avoid mentioning Perl version in Configure question
[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 Thu Mar 16 03:04:33 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getpwent=''
396 d_getsent=''
397 d_getservprotos=''
398 d_getspent=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_killpg=''
410 d_lchown=''
411 d_ldbl_dig=''
412 d_link=''
413 d_locconv=''
414 d_lockf=''
415 d_longdbl=''
416 longdblsize=''
417 d_longlong=''
418 longlongsize=''
419 d_lseekproto=''
420 d_lstat=''
421 d_madvise=''
422 d_mblen=''
423 d_mbstowcs=''
424 d_mbtowc=''
425 d_memchr=''
426 d_memcmp=''
427 d_memcpy=''
428 d_memmove=''
429 d_memset=''
430 d_mkdir=''
431 d_mkdtemp=''
432 d_mkfifo=''
433 d_mkstemp=''
434 d_mkstemps=''
435 d_mktime=''
436 d_mmap=''
437 mmaptype=''
438 d_mprotect=''
439 d_msg=''
440 d_msgctl=''
441 d_msgget=''
442 d_msgrcv=''
443 d_msgsnd=''
444 d_msync=''
445 d_munmap=''
446 d_nice=''
447 d_off64_t=''
448 d_open3=''
449 d_fpathconf=''
450 d_pathconf=''
451 d_pause=''
452 d_pipe=''
453 d_poll=''
454 d_portable=''
455 d_old_pthread_create_joinable=''
456 old_pthread_create_joinable=''
457 d_pthread_yield=''
458 d_sched_yield=''
459 sched_yield=''
460 d_qgcvt=''
461 d_readdir=''
462 d_rewinddir=''
463 d_seekdir=''
464 d_telldir=''
465 d_readlink=''
466 d_rename=''
467 d_rmdir=''
468 d_safebcpy=''
469 d_safemcpy=''
470 d_sanemcmp=''
471 d_select=''
472 d_sem=''
473 d_semctl=''
474 d_semget=''
475 d_semop=''
476 d_setegid=''
477 d_seteuid=''
478 d_setgrent=''
479 d_setgrps=''
480 d_sethent=''
481 d_setlinebuf=''
482 d_setlocale=''
483 d_setnent=''
484 d_setpent=''
485 d_setpgid=''
486 d_setpgrp2=''
487 d_bsdsetpgrp=''
488 d_setpgrp=''
489 d_setprior=''
490 d_setpwent=''
491 d_setregid=''
492 d_setresgid=''
493 d_setresuid=''
494 d_setreuid=''
495 d_setrgid=''
496 d_setruid=''
497 d_setsent=''
498 d_setsid=''
499 d_setspent=''
500 d_setvbuf=''
501 d_sfio=''
502 usesfio=''
503 d_shm=''
504 d_shmat=''
505 d_shmatprototype=''
506 shmattype=''
507 d_shmctl=''
508 d_shmdt=''
509 d_shmget=''
510 d_sigaction=''
511 d_sigsetjmp=''
512 d_msg_ctrunc=''
513 d_msg_dontroute=''
514 d_msg_oob=''
515 d_msg_peek=''
516 d_msg_proxy=''
517 d_oldsock=''
518 d_scm_rights=''
519 d_socket=''
520 d_sockpair=''
521 sockethdr=''
522 socketlib=''
523 d_socklen_t=''
524 d_sqrtl=''
525 d_statblks=''
526 d_statfs_f_flags=''
527 d_statfs_s=''
528 d_fstatvfs=''
529 d_statvfs=''
530 d_stdio_cnt_lval=''
531 d_stdio_ptr_lval=''
532 d_stdiobase=''
533 d_stdstdio=''
534 stdio_base=''
535 stdio_bufsiz=''
536 stdio_cnt=''
537 stdio_filbuf=''
538 stdio_ptr=''
539 d_index=''
540 d_strchr=''
541 d_strcoll=''
542 d_strctcpy=''
543 d_strerrm=''
544 d_strerror=''
545 d_sysernlst=''
546 d_syserrlst=''
547 d_strtod=''
548 d_strtol=''
549 d_strtold=''
550 d_strtoll=''
551 d_strtoul=''
552 d_strtoull=''
553 d_strtouq=''
554 d_strxfrm=''
555 d_symlink=''
556 d_syscall=''
557 d_sysconf=''
558 d_system=''
559 d_tcgetpgrp=''
560 d_tcsetpgrp=''
561 d_telldirproto=''
562 d_time=''
563 timetype=''
564 clocktype=''
565 d_times=''
566 d_truncate=''
567 d_tzname=''
568 d_umask=''
569 d_semctl_semid_ds=''
570 d_semctl_semun=''
571 d_union_semun=''
572 d_ustat=''
573 d_vfork=''
574 usevfork=''
575 d_voidsig=''
576 signal_t=''
577 d_volatile=''
578 d_charvspr=''
579 d_vprintf=''
580 d_wait4=''
581 d_waitpid=''
582 d_wcstombs=''
583 d_wctomb=''
584 dlext=''
585 cccdlflags=''
586 ccdlflags=''
587 dlsrc=''
588 ld=''
589 lddlflags=''
590 usedl=''
591 doublesize=''
592 ebcdic=''
593 fflushNULL=''
594 fflushall=''
595 fpossize=''
596 fpostype=''
597 gidformat=''
598 gidsign=''
599 gidsize=''
600 gidtype=''
601 groupstype=''
602 h_fcntl=''
603 h_sysfile=''
604 i_arpainet=''
605 db_hashtype=''
606 db_prefixtype=''
607 i_db=''
608 i_dbm=''
609 i_rpcsvcdbm=''
610 d_dirnamlen=''
611 direntrytype=''
612 i_dirent=''
613 i_dld=''
614 i_dlfcn=''
615 i_fcntl=''
616 i_float=''
617 i_gdbm=''
618 d_grpasswd=''
619 i_grp=''
620 i_iconv=''
621 i_ieeefp=''
622 i_inttypes=''
623 i_limits=''
624 i_locale=''
625 i_machcthr=''
626 i_malloc=''
627 i_math=''
628 i_memory=''
629 i_mntent=''
630 i_ndbm=''
631 i_netdb=''
632 i_neterrno=''
633 i_netinettcp=''
634 i_niin=''
635 i_sysin=''
636 i_poll=''
637 i_pthread=''
638 d_pwage=''
639 d_pwchange=''
640 d_pwclass=''
641 d_pwcomment=''
642 d_pwexpire=''
643 d_pwgecos=''
644 d_pwpasswd=''
645 d_pwquota=''
646 i_pwd=''
647 i_sfio=''
648 i_shadow=''
649 i_socks=''
650 i_stddef=''
651 i_stdlib=''
652 i_string=''
653 strings=''
654 i_sunmath=''
655 i_sysaccess=''
656 i_sysdir=''
657 i_sysfile=''
658 d_voidtty=''
659 i_bsdioctl=''
660 i_sysfilio=''
661 i_sysioctl=''
662 i_syssockio=''
663 i_syslog=''
664 i_sysmman=''
665 i_sysmode=''
666 i_sysmount=''
667 i_sysndir=''
668 i_sysparam=''
669 i_sysresrc=''
670 i_syssecrt=''
671 i_sysselct=''
672 i_sysstat=''
673 i_sysstatfs=''
674 i_sysstatvfs=''
675 i_systimes=''
676 i_systypes=''
677 i_sysuio=''
678 i_sysun=''
679 i_sysutsname=''
680 i_sysvfs=''
681 i_syswait=''
682 i_sgtty=''
683 i_termio=''
684 i_termios=''
685 i_systime=''
686 i_systimek=''
687 i_time=''
688 timeincl=''
689 i_unistd=''
690 i_ustat=''
691 i_utime=''
692 i_values=''
693 i_stdarg=''
694 i_varargs=''
695 i_varhdr=''
696 i_vfork=''
697 inc_version_list=''
698 inc_version_list_init=''
699 installprefix=''
700 installprefixexp=''
701 installstyle=''
702 installusrbinperl=''
703 intsize=''
704 longsize=''
705 shortsize=''
706 libc=''
707 ldlibpthname=''
708 libperl=''
709 shrpenv=''
710 useshrplib=''
711 glibpth=''
712 libpth=''
713 loclibpth=''
714 plibpth=''
715 xlibpth=''
716 ignore_versioned_solibs=''
717 libs=''
718 libsdirs=''
719 libsfiles=''
720 libsfound=''
721 libspath=''
722 lns=''
723 d_PRIEldbl=''
724 d_PRIFldbl=''
725 d_PRIGldbl=''
726 d_PRIeldbl=''
727 d_PRIfldbl=''
728 d_PRIgldbl=''
729 sPRIEldbl=''
730 sPRIFldbl=''
731 sPRIGldbl=''
732 sPRIeldbl=''
733 sPRIfldbl=''
734 sPRIgldbl=''
735 lseeksize=''
736 lseektype=''
737 make_set_make=''
738 d_mymalloc=''
739 freetype=''
740 mallocobj=''
741 mallocsrc=''
742 malloctype=''
743 usemymalloc=''
744 installman1dir=''
745 man1dir=''
746 man1direxp=''
747 man1ext=''
748 installman3dir=''
749 man3dir=''
750 man3direxp=''
751 man3ext=''
752 huge=''
753 large=''
754 medium=''
755 models=''
756 small=''
757 split=''
758 modetype=''
759 multiarch=''
760 mydomain=''
761 myhostname=''
762 phostname=''
763 c=''
764 n=''
765 d_eofnblk=''
766 eagain=''
767 o_nonblock=''
768 rd_nodata=''
769 netdb_hlen_type=''
770 netdb_host_type=''
771 netdb_name_type=''
772 netdb_net_type=''
773 groupcat=''
774 hostcat=''
775 passcat=''
776 orderlib=''
777 ranlib=''
778 package=''
779 spackage=''
780 pager=''
781 api_revision=''
782 api_subversion=''
783 api_version=''
784 api_versionstring=''
785 patchlevel=''
786 revision=''
787 subversion=''
788 version=''
789 perl5=''
790 perladmin=''
791 perlpath=''
792 d_nv_preserves_uv=''
793 i16size=''
794 i16type=''
795 i32size=''
796 i32type=''
797 i64size=''
798 i64type=''
799 i8size=''
800 i8type=''
801 ivsize=''
802 ivtype=''
803 nvsize=''
804 nvtype=''
805 u16size=''
806 u16type=''
807 u32size=''
808 u32type=''
809 u64size=''
810 u64type=''
811 u8size=''
812 u8type=''
813 uvsize=''
814 uvtype=''
815 ivdformat=''
816 uvoformat=''
817 uvuformat=''
818 uvxformat=''
819 pidtype=''
820 prefix=''
821 prefixexp=''
822 installprivlib=''
823 privlib=''
824 privlibexp=''
825 prototype=''
826 ptrsize=''
827 d_PRIX64=''
828 d_PRId64=''
829 d_PRIi64=''
830 d_PRIo64=''
831 d_PRIu64=''
832 d_PRIx64=''
833 sPRIX64=''
834 sPRId64=''
835 sPRIi64=''
836 sPRIo64=''
837 sPRIu64=''
838 sPRIx64=''
839 d_quad=''
840 quadkind=''
841 quadtype=''
842 uquadtype=''
843 drand01=''
844 randbits=''
845 randfunc=''
846 randseedtype=''
847 seedfunc=''
848 installscript=''
849 scriptdir=''
850 scriptdirexp=''
851 selectminbits=''
852 selecttype=''
853 sh=''
854 sig_count=''
855 sig_name=''
856 sig_name_init=''
857 sig_num=''
858 sig_num_init=''
859 installsitearch=''
860 sitearch=''
861 sitearchexp=''
862 installsitebin=''
863 sitebin=''
864 sitebinexp=''
865 installsitelib=''
866 sitelib=''
867 sitelib_stem=''
868 sitelibexp=''
869 siteprefix=''
870 siteprefixexp=''
871 sizesize=''
872 sizetype=''
873 so=''
874 socksizetype=''
875 sharpbang=''
876 shsharp=''
877 spitshell=''
878 src=''
879 ssizetype=''
880 startperl=''
881 startsh=''
882 stdchar=''
883 d_stdio_stream_array=''
884 stdio_stream_array=''
885 sysman=''
886 trnl=''
887 uidformat=''
888 uidsign=''
889 uidsize=''
890 uidtype=''
891 archname64=''
892 use64bitall=''
893 use64bitint=''
894 uselargefiles=''
895 uselongdouble=''
896 usemorebits=''
897 usemultiplicity=''
898 nm_opt=''
899 nm_so_opt=''
900 runnm=''
901 usenm=''
902 useperlio=''
903 usesocks=''
904 d_oldpthreads=''
905 use5005threads=''
906 useithreads=''
907 usethreads=''
908 incpath=''
909 mips_type=''
910 usrinc=''
911 d_vendorarch=''
912 installvendorarch=''
913 vendorarch=''
914 vendorarchexp=''
915 d_vendorbin=''
916 installvendorbin=''
917 vendorbin=''
918 vendorbinexp=''
919 d_vendorlib=''
920 installvendorlib=''
921 vendorlib=''
922 vendorlib_stem=''
923 vendorlibexp=''
924 usevendorprefix=''
925 vendorprefix=''
926 vendorprefixexp=''
927 defvoidused=''
928 voidflags=''
929 pm_apiversion=''
930 xs_apiversion=''
931 CONFIG=''
932
933 define='define'
934 undef='undef'
935 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
936 rmlist=''
937
938 : We must find out about Eunice early
939 eunicefix=':'
940 if test -f /etc/unixtovms; then
941         eunicefix=/etc/unixtovms
942 fi
943 if test -f /etc/unixtovms.exe; then
944         eunicefix=/etc/unixtovms.exe
945 fi
946
947 i_whoami=''
948 : set useposix=false in your hint file to disable the POSIX extension.
949 useposix=true
950 : set useopcode=false in your hint file to disable the Opcode extension.
951 useopcode=true
952 : Trailing extension.  Override this in a hint file, if needed.
953 _exe=''
954 : Extra object files, if any, needed on this platform.
955 archobjs=''
956 : Possible local include directories to search.
957 : Set locincpth to "" in a hint file to defeat local include searches.
958 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
959 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
960 :
961 : no include file wanted by default
962 inclwanted=''
963
964 groupstype=''
965 : change the next line if compiling for Xenix/286 on Xenix/386
966 xlibpth='/usr/lib/386 /lib/386'
967 : Possible local library directories to search.
968 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
969 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
970
971 : general looking path for locating libraries
972 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
973 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
974 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
975 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
976 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
977
978 : Private path used by Configure to find libraries.  Its value
979 : is prepended to libpth. This variable takes care of special
980 : machines, like the mips.  Usually, it should be empty.
981 plibpth=''
982
983 : default library list
984 libswanted=''
985 : some systems want to use only the non-versioned libso:s
986 ignore_versioned_solibs=''
987 : set usemultiplicity on the Configure command line to enable multiplicity.
988 : set usesocks on the Configure command line to enable socks.
989 : set usethreads on the Configure command line to enable threads.
990 : full support for void wanted by default
991 defvoidused=15
992
993 : List of libraries we want.
994 : If anyone needs -lnet, put it in a hint file.
995 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
996 libswanted="$libswanted dld ld sun m c cposix posix"
997 libswanted="$libswanted ndir dir crypt sec"
998 libswanted="$libswanted ucb bsd BSD PW x iconv"
999 : We probably want to search /usr/shlib before most other libraries.
1000 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1001 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1002 glibpth="/usr/shlib $glibpth"
1003 : Do not use vfork unless overridden by a hint file.
1004 usevfork=false
1005
1006 : Find the basic shell for Bourne shell scripts
1007 case "$sh" in
1008 '')
1009         case "$SYSTYPE" in
1010         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1011         *) xxx='/bin/sh';;
1012         esac
1013         if test -f "$xxx"; then
1014                 sh="$xxx"
1015         else
1016                 : Build up a list and do a single loop so we can 'break' out.
1017                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1018                 for xxx in sh bash ksh pdksh ash; do
1019                         for p in $pth; do
1020                                 try="$try ${p}/${xxx}"
1021                         done
1022                 done
1023                 for xxx in $try; do
1024                         if test -f "$xxx"; then
1025                                 sh="$xxx";
1026                                 break
1027                         elif test -f "$xxx.exe"; then
1028                                 sh="$xxx";
1029                                 break
1030                         fi
1031                 done
1032         fi
1033         ;;
1034 esac
1035
1036 case "$sh" in
1037 '')     cat <<EOM >&2
1038 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1039
1040 Usually it's in /bin/sh.  How did you even get this far?
1041 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1042 we'll try to straighten this all out.
1043 EOM
1044         exit 1
1045         ;;
1046 esac
1047
1048 : see if sh knows # comments
1049 if `$sh -c '#' >/dev/null 2>&1`; then
1050         shsharp=true
1051         spitshell=cat
1052         xcat=/bin/cat
1053         test -f $xcat || xcat=/usr/bin/cat
1054         echo "#!$xcat" >try
1055         $eunicefix try
1056         chmod +x try
1057         ./try > today
1058         if test -s today; then
1059                 sharpbang='#!'
1060         else
1061                 echo "#! $xcat" > try
1062                 $eunicefix try
1063                 chmod +x try
1064                 ./try > today
1065                 if test -s today; then
1066                         sharpbang='#! '
1067                 else
1068                         sharpbang=': use '
1069                 fi
1070         fi
1071 else
1072         echo " "
1073         echo "Your $sh doesn't grok # comments--I will strip them later on."
1074         shsharp=false
1075         cd ..
1076         echo "exec grep -v '^[  ]*#'" >spitshell
1077         chmod +x spitshell
1078         $eunicefix spitshell
1079         spitshell=`pwd`/spitshell
1080         cd UU
1081         echo "I presume that if # doesn't work, #! won't work either!"
1082         sharpbang=': use '
1083 fi
1084 rm -f try today
1085
1086 : figure out how to guarantee sh startup
1087 case "$startsh" in
1088 '') startsh=${sharpbang}${sh} ;;
1089 *)
1090 esac
1091 cat >try <<EOSS
1092 $startsh
1093 set abc
1094 test "$?abc" != 1
1095 EOSS
1096
1097 chmod +x try
1098 $eunicefix try
1099 if ./try; then
1100         : echo "Yup, it does."
1101 else
1102         echo "Hmm... '$startsh' does not guarantee sh startup..."
1103         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1104 fi
1105 rm -f try
1106
1107
1108 : Save command line options in file UU/cmdline.opt for later use in
1109 : generating config.sh.
1110 cat > cmdline.opt <<EOSH
1111 # Configure command line arguments.
1112 config_arg0='$0'
1113 config_args='$*'
1114 config_argc=$#
1115 EOSH
1116 argn=1
1117 for arg in "$@"; do
1118         cat >>cmdline.opt <<EOSH
1119 config_arg$argn='$arg'
1120 EOSH
1121         argn=`expr $argn + 1`
1122 done
1123
1124 : produce awk script to parse command line options
1125 cat >options.awk <<'EOF'
1126 BEGIN {
1127         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1128
1129         len = length(optstr);
1130         for (i = 1; i <= len; i++) {
1131                 c = substr(optstr, i, 1);
1132                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1133                 if (a == ":") {
1134                         arg[c] = 1;
1135                         i++;
1136                 }
1137                 opt[c] = 1;
1138         }
1139 }
1140 {
1141         expect = 0;
1142         str = $0;
1143         if (substr(str, 1, 1) != "-") {
1144                 printf("'%s'\n", str);
1145                 next;
1146         }
1147         len = length($0);
1148         for (i = 2; i <= len; i++) {
1149                 c = substr(str, i, 1);
1150                 if (!opt[c]) {
1151                         printf("-%s\n", substr(str, i));
1152                         next;
1153                 }
1154                 printf("-%s\n", c);
1155                 if (arg[c]) {
1156                         if (i < len)
1157                                 printf("'%s'\n", substr(str, i + 1));
1158                         else
1159                                 expect = 1;
1160                         next;
1161                 }
1162         }
1163 }
1164 END {
1165         if (expect)
1166                 print "?";
1167 }
1168 EOF
1169
1170 : process the command line options
1171 set X `for arg in "$@"; do echo "X$arg"; done |
1172         sed -e s/X// | awk -f options.awk`
1173 eval "set $*"
1174 shift
1175 rm -f options.awk
1176
1177 : set up default values
1178 fastread=''
1179 reuseval=false
1180 config_sh=''
1181 alldone=''
1182 error=''
1183 silent=''
1184 extractsh=''
1185 override=''
1186 knowitall=''
1187 rm -f optdef.sh posthint.sh
1188 cat >optdef.sh <<EOS
1189 $startsh
1190 EOS
1191
1192
1193 : option parsing
1194 while test $# -gt 0; do
1195         case "$1" in
1196         -d) shift; fastread=yes;;
1197         -e) shift; alldone=cont;;
1198         -f)
1199                 shift
1200                 cd ..
1201                 if test -r "$1"; then
1202                         config_sh="$1"
1203                 else
1204                         echo "$me: cannot read config file $1." >&2
1205                         error=true
1206                 fi
1207                 cd UU
1208                 shift;;
1209         -h) shift; error=true;;
1210         -r) shift; reuseval=true;;
1211         -s) shift; silent=true; realsilent=true;;
1212         -E) shift; alldone=exit;;
1213         -K) shift; knowitall=true;;
1214         -O) shift; override=true;;
1215         -S) shift; silent=true; extractsh=true;;
1216         -D)
1217                 shift
1218                 case "$1" in
1219                 *=)
1220                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1221                         echo "$me: ignoring -D $1" >&2
1222                         ;;
1223                 *=*) echo "$1" | \
1224                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1225                 *) echo "$1='define'" >> optdef.sh;;
1226                 esac
1227                 shift
1228                 ;;
1229         -U)
1230                 shift
1231                 case "$1" in
1232                 *=) echo "$1" >> optdef.sh;;
1233                 *=*)
1234                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1235                         echo "$me: ignoring -U $1" >&2
1236                         ;;
1237                 *) echo "$1='undef'" >> optdef.sh;;
1238                 esac
1239                 shift
1240                 ;;
1241         -A)
1242             shift
1243             xxx=''
1244             yyy="$1"
1245             zzz=''
1246             uuu=undef
1247             case "$yyy" in
1248             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1249                  case "$zzz" in
1250                  *:*) zzz='' ;;
1251                  *)   xxx=append
1252                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1253                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1254                  esac
1255                  ;;
1256             esac
1257             case "$xxx" in
1258             '')  case "$yyy" in
1259                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1260                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1261                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1262                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1263                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1264                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1265                  esac
1266                  ;;       
1267             esac
1268             case "$xxx" in
1269             append)
1270                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1271             clear)
1272                 echo "$yyy=''"                  >> posthint.sh ;;
1273             define)
1274                 case "$zzz" in
1275                 '') zzz=define ;;
1276                 esac
1277                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1278             eval)
1279                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1280             prepend)
1281                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1282             undef)
1283                 case "$zzz" in
1284                 '') zzz="$uuu" ;;
1285                 esac
1286                 echo "$yyy=$zzz"                >> posthint.sh ;;
1287             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1288             esac
1289             shift
1290             ;;
1291         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1292             exit 0;;
1293         --) break;;
1294         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1295         *) break;;
1296         esac
1297 done
1298
1299 case "$error" in
1300 true)
1301         cat >&2 <<EOM
1302 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1303                  [-U symbol] [-U symbol=] [-A command:symbol...]
1304   -d : use defaults for all answers.
1305   -e : go on without questioning past the production of config.sh.
1306   -f : specify an alternate default configuration file.
1307   -h : print this help message and exit (with an error status).
1308   -r : reuse C symbols value if possible (skips costly nm extraction).
1309   -s : silent mode, only echoes questions and essential information.
1310   -D : define symbol to have some value:
1311          -D symbol         symbol gets the value 'define'
1312          -D symbol=value   symbol gets the value 'value'
1313   -E : stop at the end of questions, after having produced config.sh.
1314   -K : do not use unless you know what you are doing.
1315   -O : let -D and -U override definitions from loaded configuration file.
1316   -S : perform variable substitutions on all .SH files (can mix with -f)
1317   -U : undefine symbol:
1318          -U symbol    symbol gets the value 'undef'
1319          -U symbol=   symbol gets completely empty
1320   -A : manipulate symbol after the platform specific hints have been applied:
1321          -A symbol=value                append " "value to symbol
1322          -A append:symbol=value         append value to symbol
1323          -A define:symbol=value         define symbol to have value
1324          -A clear:symbol                define symbol to be ''
1325          -A define:symbol               define symbol to be 'define'
1326          -A eval:symbol=value           define symbol to be eval of value
1327          -A prepend:symbol=value        prepend value to symbol
1328          -A undef:symbol                define symbol to be 'undef'
1329          -A undef:symbol=               define symbol to be ''
1330   -V : print version number and exit (with a zero status).
1331 EOM
1332         exit 1
1333         ;;
1334 esac
1335
1336 : Sanity checks
1337 case "$fastread$alldone" in
1338 yescont|yesexit) ;;
1339 *)
1340         if test ! -t 0; then
1341                 echo "Say 'sh Configure', not 'sh <Configure'"
1342                 exit 1
1343         fi
1344         ;;
1345 esac
1346
1347 exec 4>&1
1348 case "$silent" in
1349 true) exec 1>/dev/null;;
1350 esac
1351
1352 : run the defines and the undefines, if any, but leave the file out there...
1353 touch optdef.sh
1354 . ./optdef.sh
1355 : create the posthint manipulation script and leave the file out there...
1356 touch posthint.sh
1357
1358 : set package name
1359 package=perl5
1360 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1361 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1362 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1363 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1364 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1365 esac
1366
1367 : Some greps do not return status, grrr.
1368 echo "grimblepritz" >grimble
1369 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1370         contains=contains
1371 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1372         contains=grep
1373 else
1374         contains=contains
1375 fi
1376 rm -f grimble
1377 : the following should work in any shell
1378 case "$contains" in
1379 contains*)
1380         echo " "
1381         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1382         cat >contains <<'EOSS'
1383 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1384 EOSS
1385 chmod +x contains
1386 esac
1387
1388 : Find the path to the source tree
1389 case "$src" in
1390 '') case "$0" in
1391     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1392          case "$src" in
1393          /*)    ;;
1394          *)     src=`cd ../$src && pwd` ;;
1395          esac
1396          ;;
1397     *)   src='.';;
1398     esac;;
1399 esac
1400 case "$src" in
1401 '')     src=/
1402         rsrc=/
1403         ;;
1404 /*) rsrc="$src";;
1405 *) rsrc="../$src";;
1406 esac
1407 if test -f $rsrc/Configure && \
1408         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1409 then
1410    : found it, so we are ok.
1411 else
1412         rsrc=''
1413         for src in . .. ../.. ../../.. ../../../..; do
1414                 if test -f ../$src/Configure && \
1415                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1416                 then
1417                         rsrc=../$src
1418                         break
1419                 fi
1420         done
1421 fi
1422 case "$rsrc" in
1423 '')
1424         cat <<EOM >&4
1425
1426 Sorry, I can't seem to locate the source dir for $package.  Please start
1427 Configure with an explicit path -- i.e. /some/path/Configure.
1428
1429 EOM
1430         exit 1
1431         ;;
1432 ../.)   rsrc='..';;
1433 *)
1434         echo " "
1435         echo "Sources for $package found in \"$src\"." >&4
1436         ;;
1437 esac
1438
1439 : script used to extract .SH files with variable substitutions
1440 cat >extract <<'EOS'
1441 CONFIGDOTSH=true
1442 echo "Doing variable substitutions on .SH files..."
1443 if test -f $src/MANIFEST; then
1444         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1445 else
1446         echo "(Looking for .SH files under the source directory.)"
1447         set x `(cd $src; find . -name "*.SH" -print)`
1448 fi
1449 shift
1450 case $# in
1451 0) set x `(cd $src; echo *.SH)`; shift;;
1452 esac
1453 if test ! -f $src/$1; then
1454         shift
1455 fi
1456 mkdir_p='
1457 name=$1;
1458 create="";
1459 while test $name; do
1460         if test ! -d "$name"; then
1461                 create="$name $create";
1462                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1463                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1464         else
1465                 name="";
1466         fi;
1467 done;
1468 for file in $create; do
1469         mkdir $file;
1470 done
1471 '
1472 for file in $*; do
1473         case "$src" in
1474         ".")
1475                 case "$file" in
1476                 */*)
1477                         dir=`expr X$file : 'X\(.*\)/'`
1478                         file=`expr X$file : 'X.*/\(.*\)'`
1479                         (cd $dir && . ./$file)
1480                         ;;
1481                 *)
1482                         . ./$file
1483                         ;;
1484                 esac
1485                 ;;
1486         *)
1487                 case "$file" in
1488                 */*)
1489                         dir=`expr X$file : 'X\(.*\)/'`
1490                         file=`expr X$file : 'X.*/\(.*\)'`
1491                         (set x $dir; shift; eval $mkdir_p)
1492                         sh <$src/$dir/$file
1493                         ;;
1494                 *)
1495                         sh <$src/$file
1496                         ;;
1497                 esac
1498                 ;;
1499         esac
1500 done
1501 if test -f $src/config_h.SH; then
1502         if test ! -f config.h; then
1503         : oops, they left it out of MANIFEST, probably, so do it anyway.
1504         . $src/config_h.SH
1505         fi
1506 fi
1507 EOS
1508
1509 : extract files and exit if asked to do so
1510 case "$extractsh" in
1511 true)
1512         case "$realsilent" in
1513         true) ;;
1514         *) exec 1>&4;;
1515         esac
1516         case "$config_sh" in
1517         '') config_sh='config.sh';;
1518         esac
1519         echo " "
1520         echo "Fetching answers from $config_sh..."
1521         cd ..
1522         . $config_sh
1523         test "$override" && . ./optdef.sh
1524         echo " "
1525         . UU/extract
1526         rm -rf UU
1527         echo "Done."
1528         exit 0
1529         ;;
1530 esac
1531
1532 : Eunice requires " " instead of "", can you believe it
1533 echo " "
1534 : Here we go...
1535 echo "Beginning of configuration questions for $package."
1536
1537 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1538
1539 : first determine how to suppress newline on echo command
1540 echo " "
1541 echo "Checking echo to see how to suppress newlines..."
1542 (echo "hi there\c" ; echo " ") >.echotmp
1543 if $contains c .echotmp >/dev/null 2>&1 ; then
1544         echo "...using -n."
1545         n='-n'
1546         c=''
1547 else
1548         cat <<'EOM'
1549 ...using \c
1550 EOM
1551         n=''
1552         c='\c'
1553 fi
1554 echo $n "The star should be here-->$c"
1555 echo '*'
1556 rm -f .echotmp
1557
1558 : Now test for existence of everything in MANIFEST
1559 echo " "
1560 if test -f $rsrc/MANIFEST; then
1561         echo "First let's make sure your kit is complete.  Checking..." >&4
1562         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1563         rm -f missing
1564         tmppwd=`pwd`
1565         for filelist in x??; do
1566                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1567         done
1568         if test -s missing; then
1569                 cat missing >&4
1570                 cat >&4 <<'EOM'
1571
1572 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1573
1574 You have the option of continuing the configuration process, despite the
1575 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1576 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1577 and contact the author (perlbug@perl.com).
1578
1579 EOM
1580                 echo $n "Continue? [n] $c" >&4
1581                 read ans
1582                 case "$ans" in
1583                 y*)
1584                         echo "Continuing..." >&4
1585                         rm -f missing
1586                         ;;
1587                 *)
1588                         echo "ABORTING..." >&4
1589                         kill $$
1590                         ;;
1591                 esac
1592         else
1593                 echo "Looks good..."
1594         fi
1595 else
1596         echo "There is no MANIFEST file.  I hope your kit is complete !"
1597 fi
1598 rm -f missing x??
1599
1600 echo " "
1601 : Find the appropriate value for a newline for tr
1602 if test -n "$DJGPP"; then
1603        trnl='\012'
1604 fi
1605 if test X"$trnl" = X; then
1606         case "`echo foo|tr '\n' x 2>/dev/null`" in
1607         foox) trnl='\n' ;;
1608         esac
1609 fi
1610 if test X"$trnl" = X; then
1611         case "`echo foo|tr '\012' x 2>/dev/null`" in
1612         foox) trnl='\012' ;;
1613         esac
1614 fi
1615 if test X"$trnl" = X; then
1616         cat <<EOM >&2
1617
1618 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1619
1620 EOM
1621         exit 1
1622 fi
1623
1624 : compute the number of columns on the terminal for proper question formatting
1625 case "$COLUMNS" in
1626 '') COLUMNS='80';;
1627 esac
1628
1629 : set up the echo used in my read
1630 myecho="case \"\$xxxm\" in
1631 '') echo $n \"\$rp $c\" >&4;;
1632 *) case \"\$rp\" in
1633         '') echo $n \"[\$xxxm] $c\";;
1634         *)
1635                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1636                         echo \"\$rp\" >&4
1637                         echo $n \"[\$xxxm] $c\" >&4
1638                 else
1639                         echo $n \"\$rp [\$xxxm] $c\" >&4
1640                 fi
1641                 ;;
1642         esac;;
1643 esac"
1644
1645 : now set up to do reads with possible shell escape and default assignment
1646 cat <<EOSC >myread
1647 $startsh
1648 xxxm=\$dflt
1649 $myecho
1650 ans='!'
1651 case "\$fastread" in
1652 yes) case "\$dflt" in
1653         '') ;;
1654         *) ans='';
1655                 case "\$silent-\$rp" in
1656                 true-) ;;
1657                 *) echo " " >&4;;
1658                 esac;;
1659         esac;;
1660 *) case "\$silent" in
1661         true) case "\$rp" in
1662                 '') ans='';;
1663                 esac;;
1664         esac;;
1665 esac
1666 while expr "X\$ans" : "X!" >/dev/null; do
1667         read answ
1668         set x \$xxxm
1669         shift
1670         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1671         case  "\$answ" in
1672         "!")
1673                 sh 1>&4
1674                 echo " "
1675                 $myecho
1676                 ;;
1677         !*)
1678                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1679                 shift
1680                 sh 1>&4 -c "\$*"
1681                 echo " "
1682                 $myecho
1683                 ;;
1684         "\$ans")
1685                 case "\$ans" in
1686                 \\&*)
1687                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1688                         shift
1689                         case "\$1" in
1690                         -d)
1691                                 fastread=yes
1692                                 echo "(OK, I'll run with -d after this question.)" >&4
1693                                 ;;
1694                         -*)
1695                                 echo "*** Sorry, \$1 not supported yet." >&4
1696                                 ;;
1697                         esac
1698                         $myecho
1699                         ans=!
1700                         ;;
1701                 esac;;
1702         *)
1703                 case "\$aok" in
1704                 y)
1705                         echo "*** Substitution done -- please confirm."
1706                         xxxm="\$ans"
1707                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1708                         xxxm="\$ans"
1709                         ans=!
1710                         ;;
1711                 *)
1712                         echo "*** Error -- try again."
1713                         ans=!
1714                         ;;
1715                 esac
1716                 $myecho
1717                 ;;
1718         esac
1719         case "\$ans\$xxxm\$nostick" in
1720         '')
1721                 ans=!
1722                 $myecho
1723                 ;;
1724         esac
1725 done
1726 case "\$ans" in
1727 '') ans="\$xxxm";;
1728 esac
1729 EOSC
1730
1731 : create .config dir to save info across Configure sessions
1732 test -d ../.config || mkdir ../.config
1733 cat >../.config/README <<EOF
1734 This directory created by Configure to save information that should
1735 persist across sessions for $package.
1736
1737 You may safely delete it if you wish.
1738 EOF
1739
1740 : general instructions
1741 needman=true
1742 firsttime=true
1743 user=`(logname) 2>/dev/null`
1744 case "$user" in
1745 '') user=`whoami 2>&1`;;
1746 esac
1747 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1748         firsttime=false
1749         echo " "
1750         rp='Would you like to see the instructions?'
1751         dflt=n
1752         . ./myread
1753         case "$ans" in
1754         [yY]*) ;;
1755         *) needman=false;;
1756         esac
1757 fi
1758 if $needman; then
1759         cat <<EOH
1760
1761 This installation shell script will examine your system and ask you questions
1762 to determine how the perl5 package should be installed. If you get
1763 stuck on a question, you may use a ! shell escape to start a subshell or
1764 execute a command.  Many of the questions will have default answers in square
1765 brackets; typing carriage return will give you the default.
1766
1767 On some of the questions which ask for file or directory names you are allowed
1768 to use the ~name construct to specify the login directory belonging to "name",
1769 even if you don't have a shell which knows about that.  Questions where this is
1770 allowed will be marked "(~name ok)".
1771
1772 EOH
1773         rp=''
1774         dflt='Type carriage return to continue'
1775         . ./myread
1776         cat <<'EOH'
1777
1778 The prompter used in this script allows you to use shell variables and
1779 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1780 in the default answer, as if the default line was a set of arguments given to a
1781 script shell.  This means you may also use $* to repeat the whole default line,
1782 so you do not have to re-type everything to add something to the default.
1783
1784 Everytime there is a substitution, you will have to confirm.  If there is an
1785 error (e.g. an unmatched backtick), the default answer will remain unchanged
1786 and you will be prompted again.
1787
1788 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1789 the questions and use the computed defaults (or the previous answers if there
1790 was already a config.sh file). Type 'Configure -h' for a list of options.
1791 You may also start interactively and then answer '& -d' at any prompt to turn
1792 on the non-interactive behaviour for the remainder of the execution.
1793
1794 EOH
1795         . ./myread
1796         cat <<EOH
1797
1798 Much effort has been expended to ensure that this shell script will run on any
1799 Unix system.  If despite that it blows up on yours, your best bet is to edit
1800 Configure and run it again.  If you can't run Configure for some reason,
1801 you'll have to generate a config.sh file by hand.  Whatever problems you
1802 have, let me (perlbug@perl.com) know how I blew it.
1803
1804 This installation script affects things in two ways:
1805
1806 1) it may do direct variable substitutions on some of the files included
1807    in this kit.
1808 2) it builds a config.h file for inclusion in C programs.  You may edit
1809    any of these files as the need arises after running this script.
1810
1811 If you make a mistake on a question, there is no easy way to back up to it
1812 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1813 files.  Configure will offer to let you do this before it runs the SH files.
1814
1815 EOH
1816         dflt='Type carriage return to continue'
1817         . ./myread
1818         case "$firsttime" in
1819         true) echo $user >>../.config/instruct;;
1820         esac
1821 fi
1822
1823 : find out where common programs are
1824 echo " "
1825 echo "Locating common programs..." >&4
1826 cat <<EOSC >loc
1827 $startsh
1828 case \$# in
1829 0) exit 1;;
1830 esac
1831 thing=\$1
1832 shift
1833 dflt=\$1
1834 shift
1835 for dir in \$*; do
1836         case "\$thing" in
1837         .)
1838         if test -d \$dir/\$thing; then
1839                 echo \$dir
1840                 exit 0
1841         fi
1842         ;;
1843         *)
1844         for thisthing in \$dir/\$thing; do
1845                 : just loop through to pick last item
1846         done
1847         if test -f \$thisthing; then
1848                 echo \$thisthing
1849                 exit 0
1850         elif test -f \$dir/\$thing.exe; then
1851                 if test -n "$DJGPP"; then
1852                         echo \$dir/\$thing.exe
1853                 else
1854                         : on Eunice apparently
1855                         echo \$dir/\$thing
1856                 fi
1857                 exit 0
1858         fi
1859         ;;
1860         esac
1861 done
1862 echo \$dflt
1863 exit 1
1864 EOSC
1865 chmod +x loc
1866 $eunicefix loc
1867 loclist="
1868 awk
1869 cat
1870 comm
1871 cp
1872 echo
1873 expr
1874 grep
1875 ls
1876 make
1877 mkdir
1878 rm
1879 sed
1880 sort
1881 touch
1882 tr
1883 uniq
1884 "
1885 trylist="
1886 Mcc
1887 ar
1888 byacc
1889 cpp
1890 csh
1891 date
1892 egrep
1893 gzip
1894 less
1895 ln
1896 more
1897 nm
1898 nroff
1899 pg
1900 test
1901 uname
1902 zip
1903 "
1904 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1905 pth="$pth /lib /usr/lib"
1906 for file in $loclist; do
1907         eval xxx=\$$file
1908         case "$xxx" in
1909         /*|?:[\\/]*)
1910                 if test -f "$xxx"; then
1911                         : ok
1912                 else
1913                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1914                         xxx=`./loc $file $file $pth`
1915                 fi
1916                 ;;
1917         '') xxx=`./loc $file $file $pth`;;
1918         *) xxx=`./loc $xxx $xxx $pth`;;
1919         esac
1920         eval $file=$xxx
1921         eval _$file=$xxx
1922         case "$xxx" in
1923         /*)
1924                 echo $file is in $xxx.
1925                 ;;
1926         ?:[\\/]*)
1927                 echo $file is in $xxx.
1928                 ;;
1929         *)
1930                 echo "I don't know where '$file' is, and my life depends on it." >&4
1931                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1932                 exit 1
1933                 ;;
1934         esac
1935 done
1936 echo " "
1937 echo "Don't worry if any of the following aren't found..."
1938 say=offhand
1939 for file in $trylist; do
1940         eval xxx=\$$file
1941         case "$xxx" in
1942         /*|?:[\\/]*)
1943                 if test -f "$xxx"; then
1944                         : ok
1945                 else
1946                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1947                         xxx=`./loc $file $file $pth`
1948                 fi
1949                 ;;
1950         '') xxx=`./loc $file $file $pth`;;
1951         *) xxx=`./loc $xxx $xxx $pth`;;
1952         esac
1953         eval $file=$xxx
1954         eval _$file=$xxx
1955         case "$xxx" in
1956         /*)
1957                 echo $file is in $xxx.
1958                 ;;
1959         ?:[\\/]*)
1960                 echo $file is in $xxx.
1961                 ;;
1962         *)
1963                 echo "I don't see $file out there, $say."
1964                 say=either
1965                 ;;
1966         esac
1967 done
1968 case "$egrep" in
1969 egrep)
1970         echo "Substituting grep for egrep."
1971         egrep=$grep
1972         ;;
1973 esac
1974 case "$ln" in
1975 ln)
1976         echo "Substituting cp for ln."
1977         ln=$cp
1978         ;;
1979 esac
1980 case "$test" in
1981 test)
1982         echo "Hopefully test is built into your sh."
1983         ;;
1984 *)
1985         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1986                 echo "Using the test built into your sh."
1987                 test=test
1988                 _test=test
1989         fi
1990         ;;
1991 esac
1992 case "$echo" in
1993 echo)
1994         echo "Hopefully echo is built into your sh."
1995         ;;
1996 '') ;;
1997 *)
1998         echo " "
1999 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2000         $echo $n "hi there$c" >foo1
2001         echo $n "hi there$c" >foo2
2002         if cmp foo1 foo2 >/dev/null 2>&1; then
2003                 echo "They are compatible.  In fact, they may be identical."
2004         else
2005                 case "$n" in
2006                 '-n') n='' c='\c';;
2007                 *) n='-n' c='';;
2008                 esac
2009                 cat <<FOO
2010 They are not compatible!  You are probably running ksh on a non-USG system.
2011 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2012 have echo built in and we may have to run some Bourne shell scripts.  That
2013 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2014
2015 FOO
2016                 $echo $n "The star should be here-->$c"
2017                 $echo "*"
2018         fi
2019         $rm -f foo1 foo2
2020         ;;
2021 esac
2022
2023 : determine whether symbolic links are supported
2024 echo " "
2025 $touch blurfl
2026 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2027         echo "Symbolic links are supported." >&4
2028         lns="$ln -s"
2029 else
2030         echo "Symbolic links are NOT supported." >&4
2031         lns="$ln"
2032 fi
2033 $rm -f blurfl sym
2034
2035 : see whether [:lower:] and [:upper:] are supported character classes
2036 echo " "
2037 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2038 ABYZ)
2039         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2040         up='[:upper:]'
2041         low='[:lower:]'
2042         ;;
2043 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2044         # (0xc9 and 0xd1), therefore that is a nice testing point.
2045         if test "X$up" = X -o "X$low" = X; then
2046             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2047             ij) up='[A-Z]'
2048                 low='[a-z]'
2049                 ;;
2050             esac
2051         fi
2052         if test "X$up" = X -o "X$low" = X; then
2053             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2054             ij) up='A-Z'
2055                 low='a-z'
2056                 ;;
2057             esac
2058         fi
2059         if test "X$up" = X -o "X$low" = X; then
2060             case "`echo IJ | od -x 2>/dev/null`" in
2061             *C9D1*|*c9d1*)
2062                 echo "Hey, this might be EBCDIC." >&4
2063                 if test "X$up" = X -o "X$low" = X; then
2064                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2065                     ij) up='[A-IJ-RS-Z]'
2066                         low='[a-ij-rs-z]'
2067                         ;;
2068                     esac
2069                 fi
2070                 if test "X$up" = X -o "X$low" = X; then
2071                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2072                     ij) up='A-IJ-RS-Z'
2073                         low='a-ij-rs-z'
2074                         ;;
2075                     esac
2076                 fi
2077                 ;;
2078             esac
2079         fi
2080 esac
2081 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2082 ij)
2083     echo "Using $up and $low to convert case." >&4
2084     ;;
2085 *)
2086     echo "I don't know how to translate letters from upper to lower case." >&4
2087     echo "Your tr is not acting any way I know of." >&4
2088     exit 1
2089     ;;
2090 esac
2091 : set up the translation script tr, must be called with ./tr of course
2092 cat >tr <<EOSC
2093 $startsh
2094 case "\$1\$2" in
2095 '[A-Z][a-z]') exec $tr '$up' '$low';;
2096 '[a-z][A-Z]') exec $tr '$low' '$up';;
2097 esac
2098 exec $tr "\$@"
2099 EOSC
2100 chmod +x tr
2101 $eunicefix tr
2102
2103 : Try to determine whether config.sh was made on this system
2104 case "$config_sh" in
2105 '')
2106 myuname=`$uname -a 2>/dev/null`
2107 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2108 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2109 # because the A-Z/a-z are not consecutive.
2110 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2111         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2112 newmyuname="$myuname"
2113 dflt=n
2114 case "$knowitall" in
2115 '')
2116         if test -f ../config.sh; then
2117                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2118                         eval "`grep myuname= ../config.sh`"
2119                 fi
2120                 if test "X$myuname" = "X$newmyuname"; then
2121                         dflt=y
2122                 fi
2123         fi
2124         ;;
2125 *) dflt=y;;
2126 esac
2127
2128 : Get old answers from old config file if Configure was run on the
2129 : same system, otherwise use the hints.
2130 hint=default
2131 cd ..
2132 if test -f config.sh; then
2133         echo " "
2134         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2135         . UU/myread
2136         case "$ans" in
2137         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2138         *)  echo "Fetching default answers from your old config.sh file..." >&4
2139                 tmp_n="$n"
2140                 tmp_c="$c"
2141                 tmp_sh="$sh"
2142                 . ./config.sh
2143                 cp config.sh UU
2144                 n="$tmp_n"
2145                 c="$tmp_c"
2146                 : Older versions did not always set $sh.  Catch re-use of such
2147                 : an old config.sh.
2148                 case "$sh" in
2149                 '') sh="$tmp_sh" ;;
2150                 esac
2151                 hint=previous
2152                 ;;
2153         esac
2154 fi
2155 if test ! -f config.sh; then
2156         $cat <<EOM
2157
2158 First time through, eh?  I have some defaults handy for some systems
2159 that need some extra help getting the Configure answers right:
2160
2161 EOM
2162         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2163         dflt=''
2164         : Half the following guesses are probably wrong... If you have better
2165         : tests or hints, please send them to perlbug@perl.com
2166         : The metaconfig authors would also appreciate a copy...
2167         $test -f /irix && osname=irix
2168         $test -f /xenix && osname=sco_xenix
2169         $test -f /dynix && osname=dynix
2170         $test -f /dnix && osname=dnix
2171         $test -f /lynx.os && osname=lynxos
2172         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2173         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2174         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2175         $test -f /bin/mips && /bin/mips && osname=mips
2176         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2177                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2178         $test -d /usr/apollo/bin && osname=apollo
2179         $test -f /etc/saf/_sactab && osname=svr4
2180         $test -d /usr/include/minix && osname=minix
2181         if $test -d /MachTen -o -d /MachTen_Folder; then
2182                 osname=machten
2183                 if $test -x /sbin/version; then
2184                         osvers=`/sbin/version | $awk '{print $2}' |
2185                         $sed -e 's/[A-Za-z]$//'`
2186                 elif $test -x /usr/etc/version; then
2187                         osvers=`/usr/etc/version | $awk '{print $2}' |
2188                         $sed -e 's/[A-Za-z]$//'`
2189                 else
2190                         osvers="$2.$3"
2191                 fi
2192         fi
2193
2194         $test -f /sys/posix.dll &&
2195                 $test -f /usr/bin/what &&
2196                 set X `/usr/bin/what /sys/posix.dll` &&
2197                 $test "$3" = UWIN &&
2198                 osname=uwin &&
2199                 osvers="$5"
2200
2201         if $test -f $uname; then
2202                 set X $myuname
2203                 shift
2204
2205                 case "$5" in
2206                 fps*) osname=fps ;;
2207                 mips*)
2208                         case "$4" in
2209                         umips) osname=umips ;;
2210                         *) osname=mips ;;
2211                         esac;;
2212                 [23]100) osname=mips ;;
2213                 next*) osname=next ;;
2214                 i386*)
2215                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2216                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2217                                 osname='sco'
2218                                 osvers=$tmp
2219                         elif $test -f /etc/kconfig; then
2220                                 osname=isc
2221                                 if test "$lns" = "$ln -s"; then
2222                                         osvers=4
2223                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2224                                         osvers=3
2225                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2226                                         osvers=2
2227                                 fi
2228                         fi
2229                         tmp=''
2230                         ;;
2231                 pc*)
2232                         if test -n "$DJGPP"; then
2233                                 osname=dos
2234                                 osvers=djgpp
2235                         fi
2236                         ;;
2237                 esac
2238
2239                 case "$1" in
2240                 aix) osname=aix
2241                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2242                         case "$tmp" in
2243                         'not found') osvers="$4"."$3" ;;
2244                         '<3240'|'<>3240') osvers=3.2.0 ;;
2245                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2246                         '=3250'|'>3250') osvers=3.2.5 ;;
2247                         *) osvers=$tmp;;
2248                         esac
2249                         ;;
2250                 bsd386) osname=bsd386
2251                         osvers=`$uname -r`
2252                         ;;
2253                 cygwin*) osname=cygwin
2254                         osvers="$3"
2255                         ;;
2256                 *dc.osx) osname=dcosx
2257                         osvers="$3"
2258                         ;;
2259                 dnix) osname=dnix
2260                         osvers="$3"
2261                         ;;
2262                 domainos) osname=apollo
2263                         osvers="$3"
2264                         ;;
2265                 dgux) osname=dgux 
2266                         osvers="$3"
2267                         ;;
2268                 dynixptx*) osname=dynixptx
2269                         osvers=`echo "$4"|sed 's/^v//'`
2270                         ;;
2271                 freebsd) osname=freebsd 
2272                         osvers="$3" ;;
2273                 genix) osname=genix ;;
2274                 hp*) osname=hpux 
2275                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2276                         ;;
2277                 irix*) osname=irix
2278                         case "$3" in
2279                         4*) osvers=4 ;;
2280                         5*) osvers=5 ;;
2281                         *)      osvers="$3" ;;
2282                         esac
2283                         ;;
2284                 linux) osname=linux
2285                         case "$3" in
2286                         *)      osvers="$3" ;;
2287                         esac
2288                         ;;
2289                 MiNT) osname=mint
2290                         ;;
2291                 netbsd*) osname=netbsd
2292                         osvers="$3"
2293                         ;;
2294                 news-os) osvers="$3"
2295                         case "$3" in
2296                         4*) osname=newsos4 ;;
2297                         *) osname=newsos ;;
2298                         esac
2299                         ;;
2300                 next*) osname=next ;;
2301                 POSIX-BC | posix-bc ) osname=posix-bc
2302                         osvers="$3"
2303                         ;;
2304                 powerux | power_ux | powermax_os | powermaxos | \
2305                 powerunix | power_unix) osname=powerux
2306                         osvers="$3"
2307                         ;;
2308                 qnx) osname=qnx
2309                         osvers="$4"
2310                         ;;
2311                 solaris) osname=solaris
2312                         case "$3" in
2313                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 sunos) osname=sunos
2318                         case "$3" in
2319                         5*) osname=solaris
2320                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 titanos) osname=titanos
2325                         case "$3" in
2326                         1*) osvers=1 ;;
2327                         2*) osvers=2 ;;
2328                         3*) osvers=3 ;;
2329                         4*) osvers=4 ;;
2330                         *)      osvers="$3" ;;
2331                         esac
2332                         ;;
2333                 ultrix) osname=ultrix
2334                         osvers="$3"
2335                         ;;
2336                 osf1|mls+)      case "$5" in
2337                                 alpha)
2338                                         osname=dec_osf
2339                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2340                                         ;;
2341                         hp*)    osname=hp_osf1  ;;
2342                         mips)   osname=mips_osf1 ;;
2343                         esac
2344                         ;;
2345                 unixware) osname=svr5
2346                         osvers="$4"
2347                         ;;
2348                 uts) osname=uts
2349                         osvers="$3"
2350                         ;;
2351                 $2) case "$osname" in
2352                         *isc*) ;;
2353                         *freebsd*) ;;
2354                         svr*)
2355                                 : svr4.x or possibly later
2356                                 case "svr$3" in 
2357                                 ${osname}*)
2358                                         osname=svr$3
2359                                         osvers=$4
2360                                         ;;
2361                                 esac
2362                                 case "$osname" in
2363                                 svr4.0)
2364                                         : Check for ESIX
2365                                         if test -f /stand/boot ; then
2366                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2367                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2368                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2369                                                         if test -n "$isesix"; then
2370                                                                 osname=esix4
2371                                                         fi
2372                                                 fi
2373                                         fi
2374                                         ;;
2375                                 esac
2376                                 ;;
2377                         *)      if test -f /etc/systemid; then
2378                                         osname=sco
2379                                         set `echo $3 | $sed 's/\./ /g'` $4
2380                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2381                                                 osvers=$1.$2.$3
2382                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2383                                                 osvers=$1.$2
2384                                         elif $test -f $src/hints/sco_$1.sh; then
2385                                                 osvers=$1
2386                                         fi
2387                                 else
2388                                         case "$osname" in
2389                                         '') : Still unknown.  Probably a generic Sys V.
2390                                                 osname="sysv"
2391                                                 osvers="$3"
2392                                                 ;;
2393                                         esac
2394                                 fi
2395                                 ;;
2396                         esac
2397                         ;;
2398                 *)      case "$osname" in
2399                         '') : Still unknown.  Probably a generic BSD.
2400                                 osname="$1"
2401                                 osvers="$3"
2402                                 ;;
2403                         esac
2404                         ;;
2405                 esac
2406         else
2407                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2408                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2409                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2410                                 osname=news_os
2411                         fi
2412                         $rm -f UU/kernel.what
2413                 elif test -d c:/.; then
2414                         set X $myuname
2415                         osname=os2
2416                         osvers="$5"
2417                 fi
2418         fi
2419         
2420         : Now look for a hint file osname_osvers, unless one has been
2421         : specified already.
2422         case "$hintfile" in
2423         ''|' ')
2424                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2425                 : Also try without trailing minor version numbers.
2426                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2427                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2428                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2429                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2430                 case "$file" in
2431                 '') dflt=none ;;
2432                 *)  case "$osvers" in
2433                         '') dflt=$file
2434                                 ;;
2435                         *)  if $test -f $src/hints/$file.sh ; then
2436                                         dflt=$file
2437                                 elif $test -f $src/hints/$xfile.sh ; then
2438                                         dflt=$xfile
2439                                 elif $test -f $src/hints/$xxfile.sh ; then
2440                                         dflt=$xxfile
2441                                 elif $test -f $src/hints/$xxxfile.sh ; then
2442                                         dflt=$xxxfile
2443                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2444                                         dflt=$xxxxfile
2445                                 elif $test -f "$src/hints/${osname}.sh" ; then
2446                                         dflt="${osname}"
2447                                 else
2448                                         dflt=none
2449                                 fi
2450                                 ;;
2451                         esac
2452                         ;;
2453                 esac
2454                 if $test -f Policy.sh ; then
2455                         case "$dflt" in
2456                         *Policy*) ;;
2457                         none) dflt="Policy" ;;
2458                         *) dflt="Policy $dflt" ;;
2459                         esac
2460                 fi
2461                 ;;
2462         *)
2463                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2464                 ;;
2465         esac
2466
2467         if $test -f Policy.sh ; then
2468                 $cat <<EOM
2469
2470 There's also a Policy hint file available, which should make the
2471 site-specific (policy) questions easier to answer.
2472 EOM
2473
2474         fi
2475
2476         $cat <<EOM
2477
2478 You may give one or more space-separated answers, or "none" if appropriate.
2479 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2480 is a good thing.  DO NOT give a wrong version or a wrong OS.
2481
2482 EOM
2483
2484         rp="Which of these apply, if any?"
2485         . UU/myread
2486         tans=$ans
2487         for file in $tans; do
2488                 if $test X$file = XPolicy -a -f Policy.sh; then
2489                         . Policy.sh
2490                         $cat Policy.sh >> UU/config.sh
2491                 elif $test -f $src/hints/$file.sh; then
2492                         . $src/hints/$file.sh
2493                         $cat $src/hints/$file.sh >> UU/config.sh
2494                 elif $test X$tans = X -o X$tans = Xnone ; then
2495                         : nothing
2496                 else
2497                         : Give one chance to correct a possible typo.
2498                         echo "$file.sh does not exist"
2499                         dflt=$file
2500                         rp="hint to use instead?"
2501                         . UU/myread
2502                         for file in $ans; do
2503                                 if $test -f "$src/hints/$file.sh"; then
2504                                         . $src/hints/$file.sh
2505                                         $cat $src/hints/$file.sh >> UU/config.sh
2506                                 elif $test X$ans = X -o X$ans = Xnone ; then
2507                                         : nothing
2508                                 else
2509                                         echo "$file.sh does not exist -- ignored."
2510                                 fi
2511                         done
2512                 fi
2513         done
2514
2515         hint=recommended
2516         : Remember our hint file for later.
2517         if $test -f "$src/hints/$file.sh" ; then
2518                 hintfile="$file"
2519         else
2520                 hintfile=''
2521         fi
2522 fi
2523 cd UU
2524 ;;
2525 *)
2526         echo " "
2527         echo "Fetching default answers from $config_sh..." >&4
2528         tmp_n="$n"
2529         tmp_c="$c"
2530         cd ..
2531         cp $config_sh config.sh 2>/dev/null
2532         chmod +w config.sh
2533         . ./config.sh
2534         cd UU
2535         cp ../config.sh .
2536         n="$tmp_n"
2537         c="$tmp_c"
2538         hint=previous
2539         ;;
2540 esac
2541 test "$override" && . ./optdef.sh
2542 myuname="$newmyuname"
2543
2544 : Restore computed paths
2545 for file in $loclist $trylist; do
2546         eval $file="\$_$file"
2547 done
2548
2549 cat << EOM
2550
2551 Configure uses the operating system name and version to set some defaults.
2552 The default value is probably right if the name rings a bell. Otherwise,
2553 since spelling matters for me, either accept the default or answer "none"
2554 to leave it blank.
2555
2556 EOM
2557 case "$osname" in
2558         ''|' ')
2559                 case "$hintfile" in
2560                 ''|' '|none) dflt=none ;;
2561                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2562                 esac
2563                 ;;
2564         *) dflt="$osname" ;;
2565 esac
2566 rp="Operating system name?"
2567 . ./myread
2568 case "$ans" in
2569 none)  osname='' ;;
2570 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2571 esac
2572 echo " "
2573 case "$osvers" in
2574         ''|' ')
2575                 case "$hintfile" in
2576                 ''|' '|none) dflt=none ;;
2577                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2578                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2579                         case "$dflt" in
2580                         ''|' ') dflt=none ;;
2581                         esac
2582                         ;;
2583                 esac
2584                 ;;
2585         *) dflt="$osvers" ;;
2586 esac
2587 rp="Operating system version?"
2588 . ./myread
2589 case "$ans" in
2590 none)  osvers='' ;;
2591 *) osvers="$ans" ;;
2592 esac
2593
2594
2595 . ./posthint.sh
2596
2597 : who configured the system
2598 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2599 cf_by=`(logname) 2>/dev/null`
2600 case "$cf_by" in
2601 "")
2602         cf_by=`(whoami) 2>/dev/null`
2603         case "$cf_by" in
2604         "") cf_by=unknown ;;
2605         esac ;;
2606 esac
2607
2608 : set up the script used to warn in case of inconsistency
2609 cat <<EOS >whoa
2610 $startsh
2611 EOS
2612 cat <<'EOSC' >>whoa
2613 dflt=y
2614 echo " "
2615 echo "*** WHOA THERE!!! ***" >&4
2616 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2617 rp="    Keep the $hint value?"
2618 . ./myread
2619 case "$ans" in
2620 y) td=$was; tu=$was;;
2621 esac
2622 EOSC
2623
2624 : function used to set $1 to $val
2625 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2626 case "$val$was" in
2627 $define$undef) . ./whoa; eval "$var=\$td";;
2628 $undef$define) . ./whoa; eval "$var=\$tu";;
2629 *) eval "$var=$val";;
2630 esac'
2631
2632 case "$usethreads" in
2633 $define|true|[yY]*)     dflt='y';;
2634 *) dflt='n';;
2635 esac
2636 cat <<EOM
2637
2638 Perl can be built to take advantage of threads on some systems.
2639 To do so, Configure can be run with -Dusethreads.
2640
2641 Note that threading is a highly experimental feature, and
2642 some known race conditions still remain.  If you choose to try
2643 it, be very sure to not actually deploy it for production
2644 purposes.  README.threads has more details, and is required
2645 reading if you enable threads.
2646
2647 If this doesn't make any sense to you, just accept the default '$dflt'.
2648 EOM
2649 rp='Build a threading Perl?'
2650 . ./myread
2651 case "$ans" in
2652 y|Y)    val="$define" ;;
2653 *)      val="$undef" ;;
2654 esac
2655 set usethreads
2656 eval $setvar
2657
2658 case "$usethreads" in
2659 $define)
2660         $cat <<EOM
2661
2662 As of 5.5.640, Perl has two different internal threading implementations,
2663 the 5.005 version (5005threads) and an interpreter-based version
2664 (ithreads) that has one interpreter per thread.  Both are very 
2665 experimental.  This arrangement exists to help developers work out
2666 which one is better.
2667
2668 If you're a casual user, you probably don't want interpreter-threads
2669 at this time.  There doesn't yet exist a way to create threads from
2670 within Perl in this model, i.e., "use Thread;" will NOT work.
2671 EOM
2672         : Default to ithreads unless overridden on command line or with
2673         : old config.sh
2674         dflt='y'
2675         case "$use5005threads" in
2676                 $define|true|[yY]*) dflt='n';;
2677         esac
2678         case "$useithreads" in
2679                 $undef|false|[nN]*) dflt='n';;
2680         esac
2681         rp='Use interpreter-based ithreads?'
2682         . ./myread
2683         case "$ans" in
2684         y|Y)    val="$define" ;;
2685         *)      val="$undef" ;;
2686         esac
2687         set useithreads
2688         eval $setvar
2689         : Now set use5005threads to the opposite value.
2690         case "$useithreads" in
2691         $define) val="$undef" ;;
2692         *) val="$define" ;;
2693         esac
2694         set use5005threads
2695         eval $setvar
2696         ;;
2697 *)
2698         useithreads="$undef"
2699         use5005threads="$undef"
2700         ;;
2701 esac
2702
2703 case "$d_oldpthreads" in
2704 '')     : Configure tests would be welcome here.  For now, assume undef.
2705         val="$undef" ;;
2706 *)      val="$d_oldpthreads" ;;
2707 esac
2708 set d_oldpthreads
2709 eval $setvar
2710
2711
2712 case "$usethreads" in
2713 "$define"|true|[yY]*)
2714 : Look for a hint-file generated 'call-back-unit'.  If the
2715 : user has specified that a threading perl is to be built,
2716 : we may need to set or change some other defaults.
2717         if $test -f usethreads.cbu; then
2718                 echo "Your platform has some specific hints for threaded builds, using them..."
2719                 . ./usethreads.cbu
2720         else
2721                 $cat <<EOM
2722 (Your platform doesn't have any specific hints for threaded builds.
2723  Assuming POSIX threads, then.)
2724 EOM
2725         fi
2726         ;;
2727 esac
2728
2729 cat <<EOM
2730
2731 Perl can be built so that multiple Perl interpreters can coexist
2732 within the same Perl executable.
2733 EOM
2734
2735 case "$useithreads" in
2736 $define)
2737         cat <<EOM
2738 This multiple interpreter support is required for interpreter-based threads.
2739 EOM
2740         val="$define"
2741         ;;
2742 *)      case "$usemultiplicity" in
2743         $define|true|[yY]*)     dflt='y';;
2744         *) dflt='n';;
2745         esac
2746         echo " "
2747         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2748         rp='Build Perl for multiplicity?'
2749         . ./myread
2750         case "$ans" in
2751         y|Y)    val="$define" ;;
2752         *)      val="$undef" ;;
2753         esac
2754         ;;
2755 esac
2756 set usemultiplicity
2757 eval $setvar
2758
2759 : determine where manual pages are on this system
2760 echo " "
2761 case "$sysman" in
2762 '') 
2763         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2764         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2765         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2766         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2767         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2768         sysman=`./loc . /usr/man/man1 $syspath`
2769         ;;
2770 esac
2771 if $test -d "$sysman"; then
2772         echo "System manual is in $sysman." >&4
2773 else
2774         echo "Could not find manual pages in source form." >&4
2775 fi
2776
2777 : see what memory models we can support
2778 case "$models" in
2779 '')
2780         $cat >pdp11.c <<'EOP'
2781 int main() {
2782 #ifdef pdp11
2783         exit(0);
2784 #else
2785         exit(1);
2786 #endif
2787 }
2788 EOP
2789         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2790         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2791                 dflt='unsplit split'
2792         else
2793                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2794                 case "$tans" in
2795                 X) dflt='none';;
2796                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2797                                 dflt='small'
2798                         else
2799                                 dflt=''
2800                         fi
2801                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2802                                 dflt="$dflt medium"
2803                         fi
2804                         if $test -d /lib/large || $test -d /usr/lib/large; then
2805                                 dflt="$dflt large"
2806                         fi
2807                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2808                                 dflt="$dflt huge"
2809                         fi
2810                 esac
2811         fi;;
2812 *) dflt="$models";;
2813 esac
2814 $cat <<EOM
2815  
2816 Some systems have different model sizes.  On most systems they are called
2817 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2818 split.  If your system doesn't support different memory models, say "none".
2819 If you wish to force everything to one memory model, say "none" here and
2820 put the appropriate flags later when it asks you for other cc and ld flags.
2821 Venix systems may wish to put "none" and let the compiler figure things out.
2822 (In the following question multiple model names should be space separated.)
2823
2824 The default for most systems is "none".
2825
2826 EOM
2827 rp="Which memory models are supported?"
2828 . ./myread
2829 models="$ans"
2830
2831 case "$models" in
2832 none)
2833         small=''
2834         medium=''
2835         large=''
2836         huge=''
2837         unsplit=''
2838         split=''
2839         ;;
2840 *split)
2841         case "$split" in
2842         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2843                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2844                         dflt='-i'
2845                 else
2846                         dflt='none'
2847                 fi;;
2848         *) dflt="$split";;
2849         esac
2850         rp="What flag indicates separate I and D space?"
2851         . ./myread
2852         tans="$ans"
2853         case "$tans" in
2854         none) tans='';;
2855         esac
2856         split="$tans"
2857         unsplit='';;
2858 *large*|*small*|*medium*|*huge*)
2859         case "$models" in
2860         *large*)
2861                 case "$large" in
2862                 '') dflt='-Ml';;
2863                 *) dflt="$large";;
2864                 esac
2865         rp="What flag indicates large model?"
2866         . ./myread
2867         tans="$ans"
2868         case "$tans" in
2869         none) tans='';
2870         esac
2871         large="$tans";;
2872         *) large='';;
2873         esac
2874         case "$models" in
2875         *huge*) case "$huge" in
2876                 '') dflt='-Mh';;
2877                 *) dflt="$huge";;
2878                 esac
2879                 rp="What flag indicates huge model?"
2880                 . ./myread
2881                 tans="$ans"
2882                 case "$tans" in
2883                 none) tans='';
2884                 esac
2885                 huge="$tans";;
2886         *) huge="$large";;
2887         esac
2888         case "$models" in
2889         *medium*) case "$medium" in
2890                 '') dflt='-Mm';;
2891                 *) dflt="$medium";;
2892                 esac
2893                 rp="What flag indicates medium model?"
2894                 . ./myread
2895                 tans="$ans"
2896                 case "$tans" in
2897                 none) tans='';
2898                 esac
2899                 medium="$tans";;
2900         *) medium="$large";;
2901         esac
2902         case "$models" in
2903         *small*) case "$small" in
2904                 '') dflt='none';;
2905                 *) dflt="$small";;
2906                 esac
2907                 rp="What flag indicates small model?"
2908                 . ./myread
2909                 tans="$ans"
2910                 case "$tans" in
2911                 none) tans='';
2912                 esac
2913                 small="$tans";;
2914         *) small='';;
2915         esac
2916         ;;
2917 *)
2918         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2919         ;;
2920 esac
2921 $rm -f pdp11.* pdp11
2922
2923 : make some quick guesses about what we are up against
2924 echo " "
2925 $echo $n "Hmm...  $c"
2926 echo exit 1 >bsd
2927 echo exit 1 >usg
2928 echo exit 1 >v7
2929 echo exit 1 >osf1
2930 echo exit 1 >eunice
2931 echo exit 1 >xenix
2932 echo exit 1 >venix
2933 echo exit 1 >os2
2934 d_bsd="$undef"
2935 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2936 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2937 then
2938         echo "Looks kind of like an OSF/1 system, but we'll see..."
2939         echo exit 0 >osf1
2940 elif test `echo abc | tr a-z A-Z` = Abc ; then
2941         xxx=`./loc addbib blurfl $pth`
2942         if $test -f $xxx; then
2943         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2944                 echo exit 0 >bsd
2945                 echo exit 0 >usg
2946         else
2947                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2948                         echo "Looks kind of like an extended USG system, but we'll see..."
2949                 else
2950                         echo "Looks kind of like a USG system, but we'll see..."
2951                 fi
2952                 echo exit 0 >usg
2953         fi
2954 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2955         echo "Looks kind of like a BSD system, but we'll see..."
2956         d_bsd="$define"
2957         echo exit 0 >bsd
2958 else
2959         echo "Looks kind of like a Version 7 system, but we'll see..."
2960         echo exit 0 >v7
2961 fi
2962 case "$eunicefix" in
2963 *unixtovms*)
2964         $cat <<'EOI'
2965 There is, however, a strange, musty smell in the air that reminds me of
2966 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2967 EOI
2968         echo exit 0 >eunice
2969         d_eunice="$define"
2970 : it so happens the Eunice I know will not run shell scripts in Unix format
2971         ;;
2972 *)
2973         echo " "
2974         echo "Congratulations.  You aren't running Eunice."
2975         d_eunice="$undef"
2976         ;;
2977 esac
2978 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2979 case "$p_" in
2980 :) ;;
2981 *)
2982         $cat <<'EOI'
2983 I have the feeling something is not exactly right, however...don't tell me...
2984 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2985 EOI
2986         echo exit 0 >os2
2987         ;;
2988 esac
2989 if test -f /xenix; then
2990         echo "Actually, this looks more like a XENIX system..."
2991         echo exit 0 >xenix
2992         d_xenix="$define"
2993 else
2994         echo " "
2995         echo "It's not Xenix..."
2996         d_xenix="$undef"
2997 fi
2998 chmod +x xenix
2999 $eunicefix xenix
3000 if test -f /venix; then
3001         echo "Actually, this looks more like a VENIX system..."
3002         echo exit 0 >venix
3003 else
3004         echo " "
3005         if ./xenix; then
3006                 : null
3007         else
3008                 echo "Nor is it Venix..."
3009         fi
3010 fi
3011 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3012 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3013 $rm -f foo
3014
3015 : see if we need a special compiler
3016 echo " "
3017 if ./usg; then
3018         case "$cc" in
3019         '') case "$Mcc" in
3020                 /*) dflt='Mcc';;
3021                 *) case "$large" in
3022                         -M*) dflt='cc';;
3023                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3024                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3025                                                 dflt='cc'
3026                                         else
3027                                                 dflt='cc -M'
3028                                         fi
3029                                 else
3030                                         dflt='cc'
3031                                 fi;;
3032                         esac;;
3033                 esac;;
3034         *)  dflt="$cc";;
3035         esac
3036         case "$dflt" in
3037         *M*)    $cat <<'EOM'
3038 On some older systems the default C compiler will not resolve multiple global
3039 references that happen to have the same name.  On some such systems the "Mcc"
3040 command may be used to force these to be resolved.  On other systems a "cc -M"
3041 command is required.  (Note that the -M flag on other systems indicates a
3042 memory model to use!) If you have the Gnu C compiler, you might wish to use
3043 that instead.
3044
3045 EOM
3046         ;;
3047         esac
3048         rp="Use which C compiler?"
3049         . ./myread
3050         cc="$ans"
3051 else
3052         case "$cc" in
3053         '') dflt=cc;;
3054         *) dflt="$cc";;
3055         esac
3056         rp="Use which C compiler?"
3057         . ./myread
3058         cc="$ans"
3059 fi
3060 : Look for a hint-file generated 'call-back-unit'.  Now that the
3061 : user has specified the compiler, we may need to set or change some
3062 : other defaults.
3063 if $test -f cc.cbu; then
3064     . ./cc.cbu
3065 fi
3066 echo " "
3067 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3068 $cat >gccvers.c <<EOM
3069 #include <stdio.h>
3070 int main() {
3071 #ifdef __GNUC__
3072 #ifdef __VERSION__
3073         printf("%s\n", __VERSION__);
3074 #else
3075         printf("%s\n", "1");
3076 #endif
3077 #endif
3078         exit(0);
3079 }
3080 EOM
3081 if $cc $ldflags -o gccvers gccvers.c; then
3082         gccversion=`./gccvers`
3083         case "$gccversion" in
3084         '') echo "You are not using GNU cc." ;;
3085         *)  echo "You are using GNU cc $gccversion."
3086             ;;
3087         esac
3088 else
3089         echo " "
3090         echo "*** WHOA THERE!!! ***" >&4
3091         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3092         case "$knowitall" in
3093         '')
3094         echo "    You'd better start hunting for one and let me know about it." >&4
3095                 exit 1
3096                 ;;
3097         esac
3098 fi
3099 $rm -f gccvers*
3100 case "$gccversion" in
3101 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3102 esac
3103
3104 : decide how portable to be.  Allow command line overrides.
3105 case "$d_portable" in
3106 "$undef") ;;
3107 *)      d_portable="$define" ;;
3108 esac
3109
3110 : set up shell script to do ~ expansion
3111 cat >filexp <<EOSS
3112 $startsh
3113 : expand filename
3114 case "\$1" in
3115  ~/*|~)
3116         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3117         ;;
3118  ~*)
3119         if $test -f /bin/csh; then
3120                 /bin/csh -f -c "glob \$1"
3121                 failed=\$?
3122                 echo ""
3123                 exit \$failed
3124         else
3125                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3126                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3127                 if $test ! -d "\$dir"; then
3128                         me=\`basename \$0\`
3129                         echo "\$me: can't locate home directory for: \$name" >&2
3130                         exit 1
3131                 fi
3132                 case "\$1" in
3133                 */*)
3134                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3135                         ;;
3136                 *)
3137                         echo \$dir
3138                         ;;
3139                 esac
3140         fi
3141         ;;
3142 *)
3143         echo \$1
3144         ;;
3145 esac
3146 EOSS
3147 chmod +x filexp
3148 $eunicefix filexp
3149
3150 : now set up to get a file name
3151 cat <<EOS >getfile
3152 $startsh
3153 EOS
3154 cat <<'EOSC' >>getfile
3155 tilde=''
3156 fullpath=''
3157 already=''
3158 skip=''
3159 none_ok=''
3160 exp_file=''
3161 nopath_ok=''
3162 orig_rp="$rp"
3163 orig_dflt="$dflt"
3164 case "$gfpth" in
3165 '') gfpth='.' ;;
3166 esac
3167
3168 case "$fn" in
3169 *\(*)
3170         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3171         fn=`echo $fn | sed 's/(.*)//'`
3172         ;;
3173 esac
3174
3175 case "$fn" in
3176 *:*)
3177         loc_file=`expr $fn : '.*:\(.*\)'`
3178         fn=`expr $fn : '\(.*\):.*'`
3179         ;;
3180 esac
3181
3182 case "$fn" in
3183 *~*) tilde=true;;
3184 esac
3185 case "$fn" in
3186 */*) fullpath=true;;
3187 esac
3188 case "$fn" in
3189 *+*) skip=true;;
3190 esac
3191 case "$fn" in
3192 *n*) none_ok=true;;
3193 esac
3194 case "$fn" in
3195 *e*) exp_file=true;;
3196 esac
3197 case "$fn" in
3198 *p*) nopath_ok=true;;
3199 esac
3200
3201 case "$fn" in
3202 *f*) type='File';;
3203 *d*) type='Directory';;
3204 *l*) type='Locate';;
3205 esac
3206
3207 what="$type"
3208 case "$what" in
3209 Locate) what='File';;
3210 esac
3211
3212 case "$exp_file" in
3213 '')
3214         case "$d_portable" in
3215         "$define") ;;
3216         *) exp_file=true;;
3217         esac
3218         ;;
3219 esac
3220
3221 cd ..
3222 while test "$type"; do
3223         redo=''
3224         rp="$orig_rp"
3225         dflt="$orig_dflt"
3226         case "$tilde" in
3227         true) rp="$rp (~name ok)";;
3228         esac
3229         . UU/myread
3230         if test -f UU/getfile.ok && \
3231                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3232         then
3233                 value="$ans"
3234                 ansexp="$ans"
3235                 break
3236         fi
3237         case "$ans" in
3238         none)
3239                 value=''
3240                 ansexp=''
3241                 case "$none_ok" in
3242                 true) type='';;
3243                 esac
3244                 ;;
3245         *)
3246                 case "$tilde" in
3247                 '') value="$ans"
3248                         ansexp="$ans";;
3249                 *)
3250                         value=`UU/filexp $ans`
3251                         case $? in
3252                         0)
3253                                 if test "$ans" != "$value"; then
3254                                         echo "(That expands to $value on this system.)"
3255                                 fi
3256                                 ;;
3257                         *) value="$ans";;
3258                         esac
3259                         ansexp="$value"
3260                         case "$exp_file" in
3261                         '') value="$ans";;
3262                         esac
3263                         ;;
3264                 esac
3265                 case "$fullpath" in
3266                 true)
3267                         case "$ansexp" in
3268                         /*) value="$ansexp" ;;
3269                         *)
3270                                 redo=true
3271                                 case "$already" in
3272                                 true)
3273                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3274                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3275                                         ;;
3276                                 *)
3277                                 echo "Please give a full path name, starting with slash." >&4
3278                                         case "$tilde" in
3279                                         true)
3280                                 echo "Note that using ~name is ok provided it expands well." >&4
3281                                                 already=true
3282                                                 ;;
3283                                         esac
3284                                 esac
3285                                 ;;
3286                         esac
3287                         ;;
3288                 esac
3289                 case "$redo" in
3290                 '')
3291                         case "$type" in
3292                         File)
3293                                 for fp in $gfpth; do
3294                                         if test "X$fp" = X.; then
3295                                             pf="$ansexp"
3296                                         else    
3297                                             pf="$fp/$ansexp"
3298                                         fi
3299                                         if test -f "$pf"; then
3300                                                 type=''
3301                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3302                                         then
3303                                                 echo "($value is not a plain file, but that's ok.)"
3304                                                 type=''
3305                                         fi
3306                                         if test X"$type" = X; then
3307                                             value="$pf"
3308                                             break
3309                                         fi
3310                                 done
3311                                 ;;
3312                         Directory)
3313                                 for fp in $gfpth; do
3314                                         if test "X$fp" = X.; then
3315                                             pf="$ansexp"
3316                                         else    
3317                                             pf="$fp/$ansexp"
3318                                         fi
3319                                         if test -d "$pf"; then
3320                                                 type=''
3321                                                 value="$pf"
3322                                                 break
3323                                         fi
3324                                 done
3325                                 ;;
3326                         Locate)
3327                                 if test -d "$ansexp"; then
3328                                         echo "(Looking for $loc_file in directory $value.)"
3329                                         value="$value/$loc_file"
3330                                         ansexp="$ansexp/$loc_file"
3331                                 fi
3332                                 if test -f "$ansexp"; then
3333                                         type=''
3334                                 fi
3335                                 case "$nopath_ok" in
3336                                 true)   case "$value" in
3337                                         */*) ;;
3338                                         *)      echo "Assuming $value will be in people's path."
3339                                                 type=''
3340                                                 ;;
3341                                         esac
3342                                         ;;
3343                                 esac
3344                                 ;;
3345                         esac
3346
3347                         case "$skip" in
3348                         true) type='';
3349                         esac
3350
3351                         case "$type" in
3352                         '') ;;
3353                         *)
3354                                 if test "$fastread" = yes; then
3355                                         dflt=y
3356                                 else
3357                                         dflt=n
3358                                 fi
3359                                 rp="$what $value doesn't exist.  Use that name anyway?"
3360                                 . UU/myread
3361                                 dflt=''
3362                                 case "$ans" in
3363                                 y*) type='';;
3364                                 *) echo " ";;
3365                                 esac
3366                                 ;;
3367                         esac
3368                         ;;
3369                 esac
3370                 ;;
3371         esac
3372 done
3373 cd UU
3374 ans="$value"
3375 rp="$orig_rp"
3376 dflt="$orig_dflt"
3377 rm -f getfile.ok
3378 test "X$gfpthkeep" != Xy && gfpth=""
3379 EOSC
3380
3381 : What should the include directory be ?
3382 echo " "
3383 $echo $n "Hmm...  $c"
3384 dflt='/usr/include'
3385 incpath=''
3386 mips_type=''
3387 if $test -f /bin/mips && /bin/mips; then
3388         echo "Looks like a MIPS system..."
3389         $cat >usr.c <<'EOCP'
3390 #ifdef SYSTYPE_BSD43
3391 /bsd43
3392 #endif
3393 EOCP
3394         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3395                 dflt='/bsd43/usr/include'
3396                 incpath='/bsd43'
3397                 mips_type='BSD 4.3'
3398         else
3399                 mips_type='System V'
3400         fi
3401         $rm -f usr.c usr.out
3402         echo "and you're compiling with the $mips_type compiler and libraries."
3403         xxx_prompt=y
3404         echo "exit 0" >mips
3405 else
3406         echo "Doesn't look like a MIPS system."
3407         xxx_prompt=n
3408         echo "exit 1" >mips
3409 fi
3410 chmod +x mips
3411 $eunicefix mips
3412 case "$usrinc" in
3413 '') ;;
3414 *) dflt="$usrinc";;
3415 esac
3416 case "$xxx_prompt" in
3417 y)      fn=d/
3418         echo " "
3419         rp='Where are the include files you want to use?'
3420         . ./getfile
3421         usrinc="$ans"
3422         ;;
3423 *)      usrinc="$dflt"
3424         ;;
3425 esac
3426
3427 : see how we invoke the C preprocessor
3428 echo " "
3429 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3430 cat <<'EOT' >testcpp.c
3431 #define ABC abc
3432 #define XYZ xyz
3433 ABC.XYZ
3434 EOT
3435 cd ..
3436 if test ! -f cppstdin; then
3437         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3438                 # AIX cc -E doesn't show the absolute headerfile
3439                 # locations but we'll cheat by using the -M flag.
3440                 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
3441         else
3442                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3443         fi
3444 else
3445         echo "Keeping your $hint cppstdin wrapper."
3446 fi
3447 chmod 755 cppstdin
3448 wrapper=`pwd`/cppstdin
3449 ok='false'
3450 cd UU
3451
3452 if $test "X$cppstdin" != "X" && \
3453         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3454         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3455 then
3456         echo "You used to use $cppstdin $cppminus so we'll use that again."
3457         case "$cpprun" in
3458         '') echo "But let's see if we can live without a wrapper..." ;;
3459         *)
3460                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3461                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3462                 then
3463                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3464                         ok='true'
3465                 else
3466                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3467                 fi
3468                 ;;
3469         esac
3470 else
3471         case "$cppstdin" in
3472         '') ;;
3473         *)
3474                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3475                 ;;
3476         esac
3477 fi
3478
3479 if $ok; then
3480         : nothing
3481 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3482         $cc -E <testcpp.c >testcpp.out 2>&1; \
3483         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3484         echo "Yup, it does."
3485         x_cpp="$cc -E"
3486         x_minus='';
3487 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3488         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3489         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3490         echo "Yup, it does."
3491         x_cpp="$cc -E"
3492         x_minus='-';
3493 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3494         $cc -P <testcpp.c >testcpp.out 2>&1; \
3495         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496         echo "Yipee, that works!"
3497         x_cpp="$cc -P"
3498         x_minus='';
3499 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3500         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3501         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3502         echo "At long last!"
3503         x_cpp="$cc -P"
3504         x_minus='-';
3505 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3506         $cpp <testcpp.c >testcpp.out 2>&1; \
3507         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3508         echo "It works!"
3509         x_cpp="$cpp"
3510         x_minus='';
3511 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3512         $cpp - <testcpp.c >testcpp.out 2>&1; \
3513         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3514         echo "Hooray, it works!  I was beginning to wonder."
3515         x_cpp="$cpp"
3516         x_minus='-';
3517 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3518         $wrapper <testcpp.c >testcpp.out 2>&1; \
3519         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3520         x_cpp="$wrapper"
3521         x_minus=''
3522         echo "Eureka!"
3523 else
3524         dflt=''
3525         rp="No dice.  I can't find a C preprocessor.  Name one:"
3526         . ./myread
3527         x_cpp="$ans"
3528         x_minus=''
3529         $x_cpp <testcpp.c >testcpp.out 2>&1
3530         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3531                 echo "OK, that will do." >&4
3532         else
3533 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3534                 exit 1
3535         fi
3536 fi
3537
3538 case "$ok" in
3539 false)
3540         cppstdin="$x_cpp"
3541         cppminus="$x_minus"
3542         cpprun="$x_cpp"
3543         cpplast="$x_minus"
3544         set X $x_cpp
3545         shift
3546         case "$1" in
3547         "$cpp")
3548                 echo "Perhaps can we force $cc -E using a wrapper..."
3549                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3550                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3551                 then
3552                         echo "Yup, we can."
3553                         cppstdin="$wrapper"
3554                         cppminus='';
3555                 else
3556                         echo "Nope, we'll have to live without it..."
3557                 fi
3558                 ;;
3559         esac
3560         case "$cpprun" in
3561         "$wrapper")
3562                 cpprun=''
3563                 cpplast=''
3564                 ;;
3565         esac
3566         ;;
3567 esac
3568
3569 case "$cppstdin" in
3570 "$wrapper"|'cppstdin') ;;
3571 *) $rm -f $wrapper;;
3572 esac
3573 $rm -f testcpp.c testcpp.out
3574
3575 : Set private lib path
3576 case "$plibpth" in
3577 '') if ./mips; then
3578                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3579         fi;;
3580 esac
3581 case "$libpth" in
3582 ' ') dlist='';;
3583 '') dlist="$loclibpth $plibpth $glibpth";;
3584 *) dlist="$libpth";;
3585 esac
3586
3587 : Now check and see which directories actually exist, avoiding duplicates
3588 libpth=''
3589 for xxx in $dlist
3590 do
3591     if $test -d $xxx; then
3592                 case " $libpth " in
3593                 *" $xxx "*) ;;
3594                 *) libpth="$libpth $xxx";;
3595                 esac
3596     fi
3597 done
3598 $cat <<'EOM'
3599
3600 Some systems have incompatible or broken versions of libraries.  Among
3601 the directories listed in the question below, please remove any you
3602 know not to be holding relevant libraries, and add any that are needed.
3603 Say "none" for none.
3604
3605 EOM
3606 case "$libpth" in
3607 '') dflt='none';;
3608 *)
3609         set X $libpth
3610         shift
3611         dflt=${1+"$@"}
3612         ;;
3613 esac
3614 rp="Directories to use for library searches?"
3615 . ./myread
3616 case "$ans" in
3617 none) libpth=' ';;
3618 *) libpth="$ans";;
3619 esac
3620
3621 : compute shared library extension
3622 case "$so" in
3623 '')
3624         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3625                 dflt='sl'
3626         else
3627                 dflt='so'
3628         fi
3629         ;;
3630 *) dflt="$so";;
3631 esac
3632 $cat <<EOM
3633
3634 On some systems, shared libraries may be available.  Answer 'none' if
3635 you want to suppress searching of shared libraries for the remainder
3636 of this configuration.
3637
3638 EOM
3639 rp='What is the file extension used for shared libraries?'
3640 . ./myread
3641 so="$ans"
3642
3643 : Define several unixisms.
3644 : Hints files or command line option can be used to override them.
3645 : The convoluted testing is in case hints files set either the old
3646 : or the new name.
3647 case "$_exe" in
3648 '')     case "$exe_ext" in
3649     '') ;;
3650         *)      _exe="$exe_ext" ;;
3651         esac
3652         ;;
3653 esac
3654 case "$_a" in
3655 '')     case "$lib_ext" in
3656     '') _a='.a';;
3657         *)      _a="$lib_ext" ;;
3658         esac
3659         ;;
3660 esac
3661 case "$_o" in
3662 '') case "$obj_ext" in
3663         '')     _o='.o';;
3664         *)      _o="$obj_ext";;
3665         esac
3666         ;;
3667 esac
3668 case "$p_" in
3669 '') case "$path_sep" in
3670         '')     p_=':';;
3671         *)      p_="$path_sep";;
3672         esac
3673         ;;
3674 esac
3675 exe_ext=$_exe
3676 lib_ext=$_a
3677 obj_ext=$_o
3678 path_sep=$p_
3679
3680 : Which makefile gets called first.  This is used by make depend.
3681 case "$firstmakefile" in
3682 '') firstmakefile='makefile';;
3683 esac
3684
3685 case "$usesocks" in
3686 $define|true|[yY]*)     dflt='y';;
3687 *) dflt='n';;
3688 esac
3689 cat <<EOM
3690
3691 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3692 Configure must be run with -Dusesocks.
3693
3694 If this doesn't make any sense to you, just accept the default '$dflt'.
3695 EOM
3696 rp='Build Perl for SOCKS?'
3697 . ./myread
3698 case "$ans" in
3699 y|Y)    val="$define" ;;     
3700 *)      val="$undef" ;;
3701 esac
3702 set usesocks
3703 eval $setvar
3704
3705 : Looking for optional libraries
3706 echo " "
3707 echo "Checking for optional libraries..." >&4
3708 case "$libs" in
3709 ' '|'') dflt='';;
3710 *) dflt="$libs";;
3711 esac
3712 case "$libswanted" in
3713 '') libswanted='c_s';;
3714 esac
3715 case "$usesocks" in
3716 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3717 esac
3718 libsfound=''
3719 libsfiles=''
3720 libsdirs=''
3721 libspath=''
3722 for thisdir in $libpth $xlibpth; do
3723   test -d $thisdir && libspath="$libspath $thisdir"
3724 done
3725 for thislib in $libswanted; do
3726         for thisdir in $libspath; do
3727             xxx=''
3728             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3729                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3730                 $test -f "$xxx" && eval $libscheck
3731                 $test -f "$xxx" && libstyle=shared
3732             fi
3733             if test ! -f "$xxx"; then
3734                 xxx=$thisdir/lib$thislib.$so
3735                 $test -f "$xxx" && eval $libscheck
3736                 $test -f "$xxx" && libstyle=shared
3737             fi  
3738             if test ! -f "$xxx"; then
3739                 xxx=$thisdir/lib$thislib$_a
3740                 $test -f "$xxx" && eval $libscheck
3741                 $test -f "$xxx" && libstyle=static
3742             fi
3743             if test ! -f "$xxx"; then
3744                 xxx=$thisdir/$thislib$_a
3745                 $test -f "$xxx" && eval $libscheck
3746                 $test -f "$xxx" && libstyle=static
3747             fi
3748             if test ! -f "$xxx"; then
3749                 xxx=$thisdir/lib${thislib}_s$_a
3750                 $test -f "$xxx" && eval $libscheck
3751                 $test -f "$xxx" && libstyle=static
3752                 $test -f "$xxx" && thislib=${thislib}_s
3753             fi
3754             if test ! -f "$xxx"; then
3755                 xxx=$thisdir/Slib$thislib$_a
3756                 $test -f "$xxx" && eval $libscheck
3757                 $test -f "$xxx" && libstyle=static
3758             fi
3759             if $test -f "$xxx"; then
3760                 case "$libstyle" in
3761                 shared) echo "Found -l$thislib (shared)." ;;
3762                 static) echo "Found -l$thislib." ;;
3763                 *)      echo "Found -l$thislib ($libstyle)." ;;
3764                 esac
3765                 case " $dflt " in
3766                 *"-l$thislib "*);;
3767                 *) dflt="$dflt -l$thislib"
3768                    libsfound="$libsfound $xxx"
3769                    yyy=`basename $xxx`
3770                    libsfiles="$libsfiles $yyy"
3771                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3772                    case " $libsdirs " in
3773                    *" $yyy "*) ;;
3774                    *) libsdirs="$libsdirs $yyy" ;;
3775                    esac
3776                    ;;
3777                 esac
3778                 break
3779             fi  
3780         done
3781         if $test ! -f "$xxx"; then
3782             echo "No -l$thislib."
3783         fi
3784 done
3785 set X $dflt
3786 shift
3787 dflt="$*"
3788 case "$libs" in
3789 '') dflt="$dflt";;
3790 *) dflt="$libs";;
3791 esac
3792 case "$dflt" in
3793 ' '|'') dflt='none';;
3794 esac
3795
3796 $cat <<EOM
3797
3798 In order to compile $package on your machine, a number of libraries
3799 are usually needed.  Include any other special libraries here as well.
3800 Say "none" for none.  The default list is almost always right.
3801 EOM
3802
3803 echo " "
3804 rp="What libraries to use?"
3805 . ./myread
3806 case "$ans" in
3807 none) libs=' ';;
3808 *) libs="$ans";;
3809 esac
3810
3811 : determine optimization, if desired, or use for debug flag also
3812 case "$optimize" in
3813 ' '|$undef) dflt='none';;
3814 '') dflt='-O';;
3815 *) dflt="$optimize";;
3816 esac
3817 $cat <<EOH
3818
3819 By default, $package compiles with the -O flag to use the optimizer.
3820 Alternately, you might want to use the symbolic debugger, which uses
3821 the -g flag (on traditional Unix systems).  Either flag can be
3822 specified here.  To use neither flag, specify the word "none".
3823
3824 EOH
3825 rp="What optimizer/debugger flag should be used?"
3826 . ./myread
3827 optimize="$ans"
3828 case "$optimize" in
3829 'none') optimize=" ";;
3830 esac
3831
3832 dflt=''
3833 : We will not override a previous value, but we might want to
3834 : augment a hint file
3835 case "$hint" in
3836 default|recommended)
3837         case "$gccversion" in
3838         1*) dflt='-fpcc-struct-return' ;;
3839         esac
3840         case "$optimize" in
3841         *-g*) dflt="$dflt -DDEBUGGING";;
3842         esac
3843         case "$gccversion" in
3844         2*) if test -d /etc/conf/kconfig.d &&
3845                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3846                 then
3847                         dflt="$dflt -posix"
3848                 fi
3849                 ;;
3850         esac
3851         case "$gccversion" in
3852         1*) ;;
3853         2.[0-8]*) ;;
3854         ?*)     echo " "
3855                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3856                 echo 'int main(void) { return 0; }' > gcctest.c
3857                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3858                         echo "Yes, it does." 2>&1
3859                         case "$ccflags" in
3860                         *strict-aliasing*) 
3861                                 echo "Leaving current flags $ccflags alone." 2>&1
3862                                 ;;
3863                         *) dflt="$dflt -fno-strict-aliasing" ;;
3864                         esac
3865                 else
3866                         echo "Nope, it doesn't, but that's ok." 2>&1
3867                 fi
3868                 ;;
3869         esac
3870         ;;
3871 esac
3872
3873 case "$mips_type" in
3874 *BSD*|'') inclwanted="$locincpth $usrinc";;
3875 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3876 esac
3877 for thisincl in $inclwanted; do
3878         if $test -d $thisincl; then
3879                 if $test x$thisincl != x$usrinc; then
3880                         case "$dflt" in
3881                         *$thisincl*);;
3882                         *) dflt="$dflt -I$thisincl";;
3883                         esac
3884                 fi
3885         fi
3886 done
3887
3888 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3889         xxx=true;
3890 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3891         xxx=true;
3892 else
3893         xxx=false;
3894 fi;
3895 if $xxx; then
3896         case "$dflt" in
3897         *$2*);;
3898         *) dflt="$dflt -D$2";;
3899         esac;
3900 fi'
3901
3902 set signal.h LANGUAGE_C; eval $inctest
3903
3904 case "$usesocks" in
3905 $define)
3906         ccflags="$ccflags -DSOCKS"
3907         ;;
3908 esac
3909
3910 case "$hint" in
3911 default|recommended) dflt="$ccflags $dflt" ;;
3912 *) dflt="$ccflags";;
3913 esac
3914
3915 case "$dflt" in
3916 ''|' ') dflt=none;;
3917 esac
3918 $cat <<EOH
3919
3920 Your C compiler may want other flags.  For this question you should include
3921 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3922 but you should NOT include libraries or ld flags like -lwhatever.  If you
3923 want $package to honor its debug switch, you should include -DDEBUGGING here.
3924 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3925
3926 To use no flags, specify the word "none".
3927
3928 EOH
3929 set X $dflt
3930 shift
3931 dflt=${1+"$@"}
3932 rp="Any additional cc flags?"
3933 . ./myread
3934 case "$ans" in
3935 none) ccflags='';;
3936 *) ccflags="$ans";;
3937 esac
3938
3939 : the following weeds options from ccflags that are of no interest to cpp
3940 cppflags="$ccflags"
3941 case "$gccversion" in
3942 1*) cppflags="$cppflags -D__GNUC__"
3943 esac
3944 case "$mips_type" in
3945 '');;
3946 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3947 esac
3948 case "$cppflags" in
3949 '');;
3950 *)
3951         echo " "
3952         echo "Let me guess what the preprocessor flags are..." >&4
3953         set X $cppflags
3954         shift
3955         cppflags=''
3956         $cat >cpp.c <<'EOM'
3957 #define BLURFL foo
3958
3959 BLURFL xx LFRULB
3960 EOM
3961         previous=''
3962         for flag in $*
3963         do
3964                 case "$flag" in
3965                 -*) ftry="$flag";;
3966                 *) ftry="$previous $flag";;
3967                 esac
3968                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3969                         >cpp1.out 2>/dev/null && \
3970                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3971                         >cpp2.out 2>/dev/null && \
3972                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3973                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3974                 then
3975                         cppflags="$cppflags $ftry"
3976                         previous=''
3977                 else
3978                         previous="$flag"
3979                 fi
3980         done
3981         set X $cppflags
3982         shift
3983         cppflags=${1+"$@"}
3984         case "$cppflags" in
3985         *-*)  echo "They appear to be: $cppflags";;
3986         esac
3987         $rm -f cpp.c cpp?.out
3988         ;;
3989 esac
3990
3991 : flags used in final linking phase
3992 case "$ldflags" in
3993 '') if ./venix; then
3994                 dflt='-i -z'
3995         else
3996                 dflt=''
3997         fi
3998         case "$ccflags" in
3999         *-posix*) dflt="$dflt -posix" ;;
4000         esac
4001         ;;
4002 *) dflt="$ldflags";;
4003 esac
4004
4005 : Try to guess additional flags to pick up local libraries.
4006 for thislibdir in $libpth; do
4007         case " $loclibpth " in
4008         *" $thislibdir "*)
4009                 case "$dflt " in 
4010                 *"-L$thislibdir "*) ;;
4011                 *)  dflt="$dflt -L$thislibdir" ;;
4012                 esac
4013                 ;;
4014         esac
4015 done
4016
4017 case "$dflt" in
4018 '') dflt='none' ;;
4019 esac
4020
4021 $cat <<EOH
4022
4023 Your C linker may need flags.  For this question you should
4024 include -L/whatever and any other flags used by the C linker, but you
4025 should NOT include libraries like -lwhatever.
4026
4027 Make sure you include the appropriate -L/path flags if your C linker
4028 does not normally search all of the directories you specified above,
4029 namely
4030         $libpth
4031 To use no flags, specify the word "none".
4032
4033 EOH
4034
4035 rp="Any additional ld flags (NOT including libraries)?"
4036 . ./myread
4037 case "$ans" in
4038 none) ldflags='';;
4039 *) ldflags="$ans";;
4040 esac
4041 rmlist="$rmlist pdp11"
4042
4043 : coherency check
4044 echo " "
4045 echo "Checking your choice of C compiler and flags for coherency..." >&4
4046 $cat > try.c <<'EOF'
4047 #include <stdio.h>
4048 int main() { printf("Ok\n"); exit(0); }
4049 EOF
4050 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4051 shift
4052 $cat >try.msg <<'EOM'
4053 I've tried to compile and run the following simple program:
4054
4055 EOM
4056 $cat try.c >> try.msg
4057
4058 $cat >> try.msg <<EOM
4059
4060 I used the command:
4061
4062         $*
4063         ./try
4064
4065 and I got the following output:
4066
4067 EOM
4068 dflt=y
4069 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4070         if sh -c './try' >>try.msg 2>&1; then
4071                 xxx=`./try`
4072                 case "$xxx" in
4073                 "Ok") dflt=n ;;
4074                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4075                         case " $libs " in
4076                         *" -lsfio "*)
4077                                 cat >> try.msg <<'EOQS'
4078 If $libs contains -lsfio, and sfio is mis-configured, then it
4079 sometimes (apparently) runs and exits with a 0 status, but with no
4080 output!  It may have to do with sfio's use of _exit vs. exit.
4081
4082 EOQS
4083                                 rp="You have a big problem.  Shall I abort Configure"
4084                                 dflt=y
4085                                 ;;
4086                         esac
4087                         ;;
4088                 esac
4089         else
4090                 echo "The program compiled OK, but exited with status $?." >>try.msg
4091                 rp="You have a problem.  Shall I abort Configure"
4092                 dflt=y
4093         fi
4094 else
4095         echo "I can't compile the test program." >>try.msg
4096         rp="You have a BIG problem.  Shall I abort Configure"
4097         dflt=y
4098 fi
4099 case "$dflt" in
4100 y)
4101         $cat try.msg >&4
4102         case "$knowitall" in
4103         '')
4104                 echo "(The supplied flags or libraries might be incorrect.)"
4105                 ;;
4106         *) dflt=n;;
4107         esac
4108         echo " "
4109         . ./myread
4110         case "$ans" in
4111         n*|N*) ;;
4112         *)      echo "Ok.  Stopping Configure." >&4
4113                 exit 1
4114                 ;;
4115         esac
4116         ;;
4117 n) echo "OK, that should do.";;
4118 esac
4119 $rm -f try try.* core
4120
4121 : define an is-a-typedef? function
4122 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4123 case "$inclist" in
4124 "") inclist="sys/types.h";;
4125 esac;
4126 eval "varval=\$$var";
4127 case "$varval" in
4128 "")
4129         $rm -f temp.c;
4130         for inc in $inclist; do
4131                 echo "#include <$inc>" >>temp.c;
4132         done;
4133         echo "#ifdef $type" >> temp.c;
4134         echo "printf(\"We have $type\");" >> temp.c;
4135         echo "#endif" >> temp.c;
4136         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4137         if $contains $type temp.E >/dev/null 2>&1; then
4138                 eval "$var=\$type";
4139         else
4140                 eval "$var=\$def";
4141         fi;
4142         $rm -f temp.?;;
4143 *) eval "$var=\$varval";;
4144 esac'
4145
4146 : define an is-a-typedef? function that prompts if the type is not available.
4147 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4148 case "$inclist" in
4149 "") inclist="sys/types.h";;
4150 esac;
4151 eval "varval=\$$var";
4152 case "$varval" in
4153 "")
4154         $rm -f temp.c;
4155         for inc in $inclist; do
4156                 echo "#include <$inc>" >>temp.c;
4157         done;
4158         echo "#ifdef $type" >> temp.c;
4159         echo "printf(\"We have $type\");" >> temp.c;
4160         echo "#endif" >> temp.c;
4161         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4162         echo " " ;
4163         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4164         if $contains $type temp.E >/dev/null 2>&1; then
4165                 echo "$type found." >&4;
4166                 eval "$var=\$type";
4167         else
4168                 echo "$type NOT found." >&4;
4169                 dflt="$def";
4170                 . ./myread ;
4171                 eval "$var=\$ans";
4172         fi;
4173         $rm -f temp.?;;
4174 *) eval "$var=\$varval";;
4175 esac'
4176
4177 : define a shorthand compile call
4178 compile='
4179 mc_file=$1;
4180 shift;
4181 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4182 : define a shorthand compile call for compilations that should be ok.
4183 compile_ok='
4184 mc_file=$1;
4185 shift;
4186 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4187
4188 : check for lengths of integral types
4189 echo " "
4190 case "$intsize" in
4191 '')
4192         echo "Checking to see how big your integers are..." >&4
4193         $cat >intsize.c <<'EOCP'
4194 #include <stdio.h>
4195 int main()
4196 {
4197         printf("intsize=%d;\n", (int)sizeof(int));
4198         printf("longsize=%d;\n", (int)sizeof(long));
4199         printf("shortsize=%d;\n", (int)sizeof(short));
4200         exit(0);
4201 }
4202 EOCP
4203         set intsize
4204         if eval $compile_ok && ./intsize > /dev/null; then
4205                 eval `./intsize`
4206                 echo "Your integers are $intsize bytes long."
4207                 echo "Your long integers are $longsize bytes long."
4208                 echo "Your short integers are $shortsize bytes long."
4209         else
4210                 $cat >&4 <<EOM
4211 !
4212 Help! I can't compile and run the intsize test program: please enlighten me!
4213 (This is probably a misconfiguration in your system or libraries, and
4214 you really ought to fix it.  Still, I'll try anyway.)
4215 !
4216 EOM
4217                 dflt=4
4218                 rp="What is the size of an integer (in bytes)?"
4219                 . ./myread
4220                 intsize="$ans"
4221                 dflt=$intsize
4222                 rp="What is the size of a long integer (in bytes)?"
4223                 . ./myread
4224                 longsize="$ans"
4225                 dflt=2
4226                 rp="What is the size of a short integer (in bytes)?"
4227                 . ./myread
4228                 shortsize="$ans"
4229         fi
4230         ;;
4231 esac
4232 $rm -f intsize intsize.*
4233
4234 : see what type lseek is declared as in the kernel
4235 rp="What is the type used for lseek's offset on this system?"
4236 set off_t lseektype long stdio.h sys/types.h
4237 eval $typedef_ask
4238
4239 echo " "
4240 echo "Checking to see how big your file offsets are..." >&4
4241 $cat >try.c <<EOCP
4242 #include <sys/types.h>
4243 #include <stdio.h>
4244 int main()
4245 {
4246     printf("%d\n", (int)sizeof($lseektype));
4247     return(0); 
4248 }
4249 EOCP
4250 set try
4251 if eval $compile_ok; then
4252         lseeksize=`./try`
4253         echo "Your file offsets are $lseeksize bytes long."
4254 else
4255         dflt=$longsize
4256         echo " "
4257         echo "(I can't seem to compile the test program.  Guessing...)"
4258         rp="What is the size of your file offsets (in bytes)?"
4259         . ./myread
4260         lseeksize="$ans"
4261 fi
4262 $rm -f try.c try
4263
4264 : see what type file positions are declared as in the library
4265 rp="What is the type for file position used by fsetpos()?"
4266 set fpos_t fpostype long stdio.h sys/types.h
4267 eval $typedef_ask
4268
4269 echo " "
4270 case "$fpostype" in
4271 *_t) zzz="$fpostype"    ;;
4272 *)   zzz="fpos_t"       ;;
4273 esac
4274 echo "Checking the size of $zzz..." >&4 
4275 cat > try.c <<EOCP
4276 #include <sys/types.h>
4277 #include <stdio.h>
4278 int main() {
4279     printf("%d\n", (int)sizeof($fpostype));
4280     exit(0);
4281 }
4282 EOCP
4283 set try
4284 if eval $compile_ok; then
4285         yyy=`./try`
4286         case "$yyy" in
4287         '')     fpossize=4
4288                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4289                 ;;
4290         *)      fpossize=$yyy
4291                 echo "Your $zzz is $fpossize bytes long."
4292                 ;;
4293         esac
4294 else
4295         dflt="$longsize"
4296         echo " " >&4
4297         echo "(I can't compile the test program.  Guessing...)" >&4
4298         rp="What is the size of your file positions (in bytes)?"
4299         . ./myread
4300         fpossize="$ans"
4301 fi
4302
4303
4304
4305 # Backward compatibility (uselfs is deprecated).
4306 case "$uselfs" in
4307 "$define"|true|[yY]*)
4308         cat <<EOM >&4
4309
4310 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4311 EOM
4312         uselargefiles="$define"
4313         ;;
4314 esac                          
4315
4316 case "$lseeksize:$fpossize" in
4317 8:8) cat <<EOM
4318
4319 You can have files larger than 2 gigabytes.
4320 EOM
4321    val="$define" ;;
4322 *)    case "$uselargefiles" in
4323    "$undef"|false|[nN]*) dflt='n' ;;
4324    *)   dflt='y' ;;
4325    esac
4326    cat <<EOM
4327
4328 Perl can be built to understand large files (files larger than 2 gigabytes)
4329 on some systems.  To do so, Configure can be run with -Duselargefiles.
4330
4331 If this doesn't make any sense to you, just accept the default '$dflt'.
4332 EOM
4333    rp='Try to understand large files, if available?'
4334    . ./myread
4335    case "$ans" in
4336    y|Y)         val="$define" ;;
4337    *)           val="$undef"  ;;
4338    esac
4339    ;;
4340 esac
4341 set uselargefiles
4342 eval $setvar
4343 case "$uselargefiles" in
4344 "$define")
4345 : Look for a hint-file generated 'call-back-unit'.  If the
4346 : user has specified that a large files perl is to be built,
4347 : we may need to set or change some other defaults.
4348         if $test -f uselargefiles.cbu; then
4349                 echo "Your platform has some specific hints for large file builds, using them..."
4350                 . ./uselargefiles.cbu
4351                 echo " "
4352                 echo "Rechecking to see how big your file offsets are..." >&4
4353                 $cat >try.c <<EOCP
4354 #include <sys/types.h>
4355 #include <stdio.h>
4356 int main()
4357 {
4358     printf("%d\n", (int)sizeof($lseektype));
4359     return(0); 
4360 }
4361 EOCP
4362                 set try
4363                 if eval $compile_ok; then
4364                         lseeksize=`./try`
4365                         $echo "Your file offsets are now $lseeksize bytes long."
4366                 else
4367                         dflt="$lseeksize"
4368                         echo " "
4369                         echo "(I can't seem to compile the test program.  Guessing...)"
4370                         rp="What is the size of your file offsets (in bytes)?"
4371                         . ./myread
4372                         lseeksize="$ans"
4373                 fi
4374                 case "$fpostype" in
4375                 *_t) zzz="$fpostype"    ;;
4376                 *)   zzz="fpos_t"       ;;
4377                 esac
4378                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4379                 $cat > try.c <<EOCP
4380 #include <sys/types.h>
4381 #include <stdio.h>
4382 int main() {
4383     printf("%d\n", (int)sizeof($fpostype));
4384     exit(0);
4385 }
4386 EOCP
4387                 set try
4388                 if eval $compile_ok; then
4389                         yyy=`./try`
4390                         dflt="$lseeksize"
4391                         case "$yyy" in
4392                         '')     echo " "
4393                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4394                                 ;;
4395                         *)      fpossize=$yyy
4396                                 echo " $fpossize bytes." >&4
4397                                 ;;
4398                         esac
4399                 else
4400                         dflt="$fpossize"
4401                         echo " "
4402                         echo "(I can't compile the test program.  Guessing...)" >&4
4403                         rp="What is the size of your file positions (in bytes)?"
4404                         . ./myread
4405                         fpossize="$ans"
4406                 fi
4407                 $rm -f try.c try
4408         fi
4409         ;;
4410 esac
4411
4412
4413 case "$usemorebits" in
4414 "$define"|true|[yY]*)
4415         use64bitint="$define"
4416         uselongdouble="$define"
4417         usemorebits="$define"
4418         ;;
4419 *)      usemorebits="$undef"
4420         ;;
4421 esac
4422
4423
4424 case "$uselonglong" in
4425 "$define"|true|[yY]*)
4426         cat <<EOM >&4
4427
4428 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4429 EOM
4430         use64bitint="$define"
4431         ;;
4432 esac                          
4433 case "$use64bits" in
4434 "$define"|true|[yY]*)
4435         cat <<EOM >&4
4436
4437 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4438 EOM
4439         use64bitint="$define"
4440         ;;
4441 esac                          
4442 case "$use64bitints" in
4443 "$define"|true|[yY]*)
4444         cat <<EOM >&4
4445
4446 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4447 EOM
4448         use64bitint="$define"
4449         ;;
4450 esac                          
4451 case "$use64bitsint" in
4452 "$define"|true|[yY]*)
4453         cat <<EOM >&4
4454
4455 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4456 EOM
4457         use64bitint="$define"
4458         ;;
4459 esac                          
4460 case "$uselonglongs" in
4461 "$define"|true|[yY]*)
4462         cat <<EOM >&4
4463
4464 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4465 EOM
4466         use64bitint="$define"
4467         ;;
4468 esac                          
4469 case "$use64bitsall" in
4470 "$define"|true|[yY]*)
4471         cat <<EOM >&4
4472
4473 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4474 EOM
4475         use64bitall="$define"
4476         ;;
4477 esac                          
4478
4479 case "$ccflags" in
4480 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4481 esac
4482 case "$use64bitall" in
4483 "$define"|true|[yY]*) use64bitint="$define" ;;
4484 esac
4485
4486 case "$longsize" in
4487 8) cat <<EOM
4488
4489 You have natively 64-bit long integers.
4490 EOM
4491    val="$define"
4492    ;;
4493 *) case "$use64bitint" in
4494    "$define"|true|[yY]*) dflt='y';;
4495    *) dflt='n';;
4496    esac
4497    cat <<EOM
4498
4499 Perl can be built to take advantage of 64-bit integer types
4500 on some systems.  To do so, Configure can be run with -Duse64bitint.
4501 Choosing this option will most probably introduce binary incompatibilities.
4502
4503 If this doesn't make any sense to you, just accept the default '$dflt'.
4504 EOM
4505    rp='Try to use 64-bit integers, if available?'
4506    . ./myread
4507    case "$ans" in
4508    [yY]*) val="$define" ;;
4509    *)     val="$undef"  ;;
4510    esac
4511    ;;
4512 esac
4513 set use64bitint
4514 eval $setvar
4515
4516 case "$use64bitall" in
4517 "$define"|true|[yY]*) dflt='y' ;;
4518 *) case "$longsize" in
4519    8) dflt='y' ;;
4520    *) dflt='n' ;;
4521    esac
4522    ;;
4523 esac    
4524 cat <<EOM
4525
4526 You may also choose to try maximal 64-bitness.  It means using as much
4527 64-bitness as possible on the platform.  This in turn means even more
4528 binary incompatibilities.  On the other hand, your platform may not
4529 have any more 64-bitness available than what you already have chosen.
4530
4531 If this doesn't make any sense to you, just accept the default '$dflt'.
4532 EOM
4533 rp='Try to use maximal 64-bit support, if available?'
4534 . ./myread
4535 case "$ans" in
4536 [yY]*) val="$define" ;;
4537 *)     val="$undef"  ;;
4538 esac
4539 set use64bitall
4540 eval $setvar
4541 case "$use64bitall" in
4542 "$define")
4543         case "$use64bitint" in
4544         "$undef")
4545                 cat <<EOM
4546
4547 Since you have chosen a maximally 64-bit build, I'm also turning on
4548 the use of 64-bit integers.
4549 EOM
4550                 use64bitint="$define" ;;
4551         esac
4552         ;;
4553 esac
4554
4555 case "$use64bitint" in
4556 "$define"|true|[yY]*)
4557 : Look for a hint-file generated 'call-back-unit'.  If the
4558 : user has specified that a 64-bit perl is to be built,
4559 : we may need to set or change some other defaults.
4560         if $test -f use64bitint.cbu; then
4561                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4562                 . ./use64bitint.cbu
4563         fi
4564         case "$longsize" in
4565         4) case "$archname64" in
4566            '') archname64=64int ;;
4567            esac
4568            ;;
4569         esac
4570         ;;
4571 esac
4572
4573 case "$use64bitall" in
4574 "$define"|true|[yY]*)
4575 : Look for a hint-file generated 'call-back-unit'.  If the
4576 : user has specified that a maximally 64-bit perl is to be built,
4577 : we may need to set or change some other defaults.
4578         if $test -f use64bitall.cbu; then
4579                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4580                 . ./use64bitall.cbu
4581         fi
4582         case "$longsize" in
4583         4) case "$archname64" in
4584            ''|64int) archname64=64all ;;
4585            esac
4586            ;;
4587         esac
4588         ;;
4589 esac
4590
4591 : determine the architecture name
4592 echo " "
4593 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4594         tarch=`arch`"-$osname"
4595 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4596         if uname -m > tmparch 2>&1 ; then
4597                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4598                         -e 's/$/'"-$osname/" tmparch`
4599         else
4600                 tarch="$osname"
4601         fi
4602         $rm -f tmparch
4603 else
4604         tarch="$osname"
4605 fi
4606 case "$myarchname" in
4607 ''|"$tarch") ;;
4608 *)
4609         echo "(Your architecture name used to be $myarchname.)"
4610         archname=''
4611         ;;
4612 esac
4613 myarchname="$tarch"
4614 case "$archname" in
4615 '') dflt="$tarch";;
4616 *) dflt="$archname";;
4617 esac
4618 rp='What is your architecture name'
4619 . ./myread
4620 archname="$ans"
4621 case "$usethreads" in
4622 $define)
4623         echo "Threads selected." >&4
4624         case "$archname" in
4625         *-thread*) echo "...and architecture name already has -thread." >&4
4626                 ;;
4627         *)      archname="$archname-thread"
4628                 echo "...setting architecture name to $archname." >&4
4629                 ;;
4630         esac
4631         ;;
4632 esac
4633 case "$usemultiplicity" in
4634 $define)
4635         echo "Multiplicity selected." >&4
4636         case "$archname" in
4637         *-multi*) echo "...and architecture name already has -multi." >&4
4638                 ;;
4639         *)      archname="$archname-multi"
4640                 echo "...setting architecture name to $archname." >&4
4641                 ;;
4642         esac
4643         ;;
4644 esac
4645 case "$use64bitint" in
4646 $define)
4647         case "$archname64" in
4648         '')
4649                 ;;
4650         *)
4651                 case "$archname" in
4652                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4653                         ;;
4654                 *)      archname="$archname-$archname64"
4655                         echo "...setting architecture name to $archname." >&4
4656                         ;;
4657                 esac
4658                 ;;
4659         esac
4660 esac
4661
4662 : determine root of directory hierarchy where package will be installed.
4663 case "$prefix" in
4664 '')
4665         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4666         ;;
4667 *)
4668         dflt="$prefix"
4669         ;;
4670 esac
4671 $cat <<EOM
4672
4673 By default, $package will be installed in $dflt/bin, manual pages
4674 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4675 installation directories. Typically this is something like /usr/local.
4676 If you wish to have binaries under /usr/bin but other parts of the
4677 installation under /usr/local, that's ok: you will be prompted
4678 separately for each of the installation directories, the prefix being
4679 only used to set the defaults.
4680
4681 EOM
4682 fn=d~
4683 rp='Installation prefix to use?'
4684 . ./getfile
4685 oldprefix=''
4686 case "$prefix" in
4687 '') ;;
4688 *)
4689         case "$ans" in
4690         "$prefix") ;;
4691         *) oldprefix="$prefix";;
4692         esac
4693         ;;
4694 esac
4695 prefix="$ans"
4696 prefixexp="$ansexp"
4697
4698 : is AFS running?
4699 echo " "
4700 case "$afs" in
4701 $define|true)   afs=true ;;
4702 $undef|false)   afs=false ;;
4703 *)      if test -d /afs; then
4704                 afs=true
4705         else
4706                 afs=false
4707         fi
4708         ;;
4709 esac
4710 if $afs; then
4711         echo "AFS may be running... I'll be extra cautious then..." >&4
4712 else
4713         echo "AFS does not seem to be running..." >&4
4714 fi
4715
4716 : determine installation prefix for where package is to be installed.
4717 if $afs; then 
4718 $cat <<EOM
4719
4720 Since you are running AFS, I need to distinguish the directory in which
4721 files will reside from the directory in which they are installed (and from
4722 which they are presumably copied to the former directory by occult means).
4723
4724 EOM
4725         case "$installprefix" in
4726         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4727         *) dflt="$installprefix";;
4728         esac
4729 else
4730 $cat <<EOM
4731
4732 In some special cases, particularly when building $package for distribution,
4733 it is convenient to distinguish between the directory in which files should 
4734 be installed from the directory ($prefix) in which they 
4735 will eventually reside.  For most users, these two directories are the same.
4736
4737 EOM
4738         case "$installprefix" in
4739         '') dflt=$prefix ;;
4740         *) dflt=$installprefix;;
4741         esac
4742 fi
4743 fn=d~
4744 rp='What installation prefix should I use for installing files?'
4745 . ./getfile
4746 installprefix="$ans"
4747 installprefixexp="$ansexp"
4748
4749 : set the prefixit variable, to compute a suitable default value
4750 prefixit='case "$3" in
4751 ""|none)
4752         case "$oldprefix" in
4753         "") eval "$1=\"\$$2\"";;
4754         *)
4755                 case "$3" in
4756                 "") eval "$1=";;
4757                 none)
4758                         eval "tp=\"\$$2\"";
4759                         case "$tp" in
4760                         ""|" ") eval "$1=\"\$$2\"";;
4761                         *) eval "$1=";;
4762                         esac;;
4763                 esac;;
4764         esac;;
4765 *)
4766         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4767         case "$tp" in
4768         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4769         /*-$oldprefix/*|\~*-$oldprefix/*)
4770                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4771         *) eval "$1=\"\$$2\"";;
4772         esac;;
4773 esac'
4774
4775
4776 : get the patchlevel
4777 echo " "
4778 echo "Getting the current patchlevel..." >&4
4779 if $test -r $rsrc/patchlevel.h;then
4780         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4781         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4782         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4783         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4784         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4785         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4786 else
4787         revision=0
4788         patchlevel=0
4789         subversion=0
4790         api_revision=0
4791         api_version=0
4792         api_subversion=0
4793 fi
4794 $echo $n "(You have $package revision $revision" $c
4795 $echo $n " patchlevel $patchlevel" $c
4796 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4797 echo ".)"
4798 case "$osname" in
4799 dos|vms)
4800         : XXX Should be a Configure test for double-dots in filenames.
4801         version=`echo $revision $patchlevel $subversion | \
4802                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4803         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4804                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4805         ;;
4806 *)
4807         version=`echo $revision $patchlevel $subversion | \
4808                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4809         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4810                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4811         ;;
4812 esac
4813 : Special case the 5.005_xx maintenance series, which used 5.005
4814 : without any subversion label as a subdirectory in $sitelib
4815 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4816         api_versionstring='5.005'
4817 fi
4818
4819 : determine installation style
4820 : For now, try to deduce it from prefix unless it is already set.
4821 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4822 case "$installstyle" in
4823 '')     case "$prefix" in
4824                 *perl*) dflt='lib';;
4825                 *) dflt='lib/perl5' ;;
4826         esac
4827         ;;
4828 *)      dflt="$installstyle" ;;
4829 esac
4830 : Probably not worth prompting for this since we prompt for all
4831 : the directories individually, and the prompt would be too long and
4832 : confusing anyway.
4833 installstyle=$dflt
4834
4835 : determine where private library files go
4836 : Usual default is /usr/local/lib/perl5/$version.
4837 : Also allow things like /opt/perl/lib/$version, since 
4838 : /opt/perl/lib/perl5... would be redundant.
4839 : The default "style" setting is made in installstyle.U
4840 case "$installstyle" in
4841 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4842 *)       set dflt privlib lib/$version ;;
4843 esac
4844 eval $prefixit
4845 $cat <<EOM
4846
4847 There are some auxiliary files for $package that need to be put into a
4848 private library directory that is accessible by everyone.
4849
4850 EOM
4851 fn=d~+
4852 rp='Pathname where the private library files will reside?'
4853 . ./getfile
4854 privlib="$ans"
4855 privlibexp="$ansexp"
4856 : Change installation prefix, if necessary.
4857 if $test X"$prefix" != X"$installprefix"; then
4858         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4859 else
4860         installprivlib="$privlibexp"
4861 fi
4862
4863 : set the prefixup variable, to restore leading tilda escape
4864 prefixup='case "$prefixexp" in
4865 "$prefix") ;;
4866 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4867 esac'
4868
4869 : determine where public architecture dependent libraries go
4870 set archlib archlib
4871 eval $prefixit
4872 : privlib default is /usr/local/lib/$package/$version
4873 : archlib default is /usr/local/lib/$package/$version/$archname
4874 : privlib may have an optional trailing /share.
4875 tdflt=`echo $privlib | $sed 's,/share$,,'`
4876 tdflt=$tdflt/$archname
4877 case "$archlib" in
4878 '')     dflt=$tdflt
4879         ;;
4880 *)      dflt="$archlib"
4881     ;;
4882 esac
4883 $cat <<EOM
4884
4885 $spackage contains architecture-dependent library files.  If you are
4886 sharing libraries in a heterogeneous environment, you might store
4887 these files in a separate location.  Otherwise, you can just include
4888 them with the rest of the public library files.
4889
4890 EOM
4891 fn=d+~
4892 rp='Where do you want to put the public architecture-dependent libraries?'
4893 . ./getfile
4894 archlib="$ans"
4895 archlibexp="$ansexp"
4896 if $test X"$archlib" = X"$privlib"; then
4897         d_archlib="$undef"
4898 else
4899         d_archlib="$define"
4900 fi
4901 : Change installation prefix, if necessary.
4902 if $test X"$prefix" != X"$installprefix"; then
4903         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4904 else
4905         installarchlib="$archlibexp"
4906 fi
4907
4908
4909 : Binary compatibility with 5.005 is not possible for builds
4910 : with advanced features
4911 case "$usethreads$usemultiplicity" in
4912 *define*)
4913         bincompat5005="$undef"
4914         d_bincompat5005="$undef"
4915         ;;
4916 *)      $cat <<EOM
4917
4918 This version of Perl can be compiled for binary compatibility with 5.005.
4919 If you decide to do so, you will be able to continue using most of the
4920 extensions that were compiled for Perl 5.005.
4921
4922 EOM
4923         case "$bincompat5005$d_bincompat5005" in
4924         *"$undef"*) dflt=n ;;
4925         *) dflt=y ;;
4926         esac
4927         rp='Binary compatibility with Perl 5.005?'
4928         . ./myread
4929         case "$ans" in
4930         y*) val="$define" ;;
4931         *)  val="$undef" ;;
4932         esac
4933         set d_bincompat5005
4934         eval $setvar
4935         case "$d_bincompat5005" in
4936         "$define")
4937                 bincompat5005="$define"
4938                 ;;
4939         *)      bincompat5005="$undef"
4940                 d_bincompat5005="$undef"
4941                 ;;
4942         esac
4943         ;;
4944 esac
4945
4946
4947 : see if setuid scripts can be secure
4948 $cat <<EOM
4949
4950 Some kernels have a bug that prevents setuid #! scripts from being
4951 secure.  Some sites have disabled setuid #! scripts because of this.
4952
4953 First let's decide if your kernel supports secure setuid #! scripts.
4954 (If setuid #! scripts would be secure but have been disabled anyway,
4955 don't say that they are secure if asked.)
4956
4957 EOM
4958
4959 val="$undef"
4960 if $test -d /dev/fd; then
4961         echo "#!$ls" >reflect
4962         chmod +x,u+s reflect
4963         ./reflect >flect 2>&1
4964         if $contains "/dev/fd" flect >/dev/null; then
4965                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4966                 val="$define"
4967         else
4968                 $cat <<EOM
4969 If you are not sure if they are secure, I can check but I'll need a
4970 username and password different from the one you are using right now.
4971 If you don't have such a username or don't want me to test, simply
4972 enter 'none'.
4973
4974 EOM
4975                 rp='Other username to test security of setuid scripts with?'
4976                 dflt='none'
4977                 . ./myread
4978                 case "$ans" in
4979                 n|none)
4980                         case "$d_suidsafe" in
4981                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4982                                 dflt=n;;
4983                         "$undef")
4984                                 echo "Well, the $hint value is *not* secure." >&4
4985                                 dflt=n;;
4986                         *)      echo "Well, the $hint value *is* secure." >&4
4987                                 dflt=y;;
4988                         esac
4989                         ;;
4990                 *)
4991                         $rm -f reflect flect
4992                         echo "#!$ls" >reflect
4993                         chmod +x,u+s reflect
4994                         echo >flect
4995                         chmod a+w flect
4996                         echo '"su" will (probably) prompt you for '"$ans's password."
4997                         su $ans -c './reflect >flect'
4998                         if $contains "/dev/fd" flect >/dev/null; then
4999                                 echo "Okay, it looks like setuid scripts are secure." >&4
5000                                 dflt=y
5001                         else
5002                                 echo "I don't think setuid scripts are secure." >&4
5003                                 dflt=n
5004                         fi
5005                         ;;
5006                 esac
5007                 rp='Does your kernel have *secure* setuid scripts?'
5008                 . ./myread
5009                 case "$ans" in
5010                 [yY]*)  val="$define";;
5011                 *)      val="$undef";;
5012                 esac
5013         fi
5014 else
5015         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5016         echo "(That's for file descriptors, not floppy disks.)"
5017         val="$undef"
5018 fi
5019 set d_suidsafe
5020 eval $setvar
5021
5022 $rm -f reflect flect
5023
5024 : now see if they want to do setuid emulation
5025 echo " "
5026 val="$undef"
5027 case "$d_suidsafe" in
5028 "$define")
5029         val="$undef"
5030         echo "No need to emulate SUID scripts since they are secure here." >& 4
5031         ;;
5032 *)
5033         $cat <<EOM
5034 Some systems have disabled setuid scripts, especially systems where
5035 setuid scripts cannot be secure.  On systems where setuid scripts have
5036 been disabled, the setuid/setgid bits on scripts are currently
5037 useless.  It is possible for $package to detect those bits and emulate
5038 setuid/setgid in a secure fashion.  This emulation will only work if
5039 setuid scripts have been disabled in your kernel.
5040
5041 EOM
5042         case "$d_dosuid" in
5043         "$define") dflt=y ;;
5044         *) dflt=n ;;
5045         esac
5046         rp="Do you want to do setuid/setgid emulation?"
5047         . ./myread
5048         case "$ans" in
5049         [yY]*)  val="$define";;
5050         *)      val="$undef";;
5051         esac
5052         ;;
5053 esac
5054 set d_dosuid
5055 eval $setvar
5056
5057 : determine filename position in cpp output
5058 echo " "
5059 echo "Computing filename position in cpp output for #include directives..." >&4
5060 echo '#include <stdio.h>' > foo.c
5061 $cat >fieldn <<EOF
5062 $startsh
5063 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5064 $grep '^[       ]*#.*stdio\.h' | \
5065 while read cline; do
5066         pos=1
5067         set \$cline
5068         while $test \$# -gt 0; do
5069                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5070                         echo "\$pos"
5071                         exit 0
5072                 fi
5073                 shift
5074                 pos=\`expr \$pos + 1\`
5075         done
5076 done
5077 EOF
5078 chmod +x fieldn
5079 fieldn=`./fieldn`
5080 $rm -f foo.c fieldn
5081 case $fieldn in
5082 '') pos='???';;
5083 1) pos=first;;
5084 2) pos=second;;
5085 3) pos=third;;
5086 *) pos="${fieldn}th";;
5087 esac
5088 echo "Your cpp writes the filename in the $pos field of the line."
5089
5090 : locate header file
5091 $cat >findhdr <<EOF
5092 $startsh
5093 wanted=\$1
5094 name=''
5095 for usrincdir in $usrinc
5096 do
5097         if test -f \$usrincdir/\$wanted; then
5098                 echo "\$usrincdir/\$wanted"
5099                 exit 0
5100         fi
5101 done
5102 awkprg='{ print \$$fieldn }'
5103 echo "#include <\$wanted>" > foo\$\$.c
5104 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5105 $grep "^[       ]*#.*\$wanted" | \
5106 while read cline; do
5107         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5108         case "\$name" in
5109         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5110         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5111         *) exit 2;;
5112         esac;
5113 done;
5114 #
5115 # status = 0: grep returned 0 lines, case statement not executed
5116 # status = 1: headerfile found
5117 # status = 2: while loop executed, no headerfile found
5118 #
5119 status=\$?
5120 $rm -f foo\$\$.c;
5121 if test \$status -eq 1; then
5122         exit 0;
5123 fi
5124 exit 1
5125 EOF
5126 chmod +x findhdr
5127
5128 : define an alternate in-header-list? function
5129 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5130 cont=true; xxf="echo \"<\$1> found.\" >&4";
5131 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5132 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5133 esac;
5134 case $# in 4) instead=instead;; *) instead="at last";; esac;
5135 while $test "$cont"; do
5136         xxx=`./findhdr $1`
5137         var=$2; eval "was=\$$2";
5138         if $test "$xxx" && $test -r "$xxx";
5139         then eval $xxf;
5140         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5141                 cont="";
5142         else eval $xxnf;
5143         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5144         set $yyy; shift; shift; yyy=$@;
5145         case $# in 0) cont="";;
5146         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5147                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5148         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5149                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5150         esac;
5151 done;
5152 while $test "$yyy";
5153 do set $yyy; var=$2; eval "was=\$$2";
5154         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5155         set $yyy; shift; shift; yyy=$@;
5156 done'
5157
5158 : see if this is a malloc.h system
5159 set malloc.h i_malloc
5160 eval $inhdr
5161
5162 : see if stdlib is available
5163 set stdlib.h i_stdlib
5164 eval $inhdr
5165
5166 : determine which malloc to compile in
5167 echo " "
5168 case "$usemymalloc" in
5169 ''|[yY]*|true|$define)  dflt='y' ;;
5170 *)      dflt='n' ;;
5171 esac
5172 rp="Do you wish to attempt to use the malloc that comes with $package?"
5173 . ./myread
5174 usemymalloc="$ans"
5175 case "$ans" in
5176 y*|true)
5177         usemymalloc='y'
5178         mallocsrc='malloc.c'
5179         mallocobj="malloc$_o"
5180         d_mymalloc="$define"
5181         case "$libs" in
5182         *-lmalloc*)
5183                 : Remove malloc from list of libraries to use
5184                 echo "Removing unneeded -lmalloc from library list" >&4
5185                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5186                 shift
5187                 libs="$*"
5188                 echo "libs = $libs" >&4
5189                 ;;
5190         esac
5191         ;;
5192 *)
5193         usemymalloc='n'
5194         mallocsrc=''
5195         mallocobj=''
5196         d_mymalloc="$undef"
5197         ;;
5198 esac
5199
5200 : compute the return types of malloc and free
5201 echo " "
5202 $cat >malloc.c <<END
5203 #$i_malloc I_MALLOC
5204 #$i_stdlib I_STDLIB
5205 #include <stdio.h>
5206 #include <sys/types.h>
5207 #ifdef I_MALLOC
5208 #include <malloc.h>
5209 #endif
5210 #ifdef I_STDLIB
5211 #include <stdlib.h>
5212 #endif
5213 #ifdef TRY_MALLOC
5214 void *malloc();
5215 #endif
5216 #ifdef TRY_FREE
5217 void free();
5218 #endif
5219 END
5220 case "$malloctype" in
5221 '')
5222         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5223                 malloctype='void *'
5224         else
5225                 malloctype='char *'
5226         fi
5227         ;;
5228 esac
5229 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5230
5231 case "$freetype" in
5232 '')
5233         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5234                 freetype='void'
5235         else
5236                 freetype='int'
5237         fi
5238         ;;
5239 esac
5240 echo "Your system uses $freetype free(), it would seem." >&4
5241 $rm -f malloc.[co]
5242 $cat <<EOM
5243
5244 The installation process will also create a directory for
5245 vendor-supplied add-ons.  Vendors who supply perl with their system
5246 may find it convenient to place all vendor-supplied files in this
5247 directory rather than in the main distribution directory.  This will
5248 ease upgrades between binary-compatible maintenance versions of perl.
5249
5250 Of course you may also use these directories in whatever way you see
5251 fit.  For example, you might use them to access modules shared over a
5252 company-wide network.
5253
5254 The default answer should be fine for most people.
5255 This causes further questions about vendor add-ons to be skipped
5256 and no vendor-specific directories will be configured for perl.
5257
5258 EOM
5259 rp='Do you want to configure vendor-specific add-on directories?'
5260 case "$usevendorprefix" in
5261 define|true|[yY]*) dflt=y ;;
5262 *)      : User may have set vendorprefix directly on Configure command line.
5263         case "$vendorprefix" in
5264         ''|' ') dflt=n ;;
5265         *)      dflt=y ;;
5266         esac
5267         ;;
5268 esac
5269 . ./myread
5270 case "$ans" in
5271 [yY]*)  fn=d~+
5272         rp='Installation prefix to use for vendor-supplied add-ons?'
5273         case "$vendorprefix" in
5274         '') dflt='' ;;
5275         *)  dflt=$vendorprefix ;;
5276         esac
5277         . ./getfile
5278         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5279         oldvendorprefix=''
5280         case "$vendorprefix" in
5281         '') ;;
5282         *)      case "$ans" in
5283                 "$prefix") ;;
5284                 *) oldvendorprefix="$prefix";;
5285                 esac
5286                 ;;
5287         esac
5288         usevendorprefix="$define"
5289         vendorprefix="$ans"
5290         vendorprefixexp="$ansexp"
5291         ;;
5292 *)      usevendorprefix="$undef"
5293         vendorprefix=''
5294         vendorprefixexp=''
5295         ;;
5296 esac
5297
5298 case "$vendorprefix" in
5299 '')     d_vendorlib="$undef"
5300         vendorlib=''
5301         vendorlibexp=''
5302         ;;
5303 *)      d_vendorlib="$define"
5304         : determine where vendor-supplied modules go.
5305         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5306         case "$vendorlib" in
5307         '')
5308                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5309                 case "$installstyle" in
5310                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5311                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5312                 esac
5313                 ;;
5314         *)      dflt="$vendorlib"
5315                 ;;
5316         esac
5317         fn=d~+
5318         rp='Pathname for the vendor-supplied library files?'
5319         . ./getfile
5320         vendorlib="$ans"
5321         vendorlibexp="$ansexp"
5322         ;;
5323 esac
5324 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5325 : Change installation prefix, if necessary.
5326 if $test X"$prefix" != X"$installprefix"; then
5327         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5328 else
5329         installvendorlib="$vendorlibexp"
5330 fi
5331
5332 case "$vendorprefix" in
5333 '')     d_vendorarch="$undef"
5334         vendorarch=''
5335         vendorarchexp=''
5336         ;;
5337 *)      d_vendorarch="$define"
5338         : determine where vendor-supplied architecture-dependent libraries go.
5339         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5340         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5341         : vendorlib may have an optional trailing /share.
5342         case "$vendorarch" in
5343         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5344                 dflt="$dflt/$archname"
5345                 ;;
5346         *)      dflt="$vendorarch" ;;
5347         esac
5348         fn=d~+
5349         rp='Pathname for vendor-supplied architecture-dependent files?'
5350         . ./getfile
5351         vendorarch="$ans"
5352         vendorarchexp="$ansexp"
5353         ;;
5354 esac
5355 : Change installation prefix, if necessary.
5356 if $test X"$prefix" != X"$installprefix"; then
5357         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5358 else
5359         installvendorarch="$vendorarchexp"
5360 fi
5361
5362 : Cruising for prototypes
5363 echo " "
5364 echo "Checking out function prototypes..." >&4
5365 $cat >prototype.c <<'EOCP'
5366 int main(int argc, char *argv[]) {
5367         exit(0);}
5368 EOCP
5369 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5370         echo "Your C compiler appears to support function prototypes."
5371         val="$define"
5372 else
5373         echo "Your C compiler doesn't seem to understand function prototypes."
5374         val="$undef"
5375 fi
5376 set prototype
5377 eval $setvar
5378 $rm -f prototype*
5379
5380 case "$prototype" in
5381 "$define") ;;
5382 *)      ansi2knr='ansi2knr'
5383         echo " "
5384         cat <<EOM >&4
5385
5386 $me:  FATAL ERROR:
5387 This version of $package can only be compiled by a compiler that 
5388 understands function prototypes.  Unfortunately, your C compiler 
5389         $cc $ccflags
5390 doesn't seem to understand them.  Sorry about that.
5391
5392 If GNU cc is available for your system, perhaps you could try that instead.  
5393
5394 Eventually, we hope to support building Perl with pre-ANSI compilers.
5395 If you would like to help in that effort, please contact <perlbug@perl.org>.
5396
5397 Aborting Configure now.
5398 EOM
5399         exit 2
5400         ;;
5401 esac
5402
5403 : determine where public executables go
5404 echo " "
5405 set dflt bin bin
5406 eval $prefixit
5407 fn=d~
5408 rp='Pathname where the public executables will reside?'
5409 . ./getfile
5410 if $test "X$ansexp" != "X$binexp"; then
5411         installbin=''
5412 fi
5413 bin="$ans"
5414 binexp="$ansexp"
5415 : Change installation prefix, if necessary.
5416 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5417 if $test X"$prefix" != X"$installprefix"; then
5418         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5419 else
5420         installbin="$binexp"
5421 fi
5422
5423 : Find perl5.005 or later.
5424 echo "Looking for a previously installed perl5.005 or later... "
5425 case "$perl5" in
5426 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5427                 : Check if this perl is recent and can load a simple module
5428                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5429                         perl5=$tdir/perl
5430                         break;
5431                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5432                         perl5=$tdir/perl
5433                         break;
5434                 fi
5435         done
5436         ;;
5437 *)      perl5="$perl5"
5438         ;;
5439 esac
5440 case "$perl5" in
5441 '')     echo "None found.  That's ok.";;
5442 *)      echo "Using $perl5." ;;
5443 esac
5444
5445 $cat <<EOM
5446
5447 After $package is installed, you may wish to install various
5448 add-on modules and utilities.  Typically, these add-ons will
5449 be installed under $prefix with the rest
5450 of this package.  However, you may wish to install such add-ons
5451 elsewhere under a different prefix.
5452
5453 If you do not wish to put everything under a single prefix, that's
5454 ok.  You will be prompted for the individual locations; this siteprefix
5455 is only used to suggest the defaults.
5456
5457 The default should be fine for most people.
5458
5459 EOM
5460 fn=d~+
5461 rp='Installation prefix to use for add-on modules and utilities?'
5462 : XXX Here might be another good place for an installstyle setting.
5463 case "$siteprefix" in
5464 '') dflt=$prefix ;;
5465 *)  dflt=$siteprefix ;;
5466 esac
5467 . ./getfile
5468 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5469 oldsiteprefix=''
5470 case "$siteprefix" in
5471 '') ;;
5472 *)      case "$ans" in
5473         "$prefix") ;;
5474         *) oldsiteprefix="$prefix";;
5475         esac
5476         ;;
5477 esac
5478 siteprefix="$ans"
5479 siteprefixexp="$ansexp"
5480
5481 : determine where site specific libraries go.
5482 : Usual default is /usr/local/lib/perl5/site_perl/$version
5483 : The default "style" setting is made in installstyle.U
5484 : XXX No longer works with Prefixit stuff.
5485 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5486 case "$sitelib" in
5487 '') case "$installstyle" in
5488         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5489         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5490         esac
5491         ;;
5492 *)      dflt="$sitelib"
5493         ;;
5494 esac
5495 $cat <<EOM
5496
5497 The installation process will create a directory for
5498 site-specific extensions and modules.  Most users find it convenient
5499 to place all site-specific files in this directory rather than in the
5500 main distribution directory.
5501
5502 EOM
5503 fn=d~+
5504 rp='Pathname for the site-specific library files?'
5505 . ./getfile
5506 sitelib="$ans"
5507 sitelibexp="$ansexp"
5508 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5509 : Change installation prefix, if necessary.
5510 if $test X"$prefix" != X"$installprefix"; then
5511         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5512 else
5513         installsitelib="$sitelibexp"
5514 fi
5515
5516 : Determine list of previous versions to include in @INC
5517 $cat > getverlist <<EOPL
5518 #!$perl5 -w
5519 use File::Basename;
5520 \$api_versionstring = "$api_versionstring";
5521 \$version = "$version";
5522 \$sitelib = "$sitelib";
5523 \$archname = "$archname";
5524 EOPL
5525         $cat >> getverlist <<'EOPL'
5526 # Can't have leading @ because metaconfig interprets it as a command!
5527 ;@inc_version_list=();
5528 $stem=dirname($sitelib);
5529 # XXX Redo to do opendir/readdir? 
5530 if (-d $stem) {
5531     chdir($stem);
5532     ;@candidates = glob("5.*");
5533 }
5534 else {
5535     ;@candidates = ();
5536 }
5537
5538 # XXX ToDo:  These comparisons must be reworked when two-digit
5539 # subversions come along, so that 5.7.10 compares as greater than
5540 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5541 # widespread that we can use the built-in version vectors rather
5542 # than reinventing them here.  For 5.6.0, however, we must
5543 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5544 foreach $d (@candidates) {
5545     if ($d lt $version) {
5546         if ($d ge $api_versionstring) {
5547             unshift(@inc_version_list, "$d/$archname", $d);
5548         }
5549         elsif ($d ge "5.005") {
5550             unshift(@inc_version_list, $d);
5551         }
5552     }
5553     else {
5554         # Skip newer version.  I.e. don't look in
5555         # 5.7.0 if we're installing 5.6.1.
5556     }
5557 }
5558
5559 if (@inc_version_list) {
5560     print join(' ', @inc_version_list);
5561 }
5562 else {
5563     # Blank space to preserve value for next Configure run.
5564     print " ";
5565 }
5566 EOPL
5567 chmod +x getverlist
5568 case "$inc_version_list" in
5569 '')     if test -x "$perl5"; then
5570                 dflt=`$perl5 getverlist`
5571         else
5572                 dflt='none'
5573         fi
5574         ;;
5575 $undef) dflt='none' ;;
5576 *)  dflt="$inc_version_list" ;;
5577 esac
5578 case "$dflt" in
5579 ''|' ') dflt=none ;;
5580 esac
5581 $cat <<'EOM'
5582
5583 In order to ease the process of upgrading, this version of perl 
5584 can be configured to use modules built and installed with earlier 
5585 versions of perl that were installed under $prefix.  Specify here
5586 the list of earlier versions that this version of perl should check.
5587 If Configure detected no earlier versions of perl installed under
5588 $prefix, then the list will be empty.  Answer 'none' to tell perl
5589 to not search earlier versions.
5590
5591 The default should almost always be sensible, so if you're not sure,
5592 just accept the default.
5593 EOM
5594
5595 rp='List of earlier versions to include in @INC?'
5596 . ./myread
5597 case "$ans" in
5598 [Nn]one|''|' ') inc_version_list=' ' ;;
5599 *) inc_version_list="$ans" ;;
5600 esac
5601 case "$inc_version_list" in
5602 ''|' ') 
5603         inc_version_list_init='0';;
5604 *)      inc_version_list_init=`echo $inc_version_list |
5605                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5606         ;;
5607 esac
5608 $rm -f getverlist
5609
5610 : determine whether to install perl also as /usr/bin/perl
5611
5612 echo " "
5613 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5614         $cat <<EOM
5615 Many scripts expect perl to be installed as /usr/bin/perl.
5616 I can install the perl you are about to compile also as /usr/bin/perl
5617 (in addition to $installbin/perl).
5618 EOM
5619         case "$installusrbinperl" in
5620         "$undef"|[nN]*) dflt='n';;
5621         *)              dflt='y';;
5622         esac
5623         rp="Do you want to install perl as /usr/bin/perl?"
5624         . ./myread
5625         case "$ans" in
5626         [yY]*)  val="$define";;
5627         *)      val="$undef" ;;
5628         esac
5629 else
5630         val="$undef"
5631 fi
5632 set installusrbinperl
5633 eval $setvar
5634
5635 echo " "
5636 echo "Checking for GNU C Library..." >&4
5637 cat >gnulibc.c <<EOM
5638 #include <stdio.h>
5639 int main()
5640 {
5641 #ifdef __GLIBC__
5642     exit(0);
5643 #else
5644     exit(1);
5645 #endif
5646 }
5647 EOM
5648 set gnulibc
5649 if eval $compile_ok && ./gnulibc; then
5650         val="$define"
5651         echo "You are using the GNU C Library"
5652 else
5653         val="$undef"
5654         echo "You are not using the GNU C Library"
5655 fi
5656 $rm -f gnulibc*
5657 set d_gnulibc
5658 eval $setvar
5659
5660 : see if nm is to be used to determine whether a symbol is defined or not
5661 case "$usenm" in
5662 '')
5663         dflt=''
5664         case "$d_gnulibc" in
5665         "$define")
5666                 echo " "
5667                 echo "nm probably won't work on the GNU C Library." >&4
5668                 dflt=n
5669                 ;;
5670         esac
5671         case "$dflt" in
5672         '') 
5673                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5674                         echo " "
5675                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5676                         echo "'nm' won't be sufficient on this sytem." >&4
5677                         dflt=n
5678                 fi
5679                 ;;
5680         esac
5681         case "$dflt" in
5682         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5683                 if $test $dflt -gt 20; then
5684                         dflt=y
5685                 else
5686                         dflt=n
5687                 fi
5688                 ;;
5689         esac
5690         ;;
5691 *)
5692         case "$usenm" in
5693         true|$define) dflt=y;;
5694         *) dflt=n;;
5695         esac
5696         ;;
5697 esac
5698 $cat <<EOM
5699
5700 I can use $nm to extract the symbols from your C libraries. This
5701 is a time consuming task which may generate huge output on the disk (up
5702 to 3 megabytes) but that should make the symbols extraction faster. The
5703 alternative is to skip the 'nm' extraction part and to compile a small
5704 test program instead to determine whether each symbol is present. If
5705 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5706 this may be the best solution.
5707
5708 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5709
5710 EOM
5711 rp="Shall I use $nm to extract C symbols from the libraries?"
5712 . ./myread
5713 case "$ans" in
5714 [Nn]*) usenm=false;;
5715 *) usenm=true;;
5716 esac
5717
5718 runnm=$usenm
5719 case "$reuseval" in
5720 true) runnm=false;;
5721 esac
5722
5723 : nm options which may be necessary
5724 case "$nm_opt" in
5725 '') if $test -f /mach_boot; then
5726                 nm_opt=''       # Mach
5727         elif $test -d /usr/ccs/lib; then
5728                 nm_opt='-p'     # Solaris (and SunOS?)
5729         elif $test -f /dgux; then
5730                 nm_opt='-p'     # DG-UX
5731         elif $test -f /lib64/rld; then
5732                 nm_opt='-p'     # 64-bit Irix
5733         else
5734                 nm_opt=''
5735         fi;;
5736 esac
5737
5738 : nm options which may be necessary for shared libraries but illegal
5739 : for archive libraries.  Thank you, Linux.
5740 case "$nm_so_opt" in
5741 '')     case "$myuname" in
5742         *linux*)
5743                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5744                         nm_so_opt='--dynamic'
5745                 fi
5746                 ;;
5747         esac
5748         ;;
5749 esac
5750
5751 case "$runnm" in
5752 true)
5753 : get list of predefined functions in a handy place
5754 echo " "
5755 case "$libc" in
5756 '') libc=unknown
5757         case "$libs" in
5758         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5759         esac
5760         ;;
5761 esac
5762 libnames='';
5763 case "$libs" in
5764 '') ;;
5765 *)  for thislib in $libs; do
5766         case "$thislib" in
5767         -lc|-lc_s)
5768                 : Handle C library specially below.
5769                 ;;
5770         -l*)
5771                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5772                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5773                         :
5774                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5775                         :
5776                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5777                         :
5778                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5779                         :
5780                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5781                         :
5782                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5783                         :
5784                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5785                         :
5786                 else
5787                         try=''
5788                 fi
5789                 libnames="$libnames $try"
5790                 ;;
5791         *) libnames="$libnames $thislib" ;;
5792         esac
5793         done
5794         ;;
5795 esac
5796 xxx=normal
5797 case "$libc" in
5798 unknown)
5799         set /lib/libc.$so
5800         for xxx in $libpth; do
5801                 $test -r $1 || set $xxx/libc.$so
5802                 : The messy sed command sorts on library version numbers.
5803                 $test -r $1 || \
5804                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5805                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5806                                 h
5807                                 s/[0-9][0-9]*/0000&/g
5808                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5809                                 G
5810                                 s/\n/ /' | \
5811                          sort | $sed -e 's/^.* //'`
5812                 eval set \$$#
5813         done
5814         $test -r $1 || set /usr/ccs/lib/libc.$so
5815         $test -r $1 || set /lib/libsys_s$_a
5816         ;;
5817 *)
5818         set blurfl
5819         ;;
5820 esac
5821 if $test -r "$1"; then
5822         echo "Your (shared) C library seems to be in $1."
5823         libc="$1"
5824 elif $test -r /lib/libc && $test -r /lib/clib; then
5825         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5826         xxx=apollo
5827         libc='/lib/clib /lib/libc'
5828         if $test -r /lib/syslib; then
5829                 echo "(Your math library is in /lib/syslib.)"
5830                 libc="$libc /lib/syslib"
5831         fi
5832 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5833         echo "Your C library seems to be in $libc, as you said before."
5834 elif $test -r $incpath/usr/lib/libc$_a; then
5835         libc=$incpath/usr/lib/libc$_a;
5836         echo "Your C library seems to be in $libc.  That's fine."
5837 elif $test -r /lib/libc$_a; then
5838         libc=/lib/libc$_a;
5839         echo "Your C library seems to be in $libc.  You're normal."
5840 else
5841         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5842                 :
5843         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5844                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5845         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5846                 :
5847         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5848                 :
5849         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5850                 :
5851         else
5852                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5853         fi
5854         if $test -r "$tans"; then
5855                 echo "Your C library seems to be in $tans, of all places."
5856                 libc=$tans
5857         else
5858                 libc='blurfl'
5859         fi
5860 fi
5861 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5862         dflt="$libc"
5863         cat <<EOM
5864
5865 If the guess above is wrong (which it might be if you're using a strange
5866 compiler, or your machine supports multiple models), you can override it here.
5867
5868 EOM
5869 else
5870         dflt=''
5871         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5872         cat >&4 <<EOM
5873 I can't seem to find your C library.  I've looked in the following places:
5874
5875 EOM
5876         $sed 's/^/      /' libpath
5877         cat <<EOM
5878
5879 None of these seems to contain your C library. I need to get its name...
5880
5881 EOM
5882 fi
5883 fn=f
5884 rp='Where is your C library?'
5885 . ./getfile
5886 libc="$ans"
5887
5888 echo " "
5889 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5890 set X `cat libnames`
5891 shift
5892 xxx=files
5893 case $# in 1) xxx=file; esac
5894 echo "Extracting names from the following $xxx for later perusal:" >&4
5895 echo " "
5896 $sed 's/^/      /' libnames >&4
5897 echo " "
5898 $echo $n "This may take a while...$c" >&4
5899
5900 for file in $*; do
5901         case $file in
5902         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5903         *) $nm $nm_opt $file 2>/dev/null;;
5904         esac
5905 done >libc.tmp
5906
5907 $echo $n ".$c"
5908 $grep fprintf libc.tmp > libc.ptf
5909 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5910 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5911 xxx='[ADTSIW]'
5912 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5913         eval $xscan;\
5914         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5915                 eval $xrun
5916 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5917         eval $xscan;\
5918         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5919                 eval $xrun
5920 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5921         eval $xscan;\
5922         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5923                 eval $xrun
5924 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5925         eval $xscan;\
5926         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5927                 eval $xrun
5928 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5929         eval $xscan;\
5930         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5931                 eval $xrun
5932 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5933         eval $xscan;\
5934         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5935                 eval $xrun
5936 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5937                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5938         eval $xscan;\
5939         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5940                 eval $xrun
5941 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5942         eval $xscan;\
5943         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5944                 eval $xrun
5945 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5946         eval $xscan;\
5947         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5948                 eval $xrun
5949 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5950         eval $xscan;\
5951         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5952                 eval $xrun
5953 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5954         eval $xscan;\
5955         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5956                 eval $xrun
5957 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5958         eval $xscan;\
5959         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5960                 eval $xrun
5961 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5962         eval $xscan;\
5963         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5964                 eval $xrun
5965 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5966         eval $xscan;\
5967         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5968                 eval $xrun
5969 else
5970         $nm -p $* 2>/dev/null >libc.tmp
5971         $grep fprintf libc.tmp > libc.ptf
5972         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5973                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5974         then
5975                 nm_opt='-p'
5976                 eval $xrun
5977         else
5978                 echo " "
5979                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5980                 com=''
5981                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5982                         for thisname in $libnames $libc; do
5983                                 $ar t $thisname >>libc.tmp
5984                         done
5985                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5986                         echo "Ok." >&4
5987                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5988                         # Repeat libc to extract forwarders to DLL entries too
5989                         for thisname in $libnames $libc; do
5990                                 $ar tv $thisname >>libc.tmp
5991                                 # Revision 50 of EMX has bug in $ar.
5992                                 # it will not extract forwarders to DLL entries
5993                                 # Use emximp which will extract exactly them.
5994                                 emximp -o tmp.imp $thisname \
5995                                     2>/dev/null && \
5996                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5997                                     < tmp.imp >>libc.tmp
5998                                 $rm tmp.imp
5999                         done
6000                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6001                         echo "Ok." >&4
6002                 else
6003                         echo "$ar didn't seem to work right." >&4
6004                         echo "Maybe this is a Cray...trying bld instead..." >&4
6005                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6006                         then
6007                                 for thisname in $libnames; do
6008                                         bld t $libnames | \
6009                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6010                                         $ar t $thisname >>libc.tmp
6011                                 done
6012                                 echo "Ok." >&4
6013                         else
6014                                 echo "That didn't work either.  Giving up." >&4
6015                                 exit 1
6016                         fi
6017                 fi
6018         fi
6019 fi
6020 nm_extract="$com"
6021 if $test -f /lib/syscalls.exp; then
6022         echo " "
6023         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6024         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6025 fi
6026 ;;
6027 esac
6028 $rm -f libnames libpath
6029
6030 : see if dld is available
6031 set dld.h i_dld
6032 eval $inhdr
6033
6034 : is a C symbol defined?
6035 csym='tlook=$1;
6036 case "$3" in
6037 -v) tf=libc.tmp; tc=""; tdc="";;
6038 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6039 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6040 esac;
6041 tx=yes;
6042 case "$reuseval-$4" in
6043 true-) ;;
6044 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6045 esac;
6046 case "$tx" in
6047 yes)
6048         case "$runnm" in
6049         true)
6050                 if $contains $tlook $tf >/dev/null 2>&1;
6051                 then tval=true;
6052                 else tval=false;
6053                 fi;;
6054         *)
6055                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6056                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6057                 then tval=true;
6058                 else tval=false;
6059                 fi;
6060                 $rm -f t t.c;;
6061         esac;;
6062 *)
6063         case "$tval" in
6064         $define) tval=true;;
6065         *) tval=false;;
6066         esac;;
6067 esac;
6068 eval "$2=$tval"'
6069
6070 : define an is-in-libc? function
6071 inlibc='echo " "; td=$define; tu=$undef;
6072 sym=$1; var=$2; eval "was=\$$2";
6073 tx=yes;
6074 case "$reuseval$was" in
6075 true) ;;
6076 true*) tx=no;;
6077 esac;
6078 case "$tx" in
6079 yes)
6080         set $sym tres -f;
6081         eval $csym;
6082         case "$tres" in
6083         true)
6084                 echo "$sym() found." >&4;
6085                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6086         *)
6087                 echo "$sym() NOT found." >&4;
6088                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6089         esac;;
6090 *)
6091         case "$was" in
6092         $define) echo "$sym() found." >&4;;
6093         *) echo "$sym() NOT found." >&4;;
6094         esac;;
6095 esac'
6096
6097 : see if dlopen exists
6098 xxx_runnm="$runnm"
6099 runnm=false
6100 set dlopen d_dlopen
6101 eval $inlibc
6102 runnm="$xxx_runnm"
6103
6104 : determine which dynamic loading, if any, to compile in
6105 echo " "
6106 dldir="ext/DynaLoader"
6107 case "$usedl" in
6108 $define|y|true)
6109         dflt='y'
6110         usedl="$define"
6111         ;;
6112 $undef|n|false)
6113         dflt='n'
6114         usedl="$undef"
6115         ;;
6116 *) 
6117         dflt='n'
6118         case "$d_dlopen" in
6119             $define) dflt='y' ;;
6120         esac
6121         case "$i_dld" in
6122             $define) dflt='y' ;;
6123         esac
6124         : Does a dl_xxx.xs file exist for this operating system
6125         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6126         ;;
6127 esac
6128 rp="Do you wish to use dynamic loading?"
6129 . ./myread
6130 usedl="$ans"
6131 case "$ans" in
6132 y*) usedl="$define"
6133         case "$dlsrc" in
6134         '')
6135                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6136                         dflt="$dldir/dl_${osname}.xs"
6137                 elif $test "$d_dlopen" = "$define" ; then
6138                         dflt="$dldir/dl_dlopen.xs"
6139                 elif $test "$i_dld" = "$define" ; then
6140                         dflt="$dldir/dl_dld.xs"
6141                 else
6142                         dflt=''
6143                 fi
6144                 ;;
6145         *)      dflt="$dldir/$dlsrc"
6146                 ;;
6147         esac
6148     echo "The following dynamic loading files are available:"
6149         : Can not go over to $dldir because getfile has path hard-coded in.
6150         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6151         rp="Source file to use for dynamic loading"
6152         fn="fne"
6153         gfpth="$src"
6154         . ./getfile
6155         usedl="$define"
6156         : emulate basename
6157         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6158
6159         $cat << EOM
6160
6161 Some systems may require passing special flags to $cc -c to
6162 compile modules that will be used to create a shared library.
6163 To use no flags, say "none".
6164
6165 EOM
6166     case "$cccdlflags" in
6167     '') case "$gccversion" in
6168                 '') case "$osname" in
6169                         hpux)   dflt='+z' ;;
6170                         next)   dflt='none' ;;
6171                         irix*)  dflt='-KPIC' ;;
6172                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6173                         sunos)  dflt='-pic' ;;
6174                         *)      dflt='none' ;;
6175                     esac
6176                         ;;
6177                 *)  case "$osname" in
6178                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6179                         *)      dflt='-fpic' ;;
6180                     esac ;;
6181             esac ;;
6182         ' ') dflt='none' ;;
6183     *)  dflt="$cccdlflags" ;;
6184     esac
6185     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6186     . ./myread
6187     case "$ans" in
6188     none) cccdlflags=' ' ;;
6189     *) cccdlflags="$ans" ;;
6190     esac
6191
6192     cat << EOM
6193
6194 Some systems use ld to create libraries that can be dynamically loaded,
6195 while other systems (such as those using ELF) use $cc.
6196
6197 EOM
6198         case "$ld" in
6199         '')     $cat >try.c <<'EOM'
6200 /* Test for whether ELF binaries are produced */
6201 #include <fcntl.h>
6202 #include <stdlib.h>
6203 int main() {
6204         char b[4];
6205         int i = open("a.out",O_RDONLY);
6206         if(i == -1) 
6207                 exit(1); /* fail */
6208         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6209                 exit(0); /* succeed (yes, it's ELF) */
6210         else
6211                 exit(1); /* fail */
6212 }
6213 EOM
6214                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6215                         cat <<EOM
6216 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6217 EOM
6218                         dflt="$cc"
6219                 else
6220                         echo "I'll use ld to build dynamic libraries."
6221                         dflt='ld'
6222                 fi
6223                 rm -f try.c a.out
6224                 ;;
6225         *)      dflt="$ld"
6226                 ;;
6227         esac
6228
6229     rp="What command should be used to create dynamic libraries?"
6230     . ./myread
6231         ld="$ans"
6232
6233     cat << EOM
6234
6235 Some systems may require passing special flags to $ld to create a
6236 library that can be dynamically loaded.  If your ld flags include
6237 -L/other/path options to locate libraries outside your loader's normal
6238 search path, you may need to specify those -L options here as well.  To
6239 use no flags, say "none".
6240
6241 EOM
6242     case "$lddlflags" in
6243     '') case "$osname" in
6244                         beos) dflt='-nostart' ;;
6245                         hpux) dflt='-b';
6246                               case "$gccversion" in
6247                               '') dflt="$dflt +vnocompatwarnings" ;;
6248                               esac
6249                               ;;        
6250                         linux|irix*)    dflt='-shared' ;;
6251                         next)  dflt='none' ;;
6252                         solaris) dflt='-G' ;;
6253                         sunos) dflt='-assert nodefinitions' ;;
6254                         svr4*|esix*) dflt="-G $ldflags" ;;
6255                 *)     dflt='none' ;;
6256                         esac
6257                         ;;
6258     *) dflt="$lddlflags" ;;
6259     esac
6260
6261         : Try to guess additional flags to pick up local libraries.
6262         : Be careful not to append to a plain 'none'
6263         case "$dflt" in
6264         none) dflt='' ;;
6265         esac
6266         for thisflag in $ldflags; do
6267                 case "$thisflag" in
6268                 -L*)
6269                         case " $dflt " in
6270                         *" $thisflag "*) ;;
6271                         *) dflt="$dflt $thisflag" ;;
6272                         esac
6273                         ;;
6274                 esac
6275         done
6276
6277         case "$dflt" in
6278         ''|' ') dflt='none' ;;
6279         esac
6280
6281     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6282     . ./myread
6283     case "$ans" in
6284     none) lddlflags=' ' ;;
6285     *) lddlflags="$ans" ;;
6286     esac
6287
6288         cat <<EOM
6289
6290 Some systems may require passing special flags to $cc to indicate that
6291 the resulting executable will use dynamic linking.  To use no flags,
6292 say "none".
6293
6294 EOM
6295     case "$ccdlflags" in
6296     '') case "$osname" in
6297                 hpux)   dflt='-Wl,-E' ;;
6298                 linux)  dflt='-rdynamic' ;;
6299                 next)   dflt='none' ;;
6300                 sunos)  dflt='none' ;;
6301                 *)      dflt='none' ;;
6302             esac ;;
6303     ' ')  dflt='none' ;;
6304     *)  dflt="$ccdlflags" ;;
6305     esac
6306     rp="Any special flags to pass to $cc to use dynamic linking?"
6307     . ./myread
6308     case "$ans" in
6309     none) ccdlflags=' ' ;;
6310     *) ccdlflags="$ans" ;;
6311     esac
6312     ;;
6313 *)  usedl="$undef"
6314         ld='ld'
6315     dlsrc='dl_none.xs'
6316     lddlflags=''
6317     ccdlflags=''
6318     ;;
6319 esac
6320
6321 also=''
6322 case "$usedl" in
6323 $undef)
6324         # No dynamic loading being used, so don't bother even to prompt.
6325         useshrplib='false'
6326         ;;
6327 *)      case "$useshrplib" in
6328         '')     case "$osname" in
6329                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6330                         dflt=y
6331                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6332                         ;;
6333                 next*)
6334                         case "$osvers" in
6335                         4*)     dflt=y
6336                                 also='Building a shared libperl is needed for MAB support.'
6337                                 ;;
6338                         *)      dflt=n
6339                                 ;;
6340                         esac
6341                         ;;
6342                 *)      dflt=n
6343                         ;;
6344                 esac
6345                 ;;
6346         $define|true|[Yy]*)
6347                 dflt=y
6348                 ;;
6349         *)      dflt=n
6350                 ;;
6351         esac
6352         $cat << EOM
6353
6354 The perl executable is normally obtained by linking perlmain.c with
6355 libperl${_a}, any static extensions (usually just DynaLoader), and
6356 any other libraries needed on this system (such as -lm, etc.).  Since
6357 your system supports dynamic loading, it is probably possible to build
6358 a shared libperl.$so.  If you will have more than one executable linked
6359 to libperl.$so, this will significantly reduce the size of each
6360 executable, but it may have a noticeable affect on performance.  The
6361 default is probably sensible for your system.
6362 $also
6363
6364 EOM
6365         rp="Build a shared libperl.$so (y/n)"
6366         . ./myread
6367         case "$ans" in
6368         true|$define|[Yy]*)
6369                 useshrplib='true'  ;;
6370         *)      useshrplib='false' ;;
6371         esac
6372         ;;
6373 esac
6374
6375 case "$useshrplib" in
6376 true)
6377         case "$libperl" in
6378         '')
6379                 # Figure out a good name for libperl.so.  Since it gets stored in
6380                 # a version-specific architecture-dependent library, the version
6381                 # number isn't really that important, except for making cc/ld happy.
6382                 #
6383                 # A name such as libperl.so.3.1
6384                 majmin="libperl.$so.$patchlevel.$subversion"
6385                 # A name such as libperl.so.301
6386                 majonly=`echo $patchlevel $subversion |
6387                         $awk '{printf "%d%02d", $1, $2}'`
6388                 majonly=libperl.$so.$majonly
6389                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6390                 # rely on figuring it out from the naming of libc.
6391                 case "${osname}${osvers}" in
6392                 next4*)
6393                         dflt=libperl.5.$so
6394                         # XXX How handle the --version stuff for MAB?
6395                         ;;
6396                 linux*)  # ld won't link with a bare -lperl otherwise.
6397                         dflt=libperl.$so
6398                         ;;
6399                 cygwin*) # include version
6400                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6401                         ;;
6402                 *)      # Try to guess based on whether libc has major.minor.
6403                         case "$libc" in
6404                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6405                         *libc.$so.[0-9]*) dflt=$majonly ;;
6406                         *)      dflt=libperl.$so ;;
6407                         esac
6408                         ;;
6409                 esac
6410                 ;;
6411         *)      dflt=$libperl
6412                 ;;
6413         esac
6414         cat << EOM
6415
6416 I need to select a good name for the shared libperl.  If your system uses
6417 library names with major and minor numbers, then you might want something
6418 like $majmin.  Alternatively, if your system uses a single version
6419 number for shared libraries, then you might want to use $majonly.
6420 Or, your system might be quite happy with a simple libperl.$so.
6421
6422 Since the shared libperl will get installed into a version-specific
6423 architecture-dependent directory, the version number of the shared perl
6424 library probably isn't important, so the default should be o.k.
6425
6426 EOM
6427         rp='What name do you want to give to the shared libperl?'
6428         . ./myread
6429         libperl=$ans
6430         echo "Ok, I'll use $libperl"
6431         ;;
6432 *)
6433         libperl="libperl${_a}"
6434         ;;
6435 esac
6436
6437 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6438 case "$shrpdir" in
6439 '') ;;
6440 *)      $cat >&4 <<EOM
6441 WARNING:  Use of the shrpdir variable for the installation location of
6442 the shared $libperl is not supported.  It was never documented and
6443 will not work in this version.  Let me (perlbug@perl.com)
6444 know of any problems this may cause.
6445
6446 EOM
6447         case "$shrpdir" in
6448         "$archlibexp/CORE")
6449                 $cat >&4 <<EOM
6450 But your current setting of $shrpdir is
6451 the default anyway, so it's harmless.
6452 EOM
6453                 ;;
6454         *)
6455                 $cat >&4 <<EOM
6456 Further, your current attempted setting of $shrpdir
6457 conflicts with the value of $archlibexp/CORE
6458 that installperl will use.
6459 EOM
6460                 ;;
6461         esac
6462         ;;
6463 esac
6464
6465 # How will the perl executable find the installed shared $libperl?
6466 # Add $xxx to ccdlflags.
6467 # If we can't figure out a command-line option, use $shrpenv to
6468 # set env LD_RUN_PATH.  The main perl makefile uses this.
6469 shrpdir=$archlibexp/CORE
6470 xxx=''
6471 tmp_shrpenv=''
6472 if "$useshrplib"; then
6473     case "$osname" in 
6474         aix)
6475                 # We'll set it in Makefile.SH...
6476                 ;;
6477         solaris|netbsd)
6478                 xxx="-R $shrpdir"
6479                 ;;
6480         freebsd)
6481                 xxx="-Wl,-R$shrpdir"
6482                 ;;
6483         linux|irix*|dec_osf)
6484                 xxx="-Wl,-rpath,$shrpdir"
6485                 ;;
6486         next)
6487                 # next doesn't like the default...
6488                 ;;
6489         beos)
6490                 # beos doesn't like the default, either.
6491                 ;;
6492         hpux*)
6493                 # hpux doesn't like the default, either.
6494                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6495                 ;;
6496         *)
6497                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6498                 ;;
6499         esac
6500         case "$xxx" in
6501         '') ;;
6502         *)      
6503                 # Only add $xxx if it isn't already in ccdlflags.
6504                 case " $ccdlflags " in
6505                 *" $xxx "*)     ;;
6506                 *)      ccdlflags="$ccdlflags $xxx"
6507                         cat <<EOM >&4
6508
6509 Adding $xxx to the flags
6510 passed to $ld so that the perl executable will find the 
6511 installed shared $libperl.
6512
6513 EOM
6514                         ;;
6515                 esac
6516                 ;;
6517         esac
6518 fi
6519 # Fix ccdlflags in AIX for building external extensions.
6520 # (For building Perl itself bare -bE:perl.exp is needed,
6521 #  Makefile.SH takes care of this.)
6522 case "$osname" in
6523 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6524 esac
6525 # Respect a hint or command-line value.
6526 case "$shrpenv" in
6527 '') shrpenv="$tmp_shrpenv" ;;
6528 esac
6529 case "$ldlibpthname" in
6530 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6531 none)   ldlibpthname='' ;;
6532 esac
6533
6534 : determine where manual pages go
6535 set man1dir man1dir none
6536 eval $prefixit
6537 $cat <<EOM
6538
6539 $spackage has manual pages available in source form.
6540 EOM
6541 case "$nroff" in
6542 nroff)
6543         echo "However, you don't have nroff, so they're probably useless to you."
6544         case "$man1dir" in
6545         '') man1dir="none";;
6546         esac;;
6547 esac
6548 echo "If you don't want the manual sources installed, answer 'none'."
6549 case "$man1dir" in
6550 ' ') dflt=none
6551         ;;
6552 '')
6553         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6554         lookpath="$lookpath $prefixexp/man/p_man/man1"
6555         lookpath="$lookpath $prefixexp/man/u_man/man1"
6556         lookpath="$lookpath $prefixexp/man/man.1"
6557         case "$sysman" in
6558         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6559         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6560         esac
6561         set dflt
6562         eval $prefixup
6563         ;;
6564 *)  dflt="$man1dir"
6565         ;;
6566 esac
6567 echo " "
6568 fn=dn+~
6569 rp="Where do the main $spackage manual pages (source) go?"
6570 . ./getfile
6571 if $test "X$man1direxp" != "X$ansexp"; then
6572         installman1dir=''
6573 fi
6574 man1dir="$ans"
6575 man1direxp="$ansexp"
6576 case "$man1dir" in
6577 '')     man1dir=' '
6578         installman1dir='';;
6579 esac
6580
6581 : Change installation prefix, if necessary.
6582 if $test X"$prefix" != X"$installprefix"; then
6583         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6584 else
6585         installman1dir="$man1direxp"
6586 fi
6587
6588 : What suffix to use on installed man pages
6589
6590 case "$man1dir" in
6591 ' ')
6592         man1ext='0'
6593         ;;
6594 *)
6595         rp="What suffix should be used for the main $spackage man pages?"
6596         case "$man1ext" in
6597         '')     case "$man1dir" in
6598                 *1)  dflt=1 ;;
6599                 *1p) dflt=1p ;;
6600                 *1pm) dflt=1pm ;;
6601                 *l) dflt=l;;
6602                 *n) dflt=n;;
6603                 *o) dflt=o;;
6604                 *p) dflt=p;;
6605                 *C) dflt=C;;
6606                 *L) dflt=L;;
6607                 *L1) dflt=L1;;
6608                 *) dflt=1;;
6609                 esac
6610                 ;;
6611         *)      dflt="$man1ext";;
6612         esac
6613         . ./myread
6614         man1ext="$ans"
6615         ;;
6616 esac
6617
6618 : see if we can have long filenames
6619 echo " "
6620 first=123456789abcdef
6621 $rm -f $first
6622 if (echo hi >$first) 2>/dev/null; then
6623         if $test -f 123456789abcde; then
6624                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6625                 val="$undef"
6626         else
6627                 echo 'You can have filenames longer than 14 characters.'>&4
6628                 val="$define"
6629         fi
6630 else
6631         $cat <<'EOM'
6632 You can't have filenames longer than 14 chars.
6633 You can't even think about them!
6634 EOM
6635         val="$undef"
6636 fi 
6637 set d_flexfnam
6638 eval $setvar
6639 $rm -rf 123456789abcde*
6640
6641 : determine where library module manual pages go
6642 set man3dir man3dir none
6643 eval $prefixit
6644 $cat <<EOM
6645
6646 $spackage has manual pages for many of the library modules.
6647 EOM
6648
6649 case "$nroff" in
6650 nroff)
6651         $cat <<'EOM'
6652 However, you don't have nroff, so they're probably useless to you.
6653 EOM
6654         case "$man3dir" in
6655         '') man3dir="none";;
6656         esac;;
6657 esac
6658
6659 case "$d_flexfnam" in
6660 undef)
6661         $cat <<'EOM'
6662 However, your system can't handle the long file names like File::Basename.3. 
6663 EOM
6664         case "$man3dir" in
6665         '') man3dir="none";;
6666         esac;;
6667 esac
6668
6669 echo "If you don't want the manual sources installed, answer 'none'."
6670 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6671 case "$man3dir" in
6672 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6673         if $test -d "$privlib/man/man3"; then
6674                 cat <<EOM >&4
6675
6676 WARNING:  Previous versions of perl installed man3 pages into
6677 $privlib/man/man3.  This version will suggest a 
6678 new default of $dflt.  
6679 EOM
6680                 tdflt=$dflt
6681                 dflt='n'
6682                 rp='Do you wish to preserve the old behavior?(y/n)'
6683                 . ./myread
6684                 case "$ans" in
6685                 y*) dflt="$privlib/man/man3" ;;
6686                 *)  dflt=$tdflt ;;
6687                 esac
6688     fi
6689         ;;
6690 *)      dflt="$man3dir" ;;
6691 esac
6692 case "$dflt" in
6693 ' ') dflt=none ;;
6694 esac
6695 echo " "
6696 fn=dn+~
6697 rp="Where do the $package library man pages (source) go?"
6698 . ./getfile
6699 man3dir="$ans"
6700 man3direxp="$ansexp"
6701 case "$man3dir" in
6702 '')     man3dir=' '
6703         installman3dir='';;
6704 esac
6705
6706 : Change installation prefix, if necessary.
6707 if $test X"$prefix" != X"$installprefix"; then
6708         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6709 else
6710         installman3dir="$man3direxp"
6711 fi
6712
6713 : What suffix to use on installed man pages
6714 case "$man3dir" in
6715 ' ')
6716         man3ext='0'
6717         ;;
6718 *)
6719         rp="What suffix should be used for the $package library man pages?"
6720         case "$man3ext" in
6721         '')     case "$man3dir" in
6722                 *3)  dflt=3 ;;
6723                 *3p) dflt=3p ;;
6724                 *3pm) dflt=3pm ;;
6725                 *l) dflt=l;;
6726                 *n) dflt=n;;
6727                 *o) dflt=o;;
6728                 *p) dflt=p;;
6729                 *C) dflt=C;;
6730                 *L) dflt=L;;
6731                 *L3) dflt=L3;;
6732                 *) dflt=3;;
6733                 esac
6734                 ;;
6735         *)      dflt="$man3ext";;
6736         esac
6737         . ./myread
6738         man3ext="$ans"
6739         ;;
6740 esac
6741
6742 : see if we have to deal with yellow pages, now NIS.
6743 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6744         if $test -f /usr/etc/nibindd; then
6745                 echo " "
6746                 echo "I'm fairly confident you're on a NeXT."
6747                 echo " "
6748                 rp='Do you get the hosts file via NetInfo?'
6749                 dflt=y
6750                 case "$hostcat" in
6751                 nidump*) ;;
6752                 '') ;;
6753                 *) dflt=n;;
6754                 esac
6755                 . ./myread
6756                 case "$ans" in
6757                 y*) hostcat='nidump hosts .';;
6758                 *)      case "$hostcat" in
6759                         nidump*) hostcat='';;
6760                         esac
6761                         ;;
6762                 esac
6763         fi
6764         case "$hostcat" in
6765         nidump*) ;;
6766         *)
6767                 case "$hostcat" in
6768                 *ypcat*) dflt=y;;
6769                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6770                                 dflt=y
6771                         else
6772                                 dflt=n
6773                         fi;;
6774                 *) dflt=n;;
6775                 esac
6776                 echo " "
6777                 rp='Are you getting the hosts file via yellow pages?'
6778                 . ./myread
6779                 case "$ans" in
6780                 y*) hostcat='ypcat hosts';;
6781                 *) hostcat='cat /etc/hosts';;
6782                 esac
6783                 ;;
6784         esac
6785 fi
6786 case "$hostcat" in
6787 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6788 esac
6789 case "$groupcat" in
6790 '') test -f /etc/group && groupcat='cat /etc/group';;
6791 esac
6792 case "$passcat" in
6793 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6794 esac
6795
6796 : now get the host name
6797 echo " "
6798 echo "Figuring out host name..." >&4
6799 case "$myhostname" in
6800 '') cont=true
6801         echo 'Maybe "hostname" will work...'
6802         if tans=`sh -c hostname 2>&1` ; then
6803                 myhostname=$tans
6804                 phostname=hostname
6805                 cont=''
6806         fi
6807         ;;
6808 *) cont='';;
6809 esac
6810 if $test "$cont"; then
6811         if ./xenix; then
6812                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6813                 if tans=`cat /etc/systemid 2>&1` ; then
6814                         myhostname=$tans
6815                         phostname='cat /etc/systemid'
6816                         echo "Whadyaknow.  Xenix always was a bit strange..."
6817                         cont=''
6818                 fi
6819         elif $test -r /etc/systemid; then
6820                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6821         fi
6822 fi
6823 if $test "$cont"; then
6824         echo 'No, maybe "uuname -l" will work...'
6825         if tans=`sh -c 'uuname -l' 2>&1` ; then
6826                 myhostname=$tans
6827                 phostname='uuname -l'
6828         else
6829                 echo 'Strange.  Maybe "uname -n" will work...'
6830                 if tans=`sh -c 'uname -n' 2>&1` ; then
6831                         myhostname=$tans
6832                         phostname='uname -n'
6833                 else
6834                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6835                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6836                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6837                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6838                         else
6839                                 case "$myhostname" in
6840                                 '') echo "Does this machine have an identity crisis or something?"
6841                                         phostname='';;
6842                                 *)
6843                                         echo "Well, you said $myhostname before..."
6844                                         phostname='echo $myhostname';;
6845                                 esac
6846                         fi
6847                 fi
6848         fi
6849 fi
6850 : you do not want to know about this
6851 set $myhostname
6852 myhostname=$1
6853
6854 : verify guess
6855 if $test "$myhostname" ; then
6856         dflt=y
6857         rp='Your host name appears to be "'$myhostname'".'" Right?"
6858         . ./myread
6859         case "$ans" in
6860         y*) ;;
6861         *) myhostname='';;
6862         esac
6863 fi
6864
6865 : bad guess or no guess
6866 while $test "X$myhostname" = X ; do
6867         dflt=''
6868         rp="Please type the (one word) name of your host:"
6869         . ./myread
6870         myhostname="$ans"
6871 done
6872
6873 : translate upper to lower if necessary
6874 case "$myhostname" in
6875 *[A-Z]*)
6876         echo "(Normalizing case in your host name)"
6877         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6878         ;;
6879 esac
6880
6881 case "$myhostname" in
6882 *.*)
6883         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6884         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6885         echo "(Trimming domain name from host name--host name is now $myhostname)"
6886         ;;
6887 *) case "$mydomain" in
6888         '')
6889                 {
6890                         test "X$hostcat" = "Xypcat hosts" &&
6891                         ypmatch "$myhostname" hosts 2>/dev/null |\
6892                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6893                         $test -s hosts
6894                 } || {
6895                         test "X$hostcat" != "X" &&
6896                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6897                                         /[       ]$myhostname[  . ]/p" > hosts
6898                 }
6899                 tmp_re="[       . ]"
6900                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6901                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6902                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6903                         hosts | $sort | $uniq | \
6904                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6905                 case `$echo X$dflt` in
6906                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6907                         dflt=.
6908                         ;;
6909                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6910                         ;;
6911                 esac
6912                 case "$dflt" in
6913                 .)
6914                         tans=`./loc resolv.conf X /etc /usr/etc`
6915                         if $test -f "$tans"; then
6916                                 echo "(Attempting domain name extraction from $tans)"
6917                                 dflt=.`$sed -n -e 's/   / /g' \
6918                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6919                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6920                                 case "$dflt" in
6921                                 .) dflt=.`$sed -n -e 's/        / /g' \
6922                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6923                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6924                                         ;;
6925                                 esac
6926                         fi
6927                         ;;
6928                 esac
6929                 case "$dflt" in
6930                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6931                         dflt=.`sh -c domainname 2>/dev/null`
6932                         case "$dflt" in
6933                         '') dflt='.';;
6934                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6935                         esac
6936                         ;;
6937                 esac
6938                 case "$dflt" in
6939                 .) echo "(Lost all hope -- silly guess then)"
6940                         dflt='.uucp'
6941                         ;;
6942                 esac
6943                 $rm -f hosts
6944                 ;;
6945         *) dflt="$mydomain";;
6946         esac;;
6947 esac
6948 echo " "
6949 rp="What is your domain name?"
6950 . ./myread
6951 tans="$ans"
6952 case "$ans" in
6953 '') ;;
6954 .*) ;;
6955 *) tans=".$tans";;
6956 esac
6957 mydomain="$tans"
6958
6959 : translate upper to lower if necessary
6960 case "$mydomain" in
6961 *[A-Z]*)
6962         echo "(Normalizing case in your domain name)"
6963         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6964         ;;
6965 esac
6966
6967 : a little sanity check here
6968 case "$phostname" in
6969 '') ;;
6970 *)
6971         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6972         $myhostname$mydomain|$myhostname) ;;
6973         *)
6974                 case "$phostname" in
6975                 sed*)
6976                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6977                         ;;
6978                 *)
6979                         echo "(That doesn't agree with your $phostname command, by the way.)"
6980                         ;;
6981                 esac
6982         ;;
6983         esac
6984         ;;
6985 esac
6986
6987 $cat <<EOM
6988
6989 I need to get your e-mail address in Internet format if possible, i.e.
6990 something like user@host.domain. Please answer accurately since I have
6991 no easy means to double check it. The default value provided below
6992 is most probably close to reality but may not be valid from outside
6993 your organization...
6994
6995 EOM
6996 cont=x
6997 while test "$cont"; do
6998         case "$cf_email" in
6999         '') dflt="$cf_by@$myhostname$mydomain";;
7000         *) dflt="$cf_email";;
7001         esac
7002         rp='What is your e-mail address?'
7003         . ./myread
7004         cf_email="$ans"
7005         case "$cf_email" in
7006         *@*.*) cont='' ;;
7007         *)
7008                 rp='Address does not look like an Internet one.  Use it anyway?'
7009                 case "$fastread" in
7010                 yes) dflt=y ;;
7011                 *) dflt=n ;;
7012                 esac
7013                 . ./myread
7014                 case "$ans" in
7015                 y*) cont='' ;;
7016                 *) echo " " ;;
7017                 esac
7018                 ;;
7019         esac
7020 done
7021
7022 $cat <<EOM
7023
7024 If you or somebody else will be maintaining perl at your site, please
7025 fill in the correct e-mail address here so that they may be contacted
7026 if necessary. Currently, the "perlbug" program included with perl
7027 will send mail to this address in addition to perlbug@perl.com. You may
7028 enter "none" for no administrator.
7029
7030 EOM
7031 case "$perladmin" in
7032 '') dflt="$cf_email";;
7033 *) dflt="$perladmin";;
7034 esac
7035 rp='Perl administrator e-mail address'
7036 . ./myread
7037 perladmin="$ans"
7038
7039 : figure out how to guarantee perl startup
7040 case "$startperl" in
7041 '')
7042         case "$sharpbang" in
7043         *!)
7044                 $cat <<EOH
7045
7046 I can use the #! construct to start perl on your system. This will
7047 make startup of perl scripts faster, but may cause problems if you
7048 want to share those scripts and perl is not in a standard place
7049 ($binexp/perl) on all your platforms. The alternative is to force
7050 a shell by starting the script with a single ':' character.
7051
7052 EOH
7053                 dflt="$binexp/perl"
7054                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7055                 . ./myread
7056                 case "$ans" in
7057                 none)   startperl=": # use perl";;
7058                 *)      startperl="#!$ans"
7059                         if $test 30 -lt `echo "$ans" | wc -c`; then
7060                                 $cat >&4 <<EOM
7061
7062 WARNING:  Some systems limit the #! command to 32 characters.
7063 If you experience difficulty running Perl scripts with #!, try
7064 installing Perl in a directory with a shorter pathname.
7065
7066 EOM
7067                         fi ;;
7068                 esac
7069                 ;;
7070         *) startperl=": # use perl"
7071                 ;;
7072         esac
7073         ;;
7074 esac
7075 echo "I'll use $startperl to start perl scripts."
7076
7077 : figure best path for perl in scripts
7078 case "$perlpath" in
7079 '')
7080         perlpath="$binexp/perl"
7081         case "$startperl" in
7082         *!*) ;;
7083         *)
7084                 $cat <<EOH
7085
7086 I will use the "eval 'exec'" idiom to start Perl on your system.
7087 I can use the full path of your Perl binary for this purpose, but
7088 doing so may cause problems if you want to share those scripts and
7089 Perl is not always in a standard place ($binexp/perl).
7090
7091 EOH
7092                 dflt="$binexp/perl"
7093                 rp="What path shall I use in \"eval 'exec'\"?"
7094                 . ./myread
7095                 perlpath="$ans"
7096                 ;;
7097         esac
7098         ;;
7099 esac
7100 case "$startperl" in
7101 *!*)    ;;
7102 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7103 esac
7104
7105 : determine where public executable scripts go
7106 set scriptdir scriptdir
7107 eval $prefixit
7108 case "$scriptdir" in
7109 '')
7110         dflt="$bin"
7111         : guess some guesses
7112         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7113         $test -d /usr/share/bin     && dflt=/usr/share/bin
7114         $test -d /usr/local/script  && dflt=/usr/local/script
7115         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7116         $test -d $prefixexp/script  && dflt=$prefixexp/script
7117         set dflt
7118         eval $prefixup
7119         ;;
7120 *)  dflt="$scriptdir"
7121         ;;
7122 esac
7123 $cat <<EOM
7124  
7125 Some installations have a separate directory just for executable scripts so
7126 that they can mount it across multiple architectures but keep the scripts in
7127 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7128 Or you might just lump your scripts in with all your other executables.
7129  
7130 EOM
7131 fn=d~
7132 rp='Where do you keep publicly executable scripts?'
7133 . ./getfile
7134 if $test "X$ansexp" != "X$scriptdirexp"; then
7135         installscript=''
7136 fi
7137 scriptdir="$ans"
7138 scriptdirexp="$ansexp"
7139 : Change installation prefix, if necessary.
7140 if $test X"$prefix" != X"$installprefix"; then
7141         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7142 else
7143         installscript="$scriptdirexp"
7144 fi
7145
7146 : determine where site specific architecture-dependent libraries go.
7147 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7148 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7149 : sitelib may have an optional trailing /share.
7150 case "$sitearch" in
7151 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7152         dflt="$dflt/$archname"
7153         ;;
7154 *)      dflt="$sitearch"
7155         ;;
7156 esac
7157 set sitearch sitearch none
7158 eval $prefixit
7159 $cat <<EOM
7160
7161 The installation process will also create a directory for
7162 architecture-dependent site-specific extensions and modules.
7163
7164 EOM
7165 fn=d~+
7166 rp='Pathname for the site-specific architecture-dependent library files?'
7167 . ./getfile
7168 sitearch="$ans"
7169 sitearchexp="$ansexp"
7170 : Change installation prefix, if necessary.
7171 if $test X"$prefix" != X"$installprefix"; then
7172         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7173 else
7174         installsitearch="$sitearchexp"
7175 fi
7176
7177 : determine where add-on public executables go
7178 case "$sitebin" in
7179 '')     dflt=$siteprefix/bin ;;
7180 *)      dflt=$sitebin ;;
7181 esac
7182 fn=d~
7183 rp='Pathname where the add-on public executables should be installed?'
7184 . ./getfile
7185 sitebin="$ans"
7186 sitebinexp="$ansexp"
7187 : Change installation prefix, if necessary.
7188 if $test X"$prefix" != X"$installprefix"; then
7189         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7190 else
7191         installsitebin="$sitebinexp"
7192 fi
7193
7194 : see if sqrtl exists
7195 set sqrtl d_sqrtl
7196 eval $inlibc
7197
7198 case "$ccflags" in
7199 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7200 esac
7201
7202 case "$uselongdouble" in
7203 $define|true|[yY]*)     dflt='y';;
7204 *) dflt='n';;
7205 esac
7206 cat <<EOM
7207
7208 Perl can be built to take advantage of long doubles which
7209 (if available) may give more accuracy and range for floating point numbers.
7210
7211 If this doesn't make any sense to you, just accept the default '$dflt'.
7212 EOM
7213 rp='Try to use long doubles if available?'
7214 . ./myread
7215 case "$ans" in
7216 y|Y)    val="$define"   ;;
7217 *)      val="$undef"    ;;
7218 esac
7219 set uselongdouble
7220 eval $setvar
7221
7222 case "$uselongdouble" in
7223 true|[yY]*) uselongdouble="$define" ;;
7224 esac
7225
7226 case "$uselongdouble" in
7227 $define)
7228 : Look for a hint-file generated 'call-back-unit'.  If the
7229 : user has specified that long doubles should be used,
7230 : we may need to set or change some other defaults.
7231         if $test -f uselongdouble.cbu; then
7232                 echo "Your platform has some specific hints for long doubles, using them..."
7233                 . ./uselongdouble.cbu
7234         else
7235                 $cat <<EOM
7236 (Your platform doesn't have any specific hints for long doubles.)
7237 EOM
7238         fi
7239         ;;
7240 esac
7241
7242 case "$uselongdouble:$d_sqrtl" in
7243 $define:$undef)
7244                 $cat <<EOM >&4
7245
7246 *** You requested the use of long doubles but you do not seem to have
7247 *** the mathematic functions for long doubles.  I'm disabling the use
7248 *** of long doubles.
7249
7250 EOM
7251         uselongdouble=$undef
7252         ;;
7253 esac
7254
7255 case "$useperlio" in
7256 $define|true|[yY]*)     dflt='y';;
7257 *) dflt='n';;
7258 esac
7259 cat <<EOM
7260
7261 Previous version of $package used the standard IO mechanisms as defined
7262 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7263 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7264 the default.  This abstraction layer can use AT&T's sfio (if you already
7265 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7266 problems with some extension modules.  Using PerlIO with stdio is safe,
7267 but it is slower than plain stdio and therefore is not the default.
7268
7269 If this doesn't make any sense to you, just accept the default '$dflt'.
7270 EOM
7271 rp='Use the experimental PerlIO abstraction layer?'
7272 . ./myread
7273 case "$ans" in
7274 y|Y) 
7275         val="$define"
7276         ;;     
7277 *)      
7278         echo "Ok, doing things the stdio way"
7279         val="$undef"
7280         ;;
7281 esac
7282 set useperlio
7283 eval $setvar 
7284
7285 case "$vendorprefix" in
7286 '')     d_vendorbin="$undef"
7287         vendorbin=''
7288         vendorbinexp=''
7289         ;;
7290 *)      d_vendorbin="$define"
7291         : determine where vendor-supplied executables go.
7292         case "$vendorbin" in
7293         '') dflt=$vendorprefix/bin ;;
7294         *)      dflt="$vendorbin" ;;
7295         esac
7296         fn=d~+
7297         rp='Pathname for the vendor-supplied executables directory?'
7298         . ./getfile
7299         vendorbin="$ans"
7300         vendorbinexp="$ansexp"
7301         ;;
7302 esac
7303 : Change installation prefix, if necessary.
7304 if $test X"$prefix" != X"$installprefix"; then
7305         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7306 else
7307         installvendorbin="$vendorbinexp"
7308 fi
7309
7310 : see if qgcvt exists
7311 set qgcvt d_qgcvt
7312 eval $inlibc
7313
7314 : check for length of double
7315 echo " "
7316 case "$doublesize" in
7317 '')
7318         echo "Checking to see how big your double precision numbers are..." >&4
7319         $cat >try.c <<'EOCP'
7320 #include <stdio.h>
7321 int main()
7322 {
7323     printf("%d\n", (int)sizeof(double));
7324     exit(0);
7325 }
7326 EOCP
7327         set try
7328         if eval $compile_ok; then
7329                 doublesize=`./try`
7330                 echo "Your double is $doublesize bytes long."
7331         else
7332                 dflt='8'
7333                 echo "(I can't seem to compile the test program.  Guessing...)"
7334                 rp="What is the size of a double precision number (in bytes)?"
7335                 . ./myread
7336                 doublesize="$ans"
7337         fi
7338         ;;
7339 esac
7340 $rm -f try.c try
7341
7342 : check for long doubles
7343 echo " "
7344 echo "Checking to see if you have long double..." >&4
7345 echo 'int main() { long double x = 7.0; }' > try.c
7346 set try
7347 if eval $compile; then
7348         val="$define"
7349         echo "You have long double."
7350 else
7351         val="$undef"
7352         echo "You do not have long double."
7353 fi
7354 $rm try.*
7355 set d_longdbl
7356 eval $setvar
7357
7358 : check for length of long double
7359 case "${d_longdbl}${longdblsize}" in
7360 $define)
7361         echo " "
7362         echo "Checking to see how big your long doubles are..." >&4
7363         $cat >try.c <<'EOCP'
7364 #include <stdio.h>
7365 int main()
7366 {
7367         printf("%d\n", sizeof(long double));
7368 }
7369 EOCP
7370         set try
7371         set try
7372         if eval $compile; then
7373                 longdblsize=`./try$exe_ext`
7374                 echo "Your long doubles are $longdblsize bytes long."
7375         else
7376                 dflt='8'
7377                 echo " "
7378                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7379                 rp="What is the size of a long double (in bytes)?"
7380                 . ./myread
7381                 longdblsize="$ans"
7382         fi
7383         if $test "X$doublesize" = "X$longdblsize"; then
7384                 echo "(That isn't any different from an ordinary double.)"
7385         fi      
7386         ;;
7387 esac
7388 $rm -f try.* try
7389
7390 echo " "
7391
7392 if $test X"$d_longdbl" = X"$define"; then
7393
7394 echo "Checking how to print long doubles..." >&4
7395
7396 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7397         $cat >try.c <<'EOCP'
7398 #include <sys/types.h>
7399 #include <stdio.h>
7400 int main() {
7401   double d = 123.456;
7402   printf("%.3f\n", d);
7403 }
7404 EOCP
7405         set try
7406         if eval $compile; then
7407                 yyy=`./try$exe_ext`
7408                 case "$yyy" in
7409                 123.456)
7410                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7411                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7412                         echo "We will use %f."
7413                         ;;
7414                 esac
7415         fi
7416 fi
7417
7418 if $test X"$sPRIfldbl" = X; then
7419         $cat >try.c <<'EOCP'
7420 #include <sys/types.h>
7421 #include <stdio.h>
7422 int main() {
7423   long double d = 123.456;
7424   printf("%.3llf\n", d);
7425 }
7426 EOCP
7427         set try
7428         if eval $compile; then
7429                 yyy=`./try$exe_ext`
7430                 case "$yyy" in
7431                 123.456)
7432                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7433                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7434                         echo "We will use %llf."
7435                         ;;
7436                 esac
7437         fi
7438 fi
7439
7440 if $test X"$sPRIfldbl" = X; then
7441         $cat >try.c <<'EOCP'
7442 #include <sys/types.h>
7443 #include <stdio.h>
7444 int main() {
7445   long double d = 123.456;
7446   printf("%.3Lf\n", d);
7447 }
7448 EOCP
7449         set try
7450         if eval $compile; then
7451                 yyy=`./try$exe_ext`
7452                 case "$yyy" in
7453                 123.456)
7454                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7455                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7456                         echo "We will use %Lf."
7457                         ;;
7458                 esac
7459         fi
7460 fi
7461
7462 if $test X"$sPRIfldbl" = X; then
7463         $cat >try.c <<'EOCP'
7464 #include <sys/types.h>
7465 #include <stdio.h>
7466 int main() {
7467   long double d = 123.456;
7468   printf("%.3lf\n", d);
7469 }
7470 EOCP
7471         set try
7472         if eval $compile; then
7473                 yyy=`./try$exe_ext`
7474                 case "$yyy" in
7475                 123.456)
7476                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7477                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7478                         echo "We will use %lf."
7479                         ;;
7480                 esac
7481         fi
7482 fi
7483
7484 if $test X"$sPRIfldbl" = X; then
7485         echo "Cannot figure out how to print long doubles." >&4
7486 fi
7487
7488 $rm -f try try.*
7489
7490 fi # d_longdbl
7491
7492 case "$sPRIfldbl" in
7493 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7494         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7495         ;;
7496 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7497         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7498         ;;
7499 esac
7500
7501 : Check how to convert floats to strings.
7502 if test "X$d_Gconvert" = X; then
7503         echo " "
7504         echo "Checking for an efficient way to convert floats to strings."
7505         echo " " > try.c
7506         case "$uselongdouble" in
7507         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7508         esac
7509         case "$d_longdbl" in
7510         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7511         esac
7512         case "$d_PRIgldbl" in
7513         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7514         esac
7515         $cat >>try.c <<EOP
7516 #ifdef TRY_gconvert
7517 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7518 char *myname = "gconvert";
7519 #endif
7520 #ifdef TRY_gcvt
7521 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7522 char *myname = "gcvt";
7523 #endif
7524 #ifdef TRY_qgcvt
7525 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7526 char *myname = "qgcvt";
7527 #define DOUBLETYPE long double
7528 #endif
7529 #ifdef TRY_sprintf
7530 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7531 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7532 #else
7533 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7534 #endif
7535 char *myname = "sprintf";
7536 #endif
7537
7538 #ifndef DOUBLETYPE
7539 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7540 #define DOUBLETYPE long double
7541 #else
7542 #define DOUBLETYPE double
7543 #endif
7544 #endif
7545
7546 #include <stdio.h>
7547
7548 #define I_STDLIB $i_stdlib
7549 #ifdef I_STDLIB
7550 #include <stdlib.h>
7551 #endif
7552
7553 int
7554 checkit(expect, got)
7555 char *expect;
7556 char *got;
7557 {
7558     if (strcmp(expect, got)) {
7559                 printf("%s oddity:  Expected %s, got %s\n",
7560                         myname, expect, got);
7561                 exit(1);
7562         }
7563 }
7564
7565 int main()
7566
7567         char buf[64]; 
7568         buf[63] = '\0';
7569
7570         /* This must be 1st test on (which?) platform */
7571         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7572         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7573         checkit("0.1", buf);
7574
7575         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7576         checkit("1", buf);
7577
7578         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7579         checkit("1.1", buf);
7580
7581         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7582         checkit("1.01", buf);
7583
7584         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7585         checkit("1.001", buf);
7586
7587         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7588         checkit("1.0001", buf);
7589
7590         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7591         checkit("1.00001", buf);
7592
7593         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7594         checkit("1.000001", buf);
7595
7596         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7597         checkit("0", buf);
7598
7599         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7600         checkit("-1", buf);
7601
7602         /* Some Linux gcvt's give 1.e+5 here. */
7603         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7604         checkit("100000", buf);
7605         
7606         /* Some Linux gcvt's give -1.e+5 here. */
7607         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7608         checkit("-100000", buf);
7609
7610         exit(0);
7611 }
7612 EOP
7613         case "$d_Gconvert" in
7614         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7615         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7616         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7617         *) xxx_list='gconvert gcvt sprintf' ;;
7618         esac
7619
7620         case "$d_longdbl$uselongdouble$d_qgcvt" in
7621         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7622         esac
7623
7624         for xxx_convert in $xxx_list; do
7625                 echo "Trying $xxx_convert..."
7626                 $rm -f try try$_o
7627                 set try -DTRY_$xxx_convert
7628                 if eval $compile; then
7629                         echo "$xxx_convert() found." >&4
7630                         if ./try; then
7631                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7632                                 break;
7633                         else
7634                                 echo "...But $xxx_convert didn't work as I expected."
7635                         fi
7636                 else
7637                         echo "$xxx_convert NOT found." >&4
7638                 fi
7639         done
7640                 
7641         case "$xxx_convert" in
7642         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7643         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7644         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7645         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7646            "$define$define$define")
7647               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7648            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7649            esac
7650            ;;  
7651         esac
7652 fi
7653
7654 : Initialize h_fcntl
7655 h_fcntl=false
7656
7657 : Initialize h_sysfile
7658 h_sysfile=false
7659
7660 : access call always available on UNIX
7661 set access d_access
7662 eval $inlibc
7663
7664 : locate the flags for 'access()'
7665 case "$d_access" in
7666 "$define")
7667         echo " "
7668         $cat >access.c <<'EOCP'
7669 #include <sys/types.h>
7670 #ifdef I_FCNTL
7671 #include <fcntl.h>
7672 #endif
7673 #ifdef I_SYS_FILE
7674 #include <sys/file.h>
7675 #endif
7676 #ifdef I_UNISTD
7677 #include <unistd.h>
7678 #endif
7679 int main() {
7680         exit(R_OK);
7681 }
7682 EOCP
7683         : check sys/file.h first, no particular reason here
7684         if $test `./findhdr sys/file.h` && \
7685                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7686                 h_sysfile=true;
7687                 echo "<sys/file.h> defines the *_OK access constants." >&4
7688         elif $test `./findhdr fcntl.h` && \
7689                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7690                 h_fcntl=true;
7691                 echo "<fcntl.h> defines the *_OK access constants." >&4
7692         elif $test `./findhdr unistd.h` && \
7693                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7694                 echo "<unistd.h> defines the *_OK access constants." >&4
7695         else
7696                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7697         fi
7698         ;;
7699 esac
7700 $rm -f access*
7701
7702 : see if accessx exists
7703 set accessx d_accessx
7704 eval $inlibc
7705
7706 : see if alarm exists
7707 set alarm d_alarm
7708 eval $inlibc
7709
7710 : see if atolf exists
7711 set atolf d_atolf
7712 eval $inlibc
7713
7714 : see if atoll exists
7715 set atoll d_atoll
7716 eval $inlibc
7717
7718 : Look for GNU-cc style attribute checking
7719 echo " "
7720 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7721 $cat >attrib.c <<'EOCP'
7722 #include <stdio.h>
7723 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7724 EOCP
7725 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7726         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7727                 echo "Your C compiler doesn't fully support __attribute__."
7728                 val="$undef"
7729         else
7730                 echo "Your C compiler supports __attribute__."
7731                 val="$define"
7732         fi
7733 else
7734         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7735         val="$undef"
7736 fi
7737 set d_attribut
7738 eval $setvar
7739 $rm -f attrib*
7740
7741 : see if bcmp exists
7742 set bcmp d_bcmp
7743 eval $inlibc
7744
7745 : see if bcopy exists
7746 set bcopy d_bcopy
7747 eval $inlibc
7748
7749 : see if this is a unistd.h system
7750 set unistd.h i_unistd
7751 eval $inhdr
7752
7753 : see if getpgrp exists
7754 set getpgrp d_getpgrp
7755 eval $inlibc
7756
7757 case "$d_getpgrp" in
7758 "$define")
7759         echo " "
7760         echo "Checking to see which flavor of getpgrp is in use..."
7761         $cat >set.c <<EOP
7762 #$i_unistd I_UNISTD
7763 #include <sys/types.h>
7764 #ifdef I_UNISTD
7765 #  include <unistd.h>
7766 #endif
7767 int main()
7768 {
7769         if (getuid() == 0) {
7770                 printf("(I see you are running Configure as super-user...)\n");
7771                 setuid(1);
7772         }
7773 #ifdef TRY_BSD_PGRP
7774         if (getpgrp(1) == 0)
7775                 exit(0);
7776 #else
7777         if (getpgrp() > 0)
7778                 exit(0);
7779 #endif
7780         exit(1);
7781 }
7782 EOP
7783         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7784                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7785                 val="$define"
7786         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7787                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7788                 val="$undef"
7789         else
7790                 echo "I can't seem to compile and run the test program."
7791                 if ./usg; then
7792                         xxx="a USG one, i.e. you use getpgrp()."
7793                 else
7794                         # SVR4 systems can appear rather BSD-ish.
7795                         case "$i_unistd" in
7796                         $undef)
7797                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7798                                 val="$define"
7799                                 ;;
7800                         $define)
7801                                 xxx="probably a USG one, i.e. you use getpgrp()."
7802                                 val="$undef"
7803                                 ;;
7804                         esac
7805                 fi
7806                 echo "Assuming your getpgrp is $xxx" >&4
7807         fi
7808         ;;
7809 *) val="$undef";;
7810 esac
7811 set d_bsdgetpgrp
7812 eval $setvar
7813 $rm -f set set.c
7814
7815 : see if setpgrp exists
7816 set setpgrp d_setpgrp
7817 eval $inlibc
7818
7819 case "$d_setpgrp" in
7820 "$define")
7821         echo " "
7822         echo "Checking to see which flavor of setpgrp is in use..."
7823         $cat >set.c <<EOP
7824 #$i_unistd I_UNISTD
7825 #include <sys/types.h>
7826 #ifdef I_UNISTD
7827 #  include <unistd.h>
7828 #endif
7829 int main()
7830 {
7831         if (getuid() == 0) {
7832                 printf("(I see you are running Configure as super-user...)\n");
7833                 setuid(1);
7834         }
7835 #ifdef TRY_BSD_PGRP
7836         if (-1 == setpgrp(1, 1))
7837                 exit(0);
7838 #else
7839         if (setpgrp() != -1)
7840                 exit(0);
7841 #endif
7842         exit(1);
7843 }
7844 EOP
7845         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7846                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7847                 val="$define"
7848         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7849                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7850                 val="$undef"
7851         else
7852                 echo "(I can't seem to compile and run the test program.)"
7853                 if ./usg; then
7854                         xxx="a USG one, i.e. you use setpgrp()."
7855                 else
7856                         # SVR4 systems can appear rather BSD-ish.
7857                         case "$i_unistd" in
7858                         $undef)
7859                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7860                                 val="$define"
7861                                 ;;
7862                         $define)
7863                                 xxx="probably a USG one, i.e. you use setpgrp()."
7864                                 val="$undef"
7865                                 ;;
7866                         esac
7867                 fi
7868                 echo "Assuming your setpgrp is $xxx" >&4
7869         fi
7870         ;;
7871 *) val="$undef";;
7872 esac
7873 set d_bsdsetpgrp
7874 eval $setvar
7875 $rm -f set set.c
7876 : see if bzero exists
7877 set bzero d_bzero
7878 eval $inlibc
7879
7880 : see if signal is declared as pointer to function returning int or void
7881 echo " "
7882 xxx=`./findhdr signal.h`
7883 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7884 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7885         echo "You have int (*signal())() instead of void." >&4
7886         val="$undef"
7887 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7888         echo "You have void (*signal())()." >&4
7889         val="$define"
7890 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7891         echo "You have int (*signal())() instead of void." >&4
7892         val="$undef"
7893 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7894         echo "You have void (*signal())()." >&4
7895         val="$define"
7896 else
7897         case "$d_voidsig" in
7898         '')
7899         echo "I can't determine whether signal handler returns void or int..." >&4
7900                 dflt=void
7901                 rp="What type does your signal handler return?"
7902                 . ./myread
7903                 case "$ans" in
7904                 v*) val="$define";;
7905                 *) val="$undef";;
7906                 esac;;
7907         "$define")
7908                 echo "As you already told me, signal handler returns void." >&4
7909                 val="$define"
7910                 ;;
7911         *)      echo "As you already told me, signal handler returns int." >&4
7912                 val="$undef"
7913                 ;;
7914         esac
7915 fi
7916 set d_voidsig
7917 eval $setvar
7918 case "$d_voidsig" in
7919 "$define") signal_t="void";;
7920 *) signal_t="int";;
7921 esac
7922 $rm -f $$.tmp
7923
7924 : check for ability to cast large floats to 32-bit ints.
7925 echo " "
7926 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7927 if $test "$intsize" -ge 4; then
7928         xxx=int
7929 else
7930         xxx=long
7931 fi
7932 $cat >try.c <<EOCP
7933 #include <stdio.h>
7934 #include <sys/types.h>
7935 #include <signal.h>
7936 $signal_t blech(s) int s; { exit(3); }
7937 int main()
7938 {
7939         $xxx i32;
7940         double f, g;
7941         int result = 0;
7942         char str[16];
7943         signal(SIGFPE, blech);
7944
7945         /* Don't let compiler optimize the test away.  Store the number 
7946            in a writable string for gcc to pass to sscanf under HP/UX.
7947         */
7948         sprintf(str, "2147483647");
7949         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7950         g = 10 * f;
7951         i32  = ($xxx) g;
7952
7953         /* x86 processors will probably give 0x8000 0000, which is a
7954        sign change.  We don't want that.  We want to mimic SPARC
7955            behavior here, which is to preserve the sign and give
7956            back 0x7fff ffff.
7957         */
7958         if (i32 != ($xxx) f)
7959                 result |= 1;
7960         exit(result);
7961 }
7962 EOCP
7963 set try
7964 if eval $compile_ok; then
7965         ./try
7966         yyy=$?
7967 else
7968         echo "(I can't seem to compile the test program--assuming it can't)"
7969         yyy=1
7970 fi
7971 case "$yyy" in
7972 0)      val="$define"
7973         echo "Yup, it can."
7974         ;;
7975 *)      val="$undef"
7976         echo "Nope, it can't."
7977         ;;
7978 esac
7979 set d_casti32
7980 eval $setvar
7981 $rm -f try try.*
7982
7983 : check for ability to cast negative floats to unsigned
7984 echo " "
7985 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7986 $cat >try.c <<EOCP
7987 #include <stdio.h>
7988 #include <sys/types.h>
7989 #include <signal.h>
7990 $signal_t blech(s) int s; { exit(7); }
7991 $signal_t blech_in_list(s) int s; { exit(4); }
7992 unsigned long dummy_long(p) unsigned long p; { return p; }
7993 unsigned int dummy_int(p) unsigned int p; { return p; }
7994 unsigned short dummy_short(p) unsigned short p; { return p; }
7995 int main()
7996 {
7997         double f;
7998         unsigned long along;
7999         unsigned int aint;
8000         unsigned short ashort;
8001         int result = 0;
8002         char str[16];
8003         
8004         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8005            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8006            optimized the whole file away
8007         */
8008         /* Store the number in a writable string for gcc to pass to 
8009            sscanf under HP/UX.
8010         */
8011         sprintf(str, "-123");
8012         sscanf(str, "%lf", &f);  /* f = -123.; */
8013
8014         signal(SIGFPE, blech);
8015         along = (unsigned long)f;
8016         aint = (unsigned int)f;
8017         ashort = (unsigned short)f;
8018         if (along != (unsigned long)-123)
8019                 result |= 1;
8020         if (aint != (unsigned int)-123)
8021                 result |= 1;
8022         if (ashort != (unsigned short)-123)
8023                 result |= 1;
8024         sprintf(str, "1073741824.");
8025         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8026         f = f + f;
8027         along = 0;
8028         along = (unsigned long)f;
8029         if (along != 0x80000000)
8030                 result |= 2;
8031         f -= 1.;
8032         along = 0;
8033         along = (unsigned long)f;
8034         if (along != 0x7fffffff)
8035                 result |= 1;
8036         f += 2.;
8037         along = 0;
8038         along = (unsigned long)f;
8039         if (along != 0x80000001)
8040                 result |= 2;
8041         if (result)
8042                 exit(result);
8043         signal(SIGFPE, blech_in_list);
8044         sprintf(str, "123.");
8045         sscanf(str, "%lf", &f);  /* f = 123.; */
8046         along = dummy_long((unsigned long)f);
8047         aint = dummy_int((unsigned int)f);
8048         ashort = dummy_short((unsigned short)f);
8049         if (along != (unsigned long)123)
8050                 result |= 4;
8051         if (aint != (unsigned int)123)
8052                 result |= 4;
8053         if (ashort != (unsigned short)123)
8054                 result |= 4;
8055         exit(result);
8056
8057 }
8058 EOCP
8059 set try
8060 if eval $compile_ok; then
8061         ./try
8062         castflags=$?
8063 else
8064         echo "(I can't seem to compile the test program--assuming it can't)"
8065         castflags=7
8066 fi
8067 case "$castflags" in
8068 0)      val="$define"
8069         echo "Yup, it can."
8070         ;;
8071 *)      val="$undef"
8072         echo "Nope, it can't."
8073         ;;
8074 esac
8075 set d_castneg
8076 eval $setvar
8077 $rm -f try.*
8078
8079 : see if vprintf exists
8080 echo " "
8081 if set vprintf val -f d_vprintf; eval $csym; $val; then
8082         echo 'vprintf() found.' >&4
8083         val="$define"
8084         $cat >vprintf.c <<'EOF'
8085 #include <varargs.h>
8086
8087 int main() { xxx("foo"); }
8088
8089 xxx(va_alist)
8090 va_dcl
8091 {
8092         va_list args;
8093         char buf[10];
8094
8095         va_start(args);
8096         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8097 }
8098 EOF
8099         set vprintf
8100         if eval $compile && ./vprintf; then
8101                 echo "Your vsprintf() returns (int)." >&4
8102                 val2="$undef"
8103         else
8104                 echo "Your vsprintf() returns (char*)." >&4
8105                 val2="$define"
8106         fi
8107 else
8108         echo 'vprintf() NOT found.' >&4
8109                 val="$undef"
8110                 val2="$undef"
8111 fi
8112 set d_vprintf
8113 eval $setvar
8114 val=$val2
8115 set d_charvspr
8116 eval $setvar
8117
8118 : see if chown exists
8119 set chown d_chown
8120 eval $inlibc
8121
8122 : see if chroot exists
8123 set chroot d_chroot
8124 eval $inlibc
8125
8126 : see if chsize exists
8127 set chsize d_chsize
8128 eval $inlibc
8129
8130 : check for const keyword
8131 echo " "
8132 echo 'Checking to see if your C compiler knows about "const"...' >&4
8133 $cat >const.c <<'EOCP'
8134 typedef struct spug { int drokk; } spug;
8135 int main()
8136 {
8137         const char *foo;
8138         const spug y;
8139 }
8140 EOCP
8141 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8142         val="$define"
8143         echo "Yup, it does."
8144 else
8145         val="$undef"
8146         echo "Nope, it doesn't."
8147 fi
8148 set d_const
8149 eval $setvar
8150
8151 : see if crypt exists
8152 echo " "
8153 if set crypt val -f d_crypt; eval $csym; $val; then
8154         echo 'crypt() found.' >&4
8155         val="$define"
8156         cryptlib=''
8157 else
8158         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8159         if $test -z "$cryptlib"; then
8160                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8161         else
8162                 cryptlib=-lcrypt
8163         fi
8164         if $test -z "$cryptlib"; then
8165                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8166         else
8167                 cryptlib=-lcrypt
8168         fi
8169         if $test -z "$cryptlib"; then
8170                 cryptlib=`./loc libcrypt$_a "" $libpth`
8171         else
8172                 cryptlib=-lcrypt
8173         fi
8174         if $test -z "$cryptlib"; then
8175                 echo 'crypt() NOT found.' >&4
8176                 val="$undef"
8177         else
8178                 val="$define"
8179         fi
8180 fi
8181 set d_crypt
8182 eval $setvar
8183
8184 : get csh whereabouts
8185 case "$csh" in
8186 'csh') val="$undef" ;;
8187 *) val="$define" ;;
8188 esac
8189 set d_csh
8190 eval $setvar
8191 : Respect a hint or command line value for full_csh.
8192 case "$full_csh" in
8193 '') full_csh=$csh ;;
8194 esac
8195
8196 : see if cuserid exists
8197 set cuserid d_cuserid
8198 eval $inlibc
8199
8200 : see if this is a limits.h system
8201 set limits.h i_limits
8202 eval $inhdr
8203
8204 : see if this is a float.h system
8205 set float.h i_float
8206 eval $inhdr
8207
8208 : See if number of significant digits in a double precision number is known
8209 echo " "
8210 $cat >dbl_dig.c <<EOM
8211 #$i_limits I_LIMITS
8212 #$i_float I_FLOAT
8213 #ifdef I_LIMITS
8214 #include <limits.h>
8215 #endif
8216 #ifdef I_FLOAT
8217 #include <float.h>
8218 #endif
8219 #ifdef DBL_DIG
8220 printf("Contains DBL_DIG");
8221 #endif
8222 EOM
8223 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8224 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8225         echo "DBL_DIG found." >&4
8226         val="$define"
8227 else
8228         echo "DBL_DIG NOT found." >&4
8229         val="$undef"
8230 fi
8231 $rm -f dbl_dig.?
8232 set d_dbl_dig
8233 eval $setvar
8234
8235 : see if difftime exists
8236 set difftime d_difftime
8237 eval $inlibc
8238
8239 : see if this is a dirent system
8240 echo " "
8241 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8242         val="$define"
8243         echo "<dirent.h> found." >&4
8244 else
8245         val="$undef"
8246         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8247                 echo "<sys/dir.h> found." >&4
8248                 echo " "
8249         else
8250                 xinc=`./findhdr sys/ndir.h`
8251         fi
8252         echo "<dirent.h> NOT found." >&4
8253 fi
8254 set i_dirent
8255 eval $setvar
8256
8257 : Look for type of directory structure.
8258 echo " "
8259 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8260
8261 case "$direntrytype" in
8262 ''|' ')
8263         case "$i_dirent" in
8264         $define) guess1='struct dirent' ;;
8265         *) guess1='struct direct'  ;;
8266         esac
8267         ;;
8268 *)      guess1="$direntrytype"
8269         ;;
8270 esac
8271
8272 case "$guess1" in
8273 'struct dirent') guess2='struct direct' ;;
8274 *) guess2='struct dirent' ;;
8275 esac
8276                 
8277 if $contains "$guess1" try.c >/dev/null 2>&1; then
8278         direntrytype="$guess1"
8279         echo "Your directory entries are $direntrytype." >&4
8280 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8281         direntrytype="$guess2"
8282         echo "Your directory entries seem to be $direntrytype." >&4
8283 else
8284         echo "I don't recognize your system's directory entries." >&4
8285         rp="What type is used for directory entries on this system?"
8286         dflt="$guess1"
8287         . ./myread
8288         direntrytype="$ans"
8289 fi
8290 $rm -f try.c
8291
8292
8293 : see if the directory entry stores field length
8294 echo " "
8295 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8296 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8297         echo "Good, your directory entry keeps length information in d_namlen." >&4
8298         val="$define"
8299 else
8300         echo "Your directory entry does not know about the d_namlen field." >&4
8301         val="$undef"
8302 fi
8303 set d_dirnamlen
8304 eval $setvar
8305 $rm -f try.c
8306
8307 : see if dlerror exists
8308 xxx_runnm="$runnm"
8309 runnm=false
8310 set dlerror d_dlerror
8311 eval $inlibc
8312 runnm="$xxx_runnm"
8313
8314 : see if dlfcn is available
8315 set dlfcn.h i_dlfcn
8316 eval $inhdr
8317
8318 case "$usedl" in
8319 $define|y|true)
8320         $cat << EOM
8321
8322 On a few systems, the dynamically loaded modules that perl generates and uses
8323 will need a different extension than shared libs. The default will probably
8324 be appropriate.
8325
8326 EOM
8327         case "$dlext" in
8328         '')     dflt="$so" ;;
8329         *)      dflt="$dlext" ;;
8330         esac
8331         rp='What is the extension of dynamically loaded modules'
8332         . ./myread
8333         dlext="$ans"
8334         ;;
8335 *)
8336         dlext="none"
8337         ;;
8338 esac
8339
8340 : Check if dlsym need a leading underscore
8341 echo " "
8342 val="$undef"
8343
8344 case "$dlsrc" in
8345 dl_dlopen.xs)
8346         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8347         $cat >dyna.c <<'EOM'
8348 fred () { }
8349 EOM
8350
8351 $cat >fred.c<<EOM
8352
8353 #include <stdio.h>
8354 #$i_dlfcn I_DLFCN
8355 #ifdef I_DLFCN
8356 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8357 #else
8358 #include <sys/types.h>
8359 #include <nlist.h>
8360 #include <link.h>
8361 #endif
8362
8363 extern int fred() ;
8364
8365 int main()
8366 {
8367     void * handle ;
8368     void * symbol ;
8369 #ifndef RTLD_LAZY
8370     int mode = 1 ;
8371 #else
8372     int mode = RTLD_LAZY ;
8373 #endif
8374     handle = dlopen("./dyna.$dlext", mode) ;
8375     if (handle == NULL) {
8376         printf ("1\n") ;
8377         fflush (stdout) ;
8378         exit(0);
8379     }
8380     symbol = dlsym(handle, "fred") ;
8381     if (symbol == NULL) {
8382         /* try putting a leading underscore */
8383         symbol = dlsym(handle, "_fred") ;
8384         if (symbol == NULL) {
8385             printf ("2\n") ;
8386             fflush (stdout) ;
8387             exit(0);
8388         }
8389         printf ("3\n") ;
8390     }
8391     else
8392         printf ("4\n") ;
8393     fflush (stdout) ;
8394     exit(0);
8395 }
8396 EOM
8397         : Call the object file tmp-dyna.o in case dlext=o.
8398         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8399                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8400                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8401                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8402                 xxx=`./fred`
8403                 case $xxx in
8404                 1)      echo "Test program failed using dlopen." >&4
8405                         echo "Perhaps you should not use dynamic loading." >&4;;
8406                 2)      echo "Test program failed using dlsym." >&4
8407                         echo "Perhaps you should not use dynamic loading." >&4;;
8408                 3)      echo "dlsym needs a leading underscore" >&4
8409                         val="$define" ;;
8410                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8411                 esac
8412         else
8413                 echo "I can't compile and run the test program." >&4
8414                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8415         fi
8416         ;;
8417 esac
8418                 
8419 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8420
8421 set d_dlsymun
8422 eval $setvar
8423
8424 hasproto='varname=$1; func=$2; shift; shift;
8425 while $test $# -ge 2; do
8426         case "$1" in
8427         $define) echo "#include <$2>";;
8428         esac ;
8429     shift 2;
8430 done > try.c;
8431 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8432 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8433         echo "$func() prototype found.";
8434         val="$define";
8435 else
8436         echo "$func() prototype NOT found.";
8437         val="$undef";
8438 fi;
8439 set $varname;
8440 eval $setvar;
8441 $rm -f try.c tryout.c'
8442
8443 : see if prototype for drand48 is available
8444 echo " "
8445 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8446 eval $hasproto
8447
8448 : see if dup2 exists
8449 set dup2 d_dup2
8450 eval $inlibc
8451
8452 : see if eaccess exists
8453 set eaccess d_eaccess
8454 eval $inlibc
8455
8456 : see if endgrent exists
8457 set endgrent d_endgrent
8458 eval $inlibc
8459
8460 : see if endhostent exists
8461 set endhostent d_endhent
8462 eval $inlibc
8463
8464 : see if endnetent exists
8465 set endnetent d_endnent
8466 eval $inlibc
8467
8468 : see if endprotoent exists
8469 set endprotoent d_endpent
8470 eval $inlibc
8471
8472 : see if endpwent exists
8473 set endpwent d_endpwent
8474 eval $inlibc
8475
8476 : see if endservent exists
8477 set endservent d_endsent
8478 eval $inlibc
8479
8480 : see if endspent exists
8481 set endspent d_endspent
8482 eval $inlibc
8483
8484 : Locate the flags for 'open()'
8485 echo " "
8486 $cat >open3.c <<'EOCP'
8487 #include <sys/types.h>
8488 #ifdef I_FCNTL
8489 #include <fcntl.h>
8490 #endif
8491 #ifdef I_SYS_FILE
8492 #include <sys/file.h>
8493 #endif
8494 int main() {
8495         if(O_RDONLY);
8496 #ifdef O_TRUNC
8497         exit(0);
8498 #else
8499         exit(1);
8500 #endif
8501 }
8502 EOCP
8503 : check sys/file.h first to get FREAD on Sun
8504 if $test `./findhdr sys/file.h` && \
8505                 set open3 -DI_SYS_FILE && eval $compile; then
8506         h_sysfile=true;
8507         echo "<sys/file.h> defines the O_* constants..." >&4
8508         if ./open3; then
8509                 echo "and you have the 3 argument form of open()." >&4
8510                 val="$define"
8511         else
8512                 echo "but not the 3 argument form of open().  Oh, well." >&4
8513                 val="$undef"
8514         fi
8515 elif $test `./findhdr fcntl.h` && \
8516                 set open3 -DI_FCNTL && eval $compile; then
8517         h_fcntl=true;
8518         echo "<fcntl.h> defines the O_* constants..." >&4
8519         if ./open3; then
8520                 echo "and you have the 3 argument form of open()." >&4
8521                 val="$define"
8522         else
8523                 echo "but not the 3 argument form of open().  Oh, well." >&4
8524                 val="$undef"
8525         fi
8526 else
8527         val="$undef"
8528         echo "I can't find the O_* constant definitions!  You got problems." >&4
8529 fi
8530 set d_open3
8531 eval $setvar
8532 $rm -f open3*
8533
8534 : see which of string.h or strings.h is needed
8535 echo " "
8536 strings=`./findhdr string.h`
8537 if $test "$strings" && $test -r "$strings"; then
8538         echo "Using <string.h> instead of <strings.h>." >&4
8539         val="$define"
8540 else
8541         val="$undef"
8542         strings=`./findhdr strings.h`
8543         if $test "$strings" && $test -r "$strings"; then
8544                 echo "Using <strings.h> instead of <string.h>." >&4
8545         else
8546                 echo "No string header found -- You'll surely have problems." >&4
8547         fi
8548 fi
8549 set i_string
8550 eval $setvar
8551 case "$i_string" in
8552 "$undef") strings=`./findhdr strings.h`;;
8553 *)        strings=`./findhdr string.h`;;
8554 esac
8555
8556 : check for non-blocking I/O stuff
8557 case "$h_sysfile" in
8558 true) echo "#include <sys/file.h>" > head.c;;
8559 *)
8560         case "$h_fcntl" in
8561         true) echo "#include <fcntl.h>" > head.c;;
8562         *) echo "#include <sys/fcntl.h>" > head.c;;
8563         esac
8564         ;;
8565 esac
8566 echo " "
8567 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8568 case "$o_nonblock" in
8569 '')
8570         $cat head.c > try.c
8571         $cat >>try.c <<'EOCP'
8572 #include <stdio.h>
8573 int main() {
8574 #ifdef O_NONBLOCK
8575         printf("O_NONBLOCK\n");
8576         exit(0);
8577 #endif
8578 #ifdef O_NDELAY
8579         printf("O_NDELAY\n");
8580         exit(0);
8581 #endif
8582 #ifdef FNDELAY
8583         printf("FNDELAY\n");
8584         exit(0);
8585 #endif
8586         exit(0);
8587 }
8588 EOCP
8589         set try
8590         if eval $compile_ok; then
8591                 o_nonblock=`./try`
8592                 case "$o_nonblock" in
8593                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8594                 *) echo "Seems like we can use $o_nonblock.";;
8595                 esac
8596         else
8597                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8598         fi
8599         ;;
8600 *) echo "Using $hint value $o_nonblock.";;
8601 esac
8602 $rm -f try try.* .out core
8603
8604 echo " "
8605 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8606 case "$eagain" in
8607 '')
8608         $cat head.c > try.c
8609         $cat >>try.c <<EOCP
8610 #include <errno.h>
8611 #include <sys/types.h>
8612 #include <signal.h>
8613 #include <stdio.h> 
8614 #define MY_O_NONBLOCK $o_nonblock
8615 #ifndef errno  /* XXX need better Configure test */
8616 extern int errno;
8617 #endif
8618 #$i_unistd I_UNISTD
8619 #ifdef I_UNISTD
8620 #include <unistd.h>
8621 #endif
8622 #$i_string I_STRING
8623 #ifdef I_STRING
8624 #include <string.h>
8625 #else
8626 #include <strings.h>
8627 #endif
8628 $signal_t blech(x) int x; { exit(3); }
8629 EOCP
8630         $cat >> try.c <<'EOCP'
8631 int main()
8632 {
8633         int pd[2];
8634         int pu[2];
8635         char buf[1];
8636         char string[100];
8637
8638         pipe(pd);       /* Down: child -> parent */
8639         pipe(pu);       /* Up: parent -> child */
8640         if (0 != fork()) {
8641                 int ret;
8642                 close(pd[1]);   /* Parent reads from pd[0] */
8643                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8644                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8645                         exit(1);
8646                 signal(SIGALRM, blech);
8647                 alarm(5);
8648                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8649                         exit(2);
8650                 sprintf(string, "%d\n", ret);
8651                 write(2, string, strlen(string));
8652                 alarm(0);
8653 #ifdef EAGAIN
8654                 if (errno == EAGAIN) {
8655                         printf("EAGAIN\n");
8656                         goto ok;
8657                 }
8658 #endif
8659 #ifdef EWOULDBLOCK
8660                 if (errno == EWOULDBLOCK)
8661                         printf("EWOULDBLOCK\n");
8662 #endif
8663         ok:
8664                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8665                 sleep(2);                               /* Give it time to close our pipe */
8666                 alarm(5);
8667                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8668                 alarm(0);
8669                 sprintf(string, "%d\n", ret);
8670                 write(3, string, strlen(string));
8671                 exit(0);
8672         }
8673
8674         close(pd[0]);                   /* We write to pd[1] */
8675         close(pu[1]);                   /* We read from pu[0] */
8676         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8677         close(pd[1]);                   /* Pipe pd is now fully closed! */
8678         exit(0);                                /* Bye bye, thank you for playing! */
8679 }
8680 EOCP
8681         set try
8682         if eval $compile_ok; then
8683                 echo "$startsh" >mtry
8684                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8685                 chmod +x mtry
8686                 ./mtry >/dev/null 2>&1
8687                 case $? in
8688                 0) eagain=`$cat try.out`;;
8689                 1) echo "Could not perform non-blocking setting!";;
8690                 2) echo "I did a successful read() for something that was not there!";;
8691                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8692                 *) echo "Something terribly wrong happened during testing.";;
8693                 esac
8694                 rd_nodata=`$cat try.ret`
8695                 echo "A read() system call with no data present returns $rd_nodata."
8696                 case "$rd_nodata" in
8697                 0|-1) ;;
8698                 *)
8699                         echo "(That's peculiar, fixing that to be -1.)"
8700                         rd_nodata=-1
8701                         ;;
8702                 esac
8703                 case "$eagain" in
8704                 '')
8705                         echo "Forcing errno EAGAIN on read() with no data available."
8706                         eagain=EAGAIN
8707                         ;;
8708                 *)
8709                         echo "Your read() sets errno to $eagain when no data is available."
8710                         ;;
8711                 esac
8712                 status=`$cat try.err`
8713                 case "$status" in
8714                 0) echo "And it correctly returns 0 to signal EOF.";;
8715                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8716                 *) echo "However, your read() returns '$status' on EOF??";;
8717                 esac
8718                 val="$define"
8719                 if test "$status" = "$rd_nodata"; then
8720                         echo "WARNING: you can't distinguish between EOF and no data!"
8721                         val="$undef"
8722                 fi
8723         else
8724                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8725                 eagain=EAGAIN
8726         fi
8727         set d_eofnblk
8728         eval $setvar
8729         ;;
8730 *)
8731         echo "Using $hint value $eagain."
8732         echo "Your read() returns $rd_nodata when no data is present."
8733         case "$d_eofnblk" in
8734         "$define") echo "And you can see EOF because read() returns 0.";;
8735         "$undef") echo "But you can't see EOF status from read() returned value.";;
8736         *)
8737                 echo "(Assuming you can't see EOF status from read anyway.)"
8738                 d_eofnblk=$undef
8739                 ;;
8740         esac
8741         ;;
8742 esac
8743 $rm -f try try.* .out core head.c mtry
8744
8745 : see if fchmod exists
8746 set fchmod d_fchmod
8747 eval $inlibc
8748
8749 : see if fchown exists
8750 set fchown d_fchown
8751 eval $inlibc
8752
8753 : see if this is an fcntl system
8754 set fcntl d_fcntl
8755 eval $inlibc
8756
8757 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8758 while $test $# -ge 2; do
8759         case "$1" in
8760         $define) echo "#include <$2>";;
8761         esac ;
8762     shift 2;
8763 done > try.c;
8764 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8765 set try;
8766 if eval $compile; then
8767         val="$define";
8768 else
8769         val="$undef";
8770 fi;
8771 set $varname;
8772 eval $setvar;
8773 $rm -f try.c try.o'
8774
8775 socketlib=''
8776 sockethdr=''
8777 : see whether socket exists
8778 echo " "
8779 $echo $n "Hmm... $c" >&4
8780 if set socket val -f d_socket; eval $csym; $val; then
8781         echo "Looks like you have Berkeley networking support." >&4
8782         d_socket="$define"
8783         if set setsockopt val -f; eval $csym; $val; then
8784                 d_oldsock="$undef"
8785         else
8786                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8787                 d_oldsock="$define"
8788         fi
8789 else
8790         if $contains socklib libc.list >/dev/null 2>&1; then
8791                 echo "Looks like you have Berkeley networking support." >&4
8792                 d_socket="$define"
8793                 : we will have to assume that it supports the 4.2 BSD interface
8794                 d_oldsock="$undef"
8795         else
8796                 echo "You don't have Berkeley networking in libc$_a..." >&4
8797                 if test "X$d_socket" = "X$define"; then
8798                    echo "...but you seem to believe that you have sockets." >&4
8799                 else
8800                         for net in net socket
8801                         do
8802                                 if test -f /usr/lib/lib$net$_a; then
8803                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8804                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8805                                         if $contains socket libc.list >/dev/null 2>&1; then
8806                                                 d_socket="$define"
8807                                                 socketlib="-l$net"
8808                                                 case "$net" in
8809                                                 net)
8810                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8811                                                         sockethdr="-I/usr/netinclude"
8812                                                         ;;
8813                                                 esac
8814                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8815                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8816                                                         d_oldsock="$undef"
8817                                                 else
8818                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8819                                                         d_oldsock="$define"
8820                                                 fi
8821                                                 break
8822                                         fi
8823                                 fi
8824                         done
8825                         if test "X$d_socket" != "X$define"; then
8826                            echo "or anywhere else I see." >&4
8827                            d_socket="$undef"
8828                            d_oldsock="$undef"
8829                         fi
8830                 fi
8831         fi
8832 fi
8833
8834 : see if socketpair exists
8835 set socketpair d_sockpair
8836 eval $inlibc
8837
8838
8839 echo " "
8840 echo "Checking the availability of certain socket constants..." >& 4
8841 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8842         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8843         $cat >try.c <<EOF
8844 #include <sys/types.h>
8845 #include <sys/socket.h>
8846 int main() {
8847     int i = $ENUM;
8848 }
8849 EOF
8850         val="$undef"
8851         set try; if eval $compile; then
8852                 val="$define"
8853         fi
8854         set d_${enum}; eval $setvar
8855         $rm -f try.c try
8856 done
8857
8858 : see if sys/select.h has to be included
8859 set sys/select.h i_sysselct
8860 eval $inhdr
8861
8862 : see if we should include time.h, sys/time.h, or both
8863 echo " "
8864 if test "X$timeincl" = X; then
8865         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8866         $echo $n "I'm now running the test program...$c"
8867         $cat >try.c <<'EOCP'
8868 #include <sys/types.h>
8869 #ifdef I_TIME
8870 #include <time.h>
8871 #endif
8872 #ifdef I_SYSTIME
8873 #ifdef SYSTIMEKERNEL
8874 #define KERNEL
8875 #endif
8876 #include <sys/time.h>
8877 #endif
8878 #ifdef I_SYSSELECT
8879 #include <sys/select.h>
8880 #endif
8881 int main()
8882 {
8883         struct tm foo;
8884 #ifdef S_TIMEVAL
8885         struct timeval bar;
8886 #endif
8887 #ifdef S_TIMEZONE
8888         struct timezone tzp;
8889 #endif
8890         if (foo.tm_sec == foo.tm_sec)
8891                 exit(0);
8892 #ifdef S_TIMEVAL
8893         if (bar.tv_sec == bar.tv_sec)
8894                 exit(0);
8895 #endif
8896         exit(1);
8897 }
8898 EOCP
8899         flags=''
8900         for s_timezone in '-DS_TIMEZONE' ''; do
8901         sysselect=''
8902         for s_timeval in '-DS_TIMEVAL' ''; do
8903         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8904         for i_time in '' '-DI_TIME'; do
8905         for i_systime in '-DI_SYSTIME' ''; do
8906                 case "$flags" in
8907                 '') $echo $n ".$c"
8908                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8909                         if eval $compile; then
8910                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8911                                 shift
8912                                 flags="$*"
8913                                 echo " "
8914                                 $echo $n "Succeeded with $flags$c"
8915                         fi
8916                         ;;
8917                 esac
8918         done
8919         done
8920         done
8921         done
8922         done
8923         timeincl=''
8924         echo " "
8925         case "$flags" in
8926         *SYSTIMEKERNEL*) i_systimek="$define"
8927                 timeincl=`./findhdr sys/time.h`
8928                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8929         *) i_systimek="$undef";;
8930         esac
8931         case "$flags" in
8932         *I_TIME*) i_time="$define"
8933                 timeincl=`./findhdr time.h`" $timeincl"
8934                 echo "We'll include <time.h>." >&4;;
8935         *) i_time="$undef";;
8936         esac
8937         case "$flags" in
8938         *I_SYSTIME*) i_systime="$define"
8939                 timeincl=`./findhdr sys/time.h`" $timeincl"
8940                 echo "We'll include <sys/time.h>." >&4;;
8941         *) i_systime="$undef";;
8942         esac
8943         $rm -f try.c try
8944 fi
8945
8946 : check for fd_set items
8947 $cat <<EOM
8948
8949 Checking to see how well your C compiler handles fd_set and friends ...
8950 EOM
8951 $cat >fd_set.c <<EOCP
8952 #$i_systime I_SYS_TIME
8953 #$i_sysselct I_SYS_SELECT
8954 #$d_socket HAS_SOCKET
8955 #include <sys/types.h>
8956 #ifdef HAS_SOCKET
8957 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8958 #endif
8959 #ifdef I_SYS_TIME
8960 #include <sys/time.h>
8961 #endif
8962 #ifdef I_SYS_SELECT
8963 #include <sys/select.h>
8964 #endif
8965 int main() {
8966         fd_set fds;
8967
8968 #ifdef TRYBITS
8969         if(fds.fds_bits);
8970 #endif
8971
8972 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8973         exit(0);
8974 #else
8975         exit(1);
8976 #endif
8977 }
8978 EOCP
8979 set fd_set -DTRYBITS
8980 if eval $compile; then
8981         d_fds_bits="$define"
8982         d_fd_set="$define"
8983         echo "Well, your system knows about the normal fd_set typedef..." >&4
8984         if ./fd_set; then
8985                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8986                 d_fd_macros="$define"
8987         else
8988                 $cat >&4 <<'EOM'
8989 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8990 EOM
8991                 d_fd_macros="$undef"
8992         fi
8993 else
8994         $cat <<'EOM'
8995 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8996 EOM
8997         set fd_set
8998         if eval $compile; then
8999                 d_fds_bits="$undef"
9000                 d_fd_set="$define"
9001                 echo "Well, your system has some sort of fd_set available..." >&4
9002                 if ./fd_set; then
9003                         echo "and you have the normal fd_set macros." >&4
9004                         d_fd_macros="$define"
9005                 else
9006                         $cat <<'EOM'
9007 but not the normal fd_set macros!  Gross!  More work for me...
9008 EOM
9009                         d_fd_macros="$undef"
9010                 fi
9011         else
9012         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9013                 d_fd_set="$undef"
9014                 d_fds_bits="$undef"
9015                 d_fd_macros="$undef"
9016         fi
9017 fi
9018 $rm -f fd_set*
9019
9020 : see if fgetpos exists
9021 set fgetpos d_fgetpos
9022 eval $inlibc
9023
9024 : see if flock exists
9025 set flock d_flock
9026 eval $inlibc
9027
9028 : see if fork exists
9029 set fork d_fork
9030 eval $inlibc
9031
9032 : see if pathconf exists
9033 set pathconf d_pathconf
9034 eval $inlibc
9035
9036 : see if fpathconf exists
9037 set fpathconf d_fpathconf
9038 eval $inlibc
9039
9040
9041 : check for fpos64_t
9042 echo " "
9043 echo "Checking to see if you have fpos64_t..." >&4
9044 $cat >try.c <<EOCP
9045 #include <stdio.h>
9046 int main() { fpos64_t x = 7; }
9047 EOCP
9048 set try
9049 if eval $compile; then
9050         val="$define"
9051         echo "You have fpos64_t."
9052 else
9053         val="$undef"
9054         echo "You do not have fpos64_t."
9055         case "$fpossize" in
9056         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9057         esac
9058 fi
9059 $rm -f try.* try
9060 set d_fpos64_t
9061 eval $setvar
9062
9063 hasstruct='varname=$1; struct=$2; shift; shift;
9064 while $test $# -ge 2; do
9065         case "$1" in
9066         $define) echo "#include <$2>";;
9067         esac ;
9068     shift 2;
9069 done > try.c;
9070 echo "int main () { struct $struct foo; }" >> try.c;
9071 set try;
9072 if eval $compile; then
9073         val="$define";
9074 else
9075         val="$undef";
9076 fi;
9077 set $varname;
9078 eval $setvar;
9079 $rm -f try.c try.o'
9080
9081 : see if this is a sys/param system
9082 set sys/param.h i_sysparam
9083 eval $inhdr
9084
9085 : see if this is a sys/mount.h system
9086 set sys/mount.h i_sysmount
9087 eval $inhdr
9088
9089 : see if sys/types.h has to be included
9090 set sys/types.h i_systypes
9091 eval $inhdr
9092
9093
9094 echo " "
9095 echo "Checking to see if your system supports struct fs_data..." >&4
9096 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9097 eval $hasstruct
9098 case "$d_fs_data_s" in
9099 "$define")      echo "Yes, it does."   ;;
9100 *)              echo "No, it doesn't." ;;
9101 esac
9102
9103 : see if fseeko exists
9104 set fseeko d_fseeko
9105 eval $inlibc
9106 case "$longsize" in
9107 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9108 esac
9109
9110 : see if fsetpos exists
9111 set fsetpos d_fsetpos
9112 eval $inlibc
9113
9114
9115 : see if fstatfs exists
9116 set fstatfs d_fstatfs
9117 eval $inlibc
9118
9119
9120 : see if statvfs exists
9121 set statvfs d_statvfs
9122 eval $inlibc
9123
9124 : see if fstatvfs exists
9125 set fstatvfs d_fstatvfs
9126 eval $inlibc
9127
9128
9129 : see if ftello exists
9130 set ftello d_ftello
9131 eval $inlibc
9132 case "$longsize" in
9133 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9134 esac
9135
9136 : see if getcwd exists
9137 set getcwd d_getcwd
9138 eval $inlibc
9139
9140
9141 : see if getfsstat exists
9142 set getfsstat d_getfsstat
9143 eval $inlibc
9144
9145 : see if getgrent exists
9146 set getgrent d_getgrent
9147 eval $inlibc
9148
9149 : see if gethostbyaddr exists
9150 set gethostbyaddr d_gethbyaddr
9151 eval $inlibc
9152
9153 : see if gethostbyname exists
9154 set gethostbyname d_gethbyname
9155 eval $inlibc
9156
9157 : see if gethostent exists
9158 set gethostent d_gethent
9159 eval $inlibc
9160
9161 : see how we will look up host name
9162 echo " "
9163 call=''
9164 if set gethostname val -f d_gethname; eval $csym; $val; then
9165         echo 'gethostname() found.' >&4
9166         d_gethname="$define"
9167         call=gethostname
9168 fi
9169 if set uname val -f d_uname; eval $csym; $val; then
9170         if ./xenix; then
9171                 $cat <<'EOM'
9172 uname() was found, but you're running xenix, and older versions of xenix
9173 have a broken uname(). If you don't really know whether your xenix is old
9174 enough to have a broken system call, use the default answer.
9175
9176 EOM
9177                 dflt=y
9178                 case "$d_uname" in
9179                 "$define") dflt=n;;
9180                 esac
9181                 rp='Is your uname() broken?'
9182                 . ./myread
9183                 case "$ans" in
9184                 n*) d_uname="$define"; call=uname;;
9185                 esac
9186         else
9187                 echo 'uname() found.' >&4
9188                 d_uname="$define"
9189                 case "$call" in
9190                 '') call=uname ;;
9191                 esac
9192         fi
9193 fi
9194 case "$d_gethname" in
9195 '') d_gethname="$undef";;
9196 esac
9197 case "$d_uname" in
9198 '') d_uname="$undef";;
9199 esac
9200 case "$d_uname$d_gethname" in
9201 *define*)
9202         dflt=n
9203         cat <<EOM
9204  
9205 Every now and then someone has a $call() that lies about the hostname
9206 but can't be fixed for political or economic reasons.  If you wish, I can
9207 pretend $call() isn't there and maybe compute hostname at run-time
9208 thanks to the '$phostname' command.
9209
9210 EOM
9211         rp="Shall I ignore $call() from now on?"
9212         . ./myread
9213         case "$ans" in
9214         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9215         esac;;
9216 esac
9217 case "$phostname" in
9218 '') aphostname='';;
9219 *) case "$aphostname" in
9220         /*) ;;
9221         *) set X $phostname
9222                 shift
9223                 file=$1
9224                 shift
9225                 file=`./loc $file $file $pth`
9226                 aphostname=`echo $file $*`
9227                 ;;
9228         esac
9229         ;;
9230 esac
9231 case "$d_uname$d_gethname" in
9232 *define*) ;;
9233 *)
9234         case "$phostname" in
9235         '')
9236                 echo "There will be no way for $package to get your hostname." >&4;;
9237         *)
9238         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9239                 ;;
9240         esac;;
9241 esac
9242 case "$d_phostname" in
9243 '') d_phostname="$undef";;
9244 esac
9245
9246 : see if this is a netdb.h system
9247 set netdb.h i_netdb
9248 eval $inhdr
9249
9250 : see if prototypes for various gethostxxx netdb.h functions are available
9251 echo " "
9252 set d_gethostprotos gethostent $i_netdb netdb.h
9253 eval $hasproto
9254
9255 : see if getlogin exists
9256 set getlogin d_getlogin
9257 eval $inlibc
9258
9259 : see if getmnt exists
9260 set getmnt d_getmnt
9261 eval $inlibc
9262
9263 : see if getmntent exists
9264 set getmntent d_getmntent
9265 eval $inlibc
9266
9267 : see if getnetbyaddr exists
9268 set getnetbyaddr d_getnbyaddr
9269 eval $inlibc
9270
9271 : see if getnetbyname exists
9272 set getnetbyname d_getnbyname
9273 eval $inlibc
9274
9275 : see if getnetent exists
9276 set getnetent d_getnent
9277 eval $inlibc
9278
9279 : see if prototypes for various getnetxxx netdb.h functions are available
9280 echo " "
9281 set d_getnetprotos getnetent $i_netdb netdb.h
9282 eval $hasproto
9283
9284
9285 : see if getprotobyname exists
9286 set getprotobyname d_getpbyname
9287 eval $inlibc
9288
9289 : see if getprotobynumber exists
9290 set getprotobynumber d_getpbynumber
9291 eval $inlibc
9292
9293 : see if getprotoent exists
9294 set getprotoent d_getpent
9295 eval $inlibc
9296
9297 : see if getpgid exists
9298 set getpgid d_getpgid
9299 eval $inlibc
9300
9301 : see if getpgrp2 exists
9302 set getpgrp2 d_getpgrp2
9303 eval $inlibc
9304
9305 : see if getppid exists
9306 set getppid d_getppid
9307 eval $inlibc
9308
9309 : see if getpriority exists
9310 set getpriority d_getprior
9311 eval $inlibc
9312
9313 : see if prototypes for various getprotoxxx netdb.h functions are available
9314 echo " "
9315 set d_getprotoprotos getprotoent $i_netdb netdb.h
9316 eval $hasproto
9317
9318 : see if getpwent exists
9319 set getpwent d_getpwent
9320 eval $inlibc
9321
9322
9323 : see if getservbyname exists
9324 set getservbyname d_getsbyname
9325 eval $inlibc
9326
9327 : see if getservbyport exists
9328 set getservbyport d_getsbyport
9329 eval $inlibc
9330
9331 : see if getservent exists
9332 set getservent d_getsent
9333 eval $inlibc
9334
9335 : see if prototypes for various getservxxx netdb.h functions are available
9336 echo " "
9337 set d_getservprotos getservent $i_netdb netdb.h
9338 eval $hasproto
9339
9340 : see if getspent exists
9341 set getspent d_getspent
9342 eval $inlibc
9343
9344 : see if getspnam exists
9345 set getspnam d_getspnam
9346 eval $inlibc
9347
9348 : see if gettimeofday or ftime exists
9349 set gettimeofday d_gettimeod
9350 eval $inlibc
9351 case "$d_gettimeod" in
9352 "$undef")
9353         set ftime d_ftime 
9354         eval $inlibc
9355         ;;
9356 *)
9357         val="$undef"; set d_ftime; eval $setvar
9358         ;;
9359 esac
9360 case "$d_gettimeod$d_ftime" in
9361 "$undef$undef")
9362         echo " "
9363         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9364         ;;
9365 esac
9366
9367 : see if this is an grp system
9368 set grp.h i_grp
9369 eval $inhdr
9370
9371 case "$i_grp" in
9372 $define)
9373         xxx=`./findhdr grp.h`
9374         $cppstdin $cppflags $cppminus < $xxx >$$.h
9375
9376         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9377                 val="$define"
9378         else
9379                 val="$undef"
9380         fi
9381         set d_grpasswd
9382         eval $setvar
9383
9384         $rm -f $$.h
9385         ;;
9386 *)
9387         val="$undef";
9388         set d_grpasswd; eval $setvar
9389         ;;
9390 esac
9391
9392 : see if hasmntopt exists
9393 set hasmntopt d_hasmntopt
9394 eval $inlibc
9395
9396 : see if this is a netinet/in.h or sys/in.h system
9397 set netinet/in.h i_niin sys/in.h i_sysin
9398 eval $inhdr
9399
9400 : see if arpa/inet.h has to be included
9401 set arpa/inet.h i_arpainet
9402 eval $inhdr
9403
9404 : see if htonl --and friends-- exists
9405 val=''
9406 set htonl val
9407 eval $inlibc
9408
9409 : Maybe they are macros.
9410 case "$val" in
9411 $undef)
9412         $cat >htonl.c <<EOM
9413 #include <stdio.h>
9414 #include <sys/types.h>
9415 #$i_niin I_NETINET_IN
9416 #$i_sysin I_SYS_IN
9417 #$i_arpainet I_ARPA_INET
9418 #ifdef I_NETINET_IN
9419 #include <netinet/in.h>
9420 #endif
9421 #ifdef I_SYS_IN
9422 #include <sys/in.h>
9423 #endif
9424 #ifdef I_ARPA_INET
9425 #include <arpa/inet.h>
9426 #endif
9427 #ifdef htonl
9428 printf("Defined as a macro.");
9429 #endif
9430 EOM
9431         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9432         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9433                 val="$define"
9434                 echo "But it seems to be defined as a macro." >&4
9435         fi
9436         $rm -f htonl.?
9437         ;;
9438 esac
9439 set d_htonl
9440 eval $setvar
9441
9442 : see if iconv exists
9443 set iconv d_iconv
9444 eval $inlibc
9445
9446 : index or strchr
9447 echo " "
9448 if set index val -f; eval $csym; $val; then
9449         if set strchr val -f d_strchr; eval $csym; $val; then
9450                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9451                         val="$define"
9452                         vali="$undef"
9453                         echo "strchr() found." >&4
9454                 else
9455                         val="$undef"
9456                         vali="$define"
9457                         echo "index() found." >&4
9458                 fi
9459         else
9460                 val="$undef"
9461                 vali="$define"
9462                 echo "index() found." >&4
9463         fi
9464 else
9465         if set strchr val -f d_strchr; eval $csym; $val; then
9466                 val="$define"
9467                 vali="$undef"
9468                 echo "strchr() found." >&4
9469         else
9470                 echo "No index() or strchr() found!" >&4
9471                 val="$undef"
9472                 vali="$undef"
9473         fi
9474 fi
9475 set d_strchr; eval $setvar
9476 val="$vali"
9477 set d_index; eval $setvar
9478
9479 : check whether inet_aton exists
9480 set inet_aton d_inetaton
9481 eval $inlibc
9482
9483 : see if inttypes.h is available
9484 : we want a real compile instead of Inhdr because some systems
9485 : have an inttypes.h which includes non-existent headers
9486 echo " "
9487 $cat >try.c <<EOCP
9488 #include <inttypes.h>
9489 int main() {
9490         static int32_t foo32 = 0x12345678;
9491 }
9492 EOCP
9493 set try
9494 if eval $compile; then
9495         echo "<inttypes.h> found." >&4
9496         val="$define"
9497 else
9498         echo "<inttypes.h> NOT found." >&4
9499         val="$undef"
9500 fi
9501 $rm -f try.c try
9502 set i_inttypes
9503 eval $setvar
9504
9505 : check for int64_t
9506 echo " "
9507 echo "Checking to see if you have int64_t..." >&4
9508 $cat >try.c <<EOCP
9509 #include <sys/types.h>
9510 #$i_inttypes I_INTTYPES
9511 #ifdef I_INTTYPES
9512 #include <inttypes.h>
9513 #endif
9514 int main() { int64_t x = 7; }
9515 EOCP
9516 set try
9517 if eval $compile; then
9518         val="$define"
9519         echo "You have int64_t."
9520 else
9521         val="$undef"
9522         echo "You do not have int64_t."
9523 fi
9524 $rm -f try try.*
9525 set d_int64_t
9526 eval $setvar
9527
9528 : Look for isascii
9529 echo " "
9530 $cat >isascii.c <<'EOCP'
9531 #include <stdio.h>
9532 #include <ctype.h>
9533 int main() {
9534         int c = 'A';
9535         if (isascii(c))
9536                 exit(0);
9537         else
9538                 exit(1);
9539 }
9540 EOCP
9541 set isascii
9542 if eval $compile; then
9543         echo "isascii() found." >&4
9544         val="$define"
9545 else
9546         echo "isascii() NOT found." >&4
9547         val="$undef"
9548 fi
9549 set d_isascii
9550 eval $setvar
9551 $rm -f isascii*
9552
9553 : see if killpg exists
9554 set killpg d_killpg
9555 eval $inlibc
9556
9557 : see if lchown exists
9558 echo " "
9559 $cat > try.c <<'EOCP'
9560 /* System header to define __stub macros and hopefully few prototypes,
9561     which can conflict with char lchown(); below.  */
9562 #include <assert.h>
9563 /* Override any gcc2 internal prototype to avoid an error.  */
9564 /* We use char because int might match the return type of a gcc2
9565    builtin and then its argument prototype would still apply.  */
9566 char lchown();
9567 int main() {
9568     /*  The GNU C library defines this for functions which it implements
9569         to always fail with ENOSYS.  Some functions are actually named
9570         something starting with __ and the normal name is an alias.  */
9571 #if defined (__stub_lchown) || defined (__stub___lchown)
9572 choke me
9573 #else
9574 lchown();
9575 #endif
9576 ; return 0; }
9577 EOCP
9578 set try
9579 if eval $compile; then
9580     $echo "lchown() found." >&4
9581     val="$define"
9582 else
9583     $echo "lchown() NOT found." >&4
9584     val="$undef"
9585 fi
9586 set d_lchown
9587 eval $setvar
9588
9589 : See if number of significant digits in a double precision number is known
9590 echo " "
9591 $cat >ldbl_dig.c <<EOM
9592 #$i_limits I_LIMITS
9593 #$i_float I_FLOAT
9594 #ifdef I_LIMITS
9595 #include <limits.h>
9596 #endif
9597 #ifdef I_FLOAT
9598 #include <float.h>
9599 #endif
9600 #ifdef LDBL_DIG
9601 printf("Contains LDBL_DIG");
9602 #endif
9603 EOM
9604 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9605 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9606         echo "LDBL_DIG found." >&4
9607         val="$define"
9608 else
9609         echo "LDBL_DIG NOT found." >&4
9610         val="$undef"
9611 fi
9612 $rm -f ldbl_dig.?
9613 set d_ldbl_dig
9614 eval $setvar
9615
9616 : see if link exists
9617 set link d_link
9618 eval $inlibc
9619
9620 : see if localeconv exists
9621 set localeconv d_locconv
9622 eval $inlibc
9623
9624 : see if lockf exists
9625 set lockf d_lockf
9626 eval $inlibc
9627
9628 : check for long long
9629 echo " "
9630 echo "Checking to see if you have long long..." >&4
9631 echo 'int main() { long long x = 7; return 0; }' > try.c
9632 set try
9633 if eval $compile; then
9634         val="$define"
9635         echo "You have have long long."
9636 else
9637         val="$undef"
9638         echo "You do not have long long."
9639 fi
9640 $rm try.*
9641 set d_longlong
9642 eval $setvar
9643
9644 : check for length of long long
9645 case "${d_longlong}${longlongsize}" in
9646 $define)
9647         echo " "
9648         echo "Checking to see how big your long longs are..." >&4
9649         $cat >try.c <<'EOCP'
9650 #include <stdio.h>
9651 int main()
9652 {
9653     printf("%d\n", (int)sizeof(long long));
9654     return(0);
9655 }
9656 EOCP
9657         set try
9658         if eval $compile_ok; then
9659                 longlongsize=`./try$exe_ext`
9660                 echo "Your long longs are $longlongsize bytes long."
9661         else
9662                 dflt='8'
9663                 echo " "
9664                 echo "(I can't seem to compile the test program.  Guessing...)"
9665                 rp="What is the size of a long long (in bytes)?"
9666                 . ./myread
9667                 longlongsize="$ans"
9668         fi
9669         if $test "X$longsize" = "X$longlongsize"; then
9670                 echo "(That isn't any different from an ordinary long.)"
9671         fi      
9672         ;;
9673 esac
9674 $rm -f try.* try
9675
9676 : see if prototype for lseek is available
9677 echo " "
9678 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9679 eval $hasproto
9680
9681 : see if lstat exists
9682 set lstat d_lstat
9683 eval $inlibc
9684
9685 : see if madvise exists
9686 set madvise d_madvise
9687 eval $inlibc
9688
9689 : see if mblen exists
9690 set mblen d_mblen
9691 eval $inlibc
9692
9693 : see if mbstowcs exists
9694 set mbstowcs d_mbstowcs
9695 eval $inlibc
9696
9697 : see if mbtowc exists
9698 set mbtowc d_mbtowc
9699 eval $inlibc
9700
9701 : see if memchr exists
9702 set memchr d_memchr
9703 eval $inlibc
9704
9705 : see if memcmp exists
9706 set memcmp d_memcmp
9707 eval $inlibc
9708
9709 : see if memcpy exists
9710 set memcpy d_memcpy
9711 eval $inlibc
9712
9713 : see if memmove exists
9714 set memmove d_memmove
9715 eval $inlibc
9716
9717 : see if memset exists
9718 set memset d_memset
9719 eval $inlibc
9720
9721 : see if mkdir exists
9722 set mkdir d_mkdir
9723 eval $inlibc
9724
9725 : see if mkdtemp exists
9726 set mkdtemp d_mkdtemp
9727 eval $inlibc
9728
9729 : see if mkfifo exists
9730 set mkfifo d_mkfifo
9731 eval $inlibc
9732
9733 : see if mkstemp exists
9734 set mkstemp d_mkstemp
9735 eval $inlibc
9736
9737 : see if mkstemps exists
9738 set mkstemps d_mkstemps
9739 eval $inlibc
9740
9741 : see if mktime exists
9742 set mktime d_mktime
9743 eval $inlibc
9744
9745 : see if this is a sys/mman.h system
9746 set sys/mman.h i_sysmman
9747 eval $inhdr
9748
9749 : see if mmap exists
9750 set mmap d_mmap
9751 eval $inlibc
9752 : see what shmat returns
9753 : default to something harmless
9754 mmaptype='void *'
9755 case "$i_sysmman$d_mmap" in
9756 "$define$define")
9757         $cat >mmap.c <<'END'
9758 #include <sys/mman.h>
9759 void *mmap();
9760 END
9761         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9762                 mmaptype='void *'
9763         else
9764                 mmaptype='caddr_t'
9765         fi
9766         echo "and it returns ($mmaptype)." >&4
9767         ;;
9768 esac
9769
9770
9771
9772 : see if mprotect exists
9773 set mprotect d_mprotect
9774 eval $inlibc
9775
9776 : see if msgctl exists
9777 set msgctl d_msgctl
9778 eval $inlibc
9779
9780 : see if msgget exists
9781 set msgget d_msgget
9782 eval $inlibc
9783
9784 : see if msgsnd exists
9785 set msgsnd d_msgsnd
9786 eval $inlibc
9787
9788 : see if msgrcv exists
9789 set msgrcv d_msgrcv
9790 eval $inlibc
9791
9792 : see how much of the 'msg*(2)' library is present.
9793 h_msg=true
9794 echo " "
9795 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9796 *"$undef"*) h_msg=false;;
9797 esac
9798 case "$osname" in
9799 freebsd)
9800     case "`ipcs 2>&1`" in
9801     "SVID messages"*"not configured"*)
9802         echo "Your $osname does not have the msg*(2) configured." >&4
9803         h_msg=false
9804         val="$undef"
9805         set msgctl d_msgctl
9806         eval $setvar
9807         set msgget d_msgget
9808         eval $setvar
9809         set msgsnd d_msgsnd
9810         eval $setvar
9811         set msgrcv d_msgrcv
9812         eval $setvar
9813         ;;
9814     esac
9815     ;;
9816 esac
9817 : we could also check for sys/ipc.h ...
9818 if $h_msg && $test `./findhdr sys/msg.h`; then
9819         echo "You have the full msg*(2) library." >&4
9820         val="$define"
9821 else
9822         echo "You don't have the full msg*(2) library." >&4
9823         val="$undef"
9824 fi
9825 set d_msg
9826 eval $setvar
9827
9828 : see if msync exists
9829 set msync d_msync
9830 eval $inlibc
9831
9832 : see if munmap exists
9833 set munmap d_munmap
9834 eval $inlibc
9835
9836 : see if nice exists
9837 set nice d_nice
9838 eval $inlibc
9839
9840
9841 echo " "
9842 echo "Checking which 64-bit integer type we could use..." >&4
9843
9844 case "$intsize" in
9845 8) val=int
9846    set quadtype
9847    eval $setvar
9848    val='"unsigned int"'
9849    set uquadtype
9850    eval $setvar
9851    quadkind=1
9852    ;;
9853 *) case "$longsize" in
9854    8) val=long
9855       set quadtype
9856       eval $setvar
9857       val='"unsigned long"'
9858       set uquadtype
9859       eval $setvar
9860       quadkind=2
9861       ;;
9862    *) case "$d_longlong:$longlongsize" in
9863       define:8)
9864         val='"long long"'
9865         set quadtype
9866         eval $setvar
9867         val='"unsigned long long"'
9868         set uquadtype
9869         eval $setvar
9870         quadkind=3
9871         ;;
9872       *) case "$d_int64_t" in
9873          define)
9874            val=int64_t
9875            set quadtype
9876            eval $setvar
9877            val=uint64_t
9878            set uquadtype
9879            eval $setvar
9880            quadkind=4
9881            ;;
9882          esac
9883          ;;
9884       esac
9885       ;;
9886    esac
9887    ;;
9888 esac
9889
9890 case "$quadtype" in
9891 '')     echo "Alas, no 64-bit integer types in sight." >&4
9892         d_quad="$undef"
9893         ;;
9894 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9895             verb="will"
9896         else
9897             verb="could"
9898         fi
9899         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9900         d_quad="$define"
9901         ;;
9902 esac
9903
9904 : check for length of character
9905 echo " "
9906 case "$charsize" in
9907 '')
9908         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9909         $cat >try.c <<'EOCP'
9910 #include <stdio.h>
9911 int main()
9912 {
9913     printf("%d\n", (int)sizeof(char));
9914     exit(0);
9915 }
9916 EOCP
9917         set try
9918         if eval $compile_ok; then
9919                 dflt=`./try`
9920         else
9921                 dflt='1'
9922                 echo "(I can't seem to compile the test program.  Guessing...)"
9923         fi
9924         ;;
9925 *)
9926         dflt="$charsize"
9927         ;;
9928 esac
9929 rp="What is the size of a character (in bytes)?"
9930 . ./myread
9931 charsize="$ans"
9932 $rm -f try.c try
9933
9934
9935 echo " "
9936 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9937
9938 case "$use64bitint:$d_quad:$quadtype" in
9939 define:define:?*)
9940         ivtype="$quadtype"
9941         uvtype="$uquadtype"
9942         ivsize=8
9943         uvsize=8
9944         ;;
9945 *)      ivtype="long"
9946         uvtype="unsigned long"
9947         ivsize=$longsize
9948         uvsize=$longsize
9949         ;;
9950 esac
9951
9952 case "$uselongdouble:$d_longdbl" in
9953 define:define)
9954         nvtype="long double"
9955         nvsize=$longdblsize
9956         ;;
9957 *)      nvtype=double
9958         nvsize=$doublesize
9959         ;;
9960 esac
9961
9962 $echo "(IV will be "$ivtype", $ivsize bytes)"
9963 $echo "(UV will be "$uvtype", $uvsize bytes)"
9964 $echo "(NV will be "$nvtype", $nvsize bytes)"
9965
9966 $cat >try.c <<EOCP
9967 #$i_inttypes I_INTTYPES
9968 #ifdef I_INTTYPES
9969 #include <inttypes.h>
9970 #endif
9971 #include <stdio.h>
9972 int main() {
9973 #ifdef INT8
9974    int8_t i =  INT8_MAX;
9975   uint8_t u = UINT8_MAX;
9976   printf("int8_t\n");
9977 #endif
9978 #ifdef INT16
9979    int16_t i =  INT16_MAX;
9980   uint16_t i = UINT16_MAX;
9981   printf("int16_t\n");
9982 #endif
9983 #ifdef INT32
9984    int32_t i =  INT32_MAX;
9985   uint32_t u = UINT32_MAX;
9986   printf("int32_t\n");
9987 #endif
9988 }
9989 EOCP
9990
9991 case "$i8type" in
9992 '')     case "$charsize" in
9993         1)      i8type=char
9994                 u8type="unsigned char"
9995                 i8size=$charsize
9996                 u8size=$charsize
9997                 ;;
9998         esac
9999         ;;
10000 esac
10001 case "$i8type" in
10002 '')     set try -DINT8
10003         if eval $compile; then
10004                 case "`./try$exe_ext`" in
10005                 int8_t) i8type=int8_t
10006                         u8type=uint8_t
10007                         i8size=1
10008                         u8size=1
10009                         ;;
10010                 esac
10011         fi
10012         ;;
10013 esac
10014 case "$i8type" in
10015 '')     if $test $charsize -ge 1; then
10016                 i8type=char
10017                 u8type="unsigned char"
10018                 i8size=$charsize
10019                 u8size=$charsize
10020         fi
10021         ;;
10022 esac
10023
10024 case "$i16type" in
10025 '')     case "$shortsize" in
10026         2)      i16type=short
10027                 u16type="unsigned short"
10028                 i16size=$shortsize
10029                 u16size=$shortsize
10030                 ;;
10031         esac
10032         ;;
10033 esac
10034 case "$i16type" in
10035 '')     set try -DINT16
10036         if eval $compile; then
10037                 case "`./try$exe_ext`" in
10038                 int16_t)
10039                         i16type=int16_t
10040                         u16type=uint16_t
10041                         i16size=2
10042                         u16size=2
10043                         ;;
10044                 esac
10045         fi
10046         ;;
10047 esac
10048 case "$i16type" in
10049 '')     if $test $shortsize -ge 2; then
10050                 i16type=short
10051                 u16type="unsigned short"
10052                 i16size=$shortsize
10053                 u16size=$shortsize
10054         fi
10055         ;;
10056 esac
10057
10058 case "$i32type" in
10059 '')     case "$longsize" in
10060         4)      i32type=long
10061                 u32type="unsigned long"
10062                 i32size=$longsize
10063                 u32size=$longsize
10064                 ;;
10065         *)      case "$intsize" in
10066                 4)      i32type=int
10067                         u32type="unsigned int"
10068                         i32size=$intsize
10069                         u32size=$intsize
10070                         ;;
10071                 esac
10072                 ;;
10073         esac
10074         ;;
10075 esac
10076 case "$i32type" in
10077 '')     set try -DINT32
10078         if eval $compile; then
10079                 case "`./try$exe_ext`" in
10080                 int32_t)
10081                         i32type=int32_t
10082                         u32type=uint32_t
10083                         i32size=4
10084                         u32size=4
10085                         ;;
10086                 esac
10087         fi
10088         ;;
10089 esac
10090 case "$i32type" in
10091 '')     if $test $intsize -ge 4; then
10092                 i32type=int
10093                 u32type="unsigned int"
10094                 i32size=$intsize
10095                 u32size=$intsize
10096         fi
10097         ;;
10098 esac
10099
10100 case "$i64type" in
10101 '')     case "$d_quad:$quadtype" in
10102         define:?*)
10103                 i64type="$quadtype"
10104                 u64type="$uquadtype"
10105                 i64size=8
10106                 u64size=8
10107                 ;;
10108         esac
10109         ;;
10110 esac
10111
10112 $echo "Checking whether your NVs can preserve your UVs..." >&4
10113 $cat <<EOP >try.c
10114 #include <stdio.h>
10115 int main() {
10116     $uvtype k = ($uvtype)~0, l;
10117     $nvtype d;
10118     l = k;
10119     d = ($nvtype)l;
10120     l = ($uvtype)d;
10121     if (l == k)
10122        printf("preserve\n");
10123     exit(0);
10124 }
10125 EOP
10126 set try
10127 if eval $compile; then
10128         case "`./try$exe_ext`" in
10129         preserve) d_nv_preserves_uv="$define" ;;
10130         esac
10131 fi      
10132 case "$d_nv_preserves_uv" in
10133 $define) $echo "Yes, they can."  2>&1 ;;
10134 *)       $echo "No, they can't." 2>&1
10135          d_nv_preserves_uv="$undef"
10136          ;;
10137 esac
10138
10139 $rm -f try.* try
10140
10141
10142 : check for off64_t
10143 echo " "
10144 echo "Checking to see if you have off64_t..." >&4
10145 $cat >try.c <<EOCP
10146 #include <sys/types.h>
10147 #include <unistd.h>
10148 int main() { off64_t x = 7; }
10149 EOCP
10150 set try
10151 if eval $compile; then
10152         val="$define"
10153         echo "You have off64_t."
10154 else
10155         val="$undef"
10156         echo "You do not have off64_t."
10157         case "$lseeksize" in
10158         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10159         esac
10160 fi
10161 $rm -f try.* try
10162 set d_off64_t
10163 eval $setvar
10164
10165 : see if POSIX threads are available
10166 set pthread.h i_pthread
10167 eval $inhdr
10168
10169
10170
10171
10172 : how to create joinable pthreads
10173 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10174         echo " "
10175         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10176         $cat >try.c <<'EOCP'
10177 #include <pthread.h>
10178 int main() {
10179     int detachstate = JOINABLE;
10180 }
10181 EOCP
10182         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10183         if eval $compile; then
10184                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10185                 val="$undef" # Yes, undef.
10186                 set d_old_pthread_create_joinable
10187                 eval $setvar
10188                 val=""
10189                 set old_pthread_create_joinable
10190                 eval $setvar
10191         else
10192                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10193                 if eval $compile; then
10194                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10195                         val="$define"
10196                         set d_old_pthread_create_joinable
10197                         eval $setvar
10198                         val=PTHREAD_CREATE_UNDETACHED
10199                         set old_pthread_create_joinable
10200                         eval $setvar
10201                 else            
10202                         set try -DJOINABLE=__UNDETACHED
10203                         if eval $compile; then
10204                                 echo "You seem to use __UNDETACHED." >&4
10205                                 val="$define"
10206                                 set d_old_pthread_create_joinable
10207                                 eval $setvar
10208                                 val=__UNDETACHED
10209                                 set old_pthread_create_joinable
10210                                 eval $setvar
10211                         else
10212                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10213                                 val="$define"
10214                                 set d_old_pthread_create_joinable
10215                                 eval $setvar
10216                                 val=0
10217                                 set old_pthread_create_joinable
10218                                 eval $setvar
10219                         fi
10220                 fi
10221         fi
10222         $rm -f try try.*
10223 else
10224     d_old_pthread_create_joinable="$undef"
10225     old_pthread_create_joinable=""
10226 fi
10227
10228 : see if pause exists
10229 set pause d_pause
10230 eval $inlibc
10231
10232 : see if pipe exists
10233 set pipe d_pipe
10234 eval $inlibc
10235
10236 : see if poll exists
10237 set poll d_poll
10238 eval $inlibc
10239
10240
10241 : see whether the various POSIXish _yields exist
10242 $cat >try.c <<EOP
10243 #include <pthread.h>
10244 #include <stdio.h>
10245 int main() {
10246 #ifdef SCHED_YIELD
10247         sched_yield();
10248 #else
10249 #ifdef PTHREAD_YIELD
10250         pthread_yield();
10251 #else
10252 #ifdef PTHREAD_YIELD_NULL
10253         pthread_yield(NULL);
10254 #endif
10255 #endif
10256 #endif
10257 }
10258 EOP
10259 : see if sched_yield exists
10260 set try -DSCHED_YIELD
10261 if eval $compile; then
10262     val="$define"
10263     sched_yield='sched_yield()'
10264 else
10265     val="$undef"
10266 fi
10267 case "$usethreads" in
10268 $define)
10269         case "$val" in
10270         $define) echo 'sched_yield() found.' >&4        ;;
10271         *)       echo 'sched_yield() NOT found.' >&4    ;;
10272         esac
10273 esac
10274 set d_sched_yield
10275 eval $setvar
10276
10277 : see if pthread_yield exists
10278 set try -DPTHREAD_YIELD
10279 if eval $compile; then
10280     val="$define"
10281     case "$sched_yield" in
10282     '') sched_yield='pthread_yield()' ;;
10283     esac
10284 else
10285     set try -DPTHREAD_YIELD_NULL
10286     if eval $compile; then
10287         val="$define"
10288         case "$sched_yield" in
10289         '') sched_yield='pthread_yield(NULL)' ;;
10290         esac
10291     else
10292         val="$undef"
10293     fi
10294 fi
10295 case "$usethreads" in
10296 $define)
10297         case "$val" in
10298         $define) echo 'pthread_yield() found.' >&4      ;;
10299         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10300         esac
10301         ;;
10302 esac
10303 set d_pthread_yield
10304 eval $setvar
10305
10306 case "$sched_yield" in
10307 '') sched_yield=undef ;;
10308 esac
10309
10310 $rm -f try try.*
10311
10312 : see if this is a pwd.h system
10313 set pwd.h i_pwd
10314 eval $inhdr
10315
10316 case "$i_pwd" in
10317 $define)
10318         xxx=`./findhdr pwd.h`
10319         $cppstdin $cppflags $cppminus < $xxx >$$.h
10320
10321         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10322                 val="$define"
10323         else
10324                 val="$undef"
10325         fi
10326         set d_pwquota
10327         eval $setvar
10328
10329         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10330                 val="$define"
10331         else
10332                 val="$undef"
10333         fi
10334         set d_pwage
10335         eval $setvar
10336
10337         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10338                 val="$define"
10339         else
10340                 val="$undef"
10341         fi
10342         set d_pwchange
10343         eval $setvar
10344
10345         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10346                 val="$define"
10347         else
10348                 val="$undef"
10349         fi
10350         set d_pwclass
10351         eval $setvar
10352
10353         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10354                 val="$define"
10355         else
10356                 val="$undef"
10357         fi
10358         set d_pwexpire
10359         eval $setvar
10360
10361         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10362                 val="$define"
10363         else
10364                 val="$undef"
10365         fi
10366         set d_pwcomment
10367         eval $setvar
10368
10369         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10370                 val="$define"
10371         else
10372                 val="$undef"
10373         fi
10374         set d_pwgecos
10375         eval $setvar
10376
10377         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10378                 val="$define"
10379         else
10380                 val="$undef"
10381         fi
10382         set d_pwpasswd
10383         eval $setvar
10384
10385         $rm -f $$.h
10386         ;;
10387 *)
10388         val="$undef"; 
10389         set d_pwquota; eval $setvar
10390         set d_pwage; eval $setvar
10391         set d_pwchange; eval $setvar
10392         set d_pwclass; eval $setvar
10393         set d_pwexpire; eval $setvar
10394         set d_pwcomment; eval $setvar
10395         set d_pwgecos; eval $setvar
10396         set d_pwpasswd; eval $setvar
10397         ;;
10398 esac
10399
10400 : see if readdir and friends exist
10401 set readdir d_readdir
10402 eval $inlibc
10403 set seekdir d_seekdir
10404 eval $inlibc
10405 set telldir d_telldir
10406 eval $inlibc
10407 set rewinddir d_rewinddir
10408 eval $inlibc
10409
10410 : see if readlink exists
10411 set readlink d_readlink
10412 eval $inlibc
10413
10414 : see if rename exists
10415 set rename d_rename
10416 eval $inlibc
10417
10418 : see if rmdir exists
10419 set rmdir d_rmdir
10420 eval $inlibc
10421
10422 : see if memory.h is available.
10423 val=''
10424 set memory.h val
10425 eval $inhdr
10426
10427 : See if it conflicts with string.h
10428 case "$val" in
10429 $define)
10430         case "$strings" in
10431         '') ;;
10432         *)
10433                 $cppstdin $cppflags $cppminus < $strings > mem.h
10434                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10435                         echo " "
10436                         echo "We won't be including <memory.h>."
10437                         val="$undef"
10438                 fi
10439                 $rm -f mem.h
10440                 ;;
10441         esac
10442 esac
10443 set i_memory
10444 eval $setvar
10445
10446 : can bcopy handle overlapping blocks?
10447 val="$undef"
10448 case "$d_bcopy" in
10449 "$define")
10450         echo " "
10451         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10452         $cat >try.c <<EOCP
10453 #$i_memory I_MEMORY
10454 #$i_stdlib I_STDLIB
10455 #$i_string I_STRING
10456 #$i_unistd I_UNISTD
10457 EOCP
10458         $cat >>try.c <<'EOCP'
10459 #include <stdio.h>
10460 #ifdef I_MEMORY
10461 #  include <memory.h>
10462 #endif
10463 #ifdef I_STDLIB
10464 #  include <stdlib.h>
10465 #endif
10466 #ifdef I_STRING
10467 #  include <string.h>
10468 #else
10469 #  include <strings.h>
10470 #endif
10471 #ifdef I_UNISTD
10472 #  include <unistd.h>  /* Needed for NetBSD */
10473 #endif
10474 int main()
10475 {
10476 char buf[128], abc[128];
10477 char *b;
10478 int len;
10479 int off;
10480 int align;
10481
10482 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10483
10484 for (align = 7; align >= 0; align--) {
10485         for (len = 36; len; len--) {
10486                 b = buf+align;
10487                 bcopy(abc, b, len);
10488                 for (off = 1; off <= len; off++) {
10489                         bcopy(b, b+off, len);
10490                         bcopy(b+off, b, len);
10491                         if (bcmp(b, abc, len))
10492                                 exit(1);
10493                 }
10494         }
10495 }
10496 exit(0);
10497 }
10498 EOCP
10499         set try
10500         if eval $compile_ok; then
10501                 if ./try 2>/dev/null; then
10502                         echo "Yes, it can."
10503                         val="$define"
10504                 else
10505                         echo "It can't, sorry."
10506                         case "$d_memmove" in
10507                         "$define") echo "But that's Ok since you have memmove()." ;;
10508                         esac
10509                 fi
10510         else
10511                 echo "(I can't compile the test program, so we'll assume not...)"
10512                 case "$d_memmove" in
10513                 "$define") echo "But that's Ok since you have memmove()." ;;
10514                 esac
10515         fi
10516         ;;
10517 esac
10518 $rm -f try.* try core
10519 set d_safebcpy
10520 eval $setvar
10521
10522 : can memcpy handle overlapping blocks?
10523 val="$undef"
10524 case "$d_memcpy" in
10525 "$define")
10526         echo " "
10527         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10528         $cat >try.c <<EOCP
10529 #$i_memory I_MEMORY
10530 #$i_stdlib I_STDLIB
10531 #$i_string I_STRING
10532 #$i_unistd I_UNISTD
10533 EOCP
10534         $cat >>try.c <<'EOCP'
10535 #include <stdio.h>
10536 #ifdef I_MEMORY
10537 #  include <memory.h>
10538 #endif
10539 #ifdef I_STDLIB
10540 #  include <stdlib.h>
10541 #endif
10542 #ifdef I_STRING
10543 #  include <string.h>
10544 #else
10545 #  include <strings.h>
10546 #endif
10547 #ifdef I_UNISTD
10548 #  include <unistd.h>  /* Needed for NetBSD */
10549 #endif
10550 int main()
10551 {
10552 char buf[128], abc[128];
10553 char *b;
10554 int len;
10555 int off;
10556 int align;
10557
10558 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10559    try to store the string in read-only memory. */
10560 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10561
10562 for (align = 7; align >= 0; align--) {
10563         for (len = 36; len; len--) {
10564                 b = buf+align;
10565                 memcpy(b, abc, len);
10566                 for (off = 1; off <= len; off++) {
10567                         memcpy(b+off, b, len);
10568                         memcpy(b, b+off, len);
10569                         if (memcmp(b, abc, len))
10570                                 exit(1);
10571                 }
10572         }
10573 }
10574 exit(0);
10575 }
10576 EOCP
10577         set try
10578         if eval $compile_ok; then
10579                 if ./try 2>/dev/null; then
10580                         echo "Yes, it can."
10581                         val="$define"
10582                 else
10583                         echo "It can't, sorry."
10584                         case "$d_memmove" in
10585                         "$define") echo "But that's Ok since you have memmove()." ;;
10586                         esac
10587                 fi
10588         else
10589                 echo "(I can't compile the test program, so we'll assume not...)"
10590                 case "$d_memmove" in
10591                 "$define") echo "But that's Ok since you have memmove()." ;;
10592                 esac
10593         fi
10594         ;;
10595 esac
10596 $rm -f try.* try core
10597 set d_safemcpy
10598 eval $setvar
10599
10600 : can memcmp be trusted to compare relative magnitude?
10601 val="$undef"
10602 case "$d_memcmp" in
10603 "$define")
10604         echo " "
10605         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10606         $cat >try.c <<EOCP
10607 #$i_memory I_MEMORY
10608 #$i_stdlib I_STDLIB
10609 #$i_string I_STRING
10610 #$i_unistd I_UNISTD
10611 EOCP
10612         $cat >>try.c <<'EOCP'
10613 #include <stdio.h>
10614 #ifdef I_MEMORY
10615 #  include <memory.h>
10616 #endif
10617 #ifdef I_STDLIB
10618 #  include <stdlib.h>
10619 #endif
10620 #ifdef I_STRING
10621 #  include <string.h>
10622 #else
10623 #  include <strings.h>
10624 #endif
10625 #ifdef I_UNISTD
10626 #  include <unistd.h>  /* Needed for NetBSD */
10627 #endif
10628 int main()
10629 {
10630 char a = -1;
10631 char b = 0;
10632 if ((a < b) && memcmp(&a, &b, 1) < 0)
10633         exit(1);
10634 exit(0);
10635 }
10636 EOCP
10637         set try
10638         if eval $compile_ok; then
10639                 if ./try 2>/dev/null; then
10640                         echo "Yes, it can."
10641                         val="$define"
10642                 else
10643                         echo "No, it can't (it uses signed chars)."
10644                 fi
10645         else
10646                 echo "(I can't compile the test program, so we'll assume not...)"
10647         fi
10648         ;;
10649 esac
10650 $rm -f try.* try core
10651 set d_sanemcmp
10652 eval $setvar
10653
10654 : see if select exists
10655 set select d_select
10656 eval $inlibc
10657
10658 : see if semctl exists
10659 set semctl d_semctl
10660 eval $inlibc
10661
10662 : see if semget exists
10663 set semget d_semget
10664 eval $inlibc
10665
10666 : see if semop exists
10667 set semop d_semop
10668 eval $inlibc
10669
10670 : see how much of the 'sem*(2)' library is present.
10671 h_sem=true
10672 echo " "
10673 case "$d_semctl$d_semget$d_semop" in
10674 *"$undef"*) h_sem=false;;
10675 esac
10676 case "$osname" in
10677 freebsd)
10678     case "`ipcs 2>&1`" in
10679     "SVID messages"*"not configured"*)
10680         echo "Your $osname does not have the sem*(2) configured." >&4
10681         h_sem=false
10682         val="$undef"
10683         set semctl d_semctl
10684         eval $setvar
10685         set semget d_semget
10686         eval $setvar
10687         set semop d_semop
10688         eval $setvar
10689         ;;
10690     esac
10691     ;;
10692 esac
10693 : we could also check for sys/ipc.h ...
10694 if $h_sem && $test `./findhdr sys/sem.h`; then
10695         echo "You have the full sem*(2) library." >&4
10696         val="$define"
10697 else
10698         echo "You don't have the full sem*(2) library." >&4
10699         val="$undef"
10700 fi
10701 set d_sem
10702 eval $setvar
10703
10704 : see whether sys/sem.h defines union semun
10705 echo " "
10706 $cat > try.c <<'END'
10707 #include <sys/types.h>
10708 #include <sys/ipc.h>
10709 #include <sys/sem.h>
10710 int main () { union semun semun; semun.buf = 0; }
10711 END
10712 set try
10713 if eval $compile; then
10714     echo "You have union semun in <sys/sem.h>." >&4
10715     val="$define"
10716 else
10717     echo "You do not have union semun in <sys/sem.h>." >&4
10718     val="$undef"
10719 fi
10720 $rm -f try try.c try.h
10721 set d_union_semun
10722 eval $setvar
10723
10724 : see how to do semctl IPC_STAT
10725 case "$d_sem" in
10726 $define)
10727     : see whether semctl IPC_STAT can use union semun
10728     echo " "
10729     $cat > try.h <<END
10730 #ifndef S_IRUSR
10731 #   ifdef S_IREAD
10732 #       define S_IRUSR S_IREAD
10733 #       define S_IWUSR S_IWRITE
10734 #       define S_IXUSR S_IEXEC
10735 #   else
10736 #       define S_IRUSR 0400
10737 #       define S_IWUSR 0200
10738 #       define S_IXUSR 0100
10739 #   endif
10740 #   define S_IRGRP (S_IRUSR>>3)
10741 #   define S_IWGRP (S_IWUSR>>3)
10742 #   define S_IXGRP (S_IXUSR>>3)
10743 #   define S_IROTH (S_IRUSR>>6)
10744 #   define S_IWOTH (S_IWUSR>>6)
10745 #   define S_IXOTH (S_IXUSR>>6)
10746 #endif
10747 #ifndef S_IRWXU
10748 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10749 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10750 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10751 #endif
10752 END
10753
10754     $cat > try.c <<END
10755 #include <sys/types.h>
10756 #include <sys/ipc.h>
10757 #include <sys/sem.h>
10758 #include <sys/stat.h>
10759 #include <stdio.h>
10760 #include <errno.h>
10761 #include "try.h"
10762 #ifndef errno
10763 extern int errno;
10764 #endif
10765 #$d_union_semun HAS_UNION_SEMUN
10766 int main() {
10767     union semun
10768 #ifndef HAS_UNION_SEMUN
10769     {
10770         int val;
10771         struct semid_ds *buf;
10772         unsigned short *array;
10773     }
10774 #endif
10775     arg;
10776     int sem, st;
10777
10778 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10779     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10780     if (sem > -1) {
10781         struct semid_ds argbuf;
10782         arg.buf = &argbuf;
10783 #       ifdef IPC_STAT
10784         st = semctl(sem, 0, IPC_STAT, arg);
10785         if (st == 0)
10786             printf("semun\n");
10787         else
10788 #       endif /* IPC_STAT */
10789             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10790 #       ifdef IPC_RMID
10791         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10792 #       endif /* IPC_RMID */
10793             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10794     } else
10795 #endif /* IPC_PRIVATE && ... */
10796         printf("semget failed: errno = %d\n", errno);
10797   return 0;
10798 }
10799 END
10800     val="$undef"
10801     set try
10802     if eval $compile; then
10803         xxx=`./try`
10804         case "$xxx" in
10805         semun) val="$define" ;;
10806         esac
10807     fi
10808     $rm -f try try.c
10809     set d_semctl_semun
10810     eval $setvar
10811     case "$d_semctl_semun" in
10812     $define)
10813         echo "You can use union semun for semctl IPC_STAT." >&4
10814         also='also'
10815         ;;
10816     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10817         also=''
10818         ;;
10819     esac
10820
10821     : see whether semctl IPC_STAT can use struct semid_ds pointer
10822     $cat > try.c <<'END'
10823 #include <sys/types.h>
10824 #include <sys/ipc.h>
10825 #include <sys/sem.h>
10826 #include <sys/stat.h>
10827 #include "try.h"
10828 #include <stdio.h>
10829 #include <errno.h>
10830 #ifndef errno
10831 extern int errno;
10832 #endif
10833 int main() {
10834     struct semid_ds arg;
10835     int sem, st;
10836
10837 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10838     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10839     if (sem > -1) {
10840 #       ifdef IPC_STAT
10841         st = semctl(sem, 0, IPC_STAT, &arg);
10842         if (st == 0)
10843             printf("semid_ds\n");
10844         else
10845 #       endif /* IPC_STAT */
10846             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10847 #       ifdef IPC_RMID
10848         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10849 #       endif /* IPC_RMID */
10850             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10851     } else
10852 #endif /* IPC_PRIVATE && ... */
10853         printf("semget failed: errno = %d\n", errno);
10854
10855     return 0;
10856 }
10857 END
10858     val="$undef"
10859     set try
10860     if eval $compile; then
10861         xxx=`./try`
10862         case "$xxx" in
10863         semid_ds) val="$define" ;;
10864         esac
10865     fi
10866     $rm -f try try.c
10867     set d_semctl_semid_ds
10868     eval $setvar
10869     case "$d_semctl_semid_ds" in
10870     $define)
10871         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10872         ;;
10873     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10874         ;;
10875     esac
10876     $rm -f try.h
10877     ;;
10878 *)  val="$undef"
10879
10880     # We do not have the full sem*(2) library, so assume we can not
10881     # use either.
10882
10883     set d_semctl_semun
10884     eval $setvar
10885
10886     set d_semctl_semid_ds
10887     eval $setvar
10888     ;;
10889 esac
10890
10891 : see if setegid exists
10892 set setegid d_setegid
10893 eval $inlibc
10894
10895 : see if seteuid exists
10896 set seteuid d_seteuid
10897 eval $inlibc
10898
10899 : see if setgrent exists
10900 set setgrent d_setgrent
10901 eval $inlibc
10902
10903 : see if sethostent exists
10904 set sethostent d_sethent
10905 eval $inlibc
10906
10907 : see if setlinebuf exists
10908 set setlinebuf d_setlinebuf
10909 eval $inlibc
10910
10911 : see if setlocale exists
10912 set setlocale d_setlocale
10913 eval $inlibc
10914
10915 : see if setnetent exists
10916 set setnetent d_setnent
10917 eval $inlibc
10918
10919 : see if setprotoent exists
10920 set setprotoent d_setpent
10921 eval $inlibc
10922
10923 : see if setpgid exists
10924 set setpgid d_setpgid
10925 eval $inlibc
10926
10927 : see if setpgrp2 exists
10928 set setpgrp2 d_setpgrp2
10929 eval $inlibc
10930
10931 : see if setpriority exists
10932 set setpriority d_setprior
10933 eval $inlibc
10934
10935 : see if setpwent exists
10936 set setpwent d_setpwent
10937 eval $inlibc
10938
10939 : see if setregid exists
10940 set setregid d_setregid
10941 eval $inlibc
10942 set setresgid d_setresgid
10943 eval $inlibc
10944
10945 : see if setreuid exists
10946 set setreuid d_setreuid
10947 eval $inlibc
10948 set setresuid d_setresuid
10949 eval $inlibc
10950
10951 : see if setrgid exists
10952 set setrgid d_setrgid
10953 eval $inlibc
10954
10955 : see if setruid exists
10956 set setruid d_setruid
10957 eval $inlibc
10958
10959 : see if setservent exists
10960 set setservent d_setsent
10961 eval $inlibc
10962
10963 : see if setsid exists
10964 set setsid d_setsid
10965 eval $inlibc
10966
10967 : see if setspent exists
10968 set setspent d_setspent
10969 eval $inlibc
10970
10971 : see if setvbuf exists
10972 set setvbuf d_setvbuf
10973 eval $inlibc
10974
10975 : see if sfio.h is available
10976 set sfio.h i_sfio
10977 eval $inhdr
10978
10979
10980 : see if sfio library is available
10981 case "$i_sfio" in
10982 $define)
10983         val=''
10984         set sfreserve val
10985         eval $inlibc
10986         ;;
10987 *)
10988         val="$undef"
10989         ;;
10990 esac
10991 : Ok, but do we want to use it.
10992 case "$val" in
10993 $define)
10994         case "$usesfio" in
10995         true|$define|[yY]*) dflt='y';;
10996         *) dflt='n';;
10997         esac
10998         echo "$package can use the sfio library, but it is experimental."
10999         rp="You seem to have sfio available, do you want to try using it?"
11000         . ./myread
11001         case "$ans" in
11002         y|Y) ;;
11003         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11004                 val="$undef"
11005                 : Remove sfio from list of libraries to use
11006                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11007                 shift
11008                 libs="$*"
11009                 echo "libs = $libs" >&4
11010                 ;;
11011         esac
11012         ;;
11013 *)      case "$usesfio" in
11014         true|$define|[yY]*)
11015                 echo "Sorry, cannot find sfio on this machine" >&4
11016                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11017                 ;;
11018         esac
11019         ;;
11020 esac
11021 set d_sfio
11022 eval $setvar
11023 case "$d_sfio" in
11024 $define) usesfio='true';;
11025 *) usesfio='false';;
11026 esac
11027
11028 : see if shmctl exists
11029 set shmctl d_shmctl
11030 eval $inlibc
11031
11032 : see if shmget exists
11033 set shmget d_shmget
11034 eval $inlibc
11035
11036 : see if shmat exists
11037 set shmat d_shmat
11038 eval $inlibc
11039 : see what shmat returns
11040 case "$d_shmat" in
11041 "$define")
11042         $cat >shmat.c <<'END'
11043 #include <sys/shm.h>
11044 void *shmat();
11045 END
11046         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11047                 shmattype='void *'
11048         else
11049                 shmattype='char *'
11050         fi
11051         echo "and it returns ($shmattype)." >&4
11052         : see if a prototype for shmat is available
11053         xxx=`./findhdr sys/shm.h`
11054         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11055         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11056                 val="$define"
11057         else
11058                 val="$undef"
11059         fi
11060         $rm -f shmat.[co]
11061         ;;
11062 *)
11063         val="$undef"
11064         ;;
11065 esac
11066 set d_shmatprototype
11067 eval $setvar
11068
11069 : see if shmdt exists
11070 set shmdt d_shmdt
11071 eval $inlibc
11072
11073 : see how much of the 'shm*(2)' library is present.
11074 h_shm=true
11075 echo " "
11076 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11077 *"$undef"*) h_shm=false;;
11078 esac
11079 case "$osname" in
11080 freebsd)
11081     case "`ipcs 2>&1`" in
11082     "SVID shared memory"*"not configured"*)
11083         echo "Your $osname does not have the shm*(2) configured." >&4
11084         h_shm=false
11085         val="$undef"
11086         set shmctl d_shmctl
11087         evat $setvar
11088         set shmget d_shmget
11089         evat $setvar
11090         set shmat d_shmat
11091         evat $setvar
11092         set shmdt d_shmdt
11093         evat $setvar
11094         ;;
11095     esac
11096     ;;
11097 esac
11098 : we could also check for sys/ipc.h ...
11099 if $h_shm && $test `./findhdr sys/shm.h`; then
11100         echo "You have the full shm*(2) library." >&4
11101         val="$define"
11102 else
11103         echo "You don't have the full shm*(2) library." >&4
11104         val="$undef"
11105 fi
11106 set d_shm
11107 eval $setvar
11108
11109 echo " "
11110 : see if we have sigaction
11111 if set sigaction val -f d_sigaction; eval $csym; $val; then
11112         echo 'sigaction() found.' >&4
11113         $cat > try.c <<'EOP'
11114 #include <stdio.h>
11115 #include <sys/types.h>
11116 #include <signal.h>
11117 int main()
11118 {
11119     struct sigaction act, oact;
11120     act.sa_flags = 0;
11121     oact.sa_handler = 0;
11122     /* so that act and oact are used */
11123     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11124 }
11125 EOP
11126         set try
11127         if eval $compile_ok; then
11128                 val="$define"
11129         else
11130                 echo "But you don't seem to have a useable struct sigaction." >&4
11131                 val="$undef"
11132         fi
11133 else
11134         echo 'sigaction NOT found.' >&4
11135         val="$undef"
11136 fi
11137 set d_sigaction; eval $setvar
11138 $rm -f try try$_o try.c
11139
11140 : see if sigsetjmp exists
11141 echo " "
11142 case "$d_sigsetjmp" in
11143 '')
11144         $cat >try.c <<'EOP'
11145 #include <setjmp.h>
11146 sigjmp_buf env;
11147 int set = 1;
11148 int main()
11149 {
11150         if (sigsetjmp(env,1))
11151                 exit(set);
11152         set = 0;
11153         siglongjmp(env, 1);
11154         exit(1);
11155 }
11156 EOP
11157         set try
11158         if eval $compile; then
11159                 if ./try >/dev/null 2>&1; then
11160                         echo "POSIX sigsetjmp found." >&4
11161                         val="$define"
11162                 else
11163                         $cat >&4 <<EOM
11164 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11165 I'll ignore them.
11166 EOM
11167                         val="$undef"
11168                 fi
11169         else
11170                 echo "sigsetjmp not found." >&4
11171                 val="$undef"
11172         fi
11173         ;;
11174 *) val="$d_sigsetjmp"
11175         case "$d_sigsetjmp" in
11176         $define) echo "POSIX sigsetjmp found." >&4;;
11177         $undef) echo "sigsetjmp not found." >&4;;
11178         esac
11179         ;;
11180 esac
11181 set d_sigsetjmp
11182 eval $setvar
11183 $rm -f try.c try
11184
11185 : see if sys/stat.h is available
11186 set sys/stat.h i_sysstat
11187 eval $inhdr
11188
11189
11190 : see if stat knows about block sizes
11191 echo " "
11192 echo "Checking to see if your struct stat has st_blocks field..." >&4
11193 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11194 eval $hasfield
11195
11196
11197 : see if this is a sys/vfs.h system
11198 set sys/vfs.h i_sysvfs
11199 eval $inhdr
11200
11201
11202 : see if this is a sys/statfs.h system
11203 set sys/statfs.h i_sysstatfs
11204 eval $inhdr
11205
11206
11207 echo " "
11208 echo "Checking to see if your system supports struct statfs..." >&4
11209 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
11210 eval $hasstruct
11211 case "$d_statfs_s" in
11212 "$define")      echo "Yes, it does."   ;;
11213 *)              echo "No, it doesn't." ;;
11214 esac
11215
11216
11217
11218 : see if struct statfs knows about f_flags
11219 case "$d_statfs_s" in
11220 define) 
11221         echo " "
11222         echo "Checking to see if your struct statfs has f_flags field..." >&4
11223         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
11224         eval $hasfield
11225         ;;
11226 *)      val="$undef"
11227         set d_statfs_f_flags
11228         eval $setvar
11229         ;;
11230 esac
11231 case "$d_statfs_f_flags" in
11232 "$define")      echo "Yes, it does."   ;;
11233 *)              echo "No, it doesn't." ;;
11234 esac
11235
11236 : see if _ptr and _cnt from stdio act std
11237 echo " "
11238 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11239         echo "(Looks like you have stdio.h from Linux.)"
11240         case "$stdio_ptr" in
11241         '') stdio_ptr='((fp)->_IO_read_ptr)'
11242                 ptr_lval=$define
11243                 ;;
11244         *)      ptr_lval=$d_stdio_ptr_lval;;
11245         esac
11246         case "$stdio_cnt" in
11247         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11248                 cnt_lval=$undef
11249                 ;;
11250         *)      cnt_lval=$d_stdio_cnt_lval;;
11251         esac
11252         case "$stdio_base" in
11253         '') stdio_base='((fp)->_IO_read_base)';;
11254         esac
11255         case "$stdio_bufsiz" in
11256         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11257         esac
11258 else
11259         case "$stdio_ptr" in
11260         '') stdio_ptr='((fp)->_ptr)'
11261                 ptr_lval=$define
11262                 ;;
11263         *)      ptr_lval=$d_stdio_ptr_lval;;
11264         esac
11265         case "$stdio_cnt" in
11266         '') stdio_cnt='((fp)->_cnt)'
11267                 cnt_lval=$define
11268                 ;;
11269         *)      cnt_lval=$d_stdio_cnt_lval;;
11270         esac
11271         case "$stdio_base" in
11272         '') stdio_base='((fp)->_base)';;
11273         esac
11274         case "$stdio_bufsiz" in
11275         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11276         esac
11277 fi
11278 : test whether _ptr and _cnt really work
11279 echo "Checking how std your stdio is..." >&4
11280 $cat >try.c <<EOP
11281 #include <stdio.h>
11282 #define FILE_ptr(fp)    $stdio_ptr
11283 #define FILE_cnt(fp)    $stdio_cnt
11284 int main() {
11285         FILE *fp = fopen("try.c", "r");
11286         char c = getc(fp);
11287         if (
11288                 18 <= FILE_cnt(fp) &&
11289                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11290         )
11291                 exit(0);
11292         exit(1);
11293 }
11294 EOP
11295 val="$undef"
11296 set try
11297 if eval $compile; then
11298         if ./try; then
11299                 echo "Your stdio acts pretty std."
11300                 val="$define"
11301         else
11302                 echo "Your stdio isn't very std."
11303         fi
11304 else
11305         echo "Your stdio doesn't appear very std."
11306 fi
11307 $rm -f try.c try
11308 set d_stdstdio
11309 eval $setvar
11310
11311 : Can _ptr be used as an lvalue?
11312 case "$d_stdstdio$ptr_lval" in
11313 $define$define) val=$define ;;
11314 *) val=$undef ;;
11315 esac
11316 set d_stdio_ptr_lval
11317 eval $setvar
11318
11319 : Can _cnt be used as an lvalue?
11320 case "$d_stdstdio$cnt_lval" in
11321 $define$define) val=$define ;;
11322 *) val=$undef ;;
11323 esac
11324 set d_stdio_cnt_lval
11325 eval $setvar
11326
11327 : see if _base is also standard
11328 val="$undef"
11329 case "$d_stdstdio" in
11330 $define)
11331         $cat >try.c <<EOP
11332 #include <stdio.h>
11333 #define FILE_base(fp)   $stdio_base
11334 #define FILE_bufsiz(fp) $stdio_bufsiz
11335 int main() {
11336         FILE *fp = fopen("try.c", "r");
11337         char c = getc(fp);
11338         if (
11339                 19 <= FILE_bufsiz(fp) &&
11340                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11341         )
11342                 exit(0);
11343         exit(1);
11344 }
11345 EOP
11346         set try
11347         if eval $compile; then
11348                 if ./try; then
11349                         echo "And its _base field acts std."
11350                         val="$define"
11351                 else
11352                         echo "But its _base field isn't std."
11353                 fi
11354         else
11355                 echo "However, it seems to be lacking the _base field."
11356         fi
11357         $rm -f try.c try
11358         ;;
11359 esac
11360 set d_stdiobase
11361 eval $setvar
11362
11363 $cat >&4 <<EOM
11364 Checking how to access stdio streams by file descriptor number...
11365 EOM
11366 case "$stdio_stream_array" in
11367 '')     $cat >try.c <<EOCP
11368 #include <stdio.h>
11369 int main() {
11370   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11371     printf("yes\n");
11372 }
11373 EOCP
11374         for s in _iob __iob __sF
11375         do
11376                 set try -DSTDIO_STREAM_ARRAY=$s
11377                 if eval $compile; then
11378                         case "`./try$exe_ext`" in
11379                         yes)    stdio_stream_array=$s; break ;;
11380                         esac
11381                 fi
11382         done
11383         $rm -f try.* try$exe_ext
11384 esac
11385 case "$stdio_stream_array" in
11386 '')     $cat >&4 <<EOM
11387 I can't figure out how to access stdio streams by file descriptor number.
11388 EOM
11389         d_stdio_stream_array="$undef"
11390         ;;
11391 *)      $cat >&4 <<EOM
11392 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11393 EOM
11394         d_stdio_stream_array="$define"
11395         ;;
11396 esac
11397
11398 : see if strcoll exists
11399 set strcoll d_strcoll
11400 eval $inlibc
11401
11402 : check for structure copying
11403 echo " "
11404 echo "Checking to see if your C compiler can copy structs..." >&4
11405 $cat >try.c <<'EOCP'
11406 int main()
11407 {
11408         struct blurfl {
11409                 int dyick;
11410         } foo, bar;
11411
11412         foo = bar;
11413 }
11414 EOCP
11415 if $cc -c try.c >/dev/null 2>&1 ; then
11416         val="$define"
11417         echo "Yup, it can."
11418 else
11419         val="$undef"
11420         echo "Nope, it can't."
11421 fi
11422 set d_strctcpy
11423 eval $setvar
11424 $rm -f try.*
11425
11426 : see if strerror and/or sys_errlist[] exist
11427 echo " "
11428 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11429     if set strerror val -f d_strerror; eval $csym; $val; then
11430                 echo 'strerror() found.' >&4
11431                 d_strerror="$define"
11432                 d_strerrm='strerror(e)'
11433                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11434                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11435                         d_syserrlst="$define"
11436                 else
11437                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11438                         d_syserrlst="$undef"
11439                 fi
11440     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11441                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11442                 echo 'strerror() found in string header.' >&4
11443                 d_strerror="$define"
11444                 d_strerrm='strerror(e)'
11445                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11446                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11447                                 d_syserrlst="$define"
11448                 else
11449                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11450                         d_syserrlst="$undef"
11451                 fi
11452     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11453                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11454                 d_strerror="$undef"
11455                 d_syserrlst="$define"
11456                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11457     else
11458                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11459                 d_strerror="$undef"
11460                 d_syserrlst="$undef"
11461                 d_strerrm='"unknown"'
11462     fi
11463 fi
11464
11465 : see if strtod exists
11466 set strtod d_strtod
11467 eval $inlibc
11468
11469 : see if strtol exists
11470 set strtol d_strtol
11471 eval $inlibc
11472
11473 : see if strtold exists
11474 set strtold d_strtold
11475 eval $inlibc
11476
11477 : see if strtoll exists
11478 set strtoll d_strtoll
11479 eval $inlibc
11480
11481 case "$d_longlong-$d_strtoll" in
11482 "$define-$define")
11483         $cat <<EOM
11484 Checking whether your strtoll() works okay...
11485 EOM
11486         $cat >try.c <<'EOCP'
11487 #include <errno.h>
11488 #ifdef __hpux
11489 #define strtoll __strtoll
11490 #endif
11491 #include <stdio.h>
11492 extern long long int strtoll(char *s, char **, int); 
11493 static int bad = 0;
11494 int check(char *s, long long ell, int een) {
11495         long long gll;
11496         errno = 0;
11497         gll = strtoll(s, 0, 10);
11498         if (!((gll == ell) && (errno == een)))
11499                 bad++;
11500 }
11501 int main() {
11502         check(" 1",                                      1LL, 0);
11503         check(" 0",                                      0LL, 0);
11504         check("-1",                                     -1LL, 0);
11505         check("-9223372036854775808", -9223372036854775808LL, 0);
11506         check("-9223372036854775808", -9223372036854775808LL, 0);
11507         check(" 9223372036854775807",  9223372036854775807LL, 0);
11508         check("-9223372036854775808", -9223372036854775808LL, 0);
11509         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11510         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11511         if (!bad)
11512                 printf("ok\n");
11513 }
11514 EOCP
11515         set try
11516         if eval $compile; then
11517                 case "`./try`" in
11518                 ok) echo "Your strtoll() seems to be working okay." ;;
11519                 *) cat <<EOM >&4
11520 Your strtoll() doesn't seem to be working okay.
11521 EOM
11522                    d_strtoll="$undef"
11523                    ;;
11524                 esac
11525         fi
11526         ;;
11527 esac
11528
11529 : see if strtoul exists
11530 set strtoul d_strtoul
11531 eval $inlibc
11532
11533 : see if strtoull exists
11534 set strtoull d_strtoull
11535 eval $inlibc
11536
11537 case "$d_longlong-$d_strtoull" in
11538 "$define-$define")
11539         $cat <<EOM
11540 Checking whether your strtoull() works okay...
11541 EOM
11542         $cat >try.c <<'EOCP'
11543 #include <errno.h>
11544 #ifdef __hpux
11545 #define strtoull __strtoull
11546 #endif
11547 #include <stdio.h>
11548 extern unsigned long long int strtoull(char *s, char **, int); 
11549 static int bad = 0;
11550 int check(char *s, long long eull, int een) {
11551         long long gull;
11552         errno = 0;
11553         gull = strtoull(s, 0, 10);
11554         if (!((gull == eull) && (errno == een)))
11555                 bad++;
11556 }
11557 int main() {
11558         check(" 1",                                       1LL, 0);
11559         check(" 0",                                       0LL, 0);
11560         check("18446744073709551615", 18446744073709551615ULL, 0);
11561         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11562         if (!bad)
11563                 printf("ok\n");
11564 }
11565 EOCP
11566         set try
11567         if eval $compile; then
11568                 case "`./try`" in
11569                 ok) echo "Your strtoull() seems to be working okay." ;;
11570                 *) cat <<EOM >&4
11571 Your strtoull() doesn't seem to be working okay.
11572 EOM
11573                    d_strtoull="$undef"
11574                    ;;
11575                 esac
11576         fi
11577         ;;
11578 esac
11579
11580 : see if strtouq exists
11581 set strtouq d_strtouq
11582 eval $inlibc
11583
11584 : see if strxfrm exists
11585 set strxfrm d_strxfrm
11586 eval $inlibc
11587
11588 : see if symlink exists
11589 set symlink d_symlink
11590 eval $inlibc
11591
11592 : see if syscall exists
11593 set syscall d_syscall
11594 eval $inlibc
11595
11596 : see if sysconf exists
11597 set sysconf d_sysconf
11598 eval $inlibc
11599
11600 : see if system exists
11601 set system d_system
11602 eval $inlibc
11603
11604 : see if tcgetpgrp exists
11605 set tcgetpgrp d_tcgetpgrp
11606 eval $inlibc
11607
11608 : see if tcsetpgrp exists
11609 set tcsetpgrp d_tcsetpgrp
11610 eval $inlibc
11611
11612 : see if prototype for telldir is available
11613 echo " "
11614 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11615 eval $hasproto
11616
11617 : see if this is a sys/times.h system
11618 set sys/times.h i_systimes
11619 eval $inhdr
11620
11621 : see if times exists
11622 echo " "
11623 if set times val -f d_times; eval $csym; $val; then
11624         echo 'times() found.' >&4
11625         d_times="$define"
11626         inc=''
11627         case "$i_systimes" in
11628         "$define") inc='sys/times.h';;
11629         esac
11630         rp="What is the type returned by times() on this system?"
11631         set clock_t clocktype long stdio.h sys/types.h $inc
11632         eval $typedef_ask
11633 else
11634         echo 'times() NOT found, hope that will do.' >&4
11635         d_times="$undef"
11636         clocktype='int'
11637 fi
11638
11639 : see if truncate exists
11640 set truncate d_truncate
11641 eval $inlibc
11642
11643 : see if tzname[] exists
11644 echo " "
11645 if set tzname val -a d_tzname; eval $csym; $val; then
11646         val="$define"
11647         echo 'tzname[] found.' >&4
11648 else
11649         val="$undef"
11650         echo 'tzname[] NOT found.' >&4
11651 fi
11652 set d_tzname
11653 eval $setvar
11654
11655 : see if umask exists
11656 set umask d_umask
11657 eval $inlibc
11658
11659 : see if ustat exists
11660 set ustat d_ustat
11661 eval $inlibc
11662
11663 : backward compatibility for d_hvfork
11664 if test X$d_hvfork != X; then
11665         d_vfork="$d_hvfork"
11666         d_hvfork=''
11667 fi
11668 : see if there is a vfork
11669 val=''
11670 set vfork val
11671 eval $inlibc
11672
11673 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11674 : perl on Solaris 2.x, and probably elsewhere.
11675 case "$val" in
11676 $define)
11677         echo " "
11678         case "$usevfork" in
11679         false) dflt='n';;
11680         *) dflt='y';;
11681         esac
11682         cat <<'EOM'
11683  
11684 Perl can only use a vfork() that doesn't suffer from strict
11685 restrictions on calling functions or modifying global data in
11686 the child.  For example, glibc-2.1 contains such a vfork()
11687 that is unsuitable.  If your system provides a proper fork()
11688 call, chances are that you do NOT want perl to use vfork().
11689
11690 EOM
11691         rp="Do you still want to use vfork()?"
11692         . ./myread
11693         case "$ans" in
11694         y|Y) ;;
11695         *)
11696                 echo "Ok, we won't use vfork()."
11697                 val="$undef"
11698                 ;;
11699         esac
11700         ;;
11701 esac
11702 set d_vfork
11703 eval $setvar
11704 case "$d_vfork" in
11705 $define) usevfork='true';;
11706 *) usevfork='false';;
11707 esac
11708
11709 : see if this is an sysdir system
11710 set sys/dir.h i_sysdir
11711 eval $inhdr
11712
11713 : see if this is an sysndir system
11714 set sys/ndir.h i_sysndir
11715 eval $inhdr
11716
11717 : see if closedir exists
11718 set closedir d_closedir
11719 eval $inlibc
11720
11721 case "$d_closedir" in
11722 "$define")
11723         echo " "
11724         echo "Checking whether closedir() returns a status..." >&4
11725         cat > closedir.c <<EOM
11726 #$i_dirent I_DIRENT             /**/
11727 #$i_sysdir I_SYS_DIR            /**/
11728 #$i_sysndir I_SYS_NDIR          /**/
11729 #$i_systypes I_SYS_TYPES        /**/
11730
11731 #if defined(I_SYS_TYPES)
11732 #include <sys/types.h>
11733 #endif
11734 #if defined(I_DIRENT)
11735 #include <dirent.h>
11736 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11737 #include <sys/dir.h>
11738 #endif
11739 #else
11740 #ifdef I_SYS_NDIR
11741 #include <sys/ndir.h>
11742 #else
11743 #ifdef I_SYS_DIR
11744 #ifdef hp9000s500
11745 #include <ndir.h>       /* may be wrong in the future */
11746 #else
11747 #include <sys/dir.h>
11748 #endif
11749 #endif
11750 #endif
11751 #endif 
11752 int main() { return closedir(opendir(".")); }
11753 EOM
11754         set closedir
11755         if eval $compile_ok; then
11756                 if ./closedir > /dev/null 2>&1 ; then
11757                         echo "Yes, it does."
11758                         val="$undef"
11759                 else
11760                         echo "No, it doesn't."
11761                         val="$define"
11762                 fi
11763         else
11764                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11765                 val="$define"
11766         fi
11767         ;;
11768 *)
11769         val="$undef";
11770         ;;
11771 esac
11772 set d_void_closedir
11773 eval $setvar
11774 $rm -f closedir*
11775 : check for volatile keyword
11776 echo " "
11777 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11778 $cat >try.c <<'EOCP'
11779 int main()
11780 {
11781         typedef struct _goo_struct goo_struct;
11782         goo_struct * volatile goo = ((goo_struct *)0);
11783         struct _goo_struct {
11784                 long long_int;
11785                 int reg_int;
11786                 char char_var;
11787         };
11788         typedef unsigned short foo_t;
11789         char *volatile foo;
11790         volatile int bar;
11791         volatile foo_t blech;
11792         foo = foo;
11793 }
11794 EOCP
11795 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11796         val="$define"
11797         echo "Yup, it does."
11798 else
11799         val="$undef"
11800         echo "Nope, it doesn't."
11801 fi
11802 set d_volatile
11803 eval $setvar
11804 $rm -f try.*
11805
11806 : see if there is a wait4
11807 set wait4 d_wait4
11808 eval $inlibc
11809
11810 : see if waitpid exists
11811 set waitpid d_waitpid
11812 eval $inlibc
11813
11814 : see if wcstombs exists
11815 set wcstombs d_wcstombs
11816 eval $inlibc
11817
11818 : see if wctomb exists
11819 set wctomb d_wctomb
11820 eval $inlibc
11821
11822 : preserve RCS keywords in files with variable substitution, grrr
11823 Date='$Date'
11824 Id='$Id'
11825 Log='$Log'
11826 RCSfile='$RCSfile'
11827 Revision='$Revision'
11828
11829 case "$crosscompile" in
11830 ''|[nN]*) crosscompile="$undef" ;;
11831 esac
11832
11833 case "$osname" in
11834 next|rhapsody|darwin) multiarch="$define" ;;
11835 esac
11836 case "$multiarch" in
11837 ''|[nN]*) multiarch="$undef" ;;
11838 esac
11839
11840 : check for alignment requirements
11841 echo " "
11842 case "$crosscompile$multiarch" in
11843 *$define*)
11844         $cat <<EOM
11845 You seem to be either cross-compiling or doing a multiarchitecture build,
11846 skipping the memory alignment check.
11847
11848 EOM
11849         case "$alignbytes" in
11850         '') alignbytes=8 ;;
11851         esac
11852         ;;
11853 *)
11854         case "$alignbytes" in
11855         '') echo "Checking alignment constraints..." >&4
11856                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11857                         $cat >try.c <<'EOCP'
11858 typedef long double NV;
11859 EOCP
11860                 else
11861                         $cat >try.c <<'EOCP'
11862 typedef double NV;
11863 EOCP
11864                 fi
11865                 $cat >>try.c <<'EOCP'
11866 #include <stdio.h>
11867 struct foobar {
11868         char foo;
11869         NV bar;
11870 } try_algn;
11871 int main()
11872 {
11873     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11874     return(0);
11875 }
11876 EOCP
11877                 set try
11878                 if eval $compile_ok; then
11879                         dflt=`./try`
11880                 else
11881                         dflt='8'
11882                         echo "(I can't seem to compile the test program...)"
11883                 fi
11884                 ;;
11885         *) dflt="$alignbytes"
11886                 ;;
11887         esac
11888         rp="Doubles must be aligned on a how-many-byte boundary?"
11889         . ./myread
11890         alignbytes="$ans"
11891         $rm -f try.c try
11892         ;;
11893 esac
11894
11895
11896 : set the base revision
11897 baserev=5.0
11898
11899 : check for ordering of bytes in a long
11900 echo " "
11901 case "$crosscompile$multiarch" in
11902 *$define*)
11903         $cat <<EOM
11904 You seem to be either cross-compiling or doing a multiarchitecture build,
11905 skipping the byteorder check.
11906
11907 EOM
11908         byteorder='0xffff'
11909         ;;
11910 *)
11911         case "$byteorder" in
11912         '')
11913                 $cat <<'EOM'
11914 In the following, larger digits indicate more significance.  A big-endian
11915 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11916 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11917 machines may have weird orders like 3412.  A Cray will report 87654321,
11918 an Alpha will report 12345678. If the test program works the default is
11919 probably right.
11920 I'm now running the test program...
11921 EOM
11922                 $cat >try.c <<'EOCP'
11923 #include <stdio.h>
11924 int main()
11925 {
11926         int i;
11927         union {
11928                 unsigned long l;
11929                 char c[sizeof(long)];
11930         } u;
11931
11932         if (sizeof(long) > 4)
11933                 u.l = (0x08070605L << 32) | 0x04030201L;
11934         else
11935                 u.l = 0x04030201L;
11936         for (i = 0; i < sizeof(long); i++)
11937                 printf("%c", u.c[i]+'0');
11938         printf("\n");
11939         exit(0);
11940 }
11941 EOCP
11942                 xxx_prompt=y
11943                 set try
11944                 if eval $compile && ./try > /dev/null; then
11945                         dflt=`./try`
11946                         case "$dflt" in
11947                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11948                                 echo "(The test program ran ok.)"
11949                                 echo "byteorder=$dflt"
11950                                 xxx_prompt=n
11951                         ;;
11952                         ????|????????) echo "(The test program ran ok.)" ;;
11953                         *) echo "(The test program didn't run right for some reason.)" ;;
11954                         esac
11955                 else
11956                         dflt='4321'
11957                         cat <<'EOM'
11958 (I can't seem to compile the test program.  Guessing big-endian...)
11959 EOM
11960                 fi
11961                 case "$xxx_prompt" in
11962                 y)
11963                         rp="What is the order of bytes in a long?"
11964                         . ./myread
11965                         byteorder="$ans"
11966                         ;;
11967                 *)      byteorder=$dflt
11968                         ;;
11969                 esac
11970                 ;;
11971         esac
11972         $rm -f try.c try
11973         ;;
11974 esac
11975
11976
11977 : how do we catenate cpp tokens here?
11978 echo " "
11979 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11980 $cat >cpp_stuff.c <<'EOCP'
11981 #define RCAT(a,b)a/**/b
11982 #define ACAT(a,b)a ## b
11983 RCAT(Rei,ser)
11984 ACAT(Cir,cus)
11985 EOCP
11986 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11987 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11988         echo "Oh!  Smells like ANSI's been here." >&4
11989         echo "We can catify or stringify, separately or together!"
11990         cpp_stuff=42
11991 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11992         echo "Ah, yes!  The good old days!" >&4
11993         echo "However, in the good old days we don't know how to stringify and"
11994         echo "catify at the same time."
11995         cpp_stuff=1
11996 else
11997         $cat >&4 <<EOM
11998 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11999 to have to edit the values of CAT[2-5] in config.h...
12000 EOM
12001         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12002 fi
12003 $rm -f cpp_stuff.*
12004
12005 : see if this is a db.h system
12006 set db.h i_db
12007 eval $inhdr
12008
12009 case "$i_db" in
12010 $define)
12011         : Check db version.
12012         echo " "
12013         echo "Checking Berkeley DB version ..." >&4
12014         $cat >try.c <<EOCP
12015 #$d_const HASCONST
12016 #ifndef HASCONST
12017 #define const
12018 #endif
12019 #include <sys/types.h>
12020 #include <stdio.h>
12021 #include <db.h>
12022 int main()
12023 {
12024 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12025     int Major, Minor, Patch ;
12026     unsigned long Version ;
12027     (void)db_version(&Major, &Minor, &Patch) ;
12028     printf("You have Berkeley DB Version 2 or greater\n");
12029
12030     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12031                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12032     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12033                 Major, Minor, Patch) ;
12034
12035     /* check that db.h & libdb are compatible */
12036     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12037         printf("db.h and libdb are incompatible\n") ;
12038         exit(3);        
12039     }
12040
12041     printf("db.h and libdb are compatible\n") ;
12042
12043     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12044                 + DB_VERSION_PATCH ;
12045
12046     /* needs to be >= 2.3.4 */
12047     if (Version < 2003004) {
12048     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12049         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12050         exit(2);        
12051     }
12052
12053     exit(0);
12054 #else
12055 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12056     printf("You have Berkeley DB Version 1\n");
12057     exit(0);    /* DB version < 2: the coast is clear. */
12058 #else
12059     exit(1);    /* <db.h> not Berkeley DB? */
12060 #endif
12061 #endif
12062 }
12063 EOCP
12064         set try
12065         if eval $compile_ok && ./try; then
12066                 echo 'Looks OK.' >&4
12067         else
12068                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12069                 i_db=$undef
12070                 case " $libs " in
12071                 *"-ldb "*)
12072                         : Remove db from list of libraries to use
12073                         echo "Removing unusable -ldb from library list" >&4
12074                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12075                         shift
12076                         libs="$*"
12077                         echo "libs = $libs" >&4
12078                         ;;
12079                 esac
12080         fi
12081         $rm -f try.*
12082         ;;
12083 esac
12084
12085 case "$i_db" in
12086 define)
12087         : Check the return type needed for hash 
12088         echo " "
12089         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12090         $cat >try.c <<EOCP
12091 #$d_const HASCONST
12092 #ifndef HASCONST
12093 #define const
12094 #endif
12095 #include <sys/types.h>
12096 #include <db.h>
12097
12098 #ifndef DB_VERSION_MAJOR
12099 u_int32_t hash_cb (ptr, size)
12100 const void *ptr;
12101 size_t size;
12102 {
12103 }
12104 HASHINFO info;
12105 int main()
12106 {
12107         info.hash = hash_cb;
12108 }
12109 #endif
12110 EOCP
12111         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12112                 if $contains warning try.out >>/dev/null 2>&1 ; then
12113                         db_hashtype='int'
12114                 else
12115                         db_hashtype='u_int32_t'
12116                 fi
12117         else
12118                 : XXX Maybe we should just give up here.
12119                 db_hashtype=u_int32_t
12120                 $cat try.out >&4
12121                 echo "Help:  I can't seem to compile the db test program." >&4
12122                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12123         fi
12124         $rm -f try.*
12125         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12126         ;;
12127 *)      db_hashtype=u_int32_t
12128         ;;
12129 esac
12130 case "$i_db" in
12131 define)
12132         : Check the return type needed for prefix 
12133         echo " "
12134         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12135         cat >try.c <<EOCP
12136 #$d_const HASCONST
12137 #ifndef HASCONST
12138 #define const
12139 #endif
12140 #include <sys/types.h>
12141 #include <db.h>
12142
12143 #ifndef DB_VERSION_MAJOR
12144 size_t prefix_cb (key1, key2)
12145 const DBT *key1;
12146 const DBT *key2;
12147 {
12148 }
12149 BTREEINFO info;
12150 int main()
12151 {
12152         info.prefix = prefix_cb;
12153 }
12154 #endif
12155 EOCP
12156         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12157                 if $contains warning try.out >>/dev/null 2>&1 ; then
12158                         db_prefixtype='int'
12159                 else
12160                         db_prefixtype='size_t'
12161                 fi
12162         else
12163                 db_prefixtype='size_t'
12164                 : XXX Maybe we should just give up here.
12165                 $cat try.out >&4
12166                 echo "Help:  I can't seem to compile the db test program." >&4
12167                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12168         fi
12169         $rm -f try.*
12170         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12171         ;;
12172 *)      db_prefixtype='size_t'
12173         ;;
12174 esac
12175
12176 : check for void type
12177 echo " "
12178 echo "Checking to see how well your C compiler groks the void type..." >&4
12179 case "$voidflags" in
12180 '')
12181         $cat >try.c <<'EOCP'
12182 #if TRY & 1
12183 void sub() {
12184 #else
12185 sub() {
12186 #endif
12187         extern void moo();      /* function returning void */
12188         void (*goo)();          /* ptr to func returning void */
12189 #if TRY & 8
12190         void *hue;              /* generic ptr */
12191 #endif
12192 #if TRY & 2
12193         void (*foo[10])();
12194 #endif
12195
12196 #if TRY & 4
12197         if(goo == moo) {
12198                 exit(0);
12199         }
12200 #endif
12201         exit(0);
12202 }
12203 int main() { sub(); }
12204 EOCP
12205         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12206                 voidflags=$defvoidused
12207         echo "Good.  It appears to support void to the level $package wants.">&4
12208                 if $contains warning .out >/dev/null 2>&1; then
12209                         echo "However, you might get some warnings that look like this:"
12210                         $cat .out
12211                 fi
12212         else
12213 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12214                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12215                         echo "It supports 1..."
12216                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12217                                 echo "It also supports 2..."
12218                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12219                                         voidflags=7
12220                                         echo "And it supports 4 but not 8 definitely."
12221                                 else
12222                                         echo "It doesn't support 4..."
12223                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12224                                                 voidflags=11
12225                                                 echo "But it supports 8."
12226                                         else
12227                                                 voidflags=3
12228                                                 echo "Neither does it support 8."
12229                                         fi
12230                                 fi
12231                         else
12232                                 echo "It does not support 2..."
12233                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12234                                         voidflags=13
12235                                         echo "But it supports 4 and 8."
12236                                 else
12237                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12238                                                 voidflags=5
12239                                                 echo "And it supports 4 but has not heard about 8."
12240                                         else
12241                                                 echo "However it supports 8 but not 4."
12242                                         fi
12243                                 fi
12244                         fi
12245                 else
12246                         echo "There is no support at all for void."
12247                         voidflags=0
12248                 fi
12249         fi
12250 esac
12251 case "$voidflags" in
12252 "$defvoidused") ;;
12253 *)      $cat >&4 <<'EOM'
12254   Support flag bits are:
12255     1: basic void declarations.
12256     2: arrays of pointers to functions returning void.
12257     4: operations between pointers to and addresses of void functions.
12258     8: generic void pointers.
12259 EOM
12260         dflt="$voidflags";
12261         rp="Your void support flags add up to what?"
12262         . ./myread
12263         voidflags="$ans"
12264         ;;
12265 esac
12266 $rm -f try.* .out
12267
12268
12269 : How can we generate normalized random numbers ?
12270 echo " "
12271 echo "Looking for a random number function..." >&4
12272 case "$randfunc" in
12273 '')
12274         if set drand48 val -f; eval $csym; $val; then
12275                 dflt="drand48"
12276                 echo "Good, found drand48()." >&4
12277         elif set random val -f; eval $csym; $val; then
12278                 dflt="random"
12279                 echo "OK, found random()." >&4
12280         else
12281                 dflt="rand"
12282                 echo "Yick, looks like I have to use rand()." >&4
12283         fi
12284         echo " "
12285         ;;
12286 *)
12287         dflt="$randfunc"
12288         ;;
12289 esac
12290 cont=true
12291
12292 case "$ccflags" in
12293 *-Dmy_rand=*|*-Dmy_srand=*)
12294         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12295         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12296         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12297         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12298         ;;
12299 esac
12300
12301 while $test "$cont"; do
12302         rp="Use which function to generate random numbers?"
12303         . ./myread
12304         if $test "$ans" = "$dflt"; then
12305                 : null
12306         else
12307                 randbits=''
12308         fi
12309         randfunc="$ans"
12310         if set $ans val -f; eval $csym; $val; then
12311                 cont=''
12312         else
12313                 dflt=y
12314                 rp="I cannot find function $ans. Use that name anyway?"
12315                 . ./myread
12316                 dflt=rand
12317                 case "$ans" in
12318                         [yY]*) cont='';;
12319                 esac
12320         fi
12321         case "$cont" in
12322         '')
12323                 case "$randfunc" in
12324                 drand48)
12325                         drand01="drand48()"
12326                         seedfunc="srand48"
12327                         randbits=48
12328                         randseedtype=long
12329                         ;;
12330                 rand|random)
12331                         case "$randbits" in
12332                         '')
12333 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12334                                 $cat >try.c <<EOCP
12335 #$i_unistd I_UNISTD
12336 #$i_stdlib I_STDLIB
12337 #include <stdio.h>
12338 #ifdef I_UNISTD
12339 #  include <unistd.h>
12340 #endif
12341 #ifdef I_STDLIB
12342 #  include <stdlib.h>
12343 #endif
12344 int main()
12345 {
12346         register int i;
12347         register unsigned long tmp;
12348         register unsigned long max = 0L;
12349
12350         for (i = 1000; i; i--) {
12351                 tmp = (unsigned long) $randfunc();
12352                 if (tmp > max) max = tmp;
12353         }
12354         for (i = 0; max; i++)
12355                 max /= 2;
12356         printf("%d\n",i);
12357 }
12358 EOCP
12359                                 set try
12360                                 if eval $compile_ok; then
12361                                         dflt=`try`
12362                                 else
12363                                         dflt='?'
12364                                         echo "(I can't seem to compile the test program...)"
12365                                 fi
12366                                 ;;
12367                         *)
12368                                 dflt="$randbits"
12369                                 ;;
12370                         esac
12371                         rp="How many bits does your $randfunc() function produce?"
12372                         . ./myread
12373                         randbits="$ans"
12374                         $rm -f try.c try
12375                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12376                         seedfunc="s$randfunc"
12377                         randseedtype=unsigned
12378                         ;;
12379                 *)
12380                         dflt="31"
12381                         rp="How many bits does your $randfunc() function produce?"
12382                         . ./myread
12383                         randbits="$ans"
12384                         seedfunc="s$randfunc"
12385                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12386                         if set $seedfunc val -f; eval $csym; $val; then
12387                                 echo "(Using $seedfunc() to seed random generator)"
12388                         else
12389                                 echo "(Warning: no $seedfunc() to seed random generator)"
12390                                 seedfunc=rand
12391                         fi
12392                         randseedtype=unsigned
12393                         ;;
12394                 esac
12395                 ;;
12396         esac
12397 done
12398
12399 echo " "
12400 echo "Determining whether or not we are on an EBCDIC system..." >&4
12401 $cat >tebcdic.c <<'EOM'
12402 int main()
12403 {
12404   if ('M'==0xd4) return 0;
12405   return 1;
12406 }
12407 EOM
12408
12409 val=$undef
12410 set tebcdic
12411 if eval $compile_ok; then
12412         if ./tebcdic; then
12413                 echo "You have EBCDIC." >&4
12414                 val="$define"
12415         else
12416                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12417         fi
12418 else
12419         echo "I'm unable to compile the test program." >&4
12420         echo "I'll assume ASCII or some ISO Latin." >&4
12421 fi
12422 $rm -f tebcdic.c tebcdic
12423 set ebcdic
12424 eval $setvar
12425
12426 echo " "
12427 $cat >&4 <<EOM
12428 Checking how to flush all pending stdio output...
12429 EOM
12430 # I only know how to find the first 32 possibly open files on SunOS.
12431 # See also hints/sunos_4_1.sh and util.c  --AD
12432 case "$osname" in
12433 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12434 esac
12435 $cat >>try.c <<EOCP
12436 #include <stdio.h>
12437 #$i_unistd I_UNISTD
12438 #ifdef I_UNISTD
12439 # include <unistd.h>
12440 #endif
12441 #$d_sysconf HAS_SYSCONF
12442 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12443 #ifdef HAS_STDIO_STREAM_ARRAY
12444 # define STDIO_STREAM_ARRAY $stdio_stream_array
12445 #endif
12446 int main() {
12447   FILE* p = fopen("try.out", "w");
12448 #ifdef TRY_FPUTC
12449   fputc('x', p);
12450 #else
12451 # ifdef TRY_FPRINTF
12452   fprintf(p, "x");
12453 # endif
12454 #endif
12455 #ifdef TRY_FFLUSH_NULL
12456   fflush(NULL);
12457 #endif
12458 #ifdef TRY_FFLUSH_ALL
12459   {
12460     long open_max = -1;
12461 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12462     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12463 # else
12464 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12465     open_max = sysconf(_SC_OPEN_MAX);
12466 #  else
12467 #   ifdef FOPEN_MAX
12468     open_max = FOPEN_MAX;
12469 #   else
12470 #    ifdef OPEN_MAX
12471     open_max = OPEN_MAX;
12472 #    else
12473 #     ifdef _NFILE
12474     open_max = _NFILE;
12475 #     endif
12476 #    endif
12477 #   endif
12478 #  endif
12479 # endif 
12480 # ifdef HAS_STDIO_STREAM_ARRAY
12481     if (open_max > 0) {
12482       long i;
12483       for (i = 0; i < open_max; i++)
12484             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12485                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12486                 STDIO_STREAM_ARRAY[i]._flag)
12487                 fflush(&STDIO_STREAM_ARRAY[i]);
12488     }   
12489   }
12490 # endif
12491 #endif
12492   _exit(42);
12493 }
12494 EOCP
12495 : first we have to find out how _not_ to flush
12496 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12497     output=''
12498     set try -DTRY_FPUTC
12499     if eval $compile; then
12500             $rm -f try.out
12501             ./try$exe_ext 2>/dev/null
12502             if $test ! -s try.out -a "X$?" = X42; then
12503                 output=-DTRY_FPUTC
12504             fi
12505     fi
12506     case "$output" in
12507     '')
12508             set try -DTRY_FPRINTF
12509             $rm -f try.out
12510             if eval $compile; then
12511                     $rm -f try.out
12512                     ./try$exe_ext 2>/dev/null
12513                     if $test ! -s try.out -a "X$?" = X42; then
12514                         output=-DTRY_FPRINTF
12515                     fi
12516             fi
12517         ;;
12518     esac
12519 fi
12520 : check for fflush NULL behaviour
12521 case "$fflushNULL" in
12522 '')     set try -DTRY_FFLUSH_NULL $output
12523         if eval $compile; then
12524                 $rm -f try.out
12525                 ./try$exe_ext 2>/dev/null
12526                 code="$?"
12527                 if $test -s try.out -a "X$code" = X42; then
12528                         fflushNULL="`$cat try.out`"
12529                 else
12530                         if $test "X$code" != X42; then
12531                                 $cat >&4 <<EOM
12532 (If this test failed, don't worry, we'll try another method shortly.)
12533 EOM
12534                         fi
12535                 fi
12536         fi
12537         $rm -f core try.core core.try.*
12538         case "$fflushNULL" in
12539         x)      $cat >&4 <<EOM
12540 Your fflush(NULL) works okay for output streams.
12541 Let's see if it clobbers input pipes...
12542 EOM
12543 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12544 # bug that improperly flushes the input end of pipes.  So we avoid the
12545 # autoflush on fork/system/exec support for now. :-(
12546 $cat >tryp.c <<EOCP
12547 #include <stdio.h>
12548 int
12549 main(int argc, char **argv)
12550 {
12551     char buf[1024];
12552     int i;
12553     char *bp = buf;
12554     while (1) {
12555         while ((i = getc(stdin)) != -1
12556                && (*bp++ = i) != '\n'
12557                && bp < &buf[1024])
12558         /* DO NOTHING */ ;
12559         *bp = '\0';
12560         fprintf(stdout, "%s", buf);
12561         fflush(NULL);
12562         if (i == -1)
12563             return 0;
12564         bp = buf;
12565     }
12566 }
12567 EOCP
12568                 fflushNULL="$define"
12569                 set tryp
12570                 if eval $compile; then
12571                     $rm -f tryp.out
12572                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12573                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12574                        $cat >&4 <<EOM
12575 fflush(NULL) seems to behave okay with input streams.
12576 EOM
12577                         fflushNULL="$define"
12578                     else
12579                         $cat >&4 <<EOM
12580 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12581 EOM
12582                         fflushNULL="$undef"
12583                     fi
12584                 fi
12585                 $rm -f core tryp.c tryp.core core.tryp.*
12586                 ;;
12587         '')     $cat >&4 <<EOM
12588 Your fflush(NULL) isn't working (contrary to ANSI C).
12589 EOM
12590                 fflushNULL="$undef"
12591                 ;;
12592         *)      $cat >&4 <<EOM
12593 Cannot figure out whether your fflush(NULL) works or not.
12594 I'm assuming it doesn't (contrary to ANSI C).
12595 EOM
12596                 fflushNULL="$undef"
12597                 ;;
12598         esac
12599         ;;
12600 $define|true|[yY]*)
12601         fflushNULL="$define"
12602         ;;
12603 *)
12604         fflushNULL="$undef"
12605         ;;
12606 esac
12607 : check explicit looping only if NULL did not work, and if the pipe
12608 : bug does not show up on an explicit flush too
12609 case "$fflushNULL" in
12610 "$undef")
12611         $cat >tryp.c <<EOCP
12612 #include <stdio.h>
12613 int
12614 main(int argc, char **argv)
12615 {
12616     char buf[1024];
12617     int i;
12618     char *bp = buf;
12619     while (1) {
12620         while ((i = getc(stdin)) != -1
12621                && (*bp++ = i) != '\n'
12622                && bp < &buf[1024])
12623         /* DO NOTHING */ ;
12624         *bp = '\0';
12625         fprintf(stdout, "%s", buf);
12626         fflush(stdin);
12627         if (i == -1)
12628             return 0;
12629         bp = buf;
12630     }
12631 }
12632 EOCP
12633         set tryp
12634         if eval $compile; then
12635             $rm -f tryp.out
12636             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12637             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12638                $cat >&4 <<EOM
12639 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12640 EOM
12641                 : now check for fflushall behaviour
12642                 case "$fflushall" in
12643                 '')     set try -DTRY_FFLUSH_ALL $output
12644                         if eval $compile; then
12645                                 $cat >&4 <<EOM
12646 (Now testing the other method--but note that this also may fail.)
12647 EOM
12648                                 $rm -f try.out
12649                                 ./try$exe_ext 2>/dev/null
12650                                 if $test -s try.out -a "X$?" = X42; then
12651                                         fflushall="`$cat try.out`"
12652                                 fi
12653                         fi
12654                         $rm -f core try.core core.try.*
12655                         case "$fflushall" in
12656                         x)      $cat >&4 <<EOM
12657 Whew. Flushing explicitly all the stdio streams works.
12658 EOM
12659                                 fflushall="$define"
12660                                 ;;
12661                         '')     $cat >&4 <<EOM
12662 Sigh. Flushing explicitly all the stdio streams doesn't work.
12663 EOM
12664                                 fflushall="$undef"
12665                                 ;;
12666                         *)      $cat >&4 <<EOM
12667 Cannot figure out whether flushing stdio streams explicitly works or not.
12668 I'm assuming it doesn't.
12669 EOM
12670                                 fflushall="$undef"
12671                                 ;;
12672                         esac
12673                         ;;
12674                 "$define"|true|[yY]*)
12675                         fflushall="$define"
12676                         ;;
12677                 *)
12678                         fflushall="$undef"
12679                         ;;
12680                 esac
12681             else
12682                 $cat >&4 <<EOM
12683 All is futile.  Even fflush(stdin) clobbers input pipes!
12684 EOM
12685                 fflushall="$undef"
12686             fi
12687         else
12688             fflushall="$undef"
12689         fi
12690         $rm -f core tryp.c tryp.core core.tryp.*
12691         ;;
12692 *)      fflushall="$undef"
12693         ;;
12694 esac
12695
12696 case "$fflushNULL$fflushall" in
12697 undefundef)
12698         $cat <<EOM
12699 OK, I give up.  I cannot figure out how to flush pending stdio output.
12700 We won't be flushing handles at all before fork/exec/popen.
12701 EOM
12702         ;;
12703 esac
12704 $rm -f try.* try$exe_ext
12705
12706 : Store the full pathname to the ar program for use in the C program
12707 : Respect a hint or command line value for full_ar.
12708 case "$full_ar" in
12709 '') full_ar=$ar ;;
12710 esac
12711
12712 : Store the full pathname to the sed program for use in the C program
12713 full_sed=$sed
12714
12715 : see what type gids are declared as in the kernel
12716 echo " "
12717 echo "Looking for the type for group ids returned by getgid()."
12718 set gid_t gidtype xxx stdio.h sys/types.h
12719 eval $typedef
12720 case "$gidtype" in
12721 xxx)
12722         xxx=`./findhdr sys/user.h`
12723         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12724         case $1 in
12725         unsigned) dflt="$1 $2" ;;
12726         *) dflt="$1" ;;
12727         esac
12728         ;;
12729 *) dflt="$gidtype";;
12730 esac
12731 case "$gidtype" in
12732 gid_t) echo "gid_t found." ;;
12733 *)      rp="What is the type for group ids returned by getgid()?"
12734         . ./myread
12735         gidtype="$ans"
12736         ;;
12737 esac
12738
12739 echo " "
12740 case "$gidtype" in
12741 *_t) zzz="$gidtype"     ;;
12742 *)   zzz="gid"          ;;
12743 esac
12744 echo "Checking the size of $zzz..." >&4 
12745 cat > try.c <<EOCP
12746 #include <sys/types.h>
12747 #include <stdio.h>
12748 int main() {
12749     printf("%d\n", (int)sizeof($gidtype));
12750     exit(0);
12751 }
12752 EOCP
12753 set try
12754 if eval $compile_ok; then
12755         yyy=`./try`
12756         case "$yyy" in
12757         '')     gidsize=4
12758                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12759                 ;;
12760         *)      gidsize=$yyy
12761                 echo "Your $zzz is $gidsize bytes long."
12762                 ;;
12763         esac
12764 else
12765         gidsize=4
12766         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12767 fi
12768
12769
12770 echo " "
12771 case "$gidtype" in
12772 *_t) zzz="$gidtype"     ;;
12773 *)   zzz="gid"          ;;
12774 esac
12775 echo "Checking the sign of $zzz..." >&4 
12776 cat > try.c <<EOCP
12777 #include <sys/types.h>
12778 #include <stdio.h>
12779 int main() {
12780         $gidtype foo = -1;
12781         if (foo < 0)
12782                 printf("-1\n");
12783         else
12784                 printf("1\n");
12785 }
12786 EOCP
12787 set try
12788 if eval $compile; then
12789         yyy=`./try`
12790         case "$yyy" in
12791         '')     gidsign=1
12792                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12793                 ;;
12794         *)      gidsign=$yyy
12795                 case "$gidsign" in
12796                  1) echo "Your $zzz is unsigned." ;;
12797                 -1) echo "Your $zzz is signed."   ;;
12798                 esac
12799                 ;;
12800         esac
12801 else
12802         gidsign=1
12803         echo "(I can't compile the test program--guessing unsigned.)" >&4
12804 fi
12805
12806
12807 echo " "
12808
12809 if $test X"$quadtype" != X; then
12810
12811 echo "Checking how to print 64-bit integers..." >&4
12812
12813 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12814         $cat >try.c <<'EOCP'
12815 #include <sys/types.h>
12816 #include <stdio.h>
12817 int main() {
12818   int q = 12345678901;
12819   printf("%ld\n", q);
12820 }
12821 EOCP
12822         set try
12823         if eval $compile; then
12824                 yyy=`./try$exe_ext`
12825                 case "$yyy" in
12826                 12345678901)
12827                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12828                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12829                         echo "We will use %d."
12830                         ;;
12831                 esac
12832         fi
12833 fi
12834
12835 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12836         $cat >try.c <<'EOCP'
12837 #include <sys/types.h>
12838 #include <stdio.h>
12839 int main() {
12840   long q = 12345678901;
12841   printf("%ld\n", q);
12842 }
12843 EOCP
12844         set try
12845         if eval $compile; then
12846                 yyy=`./try$exe_ext`
12847                 case "$yyy" in
12848                 12345678901)
12849                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12850                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12851                         echo "We will use %ld."
12852                         ;;
12853                 esac
12854         fi
12855 fi
12856
12857 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12858         $cat >try.c <<'EOCP'
12859 #include <sys/types.h>
12860 #include <inttypes.h>
12861 #include <stdio.h>
12862 int main() {
12863   int64_t q = 12345678901;
12864   printf("%" PRId64 "\n", q);
12865 }
12866 EOCP
12867         set try
12868         if eval $compile; then
12869                 yyy=`./try$exe_ext`
12870                 case "$yyy" in
12871                 12345678901)
12872                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12873                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12874                         echo "We will use the C9X style."
12875                         ;;
12876                 esac
12877         fi
12878 fi
12879
12880 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12881         $cat >try.c <<'EOCP'
12882 #include <sys/types.h>
12883 #include <stdio.h>
12884 int main() {
12885   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12886   printf("%lld\n", q);
12887 }
12888 EOCP
12889         set try
12890         if eval $compile; then
12891                 yyy=`./try$exe_ext`
12892                 case "$yyy" in
12893                 12345678901)
12894                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12895                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12896                         echo "We will use the %lld style."
12897                         ;;
12898                 esac
12899         fi
12900 fi
12901
12902 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12903         $cat >try.c <<EOCP
12904 #include <sys/types.h>
12905 #include <stdio.h>
12906 int main() {
12907   $quadtype q = 12345678901;
12908   printf("%Ld\n", q);
12909 }
12910 EOCP
12911         set try
12912         if eval $compile; then
12913                 yyy=`./try$exe_ext`
12914                 case "$yyy" in
12915                 12345678901)
12916                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12917                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12918                         echo "We will use %Ld."
12919                         ;;
12920                 esac
12921         fi
12922 fi
12923
12924 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12925         $cat >try.c <<EOCP
12926 #include <sys/types.h>
12927 #include <stdio.h>
12928 int main() {
12929   $quadtype q = 12345678901;
12930   printf("%qd\n", q);
12931 }
12932 EOCP
12933         set try
12934         if eval $compile; then
12935                 yyy=`./try$exe_ext`
12936                 case "$yyy" in
12937                 12345678901)
12938                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12939                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12940                         echo "We will use %qd."
12941                         ;;
12942                 esac
12943         fi
12944 fi
12945
12946 if $test X"$sPRId64" = X; then
12947         echo "Cannot figure out how to print 64-bit integers." >&4
12948 fi
12949
12950 $rm -f try try.*
12951
12952 fi
12953
12954 case "$sPRId64" in
12955 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12956         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12957         ;;
12958 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12959         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12960         ;;
12961 esac
12962
12963
12964 echo " "
12965 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12966
12967 if $test X"$ivsize" = X8; then
12968         ivdformat="$sPRId64"
12969         uvuformat="$sPRIu64"
12970         uvoformat="$sPRIo64"
12971         uvxformat="$sPRIx64"
12972 else
12973         if $test X"$ivsize" = X"$longsize"; then
12974                 ivdformat='"ld"'
12975                 uvuformat='"lu"'
12976                 uvoformat='"lo"'
12977                 uvxformat='"lx"'
12978         else
12979                 if $test X"$ivsize" = X"$intsize"; then
12980                         ivdformat='"d"'
12981                         uvuformat='"u"'
12982                         uvoformat='"o"'
12983                         uvxformat='"x"'
12984                 else
12985                         : far out
12986                         if $test X"$ivsize" = X"$shortsize"; then
12987                                 ivdformat='"hd"'
12988                                 uvuformat='"hu"'
12989                                 uvoformat='"ho"'
12990                                 uvxformat='"hx"'
12991                         fi
12992                 fi
12993         fi
12994 fi
12995
12996 case "$ivdformat" in
12997 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12998     exit 1
12999     ;;
13000 esac
13001
13002
13003 echo " "
13004 $echo "Checking the format string to be used for gids..." >&4
13005
13006 case "$gidsign" in
13007 -1)     if $test X"$gidsize" = X"$ivsize"; then
13008                 gidformat="$ivdformat"
13009         else
13010                 if $test X"$gidsize" = X"$longsize"; then
13011                         gidformat='"ld"'
13012                 else
13013                         if $test X"$gidsize" = X"$intsize"; then
13014                                 gidformat='"d"'
13015                         else
13016                                 if $test X"$gidsize" = X"$shortsize"; then
13017                                         gidformat='"hd"'
13018                                 fi
13019                         fi
13020                 fi
13021         fi
13022         ;;
13023 *)      if $test X"$gidsize" = X"$uvsize"; then
13024                 gidformat="$uvuformat"
13025         else
13026                 if $test X"$gidsize" = X"$longsize"; then
13027                         gidformat='"lu"'
13028                 else
13029                         if $test X"$gidsize" = X"$intsize"; then
13030                                 gidformat='"u"'
13031                         else
13032                                 if $test X"$gidsize" = X"$shortsize"; then
13033                                         gidformat='"hu"'
13034                                 fi
13035                         fi
13036                 fi
13037         fi
13038         ;;
13039 esac
13040
13041 : see if getgroups exists
13042 set getgroups d_getgrps
13043 eval $inlibc
13044
13045 : see if setgroups exists
13046 set setgroups d_setgrps
13047 eval $inlibc
13048
13049
13050 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13051 echo " "
13052 case "$d_getgrps$d_setgrps" in
13053 *define*)
13054         case "$groupstype" in
13055         '') dflt="$gidtype" ;;
13056         *)  dflt="$groupstype" ;;
13057         esac
13058         $cat <<EOM
13059 What type of pointer is the second argument to getgroups() and setgroups()?
13060 Usually this is the same as group ids, $gidtype, but not always.
13061
13062 EOM
13063         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13064         . ./myread
13065         groupstype="$ans"
13066         ;;
13067 *)  groupstype="$gidtype";;
13068 esac
13069
13070 echo " "
13071 echo "Checking if your $make program sets \$(MAKE)..." >&4
13072 case "$make_set_make" in
13073 '')
13074         $sed 's/^X //' > testmake.mak << 'EOF'
13075 Xall:
13076 X       @echo 'maketemp="$(MAKE)"'
13077 EOF
13078         case "`$make -f testmake.mak 2>/dev/null`" in
13079         *maketemp=*) make_set_make='#' ;;
13080         *)      make_set_make="MAKE=$make" ;;
13081         esac
13082         $rm -f testmake.mak
13083         ;;
13084 esac
13085 case "$make_set_make" in
13086 '#') echo "Yup, it does.";;
13087 *) echo "Nope, it doesn't.";;
13088 esac
13089
13090 : see what type is used for mode_t
13091 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13092 set mode_t modetype int stdio.h sys/types.h
13093 eval $typedef_ask
13094
13095 : define a fucntion to check prototypes
13096 $cat > protochk <<EOSH
13097 $startsh
13098 cc="$cc"
13099 optimize="$optimize"
13100 ccflags="$ccflags"
13101 prototype="$prototype"
13102 define="$define"
13103 rm=$rm
13104 EOSH
13105
13106 $cat >> protochk <<'EOSH'
13107
13108 $rm -f try.c
13109 foo="$1"
13110 shift
13111 while test $# -ge 2; do
13112         case "$1" in
13113                 $define) echo "#include <$2>" >> try.c ;;
13114                 literal) echo "$2" >> try.c ;;
13115         esac
13116     shift 2
13117 done
13118 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13119 cat >> try.c <<'EOCP'
13120 #ifdef CAN_PROTOTYPE
13121 #define _(args) args
13122 #else
13123 #define _(args) ()
13124 #endif
13125 EOCP
13126 echo "$foo" >> try.c
13127 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13128 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13129 status=$?
13130 $rm -f try.[co]
13131 exit $status
13132 EOSH
13133 chmod +x protochk
13134 $eunicefix protochk
13135
13136 : see what type is used for size_t
13137 rp="What is the type used for the length parameter for string functions?"
13138 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13139 eval $typedef_ask
13140
13141 : check for type of arguments to gethostbyaddr. 
13142 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13143         case "$d_gethbyaddr" in
13144         $define)
13145                 $cat <<EOM
13146
13147 Checking to see what type of arguments are accepted by gethostbyaddr().
13148 EOM
13149                 hdrs="$define sys/types.h
13150                         $d_socket sys/socket.h 
13151                         $i_niin netinet/in.h 
13152                         $i_netdb netdb.h
13153                         $i_unistd unistd.h"
13154                 : The first arg can 'char *' or 'void *'
13155                 : The second arg is some of integral type
13156                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13157                         for yyy in size_t long int; do
13158                                 case "$netdb_host_type" in
13159                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13160                                         if ./protochk "$try" $hdrs; then
13161                                                 echo "Your system accepts $xxx for the first arg."
13162                                                 echo "...and $yyy for the second arg."
13163                                                 netdb_host_type="$xxx"
13164                                                 netdb_hlen_type="$yyy"
13165                                         fi
13166                                         ;;
13167                                 esac
13168                         done
13169                 done
13170                 : In case none of those worked, prompt the user.
13171                 case "$netdb_host_type" in
13172                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13173                         dflt='char *'
13174                         . ./myread
13175                         netdb_host_type=$ans
13176                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13177                         dflt="$sizetype"
13178                         . ./myread
13179                         netdb_hlen_type=$ans
13180                         ;;
13181                 esac
13182                 ;;
13183         *)      : no gethostbyaddr, so pick harmless defaults
13184                 netdb_host_type='char *'
13185                 netdb_hlen_type="$sizetype"
13186                 ;;
13187         esac
13188         # Remove the "const" if needed. -- but then we'll have a 
13189         # prototype clash!
13190         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13191 fi
13192
13193 : check for type of argument to gethostbyname. 
13194 if test "X$netdb_name_type" = X ; then
13195         case "$d_gethbyname" in
13196         $define)
13197                 $cat <<EOM
13198
13199 Checking to see what type of argument is accepted by gethostbyname().
13200 EOM
13201                 hdrs="$define sys/types.h
13202                         $d_socket sys/socket.h 
13203                         $i_niin netinet/in.h 
13204                         $i_netdb netdb.h
13205                         $i_unistd unistd.h"
13206                 for xxx in "const char *" "char *"; do
13207                         case "$netdb_name_type" in
13208                         '')     try="extern struct hostent *gethostbyname($xxx);"
13209                                 if ./protochk "$try" $hdrs; then
13210                                         echo "Your system accepts $xxx."
13211                                         netdb_name_type="$xxx"
13212                                 fi
13213                                 ;;
13214                         esac
13215                 done
13216                 : In case none of those worked, prompt the user.
13217                 case "$netdb_name_type" in
13218                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13219                         dflt='char *'
13220                         . ./myread
13221                         netdb_name_type=$ans
13222                         ;;
13223                 esac
13224                 ;;
13225         *)      : no gethostbyname, so pick harmless default
13226                 netdb_name_type='char *'
13227                 ;;
13228         esac
13229 fi
13230
13231 : check for type of 1st argument to getnetbyaddr. 
13232 if test "X$netdb_net_type" = X ; then
13233         case "$d_getnbyaddr" in
13234         $define)
13235                 $cat <<EOM
13236
13237 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13238 EOM
13239                 hdrs="$define sys/types.h
13240                         $d_socket sys/socket.h 
13241                         $i_niin netinet/in.h 
13242                         $i_netdb netdb.h
13243                         $i_unistd unistd.h"
13244                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13245                         case "$netdb_net_type" in
13246                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13247                                 if ./protochk "$try" $hdrs; then
13248                                         echo "Your system accepts $xxx."
13249                                         netdb_net_type="$xxx"
13250                                 fi
13251                                 ;;
13252                         esac
13253                 done
13254                 : In case none of those worked, prompt the user.
13255                 case "$netdb_net_type" in
13256                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13257                         dflt='long'
13258                         . ./myread
13259                         netdb_net_type=$ans
13260                         ;;
13261                 esac
13262                 ;;
13263         *)      : no getnetbyaddr, so pick harmless default
13264                 netdb_net_type='long'
13265                 ;;
13266         esac
13267 fi
13268 : locate the preferred pager for this system
13269 case "$pager" in
13270 '')
13271         dflt=''
13272         case "$pg" in
13273         /*) dflt=$pg;;
13274         esac
13275         case "$more" in
13276         /*) dflt=$more;;
13277         esac
13278         case "$less" in
13279         /*) dflt=$less;;
13280         esac
13281         case "$dflt" in
13282         '') dflt=/usr/ucb/more;;
13283         esac
13284         ;;
13285 *) dflt="$pager";;
13286 esac
13287 echo " "
13288 fn=f/
13289 rp='What pager is used on your system?'
13290 . ./getfile
13291 pager="$ans"
13292
13293 : see what type pids are declared as in the kernel
13294 rp="What is the type of process ids on this system?"
13295 set pid_t pidtype int stdio.h sys/types.h
13296 eval $typedef_ask
13297
13298 : Find earliest binary compatible site_perl subdirectory perl can use.
13299 case "$bincompat5005" in
13300 "$define") xs_apiversion='5.005' ;;
13301 *) xs_apiversion=$version ;;   # The current site_perl version.
13302 esac
13303 : Find earliest pure perl site_perl subdirectory perl can use.
13304 : The versioned directories started at 5.005.
13305 pm_apiversion='5.005'
13306
13307 : check for length of pointer
13308 echo " "
13309 case "$ptrsize" in
13310 '')
13311         echo "Checking to see how big your pointers are..." >&4
13312         if test "$voidflags" -gt 7; then
13313                 echo '#define VOID_PTR char *' > try.c
13314         else
13315                 echo '#define VOID_PTR void *' > try.c
13316         fi
13317         $cat >>try.c <<'EOCP'
13318 #include <stdio.h>
13319 int main()
13320 {
13321     printf("%d\n", (int)sizeof(VOID_PTR));
13322     exit(0);
13323 }
13324 EOCP
13325         set try
13326         if eval $compile_ok; then
13327                 ptrsize=`./try`
13328                 echo "Your pointers are $ptrsize bytes long."
13329         else
13330                 dflt='4'
13331                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13332                 rp="What is the size of a pointer (in bytes)?"
13333                 . ./myread
13334                 ptrsize="$ans"
13335         fi
13336         ;;
13337 esac
13338 $rm -f try.c try
13339
13340 : see if ar generates random libraries by itself
13341 echo " "
13342 echo "Checking how to generate random libraries on your machine..." >&4
13343 echo 'int bar1() { return bar2(); }' > bar1.c
13344 echo 'int bar2() { return 2; }' > bar2.c
13345 $cat > foo.c <<'EOP'
13346 int main() { printf("%d\n", bar1()); exit(0); }
13347 EOP
13348 $cc $ccflags -c bar1.c >/dev/null 2>&1
13349 $cc $ccflags -c bar2.c >/dev/null 2>&1
13350 $cc $ccflags -c foo.c >/dev/null 2>&1
13351 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13352 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13353         ./foobar >/dev/null 2>&1; then
13354         echo "$ar appears to generate random libraries itself."
13355         orderlib=false
13356         ranlib=":"
13357 elif $ar ts bar$_a >/dev/null 2>&1 &&
13358         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13359         ./foobar >/dev/null 2>&1; then
13360                 echo "a table of contents needs to be added with '$ar ts'."
13361                 orderlib=false
13362                 ranlib="$ar ts"
13363 else
13364         case "$ranlib" in
13365         :) ranlib='';;
13366         '')
13367                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13368                 $test -f $ranlib || ranlib=''
13369                 ;;
13370         esac
13371         if $test -n "$ranlib"; then
13372                 echo "your system has '$ranlib'; we'll use that."
13373                 orderlib=false
13374         else
13375                 echo "your system doesn't seem to support random libraries"
13376                 echo "so we'll use lorder and tsort to order the libraries."
13377                 orderlib=true
13378                 ranlib=":"
13379         fi
13380 fi
13381 $rm -f foo* bar* 
13382
13383 : check for type of arguments to select. 
13384 case "$selecttype" in
13385 '') case "$d_select" in
13386         $define)
13387                 echo " "
13388                 $cat <<EOM
13389 Checking to see what type of arguments are accepted by select().
13390 EOM
13391                 hdrs="$define sys/types.h
13392                         $i_systime sys/time.h 
13393                         $i_sysselct sys/select.h
13394                         $d_socket sys/socket.h"
13395                 : The first arg can be int, unsigned, or size_t
13396                 : The last arg may or may not be 'const'
13397                 val=''
13398                 : void pointer has been seen but using that
13399                 : breaks the selectminbits test
13400                 for xxx in 'fd_set *' 'int *'; do
13401                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13402                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13403                                         case "$val" in
13404                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13405                                                 if ./protochk "$try" $hdrs; then
13406                                                         echo "Your system accepts $xxx."
13407                                                         val="$xxx"
13408                                                 fi
13409                                                 ;;
13410                                         esac
13411                                 done
13412                         done
13413                 done
13414                 case "$val" in
13415                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13416                         case "$d_fd_set" in
13417                                 $define) dflt="fd_set *" ;;
13418                                 *)              dflt="int *" ;;
13419                         esac
13420                         . ./myread
13421                         val=$ans
13422                         ;;
13423                 esac
13424                 selecttype="$val"
13425                 ;;
13426         *)      : no select, so pick a harmless default
13427                 selecttype='int *'
13428                 ;;
13429         esac
13430         ;;
13431 esac
13432
13433 : check for the select 'width'
13434 case "$selectminbits" in
13435 '') case "$d_select" in
13436         $define)
13437                 $cat <<EOM
13438
13439 Checking to see on how many bits at a time your select() operates...
13440 EOM
13441                 $cat >try.c <<EOCP
13442 #include <sys/types.h>
13443 #$i_time I_TIME
13444 #$i_systime I_SYS_TIME
13445 #$i_systimek I_SYS_TIME_KERNEL
13446 #ifdef I_TIME
13447 #   include <time.h>
13448 #endif
13449 #ifdef I_SYS_TIME
13450 #   ifdef I_SYS_TIME_KERNEL
13451 #       define KERNEL
13452 #   endif
13453 #   include <sys/time.h>
13454 #   ifdef I_SYS_TIME_KERNEL
13455 #       undef KERNEL
13456 #   endif
13457 #endif
13458 #$i_sysselct I_SYS_SELECT
13459 #ifdef I_SYS_SELECT
13460 #include <sys/select.h>
13461 #endif
13462 #$d_socket HAS_SOCKET
13463 #ifdef HAS_SOCKET
13464 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13465 #endif
13466 #include <stdio.h>
13467 $selecttype b;
13468 #define S sizeof(*(b))
13469 #define MINBITS 64
13470 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13471 #define NBITS  (NBYTES * 8)
13472 int main() {
13473     char s[NBYTES];
13474     struct timeval t;
13475     int i;
13476     FILE* fp;
13477     int fd;
13478
13479     fclose(stdin);
13480     fp = fopen("try.c", "r");
13481     if (fp == 0)
13482       exit(1);
13483     fd = fileno(fp);
13484     if (fd < 0)
13485       exit(2);
13486     b = ($selecttype)s;
13487     for (i = 0; i < NBITS; i++)
13488         FD_SET(i, b);
13489     t.tv_sec  = 0;
13490     t.tv_usec = 0;
13491     select(fd + 1, b, 0, 0, &t);
13492     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13493     printf("%d\n", i + 1);
13494     return 0;
13495 }
13496 EOCP
13497                 set try
13498                 if eval $compile_ok; then
13499                         selectminbits=`./try`
13500                         case "$selectminbits" in
13501                         '')     cat >&4 <<EOM
13502 Cannot figure out on how many bits at a time your select() operates.
13503 I'll play safe and guess it is 32 bits.
13504 EOM
13505                                 selectminbits=32
13506                                 bits="32 bits"
13507                                 ;;
13508                         1)      bits="1 bit" ;;
13509                         *)      bits="$selectminbits bits" ;;
13510                         esac
13511                         echo "Your select() operates on $bits at a time." >&4
13512                 else
13513                         rp='What is the minimum number of bits your select() operates on?'
13514                         case "$byteorder" in
13515                         1234|12345678)  dflt=32 ;;
13516                         *)              dflt=1  ;;
13517                         esac
13518                         . ./myread
13519                         val=$ans
13520                         selectminbits="$val"
13521                 fi
13522                 $rm -f try.* try
13523                 ;;
13524         *)      : no select, so pick a harmless default
13525                 selectminbits='32'
13526                 ;;
13527         esac
13528         ;;
13529 esac
13530
13531 : Trace out the files included by signal.h, then look for SIGxxx names.
13532 : Remove SIGARRAYSIZE used by HPUX.
13533 : Remove SIGSTKSIZE used by Linux.
13534 : Remove SIGSTKSZ used by Posix.
13535 : Remove SIGTYP void lines used by OS2.
13536 : Some cpps, like os390, dont give the file name anywhere
13537 if [ "X$fieldn" = X ]; then
13538         : Just make some guesses.  We check them later.
13539         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13540 else
13541         xxx=`echo '#include <signal.h>' |
13542         $cppstdin $cppminus $cppflags 2>/dev/null |
13543         $grep '^[       ]*#.*include' | 
13544         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13545 fi
13546 : Check this list of files to be sure we have parsed the cpp output ok.
13547 : This will also avoid potentially non-existent files, such 
13548 : as ../foo/bar.h
13549 xxxfiles=''
13550 for xx in $xxx /dev/null ; do
13551         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13552 done
13553 : If we have found no files, at least try signal.h
13554 case "$xxxfiles" in
13555 '')     xxxfiles=`./findhdr signal.h` ;;
13556 esac
13557 xxx=`awk '
13558 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13559         print substr($2, 4, 20)
13560 }
13561 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13562         print substr($3, 4, 20)
13563 }' $xxxfiles`
13564 : Append some common names just in case the awk scan failed.
13565 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13566 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13567 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13568 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13569 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13570
13571 : generate a few handy files for later
13572 $cat > signal.c <<'EOCP'
13573 #include <sys/types.h>
13574 #include <signal.h>
13575 #include <stdio.h>
13576 int main() {
13577
13578 /* Strange style to avoid deeply-nested #if/#else/#endif */
13579 #ifndef NSIG
13580 #  ifdef _NSIG
13581 #    define NSIG (_NSIG)
13582 #  endif
13583 #endif
13584
13585 #ifndef NSIG
13586 #  ifdef SIGMAX
13587 #    define NSIG (SIGMAX+1)
13588 #  endif
13589 #endif
13590
13591 #ifndef NSIG
13592 #  ifdef SIG_MAX
13593 #    define NSIG (SIG_MAX+1)
13594 #  endif
13595 #endif
13596
13597 #ifndef NSIG
13598 #  ifdef MAXSIG
13599 #    define NSIG (MAXSIG+1)
13600 #  endif
13601 #endif
13602
13603 #ifndef NSIG
13604 #  ifdef MAX_SIG
13605 #    define NSIG (MAX_SIG+1)
13606 #  endif
13607 #endif
13608
13609 #ifndef NSIG
13610 #  ifdef SIGARRAYSIZE
13611 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13612 #  endif
13613 #endif
13614
13615 #ifndef NSIG
13616 #  ifdef _sys_nsig
13617 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13618 #  endif
13619 #endif
13620
13621 /* Default to some arbitrary number that's big enough to get most
13622    of the common signals.
13623 */
13624 #ifndef NSIG
13625 #    define NSIG 50
13626 #endif
13627
13628 printf("NSIG %d\n", NSIG);
13629
13630 #ifndef JUST_NSIG
13631
13632 EOCP
13633
13634 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13635 {
13636         printf "#ifdef SIG"; printf $1; printf "\n"
13637         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13638         printf $1; printf ");\n"
13639         printf "#endif\n"
13640 }
13641 END {
13642         printf "#endif /* JUST_NSIG */\n";
13643         printf "exit(0);\n}\n";
13644 }
13645 ' >>signal.c
13646 $cat >signal.awk <<'EOP'
13647 BEGIN { ndups = 0 }
13648 $1 ~ /^NSIG$/ { nsig = $2 }
13649 ($1 !~ /^NSIG$/) && (NF == 2) {
13650     if ($2 > maxsig) { maxsig = $2 }
13651     if (sig_name[$2]) {
13652         dup_name[ndups] = $1
13653         dup_num[ndups] = $2
13654         ndups++ 
13655     }
13656     else {
13657         sig_name[$2] = $1
13658         sig_num[$2] = $2
13659     }
13660 }
13661 END { 
13662     if (nsig == 0) {
13663         nsig = maxsig + 1
13664     }
13665     printf("NSIG %d\n", nsig);
13666     for (n = 1; n < nsig; n++) {
13667         if (sig_name[n]) {
13668             printf("%s %d\n", sig_name[n], sig_num[n])
13669         }
13670         else {
13671             printf("NUM%d %d\n", n, n) 
13672         }
13673     }
13674     for (n = 0; n < ndups; n++) {
13675         printf("%s %d\n", dup_name[n], dup_num[n])
13676     }
13677 }
13678 EOP
13679 $cat >signal_cmd <<EOS
13680 $startsh
13681 if $test -s signal.lst; then
13682     echo "Using your existing signal.lst file"
13683         exit 0
13684 fi
13685 xxx="$xxx"
13686 EOS
13687 $cat >>signal_cmd <<'EOS'
13688
13689 set signal
13690 if eval $compile_ok; then
13691         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13692 else
13693         echo "(I can't seem be able to compile the whole test program)" >&4
13694         echo "(I'll try it in little pieces.)" >&4
13695         set signal -DJUST_NSIG
13696         if eval $compile_ok; then
13697                 ./signal$_exe > signal.nsg
13698                 $cat signal.nsg
13699         else
13700                 echo "I can't seem to figure out how many signals you have." >&4
13701                 echo "Guessing 50." >&4
13702                 echo 'NSIG 50' > signal.nsg
13703         fi
13704         : Now look at all the signal names, one at a time.
13705         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13706                 $cat > signal.c <<EOCP
13707 #include <sys/types.h>
13708 #include <signal.h>
13709 #include <stdio.h>
13710 int main() {
13711 printf("$xx %d\n", SIG${xx});
13712 return 0;
13713 }
13714 EOCP
13715                 set signal
13716                 if eval $compile; then
13717                         echo "SIG${xx} found."
13718                         ./signal$_exe  >> signal.ls1
13719                 else
13720                         echo "SIG${xx} NOT found."
13721                 fi
13722         done
13723         if $test -s signal.ls1; then
13724                 $cat signal.nsg signal.ls1 |
13725                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13726         fi
13727
13728 fi
13729 if $test -s signal.lst; then
13730         :
13731 else
13732         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13733         echo 'kill -l' >signal
13734         set X `csh -f <signal`
13735         $rm -f signal
13736         shift
13737         case $# in
13738         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13739         esac
13740         echo $@ | $tr ' ' $trnl | \
13741             $awk '{ printf "%s %d\n", $1, ++s; }
13742                   END { printf "NSIG %d\n", ++s }' >signal.lst
13743 fi
13744 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13745 EOS
13746 chmod a+x signal_cmd
13747 $eunicefix signal_cmd
13748
13749 : generate list of signal names
13750 echo " "
13751 case "$sig_name_init" in
13752 '') doinit=yes ;;
13753 *)  case "$sig_num_init" in
13754     ''|*,*) doinit=yes ;;
13755     esac ;;
13756 esac
13757 case "$doinit" in
13758 yes)
13759         echo "Generating a list of signal names and numbers..." >&4
13760         . ./signal_cmd
13761         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13762         sig_name=`$awk 'BEGIN { printf "ZERO " }
13763                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13764         sig_num=`$awk  'BEGIN { printf "0 " }
13765                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13766         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13767                              !/^NSIG/   { printf "\"%s\", ", $1 }
13768                              END        { printf "0\n" }' signal.lst`
13769         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13770                              !/^NSIG/   { printf "%d, ", $2}
13771                              END        { printf "0\n"}' signal.lst`
13772         ;;
13773 esac
13774 echo "The following $sig_count signals are available:"
13775 echo " "
13776 echo $sig_name | $awk \
13777 'BEGIN { linelen = 0 }
13778 {
13779         for (i = 1; i <= NF; i++) {
13780                 name = "SIG" $i " "
13781                 linelen = linelen + length(name)
13782                 if (linelen > 70) {
13783                         printf "\n"
13784                         linelen = length(name)
13785                 }
13786                 printf "%s", name
13787         }
13788         printf "\n"
13789 }'
13790 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13791
13792 echo " "
13793 case "$sizetype" in
13794 *_t) zzz="$sizetype"    ;;
13795 *)   zzz="filesize"     ;;
13796 esac
13797 echo "Checking the size of $zzz..." >&4 
13798 cat > try.c <<EOCP
13799 #include <sys/types.h>
13800 #include <stdio.h>
13801 int main() {
13802     printf("%d\n", (int)sizeof($sizetype));
13803     exit(0);
13804 }
13805 EOCP
13806 set try
13807 if eval $compile_ok; then
13808         yyy=`./try`
13809         case "$yyy" in
13810         '')     sizesize=4
13811                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13812                 ;;
13813         *)      sizesize=$yyy
13814                 echo "Your $zzz size is $sizesize bytes."
13815                 ;;
13816         esac
13817 else
13818         sizesize=4
13819         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13820 fi
13821
13822
13823 : check for socklen_t
13824 echo " "
13825 echo "Checking to see if you have socklen_t..." >&4
13826 $cat >try.c <<EOCP
13827 #include <sys/types.h>
13828 #$d_socket HAS_SOCKET
13829 #ifdef HAS_SOCKET
13830 #include <sys/socket.h>
13831 #endif
13832 int main() { socklen_t x = 16; }
13833 EOCP
13834 set try
13835 if eval $compile; then
13836         val="$define"
13837         echo "You have socklen_t."
13838 else
13839         val="$undef"
13840         echo "You do not have socklen_t."
13841         case "$sizetype" in
13842         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13843         esac
13844 fi
13845 $rm -f try try.*
13846 set d_socklen_t
13847 eval $setvar
13848
13849 : check for type of the size argument to socket calls
13850 case "$d_socket" in
13851 "$define")
13852         $cat <<EOM
13853
13854 Checking to see what type is the last argument of accept().
13855 EOM
13856         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13857         yyy=''
13858         case "$d_socklen_t" in
13859         "$define") yyy="$yyy socklen_t"
13860         esac
13861         yyy="$yyy $sizetype int long"
13862         for xxx in $yyy; do
13863                 case "$socksizetype" in
13864                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13865                         if ./protochk "$try" $hdrs; then
13866                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13867                                 socksizetype="$xxx"
13868                         fi
13869                         ;;
13870                 esac
13871         done
13872 : In case none of those worked, prompt the user.
13873         case "$socksizetype" in
13874         '')     rp='What is the type for socket address structure sizes?'
13875                 dflt='int'
13876                 . ./myread
13877                 socksizetype=$ans
13878                 ;;
13879         esac
13880         ;;
13881 *)      : no sockets, so pick relatively harmless defaults
13882         socksizetype='char *'
13883         ;;
13884 esac
13885
13886 : see what type is used for signed size_t
13887 set ssize_t ssizetype int stdio.h sys/types.h
13888 eval $typedef
13889 dflt="$ssizetype"
13890 $cat > ssize.c <<EOM
13891 #include <stdio.h>
13892 #include <sys/types.h>
13893 #define Size_t $sizetype
13894 #define SSize_t $dflt
13895 int main()
13896 {
13897         if (sizeof(Size_t) == sizeof(SSize_t))
13898                 printf("$dflt\n");
13899         else if (sizeof(Size_t) == sizeof(int))
13900                 printf("int\n");
13901         else 
13902                 printf("long\n");
13903         exit(0);
13904 }
13905 EOM
13906 echo " "
13907 set ssize
13908 if eval $compile_ok && ./ssize > /dev/null; then
13909         ssizetype=`./ssize`
13910         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13911 else
13912         $cat >&4 <<EOM
13913 Help! I can't compile and run the ssize_t test program: please enlighten me!
13914 (This is probably a misconfiguration in your system or libraries, and
13915 you really ought to fix it.  Still, I'll try anyway.)
13916
13917 I need a type that is the same size as $sizetype, but is guaranteed to
13918 be signed.  Common values are ssize_t, int and long.
13919
13920 EOM
13921         rp="What signed type is the same size as $sizetype?"
13922         . ./myread
13923         ssizetype="$ans"
13924 fi
13925 $rm -f ssize ssize.*
13926
13927 : see what type of char stdio uses.
13928 echo " "
13929 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13930         echo "Your stdio uses unsigned chars." >&4
13931         stdchar="unsigned char"
13932 else
13933         echo "Your stdio uses signed chars." >&4
13934         stdchar="char"
13935 fi
13936
13937 : see if time exists
13938 echo " "
13939 if test "X$d_time" = X -o X"$timetype" = X; then
13940     if set time val -f d_time; eval $csym; $val; then
13941                 echo 'time() found.' >&4
13942                 val="$define"
13943                 rp="What is the type returned by time() on this system?"
13944                 set time_t timetype long stdio.h sys/types.h
13945                 eval $typedef_ask
13946     else
13947                 echo 'time() not found, hope that will do.' >&4
13948                 val="$undef"
13949                 timetype='int';
13950     fi
13951     set d_time
13952     eval $setvar
13953 fi
13954
13955 : see what type uids are declared as in the kernel
13956 echo " "
13957 echo "Looking for the type for user ids returned by getuid()."
13958 set uid_t uidtype xxx stdio.h sys/types.h
13959 eval $typedef
13960 case "$uidtype" in
13961 xxx)
13962         xxx=`./findhdr sys/user.h`
13963         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13964         case $1 in
13965         unsigned) dflt="$1 $2" ;;
13966         *) dflt="$1" ;;
13967         esac
13968         ;;
13969 *) dflt="$uidtype";;
13970 esac
13971 case "$uidtype" in
13972 uid_t)  echo "uid_t found." ;;
13973 *)      rp="What is the type for user ids returned by getuid()?"
13974         . ./myread
13975         uidtype="$ans"
13976         ;;
13977 esac
13978
13979 echo " "
13980 case "$uidtype" in
13981 *_t) zzz="$uidtype"     ;;
13982 *)   zzz="uid"          ;;
13983 esac
13984 echo "Checking the size of $zzz..." >&4 
13985 cat > try.c <<EOCP
13986 #include <sys/types.h>
13987 #include <stdio.h>
13988 int main() {
13989     printf("%d\n", (int)sizeof($uidtype));
13990     exit(0);
13991 }
13992 EOCP
13993 set try
13994 if eval $compile_ok; then
13995         yyy=`./try`
13996         case "$yyy" in
13997         '')     uidsize=4
13998                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13999                 ;;
14000         *)      uidsize=$yyy
14001                 echo "Your $zzz is $uidsize bytes long."
14002                 ;;
14003         esac
14004 else
14005         uidsize=4
14006         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14007 fi
14008
14009 echo " "
14010 case "$uidtype" in
14011 *_t) zzz="$uidtype"     ;;
14012 *)   zzz="uid"          ;;
14013 esac
14014 echo "Checking the sign of $zzz..." >&4
14015 cat > try.c <<EOCP
14016 #include <sys/types.h>
14017 #include <stdio.h>
14018 int main() {
14019         $uidtype foo = -1;
14020         if (foo < 0)
14021                 printf("-1\n");
14022         else
14023                 printf("1\n");
14024 }
14025 EOCP
14026 set try
14027 if eval $compile; then
14028         yyy=`./try`
14029         case "$yyy" in
14030         '')     uidsign=1
14031                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14032                 ;;
14033         *)      uidsign=$yyy
14034                 case "$uidsign" in
14035                  1) echo "Your $zzz is unsigned." ;;
14036                 -1) echo "Your $zzz is signed."   ;;
14037                 esac
14038                 ;;
14039         esac
14040 else
14041         uidsign=1
14042         echo "(I can't compile the test program--guessing unsigned.)" >&4
14043 fi
14044
14045
14046
14047 echo " "
14048 $echo "Checking the format string to be used for uids..." >&4
14049
14050 case "$uidsign" in
14051 -1)     if $test X"$uidsize" = X"$ivsize"; then
14052                 uidformat="$ivdformat"
14053         else
14054                 if $test X"$uidsize" = X"$longsize"; then
14055                         uidformat='"ld"'
14056                 else
14057                         if $test X"$uidsize" = X"$intsize"; then
14058                                 uidformat='"d"'
14059                         else
14060                                 if $test X"$uidsize" = X"$shortsize"; then
14061                                         uidformat='"hd"'
14062                                 fi
14063                         fi
14064                 fi
14065         fi
14066         ;;
14067 *)      if $test X"$uidsize" = X"$uvsize"; then
14068                 uidformat="$uvuformat"
14069         else
14070                 if $test X"$uidsize" = X"$longsize"; then
14071                         uidformat='"lu"'
14072                 else
14073                         if $test X"$uidsize" = X"$intsize"; then
14074                                 uidformat='"u"'
14075                         else
14076                                 if $test X"$uidsize" = X"$shortsize"; then
14077                                         uidformat='"hu"'
14078                                 fi
14079                         fi
14080                 fi
14081         fi
14082         ;;
14083 esac
14084
14085 : see if dbm.h is available
14086 : see if dbmclose exists
14087 set dbmclose d_dbmclose
14088 eval $inlibc
14089
14090 case "$d_dbmclose" in
14091 $define)
14092         set dbm.h i_dbm
14093         eval $inhdr
14094         case "$i_dbm" in
14095         $define)
14096                 val="$undef"
14097                 set i_rpcsvcdbm
14098                 eval $setvar
14099                 ;;
14100         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14101                 eval $inhdr
14102                 ;;
14103         esac
14104         ;;
14105 *)      echo "We won't be including <dbm.h>"
14106         val="$undef"
14107         set i_dbm
14108         eval $setvar
14109         val="$undef"
14110         set i_rpcsvcdbm
14111         eval $setvar
14112         ;;
14113 esac
14114
14115 : see if this is a sys/file.h system
14116 val=''
14117 set sys/file.h val
14118 eval $inhdr
14119
14120 : do we need to include sys/file.h ?
14121 case "$val" in
14122 "$define")
14123         echo " "
14124         if $h_sysfile; then
14125                 val="$define"
14126                 echo "We'll be including <sys/file.h>." >&4
14127         else
14128                 val="$undef"
14129                 echo "We won't be including <sys/file.h>." >&4
14130         fi
14131         ;;
14132 *)
14133         h_sysfile=false
14134         ;;
14135 esac
14136 set i_sysfile
14137 eval $setvar
14138
14139 : see if fcntl.h is there
14140 val=''
14141 set fcntl.h val
14142 eval $inhdr
14143
14144 : see if we can include fcntl.h
14145 case "$val" in
14146 "$define")
14147         echo " "
14148         if $h_fcntl; then
14149                 val="$define"
14150                 echo "We'll be including <fcntl.h>." >&4
14151         else
14152                 val="$undef"
14153                 if $h_sysfile; then
14154         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14155                 else
14156                         echo "We won't be including <fcntl.h>." >&4
14157                 fi
14158         fi
14159         ;;
14160 *)
14161         h_fcntl=false
14162         val="$undef"
14163         ;;
14164 esac
14165 set i_fcntl
14166 eval $setvar
14167
14168 : see if this is a iconv.h system
14169 set iconv.h i_iconv
14170 eval $inhdr
14171
14172 : see if this is a ieeefp.h system
14173 set ieeefp.h i_ieeefp
14174 eval $inhdr
14175
14176 : see if locale.h is available
14177 set locale.h i_locale
14178 eval $inhdr
14179
14180 : see if mach cthreads are available
14181 if test "X$usethreads" = "X$define"; then
14182         set mach/cthreads.h i_machcthr
14183         eval $inhdr
14184 else
14185         i_machcthr="$undef"
14186 fi
14187
14188
14189
14190 : see if this is a math.h system
14191 set math.h i_math
14192 eval $inhdr
14193
14194 : see if this is a mntent.h system
14195 set mntent.h i_mntent
14196 eval $inhdr
14197
14198 : see if ndbm.h is available
14199 set ndbm.h t_ndbm
14200 eval $inhdr
14201 case "$t_ndbm" in
14202 $define)
14203         : see if dbm_open exists
14204         set dbm_open d_dbm_open
14205         eval $inlibc
14206         case "$d_dbm_open" in
14207         $undef)
14208                 t_ndbm="$undef"
14209                 echo "We won't be including <ndbm.h>"
14210                 ;;
14211         esac
14212         ;;
14213 esac
14214 val="$t_ndbm"
14215 set i_ndbm
14216 eval $setvar
14217
14218 : see if net/errno.h is available
14219 val=''
14220 set net/errno.h val
14221 eval $inhdr
14222
14223 : Unfortunately, it causes problems on some systems.  Arrgh.
14224 case "$val" in
14225 $define)
14226         cat > try.c <<'EOM'
14227 #include <stdio.h>
14228 #include <errno.h>
14229 #include <net/errno.h>
14230 int func()
14231 {
14232         return ENOTSOCK;
14233 }
14234 EOM
14235         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14236                 echo "We'll be including <net/errno.h>." >&4
14237         else
14238                 echo "We won't be including <net/errno.h>." >&4
14239                 val="$undef"
14240         fi
14241         $rm -f try.* try
14242         ;;
14243 esac
14244 set i_neterrno
14245 eval $setvar
14246
14247 : see if netinet/tcp.h is available
14248 set netinet/tcp.h i_netinettcp
14249 eval $inhdr
14250
14251 : see if this is a poll.h system
14252 set poll.h i_poll
14253 eval $inhdr
14254
14255 echo " "
14256 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14257 $cat <<'EOSH' > Cppsym.know
14258 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14259 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14260 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14261 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14262 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14263 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14264 bull c cadmus clipper CMU COFF COMPILER_VERSION
14265 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14266 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14267 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14268 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14269 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14270 H3050R H3050RX hbullx20 hcx host_mips
14271 hp200 hp300 hp700 HP700 hp800 hp9000
14272 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14273 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14274 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14275 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14276 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14277 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14278 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14279 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14280 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14281 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14282 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14283 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14284 MATH_HAS_NO_SIDE_EFFECTS
14285 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14286 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14287 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14288 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14289 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14290 NetBSD news1500 news1700 news1800 news1900 news3700
14291 news700 news800 news900 NeXT NLS ns16000 ns32000
14292 ns32016 ns32332 ns32k nsc32000
14293 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14294 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14295 pc532 pdp11 PGC PIC plexus PORTAR posix
14296 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14297 POSIX_C_SOURCE POSIX_SOURCE POWER
14298 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14299 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14300 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14301 sony sony_news sonyrisc sparc sparclite spectrum
14302 stardent stdc STDC_EXT stratos sun sun3 sun386
14303 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14304 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14305 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14306 sysV68 sysV88 Tek4132 Tek4300 titan
14307 tower tower32 tower32_200 tower32_600 tower32_700
14308 tower32_800 tower32_850 tss
14309 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14310 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14311 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14312 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14313 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14314 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14315 z8000
14316 EOSH
14317 # Maybe put other stuff here too.
14318 cat <<EOSH >>Cppsym.know
14319 $osname
14320 EOSH
14321 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14322 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14323 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14324 $rm -f Cppsym.a Cppsym.b
14325 cat <<EOSH > Cppsym
14326 $startsh
14327 if $test \$# -gt 0; then
14328     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14329     if $test -s Cppsym.got; then
14330         $rm -f Cppsym.got
14331         exit 0
14332     fi
14333     $rm -f Cppsym.got
14334     exit 1
14335 else
14336     $tr " " "$trnl" | ./Cppsym.try
14337     exit 0
14338 fi
14339 EOSH
14340 chmod +x Cppsym
14341 $eunicefix Cppsym
14342 cat <<EOSH > Cppsym.try
14343 $startsh
14344 cat <<'EOCP' > try.c
14345 #include <stdio.h>
14346 int main() {
14347 EOCP
14348 $awk \\
14349 EOSH
14350 cat <<'EOSH' >> Cppsym.try
14351 'length($1) > 0 {
14352     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
14353     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
14354     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
14355     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
14356 }'       >> try.c
14357 echo '}' >> try.c
14358 EOSH
14359 cat <<EOSH >> Cppsym.try
14360 ccflags="$ccflags"
14361 case "$osname-$gccversion" in
14362 irix-) ccflags="\$ccflags -woff 1178" ;;
14363 esac
14364 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14365 EOSH
14366 chmod +x Cppsym.try
14367 $eunicefix Cppsym.try
14368 ./Cppsym < Cppsym.know > Cppsym.true
14369 : now check the C compiler for additional symbols
14370 postprocess_cc_v=''
14371 case "$osname" in
14372 aix) postprocess_cc_v="|$tr , ' '" ;;
14373 esac
14374 $cat >ccsym <<EOS
14375 $startsh
14376 $cat >tmp.c <<EOF
14377 extern int foo;
14378 EOF
14379 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14380 do
14381         case "\$i" in
14382         -D*) echo "\$i" | $sed 's/^-D//';;
14383         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14384         esac
14385 done
14386 $rm -f try.c
14387 EOS
14388 postprocess_cc_v=''
14389 chmod +x ccsym
14390 $eunicefix ccsym
14391 ./ccsym > ccsym1.raw
14392 if $test -s ccsym1.raw; then
14393        $sort ccsym1.raw | $uniq >ccsym.raw
14394 else
14395        mv ccsym1.raw ccsym.raw
14396 fi
14397
14398 $awk '/\=/ { print $0; next }
14399         { print $0"=1" }' ccsym.raw >ccsym.list
14400 $awk '/\=/ { print $0; next }
14401         { print $0"=1" }' Cppsym.true >ccsym.true
14402 $comm -13 ccsym.true ccsym.list >ccsym.own
14403 $comm -12 ccsym.true ccsym.list >ccsym.com
14404 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14405 also=''
14406 if $test -z ccsym.raw; then
14407         echo "Your C compiler doesn't seem to define any symbols!" >&4
14408         echo " "
14409         echo "However, your C preprocessor defines the following symbols:"
14410         $cat Cppsym.true
14411         ccsymbols=''
14412         cppsymbols=`$cat Cppsym.true`
14413         cppsymbols=`echo $cppsymbols`
14414         cppccsymbols="$cppsymbols"
14415 else
14416         if $test -s ccsym.com; then
14417                 echo "Your C compiler and pre-processor define these symbols:"
14418                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14419                 also='also '
14420                 symbols='ones'
14421                 cppccsymbols=`$cat ccsym.com`
14422                 cppccsymbols=`echo $cppccsymbols`
14423                 $test "$silent" || sleep 1
14424         fi
14425         if $test -s ccsym.cpp; then
14426                 $test "$also" && echo " "
14427                 echo "Your C pre-processor ${also}defines the following symbols:"
14428                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14429                 also='further '
14430                 cppsymbols=`$cat ccsym.cpp`
14431                 cppsymbols=`echo $cppsymbols`
14432                 $test "$silent" || sleep 1
14433         fi
14434         if $test -s ccsym.own; then
14435                 $test "$also" && echo " "
14436                 echo "Your C compiler ${also}defines the following cpp symbols:"
14437                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14438                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14439                 ccsymbols=`$cat ccsym.own`
14440                 ccsymbols=`echo $ccsymbols`
14441                 $test "$silent" || sleep 1
14442         fi
14443 fi
14444 $rm -f ccsym*
14445
14446 : see if this is a termio system
14447 val="$undef"
14448 val2="$undef"
14449 val3="$undef"
14450 if $test `./findhdr termios.h`; then
14451         set tcsetattr i_termios
14452         eval $inlibc
14453         val3="$i_termios"
14454 fi
14455 echo " "
14456 case "$val3" in
14457 "$define") echo "You have POSIX termios.h... good!" >&4;;
14458 *) if ./Cppsym pyr; then
14459                 case "`/bin/universe`" in
14460                 ucb) if $test `./findhdr sgtty.h`; then
14461                                 val2="$define"
14462                                 echo "<sgtty.h> found." >&4
14463                         else
14464                                 echo "System is pyramid with BSD universe."
14465                                 echo "<sgtty.h> not found--you could have problems." >&4
14466                         fi;;
14467                 *) if $test `./findhdr termio.h`; then
14468                                 val="$define"
14469                                 echo "<termio.h> found." >&4
14470                         else
14471                                 echo "System is pyramid with USG universe."
14472                                 echo "<termio.h> not found--you could have problems." >&4
14473                         fi;;
14474                 esac
14475         elif ./usg; then
14476                 if $test `./findhdr termio.h`; then
14477                         echo "<termio.h> found." >&4
14478                         val="$define"
14479                 elif $test `./findhdr sgtty.h`; then
14480                         echo "<sgtty.h> found." >&4
14481                         val2="$define"
14482                 else
14483 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14484                 fi
14485         else
14486                 if $test `./findhdr sgtty.h`; then
14487                         echo "<sgtty.h> found." >&4
14488                         val2="$define"
14489                 elif $test `./findhdr termio.h`; then
14490                         echo "<termio.h> found." >&4
14491                         val="$define"
14492                 else
14493 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14494                 fi
14495         fi;;
14496 esac
14497 set i_termio; eval $setvar
14498 val=$val2; set i_sgtty; eval $setvar
14499 val=$val3; set i_termios; eval $setvar
14500
14501 : see if this is a shadow.h system
14502 set shadow.h i_shadow
14503 eval $inhdr
14504
14505 : see if this is a socks.h system
14506 set socks.h i_socks
14507 eval $inhdr
14508
14509 : see if stdarg is available
14510 echo " "
14511 if $test `./findhdr stdarg.h`; then
14512         echo "<stdarg.h> found." >&4
14513         valstd="$define"
14514 else
14515         echo "<stdarg.h> NOT found." >&4
14516         valstd="$undef"
14517 fi
14518
14519 : see if varags is available
14520 echo " "
14521 if $test `./findhdr varargs.h`; then
14522         echo "<varargs.h> found." >&4
14523 else
14524         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14525 fi
14526
14527 : set up the varargs testing programs
14528 $cat > varargs.c <<EOP
14529 #ifdef I_STDARG
14530 #include <stdarg.h>
14531 #endif
14532 #ifdef I_VARARGS
14533 #include <varargs.h>
14534 #endif
14535
14536 #ifdef I_STDARG
14537 int f(char *p, ...)
14538 #else
14539 int f(va_alist)
14540 va_dcl
14541 #endif
14542 {
14543         va_list ap;
14544 #ifndef I_STDARG
14545         char *p;
14546 #endif
14547 #ifdef I_STDARG
14548         va_start(ap,p);
14549 #else
14550         va_start(ap);
14551         p = va_arg(ap, char *);
14552 #endif
14553         va_end(ap);
14554 }
14555 EOP
14556 $cat > varargs <<EOP
14557 $startsh
14558 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14559         echo "true"
14560 else
14561         echo "false"
14562 fi
14563 $rm -f varargs$_o
14564 EOP
14565 chmod +x varargs
14566
14567 : now check which varargs header should be included
14568 echo " "
14569 i_varhdr=''
14570 case "$valstd" in
14571 "$define")
14572         if `./varargs I_STDARG`; then
14573                 val='stdarg.h'
14574         elif `./varargs I_VARARGS`; then
14575                 val='varargs.h'
14576         fi
14577         ;;
14578 *)
14579         if `./varargs I_VARARGS`; then
14580                 val='varargs.h'
14581         fi
14582         ;;
14583 esac
14584 case "$val" in
14585 '')
14586 echo "I could not find the definition for va_dcl... You have problems..." >&4
14587         val="$undef"; set i_stdarg; eval $setvar
14588         val="$undef"; set i_varargs; eval $setvar
14589         ;;
14590 *) 
14591         set i_varhdr
14592         eval $setvar
14593         case "$i_varhdr" in
14594         stdarg.h)
14595                 val="$define"; set i_stdarg; eval $setvar
14596                 val="$undef"; set i_varargs; eval $setvar
14597                 ;;
14598         varargs.h)
14599                 val="$undef"; set i_stdarg; eval $setvar
14600                 val="$define"; set i_varargs; eval $setvar
14601                 ;;
14602         esac
14603         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14604 esac
14605 $rm -f varargs*
14606
14607 : see if stddef is available
14608 set stddef.h i_stddef
14609 eval $inhdr
14610
14611 : see if this is a sunmath.h system
14612 set sunmath.h i_sunmath
14613 eval $inhdr
14614
14615 : see if sys/access.h is available
14616 set sys/access.h i_sysaccess
14617 eval $inhdr
14618
14619 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14620 set sys/filio.h i_sysfilio
14621 eval $inhdr
14622 echo " "
14623 if $test `./findhdr sys/ioctl.h`; then
14624         val="$define"
14625         echo '<sys/ioctl.h> found.' >&4
14626 else
14627         val="$undef"
14628         if $test $i_sysfilio = "$define"; then
14629             echo '<sys/ioctl.h> NOT found.' >&4
14630         else
14631                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14632                 $test $i_termio = "$define" && xxx="termio.h"
14633                 $test $i_termios = "$define" && xxx="termios.h"
14634 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14635         fi
14636 fi
14637 set i_sysioctl
14638 eval $setvar
14639
14640
14641 : see if this is a syslog.h system
14642 set syslog.h i_syslog
14643 eval $inhdr
14644
14645
14646 : see if this is a sys/mode.h system
14647 set sys/mode.h i_sysmode
14648 eval $inhdr
14649
14650 : see if sys/resource.h has to be included
14651 set sys/resource.h i_sysresrc
14652 eval $inhdr
14653
14654 : see if sys/security.h is available
14655 set sys/security.h i_syssecrt
14656 eval $inhdr
14657
14658 : see if this is a sys/statvfs.h system
14659 set sys/statvfs.h i_sysstatvfs
14660 eval $inhdr
14661
14662 : see if this is a sys/uio.h system
14663 set sys/uio.h i_sysuio
14664 eval $inhdr
14665
14666 : see if this is a sys/un.h system
14667 set sys/un.h i_sysun
14668 eval $inhdr
14669
14670
14671 : see if this is a sys/utsname.h system
14672 set sys/utsname.h i_sysutsname
14673 eval $inhdr
14674
14675 : see if this is a syswait system
14676 set sys/wait.h i_syswait
14677 eval $inhdr
14678
14679 : see if this is a ustat.h system
14680 set ustat.h i_ustat
14681 eval $inhdr
14682
14683 : see if this is an utime system
14684 set utime.h i_utime
14685 eval $inhdr
14686
14687 : see if this is a values.h system
14688 set values.h i_values
14689 eval $inhdr
14690
14691 : see if this is a vfork system
14692 case "$d_vfork" in
14693 "$define")
14694         set vfork.h i_vfork
14695         eval $inhdr
14696         ;;
14697 *)
14698         i_vfork="$undef"
14699         ;;
14700 esac
14701
14702 : see if gdbm.h is available
14703 set gdbm.h t_gdbm
14704 eval $inhdr
14705 case "$t_gdbm" in
14706 $define)
14707         : see if gdbm_open exists
14708         set gdbm_open d_gdbm_open
14709         eval $inlibc
14710         case "$d_gdbm_open" in
14711         $undef)
14712                 t_gdbm="$undef"
14713                 echo "We won't be including <gdbm.h>"
14714                 ;;
14715         esac
14716         ;;
14717 esac
14718 val="$t_gdbm"
14719 set i_gdbm
14720 eval $setvar
14721
14722 echo " "
14723 echo "Looking for extensions..." >&4
14724 : If we are using the old config.sh, known_extensions may contain
14725 : old or inaccurate or duplicate values.
14726 known_extensions=''
14727 nonxs_extensions=''
14728 : We do not use find because it might not be available.
14729 : We do not just use MANIFEST because the user may have dropped
14730 : some additional extensions into the source tree and expect them
14731 : to be built.
14732
14733 : Function to recursively find available extensions, ignoring DynaLoader
14734 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14735 find_extensions='
14736     for xxx in *; do
14737        case "$xxx" in
14738            DynaLoader|dynaload) ;;
14739            *)
14740            if $test -f $xxx/$xxx.xs; then
14741                known_extensions="$known_extensions $1$xxx";
14742            elif $test -f $xxx/Makefile.PL; then
14743                nonxs_extensions="$nonxs_extensions $1$xxx";
14744            else
14745                if $test -d $xxx -a $# -lt 10; then
14746                    set $1$xxx/ $*;
14747                    cd $xxx;
14748                    eval $find_extensions;
14749                    cd ..;
14750                    shift;
14751                fi;
14752            fi
14753            ;;
14754        esac;
14755     done'
14756 tdir=`pwd`
14757 cd $rsrc/ext
14758 set X
14759 shift
14760 eval $find_extensions
14761 set X $nonxs_extensions
14762 shift
14763 nonxs_extensions="$*"
14764 set X $known_extensions
14765 shift
14766 known_extensions="$*"
14767 cd $tdir
14768
14769 : Now see which are supported on this system.
14770 avail_ext=''
14771 for xxx in $known_extensions ; do
14772         case "$xxx" in
14773         DB_File|db_file)
14774                 case "$i_db" in
14775                 $define) avail_ext="$avail_ext $xxx" ;;
14776                 esac
14777                 ;;
14778         GDBM_File|gdbm_fil)
14779                 case "$i_gdbm" in 
14780                 $define) avail_ext="$avail_ext $xxx" ;;
14781                 esac
14782                 ;;
14783         NDBM_File|ndbm_fil)
14784                 case "$i_ndbm" in
14785                 $define)
14786                     case "$osname-$use64bitint" in
14787                     hpux-define)
14788                         case "$libs" in
14789                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14790                         esac
14791                         ;;
14792                     *) avail_ext="$avail_ext $xxx" ;;
14793                     esac
14794                     ;;
14795                 esac
14796                 ;;
14797         ODBM_File|odbm_fil) 
14798                 case "${i_dbm}${i_rpcsvcdbm}" in
14799                 *"${define}"*)
14800                     case "$osname-$use64bitint" in
14801                     hpux-define)
14802                         case "$libs" in
14803                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14804                         esac
14805                         ;;
14806                     *) avail_ext="$avail_ext $xxx" ;;
14807                     esac
14808                     ;;
14809                 esac
14810                 ;;
14811         POSIX|posix)
14812                 case "$useposix" in
14813                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14814                 esac
14815                 ;;
14816         Opcode|opcode)
14817                 case "$useopcode" in
14818                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14819                 esac
14820                 ;;
14821         Socket|socket)
14822                 case "$d_socket" in 
14823                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14824                 esac
14825                 ;;
14826         Thread|thread)
14827                 case "$usethreads" in 
14828                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14829                 esac
14830                 ;;
14831         IPC/SysV|ipc/sysv)
14832                 : XXX Do we need a useipcsysv variable here
14833                 case "${d_msg}${d_sem}${d_shm}" in 
14834                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14835                 esac
14836                 ;;
14837         *)      avail_ext="$avail_ext $xxx"
14838                 ;;
14839         esac
14840 done
14841
14842 set X $avail_ext
14843 shift
14844 avail_ext="$*"
14845
14846 : Now see which nonxs extensions are supported on this system.
14847 : For now assume all are.
14848 nonxs_ext=''
14849 for xxx in $nonxs_extensions ; do
14850         case "$xxx" in
14851         *)      nonxs_ext="$nonxs_ext $xxx"
14852                 ;;
14853         esac
14854 done
14855
14856 set X $nonxs_ext
14857 shift
14858 nonxs_ext="$*"
14859
14860 case $usedl in
14861 $define)
14862         $cat <<EOM
14863 A number of extensions are supplied with $package.  You may choose to
14864 compile these extensions for dynamic loading (the default), compile
14865 them into the $package executable (static loading), or not include
14866 them at all.  Answer "none" to include no extensions.
14867 Note that DynaLoader is always built and need not be mentioned here.
14868
14869 EOM
14870         case "$dynamic_ext" in
14871         '') dflt="$avail_ext" ;;
14872         *)      dflt="$dynamic_ext"
14873                 # Perhaps we are reusing an old out-of-date config.sh.
14874                 case "$hint" in
14875                 previous)
14876                         if test X"$dynamic_ext" != X"$avail_ext"; then
14877                                 $cat <<EOM
14878 NOTICE:  Your previous config.sh list may be incorrect. 
14879 The extensions now available to you are 
14880         ${avail_ext}
14881 but the default list from your previous config.sh is
14882         ${dynamic_ext} 
14883
14884 EOM
14885                         fi
14886                         ;;
14887                 esac
14888                 ;;
14889         esac
14890         case "$dflt" in
14891         '')     dflt=none;;
14892         esac
14893         rp="What extensions do you wish to load dynamically?"
14894         . ./myread
14895         case "$ans" in
14896         none) dynamic_ext=' ' ;;
14897         *) dynamic_ext="$ans" ;;
14898         esac
14899
14900         case "$static_ext" in
14901         '')
14902                 : Exclude those already listed in dynamic linking
14903                 dflt=''
14904                 for xxx in $avail_ext; do
14905                         case " $dynamic_ext " in
14906                         *" $xxx "*) ;;
14907                         *) dflt="$dflt $xxx" ;;
14908                         esac
14909                 done
14910                 set X $dflt
14911                 shift
14912                 dflt="$*"
14913                 ;;
14914         *)  dflt="$static_ext" 
14915                 ;;
14916         esac
14917
14918         case "$dflt" in
14919         '')     dflt=none;;
14920         esac
14921         rp="What extensions do you wish to load statically?"
14922         . ./myread
14923         case "$ans" in
14924         none) static_ext=' ' ;;
14925         *) static_ext="$ans" ;;
14926         esac
14927         ;;
14928 *)
14929         $cat <<EOM
14930 A number of extensions are supplied with $package.  Answer "none" 
14931 to include no extensions. 
14932 Note that DynaLoader is always built and need not be mentioned here.
14933
14934 EOM
14935         case "$static_ext" in
14936         '') dflt="$avail_ext" ;;
14937         *)      dflt="$static_ext"
14938                 # Perhaps we are reusing an old out-of-date config.sh.
14939                 case "$hint" in
14940                 previous)
14941                         if test X"$static_ext" != X"$avail_ext"; then
14942                                 $cat <<EOM
14943 NOTICE:  Your previous config.sh list may be incorrect. 
14944 The extensions now available to you are 
14945         ${avail_ext}
14946 but the default list from your previous config.sh is
14947         ${static_ext} 
14948
14949 EOM
14950                         fi
14951                         ;;
14952                 esac
14953                 ;;
14954         esac
14955         : Exclude those that are not xs extensions
14956         case "$dflt" in
14957         '')     dflt=none;;
14958         esac
14959         rp="What extensions do you wish to include?"
14960         . ./myread
14961         case "$ans" in
14962         none) static_ext=' ' ;;
14963         *) static_ext="$ans" ;;
14964         esac
14965         ;;
14966 esac
14967
14968 set X $dynamic_ext $static_ext $nonxs_ext
14969 shift
14970 extensions="$*"
14971
14972 : Remove build directory name from cppstdin so it can be used from
14973 : either the present location or the final installed location.
14974 echo " "
14975 : Get out of the UU directory to get correct path name.
14976 cd ..
14977 case "$cppstdin" in
14978 `pwd`/cppstdin)
14979         echo "Stripping down cppstdin path name"
14980         cppstdin=cppstdin
14981         ;;
14982 esac
14983 cd UU
14984
14985 : end of configuration questions
14986 echo " "
14987 echo "End of configuration questions."
14988 echo " "
14989
14990 : back to where it started
14991 if test -d ../UU; then
14992         cd ..
14993 fi
14994
14995 : configuration may be patched via a 'config.over' file
14996 if $test -f config.over; then
14997         echo " "
14998         dflt=y
14999         rp='I see a config.over file.  Do you wish to load it?'
15000         . UU/myread
15001         case "$ans" in
15002         n*) echo "OK, I'll ignore it.";;
15003         *)      . ./config.over
15004                 echo "Configuration override changes have been loaded."
15005                 ;;
15006         esac
15007 fi
15008
15009 : in case they want portability, strip down executable paths
15010 case "$d_portable" in
15011 "$define")
15012         echo " "
15013         echo "Stripping down executable paths..." >&4
15014         for file in $loclist $trylist; do
15015                 eval temp=\$$file
15016                 eval $file=`basename $temp`
15017         done
15018         ;;
15019 esac
15020
15021 : create config.sh file
15022 echo " "
15023 echo "Creating config.sh..." >&4
15024 $spitshell <<EOT >config.sh
15025 $startsh
15026 #
15027 # This file was produced by running the Configure script. It holds all the
15028 # definitions figured out by Configure. Should you modify one of these values,
15029 # do not forget to propagate your changes by running "Configure -der". You may
15030 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15031 #
15032
15033 # Package name      : $package
15034 # Source directory  : $src
15035 # Configuration time: $cf_time
15036 # Configured by     : $cf_by
15037 # Target system     : $myuname
15038
15039 Author='$Author'
15040 Date='$Date'
15041 Header='$Header'
15042 Id='$Id'
15043 Locker='$Locker'
15044 Log='$Log'
15045 Mcc='$Mcc'
15046 RCSfile='$RCSfile'
15047 Revision='$Revision'
15048 Source='$Source'
15049 State='$State'
15050 _a='$_a'
15051 _exe='$_exe'
15052 _o='$_o'
15053 afs='$afs'
15054 alignbytes='$alignbytes'
15055 ansi2knr='$ansi2knr'
15056 aphostname='$aphostname'
15057 api_revision='$api_revision'
15058 api_subversion='$api_subversion'
15059 api_version='$api_version'
15060 api_versionstring='$api_versionstring'
15061 ar='$ar'
15062 archlib='$archlib'
15063 archlibexp='$archlibexp'
15064 archname64='$archname64'
15065 archname='$archname'
15066 archobjs='$archobjs'
15067 awk='$awk'
15068 baserev='$baserev'
15069 bash='$bash'
15070 bin='$bin'
15071 bincompat5005='$bincompat5005'
15072 binexp='$binexp'
15073 bison='$bison'
15074 byacc='$byacc'
15075 byteorder='$byteorder'
15076 c='$c'
15077 castflags='$castflags'
15078 cat='$cat'
15079 cc='$cc'
15080 cccdlflags='$cccdlflags'
15081 ccdlflags='$ccdlflags'
15082 ccflags='$ccflags'
15083 ccsymbols='$ccsymbols'
15084 cf_by='$cf_by'
15085 cf_email='$cf_email'
15086 cf_time='$cf_time'
15087 charsize='$charsize'
15088 chgrp='$chgrp'
15089 chmod='$chmod'
15090 chown='$chown'
15091 clocktype='$clocktype'
15092 comm='$comm'
15093 compress='$compress'
15094 contains='$contains'
15095 cp='$cp'
15096 cpio='$cpio'
15097 cpp='$cpp'
15098 cpp_stuff='$cpp_stuff'
15099 cppccsymbols='$cppccsymbols'
15100 cppflags='$cppflags'
15101 cpplast='$cpplast'
15102 cppminus='$cppminus'
15103 cpprun='$cpprun'
15104 cppstdin='$cppstdin'
15105 cppsymbols='$cppsymbols'
15106 crosscompile='$crosscompile'
15107 cryptlib='$cryptlib'
15108 csh='$csh'
15109 d_Gconvert='$d_Gconvert'
15110 d_PRIEldbl='$d_PRIEldbl'
15111 d_PRIFldbl='$d_PRIFldbl'
15112 d_PRIGldbl='$d_PRIGldbl'
15113 d_PRIX64='$d_PRIX64'
15114 d_PRId64='$d_PRId64'
15115 d_PRIeldbl='$d_PRIeldbl'
15116 d_PRIfldbl='$d_PRIfldbl'
15117 d_PRIgldbl='$d_PRIgldbl'
15118 d_PRIi64='$d_PRIi64'
15119 d_PRIo64='$d_PRIo64'
15120 d_PRIu64='$d_PRIu64'
15121 d_PRIx64='$d_PRIx64'
15122 d_access='$d_access'
15123 d_accessx='$d_accessx'
15124 d_alarm='$d_alarm'
15125 d_archlib='$d_archlib'
15126 d_atolf='$d_atolf'
15127 d_atoll='$d_atoll'
15128 d_attribut='$d_attribut'
15129 d_bcmp='$d_bcmp'
15130 d_bcopy='$d_bcopy'
15131 d_bincompat5005='$d_bincompat5005'
15132 d_bsd='$d_bsd'
15133 d_bsdgetpgrp='$d_bsdgetpgrp'
15134 d_bsdsetpgrp='$d_bsdsetpgrp'
15135 d_bzero='$d_bzero'
15136 d_casti32='$d_casti32'
15137 d_castneg='$d_castneg'
15138 d_charvspr='$d_charvspr'
15139 d_chown='$d_chown'
15140 d_chroot='$d_chroot'
15141 d_chsize='$d_chsize'
15142 d_closedir='$d_closedir'
15143 d_const='$d_const'
15144 d_crypt='$d_crypt'
15145 d_csh='$d_csh'
15146 d_cuserid='$d_cuserid'
15147 d_dbl_dig='$d_dbl_dig'
15148 d_difftime='$d_difftime'
15149 d_dirnamlen='$d_dirnamlen'
15150 d_dlerror='$d_dlerror'
15151 d_dlopen='$d_dlopen'
15152 d_dlsymun='$d_dlsymun'
15153 d_dosuid='$d_dosuid'
15154 d_drand48proto='$d_drand48proto'
15155 d_dup2='$d_dup2'
15156 d_eaccess='$d_eaccess'
15157 d_endgrent='$d_endgrent'
15158 d_endhent='$d_endhent'
15159 d_endnent='$d_endnent'
15160 d_endpent='$d_endpent'
15161 d_endpwent='$d_endpwent'
15162 d_endsent='$d_endsent'
15163 d_endspent='$d_endspent'
15164 d_eofnblk='$d_eofnblk'
15165 d_eunice='$d_eunice'
15166 d_fchmod='$d_fchmod'
15167 d_fchown='$d_fchown'
15168 d_fcntl='$d_fcntl'
15169 d_fd_macros='$d_fd_macros'
15170 d_fd_set='$d_fd_set'
15171 d_fds_bits='$d_fds_bits'
15172 d_fgetpos='$d_fgetpos'
15173 d_flexfnam='$d_flexfnam'
15174 d_flock='$d_flock'
15175 d_fork='$d_fork'
15176 d_fpathconf='$d_fpathconf'
15177 d_fpos64_t='$d_fpos64_t'
15178 d_fs_data_s='$d_fs_data_s'
15179 d_fseeko='$d_fseeko'
15180 d_fsetpos='$d_fsetpos'
15181 d_fstatfs='$d_fstatfs'
15182 d_fstatvfs='$d_fstatvfs'
15183 d_ftello='$d_ftello'
15184 d_ftime='$d_ftime'
15185 d_getcwd='$d_getcwd'
15186 d_getfsstat='$d_getfsstat'
15187 d_getgrent='$d_getgrent'
15188 d_getgrps='$d_getgrps'
15189 d_gethbyaddr='$d_gethbyaddr'
15190 d_gethbyname='$d_gethbyname'
15191 d_gethent='$d_gethent'
15192 d_gethname='$d_gethname'
15193 d_gethostprotos='$d_gethostprotos'
15194 d_getlogin='$d_getlogin'
15195 d_getmnt='$d_getmnt'
15196 d_getmntent='$d_getmntent'
15197 d_getnbyaddr='$d_getnbyaddr'
15198 d_getnbyname='$d_getnbyname'
15199 d_getnent='$d_getnent'
15200 d_getnetprotos='$d_getnetprotos'
15201 d_getpbyname='$d_getpbyname'
15202 d_getpbynumber='$d_getpbynumber'
15203 d_getpent='$d_getpent'
15204 d_getpgid='$d_getpgid'
15205 d_getpgrp2='$d_getpgrp2'
15206 d_getpgrp='$d_getpgrp'
15207 d_getppid='$d_getppid'
15208 d_getprior='$d_getprior'
15209 d_getprotoprotos='$d_getprotoprotos'
15210 d_getpwent='$d_getpwent'
15211 d_getsbyname='$d_getsbyname'
15212 d_getsbyport='$d_getsbyport'
15213 d_getsent='$d_getsent'
15214 d_getservprotos='$d_getservprotos'
15215 d_getspent='$d_getspent'
15216 d_getspnam='$d_getspnam'
15217 d_gettimeod='$d_gettimeod'
15218 d_gnulibc='$d_gnulibc'
15219 d_grpasswd='$d_grpasswd'
15220 d_hasmntopt='$d_hasmntopt'
15221 d_htonl='$d_htonl'
15222 d_iconv='$d_iconv'
15223 d_index='$d_index'
15224 d_inetaton='$d_inetaton'
15225 d_int64_t='$d_int64_t'
15226 d_isascii='$d_isascii'
15227 d_killpg='$d_killpg'
15228 d_lchown='$d_lchown'
15229 d_ldbl_dig='$d_ldbl_dig'
15230 d_link='$d_link'
15231 d_locconv='$d_locconv'
15232 d_lockf='$d_lockf'
15233 d_longdbl='$d_longdbl'
15234 d_longlong='$d_longlong'
15235 d_lseekproto='$d_lseekproto'
15236 d_lstat='$d_lstat'
15237 d_madvise='$d_madvise'
15238 d_mblen='$d_mblen'
15239 d_mbstowcs='$d_mbstowcs'
15240 d_mbtowc='$d_mbtowc'
15241 d_memchr='$d_memchr'
15242 d_memcmp='$d_memcmp'
15243 d_memcpy='$d_memcpy'
15244 d_memmove='$d_memmove'
15245 d_memset='$d_memset'
15246 d_mkdir='$d_mkdir'
15247 d_mkdtemp='$d_mkdtemp'
15248 d_mkfifo='$d_mkfifo'
15249 d_mkstemp='$d_mkstemp'
15250 d_mkstemps='$d_mkstemps'
15251 d_mktime='$d_mktime'
15252 d_mmap='$d_mmap'
15253 d_mprotect='$d_mprotect'
15254 d_msg='$d_msg'
15255 d_msg_ctrunc='$d_msg_ctrunc'
15256 d_msg_dontroute='$d_msg_dontroute'
15257 d_msg_oob='$d_msg_oob'
15258 d_msg_peek='$d_msg_peek'
15259 d_msg_proxy='$d_msg_proxy'
15260 d_msgctl='$d_msgctl'
15261 d_msgget='$d_msgget'
15262 d_msgrcv='$d_msgrcv'
15263 d_msgsnd='$d_msgsnd'
15264 d_msync='$d_msync'
15265 d_munmap='$d_munmap'
15266 d_mymalloc='$d_mymalloc'
15267 d_nice='$d_nice'
15268 d_nv_preserves_uv='$d_nv_preserves_uv'
15269 d_off64_t='$d_off64_t'
15270 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15271 d_oldpthreads='$d_oldpthreads'
15272 d_oldsock='$d_oldsock'
15273 d_open3='$d_open3'
15274 d_pathconf='$d_pathconf'
15275 d_pause='$d_pause'
15276 d_phostname='$d_phostname'
15277 d_pipe='$d_pipe'
15278 d_poll='$d_poll'
15279 d_portable='$d_portable'
15280 d_pthread_yield='$d_pthread_yield'
15281 d_pwage='$d_pwage'
15282 d_pwchange='$d_pwchange'
15283 d_pwclass='$d_pwclass'
15284 d_pwcomment='$d_pwcomment'
15285 d_pwexpire='$d_pwexpire'
15286 d_pwgecos='$d_pwgecos'
15287 d_pwpasswd='$d_pwpasswd'
15288 d_pwquota='$d_pwquota'
15289 d_qgcvt='$d_qgcvt'
15290 d_quad='$d_quad'
15291 d_readdir='$d_readdir'
15292 d_readlink='$d_readlink'
15293 d_rename='$d_rename'
15294 d_rewinddir='$d_rewinddir'
15295 d_rmdir='$d_rmdir'
15296 d_safebcpy='$d_safebcpy'
15297 d_safemcpy='$d_safemcpy'
15298 d_sanemcmp='$d_sanemcmp'
15299 d_sched_yield='$d_sched_yield'
15300 d_scm_rights='$d_scm_rights'
15301 d_seekdir='$d_seekdir'
15302 d_select='$d_select'
15303 d_sem='$d_sem'
15304 d_semctl='$d_semctl'
15305 d_semctl_semid_ds='$d_semctl_semid_ds'
15306 d_semctl_semun='$d_semctl_semun'
15307 d_semget='$d_semget'
15308 d_semop='$d_semop'
15309 d_setegid='$d_setegid'
15310 d_seteuid='$d_seteuid'
15311 d_setgrent='$d_setgrent'
15312 d_setgrps='$d_setgrps'
15313 d_sethent='$d_sethent'
15314 d_setlinebuf='$d_setlinebuf'
15315 d_setlocale='$d_setlocale'
15316 d_setnent='$d_setnent'
15317 d_setpent='$d_setpent'
15318 d_setpgid='$d_setpgid'
15319 d_setpgrp2='$d_setpgrp2'
15320 d_setpgrp='$d_setpgrp'
15321 d_setprior='$d_setprior'
15322 d_setpwent='$d_setpwent'
15323 d_setregid='$d_setregid'
15324 d_setresgid='$d_setresgid'
15325 d_setresuid='$d_setresuid'
15326 d_setreuid='$d_setreuid'
15327 d_setrgid='$d_setrgid'
15328 d_setruid='$d_setruid'
15329 d_setsent='$d_setsent'
15330 d_setsid='$d_setsid'
15331 d_setspent='$d_setspent'
15332 d_setvbuf='$d_setvbuf'
15333 d_sfio='$d_sfio'
15334 d_shm='$d_shm'
15335 d_shmat='$d_shmat'
15336 d_shmatprototype='$d_shmatprototype'
15337 d_shmctl='$d_shmctl'
15338 d_shmdt='$d_shmdt'
15339 d_shmget='$d_shmget'
15340 d_sigaction='$d_sigaction'
15341 d_sigsetjmp='$d_sigsetjmp'
15342 d_socket='$d_socket'
15343 d_socklen_t='$d_socklen_t'
15344 d_sockpair='$d_sockpair'
15345 d_sqrtl='$d_sqrtl'
15346 d_statblks='$d_statblks'
15347 d_statfs_f_flags='$d_statfs_f_flags'
15348 d_statfs_s='$d_statfs_s'
15349 d_statvfs='$d_statvfs'
15350 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15351 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15352 d_stdio_stream_array='$d_stdio_stream_array'
15353 d_stdiobase='$d_stdiobase'
15354 d_stdstdio='$d_stdstdio'
15355 d_strchr='$d_strchr'
15356 d_strcoll='$d_strcoll'
15357 d_strctcpy='$d_strctcpy'
15358 d_strerrm='$d_strerrm'
15359 d_strerror='$d_strerror'
15360 d_strtod='$d_strtod'
15361 d_strtol='$d_strtol'
15362 d_strtold='$d_strtold'
15363 d_strtoll='$d_strtoll'
15364 d_strtoul='$d_strtoul'
15365 d_strtoull='$d_strtoull'
15366 d_strtouq='$d_strtouq'
15367 d_strxfrm='$d_strxfrm'
15368 d_suidsafe='$d_suidsafe'
15369 d_symlink='$d_symlink'
15370 d_syscall='$d_syscall'
15371 d_sysconf='$d_sysconf'
15372 d_sysernlst='$d_sysernlst'
15373 d_syserrlst='$d_syserrlst'
15374 d_system='$d_system'
15375 d_tcgetpgrp='$d_tcgetpgrp'
15376 d_tcsetpgrp='$d_tcsetpgrp'
15377 d_telldir='$d_telldir'
15378 d_telldirproto='$d_telldirproto'
15379 d_time='$d_time'
15380 d_times='$d_times'
15381 d_truncate='$d_truncate'
15382 d_tzname='$d_tzname'
15383 d_umask='$d_umask'
15384 d_uname='$d_uname'
15385 d_union_semun='$d_union_semun'
15386 d_ustat='$d_ustat'
15387 d_vendorarch='$d_vendorarch'
15388 d_vendorbin='$d_vendorbin'
15389 d_vendorlib='$d_vendorlib'
15390 d_vfork='$d_vfork'
15391 d_void_closedir='$d_void_closedir'
15392 d_voidsig='$d_voidsig'
15393 d_voidtty='$d_voidtty'
15394 d_volatile='$d_volatile'
15395 d_vprintf='$d_vprintf'
15396 d_wait4='$d_wait4'
15397 d_waitpid='$d_waitpid'
15398 d_wcstombs='$d_wcstombs'
15399 d_wctomb='$d_wctomb'
15400 d_xenix='$d_xenix'
15401 date='$date'
15402 db_hashtype='$db_hashtype'
15403 db_prefixtype='$db_prefixtype'
15404 defvoidused='$defvoidused'
15405 direntrytype='$direntrytype'
15406 dlext='$dlext'
15407 dlsrc='$dlsrc'
15408 doublesize='$doublesize'
15409 drand01='$drand01'
15410 dynamic_ext='$dynamic_ext'
15411 eagain='$eagain'
15412 ebcdic='$ebcdic'
15413 echo='$echo'
15414 egrep='$egrep'
15415 emacs='$emacs'
15416 eunicefix='$eunicefix'
15417 exe_ext='$exe_ext'
15418 expr='$expr'
15419 extensions='$extensions'
15420 fflushNULL='$fflushNULL'
15421 fflushall='$fflushall'
15422 find='$find'
15423 firstmakefile='$firstmakefile'
15424 flex='$flex'
15425 fpossize='$fpossize'
15426 fpostype='$fpostype'
15427 freetype='$freetype'
15428 full_ar='$full_ar'
15429 full_csh='$full_csh'
15430 full_sed='$full_sed'
15431 gccversion='$gccversion'
15432 gidformat='$gidformat'
15433 gidsign='$gidsign'
15434 gidsize='$gidsize'
15435 gidtype='$gidtype'
15436 glibpth='$glibpth'
15437 grep='$grep'
15438 groupcat='$groupcat'
15439 groupstype='$groupstype'
15440 gzip='$gzip'
15441 h_fcntl='$h_fcntl'
15442 h_sysfile='$h_sysfile'
15443 hint='$hint'
15444 hostcat='$hostcat'
15445 huge='$huge'
15446 i16size='$i16size'
15447 i16type='$i16type'
15448 i32size='$i32size'
15449 i32type='$i32type'
15450 i64size='$i64size'
15451 i64type='$i64type'
15452 i8size='$i8size'
15453 i8type='$i8type'
15454 i_arpainet='$i_arpainet'
15455 i_bsdioctl='$i_bsdioctl'
15456 i_db='$i_db'
15457 i_dbm='$i_dbm'
15458 i_dirent='$i_dirent'
15459 i_dld='$i_dld'
15460 i_dlfcn='$i_dlfcn'
15461 i_fcntl='$i_fcntl'
15462 i_float='$i_float'
15463 i_gdbm='$i_gdbm'
15464 i_grp='$i_grp'
15465 i_iconv='$i_iconv'
15466 i_ieeefp='$i_ieeefp'
15467 i_inttypes='$i_inttypes'
15468 i_limits='$i_limits'
15469 i_locale='$i_locale'
15470 i_machcthr='$i_machcthr'
15471 i_malloc='$i_malloc'
15472 i_math='$i_math'
15473 i_memory='$i_memory'
15474 i_mntent='$i_mntent'
15475 i_ndbm='$i_ndbm'
15476 i_netdb='$i_netdb'
15477 i_neterrno='$i_neterrno'
15478 i_netinettcp='$i_netinettcp'
15479 i_niin='$i_niin'
15480 i_poll='$i_poll'
15481 i_pthread='$i_pthread'
15482 i_pwd='$i_pwd'
15483 i_rpcsvcdbm='$i_rpcsvcdbm'
15484 i_sfio='$i_sfio'
15485 i_sgtty='$i_sgtty'
15486 i_shadow='$i_shadow'
15487 i_socks='$i_socks'
15488 i_stdarg='$i_stdarg'
15489 i_stddef='$i_stddef'
15490 i_stdlib='$i_stdlib'
15491 i_string='$i_string'
15492 i_sunmath='$i_sunmath'
15493 i_sysaccess='$i_sysaccess'
15494 i_sysdir='$i_sysdir'
15495 i_sysfile='$i_sysfile'
15496 i_sysfilio='$i_sysfilio'
15497 i_sysin='$i_sysin'
15498 i_sysioctl='$i_sysioctl'
15499 i_syslog='$i_syslog'
15500 i_sysmman='$i_sysmman'
15501 i_sysmode='$i_sysmode'
15502 i_sysmount='$i_sysmount'
15503 i_sysndir='$i_sysndir'
15504 i_sysparam='$i_sysparam'
15505 i_sysresrc='$i_sysresrc'
15506 i_syssecrt='$i_syssecrt'
15507 i_sysselct='$i_sysselct'
15508 i_syssockio='$i_syssockio'
15509 i_sysstat='$i_sysstat'
15510 i_sysstatfs='$i_sysstatfs'
15511 i_sysstatvfs='$i_sysstatvfs'
15512 i_systime='$i_systime'
15513 i_systimek='$i_systimek'
15514 i_systimes='$i_systimes'
15515 i_systypes='$i_systypes'
15516 i_sysuio='$i_sysuio'
15517 i_sysun='$i_sysun'
15518 i_sysutsname='$i_sysutsname'
15519 i_sysvfs='$i_sysvfs'
15520 i_syswait='$i_syswait'
15521 i_termio='$i_termio'
15522 i_termios='$i_termios'
15523 i_time='$i_time'
15524 i_unistd='$i_unistd'
15525 i_ustat='$i_ustat'
15526 i_utime='$i_utime'
15527 i_values='$i_values'
15528 i_varargs='$i_varargs'
15529 i_varhdr='$i_varhdr'
15530 i_vfork='$i_vfork'
15531 ignore_versioned_solibs='$ignore_versioned_solibs'
15532 inc_version_list='$inc_version_list'
15533 inc_version_list_init='$inc_version_list_init'
15534 incpath='$incpath'
15535 inews='$inews'
15536 installarchlib='$installarchlib'
15537 installbin='$installbin'
15538 installman1dir='$installman1dir'
15539 installman3dir='$installman3dir'
15540 installprefix='$installprefix'
15541 installprefixexp='$installprefixexp'
15542 installprivlib='$installprivlib'
15543 installscript='$installscript'
15544 installsitearch='$installsitearch'
15545 installsitebin='$installsitebin'
15546 installsitelib='$installsitelib'
15547 installstyle='$installstyle'
15548 installusrbinperl='$installusrbinperl'
15549 installvendorarch='$installvendorarch'
15550 installvendorbin='$installvendorbin'
15551 installvendorlib='$installvendorlib'
15552 intsize='$intsize'
15553 ivdformat='$ivdformat'
15554 ivsize='$ivsize'
15555 ivtype='$ivtype'
15556 known_extensions='$known_extensions'
15557 ksh='$ksh'
15558 large='$large'
15559 ld='$ld'
15560 lddlflags='$lddlflags'
15561 ldflags='$ldflags'
15562 ldlibpthname='$ldlibpthname'
15563 less='$less'
15564 lib_ext='$lib_ext'
15565 libc='$libc'
15566 libperl='$libperl'
15567 libpth='$libpth'
15568 libs='$libs'
15569 libsdirs='$libsdirs'
15570 libsfiles='$libsfiles'
15571 libsfound='$libsfound'
15572 libspath='$libspath'
15573 libswanted='$libswanted'
15574 line='$line'
15575 lint='$lint'
15576 lkflags='$lkflags'
15577 ln='$ln'
15578 lns='$lns'
15579 locincpth='$locincpth'
15580 loclibpth='$loclibpth'
15581 longdblsize='$longdblsize'
15582 longlongsize='$longlongsize'
15583 longsize='$longsize'
15584 lp='$lp'
15585 lpr='$lpr'
15586 ls='$ls'
15587 lseeksize='$lseeksize'
15588 lseektype='$lseektype'
15589 mail='$mail'
15590 mailx='$mailx'
15591 make='$make'
15592 make_set_make='$make_set_make'
15593 mallocobj='$mallocobj'
15594 mallocsrc='$mallocsrc'
15595 malloctype='$malloctype'
15596 man1dir='$man1dir'
15597 man1direxp='$man1direxp'
15598 man1ext='$man1ext'
15599 man3dir='$man3dir'
15600 man3direxp='$man3direxp'
15601 man3ext='$man3ext'
15602 medium='$medium'
15603 mips_type='$mips_type'
15604 mkdir='$mkdir'
15605 mmaptype='$mmaptype'
15606 models='$models'
15607 modetype='$modetype'
15608 more='$more'
15609 multiarch='$multiarch'
15610 mv='$mv'
15611 myarchname='$myarchname'
15612 mydomain='$mydomain'
15613 myhostname='$myhostname'
15614 myuname='$myuname'
15615 n='$n'
15616 netdb_hlen_type='$netdb_hlen_type'
15617 netdb_host_type='$netdb_host_type'
15618 netdb_name_type='$netdb_name_type'
15619 netdb_net_type='$netdb_net_type'
15620 nm='$nm'
15621 nm_opt='$nm_opt'
15622 nm_so_opt='$nm_so_opt'
15623 nonxs_ext='$nonxs_ext'
15624 nroff='$nroff'
15625 nvsize='$nvsize'
15626 nvtype='$nvtype'
15627 o_nonblock='$o_nonblock'
15628 obj_ext='$obj_ext'
15629 old_pthread_create_joinable='$old_pthread_create_joinable'
15630 optimize='$optimize'
15631 orderlib='$orderlib'
15632 osname='$osname'
15633 osvers='$osvers'
15634 package='$package'
15635 pager='$pager'
15636 passcat='$passcat'
15637 patchlevel='$patchlevel'
15638 path_sep='$path_sep'
15639 perl5='$perl5'
15640 perl='$perl'
15641 perladmin='$perladmin'
15642 perlpath='$perlpath'
15643 pg='$pg'
15644 phostname='$phostname'
15645 pidtype='$pidtype'
15646 plibpth='$plibpth'
15647 pm_apiversion='$pm_apiversion'
15648 pmake='$pmake'
15649 pr='$pr'
15650 prefix='$prefix'
15651 prefixexp='$prefixexp'
15652 privlib='$privlib'
15653 privlibexp='$privlibexp'
15654 prototype='$prototype'
15655 ptrsize='$ptrsize'
15656 quadkind='$quadkind'
15657 quadtype='$quadtype'
15658 randbits='$randbits'
15659 randfunc='$randfunc'
15660 randseedtype='$randseedtype'
15661 ranlib='$ranlib'
15662 rd_nodata='$rd_nodata'
15663 revision='$revision'
15664 rm='$rm'
15665 rmail='$rmail'
15666 runnm='$runnm'
15667 sPRIEldbl='$sPRIEldbl'
15668 sPRIFldbl='$sPRIFldbl'
15669 sPRIGldbl='$sPRIGldbl'
15670 sPRIX64='$sPRIX64'
15671 sPRId64='$sPRId64'
15672 sPRIeldbl='$sPRIeldbl'
15673 sPRIfldbl='$sPRIfldbl'
15674 sPRIgldbl='$sPRIgldbl'
15675 sPRIi64='$sPRIi64'
15676 sPRIo64='$sPRIo64'
15677 sPRIu64='$sPRIu64'
15678 sPRIx64='$sPRIx64'
15679 sched_yield='$sched_yield'
15680 scriptdir='$scriptdir'
15681 scriptdirexp='$scriptdirexp'
15682 sed='$sed'
15683 seedfunc='$seedfunc'
15684 selectminbits='$selectminbits'
15685 selecttype='$selecttype'
15686 sendmail='$sendmail'
15687 sh='$sh'
15688 shar='$shar'
15689 sharpbang='$sharpbang'
15690 shmattype='$shmattype'
15691 shortsize='$shortsize'
15692 shrpenv='$shrpenv'
15693 shsharp='$shsharp'
15694 sig_count='$sig_count'
15695 sig_name='$sig_name'
15696 sig_name_init='$sig_name_init'
15697 sig_num='$sig_num'
15698 sig_num_init='$sig_num_init'
15699 signal_t='$signal_t'
15700 sitearch='$sitearch'
15701 sitearchexp='$sitearchexp'
15702 sitebin='$sitebin'
15703 sitebinexp='$sitebinexp'
15704 sitelib='$sitelib'
15705 sitelib_stem='$sitelib_stem'
15706 sitelibexp='$sitelibexp'
15707 siteprefix='$siteprefix'
15708 siteprefixexp='$siteprefixexp'
15709 sizesize='$sizesize'
15710 sizetype='$sizetype'
15711 sleep='$sleep'
15712 smail='$smail'
15713 small='$small'
15714 so='$so'
15715 sockethdr='$sockethdr'
15716 socketlib='$socketlib'
15717 socksizetype='$socksizetype'
15718 sort='$sort'
15719 spackage='$spackage'
15720 spitshell='$spitshell'
15721 split='$split'
15722 src='$src'
15723 ssizetype='$ssizetype'
15724 startperl='$startperl'
15725 startsh='$startsh'
15726 static_ext='$static_ext'
15727 stdchar='$stdchar'
15728 stdio_base='$stdio_base'
15729 stdio_bufsiz='$stdio_bufsiz'
15730 stdio_cnt='$stdio_cnt'
15731 stdio_filbuf='$stdio_filbuf'
15732 stdio_ptr='$stdio_ptr'
15733 stdio_stream_array='$stdio_stream_array'
15734 strings='$strings'
15735 submit='$submit'
15736 subversion='$subversion'
15737 sysman='$sysman'
15738 tail='$tail'
15739 tar='$tar'
15740 tbl='$tbl'
15741 tee='$tee'
15742 test='$test'
15743 timeincl='$timeincl'
15744 timetype='$timetype'
15745 touch='$touch'
15746 tr='$tr'
15747 trnl='$trnl'
15748 troff='$troff'
15749 u16size='$u16size'
15750 u16type='$u16type'
15751 u32size='$u32size'
15752 u32type='$u32type'
15753 u64size='$u64size'
15754 u64type='$u64type'
15755 u8size='$u8size'
15756 u8type='$u8type'
15757 uidformat='$uidformat'
15758 uidsign='$uidsign'
15759 uidsize='$uidsize'
15760 uidtype='$uidtype'
15761 uname='$uname'
15762 uniq='$uniq'
15763 uquadtype='$uquadtype'
15764 use5005threads='$use5005threads'
15765 use64bitall='$use64bitall'
15766 use64bitint='$use64bitint'
15767 usedl='$usedl'
15768 useithreads='$useithreads'
15769 uselargefiles='$uselargefiles'
15770 uselongdouble='$uselongdouble'
15771 usemorebits='$usemorebits'
15772 usemultiplicity='$usemultiplicity'
15773 usemymalloc='$usemymalloc'
15774 usenm='$usenm'
15775 useopcode='$useopcode'
15776 useperlio='$useperlio'
15777 useposix='$useposix'
15778 usesfio='$usesfio'
15779 useshrplib='$useshrplib'
15780 usesocks='$usesocks'
15781 usethreads='$usethreads'
15782 usevendorprefix='$usevendorprefix'
15783 usevfork='$usevfork'
15784 usrinc='$usrinc'
15785 uuname='$uuname'
15786 uvoformat='$uvoformat'
15787 uvsize='$uvsize'
15788 uvtype='$uvtype'
15789 uvuformat='$uvuformat'
15790 uvxformat='$uvxformat'
15791 vendorarch='$vendorarch'
15792 vendorarchexp='$vendorarchexp'
15793 vendorbin='$vendorbin'
15794 vendorbinexp='$vendorbinexp'
15795 vendorlib='$vendorlib'
15796 vendorlib_stem='$vendorlib_stem'
15797 vendorlibexp='$vendorlibexp'
15798 vendorprefix='$vendorprefix'
15799 vendorprefixexp='$vendorprefixexp'
15800 version='$version'
15801 vi='$vi'
15802 voidflags='$voidflags'
15803 xlibpth='$xlibpth'
15804 xs_apiversion='$xs_apiversion'
15805 zcat='$zcat'
15806 zip='$zip'
15807 EOT
15808
15809 : Add in command line options if available
15810 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15811
15812 : add special variables
15813 $test -f $src/patchlevel.h && \
15814 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15815 echo "CONFIGDOTSH=true" >>config.sh
15816
15817 : propagate old symbols
15818 if $test -f UU/config.sh; then
15819         <UU/config.sh sort | uniq >UU/oldconfig.sh
15820         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15821         sort | uniq -u >UU/oldsyms
15822         set X `cat UU/oldsyms`
15823         shift
15824         case $# in
15825         0) ;;
15826         *)
15827                 cat <<EOM
15828 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15829 EOM
15830                 echo "# Variables propagated from previous config.sh file." >>config.sh
15831                 for sym in `cat UU/oldsyms`; do
15832                         echo "    Propagating $hint variable "'$'"$sym..."
15833                         eval 'tmp="$'"${sym}"'"'
15834                         echo "$tmp" | \
15835                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15836                 done
15837                 ;;
15838         esac
15839 fi
15840
15841 : Finish up by extracting the .SH files
15842 case "$alldone" in
15843 exit)
15844         $rm -rf UU
15845         echo "Done."
15846         exit 0
15847         ;;
15848 cont)
15849         ;;
15850 '')
15851         dflt=''
15852         nostick=true
15853         $cat <<EOM
15854
15855 If you'd like to make any changes to the config.sh file before I begin
15856 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15857
15858 EOM
15859         rp="Press return or use a shell escape to edit config.sh:"
15860         . UU/myread
15861         nostick=''
15862         case "$ans" in
15863         '') ;;
15864         *) : in case they cannot read
15865                 sh 1>&4 -c "$ans";;
15866         esac
15867         ;;
15868 esac
15869
15870 : if this fails, just run all the .SH files by hand
15871 . ./config.sh
15872
15873 echo " "
15874 exec 1>&4
15875 . ./UU/extract
15876
15877 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15878         dflt=y
15879         case "$silent" in
15880         true) ;;
15881         *)
15882                 $cat <<EOM
15883
15884 Now you need to generate make dependencies by running "$make depend".
15885 You might prefer to run it in background: "$make depend > makedepend.out &"
15886 It can take a while, so you might not want to run it right now.
15887
15888 EOM
15889                 ;;
15890         esac
15891         rp="Run $make depend now?"
15892         . UU/myread
15893         case "$ans" in
15894         y*)
15895                 $make depend && echo "Now you must run a $make."
15896                 ;;
15897         *)
15898                 echo "You must run '$make depend' then '$make'."
15899                 ;;
15900         esac
15901 elif test -f [Mm]akefile; then
15902         echo " "
15903         echo "Now you must run a $make."
15904 else
15905         echo "Done."
15906 fi
15907
15908 if $test -f Policy.sh; then
15909     $cat <<EOM
15910
15911 If you compile $package on a different machine or from a different object
15912 directory, copy the Policy.sh file from this object directory to the
15913 new one before you run Configure -- this will help you with most of
15914 the policy defaults.
15915
15916 EOM
15917 fi
15918 if $test -f config.msg; then
15919     echo "Hmm.  I also noted the following information while running:"
15920     echo " "
15921     $cat config.msg >&4
15922     $rm -f config.msg
15923 fi
15924 $rm -f kit*isdone ark*isdone
15925 $rm -rf UU
15926
15927 : End of Configure
15928