Rename use64bits to use64bitint;
[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 Sat Feb 26 04:42:42 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             fi
3744             if test ! -f "$xxx"; then
3745                 xxx=$thisdir/Slib$thislib$_a
3746                 $test -f "$xxx" && eval $libscheck
3747                 $test -f "$xxx" && libstyle=static
3748             fi
3749             if $test -f "$xxx"; then
3750                 case "$libstyle" in
3751                 shared) echo "Found -l$thislib (shared)." ;;
3752                 static) echo "Found -l$thislib." ;;
3753                 *)      echo "Found -l$thislib ($libstyle)." ;;
3754                 esac
3755                 case " $dflt " in
3756                 *"-l$thislib "*);;
3757                 *) dflt="$dflt -l$thislib"
3758                    libsfound="$libsfound $xxx"
3759                    yyy=`basename $xxx`
3760                    libsfiles="$libsfiles $yyy"
3761                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3762                    case " $libsdirs " in
3763                    *" $yyy "*) ;;
3764                    *) libsdirs="$libsdirs $yyy" ;;
3765                    esac
3766                    ;;
3767                 esac
3768                 break
3769             fi  
3770         done
3771         if $test ! -f "$xxx"; then
3772             echo "No -l$thislib."
3773         fi
3774 done
3775 set X $dflt
3776 shift
3777 dflt="$*"
3778 case "$libs" in
3779 '') dflt="$dflt";;
3780 *) dflt="$libs";;
3781 esac
3782 case "$dflt" in
3783 ' '|'') dflt='none';;
3784 esac
3785
3786 $cat <<EOM
3787
3788 In order to compile $package on your machine, a number of libraries
3789 are usually needed.  Include any other special libraries here as well.
3790 Say "none" for none.  The default list is almost always right.
3791 EOM
3792
3793 echo " "
3794 rp="What libraries to use?"
3795 . ./myread
3796 case "$ans" in
3797 none) libs=' ';;
3798 *) libs="$ans";;
3799 esac
3800
3801 : determine optimization, if desired, or use for debug flag also
3802 case "$optimize" in
3803 ' '|$undef) dflt='none';;
3804 '') dflt='-O';;
3805 *) dflt="$optimize";;
3806 esac
3807 $cat <<EOH
3808
3809 By default, $package compiles with the -O flag to use the optimizer.
3810 Alternately, you might want to use the symbolic debugger, which uses
3811 the -g flag (on traditional Unix systems).  Either flag can be
3812 specified here.  To use neither flag, specify the word "none".
3813
3814 EOH
3815 rp="What optimizer/debugger flag should be used?"
3816 . ./myread
3817 optimize="$ans"
3818 case "$optimize" in
3819 'none') optimize=" ";;
3820 esac
3821
3822 dflt=''
3823 : We will not override a previous value, but we might want to
3824 : augment a hint file
3825 case "$hint" in
3826 default|recommended)
3827         case "$gccversion" in
3828         1*) dflt='-fpcc-struct-return' ;;
3829         esac
3830         case "$optimize" in
3831         *-g*) dflt="$dflt -DDEBUGGING";;
3832         esac
3833         case "$gccversion" in
3834         2*) if test -d /etc/conf/kconfig.d &&
3835                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3836                 then
3837                         dflt="$dflt -posix"
3838                 fi
3839                 ;;
3840         esac
3841         case "$gccversion" in
3842         1*) ;;
3843         2.[0-8]*) ;;
3844         ?*)     echo " "
3845                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3846                 echo 'int main(void) { return 0; }' > gcctest.c
3847                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3848                         echo "Yes, it does." 2>&1
3849                         case "$ccflags" in
3850                         *strict-aliasing*) 
3851                                 echo "Leaving current flags $ccflags alone." 2>&1
3852                                 ;;
3853                         *) dflt="$dflt -fno-strict-aliasing" ;;
3854                         esac
3855                 else
3856                         echo "Nope, it doesn't, but that's ok." 2>&1
3857                 fi
3858                 ;;
3859         esac
3860         ;;
3861 esac
3862
3863 case "$mips_type" in
3864 *BSD*|'') inclwanted="$locincpth $usrinc";;
3865 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3866 esac
3867 for thisincl in $inclwanted; do
3868         if $test -d $thisincl; then
3869                 if $test x$thisincl != x$usrinc; then
3870                         case "$dflt" in
3871                         *$thisincl*);;
3872                         *) dflt="$dflt -I$thisincl";;
3873                         esac
3874                 fi
3875         fi
3876 done
3877
3878 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3879         xxx=true;
3880 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3881         xxx=true;
3882 else
3883         xxx=false;
3884 fi;
3885 if $xxx; then
3886         case "$dflt" in
3887         *$2*);;
3888         *) dflt="$dflt -D$2";;
3889         esac;
3890 fi'
3891
3892 set signal.h LANGUAGE_C; eval $inctest
3893
3894 case "$usesocks" in
3895 $define)
3896         ccflags="$ccflags -DSOCKS"
3897         ;;
3898 esac
3899
3900 case "$hint" in
3901 default|recommended) dflt="$ccflags $dflt" ;;
3902 *) dflt="$ccflags";;
3903 esac
3904
3905 case "$dflt" in
3906 ''|' ') dflt=none;;
3907 esac
3908 $cat <<EOH
3909
3910 Your C compiler may want other flags.  For this question you should include
3911 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3912 but you should NOT include libraries or ld flags like -lwhatever.  If you
3913 want $package to honor its debug switch, you should include -DDEBUGGING here.
3914 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3915
3916 To use no flags, specify the word "none".
3917
3918 EOH
3919 set X $dflt
3920 shift
3921 dflt=${1+"$@"}
3922 rp="Any additional cc flags?"
3923 . ./myread
3924 case "$ans" in
3925 none) ccflags='';;
3926 *) ccflags="$ans";;
3927 esac
3928
3929 : the following weeds options from ccflags that are of no interest to cpp
3930 cppflags="$ccflags"
3931 case "$gccversion" in
3932 1*) cppflags="$cppflags -D__GNUC__"
3933 esac
3934 case "$mips_type" in
3935 '');;
3936 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3937 esac
3938 case "$cppflags" in
3939 '');;
3940 *)
3941         echo " "
3942         echo "Let me guess what the preprocessor flags are..." >&4
3943         set X $cppflags
3944         shift
3945         cppflags=''
3946         $cat >cpp.c <<'EOM'
3947 #define BLURFL foo
3948
3949 BLURFL xx LFRULB
3950 EOM
3951         previous=''
3952         for flag in $*
3953         do
3954                 case "$flag" in
3955                 -*) ftry="$flag";;
3956                 *) ftry="$previous $flag";;
3957                 esac
3958                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3959                         >cpp1.out 2>/dev/null && \
3960                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3961                         >cpp2.out 2>/dev/null && \
3962                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3963                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3964                 then
3965                         cppflags="$cppflags $ftry"
3966                         previous=''
3967                 else
3968                         previous="$flag"
3969                 fi
3970         done
3971         set X $cppflags
3972         shift
3973         cppflags=${1+"$@"}
3974         case "$cppflags" in
3975         *-*)  echo "They appear to be: $cppflags";;
3976         esac
3977         $rm -f cpp.c cpp?.out
3978         ;;
3979 esac
3980
3981 : flags used in final linking phase
3982 case "$ldflags" in
3983 '') if ./venix; then
3984                 dflt='-i -z'
3985         else
3986                 dflt=''
3987         fi
3988         case "$ccflags" in
3989         *-posix*) dflt="$dflt -posix" ;;
3990         esac
3991         ;;
3992 *) dflt="$ldflags";;
3993 esac
3994
3995 : Try to guess additional flags to pick up local libraries.
3996 for thislibdir in $libpth; do
3997         case " $loclibpth " in
3998         *" $thislibdir "*)
3999                 case "$dflt " in 
4000                 *"-L$thislibdir "*) ;;
4001                 *)  dflt="$dflt -L$thislibdir" ;;
4002                 esac
4003                 ;;
4004         esac
4005 done
4006
4007 case "$dflt" in
4008 '') dflt='none' ;;
4009 esac
4010
4011 $cat <<EOH
4012
4013 Your C linker may need flags.  For this question you should
4014 include -L/whatever and any other flags used by the C linker, but you
4015 should NOT include libraries like -lwhatever.
4016
4017 Make sure you include the appropriate -L/path flags if your C linker
4018 does not normally search all of the directories you specified above,
4019 namely
4020         $libpth
4021 To use no flags, specify the word "none".
4022
4023 EOH
4024
4025 rp="Any additional ld flags (NOT including libraries)?"
4026 . ./myread
4027 case "$ans" in
4028 none) ldflags='';;
4029 *) ldflags="$ans";;
4030 esac
4031 rmlist="$rmlist pdp11"
4032
4033 : coherency check
4034 echo " "
4035 echo "Checking your choice of C compiler and flags for coherency..." >&4
4036 $cat > try.c <<'EOF'
4037 #include <stdio.h>
4038 int main() { printf("Ok\n"); exit(0); }
4039 EOF
4040 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4041 shift
4042 $cat >try.msg <<'EOM'
4043 I've tried to compile and run the following simple program:
4044
4045 EOM
4046 $cat try.c >> try.msg
4047
4048 $cat >> try.msg <<EOM
4049
4050 I used the command:
4051
4052         $*
4053         ./try
4054
4055 and I got the following output:
4056
4057 EOM
4058 dflt=y
4059 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4060         if sh -c './try' >>try.msg 2>&1; then
4061                 xxx=`./try`
4062                 case "$xxx" in
4063                 "Ok") dflt=n ;;
4064                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4065                         case " $libs " in
4066                         *" -lsfio "*)
4067                                 cat >> try.msg <<'EOQS'
4068 If $libs contains -lsfio, and sfio is mis-configured, then it
4069 sometimes (apparently) runs and exits with a 0 status, but with no
4070 output!  It may have to do with sfio's use of _exit vs. exit.
4071
4072 EOQS
4073                                 rp="You have a big problem.  Shall I abort Configure"
4074                                 dflt=y
4075                                 ;;
4076                         esac
4077                         ;;
4078                 esac
4079         else
4080                 echo "The program compiled OK, but exited with status $?." >>try.msg
4081                 rp="You have a problem.  Shall I abort Configure"
4082                 dflt=y
4083         fi
4084 else
4085         echo "I can't compile the test program." >>try.msg
4086         rp="You have a BIG problem.  Shall I abort Configure"
4087         dflt=y
4088 fi
4089 case "$dflt" in
4090 y)
4091         $cat try.msg >&4
4092         case "$knowitall" in
4093         '')
4094                 echo "(The supplied flags or libraries might be incorrect.)"
4095                 ;;
4096         *) dflt=n;;
4097         esac
4098         echo " "
4099         . ./myread
4100         case "$ans" in
4101         n*|N*) ;;
4102         *)      echo "Ok.  Stopping Configure." >&4
4103                 exit 1
4104                 ;;
4105         esac
4106         ;;
4107 n) echo "OK, that should do.";;
4108 esac
4109 $rm -f try try.* core
4110
4111 : define an is-a-typedef? function
4112 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4113 case "$inclist" in
4114 "") inclist="sys/types.h";;
4115 esac;
4116 eval "varval=\$$var";
4117 case "$varval" in
4118 "")
4119         $rm -f temp.c;
4120         for inc in $inclist; do
4121                 echo "#include <$inc>" >>temp.c;
4122         done;
4123         echo "#ifdef $type" >> temp.c;
4124         echo "printf(\"We have $type\");" >> temp.c;
4125         echo "#endif" >> temp.c;
4126         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4127         if $contains $type temp.E >/dev/null 2>&1; then
4128                 eval "$var=\$type";
4129         else
4130                 eval "$var=\$def";
4131         fi;
4132         $rm -f temp.?;;
4133 *) eval "$var=\$varval";;
4134 esac'
4135
4136 : define an is-a-typedef? function that prompts if the type is not available.
4137 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138 case "$inclist" in
4139 "") inclist="sys/types.h";;
4140 esac;
4141 eval "varval=\$$var";
4142 case "$varval" in
4143 "")
4144         $rm -f temp.c;
4145         for inc in $inclist; do
4146                 echo "#include <$inc>" >>temp.c;
4147         done;
4148         echo "#ifdef $type" >> temp.c;
4149         echo "printf(\"We have $type\");" >> temp.c;
4150         echo "#endif" >> temp.c;
4151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152         echo " " ;
4153         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4154         if $contains $type temp.E >/dev/null 2>&1; then
4155                 echo "$type found." >&4;
4156                 eval "$var=\$type";
4157         else
4158                 echo "$type NOT found." >&4;
4159                 dflt="$def";
4160                 . ./myread ;
4161                 eval "$var=\$ans";
4162         fi;
4163         $rm -f temp.?;;
4164 *) eval "$var=\$varval";;
4165 esac'
4166
4167 : define a shorthand compile call
4168 compile='
4169 mc_file=$1;
4170 shift;
4171 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4172 : define a shorthand compile call for compilations that should be ok.
4173 compile_ok='
4174 mc_file=$1;
4175 shift;
4176 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4177
4178 : check for lengths of integral types
4179 echo " "
4180 case "$intsize" in
4181 '')
4182         echo "Checking to see how big your integers are..." >&4
4183         $cat >intsize.c <<'EOCP'
4184 #include <stdio.h>
4185 int main()
4186 {
4187         printf("intsize=%d;\n", (int)sizeof(int));
4188         printf("longsize=%d;\n", (int)sizeof(long));
4189         printf("shortsize=%d;\n", (int)sizeof(short));
4190         exit(0);
4191 }
4192 EOCP
4193         set intsize
4194         if eval $compile_ok && ./intsize > /dev/null; then
4195                 eval `./intsize`
4196                 echo "Your integers are $intsize bytes long."
4197                 echo "Your long integers are $longsize bytes long."
4198                 echo "Your short integers are $shortsize bytes long."
4199         else
4200                 $cat >&4 <<EOM
4201 !
4202 Help! I can't compile and run the intsize test program: please enlighten me!
4203 (This is probably a misconfiguration in your system or libraries, and
4204 you really ought to fix it.  Still, I'll try anyway.)
4205 !
4206 EOM
4207                 dflt=4
4208                 rp="What is the size of an integer (in bytes)?"
4209                 . ./myread
4210                 intsize="$ans"
4211                 dflt=$intsize
4212                 rp="What is the size of a long integer (in bytes)?"
4213                 . ./myread
4214                 longsize="$ans"
4215                 dflt=2
4216                 rp="What is the size of a short integer (in bytes)?"
4217                 . ./myread
4218                 shortsize="$ans"
4219         fi
4220         ;;
4221 esac
4222 $rm -f intsize intsize.*
4223
4224 : see what type lseek is declared as in the kernel
4225 rp="What is the type used for lseek's offset on this system?"
4226 set off_t lseektype long stdio.h sys/types.h
4227 eval $typedef_ask
4228
4229 echo " "
4230 echo "Checking to see how big your file offsets are..." >&4
4231 $cat >try.c <<EOCP
4232 #include <sys/types.h>
4233 #include <stdio.h>
4234 int main()
4235 {
4236     printf("%d\n", (int)sizeof($lseektype));
4237     return(0); 
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         lseeksize=`./try`
4243         echo "Your file offsets are $lseeksize bytes long."
4244 else
4245         dflt=$longsize
4246         echo " "
4247         echo "(I can't seem to compile the test program.  Guessing...)"
4248         rp="What is the size of your file offsets (in bytes)?"
4249         . ./myread
4250         lseeksize="$ans"
4251 fi
4252 $rm -f try.c try
4253
4254 : see what type file positions are declared as in the library
4255 rp="What is the type for file position used by fsetpos()?"
4256 set fpos_t fpostype long stdio.h sys/types.h
4257 eval $typedef_ask
4258
4259 echo " "
4260 case "$fpostype" in
4261 *_t) zzz="$fpostype"    ;;
4262 *)   zzz="fpos_t"       ;;
4263 esac
4264 echo "Checking the size of $zzz..." >&4 
4265 cat > try.c <<EOCP
4266 #include <sys/types.h>
4267 #include <stdio.h>
4268 int main() {
4269     printf("%d\n", (int)sizeof($fpostype));
4270     exit(0);
4271 }
4272 EOCP
4273 set try
4274 if eval $compile_ok; then
4275         yyy=`./try`
4276         case "$yyy" in
4277         '')     fpossize=4
4278                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4279                 ;;
4280         *)      fpossize=$yyy
4281                 echo "Your $zzz is $fpossize bytes long."
4282                 ;;
4283         esac
4284 else
4285         dflt="$longsize"
4286         echo " " >&4
4287         echo "(I can't compile the test program.  Guessing...)" >&4
4288         rp="What is the size of your file positions (in bytes)?"
4289         . ./myread
4290         fpossize="$ans"
4291 fi
4292
4293
4294
4295 # Backward compatibility (uselfs is deprecated).
4296 case "$uselfs" in
4297 "$define"|true|[yY]*)
4298         cat <<EOM >&4
4299
4300 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4301
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
4422 EOM
4423         use64bitint="$define"
4424         ;;
4425 esac                          
4426 # Backward compatibility (use64bits is deprecated).
4427 case "$use64bits" in
4428 "$define"|true|[yY]*)
4429         cat <<EOM >&4
4430
4431 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4432
4433 EOM
4434         use64bitint="$define"
4435         ;;
4436 esac                          
4437 # Thinko compatibility
4438 case "$use64bitints" in
4439 "$define"|true|[yY]*)
4440         cat <<EOM >&4
4441
4442 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4443
4444 EOM
4445         use64bitint="$define"
4446         ;;
4447 esac                          
4448
4449 case "$ccflags" in
4450 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4451 esac
4452 case "$use64bitall" in
4453 "$define"|true|[yY]*) use64bitint="$define" ;;
4454 esac
4455
4456 case "$longsize" in
4457 8) cat <<EOM
4458
4459 You have natively 64-bit long integers.
4460 EOM
4461    val="$define"
4462    ;;
4463 *) case "$use64bitint" in
4464    "$define"|true|[yY]*) dflt='y';;
4465    *) dflt='n';;
4466    esac
4467    cat <<EOM
4468
4469 Perl can be built to take advantage of 64-bit integer types
4470 on some systems.  To do so, Configure can be run with -Duse64bitint.
4471 Choosing this option will most probably introduce binary incompatibilities.
4472
4473 If this doesn't make any sense to you, just accept the default '$dflt'.
4474 EOM
4475    rp='Try to use 64-bit integers, if available?'
4476    . ./myread
4477    case "$ans" in
4478    [yY]*) val="$define" ;;
4479    *)     val="$undef"  ;;
4480    esac
4481    ;;
4482 esac
4483 set use64bitint
4484 eval $setvar
4485
4486 case "$use64bitall" in
4487 "$define"|true|[yY]*) val="$define" ;;
4488 *)      case "$use64bitint" in
4489         "$define")      case "$longsize" in
4490                         4)      dflt='n'
4491                                 cat <<EOM
4492
4493 Since you chose 64-bitness you may want to try maximal 64-bitness.
4494 What you have chosen is minimal 64-bitness which means just enough
4495 to get 64-bit integers.  The maximal means using as much 64-bitness
4496 as is possible on the platform.  This in turn means even more binary
4497 incompatibilities.  On the other hand, your platform may not have
4498 any more maximal 64-bitness than what you already have chosen.
4499
4500 If this doesn't make any sense to you, just accept the default '$dflt'.
4501 EOM
4502                                 rp='Try to use full 64-bit support, if available?'
4503                                 . ./myread
4504                                 case "$ans" in
4505                                 [yY]*) val="$define" ;;
4506                                 *)     val="$undef"  ;;
4507                                 esac
4508                                 ;;
4509                         8) val="$define" ;;
4510                         *) val="$undef" ;;
4511                         esac
4512                         ;;
4513         *)      val="$undef" ;;
4514         esac
4515         ;;
4516 esac 
4517 set use64bitall
4518 eval $setvar
4519
4520 case "$use64bitint" in
4521 "$define"|true|[yY]*)
4522 : Look for a hint-file generated 'call-back-unit'.  If the
4523 : user has specified that a 64-bit perl is to be built,
4524 : we may need to set or change some other defaults.
4525         if $test -f use64bitint.cbu; then
4526                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4527                 . ./use64bitint.cbu
4528         fi
4529         case "$longsize" in
4530         4) case "$ccflags" in
4531            *-DUSE_64_BIT_INT*) ;;
4532            *) ccflags="$ccflags -DUSE_64_BIT_INT";;
4533            esac
4534            case "$archname64" in
4535            '') archname64=64int ;;
4536            esac
4537            ;;
4538         esac
4539         ;;
4540 esac
4541
4542 case "$use64bitall" in
4543 "$define"|true|[yY]*)
4544 : Look for a hint-file generated 'call-back-unit'.  If the
4545 : user has specified that a full 64-bit perl is to be built,
4546 : we may need to set or change some other defaults.
4547         if $test -f use64bitall.cbu; then
4548                 echo "Your platform has some specific hints for full 64-bit builds, using them..."
4549                 . ./use64bitall.cbu
4550         fi
4551         case "$longsize" in
4552         4) case "$ccflags" in
4553            *-DUSE_64_BIT_ALL*) ;;
4554            *) ccflags="$ccflags -DUSE_64_BIT_ALL";;
4555            esac
4556            case "$archname64" in
4557            ''|64) archname64=64all ;;
4558            esac
4559            ;;
4560         esac
4561         ;;
4562 esac
4563
4564 : determine the architecture name
4565 echo " "
4566 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4567         tarch=`arch`"-$osname"
4568 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4569         if uname -m > tmparch 2>&1 ; then
4570                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4571                         -e 's/$/'"-$osname/" tmparch`
4572         else
4573                 tarch="$osname"
4574         fi
4575         $rm -f tmparch
4576 else
4577         tarch="$osname"
4578 fi
4579 case "$myarchname" in
4580 ''|"$tarch") ;;
4581 *)
4582         echo "(Your architecture name used to be $myarchname.)"
4583         archname=''
4584         ;;
4585 esac
4586 myarchname="$tarch"
4587 case "$archname" in
4588 '') dflt="$tarch";;
4589 *) dflt="$archname";;
4590 esac
4591 rp='What is your architecture name'
4592 . ./myread
4593 archname="$ans"
4594 case "$usethreads" in
4595 $define)
4596         echo "Threads selected." >&4
4597         case "$archname" in
4598         *-thread*) echo "...and architecture name already has -thread." >&4
4599                 ;;
4600         *)      archname="$archname-thread"
4601                 echo "...setting architecture name to $archname." >&4
4602                 ;;
4603         esac
4604         ;;
4605 esac
4606 case "$usemultiplicity" in
4607 $define)
4608         echo "Multiplicity selected." >&4
4609         case "$archname" in
4610         *-multi*) echo "...and architecture name already has -multi." >&4
4611                 ;;
4612         *)      archname="$archname-multi"
4613                 echo "...setting architecture name to $archname." >&4
4614                 ;;
4615         esac
4616         ;;
4617 esac
4618 case "$use64bitint" in
4619 $define)
4620         case "$archname64" in
4621         '')
4622                 ;;
4623         *)
4624                 case "$archname" in
4625                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4626                         ;;
4627                 *)      archname="$archname-$archname64"
4628                         echo "...setting architecture name to $archname." >&4
4629                         ;;
4630                 esac
4631                 ;;
4632         esac
4633 esac
4634
4635 : determine root of directory hierarchy where package will be installed.
4636 case "$prefix" in
4637 '')
4638         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4639         ;;
4640 *)
4641         dflt="$prefix"
4642         ;;
4643 esac
4644 $cat <<EOM
4645
4646 By default, $package will be installed in $dflt/bin, manual pages
4647 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4648 installation directories. Typically this is something like /usr/local.
4649 If you wish to have binaries under /usr/bin but other parts of the
4650 installation under /usr/local, that's ok: you will be prompted
4651 separately for each of the installation directories, the prefix being
4652 only used to set the defaults.
4653
4654 EOM
4655 fn=d~
4656 rp='Installation prefix to use?'
4657 . ./getfile
4658 oldprefix=''
4659 case "$prefix" in
4660 '') ;;
4661 *)
4662         case "$ans" in
4663         "$prefix") ;;
4664         *) oldprefix="$prefix";;
4665         esac
4666         ;;
4667 esac
4668 prefix="$ans"
4669 prefixexp="$ansexp"
4670
4671 : is AFS running?
4672 echo " "
4673 case "$afs" in
4674 $define|true)   afs=true ;;
4675 $undef|false)   afs=false ;;
4676 *)      if test -d /afs; then
4677                 afs=true
4678         else
4679                 afs=false
4680         fi
4681         ;;
4682 esac
4683 if $afs; then
4684         echo "AFS may be running... I'll be extra cautious then..." >&4
4685 else
4686         echo "AFS does not seem to be running..." >&4
4687 fi
4688
4689 : determine installation prefix for where package is to be installed.
4690 if $afs; then 
4691 $cat <<EOM
4692
4693 Since you are running AFS, I need to distinguish the directory in which
4694 files will reside from the directory in which they are installed (and from
4695 which they are presumably copied to the former directory by occult means).
4696
4697 EOM
4698         case "$installprefix" in
4699         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4700         *) dflt="$installprefix";;
4701         esac
4702 else
4703 $cat <<EOM
4704
4705 In some special cases, particularly when building $package for distribution,
4706 it is convenient to distinguish between the directory in which files should 
4707 be installed from the directory ($prefix) in which they 
4708 will eventually reside.  For most users, these two directories are the same.
4709
4710 EOM
4711         case "$installprefix" in
4712         '') dflt=$prefix ;;
4713         *) dflt=$installprefix;;
4714         esac
4715 fi
4716 fn=d~
4717 rp='What installation prefix should I use for installing files?'
4718 . ./getfile
4719 installprefix="$ans"
4720 installprefixexp="$ansexp"
4721
4722 : set the prefixit variable, to compute a suitable default value
4723 prefixit='case "$3" in
4724 ""|none)
4725         case "$oldprefix" in
4726         "") eval "$1=\"\$$2\"";;
4727         *)
4728                 case "$3" in
4729                 "") eval "$1=";;
4730                 none)
4731                         eval "tp=\"\$$2\"";
4732                         case "$tp" in
4733                         ""|" ") eval "$1=\"\$$2\"";;
4734                         *) eval "$1=";;
4735                         esac;;
4736                 esac;;
4737         esac;;
4738 *)
4739         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4740         case "$tp" in
4741         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4742         /*-$oldprefix/*|\~*-$oldprefix/*)
4743                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4744         *) eval "$1=\"\$$2\"";;
4745         esac;;
4746 esac'
4747
4748
4749 : get the patchlevel
4750 echo " "
4751 echo "Getting the current patchlevel..." >&4
4752 if $test -r $rsrc/patchlevel.h;then
4753         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4754         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4755         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4756         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4757         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4758         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4759 else
4760         revision=0
4761         patchlevel=0
4762         subversion=0
4763         api_revision=0
4764         api_version=0
4765         api_subversion=0
4766 fi
4767 $echo $n "(You have $package revision $revision" $c
4768 $echo $n " patchlevel $patchlevel" $c
4769 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4770 echo ".)"
4771 case "$osname" in
4772 dos|vms)
4773         : XXX Should be a Configure test for double-dots in filenames.
4774         version=`echo $revision $patchlevel $subversion | \
4775                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4776         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4777                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4778         ;;
4779 *)
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 esac
4786 : Special case the 5.005_xx maintenance series, which used 5.005
4787 : without any subversion label as a subdirectory in $sitelib
4788 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4789         api_versionstring='5.005'
4790 fi
4791
4792 : determine installation style
4793 : For now, try to deduce it from prefix unless it is already set.
4794 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4795 case "$installstyle" in
4796 '')     case "$prefix" in
4797                 *perl*) dflt='lib';;
4798                 *) dflt='lib/perl5' ;;
4799         esac
4800         ;;
4801 *)      dflt='lib/perl5' ;;
4802 esac
4803 : Probably not worth prompting for this since we prompt for all
4804 : the directories individually, and the prompt would be too long and
4805 : confusing anyway.
4806 installstyle=$dflt
4807
4808 : determine where private library files go
4809 : Usual default is /usr/local/lib/perl5/$version.
4810 : Also allow things like /opt/perl/lib/$version, since 
4811 : /opt/perl/lib/perl5... would be redundant.
4812 : The default "style" setting is made in installstyle.U
4813 case "$installstyle" in
4814 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4815 *)       set dflt privlib lib/$version ;;
4816 esac
4817 eval $prefixit
4818 $cat <<EOM
4819
4820 There are some auxiliary files for $package that need to be put into a
4821 private library directory that is accessible by everyone.
4822
4823 EOM
4824 fn=d~+
4825 rp='Pathname where the private library files will reside?'
4826 . ./getfile
4827 privlib="$ans"
4828 privlibexp="$ansexp"
4829 : Change installation prefix, if necessary.
4830 if $test X"$prefix" != X"$installprefix"; then
4831         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4832 else
4833         installprivlib="$privlibexp"
4834 fi
4835
4836 : set the prefixup variable, to restore leading tilda escape
4837 prefixup='case "$prefixexp" in
4838 "$prefix") ;;
4839 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4840 esac'
4841
4842 : determine where public architecture dependent libraries go
4843 set archlib archlib
4844 eval $prefixit
4845 : privlib default is /usr/local/lib/$package/$version
4846 : archlib default is /usr/local/lib/$package/$version/$archname
4847 : privlib may have an optional trailing /share.
4848 tdflt=`echo $privlib | $sed 's,/share$,,'`
4849 tdflt=$tdflt/$archname
4850 case "$archlib" in
4851 '')     dflt=$tdflt
4852         ;;
4853 *)      dflt="$archlib"
4854     ;;
4855 esac
4856 $cat <<EOM
4857
4858 $spackage contains architecture-dependent library files.  If you are
4859 sharing libraries in a heterogeneous environment, you might store
4860 these files in a separate location.  Otherwise, you can just include
4861 them with the rest of the public library files.
4862
4863 EOM
4864 fn=d+~
4865 rp='Where do you want to put the public architecture-dependent libraries?'
4866 . ./getfile
4867 archlib="$ans"
4868 archlibexp="$ansexp"
4869 if $test X"$archlib" = X"$privlib"; then
4870         d_archlib="$undef"
4871 else
4872         d_archlib="$define"
4873 fi
4874 : Change installation prefix, if necessary.
4875 if $test X"$prefix" != X"$installprefix"; then
4876         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4877 else
4878         installarchlib="$archlibexp"
4879 fi
4880
4881
4882 : Binary compatibility with 5.005 is not possible for builds
4883 : with advanced features
4884 case "$usethreads$usemultiplicity" in
4885 *define*)
4886         bincompat5005="$undef"
4887         d_bincompat5005="$undef"
4888         ;;
4889 *)      $cat <<EOM
4890
4891 Perl 5.006 can be compiled for binary compatibility with 5.005.
4892 If you decide to do so, you will be able to continue using most
4893 of the extensions that were compiled for Perl 5.005.
4894
4895 EOM
4896         case "$bincompat5005$d_bincompat5005" in
4897         *"$undef"*) dflt=n ;;
4898         *) dflt=y ;;
4899         esac
4900         rp='Binary compatibility with Perl 5.005?'
4901         . ./myread
4902         case "$ans" in
4903         y*) val="$define" ;;
4904         *)  val="$undef" ;;
4905         esac
4906         set d_bincompat5005
4907         eval $setvar
4908         case "$d_bincompat5005" in
4909         "$define")
4910                 bincompat5005="$define"
4911                 ;;
4912         *)      bincompat5005="$undef"
4913                 d_bincompat5005="$undef"
4914                 ;;
4915         esac
4916         ;;
4917 esac
4918
4919
4920 : see if setuid scripts can be secure
4921 $cat <<EOM
4922
4923 Some kernels have a bug that prevents setuid #! scripts from being
4924 secure.  Some sites have disabled setuid #! scripts because of this.
4925
4926 First let's decide if your kernel supports secure setuid #! scripts.
4927 (If setuid #! scripts would be secure but have been disabled anyway,
4928 don't say that they are secure if asked.)
4929
4930 EOM
4931
4932 val="$undef"
4933 if $test -d /dev/fd; then
4934         echo "#!$ls" >reflect
4935         chmod +x,u+s reflect
4936         ./reflect >flect 2>&1
4937         if $contains "/dev/fd" flect >/dev/null; then
4938                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4939                 val="$define"
4940         else
4941                 $cat <<EOM
4942 If you are not sure if they are secure, I can check but I'll need a
4943 username and password different from the one you are using right now.
4944 If you don't have such a username or don't want me to test, simply
4945 enter 'none'.
4946
4947 EOM
4948                 rp='Other username to test security of setuid scripts with?'
4949                 dflt='none'
4950                 . ./myread
4951                 case "$ans" in
4952                 n|none)
4953                         case "$d_suidsafe" in
4954                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4955                                 dflt=n;;
4956                         "$undef")
4957                                 echo "Well, the $hint value is *not* secure." >&4
4958                                 dflt=n;;
4959                         *)      echo "Well, the $hint value *is* secure." >&4
4960                                 dflt=y;;
4961                         esac
4962                         ;;
4963                 *)
4964                         $rm -f reflect flect
4965                         echo "#!$ls" >reflect
4966                         chmod +x,u+s reflect
4967                         echo >flect
4968                         chmod a+w flect
4969                         echo '"su" will (probably) prompt you for '"$ans's password."
4970                         su $ans -c './reflect >flect'
4971                         if $contains "/dev/fd" flect >/dev/null; then
4972                                 echo "Okay, it looks like setuid scripts are secure." >&4
4973                                 dflt=y
4974                         else
4975                                 echo "I don't think setuid scripts are secure." >&4
4976                                 dflt=n
4977                         fi
4978                         ;;
4979                 esac
4980                 rp='Does your kernel have *secure* setuid scripts?'
4981                 . ./myread
4982                 case "$ans" in
4983                 [yY]*)  val="$define";;
4984                 *)      val="$undef";;
4985                 esac
4986         fi
4987 else
4988         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4989         echo "(That's for file descriptors, not floppy disks.)"
4990         val="$undef"
4991 fi
4992 set d_suidsafe
4993 eval $setvar
4994
4995 $rm -f reflect flect
4996
4997 : now see if they want to do setuid emulation
4998 echo " "
4999 val="$undef"
5000 case "$d_suidsafe" in
5001 "$define")
5002         val="$undef"
5003         echo "No need to emulate SUID scripts since they are secure here." >& 4
5004         ;;
5005 *)
5006         $cat <<EOM
5007 Some systems have disabled setuid scripts, especially systems where
5008 setuid scripts cannot be secure.  On systems where setuid scripts have
5009 been disabled, the setuid/setgid bits on scripts are currently
5010 useless.  It is possible for $package to detect those bits and emulate
5011 setuid/setgid in a secure fashion.  This emulation will only work if
5012 setuid scripts have been disabled in your kernel.
5013
5014 EOM
5015         case "$d_dosuid" in
5016         "$define") dflt=y ;;
5017         *) dflt=n ;;
5018         esac
5019         rp="Do you want to do setuid/setgid emulation?"
5020         . ./myread
5021         case "$ans" in
5022         [yY]*)  val="$define";;
5023         *)      val="$undef";;
5024         esac
5025         ;;
5026 esac
5027 set d_dosuid
5028 eval $setvar
5029
5030 : determine filename position in cpp output
5031 echo " "
5032 echo "Computing filename position in cpp output for #include directives..." >&4
5033 echo '#include <stdio.h>' > foo.c
5034 $cat >fieldn <<EOF
5035 $startsh
5036 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5037 $grep '^[       ]*#.*stdio\.h' | \
5038 while read cline; do
5039         pos=1
5040         set \$cline
5041         while $test \$# -gt 0; do
5042                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5043                         echo "\$pos"
5044                         exit 0
5045                 fi
5046                 shift
5047                 pos=\`expr \$pos + 1\`
5048         done
5049 done
5050 EOF
5051 chmod +x fieldn
5052 fieldn=`./fieldn`
5053 $rm -f foo.c fieldn
5054 case $fieldn in
5055 '') pos='???';;
5056 1) pos=first;;
5057 2) pos=second;;
5058 3) pos=third;;
5059 *) pos="${fieldn}th";;
5060 esac
5061 echo "Your cpp writes the filename in the $pos field of the line."
5062
5063 : locate header file
5064 $cat >findhdr <<EOF
5065 $startsh
5066 wanted=\$1
5067 name=''
5068 for usrincdir in $usrinc
5069 do
5070         if test -f \$usrincdir/\$wanted; then
5071                 echo "\$usrincdir/\$wanted"
5072                 exit 0
5073         fi
5074 done
5075 awkprg='{ print \$$fieldn }'
5076 echo "#include <\$wanted>" > foo\$\$.c
5077 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5078 $grep "^[       ]*#.*\$wanted" | \
5079 while read cline; do
5080         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5081         case "\$name" in
5082         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5083         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5084         *) exit 2;;
5085         esac;
5086 done;
5087 #
5088 # status = 0: grep returned 0 lines, case statement not executed
5089 # status = 1: headerfile found
5090 # status = 2: while loop executed, no headerfile found
5091 #
5092 status=\$?
5093 $rm -f foo\$\$.c;
5094 if test \$status -eq 1; then
5095         exit 0;
5096 fi
5097 exit 1
5098 EOF
5099 chmod +x findhdr
5100
5101 : define an alternate in-header-list? function
5102 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5103 cont=true; xxf="echo \"<\$1> found.\" >&4";
5104 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5105 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5106 esac;
5107 case $# in 4) instead=instead;; *) instead="at last";; esac;
5108 while $test "$cont"; do
5109         xxx=`./findhdr $1`
5110         var=$2; eval "was=\$$2";
5111         if $test "$xxx" && $test -r "$xxx";
5112         then eval $xxf;
5113         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5114                 cont="";
5115         else eval $xxnf;
5116         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5117         set $yyy; shift; shift; yyy=$@;
5118         case $# in 0) cont="";;
5119         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5120                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5121         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5122                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5123         esac;
5124 done;
5125 while $test "$yyy";
5126 do set $yyy; var=$2; eval "was=\$$2";
5127         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5128         set $yyy; shift; shift; yyy=$@;
5129 done'
5130
5131 : see if this is a malloc.h system
5132 set malloc.h i_malloc
5133 eval $inhdr
5134
5135 : see if stdlib is available
5136 set stdlib.h i_stdlib
5137 eval $inhdr
5138
5139 : determine which malloc to compile in
5140 echo " "
5141 case "$usemymalloc" in
5142 ''|[yY]*|true|$define)  dflt='y' ;;
5143 *)      dflt='n' ;;
5144 esac
5145 rp="Do you wish to attempt to use the malloc that comes with $package?"
5146 . ./myread
5147 usemymalloc="$ans"
5148 case "$ans" in
5149 y*|true)
5150         usemymalloc='y'
5151         mallocsrc='malloc.c'
5152         mallocobj="malloc$_o"
5153         d_mymalloc="$define"
5154         case "$libs" in
5155         *-lmalloc*)
5156                 : Remove malloc from list of libraries to use
5157                 echo "Removing unneeded -lmalloc from library list" >&4
5158                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5159                 shift
5160                 libs="$*"
5161                 echo "libs = $libs" >&4
5162                 ;;
5163         esac
5164         ;;
5165 *)
5166         usemymalloc='n'
5167         mallocsrc=''
5168         mallocobj=''
5169         d_mymalloc="$undef"
5170         ;;
5171 esac
5172
5173 : compute the return types of malloc and free
5174 echo " "
5175 $cat >malloc.c <<END
5176 #$i_malloc I_MALLOC
5177 #$i_stdlib I_STDLIB
5178 #include <stdio.h>
5179 #include <sys/types.h>
5180 #ifdef I_MALLOC
5181 #include <malloc.h>
5182 #endif
5183 #ifdef I_STDLIB
5184 #include <stdlib.h>
5185 #endif
5186 #ifdef TRY_MALLOC
5187 void *malloc();
5188 #endif
5189 #ifdef TRY_FREE
5190 void free();
5191 #endif
5192 END
5193 case "$malloctype" in
5194 '')
5195         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5196                 malloctype='void *'
5197         else
5198                 malloctype='char *'
5199         fi
5200         ;;
5201 esac
5202 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5203
5204 case "$freetype" in
5205 '')
5206         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5207                 freetype='void'
5208         else
5209                 freetype='int'
5210         fi
5211         ;;
5212 esac
5213 echo "Your system uses $freetype free(), it would seem." >&4
5214 $rm -f malloc.[co]
5215 $cat <<EOM
5216
5217 The installation process will also create a directory for
5218 vendor-supplied add-ons.  Vendors who supply perl with their system
5219 may find it convenient to place all vendor-supplied files in this
5220 directory rather than in the main distribution directory.  This will
5221 ease upgrades between binary-compatible maintenance versions of perl.
5222
5223 Of course you may also use these directories in whatever way you see
5224 fit.  For example, you might use them to access modules shared over a
5225 company-wide network.
5226
5227 The default answer should be fine for most people.
5228 This causes further questions about vendor add-ons to be skipped
5229 and no vendor-specific directories will be configured for perl.
5230
5231 EOM
5232 rp='Do you want to configure vendor-specific add-on directories?'
5233 case "$usevendorprefix" in
5234 define|true|[yY]*) dflt=y ;;
5235 *)      : User may have set vendorprefix directly on Configure command line.
5236         case "$vendorprefix" in
5237         ''|' ') dflt=n ;;
5238         *)      dflt=y ;;
5239         esac
5240         ;;
5241 esac
5242 . ./myread
5243 case "$ans" in
5244 [yY]*)  fn=d~+
5245         rp='Installation prefix to use for vendor-supplied add-ons?'
5246         case "$vendorprefix" in
5247         '') dflt='' ;;
5248         *)  dflt=$vendorprefix ;;
5249         esac
5250         . ./getfile
5251         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5252         oldvendorprefix=''
5253         case "$vendorprefix" in
5254         '') ;;
5255         *)      case "$ans" in
5256                 "$prefix") ;;
5257                 *) oldvendorprefix="$prefix";;
5258                 esac
5259                 ;;
5260         esac
5261         usevendorprefix="$define"
5262         vendorprefix="$ans"
5263         vendorprefixexp="$ansexp"
5264         ;;
5265 *)      usevendorprefix="$undef"
5266         vendorprefix=''
5267         vendorprefixexp=''
5268         ;;
5269 esac
5270
5271 case "$vendorprefix" in
5272 '')     d_vendorlib="$undef"
5273         vendorlib=''
5274         vendorlibexp=''
5275         ;;
5276 *)      d_vendorlib="$define"
5277         : determine where vendor-supplied modules go.
5278         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5279         case "$vendorlib" in
5280         '')
5281                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5282                 case "$installstyle" in
5283                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5284                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5285                 esac
5286                 ;;
5287         *)      dflt="$vendorlib"
5288                 ;;
5289         esac
5290         fn=d~+
5291         rp='Pathname for the vendor-supplied library files?'
5292         . ./getfile
5293         vendorlib="$ans"
5294         vendorlibexp="$ansexp"
5295         ;;
5296 esac
5297 : Change installation prefix, if necessary.
5298 if $test X"$prefix" != X"$installprefix"; then
5299         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5300 else
5301         installvendorlib="$vendorlibexp"
5302 fi
5303
5304 : Cruising for prototypes
5305 echo " "
5306 echo "Checking out function prototypes..." >&4
5307 $cat >prototype.c <<'EOCP'
5308 int main(int argc, char *argv[]) {
5309         exit(0);}
5310 EOCP
5311 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5312         echo "Your C compiler appears to support function prototypes."
5313         val="$define"
5314 else
5315         echo "Your C compiler doesn't seem to understand function prototypes."
5316         val="$undef"
5317 fi
5318 set prototype
5319 eval $setvar
5320 $rm -f prototype*
5321
5322 case "$prototype" in
5323 "$define") ;;
5324 *)      ansi2knr='ansi2knr'
5325         echo " "
5326         cat <<EOM >&4
5327
5328 $me:  FATAL ERROR:
5329 This version of $package can only be compiled by a compiler that 
5330 understands function prototypes.  Unfortunately, your C compiler 
5331         $cc $ccflags
5332 doesn't seem to understand them.  Sorry about that.
5333
5334 If GNU cc is available for your system, perhaps you could try that instead.  
5335
5336 Eventually, we hope to support building Perl with pre-ANSI compilers.
5337 If you would like to help in that effort, please contact <perlbug@perl.org>.
5338
5339 Aborting Configure now.
5340 EOM
5341         exit 2
5342         ;;
5343 esac
5344
5345 : determine where public executables go
5346 echo " "
5347 set dflt bin bin
5348 eval $prefixit
5349 fn=d~
5350 rp='Pathname where the public executables will reside?'
5351 . ./getfile
5352 if $test "X$ansexp" != "X$binexp"; then
5353         installbin=''
5354 fi
5355 bin="$ans"
5356 binexp="$ansexp"
5357 : Change installation prefix, if necessary.
5358 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5359 if $test X"$prefix" != X"$installprefix"; then
5360         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5361 else
5362         installbin="$binexp"
5363 fi
5364
5365 : Find perl5.005 or later.
5366 echo "Looking for a previously installed perl5.005 or later... "
5367 case "$perl5" in
5368 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5369                 : Check if this perl is recent and can load a simple module
5370                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5371                         perl5=$tdir/perl
5372                         break;
5373                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5374                         perl5=$tdir/perl
5375                         break;
5376                 fi
5377         done
5378         ;;
5379 *)      perl5="$perl5"
5380         ;;
5381 esac
5382 case "$perl5" in
5383 '')     echo "None found.  That's ok.";;
5384 *)      echo "Using $perl5." ;;
5385 esac
5386
5387 $cat <<EOM
5388
5389 After $package is installed, you may wish to install various
5390 add-on modules and utilities.  Typically, these add-ons will
5391 be installed under $prefix with the rest
5392 of this package.  However, you may wish to install such add-ons
5393 elsewhere under a different prefix.
5394
5395 If you do not wish to put everything under a single prefix, that's
5396 ok.  You will be prompted for the individual locations; this siteprefix
5397 is only used to suggest the defaults.
5398
5399 The default should be fine for most people.
5400
5401 EOM
5402 fn=d~+
5403 rp='Installation prefix to use for add-on modules and utilities?'
5404 : XXX Here might be another good place for an installstyle setting.
5405 case "$siteprefix" in
5406 '') dflt=$prefix ;;
5407 *)  dflt=$siteprefix ;;
5408 esac
5409 . ./getfile
5410 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5411 oldsiteprefix=''
5412 case "$siteprefix" in
5413 '') ;;
5414 *)      case "$ans" in
5415         "$prefix") ;;
5416         *) oldsiteprefix="$prefix";;
5417         esac
5418         ;;
5419 esac
5420 siteprefix="$ans"
5421 siteprefixexp="$ansexp"
5422
5423 : determine where site specific libraries go.
5424 : Usual default is /usr/local/lib/perl5/site_perl/$version
5425 : The default "style" setting is made in installstyle.U
5426 : XXX No longer works with Prefixit stuff.
5427 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5428 case "$sitelib" in
5429 '') case "$installstyle" in
5430         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5431         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5432         esac
5433         ;;
5434 *)      dflt="$sitelib"
5435         ;;
5436 esac
5437 $cat <<EOM
5438
5439 The installation process will create a directory for
5440 site-specific extensions and modules.  Most users find it convenient
5441 to place all site-specific files in this directory rather than in the
5442 main distribution directory.
5443
5444 EOM
5445 fn=d~+
5446 rp='Pathname for the site-specific library files?'
5447 . ./getfile
5448 sitelib="$ans"
5449 sitelibexp="$ansexp"
5450 : Change installation prefix, if necessary.
5451 if $test X"$prefix" != X"$installprefix"; then
5452         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5453 else
5454         installsitelib="$sitelibexp"
5455 fi
5456
5457 : Determine list of previous versions to include in @INC
5458 $cat > getverlist <<EOPL
5459 #!$perl5 -w
5460 use File::Basename;
5461 \$api_versionstring = "$api_versionstring";
5462 \$version = "$version";
5463 \$sitelib = "$sitelib";
5464 \$archname = "$archname";
5465 EOPL
5466         $cat >> getverlist <<'EOPL'
5467 # Can't have leading @ because metaconfig interprets it as a command!
5468 ;@inc_version_list=();
5469 $stem=dirname($sitelib);
5470 # XXX Redo to do opendir/readdir? 
5471 if (-d $stem) {
5472     chdir($stem);
5473     ;@candidates = glob("5.*");
5474 }
5475 else {
5476     ;@candidates = ();
5477 }
5478
5479 # XXX ToDo:  These comparisons must be reworked when two-digit
5480 # subversions come along, so that 5.7.10 compares as greater than
5481 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5482 # widespread that we can use the built-in version vectors rather
5483 # than reinventing them here.  For 5.6.0, however, we must
5484 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5485 foreach $d (@candidates) {
5486     if ($d lt $version) {
5487         if ($d ge $api_versionstring) {
5488             unshift(@inc_version_list, "$d/$archname", $d);
5489         }
5490         elsif ($d ge "5.005") {
5491             unshift(@inc_version_list, $d);
5492         }
5493     }
5494     else {
5495         # Skip newer version.  I.e. don't look in
5496         # 5.7.0 if we're installing 5.6.1.
5497     }
5498 }
5499
5500 if (@inc_version_list) {
5501     print join(' ', @inc_version_list);
5502 }
5503 else {
5504     # Blank space to preserve value for next Configure run.
5505     print " ";
5506 }
5507 EOPL
5508 chmod +x getverlist
5509 case "$inc_version_list" in
5510 '')     if test -x "$perl5"; then
5511                 dflt=`$perl5 getverlist`
5512         else
5513                 dflt='none'
5514         fi
5515         ;;
5516 $undef) dflt='none' ;;
5517 *)  dflt="$inc_version_list" ;;
5518 esac
5519 case "$dflt" in
5520 ''|' ') dflt=none ;;
5521 esac
5522 $cat <<'EOM'
5523
5524 In order to ease the process of upgrading, this version of perl 
5525 can be configured to use modules built and installed with earlier 
5526 versions of perl that were installed under $prefix.  Specify here
5527 the list of earlier versions that this version of perl should check.
5528 If Configure detected no earlier versions of perl installed under
5529 $prefix, then the list will be empty.  Answer 'none' to tell perl
5530 to not search earlier versions.
5531
5532 The default should almost always be sensible, so if you're not sure,
5533 just accept the default.
5534 EOM
5535
5536 rp='List of earlier versions to include in @INC?'
5537 . ./myread
5538 case "$ans" in
5539 [Nn]one|''|' ') inc_version_list=' ' ;;
5540 *) inc_version_list="$ans" ;;
5541 esac
5542 case "$inc_version_list" in
5543 ''|' ') 
5544         inc_version_list_init='0';;
5545 *)      inc_version_list_init=`echo $inc_version_list |
5546                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5547         ;;
5548 esac
5549 $rm -f getverlist
5550
5551 : determine whether to install perl also as /usr/bin/perl
5552
5553 echo " "
5554 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5555         $cat <<EOM
5556 Many scripts expect to perl to be installed as /usr/bin/perl.
5557 I can install the perl you are about to compile also as /usr/bin/perl
5558 (in addition to $installbin/perl).
5559 EOM
5560         case "$installusrbinperl" in
5561         "$undef"|[nN]*) dflt='n';;
5562         *)              dflt='y';;
5563         esac
5564         rp="Do you want to install perl as /usr/bin/perl?"
5565         . ./myread
5566         case "$ans" in
5567         [yY]*)  val="$define";;
5568         *)      val="$undef" ;;
5569         esac
5570 else
5571         val="$undef"
5572 fi
5573 set installusrbinperl
5574 eval $setvar
5575
5576 echo " "
5577 echo "Checking for GNU C Library..." >&4
5578 cat >gnulibc.c <<EOM
5579 #include <stdio.h>
5580 int main()
5581 {
5582 #ifdef __GLIBC__
5583     exit(0);
5584 #else
5585     exit(1);
5586 #endif
5587 }
5588 EOM
5589 set gnulibc
5590 if eval $compile_ok && ./gnulibc; then
5591         val="$define"
5592         echo "You are using the GNU C Library"
5593 else
5594         val="$undef"
5595         echo "You are not using the GNU C Library"
5596 fi
5597 $rm -f gnulibc*
5598 set d_gnulibc
5599 eval $setvar
5600
5601 : see if nm is to be used to determine whether a symbol is defined or not
5602 case "$usenm" in
5603 '')
5604         dflt=''
5605         case "$d_gnulibc" in
5606         "$define")
5607                 echo " "
5608                 echo "nm probably won't work on the GNU C Library." >&4
5609                 dflt=n
5610                 ;;
5611         esac
5612         case "$dflt" in
5613         '') 
5614                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5615                         echo " "
5616                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5617                         echo "'nm' won't be sufficient on this sytem." >&4
5618                         dflt=n
5619                 fi
5620                 ;;
5621         esac
5622         case "$dflt" in
5623         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5624                 if $test $dflt -gt 20; then
5625                         dflt=y
5626                 else
5627                         dflt=n
5628                 fi
5629                 ;;
5630         esac
5631         ;;
5632 *)
5633         case "$usenm" in
5634         true|$define) dflt=y;;
5635         *) dflt=n;;
5636         esac
5637         ;;
5638 esac
5639 $cat <<EOM
5640
5641 I can use $nm to extract the symbols from your C libraries. This
5642 is a time consuming task which may generate huge output on the disk (up
5643 to 3 megabytes) but that should make the symbols extraction faster. The
5644 alternative is to skip the 'nm' extraction part and to compile a small
5645 test program instead to determine whether each symbol is present. If
5646 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5647 this may be the best solution.
5648
5649 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5650
5651 EOM
5652 rp="Shall I use $nm to extract C symbols from the libraries?"
5653 . ./myread
5654 case "$ans" in
5655 [Nn]*) usenm=false;;
5656 *) usenm=true;;
5657 esac
5658
5659 runnm=$usenm
5660 case "$reuseval" in
5661 true) runnm=false;;
5662 esac
5663
5664 : nm options which may be necessary
5665 case "$nm_opt" in
5666 '') if $test -f /mach_boot; then
5667                 nm_opt=''       # Mach
5668         elif $test -d /usr/ccs/lib; then
5669                 nm_opt='-p'     # Solaris (and SunOS?)
5670         elif $test -f /dgux; then
5671                 nm_opt='-p'     # DG-UX
5672         elif $test -f /lib64/rld; then
5673                 nm_opt='-p'     # 64-bit Irix
5674         else
5675                 nm_opt=''
5676         fi;;
5677 esac
5678
5679 : nm options which may be necessary for shared libraries but illegal
5680 : for archive libraries.  Thank you, Linux.
5681 case "$nm_so_opt" in
5682 '')     case "$myuname" in
5683         *linux*)
5684                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5685                         nm_so_opt='--dynamic'
5686                 fi
5687                 ;;
5688         esac
5689         ;;
5690 esac
5691
5692 case "$runnm" in
5693 true)
5694 : get list of predefined functions in a handy place
5695 echo " "
5696 case "$libc" in
5697 '') libc=unknown
5698         case "$libs" in
5699         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5700         esac
5701         ;;
5702 esac
5703 libnames='';
5704 case "$libs" in
5705 '') ;;
5706 *)  for thislib in $libs; do
5707         case "$thislib" in
5708         -lc|-lc_s)
5709                 : Handle C library specially below.
5710                 ;;
5711         -l*)
5712                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5713                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5714                         :
5715                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5716                         :
5717                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5718                         :
5719                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5720                         :
5721                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5722                         :
5723                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5724                         :
5725                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5726                         :
5727                 else
5728                         try=''
5729                 fi
5730                 libnames="$libnames $try"
5731                 ;;
5732         *) libnames="$libnames $thislib" ;;
5733         esac
5734         done
5735         ;;
5736 esac
5737 xxx=normal
5738 case "$libc" in
5739 unknown)
5740         set /lib/libc.$so
5741         for xxx in $libpth; do
5742                 $test -r $1 || set $xxx/libc.$so
5743                 : The messy sed command sorts on library version numbers.
5744                 $test -r $1 || \
5745                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5746                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5747                                 h
5748                                 s/[0-9][0-9]*/0000&/g
5749                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5750                                 G
5751                                 s/\n/ /' | \
5752                          sort | $sed -e 's/^.* //'`
5753                 eval set \$$#
5754         done
5755         $test -r $1 || set /usr/ccs/lib/libc.$so
5756         $test -r $1 || set /lib/libsys_s$_a
5757         ;;
5758 *)
5759         set blurfl
5760         ;;
5761 esac
5762 if $test -r "$1"; then
5763         echo "Your (shared) C library seems to be in $1."
5764         libc="$1"
5765 elif $test -r /lib/libc && $test -r /lib/clib; then
5766         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5767         xxx=apollo
5768         libc='/lib/clib /lib/libc'
5769         if $test -r /lib/syslib; then
5770                 echo "(Your math library is in /lib/syslib.)"
5771                 libc="$libc /lib/syslib"
5772         fi
5773 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5774         echo "Your C library seems to be in $libc, as you said before."
5775 elif $test -r $incpath/usr/lib/libc$_a; then
5776         libc=$incpath/usr/lib/libc$_a;
5777         echo "Your C library seems to be in $libc.  That's fine."
5778 elif $test -r /lib/libc$_a; then
5779         libc=/lib/libc$_a;
5780         echo "Your C library seems to be in $libc.  You're normal."
5781 else
5782         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5783                 :
5784         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5785                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5786         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5787                 :
5788         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5789                 :
5790         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5791                 :
5792         else
5793                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5794         fi
5795         if $test -r "$tans"; then
5796                 echo "Your C library seems to be in $tans, of all places."
5797                 libc=$tans
5798         else
5799                 libc='blurfl'
5800         fi
5801 fi
5802 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5803         dflt="$libc"
5804         cat <<EOM
5805
5806 If the guess above is wrong (which it might be if you're using a strange
5807 compiler, or your machine supports multiple models), you can override it here.
5808
5809 EOM
5810 else
5811         dflt=''
5812         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5813         cat >&4 <<EOM
5814 I can't seem to find your C library.  I've looked in the following places:
5815
5816 EOM
5817         $sed 's/^/      /' libpath
5818         cat <<EOM
5819
5820 None of these seems to contain your C library. I need to get its name...
5821
5822 EOM
5823 fi
5824 fn=f
5825 rp='Where is your C library?'
5826 . ./getfile
5827 libc="$ans"
5828
5829 echo " "
5830 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5831 set X `cat libnames`
5832 shift
5833 xxx=files
5834 case $# in 1) xxx=file; esac
5835 echo "Extracting names from the following $xxx for later perusal:" >&4
5836 echo " "
5837 $sed 's/^/      /' libnames >&4
5838 echo " "
5839 $echo $n "This may take a while...$c" >&4
5840
5841 for file in $*; do
5842         case $file in
5843         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5844         *) $nm $nm_opt $file 2>/dev/null;;
5845         esac
5846 done >libc.tmp
5847
5848 $echo $n ".$c"
5849 $grep fprintf libc.tmp > libc.ptf
5850 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5851 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5852 xxx='[ADTSIW]'
5853 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5854         eval $xscan;\
5855         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5856                 eval $xrun
5857 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5858         eval $xscan;\
5859         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5860                 eval $xrun
5861 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5862         eval $xscan;\
5863         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5864                 eval $xrun
5865 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5866         eval $xscan;\
5867         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5868                 eval $xrun
5869 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5870         eval $xscan;\
5871         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5872                 eval $xrun
5873 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5874         eval $xscan;\
5875         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5876                 eval $xrun
5877 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5878                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5879         eval $xscan;\
5880         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5881                 eval $xrun
5882 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5883         eval $xscan;\
5884         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5885                 eval $xrun
5886 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5887         eval $xscan;\
5888         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5889                 eval $xrun
5890 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5891         eval $xscan;\
5892         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5893                 eval $xrun
5894 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5895         eval $xscan;\
5896         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5897                 eval $xrun
5898 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5899         eval $xscan;\
5900         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5901                 eval $xrun
5902 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5903         eval $xscan;\
5904         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5905                 eval $xrun
5906 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5907         eval $xscan;\
5908         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5909                 eval $xrun
5910 else
5911         $nm -p $* 2>/dev/null >libc.tmp
5912         $grep fprintf libc.tmp > libc.ptf
5913         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5914                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5915         then
5916                 nm_opt='-p'
5917                 eval $xrun
5918         else
5919                 echo " "
5920                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5921                 com=''
5922                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5923                         for thisname in $libnames $libc; do
5924                                 $ar t $thisname >>libc.tmp
5925                         done
5926                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5927                         echo "Ok." >&4
5928                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5929                         # Repeat libc to extract forwarders to DLL entries too
5930                         for thisname in $libnames $libc; do
5931                                 $ar tv $thisname >>libc.tmp
5932                                 # Revision 50 of EMX has bug in $ar.
5933                                 # it will not extract forwarders to DLL entries
5934                                 # Use emximp which will extract exactly them.
5935                                 emximp -o tmp.imp $thisname \
5936                                     2>/dev/null && \
5937                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5938                                     < tmp.imp >>libc.tmp
5939                                 $rm tmp.imp
5940                         done
5941                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5942                         echo "Ok." >&4
5943                 else
5944                         echo "$ar didn't seem to work right." >&4
5945                         echo "Maybe this is a Cray...trying bld instead..." >&4
5946                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5947                         then
5948                                 for thisname in $libnames; do
5949                                         bld t $libnames | \
5950                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5951                                         $ar t $thisname >>libc.tmp
5952                                 done
5953                                 echo "Ok." >&4
5954                         else
5955                                 echo "That didn't work either.  Giving up." >&4
5956                                 exit 1
5957                         fi
5958                 fi
5959         fi
5960 fi
5961 nm_extract="$com"
5962 if $test -f /lib/syscalls.exp; then
5963         echo " "
5964         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5965         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5966 fi
5967 ;;
5968 esac
5969 $rm -f libnames libpath
5970
5971 : see if dld is available
5972 set dld.h i_dld
5973 eval $inhdr
5974
5975 : is a C symbol defined?
5976 csym='tlook=$1;
5977 case "$3" in
5978 -v) tf=libc.tmp; tc=""; tdc="";;
5979 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5980 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5981 esac;
5982 tx=yes;
5983 case "$reuseval-$4" in
5984 true-) ;;
5985 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5986 esac;
5987 case "$tx" in
5988 yes)
5989         case "$runnm" in
5990         true)
5991                 if $contains $tlook $tf >/dev/null 2>&1;
5992                 then tval=true;
5993                 else tval=false;
5994                 fi;;
5995         *)
5996                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5997                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5998                 then tval=true;
5999                 else tval=false;
6000                 fi;
6001                 $rm -f t t.c;;
6002         esac;;
6003 *)
6004         case "$tval" in
6005         $define) tval=true;;
6006         *) tval=false;;
6007         esac;;
6008 esac;
6009 eval "$2=$tval"'
6010
6011 : define an is-in-libc? function
6012 inlibc='echo " "; td=$define; tu=$undef;
6013 sym=$1; var=$2; eval "was=\$$2";
6014 tx=yes;
6015 case "$reuseval$was" in
6016 true) ;;
6017 true*) tx=no;;
6018 esac;
6019 case "$tx" in
6020 yes)
6021         set $sym tres -f;
6022         eval $csym;
6023         case "$tres" in
6024         true)
6025                 echo "$sym() found." >&4;
6026                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6027         *)
6028                 echo "$sym() NOT found." >&4;
6029                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6030         esac;;
6031 *)
6032         case "$was" in
6033         $define) echo "$sym() found." >&4;;
6034         *) echo "$sym() NOT found." >&4;;
6035         esac;;
6036 esac'
6037
6038 : see if dlopen exists
6039 xxx_runnm="$runnm"
6040 runnm=false
6041 set dlopen d_dlopen
6042 eval $inlibc
6043 runnm="$xxx_runnm"
6044
6045 : determine which dynamic loading, if any, to compile in
6046 echo " "
6047 dldir="ext/DynaLoader"
6048 case "$usedl" in
6049 $define|y|true)
6050         dflt='y'
6051         usedl="$define"
6052         ;;
6053 $undef|n|false)
6054         dflt='n'
6055         usedl="$undef"
6056         ;;
6057 *) 
6058         dflt='n'
6059         case "$d_dlopen" in
6060             $define) dflt='y' ;;
6061         esac
6062         case "$i_dld" in
6063             $define) dflt='y' ;;
6064         esac
6065         : Does a dl_xxx.xs file exist for this operating system
6066         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6067         ;;
6068 esac
6069 rp="Do you wish to use dynamic loading?"
6070 . ./myread
6071 usedl="$ans"
6072 case "$ans" in
6073 y*) usedl="$define"
6074         case "$dlsrc" in
6075         '')
6076                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6077                         dflt="$dldir/dl_${osname}.xs"
6078                 elif $test "$d_dlopen" = "$define" ; then
6079                         dflt="$dldir/dl_dlopen.xs"
6080                 elif $test "$i_dld" = "$define" ; then
6081                         dflt="$dldir/dl_dld.xs"
6082                 else
6083                         dflt=''
6084                 fi
6085                 ;;
6086         *)      dflt="$dldir/$dlsrc"
6087                 ;;
6088         esac
6089     echo "The following dynamic loading files are available:"
6090         : Can not go over to $dldir because getfile has path hard-coded in.
6091         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6092         rp="Source file to use for dynamic loading"
6093         fn="fne"
6094         gfpth="$src"
6095         . ./getfile
6096         usedl="$define"
6097         : emulate basename
6098         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6099
6100         $cat << EOM
6101
6102 Some systems may require passing special flags to $cc -c to
6103 compile modules that will be used to create a shared library.
6104 To use no flags, say "none".
6105
6106 EOM
6107     case "$cccdlflags" in
6108     '') case "$gccversion" in
6109                 '') case "$osname" in
6110                         hpux)   dflt='+z' ;;
6111                         next)   dflt='none' ;;
6112                         irix*)  dflt='-KPIC' ;;
6113                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6114                         sunos)  dflt='-pic' ;;
6115                         *)      dflt='none' ;;
6116                     esac
6117                         ;;
6118                 *)  case "$osname" in
6119                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6120                         *)      dflt='-fpic' ;;
6121                     esac ;;
6122             esac ;;
6123         ' ') dflt='none' ;;
6124     *)  dflt="$cccdlflags" ;;
6125     esac
6126     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6127     . ./myread
6128     case "$ans" in
6129     none) cccdlflags=' ' ;;
6130     *) cccdlflags="$ans" ;;
6131     esac
6132
6133     cat << EOM
6134
6135 Some systems use ld to create libraries that can be dynamically loaded,
6136 while other systems (such as those using ELF) use $cc.
6137
6138 EOM
6139         case "$ld" in
6140         '')     $cat >try.c <<'EOM'
6141 /* Test for whether ELF binaries are produced */
6142 #include <fcntl.h>
6143 #include <stdlib.h>
6144 int main() {
6145         char b[4];
6146         int i = open("a.out",O_RDONLY);
6147         if(i == -1) 
6148                 exit(1); /* fail */
6149         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6150                 exit(0); /* succeed (yes, it's ELF) */
6151         else
6152                 exit(1); /* fail */
6153 }
6154 EOM
6155                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6156                         cat <<EOM
6157 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6158 EOM
6159                         dflt="$cc"
6160                 else
6161                         echo "I'll use ld to build dynamic libraries."
6162                         dflt='ld'
6163                 fi
6164                 rm -f try.c a.out
6165                 ;;
6166         *)      dflt="$ld"
6167                 ;;
6168         esac
6169
6170     rp="What command should be used to create dynamic libraries?"
6171     . ./myread
6172         ld="$ans"
6173
6174     cat << EOM
6175
6176 Some systems may require passing special flags to $ld to create a
6177 library that can be dynamically loaded.  If your ld flags include
6178 -L/other/path options to locate libraries outside your loader's normal
6179 search path, you may need to specify those -L options here as well.  To
6180 use no flags, say "none".
6181
6182 EOM
6183     case "$lddlflags" in
6184     '') case "$osname" in
6185                         beos) dflt='-nostart' ;;
6186                         hpux)  dflt='-b +vnocompatwarnings' ;;
6187                         linux|irix*)    dflt='-shared' ;;
6188                         next)  dflt='none' ;;
6189                         solaris) dflt='-G' ;;
6190                         sunos) dflt='-assert nodefinitions' ;;
6191                         svr4*|esix*) dflt="-G $ldflags" ;;
6192                 *)     dflt='none' ;;
6193                         esac
6194                         ;;
6195     *) dflt="$lddlflags" ;;
6196     esac
6197
6198         : Try to guess additional flags to pick up local libraries.
6199         : Be careful not to append to a plain 'none'
6200         case "$dflt" in
6201         none) dflt='' ;;
6202         esac
6203         for thisflag in $ldflags; do
6204                 case "$thisflag" in
6205                 -L*)
6206                         case " $dflt " in
6207                         *" $thisflag "*) ;;
6208                         *) dflt="$dflt $thisflag" ;;
6209                         esac
6210                         ;;
6211                 esac
6212         done
6213
6214         case "$dflt" in
6215         ''|' ') dflt='none' ;;
6216         esac
6217
6218     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6219     . ./myread
6220     case "$ans" in
6221     none) lddlflags=' ' ;;
6222     *) lddlflags="$ans" ;;
6223     esac
6224
6225         cat <<EOM
6226
6227 Some systems may require passing special flags to $cc to indicate that
6228 the resulting executable will use dynamic linking.  To use no flags,
6229 say "none".
6230
6231 EOM
6232     case "$ccdlflags" in
6233     '') case "$osname" in
6234                 hpux)   dflt='-Wl,-E' ;;
6235                 linux)  dflt='-rdynamic' ;;
6236                 next)   dflt='none' ;;
6237                 sunos)  dflt='none' ;;
6238                 *)      dflt='none' ;;
6239             esac ;;
6240     ' ')  dflt='none' ;;
6241     *)  dflt="$ccdlflags" ;;
6242     esac
6243     rp="Any special flags to pass to $cc to use dynamic linking?"
6244     . ./myread
6245     case "$ans" in
6246     none) ccdlflags=' ' ;;
6247     *) ccdlflags="$ans" ;;
6248     esac
6249     ;;
6250 *)  usedl="$undef"
6251         ld='ld'
6252     dlsrc='dl_none.xs'
6253     lddlflags=''
6254     ccdlflags=''
6255     ;;
6256 esac
6257
6258 also=''
6259 case "$usedl" in
6260 $undef)
6261         # No dynamic loading being used, so don't bother even to prompt.
6262         useshrplib='false'
6263         ;;
6264 *)      case "$useshrplib" in
6265         '')     case "$osname" in
6266                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6267                         dflt=y
6268                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6269                         ;;
6270                 next*)
6271                         case "$osvers" in
6272                         4*)     dflt=y
6273                                 also='Building a shared libperl is needed for MAB support.'
6274                                 ;;
6275                         *)      dflt=n
6276                                 ;;
6277                         esac
6278                         ;;
6279                 *)      dflt=n
6280                         ;;
6281                 esac
6282                 ;;
6283         $define|true|[Yy]*)
6284                 dflt=y
6285                 ;;
6286         *)      dflt=n
6287                 ;;
6288         esac
6289         $cat << EOM
6290
6291 The perl executable is normally obtained by linking perlmain.c with
6292 libperl${_a}, any static extensions (usually just DynaLoader), and
6293 any other libraries needed on this system (such as -lm, etc.).  Since
6294 your system supports dynamic loading, it is probably possible to build
6295 a shared libperl.$so.  If you will have more than one executable linked
6296 to libperl.$so, this will significantly reduce the size of each
6297 executable, but it may have a noticeable affect on performance.  The
6298 default is probably sensible for your system.
6299 $also
6300
6301 EOM
6302         rp="Build a shared libperl.$so (y/n)"
6303         . ./myread
6304         case "$ans" in
6305         true|$define|[Yy]*)
6306                 useshrplib='true'  ;;
6307         *)      useshrplib='false' ;;
6308         esac
6309         ;;
6310 esac
6311
6312 case "$useshrplib" in
6313 true)
6314         case "$libperl" in
6315         '')
6316                 # Figure out a good name for libperl.so.  Since it gets stored in
6317                 # a version-specific architecture-dependent library, the version
6318                 # number isn't really that important, except for making cc/ld happy.
6319                 #
6320                 # A name such as libperl.so.3.1
6321                 majmin="libperl.$so.$patchlevel.$subversion"
6322                 # A name such as libperl.so.301
6323                 majonly=`echo $patchlevel $subversion |
6324                         $awk '{printf "%d%02d", $1, $2}'`
6325                 majonly=libperl.$so.$majonly
6326                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6327                 # rely on figuring it out from the naming of libc.
6328                 case "${osname}${osvers}" in
6329                 next4*)
6330                         dflt=libperl.5.$so
6331                         # XXX How handle the --version stuff for MAB?
6332                         ;;
6333                 linux*)  # ld won't link with a bare -lperl otherwise.
6334                         dflt=libperl.$so
6335                         ;;
6336                 cygwin*) # include version
6337                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6338                         ;;
6339                 *)      # Try to guess based on whether libc has major.minor.
6340                         case "$libc" in
6341                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6342                         *libc.$so.[0-9]*) dflt=$majonly ;;
6343                         *)      dflt=libperl.$so ;;
6344                         esac
6345                         ;;
6346                 esac
6347                 ;;
6348         *)      dflt=$libperl
6349                 ;;
6350         esac
6351         cat << EOM
6352
6353 I need to select a good name for the shared libperl.  If your system uses
6354 library names with major and minor numbers, then you might want something
6355 like $majmin.  Alternatively, if your system uses a single version
6356 number for shared libraries, then you might want to use $majonly.
6357 Or, your system might be quite happy with a simple libperl.$so.
6358
6359 Since the shared libperl will get installed into a version-specific
6360 architecture-dependent directory, the version number of the shared perl
6361 library probably isn't important, so the default should be o.k.
6362
6363 EOM
6364         rp='What name do you want to give to the shared libperl?'
6365         . ./myread
6366         libperl=$ans
6367         echo "Ok, I'll use $libperl"
6368         ;;
6369 *)
6370         libperl="libperl${_a}"
6371         ;;
6372 esac
6373
6374 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6375 case "$shrpdir" in
6376 '') ;;
6377 *)      $cat >&4 <<EOM
6378 WARNING:  Use of the shrpdir variable for the installation location of
6379 the shared $libperl is not supported.  It was never documented and
6380 will not work in this version.  Let me (perlbug@perl.com)
6381 know of any problems this may cause.
6382
6383 EOM
6384         case "$shrpdir" in
6385         "$archlibexp/CORE")
6386                 $cat >&4 <<EOM
6387 But your current setting of $shrpdir is
6388 the default anyway, so it's harmless.
6389 EOM
6390                 ;;
6391         *)
6392                 $cat >&4 <<EOM
6393 Further, your current attempted setting of $shrpdir
6394 conflicts with the value of $archlibexp/CORE
6395 that installperl will use.
6396 EOM
6397                 ;;
6398         esac
6399         ;;
6400 esac
6401
6402 # How will the perl executable find the installed shared $libperl?
6403 # Add $xxx to ccdlflags.
6404 # If we can't figure out a command-line option, use $shrpenv to
6405 # set env LD_RUN_PATH.  The main perl makefile uses this.
6406 shrpdir=$archlibexp/CORE
6407 xxx=''
6408 tmp_shrpenv=''
6409 if "$useshrplib"; then
6410     case "$osname" in 
6411         aix)
6412                 # We'll set it in Makefile.SH...
6413                 ;;
6414         solaris|netbsd)
6415                 xxx="-R $shrpdir"
6416                 ;;
6417         freebsd)
6418                 xxx="-Wl,-R$shrpdir"
6419                 ;;
6420         linux|irix*|dec_osf)
6421                 xxx="-Wl,-rpath,$shrpdir"
6422                 ;;
6423         next)
6424                 # next doesn't like the default...
6425                 ;;
6426         beos)
6427                 # beos doesn't like the default, either.
6428                 ;;
6429         hpux*)
6430                 # hpux doesn't like the default, either.
6431                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6432                 ;;
6433         *)
6434                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6435                 ;;
6436         esac
6437         case "$xxx" in
6438         '') ;;
6439         *)      
6440                 # Only add $xxx if it isn't already in ccdlflags.
6441                 case " $ccdlflags " in
6442                 *" $xxx "*)     ;;
6443                 *)      ccdlflags="$ccdlflags $xxx"
6444                         cat <<EOM >&4
6445
6446 Adding $xxx to the flags
6447 passed to $ld so that the perl executable will find the 
6448 installed shared $libperl.
6449
6450 EOM
6451                         ;;
6452                 esac
6453                 ;;
6454         esac
6455 fi
6456 # Fix ccdlflags in AIX for building external extensions.
6457 # (For building Perl itself bare -bE:perl.exp is needed,
6458 #  Makefile.SH takes care of this.)
6459 case "$osname" in
6460 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6461 esac
6462 # Respect a hint or command-line value.
6463 case "$shrpenv" in
6464 '') shrpenv="$tmp_shrpenv" ;;
6465 esac
6466 case "$ldlibpthname" in
6467 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6468 none)   ldlibpthname='' ;;
6469 esac
6470
6471 : determine where manual pages go
6472 set man1dir man1dir none
6473 eval $prefixit
6474 $cat <<EOM
6475
6476 $spackage has manual pages available in source form.
6477 EOM
6478 case "$nroff" in
6479 nroff)
6480         echo "However, you don't have nroff, so they're probably useless to you."
6481         case "$man1dir" in
6482         '') man1dir="none";;
6483         esac;;
6484 esac
6485 echo "If you don't want the manual sources installed, answer 'none'."
6486 case "$man1dir" in
6487 ' ') dflt=none
6488         ;;
6489 '')
6490         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6491         lookpath="$lookpath $prefixexp/man/p_man/man1"
6492         lookpath="$lookpath $prefixexp/man/u_man/man1"
6493         lookpath="$lookpath $prefixexp/man/man.1"
6494         case "$sysman" in
6495         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6496         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6497         esac
6498         set dflt
6499         eval $prefixup
6500         ;;
6501 *)  dflt="$man1dir"
6502         ;;
6503 esac
6504 echo " "
6505 fn=dn+~
6506 rp="Where do the main $spackage manual pages (source) go?"
6507 . ./getfile
6508 if $test "X$man1direxp" != "X$ansexp"; then
6509         installman1dir=''
6510 fi
6511 man1dir="$ans"
6512 man1direxp="$ansexp"
6513 case "$man1dir" in
6514 '')     man1dir=' '
6515         installman1dir='';;
6516 esac
6517
6518 : Change installation prefix, if necessary.
6519 if $test X"$prefix" != X"$installprefix"; then
6520         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6521 else
6522         installman1dir="$man1direxp"
6523 fi
6524
6525 : What suffix to use on installed man pages
6526
6527 case "$man1dir" in
6528 ' ')
6529         man1ext='0'
6530         ;;
6531 *)
6532         rp="What suffix should be used for the main $spackage man pages?"
6533         case "$man1ext" in
6534         '')     case "$man1dir" in
6535                 *1)  dflt=1 ;;
6536                 *1p) dflt=1p ;;
6537                 *1pm) dflt=1pm ;;
6538                 *l) dflt=l;;
6539                 *n) dflt=n;;
6540                 *o) dflt=o;;
6541                 *p) dflt=p;;
6542                 *C) dflt=C;;
6543                 *L) dflt=L;;
6544                 *L1) dflt=L1;;
6545                 *) dflt=1;;
6546                 esac
6547                 ;;
6548         *)      dflt="$man1ext";;
6549         esac
6550         . ./myread
6551         man1ext="$ans"
6552         ;;
6553 esac
6554
6555 : see if we can have long filenames
6556 echo " "
6557 rmlist="$rmlist /tmp/cf$$"
6558 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6559 first=123456789abcdef
6560 second=/tmp/cf$$/$first
6561 $rm -f $first $second
6562 if (echo hi >$first) 2>/dev/null; then
6563         if $test -f 123456789abcde; then
6564                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6565                 val="$undef"
6566         else
6567                 if (echo hi >$second) 2>/dev/null; then
6568                         if $test -f /tmp/cf$$/123456789abcde; then
6569                                 $cat <<'EOM'
6570 That's peculiar... You can have filenames longer than 14 characters, but only
6571 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6572 I shall consider your system cannot support long filenames at all.
6573 EOM
6574                                 val="$undef"
6575                         else
6576                                 echo 'You can have filenames longer than 14 characters.' >&4
6577                                 val="$define"
6578                         fi
6579                 else
6580                         $cat <<'EOM'
6581 How confusing! Some of your filesystems are sane enough to allow filenames
6582 longer than 14 characters but some others like /tmp can't even think about them.
6583 So, for now on, I shall assume your kernel does not allow them at all.
6584 EOM
6585                         val="$undef"
6586                 fi
6587         fi
6588 else
6589         $cat <<'EOM'
6590 You can't have filenames longer than 14 chars.  You can't even think about them!
6591 EOM
6592         val="$undef"
6593 fi 
6594 set d_flexfnam
6595 eval $setvar
6596 $rm -rf /tmp/cf$$ 123456789abcde*
6597
6598 : determine where library module manual pages go
6599 set man3dir man3dir none
6600 eval $prefixit
6601 $cat <<EOM
6602
6603 $spackage has manual pages for many of the library modules.
6604 EOM
6605
6606 case "$nroff" in
6607 nroff)
6608         $cat <<'EOM'
6609 However, you don't have nroff, so they're probably useless to you.
6610 EOM
6611         case "$man3dir" in
6612         '') man3dir="none";;
6613         esac;;
6614 esac
6615
6616 case "$d_flexfnam" in
6617 undef)
6618         $cat <<'EOM'
6619 However, your system can't handle the long file names like File::Basename.3. 
6620 EOM
6621         case "$man3dir" in
6622         '') man3dir="none";;
6623         esac;;
6624 esac
6625
6626 echo "If you don't want the manual sources installed, answer 'none'."
6627 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6628 case "$man3dir" in
6629 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6630         if $test -d "$privlib/man/man3"; then
6631                 cat <<EOM >&4
6632
6633 WARNING:  Previous versions of perl installed man3 pages into
6634 $privlib/man/man3.  This version will suggest a 
6635 new default of $dflt.  
6636 EOM
6637                 tdflt=$dflt
6638                 dflt='n'
6639                 rp='Do you wish to preserve the old behavior?(y/n)'
6640                 . ./myread
6641                 case "$ans" in
6642                 y*) dflt="$privlib/man/man3" ;;
6643                 *)  dflt=$tdflt ;;
6644                 esac
6645     fi
6646         ;;
6647 ' ') dflt=none;;
6648 *)      dflt="$man3dir" ;;
6649 esac
6650 echo " "
6651 fn=dn+~
6652 rp="Where do the $package library man pages (source) go?"
6653 . ./getfile
6654 man3dir="$ans"
6655 man3direxp="$ansexp"
6656 case "$man1dir" in
6657 '')     man3dir=' '
6658         installman3dir='';;
6659 esac
6660
6661 : Change installation prefix, if necessary.
6662 if $test X"$prefix" != X"$installprefix"; then
6663         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6664 else
6665         installman3dir="$man3direxp"
6666 fi
6667
6668 : What suffix to use on installed man pages
6669 case "$man3dir" in
6670 ' ')
6671         man3ext='0'
6672         ;;
6673 *)
6674         rp="What suffix should be used for the $package library man pages?"
6675         case "$man3ext" in
6676         '')     case "$man3dir" in
6677                 *3)  dflt=3 ;;
6678                 *3p) dflt=3p ;;
6679                 *3pm) dflt=3pm ;;
6680                 *l) dflt=l;;
6681                 *n) dflt=n;;
6682                 *o) dflt=o;;
6683                 *p) dflt=p;;
6684                 *C) dflt=C;;
6685                 *L) dflt=L;;
6686                 *L3) dflt=L3;;
6687                 *) dflt=3;;
6688                 esac
6689                 ;;
6690         *)      dflt="$man3ext";;
6691         esac
6692         . ./myread
6693         man3ext="$ans"
6694         ;;
6695 esac
6696
6697 : see if we have to deal with yellow pages, now NIS.
6698 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6699         if $test -f /usr/etc/nibindd; then
6700                 echo " "
6701                 echo "I'm fairly confident you're on a NeXT."
6702                 echo " "
6703                 rp='Do you get the hosts file via NetInfo?'
6704                 dflt=y
6705                 case "$hostcat" in
6706                 nidump*) ;;
6707                 '') ;;
6708                 *) dflt=n;;
6709                 esac
6710                 . ./myread
6711                 case "$ans" in
6712                 y*) hostcat='nidump hosts .';;
6713                 *)      case "$hostcat" in
6714                         nidump*) hostcat='';;
6715                         esac
6716                         ;;
6717                 esac
6718         fi
6719         case "$hostcat" in
6720         nidump*) ;;
6721         *)
6722                 case "$hostcat" in
6723                 *ypcat*) dflt=y;;
6724                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6725                                 dflt=y
6726                         else
6727                                 dflt=n
6728                         fi;;
6729                 *) dflt=n;;
6730                 esac
6731                 echo " "
6732                 rp='Are you getting the hosts file via yellow pages?'
6733                 . ./myread
6734                 case "$ans" in
6735                 y*) hostcat='ypcat hosts';;
6736                 *) hostcat='cat /etc/hosts';;
6737                 esac
6738                 ;;
6739         esac
6740 fi
6741 case "$hostcat" in
6742 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6743 esac
6744 case "$groupcat" in
6745 '') test -f /etc/group && groupcat='cat /etc/group';;
6746 esac
6747 case "$passcat" in
6748 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6749 esac
6750
6751 : now get the host name
6752 echo " "
6753 echo "Figuring out host name..." >&4
6754 case "$myhostname" in
6755 '') cont=true
6756         echo 'Maybe "hostname" will work...'
6757         if tans=`sh -c hostname 2>&1` ; then
6758                 myhostname=$tans
6759                 phostname=hostname
6760                 cont=''
6761         fi
6762         ;;
6763 *) cont='';;
6764 esac
6765 if $test "$cont"; then
6766         if ./xenix; then
6767                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6768                 if tans=`cat /etc/systemid 2>&1` ; then
6769                         myhostname=$tans
6770                         phostname='cat /etc/systemid'
6771                         echo "Whadyaknow.  Xenix always was a bit strange..."
6772                         cont=''
6773                 fi
6774         elif $test -r /etc/systemid; then
6775                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6776         fi
6777 fi
6778 if $test "$cont"; then
6779         echo 'No, maybe "uuname -l" will work...'
6780         if tans=`sh -c 'uuname -l' 2>&1` ; then
6781                 myhostname=$tans
6782                 phostname='uuname -l'
6783         else
6784                 echo 'Strange.  Maybe "uname -n" will work...'
6785                 if tans=`sh -c 'uname -n' 2>&1` ; then
6786                         myhostname=$tans
6787                         phostname='uname -n'
6788                 else
6789                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6790                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6791                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6792                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6793                         else
6794                                 case "$myhostname" in
6795                                 '') echo "Does this machine have an identity crisis or something?"
6796                                         phostname='';;
6797                                 *)
6798                                         echo "Well, you said $myhostname before..."
6799                                         phostname='echo $myhostname';;
6800                                 esac
6801                         fi
6802                 fi
6803         fi
6804 fi
6805 : you do not want to know about this
6806 set $myhostname
6807 myhostname=$1
6808
6809 : verify guess
6810 if $test "$myhostname" ; then
6811         dflt=y
6812         rp='Your host name appears to be "'$myhostname'".'" Right?"
6813         . ./myread
6814         case "$ans" in
6815         y*) ;;
6816         *) myhostname='';;
6817         esac
6818 fi
6819
6820 : bad guess or no guess
6821 while $test "X$myhostname" = X ; do
6822         dflt=''
6823         rp="Please type the (one word) name of your host:"
6824         . ./myread
6825         myhostname="$ans"
6826 done
6827
6828 : translate upper to lower if necessary
6829 case "$myhostname" in
6830 *[A-Z]*)
6831         echo "(Normalizing case in your host name)"
6832         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6833         ;;
6834 esac
6835
6836 case "$myhostname" in
6837 *.*)
6838         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6839         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6840         echo "(Trimming domain name from host name--host name is now $myhostname)"
6841         ;;
6842 *) case "$mydomain" in
6843         '')
6844                 {
6845                         test "X$hostcat" = "Xypcat hosts" &&
6846                         ypmatch "$myhostname" hosts 2>/dev/null |\
6847                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6848                         $test -s hosts
6849                 } || {
6850                         test "X$hostcat" != "X" &&
6851                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6852                                         /[       ]$myhostname[  . ]/p" > hosts
6853                 }
6854                 tmp_re="[       . ]"
6855                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6856                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6857                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6858                         hosts | $sort | $uniq | \
6859                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6860                 case `$echo X$dflt` in
6861                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6862                         dflt=.
6863                         ;;
6864                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6865                         ;;
6866                 esac
6867                 case "$dflt" in
6868                 .)
6869                         tans=`./loc resolv.conf X /etc /usr/etc`
6870                         if $test -f "$tans"; then
6871                                 echo "(Attempting domain name extraction from $tans)"
6872                                 dflt=.`$sed -n -e 's/   / /g' \
6873                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6874                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6875                                 case "$dflt" in
6876                                 .) dflt=.`$sed -n -e 's/        / /g' \
6877                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6878                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6879                                         ;;
6880                                 esac
6881                         fi
6882                         ;;
6883                 esac
6884                 case "$dflt" in
6885                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6886                         dflt=.`sh -c domainname 2>/dev/null`
6887                         case "$dflt" in
6888                         '') dflt='.';;
6889                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6890                         esac
6891                         ;;
6892                 esac
6893                 case "$dflt" in
6894                 .) echo "(Lost all hope -- silly guess then)"
6895                         dflt='.uucp'
6896                         ;;
6897                 esac
6898                 $rm -f hosts
6899                 ;;
6900         *) dflt="$mydomain";;
6901         esac;;
6902 esac
6903 echo " "
6904 rp="What is your domain name?"
6905 . ./myread
6906 tans="$ans"
6907 case "$ans" in
6908 '') ;;
6909 .*) ;;
6910 *) tans=".$tans";;
6911 esac
6912 mydomain="$tans"
6913
6914 : translate upper to lower if necessary
6915 case "$mydomain" in
6916 *[A-Z]*)
6917         echo "(Normalizing case in your domain name)"
6918         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6919         ;;
6920 esac
6921
6922 : a little sanity check here
6923 case "$phostname" in
6924 '') ;;
6925 *)
6926         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6927         $myhostname$mydomain|$myhostname) ;;
6928         *)
6929                 case "$phostname" in
6930                 sed*)
6931                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6932                         ;;
6933                 *)
6934                         echo "(That doesn't agree with your $phostname command, by the way.)"
6935                         ;;
6936                 esac
6937         ;;
6938         esac
6939         ;;
6940 esac
6941
6942 $cat <<EOM
6943
6944 I need to get your e-mail address in Internet format if possible, i.e.
6945 something like user@host.domain. Please answer accurately since I have
6946 no easy means to double check it. The default value provided below
6947 is most probably close to reality but may not be valid from outside
6948 your organization...
6949
6950 EOM
6951 cont=x
6952 while test "$cont"; do
6953         case "$cf_email" in
6954         '') dflt="$cf_by@$myhostname$mydomain";;
6955         *) dflt="$cf_email";;
6956         esac
6957         rp='What is your e-mail address?'
6958         . ./myread
6959         cf_email="$ans"
6960         case "$cf_email" in
6961         *@*.*) cont='' ;;
6962         *)
6963                 rp='Address does not look like an Internet one.  Use it anyway?'
6964                 case "$fastread" in
6965                 yes) dflt=y ;;
6966                 *) dflt=n ;;
6967                 esac
6968                 . ./myread
6969                 case "$ans" in
6970                 y*) cont='' ;;
6971                 *) echo " " ;;
6972                 esac
6973                 ;;
6974         esac
6975 done
6976
6977 $cat <<EOM
6978
6979 If you or somebody else will be maintaining perl at your site, please
6980 fill in the correct e-mail address here so that they may be contacted
6981 if necessary. Currently, the "perlbug" program included with perl
6982 will send mail to this address in addition to perlbug@perl.com. You may
6983 enter "none" for no administrator.
6984
6985 EOM
6986 case "$perladmin" in
6987 '') dflt="$cf_email";;
6988 *) dflt="$perladmin";;
6989 esac
6990 rp='Perl administrator e-mail address'
6991 . ./myread
6992 perladmin="$ans"
6993
6994 : figure out how to guarantee perl startup
6995 case "$startperl" in
6996 '')
6997         case "$sharpbang" in
6998         *!)
6999                 $cat <<EOH
7000
7001 I can use the #! construct to start perl on your system. This will
7002 make startup of perl scripts faster, but may cause problems if you
7003 want to share those scripts and perl is not in a standard place
7004 ($binexp/perl) on all your platforms. The alternative is to force
7005 a shell by starting the script with a single ':' character.
7006
7007 EOH
7008                 dflt="$binexp/perl"
7009                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7010                 . ./myread
7011                 case "$ans" in
7012                 none)   startperl=": # use perl";;
7013                 *)      startperl="#!$ans"
7014                         if $test 30 -lt `echo "$ans" | wc -c`; then
7015                                 $cat >&4 <<EOM
7016
7017 WARNING:  Some systems limit the #! command to 32 characters.
7018 If you experience difficulty running Perl scripts with #!, try
7019 installing Perl in a directory with a shorter pathname.
7020
7021 EOM
7022                         fi ;;
7023                 esac
7024                 ;;
7025         *) startperl=": # use perl"
7026                 ;;
7027         esac
7028         ;;
7029 esac
7030 echo "I'll use $startperl to start perl scripts."
7031
7032 : figure best path for perl in scripts
7033 case "$perlpath" in
7034 '')
7035         perlpath="$binexp/perl"
7036         case "$startperl" in
7037         *!*) ;;
7038         *)
7039                 $cat <<EOH
7040
7041 I will use the "eval 'exec'" idiom to start Perl on your system.
7042 I can use the full path of your Perl binary for this purpose, but
7043 doing so may cause problems if you want to share those scripts and
7044 Perl is not always in a standard place ($binexp/perl).
7045
7046 EOH
7047                 dflt="$binexp/perl"
7048                 rp="What path shall I use in \"eval 'exec'\"?"
7049                 . ./myread
7050                 perlpath="$ans"
7051                 ;;
7052         esac
7053         ;;
7054 esac
7055 case "$startperl" in
7056 *!*)    ;;
7057 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7058 esac
7059
7060 : determine where public executable scripts go
7061 set scriptdir scriptdir
7062 eval $prefixit
7063 case "$scriptdir" in
7064 '')
7065         dflt="$bin"
7066         : guess some guesses
7067         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7068         $test -d /usr/share/bin     && dflt=/usr/share/bin
7069         $test -d /usr/local/script  && dflt=/usr/local/script
7070         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7071         $test -d $prefixexp/script  && dflt=$prefixexp/script
7072         set dflt
7073         eval $prefixup
7074         ;;
7075 *)  dflt="$scriptdir"
7076         ;;
7077 esac
7078 $cat <<EOM
7079  
7080 Some installations have a separate directory just for executable scripts so
7081 that they can mount it across multiple architectures but keep the scripts in
7082 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7083 Or you might just lump your scripts in with all your other executables.
7084  
7085 EOM
7086 fn=d~
7087 rp='Where do you keep publicly executable scripts?'
7088 . ./getfile
7089 if $test "X$ansexp" != "X$scriptdirexp"; then
7090         installscript=''
7091 fi
7092 scriptdir="$ans"
7093 scriptdirexp="$ansexp"
7094 : Change installation prefix, if necessary.
7095 if $test X"$prefix" != X"$installprefix"; then
7096         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7097 else
7098         installscript="$scriptdirexp"
7099 fi
7100
7101 : determine where site specific architecture-dependent libraries go.
7102 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7103 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7104 : sitelib may have an optional trailing /share.
7105 case "$sitearch" in
7106 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7107         dflt="$dflt/$archname"
7108         ;;
7109 *)      dflt="$sitearch"
7110         ;;
7111 esac
7112 set sitearch sitearch none
7113 eval $prefixit
7114 $cat <<EOM
7115
7116 The installation process will also create a directory for
7117 architecture-dependent site-specific extensions and modules.
7118
7119 EOM
7120 fn=d~+
7121 rp='Pathname for the site-specific architecture-dependent library files?'
7122 . ./getfile
7123 sitearch="$ans"
7124 sitearchexp="$ansexp"
7125 : Change installation prefix, if necessary.
7126 if $test X"$prefix" != X"$installprefix"; then
7127         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7128 else
7129         installsitearch="$sitearchexp"
7130 fi
7131
7132 : determine where add-on public executables go
7133 case "$sitebin" in
7134 '')     dflt=$siteprefix/bin ;;
7135 *)      dflt=$sitebin ;;
7136 esac
7137 fn=d~
7138 rp='Pathname where the add-on public executables should be installed?'
7139 . ./getfile
7140 sitebin="$ans"
7141 sitebinexp="$ansexp"
7142 : Change installation prefix, if necessary.
7143 if $test X"$prefix" != X"$installprefix"; then
7144         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7145 else
7146         installsitebin="$sitebinexp"
7147 fi
7148
7149 : see if sqrtl exists
7150 set sqrtl d_sqrtl
7151 eval $inlibc
7152
7153 case "$ccflags" in
7154 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7155 esac
7156
7157 case "$uselongdouble" in
7158 $define|true|[yY]*)     dflt='y';;
7159 *) dflt='n';;
7160 esac
7161 cat <<EOM
7162
7163 Perl can be built to take advantage of long doubles which
7164 (if available) may give more accuracy and range for floating point numbers.
7165
7166 If this doesn't make any sense to you, just accept the default '$dflt'.
7167 EOM
7168 rp='Try to use long doubles if available?'
7169 . ./myread
7170 case "$ans" in
7171 y|Y)    val="$define"   ;;
7172 *)      val="$undef"    ;;
7173 esac
7174 set uselongdouble
7175 eval $setvar
7176
7177 case "$uselongdouble" in
7178 true|[yY]*) uselongdouble="$define" ;;
7179 esac
7180
7181 case "$uselongdouble" in
7182 $define)
7183 : Look for a hint-file generated 'call-back-unit'.  If the
7184 : user has specified that long doubles should be used,
7185 : we may need to set or change some other defaults.
7186         if $test -f uselongdouble.cbu; then
7187                 echo "Your platform has some specific hints for long doubles, using them..."
7188                 . ./uselongdouble.cbu
7189         else
7190                 $cat <<EOM
7191 (Your platform doesn't have any specific hints for long doubles.)
7192 EOM
7193         fi
7194         ;;
7195 esac
7196
7197 case "$uselongdouble:$d_sqrtl" in
7198 $define:$undef)
7199                 $cat <<EOM >&4
7200
7201 You requested the use of long doubles but you do not seem to have
7202 the mathematic functions for long doubles.  I'm disabling the use
7203 of long doubles.
7204 EOM
7205         uselongdouble=$undef
7206         ;;
7207 esac
7208
7209 case "$useperlio" in
7210 $define|true|[yY]*)     dflt='y';;
7211 *) dflt='n';;
7212 esac
7213 cat <<EOM
7214
7215 Previous version of $package used the standard IO mechanisms as defined
7216 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7217 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7218 the default.  This abstraction layer can use AT&T's sfio (if you already
7219 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7220 problems with some extension modules.  Using PerlIO with stdio is safe,
7221 but it is slower than plain stdio and therefore is not the default.
7222
7223 If this doesn't make any sense to you, just accept the default '$dflt'.
7224 EOM
7225 rp='Use the experimental PerlIO abstraction layer?'
7226 . ./myread
7227 case "$ans" in
7228 y|Y) 
7229         val="$define"
7230         ;;     
7231 *)      
7232         echo "Ok, doing things the stdio way"
7233         val="$undef"
7234         ;;
7235 esac
7236 set useperlio
7237 eval $setvar 
7238
7239 case "$vendorprefix" in
7240 '')     d_vendorbin="$undef"
7241         vendorbin=''
7242         vendorbinexp=''
7243         ;;
7244 *)      d_vendorbin="$define"
7245         : determine where vendor-supplied executables go.
7246         case "$vendorbin" in
7247         '') dflt=$vendorprefix/bin ;;
7248         *)      dflt="$vendorbin" ;;
7249         esac
7250         fn=d~+
7251         rp='Pathname for the vendor-supplied executables directory?'
7252         . ./getfile
7253         vendorbin="$ans"
7254         vendorbinexp="$ansexp"
7255         ;;
7256 esac
7257 : Change installation prefix, if necessary.
7258 if $test X"$prefix" != X"$installprefix"; then
7259         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7260 else
7261         installvendorbin="$vendorbinexp"
7262 fi
7263
7264 : check for length of double
7265 echo " "
7266 case "$doublesize" in
7267 '')
7268         echo "Checking to see how big your double precision numbers are..." >&4
7269         $cat >try.c <<'EOCP'
7270 #include <stdio.h>
7271 int main()
7272 {
7273     printf("%d\n", (int)sizeof(double));
7274     exit(0);
7275 }
7276 EOCP
7277         set try
7278         if eval $compile_ok; then
7279                 doublesize=`./try`
7280                 echo "Your double is $doublesize bytes long."
7281         else
7282                 dflt='8'
7283                 echo "(I can't seem to compile the test program.  Guessing...)"
7284                 rp="What is the size of a double precision number (in bytes)?"
7285                 . ./myread
7286                 doublesize="$ans"
7287         fi
7288         ;;
7289 esac
7290 $rm -f try.c try
7291
7292 : check for long doubles
7293 echo " "
7294 echo "Checking to see if you have long double..." >&4
7295 echo 'int main() { long double x = 7.0; }' > try.c
7296 set try
7297 if eval $compile; then
7298         val="$define"
7299         echo "You have long double."
7300 else
7301         val="$undef"
7302         echo "You do not have long double."
7303 fi
7304 $rm try.*
7305 set d_longdbl
7306 eval $setvar
7307
7308 : check for length of long double
7309 case "${d_longdbl}${longdblsize}" in
7310 $define)
7311         echo " "
7312         echo "Checking to see how big your long doubles are..." >&4
7313         $cat >try.c <<'EOCP'
7314 #include <stdio.h>
7315 int main()
7316 {
7317         printf("%d\n", sizeof(long double));
7318 }
7319 EOCP
7320         set try
7321         set try
7322         if eval $compile; then
7323                 longdblsize=`./try$exe_ext`
7324                 echo "Your long doubles are $longdblsize bytes long."
7325         else
7326                 dflt='8'
7327                 echo " "
7328                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7329                 rp="What is the size of a long double (in bytes)?"
7330                 . ./myread
7331                 longdblsize="$ans"
7332         fi
7333         if $test "X$doublesize" = "X$longdblsize"; then
7334                 echo "(That isn't any different from an ordinary double.)"
7335         fi      
7336         ;;
7337 esac
7338 $rm -f try.* try
7339
7340 : Check how to convert floats to strings.
7341 if test "X$d_Gconvert" = X; then
7342         echo " "
7343         echo "Checking for an efficient way to convert floats to strings."
7344         $cat >try.c <<EOP
7345 #ifdef TRY_gconvert
7346 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7347 char *myname = "gconvert";
7348 #endif
7349 #ifdef TRY_gcvt
7350 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7351 char *myname = "gcvt";
7352 #endif
7353 #ifdef TRY_qgcvt
7354 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7355 char *myname = "qgcvt";
7356 #define DOUBLETYPE long double
7357 #endif
7358 #ifdef TRY_sprintf
7359 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7360 char *myname = "sprintf";
7361 #endif
7362
7363 #ifndef DOUBLETYPE
7364 #define DOUBLETYPE double
7365 #endif
7366
7367 #include <stdio.h>
7368
7369 #define I_STDLIB $i_stdlib
7370 #ifdef I_STDLIB
7371 #include <stdlib.h>
7372 #endif
7373
7374 int
7375 checkit(expect, got)
7376 char *expect;
7377 char *got;
7378 {
7379     if (strcmp(expect, got)) {
7380                 printf("%s oddity:  Expected %s, got %s\n",
7381                         myname, expect, got);
7382                 exit(1);
7383         }
7384 }
7385
7386 int main()
7387
7388         char buf[64]; 
7389         buf[63] = '\0';
7390
7391         /* This must be 1st test on (which?) platform */
7392         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7393         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7394         checkit("0.1", buf);
7395
7396         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7397         checkit("1", buf);
7398
7399         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7400         checkit("0", buf);
7401
7402         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7403         checkit("-1", buf);
7404
7405         /* Some Linux gcvt's give 1.e+5 here. */
7406         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7407         checkit("100000", buf);
7408         
7409         /* Some Linux gcvt's give -1.e+5 here. */
7410         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7411         checkit("-100000", buf);
7412
7413         exit(0);
7414 }
7415 EOP
7416         case "$d_Gconvert" in
7417         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7418         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7419         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7420         *) xxx_list='gconvert gcvt sprintf' ;;
7421         esac
7422
7423         case "$d_longdbl$uselongdouble" in
7424         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7425         esac
7426
7427         for xxx_convert in $xxx_list; do
7428                 echo "Trying $xxx_convert..."
7429                 $rm -f try try$_o
7430                 set try -DTRY_$xxx_convert
7431                 if eval $compile; then
7432                         echo "$xxx_convert() found." >&4
7433                         if ./try; then
7434                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7435                                 break;
7436                         else
7437                                 echo "...But $xxx_convert didn't work as I expected."
7438                         fi
7439                 else
7440                         echo "$xxx_convert NOT found." >&4
7441                 fi
7442         done
7443                 
7444         case "$xxx_convert" in
7445         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7446         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7447         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7448         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7449         esac
7450 fi
7451
7452 echo " "
7453
7454 if $test X"$d_longdbl" = X"$define"; then
7455
7456 echo "Checking how to print long doubles..." >&4
7457
7458 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7459         $cat >try.c <<'EOCP'
7460 #include <sys/types.h>
7461 #include <stdio.h>
7462 int main() {
7463   double d = 123.456;
7464   printf("%.3f\n", d);
7465 }
7466 EOCP
7467         set try
7468         if eval $compile; then
7469                 yyy=`./try$exe_ext`
7470                 case "$yyy" in
7471                 123.456)
7472                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7473                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7474                         echo "We will use %f."
7475                         ;;
7476                 esac
7477         fi
7478 fi
7479
7480 if $test X"$sPRIfldbl" = X; then
7481         $cat >try.c <<'EOCP'
7482 #include <sys/types.h>
7483 #include <stdio.h>
7484 int main() {
7485   long double d = 123.456;
7486   printf("%.3llf\n", d);
7487 }
7488 EOCP
7489         set try
7490         if eval $compile; then
7491                 yyy=`./try$exe_ext`
7492                 case "$yyy" in
7493                 123.456)
7494                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7495                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7496                         echo "We will use %llf."
7497                         ;;
7498                 esac
7499         fi
7500 fi
7501
7502 if $test X"$sPRIfldbl" = X; then
7503         $cat >try.c <<'EOCP'
7504 #include <sys/types.h>
7505 #include <stdio.h>
7506 int main() {
7507   long double d = 123.456;
7508   printf("%.3Lf\n", d);
7509 }
7510 EOCP
7511         set try
7512         if eval $compile; then
7513                 yyy=`./try$exe_ext`
7514                 case "$yyy" in
7515                 123.456)
7516                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7517                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7518                         echo "We will use %Lf."
7519                         ;;
7520                 esac
7521         fi
7522 fi
7523
7524 if $test X"$sPRIfldbl" = X; then
7525         $cat >try.c <<'EOCP'
7526 #include <sys/types.h>
7527 #include <stdio.h>
7528 int main() {
7529   long double d = 123.456;
7530   printf("%.3lf\n", d);
7531 }
7532 EOCP
7533         set try
7534         if eval $compile; then
7535                 yyy=`./try$exe_ext`
7536                 case "$yyy" in
7537                 123.456)
7538                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7539                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7540                         echo "We will use %lf."
7541                         ;;
7542                 esac
7543         fi
7544 fi
7545
7546 if $test X"$sPRIfldbl" = X; then
7547         echo "Cannot figure out how to print long doubles." >&4
7548 fi
7549
7550 $rm -f try try.*
7551
7552 fi # d_longdbl
7553
7554 case "$sPRIfldbl" in
7555 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7556         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7557         ;;
7558 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7559         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7560         ;;
7561 esac
7562
7563 : Initialize h_fcntl
7564 h_fcntl=false
7565
7566 : Initialize h_sysfile
7567 h_sysfile=false
7568
7569 : access call always available on UNIX
7570 set access d_access
7571 eval $inlibc
7572
7573 : locate the flags for 'access()'
7574 case "$d_access" in
7575 "$define")
7576         echo " "
7577         $cat >access.c <<'EOCP'
7578 #include <sys/types.h>
7579 #ifdef I_FCNTL
7580 #include <fcntl.h>
7581 #endif
7582 #ifdef I_SYS_FILE
7583 #include <sys/file.h>
7584 #endif
7585 #ifdef I_UNISTD
7586 #include <unistd.h>
7587 #endif
7588 int main() {
7589         exit(R_OK);
7590 }
7591 EOCP
7592         : check sys/file.h first, no particular reason here
7593         if $test `./findhdr sys/file.h` && \
7594                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7595                 h_sysfile=true;
7596                 echo "<sys/file.h> defines the *_OK access constants." >&4
7597         elif $test `./findhdr fcntl.h` && \
7598                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7599                 h_fcntl=true;
7600                 echo "<fcntl.h> defines the *_OK access constants." >&4
7601         elif $test `./findhdr unistd.h` && \
7602                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7603                 echo "<unistd.h> defines the *_OK access constants." >&4
7604         else
7605                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7606         fi
7607         ;;
7608 esac
7609 $rm -f access*
7610
7611 : see if accessx exists
7612 set accessx d_accessx
7613 eval $inlibc
7614
7615 : see if alarm exists
7616 set alarm d_alarm
7617 eval $inlibc
7618
7619 : see if atolf exists
7620 set atolf d_atolf
7621 eval $inlibc
7622
7623 : see if atoll exists
7624 set atoll d_atoll
7625 eval $inlibc
7626
7627 : Look for GNU-cc style attribute checking
7628 echo " "
7629 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7630 $cat >attrib.c <<'EOCP'
7631 #include <stdio.h>
7632 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7633 EOCP
7634 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7635         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7636                 echo "Your C compiler doesn't fully support __attribute__."
7637                 val="$undef"
7638         else
7639                 echo "Your C compiler supports __attribute__."
7640                 val="$define"
7641         fi
7642 else
7643         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7644         val="$undef"
7645 fi
7646 set d_attribut
7647 eval $setvar
7648 $rm -f attrib*
7649
7650 : see if bcmp exists
7651 set bcmp d_bcmp
7652 eval $inlibc
7653
7654 : see if bcopy exists
7655 set bcopy d_bcopy
7656 eval $inlibc
7657
7658 : see if this is a unistd.h system
7659 set unistd.h i_unistd
7660 eval $inhdr
7661
7662 : see if getpgrp exists
7663 set getpgrp d_getpgrp
7664 eval $inlibc
7665
7666 case "$d_getpgrp" in
7667 "$define")
7668         echo " "
7669         echo "Checking to see which flavor of getpgrp is in use..."
7670         $cat >set.c <<EOP
7671 #$i_unistd I_UNISTD
7672 #include <sys/types.h>
7673 #ifdef I_UNISTD
7674 #  include <unistd.h>
7675 #endif
7676 int main()
7677 {
7678         if (getuid() == 0) {
7679                 printf("(I see you are running Configure as super-user...)\n");
7680                 setuid(1);
7681         }
7682 #ifdef TRY_BSD_PGRP
7683         if (getpgrp(1) == 0)
7684                 exit(0);
7685 #else
7686         if (getpgrp() > 0)
7687                 exit(0);
7688 #endif
7689         exit(1);
7690 }
7691 EOP
7692         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7693                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7694                 val="$define"
7695         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7696                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7697                 val="$undef"
7698         else
7699                 echo "I can't seem to compile and run the test program."
7700                 if ./usg; then
7701                         xxx="a USG one, i.e. you use getpgrp()."
7702                 else
7703                         # SVR4 systems can appear rather BSD-ish.
7704                         case "$i_unistd" in
7705                         $undef)
7706                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7707                                 val="$define"
7708                                 ;;
7709                         $define)
7710                                 xxx="probably a USG one, i.e. you use getpgrp()."
7711                                 val="$undef"
7712                                 ;;
7713                         esac
7714                 fi
7715                 echo "Assuming your getpgrp is $xxx" >&4
7716         fi
7717         ;;
7718 *) val="$undef";;
7719 esac
7720 set d_bsdgetpgrp
7721 eval $setvar
7722 $rm -f set set.c
7723
7724 : see if setpgrp exists
7725 set setpgrp d_setpgrp
7726 eval $inlibc
7727
7728 case "$d_setpgrp" in
7729 "$define")
7730         echo " "
7731         echo "Checking to see which flavor of setpgrp is in use..."
7732         $cat >set.c <<EOP
7733 #$i_unistd I_UNISTD
7734 #include <sys/types.h>
7735 #ifdef I_UNISTD
7736 #  include <unistd.h>
7737 #endif
7738 int main()
7739 {
7740         if (getuid() == 0) {
7741                 printf("(I see you are running Configure as super-user...)\n");
7742                 setuid(1);
7743         }
7744 #ifdef TRY_BSD_PGRP
7745         if (-1 == setpgrp(1, 1))
7746                 exit(0);
7747 #else
7748         if (setpgrp() != -1)
7749                 exit(0);
7750 #endif
7751         exit(1);
7752 }
7753 EOP
7754         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7755                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7756                 val="$define"
7757         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7758                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7759                 val="$undef"
7760         else
7761                 echo "(I can't seem to compile and run the test program.)"
7762                 if ./usg; then
7763                         xxx="a USG one, i.e. you use setpgrp()."
7764                 else
7765                         # SVR4 systems can appear rather BSD-ish.
7766                         case "$i_unistd" in
7767                         $undef)
7768                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7769                                 val="$define"
7770                                 ;;
7771                         $define)
7772                                 xxx="probably a USG one, i.e. you use setpgrp()."
7773                                 val="$undef"
7774                                 ;;
7775                         esac
7776                 fi
7777                 echo "Assuming your setpgrp is $xxx" >&4
7778         fi
7779         ;;
7780 *) val="$undef";;
7781 esac
7782 set d_bsdsetpgrp
7783 eval $setvar
7784 $rm -f set set.c
7785 : see if bzero exists
7786 set bzero d_bzero
7787 eval $inlibc
7788
7789 : see if signal is declared as pointer to function returning int or void
7790 echo " "
7791 xxx=`./findhdr signal.h`
7792 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7793 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7794         echo "You have int (*signal())() instead of void." >&4
7795         val="$undef"
7796 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7797         echo "You have void (*signal())()." >&4
7798         val="$define"
7799 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7800         echo "You have int (*signal())() instead of void." >&4
7801         val="$undef"
7802 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7803         echo "You have void (*signal())()." >&4
7804         val="$define"
7805 else
7806         case "$d_voidsig" in
7807         '')
7808         echo "I can't determine whether signal handler returns void or int..." >&4
7809                 dflt=void
7810                 rp="What type does your signal handler return?"
7811                 . ./myread
7812                 case "$ans" in
7813                 v*) val="$define";;
7814                 *) val="$undef";;
7815                 esac;;
7816         "$define")
7817                 echo "As you already told me, signal handler returns void." >&4
7818                 val="$define"
7819                 ;;
7820         *)      echo "As you already told me, signal handler returns int." >&4
7821                 val="$undef"
7822                 ;;
7823         esac
7824 fi
7825 set d_voidsig
7826 eval $setvar
7827 case "$d_voidsig" in
7828 "$define") signal_t="void";;
7829 *) signal_t="int";;
7830 esac
7831 $rm -f $$.tmp
7832
7833 : check for ability to cast large floats to 32-bit ints.
7834 echo " "
7835 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7836 if $test "$intsize" -ge 4; then
7837         xxx=int
7838 else
7839         xxx=long
7840 fi
7841 $cat >try.c <<EOCP
7842 #include <stdio.h>
7843 #include <sys/types.h>
7844 #include <signal.h>
7845 $signal_t blech(s) int s; { exit(3); }
7846 int main()
7847 {
7848         $xxx i32;
7849         double f, g;
7850         int result = 0;
7851         char str[16];
7852         signal(SIGFPE, blech);
7853
7854         /* Don't let compiler optimize the test away.  Store the number 
7855            in a writable string for gcc to pass to sscanf under HP/UX.
7856         */
7857         sprintf(str, "2147483647");
7858         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7859         g = 10 * f;
7860         i32  = ($xxx) g;
7861
7862         /* x86 processors will probably give 0x8000 0000, which is a
7863        sign change.  We don't want that.  We want to mimic SPARC
7864            behavior here, which is to preserve the sign and give
7865            back 0x7fff ffff.
7866         */
7867         if (i32 != ($xxx) f)
7868                 result |= 1;
7869         exit(result);
7870 }
7871 EOCP
7872 set try
7873 if eval $compile_ok; then
7874         ./try
7875         yyy=$?
7876 else
7877         echo "(I can't seem to compile the test program--assuming it can't)"
7878         yyy=1
7879 fi
7880 case "$yyy" in
7881 0)      val="$define"
7882         echo "Yup, it can."
7883         ;;
7884 *)      val="$undef"
7885         echo "Nope, it can't."
7886         ;;
7887 esac
7888 set d_casti32
7889 eval $setvar
7890 $rm -f try try.*
7891
7892 : check for ability to cast negative floats to unsigned
7893 echo " "
7894 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7895 $cat >try.c <<EOCP
7896 #include <stdio.h>
7897 #include <sys/types.h>
7898 #include <signal.h>
7899 $signal_t blech(s) int s; { exit(7); }
7900 $signal_t blech_in_list(s) int s; { exit(4); }
7901 unsigned long dummy_long(p) unsigned long p; { return p; }
7902 unsigned int dummy_int(p) unsigned int p; { return p; }
7903 unsigned short dummy_short(p) unsigned short p; { return p; }
7904 int main()
7905 {
7906         double f;
7907         unsigned long along;
7908         unsigned int aint;
7909         unsigned short ashort;
7910         int result = 0;
7911         char str[16];
7912         
7913         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7914            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7915            optimized the whole file away
7916         */
7917         /* Store the number in a writable string for gcc to pass to 
7918            sscanf under HP/UX.
7919         */
7920         sprintf(str, "-123");
7921         sscanf(str, "%lf", &f);  /* f = -123.; */
7922
7923         signal(SIGFPE, blech);
7924         along = (unsigned long)f;
7925         aint = (unsigned int)f;
7926         ashort = (unsigned short)f;
7927         if (along != (unsigned long)-123)
7928                 result |= 1;
7929         if (aint != (unsigned int)-123)
7930                 result |= 1;
7931         if (ashort != (unsigned short)-123)
7932                 result |= 1;
7933         sprintf(str, "1073741824.");
7934         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7935         f = f + f;
7936         along = 0;
7937         along = (unsigned long)f;
7938         if (along != 0x80000000)
7939                 result |= 2;
7940         f -= 1.;
7941         along = 0;
7942         along = (unsigned long)f;
7943         if (along != 0x7fffffff)
7944                 result |= 1;
7945         f += 2.;
7946         along = 0;
7947         along = (unsigned long)f;
7948         if (along != 0x80000001)
7949                 result |= 2;
7950         if (result)
7951                 exit(result);
7952         signal(SIGFPE, blech_in_list);
7953         sprintf(str, "123.");
7954         sscanf(str, "%lf", &f);  /* f = 123.; */
7955         along = dummy_long((unsigned long)f);
7956         aint = dummy_int((unsigned int)f);
7957         ashort = dummy_short((unsigned short)f);
7958         if (along != (unsigned long)123)
7959                 result |= 4;
7960         if (aint != (unsigned int)123)
7961                 result |= 4;
7962         if (ashort != (unsigned short)123)
7963                 result |= 4;
7964         exit(result);
7965
7966 }
7967 EOCP
7968 set try
7969 if eval $compile_ok; then
7970         ./try
7971         castflags=$?
7972 else
7973         echo "(I can't seem to compile the test program--assuming it can't)"
7974         castflags=7
7975 fi
7976 case "$castflags" in
7977 0)      val="$define"
7978         echo "Yup, it can."
7979         ;;
7980 *)      val="$undef"
7981         echo "Nope, it can't."
7982         ;;
7983 esac
7984 set d_castneg
7985 eval $setvar
7986 $rm -f try.*
7987
7988 : see if vprintf exists
7989 echo " "
7990 if set vprintf val -f d_vprintf; eval $csym; $val; then
7991         echo 'vprintf() found.' >&4
7992         val="$define"
7993         $cat >vprintf.c <<'EOF'
7994 #include <varargs.h>
7995
7996 int main() { xxx("foo"); }
7997
7998 xxx(va_alist)
7999 va_dcl
8000 {
8001         va_list args;
8002         char buf[10];
8003
8004         va_start(args);
8005         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8006 }
8007 EOF
8008         set vprintf
8009         if eval $compile && ./vprintf; then
8010                 echo "Your vsprintf() returns (int)." >&4
8011                 val2="$undef"
8012         else
8013                 echo "Your vsprintf() returns (char*)." >&4
8014                 val2="$define"
8015         fi
8016 else
8017         echo 'vprintf() NOT found.' >&4
8018                 val="$undef"
8019                 val2="$undef"
8020 fi
8021 set d_vprintf
8022 eval $setvar
8023 val=$val2
8024 set d_charvspr
8025 eval $setvar
8026
8027 : see if chown exists
8028 set chown d_chown
8029 eval $inlibc
8030
8031 : see if chroot exists
8032 set chroot d_chroot
8033 eval $inlibc
8034
8035 : see if chsize exists
8036 set chsize d_chsize
8037 eval $inlibc
8038
8039 : check for const keyword
8040 echo " "
8041 echo 'Checking to see if your C compiler knows about "const"...' >&4
8042 $cat >const.c <<'EOCP'
8043 typedef struct spug { int drokk; } spug;
8044 int main()
8045 {
8046         const char *foo;
8047         const spug y;
8048 }
8049 EOCP
8050 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8051         val="$define"
8052         echo "Yup, it does."
8053 else
8054         val="$undef"
8055         echo "Nope, it doesn't."
8056 fi
8057 set d_const
8058 eval $setvar
8059
8060 : see if crypt exists
8061 echo " "
8062 if set crypt val -f d_crypt; eval $csym; $val; then
8063         echo 'crypt() found.' >&4
8064         val="$define"
8065         cryptlib=''
8066 else
8067         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8068         if $test -z "$cryptlib"; then
8069                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8070         else
8071                 cryptlib=-lcrypt
8072         fi
8073         if $test -z "$cryptlib"; then
8074                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8075         else
8076                 cryptlib=-lcrypt
8077         fi
8078         if $test -z "$cryptlib"; then
8079                 cryptlib=`./loc libcrypt$_a "" $libpth`
8080         else
8081                 cryptlib=-lcrypt
8082         fi
8083         if $test -z "$cryptlib"; then
8084                 echo 'crypt() NOT found.' >&4
8085                 val="$undef"
8086         else
8087                 val="$define"
8088         fi
8089 fi
8090 set d_crypt
8091 eval $setvar
8092
8093 : get csh whereabouts
8094 case "$csh" in
8095 'csh') val="$undef" ;;
8096 *) val="$define" ;;
8097 esac
8098 set d_csh
8099 eval $setvar
8100 : Respect a hint or command line value for full_csh.
8101 case "$full_csh" in
8102 '') full_csh=$csh ;;
8103 esac
8104
8105 : see if cuserid exists
8106 set cuserid d_cuserid
8107 eval $inlibc
8108
8109 : see if this is a limits.h system
8110 set limits.h i_limits
8111 eval $inhdr
8112
8113 : see if this is a float.h system
8114 set float.h i_float
8115 eval $inhdr
8116
8117 : See if number of significant digits in a double precision number is known
8118 echo " "
8119 $cat >dbl_dig.c <<EOM
8120 #$i_limits I_LIMITS
8121 #$i_float I_FLOAT
8122 #ifdef I_LIMITS
8123 #include <limits.h>
8124 #endif
8125 #ifdef I_FLOAT
8126 #include <float.h>
8127 #endif
8128 #ifdef DBL_DIG
8129 printf("Contains DBL_DIG");
8130 #endif
8131 EOM
8132 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8133 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8134         echo "DBL_DIG found." >&4
8135         val="$define"
8136 else
8137         echo "DBL_DIG NOT found." >&4
8138         val="$undef"
8139 fi
8140 $rm -f dbl_dig.?
8141 set d_dbl_dig
8142 eval $setvar
8143
8144 : see if difftime exists
8145 set difftime d_difftime
8146 eval $inlibc
8147
8148 : see if this is a dirent system
8149 echo " "
8150 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8151         val="$define"
8152         echo "<dirent.h> found." >&4
8153 else
8154         val="$undef"
8155         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8156                 echo "<sys/dir.h> found." >&4
8157                 echo " "
8158         else
8159                 xinc=`./findhdr sys/ndir.h`
8160         fi
8161         echo "<dirent.h> NOT found." >&4
8162 fi
8163 set i_dirent
8164 eval $setvar
8165
8166 : Look for type of directory structure.
8167 echo " "
8168 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8169
8170 case "$direntrytype" in
8171 ''|' ')
8172         case "$i_dirent" in
8173         $define) guess1='struct dirent' ;;
8174         *) guess1='struct direct'  ;;
8175         esac
8176         ;;
8177 *)      guess1="$direntrytype"
8178         ;;
8179 esac
8180
8181 case "$guess1" in
8182 'struct dirent') guess2='struct direct' ;;
8183 *) guess2='struct dirent' ;;
8184 esac
8185                 
8186 if $contains "$guess1" try.c >/dev/null 2>&1; then
8187         direntrytype="$guess1"
8188         echo "Your directory entries are $direntrytype." >&4
8189 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8190         direntrytype="$guess2"
8191         echo "Your directory entries seem to be $direntrytype." >&4
8192 else
8193         echo "I don't recognize your system's directory entries." >&4
8194         rp="What type is used for directory entries on this system?"
8195         dflt="$guess1"
8196         . ./myread
8197         direntrytype="$ans"
8198 fi
8199 $rm -f try.c
8200
8201
8202 : see if the directory entry stores field length
8203 echo " "
8204 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8205 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8206         echo "Good, your directory entry keeps length information in d_namlen." >&4
8207         val="$define"
8208 else
8209         echo "Your directory entry does not know about the d_namlen field." >&4
8210         val="$undef"
8211 fi
8212 set d_dirnamlen
8213 eval $setvar
8214 $rm -f try.c
8215
8216 : see if dlerror exists
8217 xxx_runnm="$runnm"
8218 runnm=false
8219 set dlerror d_dlerror
8220 eval $inlibc
8221 runnm="$xxx_runnm"
8222
8223 : see if dlfcn is available
8224 set dlfcn.h i_dlfcn
8225 eval $inhdr
8226
8227 case "$usedl" in
8228 $define|y|true)
8229         $cat << EOM
8230
8231 On a few systems, the dynamically loaded modules that perl generates and uses
8232 will need a different extension than shared libs. The default will probably
8233 be appropriate.
8234
8235 EOM
8236         case "$dlext" in
8237         '')     dflt="$so" ;;
8238         *)      dflt="$dlext" ;;
8239         esac
8240         rp='What is the extension of dynamically loaded modules'
8241         . ./myread
8242         dlext="$ans"
8243         ;;
8244 *)
8245         dlext="none"
8246         ;;
8247 esac
8248
8249 : Check if dlsym need a leading underscore
8250 echo " "
8251 val="$undef"
8252
8253 case "$dlsrc" in
8254 dl_dlopen.xs)
8255         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8256         $cat >dyna.c <<'EOM'
8257 fred () { }
8258 EOM
8259
8260 $cat >fred.c<<EOM
8261
8262 #include <stdio.h>
8263 #$i_dlfcn I_DLFCN
8264 #ifdef I_DLFCN
8265 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8266 #else
8267 #include <sys/types.h>
8268 #include <nlist.h>
8269 #include <link.h>
8270 #endif
8271
8272 extern int fred() ;
8273
8274 int main()
8275 {
8276     void * handle ;
8277     void * symbol ;
8278 #ifndef RTLD_LAZY
8279     int mode = 1 ;
8280 #else
8281     int mode = RTLD_LAZY ;
8282 #endif
8283     handle = dlopen("./dyna.$dlext", mode) ;
8284     if (handle == NULL) {
8285         printf ("1\n") ;
8286         fflush (stdout) ;
8287         exit(0);
8288     }
8289     symbol = dlsym(handle, "fred") ;
8290     if (symbol == NULL) {
8291         /* try putting a leading underscore */
8292         symbol = dlsym(handle, "_fred") ;
8293         if (symbol == NULL) {
8294             printf ("2\n") ;
8295             fflush (stdout) ;
8296             exit(0);
8297         }
8298         printf ("3\n") ;
8299     }
8300     else
8301         printf ("4\n") ;
8302     fflush (stdout) ;
8303     exit(0);
8304 }
8305 EOM
8306         : Call the object file tmp-dyna.o in case dlext=o.
8307         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8308                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8309                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8310                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8311                 xxx=`./fred`
8312                 case $xxx in
8313                 1)      echo "Test program failed using dlopen." >&4
8314                         echo "Perhaps you should not use dynamic loading." >&4;;
8315                 2)      echo "Test program failed using dlsym." >&4
8316                         echo "Perhaps you should not use dynamic loading." >&4;;
8317                 3)      echo "dlsym needs a leading underscore" >&4
8318                         val="$define" ;;
8319                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8320                 esac
8321         else
8322                 echo "I can't compile and run the test program." >&4
8323                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8324         fi
8325         ;;
8326 esac
8327                 
8328 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8329
8330 set d_dlsymun
8331 eval $setvar
8332
8333 hasproto='varname=$1; func=$2; shift; shift;
8334 while $test $# -ge 2; do
8335         case "$1" in
8336         $define) echo "#include <$2>";;
8337         esac ;
8338     shift 2;
8339 done > try.c;
8340 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8341 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8342         echo "$func() prototype found.";
8343         val="$define";
8344 else
8345         echo "$func() prototype NOT found.";
8346         val="$undef";
8347 fi;
8348 set $varname;
8349 eval $setvar;
8350 $rm -f try.c tryout.c'
8351
8352 : see if prototype for drand48 is available
8353 echo " "
8354 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8355 eval $hasproto
8356
8357 : see if dup2 exists
8358 set dup2 d_dup2
8359 eval $inlibc
8360
8361 : see if eaccess exists
8362 set eaccess d_eaccess
8363 eval $inlibc
8364
8365 : see if endgrent exists
8366 set endgrent d_endgrent
8367 eval $inlibc
8368
8369 : see if endhostent exists
8370 set endhostent d_endhent
8371 eval $inlibc
8372
8373 : see if endnetent exists
8374 set endnetent d_endnent
8375 eval $inlibc
8376
8377 : see if endprotoent exists
8378 set endprotoent d_endpent
8379 eval $inlibc
8380
8381 : see if endpwent exists
8382 set endpwent d_endpwent
8383 eval $inlibc
8384
8385 : see if endservent exists
8386 set endservent d_endsent
8387 eval $inlibc
8388
8389 : see if endspent exists
8390 set endspent d_endspent
8391 eval $inlibc
8392
8393 : Locate the flags for 'open()'
8394 echo " "
8395 $cat >open3.c <<'EOCP'
8396 #include <sys/types.h>
8397 #ifdef I_FCNTL
8398 #include <fcntl.h>
8399 #endif
8400 #ifdef I_SYS_FILE
8401 #include <sys/file.h>
8402 #endif
8403 int main() {
8404         if(O_RDONLY);
8405 #ifdef O_TRUNC
8406         exit(0);
8407 #else
8408         exit(1);
8409 #endif
8410 }
8411 EOCP
8412 : check sys/file.h first to get FREAD on Sun
8413 if $test `./findhdr sys/file.h` && \
8414                 set open3 -DI_SYS_FILE && eval $compile; then
8415         h_sysfile=true;
8416         echo "<sys/file.h> defines the O_* constants..." >&4
8417         if ./open3; then
8418                 echo "and you have the 3 argument form of open()." >&4
8419                 val="$define"
8420         else
8421                 echo "but not the 3 argument form of open().  Oh, well." >&4
8422                 val="$undef"
8423         fi
8424 elif $test `./findhdr fcntl.h` && \
8425                 set open3 -DI_FCNTL && eval $compile; then
8426         h_fcntl=true;
8427         echo "<fcntl.h> defines the O_* constants..." >&4
8428         if ./open3; then
8429                 echo "and you have the 3 argument form of open()." >&4
8430                 val="$define"
8431         else
8432                 echo "but not the 3 argument form of open().  Oh, well." >&4
8433                 val="$undef"
8434         fi
8435 else
8436         val="$undef"
8437         echo "I can't find the O_* constant definitions!  You got problems." >&4
8438 fi
8439 set d_open3
8440 eval $setvar
8441 $rm -f open3*
8442
8443 : see which of string.h or strings.h is needed
8444 echo " "
8445 strings=`./findhdr string.h`
8446 if $test "$strings" && $test -r "$strings"; then
8447         echo "Using <string.h> instead of <strings.h>." >&4
8448         val="$define"
8449 else
8450         val="$undef"
8451         strings=`./findhdr strings.h`
8452         if $test "$strings" && $test -r "$strings"; then
8453                 echo "Using <strings.h> instead of <string.h>." >&4
8454         else
8455                 echo "No string header found -- You'll surely have problems." >&4
8456         fi
8457 fi
8458 set i_string
8459 eval $setvar
8460 case "$i_string" in
8461 "$undef") strings=`./findhdr strings.h`;;
8462 *)        strings=`./findhdr string.h`;;
8463 esac
8464
8465 : check for non-blocking I/O stuff
8466 case "$h_sysfile" in
8467 true) echo "#include <sys/file.h>" > head.c;;
8468 *)
8469         case "$h_fcntl" in
8470         true) echo "#include <fcntl.h>" > head.c;;
8471         *) echo "#include <sys/fcntl.h>" > head.c;;
8472         esac
8473         ;;
8474 esac
8475 echo " "
8476 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8477 case "$o_nonblock" in
8478 '')
8479         $cat head.c > try.c
8480         $cat >>try.c <<'EOCP'
8481 #include <stdio.h>
8482 int main() {
8483 #ifdef O_NONBLOCK
8484         printf("O_NONBLOCK\n");
8485         exit(0);
8486 #endif
8487 #ifdef O_NDELAY
8488         printf("O_NDELAY\n");
8489         exit(0);
8490 #endif
8491 #ifdef FNDELAY
8492         printf("FNDELAY\n");
8493         exit(0);
8494 #endif
8495         exit(0);
8496 }
8497 EOCP
8498         set try
8499         if eval $compile_ok; then
8500                 o_nonblock=`./try`
8501                 case "$o_nonblock" in
8502                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8503                 *) echo "Seems like we can use $o_nonblock.";;
8504                 esac
8505         else
8506                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8507         fi
8508         ;;
8509 *) echo "Using $hint value $o_nonblock.";;
8510 esac
8511 $rm -f try try.* .out core
8512
8513 echo " "
8514 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8515 case "$eagain" in
8516 '')
8517         $cat head.c > try.c
8518         $cat >>try.c <<EOCP
8519 #include <errno.h>
8520 #include <sys/types.h>
8521 #include <signal.h>
8522 #include <stdio.h> 
8523 #define MY_O_NONBLOCK $o_nonblock
8524 #ifndef errno  /* XXX need better Configure test */
8525 extern int errno;
8526 #endif
8527 #$i_unistd I_UNISTD
8528 #ifdef I_UNISTD
8529 #include <unistd.h>
8530 #endif
8531 #ifdef $i_string
8532 #include <string.h>
8533 #else
8534 #include <strings.h>
8535 #endif
8536 $signal_t blech(x) int x; { exit(3); }
8537 EOCP
8538         $cat >> try.c <<'EOCP'
8539 int main()
8540 {
8541         int pd[2];
8542         int pu[2];
8543         char buf[1];
8544         char string[100];
8545
8546         pipe(pd);       /* Down: child -> parent */
8547         pipe(pu);       /* Up: parent -> child */
8548         if (0 != fork()) {
8549                 int ret;
8550                 close(pd[1]);   /* Parent reads from pd[0] */
8551                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8552                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8553                         exit(1);
8554                 signal(SIGALRM, blech);
8555                 alarm(5);
8556                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8557                         exit(2);
8558                 sprintf(string, "%d\n", ret);
8559                 write(2, string, strlen(string));
8560                 alarm(0);
8561 #ifdef EAGAIN
8562                 if (errno == EAGAIN) {
8563                         printf("EAGAIN\n");
8564                         goto ok;
8565                 }
8566 #endif
8567 #ifdef EWOULDBLOCK
8568                 if (errno == EWOULDBLOCK)
8569                         printf("EWOULDBLOCK\n");
8570 #endif
8571         ok:
8572                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8573                 sleep(2);                               /* Give it time to close our pipe */
8574                 alarm(5);
8575                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8576                 alarm(0);
8577                 sprintf(string, "%d\n", ret);
8578                 write(3, string, strlen(string));
8579                 exit(0);
8580         }
8581
8582         close(pd[0]);                   /* We write to pd[1] */
8583         close(pu[1]);                   /* We read from pu[0] */
8584         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8585         close(pd[1]);                   /* Pipe pd is now fully closed! */
8586         exit(0);                                /* Bye bye, thank you for playing! */
8587 }
8588 EOCP
8589         set try
8590         if eval $compile_ok; then
8591                 echo "$startsh" >mtry
8592                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8593                 chmod +x mtry
8594                 ./mtry >/dev/null 2>&1
8595                 case $? in
8596                 0) eagain=`$cat try.out`;;
8597                 1) echo "Could not perform non-blocking setting!";;
8598                 2) echo "I did a successful read() for something that was not there!";;
8599                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8600                 *) echo "Something terribly wrong happened during testing.";;
8601                 esac
8602                 rd_nodata=`$cat try.ret`
8603                 echo "A read() system call with no data present returns $rd_nodata."
8604                 case "$rd_nodata" in
8605                 0|-1) ;;
8606                 *)
8607                         echo "(That's peculiar, fixing that to be -1.)"
8608                         rd_nodata=-1
8609                         ;;
8610                 esac
8611                 case "$eagain" in
8612                 '')
8613                         echo "Forcing errno EAGAIN on read() with no data available."
8614                         eagain=EAGAIN
8615                         ;;
8616                 *)
8617                         echo "Your read() sets errno to $eagain when no data is available."
8618                         ;;
8619                 esac
8620                 status=`$cat try.err`
8621                 case "$status" in
8622                 0) echo "And it correctly returns 0 to signal EOF.";;
8623                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8624                 *) echo "However, your read() returns '$status' on EOF??";;
8625                 esac
8626                 val="$define"
8627                 if test "$status" = "$rd_nodata"; then
8628                         echo "WARNING: you can't distinguish between EOF and no data!"
8629                         val="$undef"
8630                 fi
8631         else
8632                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8633                 eagain=EAGAIN
8634         fi
8635         set d_eofnblk
8636         eval $setvar
8637         ;;
8638 *)
8639         echo "Using $hint value $eagain."
8640         echo "Your read() returns $rd_nodata when no data is present."
8641         case "$d_eofnblk" in
8642         "$define") echo "And you can see EOF because read() returns 0.";;
8643         "$undef") echo "But you can't see EOF status from read() returned value.";;
8644         *)
8645                 echo "(Assuming you can't see EOF status from read anyway.)"
8646                 d_eofnblk=$undef
8647                 ;;
8648         esac
8649         ;;
8650 esac
8651 $rm -f try try.* .out core head.c mtry
8652
8653 : see if fchmod exists
8654 set fchmod d_fchmod
8655 eval $inlibc
8656
8657 : see if fchown exists
8658 set fchown d_fchown
8659 eval $inlibc
8660
8661 : see if this is an fcntl system
8662 set fcntl d_fcntl
8663 eval $inlibc
8664
8665 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8666 while $test $# -ge 2; do
8667         case "$1" in
8668         $define) echo "#include <$2>";;
8669         esac ;
8670     shift 2;
8671 done > try.c;
8672 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8673 set try;
8674 if eval $compile; then
8675         val="$define";
8676 else
8677         val="$undef";
8678 fi;
8679 set $varname;
8680 eval $setvar;
8681 $rm -f try.c try.o'
8682
8683 socketlib=''
8684 sockethdr=''
8685 : see whether socket exists
8686 echo " "
8687 $echo $n "Hmm... $c" >&4
8688 if set socket val -f d_socket; eval $csym; $val; then
8689         echo "Looks like you have Berkeley networking support." >&4
8690         d_socket="$define"
8691         if set setsockopt val -f; eval $csym; $val; then
8692                 d_oldsock="$undef"
8693         else
8694                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8695                 d_oldsock="$define"
8696         fi
8697 else
8698         if $contains socklib libc.list >/dev/null 2>&1; then
8699                 echo "Looks like you have Berkeley networking support." >&4
8700                 d_socket="$define"
8701                 : we will have to assume that it supports the 4.2 BSD interface
8702                 d_oldsock="$undef"
8703         else
8704                 echo "You don't have Berkeley networking in libc$_a..." >&4
8705                 if test "X$d_socket" = "X$define"; then
8706                    echo "...but you seem to believe that you have sockets." >&4
8707                 else
8708                         for net in net socket
8709                         do
8710                                 if test -f /usr/lib/lib$net$_a; then
8711                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8712                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8713                                         if $contains socket libc.list >/dev/null 2>&1; then
8714                                                 d_socket="$define"
8715                                                 socketlib="-l$net"
8716                                                 case "$net" in
8717                                                 net)
8718                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8719                                                         sockethdr="-I/usr/netinclude"
8720                                                         ;;
8721                                                 esac
8722                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8723                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8724                                                         d_oldsock="$undef"
8725                                                 else
8726                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8727                                                         d_oldsock="$define"
8728                                                 fi
8729                                                 break
8730                                         fi
8731                                 fi
8732                         done
8733                         if test "X$d_socket" != "X$define"; then
8734                            echo "or anywhere else I see." >&4
8735                            d_socket="$undef"
8736                            d_oldsock="$undef"
8737                         fi
8738                 fi
8739         fi
8740 fi
8741
8742 : see if socketpair exists
8743 set socketpair d_sockpair
8744 eval $inlibc
8745
8746
8747 echo " "
8748 echo "Checking the availability of certain socket constants..." >& 4
8749 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8750         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8751         $cat >try.c <<EOF
8752 #include <sys/types.h>
8753 #include <sys/socket.h>
8754 int main() {
8755     int i = $ENUM;
8756 }
8757 EOF
8758         val="$undef"
8759         set try; if eval $compile; then
8760                 val="$define"
8761         fi
8762         set d_${enum}; eval $setvar
8763         $rm -f try.c try
8764 done
8765
8766 : see if sys/select.h has to be included
8767 set sys/select.h i_sysselct
8768 eval $inhdr
8769
8770 : see if we should include time.h, sys/time.h, or both
8771 echo " "
8772 if test "X$timeincl" = X; then
8773         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8774         $echo $n "I'm now running the test program...$c"
8775         $cat >try.c <<'EOCP'
8776 #include <sys/types.h>
8777 #ifdef I_TIME
8778 #include <time.h>
8779 #endif
8780 #ifdef I_SYSTIME
8781 #ifdef SYSTIMEKERNEL
8782 #define KERNEL
8783 #endif
8784 #include <sys/time.h>
8785 #endif
8786 #ifdef I_SYSSELECT
8787 #include <sys/select.h>
8788 #endif
8789 int main()
8790 {
8791         struct tm foo;
8792 #ifdef S_TIMEVAL
8793         struct timeval bar;
8794 #endif
8795 #ifdef S_TIMEZONE
8796         struct timezone tzp;
8797 #endif
8798         if (foo.tm_sec == foo.tm_sec)
8799                 exit(0);
8800 #ifdef S_TIMEVAL
8801         if (bar.tv_sec == bar.tv_sec)
8802                 exit(0);
8803 #endif
8804         exit(1);
8805 }
8806 EOCP
8807         flags=''
8808         for s_timezone in '-DS_TIMEZONE' ''; do
8809         sysselect=''
8810         for s_timeval in '-DS_TIMEVAL' ''; do
8811         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8812         for i_time in '' '-DI_TIME'; do
8813         for i_systime in '-DI_SYSTIME' ''; do
8814                 case "$flags" in
8815                 '') $echo $n ".$c"
8816                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8817                         if eval $compile; then
8818                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8819                                 shift
8820                                 flags="$*"
8821                                 echo " "
8822                                 $echo $n "Succeeded with $flags$c"
8823                         fi
8824                         ;;
8825                 esac
8826         done
8827         done
8828         done
8829         done
8830         done
8831         timeincl=''
8832         echo " "
8833         case "$flags" in
8834         *SYSTIMEKERNEL*) i_systimek="$define"
8835                 timeincl=`./findhdr sys/time.h`
8836                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8837         *) i_systimek="$undef";;
8838         esac
8839         case "$flags" in
8840         *I_TIME*) i_time="$define"
8841                 timeincl=`./findhdr time.h`" $timeincl"
8842                 echo "We'll include <time.h>." >&4;;
8843         *) i_time="$undef";;
8844         esac
8845         case "$flags" in
8846         *I_SYSTIME*) i_systime="$define"
8847                 timeincl=`./findhdr sys/time.h`" $timeincl"
8848                 echo "We'll include <sys/time.h>." >&4;;
8849         *) i_systime="$undef";;
8850         esac
8851         $rm -f try.c try
8852 fi
8853
8854 : check for fd_set items
8855 $cat <<EOM
8856
8857 Checking to see how well your C compiler handles fd_set and friends ...
8858 EOM
8859 $cat >fd_set.c <<EOCP
8860 #$i_systime I_SYS_TIME
8861 #$i_sysselct I_SYS_SELECT
8862 #$d_socket HAS_SOCKET
8863 #include <sys/types.h>
8864 #ifdef HAS_SOCKET
8865 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8866 #endif
8867 #ifdef I_SYS_TIME
8868 #include <sys/time.h>
8869 #endif
8870 #ifdef I_SYS_SELECT
8871 #include <sys/select.h>
8872 #endif
8873 int main() {
8874         fd_set fds;
8875
8876 #ifdef TRYBITS
8877         if(fds.fds_bits);
8878 #endif
8879
8880 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8881         exit(0);
8882 #else
8883         exit(1);
8884 #endif
8885 }
8886 EOCP
8887 set fd_set -DTRYBITS
8888 if eval $compile; then
8889         d_fds_bits="$define"
8890         d_fd_set="$define"
8891         echo "Well, your system knows about the normal fd_set typedef..." >&4
8892         if ./fd_set; then
8893                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8894                 d_fd_macros="$define"
8895         else
8896                 $cat >&4 <<'EOM'
8897 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8898 EOM
8899                 d_fd_macros="$undef"
8900         fi
8901 else
8902         $cat <<'EOM'
8903 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8904 EOM
8905         set fd_set
8906         if eval $compile; then
8907                 d_fds_bits="$undef"
8908                 d_fd_set="$define"
8909                 echo "Well, your system has some sort of fd_set available..." >&4
8910                 if ./fd_set; then
8911                         echo "and you have the normal fd_set macros." >&4
8912                         d_fd_macros="$define"
8913                 else
8914                         $cat <<'EOM'
8915 but not the normal fd_set macros!  Gross!  More work for me...
8916 EOM
8917                         d_fd_macros="$undef"
8918                 fi
8919         else
8920         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8921                 d_fd_set="$undef"
8922                 d_fds_bits="$undef"
8923                 d_fd_macros="$undef"
8924         fi
8925 fi
8926 $rm -f fd_set*
8927
8928 : see if fgetpos exists
8929 set fgetpos d_fgetpos
8930 eval $inlibc
8931
8932 : see if flock exists
8933 set flock d_flock
8934 eval $inlibc
8935
8936 : see if fork exists
8937 set fork d_fork
8938 eval $inlibc
8939
8940 : see if pathconf exists
8941 set pathconf d_pathconf
8942 eval $inlibc
8943
8944 : see if fpathconf exists
8945 set fpathconf d_fpathconf
8946 eval $inlibc
8947
8948
8949 : check for fpos64_t
8950 echo " "
8951 echo "Checking to see if you have fpos64_t..." >&4
8952 $cat >try.c <<EOCP
8953 #include <stdio.h>
8954 int main() { fpos64_t x = 7; }
8955 EOCP
8956 set try
8957 if eval $compile; then
8958         val="$define"
8959         echo "You have fpos64_t."
8960 else
8961         val="$undef"
8962         echo "You do not have fpos64_t."
8963         case "$fpossize" in
8964         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8965         esac
8966 fi
8967 $rm -f try.* try
8968 set d_fpos64_t
8969 eval $setvar
8970
8971 hasstruct='varname=$1; struct=$2; shift; shift;
8972 while $test $# -ge 2; do
8973         case "$1" in
8974         $define) echo "#include <$2>";;
8975         esac ;
8976     shift 2;
8977 done > try.c;
8978 echo "int main () { struct $struct foo; }" >> try.c;
8979 set try;
8980 if eval $compile; then
8981         val="$define";
8982 else
8983         val="$undef";
8984 fi;
8985 set $varname;
8986 eval $setvar;
8987 $rm -f try.c try.o'
8988
8989 : see if this is a sys/param system
8990 set sys/param.h i_sysparam
8991 eval $inhdr
8992
8993 : see if this is a sys/mount.h system
8994 set sys/mount.h i_sysmount
8995 eval $inhdr
8996
8997 : see if sys/types.h has to be included
8998 set sys/types.h i_systypes
8999 eval $inhdr
9000
9001
9002 echo " "
9003 echo "Checking to see if your system supports struct fs_data..." >&4
9004 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9005 eval $hasstruct
9006 case "$d_fs_data_s" in
9007 "$define")      echo "Yes, it does."   ;;
9008 *)              echo "No, it doesn't." ;;
9009 esac
9010
9011 : see if fseeko exists
9012 set fseeko d_fseeko
9013 eval $inlibc
9014 case "$longsize" in
9015 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9016 esac
9017
9018 : see if fsetpos exists
9019 set fsetpos d_fsetpos
9020 eval $inlibc
9021
9022
9023 : see if fstatfs exists
9024 set fstatfs d_fstatfs
9025 eval $inlibc
9026
9027
9028 : see if statvfs exists
9029 set statvfs d_statvfs
9030 eval $inlibc
9031
9032 : see if fstatvfs exists
9033 set fstatvfs d_fstatvfs
9034 eval $inlibc
9035
9036
9037 : see if ftello exists
9038 set ftello d_ftello
9039 eval $inlibc
9040 case "$longsize" in
9041 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9042 esac
9043
9044 : see if getcwd exists
9045 set getcwd d_getcwd
9046 eval $inlibc
9047
9048
9049 : see if getfsstat exists
9050 set getfsstat d_getfsstat
9051 eval $inlibc
9052
9053 : see if getgrent exists
9054 set getgrent d_getgrent
9055 eval $inlibc
9056
9057 : see if gethostbyaddr exists
9058 set gethostbyaddr d_gethbyaddr
9059 eval $inlibc
9060
9061 : see if gethostbyname exists
9062 set gethostbyname d_gethbyname
9063 eval $inlibc
9064
9065 : see if gethostent exists
9066 set gethostent d_gethent
9067 eval $inlibc
9068
9069 : see how we will look up host name
9070 echo " "
9071 call=''
9072 if set gethostname val -f d_gethname; eval $csym; $val; then
9073         echo 'gethostname() found.' >&4
9074         d_gethname="$define"
9075         call=gethostname
9076 fi
9077 if set uname val -f d_uname; eval $csym; $val; then
9078         if ./xenix; then
9079                 $cat <<'EOM'
9080 uname() was found, but you're running xenix, and older versions of xenix
9081 have a broken uname(). If you don't really know whether your xenix is old
9082 enough to have a broken system call, use the default answer.
9083
9084 EOM
9085                 dflt=y
9086                 case "$d_uname" in
9087                 "$define") dflt=n;;
9088                 esac
9089                 rp='Is your uname() broken?'
9090                 . ./myread
9091                 case "$ans" in
9092                 n*) d_uname="$define"; call=uname;;
9093                 esac
9094         else
9095                 echo 'uname() found.' >&4
9096                 d_uname="$define"
9097                 case "$call" in
9098                 '') call=uname ;;
9099                 esac
9100         fi
9101 fi
9102 case "$d_gethname" in
9103 '') d_gethname="$undef";;
9104 esac
9105 case "$d_uname" in
9106 '') d_uname="$undef";;
9107 esac
9108 case "$d_uname$d_gethname" in
9109 *define*)
9110         dflt=n
9111         cat <<EOM
9112  
9113 Every now and then someone has a $call() that lies about the hostname
9114 but can't be fixed for political or economic reasons.  If you wish, I can
9115 pretend $call() isn't there and maybe compute hostname at run-time
9116 thanks to the '$phostname' command.
9117
9118 EOM
9119         rp="Shall I ignore $call() from now on?"
9120         . ./myread
9121         case "$ans" in
9122         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9123         esac;;
9124 esac
9125 case "$phostname" in
9126 '') aphostname='';;
9127 *) case "$aphostname" in
9128         /*) ;;
9129         *) set X $phostname
9130                 shift
9131                 file=$1
9132                 shift
9133                 file=`./loc $file $file $pth`
9134                 aphostname=`echo $file $*`
9135                 ;;
9136         esac
9137         ;;
9138 esac
9139 case "$d_uname$d_gethname" in
9140 *define*) ;;
9141 *)
9142         case "$phostname" in
9143         '')
9144                 echo "There will be no way for $package to get your hostname." >&4;;
9145         *)
9146         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9147                 ;;
9148         esac;;
9149 esac
9150 case "$d_phostname" in
9151 '') d_phostname="$undef";;
9152 esac
9153
9154 : see if this is a netdb.h system
9155 set netdb.h i_netdb
9156 eval $inhdr
9157
9158 : see if prototypes for various gethostxxx netdb.h functions are available
9159 echo " "
9160 set d_gethostprotos gethostent $i_netdb netdb.h
9161 eval $hasproto
9162
9163 : see if getlogin exists
9164 set getlogin d_getlogin
9165 eval $inlibc
9166
9167 : see if getmnt exists
9168 set getmnt d_getmnt
9169 eval $inlibc
9170
9171 : see if getmntent exists
9172 set getmntent d_getmntent
9173 eval $inlibc
9174
9175 : see if getnetbyaddr exists
9176 set getnetbyaddr d_getnbyaddr
9177 eval $inlibc
9178
9179 : see if getnetbyname exists
9180 set getnetbyname d_getnbyname
9181 eval $inlibc
9182
9183 : see if getnetent exists
9184 set getnetent d_getnent
9185 eval $inlibc
9186
9187 : see if prototypes for various getnetxxx netdb.h functions are available
9188 echo " "
9189 set d_getnetprotos getnetent $i_netdb netdb.h
9190 eval $hasproto
9191
9192
9193 : see if getprotobyname exists
9194 set getprotobyname d_getpbyname
9195 eval $inlibc
9196
9197 : see if getprotobynumber exists
9198 set getprotobynumber d_getpbynumber
9199 eval $inlibc
9200
9201 : see if getprotoent exists
9202 set getprotoent d_getpent
9203 eval $inlibc
9204
9205 : see if getpgid exists
9206 set getpgid d_getpgid
9207 eval $inlibc
9208
9209 : see if getpgrp2 exists
9210 set getpgrp2 d_getpgrp2
9211 eval $inlibc
9212
9213 : see if getppid exists
9214 set getppid d_getppid
9215 eval $inlibc
9216
9217 : see if getpriority exists
9218 set getpriority d_getprior
9219 eval $inlibc
9220
9221 : see if prototypes for various getprotoxxx netdb.h functions are available
9222 echo " "
9223 set d_getprotoprotos getprotoent $i_netdb netdb.h
9224 eval $hasproto
9225
9226 : see if getpwent exists
9227 set getpwent d_getpwent
9228 eval $inlibc
9229
9230
9231 : see if getservbyname exists
9232 set getservbyname d_getsbyname
9233 eval $inlibc
9234
9235 : see if getservbyport exists
9236 set getservbyport d_getsbyport
9237 eval $inlibc
9238
9239 : see if getservent exists
9240 set getservent d_getsent
9241 eval $inlibc
9242
9243 : see if prototypes for various getservxxx netdb.h functions are available
9244 echo " "
9245 set d_getservprotos getservent $i_netdb netdb.h
9246 eval $hasproto
9247
9248 : see if getspent exists
9249 set getspent d_getspent
9250 eval $inlibc
9251
9252 : see if getspnam exists
9253 set getspnam d_getspnam
9254 eval $inlibc
9255
9256 : see if gettimeofday or ftime exists
9257 set gettimeofday d_gettimeod
9258 eval $inlibc
9259 case "$d_gettimeod" in
9260 "$undef")
9261         set ftime d_ftime 
9262         eval $inlibc
9263         ;;
9264 *)
9265         val="$undef"; set d_ftime; eval $setvar
9266         ;;
9267 esac
9268 case "$d_gettimeod$d_ftime" in
9269 "$undef$undef")
9270         echo " "
9271         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9272         ;;
9273 esac
9274
9275 : see if this is an grp system
9276 set grp.h i_grp
9277 eval $inhdr
9278
9279 case "$i_grp" in
9280 $define)
9281         xxx=`./findhdr grp.h`
9282         $cppstdin $cppflags $cppminus < $xxx >$$.h
9283
9284         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9285                 val="$define"
9286         else
9287                 val="$undef"
9288         fi
9289         set d_grpasswd
9290         eval $setvar
9291
9292         $rm -f $$.h
9293         ;;
9294 *)
9295         val="$undef";
9296         set d_grpasswd; eval $setvar
9297         ;;
9298 esac
9299
9300 : see if hasmntopt exists
9301 set hasmntopt d_hasmntopt
9302 eval $inlibc
9303
9304 : see if this is a netinet/in.h or sys/in.h system
9305 set netinet/in.h i_niin sys/in.h i_sysin
9306 eval $inhdr
9307
9308 : see if arpa/inet.h has to be included
9309 set arpa/inet.h i_arpainet
9310 eval $inhdr
9311
9312 : see if htonl --and friends-- exists
9313 val=''
9314 set htonl val
9315 eval $inlibc
9316
9317 : Maybe they are macros.
9318 case "$val" in
9319 $undef)
9320         $cat >htonl.c <<EOM
9321 #include <stdio.h>
9322 #include <sys/types.h>
9323 #$i_niin I_NETINET_IN
9324 #$i_sysin I_SYS_IN
9325 #$i_arpainet I_ARPA_INET
9326 #ifdef I_NETINET_IN
9327 #include <netinet/in.h>
9328 #endif
9329 #ifdef I_SYS_IN
9330 #include <sys/in.h>
9331 #endif
9332 #ifdef I_ARPA_INET
9333 #include <arpa/inet.h>
9334 #endif
9335 #ifdef htonl
9336 printf("Defined as a macro.");
9337 #endif
9338 EOM
9339         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9340         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9341                 val="$define"
9342                 echo "But it seems to be defined as a macro." >&4
9343         fi
9344         $rm -f htonl.?
9345         ;;
9346 esac
9347 set d_htonl
9348 eval $setvar
9349
9350 : see if iconv exists
9351 set iconv d_iconv
9352 eval $inlibc
9353
9354 : index or strchr
9355 echo " "
9356 if set index val -f; eval $csym; $val; then
9357         if set strchr val -f d_strchr; eval $csym; $val; then
9358                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9359                         val="$define"
9360                         vali="$undef"
9361                         echo "strchr() found." >&4
9362                 else
9363                         val="$undef"
9364                         vali="$define"
9365                         echo "index() found." >&4
9366                 fi
9367         else
9368                 val="$undef"
9369                 vali="$define"
9370                 echo "index() found." >&4
9371         fi
9372 else
9373         if set strchr val -f d_strchr; eval $csym; $val; then
9374                 val="$define"
9375                 vali="$undef"
9376                 echo "strchr() found." >&4
9377         else
9378                 echo "No index() or strchr() found!" >&4
9379                 val="$undef"
9380                 vali="$undef"
9381         fi
9382 fi
9383 set d_strchr; eval $setvar
9384 val="$vali"
9385 set d_index; eval $setvar
9386
9387 : check whether inet_aton exists
9388 set inet_aton d_inetaton
9389 eval $inlibc
9390
9391 : see if inttypes.h is available
9392 : we want a real compile instead of Inhdr because some systems
9393 : have an inttypes.h which includes non-existent headers
9394 echo " "
9395 $cat >try.c <<EOCP
9396 #include <inttypes.h>
9397 int main() {
9398         static int32_t foo32 = 0x12345678;
9399 }
9400 EOCP
9401 set try
9402 if eval $compile; then
9403         echo "<inttypes.h> found." >&4
9404         val="$define"
9405 else
9406         echo "<inttypes.h> NOT found." >&4
9407         val="$undef"
9408 fi
9409 $rm -f try.c try
9410 set i_inttypes
9411 eval $setvar
9412
9413 : check for int64_t
9414 echo " "
9415 echo "Checking to see if you have int64_t..." >&4
9416 $cat >try.c <<EOCP
9417 #include <sys/types.h>
9418 #$i_inttypes I_INTTYPES
9419 #ifdef I_INTTYPES
9420 #include <inttypes.h>
9421 #endif
9422 int main() { int64_t x = 7; }
9423 EOCP
9424 set try
9425 if eval $compile; then
9426         val="$define"
9427         echo "You have int64_t."
9428 else
9429         val="$undef"
9430         echo "You do not have int64_t."
9431 fi
9432 $rm -f try try.*
9433 set d_int64_t
9434 eval $setvar
9435
9436 : Look for isascii
9437 echo " "
9438 $cat >isascii.c <<'EOCP'
9439 #include <stdio.h>
9440 #include <ctype.h>
9441 int main() {
9442         int c = 'A';
9443         if (isascii(c))
9444                 exit(0);
9445         else
9446                 exit(1);
9447 }
9448 EOCP
9449 set isascii
9450 if eval $compile; then
9451         echo "isascii() found." >&4
9452         val="$define"
9453 else
9454         echo "isascii() NOT found." >&4
9455         val="$undef"
9456 fi
9457 set d_isascii
9458 eval $setvar
9459 $rm -f isascii*
9460
9461 : see if killpg exists
9462 set killpg d_killpg
9463 eval $inlibc
9464
9465 : see if lchown exists
9466 echo " "
9467 $cat > try.c <<'EOCP'
9468 /* System header to define __stub macros and hopefully few prototypes,
9469     which can conflict with char lchown(); below.  */
9470 #include <assert.h>
9471 /* Override any gcc2 internal prototype to avoid an error.  */
9472 /* We use char because int might match the return type of a gcc2
9473    builtin and then its argument prototype would still apply.  */
9474 char lchown();
9475 int main() {
9476     /*  The GNU C library defines this for functions which it implements
9477         to always fail with ENOSYS.  Some functions are actually named
9478         something starting with __ and the normal name is an alias.  */
9479 #if defined (__stub_lchown) || defined (__stub___lchown)
9480 choke me
9481 #else
9482 lchown();
9483 #endif
9484 ; return 0; }
9485 EOCP
9486 set try
9487 if eval $compile; then
9488     $echo "lchown() found." >&4
9489     val="$define"
9490 else
9491     $echo "lchown() NOT found." >&4
9492     val="$undef"
9493 fi
9494 set d_lchown
9495 eval $setvar
9496
9497 : See if number of significant digits in a double precision number is known
9498 echo " "
9499 $cat >ldbl_dig.c <<EOM
9500 #$i_limits I_LIMITS
9501 #$i_float I_FLOAT
9502 #ifdef I_LIMITS
9503 #include <limits.h>
9504 #endif
9505 #ifdef I_FLOAT
9506 #include <float.h>
9507 #endif
9508 #ifdef LDBL_DIG
9509 printf("Contains LDBL_DIG");
9510 #endif
9511 EOM
9512 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9513 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9514         echo "LDBL_DIG found." >&4
9515         val="$define"
9516 else
9517         echo "LDBL_DIG NOT found." >&4
9518         val="$undef"
9519 fi
9520 $rm -f ldbl_dig.?
9521 set d_ldbl_dig
9522 eval $setvar
9523
9524 : see if link exists
9525 set link d_link
9526 eval $inlibc
9527
9528 : see if localeconv exists
9529 set localeconv d_locconv
9530 eval $inlibc
9531
9532 : see if lockf exists
9533 set lockf d_lockf
9534 eval $inlibc
9535
9536 : check for long long
9537 echo " "
9538 echo "Checking to see if you have long long..." >&4
9539 echo 'int main() { long long x = 7; return 0; }' > try.c
9540 set try
9541 if eval $compile; then
9542         val="$define"
9543         echo "You have have long long."
9544 else
9545         val="$undef"
9546         echo "You do not have long long."
9547 fi
9548 $rm try.*
9549 set d_longlong
9550 eval $setvar
9551
9552 : check for length of long long
9553 case "${d_longlong}${longlongsize}" in
9554 $define)
9555         echo " "
9556         echo "Checking to see how big your long longs are..." >&4
9557         $cat >try.c <<'EOCP'
9558 #include <stdio.h>
9559 int main()
9560 {
9561     printf("%d\n", (int)sizeof(long long));
9562     return(0);
9563 }
9564 EOCP
9565         set try
9566         if eval $compile_ok; then
9567                 longlongsize=`./try$exe_ext`
9568                 echo "Your long longs are $longlongsize bytes long."
9569         else
9570                 dflt='8'
9571                 echo " "
9572                 echo "(I can't seem to compile the test program.  Guessing...)"
9573                 rp="What is the size of a long long (in bytes)?"
9574                 . ./myread
9575                 longlongsize="$ans"
9576         fi
9577         if $test "X$longsize" = "X$longlongsize"; then
9578                 echo "(That isn't any different from an ordinary long.)"
9579         fi      
9580         ;;
9581 esac
9582 $rm -f try.* try
9583
9584 : see if prototype for lseek is available
9585 echo " "
9586 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9587 eval $hasproto
9588
9589 : see if lstat exists
9590 set lstat d_lstat
9591 eval $inlibc
9592
9593 : see if mblen exists
9594 set mblen d_mblen
9595 eval $inlibc
9596
9597 : see if mbstowcs exists
9598 set mbstowcs d_mbstowcs
9599 eval $inlibc
9600
9601 : see if mbtowc exists
9602 set mbtowc d_mbtowc
9603 eval $inlibc
9604
9605 : see if memchr exists
9606 set memchr d_memchr
9607 eval $inlibc
9608
9609 : see if memcmp exists
9610 set memcmp d_memcmp
9611 eval $inlibc
9612
9613 : see if memcpy exists
9614 set memcpy d_memcpy
9615 eval $inlibc
9616
9617 : see if memmove exists
9618 set memmove d_memmove
9619 eval $inlibc
9620
9621 : see if memset exists
9622 set memset d_memset
9623 eval $inlibc
9624
9625 : see if mkdir exists
9626 set mkdir d_mkdir
9627 eval $inlibc
9628
9629 : see if mkdtemp exists
9630 set mkdtemp d_mkdtemp
9631 eval $inlibc
9632
9633 : see if mkfifo exists
9634 set mkfifo d_mkfifo
9635 eval $inlibc
9636
9637 : see if mkstemp exists
9638 set mkstemp d_mkstemp
9639 eval $inlibc
9640
9641 : see if mkstemps exists
9642 set mkstemps d_mkstemps
9643 eval $inlibc
9644
9645 : see if mktime exists
9646 set mktime d_mktime
9647 eval $inlibc
9648
9649 : see if this is a sys/mman.h system
9650 set sys/mman.h i_sysmman
9651 eval $inhdr
9652
9653 : see if mmap exists
9654 set mmap d_mmap
9655 eval $inlibc
9656 : see what shmat returns
9657 : default to something harmless
9658 mmaptype='void *'
9659 case "$i_sysmman$d_mmap" in
9660 "$define$define")
9661         $cat >mmap.c <<'END'
9662 #include <sys/mman.h>
9663 void *mmap();
9664 END
9665         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9666                 mmaptype='void *'
9667         else
9668                 mmaptype='caddr_t'
9669         fi
9670         echo "and it returns ($mmaptype)." >&4
9671         ;;
9672 esac
9673
9674
9675
9676 : see if mprotect exists
9677 set mprotect d_mprotect
9678 eval $inlibc
9679
9680 : see if msgctl exists
9681 set msgctl d_msgctl
9682 eval $inlibc
9683
9684 : see if msgget exists
9685 set msgget d_msgget
9686 eval $inlibc
9687
9688 : see if msgsnd exists
9689 set msgsnd d_msgsnd
9690 eval $inlibc
9691
9692 : see if msgrcv exists
9693 set msgrcv d_msgrcv
9694 eval $inlibc
9695
9696 : see how much of the 'msg*(2)' library is present.
9697 h_msg=true
9698 echo " "
9699 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9700 *"$undef"*) h_msg=false;;
9701 esac
9702 case "$osname" in
9703 freebsd)
9704     case "`ipcs 2>&1`" in
9705     "SVID messages"*"not configured"*)
9706         echo "Your $osname does not have the msg*(2) configured." >&4
9707         h_msg=false
9708         val="$undef"
9709         set msgctl d_msgctl
9710         eval $setvar
9711         set msgget d_msgget
9712         eval $setvar
9713         set msgsnd d_msgsnd
9714         eval $setvar
9715         set msgrcv d_msgrcv
9716         eval $setvar
9717         ;;
9718     esac
9719     ;;
9720 esac
9721 : we could also check for sys/ipc.h ...
9722 if $h_msg && $test `./findhdr sys/msg.h`; then
9723         echo "You have the full msg*(2) library." >&4
9724         val="$define"
9725 else
9726         echo "You don't have the full msg*(2) library." >&4
9727         val="$undef"
9728 fi
9729 set d_msg
9730 eval $setvar
9731
9732 : see if msync exists
9733 set msync d_msync
9734 eval $inlibc
9735
9736 : see if munmap exists
9737 set munmap d_munmap
9738 eval $inlibc
9739
9740 : see if nice exists
9741 set nice d_nice
9742 eval $inlibc
9743
9744
9745 echo " "
9746 echo "Checking which 64-bit integer type we could use..." >&4
9747
9748 case "$intsize" in
9749 8) val=int
9750    set quadtype
9751    eval $setvar
9752    val='"unsigned int"'
9753    set uquadtype
9754    eval $setvar
9755    quadkind=1
9756    ;;
9757 *) case "$longsize" in
9758    8) val=long
9759       set quadtype
9760       eval $setvar
9761       val='"unsigned long"'
9762       set uquadtype
9763       eval $setvar
9764       quadkind=2
9765       ;;
9766    *) case "$d_longlong:$longlongsize" in
9767       define:8)
9768         val='"long long"'
9769         set quadtype
9770         eval $setvar
9771         val='"unsigned long long"'
9772         set uquadtype
9773         eval $setvar
9774         quadkind=3
9775         ;;
9776       *) case "$d_int64_t" in
9777          define)
9778            val=int64_t
9779            set quadtype
9780            eval $setvar
9781            val=uint64_t
9782            set uquadtype
9783            eval $setvar
9784            quadkind=4
9785            ;;
9786          esac
9787          ;;
9788       esac
9789       ;;
9790    esac
9791    ;;
9792 esac
9793
9794 case "$quadtype" in
9795 '')     echo "Alas, no 64-bit integer types in sight." >&4
9796         d_quad="$undef"
9797         ;;
9798 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9799             verb="will"
9800         else
9801             verb="could"
9802         fi
9803         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9804         d_quad="$define"
9805         ;;
9806 esac
9807
9808 : check for length of character
9809 echo " "
9810 case "$charsize" in
9811 '')
9812         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9813         $cat >try.c <<'EOCP'
9814 #include <stdio.h>
9815 int main()
9816 {
9817     printf("%d\n", (int)sizeof(char));
9818     exit(0);
9819 }
9820 EOCP
9821         set try
9822         if eval $compile_ok; then
9823                 dflt=`./try`
9824         else
9825                 dflt='1'
9826                 echo "(I can't seem to compile the test program.  Guessing...)"
9827         fi
9828         ;;
9829 *)
9830         dflt="$charsize"
9831         ;;
9832 esac
9833 rp="What is the size of a character (in bytes)?"
9834 . ./myread
9835 charsize="$ans"
9836 $rm -f try.c try
9837
9838
9839 echo " "
9840 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9841
9842 case "$use64bitint:$d_quad:$quadtype" in
9843 define:define:?*)
9844         ivtype="$quadtype"
9845         uvtype="$uquadtype"
9846         ivsize=8
9847         uvsize=8
9848         ;;
9849 *)      ivtype="long"
9850         uvtype="unsigned long"
9851         ivsize=$longsize
9852         uvsize=$longsize
9853         ;;
9854 esac
9855
9856 case "$uselongdouble:$d_longdbl" in
9857 define:define)
9858         nvtype="long double"
9859         nvsize=$longdblsize
9860         ;;
9861 *)      nvtype=double
9862         nvsize=$doublesize
9863         ;;
9864 esac
9865
9866 $echo "(IV will be "$ivtype", $ivsize bytes)"
9867 $echo "(UV will be "$uvtype", $uvsize bytes)"
9868 $echo "(NV will be "$nvtype", $nvsize bytes)"
9869
9870 $cat >try.c <<EOCP
9871 #$i_inttypes I_INTTYPES
9872 #ifdef I_INTTYPES
9873 #include <inttypes.h>
9874 #endif
9875 #include <stdio.h>
9876 int main() {
9877 #ifdef INT8
9878    int8_t i =  INT8_MAX;
9879   uint8_t u = UINT8_MAX;
9880   printf("int8_t\n");
9881 #endif
9882 #ifdef INT16
9883    int16_t i =  INT16_MAX;
9884   uint16_t i = UINT16_MAX;
9885   printf("int16_t\n");
9886 #endif
9887 #ifdef INT32
9888    int32_t i =  INT32_MAX;
9889   uint32_t u = UINT32_MAX;
9890   printf("int32_t\n");
9891 #endif
9892 }
9893 EOCP
9894
9895 case "$i8type" in
9896 '')     case "$charsize" in
9897         1)      i8type=char
9898                 u8type="unsigned char"
9899                 i8size=$charsize
9900                 u8size=$charsize
9901                 ;;
9902         esac
9903         ;;
9904 esac
9905 case "$i8type" in
9906 '')     set try -DINT8
9907         if eval $compile; then
9908                 case "`./try$exe_ext`" in
9909                 int8_t) i8type=int8_t
9910                         u8type=uint8_t
9911                         i8size=1
9912                         u8size=1
9913                         ;;
9914                 esac
9915         fi
9916         ;;
9917 esac
9918 case "$i8type" in
9919 '')     if $test $charsize -ge 1; then
9920                 i8type=char
9921                 u8type="unsigned char"
9922                 i8size=$charsize
9923                 u8size=$charsize
9924         fi
9925         ;;
9926 esac
9927
9928 case "$i16type" in
9929 '')     case "$shortsize" in
9930         2)      i16type=short
9931                 u16type="unsigned short"
9932                 i16size=$shortsize
9933                 u16size=$shortsize
9934                 ;;
9935         esac
9936         ;;
9937 esac
9938 case "$i16type" in
9939 '')     set try -DINT16
9940         if eval $compile; then
9941                 case "`./try$exe_ext`" in
9942                 int16_t)
9943                         i16type=int16_t
9944                         u16type=uint16_t
9945                         i16size=2
9946                         u16size=2
9947                         ;;
9948                 esac
9949         fi
9950         ;;
9951 esac
9952 case "$i16type" in
9953 '')     if $test $shortsize -ge 2; then
9954                 i16type=short
9955                 u16type="unsigned short"
9956                 i16size=$shortsize
9957                 u16size=$shortsize
9958         fi
9959         ;;
9960 esac
9961
9962 case "$i32type" in
9963 '')     case "$longsize" in
9964         4)      i32type=long
9965                 u32type="unsigned long"
9966                 i32size=$longsize
9967                 u32size=$longsize
9968                 ;;
9969         *)      case "$intsize" in
9970                 4)      i32type=int
9971                         u32type="unsigned int"
9972                         i32size=$intsize
9973                         u32size=$intsize
9974                         ;;
9975                 esac
9976                 ;;
9977         esac
9978         ;;
9979 esac
9980 case "$i32type" in
9981 '')     set try -DINT32
9982         if eval $compile; then
9983                 case "`./try$exe_ext`" in
9984                 int32_t)
9985                         i32type=int32_t
9986                         u32type=uint32_t
9987                         i32size=4
9988                         u32size=4
9989                         ;;
9990                 esac
9991         fi
9992         ;;
9993 esac
9994 case "$i32type" in
9995 '')     if $test $intsize -ge 4; then
9996                 i32type=int
9997                 u32type="unsigned int"
9998                 i32size=$intsize
9999                 u32size=$intsize
10000         fi
10001         ;;
10002 esac
10003
10004 case "$i64type" in
10005 '')     case "$d_quad:$quadtype" in
10006         define:?*)
10007                 i64type="$quadtype"
10008                 u64type="$uquadtype"
10009                 i64size=8
10010                 u64size=8
10011                 ;;
10012         esac
10013         ;;
10014 esac
10015
10016 $echo "Checking whether your NVs can preserve your UVs..." >&4
10017 $cat <<EOP >try.c
10018 #include <stdio.h>
10019 int main() {
10020     $uvtype k = ($uvtype)~0, l;
10021     $nvtype d;
10022     l = k;
10023     d = ($nvtype)l;
10024     l = ($uvtype)d;
10025     if (l == k)
10026        printf("preserve\n");
10027     exit(0);
10028 }
10029 EOP
10030 set try
10031 if eval $compile; then
10032         case "`./try$exe_ext`" in
10033         preserve) d_nv_preserves_uv="$define" ;;
10034         esac
10035 fi      
10036 case "$d_nv_preserves_uv" in
10037 $define) $echo "Yes, they can."  2>&1 ;;
10038 *)       $echo "No, they can't." 2>&1
10039          d_nv_preserves_uv="$undef"
10040          ;;
10041 esac
10042
10043 $rm -f try.* try
10044
10045
10046 : check for off64_t
10047 echo " "
10048 echo "Checking to see if you have off64_t..." >&4
10049 $cat >try.c <<EOCP
10050 #include <sys/types.h>
10051 #include <unistd.h>
10052 int main() { off64_t x = 7; }
10053 EOCP
10054 set try
10055 if eval $compile; then
10056         val="$define"
10057         echo "You have off64_t."
10058 else
10059         val="$undef"
10060         echo "You do not have off64_t."
10061         case "$lseeksize" in
10062         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10063         esac
10064 fi
10065 $rm -f try.* try
10066 set d_off64_t
10067 eval $setvar
10068
10069 : see if POSIX threads are available
10070 set pthread.h i_pthread
10071 eval $inhdr
10072
10073
10074
10075
10076 : how to create joinable pthreads
10077 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10078         echo " "
10079         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10080         $cat >try.c <<'EOCP'
10081 #include <pthread.h>
10082 int main() {
10083     int detachstate = JOINABLE;
10084 }
10085 EOCP
10086         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10087         if eval $compile; then
10088                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10089                 val="$undef" # Yes, undef.
10090                 set d_old_pthread_create_joinable
10091                 eval $setvar
10092                 val=""
10093                 set old_pthread_create_joinable
10094                 eval $setvar
10095         else
10096                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10097                 if eval $compile; then
10098                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10099                         val="$define"
10100                         set d_old_pthread_create_joinable
10101                         eval $setvar
10102                         val=PTHREAD_CREATE_UNDETACHED
10103                         set old_pthread_create_joinable
10104                         eval $setvar
10105                 else            
10106                         set try -DJOINABLE=__UNDETACHED
10107                         if eval $compile; then
10108                                 echo "You seem to use __UNDETACHED." >&4
10109                                 val="$define"
10110                                 set d_old_pthread_create_joinable
10111                                 eval $setvar
10112                                 val=__UNDETACHED
10113                                 set old_pthread_create_joinable
10114                                 eval $setvar
10115                         else
10116                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10117                                 val="$define"
10118                                 set d_old_pthread_create_joinable
10119                                 eval $setvar
10120                                 val=0
10121                                 set old_pthread_create_joinable
10122                                 eval $setvar
10123                         fi
10124                 fi
10125         fi
10126         $rm -f try try.*
10127 else
10128     d_old_pthread_create_joinable="$undef"
10129     old_pthread_create_joinable=""
10130 fi
10131
10132 : see if pause exists
10133 set pause d_pause
10134 eval $inlibc
10135
10136 : see if pipe exists
10137 set pipe d_pipe
10138 eval $inlibc
10139
10140 : see if poll exists
10141 set poll d_poll
10142 eval $inlibc
10143
10144
10145 : see whether the various POSIXish _yields exist
10146 $cat >try.c <<EOP
10147 #include <pthread.h>
10148 #include <stdio.h>
10149 int main() {
10150 #ifdef SCHED_YIELD
10151         sched_yield();
10152 #else
10153 #ifdef PTHREAD_YIELD
10154         pthread_yield();
10155 #else
10156 #ifdef PTHREAD_YIELD_NULL
10157         pthread_yield(NULL);
10158 #endif
10159 #endif
10160 #endif
10161 }
10162 EOP
10163 : see if sched_yield exists
10164 set try -DSCHED_YIELD
10165 if eval $compile; then
10166     val="$define"
10167     sched_yield='sched_yield()'
10168 else
10169     val="$undef"
10170 fi
10171 case "$usethreads" in
10172 $define)
10173         case "$val" in
10174         $define) echo 'sched_yield() found.' >&4        ;;
10175         *)       echo 'sched_yield() NOT found.' >&4    ;;
10176         esac
10177 esac
10178 set d_sched_yield
10179 eval $setvar
10180
10181 : see if pthread_yield exists
10182 set try -DPTHREAD_YIELD
10183 if eval $compile; then
10184     val="$define"
10185     case "$sched_yield" in
10186     '') sched_yield='pthread_yield()' ;;
10187     esac
10188 else
10189     set try -DPTHREAD_YIELD_NULL
10190     if eval $compile; then
10191         val="$define"
10192         case "$sched_yield" in
10193         '') sched_yield='pthread_yield(NULL)' ;;
10194         esac
10195     else
10196         val="$undef"
10197     fi
10198 fi
10199 case "$usethreads" in
10200 $define)
10201         case "$val" in
10202         $define) echo 'pthread_yield() found.' >&4      ;;
10203         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10204         esac
10205         ;;
10206 esac
10207 set d_pthread_yield
10208 eval $setvar
10209
10210 case "$sched_yield" in
10211 '') sched_yield=undef ;;
10212 esac
10213
10214 $rm -f try try.*
10215
10216 : see if this is a pwd.h system
10217 set pwd.h i_pwd
10218 eval $inhdr
10219
10220 case "$i_pwd" in
10221 $define)
10222         xxx=`./findhdr pwd.h`
10223         $cppstdin $cppflags $cppminus < $xxx >$$.h
10224
10225         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10226                 val="$define"
10227         else
10228                 val="$undef"
10229         fi
10230         set d_pwquota
10231         eval $setvar
10232
10233         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10234                 val="$define"
10235         else
10236                 val="$undef"
10237         fi
10238         set d_pwage
10239         eval $setvar
10240
10241         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10242                 val="$define"
10243         else
10244                 val="$undef"
10245         fi
10246         set d_pwchange
10247         eval $setvar
10248
10249         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10250                 val="$define"
10251         else
10252                 val="$undef"
10253         fi
10254         set d_pwclass
10255         eval $setvar
10256
10257         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10258                 val="$define"
10259         else
10260                 val="$undef"
10261         fi
10262         set d_pwexpire
10263         eval $setvar
10264
10265         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10266                 val="$define"
10267         else
10268                 val="$undef"
10269         fi
10270         set d_pwcomment
10271         eval $setvar
10272
10273         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10274                 val="$define"
10275         else
10276                 val="$undef"
10277         fi
10278         set d_pwgecos
10279         eval $setvar
10280
10281         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10282                 val="$define"
10283         else
10284                 val="$undef"
10285         fi
10286         set d_pwpasswd
10287         eval $setvar
10288
10289         $rm -f $$.h
10290         ;;
10291 *)
10292         val="$undef"; 
10293         set d_pwquota; eval $setvar
10294         set d_pwage; eval $setvar
10295         set d_pwchange; eval $setvar
10296         set d_pwclass; eval $setvar
10297         set d_pwexpire; eval $setvar
10298         set d_pwcomment; eval $setvar
10299         set d_pwgecos; eval $setvar
10300         set d_pwpasswd; eval $setvar
10301         ;;
10302 esac
10303
10304 : see if readdir and friends exist
10305 set readdir d_readdir
10306 eval $inlibc
10307 set seekdir d_seekdir
10308 eval $inlibc
10309 set telldir d_telldir
10310 eval $inlibc
10311 set rewinddir d_rewinddir
10312 eval $inlibc
10313
10314 : see if readlink exists
10315 set readlink d_readlink
10316 eval $inlibc
10317
10318 : see if rename exists
10319 set rename d_rename
10320 eval $inlibc
10321
10322 : see if rmdir exists
10323 set rmdir d_rmdir
10324 eval $inlibc
10325
10326 : see if memory.h is available.
10327 val=''
10328 set memory.h val
10329 eval $inhdr
10330
10331 : See if it conflicts with string.h
10332 case "$val" in
10333 $define)
10334         case "$strings" in
10335         '') ;;
10336         *)
10337                 $cppstdin $cppflags $cppminus < $strings > mem.h
10338                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10339                         echo " "
10340                         echo "We won't be including <memory.h>."
10341                         val="$undef"
10342                 fi
10343                 $rm -f mem.h
10344                 ;;
10345         esac
10346 esac
10347 set i_memory
10348 eval $setvar
10349
10350 : can bcopy handle overlapping blocks?
10351 val="$undef"
10352 case "$d_bcopy" in
10353 "$define")
10354         echo " "
10355         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10356         $cat >try.c <<EOCP
10357 #$i_memory I_MEMORY
10358 #$i_stdlib I_STDLIB
10359 #$i_string I_STRING
10360 #$i_unistd I_UNISTD
10361 EOCP
10362         $cat >>try.c <<'EOCP'
10363 #include <stdio.h>
10364 #ifdef I_MEMORY
10365 #  include <memory.h>
10366 #endif
10367 #ifdef I_STDLIB
10368 #  include <stdlib.h>
10369 #endif
10370 #ifdef I_STRING
10371 #  include <string.h>
10372 #else
10373 #  include <strings.h>
10374 #endif
10375 #ifdef I_UNISTD
10376 #  include <unistd.h>  /* Needed for NetBSD */
10377 #endif
10378 int main()
10379 {
10380 char buf[128], abc[128];
10381 char *b;
10382 int len;
10383 int off;
10384 int align;
10385
10386 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10387
10388 for (align = 7; align >= 0; align--) {
10389         for (len = 36; len; len--) {
10390                 b = buf+align;
10391                 bcopy(abc, b, len);
10392                 for (off = 1; off <= len; off++) {
10393                         bcopy(b, b+off, len);
10394                         bcopy(b+off, b, len);
10395                         if (bcmp(b, abc, len))
10396                                 exit(1);
10397                 }
10398         }
10399 }
10400 exit(0);
10401 }
10402 EOCP
10403         set try
10404         if eval $compile_ok; then
10405                 if ./try 2>/dev/null; then
10406                         echo "Yes, it can."
10407                         val="$define"
10408                 else
10409                         echo "It can't, sorry."
10410                         case "$d_memmove" in
10411                         "$define") echo "But that's Ok since you have memmove()." ;;
10412                         esac
10413                 fi
10414         else
10415                 echo "(I can't compile the test program, so we'll assume not...)"
10416                 case "$d_memmove" in
10417                 "$define") echo "But that's Ok since you have memmove()." ;;
10418                 esac
10419         fi
10420         ;;
10421 esac
10422 $rm -f try.* try core
10423 set d_safebcpy
10424 eval $setvar
10425
10426 : can memcpy handle overlapping blocks?
10427 val="$undef"
10428 case "$d_memcpy" in
10429 "$define")
10430         echo " "
10431         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10432         $cat >try.c <<EOCP
10433 #$i_memory I_MEMORY
10434 #$i_stdlib I_STDLIB
10435 #$i_string I_STRING
10436 #$i_unistd I_UNISTD
10437 EOCP
10438         $cat >>try.c <<'EOCP'
10439 #include <stdio.h>
10440 #ifdef I_MEMORY
10441 #  include <memory.h>
10442 #endif
10443 #ifdef I_STDLIB
10444 #  include <stdlib.h>
10445 #endif
10446 #ifdef I_STRING
10447 #  include <string.h>
10448 #else
10449 #  include <strings.h>
10450 #endif
10451 #ifdef I_UNISTD
10452 #  include <unistd.h>  /* Needed for NetBSD */
10453 #endif
10454 int main()
10455 {
10456 char buf[128], abc[128];
10457 char *b;
10458 int len;
10459 int off;
10460 int align;
10461
10462 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10463    try to store the string in read-only memory. */
10464 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10465
10466 for (align = 7; align >= 0; align--) {
10467         for (len = 36; len; len--) {
10468                 b = buf+align;
10469                 memcpy(b, abc, len);
10470                 for (off = 1; off <= len; off++) {
10471                         memcpy(b+off, b, len);
10472                         memcpy(b, b+off, len);
10473                         if (memcmp(b, abc, len))
10474                                 exit(1);
10475                 }
10476         }
10477 }
10478 exit(0);
10479 }
10480 EOCP
10481         set try
10482         if eval $compile_ok; then
10483                 if ./try 2>/dev/null; then
10484                         echo "Yes, it can."
10485                         val="$define"
10486                 else
10487                         echo "It can't, sorry."
10488                         case "$d_memmove" in
10489                         "$define") echo "But that's Ok since you have memmove()." ;;
10490                         esac
10491                 fi
10492         else
10493                 echo "(I can't compile the test program, so we'll assume not...)"
10494                 case "$d_memmove" in
10495                 "$define") echo "But that's Ok since you have memmove()." ;;
10496                 esac
10497         fi
10498         ;;
10499 esac
10500 $rm -f try.* try core
10501 set d_safemcpy
10502 eval $setvar
10503
10504 : can memcmp be trusted to compare relative magnitude?
10505 val="$undef"
10506 case "$d_memcmp" in
10507 "$define")
10508         echo " "
10509         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10510         $cat >try.c <<EOCP
10511 #$i_memory I_MEMORY
10512 #$i_stdlib I_STDLIB
10513 #$i_string I_STRING
10514 #$i_unistd I_UNISTD
10515 EOCP
10516         $cat >>try.c <<'EOCP'
10517 #include <stdio.h>
10518 #ifdef I_MEMORY
10519 #  include <memory.h>
10520 #endif
10521 #ifdef I_STDLIB
10522 #  include <stdlib.h>
10523 #endif
10524 #ifdef I_STRING
10525 #  include <string.h>
10526 #else
10527 #  include <strings.h>
10528 #endif
10529 #ifdef I_UNISTD
10530 #  include <unistd.h>  /* Needed for NetBSD */
10531 #endif
10532 int main()
10533 {
10534 char a = -1;
10535 char b = 0;
10536 if ((a < b) && memcmp(&a, &b, 1) < 0)
10537         exit(1);
10538 exit(0);
10539 }
10540 EOCP
10541         set try
10542         if eval $compile_ok; then
10543                 if ./try 2>/dev/null; then
10544                         echo "Yes, it can."
10545                         val="$define"
10546                 else
10547                         echo "No, it can't (it uses signed chars)."
10548                 fi
10549         else
10550                 echo "(I can't compile the test program, so we'll assume not...)"
10551         fi
10552         ;;
10553 esac
10554 $rm -f try.* try core
10555 set d_sanemcmp
10556 eval $setvar
10557
10558 : see if select exists
10559 set select d_select
10560 eval $inlibc
10561
10562 : see if semctl exists
10563 set semctl d_semctl
10564 eval $inlibc
10565
10566 : see if semget exists
10567 set semget d_semget
10568 eval $inlibc
10569
10570 : see if semop exists
10571 set semop d_semop
10572 eval $inlibc
10573
10574 : see how much of the 'sem*(2)' library is present.
10575 h_sem=true
10576 echo " "
10577 case "$d_semctl$d_semget$d_semop" in
10578 *"$undef"*) h_sem=false;;
10579 esac
10580 case "$osname" in
10581 freebsd)
10582     case "`ipcs 2>&1`" in
10583     "SVID messages"*"not configured"*)
10584         echo "Your $osname does not have the sem*(2) configured." >&4
10585         h_sem=false
10586         val="$undef"
10587         set semctl d_semctl
10588         eval $setvar
10589         set semget d_semget
10590         eval $setvar
10591         set semop d_semop
10592         eval $setvar
10593         ;;
10594     esac
10595     ;;
10596 esac
10597 : we could also check for sys/ipc.h ...
10598 if $h_sem && $test `./findhdr sys/sem.h`; then
10599         echo "You have the full sem*(2) library." >&4
10600         val="$define"
10601 else
10602         echo "You don't have the full sem*(2) library." >&4
10603         val="$undef"
10604 fi
10605 set d_sem
10606 eval $setvar
10607
10608 : see whether sys/sem.h defines union semun
10609 echo " "
10610 $cat > try.c <<'END'
10611 #include <sys/types.h>
10612 #include <sys/ipc.h>
10613 #include <sys/sem.h>
10614 int main () { union semun semun; semun.buf = 0; }
10615 END
10616 set try
10617 if eval $compile; then
10618     echo "You have union semun in <sys/sem.h>." >&4
10619     val="$define"
10620 else
10621     echo "You do not have union semun in <sys/sem.h>." >&4
10622     val="$undef"
10623 fi
10624 $rm -f try try.c try.h
10625 set d_union_semun
10626 eval $setvar
10627
10628 : see how to do semctl IPC_STAT
10629 case "$d_sem" in
10630 $define)
10631     : see whether semctl IPC_STAT can use union semun
10632     echo " "
10633     $cat > try.h <<END
10634 #ifndef S_IRUSR
10635 #   ifdef S_IREAD
10636 #       define S_IRUSR S_IREAD
10637 #       define S_IWUSR S_IWRITE
10638 #       define S_IXUSR S_IEXEC
10639 #   else
10640 #       define S_IRUSR 0400
10641 #       define S_IWUSR 0200
10642 #       define S_IXUSR 0100
10643 #   endif
10644 #   define S_IRGRP (S_IRUSR>>3)
10645 #   define S_IWGRP (S_IWUSR>>3)
10646 #   define S_IXGRP (S_IXUSR>>3)
10647 #   define S_IROTH (S_IRUSR>>6)
10648 #   define S_IWOTH (S_IWUSR>>6)
10649 #   define S_IXOTH (S_IXUSR>>6)
10650 #endif
10651 #ifndef S_IRWXU
10652 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10653 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10654 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10655 #endif
10656 END
10657
10658     $cat > try.c <<END
10659 #include <sys/types.h>
10660 #include <sys/ipc.h>
10661 #include <sys/sem.h>
10662 #include <sys/stat.h>
10663 #include <stdio.h>
10664 #include <errno.h>
10665 #include "try.h"
10666 #ifndef errno
10667 extern int errno;
10668 #endif
10669 #$d_union_semun HAS_UNION_SEMUN
10670 int main() {
10671     union semun
10672 #ifndef HAS_UNION_SEMUN
10673     {
10674         int val;
10675         struct semid_ds *buf;
10676         unsigned short *array;
10677     }
10678 #endif
10679     arg;
10680     int sem, st;
10681
10682 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10683     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10684     if (sem > -1) {
10685         struct semid_ds argbuf;
10686         arg.buf = &argbuf;
10687 #       ifdef IPC_STAT
10688         st = semctl(sem, 0, IPC_STAT, arg);
10689         if (st == 0)
10690             printf("semun\n");
10691         else
10692 #       endif /* IPC_STAT */
10693             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10694 #       ifdef IPC_RMID
10695         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10696 #       endif /* IPC_RMID */
10697             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10698     } else
10699 #endif /* IPC_PRIVATE && ... */
10700         printf("semget failed: errno = %d\n", errno);
10701   return 0;
10702 }
10703 END
10704     val="$undef"
10705     set try
10706     if eval $compile; then
10707         xxx=`./try`
10708         case "$xxx" in
10709         semun) val="$define" ;;
10710         esac
10711     fi
10712     $rm -f try try.c
10713     set d_semctl_semun
10714     eval $setvar
10715     case "$d_semctl_semun" in
10716     $define)
10717         echo "You can use union semun for semctl IPC_STAT." >&4
10718         also='also'
10719         ;;
10720     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10721         also=''
10722         ;;
10723     esac
10724
10725     : see whether semctl IPC_STAT can use struct semid_ds pointer
10726     $cat > try.c <<'END'
10727 #include <sys/types.h>
10728 #include <sys/ipc.h>
10729 #include <sys/sem.h>
10730 #include <sys/stat.h>
10731 #include "try.h"
10732 #include <stdio.h>
10733 #include <errno.h>
10734 #ifndef errno
10735 extern int errno;
10736 #endif
10737 int main() {
10738     struct semid_ds arg;
10739     int sem, st;
10740
10741 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10742     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10743     if (sem > -1) {
10744 #       ifdef IPC_STAT
10745         st = semctl(sem, 0, IPC_STAT, &arg);
10746         if (st == 0)
10747             printf("semid_ds\n");
10748         else
10749 #       endif /* IPC_STAT */
10750             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10751 #       ifdef IPC_RMID
10752         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10753 #       endif /* IPC_RMID */
10754             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10755     } else
10756 #endif /* IPC_PRIVATE && ... */
10757         printf("semget failed: errno = %d\n", errno);
10758
10759     return 0;
10760 }
10761 END
10762     val="$undef"
10763     set try
10764     if eval $compile; then
10765         xxx=`./try`
10766         case "$xxx" in
10767         semid_ds) val="$define" ;;
10768         esac
10769     fi
10770     $rm -f try try.c
10771     set d_semctl_semid_ds
10772     eval $setvar
10773     case "$d_semctl_semid_ds" in
10774     $define)
10775         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10776         ;;
10777     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10778         ;;
10779     esac
10780     $rm -f try.h
10781     ;;
10782 *)  val="$undef"
10783
10784     # We do not have the full sem*(2) library, so assume we can not
10785     # use either.
10786
10787     set d_semctl_semun
10788     eval $setvar
10789
10790     set d_semctl_semid_ds
10791     eval $setvar
10792     ;;
10793 esac
10794
10795 : see if setegid exists
10796 set setegid d_setegid
10797 eval $inlibc
10798
10799 : see if seteuid exists
10800 set seteuid d_seteuid
10801 eval $inlibc
10802
10803 : see if setgrent exists
10804 set setgrent d_setgrent
10805 eval $inlibc
10806
10807 : see if sethostent exists
10808 set sethostent d_sethent
10809 eval $inlibc
10810
10811 : see if setlinebuf exists
10812 set setlinebuf d_setlinebuf
10813 eval $inlibc
10814
10815 : see if setlocale exists
10816 set setlocale d_setlocale
10817 eval $inlibc
10818
10819 : see if setnetent exists
10820 set setnetent d_setnent
10821 eval $inlibc
10822
10823 : see if setprotoent exists
10824 set setprotoent d_setpent
10825 eval $inlibc
10826
10827 : see if setpgid exists
10828 set setpgid d_setpgid
10829 eval $inlibc
10830
10831 : see if setpgrp2 exists
10832 set setpgrp2 d_setpgrp2
10833 eval $inlibc
10834
10835 : see if setpriority exists
10836 set setpriority d_setprior
10837 eval $inlibc
10838
10839 : see if setpwent exists
10840 set setpwent d_setpwent
10841 eval $inlibc
10842
10843 : see if setregid exists
10844 set setregid d_setregid
10845 eval $inlibc
10846 set setresgid d_setresgid
10847 eval $inlibc
10848
10849 : see if setreuid exists
10850 set setreuid d_setreuid
10851 eval $inlibc
10852 set setresuid d_setresuid
10853 eval $inlibc
10854
10855 : see if setrgid exists
10856 set setrgid d_setrgid
10857 eval $inlibc
10858
10859 : see if setruid exists
10860 set setruid d_setruid
10861 eval $inlibc
10862
10863 : see if setservent exists
10864 set setservent d_setsent
10865 eval $inlibc
10866
10867 : see if setsid exists
10868 set setsid d_setsid
10869 eval $inlibc
10870
10871 : see if setspent exists
10872 set setspent d_setspent
10873 eval $inlibc
10874
10875 : see if setvbuf exists
10876 set setvbuf d_setvbuf
10877 eval $inlibc
10878
10879 : see if sfio.h is available
10880 set sfio.h i_sfio
10881 eval $inhdr
10882
10883
10884 : see if sfio library is available
10885 case "$i_sfio" in
10886 $define)
10887         val=''
10888         set sfreserve val
10889         eval $inlibc
10890         ;;
10891 *)
10892         val="$undef"
10893         ;;
10894 esac
10895 : Ok, but do we want to use it.
10896 case "$val" in
10897 $define)
10898         case "$usesfio" in
10899         true|$define|[yY]*) dflt='y';;
10900         *) dflt='n';;
10901         esac
10902         echo "$package can use the sfio library, but it is experimental."
10903         rp="You seem to have sfio available, do you want to try using it?"
10904         . ./myread
10905         case "$ans" in
10906         y|Y) ;;
10907         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10908                 val="$undef"
10909                 : Remove sfio from list of libraries to use
10910                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10911                 shift
10912                 libs="$*"
10913                 echo "libs = $libs" >&4
10914                 ;;
10915         esac
10916         ;;
10917 *)      case "$usesfio" in
10918         true|$define|[yY]*)
10919                 echo "Sorry, cannot find sfio on this machine" >&4
10920                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10921                 ;;
10922         esac
10923         ;;
10924 esac
10925 set d_sfio
10926 eval $setvar
10927 case "$d_sfio" in
10928 $define) usesfio='true';;
10929 *) usesfio='false';;
10930 esac
10931
10932 : see if shmctl exists
10933 set shmctl d_shmctl
10934 eval $inlibc
10935
10936 : see if shmget exists
10937 set shmget d_shmget
10938 eval $inlibc
10939
10940 : see if shmat exists
10941 set shmat d_shmat
10942 eval $inlibc
10943 : see what shmat returns
10944 case "$d_shmat" in
10945 "$define")
10946         $cat >shmat.c <<'END'
10947 #include <sys/shm.h>
10948 void *shmat();
10949 END
10950         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10951                 shmattype='void *'
10952         else
10953                 shmattype='char *'
10954         fi
10955         echo "and it returns ($shmattype)." >&4
10956         : see if a prototype for shmat is available
10957         xxx=`./findhdr sys/shm.h`
10958         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10959         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10960                 val="$define"
10961         else
10962                 val="$undef"
10963         fi
10964         $rm -f shmat.[co]
10965         ;;
10966 *)
10967         val="$undef"
10968         ;;
10969 esac
10970 set d_shmatprototype
10971 eval $setvar
10972
10973 : see if shmdt exists
10974 set shmdt d_shmdt
10975 eval $inlibc
10976
10977 : see how much of the 'shm*(2)' library is present.
10978 h_shm=true
10979 echo " "
10980 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10981 *"$undef"*) h_shm=false;;
10982 esac
10983 case "$osname" in
10984 freebsd)
10985     case "`ipcs 2>&1`" in
10986     "SVID shared memory"*"not configured"*)
10987         echo "Your $osname does not have the shm*(2) configured." >&4
10988         h_shm=false
10989         val="$undef"
10990         set shmctl d_shmctl
10991         evat $setvar
10992         set shmget d_shmget
10993         evat $setvar
10994         set shmat d_shmat
10995         evat $setvar
10996         set shmdt d_shmdt
10997         evat $setvar
10998         ;;
10999     esac
11000     ;;
11001 esac
11002 : we could also check for sys/ipc.h ...
11003 if $h_shm && $test `./findhdr sys/shm.h`; then
11004         echo "You have the full shm*(2) library." >&4
11005         val="$define"
11006 else
11007         echo "You don't have the full shm*(2) library." >&4
11008         val="$undef"
11009 fi
11010 set d_shm
11011 eval $setvar
11012
11013 echo " "
11014 : see if we have sigaction
11015 if set sigaction val -f d_sigaction; eval $csym; $val; then
11016         echo 'sigaction() found.' >&4
11017         $cat > try.c <<'EOP'
11018 #include <stdio.h>
11019 #include <sys/types.h>
11020 #include <signal.h>
11021 int main()
11022 {
11023     struct sigaction act, oact;
11024     act.sa_flags = 0;
11025     oact.sa_handler = 0;
11026     /* so that act and oact are used */
11027     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11028 }
11029 EOP
11030         set try
11031         if eval $compile_ok; then
11032                 val="$define"
11033         else
11034                 echo "But you don't seem to have a useable struct sigaction." >&4
11035                 val="$undef"
11036         fi
11037 else
11038         echo 'sigaction NOT found.' >&4
11039         val="$undef"
11040 fi
11041 set d_sigaction; eval $setvar
11042 $rm -f try try$_o try.c
11043
11044 : see if sigsetjmp exists
11045 echo " "
11046 case "$d_sigsetjmp" in
11047 '')
11048         $cat >try.c <<'EOP'
11049 #include <setjmp.h>
11050 sigjmp_buf env;
11051 int set = 1;
11052 int main()
11053 {
11054         if (sigsetjmp(env,1))
11055                 exit(set);
11056         set = 0;
11057         siglongjmp(env, 1);
11058         exit(1);
11059 }
11060 EOP
11061         set try
11062         if eval $compile; then
11063                 if ./try >/dev/null 2>&1; then
11064                         echo "POSIX sigsetjmp found." >&4
11065                         val="$define"
11066                 else
11067                         $cat >&4 <<EOM
11068 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11069 I'll ignore them.
11070 EOM
11071                         val="$undef"
11072                 fi
11073         else
11074                 echo "sigsetjmp not found." >&4
11075                 val="$undef"
11076         fi
11077         ;;
11078 *) val="$d_sigsetjmp"
11079         case "$d_sigsetjmp" in
11080         $define) echo "POSIX sigsetjmp found." >&4;;
11081         $undef) echo "sigsetjmp not found." >&4;;
11082         esac
11083         ;;
11084 esac
11085 set d_sigsetjmp
11086 eval $setvar
11087 $rm -f try.c try
11088
11089 : see if sys/stat.h is available
11090 set sys/stat.h i_sysstat
11091 eval $inhdr
11092
11093
11094 : see if stat knows about block sizes
11095 echo " "
11096 echo "Checking to see if your struct stat has st_blocks field..." >&4
11097 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11098 eval $hasfield
11099
11100
11101 : see if this is a sys/vfs.h system
11102 set sys/vfs.h i_sysvfs
11103 eval $inhdr
11104
11105
11106 : see if this is a sys/statfs.h system
11107 set sys/statfs.h i_sysstatfs
11108 eval $inhdr
11109
11110
11111 echo " "
11112 echo "Checking to see if your system supports struct statfs..." >&4
11113 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
11114 eval $hasstruct
11115 case "$d_statfs_s" in
11116 "$define")      echo "Yes, it does."   ;;
11117 *)              echo "No, it doesn't." ;;
11118 esac
11119
11120
11121
11122 : see if struct statfs knows about f_flags
11123 case "$d_statfs_s" in
11124 define) 
11125         echo " "
11126         echo "Checking to see if your struct statfs has f_flags field..." >&4
11127         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
11128         eval $hasfield
11129         ;;
11130 *)      val="$undef"
11131         set d_statfs_f_flags
11132         eval $setvar
11133         ;;
11134 esac
11135 case "$d_statfs_f_flags" in
11136 "$define")      echo "Yes, it does."   ;;
11137 *)              echo "No, it doesn't." ;;
11138 esac
11139
11140 : see if _ptr and _cnt from stdio act std
11141 echo " "
11142 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11143         echo "(Looks like you have stdio.h from Linux.)"
11144         case "$stdio_ptr" in
11145         '') stdio_ptr='((fp)->_IO_read_ptr)'
11146                 ptr_lval=$define
11147                 ;;
11148         *)      ptr_lval=$d_stdio_ptr_lval;;
11149         esac
11150         case "$stdio_cnt" in
11151         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11152                 cnt_lval=$undef
11153                 ;;
11154         *)      cnt_lval=$d_stdio_cnt_lval;;
11155         esac
11156         case "$stdio_base" in
11157         '') stdio_base='((fp)->_IO_read_base)';;
11158         esac
11159         case "$stdio_bufsiz" in
11160         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11161         esac
11162 else
11163         case "$stdio_ptr" in
11164         '') stdio_ptr='((fp)->_ptr)'
11165                 ptr_lval=$define
11166                 ;;
11167         *)      ptr_lval=$d_stdio_ptr_lval;;
11168         esac
11169         case "$stdio_cnt" in
11170         '') stdio_cnt='((fp)->_cnt)'
11171                 cnt_lval=$define
11172                 ;;
11173         *)      cnt_lval=$d_stdio_cnt_lval;;
11174         esac
11175         case "$stdio_base" in
11176         '') stdio_base='((fp)->_base)';;
11177         esac
11178         case "$stdio_bufsiz" in
11179         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11180         esac
11181 fi
11182 : test whether _ptr and _cnt really work
11183 echo "Checking how std your stdio is..." >&4
11184 $cat >try.c <<EOP
11185 #include <stdio.h>
11186 #define FILE_ptr(fp)    $stdio_ptr
11187 #define FILE_cnt(fp)    $stdio_cnt
11188 int main() {
11189         FILE *fp = fopen("try.c", "r");
11190         char c = getc(fp);
11191         if (
11192                 18 <= FILE_cnt(fp) &&
11193                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11194         )
11195                 exit(0);
11196         exit(1);
11197 }
11198 EOP
11199 val="$undef"
11200 set try
11201 if eval $compile; then
11202         if ./try; then
11203                 echo "Your stdio acts pretty std."
11204                 val="$define"
11205         else
11206                 echo "Your stdio isn't very std."
11207         fi
11208 else
11209         echo "Your stdio doesn't appear very std."
11210 fi
11211 $rm -f try.c try
11212 set d_stdstdio
11213 eval $setvar
11214
11215 : Can _ptr be used as an lvalue?
11216 case "$d_stdstdio$ptr_lval" in
11217 $define$define) val=$define ;;
11218 *) val=$undef ;;
11219 esac
11220 set d_stdio_ptr_lval
11221 eval $setvar
11222
11223 : Can _cnt be used as an lvalue?
11224 case "$d_stdstdio$cnt_lval" in
11225 $define$define) val=$define ;;
11226 *) val=$undef ;;
11227 esac
11228 set d_stdio_cnt_lval
11229 eval $setvar
11230
11231 : see if _base is also standard
11232 val="$undef"
11233 case "$d_stdstdio" in
11234 $define)
11235         $cat >try.c <<EOP
11236 #include <stdio.h>
11237 #define FILE_base(fp)   $stdio_base
11238 #define FILE_bufsiz(fp) $stdio_bufsiz
11239 int main() {
11240         FILE *fp = fopen("try.c", "r");
11241         char c = getc(fp);
11242         if (
11243                 19 <= FILE_bufsiz(fp) &&
11244                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11245         )
11246                 exit(0);
11247         exit(1);
11248 }
11249 EOP
11250         set try
11251         if eval $compile; then
11252                 if ./try; then
11253                         echo "And its _base field acts std."
11254                         val="$define"
11255                 else
11256                         echo "But its _base field isn't std."
11257                 fi
11258         else
11259                 echo "However, it seems to be lacking the _base field."
11260         fi
11261         $rm -f try.c try
11262         ;;
11263 esac
11264 set d_stdiobase
11265 eval $setvar
11266
11267 $cat >&4 <<EOM
11268 Checking how to access stdio streams by file descriptor number...
11269 EOM
11270 case "$stdio_stream_array" in
11271 '')     $cat >try.c <<EOCP
11272 #include <stdio.h>
11273 int main() {
11274   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11275     printf("yes\n");
11276 }
11277 EOCP
11278         for s in _iob __iob __sF
11279         do
11280                 set try -DSTDIO_STREAM_ARRAY=$s
11281                 if eval $compile; then
11282                         case "`./try$exe_ext`" in
11283                         yes)    stdio_stream_array=$s; break ;;
11284                         esac
11285                 fi
11286         done
11287         $rm -f try.* try$exe_ext
11288 esac
11289 case "$stdio_stream_array" in
11290 '')     $cat >&4 <<EOM
11291 I can't figure out how to access stdio streams by file descriptor number.
11292 EOM
11293         d_stdio_stream_array="$undef"
11294         ;;
11295 *)      $cat >&4 <<EOM
11296 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11297 EOM
11298         d_stdio_stream_array="$define"
11299         ;;
11300 esac
11301
11302 : see if strcoll exists
11303 set strcoll d_strcoll
11304 eval $inlibc
11305
11306 : check for structure copying
11307 echo " "
11308 echo "Checking to see if your C compiler can copy structs..." >&4
11309 $cat >try.c <<'EOCP'
11310 int main()
11311 {
11312         struct blurfl {
11313                 int dyick;
11314         } foo, bar;
11315
11316         foo = bar;
11317 }
11318 EOCP
11319 if $cc -c try.c >/dev/null 2>&1 ; then
11320         val="$define"
11321         echo "Yup, it can."
11322 else
11323         val="$undef"
11324         echo "Nope, it can't."
11325 fi
11326 set d_strctcpy
11327 eval $setvar
11328 $rm -f try.*
11329
11330 : see if strerror and/or sys_errlist[] exist
11331 echo " "
11332 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11333     if set strerror val -f d_strerror; eval $csym; $val; then
11334                 echo 'strerror() found.' >&4
11335                 d_strerror="$define"
11336                 d_strerrm='strerror(e)'
11337                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11338                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11339                         d_syserrlst="$define"
11340                 else
11341                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11342                         d_syserrlst="$undef"
11343                 fi
11344     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11345                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11346                 echo 'strerror() found in string header.' >&4
11347                 d_strerror="$define"
11348                 d_strerrm='strerror(e)'
11349                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11350                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11351                                 d_syserrlst="$define"
11352                 else
11353                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11354                         d_syserrlst="$undef"
11355                 fi
11356     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11357                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11358                 d_strerror="$undef"
11359                 d_syserrlst="$define"
11360                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11361     else
11362                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11363                 d_strerror="$undef"
11364                 d_syserrlst="$undef"
11365                 d_strerrm='"unknown"'
11366     fi
11367 fi
11368
11369 : see if strtod exists
11370 set strtod d_strtod
11371 eval $inlibc
11372
11373 : see if strtol exists
11374 set strtol d_strtol
11375 eval $inlibc
11376
11377 : see if strtold exists
11378 set strtold d_strtold
11379 eval $inlibc
11380
11381 : see if strtoll exists
11382 set strtoll d_strtoll
11383 eval $inlibc
11384
11385 : see if strtoul exists
11386 set strtoul d_strtoul
11387 eval $inlibc
11388
11389 : see if strtoull exists
11390 set strtoull d_strtoull
11391 eval $inlibc
11392
11393 : see if strtouq exists
11394 set strtouq d_strtouq
11395 eval $inlibc
11396
11397 : see if strxfrm exists
11398 set strxfrm d_strxfrm
11399 eval $inlibc
11400
11401 : see if symlink exists
11402 set symlink d_symlink
11403 eval $inlibc
11404
11405 : see if syscall exists
11406 set syscall d_syscall
11407 eval $inlibc
11408
11409 : see if sysconf exists
11410 set sysconf d_sysconf
11411 eval $inlibc
11412
11413 : see if system exists
11414 set system d_system
11415 eval $inlibc
11416
11417 : see if tcgetpgrp exists
11418 set tcgetpgrp d_tcgetpgrp
11419 eval $inlibc
11420
11421 : see if tcsetpgrp exists
11422 set tcsetpgrp d_tcsetpgrp
11423 eval $inlibc
11424
11425 : see if prototype for telldir is available
11426 echo " "
11427 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11428 eval $hasproto
11429
11430 : see if this is a sys/times.h system
11431 set sys/times.h i_systimes
11432 eval $inhdr
11433
11434 : see if times exists
11435 echo " "
11436 if set times val -f d_times; eval $csym; $val; then
11437         echo 'times() found.' >&4
11438         d_times="$define"
11439         inc=''
11440         case "$i_systimes" in
11441         "$define") inc='sys/times.h';;
11442         esac
11443         rp="What is the type returned by times() on this system?"
11444         set clock_t clocktype long stdio.h sys/types.h $inc
11445         eval $typedef_ask
11446 else
11447         echo 'times() NOT found, hope that will do.' >&4
11448         d_times="$undef"
11449         clocktype='int'
11450 fi
11451
11452 : see if truncate exists
11453 set truncate d_truncate
11454 eval $inlibc
11455
11456 : see if tzname[] exists
11457 echo " "
11458 if set tzname val -a d_tzname; eval $csym; $val; then
11459         val="$define"
11460         echo 'tzname[] found.' >&4
11461 else
11462         val="$undef"
11463         echo 'tzname[] NOT found.' >&4
11464 fi
11465 set d_tzname
11466 eval $setvar
11467
11468 : see if umask exists
11469 set umask d_umask
11470 eval $inlibc
11471
11472 : see if ustat exists
11473 set ustat d_ustat
11474 eval $inlibc
11475
11476 : backward compatibility for d_hvfork
11477 if test X$d_hvfork != X; then
11478         d_vfork="$d_hvfork"
11479         d_hvfork=''
11480 fi
11481 : see if there is a vfork
11482 val=''
11483 set vfork val
11484 eval $inlibc
11485
11486 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11487 : perl on Solaris 2.x, and probably elsewhere.
11488 case "$val" in
11489 $define)
11490         echo " "
11491         case "$usevfork" in
11492         false) dflt='n';;
11493         *) dflt='y';;
11494         esac
11495         cat <<'EOM'
11496  
11497 Perl can only use a vfork() that doesn't suffer from strict
11498 restrictions on calling functions or modifying global data in
11499 the child.  For example, glibc-2.1 contains such a vfork()
11500 that is unsuitable.  If your system provides a proper fork()
11501 call, chances are that you do NOT want perl to use vfork().
11502
11503 EOM
11504         rp="Do you still want to use vfork()?"
11505         . ./myread
11506         case "$ans" in
11507         y|Y) ;;
11508         *)
11509                 echo "Ok, we won't use vfork()."
11510                 val="$undef"
11511                 ;;
11512         esac
11513         ;;
11514 esac
11515 set d_vfork
11516 eval $setvar
11517 case "$d_vfork" in
11518 $define) usevfork='true';;
11519 *) usevfork='false';;
11520 esac
11521
11522 : see if this is an sysdir system
11523 set sys/dir.h i_sysdir
11524 eval $inhdr
11525
11526 : see if this is an sysndir system
11527 set sys/ndir.h i_sysndir
11528 eval $inhdr
11529
11530 : see if closedir exists
11531 set closedir d_closedir
11532 eval $inlibc
11533
11534 case "$d_closedir" in
11535 "$define")
11536         echo " "
11537         echo "Checking whether closedir() returns a status..." >&4
11538         cat > closedir.c <<EOM
11539 #$i_dirent I_DIRENT             /**/
11540 #$i_sysdir I_SYS_DIR            /**/
11541 #$i_sysndir I_SYS_NDIR          /**/
11542 #$i_systypes I_SYS_TYPES        /**/
11543
11544 #if defined(I_SYS_TYPES)
11545 #include <sys/types.h>
11546 #endif
11547 #if defined(I_DIRENT)
11548 #include <dirent.h>
11549 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11550 #include <sys/dir.h>
11551 #endif
11552 #else
11553 #ifdef I_SYS_NDIR
11554 #include <sys/ndir.h>
11555 #else
11556 #ifdef I_SYS_DIR
11557 #ifdef hp9000s500
11558 #include <ndir.h>       /* may be wrong in the future */
11559 #else
11560 #include <sys/dir.h>
11561 #endif
11562 #endif
11563 #endif
11564 #endif 
11565 int main() { return closedir(opendir(".")); }
11566 EOM
11567         set closedir
11568         if eval $compile_ok; then
11569                 if ./closedir > /dev/null 2>&1 ; then
11570                         echo "Yes, it does."
11571                         val="$undef"
11572                 else
11573                         echo "No, it doesn't."
11574                         val="$define"
11575                 fi
11576         else
11577                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11578                 val="$define"
11579         fi
11580         ;;
11581 *)
11582         val="$undef";
11583         ;;
11584 esac
11585 set d_void_closedir
11586 eval $setvar
11587 $rm -f closedir*
11588 : check for volatile keyword
11589 echo " "
11590 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11591 $cat >try.c <<'EOCP'
11592 int main()
11593 {
11594         typedef struct _goo_struct goo_struct;
11595         goo_struct * volatile goo = ((goo_struct *)0);
11596         struct _goo_struct {
11597                 long long_int;
11598                 int reg_int;
11599                 char char_var;
11600         };
11601         typedef unsigned short foo_t;
11602         char *volatile foo;
11603         volatile int bar;
11604         volatile foo_t blech;
11605         foo = foo;
11606 }
11607 EOCP
11608 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11609         val="$define"
11610         echo "Yup, it does."
11611 else
11612         val="$undef"
11613         echo "Nope, it doesn't."
11614 fi
11615 set d_volatile
11616 eval $setvar
11617 $rm -f try.*
11618
11619 : see if there is a wait4
11620 set wait4 d_wait4
11621 eval $inlibc
11622
11623 : see if waitpid exists
11624 set waitpid d_waitpid
11625 eval $inlibc
11626
11627 : see if wcstombs exists
11628 set wcstombs d_wcstombs
11629 eval $inlibc
11630
11631 : see if wctomb exists
11632 set wctomb d_wctomb
11633 eval $inlibc
11634
11635 : preserve RCS keywords in files with variable substitution, grrr
11636 Date='$Date'
11637 Id='$Id'
11638 Log='$Log'
11639 RCSfile='$RCSfile'
11640 Revision='$Revision'
11641
11642 case "$crosscompile" in
11643 ''|[nN]*) crosscompile="$undef" ;;
11644 esac
11645
11646 case "$osname" in
11647 next|rhapsody) multiarch="$define" ;;
11648 esac
11649 case "$multiarch" in
11650 ''|[nN]*) multiarch="$undef" ;;
11651 esac
11652
11653 : check for alignment requirements
11654 echo " "
11655 case "$crosscompile$multiarch" in
11656 *$define*)
11657         $cat <<EOM
11658 You seem to be either cross-compiling or doing a multiarchitecture build,
11659 skipping the memory alignment check.
11660
11661 EOM
11662         case "$alignbytes" in
11663         '') alignbytes=8 ;;
11664         esac
11665         ;;
11666 *)
11667         case "$alignbytes" in
11668         '') echo "Checking alignment constraints..." >&4
11669                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11670                         $cat >try.c <<'EOCP'
11671 typedef long double NV;
11672 EOCP
11673                 else
11674                         $cat >try.c <<'EOCP'
11675 typedef double NV;
11676 EOCP
11677                 fi
11678                 $cat >>try.c <<'EOCP'
11679 #include <stdio.h>
11680 struct foobar {
11681         char foo;
11682         NV bar;
11683 } try_algn;
11684 int main()
11685 {
11686     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11687     return(0);
11688 }
11689 EOCP
11690                 set try
11691                 if eval $compile_ok; then
11692                         dflt=`./try`
11693                 else
11694                         dflt='8'
11695                         echo "(I can't seem to compile the test program...)"
11696                 fi
11697                 ;;
11698         *) dflt="$alignbytes"
11699                 ;;
11700         esac
11701         rp="Doubles must be aligned on a how-many-byte boundary?"
11702         . ./myread
11703         alignbytes="$ans"
11704         $rm -f try.c try
11705         ;;
11706 esac
11707
11708
11709 : set the base revision
11710 baserev=5.0
11711
11712 : check for ordering of bytes in a long
11713 echo " "
11714 case "$crosscompile$multiarch" in
11715 *$define*)
11716         $cat <<EOM
11717 You seem to be either cross-compiling or doing a multiarchitecture build,
11718 skipping the byteorder check.
11719
11720 EOM
11721         byteorder='0xffff'
11722         ;;
11723 *)
11724         case "$byteorder" in
11725         '')
11726                 $cat <<'EOM'
11727 In the following, larger digits indicate more significance.  A big-endian
11728 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11729 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11730 machines may have weird orders like 3412.  A Cray will report 87654321,
11731 an Alpha will report 12345678. If the test program works the default is
11732 probably right.
11733 I'm now running the test program...
11734 EOM
11735                 $cat >try.c <<'EOCP'
11736 #include <stdio.h>
11737 int main()
11738 {
11739         int i;
11740         union {
11741                 unsigned long l;
11742                 char c[sizeof(long)];
11743         } u;
11744
11745         if (sizeof(long) > 4)
11746                 u.l = (0x08070605L << 32) | 0x04030201L;
11747         else
11748                 u.l = 0x04030201L;
11749         for (i = 0; i < sizeof(long); i++)
11750                 printf("%c", u.c[i]+'0');
11751         printf("\n");
11752         exit(0);
11753 }
11754 EOCP
11755                 xxx_prompt=y
11756                 set try
11757                 if eval $compile && ./try > /dev/null; then
11758                         dflt=`./try`
11759                         case "$dflt" in
11760                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11761                                 echo "(The test program ran ok.)"
11762                                 echo "byteorder=$dflt"
11763                                 xxx_prompt=n
11764                         ;;
11765                         ????|????????) echo "(The test program ran ok.)" ;;
11766                         *) echo "(The test program didn't run right for some reason.)" ;;
11767                         esac
11768                 else
11769                         dflt='4321'
11770                         cat <<'EOM'
11771 (I can't seem to compile the test program.  Guessing big-endian...)
11772 EOM
11773                 fi
11774                 case "$xxx_prompt" in
11775                 y)
11776                         rp="What is the order of bytes in a long?"
11777                         . ./myread
11778                         byteorder="$ans"
11779                         ;;
11780                 *)      byteorder=$dflt
11781                         ;;
11782                 esac
11783                 ;;
11784         esac
11785         $rm -f try.c try
11786         ;;
11787 esac
11788
11789
11790 : how do we catenate cpp tokens here?
11791 echo " "
11792 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11793 $cat >cpp_stuff.c <<'EOCP'
11794 #define RCAT(a,b)a/**/b
11795 #define ACAT(a,b)a ## b
11796 RCAT(Rei,ser)
11797 ACAT(Cir,cus)
11798 EOCP
11799 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11800 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11801         echo "Oh!  Smells like ANSI's been here." >&4
11802         echo "We can catify or stringify, separately or together!"
11803         cpp_stuff=42
11804 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11805         echo "Ah, yes!  The good old days!" >&4
11806         echo "However, in the good old days we don't know how to stringify and"
11807         echo "catify at the same time."
11808         cpp_stuff=1
11809 else
11810         $cat >&4 <<EOM
11811 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11812 to have to edit the values of CAT[2-5] in config.h...
11813 EOM
11814         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11815 fi
11816 $rm -f cpp_stuff.*
11817
11818 : see if this is a db.h system
11819 set db.h i_db
11820 eval $inhdr
11821
11822 case "$i_db" in
11823 $define)
11824         : Check db version.
11825         echo " "
11826         echo "Checking Berkeley DB version ..." >&4
11827         $cat >try.c <<EOCP
11828 #$d_const HASCONST
11829 #ifndef HASCONST
11830 #define const
11831 #endif
11832 #include <sys/types.h>
11833 #include <stdio.h>
11834 #include <db.h>
11835 int main()
11836 {
11837 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11838     int Major, Minor, Patch ;
11839     unsigned long Version ;
11840     (void)db_version(&Major, &Minor, &Patch) ;
11841     printf("You have Berkeley DB Version 2 or greater\n");
11842
11843     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11844                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11845     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11846                 Major, Minor, Patch) ;
11847
11848     /* check that db.h & libdb are compatible */
11849     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11850         printf("db.h and libdb are incompatible\n") ;
11851         exit(3);        
11852     }
11853
11854     printf("db.h and libdb are compatible\n") ;
11855
11856     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11857                 + DB_VERSION_PATCH ;
11858
11859     /* needs to be >= 2.3.4 */
11860     if (Version < 2003004) {
11861     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11862         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11863         exit(2);        
11864     }
11865
11866     exit(0);
11867 #else
11868 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11869     printf("You have Berkeley DB Version 1\n");
11870     exit(0);    /* DB version < 2: the coast is clear. */
11871 #else
11872     exit(1);    /* <db.h> not Berkeley DB? */
11873 #endif
11874 #endif
11875 }
11876 EOCP
11877         set try
11878         if eval $compile_ok && ./try; then
11879                 echo 'Looks OK.' >&4
11880         else
11881                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11882                 i_db=$undef
11883                 case " $libs " in
11884                 *"-ldb "*)
11885                         : Remove db from list of libraries to use
11886                         echo "Removing unusable -ldb from library list" >&4
11887                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11888                         shift
11889                         libs="$*"
11890                         echo "libs = $libs" >&4
11891                         ;;
11892                 esac
11893         fi
11894         $rm -f try.*
11895         ;;
11896 esac
11897
11898 case "$i_db" in
11899 define)
11900         : Check the return type needed for hash 
11901         echo " "
11902         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11903         $cat >try.c <<EOCP
11904 #$d_const HASCONST
11905 #ifndef HASCONST
11906 #define const
11907 #endif
11908 #include <sys/types.h>
11909 #include <db.h>
11910
11911 #ifndef DB_VERSION_MAJOR
11912 u_int32_t hash_cb (ptr, size)
11913 const void *ptr;
11914 size_t size;
11915 {
11916 }
11917 HASHINFO info;
11918 int main()
11919 {
11920         info.hash = hash_cb;
11921 }
11922 #endif
11923 EOCP
11924         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11925                 if $contains warning try.out >>/dev/null 2>&1 ; then
11926                         db_hashtype='int'
11927                 else
11928                         db_hashtype='u_int32_t'
11929                 fi
11930         else
11931                 : XXX Maybe we should just give up here.
11932                 db_hashtype=u_int32_t
11933                 $cat try.out >&4
11934                 echo "Help:  I can't seem to compile the db test program." >&4
11935                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11936         fi
11937         $rm -f try.*
11938         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11939         ;;
11940 *)      db_hashtype=u_int32_t
11941         ;;
11942 esac
11943 case "$i_db" in
11944 define)
11945         : Check the return type needed for prefix 
11946         echo " "
11947         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11948         cat >try.c <<EOCP
11949 #$d_const HASCONST
11950 #ifndef HASCONST
11951 #define const
11952 #endif
11953 #include <sys/types.h>
11954 #include <db.h>
11955
11956 #ifndef DB_VERSION_MAJOR
11957 size_t prefix_cb (key1, key2)
11958 const DBT *key1;
11959 const DBT *key2;
11960 {
11961 }
11962 BTREEINFO info;
11963 int main()
11964 {
11965         info.prefix = prefix_cb;
11966 }
11967 #endif
11968 EOCP
11969         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11970                 if $contains warning try.out >>/dev/null 2>&1 ; then
11971                         db_prefixtype='int'
11972                 else
11973                         db_prefixtype='size_t'
11974                 fi
11975         else
11976                 db_prefixtype='size_t'
11977                 : XXX Maybe we should just give up here.
11978                 $cat try.out >&4
11979                 echo "Help:  I can't seem to compile the db test program." >&4
11980                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11981         fi
11982         $rm -f try.*
11983         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11984         ;;
11985 *)      db_prefixtype='size_t'
11986         ;;
11987 esac
11988
11989 : check for void type
11990 echo " "
11991 echo "Checking to see how well your C compiler groks the void type..." >&4
11992 case "$voidflags" in
11993 '')
11994         $cat >try.c <<'EOCP'
11995 #if TRY & 1
11996 void sub() {
11997 #else
11998 sub() {
11999 #endif
12000         extern void moo();      /* function returning void */
12001         void (*goo)();          /* ptr to func returning void */
12002 #if TRY & 8
12003         void *hue;              /* generic ptr */
12004 #endif
12005 #if TRY & 2
12006         void (*foo[10])();
12007 #endif
12008
12009 #if TRY & 4
12010         if(goo == moo) {
12011                 exit(0);
12012         }
12013 #endif
12014         exit(0);
12015 }
12016 int main() { sub(); }
12017 EOCP
12018         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12019                 voidflags=$defvoidused
12020         echo "Good.  It appears to support void to the level $package wants.">&4
12021                 if $contains warning .out >/dev/null 2>&1; then
12022                         echo "However, you might get some warnings that look like this:"
12023                         $cat .out
12024                 fi
12025         else
12026 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12027                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12028                         echo "It supports 1..."
12029                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12030                                 echo "It also supports 2..."
12031                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12032                                         voidflags=7
12033                                         echo "And it supports 4 but not 8 definitely."
12034                                 else
12035                                         echo "It doesn't support 4..."
12036                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12037                                                 voidflags=11
12038                                                 echo "But it supports 8."
12039                                         else
12040                                                 voidflags=3
12041                                                 echo "Neither does it support 8."
12042                                         fi
12043                                 fi
12044                         else
12045                                 echo "It does not support 2..."
12046                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12047                                         voidflags=13
12048                                         echo "But it supports 4 and 8."
12049                                 else
12050                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12051                                                 voidflags=5
12052                                                 echo "And it supports 4 but has not heard about 8."
12053                                         else
12054                                                 echo "However it supports 8 but not 4."
12055                                         fi
12056                                 fi
12057                         fi
12058                 else
12059                         echo "There is no support at all for void."
12060                         voidflags=0
12061                 fi
12062         fi
12063 esac
12064 case "$voidflags" in
12065 "$defvoidused") ;;
12066 *)      $cat >&4 <<'EOM'
12067   Support flag bits are:
12068     1: basic void declarations.
12069     2: arrays of pointers to functions returning void.
12070     4: operations between pointers to and addresses of void functions.
12071     8: generic void pointers.
12072 EOM
12073         dflt="$voidflags";
12074         rp="Your void support flags add up to what?"
12075         . ./myread
12076         voidflags="$ans"
12077         ;;
12078 esac
12079 $rm -f try.* .out
12080
12081
12082 : How can we generate normalized random numbers ?
12083 echo " "
12084 echo "Looking for a random number function..." >&4
12085 case "$randfunc" in
12086 '')
12087         if set drand48 val -f; eval $csym; $val; then
12088                 dflt="drand48"
12089                 echo "Good, found drand48()." >&4
12090         elif set random val -f; eval $csym; $val; then
12091                 dflt="random"
12092                 echo "OK, found random()." >&4
12093         else
12094                 dflt="rand"
12095                 echo "Yick, looks like I have to use rand()." >&4
12096         fi
12097         echo " "
12098         ;;
12099 *)
12100         dflt="$randfunc"
12101         ;;
12102 esac
12103 cont=true
12104
12105 case "$ccflags" in
12106 *-Dmy_rand=*|*-Dmy_srand=*)
12107         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12108         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12109         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12110         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12111         ;;
12112 esac
12113
12114 while $test "$cont"; do
12115         rp="Use which function to generate random numbers?"
12116         . ./myread
12117         if $test "$ans" = "$dflt"; then
12118                 : null
12119         else
12120                 randbits=''
12121         fi
12122         randfunc="$ans"
12123         if set $ans val -f; eval $csym; $val; then
12124                 cont=''
12125         else
12126                 dflt=y
12127                 rp="I cannot find function $ans. Use that name anyway?"
12128                 . ./myread
12129                 dflt=rand
12130                 case "$ans" in
12131                         [yY]*) cont='';;
12132                 esac
12133         fi
12134         case "$cont" in
12135         '')
12136                 case "$randfunc" in
12137                 drand48)
12138                         drand01="drand48()"
12139                         seedfunc="srand48"
12140                         randbits=48
12141                         randseedtype=long
12142                         ;;
12143                 rand|random)
12144                         case "$randbits" in
12145                         '')
12146 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12147                                 $cat >try.c <<EOCP
12148 #$i_unistd I_UNISTD
12149 #$i_stdlib I_STDLIB
12150 #include <stdio.h>
12151 #ifdef I_UNISTD
12152 #  include <unistd.h>
12153 #endif
12154 #ifdef I_STDLIB
12155 #  include <stdlib.h>
12156 #endif
12157 int main()
12158 {
12159         register int i;
12160         register unsigned long tmp;
12161         register unsigned long max = 0L;
12162
12163         for (i = 1000; i; i--) {
12164                 tmp = (unsigned long) $randfunc();
12165                 if (tmp > max) max = tmp;
12166         }
12167         for (i = 0; max; i++)
12168                 max /= 2;
12169         printf("%d\n",i);
12170 }
12171 EOCP
12172                                 set try
12173                                 if eval $compile_ok; then
12174                                         dflt=`try`
12175                                 else
12176                                         dflt='?'
12177                                         echo "(I can't seem to compile the test program...)"
12178                                 fi
12179                                 ;;
12180                         *)
12181                                 dflt="$randbits"
12182                                 ;;
12183                         esac
12184                         rp="How many bits does your $randfunc() function produce?"
12185                         . ./myread
12186                         randbits="$ans"
12187                         $rm -f try.c try
12188                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12189                         seedfunc="s$randfunc"
12190                         randseedtype=unsigned
12191                         ;;
12192                 *)
12193                         dflt="31"
12194                         rp="How many bits does your $randfunc() function produce?"
12195                         . ./myread
12196                         randbits="$ans"
12197                         seedfunc="s$randfunc"
12198                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12199                         if set $seedfunc val -f; eval $csym; $val; then
12200                                 echo "(Using $seedfunc() to seed random generator)"
12201                         else
12202                                 echo "(Warning: no $seedfunc() to seed random generator)"
12203                                 seedfunc=rand
12204                         fi
12205                         randseedtype=unsigned
12206                         ;;
12207                 esac
12208                 ;;
12209         esac
12210 done
12211
12212 echo " "
12213 echo "Determining whether or not we are on an EBCDIC system..." >&4
12214 $cat >tebcdic.c <<'EOM'
12215 int main()
12216 {
12217   if ('M'==0xd4) return 0;
12218   return 1;
12219 }
12220 EOM
12221
12222 val=$undef
12223 set tebcdic
12224 if eval $compile_ok; then
12225         if ./tebcdic; then
12226                 echo "You have EBCDIC." >&4
12227                 val="$define"
12228         else
12229                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12230         fi
12231 else
12232         echo "I'm unable to compile the test program." >&4
12233         echo "I'll assume ASCII or some ISO Latin." >&4
12234 fi
12235 $rm -f tebcdic.c tebcdic
12236 set ebcdic
12237 eval $setvar
12238
12239 echo " "
12240 $cat >&4 <<EOM
12241 Checking how to flush all pending stdio output...
12242 EOM
12243 # I only know how to find the first 32 possibly open files on SunOS.
12244 # See also hints/sunos_4_1.sh and util.c  --AD
12245 case "$osname" in
12246 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12247 esac
12248 $cat >>try.c <<EOCP
12249 #include <stdio.h>
12250 #$i_unistd I_UNISTD
12251 #ifdef I_UNISTD
12252 # include <unistd.h>
12253 #endif
12254 #$d_sysconf HAS_SYSCONF
12255 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12256 #ifdef HAS_STDIO_STREAM_ARRAY
12257 # define STDIO_STREAM_ARRAY $stdio_stream_array
12258 #endif
12259 int main() {
12260   FILE* p = fopen("try.out", "w");
12261 #ifdef TRY_FPUTC
12262   fputc('x', p);
12263 #else
12264 # ifdef TRY_FPRINTF
12265   fprintf(p, "x");
12266 # endif
12267 #endif
12268 #ifdef TRY_FFLUSH_NULL
12269   fflush(NULL);
12270 #endif
12271 #ifdef TRY_FFLUSH_ALL
12272   {
12273     long open_max = -1;
12274 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12275     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12276 # else
12277 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12278     open_max = sysconf(_SC_OPEN_MAX);
12279 #  else
12280 #   ifdef FOPEN_MAX
12281     open_max = FOPEN_MAX;
12282 #   else
12283 #    ifdef OPEN_MAX
12284     open_max = OPEN_MAX;
12285 #    else
12286 #     ifdef _NFILE
12287     open_max = _NFILE;
12288 #     endif
12289 #    endif
12290 #   endif
12291 #  endif
12292 # endif 
12293 # ifdef HAS_STDIO_STREAM_ARRAY
12294     if (open_max > 0) {
12295       long i;
12296       for (i = 0; i < open_max; i++)
12297             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12298                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12299                 STDIO_STREAM_ARRAY[i]._flag)
12300                 fflush(&STDIO_STREAM_ARRAY[i]);
12301     }   
12302   }
12303 # endif
12304 #endif
12305   _exit(42);
12306 }
12307 EOCP
12308 : first we have to find out how _not_ to flush
12309 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12310     output=''
12311     set try -DTRY_FPUTC
12312     if eval $compile; then
12313             $rm -f try.out
12314             ./try$exe_ext 2>/dev/null
12315             if $test ! -s try.out -a "X$?" = X42; then
12316                 output=-DTRY_FPUTC
12317             fi
12318     fi
12319     case "$output" in
12320     '')
12321             set try -DTRY_FPRINTF
12322             $rm -f try.out
12323             if eval $compile; then
12324                     $rm -f try.out
12325                     ./try$exe_ext 2>/dev/null
12326                     if $test ! -s try.out -a "X$?" = X42; then
12327                         output=-DTRY_FPRINTF
12328                     fi
12329             fi
12330         ;;
12331     esac
12332 fi
12333 : check for fflush NULL behaviour
12334 case "$fflushNULL" in
12335 '')     set try -DTRY_FFLUSH_NULL $output
12336         if eval $compile; then
12337                 $rm -f try.out
12338                 ./try$exe_ext 2>/dev/null
12339                 code="$?"
12340                 if $test -s try.out -a "X$code" = X42; then
12341                         fflushNULL="`$cat try.out`"
12342                 else
12343                         if $test "X$code" != X42; then
12344                                 $cat >&4 <<EOM
12345 (If this test failed, don't worry, we'll try another method shortly.)
12346 EOM
12347                         fi
12348                 fi
12349         fi
12350         $rm -f core try.core core.try.*
12351         case "$fflushNULL" in
12352         x)      $cat >&4 <<EOM
12353 Your fflush(NULL) works okay.
12354 EOM
12355                 fflushNULL="$define"
12356                 ;;
12357         '')     $cat >&4 <<EOM
12358 Your fflush(NULL) isn't working (contrary to ANSI C).
12359 EOM
12360                 fflushNULL="$undef"
12361                 ;;
12362         *)      $cat >&4 <<EOM
12363 Cannot figure out whether your fflush(NULL) works or not.
12364 I'm assuming it doesn't (contrary to ANSI C).
12365 EOM
12366                 fflushNULL="$undef"
12367                 ;;
12368         esac
12369         ;;
12370 $define|true|[yY]*)
12371         fflushNULL="$define"
12372         ;;
12373 *)
12374         fflushNULL="$undef"
12375         ;;
12376 esac
12377 : check explicit looping only if NULL did not work
12378 case "$fflushNULL" in
12379 "$undef")
12380         : check for fflush all behaviour
12381         case "$fflushall" in
12382         '')     set try -DTRY_FFLUSH_ALL $output
12383                 if eval $compile; then
12384                         $cat >&4 <<EOM
12385 (Now testing the other method--but note that also this may fail.)
12386 EOM
12387                         $rm -f try.out
12388                         ./try$exe_ext 2>/dev/null
12389                         if $test -s try.out -a "X$?" = X42; then
12390                                 fflushall="`$cat try.out`"
12391                         fi
12392                 fi
12393                 $rm -f core try.core core.try.*
12394                 case "$fflushall" in
12395                 x)      $cat >&4 <<EOM
12396 Whew. Flushing explicitly all the stdio streams works.
12397 EOM
12398                         fflushall="$define"
12399                         ;;
12400                 '')     $cat >&4 <<EOM
12401 Sigh. Flushing explicitly all the stdio streams doesn't work.
12402 EOM
12403                         fflushall="$undef"
12404                         ;;
12405                 *)      $cat >&4 <<EOM
12406 Cannot figure out whether flushing stdio streams explicitly works or not.
12407 I'm assuming it doesn't.
12408 EOM
12409                         fflushall="$undef"
12410                         ;;
12411                 esac
12412                 ;;
12413         "$define"|true|[yY]*)
12414                 fflushall="$define"
12415                 ;;
12416         *)
12417                 fflushall="$undef"
12418                 ;;
12419         esac
12420         ;;
12421 *)      fflushall="$undef"      
12422         ;;
12423 esac
12424 case "$fflushNULL$fflushall" in
12425 undefundef)
12426         $cat <<EOM
12427 I cannot figure out how to flush pending stdio output.
12428 EOM
12429         ;;
12430 esac
12431 $rm -f try.* try$exe_ext
12432
12433 : Store the full pathname to the ar program for use in the C program
12434 : Respect a hint or command line value for full_ar.
12435 case "$full_ar" in
12436 '') full_ar=$ar ;;
12437 esac
12438
12439 : Store the full pathname to the sed program for use in the C program
12440 full_sed=$sed
12441
12442 : see what type gids are declared as in the kernel
12443 echo " "
12444 echo "Looking for the type for group ids returned by getgid()."
12445 set gid_t gidtype xxx stdio.h sys/types.h
12446 eval $typedef
12447 case "$gidtype" in
12448 xxx)
12449         xxx=`./findhdr sys/user.h`
12450         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12451         case $1 in
12452         unsigned) dflt="$1 $2" ;;
12453         *) dflt="$1" ;;
12454         esac
12455         ;;
12456 *) dflt="$gidtype";;
12457 esac
12458 case "$gidtype" in
12459 gid_t) echo "gid_t found." ;;
12460 *)      rp="What is the type for group ids returned by getgid()?"
12461         . ./myread
12462         gidtype="$ans"
12463         ;;
12464 esac
12465
12466 echo " "
12467 case "$gidtype" in
12468 *_t) zzz="$gidtype"     ;;
12469 *)   zzz="gid"          ;;
12470 esac
12471 echo "Checking the size of $zzz..." >&4 
12472 cat > try.c <<EOCP
12473 #include <sys/types.h>
12474 #include <stdio.h>
12475 int main() {
12476     printf("%d\n", (int)sizeof($gidtype));
12477     exit(0);
12478 }
12479 EOCP
12480 set try
12481 if eval $compile_ok; then
12482         yyy=`./try`
12483         case "$yyy" in
12484         '')     gidsize=4
12485                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12486                 ;;
12487         *)      gidsize=$yyy
12488                 echo "Your $zzz is $gidsize bytes long."
12489                 ;;
12490         esac
12491 else
12492         gidsize=4
12493         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12494 fi
12495
12496
12497 echo " "
12498 case "$gidtype" in
12499 *_t) zzz="$gidtype"     ;;
12500 *)   zzz="gid"          ;;
12501 esac
12502 echo "Checking the sign of $zzz..." >&4 
12503 cat > try.c <<EOCP
12504 #include <sys/types.h>
12505 #include <stdio.h>
12506 int main() {
12507         $gidtype foo = -1;
12508         if (foo < 0)
12509                 printf("-1\n");
12510         else
12511                 printf("1\n");
12512 }
12513 EOCP
12514 set try
12515 if eval $compile; then
12516         yyy=`./try`
12517         case "$yyy" in
12518         '')     gidsign=1
12519                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12520                 ;;
12521         *)      gidsign=$yyy
12522                 case "$gidsign" in
12523                  1) echo "Your $zzz is unsigned." ;;
12524                 -1) echo "Your $zzz is signed."   ;;
12525                 esac
12526                 ;;
12527         esac
12528 else
12529         gidsign=1
12530         echo "(I can't compile the test program--guessing unsigned.)" >&4
12531 fi
12532
12533
12534 echo " "
12535
12536 if $test X"$quadtype" != X; then
12537
12538 echo "Checking how to print 64-bit integers..." >&4
12539
12540 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12541         $cat >try.c <<'EOCP'
12542 #include <sys/types.h>
12543 #include <stdio.h>
12544 int main() {
12545   int q = 12345678901;
12546   printf("%ld\n", q);
12547 }
12548 EOCP
12549         set try
12550         if eval $compile; then
12551                 yyy=`./try$exe_ext`
12552                 case "$yyy" in
12553                 12345678901)
12554                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12555                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12556                         echo "We will use %d."
12557                         ;;
12558                 esac
12559         fi
12560 fi
12561
12562 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12563         $cat >try.c <<'EOCP'
12564 #include <sys/types.h>
12565 #include <stdio.h>
12566 int main() {
12567   long q = 12345678901;
12568   printf("%ld\n", q);
12569 }
12570 EOCP
12571         set try
12572         if eval $compile; then
12573                 yyy=`./try$exe_ext`
12574                 case "$yyy" in
12575                 12345678901)
12576                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12577                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12578                         echo "We will use %ld."
12579                         ;;
12580                 esac
12581         fi
12582 fi
12583
12584 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12585         $cat >try.c <<'EOCP'
12586 #include <sys/types.h>
12587 #include <inttypes.h>
12588 #include <stdio.h>
12589 int main() {
12590   int64_t q = 12345678901;
12591   printf("%" PRId64 "\n", q);
12592 }
12593 EOCP
12594         set try
12595         if eval $compile; then
12596                 yyy=`./try$exe_ext`
12597                 case "$yyy" in
12598                 12345678901)
12599                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12600                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12601                         echo "We will use the C9X style."
12602                         ;;
12603                 esac
12604         fi
12605 fi
12606
12607 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12608         $cat >try.c <<'EOCP'
12609 #include <sys/types.h>
12610 #include <stdio.h>
12611 int main() {
12612   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12613   printf("%lld\n", q);
12614 }
12615 EOCP
12616         set try
12617         if eval $compile; then
12618                 yyy=`./try$exe_ext`
12619                 case "$yyy" in
12620                 12345678901)
12621                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12622                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12623                         echo "We will use the %lld style."
12624                         ;;
12625                 esac
12626         fi
12627 fi
12628
12629 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12630         $cat >try.c <<EOCP
12631 #include <sys/types.h>
12632 #include <stdio.h>
12633 int main() {
12634   $quadtype q = 12345678901;
12635   printf("%Ld\n", q);
12636 }
12637 EOCP
12638         set try
12639         if eval $compile; then
12640                 yyy=`./try$exe_ext`
12641                 case "$yyy" in
12642                 12345678901)
12643                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12644                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12645                         echo "We will use %Ld."
12646                         ;;
12647                 esac
12648         fi
12649 fi
12650
12651 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12652         $cat >try.c <<EOCP
12653 #include <sys/types.h>
12654 #include <stdio.h>
12655 int main() {
12656   $quadtype q = 12345678901;
12657   printf("%qd\n", q);
12658 }
12659 EOCP
12660         set try
12661         if eval $compile; then
12662                 yyy=`./try$exe_ext`
12663                 case "$yyy" in
12664                 12345678901)
12665                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12666                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12667                         echo "We will use %qd."
12668                         ;;
12669                 esac
12670         fi
12671 fi
12672
12673 if $test X"$sPRId64" = X; then
12674         echo "Cannot figure out how to print 64-bit integers." >&4
12675 fi
12676
12677 $rm -f try try.*
12678
12679 fi
12680
12681 case "$sPRId64" in
12682 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12683         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12684         ;;
12685 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12686         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12687         ;;
12688 esac
12689
12690
12691 echo " "
12692 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12693
12694 if $test X"$ivsize" = X8; then
12695         ivdformat="$sPRId64"
12696         uvuformat="$sPRIu64"
12697         uvoformat="$sPRIo64"
12698         uvxformat="$sPRIx64"
12699 else
12700         if $test X"$ivsize" = X"$longsize"; then
12701                 ivdformat='"ld"'
12702                 uvuformat='"lu"'
12703                 uvoformat='"lo"'
12704                 uvxformat='"lx"'
12705         else
12706                 if $test X"$ivsize" = X"$intsize"; then
12707                         ivdformat='"d"'
12708                         uvuformat='"u"'
12709                         uvoformat='"o"'
12710                         uvxformat='"x"'
12711                 else
12712                         : far out
12713                         if $test X"$ivsize" = X"$shortsize"; then
12714                                 ivdformat='"hd"'
12715                                 uvuformat='"hu"'
12716                                 uvoformat='"ho"'
12717                                 uvxformat='"hx"'
12718                         fi
12719                 fi
12720         fi
12721 fi
12722
12723 case "$ivdformat" in
12724 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12725     exit 1
12726     ;;
12727 esac
12728
12729
12730 echo " "
12731 $echo "Checking the format string to be used for gids..." >&4
12732
12733 case "$gidsign" in
12734 -1)     if $test X"$gidsize" = X"$ivsize"; then
12735                 gidformat="$ivdformat"
12736         else
12737                 if $test X"$gidsize" = X"$longsize"; then
12738                         gidformat='"ld"'
12739                 else
12740                         if $test X"$gidsize" = X"$intsize"; then
12741                                 gidformat='"d"'
12742                         else
12743                                 if $test X"$gidsize" = X"$shortsize"; then
12744                                         gidformat='"hd"'
12745                                 fi
12746                         fi
12747                 fi
12748         fi
12749         ;;
12750 *)      if $test X"$gidsize" = X"$uvsize"; then
12751                 gidformat="$uvuformat"
12752         else
12753                 if $test X"$gidsize" = X"$longsize"; then
12754                         gidformat='"lu"'
12755                 else
12756                         if $test X"$gidsize" = X"$intsize"; then
12757                                 gidformat='"u"'
12758                         else
12759                                 if $test X"$gidsize" = X"$shortsize"; then
12760                                         gidformat='"hu"'
12761                                 fi
12762                         fi
12763                 fi
12764         fi
12765         ;;
12766 esac
12767
12768 : see if getgroups exists
12769 set getgroups d_getgrps
12770 eval $inlibc
12771
12772 : see if setgroups exists
12773 set setgroups d_setgrps
12774 eval $inlibc
12775
12776
12777 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12778 echo " "
12779 case "$d_getgrps$d_setgrps" in
12780 *define*)
12781         case "$groupstype" in
12782         '') dflt="$gidtype" ;;
12783         *)  dflt="$groupstype" ;;
12784         esac
12785         $cat <<EOM
12786 What type of pointer is the second argument to getgroups() and setgroups()?
12787 Usually this is the same as group ids, $gidtype, but not always.
12788
12789 EOM
12790         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12791         . ./myread
12792         groupstype="$ans"
12793         ;;
12794 *)  groupstype="$gidtype";;
12795 esac
12796
12797 echo " "
12798 echo "Checking if your $make program sets \$(MAKE)..." >&4
12799 case "$make_set_make" in
12800 '')
12801         $sed 's/^X //' > testmake.mak << 'EOF'
12802 Xall:
12803 X       @echo 'maketemp="$(MAKE)"'
12804 EOF
12805         case "`$make -f testmake.mak 2>/dev/null`" in
12806         *maketemp=*) make_set_make='#' ;;
12807         *)      make_set_make="MAKE=$make" ;;
12808         esac
12809         $rm -f testmake.mak
12810         ;;
12811 esac
12812 case "$make_set_make" in
12813 '#') echo "Yup, it does.";;
12814 *) echo "Nope, it doesn't.";;
12815 esac
12816
12817 : see what type is used for mode_t
12818 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12819 set mode_t modetype int stdio.h sys/types.h
12820 eval $typedef_ask
12821
12822 : define a fucntion to check prototypes
12823 $cat > protochk <<EOSH
12824 $startsh
12825 cc="$cc"
12826 optimize="$optimize"
12827 ccflags="$ccflags"
12828 prototype="$prototype"
12829 define="$define"
12830 rm=$rm
12831 EOSH
12832
12833 $cat >> protochk <<'EOSH'
12834
12835 $rm -f try.c
12836 foo="$1"
12837 shift
12838 while test $# -ge 2; do
12839         case "$1" in
12840                 $define) echo "#include <$2>" >> try.c ;;
12841                 literal) echo "$2" >> try.c ;;
12842         esac
12843     shift 2
12844 done
12845 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12846 cat >> try.c <<'EOCP'
12847 #ifdef CAN_PROTOTYPE
12848 #define _(args) args
12849 #else
12850 #define _(args) ()
12851 #endif
12852 EOCP
12853 echo "$foo" >> try.c
12854 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12855 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12856 status=$?
12857 $rm -f try.[co]
12858 exit $status
12859 EOSH
12860 chmod +x protochk
12861 $eunicefix protochk
12862
12863 : see what type is used for size_t
12864 rp="What is the type used for the length parameter for string functions?"
12865 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12866 eval $typedef_ask
12867
12868 : check for type of arguments to gethostbyaddr. 
12869 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12870         case "$d_gethbyaddr" in
12871         $define)
12872                 $cat <<EOM
12873
12874 Checking to see what type of arguments are accepted by gethostbyaddr().
12875 EOM
12876                 hdrs="$define sys/types.h
12877                         $d_socket sys/socket.h 
12878                         $i_niin netinet/in.h 
12879                         $i_netdb netdb.h
12880                         $i_unistd unistd.h"
12881                 : The first arg can 'char *' or 'void *'
12882                 : The second arg is some of integral type
12883                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12884                         for yyy in size_t long int; do
12885                                 case "$netdb_host_type" in
12886                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12887                                         if ./protochk "$try" $hdrs; then
12888                                                 echo "Your system accepts $xxx for the first arg."
12889                                                 echo "...and $yyy for the second arg."
12890                                                 netdb_host_type="$xxx"
12891                                                 netdb_hlen_type="$yyy"
12892                                         fi
12893                                         ;;
12894                                 esac
12895                         done
12896                 done
12897                 : In case none of those worked, prompt the user.
12898                 case "$netdb_host_type" in
12899                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12900                         dflt='char *'
12901                         . ./myread
12902                         netdb_host_type=$ans
12903                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12904                         dflt="$sizetype"
12905                         . ./myread
12906                         netdb_hlen_type=$ans
12907                         ;;
12908                 esac
12909                 ;;
12910         *)      : no gethostbyaddr, so pick harmless defaults
12911                 netdb_host_type='char *'
12912                 netdb_hlen_type="$sizetype"
12913                 ;;
12914         esac
12915         # Remove the "const" if needed. -- but then we'll have a 
12916         # prototype clash!
12917         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12918 fi
12919
12920 : check for type of argument to gethostbyname. 
12921 if test "X$netdb_name_type" = X ; then
12922         case "$d_gethbyname" in
12923         $define)
12924                 $cat <<EOM
12925
12926 Checking to see what type of argument is accepted by gethostbyname().
12927 EOM
12928                 hdrs="$define sys/types.h
12929                         $d_socket sys/socket.h 
12930                         $i_niin netinet/in.h 
12931                         $i_netdb netdb.h
12932                         $i_unistd unistd.h"
12933                 for xxx in "const char *" "char *"; do
12934                         case "$netdb_name_type" in
12935                         '')     try="extern struct hostent *gethostbyname($xxx);"
12936                                 if ./protochk "$try" $hdrs; then
12937                                         echo "Your system accepts $xxx."
12938                                         netdb_name_type="$xxx"
12939                                 fi
12940                                 ;;
12941                         esac
12942                 done
12943                 : In case none of those worked, prompt the user.
12944                 case "$netdb_name_type" in
12945                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12946                         dflt='char *'
12947                         . ./myread
12948                         netdb_name_type=$ans
12949                         ;;
12950                 esac
12951                 ;;
12952         *)      : no gethostbyname, so pick harmless default
12953                 netdb_name_type='char *'
12954                 ;;
12955         esac
12956 fi
12957
12958 : check for type of 1st argument to getnetbyaddr. 
12959 if test "X$netdb_net_type" = X ; then
12960         case "$d_getnbyaddr" in
12961         $define)
12962                 $cat <<EOM
12963
12964 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12965 EOM
12966                 hdrs="$define sys/types.h
12967                         $d_socket sys/socket.h 
12968                         $i_niin netinet/in.h 
12969                         $i_netdb netdb.h
12970                         $i_unistd unistd.h"
12971                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12972                         case "$netdb_net_type" in
12973                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12974                                 if ./protochk "$try" $hdrs; then
12975                                         echo "Your system accepts $xxx."
12976                                         netdb_net_type="$xxx"
12977                                 fi
12978                                 ;;
12979                         esac
12980                 done
12981                 : In case none of those worked, prompt the user.
12982                 case "$netdb_net_type" in
12983                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12984                         dflt='long'
12985                         . ./myread
12986                         netdb_net_type=$ans
12987                         ;;
12988                 esac
12989                 ;;
12990         *)      : no getnetbyaddr, so pick harmless default
12991                 netdb_net_type='long'
12992                 ;;
12993         esac
12994 fi
12995 : locate the preferred pager for this system
12996 case "$pager" in
12997 '')
12998         dflt=''
12999         case "$pg" in
13000         /*) dflt=$pg;;
13001         esac
13002         case "$more" in
13003         /*) dflt=$more;;
13004         esac
13005         case "$less" in
13006         /*) dflt=$less;;
13007         esac
13008         case "$dflt" in
13009         '') dflt=/usr/ucb/more;;
13010         esac
13011         ;;
13012 *) dflt="$pager";;
13013 esac
13014 echo " "
13015 fn=f/
13016 rp='What pager is used on your system?'
13017 . ./getfile
13018 pager="$ans"
13019
13020 : see what type pids are declared as in the kernel
13021 rp="What is the type of process ids on this system?"
13022 set pid_t pidtype int stdio.h sys/types.h
13023 eval $typedef_ask
13024
13025 : Find earliest binary compatible site_perl subdirectory perl can use.
13026 case "$bincompat5005" in
13027 "$define") xs_apiversion='5.005' ;;
13028 *) xs_apiversion=$version ;;   # The current site_perl version.
13029 esac
13030 : Find earliest pure perl site_perl subdirectory perl can use.
13031 : The versioned directories started at 5.005.
13032 pm_apiversion='5.005'
13033
13034 : check for length of pointer
13035 echo " "
13036 case "$ptrsize" in
13037 '')
13038         echo "Checking to see how big your pointers are..." >&4
13039         if test "$voidflags" -gt 7; then
13040                 echo '#define VOID_PTR char *' > try.c
13041         else
13042                 echo '#define VOID_PTR void *' > try.c
13043         fi
13044         $cat >>try.c <<'EOCP'
13045 #include <stdio.h>
13046 int main()
13047 {
13048     printf("%d\n", (int)sizeof(VOID_PTR));
13049     exit(0);
13050 }
13051 EOCP
13052         set try
13053         if eval $compile_ok; then
13054                 ptrsize=`./try`
13055                 echo "Your pointers are $ptrsize bytes long."
13056         else
13057                 dflt='4'
13058                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13059                 rp="What is the size of a pointer (in bytes)?"
13060                 . ./myread
13061                 ptrsize="$ans"
13062         fi
13063         ;;
13064 esac
13065 $rm -f try.c try
13066
13067 : see if ar generates random libraries by itself
13068 echo " "
13069 echo "Checking how to generate random libraries on your machine..." >&4
13070 echo 'int bar1() { return bar2(); }' > bar1.c
13071 echo 'int bar2() { return 2; }' > bar2.c
13072 $cat > foo.c <<'EOP'
13073 int main() { printf("%d\n", bar1()); exit(0); }
13074 EOP
13075 $cc $ccflags -c bar1.c >/dev/null 2>&1
13076 $cc $ccflags -c bar2.c >/dev/null 2>&1
13077 $cc $ccflags -c foo.c >/dev/null 2>&1
13078 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13079 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13080         ./foobar >/dev/null 2>&1; then
13081         echo "$ar appears to generate random libraries itself."
13082         orderlib=false
13083         ranlib=":"
13084 elif $ar ts bar$_a >/dev/null 2>&1 &&
13085         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13086         ./foobar >/dev/null 2>&1; then
13087                 echo "a table of contents needs to be added with '$ar ts'."
13088                 orderlib=false
13089                 ranlib="$ar ts"
13090 else
13091         case "$ranlib" in
13092         :) ranlib='';;
13093         '')
13094                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13095                 $test -f $ranlib || ranlib=''
13096                 ;;
13097         esac
13098         if $test -n "$ranlib"; then
13099                 echo "your system has '$ranlib'; we'll use that."
13100                 orderlib=false
13101         else
13102                 echo "your system doesn't seem to support random libraries"
13103                 echo "so we'll use lorder and tsort to order the libraries."
13104                 orderlib=true
13105                 ranlib=":"
13106         fi
13107 fi
13108 $rm -f foo* bar* 
13109
13110 : check for type of arguments to select. 
13111 case "$selecttype" in
13112 '') case "$d_select" in
13113         $define)
13114                 echo " "
13115                 $cat <<EOM
13116 Checking to see what type of arguments are accepted by select().
13117 EOM
13118                 hdrs="$define sys/types.h
13119                         $i_systime sys/time.h 
13120                         $i_sysselct sys/select.h
13121                         $d_socket sys/socket.h"
13122                 : The first arg can be int, unsigned, or size_t
13123                 : The last arg may or may not be 'const'
13124                 val=''
13125                 : void pointer has been seen but using that
13126                 : breaks the selectminbits test
13127                 for xxx in 'fd_set *' 'int *'; do
13128                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13129                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13130                                         case "$val" in
13131                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13132                                                 if ./protochk "$try" $hdrs; then
13133                                                         echo "Your system accepts $xxx."
13134                                                         val="$xxx"
13135                                                 fi
13136                                                 ;;
13137                                         esac
13138                                 done
13139                         done
13140                 done
13141                 case "$val" in
13142                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13143                         case "$d_fd_set" in
13144                                 $define) dflt="fd_set *" ;;
13145                                 *)              dflt="int *" ;;
13146                         esac
13147                         . ./myread
13148                         val=$ans
13149                         ;;
13150                 esac
13151                 selecttype="$val"
13152                 ;;
13153         *)      : no select, so pick a harmless default
13154                 selecttype='int *'
13155                 ;;
13156         esac
13157         ;;
13158 esac
13159
13160 : check for the select 'width'
13161 case "$selectminbits" in
13162 '') case "$d_select" in
13163         $define)
13164                 $cat <<EOM
13165
13166 Checking to see on how many bits at a time your select() operates...
13167 EOM
13168                 $cat >try.c <<EOCP
13169 #include <sys/types.h>
13170 #$i_time I_TIME
13171 #$i_systime I_SYS_TIME
13172 #$i_systimek I_SYS_TIME_KERNEL
13173 #ifdef I_TIME
13174 #   include <time.h>
13175 #endif
13176 #ifdef I_SYS_TIME
13177 #   ifdef I_SYS_TIME_KERNEL
13178 #       define KERNEL
13179 #   endif
13180 #   include <sys/time.h>
13181 #   ifdef I_SYS_TIME_KERNEL
13182 #       undef KERNEL
13183 #   endif
13184 #endif
13185 #$i_sysselct I_SYS_SELECT
13186 #ifdef I_SYS_SELECT
13187 #include <sys/select.h>
13188 #endif
13189 #$d_socket HAS_SOCKET
13190 #ifdef HAS_SOCKET
13191 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13192 #endif
13193 #include <stdio.h>
13194 $selecttype b;
13195 #define S sizeof(*(b))
13196 #define MINBITS 64
13197 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13198 #define NBITS  (NBYTES * 8)
13199 int main() {
13200     char s[NBYTES];
13201     struct timeval t;
13202     int i;
13203     FILE* fp;
13204     int fd;
13205
13206     fclose(stdin);
13207     fp = fopen("try.c", "r");
13208     if (fp == 0)
13209       exit(1);
13210     fd = fileno(fp);
13211     if (fd < 0)
13212       exit(2);
13213     b = ($selecttype)s;
13214     for (i = 0; i < NBITS; i++)
13215         FD_SET(i, b);
13216     t.tv_sec  = 0;
13217     t.tv_usec = 0;
13218     select(fd + 1, b, 0, 0, &t);
13219     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13220     printf("%d\n", i + 1);
13221     return 0;
13222 }
13223 EOCP
13224                 set try
13225                 if eval $compile_ok; then
13226                         selectminbits=`./try`
13227                         case "$selectminbits" in
13228                         '')     cat >&4 <<EOM
13229 Cannot figure out on how many bits at a time your select() operates.
13230 I'll play safe and guess it is 32 bits.
13231 EOM
13232                                 selectminbits=32
13233                                 bits="32 bits"
13234                                 ;;
13235                         1)      bits="1 bit" ;;
13236                         *)      bits="$selectminbits bits" ;;
13237                         esac
13238                         echo "Your select() operates on $bits at a time." >&4
13239                 else
13240                         rp='What is the minimum number of bits your select() operates on?'
13241                         case "$byteorder" in
13242                         1234|12345678)  dflt=32 ;;
13243                         *)              dflt=1  ;;
13244                         esac
13245                         . ./myread
13246                         val=$ans
13247                         selectminbits="$val"
13248                 fi
13249                 $rm -f try.* try
13250                 ;;
13251         *)      : no select, so pick a harmless default
13252                 selectminbits='32'
13253                 ;;
13254         esac
13255         ;;
13256 esac
13257
13258 : Trace out the files included by signal.h, then look for SIGxxx names.
13259 : Remove SIGARRAYSIZE used by HPUX.
13260 : Remove SIGSTKSIZE used by Linux.
13261 : Remove SIGSTKSZ used by Posix.
13262 : Remove SIGTYP void lines used by OS2.
13263 : Some cpps, like os390, dont give the file name anywhere
13264 if [ "X$fieldn" = X ]; then
13265         : Just make some guesses.  We check them later.
13266         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13267 else
13268         xxx=`echo '#include <signal.h>' |
13269         $cppstdin $cppminus $cppflags 2>/dev/null |
13270         $grep '^[       ]*#.*include' | 
13271         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13272 fi
13273 : Check this list of files to be sure we have parsed the cpp output ok.
13274 : This will also avoid potentially non-existent files, such 
13275 : as ../foo/bar.h
13276 xxxfiles=''
13277 for xx in $xxx /dev/null ; do
13278         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13279 done
13280 : If we have found no files, at least try signal.h
13281 case "$xxxfiles" in
13282 '')     xxxfiles=`./findhdr signal.h` ;;
13283 esac
13284 xxx=`awk '
13285 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13286         print substr($2, 4, 20)
13287 }
13288 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13289         print substr($3, 4, 20)
13290 }' $xxxfiles`
13291 : Append some common names just in case the awk scan failed.
13292 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13293 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13294 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13295 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13296 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13297
13298 : generate a few handy files for later
13299 $cat > signal.c <<'EOCP'
13300 #include <sys/types.h>
13301 #include <signal.h>
13302 #include <stdio.h>
13303 int main() {
13304
13305 /* Strange style to avoid deeply-nested #if/#else/#endif */
13306 #ifndef NSIG
13307 #  ifdef _NSIG
13308 #    define NSIG (_NSIG)
13309 #  endif
13310 #endif
13311
13312 #ifndef NSIG
13313 #  ifdef SIGMAX
13314 #    define NSIG (SIGMAX+1)
13315 #  endif
13316 #endif
13317
13318 #ifndef NSIG
13319 #  ifdef SIG_MAX
13320 #    define NSIG (SIG_MAX+1)
13321 #  endif
13322 #endif
13323
13324 #ifndef NSIG
13325 #  ifdef MAXSIG
13326 #    define NSIG (MAXSIG+1)
13327 #  endif
13328 #endif
13329
13330 #ifndef NSIG
13331 #  ifdef MAX_SIG
13332 #    define NSIG (MAX_SIG+1)
13333 #  endif
13334 #endif
13335
13336 #ifndef NSIG
13337 #  ifdef SIGARRAYSIZE
13338 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13339 #  endif
13340 #endif
13341
13342 #ifndef NSIG
13343 #  ifdef _sys_nsig
13344 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13345 #  endif
13346 #endif
13347
13348 /* Default to some arbitrary number that's big enough to get most
13349    of the common signals.
13350 */
13351 #ifndef NSIG
13352 #    define NSIG 50
13353 #endif
13354
13355 printf("NSIG %d\n", NSIG);
13356
13357 #ifndef JUST_NSIG
13358
13359 EOCP
13360
13361 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13362 {
13363         printf "#ifdef SIG"; printf $1; printf "\n"
13364         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13365         printf $1; printf ");\n"
13366         printf "#endif\n"
13367 }
13368 END {
13369         printf "#endif /* JUST_NSIG */\n";
13370         printf "exit(0);\n}\n";
13371 }
13372 ' >>signal.c
13373 $cat >signal.awk <<'EOP'
13374 BEGIN { ndups = 0 }
13375 $1 ~ /^NSIG$/ { nsig = $2 }
13376 ($1 !~ /^NSIG$/) && (NF == 2) {
13377     if ($2 > maxsig) { maxsig = $2 }
13378     if (sig_name[$2]) {
13379         dup_name[ndups] = $1
13380         dup_num[ndups] = $2
13381         ndups++ 
13382     }
13383     else {
13384         sig_name[$2] = $1
13385         sig_num[$2] = $2
13386     }
13387 }
13388 END { 
13389     if (nsig == 0) {
13390         nsig = maxsig + 1
13391     }
13392     printf("NSIG %d\n", nsig);
13393     for (n = 1; n < nsig; n++) {
13394         if (sig_name[n]) {
13395             printf("%s %d\n", sig_name[n], sig_num[n])
13396         }
13397         else {
13398             printf("NUM%d %d\n", n, n) 
13399         }
13400     }
13401     for (n = 0; n < ndups; n++) {
13402         printf("%s %d\n", dup_name[n], dup_num[n])
13403     }
13404 }
13405 EOP
13406 $cat >signal_cmd <<EOS
13407 $startsh
13408 if $test -s signal.lst; then
13409     echo "Using your existing signal.lst file"
13410         exit 0
13411 fi
13412 xxx="$xxx"
13413 EOS
13414 $cat >>signal_cmd <<'EOS'
13415
13416 set signal
13417 if eval $compile_ok; then
13418         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13419 else
13420         echo "(I can't seem be able to compile the whole test program)" >&4
13421         echo "(I'll try it in little pieces.)" >&4
13422         set signal -DJUST_NSIG
13423         if eval $compile_ok; then
13424                 ./signal$_exe > signal.nsg
13425                 $cat signal.nsg
13426         else
13427                 echo "I can't seem to figure out how many signals you have." >&4
13428                 echo "Guessing 50." >&4
13429                 echo 'NSIG 50' > signal.nsg
13430         fi
13431         : Now look at all the signal names, one at a time.
13432         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13433                 $cat > signal.c <<EOCP
13434 #include <sys/types.h>
13435 #include <signal.h>
13436 #include <stdio.h>
13437 int main() {
13438 printf("$xx %d\n", SIG${xx});
13439 return 0;
13440 }
13441 EOCP
13442                 set signal
13443                 if eval $compile; then
13444                         echo "SIG${xx} found."
13445                         ./signal$_exe  >> signal.ls1
13446                 else
13447                         echo "SIG${xx} NOT found."
13448                 fi
13449         done
13450         if $test -s signal.ls1; then
13451                 $cat signal.nsg signal.ls1 |
13452                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13453         fi
13454
13455 fi
13456 if $test -s signal.lst; then
13457         :
13458 else
13459         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13460         echo 'kill -l' >signal
13461         set X `csh -f <signal`
13462         $rm -f signal
13463         shift
13464         case $# in
13465         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13466         esac
13467         echo $@ | $tr ' ' $trnl | \
13468             $awk '{ printf "%s %d\n", $1, ++s; }
13469                   END { printf "NSIG %d\n", ++s }' >signal.lst
13470 fi
13471 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13472 EOS
13473 chmod a+x signal_cmd
13474 $eunicefix signal_cmd
13475
13476 : generate list of signal names
13477 echo " "
13478 case "$sig_name_init" in
13479 '') doinit=yes ;;
13480 *)  case "$sig_num_init" in
13481     ''|*,*) doinit=yes ;;
13482     esac ;;
13483 esac
13484 case "$doinit" in
13485 yes)
13486         echo "Generating a list of signal names and numbers..." >&4
13487         . ./signal_cmd
13488         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13489         sig_name=`$awk 'BEGIN { printf "ZERO " }
13490                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13491         sig_num=`$awk  'BEGIN { printf "0 " }
13492                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13493         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13494                              !/^NSIG/   { printf "\"%s\", ", $1 }
13495                              END        { printf "0\n" }' signal.lst`
13496         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13497                              !/^NSIG/   { printf "%d, ", $2}
13498                              END        { printf "0\n"}' signal.lst`
13499         ;;
13500 esac
13501 echo "The following $sig_count signals are available:"
13502 echo " "
13503 echo $sig_name | $awk \
13504 'BEGIN { linelen = 0 }
13505 {
13506         for (i = 1; i <= NF; i++) {
13507                 name = "SIG" $i " "
13508                 linelen = linelen + length(name)
13509                 if (linelen > 70) {
13510                         printf "\n"
13511                         linelen = length(name)
13512                 }
13513                 printf "%s", name
13514         }
13515         printf "\n"
13516 }'
13517 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13518
13519 : check for socklen_t
13520 echo " "
13521 echo "Checking to see if you have socklen_t..." >&4
13522 $cat >try.c <<EOCP
13523 #include <sys/types.h>
13524 #$d_socket HAS_SOCKET
13525 #ifdef HAS_SOCKET
13526 #include <sys/socket.h>
13527 #endif
13528 int main() { socklen_t x = 16; }
13529 EOCP
13530 set try
13531 if eval $compile; then
13532         val="$define"
13533         echo "You have socklen_t."
13534 else
13535         val="$undef"
13536         echo "You do not have socklen_t."
13537         case "$sizetype" in
13538         size_t) echo "(You do have size_t, that might work.)" ;;
13539         esac
13540 fi
13541 $rm -f try try.*
13542 set d_socklen_t
13543 eval $setvar
13544
13545 : check for type of the size argument to socket calls
13546 case "$d_socket" in
13547 "$define")
13548         $cat <<EOM
13549
13550 Checking to see what type is the last argument of accept().
13551 EOM
13552         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13553         yyy=''
13554         case "$d_socklen_t" in
13555         "$define") yyy="$yyy socklen_t"
13556         esac
13557         yyy="$yyy $sizetype int long"
13558         for xxx in $yyy; do
13559                 case "$socksizetype" in
13560                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13561                         if ./protochk "$try" $hdrs; then
13562                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13563                                 socksizetype="$xxx"
13564                         fi
13565                         ;;
13566                 esac
13567         done
13568 : In case none of those worked, prompt the user.
13569         case "$socksizetype" in
13570         '')     rp='What is the type for the last argument to accept()?'
13571                 dflt='int'
13572                 . ./myread
13573                 socksizetype=$ans
13574                 ;;
13575         esac
13576         ;;
13577 *)      : no sockets, so pick relatively harmless defaults
13578         socksizetype='char *'
13579         ;;
13580 esac
13581
13582 : see what type is used for signed size_t
13583 set ssize_t ssizetype int stdio.h sys/types.h
13584 eval $typedef
13585 dflt="$ssizetype"
13586 $cat > ssize.c <<EOM
13587 #include <stdio.h>
13588 #include <sys/types.h>
13589 #define Size_t $sizetype
13590 #define SSize_t $dflt
13591 int main()
13592 {
13593         if (sizeof(Size_t) == sizeof(SSize_t))
13594                 printf("$dflt\n");
13595         else if (sizeof(Size_t) == sizeof(int))
13596                 printf("int\n");
13597         else 
13598                 printf("long\n");
13599         exit(0);
13600 }
13601 EOM
13602 echo " "
13603 set ssize
13604 if eval $compile_ok && ./ssize > /dev/null; then
13605         ssizetype=`./ssize`
13606         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13607 else
13608         $cat >&4 <<EOM
13609 Help! I can't compile and run the ssize_t test program: please enlighten me!
13610 (This is probably a misconfiguration in your system or libraries, and
13611 you really ought to fix it.  Still, I'll try anyway.)
13612
13613 I need a type that is the same size as $sizetype, but is guaranteed to
13614 be signed.  Common values are ssize_t, int and long.
13615
13616 EOM
13617         rp="What signed type is the same size as $sizetype?"
13618         . ./myread
13619         ssizetype="$ans"
13620 fi
13621 $rm -f ssize ssize.*
13622
13623 : see what type of char stdio uses.
13624 echo " "
13625 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13626         echo "Your stdio uses unsigned chars." >&4
13627         stdchar="unsigned char"
13628 else
13629         echo "Your stdio uses signed chars." >&4
13630         stdchar="char"
13631 fi
13632
13633 : see if time exists
13634 echo " "
13635 if test "X$d_time" = X -o X"$timetype" = X; then
13636     if set time val -f d_time; eval $csym; $val; then
13637                 echo 'time() found.' >&4
13638                 val="$define"
13639                 rp="What is the type returned by time() on this system?"
13640                 set time_t timetype long stdio.h sys/types.h
13641                 eval $typedef_ask
13642     else
13643                 echo 'time() not found, hope that will do.' >&4
13644                 val="$undef"
13645                 timetype='int';
13646     fi
13647     set d_time
13648     eval $setvar
13649 fi
13650
13651 : see what type uids are declared as in the kernel
13652 echo " "
13653 echo "Looking for the type for user ids returned by getuid()."
13654 set uid_t uidtype xxx stdio.h sys/types.h
13655 eval $typedef
13656 case "$uidtype" in
13657 xxx)
13658         xxx=`./findhdr sys/user.h`
13659         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13660         case $1 in
13661         unsigned) dflt="$1 $2" ;;
13662         *) dflt="$1" ;;
13663         esac
13664         ;;
13665 *) dflt="$uidtype";;
13666 esac
13667 case "$uidtype" in
13668 uid_t)  echo "uid_t found." ;;
13669 *)      rp="What is the type for user ids returned by getuid()?"
13670         . ./myread
13671         uidtype="$ans"
13672         ;;
13673 esac
13674
13675 echo " "
13676 case "$uidtype" in
13677 *_t) zzz="$uidtype"     ;;
13678 *)   zzz="uid"          ;;
13679 esac
13680 echo "Checking the size of $zzz..." >&4 
13681 cat > try.c <<EOCP
13682 #include <sys/types.h>
13683 #include <stdio.h>
13684 int main() {
13685     printf("%d\n", (int)sizeof($uidtype));
13686     exit(0);
13687 }
13688 EOCP
13689 set try
13690 if eval $compile_ok; then
13691         yyy=`./try`
13692         case "$yyy" in
13693         '')     uidsize=4
13694                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13695                 ;;
13696         *)      uidsize=$yyy
13697                 echo "Your $zzz is $uidsize bytes long."
13698                 ;;
13699         esac
13700 else
13701         uidsize=4
13702         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13703 fi
13704
13705 echo " "
13706 case "$uidtype" in
13707 *_t) zzz="$uidtype"     ;;
13708 *)   zzz="uid"          ;;
13709 esac
13710 echo "Checking the sign of $zzz..." >&4
13711 cat > try.c <<EOCP
13712 #include <sys/types.h>
13713 #include <stdio.h>
13714 int main() {
13715         $uidtype foo = -1;
13716         if (foo < 0)
13717                 printf("-1\n");
13718         else
13719                 printf("1\n");
13720 }
13721 EOCP
13722 set try
13723 if eval $compile; then
13724         yyy=`./try`
13725         case "$yyy" in
13726         '')     uidsign=1
13727                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13728                 ;;
13729         *)      uidsign=$yyy
13730                 case "$uidsign" in
13731                  1) echo "Your $zzz is unsigned." ;;
13732                 -1) echo "Your $zzz is signed."   ;;
13733                 esac
13734                 ;;
13735         esac
13736 else
13737         uidsign=1
13738         echo "(I can't compile the test program--guessing unsigned.)" >&4
13739 fi
13740
13741
13742
13743 echo " "
13744 $echo "Checking the format string to be used for uids..." >&4
13745
13746 case "$uidsign" in
13747 -1)     if $test X"$uidsize" = X"$ivsize"; then
13748                 uidformat="$ivdformat"
13749         else
13750                 if $test X"$uidsize" = X"$longsize"; then
13751                         uidformat='"ld"'
13752                 else
13753                         if $test X"$uidsize" = X"$intsize"; then
13754                                 uidformat='"d"'
13755                         else
13756                                 if $test X"$uidsize" = X"$shortsize"; then
13757                                         uidformat='"hd"'
13758                                 fi
13759                         fi
13760                 fi
13761         fi
13762         ;;
13763 *)      if $test X"$uidsize" = X"$uvsize"; then
13764                 uidformat="$uvuformat"
13765         else
13766                 if $test X"$uidsize" = X"$longsize"; then
13767                         uidformat='"lu"'
13768                 else
13769                         if $test X"$uidsize" = X"$intsize"; then
13770                                 uidformat='"u"'
13771                         else
13772                                 if $test X"$uidsize" = X"$shortsize"; then
13773                                         uidformat='"hu"'
13774                                 fi
13775                         fi
13776                 fi
13777         fi
13778         ;;
13779 esac
13780
13781 : see if dbm.h is available
13782 : see if dbmclose exists
13783 set dbmclose d_dbmclose
13784 eval $inlibc
13785
13786 case "$d_dbmclose" in
13787 $define)
13788         set dbm.h i_dbm
13789         eval $inhdr
13790         case "$i_dbm" in
13791         $define)
13792                 val="$undef"
13793                 set i_rpcsvcdbm
13794                 eval $setvar
13795                 ;;
13796         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13797                 eval $inhdr
13798                 ;;
13799         esac
13800         ;;
13801 *)      echo "We won't be including <dbm.h>"
13802         val="$undef"
13803         set i_dbm
13804         eval $setvar
13805         val="$undef"
13806         set i_rpcsvcdbm
13807         eval $setvar
13808         ;;
13809 esac
13810
13811 : see if this is a sys/file.h system
13812 val=''
13813 set sys/file.h val
13814 eval $inhdr
13815
13816 : do we need to include sys/file.h ?
13817 case "$val" in
13818 "$define")
13819         echo " "
13820         if $h_sysfile; then
13821                 val="$define"
13822                 echo "We'll be including <sys/file.h>." >&4
13823         else
13824                 val="$undef"
13825                 echo "We won't be including <sys/file.h>." >&4
13826         fi
13827         ;;
13828 *)
13829         h_sysfile=false
13830         ;;
13831 esac
13832 set i_sysfile
13833 eval $setvar
13834
13835 : see if fcntl.h is there
13836 val=''
13837 set fcntl.h val
13838 eval $inhdr
13839
13840 : see if we can include fcntl.h
13841 case "$val" in
13842 "$define")
13843         echo " "
13844         if $h_fcntl; then
13845                 val="$define"
13846                 echo "We'll be including <fcntl.h>." >&4
13847         else
13848                 val="$undef"
13849                 if $h_sysfile; then
13850         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13851                 else
13852                         echo "We won't be including <fcntl.h>." >&4
13853                 fi
13854         fi
13855         ;;
13856 *)
13857         h_fcntl=false
13858         val="$undef"
13859         ;;
13860 esac
13861 set i_fcntl
13862 eval $setvar
13863
13864 : see if this is a iconv.h system
13865 set iconv.h i_iconv
13866 eval $inhdr
13867
13868 : see if locale.h is available
13869 set locale.h i_locale
13870 eval $inhdr
13871
13872 : see if mach cthreads are available
13873 if test "X$usethreads" = "X$define"; then
13874         set mach/cthreads.h i_machcthr
13875         eval $inhdr
13876 else
13877         i_machcthr="$undef"
13878 fi
13879
13880
13881
13882 : see if this is a math.h system
13883 set math.h i_math
13884 eval $inhdr
13885
13886 : see if this is a mntent.h system
13887 set mntent.h i_mntent
13888 eval $inhdr
13889
13890 : see if ndbm.h is available
13891 set ndbm.h t_ndbm
13892 eval $inhdr
13893 case "$t_ndbm" in
13894 $define)
13895         : see if dbm_open exists
13896         set dbm_open d_dbm_open
13897         eval $inlibc
13898         case "$d_dbm_open" in
13899         $undef)
13900                 t_ndbm="$undef"
13901                 echo "We won't be including <ndbm.h>"
13902                 ;;
13903         esac
13904         ;;
13905 esac
13906 val="$t_ndbm"
13907 set i_ndbm
13908 eval $setvar
13909
13910 : see if net/errno.h is available
13911 val=''
13912 set net/errno.h val
13913 eval $inhdr
13914
13915 : Unfortunately, it causes problems on some systems.  Arrgh.
13916 case "$val" in
13917 $define)
13918         cat > try.c <<'EOM'
13919 #include <stdio.h>
13920 #include <errno.h>
13921 #include <net/errno.h>
13922 int func()
13923 {
13924         return ENOTSOCK;
13925 }
13926 EOM
13927         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13928                 echo "We'll be including <net/errno.h>." >&4
13929         else
13930                 echo "We won't be including <net/errno.h>." >&4
13931                 val="$undef"
13932         fi
13933         $rm -f try.* try
13934         ;;
13935 esac
13936 set i_neterrno
13937 eval $setvar
13938
13939 : see if netinet/tcp.h is available
13940 set netinet/tcp.h i_netinettcp
13941 eval $inhdr
13942
13943 : see if this is a poll.h system
13944 set poll.h i_poll
13945 eval $inhdr
13946
13947 echo " "
13948 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13949 $cat <<'EOSH' > Cppsym.know
13950 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13951 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13952 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13953 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13954 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13955 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13956 bull c cadmus clipper CMU COFF COMPILER_VERSION
13957 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13958 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13959 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13960 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13961 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13962 H3050R H3050RX hbullx20 hcx host_mips
13963 hp200 hp300 hp700 HP700 hp800 hp9000
13964 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13965 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13966 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13967 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13968 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13969 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13970 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13971 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13972 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13973 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13974 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13975 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13976 MATH_HAS_NO_SIDE_EFFECTS
13977 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13978 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13979 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13980 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13981 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13982 NetBSD news1500 news1700 news1800 news1900 news3700
13983 news700 news800 news900 NeXT NLS ns16000 ns32000
13984 ns32016 ns32332 ns32k nsc32000
13985 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13986 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13987 pc532 pdp11 PGC PIC plexus PORTAR posix
13988 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13989 POSIX_C_SOURCE POSIX_SOURCE POWER
13990 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13991 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13992 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13993 sony sony_news sonyrisc sparc sparclite spectrum
13994 stardent stdc STDC_EXT stratos sun sun3 sun386
13995 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13996 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13997 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13998 sysV68 sysV88 Tek4132 Tek4300 titan
13999 tower tower32 tower32_200 tower32_600 tower32_700
14000 tower32_800 tower32_850 tss
14001 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14002 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14003 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14004 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14005 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14006 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14007 z8000
14008 EOSH
14009 # Maybe put other stuff here too.
14010 cat <<EOSH >>Cppsym.know
14011 $osname
14012 EOSH
14013 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14014 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14015 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14016 $rm -f Cppsym.a Cppsym.b
14017 cat <<EOSH > Cppsym
14018 $startsh
14019 if $test \$# -gt 0; then
14020     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14021     if $test -s Cppsym.got; then
14022         $rm -f Cppsym.got
14023         exit 0
14024     fi
14025     $rm -f Cppsym.got
14026     exit 1
14027 else
14028     $tr " " "$trnl" | ./Cppsym.try
14029     exit 0
14030 fi
14031 EOSH
14032 chmod +x Cppsym
14033 $eunicefix Cppsym
14034 cat <<EOSH > Cppsym.try
14035 $startsh
14036 cat <<'EOCP' > try.c
14037 #include <stdio.h>
14038 int main() {
14039 EOCP
14040 $awk \\
14041 EOSH
14042 cat <<'EOSH' >> Cppsym.try
14043 'length($1) > 0 {
14044     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
14045     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
14046     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
14047     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
14048 }'       >> try.c
14049 echo '}' >> try.c
14050 EOSH
14051 cat <<EOSH >> Cppsym.try
14052 cc="$cc"
14053 optimize="$optimize"
14054 ccflags="$ccflags"
14055 ldflags="$ldflags"
14056 libs="$libs"
14057 exe_ext="$exe_ext"
14058 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14059 EOSH
14060 chmod +x Cppsym.try
14061 $eunicefix Cppsym.try
14062 ./Cppsym < Cppsym.know > Cppsym.true
14063 : now check the C compiler for additional symbols
14064 postprocess_cc_v=''
14065 case "$osname" in
14066 aix) postprocess_cc_v="|$tr , ' '" ;;
14067 esac
14068 $cat >ccsym <<EOS
14069 $startsh
14070 $cat >tmp.c <<EOF
14071 extern int foo;
14072 EOF
14073 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14074 do
14075         case "\$i" in
14076         -D*) echo "\$i" | $sed 's/^-D//';;
14077         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14078         esac
14079 done
14080 $rm -f try.c
14081 EOS
14082 postprocess_cc_v=''
14083 chmod +x ccsym
14084 $eunicefix ccsym
14085 ./ccsym > ccsym1.raw
14086 if $test -s ccsym1.raw; then
14087        $sort ccsym1.raw | $uniq >ccsym.raw
14088 else
14089        mv ccsym1.raw ccsym.raw
14090 fi
14091
14092 $awk '/\=/ { print $0; next }
14093         { print $0"=1" }' ccsym.raw >ccsym.list
14094 $awk '/\=/ { print $0; next }
14095         { print $0"=1" }' Cppsym.true >ccsym.true
14096 $comm -13 ccsym.true ccsym.list >ccsym.own
14097 $comm -12 ccsym.true ccsym.list >ccsym.com
14098 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14099 also=''
14100 if $test -z ccsym.raw; then
14101         echo "Your C compiler doesn't seem to define any symbols!" >&4
14102         echo " "
14103         echo "However, your C preprocessor defines the following symbols:"
14104         $cat Cppsym.true
14105         ccsymbols=''
14106         cppsymbols=`$cat Cppsym.true`
14107         cppsymbols=`echo $cppsymbols`
14108         cppccsymbols="$cppsymbols"
14109 else
14110         if $test -s ccsym.com; then
14111                 echo "Your C compiler and pre-processor define these symbols:"
14112                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14113                 also='also '
14114                 symbols='ones'
14115                 cppccsymbols=`$cat ccsym.com`
14116                 cppccsymbols=`echo $cppccsymbols`
14117                 $test "$silent" || sleep 1
14118         fi
14119         if $test -s ccsym.cpp; then
14120                 $test "$also" && echo " "
14121                 echo "Your C pre-processor ${also}defines the following symbols:"
14122                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14123                 also='further '
14124                 cppsymbols=`$cat ccsym.cpp`
14125                 cppsymbols=`echo $cppsymbols`
14126                 $test "$silent" || sleep 1
14127         fi
14128         if $test -s ccsym.own; then
14129                 $test "$also" && echo " "
14130                 echo "Your C compiler ${also}defines the following cpp symbols:"
14131                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14132                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14133                 ccsymbols=`$cat ccsym.own`
14134                 ccsymbols=`echo $ccsymbols`
14135                 $test "$silent" || sleep 1
14136         fi
14137 fi
14138 $rm -f ccsym*
14139
14140 : see if this is a termio system
14141 val="$undef"
14142 val2="$undef"
14143 val3="$undef"
14144 if $test `./findhdr termios.h`; then
14145         set tcsetattr i_termios
14146         eval $inlibc
14147         val3="$i_termios"
14148 fi
14149 echo " "
14150 case "$val3" in
14151 "$define") echo "You have POSIX termios.h... good!" >&4;;
14152 *) if ./Cppsym pyr; then
14153                 case "`/bin/universe`" in
14154                 ucb) if $test `./findhdr sgtty.h`; then
14155                                 val2="$define"
14156                                 echo "<sgtty.h> found." >&4
14157                         else
14158                                 echo "System is pyramid with BSD universe."
14159                                 echo "<sgtty.h> not found--you could have problems." >&4
14160                         fi;;
14161                 *) if $test `./findhdr termio.h`; then
14162                                 val="$define"
14163                                 echo "<termio.h> found." >&4
14164                         else
14165                                 echo "System is pyramid with USG universe."
14166                                 echo "<termio.h> not found--you could have problems." >&4
14167                         fi;;
14168                 esac
14169         elif ./usg; then
14170                 if $test `./findhdr termio.h`; then
14171                         echo "<termio.h> found." >&4
14172                         val="$define"
14173                 elif $test `./findhdr sgtty.h`; then
14174                         echo "<sgtty.h> found." >&4
14175                         val2="$define"
14176                 else
14177 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14178                 fi
14179         else
14180                 if $test `./findhdr sgtty.h`; then
14181                         echo "<sgtty.h> found." >&4
14182                         val2="$define"
14183                 elif $test `./findhdr termio.h`; then
14184                         echo "<termio.h> found." >&4
14185                         val="$define"
14186                 else
14187 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14188                 fi
14189         fi;;
14190 esac
14191 set i_termio; eval $setvar
14192 val=$val2; set i_sgtty; eval $setvar
14193 val=$val3; set i_termios; eval $setvar
14194
14195 : see if this is a shadow.h system
14196 set shadow.h i_shadow
14197 eval $inhdr
14198
14199 : see if this is a socks.h system
14200 set socks.h i_socks
14201 eval $inhdr
14202
14203 : see if stdarg is available
14204 echo " "
14205 if $test `./findhdr stdarg.h`; then
14206         echo "<stdarg.h> found." >&4
14207         valstd="$define"
14208 else
14209         echo "<stdarg.h> NOT found." >&4
14210         valstd="$undef"
14211 fi
14212
14213 : see if varags is available
14214 echo " "
14215 if $test `./findhdr varargs.h`; then
14216         echo "<varargs.h> found." >&4
14217 else
14218         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14219 fi
14220
14221 : set up the varargs testing programs
14222 $cat > varargs.c <<EOP
14223 #ifdef I_STDARG
14224 #include <stdarg.h>
14225 #endif
14226 #ifdef I_VARARGS
14227 #include <varargs.h>
14228 #endif
14229
14230 #ifdef I_STDARG
14231 int f(char *p, ...)
14232 #else
14233 int f(va_alist)
14234 va_dcl
14235 #endif
14236 {
14237         va_list ap;
14238 #ifndef I_STDARG
14239         char *p;
14240 #endif
14241 #ifdef I_STDARG
14242         va_start(ap,p);
14243 #else
14244         va_start(ap);
14245         p = va_arg(ap, char *);
14246 #endif
14247         va_end(ap);
14248 }
14249 EOP
14250 $cat > varargs <<EOP
14251 $startsh
14252 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14253         echo "true"
14254 else
14255         echo "false"
14256 fi
14257 $rm -f varargs$_o
14258 EOP
14259 chmod +x varargs
14260
14261 : now check which varargs header should be included
14262 echo " "
14263 i_varhdr=''
14264 case "$valstd" in
14265 "$define")
14266         if `./varargs I_STDARG`; then
14267                 val='stdarg.h'
14268         elif `./varargs I_VARARGS`; then
14269                 val='varargs.h'
14270         fi
14271         ;;
14272 *)
14273         if `./varargs I_VARARGS`; then
14274                 val='varargs.h'
14275         fi
14276         ;;
14277 esac
14278 case "$val" in
14279 '')
14280 echo "I could not find the definition for va_dcl... You have problems..." >&4
14281         val="$undef"; set i_stdarg; eval $setvar
14282         val="$undef"; set i_varargs; eval $setvar
14283         ;;
14284 *) 
14285         set i_varhdr
14286         eval $setvar
14287         case "$i_varhdr" in
14288         stdarg.h)
14289                 val="$define"; set i_stdarg; eval $setvar
14290                 val="$undef"; set i_varargs; eval $setvar
14291                 ;;
14292         varargs.h)
14293                 val="$undef"; set i_stdarg; eval $setvar
14294                 val="$define"; set i_varargs; eval $setvar
14295                 ;;
14296         esac
14297         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14298 esac
14299 $rm -f varargs*
14300
14301 : see if stddef is available
14302 set stddef.h i_stddef
14303 eval $inhdr
14304
14305 : see if sys/access.h is available
14306 set sys/access.h i_sysaccess
14307 eval $inhdr
14308
14309 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14310 set sys/filio.h i_sysfilio
14311 eval $inhdr
14312 echo " "
14313 if $test `./findhdr sys/ioctl.h`; then
14314         val="$define"
14315         echo '<sys/ioctl.h> found.' >&4
14316 else
14317         val="$undef"
14318         if $test $i_sysfilio = "$define"; then
14319             echo '<sys/ioctl.h> NOT found.' >&4
14320         else
14321                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14322                 $test $i_termio = "$define" && xxx="termio.h"
14323                 $test $i_termios = "$define" && xxx="termios.h"
14324 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14325         fi
14326 fi
14327 set i_sysioctl
14328 eval $setvar
14329
14330
14331 : see if this is a syslog.h system
14332 set syslog.h i_syslog
14333 eval $inhdr
14334
14335
14336 : see if this is a sys/mode.h system
14337 set sys/mode.h i_sysmode
14338 eval $inhdr
14339
14340 : see if sys/resource.h has to be included
14341 set sys/resource.h i_sysresrc
14342 eval $inhdr
14343
14344 : see if sys/security.h is available
14345 set sys/security.h i_syssecrt
14346 eval $inhdr
14347
14348 : see if this is a sys/statvfs.h system
14349 set sys/statvfs.h i_sysstatvfs
14350 eval $inhdr
14351
14352 : see if this is a sys/uio.h system
14353 set sys/uio.h i_sysuio
14354 eval $inhdr
14355
14356 : see if this is a sys/un.h system
14357 set sys/un.h i_sysun
14358 eval $inhdr
14359
14360
14361 : see if this is a sys/utsname.h system
14362 set sys/utsname.h i_sysutsname
14363 eval $inhdr
14364
14365 : see if this is a syswait system
14366 set sys/wait.h i_syswait
14367 eval $inhdr
14368
14369 : see if this is a ustat.h system
14370 set ustat.h i_ustat
14371 eval $inhdr
14372
14373 : see if this is an utime system
14374 set utime.h i_utime
14375 eval $inhdr
14376
14377 : see if this is a values.h system
14378 set values.h i_values
14379 eval $inhdr
14380
14381 : see if this is a vfork system
14382 case "$d_vfork" in
14383 "$define")
14384         set vfork.h i_vfork
14385         eval $inhdr
14386         ;;
14387 *)
14388         i_vfork="$undef"
14389         ;;
14390 esac
14391
14392 : see if gdbm.h is available
14393 set gdbm.h t_gdbm
14394 eval $inhdr
14395 case "$t_gdbm" in
14396 $define)
14397         : see if gdbm_open exists
14398         set gdbm_open d_gdbm_open
14399         eval $inlibc
14400         case "$d_gdbm_open" in
14401         $undef)
14402                 t_gdbm="$undef"
14403                 echo "We won't be including <gdbm.h>"
14404                 ;;
14405         esac
14406         ;;
14407 esac
14408 val="$t_gdbm"
14409 set i_gdbm
14410 eval $setvar
14411
14412 echo " "
14413 echo "Looking for extensions..." >&4
14414 : If we are using the old config.sh, known_extensions may contain
14415 : old or inaccurate or duplicate values.
14416 known_extensions=''
14417 nonxs_extensions=''
14418 : We do not use find because it might not be available.
14419 : We do not just use MANIFEST because the user may have dropped
14420 : some additional extensions into the source tree and expect them
14421 : to be built.
14422
14423 : Function to recursively find available extensions, ignoring DynaLoader
14424 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14425 find_extensions='
14426     for xxx in *; do
14427        case "$xxx" in
14428            DynaLoader|dynaload) ;;
14429            *)
14430            if $test -f $xxx/$xxx.xs; then
14431                known_extensions="$known_extensions $1$xxx";
14432            elif $test -f $xxx/Makefile.PL; then
14433                nonxs_extensions="$nonxs_extensions $1$xxx";
14434            else
14435                if $test -d $xxx -a $# -lt 10; then
14436                    set $1$xxx/ $*;
14437                    cd $xxx;
14438                    eval $find_extensions;
14439                    cd ..;
14440                    shift;
14441                fi;
14442            fi
14443            ;;
14444        esac;
14445     done'
14446 tdir=`pwd`
14447 cd $rsrc/ext
14448 set X
14449 shift
14450 eval $find_extensions
14451 set X $nonxs_extensions
14452 shift
14453 nonxs_extensions="$*"
14454 set X $known_extensions
14455 shift
14456 known_extensions="$*"
14457 cd $tdir
14458
14459 : Now see which are supported on this system.
14460 avail_ext=''
14461 for xxx in $known_extensions ; do
14462         case "$xxx" in
14463         DB_File|db_file)
14464                 case "$i_db" in
14465                 $define) avail_ext="$avail_ext $xxx" ;;
14466                 esac
14467                 ;;
14468         GDBM_File|gdbm_fil)
14469                 case "$i_gdbm" in 
14470                 $define) avail_ext="$avail_ext $xxx" ;;
14471                 esac
14472                 ;;
14473         NDBM_File|ndbm_fil)
14474                 case "$i_ndbm" in
14475                 $define)
14476                     case "$osname-$use64bitint" in
14477                     hpux-define)
14478                         case "$libs" in
14479                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14480                         esac
14481                         ;;
14482                     *) avail_ext="$avail_ext $xxx" ;;
14483                     esac
14484                     ;;
14485                 esac
14486                 ;;
14487         ODBM_File|odbm_fil) 
14488                 case "${i_dbm}${i_rpcsvcdbm}" in
14489                 *"${define}"*)
14490                     case "$osname-$use64bitint" in
14491                     hpux-define)
14492                         case "$libs" in
14493                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14494                         esac
14495                         ;;
14496                     *) avail_ext="$avail_ext $xxx" ;;
14497                     esac
14498                     ;;
14499                 esac
14500                 ;;
14501         POSIX|posix)
14502                 case "$useposix" in
14503                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14504                 esac
14505                 ;;
14506         Opcode|opcode)
14507                 case "$useopcode" in
14508                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14509                 esac
14510                 ;;
14511         Socket|socket)
14512                 case "$d_socket" in 
14513                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14514                 esac
14515                 ;;
14516         Thread|thread)
14517                 case "$usethreads" in 
14518                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14519                 esac
14520                 ;;
14521         IPC/SysV|ipc/sysv)
14522                 : XXX Do we need a useipcsysv variable here
14523                 case "${d_msg}${d_sem}${d_shm}" in 
14524                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14525                 esac
14526                 ;;
14527         *)      avail_ext="$avail_ext $xxx"
14528                 ;;
14529         esac
14530 done
14531
14532 set X $avail_ext
14533 shift
14534 avail_ext="$*"
14535
14536 : Now see which nonxs extensions are supported on this system.
14537 : For now assume all are.
14538 nonxs_ext=''
14539 for xxx in $nonxs_extensions ; do
14540         case "$xxx" in
14541         *)      nonxs_ext="$nonxs_ext $xxx"
14542                 ;;
14543         esac
14544 done
14545
14546 set X $nonxs_ext
14547 shift
14548 nonxs_ext="$*"
14549
14550 case $usedl in
14551 $define)
14552         $cat <<EOM
14553 A number of extensions are supplied with $package.  You may choose to
14554 compile these extensions for dynamic loading (the default), compile
14555 them into the $package executable (static loading), or not include
14556 them at all.  Answer "none" to include no extensions.
14557 Note that DynaLoader is always built and need not be mentioned here.
14558
14559 EOM
14560         case "$dynamic_ext" in
14561         '') dflt="$avail_ext" ;;
14562         *)      dflt="$dynamic_ext"
14563                 # Perhaps we are reusing an old out-of-date config.sh.
14564                 case "$hint" in
14565                 previous)
14566                         if test X"$dynamic_ext" != X"$avail_ext"; then
14567                                 $cat <<EOM
14568 NOTICE:  Your previous config.sh list may be incorrect. 
14569 The extensions now available to you are 
14570         ${avail_ext}
14571 but the default list from your previous config.sh is
14572         ${dynamic_ext} 
14573
14574 EOM
14575                         fi
14576                         ;;
14577                 esac
14578                 ;;
14579         esac
14580         case "$dflt" in
14581         '')     dflt=none;;
14582         esac
14583         rp="What extensions do you wish to load dynamically?"
14584         . ./myread
14585         case "$ans" in
14586         none) dynamic_ext=' ' ;;
14587         *) dynamic_ext="$ans" ;;
14588         esac
14589
14590         case "$static_ext" in
14591         '')
14592                 : Exclude those already listed in dynamic linking
14593                 dflt=''
14594                 for xxx in $avail_ext; do
14595                         case " $dynamic_ext " in
14596                         *" $xxx "*) ;;
14597                         *) dflt="$dflt $xxx" ;;
14598                         esac
14599                 done
14600                 set X $dflt
14601                 shift
14602                 dflt="$*"
14603                 ;;
14604         *)  dflt="$static_ext" 
14605                 ;;
14606         esac
14607
14608         case "$dflt" in
14609         '')     dflt=none;;
14610         esac
14611         rp="What extensions do you wish to load statically?"
14612         . ./myread
14613         case "$ans" in
14614         none) static_ext=' ' ;;
14615         *) static_ext="$ans" ;;
14616         esac
14617         ;;
14618 *)
14619         $cat <<EOM
14620 A number of extensions are supplied with $package.  Answer "none" 
14621 to include no extensions. 
14622 Note that DynaLoader is always built and need not be mentioned here.
14623
14624 EOM
14625         case "$static_ext" in
14626         '') dflt="$avail_ext" ;;
14627         *)      dflt="$static_ext"
14628                 # Perhaps we are reusing an old out-of-date config.sh.
14629                 case "$hint" in
14630                 previous)
14631                         if test X"$static_ext" != X"$avail_ext"; then
14632                                 $cat <<EOM
14633 NOTICE:  Your previous config.sh list may be incorrect. 
14634 The extensions now available to you are 
14635         ${avail_ext}
14636 but the default list from your previous config.sh is
14637         ${static_ext} 
14638
14639 EOM
14640                         fi
14641                         ;;
14642                 esac
14643                 ;;
14644         esac
14645         : Exclude those that are not xs extensions
14646         case "$dflt" in
14647         '')     dflt=none;;
14648         esac
14649         rp="What extensions do you wish to include?"
14650         . ./myread
14651         case "$ans" in
14652         none) static_ext=' ' ;;
14653         *) static_ext="$ans" ;;
14654         esac
14655         ;;
14656 esac
14657
14658 set X $dynamic_ext $static_ext $nonxs_ext
14659 shift
14660 extensions="$*"
14661
14662 : Remove build directory name from cppstdin so it can be used from
14663 : either the present location or the final installed location.
14664 echo " "
14665 : Get out of the UU directory to get correct path name.
14666 cd ..
14667 case "$cppstdin" in
14668 `pwd`/cppstdin)
14669         echo "Stripping down cppstdin path name"
14670         cppstdin=cppstdin
14671         ;;
14672 esac
14673 cd UU
14674
14675 : end of configuration questions
14676 echo " "
14677 echo "End of configuration questions."
14678 echo " "
14679
14680 : back to where it started
14681 if test -d ../UU; then
14682         cd ..
14683 fi
14684
14685 : configuration may be patched via a 'config.over' file
14686 if $test -f config.over; then
14687         echo " "
14688         dflt=y
14689         rp='I see a config.over file.  Do you wish to load it?'
14690         . UU/myread
14691         case "$ans" in
14692         n*) echo "OK, I'll ignore it.";;
14693         *)      . ./config.over
14694                 echo "Configuration override changes have been loaded."
14695                 ;;
14696         esac
14697 fi
14698
14699 : in case they want portability, strip down executable paths
14700 case "$d_portable" in
14701 "$define")
14702         echo " "
14703         echo "Stripping down executable paths..." >&4
14704         for file in $loclist $trylist; do
14705                 eval temp=\$$file
14706                 eval $file=`basename $temp`
14707         done
14708         ;;
14709 esac
14710
14711 : create config.sh file
14712 echo " "
14713 echo "Creating config.sh..." >&4
14714 $spitshell <<EOT >config.sh
14715 $startsh
14716 #
14717 # This file was produced by running the Configure script. It holds all the
14718 # definitions figured out by Configure. Should you modify one of these values,
14719 # do not forget to propagate your changes by running "Configure -der". You may
14720 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14721 #
14722
14723 # Package name      : $package
14724 # Source directory  : $src
14725 # Configuration time: $cf_time
14726 # Configured by     : $cf_by
14727 # Target system     : $myuname
14728
14729 Author='$Author'
14730 Date='$Date'
14731 Header='$Header'
14732 Id='$Id'
14733 Locker='$Locker'
14734 Log='$Log'
14735 Mcc='$Mcc'
14736 RCSfile='$RCSfile'
14737 Revision='$Revision'
14738 Source='$Source'
14739 State='$State'
14740 _a='$_a'
14741 _exe='$_exe'
14742 _o='$_o'
14743 afs='$afs'
14744 alignbytes='$alignbytes'
14745 ansi2knr='$ansi2knr'
14746 aphostname='$aphostname'
14747 api_revision='$api_revision'
14748 api_subversion='$api_subversion'
14749 api_version='$api_version'
14750 api_versionstring='$api_versionstring'
14751 ar='$ar'
14752 archlib='$archlib'
14753 archlibexp='$archlibexp'
14754 archname64='$archname64'
14755 archname='$archname'
14756 archobjs='$archobjs'
14757 awk='$awk'
14758 baserev='$baserev'
14759 bash='$bash'
14760 bin='$bin'
14761 bincompat5005='$bincompat5005'
14762 binexp='$binexp'
14763 bison='$bison'
14764 byacc='$byacc'
14765 byteorder='$byteorder'
14766 c='$c'
14767 castflags='$castflags'
14768 cat='$cat'
14769 cc='$cc'
14770 cccdlflags='$cccdlflags'
14771 ccdlflags='$ccdlflags'
14772 ccflags='$ccflags'
14773 ccsymbols='$ccsymbols'
14774 cf_by='$cf_by'
14775 cf_email='$cf_email'
14776 cf_time='$cf_time'
14777 charsize='$charsize'
14778 chgrp='$chgrp'
14779 chmod='$chmod'
14780 chown='$chown'
14781 clocktype='$clocktype'
14782 comm='$comm'
14783 compress='$compress'
14784 contains='$contains'
14785 cp='$cp'
14786 cpio='$cpio'
14787 cpp='$cpp'
14788 cpp_stuff='$cpp_stuff'
14789 cppccsymbols='$cppccsymbols'
14790 cppflags='$cppflags'
14791 cpplast='$cpplast'
14792 cppminus='$cppminus'
14793 cpprun='$cpprun'
14794 cppstdin='$cppstdin'
14795 cppsymbols='$cppsymbols'
14796 crosscompile='$crosscompile'
14797 cryptlib='$cryptlib'
14798 csh='$csh'
14799 d_Gconvert='$d_Gconvert'
14800 d_PRIEldbl='$d_PRIEldbl'
14801 d_PRIFldbl='$d_PRIFldbl'
14802 d_PRIGldbl='$d_PRIGldbl'
14803 d_PRIX64='$d_PRIX64'
14804 d_PRId64='$d_PRId64'
14805 d_PRIeldbl='$d_PRIeldbl'
14806 d_PRIfldbl='$d_PRIfldbl'
14807 d_PRIgldbl='$d_PRIgldbl'
14808 d_PRIi64='$d_PRIi64'
14809 d_PRIo64='$d_PRIo64'
14810 d_PRIu64='$d_PRIu64'
14811 d_PRIx64='$d_PRIx64'
14812 d_access='$d_access'
14813 d_accessx='$d_accessx'
14814 d_alarm='$d_alarm'
14815 d_archlib='$d_archlib'
14816 d_atolf='$d_atolf'
14817 d_atoll='$d_atoll'
14818 d_attribut='$d_attribut'
14819 d_bcmp='$d_bcmp'
14820 d_bcopy='$d_bcopy'
14821 d_bincompat5005='$d_bincompat5005'
14822 d_bsd='$d_bsd'
14823 d_bsdgetpgrp='$d_bsdgetpgrp'
14824 d_bsdsetpgrp='$d_bsdsetpgrp'
14825 d_bzero='$d_bzero'
14826 d_casti32='$d_casti32'
14827 d_castneg='$d_castneg'
14828 d_charvspr='$d_charvspr'
14829 d_chown='$d_chown'
14830 d_chroot='$d_chroot'
14831 d_chsize='$d_chsize'
14832 d_closedir='$d_closedir'
14833 d_const='$d_const'
14834 d_crypt='$d_crypt'
14835 d_csh='$d_csh'
14836 d_cuserid='$d_cuserid'
14837 d_dbl_dig='$d_dbl_dig'
14838 d_difftime='$d_difftime'
14839 d_dirnamlen='$d_dirnamlen'
14840 d_dlerror='$d_dlerror'
14841 d_dlopen='$d_dlopen'
14842 d_dlsymun='$d_dlsymun'
14843 d_dosuid='$d_dosuid'
14844 d_drand48proto='$d_drand48proto'
14845 d_dup2='$d_dup2'
14846 d_eaccess='$d_eaccess'
14847 d_endgrent='$d_endgrent'
14848 d_endhent='$d_endhent'
14849 d_endnent='$d_endnent'
14850 d_endpent='$d_endpent'
14851 d_endpwent='$d_endpwent'
14852 d_endsent='$d_endsent'
14853 d_endspent='$d_endspent'
14854 d_eofnblk='$d_eofnblk'
14855 d_eunice='$d_eunice'
14856 d_fchmod='$d_fchmod'
14857 d_fchown='$d_fchown'
14858 d_fcntl='$d_fcntl'
14859 d_fd_macros='$d_fd_macros'
14860 d_fd_set='$d_fd_set'
14861 d_fds_bits='$d_fds_bits'
14862 d_fgetpos='$d_fgetpos'
14863 d_flexfnam='$d_flexfnam'
14864 d_flock='$d_flock'
14865 d_fork='$d_fork'
14866 d_fpathconf='$d_fpathconf'
14867 d_fpos64_t='$d_fpos64_t'
14868 d_fs_data_s='$d_fs_data_s'
14869 d_fseeko='$d_fseeko'
14870 d_fsetpos='$d_fsetpos'
14871 d_fstatfs='$d_fstatfs'
14872 d_fstatvfs='$d_fstatvfs'
14873 d_ftello='$d_ftello'
14874 d_ftime='$d_ftime'
14875 d_getcwd='$d_getcwd'
14876 d_getfsstat='$d_getfsstat'
14877 d_getgrent='$d_getgrent'
14878 d_getgrps='$d_getgrps'
14879 d_gethbyaddr='$d_gethbyaddr'
14880 d_gethbyname='$d_gethbyname'
14881 d_gethent='$d_gethent'
14882 d_gethname='$d_gethname'
14883 d_gethostprotos='$d_gethostprotos'
14884 d_getlogin='$d_getlogin'
14885 d_getmnt='$d_getmnt'
14886 d_getmntent='$d_getmntent'
14887 d_getnbyaddr='$d_getnbyaddr'
14888 d_getnbyname='$d_getnbyname'
14889 d_getnent='$d_getnent'
14890 d_getnetprotos='$d_getnetprotos'
14891 d_getpbyname='$d_getpbyname'
14892 d_getpbynumber='$d_getpbynumber'
14893 d_getpent='$d_getpent'
14894 d_getpgid='$d_getpgid'
14895 d_getpgrp2='$d_getpgrp2'
14896 d_getpgrp='$d_getpgrp'
14897 d_getppid='$d_getppid'
14898 d_getprior='$d_getprior'
14899 d_getprotoprotos='$d_getprotoprotos'
14900 d_getpwent='$d_getpwent'
14901 d_getsbyname='$d_getsbyname'
14902 d_getsbyport='$d_getsbyport'
14903 d_getsent='$d_getsent'
14904 d_getservprotos='$d_getservprotos'
14905 d_getspent='$d_getspent'
14906 d_getspnam='$d_getspnam'
14907 d_gettimeod='$d_gettimeod'
14908 d_gnulibc='$d_gnulibc'
14909 d_grpasswd='$d_grpasswd'
14910 d_hasmntopt='$d_hasmntopt'
14911 d_htonl='$d_htonl'
14912 d_iconv='$d_iconv'
14913 d_index='$d_index'
14914 d_inetaton='$d_inetaton'
14915 d_int64_t='$d_int64_t'
14916 d_isascii='$d_isascii'
14917 d_killpg='$d_killpg'
14918 d_lchown='$d_lchown'
14919 d_ldbl_dig='$d_ldbl_dig'
14920 d_link='$d_link'
14921 d_locconv='$d_locconv'
14922 d_lockf='$d_lockf'
14923 d_longdbl='$d_longdbl'
14924 d_longlong='$d_longlong'
14925 d_lseekproto='$d_lseekproto'
14926 d_lstat='$d_lstat'
14927 d_mblen='$d_mblen'
14928 d_mbstowcs='$d_mbstowcs'
14929 d_mbtowc='$d_mbtowc'
14930 d_memchr='$d_memchr'
14931 d_memcmp='$d_memcmp'
14932 d_memcpy='$d_memcpy'
14933 d_memmove='$d_memmove'
14934 d_memset='$d_memset'
14935 d_mkdir='$d_mkdir'
14936 d_mkdtemp='$d_mkdtemp'
14937 d_mkfifo='$d_mkfifo'
14938 d_mkstemp='$d_mkstemp'
14939 d_mkstemps='$d_mkstemps'
14940 d_mktime='$d_mktime'
14941 d_mmap='$d_mmap'
14942 d_mprotect='$d_mprotect'
14943 d_msg='$d_msg'
14944 d_msg_ctrunc='$d_msg_ctrunc'
14945 d_msg_dontroute='$d_msg_dontroute'
14946 d_msg_oob='$d_msg_oob'
14947 d_msg_peek='$d_msg_peek'
14948 d_msg_proxy='$d_msg_proxy'
14949 d_msgctl='$d_msgctl'
14950 d_msgget='$d_msgget'
14951 d_msgrcv='$d_msgrcv'
14952 d_msgsnd='$d_msgsnd'
14953 d_msync='$d_msync'
14954 d_munmap='$d_munmap'
14955 d_mymalloc='$d_mymalloc'
14956 d_nice='$d_nice'
14957 d_nv_preserves_uv='$d_nv_preserves_uv'
14958 d_off64_t='$d_off64_t'
14959 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14960 d_oldpthreads='$d_oldpthreads'
14961 d_oldsock='$d_oldsock'
14962 d_open3='$d_open3'
14963 d_pathconf='$d_pathconf'
14964 d_pause='$d_pause'
14965 d_phostname='$d_phostname'
14966 d_pipe='$d_pipe'
14967 d_poll='$d_poll'
14968 d_portable='$d_portable'
14969 d_pthread_yield='$d_pthread_yield'
14970 d_pwage='$d_pwage'
14971 d_pwchange='$d_pwchange'
14972 d_pwclass='$d_pwclass'
14973 d_pwcomment='$d_pwcomment'
14974 d_pwexpire='$d_pwexpire'
14975 d_pwgecos='$d_pwgecos'
14976 d_pwpasswd='$d_pwpasswd'
14977 d_pwquota='$d_pwquota'
14978 d_quad='$d_quad'
14979 d_readdir='$d_readdir'
14980 d_readlink='$d_readlink'
14981 d_rename='$d_rename'
14982 d_rewinddir='$d_rewinddir'
14983 d_rmdir='$d_rmdir'
14984 d_safebcpy='$d_safebcpy'
14985 d_safemcpy='$d_safemcpy'
14986 d_sanemcmp='$d_sanemcmp'
14987 d_sched_yield='$d_sched_yield'
14988 d_scm_rights='$d_scm_rights'
14989 d_seekdir='$d_seekdir'
14990 d_select='$d_select'
14991 d_sem='$d_sem'
14992 d_semctl='$d_semctl'
14993 d_semctl_semid_ds='$d_semctl_semid_ds'
14994 d_semctl_semun='$d_semctl_semun'
14995 d_semget='$d_semget'
14996 d_semop='$d_semop'
14997 d_setegid='$d_setegid'
14998 d_seteuid='$d_seteuid'
14999 d_setgrent='$d_setgrent'
15000 d_setgrps='$d_setgrps'
15001 d_sethent='$d_sethent'
15002 d_setlinebuf='$d_setlinebuf'
15003 d_setlocale='$d_setlocale'
15004 d_setnent='$d_setnent'
15005 d_setpent='$d_setpent'
15006 d_setpgid='$d_setpgid'
15007 d_setpgrp2='$d_setpgrp2'
15008 d_setpgrp='$d_setpgrp'
15009 d_setprior='$d_setprior'
15010 d_setpwent='$d_setpwent'
15011 d_setregid='$d_setregid'
15012 d_setresgid='$d_setresgid'
15013 d_setresuid='$d_setresuid'
15014 d_setreuid='$d_setreuid'
15015 d_setrgid='$d_setrgid'
15016 d_setruid='$d_setruid'
15017 d_setsent='$d_setsent'
15018 d_setsid='$d_setsid'
15019 d_setspent='$d_setspent'
15020 d_setvbuf='$d_setvbuf'
15021 d_sfio='$d_sfio'
15022 d_shm='$d_shm'
15023 d_shmat='$d_shmat'
15024 d_shmatprototype='$d_shmatprototype'
15025 d_shmctl='$d_shmctl'
15026 d_shmdt='$d_shmdt'
15027 d_shmget='$d_shmget'
15028 d_sigaction='$d_sigaction'
15029 d_sigsetjmp='$d_sigsetjmp'
15030 d_socket='$d_socket'
15031 d_socklen_t='$d_socklen_t'
15032 d_sockpair='$d_sockpair'
15033 d_sqrtl='$d_sqrtl'
15034 d_statblks='$d_statblks'
15035 d_statfs_f_flags='$d_statfs_f_flags'
15036 d_statfs_s='$d_statfs_s'
15037 d_statvfs='$d_statvfs'
15038 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15039 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15040 d_stdio_stream_array='$d_stdio_stream_array'
15041 d_stdiobase='$d_stdiobase'
15042 d_stdstdio='$d_stdstdio'
15043 d_strchr='$d_strchr'
15044 d_strcoll='$d_strcoll'
15045 d_strctcpy='$d_strctcpy'
15046 d_strerrm='$d_strerrm'
15047 d_strerror='$d_strerror'
15048 d_strtod='$d_strtod'
15049 d_strtol='$d_strtol'
15050 d_strtold='$d_strtold'
15051 d_strtoll='$d_strtoll'
15052 d_strtoul='$d_strtoul'
15053 d_strtoull='$d_strtoull'
15054 d_strtouq='$d_strtouq'
15055 d_strxfrm='$d_strxfrm'
15056 d_suidsafe='$d_suidsafe'
15057 d_symlink='$d_symlink'
15058 d_syscall='$d_syscall'
15059 d_sysconf='$d_sysconf'
15060 d_sysernlst='$d_sysernlst'
15061 d_syserrlst='$d_syserrlst'
15062 d_system='$d_system'
15063 d_tcgetpgrp='$d_tcgetpgrp'
15064 d_tcsetpgrp='$d_tcsetpgrp'
15065 d_telldir='$d_telldir'
15066 d_telldirproto='$d_telldirproto'
15067 d_time='$d_time'
15068 d_times='$d_times'
15069 d_truncate='$d_truncate'
15070 d_tzname='$d_tzname'
15071 d_umask='$d_umask'
15072 d_uname='$d_uname'
15073 d_union_semun='$d_union_semun'
15074 d_ustat='$d_ustat'
15075 d_vendorbin='$d_vendorbin'
15076 d_vendorlib='$d_vendorlib'
15077 d_vfork='$d_vfork'
15078 d_void_closedir='$d_void_closedir'
15079 d_voidsig='$d_voidsig'
15080 d_voidtty='$d_voidtty'
15081 d_volatile='$d_volatile'
15082 d_vprintf='$d_vprintf'
15083 d_wait4='$d_wait4'
15084 d_waitpid='$d_waitpid'
15085 d_wcstombs='$d_wcstombs'
15086 d_wctomb='$d_wctomb'
15087 d_xenix='$d_xenix'
15088 date='$date'
15089 db_hashtype='$db_hashtype'
15090 db_prefixtype='$db_prefixtype'
15091 defvoidused='$defvoidused'
15092 direntrytype='$direntrytype'
15093 dlext='$dlext'
15094 dlsrc='$dlsrc'
15095 doublesize='$doublesize'
15096 drand01='$drand01'
15097 dynamic_ext='$dynamic_ext'
15098 eagain='$eagain'
15099 ebcdic='$ebcdic'
15100 echo='$echo'
15101 egrep='$egrep'
15102 emacs='$emacs'
15103 eunicefix='$eunicefix'
15104 exe_ext='$exe_ext'
15105 expr='$expr'
15106 extensions='$extensions'
15107 fflushNULL='$fflushNULL'
15108 fflushall='$fflushall'
15109 find='$find'
15110 firstmakefile='$firstmakefile'
15111 flex='$flex'
15112 fpossize='$fpossize'
15113 fpostype='$fpostype'
15114 freetype='$freetype'
15115 full_ar='$full_ar'
15116 full_csh='$full_csh'
15117 full_sed='$full_sed'
15118 gccversion='$gccversion'
15119 gidformat='$gidformat'
15120 gidsign='$gidsign'
15121 gidsize='$gidsize'
15122 gidtype='$gidtype'
15123 glibpth='$glibpth'
15124 grep='$grep'
15125 groupcat='$groupcat'
15126 groupstype='$groupstype'
15127 gzip='$gzip'
15128 h_fcntl='$h_fcntl'
15129 h_sysfile='$h_sysfile'
15130 hint='$hint'
15131 hostcat='$hostcat'
15132 huge='$huge'
15133 i16size='$i16size'
15134 i16type='$i16type'
15135 i32size='$i32size'
15136 i32type='$i32type'
15137 i64size='$i64size'
15138 i64type='$i64type'
15139 i8size='$i8size'
15140 i8type='$i8type'
15141 i_arpainet='$i_arpainet'
15142 i_bsdioctl='$i_bsdioctl'
15143 i_db='$i_db'
15144 i_dbm='$i_dbm'
15145 i_dirent='$i_dirent'
15146 i_dld='$i_dld'
15147 i_dlfcn='$i_dlfcn'
15148 i_fcntl='$i_fcntl'
15149 i_float='$i_float'
15150 i_gdbm='$i_gdbm'
15151 i_grp='$i_grp'
15152 i_iconv='$i_iconv'
15153 i_inttypes='$i_inttypes'
15154 i_limits='$i_limits'
15155 i_locale='$i_locale'
15156 i_machcthr='$i_machcthr'
15157 i_malloc='$i_malloc'
15158 i_math='$i_math'
15159 i_memory='$i_memory'
15160 i_mntent='$i_mntent'
15161 i_ndbm='$i_ndbm'
15162 i_netdb='$i_netdb'
15163 i_neterrno='$i_neterrno'
15164 i_netinettcp='$i_netinettcp'
15165 i_niin='$i_niin'
15166 i_poll='$i_poll'
15167 i_pthread='$i_pthread'
15168 i_pwd='$i_pwd'
15169 i_rpcsvcdbm='$i_rpcsvcdbm'
15170 i_sfio='$i_sfio'
15171 i_sgtty='$i_sgtty'
15172 i_shadow='$i_shadow'
15173 i_socks='$i_socks'
15174 i_stdarg='$i_stdarg'
15175 i_stddef='$i_stddef'
15176 i_stdlib='$i_stdlib'
15177 i_string='$i_string'
15178 i_sysaccess='$i_sysaccess'
15179 i_sysdir='$i_sysdir'
15180 i_sysfile='$i_sysfile'
15181 i_sysfilio='$i_sysfilio'
15182 i_sysin='$i_sysin'
15183 i_sysioctl='$i_sysioctl'
15184 i_syslog='$i_syslog'
15185 i_sysmman='$i_sysmman'
15186 i_sysmode='$i_sysmode'
15187 i_sysmount='$i_sysmount'
15188 i_sysndir='$i_sysndir'
15189 i_sysparam='$i_sysparam'
15190 i_sysresrc='$i_sysresrc'
15191 i_syssecrt='$i_syssecrt'
15192 i_sysselct='$i_sysselct'
15193 i_syssockio='$i_syssockio'
15194 i_sysstat='$i_sysstat'
15195 i_sysstatfs='$i_sysstatfs'
15196 i_sysstatvfs='$i_sysstatvfs'
15197 i_systime='$i_systime'
15198 i_systimek='$i_systimek'
15199 i_systimes='$i_systimes'
15200 i_systypes='$i_systypes'
15201 i_sysuio='$i_sysuio'
15202 i_sysun='$i_sysun'
15203 i_sysutsname='$i_sysutsname'
15204 i_sysvfs='$i_sysvfs'
15205 i_syswait='$i_syswait'
15206 i_termio='$i_termio'
15207 i_termios='$i_termios'
15208 i_time='$i_time'
15209 i_unistd='$i_unistd'
15210 i_ustat='$i_ustat'
15211 i_utime='$i_utime'
15212 i_values='$i_values'
15213 i_varargs='$i_varargs'
15214 i_varhdr='$i_varhdr'
15215 i_vfork='$i_vfork'
15216 ignore_versioned_solibs='$ignore_versioned_solibs'
15217 inc_version_list='$inc_version_list'
15218 inc_version_list_init='$inc_version_list_init'
15219 incpath='$incpath'
15220 inews='$inews'
15221 installarchlib='$installarchlib'
15222 installbin='$installbin'
15223 installman1dir='$installman1dir'
15224 installman3dir='$installman3dir'
15225 installprefix='$installprefix'
15226 installprefixexp='$installprefixexp'
15227 installprivlib='$installprivlib'
15228 installscript='$installscript'
15229 installsitearch='$installsitearch'
15230 installsitebin='$installsitebin'
15231 installsitelib='$installsitelib'
15232 installstyle='$installstyle'
15233 installusrbinperl='$installusrbinperl'
15234 installvendorbin='$installvendorbin'
15235 installvendorlib='$installvendorlib'
15236 intsize='$intsize'
15237 ivdformat='$ivdformat'
15238 ivsize='$ivsize'
15239 ivtype='$ivtype'
15240 known_extensions='$known_extensions'
15241 ksh='$ksh'
15242 large='$large'
15243 ld='$ld'
15244 lddlflags='$lddlflags'
15245 ldflags='$ldflags'
15246 ldlibpthname='$ldlibpthname'
15247 less='$less'
15248 lib_ext='$lib_ext'
15249 libc='$libc'
15250 libperl='$libperl'
15251 libpth='$libpth'
15252 libs='$libs'
15253 libsdirs='$libsdirs'
15254 libsfiles='$libsfiles'
15255 libsfound='$libsfound'
15256 libspath='$libspath'
15257 libswanted='$libswanted'
15258 line='$line'
15259 lint='$lint'
15260 lkflags='$lkflags'
15261 ln='$ln'
15262 lns='$lns'
15263 locincpth='$locincpth'
15264 loclibpth='$loclibpth'
15265 longdblsize='$longdblsize'
15266 longlongsize='$longlongsize'
15267 longsize='$longsize'
15268 lp='$lp'
15269 lpr='$lpr'
15270 ls='$ls'
15271 lseeksize='$lseeksize'
15272 lseektype='$lseektype'
15273 mail='$mail'
15274 mailx='$mailx'
15275 make='$make'
15276 make_set_make='$make_set_make'
15277 mallocobj='$mallocobj'
15278 mallocsrc='$mallocsrc'
15279 malloctype='$malloctype'
15280 man1dir='$man1dir'
15281 man1direxp='$man1direxp'
15282 man1ext='$man1ext'
15283 man3dir='$man3dir'
15284 man3direxp='$man3direxp'
15285 man3ext='$man3ext'
15286 medium='$medium'
15287 mips_type='$mips_type'
15288 mkdir='$mkdir'
15289 mmaptype='$mmaptype'
15290 models='$models'
15291 modetype='$modetype'
15292 more='$more'
15293 multiarch='$multiarch'
15294 mv='$mv'
15295 myarchname='$myarchname'
15296 mydomain='$mydomain'
15297 myhostname='$myhostname'
15298 myuname='$myuname'
15299 n='$n'
15300 netdb_hlen_type='$netdb_hlen_type'
15301 netdb_host_type='$netdb_host_type'
15302 netdb_name_type='$netdb_name_type'
15303 netdb_net_type='$netdb_net_type'
15304 nm='$nm'
15305 nm_opt='$nm_opt'
15306 nm_so_opt='$nm_so_opt'
15307 nonxs_ext='$nonxs_ext'
15308 nroff='$nroff'
15309 nvsize='$nvsize'
15310 nvtype='$nvtype'
15311 o_nonblock='$o_nonblock'
15312 obj_ext='$obj_ext'
15313 old_pthread_create_joinable='$old_pthread_create_joinable'
15314 optimize='$optimize'
15315 orderlib='$orderlib'
15316 osname='$osname'
15317 osvers='$osvers'
15318 package='$package'
15319 pager='$pager'
15320 passcat='$passcat'
15321 patchlevel='$patchlevel'
15322 path_sep='$path_sep'
15323 perl5='$perl5'
15324 perl='$perl'
15325 perladmin='$perladmin'
15326 perlpath='$perlpath'
15327 pg='$pg'
15328 phostname='$phostname'
15329 pidtype='$pidtype'
15330 plibpth='$plibpth'
15331 pm_apiversion='$pm_apiversion'
15332 pmake='$pmake'
15333 pr='$pr'
15334 prefix='$prefix'
15335 prefixexp='$prefixexp'
15336 privlib='$privlib'
15337 privlibexp='$privlibexp'
15338 prototype='$prototype'
15339 ptrsize='$ptrsize'
15340 quadkind='$quadkind'
15341 quadtype='$quadtype'
15342 randbits='$randbits'
15343 randfunc='$randfunc'
15344 randseedtype='$randseedtype'
15345 ranlib='$ranlib'
15346 rd_nodata='$rd_nodata'
15347 revision='$revision'
15348 rm='$rm'
15349 rmail='$rmail'
15350 runnm='$runnm'
15351 sPRIEldbl='$sPRIEldbl'
15352 sPRIFldbl='$sPRIFldbl'
15353 sPRIGldbl='$sPRIGldbl'
15354 sPRIX64='$sPRIX64'
15355 sPRId64='$sPRId64'
15356 sPRIeldbl='$sPRIeldbl'
15357 sPRIfldbl='$sPRIfldbl'
15358 sPRIgldbl='$sPRIgldbl'
15359 sPRIi64='$sPRIi64'
15360 sPRIo64='$sPRIo64'
15361 sPRIu64='$sPRIu64'
15362 sPRIx64='$sPRIx64'
15363 sched_yield='$sched_yield'
15364 scriptdir='$scriptdir'
15365 scriptdirexp='$scriptdirexp'
15366 sed='$sed'
15367 seedfunc='$seedfunc'
15368 selectminbits='$selectminbits'
15369 selecttype='$selecttype'
15370 sendmail='$sendmail'
15371 sh='$sh'
15372 shar='$shar'
15373 sharpbang='$sharpbang'
15374 shmattype='$shmattype'
15375 shortsize='$shortsize'
15376 shrpenv='$shrpenv'
15377 shsharp='$shsharp'
15378 sig_count='$sig_count'
15379 sig_name='$sig_name'
15380 sig_name_init='$sig_name_init'
15381 sig_num='$sig_num'
15382 sig_num_init='$sig_num_init'
15383 signal_t='$signal_t'
15384 sitearch='$sitearch'
15385 sitearchexp='$sitearchexp'
15386 sitebin='$sitebin'
15387 sitebinexp='$sitebinexp'
15388 sitelib='$sitelib'
15389 sitelibexp='$sitelibexp'
15390 siteprefix='$siteprefix'
15391 siteprefixexp='$siteprefixexp'
15392 sizetype='$sizetype'
15393 sleep='$sleep'
15394 smail='$smail'
15395 small='$small'
15396 so='$so'
15397 sockethdr='$sockethdr'
15398 socketlib='$socketlib'
15399 socksizetype='$socksizetype'
15400 sort='$sort'
15401 spackage='$spackage'
15402 spitshell='$spitshell'
15403 split='$split'
15404 src='$src'
15405 ssizetype='$ssizetype'
15406 startperl='$startperl'
15407 startsh='$startsh'
15408 static_ext='$static_ext'
15409 stdchar='$stdchar'
15410 stdio_base='$stdio_base'
15411 stdio_bufsiz='$stdio_bufsiz'
15412 stdio_cnt='$stdio_cnt'
15413 stdio_filbuf='$stdio_filbuf'
15414 stdio_ptr='$stdio_ptr'
15415 stdio_stream_array='$stdio_stream_array'
15416 strings='$strings'
15417 submit='$submit'
15418 subversion='$subversion'
15419 sysman='$sysman'
15420 tail='$tail'
15421 tar='$tar'
15422 tbl='$tbl'
15423 tee='$tee'
15424 test='$test'
15425 timeincl='$timeincl'
15426 timetype='$timetype'
15427 touch='$touch'
15428 tr='$tr'
15429 trnl='$trnl'
15430 troff='$troff'
15431 u16size='$u16size'
15432 u16type='$u16type'
15433 u32size='$u32size'
15434 u32type='$u32type'
15435 u64size='$u64size'
15436 u64type='$u64type'
15437 u8size='$u8size'
15438 u8type='$u8type'
15439 uidformat='$uidformat'
15440 uidsign='$uidsign'
15441 uidsize='$uidsize'
15442 uidtype='$uidtype'
15443 uname='$uname'
15444 uniq='$uniq'
15445 uquadtype='$uquadtype'
15446 use5005threads='$use5005threads'
15447 use64bitall='$use64bitall'
15448 use64bitint='$use64bitint'
15449 usedl='$usedl'
15450 useithreads='$useithreads'
15451 uselargefiles='$uselargefiles'
15452 uselongdouble='$uselongdouble'
15453 usemorebits='$usemorebits'
15454 usemultiplicity='$usemultiplicity'
15455 usemymalloc='$usemymalloc'
15456 usenm='$usenm'
15457 useopcode='$useopcode'
15458 useperlio='$useperlio'
15459 useposix='$useposix'
15460 usesfio='$usesfio'
15461 useshrplib='$useshrplib'
15462 usesocks='$usesocks'
15463 usethreads='$usethreads'
15464 usevendorprefix='$usevendorprefix'
15465 usevfork='$usevfork'
15466 usrinc='$usrinc'
15467 uuname='$uuname'
15468 uvoformat='$uvoformat'
15469 uvsize='$uvsize'
15470 uvtype='$uvtype'
15471 uvuformat='$uvuformat'
15472 uvxformat='$uvxformat'
15473 vendorbin='$vendorbin'
15474 vendorbinexp='$vendorbinexp'
15475 vendorlib='$vendorlib'
15476 vendorlibexp='$vendorlibexp'
15477 vendorprefix='$vendorprefix'
15478 vendorprefixexp='$vendorprefixexp'
15479 version='$version'
15480 vi='$vi'
15481 voidflags='$voidflags'
15482 xlibpth='$xlibpth'
15483 xs_apiversion='$xs_apiversion'
15484 zcat='$zcat'
15485 zip='$zip'
15486 EOT
15487
15488 : Add in command line options if available
15489 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15490
15491 : add special variables
15492 $test -f $src/patchlevel.h && \
15493 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15494 echo "CONFIGDOTSH=true" >>config.sh
15495
15496 : propagate old symbols
15497 if $test -f UU/config.sh; then
15498         <UU/config.sh sort | uniq >UU/oldconfig.sh
15499         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15500         sort | uniq -u >UU/oldsyms
15501         set X `cat UU/oldsyms`
15502         shift
15503         case $# in
15504         0) ;;
15505         *)
15506                 cat <<EOM
15507 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15508 EOM
15509                 echo "# Variables propagated from previous config.sh file." >>config.sh
15510                 for sym in `cat UU/oldsyms`; do
15511                         echo "    Propagating $hint variable "'$'"$sym..."
15512                         eval 'tmp="$'"${sym}"'"'
15513                         echo "$tmp" | \
15514                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15515                 done
15516                 ;;
15517         esac
15518 fi
15519
15520 : Finish up by extracting the .SH files
15521 case "$alldone" in
15522 exit)
15523         $rm -rf UU
15524         echo "Done."
15525         exit 0
15526         ;;
15527 cont)
15528         ;;
15529 '')
15530         dflt=''
15531         nostick=true
15532         $cat <<EOM
15533
15534 If you'd like to make any changes to the config.sh file before I begin
15535 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15536
15537 EOM
15538         rp="Press return or use a shell escape to edit config.sh:"
15539         . UU/myread
15540         nostick=''
15541         case "$ans" in
15542         '') ;;
15543         *) : in case they cannot read
15544                 sh 1>&4 -c "$ans";;
15545         esac
15546         ;;
15547 esac
15548
15549 : if this fails, just run all the .SH files by hand
15550 . ./config.sh
15551
15552 echo " "
15553 exec 1>&4
15554 . ./UU/extract
15555
15556 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15557         dflt=y
15558         case "$silent" in
15559         true) ;;
15560         *)
15561                 $cat <<EOM
15562
15563 Now you need to generate make dependencies by running "$make depend".
15564 You might prefer to run it in background: "$make depend > makedepend.out &"
15565 It can take a while, so you might not want to run it right now.
15566
15567 EOM
15568                 ;;
15569         esac
15570         rp="Run $make depend now?"
15571         . UU/myread
15572         case "$ans" in
15573         y*)
15574                 $make depend && echo "Now you must run a $make."
15575                 ;;
15576         *)
15577                 echo "You must run '$make depend' then '$make'."
15578                 ;;
15579         esac
15580 elif test -f [Mm]akefile; then
15581         echo " "
15582         echo "Now you must run a $make."
15583 else
15584         echo "Done."
15585 fi
15586
15587 if $test -f Policy.sh; then
15588     $cat <<EOM
15589
15590 If you compile $package on a different machine or from a different object
15591 directory, copy the Policy.sh file from this object directory to the
15592 new one before you run Configure -- this will help you with most of
15593 the policy defaults.
15594
15595 EOM
15596 fi
15597 if $test -f config.msg; then
15598     echo "Hmm.  I also noted the following information while running:"
15599     echo " "
15600     $cat config.msg >&4
15601     $rm -f config.msg
15602 fi
15603 $rm -f kit*isdone ark*isdone
15604 $rm -rf UU
15605
15606 : End of Configure
15607