Add test for Net::netent.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue May 29 17:16:31 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_cmsghdr_s=''
328 d_const=''
329 cryptlib=''
330 d_crypt=''
331 d_csh=''
332 full_csh=''
333 d_cuserid=''
334 d_dbl_dig=''
335 d_difftime=''
336 d_dlerror=''
337 d_dlopen=''
338 d_dlsymun=''
339 d_dosuid=''
340 d_suidsafe=''
341 d_drand48proto=''
342 d_dup2=''
343 d_eaccess=''
344 d_endgrent=''
345 d_endhent=''
346 d_endnent=''
347 d_endpent=''
348 d_endpwent=''
349 d_endsent=''
350 d_fchmod=''
351 d_fchown=''
352 d_fcntl=''
353 d_fcntl_can_lock=''
354 d_fd_macros=''
355 d_fd_set=''
356 d_fds_bits=''
357 d_fgetpos=''
358 d_flexfnam=''
359 d_flock=''
360 d_fork=''
361 d_fpos64_t=''
362 d_frexpl=''
363 d_fs_data_s=''
364 d_fseeko=''
365 d_fsetpos=''
366 d_fstatfs=''
367 d_fsync=''
368 d_ftello=''
369 d_ftime=''
370 d_gettimeod=''
371 d_Gconvert=''
372 d_getcwd=''
373 d_getespwnam=''
374 d_getfsstat=''
375 d_getgrent=''
376 d_getgrps=''
377 d_gethbyaddr=''
378 d_gethbyname=''
379 d_gethent=''
380 aphostname=''
381 d_gethname=''
382 d_phostname=''
383 d_uname=''
384 d_gethostprotos=''
385 d_getitimer=''
386 d_getlogin=''
387 d_getmnt=''
388 d_getmntent=''
389 d_getnbyaddr=''
390 d_getnbyname=''
391 d_getnent=''
392 d_getnetprotos=''
393 d_getpagsz=''
394 d_getpent=''
395 d_getpgid=''
396 d_getpgrp2=''
397 d_bsdgetpgrp=''
398 d_getpgrp=''
399 d_getppid=''
400 d_getprior=''
401 d_getpbyname=''
402 d_getpbynumber=''
403 d_getprotoprotos=''
404 d_getprpwnam=''
405 d_getpwent=''
406 d_getsent=''
407 d_getservprotos=''
408 d_getspnam=''
409 d_getsbyname=''
410 d_getsbyport=''
411 d_gnulibc=''
412 d_hasmntopt=''
413 d_htonl=''
414 d_iconv=''
415 d_inetaton=''
416 d_int64_t=''
417 d_isascii=''
418 d_isnan=''
419 d_isnanl=''
420 d_killpg=''
421 d_lchown=''
422 d_ldbl_dig=''
423 d_link=''
424 d_locconv=''
425 d_lockf=''
426 d_longdbl=''
427 longdblsize=''
428 d_longlong=''
429 longlongsize=''
430 d_lseekproto=''
431 d_lstat=''
432 d_madvise=''
433 d_mblen=''
434 d_mbstowcs=''
435 d_mbtowc=''
436 d_memchr=''
437 d_memcmp=''
438 d_memcpy=''
439 d_memmove=''
440 d_memset=''
441 d_mkdir=''
442 d_mkdtemp=''
443 d_mkfifo=''
444 d_mkstemp=''
445 d_mkstemps=''
446 d_mktime=''
447 d_mmap=''
448 mmaptype=''
449 d_modfl=''
450 d_mprotect=''
451 d_msg=''
452 d_msgctl=''
453 d_msgget=''
454 d_msghdr_s=''
455 d_msgrcv=''
456 d_msgsnd=''
457 d_msync=''
458 d_munmap=''
459 d_nice=''
460 d_off64_t=''
461 d_open3=''
462 d_fpathconf=''
463 d_pathconf=''
464 d_pause=''
465 d_pipe=''
466 d_poll=''
467 d_portable=''
468 d_old_pthread_create_joinable=''
469 old_pthread_create_joinable=''
470 d_pthread_yield=''
471 d_sched_yield=''
472 sched_yield=''
473 d_qgcvt=''
474 d_readdir=''
475 d_rewinddir=''
476 d_seekdir=''
477 d_telldir=''
478 d_readlink=''
479 d_readv=''
480 d_recvmsg=''
481 d_rename=''
482 d_rmdir=''
483 d_safebcpy=''
484 d_safemcpy=''
485 d_sanemcmp=''
486 d_sbrkproto=''
487 d_select=''
488 d_sem=''
489 d_semctl=''
490 d_semget=''
491 d_semop=''
492 d_sendmsg=''
493 d_setegid=''
494 d_seteuid=''
495 d_setgrent=''
496 d_setgrps=''
497 d_sethent=''
498 d_setitimer=''
499 d_setlinebuf=''
500 d_setlocale=''
501 d_setnent=''
502 d_setpent=''
503 d_setpgid=''
504 d_setpgrp2=''
505 d_bsdsetpgrp=''
506 d_setpgrp=''
507 d_setprior=''
508 d_setproctitle=''
509 d_setpwent=''
510 d_setregid=''
511 d_setresgid=''
512 d_setresuid=''
513 d_setreuid=''
514 d_setrgid=''
515 d_setruid=''
516 d_setsent=''
517 d_setsid=''
518 d_setvbuf=''
519 d_sfio=''
520 usesfio=''
521 d_shm=''
522 d_shmat=''
523 d_shmatprototype=''
524 shmattype=''
525 d_shmctl=''
526 d_shmdt=''
527 d_shmget=''
528 d_sigaction=''
529 d_sigprocmask=''
530 d_sigsetjmp=''
531 d_sockatmark=''
532 d_msg_ctrunc=''
533 d_msg_dontroute=''
534 d_msg_oob=''
535 d_msg_peek=''
536 d_msg_proxy=''
537 d_oldsock=''
538 d_scm_rights=''
539 d_socket=''
540 d_sockpair=''
541 sockethdr=''
542 socketlib=''
543 d_socklen_t=''
544 d_socks5_init=''
545 d_sqrtl=''
546 d_statblks=''
547 d_statfs_f_flags=''
548 d_statfs_s=''
549 d_fstatvfs=''
550 d_statvfs=''
551 d_stdio_cnt_lval=''
552 d_stdio_ptr_lval=''
553 d_stdio_ptr_lval_nochange_cnt=''
554 d_stdio_ptr_lval_sets_cnt=''
555 d_stdiobase=''
556 d_stdstdio=''
557 stdio_base=''
558 stdio_bufsiz=''
559 stdio_cnt=''
560 stdio_filbuf=''
561 stdio_ptr=''
562 d_index=''
563 d_strchr=''
564 d_strcoll=''
565 d_strctcpy=''
566 d_strerrm=''
567 d_strerror=''
568 d_sysernlst=''
569 d_syserrlst=''
570 d_strftime=''
571 d_strtod=''
572 d_strtol=''
573 d_strtold=''
574 d_strtoll=''
575 d_strtoq=''
576 d_strtoul=''
577 d_strtoull=''
578 d_strtouq=''
579 d_strxfrm=''
580 d_symlink=''
581 d_syscall=''
582 d_sysconf=''
583 d_system=''
584 d_tcgetpgrp=''
585 d_tcsetpgrp=''
586 d_telldirproto=''
587 d_time=''
588 timetype=''
589 clocktype=''
590 d_times=''
591 d_truncate=''
592 d_tzname=''
593 d_u32align=''
594 d_ualarm=''
595 d_umask=''
596 d_semctl_semid_ds=''
597 d_semctl_semun=''
598 d_union_semun=''
599 d_usleep=''
600 d_ustat=''
601 d_vfork=''
602 usevfork=''
603 d_voidsig=''
604 signal_t=''
605 d_volatile=''
606 d_charvspr=''
607 d_vprintf=''
608 d_wait4=''
609 d_waitpid=''
610 d_wcstombs=''
611 d_wctomb=''
612 d_writev=''
613 dlext=''
614 cccdlflags=''
615 ccdlflags=''
616 dlsrc=''
617 ld=''
618 lddlflags=''
619 usedl=''
620 doublesize=''
621 ebcdic=''
622 fflushNULL=''
623 fflushall=''
624 fpossize=''
625 fpostype=''
626 gccosandvers=''
627 gccversion=''
628 gidformat=''
629 gidsign=''
630 gidsize=''
631 gidtype=''
632 groupstype=''
633 h_fcntl=''
634 h_sysfile=''
635 i_arpainet=''
636 db_hashtype=''
637 db_prefixtype=''
638 i_db=''
639 i_dbm=''
640 i_rpcsvcdbm=''
641 d_dirnamlen=''
642 direntrytype=''
643 i_dirent=''
644 i_dld=''
645 i_dlfcn=''
646 i_fcntl=''
647 i_float=''
648 i_gdbm=''
649 d_grpasswd=''
650 i_grp=''
651 i_iconv=''
652 i_ieeefp=''
653 i_inttypes=''
654 i_libutil=''
655 i_limits=''
656 i_locale=''
657 i_machcthr=''
658 i_malloc=''
659 i_math=''
660 i_memory=''
661 i_mntent=''
662 i_ndbm=''
663 i_netdb=''
664 i_neterrno=''
665 i_netinettcp=''
666 i_niin=''
667 i_sysin=''
668 i_poll=''
669 i_prot=''
670 i_pthread=''
671 d_pwage=''
672 d_pwchange=''
673 d_pwclass=''
674 d_pwcomment=''
675 d_pwexpire=''
676 d_pwgecos=''
677 d_pwpasswd=''
678 d_pwquota=''
679 i_pwd=''
680 i_sfio=''
681 i_shadow=''
682 i_socks=''
683 i_stddef=''
684 i_stdlib=''
685 i_string=''
686 strings=''
687 i_sunmath=''
688 i_sysaccess=''
689 i_sysdir=''
690 i_sysfile=''
691 d_voidtty=''
692 i_bsdioctl=''
693 i_sysfilio=''
694 i_sysioctl=''
695 i_syssockio=''
696 i_syslog=''
697 i_sysmman=''
698 i_sysmode=''
699 i_sysmount=''
700 i_sysndir=''
701 i_sysparam=''
702 i_sysresrc=''
703 i_syssecrt=''
704 i_sysselct=''
705 i_sysstat=''
706 i_sysstatfs=''
707 i_sysstatvfs=''
708 i_systimes=''
709 i_systypes=''
710 i_sysuio=''
711 i_sysun=''
712 i_sysutsname=''
713 i_sysvfs=''
714 i_syswait=''
715 i_sgtty=''
716 i_termio=''
717 i_termios=''
718 i_systime=''
719 i_systimek=''
720 i_time=''
721 timeincl=''
722 i_unistd=''
723 i_ustat=''
724 i_utime=''
725 i_values=''
726 i_stdarg=''
727 i_varargs=''
728 i_varhdr=''
729 i_vfork=''
730 inc_version_list=''
731 inc_version_list_init=''
732 installprefix=''
733 installprefixexp=''
734 installstyle=''
735 installusrbinperl=''
736 intsize=''
737 longsize=''
738 shortsize=''
739 issymlink=''
740 libc=''
741 ldlibpthname=''
742 libperl=''
743 shrpenv=''
744 useshrplib=''
745 glibpth=''
746 libpth=''
747 loclibpth=''
748 plibpth=''
749 xlibpth=''
750 ignore_versioned_solibs=''
751 libs=''
752 libsdirs=''
753 libsfiles=''
754 libsfound=''
755 libspath=''
756 lns=''
757 d_PRIEUldbl=''
758 d_PRIFUldbl=''
759 d_PRIGUldbl=''
760 d_PRIeldbl=''
761 d_PRIfldbl=''
762 d_PRIgldbl=''
763 d_SCNfldbl=''
764 sPRIEUldbl=''
765 sPRIFUldbl=''
766 sPRIGUldbl=''
767 sPRIeldbl=''
768 sPRIfldbl=''
769 sPRIgldbl=''
770 sSCNfldbl=''
771 lseeksize=''
772 lseektype=''
773 make_set_make=''
774 d_mymalloc=''
775 freetype=''
776 mallocobj=''
777 mallocsrc=''
778 malloctype=''
779 usemymalloc=''
780 installman1dir=''
781 man1dir=''
782 man1direxp=''
783 man1ext=''
784 installman3dir=''
785 man3dir=''
786 man3direxp=''
787 man3ext=''
788 modetype=''
789 multiarch=''
790 mydomain=''
791 myhostname=''
792 phostname=''
793 c=''
794 n=''
795 d_eofnblk=''
796 eagain=''
797 o_nonblock=''
798 rd_nodata=''
799 need_va_copy=''
800 netdb_hlen_type=''
801 netdb_host_type=''
802 netdb_name_type=''
803 netdb_net_type=''
804 groupcat=''
805 hostcat=''
806 passcat=''
807 orderlib=''
808 ranlib=''
809 d_perl_otherlibdirs=''
810 otherlibdirs=''
811 package=''
812 spackage=''
813 pager=''
814 api_revision=''
815 api_subversion=''
816 api_version=''
817 api_versionstring=''
818 patchlevel=''
819 perl_patchlevel=''
820 revision=''
821 subversion=''
822 version=''
823 perl5=''
824 perladmin=''
825 perlpath=''
826 d_nv_preserves_uv=''
827 d_nv_preserves_uv_bits=''
828 i16size=''
829 i16type=''
830 i32size=''
831 i32type=''
832 i64size=''
833 i64type=''
834 i8size=''
835 i8type=''
836 ivsize=''
837 ivtype=''
838 nvsize=''
839 nvtype=''
840 u16size=''
841 u16type=''
842 u32size=''
843 u32type=''
844 u64size=''
845 u64type=''
846 u8size=''
847 u8type=''
848 uvsize=''
849 uvtype=''
850 ivdformat=''
851 nvEUformat=''
852 nvFUformat=''
853 nvGUformat=''
854 nveformat=''
855 nvfformat=''
856 nvgformat=''
857 uvXUformat=''
858 uvoformat=''
859 uvuformat=''
860 uvxformat=''
861 pidtype=''
862 prefix=''
863 prefixexp=''
864 installprivlib=''
865 privlib=''
866 privlibexp=''
867 prototype=''
868 ptrsize=''
869 d_PRIXU64=''
870 d_PRId64=''
871 d_PRIi64=''
872 d_PRIo64=''
873 d_PRIu64=''
874 d_PRIx64=''
875 sPRIXU64=''
876 sPRId64=''
877 sPRIi64=''
878 sPRIo64=''
879 sPRIu64=''
880 sPRIx64=''
881 d_quad=''
882 quadkind=''
883 quadtype=''
884 uquadtype=''
885 drand01=''
886 randbits=''
887 randfunc=''
888 randseedtype=''
889 seedfunc=''
890 installscript=''
891 scriptdir=''
892 scriptdirexp=''
893 selectminbits=''
894 selecttype=''
895 sh=''
896 sig_count=''
897 sig_name=''
898 sig_name_init=''
899 sig_num=''
900 sig_num_init=''
901 sig_size=''
902 installsitearch=''
903 sitearch=''
904 sitearchexp=''
905 installsitebin=''
906 sitebin=''
907 sitebinexp=''
908 installsitelib=''
909 sitelib=''
910 sitelib_stem=''
911 sitelibexp=''
912 siteprefix=''
913 siteprefixexp=''
914 sizesize=''
915 sizetype=''
916 so=''
917 socksizetype=''
918 sharpbang=''
919 shsharp=''
920 spitshell=''
921 src=''
922 ssizetype=''
923 startperl=''
924 startsh=''
925 stdchar=''
926 d_stdio_stream_array=''
927 stdio_stream_array=''
928 sysman=''
929 trnl=''
930 uidformat=''
931 uidsign=''
932 uidsize=''
933 uidtype=''
934 archname64=''
935 use64bitall=''
936 use64bitint=''
937 ccflags_uselargefiles=''
938 ldflags_uselargefiles=''
939 libswanted_uselargefiles=''
940 uselargefiles=''
941 uselongdouble=''
942 usemorebits=''
943 usemultiplicity=''
944 nm_opt=''
945 nm_so_opt=''
946 runnm=''
947 usenm=''
948 useperlio=''
949 usesocks=''
950 d_oldpthreads=''
951 use5005threads=''
952 useithreads=''
953 usethreads=''
954 incpath=''
955 mips_type=''
956 usrinc=''
957 d_vendorarch=''
958 installvendorarch=''
959 vendorarch=''
960 vendorarchexp=''
961 d_vendorbin=''
962 installvendorbin=''
963 vendorbin=''
964 vendorbinexp=''
965 d_vendorlib=''
966 installvendorlib=''
967 vendorlib=''
968 vendorlib_stem=''
969 vendorlibexp=''
970 usevendorprefix=''
971 vendorprefix=''
972 vendorprefixexp=''
973 versiononly=''
974 defvoidused=''
975 voidflags=''
976 pm_apiversion=''
977 xs_apiversion=''
978 yacc=''
979 yaccflags=''
980 CONFIG=''
981
982 define='define'
983 undef='undef'
984 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
985 rmlist=''
986
987 : We must find out about Eunice early
988 eunicefix=':'
989 if test -f /etc/unixtovms; then
990         eunicefix=/etc/unixtovms
991 fi
992 if test -f /etc/unixtovms.exe; then
993         eunicefix=/etc/unixtovms.exe
994 fi
995
996 i_whoami=''
997 ccname=''
998 ccversion=''
999 perllibs=''
1000 : set useposix=false in your hint file to disable the POSIX extension.
1001 useposix=true
1002 : set useopcode=false in your hint file to disable the Opcode extension.
1003 useopcode=true
1004 : Trailing extension.  Override this in a hint file, if needed.
1005 _exe=''
1006 : Extra object files, if any, needed on this platform.
1007 archobjs=''
1008 archname=''
1009 : Possible local include directories to search.
1010 : Set locincpth to "" in a hint file to defeat local include searches.
1011 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1012 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1013 :
1014 : no include file wanted by default
1015 inclwanted=''
1016
1017 groupstype=''
1018 : change the next line if compiling for Xenix/286 on Xenix/386
1019 xlibpth='/usr/lib/386 /lib/386'
1020 : Possible local library directories to search.
1021 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1022 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1023
1024 : general looking path for locating libraries
1025 glibpth="/lib /usr/lib $xlibpth"
1026 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1027 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1028 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1029
1030 : Private path used by Configure to find libraries.  Its value
1031 : is prepended to libpth. This variable takes care of special
1032 : machines, like the mips.  Usually, it should be empty.
1033 plibpth=''
1034
1035 : default library list
1036 libswanted=''
1037 : some systems want to use only the non-versioned libso:s
1038 ignore_versioned_solibs=''
1039 archname64=''
1040 ccflags_uselargefiles=''
1041 ldflags_uselargefiles=''
1042 libswanted_uselargefiles=''
1043 : set usemultiplicity on the Configure command line to enable multiplicity.
1044 : set usesocks on the Configure command line to enable socks.
1045 : set usethreads on the Configure command line to enable threads.
1046 : full support for void wanted by default
1047 defvoidused=15
1048
1049 : List of libraries we want.
1050 : If anyone needs -lnet, put it in a hint file.
1051 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1052 libswanted="$libswanted dld ld sun m c cposix posix"
1053 libswanted="$libswanted ndir dir crypt sec"
1054 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1055 : We probably want to search /usr/shlib before most other libraries.
1056 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1057 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1058 glibpth="/usr/shlib $glibpth"
1059 : Do not use vfork unless overridden by a hint file.
1060 usevfork=false
1061
1062 : Find the basic shell for Bourne shell scripts
1063 case "$sh" in
1064 '')
1065         case "$SYSTYPE" in
1066         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1067         *) xxx='/bin/sh';;
1068         esac
1069         if test -f "$xxx"; then
1070                 sh="$xxx"
1071         else
1072                 : Build up a list and do a single loop so we can 'break' out.
1073                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1074                 for xxx in sh bash ksh pdksh ash; do
1075                         for p in $pth; do
1076                                 try="$try ${p}/${xxx}"
1077                         done
1078                 done
1079                 for xxx in $try; do
1080                         if test -f "$xxx"; then
1081                                 sh="$xxx";
1082                                 break
1083                         elif test -f "$xxx.exe"; then
1084                                 sh="$xxx";
1085                                 break
1086                         fi
1087                 done
1088         fi
1089         ;;
1090 esac
1091
1092 case "$sh" in
1093 '')     cat <<EOM >&2
1094 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1095
1096 Usually it's in /bin/sh.  How did you even get this far?
1097 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1098 we'll try to straighten this all out.
1099 EOM
1100         exit 1
1101         ;;
1102 esac
1103
1104 : see if sh knows # comments
1105 if `$sh -c '#' >/dev/null 2>&1`; then
1106         shsharp=true
1107         spitshell=cat
1108         xcat=/bin/cat
1109         test -f $xcat || xcat=/usr/bin/cat
1110         echo "#!$xcat" >try
1111         $eunicefix try
1112         chmod +x try
1113         ./try > today
1114         if test -s today; then
1115                 sharpbang='#!'
1116         else
1117                 echo "#! $xcat" > try
1118                 $eunicefix try
1119                 chmod +x try
1120                 ./try > today
1121                 if test -s today; then
1122                         sharpbang='#! '
1123                 else
1124                         sharpbang=': use '
1125                 fi
1126         fi
1127 else
1128         echo " "
1129         echo "Your $sh doesn't grok # comments--I will strip them later on."
1130         shsharp=false
1131         cd ..
1132         echo "exec grep -v '^[  ]*#'" >spitshell
1133         chmod +x spitshell
1134         $eunicefix spitshell
1135         spitshell=`pwd`/spitshell
1136         cd UU
1137         echo "I presume that if # doesn't work, #! won't work either!"
1138         sharpbang=': use '
1139 fi
1140 rm -f try today
1141
1142 : figure out how to guarantee sh startup
1143 case "$startsh" in
1144 '') startsh=${sharpbang}${sh} ;;
1145 *)
1146 esac
1147 cat >try <<EOSS
1148 $startsh
1149 set abc
1150 test "$?abc" != 1
1151 EOSS
1152
1153 chmod +x try
1154 $eunicefix try
1155 if ./try; then
1156         : echo "Yup, it does."
1157 else
1158         echo "Hmm... '$startsh' does not guarantee sh startup..."
1159         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1160 fi
1161 rm -f try
1162
1163
1164 : Save command line options in file UU/cmdline.opt for later use in
1165 : generating config.sh.
1166 cat > cmdline.opt <<EOSH
1167 # Configure command line arguments.
1168 config_arg0='$0'
1169 config_args='$*'
1170 config_argc=$#
1171 EOSH
1172 argn=1
1173 for arg in "$@"; do
1174         cat >>cmdline.opt <<EOSH
1175 config_arg$argn='$arg'
1176 EOSH
1177         argn=`expr $argn + 1`
1178 done
1179
1180 : produce awk script to parse command line options
1181 cat >options.awk <<'EOF'
1182 BEGIN {
1183         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1184
1185         len = length(optstr);
1186         for (i = 1; i <= len; i++) {
1187                 c = substr(optstr, i, 1);
1188                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1189                 if (a == ":") {
1190                         arg[c] = 1;
1191                         i++;
1192                 }
1193                 opt[c] = 1;
1194         }
1195 }
1196 {
1197         expect = 0;
1198         str = $0;
1199         if (substr(str, 1, 1) != "-") {
1200                 printf("'%s'\n", str);
1201                 next;
1202         }
1203         len = length($0);
1204         for (i = 2; i <= len; i++) {
1205                 c = substr(str, i, 1);
1206                 if (!opt[c]) {
1207                         printf("-%s\n", substr(str, i));
1208                         next;
1209                 }
1210                 printf("-%s\n", c);
1211                 if (arg[c]) {
1212                         if (i < len)
1213                                 printf("'%s'\n", substr(str, i + 1));
1214                         else
1215                                 expect = 1;
1216                         next;
1217                 }
1218         }
1219 }
1220 END {
1221         if (expect)
1222                 print "?";
1223 }
1224 EOF
1225
1226 : process the command line options
1227 set X `for arg in "$@"; do echo "X$arg"; done |
1228         sed -e s/X// | awk -f options.awk`
1229 eval "set $*"
1230 shift
1231 rm -f options.awk
1232
1233 : set up default values
1234 fastread=''
1235 reuseval=false
1236 config_sh=''
1237 alldone=''
1238 error=''
1239 silent=''
1240 extractsh=''
1241 override=''
1242 knowitall=''
1243 rm -f optdef.sh posthint.sh
1244 cat >optdef.sh <<EOS
1245 $startsh
1246 EOS
1247
1248
1249 : option parsing
1250 while test $# -gt 0; do
1251         case "$1" in
1252         -d) shift; fastread=yes;;
1253         -e) shift; alldone=cont;;
1254         -f)
1255                 shift
1256                 cd ..
1257                 if test -r "$1"; then
1258                         config_sh="$1"
1259                 else
1260                         echo "$me: cannot read config file $1." >&2
1261                         error=true
1262                 fi
1263                 cd UU
1264                 shift;;
1265         -h) shift; error=true;;
1266         -r) shift; reuseval=true;;
1267         -s) shift; silent=true; realsilent=true;;
1268         -E) shift; alldone=exit;;
1269         -K) shift; knowitall=true;;
1270         -O) shift; override=true;;
1271         -S) shift; silent=true; extractsh=true;;
1272         -D)
1273                 shift
1274                 case "$1" in
1275                 *=)
1276                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1277                         echo "$me: ignoring -D $1" >&2
1278                         ;;
1279                 *=*) echo "$1" | \
1280                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1281                 *) echo "$1='define'" >> optdef.sh;;
1282                 esac
1283                 shift
1284                 ;;
1285         -U)
1286                 shift
1287                 case "$1" in
1288                 *=) echo "$1" >> optdef.sh;;
1289                 *=*)
1290                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1291                         echo "$me: ignoring -U $1" >&2
1292                         ;;
1293                 *) echo "$1='undef'" >> optdef.sh;;
1294                 esac
1295                 shift
1296                 ;;
1297         -A)
1298             shift
1299             xxx=''
1300             yyy="$1"
1301             zzz=''
1302             uuu=undef
1303             case "$yyy" in
1304             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1305                  case "$zzz" in
1306                  *:*) zzz='' ;;
1307                  *)   xxx=append
1308                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1309                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1310                  esac
1311                  ;;
1312             esac
1313             case "$xxx" in
1314             '')  case "$yyy" in
1315                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1316                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1317                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1318                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1319                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1320                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1321                  esac
1322                  ;;       
1323             esac
1324             case "$xxx" in
1325             append)
1326                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1327             clear)
1328                 echo "$yyy=''"                  >> posthint.sh ;;
1329             define)
1330                 case "$zzz" in
1331                 '') zzz=define ;;
1332                 esac
1333                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1334             eval)
1335                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1336             prepend)
1337                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1338             undef)
1339                 case "$zzz" in
1340                 '') zzz="$uuu" ;;
1341                 esac
1342                 echo "$yyy=$zzz"                >> posthint.sh ;;
1343             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1344             esac
1345             shift
1346             ;;
1347         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1348             exit 0;;
1349         --) break;;
1350         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1351         *) break;;
1352         esac
1353 done
1354
1355 case "$error" in
1356 true)
1357         cat >&2 <<EOM
1358 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1359                  [-U symbol] [-U symbol=] [-A command:symbol...]
1360   -d : use defaults for all answers.
1361   -e : go on without questioning past the production of config.sh.
1362   -f : specify an alternate default configuration file.
1363   -h : print this help message and exit (with an error status).
1364   -r : reuse C symbols value if possible (skips costly nm extraction).
1365   -s : silent mode, only echoes questions and essential information.
1366   -D : define symbol to have some value:
1367          -D symbol         symbol gets the value 'define'
1368          -D symbol=value   symbol gets the value 'value'
1369   -E : stop at the end of questions, after having produced config.sh.
1370   -K : do not use unless you know what you are doing.
1371   -O : let -D and -U override definitions from loaded configuration file.
1372   -S : perform variable substitutions on all .SH files (can mix with -f)
1373   -U : undefine symbol:
1374          -U symbol    symbol gets the value 'undef'
1375          -U symbol=   symbol gets completely empty
1376   -A : manipulate symbol after the platform specific hints have been applied:
1377          -A symbol=value                append " "value to symbol
1378          -A append:symbol=value         append value to symbol
1379          -A define:symbol=value         define symbol to have value
1380          -A clear:symbol                define symbol to be ''
1381          -A define:symbol               define symbol to be 'define'
1382          -A eval:symbol=value           define symbol to be eval of value
1383          -A prepend:symbol=value        prepend value to symbol
1384          -A undef:symbol                define symbol to be 'undef'
1385          -A undef:symbol=               define symbol to be ''
1386   -V : print version number and exit (with a zero status).
1387 EOM
1388         exit 1
1389         ;;
1390 esac
1391
1392 : Sanity checks
1393 case "$fastread$alldone" in
1394 yescont|yesexit) ;;
1395 *)
1396         case "$extractsh" in
1397         true) ;;
1398         *)
1399                 if test ! -t 0; then
1400                         echo "Say 'sh Configure', not 'sh <Configure'"
1401                         exit 1
1402                 fi
1403                 ;;
1404         esac
1405         ;;
1406 esac
1407
1408 exec 4>&1
1409 case "$silent" in
1410 true) exec 1>/dev/null;;
1411 esac
1412
1413 : run the defines and the undefines, if any, but leave the file out there...
1414 touch optdef.sh
1415 . ./optdef.sh
1416 : create the posthint manipulation script and leave the file out there...
1417 touch posthint.sh
1418
1419 : set package name
1420 package=perl5
1421 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1422 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1423 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1424 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1425 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1426 esac
1427
1428 : Some greps do not return status, grrr.
1429 echo "grimblepritz" >grimble
1430 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1431         contains=contains
1432 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1433         contains=grep
1434 else
1435         contains=contains
1436 fi
1437 rm -f grimble
1438 : the following should work in any shell
1439 case "$contains" in
1440 contains*)
1441         echo " "
1442         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1443         cat >contains <<'EOSS'
1444 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1445 EOSS
1446 chmod +x contains
1447 esac
1448
1449 : Find the path to the source tree
1450 case "$src" in
1451 '') case "$0" in
1452     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1453          case "$src" in
1454          /*)    ;;
1455          .)     ;;
1456          *)     src=`cd ../$src && pwd` ;;
1457          esac
1458          ;;
1459     *)   src='.';;
1460     esac;;
1461 esac
1462 case "$src" in
1463 '')     src=/
1464         rsrc=/
1465         ;;
1466 /*) rsrc="$src";;
1467 *) rsrc="../$src";;
1468 esac
1469 if test -f $rsrc/Configure && \
1470         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1471 then
1472    : found it, so we are ok.
1473 else
1474         rsrc=''
1475         for src in . .. ../.. ../../.. ../../../..; do
1476                 if test -f ../$src/Configure && \
1477                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1478                 then
1479                         rsrc=../$src
1480                         break
1481                 fi
1482         done
1483 fi
1484 case "$rsrc" in
1485 '')
1486         cat <<EOM >&4
1487
1488 Sorry, I can't seem to locate the source dir for $package.  Please start
1489 Configure with an explicit path -- i.e. /some/path/Configure.
1490
1491 EOM
1492         exit 1
1493         ;;
1494 ../.)   rsrc='..';;
1495 *)
1496         echo " "
1497         echo "Sources for $package found in \"$src\"." >&4
1498         ;;
1499 esac
1500
1501 : script used to extract .SH files with variable substitutions
1502 cat >extract <<'EOS'
1503 PERL_CONFIG_SH=true
1504 echo "Doing variable substitutions on .SH files..."
1505 if test -f $src/MANIFEST; then
1506         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1507 else
1508         echo "(Looking for .SH files under the source directory.)"
1509         set x `(cd $src; find . -name "*.SH" -print)`
1510 fi
1511 shift
1512 case $# in
1513 0) set x `(cd $src; echo *.SH)`; shift;;
1514 esac
1515 if test ! -f $src/$1; then
1516         shift
1517 fi
1518 mkdir_p='
1519 name=$1;
1520 create="";
1521 while test $name; do
1522         if test ! -d "$name"; then
1523                 create="$name $create";
1524                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1525                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1526         else
1527                 name="";
1528         fi;
1529 done;
1530 for file in $create; do
1531         mkdir $file;
1532 done
1533 '
1534 for file in $*; do
1535         case "$src" in
1536         ".")
1537                 case "$file" in
1538                 */*)
1539                         dir=`expr X$file : 'X\(.*\)/'`
1540                         file=`expr X$file : 'X.*/\(.*\)'`
1541                         (cd $dir && . ./$file)
1542                         ;;
1543                 *)
1544                         . ./$file
1545                         ;;
1546                 esac
1547                 ;;
1548         *)
1549                 case "$file" in
1550                 */*)
1551                         dir=`expr X$file : 'X\(.*\)/'`
1552                         file=`expr X$file : 'X.*/\(.*\)'`
1553                         (set x $dir; shift; eval $mkdir_p)
1554                         sh <$src/$dir/$file
1555                         ;;
1556                 *)
1557                         sh <$src/$file
1558                         ;;
1559                 esac
1560                 ;;
1561         esac
1562 done
1563 if test -f $src/config_h.SH; then
1564         if test ! -f config.h; then
1565         : oops, they left it out of MANIFEST, probably, so do it anyway.
1566         . $src/config_h.SH
1567         fi
1568 fi
1569 EOS
1570
1571 : extract files and exit if asked to do so
1572 case "$extractsh" in
1573 true)
1574         case "$realsilent" in
1575         true) ;;
1576         *) exec 1>&4;;
1577         esac
1578         case "$config_sh" in
1579         '') config_sh='config.sh';;
1580         esac
1581         echo " "
1582         echo "Fetching answers from $config_sh..."
1583         cd ..
1584         . $config_sh
1585         test "$override" && . ./optdef.sh
1586         echo " "
1587         . UU/extract
1588         rm -rf UU
1589         echo "Done."
1590         exit 0
1591         ;;
1592 esac
1593
1594 : Eunice requires " " instead of "", can you believe it
1595 echo " "
1596 : Here we go...
1597 echo "Beginning of configuration questions for $package."
1598
1599 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1600
1601 : first determine how to suppress newline on echo command
1602 echo " "
1603 echo "Checking echo to see how to suppress newlines..."
1604 (echo "hi there\c" ; echo " ") >.echotmp
1605 if $contains c .echotmp >/dev/null 2>&1 ; then
1606         echo "...using -n."
1607         n='-n'
1608         c=''
1609 else
1610         cat <<'EOM'
1611 ...using \c
1612 EOM
1613         n=''
1614         c='\c'
1615 fi
1616 echo $n "The star should be here-->$c"
1617 echo '*'
1618 rm -f .echotmp
1619
1620 : Now test for existence of everything in MANIFEST
1621 echo " "
1622 if test -f $rsrc/MANIFEST; then
1623         echo "First let's make sure your kit is complete.  Checking..." >&4
1624         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1625         rm -f missing
1626         tmppwd=`pwd`
1627         for filelist in x??; do
1628                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1629         done
1630         if test -s missing; then
1631                 cat missing >&4
1632                 cat >&4 <<'EOM'
1633
1634 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1635
1636 You have the option of continuing the configuration process, despite the
1637 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1638 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1639 and contact the author (perlbug@perl.org).
1640
1641 EOM
1642                 echo $n "Continue? [n] $c" >&4
1643                 read ans
1644                 case "$ans" in
1645                 y*)
1646                         echo "Continuing..." >&4
1647                         rm -f missing
1648                         ;;
1649                 *)
1650                         echo "ABORTING..." >&4
1651                         kill $$
1652                         ;;
1653                 esac
1654         else
1655                 echo "Looks good..."
1656         fi
1657 else
1658         echo "There is no MANIFEST file.  I hope your kit is complete !"
1659 fi
1660 rm -f missing x??
1661
1662 echo " "
1663 : Find the appropriate value for a newline for tr
1664 if test -n "$DJGPP"; then
1665        trnl='\012'
1666 fi
1667 if test X"$trnl" = X; then
1668         case "`echo foo|tr '\n' x 2>/dev/null`" in
1669         foox) trnl='\n' ;;
1670         esac
1671 fi
1672 if test X"$trnl" = X; then
1673         case "`echo foo|tr '\012' x 2>/dev/null`" in
1674         foox) trnl='\012' ;;
1675         esac
1676 fi
1677 if test X"$trnl" = X; then
1678         cat <<EOM >&2
1679
1680 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1681
1682 EOM
1683         exit 1
1684 fi
1685
1686 : compute the number of columns on the terminal for proper question formatting
1687 case "$COLUMNS" in
1688 '') COLUMNS='80';;
1689 esac
1690
1691 : set up the echo used in my read
1692 myecho="case \"\$xxxm\" in
1693 '') echo $n \"\$rp $c\" >&4;;
1694 *) case \"\$rp\" in
1695         '') echo $n \"[\$xxxm] $c\";;
1696         *)
1697                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1698                         echo \"\$rp\" >&4
1699                         echo $n \"[\$xxxm] $c\" >&4
1700                 else
1701                         echo $n \"\$rp [\$xxxm] $c\" >&4
1702                 fi
1703                 ;;
1704         esac;;
1705 esac"
1706
1707 : now set up to do reads with possible shell escape and default assignment
1708 cat <<EOSC >myread
1709 $startsh
1710 xxxm=\$dflt
1711 $myecho
1712 ans='!'
1713 case "\$fastread" in
1714 yes) case "\$dflt" in
1715         '') ;;
1716         *) ans='';
1717                 case "\$silent-\$rp" in
1718                 true-) ;;
1719                 *) echo " " >&4;;
1720                 esac;;
1721         esac;;
1722 *) case "\$silent" in
1723         true) case "\$rp" in
1724                 '') ans='';;
1725                 esac;;
1726         esac;;
1727 esac
1728 while expr "X\$ans" : "X!" >/dev/null; do
1729         read answ
1730         set x \$xxxm
1731         shift
1732         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1733         case  "\$answ" in
1734         "!")
1735                 sh 1>&4
1736                 echo " "
1737                 $myecho
1738                 ;;
1739         !*)
1740                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1741                 shift
1742                 sh 1>&4 -c "\$*"
1743                 echo " "
1744                 $myecho
1745                 ;;
1746         "\$ans")
1747                 case "\$ans" in
1748                 \\&*)
1749                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1750                         shift
1751                         case "\$1" in
1752                         -d)
1753                                 fastread=yes
1754                                 echo "(OK, I'll run with -d after this question.)" >&4
1755                                 ;;
1756                         -*)
1757                                 echo "*** Sorry, \$1 not supported yet." >&4
1758                                 ;;
1759                         esac
1760                         $myecho
1761                         ans=!
1762                         ;;
1763                 esac;;
1764         *)
1765                 case "\$aok" in
1766                 y)
1767                         echo "*** Substitution done -- please confirm."
1768                         xxxm="\$ans"
1769                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1770                         xxxm="\$ans"
1771                         ans=!
1772                         ;;
1773                 *)
1774                         echo "*** Error -- try again."
1775                         ans=!
1776                         ;;
1777                 esac
1778                 $myecho
1779                 ;;
1780         esac
1781         case "\$ans\$xxxm\$nostick" in
1782         '')
1783                 ans=!
1784                 $myecho
1785                 ;;
1786         esac
1787 done
1788 case "\$ans" in
1789 '') ans="\$xxxm";;
1790 esac
1791 EOSC
1792
1793 : create .config dir to save info across Configure sessions
1794 test -d ../.config || mkdir ../.config
1795 cat >../.config/README <<EOF
1796 This directory created by Configure to save information that should
1797 persist across sessions for $package.
1798
1799 You may safely delete it if you wish.
1800 EOF
1801
1802 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1803 case "$usedevel" in
1804 $define|true|[yY]*) ;;
1805 *) case "$xversion" in
1806    *[13579])
1807         cat >&4 <<EOH
1808 *** WHOA THERE!!! ***
1809
1810     This is an UNSTABLE DEVELOPMENT release.
1811     The version of this $package distribution is $xversion, that is, odd,
1812     (as opposed to even) and that signifies a development release.
1813     If you want a maintenance release, you want an even-numbered version.
1814
1815     Do ***NOT*** install this into production use.
1816     Data corruption and crashes are possible.
1817
1818     It is most seriously suggested that you do not continue any further
1819     unless you want to help in developing and debugging Perl.
1820
1821     If you *still* want to build perl, you can answer 'y' now,
1822     or pass -Dusedevel to Configure.
1823
1824 EOH
1825         rp='Do you really want to continue?'
1826         dflt='n'
1827         . ./myread
1828         case "$ans" in
1829         [yY]) echo >&4 "Okay, continuing."
1830               usedevel="$define" ;;
1831         *) echo >&4 "Okay, bye."
1832            exit 1
1833            ;;
1834         esac
1835         ;;
1836     esac
1837     ;;
1838 esac
1839 case "$usedevel" in
1840 $define|true|[yY]*)
1841         case "$versiononly" in
1842         '') versiononly="$define" ;;
1843         esac
1844         case "$installusrbinperl" in
1845         '') installusrbinperl="$undef" ;;
1846         esac
1847         ;;
1848 esac
1849
1850 : general instructions
1851 needman=true
1852 firsttime=true
1853 user=`(logname) 2>/dev/null`
1854 case "$user" in
1855 '') user=`whoami 2>&1`;;
1856 esac
1857 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1858         firsttime=false
1859         echo " "
1860         rp='Would you like to see the instructions?'
1861         dflt=n
1862         . ./myread
1863         case "$ans" in
1864         [yY]*) ;;
1865         *) needman=false;;
1866         esac
1867 fi
1868 if $needman; then
1869         cat <<EOH
1870
1871 This installation shell script will examine your system and ask you questions
1872 to determine how the perl5 package should be installed. If you get
1873 stuck on a question, you may use a ! shell escape to start a subshell or
1874 execute a command.  Many of the questions will have default answers in square
1875 brackets; typing carriage return will give you the default.
1876
1877 On some of the questions which ask for file or directory names you are allowed
1878 to use the ~name construct to specify the login directory belonging to "name",
1879 even if you don't have a shell which knows about that.  Questions where this is
1880 allowed will be marked "(~name ok)".
1881
1882 EOH
1883         rp=''
1884         dflt='Type carriage return to continue'
1885         . ./myread
1886         cat <<'EOH'
1887
1888 The prompter used in this script allows you to use shell variables and
1889 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1890 in the default answer, as if the default line was a set of arguments given to a
1891 script shell.  This means you may also use $* to repeat the whole default line,
1892 so you do not have to re-type everything to add something to the default.
1893
1894 Everytime there is a substitution, you will have to confirm.  If there is an
1895 error (e.g. an unmatched backtick), the default answer will remain unchanged
1896 and you will be prompted again.
1897
1898 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1899 the questions and use the computed defaults (or the previous answers if there
1900 was already a config.sh file). Type 'Configure -h' for a list of options.
1901 You may also start interactively and then answer '& -d' at any prompt to turn
1902 on the non-interactive behaviour for the remainder of the execution.
1903
1904 EOH
1905         . ./myread
1906         cat <<EOH
1907
1908 Much effort has been expended to ensure that this shell script will run on any
1909 Unix system.  If despite that it blows up on yours, your best bet is to edit
1910 Configure and run it again.  If you can't run Configure for some reason,
1911 you'll have to generate a config.sh file by hand.  Whatever problems you
1912 have, let me (perlbug@perl.org) know how I blew it.
1913
1914 This installation script affects things in two ways:
1915
1916 1) it may do direct variable substitutions on some of the files included
1917    in this kit.
1918 2) it builds a config.h file for inclusion in C programs.  You may edit
1919    any of these files as the need arises after running this script.
1920
1921 If you make a mistake on a question, there is no easy way to back up to it
1922 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1923 files.  Configure will offer to let you do this before it runs the SH files.
1924
1925 EOH
1926         dflt='Type carriage return to continue'
1927         . ./myread
1928         case "$firsttime" in
1929         true) echo $user >>../.config/instruct;;
1930         esac
1931 fi
1932
1933 : find out where common programs are
1934 echo " "
1935 echo "Locating common programs..." >&4
1936 cat <<EOSC >loc
1937 $startsh
1938 case \$# in
1939 0) exit 1;;
1940 esac
1941 thing=\$1
1942 shift
1943 dflt=\$1
1944 shift
1945 for dir in \$*; do
1946         case "\$thing" in
1947         .)
1948         if test -d \$dir/\$thing; then
1949                 echo \$dir
1950                 exit 0
1951         fi
1952         ;;
1953         *)
1954         for thisthing in \$dir/\$thing; do
1955                 : just loop through to pick last item
1956         done
1957         if test -f \$thisthing; then
1958                 echo \$thisthing
1959                 exit 0
1960         elif test -f \$dir/\$thing.exe; then
1961                 if test -n "$DJGPP"; then
1962                         echo \$dir/\$thing.exe
1963                 else
1964                         : on Eunice apparently
1965                         echo \$dir/\$thing
1966                 fi
1967                 exit 0
1968         fi
1969         ;;
1970         esac
1971 done
1972 echo \$dflt
1973 exit 1
1974 EOSC
1975 chmod +x loc
1976 $eunicefix loc
1977 loclist="
1978 awk
1979 cat
1980 comm
1981 cp
1982 echo
1983 expr
1984 grep
1985 ls
1986 make
1987 mkdir
1988 rm
1989 sed
1990 sort
1991 touch
1992 tr
1993 uniq
1994 "
1995 trylist="
1996 Mcc
1997 ar
1998 bison
1999 byacc
2000 cpp
2001 csh
2002 date
2003 egrep
2004 gzip
2005 less
2006 ln
2007 more
2008 nm
2009 nroff
2010 pg
2011 test
2012 uname
2013 zip
2014 "
2015 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2016 pth="$pth /lib /usr/lib"
2017 for file in $loclist; do
2018         eval xxx=\$$file
2019         case "$xxx" in
2020         /*|?:[\\/]*)
2021                 if test -f "$xxx"; then
2022                         : ok
2023                 else
2024                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2025                         xxx=`./loc $file $file $pth`
2026                 fi
2027                 ;;
2028         '') xxx=`./loc $file $file $pth`;;
2029         *) xxx=`./loc $xxx $xxx $pth`;;
2030         esac
2031         eval $file=$xxx
2032         eval _$file=$xxx
2033         case "$xxx" in
2034         /*)
2035                 echo $file is in $xxx.
2036                 ;;
2037         ?:[\\/]*)
2038                 echo $file is in $xxx.
2039                 ;;
2040         *)
2041                 echo "I don't know where '$file' is, and my life depends on it." >&4
2042                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2043                 exit 1
2044                 ;;
2045         esac
2046 done
2047 echo " "
2048 echo "Don't worry if any of the following aren't found..."
2049 say=offhand
2050 for file in $trylist; do
2051         eval xxx=\$$file
2052         case "$xxx" in
2053         /*|?:[\\/]*)
2054                 if test -f "$xxx"; then
2055                         : ok
2056                 else
2057                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2058                         xxx=`./loc $file $file $pth`
2059                 fi
2060                 ;;
2061         '') xxx=`./loc $file $file $pth`;;
2062         *) xxx=`./loc $xxx $xxx $pth`;;
2063         esac
2064         eval $file=$xxx
2065         eval _$file=$xxx
2066         case "$xxx" in
2067         /*)
2068                 echo $file is in $xxx.
2069                 ;;
2070         ?:[\\/]*)
2071                 echo $file is in $xxx.
2072                 ;;
2073         *)
2074                 echo "I don't see $file out there, $say."
2075                 say=either
2076                 ;;
2077         esac
2078 done
2079 case "$egrep" in
2080 egrep)
2081         echo "Substituting grep for egrep."
2082         egrep=$grep
2083         ;;
2084 esac
2085 case "$ln" in
2086 ln)
2087         echo "Substituting cp for ln."
2088         ln=$cp
2089         ;;
2090 esac
2091 case "$test" in
2092 test)
2093         echo "Hopefully test is built into your sh."
2094         ;;
2095 *)
2096         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2097                 echo "Using the test built into your sh."
2098                 test=test
2099                 _test=test
2100         fi
2101         ;;
2102 esac
2103 case "$echo" in
2104 echo)
2105         echo "Hopefully echo is built into your sh."
2106         ;;
2107 '') ;;
2108 *)
2109         echo " "
2110 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2111         $echo $n "hi there$c" >foo1
2112         echo $n "hi there$c" >foo2
2113         if cmp foo1 foo2 >/dev/null 2>&1; then
2114                 echo "They are compatible.  In fact, they may be identical."
2115         else
2116                 case "$n" in
2117                 '-n') n='' c='\c';;
2118                 *) n='-n' c='';;
2119                 esac
2120                 cat <<FOO
2121 They are not compatible!  You are probably running ksh on a non-USG system.
2122 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2123 have echo built in and we may have to run some Bourne shell scripts.  That
2124 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2125
2126 FOO
2127                 $echo $n "The star should be here-->$c"
2128                 $echo "*"
2129         fi
2130         $rm -f foo1 foo2
2131         ;;
2132 esac
2133
2134 cat <<EOS >checkcc
2135 $startsh
2136 EOS
2137 cat <<'EOSC' >>checkcc
2138 case "$cc" in
2139 '') ;;
2140 *)  $rm -f try try.*
2141     $cat >try.c <<EOM
2142 int main(int argc, char *argv[]) {
2143   return 0;
2144 }
2145 EOM
2146     if $cc -o try $ccflags $ldflags try.c; then
2147        :
2148     else
2149         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2150         despair=yes
2151         trygcc=yes
2152         case "$cc" in
2153         *gcc*) trygcc=no ;;
2154         esac
2155         case "`$cc -v -c try.c 2>&1`" in
2156         *gcc*) trygcc=no ;;
2157         esac
2158         if $test X"$trygcc" = Xyes; then
2159             if gcc -o try -c try.c; then
2160                 echo " "
2161                 echo "You seem to have a working gcc, though." >&4
2162                 rp="Would you like to use it?"
2163                 dflt=y
2164                 if $test -f myread; then
2165                     . ./myread
2166                 else
2167                     if $test -f UU/myread; then
2168                         . ./UU/myread
2169                     else
2170                         echo "Cannot find myread, sorry.  Aborting." >&2
2171                         exit 1
2172                     fi
2173                 fi  
2174                 case "$ans" in
2175                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2176                 esac
2177             fi
2178         fi
2179         if $test X"$despair" = Xyes; then
2180             $cat >&4 <<EOM
2181 You need to find a working C compiler.
2182 Either (purchase and) install the C compiler supplied by your OS vendor,
2183 or for a free C compiler try http://gcc.gnu.org/
2184 I cannot continue any further, aborting.
2185 EOM
2186             exit 1
2187         fi
2188     fi
2189     $rm -f try try.*
2190     ;;
2191 esac
2192 EOSC
2193
2194 : determine whether symbolic links are supported
2195 echo " "
2196 $touch blurfl
2197 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2198         echo "Symbolic links are supported." >&4
2199         lns="$ln -s"
2200 else
2201         echo "Symbolic links are NOT supported." >&4
2202         lns="$ln"
2203 fi
2204 $rm -f blurfl sym
2205
2206 : determine whether symbolic links are supported
2207 echo " "
2208 case "$lns" in
2209 *"ln -s")
2210         echo "Checking how to test for symbolic links..." >&4
2211         $lns blurfl sym
2212         if $test "X$issymlink" = X; then
2213                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2214                 if test $? = 0; then
2215                         issymlink="test -h"
2216                 fi              
2217         fi
2218         if $test "X$issymlink" = X; then
2219                 if  $test -h >/dev/null 2>&1; then
2220                         issymlink="$test -h"
2221                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2222                 fi              
2223         fi
2224         if $test "X$issymlink" = X; then
2225                 if $test -L sym 2>/dev/null; then
2226                         issymlink="$test -L"
2227                 fi
2228         fi
2229         if $test "X$issymlink" != X; then
2230                 echo "You can test for symbolic links with '$issymlink'." >&4
2231         else
2232                 echo "I do not know how you can test for symbolic links." >&4
2233         fi
2234         $rm -f blurfl sym
2235         ;;
2236 *)      echo "No symbolic links, so not testing for their testing..." >&4
2237         ;;
2238 esac
2239 echo " "
2240
2241
2242 case "$mksymlinks" in
2243 $define|true|[yY]*)
2244         case "$src" in
2245         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2246                 exit 1
2247                 ;;
2248         *)      case "$lns:$issymlink" in
2249                 *"ln -s:"*"test -"?)
2250                         echo "Creating the symbolic links..." >&4
2251                         echo "(First creating the subdirectories...)" >&4
2252                         cd ..
2253                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2254                                 read directory
2255                                 test -z "$directory" && break
2256                                 mkdir -p $directory
2257                         done
2258                         # Sanity check 1.
2259                         if test ! -d t/base; then
2260                                 echo "Failed to create the subdirectories.  Aborting." >&4
2261                                 exit 1
2262                         fi
2263                         echo "(Then creating the symlinks...)" >&4
2264                         awk '{print $1}' $src/MANIFEST | while true; do
2265                                 read filename
2266                                 test -z "$filename" && break
2267                                 if test -f $filename; then
2268                                         if $issymlink $filename; then
2269                                                 rm -f $filename
2270                                         fi
2271                                 fi
2272                                 if test -f $filename; then
2273                                         echo "$filename already exists, not symlinking."
2274                                 else
2275                                         ln -s $src/$filename $filename
2276                                 fi
2277                         done
2278                         # Sanity check 2.
2279                         if test ! -f t/base/commonsense.t; then
2280                                 echo "Failed to create the symlinks.  Aborting." >&4
2281                                 exit 1
2282                         fi
2283                         cd UU
2284                         ;;
2285                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2286                         ;;
2287                 esac
2288                 ;;
2289         esac
2290         ;;
2291 esac
2292
2293 : see whether [:lower:] and [:upper:] are supported character classes
2294 echo " "
2295 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2296 ABYZ)
2297         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2298         up='[:upper:]'
2299         low='[:lower:]'
2300         ;;
2301 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2302         # (0xc9 and 0xd1), therefore that is a nice testing point.
2303         if test "X$up" = X -o "X$low" = X; then
2304             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2305             ij) up='[A-Z]'
2306                 low='[a-z]'
2307                 ;;
2308             esac
2309         fi
2310         if test "X$up" = X -o "X$low" = X; then
2311             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2312             ij) up='A-Z'
2313                 low='a-z'
2314                 ;;
2315             esac
2316         fi
2317         if test "X$up" = X -o "X$low" = X; then
2318             case "`echo IJ | od -x 2>/dev/null`" in
2319             *C9D1*|*c9d1*)
2320                 echo "Hey, this might be EBCDIC." >&4
2321                 if test "X$up" = X -o "X$low" = X; then
2322                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2323                     ij) up='[A-IJ-RS-Z]'
2324                         low='[a-ij-rs-z]'
2325                         ;;
2326                     esac
2327                 fi
2328                 if test "X$up" = X -o "X$low" = X; then
2329                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2330                     ij) up='A-IJ-RS-Z'
2331                         low='a-ij-rs-z'
2332                         ;;
2333                     esac
2334                 fi
2335                 ;;
2336             esac
2337         fi
2338 esac
2339 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2340 ij)
2341     echo "Using $up and $low to convert case." >&4
2342     ;;
2343 *)
2344     echo "I don't know how to translate letters from upper to lower case." >&4
2345     echo "Your tr is not acting any way I know of." >&4
2346     exit 1
2347     ;;
2348 esac
2349 : set up the translation script tr, must be called with ./tr of course
2350 cat >tr <<EOSC
2351 $startsh
2352 case "\$1\$2" in
2353 '[A-Z][a-z]') exec $tr '$up' '$low';;
2354 '[a-z][A-Z]') exec $tr '$low' '$up';;
2355 esac
2356 exec $tr "\$@"
2357 EOSC
2358 chmod +x tr
2359 $eunicefix tr
2360
2361 : Try to determine whether config.sh was made on this system
2362 case "$config_sh" in
2363 '')
2364 myuname=`$uname -a 2>/dev/null`
2365 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2366 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2367 # because the A-Z/a-z are not consecutive.
2368 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2369         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2370 newmyuname="$myuname"
2371 dflt=n
2372 case "$knowitall" in
2373 '')
2374         if test -f ../config.sh; then
2375                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2376                         eval "`grep myuname= ../config.sh`"
2377                 fi
2378                 if test "X$myuname" = "X$newmyuname"; then
2379                         dflt=y
2380                 fi
2381         fi
2382         ;;
2383 *) dflt=y;;
2384 esac
2385
2386 : Get old answers from old config file if Configure was run on the
2387 : same system, otherwise use the hints.
2388 hint=default
2389 cd ..
2390 if test -f config.sh; then
2391         echo " "
2392         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2393         . UU/myread
2394         case "$ans" in
2395         n*|N*) echo "OK, I'll ignore it."
2396                 mv config.sh config.sh.old
2397                 myuname="$newmyuname"
2398                 ;;
2399         *)  echo "Fetching default answers from your old config.sh file..." >&4
2400                 tmp_n="$n"
2401                 tmp_c="$c"
2402                 tmp_sh="$sh"
2403                 . ./config.sh
2404                 cp config.sh UU
2405                 n="$tmp_n"
2406                 c="$tmp_c"
2407                 : Older versions did not always set $sh.  Catch re-use of such
2408                 : an old config.sh.
2409                 case "$sh" in
2410                 '') sh="$tmp_sh" ;;
2411                 esac
2412                 hint=previous
2413                 ;;
2414         esac
2415 fi
2416 . ./UU/checkcc
2417 if test ! -f config.sh; then
2418         $cat <<EOM
2419
2420 First time through, eh?  I have some defaults handy for some systems
2421 that need some extra help getting the Configure answers right:
2422
2423 EOM
2424         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2425         dflt=''
2426         : Half the following guesses are probably wrong... If you have better
2427         : tests or hints, please send them to perlbug@perl.org
2428         : The metaconfig authors would also appreciate a copy...
2429         $test -f /irix && osname=irix
2430         $test -f /xenix && osname=sco_xenix
2431         $test -f /dynix && osname=dynix
2432         $test -f /dnix && osname=dnix
2433         $test -f /lynx.os && osname=lynxos
2434         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2435         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2436         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2437         $test -f /bin/mips && /bin/mips && osname=mips
2438         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2439                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2440         $test -d /usr/apollo/bin && osname=apollo
2441         $test -f /etc/saf/_sactab && osname=svr4
2442         $test -d /usr/include/minix && osname=minix
2443         if $test -d /MachTen -o -d /MachTen_Folder; then
2444                 osname=machten
2445                 if $test -x /sbin/version; then
2446                         osvers=`/sbin/version | $awk '{print $2}' |
2447                         $sed -e 's/[A-Za-z]$//'`
2448                 elif $test -x /usr/etc/version; then
2449                         osvers=`/usr/etc/version | $awk '{print $2}' |
2450                         $sed -e 's/[A-Za-z]$//'`
2451                 else
2452                         osvers="$2.$3"
2453                 fi
2454         fi
2455
2456         $test -f /sys/posix.dll &&
2457                 $test -f /usr/bin/what &&
2458                 set X `/usr/bin/what /sys/posix.dll` &&
2459                 $test "$3" = UWIN &&
2460                 osname=uwin &&
2461                 osvers="$5"
2462
2463         if $test -f $uname; then
2464                 set X $myuname
2465                 shift
2466
2467                 case "$5" in
2468                 fps*) osname=fps ;;
2469                 mips*)
2470                         case "$4" in
2471                         umips) osname=umips ;;
2472                         *) osname=mips ;;
2473                         esac;;
2474                 [23]100) osname=mips ;;
2475                 next*) osname=next ;;
2476                 i386*)
2477                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2478                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2479                                 osname='sco'
2480                                 osvers=$tmp
2481                         elif $test -f /etc/kconfig; then
2482                                 osname=isc
2483                                 if test "$lns" = "$ln -s"; then
2484                                         osvers=4
2485                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2486                                         osvers=3
2487                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2488                                         osvers=2
2489                                 fi
2490                         fi
2491                         tmp=''
2492                         ;;
2493                 pc*)
2494                         if test -n "$DJGPP"; then
2495                                 osname=dos
2496                                 osvers=djgpp
2497                         fi
2498                         ;;
2499                 esac
2500
2501                 case "$1" in
2502                 aix) osname=aix
2503                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2504                         case "$tmp" in
2505                         'not found') osvers="$4"."$3" ;;
2506                         '<3240'|'<>3240') osvers=3.2.0 ;;
2507                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2508                         '=3250'|'>3250') osvers=3.2.5 ;;
2509                         *) osvers=$tmp;;
2510                         esac
2511                         ;;
2512                 bsd386) osname=bsd386
2513                         osvers=`$uname -r`
2514                         ;;
2515                 cygwin*) osname=cygwin
2516                         osvers="$3"
2517                         ;;
2518                 *dc.osx) osname=dcosx
2519                         osvers="$3"
2520                         ;;
2521                 dnix) osname=dnix
2522                         osvers="$3"
2523                         ;;
2524                 domainos) osname=apollo
2525                         osvers="$3"
2526                         ;;
2527                 dgux) osname=dgux 
2528                         osvers="$3"
2529                         ;;
2530                 dynixptx*) osname=dynixptx
2531                         osvers=`echo "$4"|sed 's/^v//'`
2532                         ;;
2533                 freebsd) osname=freebsd 
2534                         osvers="$3" ;;
2535                 genix) osname=genix ;;
2536                 hp*) osname=hpux 
2537                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2538                         ;;
2539                 irix*) osname=irix
2540                         case "$3" in
2541                         4*) osvers=4 ;;
2542                         5*) osvers=5 ;;
2543                         *)      osvers="$3" ;;
2544                         esac
2545                         ;;
2546                 linux) osname=linux
2547                         case "$3" in
2548                         *)      osvers="$3" ;;
2549                         esac
2550                         ;;
2551                 MiNT) osname=mint
2552                         ;;
2553                 netbsd*) osname=netbsd
2554                         osvers="$3"
2555                         ;;
2556                 news-os) osvers="$3"
2557                         case "$3" in
2558                         4*) osname=newsos4 ;;
2559                         *) osname=newsos ;;
2560                         esac
2561                         ;;
2562                 next*) osname=next ;;
2563                 nonstop-ux) osname=nonstopux ;;
2564                 POSIX-BC | posix-bc ) osname=posix-bc
2565                         osvers="$3"
2566                         ;;
2567                 powerux | power_ux | powermax_os | powermaxos | \
2568                 powerunix | power_unix) osname=powerux
2569                         osvers="$3"
2570                         ;;
2571                 qnx) osname=qnx
2572                         osvers="$4"
2573                         ;;
2574                 solaris) osname=solaris
2575                         case "$3" in
2576                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2577                         *)      osvers="$3" ;;
2578                         esac
2579                         ;;
2580                 sunos) osname=sunos
2581                         case "$3" in
2582                         5*) osname=solaris
2583                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2584                         *)      osvers="$3" ;;
2585                         esac
2586                         ;;
2587                 titanos) osname=titanos
2588                         case "$3" in
2589                         1*) osvers=1 ;;
2590                         2*) osvers=2 ;;
2591                         3*) osvers=3 ;;
2592                         4*) osvers=4 ;;
2593                         *)      osvers="$3" ;;
2594                         esac
2595                         ;;
2596                 ultrix) osname=ultrix
2597                         osvers="$3"
2598                         ;;
2599                 osf1|mls+)      case "$5" in
2600                                 alpha)
2601                                         osname=dec_osf
2602                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2603                                         case "$osvers" in
2604                                         [1-9].[0-9]*) ;;
2605                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2606                                         esac
2607                                         ;;
2608                         hp*)    osname=hp_osf1  ;;
2609                         mips)   osname=mips_osf1 ;;
2610                         esac
2611                         ;;
2612                 unixware) osname=svr5
2613                         osvers="$4"
2614                         ;;
2615                 uts) osname=uts
2616                         osvers="$3"
2617                         ;;
2618                 $2) case "$osname" in
2619                         *isc*) ;;
2620                         *freebsd*) ;;
2621                         svr*)
2622                                 : svr4.x or possibly later
2623                                 case "svr$3" in 
2624                                 ${osname}*)
2625                                         osname=svr$3
2626                                         osvers=$4
2627                                         ;;
2628                                 esac
2629                                 case "$osname" in
2630                                 svr4.0)
2631                                         : Check for ESIX
2632                                         if test -f /stand/boot ; then
2633                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2634                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2635                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2636                                                         if test -n "$isesix"; then
2637                                                                 osname=esix4
2638                                                         fi
2639                                                 fi
2640                                         fi
2641                                         ;;
2642                                 esac
2643                                 ;;
2644                         *)      if test -f /etc/systemid; then
2645                                         osname=sco
2646                                         set `echo $3 | $sed 's/\./ /g'` $4
2647                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2648                                                 osvers=$1.$2.$3
2649                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2650                                                 osvers=$1.$2
2651                                         elif $test -f $src/hints/sco_$1.sh; then
2652                                                 osvers=$1
2653                                         fi
2654                                 else
2655                                         case "$osname" in
2656                                         '') : Still unknown.  Probably a generic Sys V.
2657                                                 osname="sysv"
2658                                                 osvers="$3"
2659                                                 ;;
2660                                         esac
2661                                 fi
2662                                 ;;
2663                         esac
2664                         ;;
2665                 *)      case "$osname" in
2666                         '') : Still unknown.  Probably a generic BSD.
2667                                 osname="$1"
2668                                 osvers="$3"
2669                                 ;;
2670                         esac
2671                         ;;
2672                 esac
2673         else
2674                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2675                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2676                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2677                                 osname=news_os
2678                         fi
2679                         $rm -f UU/kernel.what
2680                 elif test -d c:/.; then
2681                         set X $myuname
2682                         osname=os2
2683                         osvers="$5"
2684                 fi
2685         fi
2686         
2687         : Now look for a hint file osname_osvers, unless one has been
2688         : specified already.
2689         case "$hintfile" in
2690         ''|' ')
2691                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2692                 : Also try without trailing minor version numbers.
2693                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2694                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2695                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2696                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2697                 case "$file" in
2698                 '') dflt=none ;;
2699                 *)  case "$osvers" in
2700                         '') dflt=$file
2701                                 ;;
2702                         *)  if $test -f $src/hints/$file.sh ; then
2703                                         dflt=$file
2704                                 elif $test -f $src/hints/$xfile.sh ; then
2705                                         dflt=$xfile
2706                                 elif $test -f $src/hints/$xxfile.sh ; then
2707                                         dflt=$xxfile
2708                                 elif $test -f $src/hints/$xxxfile.sh ; then
2709                                         dflt=$xxxfile
2710                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2711                                         dflt=$xxxxfile
2712                                 elif $test -f "$src/hints/${osname}.sh" ; then
2713                                         dflt="${osname}"
2714                                 else
2715                                         dflt=none
2716                                 fi
2717                                 ;;
2718                         esac
2719                         ;;
2720                 esac
2721                 if $test -f Policy.sh ; then
2722                         case "$dflt" in
2723                         *Policy*) ;;
2724                         none) dflt="Policy" ;;
2725                         *) dflt="Policy $dflt" ;;
2726                         esac
2727                 fi
2728                 ;;
2729         *)
2730                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2731                 ;;
2732         esac
2733
2734         if $test -f Policy.sh ; then
2735                 $cat <<EOM
2736
2737 There's also a Policy hint file available, which should make the
2738 site-specific (policy) questions easier to answer.
2739 EOM
2740
2741         fi
2742
2743         $cat <<EOM
2744
2745 You may give one or more space-separated answers, or "none" if appropriate.
2746 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2747 is a good thing.  DO NOT give a wrong version or a wrong OS.
2748
2749 EOM
2750
2751         rp="Which of these apply, if any?"
2752         . UU/myread
2753         tans=$ans
2754         for file in $tans; do
2755                 if $test X$file = XPolicy -a -f Policy.sh; then
2756                         . Policy.sh
2757                         $cat Policy.sh >> UU/config.sh
2758                 elif $test -f $src/hints/$file.sh; then
2759                         . $src/hints/$file.sh
2760                         $cat $src/hints/$file.sh >> UU/config.sh
2761                 elif $test X$tans = X -o X$tans = Xnone ; then
2762                         : nothing
2763                 else
2764                         : Give one chance to correct a possible typo.
2765                         echo "$file.sh does not exist"
2766                         dflt=$file
2767                         rp="hint to use instead?"
2768                         . UU/myread
2769                         for file in $ans; do
2770                                 if $test -f "$src/hints/$file.sh"; then
2771                                         . $src/hints/$file.sh
2772                                         $cat $src/hints/$file.sh >> UU/config.sh
2773                                 elif $test X$ans = X -o X$ans = Xnone ; then
2774                                         : nothing
2775                                 else
2776                                         echo "$file.sh does not exist -- ignored."
2777                                 fi
2778                         done
2779                 fi
2780         done
2781
2782         hint=recommended
2783         : Remember our hint file for later.
2784         if $test -f "$src/hints/$file.sh" ; then
2785                 hintfile="$file"
2786         else
2787                 hintfile=''
2788         fi
2789 fi
2790 cd UU
2791 ;;
2792 *)
2793         echo " "
2794         echo "Fetching default answers from $config_sh..." >&4
2795         tmp_n="$n"
2796         tmp_c="$c"
2797         cd ..
2798         cp $config_sh config.sh 2>/dev/null
2799         chmod +w config.sh
2800         . ./config.sh
2801         cd UU
2802         cp ../config.sh .
2803         n="$tmp_n"
2804         c="$tmp_c"
2805         hint=previous
2806         ;;
2807 esac
2808 test "$override" && . ./optdef.sh
2809
2810 : Restore computed paths
2811 for file in $loclist $trylist; do
2812         eval $file="\$_$file"
2813 done
2814
2815 cat << EOM
2816
2817 Configure uses the operating system name and version to set some defaults.
2818 The default value is probably right if the name rings a bell. Otherwise,
2819 since spelling matters for me, either accept the default or answer "none"
2820 to leave it blank.
2821
2822 EOM
2823 case "$osname" in
2824         ''|' ')
2825                 case "$hintfile" in
2826                 ''|' '|none) dflt=none ;;
2827                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2828                 esac
2829                 ;;
2830         *) dflt="$osname" ;;
2831 esac
2832 rp="Operating system name?"
2833 . ./myread
2834 case "$ans" in
2835 none)  osname='' ;;
2836 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2837 esac
2838 echo " "
2839 case "$osvers" in
2840         ''|' ')
2841                 case "$hintfile" in
2842                 ''|' '|none) dflt=none ;;
2843                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2844                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2845                         case "$dflt" in
2846                         ''|' ') dflt=none ;;
2847                         esac
2848                         ;;
2849                 esac
2850                 ;;
2851         *) dflt="$osvers" ;;
2852 esac
2853 rp="Operating system version?"
2854 . ./myread
2855 case "$ans" in
2856 none)  osvers='' ;;
2857 *) osvers="$ans" ;;
2858 esac
2859
2860
2861 . ./posthint.sh
2862
2863 : who configured the system
2864 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2865 cf_by=`(logname) 2>/dev/null`
2866 case "$cf_by" in
2867 "")
2868         cf_by=`(whoami) 2>/dev/null`
2869         case "$cf_by" in
2870         "") cf_by=unknown ;;
2871         esac ;;
2872 esac
2873
2874 : set up the script used to warn in case of inconsistency
2875 cat <<EOS >whoa
2876 $startsh
2877 EOS
2878 cat <<'EOSC' >>whoa
2879 dflt=y
2880 echo " "
2881 echo "*** WHOA THERE!!! ***" >&4
2882 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2883 rp="    Keep the $hint value?"
2884 . ./myread
2885 case "$ans" in
2886 y) td=$was; tu=$was;;
2887 esac
2888 EOSC
2889
2890 : function used to set $1 to $val
2891 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2892 case "$val$was" in
2893 $define$undef) . ./whoa; eval "$var=\$td";;
2894 $undef$define) . ./whoa; eval "$var=\$tu";;
2895 *) eval "$var=$val";;
2896 esac'
2897
2898 case "$usethreads" in
2899 $define|true|[yY]*)     dflt='y';;
2900 *) dflt='n';;
2901 esac
2902 cat <<EOM
2903
2904 Perl can be built to take advantage of threads on some systems.
2905 To do so, Configure can be run with -Dusethreads.
2906
2907 Note that threading is a highly experimental feature, and
2908 some known race conditions still remain.  If you choose to try
2909 it, be very sure to not actually deploy it for production
2910 purposes.  README.threads has more details, and is required
2911 reading if you enable threads.
2912
2913 If this doesn't make any sense to you, just accept the default '$dflt'.
2914 EOM
2915 rp='Build a threading Perl?'
2916 . ./myread
2917 case "$ans" in
2918 y|Y)    val="$define" ;;
2919 *)      val="$undef" ;;
2920 esac
2921 set usethreads
2922 eval $setvar
2923
2924 case "$usethreads" in
2925 $define)
2926         $cat <<EOM
2927
2928 As of 5.5.640, Perl has two different internal threading implementations,
2929 the 5.005 version (5005threads) and an interpreter-based version
2930 (ithreads) that has one interpreter per thread.  Both are very 
2931 experimental.  This arrangement exists to help developers work out
2932 which one is better.
2933
2934 If you're a casual user, you probably don't want interpreter-threads
2935 at this time.  There doesn't yet exist a way to create threads from
2936 within Perl in this model, i.e., "use Thread;" will NOT work.
2937 EOM
2938         : Default to ithreads unless overridden on command line or with
2939         : old config.sh
2940         dflt='y'
2941         case "$use5005threads" in
2942                 $define|true|[yY]*) dflt='n';;
2943         esac
2944         case "$useithreads" in
2945                 $undef|false|[nN]*) dflt='n';;
2946         esac
2947         rp='Use interpreter-based ithreads?'
2948         . ./myread
2949         case "$ans" in
2950         y|Y)    val="$define" ;;
2951         *)      val="$undef" ;;
2952         esac
2953         set useithreads
2954         eval $setvar
2955         : Now set use5005threads to the opposite value.
2956         case "$useithreads" in
2957         $define) val="$undef" ;;
2958         *) val="$define" ;;
2959         esac
2960         set use5005threads
2961         eval $setvar
2962         ;;
2963 *)
2964         useithreads="$undef"
2965         use5005threads="$undef"
2966         ;;
2967 esac
2968
2969 case "$useithreads$use5005threads" in
2970 "$define$define")
2971         $cat >&4 <<EOM
2972
2973 You cannot have both the ithreads and the 5.005 threads enabled
2974 at the same time.  Disabling the 5.005 threads since they are
2975 much less stable than the ithreads.
2976
2977 EOM
2978         use5005threads="$undef"
2979         ;;
2980 esac
2981
2982 case "$d_oldpthreads" in
2983 '')     : Configure tests would be welcome here.  For now, assume undef.
2984         val="$undef" ;;
2985 *)      val="$d_oldpthreads" ;;
2986 esac
2987 set d_oldpthreads
2988 eval $setvar
2989
2990
2991 case "$usethreads" in
2992 "$define"|true|[yY]*)
2993 : Look for a hint-file generated 'call-back-unit'.  If the
2994 : user has specified that a threading perl is to be built,
2995 : we may need to set or change some other defaults.
2996         if $test -f usethreads.cbu; then
2997                 echo "Your platform has some specific hints for threaded builds, using them..."
2998                 . ./usethreads.cbu
2999         else
3000                 $cat <<EOM
3001 (Your platform doesn't have any specific hints for threaded builds.
3002  Assuming POSIX threads, then.)
3003 EOM
3004         fi
3005         ;;
3006 esac
3007
3008 cat <<EOM
3009
3010 Perl can be built so that multiple Perl interpreters can coexist
3011 within the same Perl executable.
3012 EOM
3013
3014 case "$useithreads" in
3015 $define)
3016         cat <<EOM
3017 This multiple interpreter support is required for interpreter-based threads.
3018 EOM
3019         val="$define"
3020         ;;
3021 *)      case "$usemultiplicity" in
3022         $define|true|[yY]*)     dflt='y';;
3023         *) dflt='n';;
3024         esac
3025         echo " "
3026         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3027         rp='Build Perl for multiplicity?'
3028         . ./myread
3029         case "$ans" in
3030         y|Y)    val="$define" ;;
3031         *)      val="$undef" ;;
3032         esac
3033         ;;
3034 esac
3035 set usemultiplicity
3036 eval $setvar
3037
3038 : make some quick guesses about what we are up against
3039 echo " "
3040 $echo $n "Hmm...  $c"
3041 echo exit 1 >bsd
3042 echo exit 1 >usg
3043 echo exit 1 >v7
3044 echo exit 1 >osf1
3045 echo exit 1 >eunice
3046 echo exit 1 >xenix
3047 echo exit 1 >venix
3048 echo exit 1 >os2
3049 d_bsd="$undef"
3050 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3051 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3052 then
3053         echo "Looks kind of like an OSF/1 system, but we'll see..."
3054         echo exit 0 >osf1
3055 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3056         xxx=`./loc addbib blurfl $pth`
3057         if $test -f $xxx; then
3058         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3059                 echo exit 0 >bsd
3060                 echo exit 0 >usg
3061         else
3062                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3063                         echo "Looks kind of like an extended USG system, but we'll see..."
3064                 else
3065                         echo "Looks kind of like a USG system, but we'll see..."
3066                 fi
3067                 echo exit 0 >usg
3068         fi
3069 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3070         echo "Looks kind of like a BSD system, but we'll see..."
3071         d_bsd="$define"
3072         echo exit 0 >bsd
3073 else
3074         echo "Looks kind of like a Version 7 system, but we'll see..."
3075         echo exit 0 >v7
3076 fi
3077 case "$eunicefix" in
3078 *unixtovms*)
3079         $cat <<'EOI'
3080 There is, however, a strange, musty smell in the air that reminds me of
3081 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3082 EOI
3083         echo exit 0 >eunice
3084         d_eunice="$define"
3085 : it so happens the Eunice I know will not run shell scripts in Unix format
3086         ;;
3087 *)
3088         echo " "
3089         echo "Congratulations.  You aren't running Eunice."
3090         d_eunice="$undef"
3091         ;;
3092 esac
3093 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3094 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3095 : semicolon as a patch separator
3096 case "$p_" in
3097 :) ;;
3098 *)
3099         $cat <<'EOI'
3100 I have the feeling something is not exactly right, however...don't tell me...
3101 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3102 (Or you may be running DOS with DJGPP.)
3103 EOI
3104         echo exit 0 >os2
3105         ;;
3106 esac
3107 if test -f /xenix; then
3108         echo "Actually, this looks more like a XENIX system..."
3109         echo exit 0 >xenix
3110         d_xenix="$define"
3111 else
3112         echo " "
3113         echo "It's not Xenix..."
3114         d_xenix="$undef"
3115 fi
3116 chmod +x xenix
3117 $eunicefix xenix
3118 if test -f /venix; then
3119         echo "Actually, this looks more like a VENIX system..."
3120         echo exit 0 >venix
3121 else
3122         echo " "
3123         if ./xenix; then
3124                 : null
3125         else
3126                 echo "Nor is it Venix..."
3127         fi
3128 fi
3129 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3130 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3131 $rm -f foo
3132
3133 case "$cc" in
3134 '') dflt=cc;;
3135 *) dflt="$cc";;
3136 esac
3137 rp="Use which C compiler?"
3138 . ./myread
3139 cc="$ans"
3140 : Look for a hint-file generated 'call-back-unit'.  Now that the
3141 : user has specified the compiler, we may need to set or change some
3142 : other defaults.
3143 if $test -f cc.cbu; then
3144     . ./cc.cbu
3145 fi
3146 . ./checkcc
3147
3148 echo " "
3149 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3150 $cat >gccvers.c <<EOM
3151 #include <stdio.h>
3152 int main() {
3153 #ifdef __GNUC__
3154 #ifdef __VERSION__
3155         printf("%s\n", __VERSION__);
3156 #else
3157         printf("%s\n", "1");
3158 #endif
3159 #endif
3160         exit(0);
3161 }
3162 EOM
3163 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3164         gccversion=`./gccvers`
3165         case "$gccversion" in
3166         '') echo "You are not using GNU cc." ;;
3167         *)  echo "You are using GNU cc $gccversion."
3168             ccname=gcc  
3169             ;;
3170         esac
3171 else
3172         echo " "
3173         echo "*** WHOA THERE!!! ***" >&4
3174         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3175         case "$knowitall" in
3176         '')
3177         echo "    You'd better start hunting for one and let me know about it." >&4
3178                 exit 1
3179                 ;;
3180         esac
3181 fi
3182 $rm -f gccvers*
3183 case "$gccversion" in
3184 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3185 esac
3186 case "$gccversion" in
3187 '') gccosandvers='' ;;
3188 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3189    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3190    gccshortvers=''
3191    case "$gccosandvers" in
3192    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3193    $osname$osvers) ;; # looking good
3194    $osname*) cat <<EOM >&4
3195
3196 *** WHOA THERE!!! ***
3197
3198     Your gcc has not been compiled for the exact release of
3199     your operating system ($gccosandvers versus $osname$osvers).
3200
3201     In general it is a good idea to keep gcc synchronized with
3202     the operating system because otherwise serious problems
3203     may ensue when trying to compile software, like Perl.
3204
3205     I'm trying to be optimistic here, though, and will continue.
3206     If later during the configuration and build icky compilation
3207     problems appear (headerfile conflicts being the most common
3208     manifestation), I suggest reinstalling the gcc to match
3209     your operating system release.
3210
3211 EOM
3212       ;;
3213    *) gccosandvers='' ;; # failed to parse, better be silent
3214    esac
3215    ;;
3216 esac
3217 case "$ccname" in
3218 '') ccname="$cc" ;;
3219 esac
3220
3221 : see how we invoke the C preprocessor
3222 echo " "
3223 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3224 cat <<'EOT' >testcpp.c
3225 #define ABC abc
3226 #define XYZ xyz
3227 ABC.XYZ
3228 EOT
3229 cd ..
3230 if test ! -f cppstdin; then
3231         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3232                 # AIX cc -E doesn't show the absolute headerfile
3233                 # locations but we'll cheat by using the -M flag.
3234                 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
3235         else
3236                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3237         fi
3238 else
3239         echo "Keeping your $hint cppstdin wrapper."
3240 fi
3241 chmod 755 cppstdin
3242 wrapper=`pwd`/cppstdin
3243 ok='false'
3244 cd UU
3245
3246 if $test "X$cppstdin" != "X" && \
3247         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3248         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3249 then
3250         echo "You used to use $cppstdin $cppminus so we'll use that again."
3251         case "$cpprun" in
3252         '') echo "But let's see if we can live without a wrapper..." ;;
3253         *)
3254                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3255                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3256                 then
3257                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3258                         ok='true'
3259                 else
3260                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3261                 fi
3262                 ;;
3263         esac
3264 else
3265         case "$cppstdin" in
3266         '') ;;
3267         *)
3268                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3269                 ;;
3270         esac
3271 fi
3272
3273 if $ok; then
3274         : nothing
3275 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3276         $cc -E <testcpp.c >testcpp.out 2>&1; \
3277         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3278         echo "Yup, it does."
3279         x_cpp="$cc -E"
3280         x_minus='';
3281 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3282         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3283         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3284         echo "Yup, it does."
3285         x_cpp="$cc -E"
3286         x_minus='-';
3287 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3288         $cc -P <testcpp.c >testcpp.out 2>&1; \
3289         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3290         echo "Yipee, that works!"
3291         x_cpp="$cc -P"
3292         x_minus='';
3293 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3294         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3295         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3296         echo "At long last!"
3297         x_cpp="$cc -P"
3298         x_minus='-';
3299 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3300         $cpp <testcpp.c >testcpp.out 2>&1; \
3301         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3302         echo "It works!"
3303         x_cpp="$cpp"
3304         x_minus='';
3305 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3306         $cpp - <testcpp.c >testcpp.out 2>&1; \
3307         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3308         echo "Hooray, it works!  I was beginning to wonder."
3309         x_cpp="$cpp"
3310         x_minus='-';
3311 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3312         $wrapper <testcpp.c >testcpp.out 2>&1; \
3313         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3314         x_cpp="$wrapper"
3315         x_minus=''
3316         echo "Eureka!"
3317 else
3318         dflt=''
3319         rp="No dice.  I can't find a C preprocessor.  Name one:"
3320         . ./myread
3321         x_cpp="$ans"
3322         x_minus=''
3323         $x_cpp <testcpp.c >testcpp.out 2>&1
3324         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3325                 echo "OK, that will do." >&4
3326         else
3327 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3328                 exit 1
3329         fi
3330 fi
3331
3332 case "$ok" in
3333 false)
3334         cppstdin="$x_cpp"
3335         cppminus="$x_minus"
3336         cpprun="$x_cpp"
3337         cpplast="$x_minus"
3338         set X $x_cpp
3339         shift
3340         case "$1" in
3341         "$cpp")
3342                 echo "Perhaps can we force $cc -E using a wrapper..."
3343                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3344                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3345                 then
3346                         echo "Yup, we can."
3347                         cppstdin="$wrapper"
3348                         cppminus='';
3349                 else
3350                         echo "Nope, we'll have to live without it..."
3351                 fi
3352                 ;;
3353         esac
3354         case "$cpprun" in
3355         "$wrapper")
3356                 cpprun=''
3357                 cpplast=''
3358                 ;;
3359         esac
3360         ;;
3361 esac
3362
3363 case "$cppstdin" in
3364 "$wrapper"|'cppstdin') ;;
3365 *) $rm -f $wrapper;;
3366 esac
3367 $rm -f testcpp.c testcpp.out
3368
3369 : decide how portable to be.  Allow command line overrides.
3370 case "$d_portable" in
3371 "$undef") ;;
3372 *)      d_portable="$define" ;;
3373 esac
3374
3375 : set up shell script to do ~ expansion
3376 cat >filexp <<EOSS
3377 $startsh
3378 : expand filename
3379 case "\$1" in
3380  ~/*|~)
3381         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3382         ;;
3383  ~*)
3384         if $test -f /bin/csh; then
3385                 /bin/csh -f -c "glob \$1"
3386                 failed=\$?
3387                 echo ""
3388                 exit \$failed
3389         else
3390                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3391                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3392                 if $test ! -d "\$dir"; then
3393                         me=\`basename \$0\`
3394                         echo "\$me: can't locate home directory for: \$name" >&2
3395                         exit 1
3396                 fi
3397                 case "\$1" in
3398                 */*)
3399                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3400                         ;;
3401                 *)
3402                         echo \$dir
3403                         ;;
3404                 esac
3405         fi
3406         ;;
3407 *)
3408         echo \$1
3409         ;;
3410 esac
3411 EOSS
3412 chmod +x filexp
3413 $eunicefix filexp
3414
3415 : now set up to get a file name
3416 cat <<EOS >getfile
3417 $startsh
3418 EOS
3419 cat <<'EOSC' >>getfile
3420 tilde=''
3421 fullpath=''
3422 already=''
3423 skip=''
3424 none_ok=''
3425 exp_file=''
3426 nopath_ok=''
3427 orig_rp="$rp"
3428 orig_dflt="$dflt"
3429 case "$gfpth" in
3430 '') gfpth='.' ;;
3431 esac
3432
3433 case "$fn" in
3434 *\(*)
3435         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3436         fn=`echo $fn | sed 's/(.*)//'`
3437         ;;
3438 esac
3439
3440 case "$fn" in
3441 *:*)
3442         loc_file=`expr $fn : '.*:\(.*\)'`
3443         fn=`expr $fn : '\(.*\):.*'`
3444         ;;
3445 esac
3446
3447 case "$fn" in
3448 *~*) tilde=true;;
3449 esac
3450 case "$fn" in
3451 */*) fullpath=true;;
3452 esac
3453 case "$fn" in
3454 *+*) skip=true;;
3455 esac
3456 case "$fn" in
3457 *n*) none_ok=true;;
3458 esac
3459 case "$fn" in
3460 *e*) exp_file=true;;
3461 esac
3462 case "$fn" in
3463 *p*) nopath_ok=true;;
3464 esac
3465
3466 case "$fn" in
3467 *f*) type='File';;
3468 *d*) type='Directory';;
3469 *l*) type='Locate';;
3470 esac
3471
3472 what="$type"
3473 case "$what" in
3474 Locate) what='File';;
3475 esac
3476
3477 case "$exp_file" in
3478 '')
3479         case "$d_portable" in
3480         "$define") ;;
3481         *) exp_file=true;;
3482         esac
3483         ;;
3484 esac
3485
3486 cd ..
3487 while test "$type"; do
3488         redo=''
3489         rp="$orig_rp"
3490         dflt="$orig_dflt"
3491         case "$tilde" in
3492         true) rp="$rp (~name ok)";;
3493         esac
3494         . UU/myread
3495         if test -f UU/getfile.ok && \
3496                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3497         then
3498                 value="$ans"
3499                 ansexp="$ans"
3500                 break
3501         fi
3502         case "$ans" in
3503         none)
3504                 value=''
3505                 ansexp=''
3506                 case "$none_ok" in
3507                 true) type='';;
3508                 esac
3509                 ;;
3510         *)
3511                 case "$tilde" in
3512                 '') value="$ans"
3513                         ansexp="$ans";;
3514                 *)
3515                         value=`UU/filexp $ans`
3516                         case $? in
3517                         0)
3518                                 if test "$ans" != "$value"; then
3519                                         echo "(That expands to $value on this system.)"
3520                                 fi
3521                                 ;;
3522                         *) value="$ans";;
3523                         esac
3524                         ansexp="$value"
3525                         case "$exp_file" in
3526                         '') value="$ans";;
3527                         esac
3528                         ;;
3529                 esac
3530                 case "$fullpath" in
3531                 true)
3532                         case "$ansexp" in
3533                         /*) value="$ansexp" ;;
3534                         [a-zA-Z]:/*) value="$ansexp" ;;
3535                         *)
3536                                 redo=true
3537                                 case "$already" in
3538                                 true)
3539                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3540                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3541                                         ;;
3542                                 *)
3543                                 echo "Please give a full path name, starting with slash." >&4
3544                                         case "$tilde" in
3545                                         true)
3546                                 echo "Note that using ~name is ok provided it expands well." >&4
3547                                                 already=true
3548                                                 ;;
3549                                         esac
3550                                 esac
3551                                 ;;
3552                         esac
3553                         ;;
3554                 esac
3555                 case "$redo" in
3556                 '')
3557                         case "$type" in
3558                         File)
3559                                 for fp in $gfpth; do
3560                                         if test "X$fp" = X.; then
3561                                             pf="$ansexp"
3562                                         else    
3563                                             pf="$fp/$ansexp"
3564                                         fi
3565                                         if test -f "$pf"; then
3566                                                 type=''
3567                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3568                                         then
3569                                                 echo "($value is not a plain file, but that's ok.)"
3570                                                 type=''
3571                                         fi
3572                                         if test X"$type" = X; then
3573                                             value="$pf"
3574                                             break
3575                                         fi
3576                                 done
3577                                 ;;
3578                         Directory)
3579                                 for fp in $gfpth; do
3580                                         if test "X$fp" = X.; then
3581                                             dir="$ans"
3582                                             direxp="$ansexp"
3583                                         else    
3584                                             dir="$fp/$ansexp"
3585                                             direxp="$fp/$ansexp"
3586                                         fi
3587                                         if test -d "$direxp"; then
3588                                                 type=''
3589                                                 value="$dir"
3590                                                 break
3591                                         fi
3592                                 done
3593                                 ;;
3594                         Locate)
3595                                 if test -d "$ansexp"; then
3596                                         echo "(Looking for $loc_file in directory $value.)"
3597                                         value="$value/$loc_file"
3598                                         ansexp="$ansexp/$loc_file"
3599                                 fi
3600                                 if test -f "$ansexp"; then
3601                                         type=''
3602                                 fi
3603                                 case "$nopath_ok" in
3604                                 true)   case "$value" in
3605                                         */*) ;;
3606                                         *)      echo "Assuming $value will be in people's path."
3607                                                 type=''
3608                                                 ;;
3609                                         esac
3610                                         ;;
3611                                 esac
3612                                 ;;
3613                         esac
3614
3615                         case "$skip" in
3616                         true) type='';
3617                         esac
3618
3619                         case "$type" in
3620                         '') ;;
3621                         *)
3622                                 if test "$fastread" = yes; then
3623                                         dflt=y
3624                                 else
3625                                         dflt=n
3626                                 fi
3627                                 rp="$what $value doesn't exist.  Use that name anyway?"
3628                                 . UU/myread
3629                                 dflt=''
3630                                 case "$ans" in
3631                                 y*) type='';;
3632                                 *) echo " ";;
3633                                 esac
3634                                 ;;
3635                         esac
3636                         ;;
3637                 esac
3638                 ;;
3639         esac
3640 done
3641 cd UU
3642 ans="$value"
3643 rp="$orig_rp"
3644 dflt="$orig_dflt"
3645 rm -f getfile.ok
3646 test "X$gfpthkeep" != Xy && gfpth=""
3647 EOSC
3648
3649 : What should the include directory be ?
3650 echo " "
3651 $echo $n "Hmm...  $c"
3652 dflt='/usr/include'
3653 incpath=''
3654 mips_type=''
3655 if $test -f /bin/mips && /bin/mips; then
3656         echo "Looks like a MIPS system..."
3657         $cat >usr.c <<'EOCP'
3658 #ifdef SYSTYPE_BSD43
3659 /bsd43
3660 #endif
3661 EOCP
3662         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3663                 dflt='/bsd43/usr/include'
3664                 incpath='/bsd43'
3665                 mips_type='BSD 4.3'
3666         else
3667                 mips_type='System V'
3668         fi
3669         $rm -f usr.c usr.out
3670         echo "and you're compiling with the $mips_type compiler and libraries."
3671         xxx_prompt=y
3672         echo "exit 0" >mips
3673 else
3674         echo "Doesn't look like a MIPS system."
3675         xxx_prompt=n
3676         echo "exit 1" >mips
3677 fi
3678 chmod +x mips
3679 $eunicefix mips
3680 case "$usrinc" in
3681 '') ;;
3682 *) dflt="$usrinc";;
3683 esac
3684 case "$xxx_prompt" in
3685 y)      fn=d/
3686         echo " "
3687         rp='Where are the include files you want to use?'
3688         . ./getfile
3689         usrinc="$ans"
3690         ;;
3691 *)      usrinc="$dflt"
3692         ;;
3693 esac
3694
3695 : Set private lib path
3696 case "$plibpth" in
3697 '') if ./mips; then
3698                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3699         fi;;
3700 esac
3701 case "$libpth" in
3702 ' ') dlist='';;
3703 '') dlist="$loclibpth $plibpth $glibpth";;
3704 *) dlist="$libpth";;
3705 esac
3706
3707 : Now check and see which directories actually exist, avoiding duplicates
3708 libpth=''
3709 for xxx in $dlist
3710 do
3711     if $test -d $xxx; then
3712                 case " $libpth " in
3713                 *" $xxx "*) ;;
3714                 *) libpth="$libpth $xxx";;
3715                 esac
3716     fi
3717 done
3718 $cat <<'EOM'
3719
3720 Some systems have incompatible or broken versions of libraries.  Among
3721 the directories listed in the question below, please remove any you
3722 know not to be holding relevant libraries, and add any that are needed.
3723 Say "none" for none.
3724
3725 EOM
3726 case "$libpth" in
3727 '') dflt='none';;
3728 *)
3729         set X $libpth
3730         shift
3731         dflt=${1+"$@"}
3732         ;;
3733 esac
3734 rp="Directories to use for library searches?"
3735 . ./myread
3736 case "$ans" in
3737 none) libpth=' ';;
3738 *) libpth="$ans";;
3739 esac
3740
3741 : compute shared library extension
3742 case "$so" in
3743 '')
3744         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3745                 dflt='sl'
3746         else
3747                 dflt='so'
3748         fi
3749         ;;
3750 *) dflt="$so";;
3751 esac
3752 $cat <<EOM
3753
3754 On some systems, shared libraries may be available.  Answer 'none' if
3755 you want to suppress searching of shared libraries for the remainder
3756 of this configuration.
3757
3758 EOM
3759 rp='What is the file extension used for shared libraries?'
3760 . ./myread
3761 so="$ans"
3762
3763 : Define several unixisms.
3764 : Hints files or command line option can be used to override them.
3765 : The convoluted testing is in case hints files set either the old
3766 : or the new name.
3767 case "$_exe" in
3768 '')     case "$exe_ext" in
3769     '') ;;
3770         *)      _exe="$exe_ext" ;;
3771         esac
3772         ;;
3773 esac
3774 case "$_a" in
3775 '')     case "$lib_ext" in
3776     '') _a='.a';;
3777         *)      _a="$lib_ext" ;;
3778         esac
3779         ;;
3780 esac
3781 case "$_o" in
3782 '') case "$obj_ext" in
3783         '')     _o='.o';;
3784         *)      _o="$obj_ext";;
3785         esac
3786         ;;
3787 esac
3788 case "$p_" in
3789 '') case "$path_sep" in
3790         '')     p_=':';;
3791         *)      p_="$path_sep";;
3792         esac
3793         ;;
3794 esac
3795 exe_ext=$_exe
3796 lib_ext=$_a
3797 obj_ext=$_o
3798 path_sep=$p_
3799
3800 : Which makefile gets called first.  This is used by make depend.
3801 case "$firstmakefile" in
3802 '') firstmakefile='makefile';;
3803 esac
3804
3805 case "$usesocks" in
3806 $define|true|[yY]*)     dflt='y';;
3807 *) dflt='n';;
3808 esac
3809 cat <<EOM
3810
3811 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3812 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3813 to use the PerlIO abstraction layer, this will be implicitly selected.
3814
3815 If this doesn't make any sense to you, just accept the default '$dflt'.
3816 EOM
3817 rp='Build Perl for SOCKS?'
3818 . ./myread
3819 case "$ans" in
3820 y|Y)    val="$define" ;;     
3821 *)      val="$undef" ;;
3822 esac
3823 set usesocks
3824 eval $setvar
3825
3826 case "$usesocks" in
3827 $define|true|[yY]*) useperlio="$define";;
3828 esac
3829
3830 : Looking for optional libraries
3831 echo " "
3832 echo "Checking for optional libraries..." >&4
3833 case "$libs" in
3834 ' '|'') dflt='';;
3835 *) dflt="$libs";;
3836 esac
3837 case "$libswanted" in
3838 '') libswanted='c_s';;
3839 esac
3840 case "$usesocks" in
3841 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3842 esac
3843 libsfound=''
3844 libsfiles=''
3845 libsdirs=''
3846 libspath=''
3847 for thisdir in $libpth $xlibpth; do
3848   test -d $thisdir && libspath="$libspath $thisdir"
3849 done
3850 for thislib in $libswanted; do
3851         for thisdir in $libspath; do
3852             xxx=''
3853             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3854                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3855                 $test -f "$xxx" && eval $libscheck
3856                 $test -f "$xxx" && libstyle=shared
3857             fi
3858             if test ! -f "$xxx"; then
3859                 xxx=$thisdir/lib$thislib.$so
3860                 $test -f "$xxx" && eval $libscheck
3861                 $test -f "$xxx" && libstyle=shared
3862             fi  
3863             if test ! -f "$xxx"; then
3864                 xxx=$thisdir/lib$thislib$_a
3865                 $test -f "$xxx" && eval $libscheck
3866                 $test -f "$xxx" && libstyle=static
3867             fi
3868             if test ! -f "$xxx"; then
3869                 xxx=$thisdir/$thislib$_a
3870                 $test -f "$xxx" && eval $libscheck
3871                 $test -f "$xxx" && libstyle=static
3872             fi
3873             if test ! -f "$xxx"; then
3874                 xxx=$thisdir/lib${thislib}_s$_a
3875                 $test -f "$xxx" && eval $libscheck
3876                 $test -f "$xxx" && libstyle=static
3877                 $test -f "$xxx" && thislib=${thislib}_s
3878             fi
3879             if test ! -f "$xxx"; then
3880                 xxx=$thisdir/Slib$thislib$_a
3881                 $test -f "$xxx" && eval $libscheck
3882                 $test -f "$xxx" && libstyle=static
3883             fi
3884             if $test -f "$xxx"; then
3885                 case "$libstyle" in
3886                 shared) echo "Found -l$thislib (shared)." ;;
3887                 static) echo "Found -l$thislib." ;;
3888                 *)      echo "Found -l$thislib ($libstyle)." ;;
3889                 esac
3890                 case " $dflt " in
3891                 *"-l$thislib "*);;
3892                 *) dflt="$dflt -l$thislib"
3893                    libsfound="$libsfound $xxx"
3894                    yyy=`basename $xxx`
3895                    libsfiles="$libsfiles $yyy"
3896                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3897                    case " $libsdirs " in
3898                    *" $yyy "*) ;;
3899                    *) libsdirs="$libsdirs $yyy" ;;
3900                    esac
3901                    ;;
3902                 esac
3903                 break
3904             fi  
3905         done
3906         if $test ! -f "$xxx"; then
3907             echo "No -l$thislib."
3908         fi
3909 done
3910 set X $dflt
3911 shift
3912 dflt="$*"
3913 case "$libs" in
3914 '') dflt="$dflt";;
3915 *) dflt="$libs";;
3916 esac
3917 case "$dflt" in
3918 ' '|'') dflt='none';;
3919 esac
3920
3921 $cat <<EOM
3922
3923 In order to compile $package on your machine, a number of libraries
3924 are usually needed.  Include any other special libraries here as well.
3925 Say "none" for none.  The default list is almost always right.
3926 EOM
3927
3928 echo " "
3929 rp="What libraries to use?"
3930 . ./myread
3931 case "$ans" in
3932 none) libs=' ';;
3933 *) libs="$ans";;
3934 esac
3935
3936 : determine optimization, if desired, or use for debug flag also
3937 case "$optimize" in
3938 ' '|$undef) dflt='none';;
3939 '') dflt='-O';;
3940 *) dflt="$optimize";;
3941 esac
3942 $cat <<EOH
3943
3944 By default, $package compiles with the -O flag to use the optimizer.
3945 Alternately, you might want to use the symbolic debugger, which uses
3946 the -g flag (on traditional Unix systems).  Either flag can be
3947 specified here.  To use neither flag, specify the word "none".
3948
3949 EOH
3950 rp="What optimizer/debugger flag should be used?"
3951 . ./myread
3952 optimize="$ans"
3953 case "$optimize" in
3954 'none') optimize=" ";;
3955 esac
3956
3957 dflt=''
3958 : We will not override a previous value, but we might want to
3959 : augment a hint file
3960 case "$hint" in
3961 default|recommended)
3962         case "$gccversion" in
3963         1*) dflt='-fpcc-struct-return' ;;
3964         esac
3965         case "$optimize" in
3966         *-g*) dflt="$dflt -DDEBUGGING";;
3967         esac
3968         case "$gccversion" in
3969         2*) if test -d /etc/conf/kconfig.d &&
3970                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3971                 then
3972                         dflt="$dflt -posix"
3973                 fi
3974                 ;;
3975         esac
3976         case "$gccversion" in
3977         1*) ;;
3978         2.[0-8]*) ;;
3979         ?*)     echo " "
3980                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3981                 echo 'int main(void) { return 0; }' > gcctest.c
3982                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3983                         echo "Yes, it does." 2>&1
3984                         case "$ccflags" in
3985                         *strict-aliasing*) 
3986                                 echo "Leaving current flags $ccflags alone." 2>&1
3987                                 ;;
3988                         *) dflt="$dflt -fno-strict-aliasing" ;;
3989                         esac
3990                 else
3991                         echo "Nope, it doesn't, but that's ok." 2>&1
3992                 fi
3993                 ;;
3994         esac
3995         ;;
3996 esac
3997
3998 case "$mips_type" in
3999 *BSD*|'') inclwanted="$locincpth $usrinc";;
4000 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4001 esac
4002 for thisincl in $inclwanted; do
4003         if $test -d $thisincl; then
4004                 if $test x$thisincl != x$usrinc; then
4005                         case "$dflt" in
4006                         *" -I$thisincl "*);;
4007                         *) dflt="$dflt -I$thisincl ";;
4008                         esac
4009                 fi
4010         fi
4011 done
4012
4013 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4014         xxx=true;
4015 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4016         xxx=true;
4017 else
4018         xxx=false;
4019 fi;
4020 if $xxx; then
4021         case "$dflt" in
4022         *$2*);;
4023         *) dflt="$dflt -D$2";;
4024         esac;
4025 fi'
4026
4027 set signal.h LANGUAGE_C; eval $inctest
4028
4029 case "$usesocks" in
4030 $define)
4031         ccflags="$ccflags -DSOCKS"
4032         ;;
4033 esac
4034
4035 case "$hint" in
4036 default|recommended) dflt="$ccflags $dflt" ;;
4037 *) dflt="$ccflags";;
4038 esac
4039
4040 case "$dflt" in
4041 ''|' ') dflt=none;;
4042 esac
4043
4044 $cat <<EOH
4045
4046 Your C compiler may want other flags.  For this question you should include
4047 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4048 but you should NOT include libraries or ld flags like -lwhatever.  If you
4049 want $package to honor its debug switch, you should include -DDEBUGGING here.
4050 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4051
4052 To use no flags, specify the word "none".
4053
4054 EOH
4055 set X $dflt
4056 shift
4057 dflt=${1+"$@"}
4058 rp="Any additional cc flags?"
4059 . ./myread
4060 case "$ans" in
4061 none) ccflags='';;
4062 *) ccflags="$ans";;
4063 esac
4064
4065 : the following weeds options from ccflags that are of no interest to cpp
4066 case "$cppflags" in
4067 '') cppflags="$ccflags" ;;
4068 *)  cppflags="$cppflags $ccflags" ;;
4069 esac
4070 case "$gccversion" in
4071 1*) cppflags="$cppflags -D__GNUC__"
4072 esac
4073 case "$mips_type" in
4074 '');;
4075 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4076 esac
4077 case "$cppflags" in
4078 '');;
4079 *)
4080         echo " "
4081         echo "Let me guess what the preprocessor flags are..." >&4
4082         set X $cppflags
4083         shift
4084         cppflags=''
4085         $cat >cpp.c <<'EOM'
4086 #define BLURFL foo
4087
4088 BLURFL xx LFRULB
4089 EOM
4090         previous=''
4091         for flag in $*
4092         do
4093                 case "$flag" in
4094                 -*) ftry="$flag";;
4095                 *) ftry="$previous $flag";;
4096                 esac
4097                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4098                         >cpp1.out 2>/dev/null && \
4099                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4100                         >cpp2.out 2>/dev/null && \
4101                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4102                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4103                 then
4104                         cppflags="$cppflags $ftry"
4105                         previous=''
4106                 else
4107                         previous="$flag"
4108                 fi
4109         done
4110         set X $cppflags
4111         shift
4112         cppflags=${1+"$@"}
4113         case "$cppflags" in
4114         *-*)  echo "They appear to be: $cppflags";;
4115         esac
4116         $rm -f cpp.c cpp?.out
4117         ;;
4118 esac
4119
4120 : flags used in final linking phase
4121 case "$ldflags" in
4122 '') if ./venix; then
4123                 dflt='-i -z'
4124         else
4125                 dflt=''
4126         fi
4127         case "$ccflags" in
4128         *-posix*) dflt="$dflt -posix" ;;
4129         esac
4130         ;;
4131 *) dflt="$ldflags";;
4132 esac
4133
4134 : Try to guess additional flags to pick up local libraries.
4135 for thislibdir in $libpth; do
4136         case " $loclibpth " in
4137         *" $thislibdir "*)
4138                 case "$dflt " in 
4139                 *"-L$thislibdir "*) ;;
4140                 *)  dflt="$dflt -L$thislibdir" ;;
4141                 esac
4142                 ;;
4143         esac
4144 done
4145
4146 case "$dflt" in
4147 '') dflt='none' ;;
4148 esac
4149
4150 $cat <<EOH
4151
4152 Your C linker may need flags.  For this question you should
4153 include -L/whatever and any other flags used by the C linker, but you
4154 should NOT include libraries like -lwhatever.
4155
4156 Make sure you include the appropriate -L/path flags if your C linker
4157 does not normally search all of the directories you specified above,
4158 namely
4159         $libpth
4160 To use no flags, specify the word "none".
4161
4162 EOH
4163
4164 rp="Any additional ld flags (NOT including libraries)?"
4165 . ./myread
4166 case "$ans" in
4167 none) ldflags='';;
4168 *) ldflags="$ans";;
4169 esac
4170 rmlist="$rmlist pdp11"
4171
4172 : coherency check
4173 echo " "
4174 echo "Checking your choice of C compiler and flags for coherency..." >&4
4175 $cat > try.c <<'EOF'
4176 #include <stdio.h>
4177 int main() { printf("Ok\n"); exit(0); }
4178 EOF
4179 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4180 shift
4181 $cat >try.msg <<'EOM'
4182 I've tried to compile and run the following simple program:
4183
4184 EOM
4185 $cat try.c >> try.msg
4186
4187 $cat >> try.msg <<EOM
4188
4189 I used the command:
4190
4191         $*
4192         ./try
4193
4194 and I got the following output:
4195
4196 EOM
4197 dflt=y
4198 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4199         if $sh -c './try' >>try.msg 2>&1; then
4200                 xxx=`./try`
4201                 case "$xxx" in
4202                 "Ok") dflt=n ;;
4203                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4204                         case " $libs " in
4205                         *" -lsfio "*)
4206                                 cat >> try.msg <<'EOQS'
4207 If $libs contains -lsfio, and sfio is mis-configured, then it
4208 sometimes (apparently) runs and exits with a 0 status, but with no
4209 output!  It may have to do with sfio's use of _exit vs. exit.
4210
4211 EOQS
4212                                 rp="You have a big problem.  Shall I abort Configure"
4213                                 dflt=y
4214                                 ;;
4215                         esac
4216                         ;;
4217                 esac
4218         else
4219                 echo "The program compiled OK, but exited with status $?." >>try.msg
4220                 rp="You have a problem.  Shall I abort Configure"
4221                 dflt=y
4222         fi
4223 else
4224         echo "I can't compile the test program." >>try.msg
4225         rp="You have a BIG problem.  Shall I abort Configure"
4226         dflt=y
4227 fi
4228 case "$dflt" in
4229 y)
4230         $cat try.msg >&4
4231         case "$knowitall" in
4232         '')
4233                 echo "(The supplied flags or libraries might be incorrect.)"
4234                 ;;
4235         *) dflt=n;;
4236         esac
4237         echo " "
4238         . ./myread
4239         case "$ans" in
4240         n*|N*) ;;
4241         *)      echo "Ok.  Stopping Configure." >&4
4242                 exit 1
4243                 ;;
4244         esac
4245         ;;
4246 n) echo "OK, that should do.";;
4247 esac
4248 $rm -f try try.* core
4249
4250 : define an is-a-typedef? function
4251 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4252 case "$inclist" in
4253 "") inclist="sys/types.h";;
4254 esac;
4255 eval "varval=\$$var";
4256 case "$varval" in
4257 "")
4258         $rm -f temp.c;
4259         for inc in $inclist; do
4260                 echo "#include <$inc>" >>temp.c;
4261         done;
4262         echo "#ifdef $type" >> temp.c;
4263         echo "printf(\"We have $type\");" >> temp.c;
4264         echo "#endif" >> temp.c;
4265         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4266         if $contains $type temp.E >/dev/null 2>&1; then
4267                 eval "$var=\$type";
4268         else
4269                 eval "$var=\$def";
4270         fi;
4271         $rm -f temp.?;;
4272 *) eval "$var=\$varval";;
4273 esac'
4274
4275 : define an is-a-typedef? function that prompts if the type is not available.
4276 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4277 case "$inclist" in
4278 "") inclist="sys/types.h";;
4279 esac;
4280 eval "varval=\$$var";
4281 case "$varval" in
4282 "")
4283         $rm -f temp.c;
4284         for inc in $inclist; do
4285                 echo "#include <$inc>" >>temp.c;
4286         done;
4287         echo "#ifdef $type" >> temp.c;
4288         echo "printf(\"We have $type\");" >> temp.c;
4289         echo "#endif" >> temp.c;
4290         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4291         echo " " ;
4292         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4293         if $contains $type temp.E >/dev/null 2>&1; then
4294                 echo "$type found." >&4;
4295                 eval "$var=\$type";
4296         else
4297                 echo "$type NOT found." >&4;
4298                 dflt="$def";
4299                 . ./myread ;
4300                 eval "$var=\$ans";
4301         fi;
4302         $rm -f temp.?;;
4303 *) eval "$var=\$varval";;
4304 esac'
4305
4306 : define a shorthand compile call
4307 compile='
4308 mc_file=$1;
4309 shift;
4310 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4311 : define a shorthand compile call for compilations that should be ok.
4312 compile_ok='
4313 mc_file=$1;
4314 shift;
4315 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4316
4317 : check for lengths of integral types
4318 echo " "
4319 case "$intsize" in
4320 '')
4321         echo "Checking to see how big your integers are..." >&4
4322         $cat >intsize.c <<'EOCP'
4323 #include <stdio.h>
4324 int main()
4325 {
4326         printf("intsize=%d;\n", (int)sizeof(int));
4327         printf("longsize=%d;\n", (int)sizeof(long));
4328         printf("shortsize=%d;\n", (int)sizeof(short));
4329         exit(0);
4330 }
4331 EOCP
4332         set intsize
4333         if eval $compile_ok && ./intsize > /dev/null; then
4334                 eval `./intsize`
4335                 echo "Your integers are $intsize bytes long."
4336                 echo "Your long integers are $longsize bytes long."
4337                 echo "Your short integers are $shortsize bytes long."
4338         else
4339                 $cat >&4 <<EOM
4340 !
4341 Help! I can't compile and run the intsize test program: please enlighten me!
4342 (This is probably a misconfiguration in your system or libraries, and
4343 you really ought to fix it.  Still, I'll try anyway.)
4344 !
4345 EOM
4346                 dflt=4
4347                 rp="What is the size of an integer (in bytes)?"
4348                 . ./myread
4349                 intsize="$ans"
4350                 dflt=$intsize
4351                 rp="What is the size of a long integer (in bytes)?"
4352                 . ./myread
4353                 longsize="$ans"
4354                 dflt=2
4355                 rp="What is the size of a short integer (in bytes)?"
4356                 . ./myread
4357                 shortsize="$ans"
4358         fi
4359         ;;
4360 esac
4361 $rm -f intsize intsize.*
4362
4363 : see what type lseek is declared as in the kernel
4364 rp="What is the type used for lseek's offset on this system?"
4365 set off_t lseektype long stdio.h sys/types.h
4366 eval $typedef_ask
4367
4368 echo " "
4369 echo "Checking to see how big your file offsets are..." >&4
4370 $cat >try.c <<EOCP
4371 #include <sys/types.h>
4372 #include <stdio.h>
4373 int main()
4374 {
4375     printf("%d\n", (int)sizeof($lseektype));
4376     return(0); 
4377 }
4378 EOCP
4379 set try
4380 if eval $compile_ok; then
4381         lseeksize=`./try`
4382         echo "Your file offsets are $lseeksize bytes long."
4383 else
4384         dflt=$longsize
4385         echo " "
4386         echo "(I can't seem to compile the test program.  Guessing...)"
4387         rp="What is the size of your file offsets (in bytes)?"
4388         . ./myread
4389         lseeksize="$ans"
4390 fi
4391 $rm -f try.c try
4392
4393 : see what type file positions are declared as in the library
4394 rp="What is the type for file position used by fsetpos()?"
4395 set fpos_t fpostype long stdio.h sys/types.h
4396 eval $typedef_ask
4397
4398 echo " "
4399 case "$fpostype" in
4400 *_t) zzz="$fpostype"    ;;
4401 *)   zzz="fpos_t"       ;;
4402 esac
4403 echo "Checking the size of $zzz..." >&4 
4404 cat > try.c <<EOCP
4405 #include <sys/types.h>
4406 #include <stdio.h>
4407 int main() {
4408     printf("%d\n", (int)sizeof($fpostype));
4409     exit(0);
4410 }
4411 EOCP
4412 set try
4413 if eval $compile_ok; then
4414         yyy=`./try`
4415         case "$yyy" in
4416         '')     fpossize=4
4417                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4418                 ;;
4419         *)      fpossize=$yyy
4420                 echo "Your $zzz is $fpossize bytes long."
4421                 ;;
4422         esac
4423 else
4424         dflt="$longsize"
4425         echo " " >&4
4426         echo "(I can't compile the test program.  Guessing...)" >&4
4427         rp="What is the size of your file positions (in bytes)?"
4428         . ./myread
4429         fpossize="$ans"
4430 fi
4431
4432
4433
4434 # Backward compatibility (uselfs is deprecated).
4435 case "$uselfs" in
4436 "$define"|true|[yY]*)
4437         cat <<EOM >&4
4438
4439 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4440 EOM
4441         uselargefiles="$define"
4442         ;;
4443 esac                          
4444
4445 case "$lseeksize:$fpossize" in
4446 8:8) cat <<EOM
4447
4448 You can have files larger than 2 gigabytes.
4449 EOM
4450    val="$define" ;;
4451 *)    case "$uselargefiles" in
4452    "$undef"|false|[nN]*) dflt='n' ;;
4453    *)   dflt='y' ;;
4454    esac
4455    cat <<EOM
4456
4457 Perl can be built to understand large files (files larger than 2 gigabytes)
4458 on some systems.  To do so, Configure can be run with -Duselargefiles.
4459
4460 If this doesn't make any sense to you, just accept the default '$dflt'.
4461 EOM
4462    rp='Try to understand large files, if available?'
4463    . ./myread
4464    case "$ans" in
4465    y|Y)         val="$define" ;;
4466    *)           val="$undef"  ;;
4467    esac
4468    ;;
4469 esac
4470 set uselargefiles
4471 eval $setvar
4472 case "$uselargefiles" in
4473 "$define")
4474 : Look for a hint-file generated 'call-back-unit'.  If the
4475 : user has specified that a large files perl is to be built,
4476 : we may need to set or change some other defaults.
4477         if $test -f uselargefiles.cbu; then
4478                 echo "Your platform has some specific hints for large file builds, using them..."
4479                 . ./uselargefiles.cbu
4480                 echo " "
4481                 echo "Rechecking to see how big your file offsets are..." >&4
4482                 $cat >try.c <<EOCP
4483 #include <sys/types.h>
4484 #include <stdio.h>
4485 int main()
4486 {
4487     printf("%d\n", (int)sizeof($lseektype));
4488     return(0); 
4489 }
4490 EOCP
4491                 set try
4492                 if eval $compile_ok; then
4493                         lseeksize=`./try`
4494                         $echo "Your file offsets are now $lseeksize bytes long."
4495                 else
4496                         dflt="$lseeksize"
4497                         echo " "
4498                         echo "(I can't seem to compile the test program.  Guessing...)"
4499                         rp="What is the size of your file offsets (in bytes)?"
4500                         . ./myread
4501                         lseeksize="$ans"
4502                 fi
4503                 case "$fpostype" in
4504                 *_t) zzz="$fpostype"    ;;
4505                 *)   zzz="fpos_t"       ;;
4506                 esac
4507                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4508                 $cat > try.c <<EOCP
4509 #include <sys/types.h>
4510 #include <stdio.h>
4511 int main() {
4512     printf("%d\n", (int)sizeof($fpostype));
4513     exit(0);
4514 }
4515 EOCP
4516                 set try
4517                 if eval $compile_ok; then
4518                         yyy=`./try`
4519                         dflt="$lseeksize"
4520                         case "$yyy" in
4521                         '')     echo " "
4522                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4523                                 ;;
4524                         *)      fpossize=$yyy
4525                                 echo " $fpossize bytes." >&4
4526                                 ;;
4527                         esac
4528                 else
4529                         dflt="$fpossize"
4530                         echo " "
4531                         echo "(I can't compile the test program.  Guessing...)" >&4
4532                         rp="What is the size of your file positions (in bytes)?"
4533                         . ./myread
4534                         fpossize="$ans"
4535                 fi
4536                 $rm -f try.c try
4537         fi
4538         ;;
4539 esac
4540
4541
4542 case "$usemorebits" in
4543 "$define"|true|[yY]*)
4544         use64bitint="$define"
4545         uselongdouble="$define"
4546         usemorebits="$define"
4547         ;;
4548 *)      usemorebits="$undef"
4549         ;;
4550 esac
4551
4552 : check for void type
4553 echo " "
4554 echo "Checking to see how well your C compiler groks the void type..." >&4
4555 case "$voidflags" in
4556 '')
4557         $cat >try.c <<'EOCP'
4558 #if TRY & 1
4559 void sub() {
4560 #else
4561 sub() {
4562 #endif
4563         extern void moo();      /* function returning void */
4564         void (*goo)();          /* ptr to func returning void */
4565 #if TRY & 8
4566         void *hue;              /* generic ptr */
4567 #endif
4568 #if TRY & 2
4569         void (*foo[10])();
4570 #endif
4571
4572 #if TRY & 4
4573         if(goo == moo) {
4574                 exit(0);
4575         }
4576 #endif
4577         exit(0);
4578 }
4579 int main() { sub(); }
4580 EOCP
4581         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4582                 voidflags=$defvoidused
4583         echo "Good.  It appears to support void to the level $package wants.">&4
4584                 if $contains warning .out >/dev/null 2>&1; then
4585                         echo "However, you might get some warnings that look like this:"
4586                         $cat .out
4587                 fi
4588         else
4589 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4590                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4591                         echo "It supports 1..."
4592                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4593                                 echo "It also supports 2..."
4594                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4595                                         voidflags=7
4596                                         echo "And it supports 4 but not 8 definitely."
4597                                 else
4598                                         echo "It doesn't support 4..."
4599                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4600                                                 voidflags=11
4601                                                 echo "But it supports 8."
4602                                         else
4603                                                 voidflags=3
4604                                                 echo "Neither does it support 8."
4605                                         fi
4606                                 fi
4607                         else
4608                                 echo "It does not support 2..."
4609                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4610                                         voidflags=13
4611                                         echo "But it supports 4 and 8."
4612                                 else
4613                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4614                                                 voidflags=5
4615                                                 echo "And it supports 4 but has not heard about 8."
4616                                         else
4617                                                 echo "However it supports 8 but not 4."
4618                                         fi
4619                                 fi
4620                         fi
4621                 else
4622                         echo "There is no support at all for void."
4623                         voidflags=0
4624                 fi
4625         fi
4626 esac
4627 case "$voidflags" in
4628 "$defvoidused") ;;
4629 *)      $cat >&4 <<'EOM'
4630   Support flag bits are:
4631     1: basic void declarations.
4632     2: arrays of pointers to functions returning void.
4633     4: operations between pointers to and addresses of void functions.
4634     8: generic void pointers.
4635 EOM
4636         dflt="$voidflags";
4637         rp="Your void support flags add up to what?"
4638         . ./myread
4639         voidflags="$ans"
4640         ;;
4641 esac
4642 $rm -f try.* .out
4643
4644 : check for length of pointer
4645 echo " "
4646 case "$ptrsize" in
4647 '')
4648         echo "Checking to see how big your pointers are..." >&4
4649         if test "$voidflags" -gt 7; then
4650                 echo '#define VOID_PTR char *' > try.c
4651         else
4652                 echo '#define VOID_PTR void *' > try.c
4653         fi
4654         $cat >>try.c <<'EOCP'
4655 #include <stdio.h>
4656 int main()
4657 {
4658     printf("%d\n", (int)sizeof(VOID_PTR));
4659     exit(0);
4660 }
4661 EOCP
4662         set try
4663         if eval $compile_ok; then
4664                 ptrsize=`./try`
4665                 echo "Your pointers are $ptrsize bytes long."
4666         else
4667                 dflt='4'
4668                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4669                 rp="What is the size of a pointer (in bytes)?"
4670                 . ./myread
4671                 ptrsize="$ans"
4672         fi
4673         ;;
4674 esac
4675 $rm -f try.c try
4676
4677 : check for long long
4678 echo " "
4679 echo "Checking to see if you have long long..." >&4
4680 echo 'int main() { long long x = 7; return 0; }' > try.c
4681 set try
4682 if eval $compile; then
4683         val="$define"
4684         echo "You have long long."
4685 else
4686         val="$undef"
4687         echo "You do not have long long."
4688 fi
4689 $rm try.*
4690 set d_longlong
4691 eval $setvar
4692
4693 : check for length of long long
4694 case "${d_longlong}${longlongsize}" in
4695 $define)
4696         echo " "
4697         echo "Checking to see how big your long longs are..." >&4
4698         $cat >try.c <<'EOCP'
4699 #include <stdio.h>
4700 int main()
4701 {
4702     printf("%d\n", (int)sizeof(long long));
4703     return(0);
4704 }
4705 EOCP
4706         set try
4707         if eval $compile_ok; then
4708                 longlongsize=`./try$exe_ext`
4709                 echo "Your long longs are $longlongsize bytes long."
4710         else
4711                 dflt='8'
4712                 echo " "
4713                 echo "(I can't seem to compile the test program.  Guessing...)"
4714                 rp="What is the size of a long long (in bytes)?"
4715                 . ./myread
4716                 longlongsize="$ans"
4717         fi
4718         if $test "X$longsize" = "X$longlongsize"; then
4719                 echo "(That isn't any different from an ordinary long.)"
4720         fi      
4721         ;;
4722 esac
4723 $rm -f try.* try
4724
4725 : determine filename position in cpp output
4726 echo " "
4727 echo "Computing filename position in cpp output for #include directives..." >&4
4728 echo '#include <stdio.h>' > foo.c
4729 $cat >fieldn <<EOF
4730 $startsh
4731 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4732 $grep '^[       ]*#.*stdio\.h' | \
4733 while read cline; do
4734         pos=1
4735         set \$cline
4736         while $test \$# -gt 0; do
4737                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4738                         echo "\$pos"
4739                         exit 0
4740                 fi
4741                 shift
4742                 pos=\`expr \$pos + 1\`
4743         done
4744 done
4745 EOF
4746 chmod +x fieldn
4747 fieldn=`./fieldn`
4748 $rm -f foo.c fieldn
4749 case $fieldn in
4750 '') pos='???';;
4751 1) pos=first;;
4752 2) pos=second;;
4753 3) pos=third;;
4754 *) pos="${fieldn}th";;
4755 esac
4756 echo "Your cpp writes the filename in the $pos field of the line."
4757
4758 : locate header file
4759 $cat >findhdr <<EOF
4760 $startsh
4761 wanted=\$1
4762 name=''
4763 for usrincdir in $usrinc
4764 do
4765         if test -f \$usrincdir/\$wanted; then
4766                 echo "\$usrincdir/\$wanted"
4767                 exit 0
4768         fi
4769 done
4770 awkprg='{ print \$$fieldn }'
4771 echo "#include <\$wanted>" > foo\$\$.c
4772 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4773 $grep "^[       ]*#.*\$wanted" | \
4774 while read cline; do
4775         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4776         case "\$name" in
4777         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4778         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4779         *) exit 2;;
4780         esac;
4781 done;
4782 #
4783 # status = 0: grep returned 0 lines, case statement not executed
4784 # status = 1: headerfile found
4785 # status = 2: while loop executed, no headerfile found
4786 #
4787 status=\$?
4788 $rm -f foo\$\$.c;
4789 if test \$status -eq 1; then
4790         exit 0;
4791 fi
4792 exit 1
4793 EOF
4794 chmod +x findhdr
4795
4796 : define an alternate in-header-list? function
4797 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4798 cont=true; xxf="echo \"<\$1> found.\" >&4";
4799 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4800 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4801 esac;
4802 case $# in 4) instead=instead;; *) instead="at last";; esac;
4803 while $test "$cont"; do
4804         xxx=`./findhdr $1`
4805         var=$2; eval "was=\$$2";
4806         if $test "$xxx" && $test -r "$xxx";
4807         then eval $xxf;
4808         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4809                 cont="";
4810         else eval $xxnf;
4811         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4812         set $yyy; shift; shift; yyy=$@;
4813         case $# in 0) cont="";;
4814         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4815                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4816         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4817                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4818         esac;
4819 done;
4820 while $test "$yyy";
4821 do set $yyy; var=$2; eval "was=\$$2";
4822         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4823         set $yyy; shift; shift; yyy=$@;
4824 done'
4825
4826 : see if inttypes.h is available
4827 : we want a real compile instead of Inhdr because some systems
4828 : have an inttypes.h which includes non-existent headers
4829 echo " "
4830 $cat >try.c <<EOCP
4831 #include <inttypes.h>
4832 int main() {
4833         static int32_t foo32 = 0x12345678;
4834 }
4835 EOCP
4836 set try
4837 if eval $compile; then
4838         echo "<inttypes.h> found." >&4
4839         val="$define"
4840 else
4841         echo "<inttypes.h> NOT found." >&4
4842         val="$undef"
4843 fi
4844 $rm -f try.c try
4845 set i_inttypes
4846 eval $setvar
4847
4848 : check for int64_t
4849 echo " "
4850 echo "Checking to see if you have int64_t..." >&4
4851 $cat >try.c <<EOCP
4852 #include <sys/types.h>
4853 #$i_inttypes I_INTTYPES
4854 #ifdef I_INTTYPES
4855 #include <inttypes.h>
4856 #endif
4857 int main() { int64_t x = 7; }
4858 EOCP
4859 set try
4860 if eval $compile; then
4861         val="$define"
4862         echo "You have int64_t."
4863 else
4864         val="$undef"
4865         echo "You do not have int64_t."
4866 fi
4867 $rm -f try try.*
4868 set d_int64_t
4869 eval $setvar
4870
4871
4872 echo " "
4873 echo "Checking which 64-bit integer type we could use..." >&4
4874
4875 case "$intsize" in
4876 8) val=int
4877    set quadtype
4878    eval $setvar
4879    val='"unsigned int"'
4880    set uquadtype
4881    eval $setvar
4882    quadkind=1
4883    ;;
4884 *) case "$longsize" in
4885    8) val=long
4886       set quadtype
4887       eval $setvar
4888       val='"unsigned long"'
4889       set uquadtype
4890       eval $setvar
4891       quadkind=2
4892       ;;
4893    *) case "$d_longlong:$longlongsize" in
4894       define:8)
4895         val='"long long"'
4896         set quadtype
4897         eval $setvar
4898         val='"unsigned long long"'
4899         set uquadtype
4900         eval $setvar
4901         quadkind=3
4902         ;;
4903       *) case "$d_int64_t" in
4904          define)
4905            val=int64_t
4906            set quadtype
4907            eval $setvar
4908            val=uint64_t
4909            set uquadtype
4910            eval $setvar
4911            quadkind=4
4912            ;;
4913          esac
4914          ;;
4915       esac
4916       ;;
4917    esac
4918    ;;
4919 esac
4920
4921 case "$quadtype" in
4922 '')     echo "Alas, no 64-bit integer types in sight." >&4
4923         d_quad="$undef"
4924         ;;
4925 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4926         d_quad="$define"
4927         ;;
4928 esac
4929
4930
4931 case "$uselonglong" in
4932 "$define"|true|[yY]*)
4933         cat <<EOM >&4
4934
4935 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4936 EOM
4937         use64bitint="$define"
4938         ;;
4939 esac                          
4940 case "$use64bits" in
4941 "$define"|true|[yY]*)
4942         cat <<EOM >&4
4943
4944 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4945 EOM
4946         use64bitint="$define"
4947         ;;
4948 esac                          
4949 case "$use64bitints" in
4950 "$define"|true|[yY]*)
4951         cat <<EOM >&4
4952
4953 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4954 EOM
4955         use64bitint="$define"
4956         ;;
4957 esac                          
4958 case "$use64bitsint" in
4959 "$define"|true|[yY]*)
4960         cat <<EOM >&4
4961
4962 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4963 EOM
4964         use64bitint="$define"
4965         ;;
4966 esac                          
4967 case "$uselonglongs" in
4968 "$define"|true|[yY]*)
4969         cat <<EOM >&4
4970
4971 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4972 EOM
4973         use64bitint="$define"
4974         ;;
4975 esac                          
4976 case "$use64bitsall" in
4977 "$define"|true|[yY]*)
4978         cat <<EOM >&4
4979
4980 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4981 EOM
4982         use64bitall="$define"
4983         ;;
4984 esac                          
4985
4986 case "$ccflags" in
4987 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4988 esac
4989 case "$use64bitall" in
4990 "$define"|true|[yY]*) use64bitint="$define" ;;
4991 esac
4992
4993 case "$longsize" in
4994 8) cat <<EOM
4995
4996 You have natively 64-bit long integers.
4997 EOM
4998    val="$define"
4999    ;;
5000 *) case "$use64bitint" in
5001    "$define"|true|[yY]*) dflt='y';;
5002    *) dflt='n';;
5003    esac
5004    case "$d_quad" in
5005    "$define") ;;
5006    *) dflt='n' ;;
5007    esac
5008    cat <<EOM
5009
5010 Perl can be built to take advantage of 64-bit integer types
5011 on some systems.  To do so, Configure can be run with -Duse64bitint.
5012 Choosing this option will most probably introduce binary incompatibilities.
5013
5014 If this doesn't make any sense to you, just accept the default '$dflt'.
5015 (The default has been chosen based on your configuration.)
5016 EOM
5017    rp='Try to use 64-bit integers, if available?'
5018    . ./myread
5019    case "$ans" in
5020    [yY]*) val="$define" ;;
5021    *)     val="$undef"  ;;
5022    esac
5023    ;;
5024 esac
5025 set use64bitint
5026 eval $setvar
5027
5028 case "$use64bitall" in
5029 "$define"|true|[yY]*) dflt='y' ;;
5030 *) case "$longsize" in
5031    8) dflt='y' ;;
5032    *) dflt='n' ;;
5033    esac
5034    ;;
5035 esac    
5036 cat <<EOM
5037
5038 You may also choose to try maximal 64-bitness.  It means using as much
5039 64-bitness as possible on the platform.  This in turn means even more
5040 binary incompatibilities.  On the other hand, your platform may not
5041 have any more 64-bitness available than what you already have chosen.
5042
5043 If this doesn't make any sense to you, just accept the default '$dflt'.
5044 (The default has been chosen based on your configuration.)
5045 EOM
5046 rp='Try to use maximal 64-bit support, if available?'
5047 . ./myread
5048 case "$ans" in
5049 [yY]*) val="$define" ;;
5050 *)     val="$undef"  ;;
5051 esac
5052 set use64bitall
5053 eval $setvar
5054 case "$use64bitall" in
5055 "$define")
5056         case "$use64bitint" in
5057         "$undef")
5058                 cat <<EOM
5059
5060 Since you have chosen a maximally 64-bit build, I'm also turning on
5061 the use of 64-bit integers.
5062 EOM
5063                 use64bitint="$define" ;;
5064         esac
5065         ;;
5066 esac
5067
5068 case "$use64bitall" in
5069 "$define"|true|[yY]*)
5070         case "$ptrsize" in
5071         4)      cat <<EOM >&4
5072
5073 *** You have chosen a maximally 64-bit build, but your pointers
5074 *** are only 4 bytes wide, disabling maximal 64-bitness.
5075
5076 EOM
5077                 use64bitall="$undef"
5078                 case "$use64bitint" in
5079                 "$define"|true|[yY]*) ;;
5080                 *)      cat <<EOM >&4
5081
5082 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5083
5084 EOM
5085                         use64bitint="$define"
5086                         ;;
5087                 esac
5088                 ;;
5089         esac
5090         ;;
5091 esac
5092
5093 case "$use64bitint" in
5094 "$define"|true|[yY]*)
5095 : Look for a hint-file generated 'call-back-unit'.  If the
5096 : user has specified that a 64-bit perl is to be built,
5097 : we may need to set or change some other defaults.
5098         if $test -f use64bitint.cbu; then
5099                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5100                 . ./use64bitint.cbu
5101         fi
5102         case "$longsize" in
5103         4) case "$archname64" in
5104            '') archname64=64int ;;
5105            esac
5106            ;;
5107         esac
5108         ;;
5109 esac
5110
5111 case "$use64bitall" in
5112 "$define"|true|[yY]*)
5113 : Look for a hint-file generated 'call-back-unit'.  If the
5114 : user has specified that a maximally 64-bit perl is to be built,
5115 : we may need to set or change some other defaults.
5116         if $test -f use64bitall.cbu; then
5117                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5118                 . ./use64bitall.cbu
5119         fi
5120         case "$longsize" in
5121         4) case "$archname64" in
5122            ''|64int) archname64=64all ;;
5123            esac
5124            ;;
5125         esac
5126         ;;
5127 esac
5128
5129 echo " "
5130 echo "Checking for GNU C Library..." >&4
5131 cat >gnulibc.c <<EOM
5132 #include <stdio.h>
5133 int main()
5134 {
5135 #ifdef __GLIBC__
5136     exit(0);
5137 #else
5138     exit(1);
5139 #endif
5140 }
5141 EOM
5142 set gnulibc
5143 if eval $compile_ok && ./gnulibc; then
5144         val="$define"
5145         echo "You are using the GNU C Library"
5146 else
5147         val="$undef"
5148         echo "You are not using the GNU C Library"
5149 fi
5150 $rm -f gnulibc*
5151 set d_gnulibc
5152 eval $setvar
5153
5154 : see if nm is to be used to determine whether a symbol is defined or not
5155 case "$usenm" in
5156 '')
5157         dflt=''
5158         case "$d_gnulibc" in
5159         "$define")
5160                 echo " "
5161                 echo "nm probably won't work on the GNU C Library." >&4
5162                 dflt=n
5163                 ;;
5164         esac
5165         case "$dflt" in
5166         '') 
5167                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5168                         echo " "
5169                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5170                         echo "'nm' won't be sufficient on this sytem." >&4
5171                         dflt=n
5172                 fi
5173                 ;;
5174         esac
5175         case "$dflt" in
5176         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5177                 if $test $dflt -gt 20; then
5178                         dflt=y
5179                 else
5180                         dflt=n
5181                 fi
5182                 ;;
5183         esac
5184         ;;
5185 *)
5186         case "$usenm" in
5187         true|$define) dflt=y;;
5188         *) dflt=n;;
5189         esac
5190         ;;
5191 esac
5192 $cat <<EOM
5193
5194 I can use $nm to extract the symbols from your C libraries. This
5195 is a time consuming task which may generate huge output on the disk (up
5196 to 3 megabytes) but that should make the symbols extraction faster. The
5197 alternative is to skip the 'nm' extraction part and to compile a small
5198 test program instead to determine whether each symbol is present. If
5199 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5200 this may be the best solution.
5201
5202 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5203
5204 EOM
5205 rp="Shall I use $nm to extract C symbols from the libraries?"
5206 . ./myread
5207 case "$ans" in
5208 [Nn]*) usenm=false;;
5209 *) usenm=true;;
5210 esac
5211
5212 runnm=$usenm
5213 case "$reuseval" in
5214 true) runnm=false;;
5215 esac
5216
5217 : nm options which may be necessary
5218 case "$nm_opt" in
5219 '') if $test -f /mach_boot; then
5220                 nm_opt=''       # Mach
5221         elif $test -d /usr/ccs/lib; then
5222                 nm_opt='-p'     # Solaris (and SunOS?)
5223         elif $test -f /dgux; then
5224                 nm_opt='-p'     # DG-UX
5225         elif $test -f /lib64/rld; then
5226                 nm_opt='-p'     # 64-bit Irix
5227         else
5228                 nm_opt=''
5229         fi;;
5230 esac
5231
5232 : nm options which may be necessary for shared libraries but illegal
5233 : for archive libraries.  Thank you, Linux.
5234 case "$nm_so_opt" in
5235 '')     case "$myuname" in
5236         *linux*)
5237                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5238                         nm_so_opt='--dynamic'
5239                 fi
5240                 ;;
5241         esac
5242         ;;
5243 esac
5244
5245 case "$runnm" in
5246 true)
5247 : get list of predefined functions in a handy place
5248 echo " "
5249 case "$libc" in
5250 '') libc=unknown
5251         case "$libs" in
5252         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5253         esac
5254         ;;
5255 esac
5256 libnames='';
5257 case "$libs" in
5258 '') ;;
5259 *)  for thislib in $libs; do
5260         case "$thislib" in
5261         -lc|-lc_s)
5262                 : Handle C library specially below.
5263                 ;;
5264         -l*)
5265                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5266                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5267                         :
5268                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5269                         :
5270                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5271                         :
5272                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5273                         :
5274                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5275                         :
5276                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5277                         :
5278                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5279                         :
5280                 else
5281                         try=''
5282                 fi
5283                 libnames="$libnames $try"
5284                 ;;
5285         *) libnames="$libnames $thislib" ;;
5286         esac
5287         done
5288         ;;
5289 esac
5290 xxx=normal
5291 case "$libc" in
5292 unknown)
5293         set /lib/libc.$so
5294         for xxx in $libpth; do
5295                 $test -r $1 || set $xxx/libc.$so
5296                 : The messy sed command sorts on library version numbers.
5297                 $test -r $1 || \
5298                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5299                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5300                                 h
5301                                 s/[0-9][0-9]*/0000&/g
5302                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5303                                 G
5304                                 s/\n/ /' | \
5305                          $sort | $sed -e 's/^.* //'`
5306                 eval set \$$#
5307         done
5308         $test -r $1 || set /usr/ccs/lib/libc.$so
5309         $test -r $1 || set /lib/libsys_s$_a
5310         ;;
5311 *)
5312         set blurfl
5313         ;;
5314 esac
5315 if $test -r "$1"; then
5316         echo "Your (shared) C library seems to be in $1."
5317         libc="$1"
5318 elif $test -r /lib/libc && $test -r /lib/clib; then
5319         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5320         xxx=apollo
5321         libc='/lib/clib /lib/libc'
5322         if $test -r /lib/syslib; then
5323                 echo "(Your math library is in /lib/syslib.)"
5324                 libc="$libc /lib/syslib"
5325         fi
5326 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5327         echo "Your C library seems to be in $libc, as you said before."
5328 elif $test -r $incpath/usr/lib/libc$_a; then
5329         libc=$incpath/usr/lib/libc$_a;
5330         echo "Your C library seems to be in $libc.  That's fine."
5331 elif $test -r /lib/libc$_a; then
5332         libc=/lib/libc$_a;
5333         echo "Your C library seems to be in $libc.  You're normal."
5334 else
5335         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5336                 :
5337         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5338                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5339         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5340                 :
5341         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5342                 :
5343         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5344                 :
5345         else
5346                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5347         fi
5348         if $test -r "$tans"; then
5349                 echo "Your C library seems to be in $tans, of all places."
5350                 libc=$tans
5351         else
5352                 libc='blurfl'
5353         fi
5354 fi
5355 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5356         dflt="$libc"
5357         cat <<EOM
5358
5359 If the guess above is wrong (which it might be if you're using a strange
5360 compiler, or your machine supports multiple models), you can override it here.
5361
5362 EOM
5363 else
5364         dflt=''
5365         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5366         cat >&4 <<EOM
5367 I can't seem to find your C library.  I've looked in the following places:
5368
5369 EOM
5370         $sed 's/^/      /' libpath
5371         cat <<EOM
5372
5373 None of these seems to contain your C library. I need to get its name...
5374
5375 EOM
5376 fi
5377 fn=f
5378 rp='Where is your C library?'
5379 . ./getfile
5380 libc="$ans"
5381
5382 echo " "
5383 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5384 set X `cat libnames`
5385 shift
5386 xxx=files
5387 case $# in 1) xxx=file; esac
5388 echo "Extracting names from the following $xxx for later perusal:" >&4
5389 echo " "
5390 $sed 's/^/      /' libnames >&4
5391 echo " "
5392 $echo $n "This may take a while...$c" >&4
5393
5394 for file in $*; do
5395         case $file in
5396         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5397         *) $nm $nm_opt $file 2>/dev/null;;
5398         esac
5399 done >libc.tmp
5400
5401 $echo $n ".$c"
5402 $grep fprintf libc.tmp > libc.ptf
5403 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5404 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5405 xxx='[ADTSIW]'
5406 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5407         eval $xscan;\
5408         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5409                 eval $xrun
5410 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5411         eval $xscan;\
5412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5413                 eval $xrun
5414 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5415         eval $xscan;\
5416         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5417                 eval $xrun
5418 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5419         eval $xscan;\
5420         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5421                 eval $xrun
5422 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5423         eval $xscan;\
5424         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5425                 eval $xrun
5426 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5427         eval $xscan;\
5428         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5429                 eval $xrun
5430 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5431                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5432         eval $xscan;\
5433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5434                 eval $xrun
5435 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5436         eval $xscan;\
5437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5438                 eval $xrun
5439 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5440         eval $xscan;\
5441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5442                 eval $xrun
5443 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5444         eval $xscan;\
5445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5446                 eval $xrun
5447 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5448         eval $xscan;\
5449         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5450                 eval $xrun
5451 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5452         eval $xscan;\
5453         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5454                 eval $xrun
5455 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5456         eval $xscan;\
5457         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5458                 eval $xrun
5459 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5460         eval $xscan;\
5461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5462                 eval $xrun
5463 else
5464         $nm -p $* 2>/dev/null >libc.tmp
5465         $grep fprintf libc.tmp > libc.ptf
5466         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5467                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5468         then
5469                 nm_opt='-p'
5470                 eval $xrun
5471         else
5472                 echo " "
5473                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5474                 com=''
5475                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5476                         for thisname in $libnames $libc; do
5477                                 $ar t $thisname >>libc.tmp
5478                         done
5479                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5480                         echo "Ok." >&4
5481                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5482                         # Repeat libc to extract forwarders to DLL entries too
5483                         for thisname in $libnames $libc; do
5484                                 $ar tv $thisname >>libc.tmp
5485                                 # Revision 50 of EMX has bug in $ar.
5486                                 # it will not extract forwarders to DLL entries
5487                                 # Use emximp which will extract exactly them.
5488                                 emximp -o tmp.imp $thisname \
5489                                     2>/dev/null && \
5490                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5491                                     < tmp.imp >>libc.tmp
5492                                 $rm tmp.imp
5493                         done
5494                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5495                         echo "Ok." >&4
5496                 else
5497                         echo "$ar didn't seem to work right." >&4
5498                         echo "Maybe this is a Cray...trying bld instead..." >&4
5499                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5500                         then
5501                                 for thisname in $libnames; do
5502                                         bld t $libnames | \
5503                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5504                                         $ar t $thisname >>libc.tmp
5505                                 done
5506                                 echo "Ok." >&4
5507                         else
5508                                 echo "That didn't work either.  Giving up." >&4
5509                                 exit 1
5510                         fi
5511                 fi
5512         fi
5513 fi
5514 nm_extract="$com"
5515 if $test -f /lib/syscalls.exp; then
5516         echo " "
5517         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5518         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5519 fi
5520 ;;
5521 esac
5522 $rm -f libnames libpath
5523
5524 : is a C symbol defined?
5525 csym='tlook=$1;
5526 case "$3" in
5527 -v) tf=libc.tmp; tc=""; tdc="";;
5528 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5529 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5530 esac;
5531 tx=yes;
5532 case "$reuseval-$4" in
5533 true-) ;;
5534 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5535 esac;
5536 case "$tx" in
5537 yes)
5538         case "$runnm" in
5539         true)
5540                 if $contains $tlook $tf >/dev/null 2>&1;
5541                 then tval=true;
5542                 else tval=false;
5543                 fi;;
5544         *)
5545                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5546                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5547                 then tval=true;
5548                 else tval=false;
5549                 fi;
5550                 $rm -f t t.c;;
5551         esac;;
5552 *)
5553         case "$tval" in
5554         $define) tval=true;;
5555         *) tval=false;;
5556         esac;;
5557 esac;
5558 eval "$2=$tval"'
5559
5560 : define an is-in-libc? function
5561 inlibc='echo " "; td=$define; tu=$undef;
5562 sym=$1; var=$2; eval "was=\$$2";
5563 tx=yes;
5564 case "$reuseval$was" in
5565 true) ;;
5566 true*) tx=no;;
5567 esac;
5568 case "$tx" in
5569 yes)
5570         set $sym tres -f;
5571         eval $csym;
5572         case "$tres" in
5573         true)
5574                 echo "$sym() found." >&4;
5575                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5576         *)
5577                 echo "$sym() NOT found." >&4;
5578                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5579         esac;;
5580 *)
5581         case "$was" in
5582         $define) echo "$sym() found." >&4;;
5583         *) echo "$sym() NOT found." >&4;;
5584         esac;;
5585 esac'
5586
5587 : see if sqrtl exists
5588 set sqrtl d_sqrtl
5589 eval $inlibc
5590
5591 case "$ccflags" in
5592 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5593 esac
5594
5595 case "$uselongdouble" in
5596 $define|true|[yY]*)     dflt='y';;
5597 *) dflt='n';;
5598 esac
5599 cat <<EOM
5600
5601 Perl can be built to take advantage of long doubles which
5602 (if available) may give more accuracy and range for floating point numbers.
5603
5604 If this doesn't make any sense to you, just accept the default '$dflt'.
5605 EOM
5606 rp='Try to use long doubles if available?'
5607 . ./myread
5608 case "$ans" in
5609 y|Y)    val="$define"   ;;
5610 *)      val="$undef"    ;;
5611 esac
5612 set uselongdouble
5613 eval $setvar
5614
5615 case "$uselongdouble" in
5616 true|[yY]*) uselongdouble="$define" ;;
5617 esac
5618
5619 case "$uselongdouble" in
5620 $define)
5621 : Look for a hint-file generated 'call-back-unit'.  If the
5622 : user has specified that long doubles should be used,
5623 : we may need to set or change some other defaults.
5624         if $test -f uselongdouble.cbu; then
5625                 echo "Your platform has some specific hints for long doubles, using them..."
5626                 . ./uselongdouble.cbu
5627         else
5628                 $cat <<EOM
5629 (Your platform doesn't have any specific hints for long doubles.)
5630 EOM
5631         fi
5632         ;;
5633 esac
5634
5635 case "$uselongdouble:$d_sqrtl" in
5636 $define:$undef)
5637                 $cat <<EOM >&4
5638
5639 *** You requested the use of long doubles but you do not seem to have
5640 *** the mathematic functions for long doubles.  I'm disabling the use
5641 *** of long doubles.
5642
5643 EOM
5644         uselongdouble=$undef
5645         ;;
5646 esac
5647
5648 : check for length of double
5649 echo " "
5650 case "$doublesize" in
5651 '')
5652         echo "Checking to see how big your double precision numbers are..." >&4
5653         $cat >try.c <<'EOCP'
5654 #include <stdio.h>
5655 int main()
5656 {
5657     printf("%d\n", (int)sizeof(double));
5658     exit(0);
5659 }
5660 EOCP
5661         set try
5662         if eval $compile_ok; then
5663                 doublesize=`./try`
5664                 echo "Your double is $doublesize bytes long."
5665         else
5666                 dflt='8'
5667                 echo "(I can't seem to compile the test program.  Guessing...)"
5668                 rp="What is the size of a double precision number (in bytes)?"
5669                 . ./myread
5670                 doublesize="$ans"
5671         fi
5672         ;;
5673 esac
5674 $rm -f try.c try
5675
5676 : check for long doubles
5677 echo " "
5678 echo "Checking to see if you have long double..." >&4
5679 echo 'int main() { long double x = 7.0; }' > try.c
5680 set try
5681 if eval $compile; then
5682         val="$define"
5683         echo "You have long double."
5684 else
5685         val="$undef"
5686         echo "You do not have long double."
5687 fi
5688 $rm try.*
5689 set d_longdbl
5690 eval $setvar
5691
5692 : check for length of long double
5693 case "${d_longdbl}${longdblsize}" in
5694 $define)
5695         echo " "
5696         echo "Checking to see how big your long doubles are..." >&4
5697         $cat >try.c <<'EOCP'
5698 #include <stdio.h>
5699 int main()
5700 {
5701         printf("%d\n", sizeof(long double));
5702 }
5703 EOCP
5704         set try
5705         set try
5706         if eval $compile; then
5707                 longdblsize=`./try$exe_ext`
5708                 echo "Your long doubles are $longdblsize bytes long."
5709         else
5710                 dflt='8'
5711                 echo " "
5712                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5713                 rp="What is the size of a long double (in bytes)?"
5714                 . ./myread
5715                 longdblsize="$ans"
5716         fi
5717         if $test "X$doublesize" = "X$longdblsize"; then
5718                 echo "(That isn't any different from an ordinary double.)"
5719         fi      
5720         ;;
5721 esac
5722 $rm -f try.* try
5723
5724 case "$useperlio" in
5725 $define|true|[yY]*|'')  dflt='y';;
5726 *) dflt='n';;
5727 esac
5728 cat <<EOM
5729
5730 Previous version of $package used the standard IO mechanisms as
5731 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5732 alternate IO mechanisms via the PerlIO abstraction layer, but the
5733 stdio mechanism is still available if needed.  The abstraction layer
5734 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5735 Using PerlIO with sfio may cause problems with some extension modules.
5736
5737 If this doesn't make any sense to you, just accept the default '$dflt'.
5738 EOM
5739 rp='Use the PerlIO abstraction layer?'
5740 . ./myread
5741 case "$ans" in
5742 y|Y) 
5743         val="$define"
5744         ;;
5745 *)      
5746         echo "Ok, doing things the stdio way."
5747         val="$undef"
5748         ;;
5749 esac
5750 set useperlio
5751 eval $setvar 
5752
5753 case "$usesocks" in
5754 $define|true|[yY]*)
5755         case "$useperlio" in
5756         $define|true|[yY]*) ;;
5757         *)      cat >&4 <<EOM
5758
5759 You are using the SOCKS proxy protocol library which means that you
5760 should also use the PerlIO layer.  You may be headed for trouble.
5761
5762 EOM
5763                 ;;
5764         esac
5765         ;;
5766 esac
5767
5768         
5769 : determine the architecture name
5770 echo " "
5771 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5772         tarch=`arch`"-$osname"
5773 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5774         if uname -m > tmparch 2>&1 ; then
5775                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5776                         -e 's/$/'"-$osname/" tmparch`
5777         else
5778                 tarch="$osname"
5779         fi
5780         $rm -f tmparch
5781 else
5782         tarch="$osname"
5783 fi
5784 case "$myarchname" in
5785 ''|"$tarch") ;;
5786 *)
5787         echo "(Your architecture name used to be $myarchname.)"
5788         archname=''
5789         ;;
5790 esac
5791 myarchname="$tarch"
5792 case "$archname" in
5793 '') dflt="$tarch";;
5794 *) dflt="$archname";;
5795 esac
5796 rp='What is your architecture name'
5797 . ./myread
5798 archname="$ans"
5799 case "$usethreads" in
5800 $define)
5801         echo "Threads selected." >&4
5802         case "$archname" in
5803         *-thread*) echo "...and architecture name already has -thread." >&4
5804                 ;;
5805         *)      archname="$archname-thread"
5806                 echo "...setting architecture name to $archname." >&4
5807                 ;;
5808         esac
5809         ;;
5810 esac
5811 case "$usemultiplicity" in
5812 $define)
5813         echo "Multiplicity selected." >&4
5814         case "$archname" in
5815         *-multi*) echo "...and architecture name already has -multi." >&4
5816                 ;;
5817         *)      archname="$archname-multi"
5818                 echo "...setting architecture name to $archname." >&4
5819                 ;;
5820         esac
5821         ;;
5822 esac
5823 case "$use64bitint$use64bitall" in
5824 *"$define"*)
5825         case "$archname64" in
5826         '')
5827                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5828                 ;;
5829         *)
5830                 case "$use64bitint" in
5831                 "$define") echo "64 bit integers selected." >&4 ;;
5832                 esac
5833                 case "$use64bitall" in
5834                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5835                 esac
5836                 case "$archname" in
5837                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5838                         ;;
5839                 *)      archname="$archname-$archname64"
5840                         echo "...setting architecture name to $archname." >&4
5841                         ;;
5842                 esac
5843                 ;;
5844         esac
5845 esac
5846 case "$uselongdouble" in
5847 $define)
5848         echo "Long doubles selected." >&4
5849         case "$longdblsize" in
5850         $doublesize)
5851                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5852                 ;;
5853         *)
5854                 case "$archname" in
5855                 *-ld*) echo "...and architecture name already has -ld." >&4
5856                         ;;
5857                 *)      archname="$archname-ld"
5858                         echo "...setting architecture name to $archname." >&4
5859                         ;;
5860                 esac
5861                 ;;
5862         esac
5863         ;;
5864 esac
5865 case "$useperlio" in
5866 $define)
5867         echo "Perlio selected." >&4
5868         ;;
5869 *)
5870         echo "Perlio not selected, using stdio." >&4
5871         case "$archname" in
5872         *-stdio*) echo "...and architecture name already has -stdio." >&4
5873                 ;;
5874         *)      archname="$archname-stdio"
5875                 echo "...setting architecture name to $archname." >&4
5876                 ;;
5877         esac
5878         ;;
5879 esac
5880
5881 : determine root of directory hierarchy where package will be installed.
5882 case "$prefix" in
5883 '')
5884         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5885         ;;
5886 *)
5887         dflt="$prefix"
5888         ;;
5889 esac
5890 $cat <<EOM
5891
5892 By default, $package will be installed in $dflt/bin, manual pages
5893 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5894 installation directories. Typically this is something like /usr/local.
5895 If you wish to have binaries under /usr/bin but other parts of the
5896 installation under /usr/local, that's ok: you will be prompted
5897 separately for each of the installation directories, the prefix being
5898 only used to set the defaults.
5899
5900 EOM
5901 fn=d~
5902 rp='Installation prefix to use?'
5903 . ./getfile
5904 oldprefix=''
5905 case "$prefix" in
5906 '') ;;
5907 *)
5908         case "$ans" in
5909         "$prefix") ;;
5910         *) oldprefix="$prefix";;
5911         esac
5912         ;;
5913 esac
5914 prefix="$ans"
5915 prefixexp="$ansexp"
5916
5917 : is AFS running?
5918 echo " "
5919 case "$afs" in
5920 $define|true)   afs=true ;;
5921 $undef|false)   afs=false ;;
5922 *)      if test -d /afs; then
5923                 afs=true
5924         else
5925                 afs=false
5926         fi
5927         ;;
5928 esac
5929 if $afs; then
5930         echo "AFS may be running... I'll be extra cautious then..." >&4
5931 else
5932         echo "AFS does not seem to be running..." >&4
5933 fi
5934
5935 : determine installation prefix for where package is to be installed.
5936 if $afs; then 
5937 $cat <<EOM
5938
5939 Since you are running AFS, I need to distinguish the directory in which
5940 files will reside from the directory in which they are installed (and from
5941 which they are presumably copied to the former directory by occult means).
5942
5943 EOM
5944         case "$installprefix" in
5945         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5946         *) dflt="$installprefix";;
5947         esac
5948 else
5949 $cat <<EOM
5950
5951 In some special cases, particularly when building $package for distribution,
5952 it is convenient to distinguish between the directory in which files should 
5953 be installed from the directory ($prefix) in which they 
5954 will eventually reside.  For most users, these two directories are the same.
5955
5956 EOM
5957         case "$installprefix" in
5958         '') dflt=$prefix ;;
5959         *) dflt=$installprefix;;
5960         esac
5961 fi
5962 fn=d~
5963 rp='What installation prefix should I use for installing files?'
5964 . ./getfile
5965 installprefix="$ans"
5966 installprefixexp="$ansexp"
5967
5968 : set the prefixit variable, to compute a suitable default value
5969 prefixit='case "$3" in
5970 ""|none)
5971         case "$oldprefix" in
5972         "") eval "$1=\"\$$2\"";;
5973         *)
5974                 case "$3" in
5975                 "") eval "$1=";;
5976                 none)
5977                         eval "tp=\"\$$2\"";
5978                         case "$tp" in
5979                         ""|" ") eval "$1=\"\$$2\"";;
5980                         *) eval "$1=";;
5981                         esac;;
5982                 esac;;
5983         esac;;
5984 *)
5985         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5986         case "$tp" in
5987         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5988         /*-$oldprefix/*|\~*-$oldprefix/*)
5989                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5990         *) eval "$1=\"\$$2\"";;
5991         esac;;
5992 esac'
5993
5994
5995 : get the patchlevel
5996 echo " "
5997 echo "Getting the current patchlevel..." >&4
5998 if $test -r $rsrc/patchlevel.h;then
5999         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6000         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6001         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6002         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6003         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6004         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6005        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6006 else
6007         revision=0
6008         patchlevel=0
6009         subversion=0
6010         api_revision=0
6011         api_version=0
6012         api_subversion=0
6013         perl_patchlevel=0
6014         $echo "(You do not have patchlevel.h.  Eek.)"
6015 fi
6016 if $test -r $rsrc/.patch ; then  
6017         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6018                 perl_patchlevel=`cat $rsrc/.patch`
6019         fi
6020 fi
6021 case "$perl_patchlevel" in
6022 0)  ;;
6023 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6024 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6025 esac
6026 case "$osname" in
6027 dos|vms)
6028         : XXX Should be a Configure test for double-dots in filenames.
6029         version=`echo $revision $patchlevel $subversion | \
6030                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6031         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6032                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6033         ;;
6034 *)
6035         version=`echo $revision $patchlevel $subversion | \
6036                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6037         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6038                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6039         ;;
6040 esac
6041 : Special case the 5.005_xx maintenance series, which used 5.005
6042 : without any subversion label as a subdirectory in $sitelib
6043 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6044         api_versionstring='5.005'
6045 fi
6046
6047 : determine installation style
6048 : For now, try to deduce it from prefix unless it is already set.
6049 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6050 case "$installstyle" in
6051 '')     case "$prefix" in
6052                 *perl*) dflt='lib';;
6053                 *) dflt='lib/perl5' ;;
6054         esac
6055         ;;
6056 *)      dflt="$installstyle" ;;
6057 esac
6058 : Probably not worth prompting for this since we prompt for all
6059 : the directories individually, and the prompt would be too long and
6060 : confusing anyway.
6061 installstyle=$dflt
6062
6063 : determine where private library files go
6064 : Usual default is /usr/local/lib/perl5/$version.
6065 : Also allow things like /opt/perl/lib/$version, since 
6066 : /opt/perl/lib/perl5... would be redundant.
6067 : The default "style" setting is made in installstyle.U
6068 case "$installstyle" in
6069 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6070 *)       set dflt privlib lib/$version ;;
6071 esac
6072 eval $prefixit
6073 $cat <<EOM
6074
6075 There are some auxiliary files for $package that need to be put into a
6076 private library directory that is accessible by everyone.
6077
6078 EOM
6079 fn=d~+
6080 rp='Pathname where the private library files will reside?'
6081 . ./getfile
6082 privlib="$ans"
6083 privlibexp="$ansexp"
6084 : Change installation prefix, if necessary.
6085 if $test X"$prefix" != X"$installprefix"; then
6086         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6087 else
6088         installprivlib="$privlibexp"
6089 fi
6090
6091 : set the prefixup variable, to restore leading tilda escape
6092 prefixup='case "$prefixexp" in
6093 "$prefix") ;;
6094 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6095 esac'
6096
6097 : determine where public architecture dependent libraries go
6098 set archlib archlib
6099 eval $prefixit
6100 : privlib default is /usr/local/lib/$package/$version
6101 : archlib default is /usr/local/lib/$package/$version/$archname
6102 : privlib may have an optional trailing /share.
6103 tdflt=`echo $privlib | $sed 's,/share$,,'`
6104 tdflt=$tdflt/$archname
6105 case "$archlib" in
6106 '')     dflt=$tdflt
6107         ;;
6108 *)      dflt="$archlib"
6109     ;;
6110 esac
6111 $cat <<EOM
6112
6113 $spackage contains architecture-dependent library files.  If you are
6114 sharing libraries in a heterogeneous environment, you might store
6115 these files in a separate location.  Otherwise, you can just include
6116 them with the rest of the public library files.
6117
6118 EOM
6119 fn=d+~
6120 rp='Where do you want to put the public architecture-dependent libraries?'
6121 . ./getfile
6122 archlib="$ans"
6123 archlibexp="$ansexp"
6124 if $test X"$archlib" = X"$privlib"; then
6125         d_archlib="$undef"
6126 else
6127         d_archlib="$define"
6128 fi
6129 : Change installation prefix, if necessary.
6130 if $test X"$prefix" != X"$installprefix"; then
6131         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6132 else
6133         installarchlib="$archlibexp"
6134 fi
6135
6136
6137 : Binary compatibility with 5.005 is not possible for builds
6138 : with advanced features
6139 case "$usethreads$usemultiplicity" in
6140 *define*)
6141         bincompat5005="$undef"
6142         d_bincompat5005="$undef"
6143         ;;
6144 *)      $cat <<EOM
6145
6146 This version of Perl can be compiled for binary compatibility with 5.005.
6147 If you decide to do so, you will be able to continue using most of the
6148 extensions that were compiled for Perl 5.005.
6149
6150 EOM
6151         case "$bincompat5005$d_bincompat5005" in
6152         *"$undef"*) dflt=n ;;
6153         *) dflt=y ;;
6154         esac
6155         rp='Binary compatibility with Perl 5.005?'
6156         . ./myread
6157         case "$ans" in
6158         y*) val="$define" ;;
6159         *)  val="$undef" ;;
6160         esac
6161         set d_bincompat5005
6162         eval $setvar
6163         case "$d_bincompat5005" in
6164         "$define")
6165                 bincompat5005="$define"
6166                 ;;
6167         *)      bincompat5005="$undef"
6168                 d_bincompat5005="$undef"
6169                 ;;
6170         esac
6171         ;;
6172 esac
6173
6174
6175 : see if setuid scripts can be secure
6176 $cat <<EOM
6177
6178 Some kernels have a bug that prevents setuid #! scripts from being
6179 secure.  Some sites have disabled setuid #! scripts because of this.
6180
6181 First let's decide if your kernel supports secure setuid #! scripts.
6182 (If setuid #! scripts would be secure but have been disabled anyway,
6183 don't say that they are secure if asked.)
6184
6185 EOM
6186
6187 val="$undef"
6188 if $test -d /dev/fd; then
6189         echo "#!$ls" >reflect
6190         chmod +x,u+s reflect
6191         ./reflect >flect 2>&1
6192         if $contains "/dev/fd" flect >/dev/null; then
6193                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6194                 val="$define"
6195         else
6196                 $cat <<EOM
6197 If you are not sure if they are secure, I can check but I'll need a
6198 username and password different from the one you are using right now.
6199 If you don't have such a username or don't want me to test, simply
6200 enter 'none'.
6201
6202 EOM
6203                 rp='Other username to test security of setuid scripts with?'
6204                 dflt='none'
6205                 . ./myread
6206                 case "$ans" in
6207                 n|none)
6208                         case "$d_suidsafe" in
6209                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6210                                 dflt=n;;
6211                         "$undef")
6212                                 echo "Well, the $hint value is *not* secure." >&4
6213                                 dflt=n;;
6214                         *)      echo "Well, the $hint value *is* secure." >&4
6215                                 dflt=y;;
6216                         esac
6217                         ;;
6218                 *)
6219                         $rm -f reflect flect
6220                         echo "#!$ls" >reflect
6221                         chmod +x,u+s reflect
6222                         echo >flect
6223                         chmod a+w flect
6224                         echo '"su" will (probably) prompt you for '"$ans's password."
6225                         su $ans -c './reflect >flect'
6226                         if $contains "/dev/fd" flect >/dev/null; then
6227                                 echo "Okay, it looks like setuid scripts are secure." >&4
6228                                 dflt=y
6229                         else
6230                                 echo "I don't think setuid scripts are secure." >&4
6231                                 dflt=n
6232                         fi
6233                         ;;
6234                 esac
6235                 rp='Does your kernel have *secure* setuid scripts?'
6236                 . ./myread
6237                 case "$ans" in
6238                 [yY]*)  val="$define";;
6239                 *)      val="$undef";;
6240                 esac
6241         fi
6242 else
6243         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6244         echo "(That's for file descriptors, not floppy disks.)"
6245         val="$undef"
6246 fi
6247 set d_suidsafe
6248 eval $setvar
6249
6250 $rm -f reflect flect
6251
6252 : now see if they want to do setuid emulation
6253 echo " "
6254 val="$undef"
6255 case "$d_suidsafe" in
6256 "$define")
6257         val="$undef"
6258         echo "No need to emulate SUID scripts since they are secure here." >& 4
6259         ;;
6260 *)
6261         $cat <<EOM
6262 Some systems have disabled setuid scripts, especially systems where
6263 setuid scripts cannot be secure.  On systems where setuid scripts have
6264 been disabled, the setuid/setgid bits on scripts are currently
6265 useless.  It is possible for $package to detect those bits and emulate
6266 setuid/setgid in a secure fashion.  This emulation will only work if
6267 setuid scripts have been disabled in your kernel.
6268
6269 EOM
6270         case "$d_dosuid" in
6271         "$define") dflt=y ;;
6272         *) dflt=n ;;
6273         esac
6274         rp="Do you want to do setuid/setgid emulation?"
6275         . ./myread
6276         case "$ans" in
6277         [yY]*)  val="$define";;
6278         *)      val="$undef";;
6279         esac
6280         ;;
6281 esac
6282 set d_dosuid
6283 eval $setvar
6284
6285 : see if this is a malloc.h system
6286 set malloc.h i_malloc
6287 eval $inhdr
6288
6289 : see if stdlib is available
6290 set stdlib.h i_stdlib
6291 eval $inhdr
6292
6293 : determine which malloc to compile in
6294 echo " "
6295 case "$usemymalloc" in
6296 [yY]*|true|$define)     dflt='y' ;;
6297 [nN]*|false|$undef)     dflt='n' ;;
6298 *)      case "$ptrsize" in
6299         4) dflt='y' ;;
6300         *) dflt='n' ;;
6301         esac
6302         ;;
6303 esac
6304 rp="Do you wish to attempt to use the malloc that comes with $package?"
6305 . ./myread
6306 usemymalloc="$ans"
6307 case "$ans" in
6308 y*|true)
6309         usemymalloc='y'
6310         mallocsrc='malloc.c'
6311         mallocobj="malloc$_o"
6312         d_mymalloc="$define"
6313         case "$libs" in
6314         *-lmalloc*)
6315                 : Remove malloc from list of libraries to use
6316                 echo "Removing unneeded -lmalloc from library list" >&4
6317                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6318                 shift
6319                 libs="$*"
6320                 echo "libs = $libs" >&4
6321                 ;;
6322         esac
6323         ;;
6324 *)
6325         usemymalloc='n'
6326         mallocsrc=''
6327         mallocobj=''
6328         d_mymalloc="$undef"
6329         ;;
6330 esac
6331
6332 : compute the return types of malloc and free
6333 echo " "
6334 $cat >malloc.c <<END
6335 #$i_malloc I_MALLOC
6336 #$i_stdlib I_STDLIB
6337 #include <stdio.h>
6338 #include <sys/types.h>
6339 #ifdef I_MALLOC
6340 #include <malloc.h>
6341 #endif
6342 #ifdef I_STDLIB
6343 #include <stdlib.h>
6344 #endif
6345 #ifdef TRY_MALLOC
6346 void *malloc();
6347 #endif
6348 #ifdef TRY_FREE
6349 void free();
6350 #endif
6351 END
6352 case "$malloctype" in
6353 '')
6354         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6355                 malloctype='void *'
6356         else
6357                 malloctype='char *'
6358         fi
6359         ;;
6360 esac
6361 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6362
6363 case "$freetype" in
6364 '')
6365         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6366                 freetype='void'
6367         else
6368                 freetype='int'
6369         fi
6370         ;;
6371 esac
6372 echo "Your system uses $freetype free(), it would seem." >&4
6373 $rm -f malloc.[co]
6374 $cat <<EOM
6375
6376 After $package is installed, you may wish to install various
6377 add-on modules and utilities.  Typically, these add-ons will
6378 be installed under $prefix with the rest
6379 of this package.  However, you may wish to install such add-ons
6380 elsewhere under a different prefix.
6381
6382 If you do not wish to put everything under a single prefix, that's
6383 ok.  You will be prompted for the individual locations; this siteprefix
6384 is only used to suggest the defaults.
6385
6386 The default should be fine for most people.
6387
6388 EOM
6389 fn=d~+
6390 rp='Installation prefix to use for add-on modules and utilities?'
6391 : XXX Here might be another good place for an installstyle setting.
6392 case "$siteprefix" in
6393 '') dflt=$prefix ;;
6394 *)  dflt=$siteprefix ;;
6395 esac
6396 . ./getfile
6397 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6398 oldsiteprefix=''
6399 case "$siteprefix" in
6400 '') ;;
6401 *)      case "$ans" in
6402         "$prefix") ;;
6403         *) oldsiteprefix="$prefix";;
6404         esac
6405         ;;
6406 esac
6407 siteprefix="$ans"
6408 siteprefixexp="$ansexp"
6409
6410 : determine where site specific libraries go.
6411 : Usual default is /usr/local/lib/perl5/site_perl/$version
6412 : The default "style" setting is made in installstyle.U
6413 : XXX No longer works with Prefixit stuff.
6414 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6415 case "$sitelib" in
6416 '') case "$installstyle" in
6417         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6418         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6419         esac
6420         ;;
6421 *)      dflt="$sitelib"
6422         ;;
6423 esac
6424 $cat <<EOM
6425
6426 The installation process will create a directory for
6427 site-specific extensions and modules.  Most users find it convenient
6428 to place all site-specific files in this directory rather than in the
6429 main distribution directory.
6430
6431 EOM
6432 fn=d~+
6433 rp='Pathname for the site-specific library files?'
6434 . ./getfile
6435 sitelib="$ans"
6436 sitelibexp="$ansexp"
6437 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6438 : Change installation prefix, if necessary.
6439 if $test X"$prefix" != X"$installprefix"; then
6440         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6441 else
6442         installsitelib="$sitelibexp"
6443 fi
6444
6445 : determine where site specific architecture-dependent libraries go.
6446 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6447 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6448 : sitelib may have an optional trailing /share.
6449 case "$sitearch" in
6450 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6451         dflt="$dflt/$archname"
6452         ;;
6453 *)      dflt="$sitearch"
6454         ;;
6455 esac
6456 set sitearch sitearch none
6457 eval $prefixit
6458 $cat <<EOM
6459
6460 The installation process will also create a directory for
6461 architecture-dependent site-specific extensions and modules.
6462
6463 EOM
6464 fn=d~+
6465 rp='Pathname for the site-specific architecture-dependent library files?'
6466 . ./getfile
6467 sitearch="$ans"
6468 sitearchexp="$ansexp"
6469 : Change installation prefix, if necessary.
6470 if $test X"$prefix" != X"$installprefix"; then
6471         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6472 else
6473         installsitearch="$sitearchexp"
6474 fi
6475
6476 $cat <<EOM
6477
6478 The installation process will also create a directory for
6479 vendor-supplied add-ons.  Vendors who supply perl with their system
6480 may find it convenient to place all vendor-supplied files in this
6481 directory rather than in the main distribution directory.  This will
6482 ease upgrades between binary-compatible maintenance versions of perl.
6483
6484 Of course you may also use these directories in whatever way you see
6485 fit.  For example, you might use them to access modules shared over a
6486 company-wide network.
6487
6488 The default answer should be fine for most people.
6489 This causes further questions about vendor add-ons to be skipped
6490 and no vendor-specific directories will be configured for perl.
6491
6492 EOM
6493 rp='Do you want to configure vendor-specific add-on directories?'
6494 case "$usevendorprefix" in
6495 define|true|[yY]*) dflt=y ;;
6496 *)      : User may have set vendorprefix directly on Configure command line.
6497         case "$vendorprefix" in
6498         ''|' ') dflt=n ;;
6499         *)      dflt=y ;;
6500         esac
6501         ;;
6502 esac
6503 . ./myread
6504 case "$ans" in
6505 [yY]*)  fn=d~+
6506         rp='Installation prefix to use for vendor-supplied add-ons?'
6507         case "$vendorprefix" in
6508         '') dflt='' ;;
6509         *)  dflt=$vendorprefix ;;
6510         esac
6511         . ./getfile
6512         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6513         oldvendorprefix=''
6514         case "$vendorprefix" in
6515         '') ;;
6516         *)      case "$ans" in
6517                 "$prefix") ;;
6518                 *) oldvendorprefix="$prefix";;
6519                 esac
6520                 ;;
6521         esac
6522         usevendorprefix="$define"
6523         vendorprefix="$ans"
6524         vendorprefixexp="$ansexp"
6525         ;;
6526 *)      usevendorprefix="$undef"
6527         vendorprefix=''
6528         vendorprefixexp=''
6529         ;;
6530 esac
6531
6532 case "$vendorprefix" in
6533 '')     d_vendorlib="$undef"
6534         vendorlib=''
6535         vendorlibexp=''
6536         ;;
6537 *)      d_vendorlib="$define"
6538         : determine where vendor-supplied modules go.
6539         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6540         case "$vendorlib" in
6541         '')
6542                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6543                 case "$installstyle" in
6544                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6545                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6546                 esac
6547                 ;;
6548         *)      dflt="$vendorlib"
6549                 ;;
6550         esac
6551         fn=d~+
6552         rp='Pathname for the vendor-supplied library files?'
6553         . ./getfile
6554         vendorlib="$ans"
6555         vendorlibexp="$ansexp"
6556         ;;
6557 esac
6558 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6559 : Change installation prefix, if necessary.
6560 if $test X"$prefix" != X"$installprefix"; then
6561         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6562 else
6563         installvendorlib="$vendorlibexp"
6564 fi
6565
6566 case "$vendorprefix" in
6567 '')     d_vendorarch="$undef"
6568         vendorarch=''
6569         vendorarchexp=''
6570         ;;
6571 *)      d_vendorarch="$define"
6572         : determine where vendor-supplied architecture-dependent libraries go.
6573         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6574         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6575         : vendorlib may have an optional trailing /share.
6576         case "$vendorarch" in
6577         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6578                 dflt="$dflt/$archname"
6579                 ;;
6580         *)      dflt="$vendorarch" ;;
6581         esac
6582         fn=d~+
6583         rp='Pathname for vendor-supplied architecture-dependent files?'
6584         . ./getfile
6585         vendorarch="$ans"
6586         vendorarchexp="$ansexp"
6587         ;;
6588 esac
6589 : Change installation prefix, if necessary.
6590 if $test X"$prefix" != X"$installprefix"; then
6591         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6592 else
6593         installvendorarch="$vendorarchexp"
6594 fi
6595
6596 : Final catch-all directories to search
6597 $cat <<EOM
6598
6599 Lastly, you can have perl look in other directories for extensions and
6600 modules in addition to those already specified.
6601 These directories will be searched after 
6602         $sitearch 
6603         $sitelib 
6604 EOM
6605 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6606 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6607 echo ' '
6608 case "$otherlibdirs" in
6609 ''|' ') dflt='none' ;;
6610 *)      dflt="$otherlibdirs" ;;
6611 esac
6612 $cat <<EOM
6613 Enter a colon-separated set of extra paths to include in perl's @INC
6614 search path, or enter 'none' for no extra paths.
6615
6616 EOM
6617
6618 rp='Colon-separated list of additional directories for perl to search?'
6619 . ./myread
6620 case "$ans" in
6621 ' '|''|none)    otherlibdirs=' ' ;;     
6622 *)      otherlibdirs="$ans" ;;
6623 esac
6624 case "$otherlibdirs" in
6625 ' ') val=$undef ;;
6626 *)      val=$define ;;
6627 esac
6628 set d_perl_otherlibdirs
6629 eval $setvar
6630
6631 : Cruising for prototypes
6632 echo " "
6633 echo "Checking out function prototypes..." >&4
6634 $cat >prototype.c <<'EOCP'
6635 int main(int argc, char *argv[]) {
6636         exit(0);}
6637 EOCP
6638 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6639         echo "Your C compiler appears to support function prototypes."
6640         val="$define"
6641 else
6642         echo "Your C compiler doesn't seem to understand function prototypes."
6643         val="$undef"
6644 fi
6645 set prototype
6646 eval $setvar
6647 $rm -f prototype*
6648
6649 case "$prototype" in
6650 "$define") ;;
6651 *)      ansi2knr='ansi2knr'
6652         echo " "
6653         cat <<EOM >&4
6654
6655 $me:  FATAL ERROR:
6656 This version of $package can only be compiled by a compiler that 
6657 understands function prototypes.  Unfortunately, your C compiler 
6658         $cc $ccflags
6659 doesn't seem to understand them.  Sorry about that.
6660
6661 If GNU cc is available for your system, perhaps you could try that instead.  
6662
6663 Eventually, we hope to support building Perl with pre-ANSI compilers.
6664 If you would like to help in that effort, please contact <perlbug@perl.org>.
6665
6666 Aborting Configure now.
6667 EOM
6668         exit 2
6669         ;;
6670 esac
6671
6672 : determine where public executables go
6673 echo " "
6674 set dflt bin bin
6675 eval $prefixit
6676 fn=d~
6677 rp='Pathname where the public executables will reside?'
6678 . ./getfile
6679 if $test "X$ansexp" != "X$binexp"; then
6680         installbin=''
6681 fi
6682 bin="$ans"
6683 binexp="$ansexp"
6684 : Change installation prefix, if necessary.
6685 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6686 if $test X"$prefix" != X"$installprefix"; then
6687         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6688 else
6689         installbin="$binexp"
6690 fi
6691
6692 : Find perl5.005 or later.
6693 echo "Looking for a previously installed perl5.005 or later... "
6694 case "$perl5" in
6695 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6696                 : Check if this perl is recent and can load a simple module
6697                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6698                         perl5=$tdir/perl
6699                         break;
6700                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6701                         perl5=$tdir/perl5
6702                         break;
6703                 fi
6704         done
6705         ;;
6706 *)      perl5="$perl5"
6707         ;;
6708 esac
6709 case "$perl5" in
6710 '')     echo "None found.  That's ok.";;
6711 *)      echo "Using $perl5." ;;
6712 esac
6713
6714 : Determine list of previous versions to include in @INC
6715 $cat > getverlist <<EOPL
6716 #!$perl5 -w
6717 use File::Basename;
6718 \$api_versionstring = "$api_versionstring";
6719 \$version = "$version";
6720 \$stem = "$sitelib_stem";
6721 \$archname = "$archname";
6722 EOPL
6723         $cat >> getverlist <<'EOPL'
6724 # Can't have leading @ because metaconfig interprets it as a command!
6725 ;@inc_version_list=();
6726 # XXX Redo to do opendir/readdir? 
6727 if (-d $stem) {
6728     chdir($stem);
6729     ;@candidates = glob("5.*");
6730 }
6731 else {
6732     ;@candidates = ();
6733 }
6734
6735 # XXX ToDo:  These comparisons must be reworked when two-digit
6736 # subversions come along, so that 5.7.10 compares as greater than
6737 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6738 # widespread that we can use the built-in version vectors rather
6739 # than reinventing them here.  For 5.6.0, however, we must
6740 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6741 foreach $d (@candidates) {
6742     if ($d lt $version) {
6743         if ($d ge $api_versionstring) {
6744             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6745         }
6746         elsif ($d ge "5.005") {
6747             unshift(@inc_version_list, grep { -d } $d);
6748         }
6749     }
6750     else {
6751         # Skip newer version.  I.e. don't look in
6752         # 5.7.0 if we're installing 5.6.1.
6753     }
6754 }
6755
6756 if (@inc_version_list) {
6757     print join(' ', @inc_version_list);
6758 }
6759 else {
6760     # Blank space to preserve value for next Configure run.
6761     print " ";
6762 }
6763 EOPL
6764 chmod +x getverlist
6765 case "$inc_version_list" in
6766 '')     if test -x "$perl5$exe_ext"; then
6767                 dflt=`$perl5 getverlist`
6768         else
6769                 dflt='none'
6770         fi
6771         ;;
6772 $undef) dflt='none' ;;
6773 *)  dflt="$inc_version_list" ;;
6774 esac
6775 case "$dflt" in
6776 ''|' ') dflt=none ;;
6777 esac
6778 case "$dflt" in
6779 5.005) case "$bincompat5005" in
6780        $define|true|[yY]*) ;;
6781        *) dflt=none ;;
6782        esac
6783        ;;
6784 esac
6785 $cat <<'EOM'
6786
6787 In order to ease the process of upgrading, this version of perl 
6788 can be configured to use modules built and installed with earlier 
6789 versions of perl that were installed under $prefix.  Specify here
6790 the list of earlier versions that this version of perl should check.
6791 If Configure detected no earlier versions of perl installed under
6792 $prefix, then the list will be empty.  Answer 'none' to tell perl
6793 to not search earlier versions.
6794
6795 The default should almost always be sensible, so if you're not sure,
6796 just accept the default.
6797 EOM
6798
6799 rp='List of earlier versions to include in @INC?'
6800 . ./myread
6801 case "$ans" in
6802 [Nn]one|''|' ') inc_version_list=' ' ;;
6803 *) inc_version_list="$ans" ;;
6804 esac
6805 case "$inc_version_list" in
6806 ''|' ') 
6807         inc_version_list_init='0';;
6808 *)      inc_version_list_init=`echo $inc_version_list |
6809                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6810         ;;
6811 esac
6812 $rm -f getverlist
6813
6814 : determine whether to install perl also as /usr/bin/perl
6815
6816 echo " "
6817 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6818         $cat <<EOM
6819 Many scripts expect perl to be installed as /usr/bin/perl.
6820 I can install the perl you are about to compile also as /usr/bin/perl
6821 (in addition to $installbin/perl).
6822 EOM
6823         case "$installusrbinperl" in
6824         "$undef"|[nN]*) dflt='n';;
6825         *)              dflt='y';;
6826         esac
6827         rp="Do you want to install perl as /usr/bin/perl?"
6828         . ./myread
6829         case "$ans" in
6830         [yY]*)  val="$define";;
6831         *)      val="$undef" ;;
6832         esac
6833 else
6834         val="$undef"
6835 fi
6836 set installusrbinperl
6837 eval $setvar
6838
6839 : see if dld is available
6840 set dld.h i_dld
6841 eval $inhdr
6842
6843 : see if dlopen exists
6844 xxx_runnm="$runnm"
6845 runnm=false
6846 set dlopen d_dlopen
6847 eval $inlibc
6848 runnm="$xxx_runnm"
6849
6850 : determine which dynamic loading, if any, to compile in
6851 echo " "
6852 dldir="ext/DynaLoader"
6853 case "$usedl" in
6854 $define|y|true)
6855         dflt='y'
6856         usedl="$define"
6857         ;;
6858 $undef|n|false)
6859         dflt='n'
6860         usedl="$undef"
6861         ;;
6862 *) 
6863         dflt='n'
6864         case "$d_dlopen" in
6865             $define) dflt='y' ;;
6866         esac
6867         case "$i_dld" in
6868             $define) dflt='y' ;;
6869         esac
6870         : Does a dl_xxx.xs file exist for this operating system
6871         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6872         ;;
6873 esac
6874 rp="Do you wish to use dynamic loading?"
6875 . ./myread
6876 usedl="$ans"
6877 case "$ans" in
6878 y*) usedl="$define"
6879         case "$dlsrc" in
6880         '')
6881                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6882                         dflt="$dldir/dl_${osname}.xs"
6883                 elif $test "$d_dlopen" = "$define" ; then
6884                         dflt="$dldir/dl_dlopen.xs"
6885                 elif $test "$i_dld" = "$define" ; then
6886                         dflt="$dldir/dl_dld.xs"
6887                 else
6888                         dflt=''
6889                 fi
6890                 ;;
6891         *)      dflt="$dldir/$dlsrc"
6892                 ;;
6893         esac
6894     echo "The following dynamic loading files are available:"
6895         : Can not go over to $dldir because getfile has path hard-coded in.
6896         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6897         rp="Source file to use for dynamic loading"
6898         fn="fne"
6899         gfpth="$src"
6900         . ./getfile
6901         usedl="$define"
6902         : emulate basename
6903         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6904
6905         $cat << EOM
6906
6907 Some systems may require passing special flags to $cc -c to
6908 compile modules that will be used to create a shared library.
6909 To use no flags, say "none".
6910
6911 EOM
6912     case "$cccdlflags" in
6913     '') case "$gccversion" in
6914                 '') case "$osname" in
6915                         hpux)   dflt='+z' ;;
6916                         next)   dflt='none' ;;
6917                         irix*)  dflt='-KPIC' ;;
6918                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6919                         sunos)  dflt='-pic' ;;
6920                         *)      dflt='none' ;;
6921                     esac
6922                         ;;
6923                 *)  case "$osname" in
6924                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6925                         *)      dflt='-fpic' ;;
6926                     esac ;;
6927             esac ;;
6928         ' ') dflt='none' ;;
6929     *)  dflt="$cccdlflags" ;;
6930     esac
6931     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6932     . ./myread
6933     case "$ans" in
6934     none) cccdlflags=' ' ;;
6935     *) cccdlflags="$ans" ;;
6936     esac
6937
6938     cat << EOM
6939
6940 Some systems use ld to create libraries that can be dynamically loaded,
6941 while other systems (such as those using ELF) use $cc.
6942
6943 EOM
6944         case "$ld" in
6945         '')     $cat >try.c <<'EOM'
6946 /* Test for whether ELF binaries are produced */
6947 #include <fcntl.h>
6948 #include <stdlib.h>
6949 int main() {
6950         char b[4];
6951         int i = open("a.out",O_RDONLY);
6952         if(i == -1) 
6953                 exit(1); /* fail */
6954         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6955                 exit(0); /* succeed (yes, it's ELF) */
6956         else
6957                 exit(1); /* fail */
6958 }
6959 EOM
6960                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6961                         cat <<EOM
6962 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6963 EOM
6964                         dflt="$cc"
6965                 else
6966                         echo "I'll use ld to build dynamic libraries."
6967                         dflt='ld'
6968                 fi
6969                 rm -f try.c a.out
6970                 ;;
6971         *)      dflt="$ld"
6972                 ;;
6973         esac
6974
6975     rp="What command should be used to create dynamic libraries?"
6976     . ./myread
6977         ld="$ans"
6978
6979     cat << EOM
6980
6981 Some systems may require passing special flags to $ld to create a
6982 library that can be dynamically loaded.  If your ld flags include
6983 -L/other/path options to locate libraries outside your loader's normal
6984 search path, you may need to specify those -L options here as well.  To
6985 use no flags, say "none".
6986
6987 EOM
6988     case "$lddlflags" in
6989     '') case "$osname" in
6990                         beos) dflt='-nostart' ;;
6991                         hpux) dflt='-b';
6992                               case "$gccversion" in
6993                               '') dflt="$dflt +vnocompatwarnings" ;;
6994                               esac
6995                               ;;        
6996                         linux|irix*)    dflt='-shared' ;;
6997                         next)  dflt='none' ;;
6998                         solaris) dflt='-G' ;;
6999                         sunos) dflt='-assert nodefinitions' ;;
7000                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7001                 *)     dflt='none' ;;
7002                         esac
7003                         ;;
7004     *) dflt="$lddlflags" ;;
7005     esac
7006
7007         : Try to guess additional flags to pick up local libraries.
7008         : Be careful not to append to a plain 'none'
7009         case "$dflt" in
7010         none) dflt='' ;;
7011         esac
7012         for thisflag in $ldflags; do
7013                 case "$thisflag" in
7014                 -L*|-R*)
7015                         case " $dflt " in
7016                         *" $thisflag "*) ;;
7017                         *) dflt="$dflt $thisflag" ;;
7018                         esac
7019                         ;;
7020                 esac
7021         done
7022
7023         case "$dflt" in
7024         ''|' ') dflt='none' ;;
7025         esac
7026
7027     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7028     . ./myread
7029     case "$ans" in
7030     none) lddlflags=' ' ;;
7031     *) lddlflags="$ans" ;;
7032     esac
7033
7034         cat <<EOM
7035
7036 Some systems may require passing special flags to $cc to indicate that
7037 the resulting executable will use dynamic linking.  To use no flags,
7038 say "none".
7039
7040 EOM
7041     case "$ccdlflags" in
7042     '') case "$osname" in
7043                 hpux)   dflt='-Wl,-E' ;;
7044                 linux)  dflt='-rdynamic' ;;
7045                 next)   dflt='none' ;;
7046                 sunos)  dflt='none' ;;
7047                 *)      dflt='none' ;;
7048             esac ;;
7049     ' ')  dflt='none' ;;
7050     *)  dflt="$ccdlflags" ;;
7051     esac
7052     rp="Any special flags to pass to $cc to use dynamic linking?"
7053     . ./myread
7054     case "$ans" in
7055     none) ccdlflags=' ' ;;
7056     *) ccdlflags="$ans" ;;
7057     esac
7058     ;;
7059 *)  usedl="$undef"
7060         ld='ld'
7061     dlsrc='dl_none.xs'
7062     lddlflags=''
7063     ccdlflags=''
7064     ;;
7065 esac
7066
7067 also=''
7068 case "$usedl" in
7069 $undef)
7070         # No dynamic loading being used, so don't bother even to prompt.
7071         useshrplib='false'
7072         ;;
7073 *)      case "$useshrplib" in
7074         '')     case "$osname" in
7075                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7076                         dflt=y
7077                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7078                         ;;
7079                 next*)
7080                         case "$osvers" in
7081                         4*)     dflt=y
7082                                 also='Building a shared libperl is needed for MAB support.'
7083                                 ;;
7084                         *)      dflt=n
7085                                 ;;
7086                         esac
7087                         ;;
7088                 *)      dflt=n
7089                         ;;
7090                 esac
7091                 ;;
7092         $define|true|[Yy]*)
7093                 dflt=y
7094                 ;;
7095         *)      dflt=n
7096                 ;;
7097         esac
7098         $cat << EOM
7099
7100 The perl executable is normally obtained by linking perlmain.c with
7101 libperl${_a}, any static extensions (usually just DynaLoader), and
7102 any other libraries needed on this system (such as -lm, etc.).  Since
7103 your system supports dynamic loading, it is probably possible to build
7104 a shared libperl.$so.  If you will have more than one executable linked
7105 to libperl.$so, this will significantly reduce the size of each
7106 executable, but it may have a noticeable affect on performance.  The
7107 default is probably sensible for your system.
7108 $also
7109
7110 EOM
7111         rp="Build a shared libperl.$so (y/n)"
7112         . ./myread
7113         case "$ans" in
7114         true|$define|[Yy]*)
7115                 useshrplib='true'  ;;
7116         *)      useshrplib='false' ;;
7117         esac
7118         ;;
7119 esac
7120
7121 case "$useshrplib" in
7122 true)
7123         case "$libperl" in
7124         '')
7125                 # Figure out a good name for libperl.so.  Since it gets stored in
7126                 # a version-specific architecture-dependent library, the version
7127                 # number isn't really that important, except for making cc/ld happy.
7128                 #
7129                 # A name such as libperl.so.3.1
7130                 majmin="libperl.$so.$patchlevel.$subversion"
7131                 # A name such as libperl.so.301
7132                 majonly=`echo $patchlevel $subversion |
7133                         $awk '{printf "%d%02d", $1, $2}'`
7134                 majonly=libperl.$so.$majonly
7135                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7136                 # rely on figuring it out from the naming of libc.
7137                 case "${osname}${osvers}" in
7138                 next4*)
7139                         dflt=libperl.5.$so
7140                         # XXX How handle the --version stuff for MAB?
7141                         ;;
7142                 linux*)  # ld won't link with a bare -lperl otherwise.
7143                         dflt=libperl.$so
7144                         ;;
7145                 cygwin*) # include version
7146                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7147                         ;;
7148                 *)      # Try to guess based on whether libc has major.minor.
7149                         case "$libc" in
7150                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7151                         *libc.$so.[0-9]*) dflt=$majonly ;;
7152                         *)      dflt=libperl.$so ;;
7153                         esac
7154                         ;;
7155                 esac
7156                 ;;
7157         *)      dflt=$libperl
7158                 ;;
7159         esac
7160         cat << EOM
7161
7162 I need to select a good name for the shared libperl.  If your system uses
7163 library names with major and minor numbers, then you might want something
7164 like $majmin.  Alternatively, if your system uses a single version
7165 number for shared libraries, then you might want to use $majonly.
7166 Or, your system might be quite happy with a simple libperl.$so.
7167
7168 Since the shared libperl will get installed into a version-specific
7169 architecture-dependent directory, the version number of the shared perl
7170 library probably isn't important, so the default should be o.k.
7171
7172 EOM
7173         rp='What name do you want to give to the shared libperl?'
7174         . ./myread
7175         libperl=$ans
7176         echo "Ok, I'll use $libperl"
7177         ;;
7178 *)
7179         libperl="libperl${_a}"
7180         ;;
7181 esac
7182
7183 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7184 case "$shrpdir" in
7185 '') ;;
7186 *)      $cat >&4 <<EOM
7187 WARNING:  Use of the shrpdir variable for the installation location of
7188 the shared $libperl is not supported.  It was never documented and
7189 will not work in this version.  Let me (perlbug@perl.org)
7190 know of any problems this may cause.
7191
7192 EOM
7193         case "$shrpdir" in
7194         "$archlibexp/CORE")
7195                 $cat >&4 <<EOM
7196 But your current setting of $shrpdir is
7197 the default anyway, so it's harmless.
7198 EOM
7199                 ;;
7200         *)
7201                 $cat >&4 <<EOM
7202 Further, your current attempted setting of $shrpdir
7203 conflicts with the value of $archlibexp/CORE
7204 that installperl will use.
7205 EOM
7206                 ;;
7207         esac
7208         ;;
7209 esac
7210
7211 # How will the perl executable find the installed shared $libperl?
7212 # Add $xxx to ccdlflags.
7213 # If we can't figure out a command-line option, use $shrpenv to
7214 # set env LD_RUN_PATH.  The main perl makefile uses this.
7215 shrpdir=$archlibexp/CORE
7216 xxx=''
7217 tmp_shrpenv=''
7218 if "$useshrplib"; then
7219     case "$osname" in 
7220         aix)
7221                 # We'll set it in Makefile.SH...
7222                 ;;
7223         solaris|netbsd)
7224                 xxx="-R $shrpdir"
7225                 ;;
7226         freebsd)
7227                 xxx="-Wl,-R$shrpdir"
7228                 ;;
7229         linux|irix*|dec_osf)
7230                 xxx="-Wl,-rpath,$shrpdir"
7231                 ;;
7232         next)
7233                 # next doesn't like the default...
7234                 ;;
7235         beos)
7236                 # beos doesn't like the default, either.
7237                 ;;
7238         hpux*)
7239                 # hpux doesn't like the default, either.
7240                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7241                 ;;
7242         *)
7243                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7244                 ;;
7245         esac
7246         case "$xxx" in
7247         '') ;;
7248         *)      
7249                 # Only add $xxx if it isn't already in ccdlflags.
7250                 case " $ccdlflags " in
7251                 *" $xxx "*)     ;;
7252                 *)      ccdlflags="$ccdlflags $xxx"
7253                         cat <<EOM >&4
7254
7255 Adding $xxx to the flags
7256 passed to $ld so that the perl executable will find the 
7257 installed shared $libperl.
7258
7259 EOM
7260                         ;;
7261                 esac
7262                 ;;
7263         esac
7264 fi
7265 # Fix ccdlflags in AIX for building external extensions.
7266 # (For building Perl itself bare -bE:perl.exp is needed,
7267 #  Makefile.SH takes care of this.)
7268 case "$osname" in
7269 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7270 esac
7271 # Respect a hint or command-line value.
7272 case "$shrpenv" in
7273 '') shrpenv="$tmp_shrpenv" ;;
7274 esac
7275 case "$ldlibpthname" in
7276 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7277 none)   ldlibpthname='' ;;
7278 esac
7279
7280 : determine where manual pages are on this system
7281 echo " "
7282 case "$sysman" in
7283 '') 
7284         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7285         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7286         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7287         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7288         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7289         sysman=`./loc . /usr/man/man1 $syspath`
7290         ;;
7291 esac
7292 if $test -d "$sysman"; then
7293         echo "System manual is in $sysman." >&4
7294 else
7295         echo "Could not find manual pages in source form." >&4
7296 fi
7297
7298 : determine where manual pages go
7299 set man1dir man1dir none
7300 eval $prefixit
7301 $cat <<EOM
7302
7303 $spackage has manual pages available in source form.
7304 EOM
7305 case "$nroff" in
7306 nroff)
7307         echo "However, you don't have nroff, so they're probably useless to you."
7308         case "$man1dir" in
7309         '') man1dir="none";;
7310         esac;;
7311 esac
7312 echo "If you don't want the manual sources installed, answer 'none'."
7313 case "$man1dir" in
7314 ' ') dflt=none
7315         ;;
7316 '')
7317         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7318         lookpath="$lookpath $prefixexp/man/p_man/man1"
7319         lookpath="$lookpath $prefixexp/man/u_man/man1"
7320         lookpath="$lookpath $prefixexp/man/man.1"
7321         case "$sysman" in
7322         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7323         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7324         esac
7325         set dflt
7326         eval $prefixup
7327         ;;
7328 *)  dflt="$man1dir"
7329         ;;
7330 esac
7331 echo " "
7332 fn=dn+~
7333 rp="Where do the main $spackage manual pages (source) go?"
7334 . ./getfile
7335 if $test "X$man1direxp" != "X$ansexp"; then
7336         installman1dir=''
7337 fi
7338 man1dir="$ans"
7339 man1direxp="$ansexp"
7340 case "$man1dir" in
7341 '')     man1dir=' '
7342         installman1dir='';;
7343 esac
7344
7345 : Change installation prefix, if necessary.
7346 if $test X"$prefix" != X"$installprefix"; then
7347         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7348 else
7349         installman1dir="$man1direxp"
7350 fi
7351
7352 : What suffix to use on installed man pages
7353
7354 case "$man1dir" in
7355 ' ')
7356         man1ext='0'
7357         ;;
7358 *)
7359         rp="What suffix should be used for the main $spackage man pages?"
7360         case "$man1ext" in
7361         '')     case "$man1dir" in
7362                 *1)  dflt=1 ;;
7363                 *1p) dflt=1p ;;
7364                 *1pm) dflt=1pm ;;
7365                 *l) dflt=l;;
7366                 *n) dflt=n;;
7367                 *o) dflt=o;;
7368                 *p) dflt=p;;
7369                 *C) dflt=C;;
7370                 *L) dflt=L;;
7371                 *L1) dflt=L1;;
7372                 *) dflt=1;;
7373                 esac
7374                 ;;
7375         *)      dflt="$man1ext";;
7376         esac
7377         . ./myread
7378         man1ext="$ans"
7379         ;;
7380 esac
7381
7382 : see if we can have long filenames
7383 echo " "
7384 first=123456789abcdef
7385 $rm -f $first
7386 if (echo hi >$first) 2>/dev/null; then
7387         if $test -f 123456789abcde; then
7388                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7389                 val="$undef"
7390         else
7391                 echo 'You can have filenames longer than 14 characters.'>&4
7392                 val="$define"
7393         fi
7394 else
7395         $cat <<'EOM'
7396 You can't have filenames longer than 14 chars.
7397 You can't even think about them!
7398 EOM
7399         val="$undef"
7400 fi 
7401 set d_flexfnam
7402 eval $setvar
7403 $rm -rf 123456789abcde*
7404
7405 : determine where library module manual pages go
7406 set man3dir man3dir none
7407 eval $prefixit
7408 $cat <<EOM
7409
7410 $spackage has manual pages for many of the library modules.
7411 EOM
7412
7413 case "$nroff" in
7414 nroff)
7415         $cat <<'EOM'
7416 However, you don't have nroff, so they're probably useless to you.
7417 EOM
7418         case "$man3dir" in
7419         '') man3dir="none";;
7420         esac;;
7421 esac
7422
7423 case "$d_flexfnam" in
7424 undef)
7425         $cat <<'EOM'
7426 However, your system can't handle the long file names like File::Basename.3. 
7427 EOM
7428         case "$man3dir" in
7429         '') man3dir="none";;
7430         esac;;
7431 esac
7432
7433 echo "If you don't want the manual sources installed, answer 'none'."
7434 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7435 case "$man3dir" in
7436 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7437         if $test -d "$privlib/man/man3"; then
7438                 cat <<EOM >&4
7439
7440 WARNING:  Previous versions of perl installed man3 pages into
7441 $privlib/man/man3.  This version will suggest a 
7442 new default of $dflt.  
7443 EOM
7444                 tdflt=$dflt
7445                 dflt='n'
7446                 rp='Do you wish to preserve the old behavior?(y/n)'
7447                 . ./myread
7448                 case "$ans" in
7449                 y*) dflt="$privlib/man/man3" ;;
7450                 *)  dflt=$tdflt ;;
7451                 esac
7452     fi
7453         ;;
7454 *)      dflt="$man3dir" ;;
7455 esac
7456 case "$dflt" in
7457 ' ') dflt=none ;;
7458 esac
7459 echo " "
7460 fn=dn+~
7461 rp="Where do the $package library man pages (source) go?"
7462 . ./getfile
7463 man3dir="$ans"
7464 man3direxp="$ansexp"
7465 case "$man3dir" in
7466 '')     man3dir=' '
7467         installman3dir='';;
7468 esac
7469
7470 : Change installation prefix, if necessary.
7471 if $test X"$prefix" != X"$installprefix"; then
7472         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7473 else
7474         installman3dir="$man3direxp"
7475 fi
7476
7477 : What suffix to use on installed man pages
7478 case "$man3dir" in
7479 ' ')
7480         man3ext='0'
7481         ;;
7482 *)
7483         rp="What suffix should be used for the $package library man pages?"
7484         case "$man3ext" in
7485         '')     case "$man3dir" in
7486                 *3)  dflt=3 ;;
7487                 *3p) dflt=3p ;;
7488                 *3pm) dflt=3pm ;;
7489                 *l) dflt=l;;
7490                 *n) dflt=n;;
7491                 *o) dflt=o;;
7492                 *p) dflt=p;;
7493                 *C) dflt=C;;
7494                 *L) dflt=L;;
7495                 *L3) dflt=L3;;
7496                 *) dflt=3;;
7497                 esac
7498                 ;;
7499         *)      dflt="$man3ext";;
7500         esac
7501         . ./myread
7502         man3ext="$ans"
7503         ;;
7504 esac
7505
7506 : see if we have to deal with yellow pages, now NIS.
7507 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7508         if $test -f /usr/etc/nibindd; then
7509                 echo " "
7510                 echo "I'm fairly confident you're on a NeXT."
7511                 echo " "
7512                 rp='Do you get the hosts file via NetInfo?'
7513                 dflt=y
7514                 case "$hostcat" in
7515                 nidump*) ;;
7516                 '') ;;
7517                 *) dflt=n;;
7518                 esac
7519                 . ./myread
7520                 case "$ans" in
7521                 y*) hostcat='nidump hosts .';;
7522                 *)      case "$hostcat" in
7523                         nidump*) hostcat='';;
7524                         esac
7525                         ;;
7526                 esac
7527         fi
7528         case "$hostcat" in
7529         nidump*) ;;
7530         *)
7531                 case "$hostcat" in
7532                 *ypcat*) dflt=y;;
7533                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7534                                 dflt=y
7535                         else
7536                                 dflt=n
7537                         fi;;
7538                 *) dflt=n;;
7539                 esac
7540                 echo " "
7541                 rp='Are you getting the hosts file via yellow pages?'
7542                 . ./myread
7543                 case "$ans" in
7544                 y*) hostcat='ypcat hosts';;
7545                 *) hostcat='cat /etc/hosts';;
7546                 esac
7547                 ;;
7548         esac
7549 fi
7550 case "$hostcat" in
7551 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7552 esac
7553 case "$groupcat" in
7554 '') test -f /etc/group && groupcat='cat /etc/group';;
7555 esac
7556 case "$passcat" in
7557 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7558 esac
7559
7560 : now get the host name
7561 echo " "
7562 echo "Figuring out host name..." >&4
7563 case "$myhostname" in
7564 '') cont=true
7565         echo 'Maybe "hostname" will work...'
7566         if tans=`sh -c hostname 2>&1` ; then
7567                 myhostname=$tans
7568                 phostname=hostname
7569                 cont=''
7570         fi
7571         ;;
7572 *) cont='';;
7573 esac
7574 if $test "$cont"; then
7575         if ./xenix; then
7576                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7577                 if tans=`cat /etc/systemid 2>&1` ; then
7578                         myhostname=$tans
7579                         phostname='cat /etc/systemid'
7580                         echo "Whadyaknow.  Xenix always was a bit strange..."
7581                         cont=''
7582                 fi
7583         elif $test -r /etc/systemid; then
7584                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7585         fi
7586 fi
7587 if $test "$cont"; then
7588         echo 'No, maybe "uuname -l" will work...'
7589         if tans=`sh -c 'uuname -l' 2>&1` ; then
7590                 myhostname=$tans
7591                 phostname='uuname -l'
7592         else
7593                 echo 'Strange.  Maybe "uname -n" will work...'
7594                 if tans=`sh -c 'uname -n' 2>&1` ; then
7595                         myhostname=$tans
7596                         phostname='uname -n'
7597                 else
7598                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7599                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7600                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7601                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7602                         else
7603                                 case "$myhostname" in
7604                                 '') echo "Does this machine have an identity crisis or something?"
7605                                         phostname='';;
7606                                 *)
7607                                         echo "Well, you said $myhostname before..."
7608                                         phostname='echo $myhostname';;
7609                                 esac
7610                         fi
7611                 fi
7612         fi
7613 fi
7614 : you do not want to know about this
7615 set $myhostname
7616 myhostname=$1
7617
7618 : verify guess
7619 if $test "$myhostname" ; then
7620         dflt=y
7621         rp='Your host name appears to be "'$myhostname'".'" Right?"
7622         . ./myread
7623         case "$ans" in
7624         y*) ;;
7625         *) myhostname='';;
7626         esac
7627 fi
7628
7629 : bad guess or no guess
7630 while $test "X$myhostname" = X ; do
7631         dflt=''
7632         rp="Please type the (one word) name of your host:"
7633         . ./myread
7634         myhostname="$ans"
7635 done
7636
7637 : translate upper to lower if necessary
7638 case "$myhostname" in
7639 *[A-Z]*)
7640         echo "(Normalizing case in your host name)"
7641         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7642         ;;
7643 esac
7644
7645 case "$myhostname" in
7646 *.*)
7647         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7648         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7649         echo "(Trimming domain name from host name--host name is now $myhostname)"
7650         ;;
7651 *) case "$mydomain" in
7652         '')
7653                 {
7654                         test "X$hostcat" = "Xypcat hosts" &&
7655                         ypmatch "$myhostname" hosts 2>/dev/null |\
7656                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7657                         $test -s hosts
7658                 } || {
7659                         test "X$hostcat" != "X" &&
7660                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7661                                         /[       ]$myhostname[  . ]/p" > hosts
7662                 }
7663                 tmp_re="[       . ]"
7664                 if $test -f hosts; then
7665                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7666                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7667                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7668                                 hosts | $sort | $uniq | \
7669                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7670                         case `$echo X$dflt` in
7671                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7672                                 dflt=.
7673                                 ;;
7674                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7675                                 ;;
7676                         esac
7677                 else
7678                         echo "(I cannot locate a hosts database anywhere)"
7679                         dflt=.
7680                 fi
7681                 case "$dflt" in
7682                 .)
7683                         tans=`./loc resolv.conf X /etc /usr/etc`
7684                         if $test -f "$tans"; then
7685                                 echo "(Attempting domain name extraction from $tans)"
7686                                 dflt=.`$sed -n -e 's/   / /g' \
7687                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7688                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7689                                 case "$dflt" in
7690                                 .) dflt=.`$sed -n -e 's/        / /g' \
7691                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7692                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7693                                         ;;
7694                                 esac
7695                         fi
7696                         ;;
7697                 esac
7698                 case "$dflt" in
7699                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7700                         dflt=.`sh -c domainname 2>/dev/null`
7701                         case "$dflt" in
7702                         '') dflt='.';;
7703                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7704                         esac
7705                         ;;
7706                 esac
7707                 case "$dflt$osname" in
7708                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7709                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7710                         ;;
7711                 esac
7712                 case "$dflt" in
7713                 .) echo "(Lost all hope -- silly guess then)"
7714                         dflt='.uucp'
7715                         ;;
7716                 esac
7717                 $rm -f hosts
7718                 ;;
7719         *) dflt="$mydomain";;
7720         esac;;
7721 esac
7722 echo " "
7723 rp="What is your domain name?"
7724 . ./myread
7725 tans="$ans"
7726 case "$ans" in
7727 '') ;;
7728 .*) ;;
7729 *) tans=".$tans";;
7730 esac
7731 mydomain="$tans"
7732
7733 : translate upper to lower if necessary
7734 case "$mydomain" in
7735 *[A-Z]*)
7736         echo "(Normalizing case in your domain name)"
7737         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7738         ;;
7739 esac
7740
7741 : a little sanity check here
7742 case "$phostname" in
7743 '') ;;
7744 *)
7745         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7746         $myhostname$mydomain|$myhostname) ;;
7747         *)
7748                 case "$phostname" in
7749                 sed*)
7750                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7751                         ;;
7752                 *)
7753                         echo "(That doesn't agree with your $phostname command, by the way.)"
7754                         ;;
7755                 esac
7756         ;;
7757         esac
7758         ;;
7759 esac
7760
7761 $cat <<EOM
7762
7763 I need to get your e-mail address in Internet format if possible, i.e.
7764 something like user@host.domain. Please answer accurately since I have
7765 no easy means to double check it. The default value provided below
7766 is most probably close to reality but may not be valid from outside
7767 your organization...
7768
7769 EOM
7770 cont=x
7771 while test "$cont"; do
7772         case "$cf_email" in
7773         '') dflt="$cf_by@$myhostname$mydomain";;
7774         *) dflt="$cf_email";;
7775         esac
7776         rp='What is your e-mail address?'
7777         . ./myread
7778         cf_email="$ans"
7779         case "$cf_email" in
7780         *@*.*) cont='' ;;
7781         *)
7782                 rp='Address does not look like an Internet one.  Use it anyway?'
7783                 case "$fastread" in
7784                 yes) dflt=y ;;
7785                 *) dflt=n ;;
7786                 esac
7787                 . ./myread
7788                 case "$ans" in
7789                 y*) cont='' ;;
7790                 *) echo " " ;;
7791                 esac
7792                 ;;
7793         esac
7794 done
7795
7796 $cat <<EOM
7797
7798 If you or somebody else will be maintaining perl at your site, please
7799 fill in the correct e-mail address here so that they may be contacted
7800 if necessary. Currently, the "perlbug" program included with perl
7801 will send mail to this address in addition to perlbug@perl.org. You may
7802 enter "none" for no administrator.
7803
7804 EOM
7805 case "$perladmin" in
7806 '') dflt="$cf_email";;
7807 *) dflt="$perladmin";;
7808 esac
7809 rp='Perl administrator e-mail address'
7810 . ./myread
7811 perladmin="$ans"
7812
7813 : determine whether to only install version-specific parts.
7814 echo " "
7815 $cat <<EOM
7816 Do you want to install only the version-specific parts of the perl
7817 distribution?  Usually you do *not* want to do this.
7818 EOM
7819 case "$versiononly" in
7820 "$define"|[Yy]*|true) dflt='y' ;;
7821 *) dflt='n';
7822 esac
7823 rp="Do you want to install only the version-specific parts of perl?"
7824 . ./myread
7825 case "$ans" in
7826 [yY]*)  val="$define";;
7827 *)      val="$undef" ;;
7828 esac
7829 set versiononly
7830 eval $setvar
7831
7832 : figure out how to guarantee perl startup
7833 case "$startperl" in
7834 '')
7835         case "$sharpbang" in
7836         *!)
7837                 $cat <<EOH
7838
7839 I can use the #! construct to start perl on your system. This will
7840 make startup of perl scripts faster, but may cause problems if you
7841 want to share those scripts and perl is not in a standard place
7842 ($binexp/perl) on all your platforms. The alternative is to force
7843 a shell by starting the script with a single ':' character.
7844
7845 EOH
7846                 case "$versiononly" in
7847                 "$define")      dflt="$binexp/perl$version";;  
7848                 *)              dflt="$binexp/perl";;
7849                 esac
7850                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7851                 . ./myread
7852                 case "$ans" in
7853                 none)   startperl=": # use perl";;
7854                 *)      startperl="#!$ans"
7855                         if $test 30 -lt `echo "$ans" | wc -c`; then
7856                                 $cat >&4 <<EOM
7857
7858 WARNING:  Some systems limit the #! command to 32 characters.
7859 If you experience difficulty running Perl scripts with #!, try
7860 installing Perl in a directory with a shorter pathname.
7861
7862 EOM
7863                         fi ;;
7864                 esac
7865                 ;;
7866         *) startperl=": # use perl"
7867                 ;;
7868         esac
7869         ;;
7870 esac
7871 echo "I'll use $startperl to start perl scripts."
7872
7873 : figure best path for perl in scripts
7874 case "$perlpath" in
7875 '')
7876         perlpath="$binexp/perl"
7877         case "$startperl" in
7878         *!*) ;;
7879         *)
7880                 $cat <<EOH
7881
7882 I will use the "eval 'exec'" idiom to start Perl on your system.
7883 I can use the full path of your Perl binary for this purpose, but
7884 doing so may cause problems if you want to share those scripts and
7885 Perl is not always in a standard place ($binexp/perl).
7886
7887 EOH
7888                 dflt="$binexp/perl"
7889                 rp="What path shall I use in \"eval 'exec'\"?"
7890                 . ./myread
7891                 perlpath="$ans"
7892                 ;;
7893         esac
7894         ;;
7895 esac
7896 case "$startperl" in
7897 *!*)    ;;
7898 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7899 esac
7900
7901 : determine where public executable scripts go
7902 set scriptdir scriptdir
7903 eval $prefixit
7904 case "$scriptdir" in
7905 '')
7906         dflt="$bin"
7907         : guess some guesses
7908         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7909         $test -d /usr/share/bin     && dflt=/usr/share/bin
7910         $test -d /usr/local/script  && dflt=/usr/local/script
7911         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7912         $test -d $prefixexp/script  && dflt=$prefixexp/script
7913         set dflt
7914         eval $prefixup
7915         ;;
7916 *)  dflt="$scriptdir"
7917         ;;
7918 esac
7919 $cat <<EOM
7920  
7921 Some installations have a separate directory just for executable scripts so
7922 that they can mount it across multiple architectures but keep the scripts in
7923 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7924 Or you might just lump your scripts in with all your other executables.
7925  
7926 EOM
7927 fn=d~
7928 rp='Where do you keep publicly executable scripts?'
7929 . ./getfile
7930 if $test "X$ansexp" != "X$scriptdirexp"; then
7931         installscript=''
7932 fi
7933 scriptdir="$ans"
7934 scriptdirexp="$ansexp"
7935 : Change installation prefix, if necessary.
7936 if $test X"$prefix" != X"$installprefix"; then
7937         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7938 else
7939         installscript="$scriptdirexp"
7940 fi
7941
7942 : determine where add-on public executables go
7943 case "$sitebin" in
7944 '')     dflt=$siteprefix/bin ;;
7945 *)      dflt=$sitebin ;;
7946 esac
7947 fn=d~
7948 rp='Pathname where the add-on public executables should be installed?'
7949 . ./getfile
7950 sitebin="$ans"
7951 sitebinexp="$ansexp"
7952 : Change installation prefix, if necessary.
7953 if $test X"$prefix" != X"$installprefix"; then
7954         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7955 else
7956         installsitebin="$sitebinexp"
7957 fi
7958
7959 case "$vendorprefix" in
7960 '')     d_vendorbin="$undef"
7961         vendorbin=''
7962         vendorbinexp=''
7963         ;;
7964 *)      d_vendorbin="$define"
7965         : determine where vendor-supplied executables go.
7966         case "$vendorbin" in
7967         '') dflt=$vendorprefix/bin ;;
7968         *)      dflt="$vendorbin" ;;
7969         esac
7970         fn=d~+
7971         rp='Pathname for the vendor-supplied executables directory?'
7972         . ./getfile
7973         vendorbin="$ans"
7974         vendorbinexp="$ansexp"
7975         ;;
7976 esac
7977 : Change installation prefix, if necessary.
7978 if $test X"$prefix" != X"$installprefix"; then
7979         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7980 else
7981         installvendorbin="$vendorbinexp"
7982 fi
7983
7984 : see if qgcvt exists
7985 set qgcvt d_qgcvt
7986 eval $inlibc
7987
7988 echo " "
7989
7990 if $test X"$d_longdbl" = X"$define"; then
7991
7992 echo "Checking how to print long doubles..." >&4
7993
7994 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7995         $cat >try.c <<'EOCP'
7996 #include <sys/types.h>
7997 #include <stdio.h>
7998 int main() {
7999   double d = 123.456;
8000   printf("%.3f\n", d);
8001 }
8002 EOCP
8003         set try
8004         if eval $compile; then
8005                 yyy=`./try$exe_ext`
8006                 case "$yyy" in
8007                 123.456)
8008                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8009                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8010                         echo "We will use %f."
8011                         ;;
8012                 esac
8013         fi
8014 fi
8015
8016 if $test X"$sPRIfldbl" = X; then
8017         $cat >try.c <<'EOCP'
8018 #include <sys/types.h>
8019 #include <stdio.h>
8020 int main() {
8021   long double d = 123.456;
8022   printf("%.3llf\n", d);
8023 }
8024 EOCP
8025         set try
8026         if eval $compile; then
8027                 yyy=`./try$exe_ext`
8028                 case "$yyy" in
8029                 123.456)
8030                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8031                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8032                         echo "We will use %llf."
8033                         ;;
8034                 esac
8035         fi
8036 fi
8037
8038 if $test X"$sPRIfldbl" = X; then
8039         $cat >try.c <<'EOCP'
8040 #include <sys/types.h>
8041 #include <stdio.h>
8042 int main() {
8043   long double d = 123.456;
8044   printf("%.3Lf\n", d);
8045 }
8046 EOCP
8047         set try
8048         if eval $compile; then
8049                 yyy=`./try$exe_ext`
8050                 case "$yyy" in
8051                 123.456)
8052                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8053                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8054                         echo "We will use %Lf."
8055                         ;;
8056                 esac
8057         fi
8058 fi
8059
8060 if $test X"$sPRIfldbl" = X; then
8061         $cat >try.c <<'EOCP'
8062 #include <sys/types.h>
8063 #include <stdio.h>
8064 int main() {
8065   long double d = 123.456;
8066   printf("%.3lf\n", d);
8067 }
8068 EOCP
8069         set try
8070         if eval $compile; then
8071                 yyy=`./try$exe_ext`
8072                 case "$yyy" in
8073                 123.456)
8074                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8075                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8076                         echo "We will use %lf."
8077                         ;;
8078                 esac
8079         fi
8080 fi
8081
8082 if $test X"$sPRIfldbl" = X; then
8083         echo "Cannot figure out how to print long doubles." >&4
8084 else
8085         sSCNfldbl=$sPRIfldbl    # expect consistency
8086 fi
8087
8088 $rm -f try try.*
8089
8090 fi # d_longdbl
8091
8092 case "$sPRIfldbl" in
8093 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8094         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8095         d_SCNfldbl="$undef";
8096         ;;
8097 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8098         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8099         d_SCNfldbl="$define";
8100         ;;
8101 esac
8102
8103 : Check how to convert floats to strings.
8104 echo " "
8105 echo "Checking for an efficient way to convert floats to strings."
8106 echo " " > try.c
8107 case "$uselongdouble" in
8108 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8109 esac
8110 case "$d_longdbl" in
8111 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8112 esac
8113 case "$d_PRIgldbl" in
8114 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8115 esac
8116 $cat >>try.c <<EOP
8117 #ifdef TRY_gconvert
8118 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8119 char *myname = "gconvert";
8120 #endif
8121 #ifdef TRY_gcvt
8122 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8123 char *myname = "gcvt";
8124 #endif
8125 #ifdef TRY_qgcvt
8126 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8127 char *myname = "qgcvt";
8128 #define DOUBLETYPE long double
8129 #endif
8130 #ifdef TRY_sprintf
8131 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8132 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8133 #else
8134 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8135 #endif
8136 char *myname = "sprintf";
8137 #endif
8138
8139 #ifndef DOUBLETYPE
8140 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8141 #define DOUBLETYPE long double
8142 #else
8143 #define DOUBLETYPE double
8144 #endif
8145 #endif
8146
8147 #include <stdio.h>
8148
8149 #define I_STDLIB $i_stdlib
8150 #ifdef I_STDLIB
8151 #include <stdlib.h>
8152 #endif
8153
8154 int
8155 checkit(expect, got)
8156 char *expect;
8157 char *got;
8158 {
8159     if (strcmp(expect, got)) {
8160                 printf("%s oddity:  Expected %s, got %s\n",
8161                         myname, expect, got);
8162                 exit(1);
8163         }
8164 }
8165
8166 int main()
8167
8168         char buf[64]; 
8169         buf[63] = '\0';
8170
8171         /* This must be 1st test on (which?) platform */
8172         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8173         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8174         checkit("0.1", buf);
8175
8176         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8177         checkit("1", buf);
8178
8179         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8180         checkit("1.1", buf);
8181
8182         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8183         checkit("1.01", buf);
8184
8185         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8186         checkit("1.001", buf);
8187
8188         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8189         checkit("1.0001", buf);
8190
8191         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8192         checkit("1.00001", buf);
8193
8194         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8195         checkit("1.000001", buf);
8196
8197         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8198         checkit("0", buf);
8199
8200         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8201         checkit("-1", buf);
8202
8203         /* Some Linux gcvt's give 1.e+5 here. */
8204         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8205         checkit("100000", buf);
8206         
8207         /* Some Linux gcvt's give -1.e+5 here. */
8208         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8209         checkit("-100000", buf);
8210
8211         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8212         checkit("123.456", buf);
8213
8214         exit(0);
8215 }
8216 EOP
8217 case "$d_Gconvert" in
8218 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8219 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8220 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8221 *) xxx_list='gconvert gcvt sprintf' ;;
8222 esac
8223
8224 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8225 "$define$define$define")
8226     # for long doubles prefer first qgcvt, then sprintf
8227     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8228     xxx_list="sprintf $xxx_list"
8229     case "$d_qgcvt" in
8230     "$define") xxx_list="qgcvt $xxx_list" ;;
8231     esac
8232     ;;
8233 esac
8234
8235 for xxx_convert in $xxx_list; do
8236         echo "Trying $xxx_convert..."
8237         $rm -f try try$_o
8238         set try -DTRY_$xxx_convert
8239         if eval $compile; then
8240                 echo "$xxx_convert() found." >&4
8241                 if ./try; then
8242                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8243                         break;
8244                 else
8245                         echo "...But $xxx_convert didn't work as I expected."
8246                 fi
8247         else
8248                 echo "$xxx_convert NOT found." >&4
8249         fi
8250 done
8251         
8252 case "$xxx_convert" in
8253 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8254 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8255 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8256 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8257    "$define$define$define")
8258       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8259    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8260    esac
8261    ;;  
8262 esac
8263
8264 : see if _fwalk exists
8265 set fwalk d__fwalk
8266 eval $inlibc
8267
8268 : Initialize h_fcntl
8269 h_fcntl=false
8270
8271 : Initialize h_sysfile
8272 h_sysfile=false
8273
8274 : access call always available on UNIX
8275 set access d_access
8276 eval $inlibc
8277
8278 : locate the flags for 'access()'
8279 case "$d_access" in
8280 "$define")
8281         echo " "
8282         $cat >access.c <<'EOCP'
8283 #include <sys/types.h>
8284 #ifdef I_FCNTL
8285 #include <fcntl.h>
8286 #endif
8287 #ifdef I_SYS_FILE
8288 #include <sys/file.h>
8289 #endif
8290 #ifdef I_UNISTD
8291 #include <unistd.h>
8292 #endif
8293 int main() {
8294         exit(R_OK);
8295 }
8296 EOCP
8297         : check sys/file.h first, no particular reason here
8298         if $test `./findhdr sys/file.h` && \
8299                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8300                 h_sysfile=true;
8301                 echo "<sys/file.h> defines the *_OK access constants." >&4
8302         elif $test `./findhdr fcntl.h` && \
8303                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8304                 h_fcntl=true;
8305                 echo "<fcntl.h> defines the *_OK access constants." >&4
8306         elif $test `./findhdr unistd.h` && \
8307                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8308                 echo "<unistd.h> defines the *_OK access constants." >&4
8309         else
8310                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8311         fi
8312         ;;
8313 esac
8314 $rm -f access*
8315
8316 : see if accessx exists
8317 set accessx d_accessx
8318 eval $inlibc
8319
8320 : see if alarm exists
8321 set alarm d_alarm
8322 eval $inlibc
8323
8324 : see if atolf exists
8325 set atolf d_atolf
8326 eval $inlibc
8327
8328 : see if atoll exists
8329 set atoll d_atoll
8330 eval $inlibc
8331
8332 : Look for GNU-cc style attribute checking
8333 echo " "
8334 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8335 $cat >attrib.c <<'EOCP'
8336 #include <stdio.h>
8337 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8338 EOCP
8339 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8340         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8341                 echo "Your C compiler doesn't fully support __attribute__."
8342                 val="$undef"
8343         else
8344                 echo "Your C compiler supports __attribute__."
8345                 val="$define"
8346         fi
8347 else
8348         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8349         val="$undef"
8350 fi
8351 set d_attribut
8352 eval $setvar
8353 $rm -f attrib*
8354
8355 : see if bcmp exists
8356 set bcmp d_bcmp
8357 eval $inlibc
8358
8359 : see if bcopy exists
8360 set bcopy d_bcopy
8361 eval $inlibc
8362
8363 : see if this is a unistd.h system
8364 set unistd.h i_unistd
8365 eval $inhdr
8366
8367 : see if getpgrp exists
8368 set getpgrp d_getpgrp
8369 eval $inlibc
8370
8371 case "$d_getpgrp" in
8372 "$define")
8373         echo " "
8374         echo "Checking to see which flavor of getpgrp is in use..."
8375         $cat >set.c <<EOP
8376 #$i_unistd I_UNISTD
8377 #include <sys/types.h>
8378 #ifdef I_UNISTD
8379 #  include <unistd.h>
8380 #endif
8381 int main()
8382 {
8383         if (getuid() == 0) {
8384                 printf("(I see you are running Configure as super-user...)\n");
8385                 setuid(1);
8386         }
8387 #ifdef TRY_BSD_PGRP
8388         if (getpgrp(1) == 0)
8389                 exit(0);
8390 #else
8391         if (getpgrp() > 0)
8392                 exit(0);
8393 #endif
8394         exit(1);
8395 }
8396 EOP
8397         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8398                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8399                 val="$define"
8400         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8401                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8402                 val="$undef"
8403         else
8404                 echo "I can't seem to compile and run the test program."
8405                 if ./usg; then
8406                         xxx="a USG one, i.e. you use getpgrp()."
8407                 else
8408                         # SVR4 systems can appear rather BSD-ish.
8409                         case "$i_unistd" in
8410                         $undef)
8411                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8412                                 val="$define"
8413                                 ;;
8414                         $define)
8415                                 xxx="probably a USG one, i.e. you use getpgrp()."
8416                                 val="$undef"
8417                                 ;;
8418                         esac
8419                 fi
8420                 echo "Assuming your getpgrp is $xxx" >&4
8421         fi
8422         ;;
8423 *) val="$undef";;
8424 esac
8425 set d_bsdgetpgrp
8426 eval $setvar
8427 $rm -f set set.c
8428
8429 : see if setpgrp exists
8430 set setpgrp d_setpgrp
8431 eval $inlibc
8432
8433 case "$d_setpgrp" in
8434 "$define")
8435         echo " "
8436         echo "Checking to see which flavor of setpgrp is in use..."
8437         $cat >set.c <<EOP
8438 #$i_unistd I_UNISTD
8439 #include <sys/types.h>
8440 #ifdef I_UNISTD
8441 #  include <unistd.h>
8442 #endif
8443 int main()
8444 {
8445         if (getuid() == 0) {
8446                 printf("(I see you are running Configure as super-user...)\n");
8447                 setuid(1);
8448         }
8449 #ifdef TRY_BSD_PGRP
8450         if (-1 == setpgrp(1, 1))
8451                 exit(0);
8452 #else
8453         if (setpgrp() != -1)
8454                 exit(0);
8455 #endif
8456         exit(1);
8457 }
8458 EOP
8459         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8460                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8461                 val="$define"
8462         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8463                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8464                 val="$undef"
8465         else
8466                 echo "(I can't seem to compile and run the test program.)"
8467                 if ./usg; then
8468                         xxx="a USG one, i.e. you use setpgrp()."
8469                 else
8470                         # SVR4 systems can appear rather BSD-ish.
8471                         case "$i_unistd" in
8472                         $undef)
8473                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8474                                 val="$define"
8475                                 ;;
8476                         $define)
8477                                 xxx="probably a USG one, i.e. you use setpgrp()."
8478                                 val="$undef"
8479                                 ;;
8480                         esac
8481                 fi
8482                 echo "Assuming your setpgrp is $xxx" >&4
8483         fi
8484         ;;
8485 *) val="$undef";;
8486 esac
8487 set d_bsdsetpgrp
8488 eval $setvar
8489 $rm -f set set.c
8490 : see if bzero exists
8491 set bzero d_bzero
8492 eval $inlibc
8493
8494 : see if signal is declared as pointer to function returning int or void
8495 echo " "
8496 xxx=`./findhdr signal.h`
8497 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8498 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8499         echo "You have int (*signal())() instead of void." >&4
8500         val="$undef"
8501 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8502         echo "You have void (*signal())()." >&4
8503         val="$define"
8504 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8505         echo "You have int (*signal())() instead of void." >&4
8506         val="$undef"
8507 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8508         echo "You have void (*signal())()." >&4
8509         val="$define"
8510 else
8511         case "$d_voidsig" in
8512         '')
8513         echo "I can't determine whether signal handler returns void or int..." >&4
8514                 dflt=void
8515                 rp="What type does your signal handler return?"
8516                 . ./myread
8517                 case "$ans" in
8518                 v*) val="$define";;
8519                 *) val="$undef";;
8520                 esac;;
8521         "$define")
8522                 echo "As you already told me, signal handler returns void." >&4
8523                 val="$define"
8524                 ;;
8525         *)      echo "As you already told me, signal handler returns int." >&4
8526                 val="$undef"
8527                 ;;
8528         esac
8529 fi
8530 set d_voidsig
8531 eval $setvar
8532 case "$d_voidsig" in
8533 "$define") signal_t="void";;
8534 *) signal_t="int";;
8535 esac
8536 $rm -f $$.tmp
8537
8538 : check for ability to cast large floats to 32-bit ints.
8539 echo " "
8540 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8541 if $test "$intsize" -ge 4; then
8542         xxx=int
8543 else
8544         xxx=long
8545 fi
8546 $cat >try.c <<EOCP
8547 #include <stdio.h>
8548 #include <sys/types.h>
8549 #include <signal.h>
8550 $signal_t blech(s) int s; { exit(3); }
8551 int main()
8552 {
8553         $xxx i32;
8554         double f, g;
8555         int result = 0;
8556         char str[16];
8557         signal(SIGFPE, blech);
8558
8559         /* Don't let compiler optimize the test away.  Store the number 
8560            in a writable string for gcc to pass to sscanf under HP/UX.
8561         */
8562         sprintf(str, "2147483647");
8563         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8564         g = 10 * f;
8565         i32  = ($xxx) g;
8566
8567         /* x86 processors will probably give 0x8000 0000, which is a
8568        sign change.  We don't want that.  We want to mimic SPARC
8569            behavior here, which is to preserve the sign and give
8570            back 0x7fff ffff.
8571         */
8572         if (i32 != ($xxx) f)
8573                 result |= 1;
8574         exit(result);
8575 }
8576 EOCP
8577 set try
8578 if eval $compile_ok; then
8579         ./try
8580         yyy=$?
8581 else
8582         echo "(I can't seem to compile the test program--assuming it can't)"
8583         yyy=1
8584 fi
8585 case "$yyy" in
8586 0)      val="$define"
8587         echo "Yup, it can."
8588         ;;
8589 *)      val="$undef"
8590         echo "Nope, it can't."
8591         ;;
8592 esac
8593 set d_casti32
8594 eval $setvar
8595 $rm -f try try.*
8596
8597 : check for ability to cast negative floats to unsigned
8598 echo " "
8599 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8600 $cat >try.c <<EOCP
8601 #include <stdio.h>
8602 #include <sys/types.h>
8603 #include <signal.h>
8604 $signal_t blech(s) int s; { exit(7); }
8605 $signal_t blech_in_list(s) int s; { exit(4); }
8606 unsigned long dummy_long(p) unsigned long p; { return p; }
8607 unsigned int dummy_int(p) unsigned int p; { return p; }
8608 unsigned short dummy_short(p) unsigned short p; { return p; }
8609 int main()
8610 {
8611         double f;
8612         unsigned long along;
8613         unsigned int aint;
8614         unsigned short ashort;
8615         int result = 0;
8616         char str[16];
8617         
8618         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8619            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8620            optimized the whole file away
8621         */
8622         /* Store the number in a writable string for gcc to pass to 
8623            sscanf under HP/UX.
8624         */
8625         sprintf(str, "-123");
8626         sscanf(str, "%lf", &f);  /* f = -123.; */
8627
8628         signal(SIGFPE, blech);
8629         along = (unsigned long)f;
8630         aint = (unsigned int)f;
8631         ashort = (unsigned short)f;
8632         if (along != (unsigned long)-123)
8633                 result |= 1;
8634         if (aint != (unsigned int)-123)
8635                 result |= 1;
8636         if (ashort != (unsigned short)-123)
8637                 result |= 1;
8638         sprintf(str, "1073741824.");
8639         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8640         f = f + f;
8641         along = 0;
8642         along = (unsigned long)f;
8643         if (along != 0x80000000)
8644                 result |= 2;
8645         f -= 1.;
8646         along = 0;
8647         along = (unsigned long)f;
8648         if (along != 0x7fffffff)
8649                 result |= 1;
8650         f += 2.;
8651         along = 0;
8652         along = (unsigned long)f;
8653         if (along != 0x80000001)
8654                 result |= 2;
8655         if (result)
8656                 exit(result);
8657         signal(SIGFPE, blech_in_list);
8658         sprintf(str, "123.");
8659         sscanf(str, "%lf", &f);  /* f = 123.; */
8660         along = dummy_long((unsigned long)f);
8661         aint = dummy_int((unsigned int)f);
8662         ashort = dummy_short((unsigned short)f);
8663         if (along != (unsigned long)123)
8664                 result |= 4;
8665         if (aint != (unsigned int)123)
8666                 result |= 4;
8667         if (ashort != (unsigned short)123)
8668                 result |= 4;
8669         exit(result);
8670
8671 }
8672 EOCP
8673 set try
8674 if eval $compile_ok; then
8675         ./try
8676         castflags=$?
8677 else
8678         echo "(I can't seem to compile the test program--assuming it can't)"
8679         castflags=7
8680 fi
8681 case "$castflags" in
8682 0)      val="$define"
8683         echo "Yup, it can."
8684         ;;
8685 *)      val="$undef"
8686         echo "Nope, it can't."
8687         ;;
8688 esac
8689 set d_castneg
8690 eval $setvar
8691 $rm -f try.*
8692
8693 : see if vprintf exists
8694 echo " "
8695 if set vprintf val -f d_vprintf; eval $csym; $val; then
8696         echo 'vprintf() found.' >&4
8697         val="$define"
8698         $cat >vprintf.c <<'EOF'
8699 #include <varargs.h>
8700
8701 int main() { xxx("foo"); }
8702
8703 xxx(va_alist)
8704 va_dcl
8705 {
8706         va_list args;
8707         char buf[10];
8708
8709         va_start(args);
8710         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8711 }
8712 EOF
8713         set vprintf
8714         if eval $compile && ./vprintf; then
8715                 echo "Your vsprintf() returns (int)." >&4
8716                 val2="$undef"
8717         else
8718                 echo "Your vsprintf() returns (char*)." >&4
8719                 val2="$define"
8720         fi
8721 else
8722         echo 'vprintf() NOT found.' >&4
8723                 val="$undef"
8724                 val2="$undef"
8725 fi
8726 set d_vprintf
8727 eval $setvar
8728 val=$val2
8729 set d_charvspr
8730 eval $setvar
8731
8732 : see if chown exists
8733 set chown d_chown
8734 eval $inlibc
8735
8736 : see if chroot exists
8737 set chroot d_chroot
8738 eval $inlibc
8739
8740 : see if chsize exists
8741 set chsize d_chsize
8742 eval $inlibc
8743
8744 hasstruct='varname=$1; struct=$2; shift; shift;
8745 while $test $# -ge 2; do
8746         case "$1" in
8747         $define) echo "#include <$2>";;
8748         esac ;
8749     shift 2;
8750 done > try.c;
8751 echo "int main () { struct $struct foo; }" >> try.c;
8752 set try;
8753 if eval $compile; then
8754         val="$define";
8755 else
8756         val="$undef";
8757 fi;
8758 set $varname;
8759 eval $setvar;
8760 $rm -f try.c try.o'
8761
8762 : see if sys/types.h has to be included
8763 set sys/types.h i_systypes
8764 eval $inhdr
8765
8766 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8767 while $test $# -ge 2; do
8768         case "$1" in
8769         $define) echo "#include <$2>";;
8770         esac ;
8771     shift 2;
8772 done > try.c;
8773 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8774 set try;
8775 if eval $compile; then
8776         val="$define";
8777 else
8778         val="$undef";
8779 fi;
8780 set $varname;
8781 eval $setvar;
8782 $rm -f try.c try.o'
8783
8784 socketlib=''
8785 sockethdr=''
8786 : see whether socket exists
8787 echo " "
8788 $echo $n "Hmm... $c" >&4
8789 if set socket val -f d_socket; eval $csym; $val; then
8790         echo "Looks like you have Berkeley networking support." >&4
8791         d_socket="$define"
8792         if set setsockopt val -f; eval $csym; $val; then
8793                 d_oldsock="$undef"
8794         else
8795                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8796                 d_oldsock="$define"
8797         fi
8798 else
8799         if $contains socklib libc.list >/dev/null 2>&1; then
8800                 echo "Looks like you have Berkeley networking support." >&4
8801                 d_socket="$define"
8802                 : we will have to assume that it supports the 4.2 BSD interface
8803                 d_oldsock="$undef"
8804         else
8805                 echo "You don't have Berkeley networking in libc$_a..." >&4
8806                 if test "X$d_socket" = "X$define"; then
8807                    echo "...but you seem to believe that you have sockets." >&4
8808                 else
8809                         for net in net socket
8810                         do
8811                                 if test -f /usr/lib/lib$net$_a; then
8812                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8813                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8814                                         if $contains socket libc.list >/dev/null 2>&1; then
8815                                                 d_socket="$define"
8816                                                 socketlib="-l$net"
8817                                                 case "$net" in
8818                                                 net)
8819                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8820                                                         sockethdr="-I/usr/netinclude"
8821                                                         ;;
8822                                                 esac
8823                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8824                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8825                                                         d_oldsock="$undef"
8826                                                 else
8827                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8828                                                         d_oldsock="$define"
8829                                                 fi
8830                                                 break
8831                                         fi
8832                                 fi
8833                         done
8834                         if test "X$d_socket" != "X$define"; then
8835                            echo "or anywhere else I see." >&4
8836                            d_socket="$undef"
8837                            d_oldsock="$undef"
8838                         fi
8839                 fi
8840         fi
8841 fi
8842
8843 : see if socketpair exists
8844 set socketpair d_sockpair
8845 eval $inlibc
8846
8847
8848 echo " "
8849 echo "Checking the availability of certain socket constants..." >& 4
8850 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8851         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8852         $cat >try.c <<EOF
8853 #include <sys/types.h>
8854 #include <sys/socket.h>
8855 int main() {
8856     int i = $ENUM;
8857 }
8858 EOF
8859         val="$undef"
8860         set try; if eval $compile; then
8861                 val="$define"
8862         fi
8863         set d_${enum}; eval $setvar
8864         $rm -f try.c try
8865 done
8866
8867 : see if this is a sys/uio.h system
8868 set sys/uio.h i_sysuio
8869 eval $inhdr
8870
8871
8872 echo " "
8873 echo "Checking to see if your system supports struct cmsghdr..." >&4
8874 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8875 eval $hasstruct
8876 case "$d_cmsghdr_s" in
8877 "$define")      echo "Yes, it does."   ;;
8878 *)              echo "No, it doesn't." ;;
8879 esac
8880
8881
8882 : check for const keyword
8883 echo " "
8884 echo 'Checking to see if your C compiler knows about "const"...' >&4
8885 $cat >const.c <<'EOCP'
8886 typedef struct spug { int drokk; } spug;
8887 int main()
8888 {
8889         const char *foo;
8890         const spug y;
8891 }
8892 EOCP
8893 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8894         val="$define"
8895         echo "Yup, it does."
8896 else
8897         val="$undef"
8898         echo "Nope, it doesn't."
8899 fi
8900 set d_const
8901 eval $setvar
8902
8903 : see if crypt exists
8904 echo " "
8905 if set crypt val -f d_crypt; eval $csym; $val; then
8906         echo 'crypt() found.' >&4
8907         val="$define"
8908         cryptlib=''
8909 else
8910         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8911         if $test -z "$cryptlib"; then
8912                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8913         else
8914                 cryptlib=-lcrypt
8915         fi
8916         if $test -z "$cryptlib"; then
8917                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8918         else
8919                 cryptlib=-lcrypt
8920         fi
8921         if $test -z "$cryptlib"; then
8922                 cryptlib=`./loc libcrypt$_a "" $libpth`
8923         else
8924                 cryptlib=-lcrypt
8925         fi
8926         if $test -z "$cryptlib"; then
8927                 echo 'crypt() NOT found.' >&4
8928                 val="$undef"
8929         else
8930                 val="$define"
8931         fi
8932 fi
8933 set d_crypt
8934 eval $setvar
8935
8936 : get csh whereabouts
8937 case "$csh" in
8938 'csh') val="$undef" ;;
8939 *) val="$define" ;;
8940 esac
8941 set d_csh
8942 eval $setvar
8943 : Respect a hint or command line value for full_csh.
8944 case "$full_csh" in
8945 '') full_csh=$csh ;;
8946 esac
8947
8948 : see if cuserid exists
8949 set cuserid d_cuserid
8950 eval $inlibc
8951
8952 : see if this is a limits.h system
8953 set limits.h i_limits
8954 eval $inhdr
8955
8956 : see if this is a float.h system
8957 set float.h i_float
8958 eval $inhdr
8959
8960 : See if number of significant digits in a double precision number is known
8961 echo " "
8962 $cat >dbl_dig.c <<EOM
8963 #$i_limits I_LIMITS
8964 #$i_float I_FLOAT
8965 #ifdef I_LIMITS
8966 #include <limits.h>
8967 #endif
8968 #ifdef I_FLOAT
8969 #include <float.h>
8970 #endif
8971 #ifdef DBL_DIG
8972 printf("Contains DBL_DIG");
8973 #endif
8974 EOM
8975 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8976 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8977         echo "DBL_DIG found." >&4
8978         val="$define"
8979 else
8980         echo "DBL_DIG NOT found." >&4
8981         val="$undef"
8982 fi
8983 $rm -f dbl_dig.?
8984 set d_dbl_dig
8985 eval $setvar
8986
8987 : see if difftime exists
8988 set difftime d_difftime
8989 eval $inlibc
8990
8991 : see if this is a dirent system
8992 echo " "
8993 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8994         val="$define"
8995         echo "<dirent.h> found." >&4
8996 else
8997         val="$undef"
8998         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8999                 echo "<sys/dir.h> found." >&4
9000                 echo " "
9001         else
9002                 xinc=`./findhdr sys/ndir.h`
9003         fi
9004         echo "<dirent.h> NOT found." >&4
9005 fi
9006 set i_dirent
9007 eval $setvar
9008
9009 : Look for type of directory structure.
9010 echo " "
9011 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9012
9013 case "$direntrytype" in
9014 ''|' ')
9015         case "$i_dirent" in
9016         $define) guess1='struct dirent' ;;
9017         *) guess1='struct direct'  ;;
9018         esac
9019         ;;
9020 *)      guess1="$direntrytype"
9021         ;;
9022 esac
9023
9024 case "$guess1" in
9025 'struct dirent') guess2='struct direct' ;;
9026 *) guess2='struct dirent' ;;
9027 esac
9028                 
9029 if $contains "$guess1" try.c >/dev/null 2>&1; then
9030         direntrytype="$guess1"
9031         echo "Your directory entries are $direntrytype." >&4
9032 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9033         direntrytype="$guess2"
9034         echo "Your directory entries seem to be $direntrytype." >&4
9035 else
9036         echo "I don't recognize your system's directory entries." >&4
9037         rp="What type is used for directory entries on this system?"
9038         dflt="$guess1"
9039         . ./myread
9040         direntrytype="$ans"
9041 fi
9042 $rm -f try.c
9043
9044
9045 : see if the directory entry stores field length
9046 echo " "
9047 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9048 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9049         echo "Good, your directory entry keeps length information in d_namlen." >&4
9050         val="$define"
9051 else
9052         echo "Your directory entry does not know about the d_namlen field." >&4
9053         val="$undef"
9054 fi
9055 set d_dirnamlen
9056 eval $setvar
9057 $rm -f try.c
9058
9059 : see if dlerror exists
9060 xxx_runnm="$runnm"
9061 runnm=false
9062 set dlerror d_dlerror
9063 eval $inlibc
9064 runnm="$xxx_runnm"
9065
9066 : see if dlfcn is available
9067 set dlfcn.h i_dlfcn
9068 eval $inhdr
9069
9070 case "$usedl" in
9071 $define|y|true)
9072         $cat << EOM
9073
9074 On a few systems, the dynamically loaded modules that perl generates and uses
9075 will need a different extension than shared libs. The default will probably
9076 be appropriate.
9077
9078 EOM
9079         case "$dlext" in
9080         '')     dflt="$so" ;;
9081         *)      dflt="$dlext" ;;
9082         esac
9083         rp='What is the extension of dynamically loaded modules'
9084         . ./myread
9085         dlext="$ans"
9086         ;;
9087 *)
9088         dlext="none"
9089         ;;
9090 esac
9091
9092 : Check if dlsym need a leading underscore
9093 echo " "
9094 val="$undef"
9095
9096 case "$dlsrc" in
9097 dl_dlopen.xs)
9098         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9099         $cat >dyna.c <<'EOM'
9100 fred () { }
9101 EOM
9102
9103 $cat >fred.c<<EOM
9104
9105 #include <stdio.h>
9106 #$i_dlfcn I_DLFCN
9107 #ifdef I_DLFCN
9108 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9109 #else
9110 #include <sys/types.h>
9111 #include <nlist.h>
9112 #include <link.h>
9113 #endif
9114
9115 extern int fred() ;
9116
9117 int main()
9118 {
9119     void * handle ;
9120     void * symbol ;
9121 #ifndef RTLD_LAZY
9122     int mode = 1 ;
9123 #else
9124     int mode = RTLD_LAZY ;
9125 #endif
9126     handle = dlopen("./dyna.$dlext", mode) ;
9127     if (handle == NULL) {
9128         printf ("1\n") ;
9129         fflush (stdout) ;
9130         exit(0);
9131     }
9132     symbol = dlsym(handle, "fred") ;
9133     if (symbol == NULL) {
9134         /* try putting a leading underscore */
9135         symbol = dlsym(handle, "_fred") ;
9136         if (symbol == NULL) {
9137             printf ("2\n") ;
9138             fflush (stdout) ;
9139             exit(0);
9140         }
9141         printf ("3\n") ;
9142     }
9143     else
9144         printf ("4\n") ;
9145     fflush (stdout) ;
9146     exit(0);
9147 }
9148 EOM
9149         : Call the object file tmp-dyna.o in case dlext=o.
9150         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9151                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9152                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9153                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9154                 xxx=`./fred`
9155                 case $xxx in
9156                 1)      echo "Test program failed using dlopen." >&4
9157                         echo "Perhaps you should not use dynamic loading." >&4;;
9158                 2)      echo "Test program failed using dlsym." >&4
9159                         echo "Perhaps you should not use dynamic loading." >&4;;
9160                 3)      echo "dlsym needs a leading underscore" >&4
9161                         val="$define" ;;
9162                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9163                 esac
9164         else
9165                 echo "I can't compile and run the test program." >&4
9166                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9167         fi
9168         ;;
9169 esac
9170                 
9171 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9172
9173 set d_dlsymun
9174 eval $setvar
9175
9176 hasproto='varname=$1; func=$2; shift; shift;
9177 while $test $# -ge 2; do
9178         case "$1" in
9179         $define) echo "#include <$2>";;
9180         esac ;
9181     shift 2;
9182 done > try.c;
9183 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9184 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9185         echo "$func() prototype found.";
9186         val="$define";
9187 else
9188         echo "$func() prototype NOT found.";
9189         val="$undef";
9190 fi;
9191 set $varname;
9192 eval $setvar;
9193 $rm -f try.c tryout.c'
9194
9195 : see if prototype for drand48 is available
9196 echo " "
9197 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9198 eval $hasproto
9199
9200 : see if dup2 exists
9201 set dup2 d_dup2
9202 eval $inlibc
9203
9204 : see if eaccess exists
9205 set eaccess d_eaccess
9206 eval $inlibc
9207
9208 : see if endgrent exists
9209 set endgrent d_endgrent
9210 eval $inlibc
9211
9212 : see if endhostent exists
9213 set endhostent d_endhent
9214 eval $inlibc
9215
9216 : see if endnetent exists
9217 set endnetent d_endnent
9218 eval $inlibc
9219
9220 : see if endprotoent exists
9221 set endprotoent d_endpent
9222 eval $inlibc
9223
9224 : see if endpwent exists
9225 set endpwent d_endpwent
9226 eval $inlibc
9227
9228 : see if endservent exists
9229 set endservent d_endsent
9230 eval $inlibc
9231
9232 : Locate the flags for 'open()'
9233 echo " "
9234 $cat >open3.c <<'EOCP'
9235 #include <sys/types.h>
9236 #ifdef I_FCNTL
9237 #include <fcntl.h>
9238 #endif
9239 #ifdef I_SYS_FILE
9240 #include <sys/file.h>
9241 #endif
9242 int main() {
9243         if(O_RDONLY);
9244 #ifdef O_TRUNC
9245         exit(0);
9246 #else
9247         exit(1);
9248 #endif
9249 }
9250 EOCP
9251 : check sys/file.h first to get FREAD on Sun
9252 if $test `./findhdr sys/file.h` && \
9253                 set open3 -DI_SYS_FILE && eval $compile; then
9254         h_sysfile=true;
9255         echo "<sys/file.h> defines the O_* constants..." >&4
9256         if ./open3; then
9257                 echo "and you have the 3 argument form of open()." >&4
9258                 val="$define"
9259         else
9260                 echo "but not the 3 argument form of open().  Oh, well." >&4
9261                 val="$undef"
9262         fi
9263 elif $test `./findhdr fcntl.h` && \
9264                 set open3 -DI_FCNTL && eval $compile; then
9265         h_fcntl=true;
9266         echo "<fcntl.h> defines the O_* constants..." >&4
9267         if ./open3; then
9268                 echo "and you have the 3 argument form of open()." >&4
9269                 val="$define"
9270         else
9271                 echo "but not the 3 argument form of open().  Oh, well." >&4
9272                 val="$undef"
9273         fi
9274 else
9275         val="$undef"
9276         echo "I can't find the O_* constant definitions!  You got problems." >&4
9277 fi
9278 set d_open3
9279 eval $setvar
9280 $rm -f open3*
9281
9282 : see which of string.h or strings.h is needed
9283 echo " "
9284 strings=`./findhdr string.h`
9285 if $test "$strings" && $test -r "$strings"; then
9286         echo "Using <string.h> instead of <strings.h>." >&4
9287         val="$define"
9288 else
9289         val="$undef"
9290         strings=`./findhdr strings.h`
9291         if $test "$strings" && $test -r "$strings"; then
9292                 echo "Using <strings.h> instead of <string.h>." >&4
9293         else
9294                 echo "No string header found -- You'll surely have problems." >&4
9295         fi
9296 fi
9297 set i_string
9298 eval $setvar
9299 case "$i_string" in
9300 "$undef") strings=`./findhdr strings.h`;;
9301 *)        strings=`./findhdr string.h`;;
9302 esac
9303
9304 : check for non-blocking I/O stuff
9305 case "$h_sysfile" in
9306 true) echo "#include <sys/file.h>" > head.c;;
9307 *)
9308        case "$h_fcntl" in
9309        true) echo "#include <fcntl.h>" > head.c;;
9310        *) echo "#include <sys/fcntl.h>" > head.c;;
9311        esac
9312        ;;
9313 esac
9314 echo " "
9315 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9316 case "$o_nonblock" in
9317 '')
9318         $cat head.c > try.c
9319         $cat >>try.c <<'EOCP'
9320 #include <stdio.h>
9321 int main() {
9322 #ifdef O_NONBLOCK
9323         printf("O_NONBLOCK\n");
9324         exit(0);
9325 #endif
9326 #ifdef O_NDELAY
9327         printf("O_NDELAY\n");
9328         exit(0);
9329 #endif
9330 #ifdef FNDELAY
9331         printf("FNDELAY\n");
9332         exit(0);
9333 #endif
9334         exit(0);
9335 }
9336 EOCP
9337         set try
9338         if eval $compile_ok; then
9339                 o_nonblock=`./try`
9340                 case "$o_nonblock" in
9341                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9342                 *) echo "Seems like we can use $o_nonblock.";;
9343                 esac
9344         else
9345                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9346         fi
9347         ;;
9348 *) echo "Using $hint value $o_nonblock.";;
9349 esac
9350 $rm -f try try.* .out core
9351
9352 echo " "
9353 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9354 case "$eagain" in
9355 '')
9356         $cat head.c > try.c
9357         $cat >>try.c <<EOCP
9358 #include <errno.h>
9359 #include <sys/types.h>
9360 #include <signal.h>
9361 #include <stdio.h> 
9362 #define MY_O_NONBLOCK $o_nonblock
9363 #ifndef errno  /* XXX need better Configure test */
9364 extern int errno;
9365 #endif
9366 #$i_unistd I_UNISTD
9367 #ifdef I_UNISTD
9368 #include <unistd.h>
9369 #endif
9370 #$i_string I_STRING
9371 #ifdef I_STRING
9372 #include <string.h>
9373 #else
9374 #include <strings.h>
9375 #endif
9376 $signal_t blech(x) int x; { exit(3); }
9377 EOCP
9378         $cat >> try.c <<'EOCP'
9379 int main()
9380 {
9381         int pd[2];
9382         int pu[2];
9383         char buf[1];
9384         char string[100];
9385
9386         pipe(pd);       /* Down: child -> parent */
9387         pipe(pu);       /* Up: parent -> child */
9388         if (0 != fork()) {
9389                 int ret;
9390                 close(pd[1]);   /* Parent reads from pd[0] */
9391                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9392 #ifdef F_SETFL
9393                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9394                         exit(1);
9395 #else
9396                 exit(4);
9397 #endif
9398                 signal(SIGALRM, blech);
9399                 alarm(5);
9400                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9401                         exit(2);
9402                 sprintf(string, "%d\n", ret);
9403                 write(2, string, strlen(string));
9404                 alarm(0);
9405 #ifdef EAGAIN
9406                 if (errno == EAGAIN) {
9407                         printf("EAGAIN\n");
9408                         goto ok;
9409                 }
9410 #endif
9411 #ifdef EWOULDBLOCK
9412                 if (errno == EWOULDBLOCK)
9413                         printf("EWOULDBLOCK\n");
9414 #endif
9415         ok:
9416                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9417                 sleep(2);                               /* Give it time to close our pipe */
9418                 alarm(5);
9419                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9420                 alarm(0);
9421                 sprintf(string, "%d\n", ret);
9422                 write(3, string, strlen(string));
9423                 exit(0);
9424         }
9425
9426         close(pd[0]);                   /* We write to pd[1] */
9427         close(pu[1]);                   /* We read from pu[0] */
9428         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9429         close(pd[1]);                   /* Pipe pd is now fully closed! */
9430         exit(0);                                /* Bye bye, thank you for playing! */
9431 }
9432 EOCP
9433         set try
9434         if eval $compile_ok; then
9435                 echo "$startsh" >mtry
9436                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9437                 chmod +x mtry
9438                 ./mtry >/dev/null 2>&1
9439                 case $? in
9440                 0) eagain=`$cat try.out`;;
9441                 1) echo "Could not perform non-blocking setting!";;
9442                 2) echo "I did a successful read() for something that was not there!";;
9443                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9444                 4) echo "Could not find F_SETFL!";;
9445                 *) echo "Something terribly wrong happened during testing.";;
9446                 esac
9447                 rd_nodata=`$cat try.ret`
9448                 echo "A read() system call with no data present returns $rd_nodata."
9449                 case "$rd_nodata" in
9450                 0|-1) ;;
9451                 *)
9452                         echo "(That's peculiar, fixing that to be -1.)"
9453                         rd_nodata=-1
9454                         ;;
9455                 esac
9456                 case "$eagain" in
9457                 '')
9458                         echo "Forcing errno EAGAIN on read() with no data available."
9459                         eagain=EAGAIN
9460                         ;;
9461                 *)
9462                         echo "Your read() sets errno to $eagain when no data is available."
9463                         ;;
9464                 esac
9465                 status=`$cat try.err`
9466                 case "$status" in
9467                 0) echo "And it correctly returns 0 to signal EOF.";;
9468                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9469                 *) echo "However, your read() returns '$status' on EOF??";;
9470                 esac
9471                 val="$define"
9472                 if test "$status" = "$rd_nodata"; then
9473                         echo "WARNING: you can't distinguish between EOF and no data!"
9474                         val="$undef"
9475                 fi
9476         else
9477                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9478                 eagain=EAGAIN
9479         fi
9480         set d_eofnblk
9481         eval $setvar
9482         ;;
9483 *)
9484         echo "Using $hint value $eagain."
9485         echo "Your read() returns $rd_nodata when no data is present."
9486         case "$d_eofnblk" in
9487         "$define") echo "And you can see EOF because read() returns 0.";;
9488         "$undef") echo "But you can't see EOF status from read() returned value.";;
9489         *)
9490                 echo "(Assuming you can't see EOF status from read anyway.)"
9491                 d_eofnblk=$undef
9492                 ;;
9493         esac
9494         ;;
9495 esac
9496 $rm -f try try.* .out core head.c mtry
9497
9498 : see if fchmod exists
9499 set fchmod d_fchmod
9500 eval $inlibc
9501
9502 : see if fchown exists
9503 set fchown d_fchown
9504 eval $inlibc
9505
9506 : see if this is an fcntl system
9507 set fcntl d_fcntl
9508 eval $inlibc
9509
9510 echo " "
9511 : See if fcntl-based locking works.
9512 $cat >try.c <<'EOCP'
9513 #include <stdlib.h>
9514 #include <unistd.h>
9515 #include <fcntl.h>
9516 int main() {
9517 #if defined(F_SETLK) && defined(F_SETLKW)
9518      struct flock flock;
9519      int retval, fd;
9520      fd = open("try.c", O_RDONLY);
9521      flock.l_type = F_RDLCK;
9522      flock.l_whence = SEEK_SET;
9523      flock.l_start = flock.l_len = 0;
9524      retval = fcntl(fd, F_SETLK, &flock);
9525      close(fd);
9526      (retval < 0 ? exit(2) : exit(0));
9527 #else
9528      exit(2);
9529 #endif
9530 }
9531 EOCP
9532 echo "Checking if fcntl-based file locking works... "
9533 case "$d_fcntl" in
9534 "$define")
9535         set try
9536         if eval $compile_ok; then
9537                 if ./try; then
9538                         echo "Yes, it seems to work."
9539                         val="$define"
9540                 else
9541                         echo "Nope, it didn't work."
9542                         val="$undef"
9543                 fi
9544         else
9545                 echo "I'm unable to compile the test program, so I'll assume not."
9546                 val="$undef"
9547         fi
9548         ;;
9549 *) val="$undef";
9550         echo "Nope, since you don't even have fcntl()."
9551         ;;
9552 esac
9553 set d_fcntl_can_lock
9554 eval $setvar
9555 $rm -f try*
9556
9557
9558 : see if sys/select.h has to be included
9559 set sys/select.h i_sysselct
9560 eval $inhdr
9561
9562 : see if we should include time.h, sys/time.h, or both
9563 echo " "
9564 if test "X$timeincl" = X; then
9565         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9566         $echo $n "I'm now running the test program...$c"
9567         $cat >try.c <<'EOCP'
9568 #include <sys/types.h>
9569 #ifdef I_TIME
9570 #include <time.h>
9571 #endif
9572 #ifdef I_SYSTIME
9573 #ifdef SYSTIMEKERNEL
9574 #define KERNEL
9575 #endif
9576 #include <sys/time.h>
9577 #endif
9578 #ifdef I_SYSSELECT
9579 #include <sys/select.h>
9580 #endif
9581 int main()
9582 {
9583         struct tm foo;
9584 #ifdef S_TIMEVAL
9585         struct timeval bar;
9586 #endif
9587 #ifdef S_TIMEZONE
9588         struct timezone tzp;
9589 #endif
9590         if (foo.tm_sec == foo.tm_sec)
9591                 exit(0);
9592 #ifdef S_TIMEVAL
9593         if (bar.tv_sec == bar.tv_sec)
9594                 exit(0);
9595 #endif
9596         exit(1);
9597 }
9598 EOCP
9599         flags=''
9600         for s_timezone in '-DS_TIMEZONE' ''; do
9601         sysselect=''
9602         for s_timeval in '-DS_TIMEVAL' ''; do
9603         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9604         for i_time in '' '-DI_TIME'; do
9605         for i_systime in '-DI_SYSTIME' ''; do
9606                 case "$flags" in
9607                 '') $echo $n ".$c"
9608                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9609                         if eval $compile; then
9610                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9611                                 shift
9612                                 flags="$*"
9613                                 echo " "
9614                                 $echo $n "Succeeded with $flags$c"
9615                         fi
9616                         ;;
9617                 esac
9618         done
9619         done
9620         done
9621         done
9622         done
9623         timeincl=''
9624         echo " "
9625         case "$flags" in
9626         *SYSTIMEKERNEL*) i_systimek="$define"
9627                 timeincl=`./findhdr sys/time.h`
9628                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9629         *) i_systimek="$undef";;
9630         esac
9631         case "$flags" in
9632         *I_TIME*) i_time="$define"
9633                 timeincl=`./findhdr time.h`" $timeincl"
9634                 echo "We'll include <time.h>." >&4;;
9635         *) i_time="$undef";;
9636         esac
9637         case "$flags" in
9638         *I_SYSTIME*) i_systime="$define"
9639                 timeincl=`./findhdr sys/time.h`" $timeincl"
9640                 echo "We'll include <sys/time.h>." >&4;;
9641         *) i_systime="$undef";;
9642         esac
9643         $rm -f try.c try
9644 fi
9645
9646 : check for fd_set items
9647 $cat <<EOM
9648
9649 Checking to see how well your C compiler handles fd_set and friends ...
9650 EOM
9651 $cat >fd_set.c <<EOCP
9652 #$i_systime I_SYS_TIME
9653 #$i_sysselct I_SYS_SELECT
9654 #$d_socket HAS_SOCKET
9655 #include <sys/types.h>
9656 #ifdef HAS_SOCKET
9657 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9658 #endif
9659 #ifdef I_SYS_TIME
9660 #include <sys/time.h>
9661 #endif
9662 #ifdef I_SYS_SELECT
9663 #include <sys/select.h>
9664 #endif
9665 int main() {
9666         fd_set fds;
9667
9668 #ifdef TRYBITS
9669         if(fds.fds_bits);
9670 #endif
9671
9672 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9673         exit(0);
9674 #else
9675         exit(1);
9676 #endif
9677 }
9678 EOCP
9679 set fd_set -DTRYBITS
9680 if eval $compile; then
9681         d_fds_bits="$define"
9682         d_fd_set="$define"
9683         echo "Well, your system knows about the normal fd_set typedef..." >&4
9684         if ./fd_set; then
9685                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9686                 d_fd_macros="$define"
9687         else
9688                 $cat >&4 <<'EOM'
9689 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9690 EOM
9691                 d_fd_macros="$undef"
9692         fi
9693 else
9694         $cat <<'EOM'
9695 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9696 EOM
9697         set fd_set
9698         if eval $compile; then
9699                 d_fds_bits="$undef"
9700                 d_fd_set="$define"
9701                 echo "Well, your system has some sort of fd_set available..." >&4
9702                 if ./fd_set; then
9703                         echo "and you have the normal fd_set macros." >&4
9704                         d_fd_macros="$define"
9705                 else
9706                         $cat <<'EOM'
9707 but not the normal fd_set macros!  Gross!  More work for me...
9708 EOM
9709                         d_fd_macros="$undef"
9710                 fi
9711         else
9712         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9713                 d_fd_set="$undef"
9714                 d_fds_bits="$undef"
9715                 d_fd_macros="$undef"
9716         fi
9717 fi
9718 $rm -f fd_set*
9719
9720 : see if fgetpos exists
9721 set fgetpos d_fgetpos
9722 eval $inlibc
9723
9724 : see if flock exists
9725 set flock d_flock
9726 eval $inlibc
9727
9728 : see if fork exists
9729 set fork d_fork
9730 eval $inlibc
9731
9732 : see if pathconf exists
9733 set pathconf d_pathconf
9734 eval $inlibc
9735
9736 : see if fpathconf exists
9737 set fpathconf d_fpathconf
9738 eval $inlibc
9739
9740
9741 : check for fpos64_t
9742 echo " "
9743 echo "Checking to see if you have fpos64_t..." >&4
9744 $cat >try.c <<EOCP
9745 #include <stdio.h>
9746 int main() { fpos64_t x = 7; }
9747 EOCP
9748 set try
9749 if eval $compile; then
9750         val="$define"
9751         echo "You have fpos64_t."
9752 else
9753         val="$undef"
9754         echo "You do not have fpos64_t."
9755         case "$fpossize" in
9756         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9757         esac
9758 fi
9759 $rm -f try.* try
9760 set d_fpos64_t
9761 eval $setvar
9762
9763 : see if frexpl exists
9764 set frexpl d_frexpl
9765 eval $inlibc
9766
9767 : see if this is a sys/param system
9768 set sys/param.h i_sysparam
9769 eval $inhdr
9770
9771 : see if this is a sys/mount.h system
9772 set sys/mount.h i_sysmount
9773 eval $inhdr
9774
9775
9776 echo " "
9777 echo "Checking to see if your system supports struct fs_data..." >&4
9778 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9779 eval $hasstruct
9780 case "$d_fs_data_s" in
9781 "$define")      echo "Yes, it does."   ;;
9782 *)              echo "No, it doesn't." ;;
9783 esac
9784
9785 : see if fseeko exists
9786 set fseeko d_fseeko
9787 eval $inlibc
9788 case "$longsize" in
9789 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9790 esac
9791
9792 : see if fsetpos exists
9793 set fsetpos d_fsetpos
9794 eval $inlibc
9795
9796
9797 : see if fstatfs exists
9798 set fstatfs d_fstatfs
9799 eval $inlibc
9800
9801
9802 : see if statvfs exists
9803 set statvfs d_statvfs
9804 eval $inlibc
9805
9806 : see if fstatvfs exists
9807 set fstatvfs d_fstatvfs
9808 eval $inlibc
9809
9810
9811 : see if fsync exists
9812 set fsync d_fsync
9813 eval $inlibc
9814
9815 : see if ftello exists
9816 set ftello d_ftello
9817 eval $inlibc
9818 case "$longsize" in
9819 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9820 esac
9821
9822 : see if getcwd exists
9823 set getcwd d_getcwd
9824 eval $inlibc
9825
9826 : see if getespwnam exists
9827 set getespwnam d_getespwnam
9828 eval $inlibc
9829
9830
9831 : see if getfsstat exists
9832 set getfsstat d_getfsstat
9833 eval $inlibc
9834
9835 : see if getgrent exists
9836 set getgrent d_getgrent
9837 eval $inlibc
9838
9839 : see if gethostbyaddr exists
9840 set gethostbyaddr d_gethbyaddr
9841 eval $inlibc
9842
9843 : see if gethostbyname exists
9844 set gethostbyname d_gethbyname
9845 eval $inlibc
9846
9847 : see if gethostent exists
9848 set gethostent d_gethent
9849 eval $inlibc
9850
9851 : see how we will look up host name
9852 echo " "
9853 call=''
9854 if set gethostname val -f d_gethname; eval $csym; $val; then
9855         echo 'gethostname() found.' >&4
9856         d_gethname="$define"
9857         call=gethostname
9858 fi
9859 if set uname val -f d_uname; eval $csym; $val; then
9860         if ./xenix; then
9861                 $cat <<'EOM'
9862 uname() was found, but you're running xenix, and older versions of xenix
9863 have a broken uname(). If you don't really know whether your xenix is old
9864 enough to have a broken system call, use the default answer.
9865
9866 EOM
9867                 dflt=y
9868                 case "$d_uname" in
9869                 "$define") dflt=n;;
9870                 esac
9871                 rp='Is your uname() broken?'
9872                 . ./myread
9873                 case "$ans" in
9874                 n*) d_uname="$define"; call=uname;;
9875                 esac
9876         else
9877                 echo 'uname() found.' >&4
9878                 d_uname="$define"
9879                 case "$call" in
9880                 '') call=uname ;;
9881                 esac
9882         fi
9883 fi
9884 case "$d_gethname" in
9885 '') d_gethname="$undef";;
9886 esac
9887 case "$d_uname" in
9888 '') d_uname="$undef";;
9889 esac
9890 case "$d_uname$d_gethname" in
9891 *define*)
9892         dflt=n
9893         cat <<EOM
9894  
9895 Every now and then someone has a $call() that lies about the hostname
9896 but can't be fixed for political or economic reasons.  If you wish, I can
9897 pretend $call() isn't there and maybe compute hostname at run-time
9898 thanks to the '$phostname' command.
9899
9900 EOM
9901         rp="Shall I ignore $call() from now on?"
9902         . ./myread
9903         case "$ans" in
9904         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9905         esac;;
9906 esac
9907 case "$phostname" in
9908 '') aphostname='';;
9909 *) case "$aphostname" in
9910         /*) ;;
9911         *) set X $phostname
9912                 shift
9913                 file=$1
9914                 shift
9915                 file=`./loc $file $file $pth`
9916                 aphostname=`echo $file $*`
9917                 ;;
9918         esac
9919         ;;
9920 esac
9921 case "$d_uname$d_gethname" in
9922 *define*) ;;
9923 *)
9924         case "$phostname" in
9925         '')
9926                 echo "There will be no way for $package to get your hostname." >&4;;
9927         *)
9928         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9929                 ;;
9930         esac;;
9931 esac
9932 case "$d_phostname" in
9933 '') d_phostname="$undef";;
9934 esac
9935
9936 : see if this is a netdb.h system
9937 set netdb.h i_netdb
9938 eval $inhdr
9939
9940 : see if prototypes for various gethostxxx netdb.h functions are available
9941 echo " "
9942 set d_gethostprotos gethostent $i_netdb netdb.h
9943 eval $hasproto
9944
9945 : see if getitimer exists
9946 set getitimer d_getitimer
9947 eval $inlibc
9948
9949 : see if getlogin exists
9950 set getlogin d_getlogin
9951 eval $inlibc
9952
9953 : see if getmnt exists
9954 set getmnt d_getmnt
9955 eval $inlibc
9956
9957 : see if getmntent exists
9958 set getmntent d_getmntent
9959 eval $inlibc
9960
9961 : see if getnetbyaddr exists
9962 set getnetbyaddr d_getnbyaddr
9963 eval $inlibc
9964
9965 : see if getnetbyname exists
9966 set getnetbyname d_getnbyname
9967 eval $inlibc
9968
9969 : see if getnetent exists
9970 set getnetent d_getnent
9971 eval $inlibc
9972
9973 : see if prototypes for various getnetxxx netdb.h functions are available
9974 echo " "
9975 set d_getnetprotos getnetent $i_netdb netdb.h
9976 eval $hasproto
9977
9978 : see if getpagesize exists
9979 set getpagesize d_getpagsz
9980 eval $inlibc
9981
9982
9983 : see if getprotobyname exists
9984 set getprotobyname d_getpbyname
9985 eval $inlibc
9986
9987 : see if getprotobynumber exists
9988 set getprotobynumber d_getpbynumber
9989 eval $inlibc
9990
9991 : see if getprotoent exists
9992 set getprotoent d_getpent
9993 eval $inlibc
9994
9995 : see if getpgid exists
9996 set getpgid d_getpgid
9997 eval $inlibc
9998
9999 : see if getpgrp2 exists
10000 set getpgrp2 d_getpgrp2
10001 eval $inlibc
10002
10003 : see if getppid exists
10004 set getppid d_getppid
10005 eval $inlibc
10006
10007 : see if getpriority exists
10008 set getpriority d_getprior
10009 eval $inlibc
10010
10011 : see if prototypes for various getprotoxxx netdb.h functions are available
10012 echo " "
10013 set d_getprotoprotos getprotoent $i_netdb netdb.h
10014 eval $hasproto
10015
10016 : see if getprpwnam exists
10017 set getprpwnam d_getprpwnam
10018 eval $inlibc
10019
10020 : see if getpwent exists
10021 set getpwent d_getpwent
10022 eval $inlibc
10023
10024
10025 : see if getservbyname exists
10026 set getservbyname d_getsbyname
10027 eval $inlibc
10028
10029 : see if getservbyport exists
10030 set getservbyport d_getsbyport
10031 eval $inlibc
10032
10033 : see if getservent exists
10034 set getservent d_getsent
10035 eval $inlibc
10036
10037 : see if prototypes for various getservxxx netdb.h functions are available
10038 echo " "
10039 set d_getservprotos getservent $i_netdb netdb.h
10040 eval $hasproto
10041
10042 : see if getspnam exists
10043 set getspnam d_getspnam
10044 eval $inlibc
10045
10046 : see if gettimeofday or ftime exists
10047 set gettimeofday d_gettimeod
10048 eval $inlibc
10049 case "$d_gettimeod" in
10050 "$undef")
10051         set ftime d_ftime 
10052         eval $inlibc
10053         ;;
10054 *)
10055         val="$undef"; set d_ftime; eval $setvar
10056         ;;
10057 esac
10058 case "$d_gettimeod$d_ftime" in
10059 "$undef$undef")
10060         echo " "
10061         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10062         ;;
10063 esac
10064
10065 : see if this is an grp system
10066 set grp.h i_grp
10067 eval $inhdr
10068
10069 case "$i_grp" in
10070 $define)
10071         xxx=`./findhdr grp.h`
10072         $cppstdin $cppflags $cppminus < $xxx >$$.h
10073
10074         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10075                 val="$define"
10076         else
10077                 val="$undef"
10078         fi
10079         set d_grpasswd
10080         eval $setvar
10081
10082         $rm -f $$.h
10083         ;;
10084 *)
10085         val="$undef";
10086         set d_grpasswd; eval $setvar
10087         ;;
10088 esac
10089
10090 : see if hasmntopt exists
10091 set hasmntopt d_hasmntopt
10092 eval $inlibc
10093
10094 : see if this is a netinet/in.h or sys/in.h system
10095 set netinet/in.h i_niin sys/in.h i_sysin
10096 eval $inhdr
10097
10098 : see if arpa/inet.h has to be included
10099 set arpa/inet.h i_arpainet
10100 eval $inhdr
10101
10102 : see if htonl --and friends-- exists
10103 val=''
10104 set htonl val
10105 eval $inlibc
10106
10107 : Maybe they are macros.
10108 case "$val" in
10109 $undef)
10110         $cat >htonl.c <<EOM
10111 #include <stdio.h>
10112 #include <sys/types.h>
10113 #$i_niin I_NETINET_IN
10114 #$i_sysin I_SYS_IN
10115 #$i_arpainet I_ARPA_INET
10116 #ifdef I_NETINET_IN
10117 #include <netinet/in.h>
10118 #endif
10119 #ifdef I_SYS_IN
10120 #include <sys/in.h>
10121 #endif
10122 #ifdef I_ARPA_INET
10123 #include <arpa/inet.h>
10124 #endif
10125 #ifdef htonl
10126 printf("Defined as a macro.");
10127 #endif
10128 EOM
10129         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10130         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10131                 val="$define"
10132                 echo "But it seems to be defined as a macro." >&4
10133         fi
10134         $rm -f htonl.?
10135         ;;
10136 esac
10137 set d_htonl
10138 eval $setvar
10139
10140 : see if iconv exists
10141 set iconv d_iconv
10142 eval $inlibc
10143
10144 : index or strchr
10145 echo " "
10146 if set index val -f; eval $csym; $val; then
10147         if set strchr val -f d_strchr; eval $csym; $val; then
10148                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10149                         val="$define"
10150                         vali="$undef"
10151                         echo "strchr() found." >&4
10152                 else
10153                         val="$undef"
10154                         vali="$define"
10155                         echo "index() found." >&4
10156                 fi
10157         else
10158                 val="$undef"
10159                 vali="$define"
10160                 echo "index() found." >&4
10161         fi
10162 else
10163         if set strchr val -f d_strchr; eval $csym; $val; then
10164                 val="$define"
10165                 vali="$undef"
10166                 echo "strchr() found." >&4
10167         else
10168                 echo "No index() or strchr() found!" >&4
10169                 val="$undef"
10170                 vali="$undef"
10171         fi
10172 fi
10173 set d_strchr; eval $setvar
10174 val="$vali"
10175 set d_index; eval $setvar
10176
10177 : check whether inet_aton exists
10178 set inet_aton d_inetaton
10179 eval $inlibc
10180
10181 : Look for isascii
10182 echo " "
10183 $cat >isascii.c <<'EOCP'
10184 #include <stdio.h>
10185 #include <ctype.h>
10186 int main() {
10187         int c = 'A';
10188         if (isascii(c))
10189                 exit(0);
10190         else
10191                 exit(1);
10192 }
10193 EOCP
10194 set isascii
10195 if eval $compile; then
10196         echo "isascii() found." >&4
10197         val="$define"
10198 else
10199         echo "isascii() NOT found." >&4
10200         val="$undef"
10201 fi
10202 set d_isascii
10203 eval $setvar
10204 $rm -f isascii*
10205
10206 : see if isnan exists
10207 set isnan d_isnan
10208 eval $inlibc
10209
10210 : see if isnanl exists
10211 set isnanl d_isnanl
10212 eval $inlibc
10213
10214 : see if killpg exists
10215 set killpg d_killpg
10216 eval $inlibc
10217
10218 : see if lchown exists
10219 echo " "
10220 $cat > try.c <<'EOCP'
10221 /* System header to define __stub macros and hopefully few prototypes,
10222     which can conflict with char lchown(); below.  */
10223 #include <assert.h>
10224 /* Override any gcc2 internal prototype to avoid an error.  */
10225 /* We use char because int might match the return type of a gcc2
10226    builtin and then its argument prototype would still apply.  */
10227 char lchown();
10228 int main() {
10229     /*  The GNU C library defines this for functions which it implements
10230         to always fail with ENOSYS.  Some functions are actually named
10231         something starting with __ and the normal name is an alias.  */
10232 #if defined (__stub_lchown) || defined (__stub___lchown)
10233 choke me
10234 #else
10235 lchown();
10236 #endif
10237 ; return 0; }
10238 EOCP
10239 set try
10240 if eval $compile; then
10241     $echo "lchown() found." >&4
10242     val="$define"
10243 else
10244     $echo "lchown() NOT found." >&4
10245     val="$undef"
10246 fi
10247 set d_lchown
10248 eval $setvar
10249
10250 : See if number of significant digits in a double precision number is known
10251 echo " "
10252 $cat >ldbl_dig.c <<EOM
10253 #$i_limits I_LIMITS
10254 #$i_float I_FLOAT
10255 #ifdef I_LIMITS
10256 #include <limits.h>
10257 #endif
10258 #ifdef I_FLOAT
10259 #include <float.h>
10260 #endif
10261 #ifdef LDBL_DIG
10262 printf("Contains LDBL_DIG");
10263 #endif
10264 EOM
10265 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10266 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10267         echo "LDBL_DIG found." >&4
10268         val="$define"
10269 else
10270         echo "LDBL_DIG NOT found." >&4
10271         val="$undef"
10272 fi
10273 $rm -f ldbl_dig.?
10274 set d_ldbl_dig
10275 eval $setvar
10276
10277 : see if link exists
10278 set link d_link
10279 eval $inlibc
10280
10281 : see if localeconv exists
10282 set localeconv d_locconv
10283 eval $inlibc
10284
10285 : see if lockf exists
10286 set lockf d_lockf
10287 eval $inlibc
10288
10289 : see if prototype for lseek is available
10290 echo " "
10291 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10292 eval $hasproto
10293
10294 : see if lstat exists
10295 set lstat d_lstat
10296 eval $inlibc
10297
10298 : see if madvise exists
10299 set madvise d_madvise
10300 eval $inlibc
10301
10302 : see if mblen exists
10303 set mblen d_mblen
10304 eval $inlibc
10305
10306 : see if mbstowcs exists
10307 set mbstowcs d_mbstowcs
10308 eval $inlibc
10309
10310 : see if mbtowc exists
10311 set mbtowc d_mbtowc
10312 eval $inlibc
10313
10314 : see if memchr exists
10315 set memchr d_memchr
10316 eval $inlibc
10317
10318 : see if memcmp exists
10319 set memcmp d_memcmp
10320 eval $inlibc
10321
10322 : see if memcpy exists
10323 set memcpy d_memcpy
10324 eval $inlibc
10325
10326 : see if memmove exists
10327 set memmove d_memmove
10328 eval $inlibc
10329
10330 : see if memset exists
10331 set memset d_memset
10332 eval $inlibc
10333
10334 : see if mkdir exists
10335 set mkdir d_mkdir
10336 eval $inlibc
10337
10338 : see if mkdtemp exists
10339 set mkdtemp d_mkdtemp
10340 eval $inlibc
10341
10342 : see if mkfifo exists
10343 set mkfifo d_mkfifo
10344 eval $inlibc
10345
10346 : see if mkstemp exists
10347 set mkstemp d_mkstemp
10348 eval $inlibc
10349
10350 : see if mkstemps exists
10351 set mkstemps d_mkstemps
10352 eval $inlibc
10353
10354 : see if mktime exists
10355 set mktime d_mktime
10356 eval $inlibc
10357
10358 : see if this is a sys/mman.h system
10359 set sys/mman.h i_sysmman
10360 eval $inhdr
10361
10362 : see if mmap exists
10363 set mmap d_mmap
10364 eval $inlibc
10365 : see what shmat returns
10366 : default to something harmless
10367 mmaptype='void *'
10368 case "$i_sysmman$d_mmap" in
10369 "$define$define")
10370         $cat >mmap.c <<'END'
10371 #include <sys/mman.h>
10372 void *mmap();
10373 END
10374         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10375                 mmaptype='void *'
10376         else
10377                 mmaptype='caddr_t'
10378         fi
10379         echo "and it returns ($mmaptype)." >&4
10380         ;;
10381 esac
10382
10383
10384
10385 : see if modfl exists
10386 set modfl d_modfl
10387 eval $inlibc
10388
10389 : see if mprotect exists
10390 set mprotect d_mprotect
10391 eval $inlibc
10392
10393 : see if msgctl exists
10394 set msgctl d_msgctl
10395 eval $inlibc
10396
10397 : see if msgget exists
10398 set msgget d_msgget
10399 eval $inlibc
10400
10401 : see if msgsnd exists
10402 set msgsnd d_msgsnd
10403 eval $inlibc
10404
10405 : see if msgrcv exists
10406 set msgrcv d_msgrcv
10407 eval $inlibc
10408
10409 : see how much of the 'msg*(2)' library is present.
10410 h_msg=true
10411 echo " "
10412 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10413 *"$undef"*) h_msg=false;;
10414 esac
10415 case "$osname" in
10416 freebsd)
10417     case "`ipcs 2>&1`" in
10418     "SVID messages"*"not configured"*)
10419         echo "Your $osname does not have the msg*(2) configured." >&4
10420         h_msg=false
10421         val="$undef"
10422         set msgctl d_msgctl
10423         eval $setvar
10424         set msgget d_msgget
10425         eval $setvar
10426         set msgsnd d_msgsnd
10427         eval $setvar
10428         set msgrcv d_msgrcv
10429         eval $setvar
10430         ;;
10431     esac
10432     ;;
10433 esac
10434 : we could also check for sys/ipc.h ...
10435 if $h_msg && $test `./findhdr sys/msg.h`; then
10436         echo "You have the full msg*(2) library." >&4
10437         val="$define"
10438 else
10439         echo "You don't have the full msg*(2) library." >&4
10440         val="$undef"
10441 fi
10442 set d_msg
10443 eval $setvar
10444
10445
10446 echo " "
10447 echo "Checking to see if your system supports struct msghdr..." >&4
10448 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10449 eval $hasstruct
10450 case "$d_msghdr_s" in
10451 "$define")      echo "Yes, it does."   ;;
10452 *)              echo "No, it doesn't." ;;
10453 esac
10454
10455
10456 : see if msync exists
10457 set msync d_msync
10458 eval $inlibc
10459
10460 : see if munmap exists
10461 set munmap d_munmap
10462 eval $inlibc
10463
10464 : see if nice exists
10465 set nice d_nice
10466 eval $inlibc
10467
10468 : check for length of character
10469 echo " "
10470 case "$charsize" in
10471 '')
10472         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10473         $cat >try.c <<'EOCP'
10474 #include <stdio.h>
10475 int main()
10476 {
10477     printf("%d\n", (int)sizeof(char));
10478     exit(0);
10479 }
10480 EOCP
10481         set try
10482         if eval $compile_ok; then
10483                 dflt=`./try`
10484         else
10485                 dflt='1'
10486                 echo "(I can't seem to compile the test program.  Guessing...)"
10487         fi
10488         ;;
10489 *)
10490         dflt="$charsize"
10491         ;;
10492 esac
10493 rp="What is the size of a character (in bytes)?"
10494 . ./myread
10495 charsize="$ans"
10496 $rm -f try.c try
10497
10498 : check for volatile keyword
10499 echo " "
10500 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10501 $cat >try.c <<'EOCP'
10502 int main()
10503 {
10504         typedef struct _goo_struct goo_struct;
10505         goo_struct * volatile goo = ((goo_struct *)0);
10506         struct _goo_struct {
10507                 long long_int;
10508                 int reg_int;
10509                 char char_var;
10510         };
10511         typedef unsigned short foo_t;
10512         char *volatile foo;
10513         volatile int bar;
10514         volatile foo_t blech;
10515         foo = foo;
10516 }
10517 EOCP
10518 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10519         val="$define"
10520         echo "Yup, it does."
10521 else
10522         val="$undef"
10523         echo "Nope, it doesn't."
10524 fi
10525 set d_volatile
10526 eval $setvar
10527 $rm -f try.*
10528
10529
10530 echo " "
10531 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10532
10533 case "$use64bitint:$d_quad:$quadtype" in
10534 define:define:?*)
10535         ivtype="$quadtype"
10536         uvtype="$uquadtype"
10537         ivsize=8
10538         uvsize=8
10539         ;;
10540 *)      ivtype="long"
10541         uvtype="unsigned long"
10542         ivsize=$longsize
10543         uvsize=$longsize
10544         ;;
10545 esac
10546
10547 case "$uselongdouble:$d_longdbl" in
10548 define:define)
10549         nvtype="long double"
10550         nvsize=$longdblsize
10551         ;;
10552 *)      nvtype=double
10553         nvsize=$doublesize
10554         ;;
10555 esac
10556
10557 $echo "(IV will be "$ivtype", $ivsize bytes)"
10558 $echo "(UV will be "$uvtype", $uvsize bytes)"
10559 $echo "(NV will be "$nvtype", $nvsize bytes)"
10560
10561 $cat >try.c <<EOCP
10562 #$i_inttypes I_INTTYPES
10563 #ifdef I_INTTYPES
10564 #include <inttypes.h>
10565 #endif
10566 #include <stdio.h>
10567 int main() {
10568 #ifdef INT8
10569    int8_t i =  INT8_MAX;
10570   uint8_t u = UINT8_MAX;
10571   printf("int8_t\n");
10572 #endif
10573 #ifdef INT16
10574    int16_t i =  INT16_MAX;
10575   uint16_t i = UINT16_MAX;
10576   printf("int16_t\n");
10577 #endif
10578 #ifdef INT32
10579    int32_t i =  INT32_MAX;
10580   uint32_t u = UINT32_MAX;
10581   printf("int32_t\n");
10582 #endif
10583 }
10584 EOCP
10585
10586 case "$i8type" in
10587 '')     case "$charsize" in
10588         1)      i8type=char
10589                 u8type="unsigned char"
10590                 i8size=$charsize
10591                 u8size=$charsize
10592                 ;;
10593         esac
10594         ;;
10595 esac
10596 case "$i8type" in
10597 '')     set try -DINT8
10598         if eval $compile; then
10599                 case "`./try$exe_ext`" in
10600                 int8_t) i8type=int8_t
10601                         u8type=uint8_t
10602                         i8size=1
10603                         u8size=1
10604                         ;;
10605                 esac
10606         fi
10607         ;;
10608 esac
10609 case "$i8type" in
10610 '')     if $test $charsize -ge 1; then
10611                 i8type=char
10612                 u8type="unsigned char"
10613                 i8size=$charsize
10614                 u8size=$charsize
10615         fi
10616         ;;
10617 esac
10618
10619 case "$i16type" in
10620 '')     case "$shortsize" in
10621         2)      i16type=short
10622                 u16type="unsigned short"
10623                 i16size=$shortsize
10624                 u16size=$shortsize
10625                 ;;
10626         esac
10627         ;;
10628 esac
10629 case "$i16type" in
10630 '')     set try -DINT16
10631         if eval $compile; then
10632                 case "`./try$exe_ext`" in
10633                 int16_t)
10634                         i16type=int16_t
10635                         u16type=uint16_t
10636                         i16size=2
10637                         u16size=2
10638                         ;;
10639                 esac
10640         fi
10641         ;;
10642 esac
10643 case "$i16type" in
10644 '')     if $test $shortsize -ge 2; then
10645                 i16type=short
10646                 u16type="unsigned short"
10647                 i16size=$shortsize
10648                 u16size=$shortsize
10649         fi
10650         ;;
10651 esac
10652
10653 case "$i32type" in
10654 '')     case "$longsize" in
10655         4)      i32type=long
10656                 u32type="unsigned long"
10657                 i32size=$longsize
10658                 u32size=$longsize
10659                 ;;
10660         *)      case "$intsize" in
10661                 4)      i32type=int
10662                         u32type="unsigned int"
10663                         i32size=$intsize
10664                         u32size=$intsize
10665                         ;;
10666                 esac
10667                 ;;
10668         esac
10669         ;;
10670 esac
10671 case "$i32type" in
10672 '')     set try -DINT32
10673         if eval $compile; then
10674                 case "`./try$exe_ext`" in
10675                 int32_t)
10676                         i32type=int32_t
10677                         u32type=uint32_t
10678                         i32size=4
10679                         u32size=4
10680                         ;;
10681                 esac
10682         fi
10683         ;;
10684 esac
10685 case "$i32type" in
10686 '')     if $test $intsize -ge 4; then
10687                 i32type=int
10688                 u32type="unsigned int"
10689                 i32size=$intsize
10690                 u32size=$intsize
10691         fi
10692         ;;
10693 esac
10694
10695 case "$i64type" in
10696 '')     case "$d_quad:$quadtype" in
10697         define:?*)
10698                 i64type="$quadtype"
10699                 u64type="$uquadtype"
10700                 i64size=8
10701                 u64size=8
10702                 ;;
10703         esac
10704         ;;
10705 esac
10706
10707 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10708 : volatile so that the compiler has to store it out to memory.
10709 if test X"$d_volatile" = X"$define"; then
10710         volatile=volatile
10711 fi
10712 $cat <<EOP >try.c
10713 #include <stdio.h>
10714 #include <sys/types.h>
10715 #include <signal.h>
10716 #ifdef SIGFPE
10717 $volatile int bletched = 0;
10718 $signal_t blech(s) int s; { bletched = 1; }
10719 #endif
10720 int main() {
10721     $uvtype u = 0;
10722     $nvtype d;
10723     int     n = 8 * $uvsize;
10724     int     i;
10725 #ifdef SIGFPE
10726     signal(SIGFPE, blech);
10727 #endif
10728
10729     for (i = 0; i < n; i++) {
10730       u = u << 1 | ($uvtype)1;
10731       d = ($nvtype)u;
10732       if (($uvtype)d != u)
10733         break;
10734       if (d <= 0)
10735         break;
10736       d = ($nvtype)(u - 1);
10737       if (($uvtype)d != (u - 1))
10738         break;
10739 #ifdef SIGFPE
10740       if (bletched) {
10741         break;
10742 #endif
10743       } 
10744     }
10745     printf("%d\n", ((i == n) ? -n : i));
10746     exit(0);
10747 }
10748 EOP
10749 set try
10750
10751 d_nv_preserves_uv="$undef"
10752 if eval $compile; then
10753         d_nv_preserves_uv_bits="`./try$exe_ext`"
10754 fi
10755 case "$d_nv_preserves_uv_bits" in
10756 \-[1-9]*)       
10757         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10758         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10759         d_nv_preserves_uv="$define"
10760         ;;
10761 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10762         d_nv_preserves_uv="$undef" ;;
10763 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10764         d_nv_preserves_uv_bits="$undef" ;;
10765 esac
10766
10767 $rm -f try.* try
10768
10769
10770 : check for off64_t
10771 echo " "
10772 echo "Checking to see if you have off64_t..." >&4
10773 $cat >try.c <<EOCP
10774 #include <sys/types.h>
10775 #include <unistd.h>
10776 int main() { off64_t x = 7; }
10777 EOCP
10778 set try
10779 if eval $compile; then
10780         val="$define"
10781         echo "You have off64_t."
10782 else
10783         val="$undef"
10784         echo "You do not have off64_t."
10785         case "$lseeksize" in
10786         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10787         esac
10788 fi
10789 $rm -f try.* try
10790 set d_off64_t
10791 eval $setvar
10792
10793 : see if POSIX threads are available
10794 set pthread.h i_pthread
10795 eval $inhdr
10796
10797
10798
10799
10800 : how to create joinable pthreads
10801 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10802         echo " "
10803         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10804         $cat >try.c <<'EOCP'
10805 #include <pthread.h>
10806 int main() {
10807     int detachstate = JOINABLE;
10808 }
10809 EOCP
10810         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10811         if eval $compile; then
10812                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10813                 val="$undef" # Yes, undef.
10814                 set d_old_pthread_create_joinable
10815                 eval $setvar
10816                 val=""
10817                 set old_pthread_create_joinable
10818                 eval $setvar
10819         else
10820                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10821                 if eval $compile; then
10822                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10823                         val="$define"
10824                         set d_old_pthread_create_joinable
10825                         eval $setvar
10826                         val=PTHREAD_CREATE_UNDETACHED
10827                         set old_pthread_create_joinable
10828                         eval $setvar
10829                 else            
10830                         set try -DJOINABLE=__UNDETACHED
10831                         if eval $compile; then
10832                                 echo "You seem to use __UNDETACHED." >&4
10833                                 val="$define"
10834                                 set d_old_pthread_create_joinable
10835                                 eval $setvar
10836                                 val=__UNDETACHED
10837                                 set old_pthread_create_joinable
10838                                 eval $setvar
10839                         else
10840                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10841                                 val="$define"
10842                                 set d_old_pthread_create_joinable
10843                                 eval $setvar
10844                                 val=0
10845                                 set old_pthread_create_joinable
10846                                 eval $setvar
10847                         fi
10848                 fi
10849         fi
10850         $rm -f try try.*
10851 else
10852     d_old_pthread_create_joinable="$undef"
10853     old_pthread_create_joinable=""
10854 fi
10855
10856 : see if pause exists
10857 set pause d_pause
10858 eval $inlibc
10859
10860 : see if pipe exists
10861 set pipe d_pipe
10862 eval $inlibc
10863
10864 : see if poll exists
10865 set poll d_poll
10866 eval $inlibc
10867
10868
10869 : see whether the various POSIXish _yields exist
10870 $cat >try.c <<EOP
10871 #include <pthread.h>
10872 #include <stdio.h>
10873 int main() {
10874 #ifdef SCHED_YIELD
10875         sched_yield();
10876 #else
10877 #ifdef PTHREAD_YIELD
10878         pthread_yield();
10879 #else
10880 #ifdef PTHREAD_YIELD_NULL
10881         pthread_yield(NULL);
10882 #endif
10883 #endif
10884 #endif
10885 }
10886 EOP
10887 : see if sched_yield exists
10888 set try -DSCHED_YIELD
10889 if eval $compile; then
10890     val="$define"
10891     sched_yield='sched_yield()'
10892 else
10893     val="$undef"
10894 fi
10895 case "$usethreads" in
10896 $define)
10897         case "$val" in
10898         $define) echo 'sched_yield() found.' >&4        ;;
10899         *)       echo 'sched_yield() NOT found.' >&4    ;;
10900         esac
10901 esac
10902 set d_sched_yield
10903 eval $setvar
10904
10905 : see if pthread_yield exists
10906 set try -DPTHREAD_YIELD
10907 if eval $compile; then
10908     val="$define"
10909     case "$sched_yield" in
10910     '') sched_yield='pthread_yield()' ;;
10911     esac
10912 else
10913     set try -DPTHREAD_YIELD_NULL
10914     if eval $compile; then
10915         val="$define"
10916         case "$sched_yield" in
10917         '') sched_yield='pthread_yield(NULL)' ;;
10918         esac
10919     else
10920         val="$undef"
10921     fi
10922 fi
10923 case "$usethreads" in
10924 $define)
10925         case "$val" in
10926         $define) echo 'pthread_yield() found.' >&4      ;;
10927         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10928         esac
10929         ;;
10930 esac
10931 set d_pthread_yield
10932 eval $setvar
10933
10934 case "$sched_yield" in
10935 '') sched_yield=undef ;;
10936 esac
10937
10938 $rm -f try try.*
10939
10940 : see if this is a pwd.h system
10941 set pwd.h i_pwd
10942 eval $inhdr
10943
10944 case "$i_pwd" in
10945 $define)
10946         xxx=`./findhdr pwd.h`
10947         $cppstdin $cppflags $cppminus < $xxx >$$.h
10948
10949         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10950                 val="$define"
10951         else
10952                 val="$undef"
10953         fi
10954         set d_pwquota
10955         eval $setvar
10956
10957         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10958                 val="$define"
10959         else
10960                 val="$undef"
10961         fi
10962         set d_pwage
10963         eval $setvar
10964
10965         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10966                 val="$define"
10967         else
10968                 val="$undef"
10969         fi
10970         set d_pwchange
10971         eval $setvar
10972
10973         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10974                 val="$define"
10975         else
10976                 val="$undef"
10977         fi
10978         set d_pwclass
10979         eval $setvar
10980
10981         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10982                 val="$define"
10983         else
10984                 val="$undef"
10985         fi
10986         set d_pwexpire
10987         eval $setvar
10988
10989         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10990                 val="$define"
10991         else
10992                 val="$undef"
10993         fi
10994         set d_pwcomment
10995         eval $setvar
10996
10997         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10998                 val="$define"
10999         else
11000                 val="$undef"
11001         fi
11002         set d_pwgecos
11003         eval $setvar
11004
11005         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11006                 val="$define"
11007         else
11008                 val="$undef"
11009         fi
11010         set d_pwpasswd
11011         eval $setvar
11012
11013         $rm -f $$.h
11014         ;;
11015 *)
11016         val="$undef"; 
11017         set d_pwquota; eval $setvar
11018         set d_pwage; eval $setvar
11019         set d_pwchange; eval $setvar
11020         set d_pwclass; eval $setvar
11021         set d_pwexpire; eval $setvar
11022         set d_pwcomment; eval $setvar
11023         set d_pwgecos; eval $setvar
11024         set d_pwpasswd; eval $setvar
11025         ;;
11026 esac
11027
11028 : see if readdir and friends exist
11029 set readdir d_readdir
11030 eval $inlibc
11031 set seekdir d_seekdir
11032 eval $inlibc
11033 set telldir d_telldir
11034 eval $inlibc
11035 set rewinddir d_rewinddir
11036 eval $inlibc
11037
11038 : see if readlink exists
11039 set readlink d_readlink
11040 eval $inlibc
11041
11042 : see if readv exists
11043 set readv d_readv
11044 eval $inlibc
11045
11046 : see if recvmsg exists
11047 set recvmsg d_recvmsg
11048 eval $inlibc
11049
11050 : see if rename exists
11051 set rename d_rename
11052 eval $inlibc
11053
11054 : see if rmdir exists
11055 set rmdir d_rmdir
11056 eval $inlibc
11057
11058 : see if memory.h is available.
11059 val=''
11060 set memory.h val
11061 eval $inhdr
11062
11063 : See if it conflicts with string.h
11064 case "$val" in
11065 $define)
11066         case "$strings" in
11067         '') ;;
11068         *)
11069                 $cppstdin $cppflags $cppminus < $strings > mem.h
11070                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11071                         echo " "
11072                         echo "We won't be including <memory.h>."
11073                         val="$undef"
11074                 fi
11075                 $rm -f mem.h
11076                 ;;
11077         esac
11078 esac
11079 set i_memory
11080 eval $setvar
11081
11082 : can bcopy handle overlapping blocks?
11083 val="$undef"
11084 case "$d_bcopy" in
11085 "$define")
11086         echo " "
11087         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11088         $cat >try.c <<EOCP
11089 #$i_memory I_MEMORY
11090 #$i_stdlib I_STDLIB
11091 #$i_string I_STRING
11092 #$i_unistd I_UNISTD
11093 EOCP
11094         $cat >>try.c <<'EOCP'
11095 #include <stdio.h>
11096 #ifdef I_MEMORY
11097 #  include <memory.h>
11098 #endif
11099 #ifdef I_STDLIB
11100 #  include <stdlib.h>
11101 #endif
11102 #ifdef I_STRING
11103 #  include <string.h>
11104 #else
11105 #  include <strings.h>
11106 #endif
11107 #ifdef I_UNISTD
11108 #  include <unistd.h>  /* Needed for NetBSD */
11109 #endif
11110 int main()
11111 {
11112 char buf[128], abc[128];
11113 char *b;
11114 int len;
11115 int off;
11116 int align;
11117
11118 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11119
11120 for (align = 7; align >= 0; align--) {
11121         for (len = 36; len; len--) {
11122                 b = buf+align;
11123                 bcopy(abc, b, len);
11124                 for (off = 1; off <= len; off++) {
11125                         bcopy(b, b+off, len);
11126                         bcopy(b+off, b, len);
11127                         if (bcmp(b, abc, len))
11128                                 exit(1);
11129                 }
11130         }
11131 }
11132 exit(0);
11133 }
11134 EOCP
11135         set try
11136         if eval $compile_ok; then
11137                 if ./try 2>/dev/null; then
11138                         echo "Yes, it can."
11139                         val="$define"
11140                 else
11141                         echo "It can't, sorry."
11142                         case "$d_memmove" in
11143                         "$define") echo "But that's Ok since you have memmove()." ;;
11144                         esac
11145                 fi
11146         else
11147                 echo "(I can't compile the test program, so we'll assume not...)"
11148                 case "$d_memmove" in
11149                 "$define") echo "But that's Ok since you have memmove()." ;;
11150                 esac
11151         fi
11152         ;;
11153 esac
11154 $rm -f try.* try core
11155 set d_safebcpy
11156 eval $setvar
11157
11158 : can memcpy handle overlapping blocks?
11159 val="$undef"
11160 case "$d_memcpy" in
11161 "$define")
11162         echo " "
11163         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11164         $cat >try.c <<EOCP
11165 #$i_memory I_MEMORY
11166 #$i_stdlib I_STDLIB
11167 #$i_string I_STRING
11168 #$i_unistd I_UNISTD
11169 EOCP
11170         $cat >>try.c <<'EOCP'
11171 #include <stdio.h>
11172 #ifdef I_MEMORY
11173 #  include <memory.h>
11174 #endif
11175 #ifdef I_STDLIB
11176 #  include <stdlib.h>
11177 #endif
11178 #ifdef I_STRING
11179 #  include <string.h>
11180 #else
11181 #  include <strings.h>
11182 #endif
11183 #ifdef I_UNISTD
11184 #  include <unistd.h>  /* Needed for NetBSD */
11185 #endif
11186 int main()
11187 {
11188 char buf[128], abc[128];
11189 char *b;
11190 int len;
11191 int off;
11192 int align;
11193
11194 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11195    try to store the string in read-only memory. */
11196 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11197
11198 for (align = 7; align >= 0; align--) {
11199         for (len = 36; len; len--) {
11200                 b = buf+align;
11201                 memcpy(b, abc, len);
11202                 for (off = 1; off <= len; off++) {
11203                         memcpy(b+off, b, len);
11204                         memcpy(b, b+off, len);
11205                         if (memcmp(b, abc, len))
11206                                 exit(1);
11207                 }
11208         }
11209 }
11210 exit(0);
11211 }
11212 EOCP
11213         set try
11214         if eval $compile_ok; then
11215                 if ./try 2>/dev/null; then
11216                         echo "Yes, it can."
11217                         val="$define"
11218                 else
11219                         echo "It can't, sorry."
11220                         case "$d_memmove" in
11221                         "$define") echo "But that's Ok since you have memmove()." ;;
11222                         esac
11223                 fi
11224         else
11225                 echo "(I can't compile the test program, so we'll assume not...)"
11226                 case "$d_memmove" in
11227                 "$define") echo "But that's Ok since you have memmove()." ;;
11228                 esac
11229         fi
11230         ;;
11231 esac
11232 $rm -f try.* try core
11233 set d_safemcpy
11234 eval $setvar
11235
11236 : can memcmp be trusted to compare relative magnitude?
11237 val="$undef"
11238 case "$d_memcmp" in
11239 "$define")
11240         echo " "
11241         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11242         $cat >try.c <<EOCP
11243 #$i_memory I_MEMORY
11244 #$i_stdlib I_STDLIB
11245 #$i_string I_STRING
11246 #$i_unistd I_UNISTD
11247 EOCP
11248         $cat >>try.c <<'EOCP'
11249 #include <stdio.h>
11250 #ifdef I_MEMORY
11251 #  include <memory.h>
11252 #endif
11253 #ifdef I_STDLIB
11254 #  include <stdlib.h>
11255 #endif
11256 #ifdef I_STRING
11257 #  include <string.h>
11258 #else
11259 #  include <strings.h>
11260 #endif
11261 #ifdef I_UNISTD
11262 #  include <unistd.h>  /* Needed for NetBSD */
11263 #endif
11264 int main()
11265 {
11266 char a = -1;
11267 char b = 0;
11268 if ((a < b) && memcmp(&a, &b, 1) < 0)
11269         exit(1);
11270 exit(0);
11271 }
11272 EOCP
11273         set try
11274         if eval $compile_ok; then
11275                 if ./try 2>/dev/null; then
11276                         echo "Yes, it can."
11277                         val="$define"
11278                 else
11279                         echo "No, it can't (it uses signed chars)."
11280                 fi
11281         else
11282                 echo "(I can't compile the test program, so we'll assume not...)"
11283         fi
11284         ;;
11285 esac
11286 $rm -f try.* try core
11287 set d_sanemcmp
11288 eval $setvar
11289
11290 : see if prototype for sbrk is available
11291 echo " "
11292 set d_sbrkproto sbrk $i_unistd unistd.h
11293 eval $hasproto
11294
11295 : see if select exists
11296 set select d_select
11297 eval $inlibc
11298
11299 : see if semctl exists
11300 set semctl d_semctl
11301 eval $inlibc
11302
11303 : see if semget exists
11304 set semget d_semget
11305 eval $inlibc
11306
11307 : see if semop exists
11308 set semop d_semop
11309 eval $inlibc
11310
11311 : see how much of the 'sem*(2)' library is present.
11312 h_sem=true
11313 echo " "
11314 case "$d_semctl$d_semget$d_semop" in
11315 *"$undef"*) h_sem=false;;
11316 esac
11317 case "$osname" in
11318 freebsd)
11319     case "`ipcs 2>&1`" in
11320     "SVID messages"*"not configured"*)
11321         echo "Your $osname does not have the sem*(2) configured." >&4
11322         h_sem=false
11323         val="$undef"
11324         set semctl d_semctl
11325         eval $setvar
11326         set semget d_semget
11327         eval $setvar
11328         set semop d_semop
11329         eval $setvar
11330         ;;
11331     esac
11332     ;;
11333 esac
11334 : we could also check for sys/ipc.h ...
11335 if $h_sem && $test `./findhdr sys/sem.h`; then
11336         echo "You have the full sem*(2) library." >&4
11337         val="$define"
11338 else
11339         echo "You don't have the full sem*(2) library." >&4
11340         val="$undef"
11341 fi
11342 set d_sem
11343 eval $setvar
11344
11345 : see whether sys/sem.h defines union semun
11346 echo " "
11347 $cat > try.c <<'END'
11348 #include <sys/types.h>
11349 #include <sys/ipc.h>
11350 #include <sys/sem.h>
11351 int main () { union semun semun; semun.buf = 0; }
11352 END
11353 set try
11354 if eval $compile; then
11355     echo "You have union semun in <sys/sem.h>." >&4
11356     val="$define"
11357 else
11358     echo "You do not have union semun in <sys/sem.h>." >&4
11359     val="$undef"
11360 fi
11361 $rm -f try try.c try.h
11362 set d_union_semun
11363 eval $setvar
11364
11365 : see how to do semctl IPC_STAT
11366 case "$d_sem" in
11367 $define)
11368     : see whether semctl IPC_STAT can use union semun
11369     echo " "
11370     $cat > try.h <<END
11371 #ifndef S_IRUSR
11372 #   ifdef S_IREAD
11373 #       define S_IRUSR S_IREAD
11374 #       define S_IWUSR S_IWRITE
11375 #       define S_IXUSR S_IEXEC
11376 #   else
11377 #       define S_IRUSR 0400
11378 #       define S_IWUSR 0200
11379 #       define S_IXUSR 0100
11380 #   endif
11381 #   define S_IRGRP (S_IRUSR>>3)
11382 #   define S_IWGRP (S_IWUSR>>3)
11383 #   define S_IXGRP (S_IXUSR>>3)
11384 #   define S_IROTH (S_IRUSR>>6)
11385 #   define S_IWOTH (S_IWUSR>>6)
11386 #   define S_IXOTH (S_IXUSR>>6)
11387 #endif
11388 #ifndef S_IRWXU
11389 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11390 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11391 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11392 #endif
11393 END
11394
11395     $cat > try.c <<END
11396 #include <sys/types.h>
11397 #include <sys/ipc.h>
11398 #include <sys/sem.h>
11399 #include <sys/stat.h>
11400 #include <stdio.h>
11401 #include <errno.h>
11402 #include "try.h"
11403 #ifndef errno
11404 extern int errno;
11405 #endif
11406 #$d_union_semun HAS_UNION_SEMUN
11407 int main() {
11408     union semun
11409 #ifndef HAS_UNION_SEMUN
11410     {
11411         int val;
11412         struct semid_ds *buf;
11413         unsigned short *array;
11414     }
11415 #endif
11416     arg;
11417     int sem, st;
11418
11419 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11420     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11421     if (sem > -1) {
11422         struct semid_ds argbuf;
11423         arg.buf = &argbuf;
11424 #       ifdef IPC_STAT
11425         st = semctl(sem, 0, IPC_STAT, arg);
11426         if (st == 0)
11427             printf("semun\n");
11428         else
11429 #       endif /* IPC_STAT */
11430             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11431 #       ifdef IPC_RMID
11432         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11433 #       endif /* IPC_RMID */
11434             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11435     } else
11436 #endif /* IPC_PRIVATE && ... */
11437         printf("semget failed: errno = %d\n", errno);
11438   return 0;
11439 }
11440 END
11441     val="$undef"
11442     set try
11443     if eval $compile; then
11444         xxx=`./try`
11445         case "$xxx" in
11446         semun) val="$define" ;;
11447         esac
11448     fi
11449     $rm -f try try.c
11450     set d_semctl_semun
11451     eval $setvar
11452     case "$d_semctl_semun" in
11453     $define)
11454         echo "You can use union semun for semctl IPC_STAT." >&4
11455         also='also'
11456         ;;
11457     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11458         also=''
11459         ;;
11460     esac
11461
11462     : see whether semctl IPC_STAT can use struct semid_ds pointer
11463     $cat > try.c <<'END'
11464 #include <sys/types.h>
11465 #include <sys/ipc.h>
11466 #include <sys/sem.h>
11467 #include <sys/stat.h>
11468 #include "try.h"
11469 #include <stdio.h>
11470 #include <errno.h>
11471 #ifndef errno
11472 extern int errno;
11473 #endif
11474 int main() {
11475     struct semid_ds arg;
11476     int sem, st;
11477
11478 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11479     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11480     if (sem > -1) {
11481 #       ifdef IPC_STAT
11482         st = semctl(sem, 0, IPC_STAT, &arg);
11483         if (st == 0)
11484             printf("semid_ds\n");
11485         else
11486 #       endif /* IPC_STAT */
11487             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11488 #       ifdef IPC_RMID
11489         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11490 #       endif /* IPC_RMID */
11491             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11492     } else
11493 #endif /* IPC_PRIVATE && ... */
11494         printf("semget failed: errno = %d\n", errno);
11495
11496     return 0;
11497 }
11498 END
11499     val="$undef"
11500     set try
11501     if eval $compile; then
11502         xxx=`./try`
11503         case "$xxx" in
11504         semid_ds) val="$define" ;;
11505         esac
11506     fi
11507     $rm -f try try.c
11508     set d_semctl_semid_ds
11509     eval $setvar
11510     case "$d_semctl_semid_ds" in
11511     $define)
11512         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11513         ;;
11514     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11515         ;;
11516     esac
11517     $rm -f try.h
11518     ;;
11519 *)  val="$undef"
11520
11521     # We do not have the full sem*(2) library, so assume we can not
11522     # use either.
11523
11524     set d_semctl_semun
11525     eval $setvar
11526
11527     set d_semctl_semid_ds
11528     eval $setvar
11529     ;;
11530 esac
11531
11532 : see if sendmsg exists
11533 set sendmsg d_sendmsg
11534 eval $inlibc
11535
11536 : see if setegid exists
11537 set setegid d_setegid
11538 eval $inlibc
11539
11540 : see if seteuid exists
11541 set seteuid d_seteuid
11542 eval $inlibc
11543
11544 : see if setgrent exists
11545 set setgrent d_setgrent
11546 eval $inlibc
11547
11548 : see if sethostent exists
11549 set sethostent d_sethent
11550 eval $inlibc
11551
11552 : see if setitimer exists
11553 set setitimer d_setitimer
11554 eval $inlibc
11555
11556 : see if setlinebuf exists
11557 set setlinebuf d_setlinebuf
11558 eval $inlibc
11559
11560 : see if setlocale exists
11561 set setlocale d_setlocale
11562 eval $inlibc
11563
11564 : see if setnetent exists
11565 set setnetent d_setnent
11566 eval $inlibc
11567
11568 : see if setprotoent exists
11569 set setprotoent d_setpent
11570 eval $inlibc
11571
11572 : see if setpgid exists
11573 set setpgid d_setpgid
11574 eval $inlibc
11575
11576 : see if setpgrp2 exists
11577 set setpgrp2 d_setpgrp2
11578 eval $inlibc
11579
11580 : see if setpriority exists
11581 set setpriority d_setprior
11582 eval $inlibc
11583
11584 : see if setproctitle exists
11585 set setproctitle d_setproctitle
11586 eval $inlibc
11587
11588 : see if setpwent exists
11589 set setpwent d_setpwent
11590 eval $inlibc
11591
11592 : see if setregid exists
11593 set setregid d_setregid
11594 eval $inlibc
11595 set setresgid d_setresgid
11596 eval $inlibc
11597
11598 : see if setreuid exists
11599 set setreuid d_setreuid
11600 eval $inlibc
11601 set setresuid d_setresuid
11602 eval $inlibc
11603
11604 : see if setrgid exists
11605 set setrgid d_setrgid
11606 eval $inlibc
11607
11608 : see if setruid exists
11609 set setruid d_setruid
11610 eval $inlibc
11611
11612 : see if setservent exists
11613 set setservent d_setsent
11614 eval $inlibc
11615
11616 : see if setsid exists
11617 set setsid d_setsid
11618 eval $inlibc
11619
11620 : see if setvbuf exists
11621 set setvbuf d_setvbuf
11622 eval $inlibc
11623
11624 : see if sfio.h is available
11625 set sfio.h i_sfio
11626 eval $inhdr
11627
11628
11629 : see if sfio library is available
11630 case "$i_sfio" in
11631 $define)
11632         val=''
11633         set sfreserve val
11634         eval $inlibc
11635         ;;
11636 *)
11637         val="$undef"
11638         ;;
11639 esac
11640 : Ok, but do we want to use it.
11641 case "$val" in
11642 $define)
11643         case "$usesfio" in
11644         true|$define|[yY]*) dflt='y';;
11645         *) dflt='n';;
11646         esac
11647         echo "$package can use the sfio library, but it is experimental."
11648         case "$useperlio" in
11649         "$undef")
11650             echo "For sfio also the PerlIO abstraction layer is needed."
11651             echo "Earlier you said you wouldn't want that."
11652             ;;
11653         esac
11654         rp="You seem to have sfio available, do you want to try using it?"
11655         . ./myread
11656         case "$ans" in
11657         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11658                 useperlio="$define"
11659                 val="$define"
11660                 ;;
11661         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11662                 val="$undef"
11663                 ;;
11664         esac
11665         ;;
11666 *)      case "$usesfio" in
11667         true|$define|[yY]*)
11668                 echo "Sorry, cannot find sfio on this machine." >&4
11669                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11670                 val="$undef"
11671                 ;;
11672         esac
11673         ;;
11674 esac
11675 set d_sfio
11676 eval $setvar
11677 case "$d_sfio" in
11678 $define) usesfio='true';;
11679 *) usesfio='false';;
11680 esac
11681 case "$d_sfio" in
11682 $define) ;;
11683 *)      : Remove sfio from list of libraries to use
11684         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11685         shift
11686         libs="$*"
11687         echo "libs = $libs" >&4
11688 ;;
11689 esac
11690
11691
11692 : see if shmctl exists
11693 set shmctl d_shmctl
11694 eval $inlibc
11695
11696 : see if shmget exists
11697 set shmget d_shmget
11698 eval $inlibc
11699
11700 : see if shmat exists
11701 set shmat d_shmat
11702 eval $inlibc
11703 : see what shmat returns
11704 case "$d_shmat" in
11705 "$define")
11706         $cat >shmat.c <<'END'
11707 #include <sys/shm.h>
11708 void *shmat();
11709 END
11710         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11711                 shmattype='void *'
11712         else
11713                 shmattype='char *'
11714         fi
11715         echo "and it returns ($shmattype)." >&4
11716         : see if a prototype for shmat is available
11717         xxx=`./findhdr sys/shm.h`
11718         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11719         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11720                 val="$define"
11721         else
11722                 val="$undef"
11723         fi
11724         $rm -f shmat.[co]
11725         ;;
11726 *)
11727         val="$undef"
11728         ;;
11729 esac
11730 set d_shmatprototype
11731 eval $setvar
11732
11733 : see if shmdt exists
11734 set shmdt d_shmdt
11735 eval $inlibc
11736
11737 : see how much of the 'shm*(2)' library is present.
11738 h_shm=true
11739 echo " "
11740 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11741 *"$undef"*) h_shm=false;;
11742 esac
11743 case "$osname" in
11744 freebsd)
11745     case "`ipcs 2>&1`" in
11746     "SVID shared memory"*"not configured"*)
11747         echo "Your $osname does not have the shm*(2) configured." >&4
11748         h_shm=false
11749         val="$undef"
11750         set shmctl d_shmctl
11751         evat $setvar
11752         set shmget d_shmget
11753         evat $setvar
11754         set shmat d_shmat
11755         evat $setvar
11756         set shmdt d_shmdt
11757         evat $setvar
11758         ;;
11759     esac
11760     ;;
11761 esac
11762 : we could also check for sys/ipc.h ...
11763 if $h_shm && $test `./findhdr sys/shm.h`; then
11764         echo "You have the full shm*(2) library." >&4
11765         val="$define"
11766 else
11767         echo "You don't have the full shm*(2) library." >&4
11768         val="$undef"
11769 fi
11770 set d_shm
11771 eval $setvar
11772
11773 echo " "
11774 : see if we have sigaction
11775 if set sigaction val -f d_sigaction; eval $csym; $val; then
11776         echo 'sigaction() found.' >&4
11777         $cat > try.c <<'EOP'
11778 #include <stdio.h>
11779 #include <sys/types.h>
11780 #include <signal.h>
11781 int main()
11782 {
11783     struct sigaction act, oact;
11784     act.sa_flags = 0;
11785     oact.sa_handler = 0;
11786     /* so that act and oact are used */
11787     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11788 }
11789 EOP
11790         set try
11791         if eval $compile_ok; then
11792                 val="$define"
11793         else
11794                 echo "But you don't seem to have a useable struct sigaction." >&4
11795                 val="$undef"
11796         fi
11797 else
11798         echo 'sigaction NOT found.' >&4
11799         val="$undef"
11800 fi
11801 set d_sigaction; eval $setvar
11802 $rm -f try try$_o try.c
11803
11804 : see if sigprocmask exists
11805 set sigprocmask d_sigprocmask
11806 eval $inlibc
11807
11808 : see if sigsetjmp exists
11809 echo " "
11810 case "$d_sigsetjmp" in
11811 '')
11812         $cat >try.c <<'EOP'
11813 #include <setjmp.h>
11814 sigjmp_buf env;
11815 int set = 1;
11816 int main()
11817 {
11818         if (sigsetjmp(env,1))
11819                 exit(set);
11820         set = 0;
11821         siglongjmp(env, 1);
11822         exit(1);
11823 }
11824 EOP
11825         set try
11826         if eval $compile; then
11827                 if ./try >/dev/null 2>&1; then
11828                         echo "POSIX sigsetjmp found." >&4
11829                         val="$define"
11830                 else
11831                         $cat >&4 <<EOM
11832 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11833 I'll ignore them.
11834 EOM
11835                         val="$undef"
11836                 fi
11837         else
11838                 echo "sigsetjmp not found." >&4
11839                 val="$undef"
11840         fi
11841         ;;
11842 *) val="$d_sigsetjmp"
11843         case "$d_sigsetjmp" in
11844         $define) echo "POSIX sigsetjmp found." >&4;;
11845         $undef) echo "sigsetjmp not found." >&4;;
11846         esac
11847         ;;
11848 esac
11849 set d_sigsetjmp
11850 eval $setvar
11851 $rm -f try.c try
11852
11853 : see if sockatmark exists
11854 set sockatmark d_sockatmark
11855 eval $inlibc
11856
11857 : see if socks5_init exists
11858 set socks5_init d_socks5_init
11859 eval $inlibc
11860
11861 : see if sys/stat.h is available
11862 set sys/stat.h i_sysstat
11863 eval $inhdr
11864
11865
11866 : see if stat knows about block sizes
11867 echo " "
11868 echo "Checking to see if your struct stat has st_blocks field..." >&4
11869 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11870 eval $hasfield
11871
11872
11873 : see if this is a sys/vfs.h system
11874 set sys/vfs.h i_sysvfs
11875 eval $inhdr
11876
11877
11878 : see if this is a sys/statfs.h system
11879 set sys/statfs.h i_sysstatfs
11880 eval $inhdr
11881
11882
11883 echo " "
11884 echo "Checking to see if your system supports struct statfs..." >&4
11885 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
11886 eval $hasstruct
11887 case "$d_statfs_s" in
11888 "$define")      echo "Yes, it does."   ;;
11889 *)              echo "No, it doesn't." ;;
11890 esac
11891
11892
11893
11894 : see if struct statfs knows about f_flags
11895 case "$d_statfs_s" in
11896 define) 
11897         echo " "
11898         echo "Checking to see if your struct statfs has f_flags field..." >&4
11899         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
11900         eval $hasfield
11901         ;;
11902 *)      val="$undef"
11903         set d_statfs_f_flags
11904         eval $setvar
11905         ;;
11906 esac
11907 case "$d_statfs_f_flags" in
11908 "$define")      echo "Yes, it does."   ;;
11909 *)              echo "No, it doesn't." ;;
11910 esac
11911
11912 : see if _ptr and _cnt from stdio act std
11913 echo " "
11914
11915 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11916         echo "(Looks like you have stdio.h from BSD.)"
11917         case "$stdio_ptr" in
11918         '') stdio_ptr='((fp)->_p)'
11919                 ptr_lval=$define
11920                 ;;
11921         *)      ptr_lval=$d_stdio_ptr_lval;;
11922         esac
11923         case "$stdio_cnt" in
11924         '') stdio_cnt='((fp)->_r)'
11925                 cnt_lval=$define
11926                 ;;
11927         *)      cnt_lval=$d_stdio_cnt_lval;;
11928         esac
11929         case "$stdio_base" in
11930         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11931         esac
11932         case "$stdio_bufsiz" in
11933         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11934         esac
11935 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11936         echo "(Looks like you have stdio.h from Linux.)"
11937         case "$stdio_ptr" in
11938         '') stdio_ptr='((fp)->_IO_read_ptr)'
11939                 ptr_lval=$define
11940                 ;;
11941         *)      ptr_lval=$d_stdio_ptr_lval;;
11942         esac
11943         case "$stdio_cnt" in
11944         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11945                 cnt_lval=$undef
11946                 ;;
11947         *)      cnt_lval=$d_stdio_cnt_lval;;
11948         esac
11949         case "$stdio_base" in
11950         '') stdio_base='((fp)->_IO_read_base)';;
11951         esac
11952         case "$stdio_bufsiz" in
11953         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11954         esac
11955 else
11956         case "$stdio_ptr" in
11957         '') stdio_ptr='((fp)->_ptr)'
11958                 ptr_lval=$define
11959                 ;;
11960         *)      ptr_lval=$d_stdio_ptr_lval;;
11961         esac
11962         case "$stdio_cnt" in
11963         '') stdio_cnt='((fp)->_cnt)'
11964                 cnt_lval=$define
11965                 ;;
11966         *)      cnt_lval=$d_stdio_cnt_lval;;
11967         esac
11968         case "$stdio_base" in
11969         '') stdio_base='((fp)->_base)';;
11970         esac
11971         case "$stdio_bufsiz" in
11972         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11973         esac
11974 fi
11975
11976 : test whether _ptr and _cnt really work
11977 echo "Checking how std your stdio is..." >&4
11978 $cat >try.c <<EOP
11979 #include <stdio.h>
11980 #define FILE_ptr(fp)    $stdio_ptr
11981 #define FILE_cnt(fp)    $stdio_cnt
11982 int main() {
11983         FILE *fp = fopen("try.c", "r");
11984         char c = getc(fp);
11985         if (
11986                 18 <= FILE_cnt(fp) &&
11987                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11988         )
11989                 exit(0);
11990         exit(1);
11991 }
11992 EOP
11993 val="$undef"
11994 set try
11995 if eval $compile; then
11996         if ./try; then
11997                 echo "Your stdio acts pretty std."
11998                 val="$define"
11999         else
12000                 echo "Your stdio isn't very std."
12001         fi
12002 else
12003         echo "Your stdio doesn't appear very std."
12004 fi
12005 $rm -f try.c try
12006 set d_stdstdio
12007 eval $setvar
12008
12009 : Can _ptr be used as an lvalue?
12010 case "$d_stdstdio$ptr_lval" in
12011 $define$define) val=$define ;;
12012 *) val=$undef ;;
12013 esac
12014 set d_stdio_ptr_lval
12015 eval $setvar
12016
12017 : Can _cnt be used as an lvalue?
12018 case "$d_stdstdio$cnt_lval" in
12019 $define$define) val=$define ;;
12020 *) val=$undef ;;
12021 esac
12022 set d_stdio_cnt_lval
12023 eval $setvar
12024
12025
12026 : test whether setting _ptr sets _cnt as a side effect
12027 d_stdio_ptr_lval_sets_cnt="$undef"
12028 d_stdio_ptr_lval_nochange_cnt="$undef"
12029 case "$d_stdio_ptr_lval$d_stdstdio" in
12030 $define$define)
12031         echo "Checking to see what happens if we set the stdio ptr..." >&4
12032 $cat >try.c <<EOP
12033 #include <stdio.h>
12034 /* Can we scream? */
12035 /* Eat dust sed :-) */
12036 /* In the buffer space, no one can hear you scream. */
12037 #define FILE_ptr(fp)    $stdio_ptr
12038 #define FILE_cnt(fp)    $stdio_cnt
12039 #include <sys/types.h>
12040 int main() {
12041         FILE *fp = fopen("try.c", "r");
12042         int c;
12043         char *ptr;
12044         size_t cnt;
12045         if (!fp) {
12046             puts("Fail even to read");
12047             exit(1);
12048         }
12049         c = getc(fp); /* Read away the first # */
12050         if (c == EOF) {
12051             puts("Fail even to read");
12052             exit(1);
12053         }
12054         if (!(
12055                 18 <= FILE_cnt(fp) &&
12056                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12057         )) {
12058                 puts("Fail even to read");
12059                 exit (1);
12060         }
12061         ptr = (char*) FILE_ptr(fp);
12062         cnt = (size_t)FILE_cnt(fp);
12063
12064         FILE_ptr(fp) += 42;
12065
12066         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12067                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12068                 exit (1);
12069         }
12070         if (FILE_cnt(fp) <= 20) {
12071                 printf ("Fail (<20 chars to test)");
12072                 exit (1);
12073         }
12074         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12075                 puts("Fail compare");
12076                 exit (1);
12077         }
12078         if (cnt == FILE_cnt(fp)) {
12079                 puts("Pass_unchanged");
12080                 exit (0);
12081         }       
12082         if (FILE_cnt(fp) == (cnt - 42)) {
12083                 puts("Pass_changed");
12084                 exit (0);
12085         }
12086         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12087         return 1;
12088
12089 }
12090 EOP
12091         set try
12092         if eval $compile; then
12093                 case `./try$exe_ext` in
12094                 Pass_changed)
12095                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12096                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12097                 Pass_unchanged)
12098                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12099                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12100                 Fail*)
12101                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12102                 *)
12103                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12104         esac
12105         else
12106                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12107         fi
12108         $rm -f try.c try
12109         ;;
12110 esac
12111
12112 : see if _base is also standard
12113 val="$undef"
12114 case "$d_stdstdio" in
12115 $define)
12116         $cat >try.c <<EOP
12117 #include <stdio.h>
12118 #define FILE_base(fp)   $stdio_base
12119 #define FILE_bufsiz(fp) $stdio_bufsiz
12120 int main() {
12121         FILE *fp = fopen("try.c", "r");
12122         char c = getc(fp);
12123         if (
12124                 19 <= FILE_bufsiz(fp) &&
12125                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12126         )
12127                 exit(0);
12128         exit(1);
12129 }
12130 EOP
12131         set try
12132         if eval $compile; then
12133                 if ./try; then
12134                         echo "And its _base field acts std."
12135                         val="$define"
12136                 else
12137                         echo "But its _base field isn't std."
12138                 fi
12139         else
12140                 echo "However, it seems to be lacking the _base field."
12141         fi
12142         $rm -f try.c try
12143         ;;
12144 esac
12145 set d_stdiobase
12146 eval $setvar
12147
12148 $cat >&4 <<EOM
12149 Checking how to access stdio streams by file descriptor number...
12150 EOM
12151 case "$stdio_stream_array" in
12152 '')     $cat >try.c <<EOCP
12153 #include <stdio.h>
12154 int main() {
12155   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12156     printf("yes\n");
12157 }
12158 EOCP
12159         for s in _iob __iob __sF
12160         do
12161                 set try -DSTDIO_STREAM_ARRAY=$s
12162                 if eval $compile; then
12163                         case "`./try$exe_ext`" in
12164                         yes)    stdio_stream_array=$s; break ;;
12165                         esac
12166                 fi
12167         done
12168         $rm -f try.* try$exe_ext
12169 esac
12170 case "$stdio_stream_array" in
12171 '')     $cat >&4 <<EOM
12172 I can't figure out how to access stdio streams by file descriptor number.
12173 EOM
12174         d_stdio_stream_array="$undef"
12175         ;;
12176 *)      $cat >&4 <<EOM
12177 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12178 EOM
12179         d_stdio_stream_array="$define"
12180         ;;
12181 esac
12182
12183 : see if strcoll exists
12184 set strcoll d_strcoll
12185 eval $inlibc
12186
12187 : check for structure copying
12188 echo " "
12189 echo "Checking to see if your C compiler can copy structs..." >&4
12190 $cat >try.c <<'EOCP'
12191 int main()
12192 {
12193         struct blurfl {
12194                 int dyick;
12195         } foo, bar;
12196
12197         foo = bar;
12198 }
12199 EOCP
12200 if $cc -c try.c >/dev/null 2>&1 ; then
12201         val="$define"
12202         echo "Yup, it can."
12203 else
12204         val="$undef"
12205         echo "Nope, it can't."
12206 fi
12207 set d_strctcpy
12208 eval $setvar
12209 $rm -f try.*
12210
12211 : see if strerror and/or sys_errlist[] exist
12212 echo " "
12213 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12214     if set strerror val -f d_strerror; eval $csym; $val; then
12215                 echo 'strerror() found.' >&4
12216                 d_strerror="$define"
12217                 d_strerrm='strerror(e)'
12218                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12219                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12220                         d_syserrlst="$define"
12221                 else
12222                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12223                         d_syserrlst="$undef"
12224                 fi
12225     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12226                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12227                 echo 'strerror() found in string header.' >&4
12228                 d_strerror="$define"
12229                 d_strerrm='strerror(e)'
12230                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12231                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12232                                 d_syserrlst="$define"
12233                 else
12234                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12235                         d_syserrlst="$undef"
12236                 fi
12237     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12238                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12239                 d_strerror="$undef"
12240                 d_syserrlst="$define"
12241                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12242     else
12243                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12244                 d_strerror="$undef"
12245                 d_syserrlst="$undef"
12246                 d_strerrm='"unknown"'
12247     fi
12248 fi
12249
12250 : see if strftime exists
12251 set strftime d_strftime
12252 eval $inlibc
12253
12254 : see if strtod exists
12255 set strtod d_strtod
12256 eval $inlibc
12257
12258 : see if strtol exists
12259 set strtol d_strtol
12260 eval $inlibc
12261
12262 : see if strtold exists
12263 set strtold d_strtold
12264 eval $inlibc
12265
12266 : see if strtoll exists
12267 set strtoll d_strtoll
12268 eval $inlibc
12269
12270 case "$d_longlong-$d_strtoll" in
12271 "$define-$define")
12272         $cat <<EOM
12273 Checking whether your strtoll() works okay...
12274 EOM
12275         $cat >try.c <<'EOCP'
12276 #include <errno.h>
12277 #ifdef __hpux
12278 #define strtoll __strtoll
12279 #endif
12280 #ifdef __EMX__
12281 #define strtoll _strtoll
12282 #endif
12283 #include <stdio.h>
12284 extern long long int strtoll(char *s, char **, int); 
12285 static int bad = 0;
12286 int check(char *s, long long ell, int een) {
12287         long long gll;
12288         errno = 0;
12289         gll = strtoll(s, 0, 10);
12290         if (!((gll == ell) && (errno == een)))
12291                 bad++;
12292 }
12293 int main() {
12294         check(" 1",                                      1LL, 0);
12295         check(" 0",                                      0LL, 0);
12296         check("-1",                                     -1LL, 0);
12297         check("-9223372036854775808", -9223372036854775808LL, 0);
12298         check("-9223372036854775808", -9223372036854775808LL, 0);
12299         check(" 9223372036854775807",  9223372036854775807LL, 0);
12300         check("-9223372036854775808", -9223372036854775808LL, 0);
12301         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12302         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12303         if (!bad)
12304                 printf("ok\n");
12305 }
12306 EOCP
12307         set try
12308         if eval $compile; then
12309                 yyy=`./try`
12310                 case "$yyy" in
12311                 ok) echo "Your strtoll() seems to be working okay." ;;
12312                 *) cat <<EOM >&4
12313 Your strtoll() doesn't seem to be working okay.
12314 EOM
12315                    d_strtoll="$undef"
12316                    ;;
12317                 esac
12318         else
12319                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12320                 d_strtoll="$undef"
12321         fi
12322         ;;
12323 esac
12324
12325 : see if strtoq exists
12326 set strtoq d_strtoq
12327 eval $inlibc
12328
12329 : see if strtoul exists
12330 set strtoul d_strtoul
12331 eval $inlibc
12332
12333 case "$d_strtoul" in
12334 "$define")
12335         $cat <<EOM
12336 Checking whether your strtoul() works okay...
12337 EOM
12338         $cat >try.c <<'EOCP'
12339 #include <errno.h>
12340 #include <stdio.h>
12341 extern unsigned long int strtoul(char *s, char **, int); 
12342 static int bad = 0;
12343 void check(char *s, unsigned long eul, int een) {
12344         unsigned long gul;
12345         errno = 0;
12346         gul = strtoul(s, 0, 10);
12347         if (!((gul == eul) && (errno == een)))
12348                 bad++;
12349 }
12350 int main() {
12351         check(" 1", 1L, 0);
12352         check(" 0", 0L, 0);
12353 EOCP
12354         case "$longsize" in
12355         8)
12356             $cat >>try.c <<'EOCP'
12357         check("18446744073709551615", 18446744073709551615UL, 0);
12358         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12359 #if 0 /* strtoul() for /^-/ strings is undefined. */
12360         check("-1", 18446744073709551615UL, 0);
12361         check("-18446744073709551614", 2, 0);
12362         check("-18446744073709551615", 1, 0);
12363         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12364         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12365 #endif
12366 EOCP
12367                 ;;
12368         4)
12369                     $cat >>try.c <<'EOCP'
12370         check("4294967295", 4294967295UL, 0);
12371         check("4294967296", 4294967295UL, ERANGE);
12372 #if 0 /* strtoul() for /^-/ strings is undefined. */
12373         check("-1", 4294967295UL, 0);
12374         check("-4294967294", 2, 0);
12375         check("-4294967295", 1, 0);
12376         check("-4294967296", 4294967295UL, ERANGE);
12377         check("-4294967297", 4294967295UL, ERANGE);
12378 #endif
12379 EOCP
12380                 ;;
12381         *)
12382 : Should we write these tests to be more portable by sprintf-ing
12383 : ~0 and then manipulating that char string as input for strtol?
12384                 ;;
12385         esac
12386         $cat >>try.c <<'EOCP'
12387         if (!bad)
12388                 printf("ok\n");
12389         return 0;
12390 }
12391 EOCP
12392         set try
12393         if eval $compile; then
12394                 case "`./try`" in
12395                 ok) echo "Your strtoul() seems to be working okay." ;;
12396                 *) cat <<EOM >&4
12397 Your strtoul() doesn't seem to be working okay.
12398 EOM
12399                    d_strtoul="$undef"
12400                    ;;
12401                 esac
12402         fi
12403         ;;
12404 esac
12405
12406 : see if strtoull exists
12407 set strtoull d_strtoull
12408 eval $inlibc
12409
12410 case "$d_longlong-$d_strtoull" in
12411 "$define-$define")
12412         $cat <<EOM
12413 Checking whether your strtoull() works okay...
12414 EOM
12415         $cat >try.c <<'EOCP'
12416 #include <errno.h>
12417 #ifdef __hpux
12418 #define strtoull __strtoull
12419 #endif
12420 #include <stdio.h>
12421 extern unsigned long long int strtoull(char *s, char **, int); 
12422 static int bad = 0;
12423 int check(char *s, long long eull, int een) {
12424         long long gull;
12425         errno = 0;
12426         gull = strtoull(s, 0, 10);
12427         if (!((gull == eull) && (errno == een)))
12428                 bad++;
12429 }
12430 int main() {
12431         check(" 1",                                        1LL, 0);
12432         check(" 0",                                        0LL, 0);
12433         check("18446744073709551615",  18446744073709551615ULL, 0);
12434         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12435 #if 0 /* strtoull() for /^-/ strings is undefined. */
12436         check("-1",                    18446744073709551615ULL, 0);
12437         check("-18446744073709551614",                     2LL, 0);
12438         check("-18446744073709551615",                     1LL, 0);
12439         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12440         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12441 #endif
12442         if (!bad)
12443                 printf("ok\n");
12444 }
12445 EOCP
12446         set try
12447         if eval $compile; then
12448                 case "`./try`" in
12449                 ok) echo "Your strtoull() seems to be working okay." ;;
12450                 *) cat <<EOM >&4
12451 Your strtoull() doesn't seem to be working okay.
12452 EOM
12453                    d_strtoull="$undef"
12454                    ;;
12455                 esac
12456         fi
12457         ;;
12458 esac
12459
12460 : see if strtouq exists
12461 set strtouq d_strtouq
12462 eval $inlibc
12463
12464 case "$d_strtouq" in
12465 "$define")
12466         $cat <<EOM
12467 Checking whether your strtouq() works okay...
12468 EOM
12469         $cat >try.c <<'EOCP'
12470 #include <errno.h>
12471 #include <stdio.h>
12472 extern unsigned long long int strtouq(char *s, char **, int); 
12473 static int bad = 0;
12474 void check(char *s, unsigned long long eull, int een) {
12475         unsigned long long gull;
12476         errno = 0;
12477         gull = strtouq(s, 0, 10);
12478         if (!((gull == eull) && (errno == een)))
12479                 bad++;
12480 }
12481 int main() {
12482         check(" 1",                                        1LL, 0);
12483         check(" 0",                                        0LL, 0);
12484         check("18446744073709551615",  18446744073709551615ULL, 0);
12485         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12486 #if 0 /* strtouq() for /^-/ strings is undefined. */
12487         check("-1",                    18446744073709551615ULL, 0);
12488         check("-18446744073709551614",                     2LL, 0);
12489         check("-18446744073709551615",                     1LL, 0);
12490         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12491         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12492 #endif
12493         if (!bad)
12494                 printf("ok\n");
12495         return 0;
12496 }
12497 EOCP
12498         set try
12499         if eval $compile; then
12500                 case "`./try`" in
12501                 ok) echo "Your strtouq() seems to be working okay." ;;
12502                 *) cat <<EOM >&4
12503 Your strtouq() doesn't seem to be working okay.
12504 EOM
12505                    d_strtouq="$undef"
12506                    ;;
12507                 esac
12508         fi
12509         ;;
12510 esac
12511
12512 : see if strxfrm exists
12513 set strxfrm d_strxfrm
12514 eval $inlibc
12515
12516 : see if symlink exists
12517 set symlink d_symlink
12518 eval $inlibc
12519
12520 : see if syscall exists
12521 set syscall d_syscall
12522 eval $inlibc
12523
12524 : see if sysconf exists
12525 set sysconf d_sysconf
12526 eval $inlibc
12527
12528 : see if system exists
12529 set system d_system
12530 eval $inlibc
12531
12532 : see if tcgetpgrp exists
12533 set tcgetpgrp d_tcgetpgrp
12534 eval $inlibc
12535
12536 : see if tcsetpgrp exists
12537 set tcsetpgrp d_tcsetpgrp
12538 eval $inlibc
12539
12540 : see if prototype for telldir is available
12541 echo " "
12542 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12543 eval $hasproto
12544
12545 : see if this is a sys/times.h system
12546 set sys/times.h i_systimes
12547 eval $inhdr
12548
12549 : see if times exists
12550 echo " "
12551 if set times val -f d_times; eval $csym; $val; then
12552         echo 'times() found.' >&4
12553         d_times="$define"
12554         inc=''
12555         case "$i_systimes" in
12556         "$define") inc='sys/times.h';;
12557         esac
12558         rp="What is the type returned by times() on this system?"
12559         set clock_t clocktype long stdio.h sys/types.h $inc
12560         eval $typedef_ask
12561 else
12562         echo 'times() NOT found, hope that will do.' >&4
12563         d_times="$undef"
12564         clocktype='int'
12565 fi
12566
12567 : see if truncate exists
12568 set truncate d_truncate
12569 eval $inlibc
12570
12571 : see if tzname[] exists
12572 echo " "
12573 if set tzname val -a d_tzname; eval $csym; $val; then
12574         val="$define"
12575         echo 'tzname[] found.' >&4
12576 else
12577         val="$undef"
12578         echo 'tzname[] NOT found.' >&4
12579 fi
12580 set d_tzname
12581 eval $setvar
12582
12583 case "$crosscompile" in
12584 ''|[nN]*) crosscompile="$undef" ;;
12585 esac
12586
12587 case "$osname" in
12588 next|rhapsody|darwin) multiarch="$define" ;;
12589 esac
12590 case "$multiarch" in
12591 ''|[nN]*) multiarch="$undef" ;;
12592 esac
12593
12594 : check for ordering of bytes in a long
12595 echo " "
12596 case "$crosscompile$multiarch" in
12597 *$define*)
12598         $cat <<EOM
12599 You seem to be either cross-compiling or doing a multiarchitecture build,
12600 skipping the byteorder check.
12601
12602 EOM
12603         byteorder='0xffff'
12604         ;;
12605 *)
12606         case "$byteorder" in
12607         '')
12608                 $cat <<'EOM'
12609 In the following, larger digits indicate more significance.  A big-endian
12610 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12611 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12612 machines may have weird orders like 3412.  A Cray will report 87654321,
12613 an Alpha will report 12345678. If the test program works the default is
12614 probably right.
12615 I'm now running the test program...
12616 EOM
12617                 $cat >try.c <<'EOCP'
12618 #include <stdio.h>
12619 int main()
12620 {
12621         int i;
12622         union {
12623                 unsigned long l;
12624                 char c[sizeof(long)];
12625         } u;
12626
12627         if (sizeof(long) > 4)
12628                 u.l = (0x08070605L << 32) | 0x04030201L;
12629         else
12630                 u.l = 0x04030201L;
12631         for (i = 0; i < sizeof(long); i++)
12632                 printf("%c", u.c[i]+'0');
12633         printf("\n");
12634         exit(0);
12635 }
12636 EOCP
12637                 xxx_prompt=y
12638                 set try
12639                 if eval $compile && ./try > /dev/null; then
12640                         dflt=`./try`
12641                         case "$dflt" in
12642                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12643                                 echo "(The test program ran ok.)"
12644                                 echo "byteorder=$dflt"
12645                                 xxx_prompt=n
12646                         ;;
12647                         ????|????????) echo "(The test program ran ok.)" ;;
12648                         *) echo "(The test program didn't run right for some reason.)" ;;
12649                         esac
12650                 else
12651                         dflt='4321'
12652                         cat <<'EOM'
12653 (I can't seem to compile the test program.  Guessing big-endian...)
12654 EOM
12655                 fi
12656                 case "$xxx_prompt" in
12657                 y)
12658                         rp="What is the order of bytes in a long?"
12659                         . ./myread
12660                         byteorder="$ans"
12661                         ;;
12662                 *)      byteorder=$dflt
12663                         ;;
12664                 esac
12665                 ;;
12666         esac
12667         $rm -f try.c try
12668         ;;
12669 esac
12670
12671
12672 $cat <<EOM
12673
12674 Checking to see whether you can access character data unalignedly...
12675 EOM
12676 $cat >try.c <<EOCP
12677 #include <stdio.h>
12678 #define U32 $u32type
12679 #define BYTEORDER $byteorder
12680 int main() {
12681 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12682     U8 buf[] = "\0\0\0\1\0\0\0\0";
12683     U32 *up;
12684     int i;
12685
12686     if (sizeof(U32) != 4) {
12687         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12688         exit(1);
12689     }
12690
12691     fflush(stdout);
12692
12693     for (i = 0; i < 4; i++) {
12694         up = (U32*)(buf + i);
12695         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12696                (*up == 1 << (8*(3-i)))  /* little-endian */
12697               )
12698            )
12699         {
12700             printf("read failed (%x)\n", *up);
12701             exit(2);
12702         }
12703     }
12704
12705     /* write test */
12706     for (i = 0; i < 4; i++) {
12707         up = (U32*)(buf + i);
12708         *up = 0xBeef;
12709         if (*up != 0xBeef) {
12710             printf("write failed (%x)\n", *up);
12711             exit(3);
12712         }
12713     }
12714
12715     exit(0);
12716 #else
12717     printf("1\n");
12718     exit(1);
12719 #endif
12720     return 0;
12721 }
12722 EOCP
12723 set try
12724 if eval $compile_ok; then
12725         echo "(This test may dump core.)" >&4
12726         ./try >&2 >/dev/null
12727         case "$?" in
12728         0)      cat >&4 <<EOM
12729 You can access character data pretty unalignedly.
12730 EOM
12731                 d_u32align="$undef"
12732                 ;;
12733         *)      cat >&4 <<EOM
12734 It seems that you must access character data in an aligned manner.
12735 EOM
12736                 d_u32align="$define"
12737                 ;;
12738         esac
12739         $rm -f core core.try.* try.core
12740 else
12741         rp='Can you access character data at unaligned addresses?'
12742         dflt='n'
12743         . ./myread
12744         case "$ans" in
12745         [yY]*)  d_u32align="$undef"  ;;
12746         *)      d_u32align="$define" ;;
12747         esac
12748 fi
12749
12750 : see if ualarm exists
12751 set ualarm d_ualarm
12752 eval $inlibc
12753
12754 : see if umask exists
12755 set umask d_umask
12756 eval $inlibc
12757
12758 : see if usleep exists
12759 set usleep d_usleep
12760 eval $inlibc
12761
12762 : see if ustat exists
12763 set ustat d_ustat
12764 eval $inlibc
12765
12766 : backward compatibility for d_hvfork
12767 if test X$d_hvfork != X; then
12768         d_vfork="$d_hvfork"
12769         d_hvfork=''
12770 fi
12771 : see if there is a vfork
12772 val=''
12773 set vfork val
12774 eval $inlibc
12775
12776 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12777 : perl on Solaris 2.x, and probably elsewhere.
12778 case "$val" in
12779 $define)
12780         echo " "
12781         case "$usevfork" in
12782         false) dflt='n';;
12783         *) dflt='y';;
12784         esac
12785         cat <<'EOM'
12786  
12787 Perl can only use a vfork() that doesn't suffer from strict
12788 restrictions on calling functions or modifying global data in
12789 the child.  For example, glibc-2.1 contains such a vfork()
12790 that is unsuitable.  If your system provides a proper fork()
12791 call, chances are that you do NOT want perl to use vfork().
12792
12793 EOM
12794         rp="Do you still want to use vfork()?"
12795         . ./myread
12796         case "$ans" in
12797         y|Y) ;;
12798         *)
12799                 echo "Ok, we won't use vfork()."
12800                 val="$undef"
12801                 ;;
12802         esac
12803         ;;
12804 esac
12805 set d_vfork
12806 eval $setvar
12807 case "$d_vfork" in
12808 $define) usevfork='true';;
12809 *) usevfork='false';;
12810 esac
12811
12812 : see if this is an sysdir system
12813 set sys/dir.h i_sysdir
12814 eval $inhdr
12815
12816 : see if this is an sysndir system
12817 set sys/ndir.h i_sysndir
12818 eval $inhdr
12819
12820 : see if closedir exists
12821 set closedir d_closedir
12822 eval $inlibc
12823
12824 case "$d_closedir" in
12825 "$define")
12826         echo " "
12827         echo "Checking whether closedir() returns a status..." >&4
12828         cat > closedir.c <<EOM
12829 #$i_dirent I_DIRENT             /**/
12830 #$i_sysdir I_SYS_DIR            /**/
12831 #$i_sysndir I_SYS_NDIR          /**/
12832 #$i_systypes I_SYS_TYPES        /**/
12833
12834 #if defined(I_SYS_TYPES)
12835 #include <sys/types.h>
12836 #endif
12837 #if defined(I_DIRENT)
12838 #include <dirent.h>
12839 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12840 #include <sys/dir.h>
12841 #endif
12842 #else
12843 #ifdef I_SYS_NDIR
12844 #include <sys/ndir.h>
12845 #else
12846 #ifdef I_SYS_DIR
12847 #ifdef hp9000s500
12848 #include <ndir.h>       /* may be wrong in the future */
12849 #else
12850 #include <sys/dir.h>
12851 #endif
12852 #endif
12853 #endif
12854 #endif 
12855 int main() { return closedir(opendir(".")); }
12856 EOM
12857         set closedir
12858         if eval $compile_ok; then
12859                 if ./closedir > /dev/null 2>&1 ; then
12860                         echo "Yes, it does."
12861                         val="$undef"
12862                 else
12863                         echo "No, it doesn't."
12864                         val="$define"
12865                 fi
12866         else
12867                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12868                 val="$define"
12869         fi
12870         ;;
12871 *)
12872         val="$undef";
12873         ;;
12874 esac
12875 set d_void_closedir
12876 eval $setvar
12877 $rm -f closedir*
12878 : see if there is a wait4
12879 set wait4 d_wait4
12880 eval $inlibc
12881
12882 : see if waitpid exists
12883 set waitpid d_waitpid
12884 eval $inlibc
12885
12886 : see if wcstombs exists
12887 set wcstombs d_wcstombs
12888 eval $inlibc
12889
12890 : see if wctomb exists
12891 set wctomb d_wctomb
12892 eval $inlibc
12893
12894 : see if writev exists
12895 set writev d_writev
12896 eval $inlibc
12897
12898 : preserve RCS keywords in files with variable substitution, grrr
12899 Date='$Date'
12900 Id='$Id'
12901 Log='$Log'
12902 RCSfile='$RCSfile'
12903 Revision='$Revision'
12904
12905 : check for alignment requirements
12906 echo " "
12907 case "$crosscompile$multiarch" in
12908 *$define*)
12909         $cat <<EOM
12910 You seem to be either cross-compiling or doing a multiarchitecture build,
12911 skipping the memory alignment check.
12912
12913 EOM
12914         case "$alignbytes" in
12915         '') alignbytes=8 ;;
12916         esac
12917         ;;
12918 *)
12919         case "$alignbytes" in
12920         '') echo "Checking alignment constraints..." >&4
12921                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12922                         $cat >try.c <<'EOCP'
12923 typedef long double NV;
12924 EOCP
12925                 else
12926                         $cat >try.c <<'EOCP'
12927 typedef double NV;
12928 EOCP
12929                 fi
12930                 $cat >>try.c <<'EOCP'
12931 #include <stdio.h>
12932 struct foobar {
12933         char foo;
12934         NV bar;
12935 } try_algn;
12936 int main()
12937 {
12938     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12939     return(0);
12940 }
12941 EOCP
12942                 set try
12943                 if eval $compile_ok; then
12944                         dflt=`./try`
12945                 else
12946                         dflt='8'
12947                         echo "(I can't seem to compile the test program...)"
12948                 fi
12949                 ;;
12950         *) dflt="$alignbytes"
12951                 ;;
12952         esac
12953         rp="Doubles must be aligned on a how-many-byte boundary?"
12954         . ./myread
12955         alignbytes="$ans"
12956         $rm -f try.c try
12957         ;;
12958 esac
12959
12960
12961 : set the base revision
12962 baserev=5.0
12963
12964 : how do we catenate cpp tokens here?
12965 echo " "
12966 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12967 $cat >cpp_stuff.c <<'EOCP'
12968 #define RCAT(a,b)a/**/b
12969 #define ACAT(a,b)a ## b
12970 RCAT(Rei,ser)
12971 ACAT(Cir,cus)
12972 EOCP
12973 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12974 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12975         echo "Oh!  Smells like ANSI's been here." >&4
12976         echo "We can catify or stringify, separately or together!"
12977         cpp_stuff=42
12978 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12979         echo "Ah, yes!  The good old days!" >&4
12980         echo "However, in the good old days we don't know how to stringify and"
12981         echo "catify at the same time."
12982         cpp_stuff=1
12983 else
12984         $cat >&4 <<EOM
12985 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12986 to have to edit the values of CAT[2-5] in config.h...
12987 EOM
12988         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12989 fi
12990 $rm -f cpp_stuff.*
12991
12992 : see if this is a db.h system
12993 set db.h i_db
12994 eval $inhdr
12995
12996 case "$i_db" in
12997 $define)
12998         : Check db version.
12999         echo " "
13000         echo "Checking Berkeley DB version ..." >&4
13001         $cat >try.c <<EOCP
13002 #$d_const HASCONST
13003 #ifndef HASCONST
13004 #define const
13005 #endif
13006 #include <sys/types.h>
13007 #include <stdio.h>
13008 #include <db.h>
13009 int main()
13010 {
13011 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13012     int Major, Minor, Patch ;
13013     unsigned long Version ;
13014     (void)db_version(&Major, &Minor, &Patch) ;
13015     printf("You have Berkeley DB Version 2 or greater\n");
13016
13017     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13018                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13019     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13020                 Major, Minor, Patch) ;
13021
13022     /* check that db.h & libdb are compatible */
13023     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13024         printf("db.h and libdb are incompatible\n") ;
13025         exit(3);        
13026     }
13027
13028     printf("db.h and libdb are compatible\n") ;
13029
13030     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13031                 + DB_VERSION_PATCH ;
13032
13033     /* needs to be >= 2.3.4 */
13034     if (Version < 2003004) {
13035     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13036         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
13037         exit(2);        
13038     }
13039
13040     exit(0);
13041 #else
13042 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13043     printf("You have Berkeley DB Version 1\n");
13044     exit(0);    /* DB version < 2: the coast is clear. */
13045 #else
13046     exit(1);    /* <db.h> not Berkeley DB? */
13047 #endif
13048 #endif
13049 }
13050 EOCP
13051         set try
13052         if eval $compile_ok && ./try; then
13053                 echo 'Looks OK.' >&4
13054         else
13055                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13056                 i_db=$undef
13057                 case " $libs " in
13058                 *"-ldb "*)
13059                         : Remove db from list of libraries to use
13060                         echo "Removing unusable -ldb from library list" >&4
13061                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13062                         shift
13063                         libs="$*"
13064                         echo "libs = $libs" >&4
13065                         ;;
13066                 esac
13067         fi
13068         $rm -f try.*
13069         ;;
13070 esac
13071
13072 case "$i_db" in
13073 define)
13074         : Check the return type needed for hash 
13075         echo " "
13076         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13077         $cat >try.c <<EOCP
13078 #$d_const HASCONST
13079 #ifndef HASCONST
13080 #define const
13081 #endif
13082 #include <sys/types.h>
13083 #include <db.h>
13084
13085 #ifndef DB_VERSION_MAJOR
13086 u_int32_t hash_cb (ptr, size)
13087 const void *ptr;
13088 size_t size;
13089 {
13090 }
13091 HASHINFO info;
13092 int main()
13093 {
13094         info.hash = hash_cb;
13095 }
13096 #endif
13097 EOCP
13098         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13099                 if $contains warning try.out >>/dev/null 2>&1 ; then
13100                         db_hashtype='int'
13101                 else
13102                         db_hashtype='u_int32_t'
13103                 fi
13104         else
13105                 : XXX Maybe we should just give up here.
13106                 db_hashtype=u_int32_t
13107                 $cat try.out >&4
13108                 echo "Help:  I can't seem to compile the db test program." >&4
13109                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13110         fi
13111         $rm -f try.*
13112         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13113         ;;
13114 *)      db_hashtype=u_int32_t
13115         ;;
13116 esac
13117 case "$i_db" in
13118 define)
13119         : Check the return type needed for prefix 
13120         echo " "
13121         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13122         cat >try.c <<EOCP
13123 #$d_const HASCONST
13124 #ifndef HASCONST
13125 #define const
13126 #endif
13127 #include <sys/types.h>
13128 #include <db.h>
13129
13130 #ifndef DB_VERSION_MAJOR
13131 size_t prefix_cb (key1, key2)
13132 const DBT *key1;
13133 const DBT *key2;
13134 {
13135 }
13136 BTREEINFO info;
13137 int main()
13138 {
13139         info.prefix = prefix_cb;
13140 }
13141 #endif
13142 EOCP
13143         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13144                 if $contains warning try.out >>/dev/null 2>&1 ; then
13145                         db_prefixtype='int'
13146                 else
13147                         db_prefixtype='size_t'
13148                 fi
13149         else
13150                 db_prefixtype='size_t'
13151                 : XXX Maybe we should just give up here.
13152                 $cat try.out >&4
13153                 echo "Help:  I can't seem to compile the db test program." >&4
13154                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13155         fi
13156         $rm -f try.*
13157         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13158         ;;
13159 *)      db_prefixtype='size_t'
13160         ;;
13161 esac
13162
13163
13164 : How can we generate normalized random numbers ?
13165 echo " "
13166 echo "Looking for a random number function..." >&4
13167 case "$randfunc" in
13168 '')
13169         if set drand48 val -f; eval $csym; $val; then
13170                 dflt="drand48"
13171                 echo "Good, found drand48()." >&4
13172         elif set random val -f; eval $csym; $val; then
13173                 dflt="random"
13174                 echo "OK, found random()." >&4
13175         else
13176                 dflt="rand"
13177                 echo "Yick, looks like I have to use rand()." >&4
13178         fi
13179         echo " "
13180         ;;
13181 *)
13182         dflt="$randfunc"
13183         ;;
13184 esac
13185 cont=true
13186
13187 case "$ccflags" in
13188 *-Dmy_rand=*|*-Dmy_srand=*)
13189         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13190         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13191         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13192         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13193         ;;
13194 esac
13195
13196 while $test "$cont"; do
13197         rp="Use which function to generate random numbers?"
13198         . ./myread
13199         if $test "$ans" = "$dflt"; then
13200                 : null
13201         else
13202                 randbits=''
13203         fi
13204         randfunc="$ans"
13205         if set $ans val -f; eval $csym; $val; then
13206                 cont=''
13207         else
13208                 dflt=y
13209                 rp="I cannot find function $ans. Use that name anyway?"
13210                 . ./myread
13211                 dflt=rand
13212                 case "$ans" in
13213                         [yY]*) cont='';;
13214                 esac
13215         fi
13216         case "$cont" in
13217         '')
13218                 case "$randfunc" in
13219                 drand48)
13220                         drand01="drand48()"
13221                         seedfunc="srand48"
13222                         randbits=48
13223                         randseedtype=long
13224                         ;;
13225                 rand|random)
13226                         case "$randbits" in
13227                         '')
13228 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13229                                 $cat >try.c <<EOCP
13230 #$i_unistd I_UNISTD
13231 #$i_stdlib I_STDLIB
13232 #include <stdio.h>
13233 #ifdef I_UNISTD
13234 #  include <unistd.h>
13235 #endif
13236 #ifdef I_STDLIB
13237 #  include <stdlib.h>
13238 #endif
13239 int main()
13240 {
13241         register int i;
13242         register unsigned long tmp;
13243         register unsigned long max = 0L;
13244
13245         for (i = 1000; i; i--) {
13246                 tmp = (unsigned long) $randfunc();
13247                 if (tmp > max) max = tmp;
13248         }
13249         for (i = 0; max; i++)
13250                 max /= 2;
13251         printf("%d\n",i);
13252 }
13253 EOCP
13254                                 set try
13255                                 if eval $compile_ok; then
13256                                         dflt=`try`
13257                                 else
13258                                         dflt='?'
13259                                         echo "(I can't seem to compile the test program...)"
13260                                 fi
13261                                 ;;
13262                         *)
13263                                 dflt="$randbits"
13264                                 ;;
13265                         esac
13266                         rp="How many bits does your $randfunc() function produce?"
13267                         . ./myread
13268                         randbits="$ans"
13269                         $rm -f try.c try
13270                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13271                         seedfunc="s$randfunc"
13272                         randseedtype=unsigned
13273                         ;;
13274                 *)
13275                         dflt="31"
13276                         rp="How many bits does your $randfunc() function produce?"
13277                         . ./myread
13278                         randbits="$ans"
13279                         seedfunc="s$randfunc"
13280                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13281                         if set $seedfunc val -f; eval $csym; $val; then
13282                                 echo "(Using $seedfunc() to seed random generator)"
13283                         else
13284                                 echo "(Warning: no $seedfunc() to seed random generator)"
13285                                 seedfunc=rand
13286                         fi
13287                         randseedtype=unsigned
13288                         ;;
13289                 esac
13290                 ;;
13291         esac
13292 done
13293
13294 echo " "
13295 echo "Determining whether or not we are on an EBCDIC system..." >&4
13296 $cat >tebcdic.c <<'EOM'
13297 int main()
13298 {
13299   if ('M'==0xd4) return 0;
13300   return 1;
13301 }
13302 EOM
13303
13304 val=$undef
13305 set tebcdic
13306 if eval $compile_ok; then
13307         if ./tebcdic; then
13308                 echo "You seem to speak EBCDIC." >&4
13309                 val="$define"
13310         else
13311                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13312         fi
13313 else
13314         echo "I'm unable to compile the test program." >&4
13315         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13316 fi
13317 $rm -f tebcdic.c tebcdic
13318 set ebcdic
13319 eval $setvar
13320
13321 echo " "
13322 $cat >&4 <<EOM
13323 Checking how to flush all pending stdio output...
13324 EOM
13325 # I only know how to find the first 32 possibly open files on SunOS.
13326 # See also hints/sunos_4_1.sh and util.c  --AD
13327 case "$osname" in
13328 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13329 esac
13330 $cat >>try.c <<EOCP
13331 #include <stdio.h>
13332 #$i_unistd I_UNISTD
13333 #ifdef I_UNISTD
13334 # include <unistd.h>
13335 #endif
13336 #$d_sysconf HAS_SYSCONF
13337 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13338 #ifdef HAS_STDIO_STREAM_ARRAY
13339 # define STDIO_STREAM_ARRAY $stdio_stream_array
13340 #endif
13341 int main() {
13342   FILE* p = fopen("try.out", "w");
13343 #ifdef TRY_FPUTC
13344   fputc('x', p);
13345 #else
13346 # ifdef TRY_FPRINTF
13347   fprintf(p, "x");
13348 # endif
13349 #endif
13350 #ifdef TRY_FFLUSH_NULL
13351   fflush(NULL);
13352 #endif
13353 #ifdef TRY_FFLUSH_ALL
13354   {
13355     long open_max = -1;
13356 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13357     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13358 # else
13359 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13360     open_max = sysconf(_SC_OPEN_MAX);
13361 #  else
13362 #   ifdef FOPEN_MAX
13363     open_max = FOPEN_MAX;
13364 #   else
13365 #    ifdef OPEN_MAX
13366     open_max = OPEN_MAX;
13367 #    else
13368 #     ifdef _NFILE
13369     open_max = _NFILE;
13370 #     endif
13371 #    endif
13372 #   endif
13373 #  endif
13374 # endif 
13375 # ifdef HAS_STDIO_STREAM_ARRAY
13376     if (open_max > 0) {
13377       long i;
13378       for (i = 0; i < open_max; i++)
13379             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13380                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13381                 STDIO_STREAM_ARRAY[i]._flag)
13382                 fflush(&STDIO_STREAM_ARRAY[i]);
13383     }   
13384   }
13385 # endif
13386 #endif
13387   _exit(42);
13388 }
13389 EOCP
13390 : first we have to find out how _not_ to flush
13391 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13392     output=''
13393     set try -DTRY_FPUTC
13394     if eval $compile; then
13395             $rm -f try.out
13396             ./try$exe_ext 2>/dev/null
13397             if $test ! -s try.out -a "X$?" = X42; then
13398                 output=-DTRY_FPUTC
13399             fi
13400     fi
13401     case "$output" in
13402     '')
13403             set try -DTRY_FPRINTF
13404             $rm -f try.out
13405             if eval $compile; then
13406                     $rm -f try.out
13407                     ./try$exe_ext 2>/dev/null
13408                     if $test ! -s try.out -a "X$?" = X42; then
13409                         output=-DTRY_FPRINTF
13410                     fi
13411             fi
13412         ;;
13413     esac
13414 fi
13415 : check for fflush NULL behaviour
13416 case "$fflushNULL" in
13417 '')     set try -DTRY_FFLUSH_NULL $output
13418         if eval $compile; then
13419                 $rm -f try.out
13420                 ./try$exe_ext 2>/dev/null
13421                 code="$?"
13422                 if $test -s try.out -a "X$code" = X42; then
13423                         fflushNULL="`$cat try.out`"
13424                 else
13425                         if $test "X$code" != X42; then
13426                                 $cat >&4 <<EOM
13427 (If this test failed, don't worry, we'll try another method shortly.)
13428 EOM
13429                         fi
13430                 fi
13431         fi
13432         $rm -f core try.core core.try.*
13433         case "$fflushNULL" in
13434         x)      $cat >&4 <<EOM
13435 Your fflush(NULL) works okay for output streams.
13436 Let's see if it clobbers input pipes...
13437 EOM
13438 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13439 # bug that improperly flushes the input end of pipes.  So we avoid the
13440 # autoflush on fork/system/exec support for now. :-(
13441 $cat >tryp.c <<EOCP
13442 #include <stdio.h>
13443 int
13444 main(int argc, char **argv)
13445 {
13446     char buf[1024];
13447     int i;
13448     char *bp = buf;
13449     while (1) {
13450         while ((i = getc(stdin)) != -1
13451                && (*bp++ = i) != '\n'
13452                && bp < &buf[1024])
13453         /* DO NOTHING */ ;
13454         *bp = '\0';
13455         fprintf(stdout, "%s", buf);
13456         fflush(NULL);
13457         if (i == -1)
13458             return 0;
13459         bp = buf;
13460     }
13461 }
13462 EOCP
13463                 fflushNULL="$define"
13464                 set tryp
13465                 if eval $compile; then
13466                     $rm -f tryp.out
13467                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13468                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13469                        $cat >&4 <<EOM
13470 fflush(NULL) seems to behave okay with input streams.
13471 EOM
13472                         fflushNULL="$define"
13473                     else
13474                         $cat >&4 <<EOM
13475 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13476 EOM
13477                         fflushNULL="$undef"
13478                     fi
13479                 fi
13480                 $rm -f core tryp.c tryp.core core.tryp.*
13481                 ;;
13482         '')     $cat >&4 <<EOM
13483 Your fflush(NULL) isn't working (contrary to ANSI C).
13484 EOM
13485                 fflushNULL="$undef"
13486                 ;;
13487         *)      $cat >&4 <<EOM
13488 Cannot figure out whether your fflush(NULL) works or not.
13489 I'm assuming it doesn't (contrary to ANSI C).
13490 EOM
13491                 fflushNULL="$undef"
13492                 ;;
13493         esac
13494         ;;
13495 $define|true|[yY]*)
13496         fflushNULL="$define"
13497         ;;
13498 *)
13499         fflushNULL="$undef"
13500         ;;
13501 esac
13502 : check explicit looping only if NULL did not work, and if the pipe
13503 : bug does not show up on an explicit flush too
13504 case "$fflushNULL" in
13505 "$undef")
13506         $cat >tryp.c <<EOCP
13507 #include <stdio.h>
13508 int
13509 main(int argc, char **argv)
13510 {
13511     char buf[1024];
13512     int i;
13513     char *bp = buf;
13514     while (1) {
13515         while ((i = getc(stdin)) != -1
13516                && (*bp++ = i) != '\n'
13517                && bp < &buf[1024])
13518         /* DO NOTHING */ ;
13519         *bp = '\0';
13520         fprintf(stdout, "%s", buf);
13521         fflush(stdin);
13522         if (i == -1)
13523             return 0;
13524         bp = buf;
13525     }
13526 }
13527 EOCP
13528         set tryp
13529         if eval $compile; then
13530             $rm -f tryp.out
13531             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13532             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13533                $cat >&4 <<EOM
13534 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13535 EOM
13536                 : now check for fflushall behaviour
13537                 case "$fflushall" in
13538                 '')     set try -DTRY_FFLUSH_ALL $output
13539                         if eval $compile; then
13540                                 $cat >&4 <<EOM
13541 (Now testing the other method--but note that this also may fail.)
13542 EOM
13543                                 $rm -f try.out
13544                                 ./try$exe_ext 2>/dev/null
13545                                 if $test -s try.out -a "X$?" = X42; then
13546                                         fflushall="`$cat try.out`"
13547                                 fi
13548                         fi
13549                         $rm -f core try.core core.try.*
13550                         case "$fflushall" in
13551                         x)      $cat >&4 <<EOM
13552 Whew. Flushing explicitly all the stdio streams works.
13553 EOM
13554                                 fflushall="$define"
13555                                 ;;
13556                         '')     $cat >&4 <<EOM
13557 Sigh. Flushing explicitly all the stdio streams doesn't work.
13558 EOM
13559                                 fflushall="$undef"
13560                                 ;;
13561                         *)      $cat >&4 <<EOM
13562 Cannot figure out whether flushing stdio streams explicitly works or not.
13563 I'm assuming it doesn't.
13564 EOM
13565                                 fflushall="$undef"
13566                                 ;;
13567                         esac
13568                         ;;
13569                 "$define"|true|[yY]*)
13570                         fflushall="$define"
13571                         ;;
13572                 *)
13573                         fflushall="$undef"
13574                         ;;
13575                 esac
13576             else
13577                 $cat >&4 <<EOM
13578 All is futile.  Even fflush(stdin) clobbers input pipes!
13579 EOM
13580                 fflushall="$undef"
13581             fi
13582         else
13583             fflushall="$undef"
13584         fi
13585         $rm -f core tryp.c tryp.core core.tryp.*
13586         ;;
13587 *)      fflushall="$undef"
13588         ;;
13589 esac
13590
13591 case "$fflushNULL$fflushall" in
13592 undefundef)
13593         $cat <<EOM
13594 OK, I give up.  I cannot figure out how to flush pending stdio output.
13595 We won't be flushing handles at all before fork/exec/popen.
13596 EOM
13597         ;;
13598 esac
13599 $rm -f try.* try$exe_ext
13600
13601 : Store the full pathname to the ar program for use in the C program
13602 : Respect a hint or command line value for full_ar.
13603 case "$full_ar" in
13604 '') full_ar=$ar ;;
13605 esac
13606
13607 : Store the full pathname to the sed program for use in the C program
13608 full_sed=$sed
13609
13610 : see what type gids are declared as in the kernel
13611 echo " "
13612 echo "Looking for the type for group ids returned by getgid()."
13613 set gid_t gidtype xxx stdio.h sys/types.h
13614 eval $typedef
13615 case "$gidtype" in
13616 xxx)
13617         xxx=`./findhdr sys/user.h`
13618         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13619         case $1 in
13620         unsigned) dflt="$1 $2" ;;
13621         *) dflt="$1" ;;
13622         esac
13623         ;;
13624 *) dflt="$gidtype";;
13625 esac
13626 case "$gidtype" in
13627 gid_t) echo "gid_t found." ;;
13628 *)      rp="What is the type for group ids returned by getgid()?"
13629         . ./myread
13630         gidtype="$ans"
13631         ;;
13632 esac
13633
13634 echo " "
13635 case "$gidtype" in
13636 *_t) zzz="$gidtype"     ;;
13637 *)   zzz="gid"          ;;
13638 esac
13639 echo "Checking the size of $zzz..." >&4 
13640 cat > try.c <<EOCP
13641 #include <sys/types.h>
13642 #include <stdio.h>
13643 int main() {
13644     printf("%d\n", (int)sizeof($gidtype));
13645     exit(0);
13646 }
13647 EOCP
13648 set try
13649 if eval $compile_ok; then
13650         yyy=`./try`
13651         case "$yyy" in
13652         '')     gidsize=4
13653                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13654                 ;;
13655         *)      gidsize=$yyy
13656                 echo "Your $zzz is $gidsize bytes long."
13657                 ;;
13658         esac
13659 else
13660         gidsize=4
13661         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13662 fi
13663
13664
13665 echo " "
13666 case "$gidtype" in
13667 *_t) zzz="$gidtype"     ;;
13668 *)   zzz="gid"          ;;
13669 esac
13670 echo "Checking the sign of $zzz..." >&4 
13671 cat > try.c <<EOCP
13672 #include <sys/types.h>
13673 #include <stdio.h>
13674 int main() {
13675         $gidtype foo = -1;
13676         if (foo < 0)
13677                 printf("-1\n");
13678         else
13679                 printf("1\n");
13680 }
13681 EOCP
13682 set try
13683 if eval $compile; then
13684         yyy=`./try`
13685         case "$yyy" in
13686         '')     gidsign=1
13687                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13688                 ;;
13689         *)      gidsign=$yyy
13690                 case "$gidsign" in
13691                  1) echo "Your $zzz is unsigned." ;;
13692                 -1) echo "Your $zzz is signed."   ;;
13693                 esac
13694                 ;;
13695         esac
13696 else
13697         gidsign=1
13698         echo "(I can't compile the test program--guessing unsigned.)" >&4
13699 fi
13700
13701
13702 echo " "
13703
13704 if $test X"$quadtype" != X; then
13705
13706 echo "Checking how to print 64-bit integers..." >&4
13707
13708 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13709         $cat >try.c <<'EOCP'
13710 #include <sys/types.h>
13711 #include <stdio.h>
13712 int main() {
13713   int q = 12345678901;
13714   printf("%ld\n", q);
13715 }
13716 EOCP
13717         set try
13718         if eval $compile; then
13719                 yyy=`./try$exe_ext`
13720                 case "$yyy" in
13721                 12345678901)
13722                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13723                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13724                         echo "We will use %d."
13725                         ;;
13726                 esac
13727         fi
13728 fi
13729
13730 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13731         $cat >try.c <<'EOCP'
13732 #include <sys/types.h>
13733 #include <stdio.h>
13734 int main() {
13735   long q = 12345678901;
13736   printf("%ld\n", q);
13737 }
13738 EOCP
13739         set try
13740         if eval $compile; then
13741                 yyy=`./try$exe_ext`
13742                 case "$yyy" in
13743                 12345678901)
13744                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13745                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13746                         echo "We will use %ld."
13747                         ;;
13748                 esac
13749         fi
13750 fi
13751
13752 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13753         $cat >try.c <<'EOCP'
13754 #include <sys/types.h>
13755 #include <inttypes.h>
13756 #include <stdio.h>
13757 int main() {
13758   int64_t q = 12345678901;
13759   printf("%" PRId64 "\n", q);
13760 }
13761 EOCP
13762         set try
13763         if eval $compile; then
13764                 yyy=`./try$exe_ext`
13765                 case "$yyy" in
13766                 12345678901)
13767                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13768                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13769                         echo "We will use the C9X style."
13770                         ;;
13771                 esac
13772         fi
13773 fi
13774
13775 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13776         $cat >try.c <<'EOCP'
13777 #include <sys/types.h>
13778 #include <stdio.h>
13779 int main() {
13780   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13781   printf("%lld\n", q);
13782 }
13783 EOCP
13784         set try
13785         if eval $compile; then
13786                 yyy=`./try$exe_ext`
13787                 case "$yyy" in
13788                 12345678901)
13789                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13790                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13791                         echo "We will use the %lld style."
13792                         ;;
13793                 esac
13794         fi
13795 fi
13796
13797 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13798         $cat >try.c <<EOCP
13799 #include <sys/types.h>
13800 #include <stdio.h>
13801 int main() {
13802   $quadtype q = 12345678901;
13803   printf("%Ld\n", q);
13804 }
13805 EOCP
13806         set try
13807         if eval $compile; then
13808                 yyy=`./try$exe_ext`
13809                 case "$yyy" in
13810                 12345678901)
13811                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13812                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13813                         echo "We will use %Ld."
13814                         ;;
13815                 esac
13816         fi
13817 fi
13818
13819 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13820         $cat >try.c <<EOCP
13821 #include <sys/types.h>
13822 #include <stdio.h>
13823 int main() {
13824   $quadtype q = 12345678901;
13825   printf("%qd\n", q);
13826 }
13827 EOCP
13828         set try
13829         if eval $compile; then
13830                 yyy=`./try$exe_ext`
13831                 case "$yyy" in
13832                 12345678901)
13833                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13834                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13835                         echo "We will use %qd."
13836                         ;;
13837                 esac
13838         fi
13839 fi
13840
13841 if $test X"$sPRId64" = X; then
13842         echo "Cannot figure out how to print 64-bit integers." >&4
13843 fi
13844
13845 $rm -f try try.*
13846
13847 fi
13848
13849 case "$sPRId64" in
13850 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13851         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13852         ;;
13853 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13854         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13855         ;;
13856 esac
13857
13858
13859 echo " "
13860 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13861
13862 if $test X"$ivsize" = X8; then
13863         ivdformat="$sPRId64"
13864         uvuformat="$sPRIu64"
13865         uvoformat="$sPRIo64"
13866         uvxformat="$sPRIx64"
13867         uvXUformat="$sPRIXU64"
13868 else
13869         if $test X"$ivsize" = X"$longsize"; then
13870                 ivdformat='"ld"'
13871                 uvuformat='"lu"'
13872                 uvoformat='"lo"'
13873                 uvxformat='"lx"'
13874                 uvXUformat='"lX"'
13875         else
13876                 if $test X"$ivsize" = X"$intsize"; then
13877                         ivdformat='"d"'
13878                         uvuformat='"u"'
13879                         uvoformat='"o"'
13880                         uvxformat='"x"'
13881                         uvXUformat='"X"'
13882                 else
13883                         : far out
13884                         if $test X"$ivsize" = X"$shortsize"; then
13885                                 ivdformat='"hd"'
13886                                 uvuformat='"hu"'
13887                                 uvoformat='"ho"'
13888                                 uvxformat='"hx"'
13889                                 uvXUformat='"hX"'
13890                         fi
13891                 fi
13892         fi
13893 fi
13894
13895 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13896         nveformat="$sPRIeldbl"
13897         nvfformat="$sPRIfldbl"
13898         nvgformat="$sPRIgldbl"
13899         nvEUformat="$sPRIEUldbl"
13900         nvFUformat="$sPRIFUldbl"
13901         nvGUformat="$sPRIGUldbl"
13902 else
13903         nveformat='"e"'
13904         nvfformat='"f"'
13905         nvgformat='"g"'
13906         nvEUformat='"E"'
13907         nvFUformat='"F"'
13908         nvGUformat='"G"'
13909 fi
13910
13911 case "$ivdformat" in
13912 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13913     exit 1
13914     ;;
13915 esac
13916
13917
13918 echo " "
13919 $echo "Checking the format string to be used for gids..." >&4
13920
13921 case "$gidsign" in
13922 -1)     if $test X"$gidsize" = X"$ivsize"; then
13923                 gidformat="$ivdformat"
13924         else
13925                 if $test X"$gidsize" = X"$longsize"; then
13926                         gidformat='"ld"'
13927                 else
13928                         if $test X"$gidsize" = X"$intsize"; then
13929                                 gidformat='"d"'
13930                         else
13931                                 if $test X"$gidsize" = X"$shortsize"; then
13932                                         gidformat='"hd"'
13933                                 fi
13934                         fi
13935                 fi
13936         fi
13937         ;;
13938 *)      if $test X"$gidsize" = X"$uvsize"; then
13939                 gidformat="$uvuformat"
13940         else
13941                 if $test X"$gidsize" = X"$longsize"; then
13942                         gidformat='"lu"'
13943                 else
13944                         if $test X"$gidsize" = X"$intsize"; then
13945                                 gidformat='"u"'
13946                         else
13947                                 if $test X"$gidsize" = X"$shortsize"; then
13948                                         gidformat='"hu"'
13949                                 fi
13950                         fi
13951                 fi
13952         fi
13953         ;;
13954 esac
13955
13956 : see if getgroups exists
13957 set getgroups d_getgrps
13958 eval $inlibc
13959
13960 : see if setgroups exists
13961 set setgroups d_setgrps
13962 eval $inlibc
13963
13964
13965 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13966 echo " "
13967 case "$d_getgrps$d_setgrps" in
13968 *define*)
13969         case "$groupstype" in
13970         '') dflt="$gidtype" ;;
13971         *)  dflt="$groupstype" ;;
13972         esac
13973         $cat <<EOM
13974 What type of pointer is the second argument to getgroups() and setgroups()?
13975 Usually this is the same as group ids, $gidtype, but not always.
13976
13977 EOM
13978         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13979         . ./myread
13980         groupstype="$ans"
13981         ;;
13982 *)  groupstype="$gidtype";;
13983 esac
13984
13985 echo " "
13986 echo "Checking if your $make program sets \$(MAKE)..." >&4
13987 case "$make_set_make" in
13988 '')
13989         $sed 's/^X //' > testmake.mak << 'EOF'
13990 Xall:
13991 X       @echo 'maketemp="$(MAKE)"'
13992 EOF
13993         case "`$make -f testmake.mak 2>/dev/null`" in
13994         *maketemp=*) make_set_make='#' ;;
13995         *)      make_set_make="MAKE=$make" ;;
13996         esac
13997         $rm -f testmake.mak
13998         ;;
13999 esac
14000 case "$make_set_make" in
14001 '#') echo "Yup, it does.";;
14002 *) echo "Nope, it doesn't.";;
14003 esac
14004
14005 : see what type is used for mode_t
14006 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14007 set mode_t modetype int stdio.h sys/types.h
14008 eval $typedef_ask
14009
14010 : see if stdarg is available
14011 echo " "
14012 if $test `./findhdr stdarg.h`; then
14013         echo "<stdarg.h> found." >&4
14014         valstd="$define"
14015 else
14016         echo "<stdarg.h> NOT found." >&4
14017         valstd="$undef"
14018 fi
14019
14020 : see if varags is available
14021 echo " "
14022 if $test `./findhdr varargs.h`; then
14023         echo "<varargs.h> found." >&4
14024 else
14025         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14026 fi
14027
14028 : set up the varargs testing programs
14029 $cat > varargs.c <<EOP
14030 #ifdef I_STDARG
14031 #include <stdarg.h>
14032 #endif
14033 #ifdef I_VARARGS
14034 #include <varargs.h>
14035 #endif
14036
14037 #ifdef I_STDARG
14038 int f(char *p, ...)
14039 #else
14040 int f(va_alist)
14041 va_dcl
14042 #endif
14043 {
14044         va_list ap;
14045 #ifndef I_STDARG
14046         char *p;
14047 #endif
14048 #ifdef I_STDARG
14049         va_start(ap,p);
14050 #else
14051         va_start(ap);
14052         p = va_arg(ap, char *);
14053 #endif
14054         va_end(ap);
14055 }
14056 EOP
14057 $cat > varargs <<EOP
14058 $startsh
14059 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14060         echo "true"
14061 else
14062         echo "false"
14063 fi
14064 $rm -f varargs$_o
14065 EOP
14066 chmod +x varargs
14067
14068 : now check which varargs header should be included
14069 echo " "
14070 i_varhdr=''
14071 case "$valstd" in
14072 "$define")
14073         if `./varargs I_STDARG`; then
14074                 val='stdarg.h'
14075         elif `./varargs I_VARARGS`; then
14076                 val='varargs.h'
14077         fi
14078         ;;
14079 *)
14080         if `./varargs I_VARARGS`; then
14081                 val='varargs.h'
14082         fi
14083         ;;
14084 esac
14085 case "$val" in
14086 '')
14087 echo "I could not find the definition for va_dcl... You have problems..." >&4
14088         val="$undef"; set i_stdarg; eval $setvar
14089         val="$undef"; set i_varargs; eval $setvar
14090         ;;
14091 *) 
14092         set i_varhdr
14093         eval $setvar
14094         case "$i_varhdr" in
14095         stdarg.h)
14096                 val="$define"; set i_stdarg; eval $setvar
14097                 val="$undef"; set i_varargs; eval $setvar
14098                 ;;
14099         varargs.h)
14100                 val="$undef"; set i_stdarg; eval $setvar
14101                 val="$define"; set i_varargs; eval $setvar
14102                 ;;
14103         esac
14104         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14105 esac
14106 $rm -f varargs*
14107
14108 : see if we need va_copy
14109 echo " "
14110 case "$i_stdarg" in
14111 "$define")
14112         $cat >try.c <<EOCP
14113 #include <stdarg.h>
14114 #include <stdio.h>
14115 #$i_stdlib I_STDLIB
14116 #ifdef I_STDLIB
14117 #include <stdlib.h>
14118 #endif
14119 #include <signal.h>
14120
14121 int
14122 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14123 {
14124   return vfprintf(f, fmt, *valp);
14125 }
14126  
14127 int    
14128 myvfprintf(FILE *f, const  char *fmt, va_list val)
14129 {
14130   return ivfprintf(f, fmt, &val);
14131 }
14132       
14133 int
14134 myprintf(char *fmt, ...) 
14135 {
14136   va_list val;
14137   va_start(val, fmt);
14138   return myvfprintf(stdout, fmt, val); 
14139 }         
14140
14141 int
14142 main(int ac, char **av)
14143 {
14144   signal(SIGSEGV, exit);
14145
14146   myprintf("%s%cs all right, then\n", "that", '\'');                            
14147   exit(0);      
14148 }
14149 EOCP
14150         set try
14151         if eval $compile && ./try 2>&1 >/dev/null; then
14152                 case "`./try`" in
14153                 "that's all right, then")
14154                         okay=yes
14155                         ;;
14156                 esac
14157         fi
14158         case "$okay" in
14159         yes)    echo "It seems that you don't need va_copy()." >&4
14160                 need_va_copy="$undef"
14161                 ;;
14162         *)      echo "It seems that va_copy() or similar will be needed." >&4
14163                 need_va_copy="$define"
14164                 ;;
14165         esac
14166         $rm -f try.* core core.* *.core *.core.*
14167         ;;
14168 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14169         ;;
14170 esac
14171
14172 : define a fucntion to check prototypes
14173 $cat > protochk <<EOSH
14174 $startsh
14175 cc="$cc"
14176 optimize="$optimize"
14177 ccflags="$ccflags"
14178 prototype="$prototype"
14179 define="$define"
14180 rm=$rm
14181 EOSH
14182
14183 $cat >> protochk <<'EOSH'
14184
14185 $rm -f try.c
14186 foo="$1"
14187 shift
14188 while test $# -ge 2; do
14189         case "$1" in
14190                 $define) echo "#include <$2>" >> try.c ;;
14191                 literal) echo "$2" >> try.c ;;
14192         esac
14193     shift 2
14194 done
14195 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14196 cat >> try.c <<'EOCP'
14197 #ifdef CAN_PROTOTYPE
14198 #define _(args) args
14199 #else
14200 #define _(args) ()
14201 #endif
14202 EOCP
14203 echo "$foo" >> try.c
14204 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14205 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14206 status=$?
14207 $rm -f try.[co]
14208 exit $status
14209 EOSH
14210 chmod +x protochk
14211 $eunicefix protochk
14212
14213 : see what type is used for size_t
14214 rp="What is the type used for the length parameter for string functions?"
14215 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14216 eval $typedef_ask
14217
14218 : check for type of arguments to gethostbyaddr. 
14219 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14220         case "$d_gethbyaddr" in
14221         $define)
14222                 $cat <<EOM
14223
14224 Checking to see what type of arguments are accepted by gethostbyaddr().
14225 EOM
14226                 hdrs="$define sys/types.h
14227                         $d_socket sys/socket.h 
14228                         $i_niin netinet/in.h 
14229                         $i_netdb netdb.h
14230                         $i_unistd unistd.h"
14231                 : The first arg can 'char *' or 'void *'
14232                 : The second arg is some of integral type
14233                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14234                         for yyy in size_t long int; do
14235                                 case "$netdb_host_type" in
14236                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14237                                         if ./protochk "$try" $hdrs; then
14238                                                 echo "Your system accepts $xxx for the first arg."
14239                                                 echo "...and $yyy for the second arg."
14240                                                 netdb_host_type="$xxx"
14241                                                 netdb_hlen_type="$yyy"
14242                                         fi
14243                                         ;;
14244                                 esac
14245                         done
14246                 done
14247                 : In case none of those worked, prompt the user.
14248                 case "$netdb_host_type" in
14249                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14250                         dflt='char *'
14251                         . ./myread
14252                         netdb_host_type=$ans
14253                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14254                         dflt="$sizetype"
14255                         . ./myread
14256                         netdb_hlen_type=$ans
14257                         ;;
14258                 esac
14259                 ;;
14260         *)      : no gethostbyaddr, so pick harmless defaults
14261                 netdb_host_type='char *'
14262                 netdb_hlen_type="$sizetype"
14263                 ;;
14264         esac
14265         # Remove the "const" if needed. -- but then we'll have a 
14266         # prototype clash!
14267         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14268 fi
14269
14270 : check for type of argument to gethostbyname. 
14271 if test "X$netdb_name_type" = X ; then
14272         case "$d_gethbyname" in
14273         $define)
14274                 $cat <<EOM
14275
14276 Checking to see what type of argument is accepted by gethostbyname().
14277 EOM
14278                 hdrs="$define sys/types.h
14279                         $d_socket sys/socket.h 
14280                         $i_niin netinet/in.h 
14281                         $i_netdb netdb.h
14282                         $i_unistd unistd.h"
14283                 for xxx in "const char *" "char *"; do
14284                         case "$netdb_name_type" in
14285                         '')     try="extern struct hostent *gethostbyname($xxx);"
14286                                 if ./protochk "$try" $hdrs; then
14287                                         echo "Your system accepts $xxx."
14288                                         netdb_name_type="$xxx"
14289                                 fi
14290                                 ;;
14291                         esac
14292                 done
14293                 : In case none of those worked, prompt the user.
14294                 case "$netdb_name_type" in
14295                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14296                         dflt='char *'
14297                         . ./myread
14298                         netdb_name_type=$ans
14299                         ;;
14300                 esac
14301                 ;;
14302         *)      : no gethostbyname, so pick harmless default
14303                 netdb_name_type='char *'
14304                 ;;
14305         esac
14306 fi
14307
14308 : check for type of 1st argument to getnetbyaddr. 
14309 if test "X$netdb_net_type" = X ; then
14310         case "$d_getnbyaddr" in
14311         $define)
14312                 $cat <<EOM
14313
14314 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14315 EOM
14316                 hdrs="$define sys/types.h
14317                         $d_socket sys/socket.h 
14318                         $i_niin netinet/in.h 
14319                         $i_netdb netdb.h
14320                         $i_unistd unistd.h"
14321                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14322                         case "$netdb_net_type" in
14323                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14324                                 if ./protochk "$try" $hdrs; then
14325                                         echo "Your system accepts $xxx."
14326                                         netdb_net_type="$xxx"
14327                                 fi
14328                                 ;;
14329                         esac
14330                 done
14331                 : In case none of those worked, prompt the user.
14332                 case "$netdb_net_type" in
14333                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14334                         dflt='long'
14335                         . ./myread
14336                         netdb_net_type=$ans
14337                         ;;
14338                 esac
14339                 ;;
14340         *)      : no getnetbyaddr, so pick harmless default
14341                 netdb_net_type='long'
14342                 ;;
14343         esac
14344 fi
14345 : locate the preferred pager for this system
14346 case "$pager" in
14347 '')
14348         dflt=''
14349         case "$pg" in
14350         /*) dflt=$pg;;
14351         [a-zA-Z]:/*) dflt=$pg;;
14352         esac
14353         case "$more" in
14354         /*) dflt=$more;;
14355         [a-zA-Z]:/*) dflt=$more;;
14356         esac
14357         case "$less" in
14358         /*) dflt=$less;;
14359         [a-zA-Z]:/*) dflt=$less;;
14360         esac
14361         case "$dflt" in
14362         '') dflt=/usr/ucb/more;;
14363         esac
14364         ;;
14365 *) dflt="$pager";;
14366 esac
14367 echo " "
14368 fn=f/
14369 rp='What pager is used on your system?'
14370 . ./getfile
14371 pager="$ans"
14372
14373 : see what type pids are declared as in the kernel
14374 rp="What is the type of process ids on this system?"
14375 set pid_t pidtype int stdio.h sys/types.h
14376 eval $typedef_ask
14377
14378 : Find earliest binary compatible site_perl subdirectory perl can use.
14379 case "$bincompat5005" in
14380 "$define") xs_apiversion='5.005' ;;
14381 *) xs_apiversion=$version ;;   # The current site_perl version.
14382 esac
14383 : Find earliest pure perl site_perl subdirectory perl can use.
14384 : The versioned directories started at 5.005.
14385 pm_apiversion='5.005'
14386
14387 : see if ar generates random libraries by itself
14388 echo " "
14389 echo "Checking how to generate random libraries on your machine..." >&4
14390 echo 'int bar1() { return bar2(); }' > bar1.c
14391 echo 'int bar2() { return 2; }' > bar2.c
14392 $cat > foo.c <<'EOP'
14393 int main() { printf("%d\n", bar1()); exit(0); }
14394 EOP
14395 $cc $ccflags -c bar1.c >/dev/null 2>&1
14396 $cc $ccflags -c bar2.c >/dev/null 2>&1
14397 $cc $ccflags -c foo.c >/dev/null 2>&1
14398 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14399 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14400         ./foobar >/dev/null 2>&1; then
14401         echo "$ar appears to generate random libraries itself."
14402         orderlib=false
14403         ranlib=":"
14404 elif $ar ts bar$_a >/dev/null 2>&1 &&
14405         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14406         ./foobar >/dev/null 2>&1; then
14407                 echo "a table of contents needs to be added with '$ar ts'."
14408                 orderlib=false
14409                 ranlib="$ar ts"
14410 else
14411         case "$ranlib" in
14412         :) ranlib='';;
14413         '')
14414                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14415                 $test -f $ranlib || ranlib=''
14416                 ;;
14417         esac
14418         if $test -n "$ranlib"; then
14419                 echo "your system has '$ranlib'; we'll use that."
14420                 orderlib=false
14421         else
14422                 echo "your system doesn't seem to support random libraries"
14423                 echo "so we'll use lorder and tsort to order the libraries."
14424                 orderlib=true
14425                 ranlib=":"
14426         fi
14427 fi
14428 $rm -f foo* bar* 
14429
14430 : check for type of arguments to select. 
14431 case "$selecttype" in
14432 '') case "$d_select" in
14433         $define)
14434                 echo " "
14435                 $cat <<EOM
14436 Checking to see what type of arguments are accepted by select().
14437 EOM
14438                 hdrs="$define sys/types.h
14439                         $i_systime sys/time.h 
14440                         $i_sysselct sys/select.h
14441                         $d_socket sys/socket.h"
14442                 : The first arg can be int, unsigned, or size_t
14443                 : The last arg may or may not be 'const'
14444                 val=''
14445                 : void pointer has been seen but using that
14446                 : breaks the selectminbits test
14447                 for xxx in 'fd_set *' 'int *'; do
14448                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14449                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14450                                         case "$val" in
14451                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14452                                                 if ./protochk "$try" $hdrs; then
14453                                                         echo "Your system accepts $xxx."
14454                                                         val="$xxx"
14455                                                 fi
14456                                                 ;;
14457                                         esac
14458                                 done
14459                         done
14460                 done
14461                 case "$val" in
14462                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14463                         case "$d_fd_set" in
14464                                 $define) dflt="fd_set *" ;;
14465                                 *)              dflt="int *" ;;
14466                         esac
14467                         . ./myread
14468                         val=$ans
14469                         ;;
14470                 esac
14471                 selecttype="$val"
14472                 ;;
14473         *)      : no select, so pick a harmless default
14474                 selecttype='int *'
14475                 ;;
14476         esac
14477         ;;
14478 esac
14479
14480 : check for the select 'width'
14481 case "$selectminbits" in
14482 '') case "$d_select" in
14483         $define)
14484                 $cat <<EOM
14485
14486 Checking to see on how many bits at a time your select() operates...
14487 EOM
14488                 $cat >try.c <<EOCP
14489 #include <sys/types.h>
14490 #$i_time I_TIME
14491 #$i_systime I_SYS_TIME
14492 #$i_systimek I_SYS_TIME_KERNEL
14493 #ifdef I_TIME
14494 #   include <time.h>
14495 #endif
14496 #ifdef I_SYS_TIME
14497 #   ifdef I_SYS_TIME_KERNEL
14498 #       define KERNEL
14499 #   endif
14500 #   include <sys/time.h>
14501 #   ifdef I_SYS_TIME_KERNEL
14502 #       undef KERNEL
14503 #   endif
14504 #endif
14505 #$i_sysselct I_SYS_SELECT
14506 #ifdef I_SYS_SELECT
14507 #include <sys/select.h>
14508 #endif
14509 #$d_socket HAS_SOCKET
14510 #ifdef HAS_SOCKET
14511 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14512 #endif
14513 #include <stdio.h>
14514 $selecttype b;
14515 #define S sizeof(*(b))
14516 #define MINBITS 64
14517 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14518 #define NBITS  (NBYTES * 8)
14519 int main() {
14520     char s[NBYTES];
14521     struct timeval t;
14522     int i;
14523     FILE* fp;
14524     int fd;
14525
14526     fclose(stdin);
14527     fp = fopen("try.c", "r");
14528     if (fp == 0)
14529       exit(1);
14530     fd = fileno(fp);
14531     if (fd < 0)
14532       exit(2);
14533     b = ($selecttype)s;
14534     for (i = 0; i < NBITS; i++)
14535         FD_SET(i, b);
14536     t.tv_sec  = 0;
14537     t.tv_usec = 0;
14538     select(fd + 1, b, 0, 0, &t);
14539     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14540     printf("%d\n", i + 1);
14541     return 0;
14542 }
14543 EOCP
14544                 set try
14545                 if eval $compile_ok; then
14546                         selectminbits=`./try`
14547                         case "$selectminbits" in
14548                         '')     cat >&4 <<EOM
14549 Cannot figure out on how many bits at a time your select() operates.
14550 I'll play safe and guess it is 32 bits.
14551 EOM
14552                                 selectminbits=32
14553                                 bits="32 bits"
14554                                 ;;
14555                         1)      bits="1 bit" ;;
14556                         *)      bits="$selectminbits bits" ;;
14557                         esac
14558                         echo "Your select() operates on $bits at a time." >&4
14559                 else
14560                         rp='What is the minimum number of bits your select() operates on?'
14561                         case "$byteorder" in
14562                         1234|12345678)  dflt=32 ;;
14563                         *)              dflt=1  ;;
14564                         esac
14565                         . ./myread
14566                         val=$ans
14567                         selectminbits="$val"
14568                 fi
14569                 $rm -f try.* try
14570                 ;;
14571         *)      : no select, so pick a harmless default
14572                 selectminbits='32'
14573                 ;;
14574         esac
14575         ;;
14576 esac
14577
14578 : Trace out the files included by signal.h, then look for SIGxxx names.
14579 : Remove SIGARRAYSIZE used by HPUX.
14580 : Remove SIGSTKSIZE used by Linux.
14581 : Remove SIGSTKSZ used by Posix.
14582 : Remove SIGTYP void lines used by OS2.
14583 : Some cpps, like os390, dont give the file name anywhere
14584 if [ "X$fieldn" = X ]; then
14585         : Just make some guesses.  We check them later.
14586         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14587 else
14588         xxx=`echo '#include <signal.h>' |
14589         $cppstdin $cppminus $cppflags 2>/dev/null |
14590         $grep '^[       ]*#.*include' | 
14591         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14592 fi
14593 : Check this list of files to be sure we have parsed the cpp output ok.
14594 : This will also avoid potentially non-existent files, such 
14595 : as ../foo/bar.h
14596 xxxfiles=''
14597 for xx in $xxx /dev/null ; do
14598         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14599 done
14600 : If we have found no files, at least try signal.h
14601 case "$xxxfiles" in
14602 '')     xxxfiles=`./findhdr signal.h` ;;
14603 esac
14604 xxx=`awk '
14605 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14606         print substr($2, 4, 20)
14607 }
14608 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14609         print substr($3, 4, 20)
14610 }' $xxxfiles`
14611 : Append some common names just in case the awk scan failed.
14612 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14613 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14614 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14615 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14616 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14617
14618 : generate a few handy files for later
14619 $cat > signal.c <<'EOCP'
14620 #include <sys/types.h>
14621 #include <signal.h>
14622 #include <stdio.h>
14623 int main() {
14624
14625 /* Strange style to avoid deeply-nested #if/#else/#endif */
14626 #ifndef NSIG
14627 #  ifdef _NSIG
14628 #    define NSIG (_NSIG)
14629 #  endif
14630 #endif
14631
14632 #ifndef NSIG
14633 #  ifdef SIGMAX
14634 #    define NSIG (SIGMAX+1)
14635 #  endif
14636 #endif
14637
14638 #ifndef NSIG
14639 #  ifdef SIG_MAX
14640 #    define NSIG (SIG_MAX+1)
14641 #  endif
14642 #endif
14643
14644 #ifndef NSIG
14645 #  ifdef MAXSIG
14646 #    define NSIG (MAXSIG+1)
14647 #  endif
14648 #endif
14649
14650 #ifndef NSIG
14651 #  ifdef MAX_SIG
14652 #    define NSIG (MAX_SIG+1)
14653 #  endif
14654 #endif
14655
14656 #ifndef NSIG
14657 #  ifdef SIGARRAYSIZE
14658 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14659 #  endif
14660 #endif
14661
14662 #ifndef NSIG
14663 #  ifdef _sys_nsig
14664 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14665 #  endif
14666 #endif
14667
14668 /* Default to some arbitrary number that's big enough to get most
14669    of the common signals.
14670 */
14671 #ifndef NSIG
14672 #    define NSIG 50
14673 #endif
14674
14675 printf("NSIG %d\n", NSIG);
14676
14677 #ifndef JUST_NSIG
14678
14679 EOCP
14680
14681 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14682 {
14683         printf "#ifdef SIG"; printf $1; printf "\n"
14684         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14685         printf $1; printf ");\n"
14686         printf "#endif\n"
14687 }
14688 END {
14689         printf "#endif /* JUST_NSIG */\n";
14690         printf "exit(0);\n}\n";
14691 }
14692 ' >>signal.c
14693 $cat >signal.awk <<'EOP'
14694 BEGIN { ndups = 0 }
14695 $1 ~ /^NSIG$/ { nsig = $2 }
14696 ($1 !~ /^NSIG$/) && (NF == 2) {
14697     if ($2 > maxsig) { maxsig = $2 }
14698     if (sig_name[$2]) {
14699         dup_name[ndups] = $1
14700         dup_num[ndups] = $2
14701         ndups++ 
14702     }
14703     else {
14704         sig_name[$2] = $1
14705         sig_num[$2] = $2
14706     }
14707 }
14708 END { 
14709     if (nsig == 0) {
14710         nsig = maxsig + 1
14711     }
14712     printf("NSIG %d\n", nsig);
14713     for (n = 1; n < nsig; n++) {
14714         if (sig_name[n]) {
14715             printf("%s %d\n", sig_name[n], sig_num[n])
14716         }
14717         else {
14718             printf("NUM%d %d\n", n, n) 
14719         }
14720     }
14721     for (n = 0; n < ndups; n++) {
14722         printf("%s %d\n", dup_name[n], dup_num[n])
14723     }
14724 }
14725 EOP
14726 $cat >signal_cmd <<EOS
14727 $startsh
14728 if $test -s signal.lst; then
14729     echo "Using your existing signal.lst file"
14730         exit 0
14731 fi
14732 xxx="$xxx"
14733 EOS
14734 $cat >>signal_cmd <<'EOS'
14735
14736 set signal
14737 if eval $compile_ok; then
14738         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14739 else
14740         echo "(I can't seem be able to compile the whole test program)" >&4
14741         echo "(I'll try it in little pieces.)" >&4
14742         set signal -DJUST_NSIG
14743         if eval $compile_ok; then
14744                 ./signal$_exe > signal.nsg
14745                 $cat signal.nsg
14746         else
14747                 echo "I can't seem to figure out how many signals you have." >&4
14748                 echo "Guessing 50." >&4
14749                 echo 'NSIG 50' > signal.nsg
14750         fi
14751         : Now look at all the signal names, one at a time.
14752         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14753                 $cat > signal.c <<EOCP
14754 #include <sys/types.h>
14755 #include <signal.h>
14756 #include <stdio.h>
14757 int main() {
14758 printf("$xx %d\n", SIG${xx});
14759 return 0;
14760 }
14761 EOCP
14762                 set signal
14763                 if eval $compile; then
14764                         echo "SIG${xx} found."
14765                         ./signal$_exe  >> signal.ls1
14766                 else
14767                         echo "SIG${xx} NOT found."
14768                 fi
14769         done
14770         if $test -s signal.ls1; then
14771                 $cat signal.nsg signal.ls1 |
14772                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14773         fi
14774
14775 fi
14776 if $test -s signal.lst; then
14777         :
14778 else
14779         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14780         echo 'kill -l' >signal
14781         set X `csh -f <signal`
14782         $rm -f signal
14783         shift
14784         case $# in
14785         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14786         esac
14787         echo $@ | $tr ' ' $trnl | \
14788             $awk '{ printf "%s %d\n", $1, ++s; }
14789                   END { printf "NSIG %d\n", ++s }' >signal.lst
14790 fi
14791 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14792 EOS
14793 chmod a+x signal_cmd
14794 $eunicefix signal_cmd
14795
14796 : generate list of signal names
14797 echo " "
14798 case "$sig_name_init" in
14799 '') doinit=yes ;;
14800 *)  case "$sig_num_init" in
14801     ''|*,*) doinit=yes ;;
14802     esac ;;
14803 esac
14804 case "$doinit" in
14805 yes)
14806         echo "Generating a list of signal names and numbers..." >&4
14807         . ./signal_cmd
14808         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14809         sig_name=`$awk 'BEGIN { printf "ZERO " }
14810                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14811         sig_num=`$awk  'BEGIN { printf "0 " }
14812                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14813         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14814                              !/^NSIG/   { printf "\"%s\", ", $1 }
14815                              END        { printf "0\n" }' signal.lst`
14816         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14817                              !/^NSIG/   { printf "%d, ", $2}
14818                              END        { printf "0\n"}' signal.lst`
14819         ;;
14820 esac
14821 echo "The following $sig_count signals are available:"
14822 echo " "
14823 echo $sig_name | $awk \
14824 'BEGIN { linelen = 0 }
14825 {
14826         for (i = 1; i <= NF; i++) {
14827                 name = "SIG" $i " "
14828                 linelen = linelen + length(name)
14829                 if (linelen > 70) {
14830                         printf "\n"
14831                         linelen = length(name)
14832                 }
14833                 printf "%s", name
14834         }
14835         printf "\n"
14836 }'
14837 sig_size=`echo $sig_name | awk '{print NF}'`
14838 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14839
14840 echo " "
14841 case "$sizetype" in
14842 *_t) zzz="$sizetype"    ;;
14843 *)   zzz="filesize"     ;;
14844 esac
14845 echo "Checking the size of $zzz..." >&4 
14846 cat > try.c <<EOCP
14847 #include <sys/types.h>
14848 #include <stdio.h>
14849 int main() {
14850     printf("%d\n", (int)sizeof($sizetype));
14851     exit(0);
14852 }
14853 EOCP
14854 set try
14855 if eval $compile_ok; then
14856         yyy=`./try`
14857         case "$yyy" in
14858         '')     sizesize=4
14859                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14860                 ;;
14861         *)      sizesize=$yyy
14862                 echo "Your $zzz size is $sizesize bytes."
14863                 ;;
14864         esac
14865 else
14866         sizesize=4
14867         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14868 fi
14869
14870
14871 : check for socklen_t
14872 echo " "
14873 echo "Checking to see if you have socklen_t..." >&4
14874 $cat >try.c <<EOCP
14875 #include <sys/types.h>
14876 #$d_socket HAS_SOCKET
14877 #ifdef HAS_SOCKET
14878 #include <sys/socket.h>
14879 #endif
14880 int main() { socklen_t x = 16; }
14881 EOCP
14882 set try
14883 if eval $compile; then
14884         val="$define"
14885         echo "You have socklen_t."
14886 else
14887         val="$undef"
14888         echo "You do not have socklen_t."
14889         case "$sizetype" in
14890         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14891         esac
14892 fi
14893 $rm -f try try.*
14894 set d_socklen_t
14895 eval $setvar
14896
14897 : see if this is a socks.h system
14898 set socks.h i_socks
14899 eval $inhdr
14900
14901 : check for type of the size argument to socket calls
14902 case "$d_socket" in
14903 "$define")
14904         $cat <<EOM
14905
14906 Checking to see what type is the last argument of accept().
14907 EOM
14908         yyy=''
14909         case "$d_socklen_t" in
14910         "$define") yyy="$yyy socklen_t"
14911         esac
14912         yyy="$yyy $sizetype int long unsigned"
14913         for xxx in $yyy; do
14914                 case "$socksizetype" in
14915                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14916                         case "$usesocks" in
14917                         "$define")
14918                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14919                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14920                                         socksizetype="$xxx"
14921                                 fi
14922                                 ;;
14923                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14924                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14925                                         socksizetype="$xxx"
14926                                 fi
14927                                 ;;
14928                         esac
14929                         ;;
14930                 esac
14931         done
14932 : In case none of those worked, prompt the user.
14933         case "$socksizetype" in
14934         '')     rp='What is the type for socket address structure sizes?'
14935                 dflt='int'
14936                 . ./myread
14937                 socksizetype=$ans
14938                 ;;
14939         esac
14940         ;;
14941 *)      : no sockets, so pick relatively harmless default
14942         socksizetype='int'
14943         ;;
14944 esac
14945
14946 : see what type is used for signed size_t
14947 set ssize_t ssizetype int stdio.h sys/types.h
14948 eval $typedef
14949 dflt="$ssizetype"
14950 $cat > ssize.c <<EOM
14951 #include <stdio.h>
14952 #include <sys/types.h>
14953 #define Size_t $sizetype
14954 #define SSize_t $dflt
14955 int main()
14956 {
14957         if (sizeof(Size_t) == sizeof(SSize_t))
14958                 printf("$dflt\n");
14959         else if (sizeof(Size_t) == sizeof(int))
14960                 printf("int\n");
14961         else 
14962                 printf("long\n");
14963         exit(0);
14964 }
14965 EOM
14966 echo " "
14967 set ssize
14968 if eval $compile_ok && ./ssize > /dev/null; then
14969         ssizetype=`./ssize`
14970         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14971 else
14972         $cat >&4 <<EOM
14973 Help! I can't compile and run the ssize_t test program: please enlighten me!
14974 (This is probably a misconfiguration in your system or libraries, and
14975 you really ought to fix it.  Still, I'll try anyway.)
14976
14977 I need a type that is the same size as $sizetype, but is guaranteed to
14978 be signed.  Common values are ssize_t, int and long.
14979
14980 EOM
14981         rp="What signed type is the same size as $sizetype?"
14982         . ./myread
14983         ssizetype="$ans"
14984 fi
14985 $rm -f ssize ssize.*
14986
14987 : see what type of char stdio uses.
14988 echo " "
14989 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14990 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14991         echo "Your stdio uses unsigned chars." >&4
14992         stdchar="unsigned char"
14993 else
14994         echo "Your stdio uses signed chars." >&4
14995         stdchar="char"
14996 fi
14997 $rm -f stdioh
14998
14999
15000
15001 : see if time exists
15002 echo " "
15003 if test "X$d_time" = X -o X"$timetype" = X; then
15004     if set time val -f d_time; eval $csym; $val; then
15005                 echo 'time() found.' >&4
15006                 val="$define"
15007                 rp="What is the type returned by time() on this system?"
15008                 set time_t timetype long stdio.h sys/types.h
15009                 eval $typedef_ask
15010     else
15011                 echo 'time() not found, hope that will do.' >&4
15012                 val="$undef"
15013                 timetype='int';
15014     fi
15015     set d_time
15016     eval $setvar
15017 fi
15018
15019 : see what type uids are declared as in the kernel
15020 echo " "
15021 echo "Looking for the type for user ids returned by getuid()."
15022 set uid_t uidtype xxx stdio.h sys/types.h
15023 eval $typedef
15024 case "$uidtype" in
15025 xxx)
15026         xxx=`./findhdr sys/user.h`
15027         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15028         case $1 in
15029         unsigned) dflt="$1 $2" ;;
15030         *) dflt="$1" ;;
15031         esac
15032         ;;
15033 *) dflt="$uidtype";;
15034 esac
15035 case "$uidtype" in
15036 uid_t)  echo "uid_t found." ;;
15037 *)      rp="What is the type for user ids returned by getuid()?"
15038         . ./myread
15039         uidtype="$ans"
15040         ;;
15041 esac
15042
15043 echo " "
15044 case "$uidtype" in
15045 *_t) zzz="$uidtype"     ;;
15046 *)   zzz="uid"          ;;
15047 esac
15048 echo "Checking the size of $zzz..." >&4 
15049 cat > try.c <<EOCP
15050 #include <sys/types.h>
15051 #include <stdio.h>
15052 int main() {
15053     printf("%d\n", (int)sizeof($uidtype));
15054     exit(0);
15055 }
15056 EOCP
15057 set try
15058 if eval $compile_ok; then
15059         yyy=`./try`
15060         case "$yyy" in
15061         '')     uidsize=4
15062                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15063                 ;;
15064         *)      uidsize=$yyy
15065                 echo "Your $zzz is $uidsize bytes long."
15066                 ;;
15067         esac
15068 else
15069         uidsize=4
15070         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15071 fi
15072
15073 echo " "
15074 case "$uidtype" in
15075 *_t) zzz="$uidtype"     ;;
15076 *)   zzz="uid"          ;;
15077 esac
15078 echo "Checking the sign of $zzz..." >&4
15079 cat > try.c <<EOCP
15080 #include <sys/types.h>
15081 #include <stdio.h>
15082 int main() {
15083         $uidtype foo = -1;
15084         if (foo < 0)
15085                 printf("-1\n");
15086         else
15087                 printf("1\n");
15088 }
15089 EOCP
15090 set try
15091 if eval $compile; then
15092         yyy=`./try`
15093         case "$yyy" in
15094         '')     uidsign=1
15095                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15096                 ;;
15097         *)      uidsign=$yyy
15098                 case "$uidsign" in
15099                  1) echo "Your $zzz is unsigned." ;;
15100                 -1) echo "Your $zzz is signed."   ;;
15101                 esac
15102                 ;;
15103         esac
15104 else
15105         uidsign=1
15106         echo "(I can't compile the test program--guessing unsigned.)" >&4
15107 fi
15108
15109
15110
15111 echo " "
15112 $echo "Checking the format string to be used for uids..." >&4
15113
15114 case "$uidsign" in
15115 -1)     if $test X"$uidsize" = X"$ivsize"; then
15116                 uidformat="$ivdformat"
15117         else
15118                 if $test X"$uidsize" = X"$longsize"; then
15119                         uidformat='"ld"'
15120                 else
15121                         if $test X"$uidsize" = X"$intsize"; then
15122                                 uidformat='"d"'
15123                         else
15124                                 if $test X"$uidsize" = X"$shortsize"; then
15125                                         uidformat='"hd"'
15126                                 fi
15127                         fi
15128                 fi
15129         fi
15130         ;;
15131 *)      if $test X"$uidsize" = X"$uvsize"; then
15132                 uidformat="$uvuformat"
15133         else
15134                 if $test X"$uidsize" = X"$longsize"; then
15135                         uidformat='"lu"'
15136                 else
15137                         if $test X"$uidsize" = X"$intsize"; then
15138                                 uidformat='"u"'
15139                         else
15140                                 if $test X"$uidsize" = X"$shortsize"; then
15141                                         uidformat='"hu"'
15142                                 fi
15143                         fi
15144                 fi
15145         fi
15146         ;;
15147 esac
15148
15149 : determine compiler compiler
15150 case "$yacc" in
15151 '')
15152         dflt=yacc;;
15153 *)
15154         dflt="$yacc";;
15155 esac
15156 echo " "
15157 comp='yacc'
15158 if $test -f "$byacc"; then
15159         dflt="$byacc"
15160         comp="byacc or $comp"
15161 fi
15162 if $test -f "$bison"; then
15163         comp="$comp or bison -y"
15164 fi
15165 rp="Which compiler compiler ($comp) shall I use?"
15166 . ./myread
15167 yacc="$ans"
15168 case "$yacc" in
15169 *bis*)
15170         case "$yacc" in
15171         *-y*) ;;
15172         *)
15173                 yacc="$yacc -y"
15174                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15175                 ;;
15176         esac
15177         ;;
15178 esac
15179
15180 : see if dbm.h is available
15181 : see if dbmclose exists
15182 set dbmclose d_dbmclose
15183 eval $inlibc
15184
15185 case "$d_dbmclose" in
15186 $define)
15187         set dbm.h i_dbm
15188         eval $inhdr
15189         case "$i_dbm" in
15190         $define)
15191                 val="$undef"
15192                 set i_rpcsvcdbm
15193                 eval $setvar
15194                 ;;
15195         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15196                 eval $inhdr
15197                 ;;
15198         esac
15199         ;;
15200 *)      echo "We won't be including <dbm.h>"
15201         val="$undef"
15202         set i_dbm
15203         eval $setvar
15204         val="$undef"
15205         set i_rpcsvcdbm
15206         eval $setvar
15207         ;;
15208 esac
15209
15210 : see if this is a sys/file.h system
15211 val=''
15212 set sys/file.h val
15213 eval $inhdr
15214
15215 : do we need to include sys/file.h ?
15216 case "$val" in
15217 "$define")
15218         echo " "
15219         if $h_sysfile; then
15220                 val="$define"
15221                 echo "We'll be including <sys/file.h>." >&4
15222         else
15223                 val="$undef"
15224                 echo "We won't be including <sys/file.h>." >&4
15225         fi
15226         ;;
15227 *)
15228         h_sysfile=false
15229         ;;
15230 esac
15231 set i_sysfile
15232 eval $setvar
15233
15234 : see if fcntl.h is there
15235 val=''
15236 set fcntl.h val
15237 eval $inhdr
15238
15239 : see if we can include fcntl.h
15240 case "$val" in
15241 "$define")
15242         echo " "
15243         if $h_fcntl; then
15244                 val="$define"
15245                 echo "We'll be including <fcntl.h>." >&4
15246         else
15247                 val="$undef"
15248                 if $h_sysfile; then
15249         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15250                 else
15251                         echo "We won't be including <fcntl.h>." >&4
15252                 fi
15253         fi
15254         ;;
15255 *)
15256         h_fcntl=false
15257         val="$undef"
15258         ;;
15259 esac
15260 set i_fcntl
15261 eval $setvar
15262
15263 : see if this is a iconv.h system
15264 set iconv.h i_iconv
15265 eval $inhdr
15266
15267 : see if this is a ieeefp.h system
15268 set ieeefp.h i_ieeefp
15269 eval $inhdr
15270
15271 : see if this is a libutil.h system
15272 set libutil.h i_libutil
15273 eval $inhdr
15274
15275 : see if locale.h is available
15276 set locale.h i_locale
15277 eval $inhdr
15278
15279 : see if mach cthreads are available
15280 if test "X$usethreads" = "X$define"; then
15281         set mach/cthreads.h i_machcthr
15282         eval $inhdr
15283 else
15284         i_machcthr="$undef"
15285 fi
15286
15287
15288
15289 : see if this is a math.h system
15290 set math.h i_math
15291 eval $inhdr
15292
15293 : see if this is a mntent.h system
15294 set mntent.h i_mntent
15295 eval $inhdr
15296
15297 : see if ndbm.h is available
15298 set ndbm.h t_ndbm
15299 eval $inhdr
15300 case "$t_ndbm" in
15301 $define)
15302         : see if dbm_open exists
15303         set dbm_open d_dbm_open
15304         eval $inlibc
15305         case "$d_dbm_open" in
15306         $undef)
15307                 t_ndbm="$undef"
15308                 echo "We won't be including <ndbm.h>"
15309                 ;;
15310         esac
15311         ;;
15312 esac
15313 val="$t_ndbm"
15314 set i_ndbm
15315 eval $setvar
15316
15317 : see if net/errno.h is available
15318 val=''
15319 set net/errno.h val
15320 eval $inhdr
15321
15322 : Unfortunately, it causes problems on some systems.  Arrgh.
15323 case "$val" in
15324 $define)
15325         cat > try.c <<'EOM'
15326 #include <stdio.h>
15327 #include <errno.h>
15328 #include <net/errno.h>
15329 int func()
15330 {
15331         return ENOTSOCK;
15332 }
15333 EOM
15334         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15335                 echo "We'll be including <net/errno.h>." >&4
15336         else
15337                 echo "We won't be including <net/errno.h>." >&4
15338                 val="$undef"
15339         fi
15340         $rm -f try.* try
15341         ;;
15342 esac
15343 set i_neterrno
15344 eval $setvar
15345
15346 : see if netinet/tcp.h is available
15347 set netinet/tcp.h i_netinettcp
15348 eval $inhdr
15349
15350 : see if this is a poll.h system
15351 set poll.h i_poll
15352 eval $inhdr
15353
15354 : see if this is a prot.h system
15355 set prot.h i_prot
15356 eval $inhdr
15357
15358 echo " "
15359 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15360 $cat <<'EOSH' > Cppsym.know
15361 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15362 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15363 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15364 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15365 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15366 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15367 bull c cadmus clipper CMU COFF COMPILER_VERSION
15368 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15369 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15370 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15371 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15372 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15373 H3050R H3050RX hbullx20 hcx host_mips
15374 hp200 hp300 hp700 HP700 hp800 hp9000
15375 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15376 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15377 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15378 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15379 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15380 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15381 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15382 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15383 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15384 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15385 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15386 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15387 MATH_HAS_NO_SIDE_EFFECTS
15388 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15389 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15390 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15391 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15392 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15393 NetBSD news1500 news1700 news1800 news1900 news3700
15394 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15395 ns32016 ns32332 ns32k nsc32000
15396 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15397 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15398 pc532 pdp11 PGC PIC plexus PORTAR posix
15399 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15400 POSIX_C_SOURCE POSIX_SOURCE POWER
15401 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15402 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15403 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15404 sony sony_news sonyrisc sparc sparclite spectrum
15405 stardent stdc STDC_EXT stratos sun sun3 sun386
15406 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15407 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15408 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15409 sysV68 sysV88 Tek4132 Tek4300 titan
15410 TM3200 TM5400 TM5600
15411 tower tower32 tower32_200 tower32_600 tower32_700
15412 tower32_800 tower32_850 tss
15413 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15414 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15415 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15416 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15417 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15418 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15419 z8000
15420 EOSH
15421 # Maybe put other stuff here too.
15422 cat <<EOSH >>Cppsym.know
15423 $osname
15424 EOSH
15425 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15426 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15427 $cat Cppsym.know > Cppsym.c
15428 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15429 $rm -f Cppsym.a Cppsym.b Cppsym.c
15430 cat <<EOSH > Cppsym
15431 $startsh
15432 if $test \$# -gt 0; then
15433     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15434     if $test -s Cppsym.got; then
15435         $rm -f Cppsym.got
15436         exit 0
15437     fi
15438     $rm -f Cppsym.got
15439     exit 1
15440 else
15441     $tr " " "$trnl" | ./Cppsym.try
15442     exit 0
15443 fi
15444 EOSH
15445 chmod +x Cppsym
15446 $eunicefix Cppsym
15447 cat <<EOSH > Cppsym.try
15448 $startsh
15449 cat <<'EOCP' > try.c
15450 #include <stdio.h>
15451 int main() {
15452 EOCP
15453 $awk \\
15454 EOSH
15455 cat <<'EOSH' >> Cppsym.try
15456 'length($1) > 0 {
15457     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
15458     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
15459     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
15460     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
15461 }'       >> try.c
15462 echo '}' >> try.c
15463 EOSH
15464 cat <<EOSH >> Cppsym.try
15465 ccflags="$ccflags"
15466 case "$osname-$gccversion" in
15467 irix-) ccflags="\$ccflags -woff 1178" ;;
15468 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15469 esac
15470 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15471 EOSH
15472 chmod +x Cppsym.try
15473 $eunicefix Cppsym.try
15474 ./Cppsym < Cppsym.know > Cppsym.true
15475 : now check the C compiler for additional symbols
15476 postprocess_cc_v=''
15477 case "$osname" in
15478 aix) postprocess_cc_v="|$tr , ' '" ;;
15479 esac
15480 $cat >ccsym <<EOS
15481 $startsh
15482 $cat >tmp.c <<EOF
15483 extern int foo;
15484 EOF
15485 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15486 do
15487         case "\$i" in
15488         -D*) echo "\$i" | $sed 's/^-D//';;
15489         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15490         esac
15491 done
15492 $rm -f try.c
15493 EOS
15494 postprocess_cc_v=''
15495 chmod +x ccsym
15496 $eunicefix ccsym
15497 ./ccsym > ccsym1.raw
15498 if $test -s ccsym1.raw; then
15499        $sort ccsym1.raw | $uniq >ccsym.raw
15500 else
15501        mv ccsym1.raw ccsym.raw
15502 fi
15503
15504 $awk '/\=/ { print $0; next }
15505         { print $0"=1" }' ccsym.raw >ccsym.list
15506 $awk '/\=/ { print $0; next }
15507         { print $0"=1" }' Cppsym.true >ccsym.true
15508 $comm -13 ccsym.true ccsym.list >ccsym.own
15509 $comm -12 ccsym.true ccsym.list >ccsym.com
15510 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15511 also=''
15512 if $test -z ccsym.raw; then
15513         echo "Your C compiler doesn't seem to define any symbols!" >&4
15514         echo " "
15515         echo "However, your C preprocessor defines the following symbols:"
15516         $cat Cppsym.true
15517         ccsymbols=''
15518         cppsymbols=`$cat Cppsym.true`
15519         cppsymbols=`echo $cppsymbols`
15520         cppccsymbols="$cppsymbols"
15521 else
15522         if $test -s ccsym.com; then
15523                 echo "Your C compiler and pre-processor define these symbols:"
15524                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15525                 also='also '
15526                 symbols='ones'
15527                 cppccsymbols=`$cat ccsym.com`
15528                 cppccsymbols=`echo $cppccsymbols`
15529                 $test "$silent" || sleep 1
15530         fi
15531         if $test -s ccsym.cpp; then
15532                 $test "$also" && echo " "
15533                 echo "Your C pre-processor ${also}defines the following symbols:"
15534                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15535                 also='further '
15536                 cppsymbols=`$cat ccsym.cpp`
15537                 cppsymbols=`echo $cppsymbols`
15538                 $test "$silent" || sleep 1
15539         fi
15540         if $test -s ccsym.own; then
15541                 $test "$also" && echo " "
15542                 echo "Your C compiler ${also}defines the following cpp symbols:"
15543                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15544                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15545                 ccsymbols=`$cat ccsym.own`
15546                 ccsymbols=`echo $ccsymbols`
15547                 $test "$silent" || sleep 1
15548         fi
15549 fi
15550 $rm -f ccsym* Cppsym.*
15551
15552 : see if this is a termio system
15553 val="$undef"
15554 val2="$undef"
15555 val3="$undef"
15556 if $test `./findhdr termios.h`; then
15557         set tcsetattr i_termios
15558         eval $inlibc
15559         val3="$i_termios"
15560 fi
15561 echo " "
15562 case "$val3" in
15563 "$define") echo "You have POSIX termios.h... good!" >&4;;
15564 *) if ./Cppsym pyr; then
15565                 case "`/bin/universe`" in
15566                 ucb) if $test `./findhdr sgtty.h`; then
15567                                 val2="$define"
15568                                 echo "<sgtty.h> found." >&4
15569                         else
15570                                 echo "System is pyramid with BSD universe."
15571                                 echo "<sgtty.h> not found--you could have problems." >&4
15572                         fi;;
15573                 *) if $test `./findhdr termio.h`; then
15574                                 val="$define"
15575                                 echo "<termio.h> found." >&4
15576                         else
15577                                 echo "System is pyramid with USG universe."
15578                                 echo "<termio.h> not found--you could have problems." >&4
15579                         fi;;
15580                 esac
15581         elif ./usg; then
15582                 if $test `./findhdr termio.h`; then
15583                         echo "<termio.h> found." >&4
15584                         val="$define"
15585                 elif $test `./findhdr sgtty.h`; then
15586                         echo "<sgtty.h> found." >&4
15587                         val2="$define"
15588                 else
15589 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15590                 fi
15591         else
15592                 if $test `./findhdr sgtty.h`; then
15593                         echo "<sgtty.h> found." >&4
15594                         val2="$define"
15595                 elif $test `./findhdr termio.h`; then
15596                         echo "<termio.h> found." >&4
15597                         val="$define"
15598                 else
15599 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15600                 fi
15601         fi;;
15602 esac
15603 set i_termio; eval $setvar
15604 val=$val2; set i_sgtty; eval $setvar
15605 val=$val3; set i_termios; eval $setvar
15606
15607 : see if this is a shadow.h system
15608 set shadow.h i_shadow
15609 eval $inhdr
15610
15611 : see if stddef is available
15612 set stddef.h i_stddef
15613 eval $inhdr
15614
15615 : see if this is a sunmath.h system
15616 set sunmath.h i_sunmath
15617 eval $inhdr
15618
15619 : see if sys/access.h is available
15620 set sys/access.h i_sysaccess
15621 eval $inhdr
15622
15623 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15624 set sys/filio.h i_sysfilio
15625 eval $inhdr
15626 echo " "
15627 if $test `./findhdr sys/ioctl.h`; then
15628         val="$define"
15629         echo '<sys/ioctl.h> found.' >&4
15630 else
15631         val="$undef"
15632         if $test $i_sysfilio = "$define"; then
15633             echo '<sys/ioctl.h> NOT found.' >&4
15634         else
15635                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15636                 $test $i_termio = "$define" && xxx="termio.h"
15637                 $test $i_termios = "$define" && xxx="termios.h"
15638 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15639         fi
15640 fi
15641 set i_sysioctl
15642 eval $setvar
15643
15644 : see if socket ioctl defs are in sys/sockio.h
15645 echo " "
15646 xxx=`./findhdr sys/sockio.h`
15647 if $test "$xxx"; then
15648         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15649                 val="$define"
15650                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15651         else
15652                 val="$undef"
15653                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15654         fi
15655 else
15656         val="$undef"
15657         $cat <<EOM
15658 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15659 EOM
15660 fi
15661 set i_syssockio
15662 eval $setvar
15663
15664
15665 : see if this is a syslog.h system
15666 set syslog.h i_syslog
15667 eval $inhdr
15668
15669
15670 : see if this is a sys/mode.h system
15671 set sys/mode.h i_sysmode
15672 eval $inhdr
15673
15674 : see if sys/resource.h has to be included
15675 set sys/resource.h i_sysresrc
15676 eval $inhdr
15677
15678 : see if sys/security.h is available
15679 set sys/security.h i_syssecrt
15680 eval $inhdr
15681
15682 : see if this is a sys/statvfs.h system
15683 set sys/statvfs.h i_sysstatvfs
15684 eval $inhdr
15685
15686 : see if this is a sys/un.h system
15687 set sys/un.h i_sysun
15688 eval $inhdr
15689
15690
15691 : see if this is a sys/utsname.h system
15692 set sys/utsname.h i_sysutsname
15693 eval $inhdr
15694
15695 : see if this is a syswait system
15696 set sys/wait.h i_syswait
15697 eval $inhdr
15698
15699 : see if this is a ustat.h system
15700 set ustat.h i_ustat
15701 eval $inhdr
15702
15703 : see if this is an utime system
15704 set utime.h i_utime
15705 eval $inhdr
15706
15707 : see if this is a values.h system
15708 set values.h i_values
15709 eval $inhdr
15710
15711 : see if this is a vfork system
15712 case "$d_vfork" in
15713 "$define")
15714         set vfork.h i_vfork
15715         eval $inhdr
15716         ;;
15717 *)
15718         i_vfork="$undef"
15719         ;;
15720 esac
15721
15722 : see if gdbm.h is available
15723 set gdbm.h t_gdbm
15724 eval $inhdr
15725 case "$t_gdbm" in
15726 $define)
15727         : see if gdbm_open exists
15728         set gdbm_open d_gdbm_open
15729         eval $inlibc
15730         case "$d_gdbm_open" in
15731         $undef)
15732                 t_gdbm="$undef"
15733                 echo "We won't be including <gdbm.h>"
15734                 ;;
15735         esac
15736         ;;
15737 esac
15738 val="$t_gdbm"
15739 set i_gdbm
15740 eval $setvar
15741
15742 echo " "
15743 echo "Looking for extensions..." >&4
15744 : If we are using the old config.sh, known_extensions may contain
15745 : old or inaccurate or duplicate values.
15746 known_extensions=''
15747 nonxs_extensions=''
15748 : We do not use find because it might not be available.
15749 : We do not just use MANIFEST because the user may have dropped
15750 : some additional extensions into the source tree and expect them
15751 : to be built.
15752
15753 : Function to recursively find available extensions, ignoring DynaLoader
15754 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15755 find_extensions='
15756     for xxx in *; do
15757        case "$xxx" in
15758            DynaLoader|dynaload) ;;
15759            *)
15760            if $test -f $xxx/$xxx.xs; then
15761                known_extensions="$known_extensions $1$xxx";
15762            elif $test -f $xxx/Makefile.PL; then
15763                nonxs_extensions="$nonxs_extensions $1$xxx";
15764            else
15765                if $test -d $xxx -a $# -lt 10; then
15766                    set $1$xxx/ $*;
15767                    cd $xxx;
15768                    eval $find_extensions;
15769                    cd ..;
15770                    shift;
15771                fi;
15772            fi
15773            ;;
15774        esac;
15775     done'
15776 tdir=`pwd`
15777 cd $rsrc/ext
15778 set X
15779 shift
15780 eval $find_extensions
15781 set X $nonxs_extensions
15782 shift
15783 nonxs_extensions="$*"
15784 set X $known_extensions
15785 shift
15786 known_extensions="$*"
15787 cd $tdir
15788
15789 : Now see which are supported on this system.
15790 avail_ext=''
15791 for xxx in $known_extensions ; do
15792         case "$xxx" in
15793         DB_File|db_file)
15794                 case "$i_db" in
15795                 $define) avail_ext="$avail_ext $xxx" ;;
15796                 esac
15797                 ;;
15798         GDBM_File|gdbm_fil)
15799                 case "$i_gdbm" in 
15800                 $define) avail_ext="$avail_ext $xxx" ;;
15801                 esac
15802                 ;;
15803         NDBM_File|ndbm_fil)
15804                 case "$i_ndbm" in
15805                 $define)
15806                     case "$osname-$use64bitint" in
15807                     hpux-define)
15808                         case "$libs" in
15809                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15810                         esac
15811                         ;;
15812                     *) avail_ext="$avail_ext $xxx" ;;
15813                     esac
15814                     ;;
15815                 esac
15816                 ;;
15817         ODBM_File|odbm_fil) 
15818                 case "${i_dbm}${i_rpcsvcdbm}" in
15819                 *"${define}"*)
15820                     case "$osname-$use64bitint" in
15821                     hpux-define)
15822                         case "$libs" in
15823                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15824                         esac
15825                         ;;
15826                     *) avail_ext="$avail_ext $xxx" ;;
15827                     esac
15828                     ;;
15829                 esac
15830                 ;;
15831         POSIX|posix)
15832                 case "$useposix" in
15833                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15834                 esac
15835                 ;;
15836         Opcode|opcode)
15837                 case "$useopcode" in
15838                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15839                 esac
15840                 ;;
15841         Socket|socket)
15842                 case "$d_socket" in 
15843                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15844                 esac
15845                 ;;
15846         Sys/Syslog|sys/syslog)
15847                 : XXX syslog requires socket
15848                 case "$d_socket" in 
15849                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15850                 esac
15851                 ;;
15852         Thread|thread)
15853                 case "$usethreads" in 
15854                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15855                 esac
15856                 ;;
15857         IPC/SysV|ipc/sysv)
15858                 : XXX Do we need a useipcsysv variable here
15859                 case "${d_msg}${d_sem}${d_shm}" in 
15860                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15861                 esac
15862                 ;;
15863         *)      avail_ext="$avail_ext $xxx"
15864                 ;;
15865         esac
15866 done
15867
15868 set X $avail_ext
15869 shift
15870 avail_ext="$*"
15871
15872 : Now see which nonxs extensions are supported on this system.
15873 : For now assume all are.
15874 nonxs_ext=''
15875 for xxx in $nonxs_extensions ; do
15876         case "$xxx" in
15877         *)      nonxs_ext="$nonxs_ext $xxx"
15878                 ;;
15879         esac
15880 done
15881
15882 set X $nonxs_ext
15883 shift
15884 nonxs_ext="$*"
15885
15886 case $usedl in
15887 $define)
15888         $cat <<EOM
15889 A number of extensions are supplied with $package.  You may choose to
15890 compile these extensions for dynamic loading (the default), compile
15891 them into the $package executable (static loading), or not include
15892 them at all.  Answer "none" to include no extensions.
15893 Note that DynaLoader is always built and need not be mentioned here.
15894
15895 EOM
15896         case "$dynamic_ext" in
15897         '') dflt="$avail_ext" ;;
15898         *)      dflt="$dynamic_ext"
15899                 # Perhaps we are reusing an old out-of-date config.sh.
15900                 case "$hint" in
15901                 previous)
15902                         if test X"$dynamic_ext" != X"$avail_ext"; then
15903                                 $cat <<EOM
15904 NOTICE:  Your previous config.sh list may be incorrect. 
15905 The extensions now available to you are 
15906         ${avail_ext}
15907 but the default list from your previous config.sh is
15908         ${dynamic_ext} 
15909
15910 EOM
15911                         fi
15912                         ;;
15913                 esac
15914                 ;;
15915         esac
15916         case "$dflt" in
15917         '')     dflt=none;;
15918         esac
15919         rp="What extensions do you wish to load dynamically?"
15920         . ./myread
15921         case "$ans" in
15922         none) dynamic_ext=' ' ;;
15923         *) dynamic_ext="$ans" ;;
15924         esac
15925
15926         case "$static_ext" in
15927         '')
15928                 : Exclude those already listed in dynamic linking
15929                 dflt=''
15930                 for xxx in $avail_ext; do
15931                         case " $dynamic_ext " in
15932                         *" $xxx "*) ;;
15933                         *) dflt="$dflt $xxx" ;;
15934                         esac
15935                 done
15936                 set X $dflt
15937                 shift
15938                 dflt="$*"
15939                 ;;
15940         *)  dflt="$static_ext" 
15941                 ;;
15942         esac
15943
15944         case "$dflt" in
15945         '')     dflt=none;;
15946         esac
15947         rp="What extensions do you wish to load statically?"
15948         . ./myread
15949         case "$ans" in
15950         none) static_ext=' ' ;;
15951         *) static_ext="$ans" ;;
15952         esac
15953         ;;
15954 *)
15955         $cat <<EOM
15956 A number of extensions are supplied with $package.  Answer "none" 
15957 to include no extensions. 
15958 Note that DynaLoader is always built and need not be mentioned here.
15959
15960 EOM
15961         case "$static_ext" in
15962         '') dflt="$avail_ext" ;;
15963         *)      dflt="$static_ext"
15964                 # Perhaps we are reusing an old out-of-date config.sh.
15965                 case "$hint" in
15966                 previous)
15967                         if test X"$static_ext" != X"$avail_ext"; then
15968                                 $cat <<EOM
15969 NOTICE:  Your previous config.sh list may be incorrect. 
15970 The extensions now available to you are 
15971         ${avail_ext}
15972 but the default list from your previous config.sh is
15973         ${static_ext} 
15974
15975 EOM
15976                         fi
15977                         ;;
15978                 esac
15979                 ;;
15980         esac
15981         : Exclude those that are not xs extensions
15982         case "$dflt" in
15983         '')     dflt=none;;
15984         esac
15985         rp="What extensions do you wish to include?"
15986         . ./myread
15987         case "$ans" in
15988         none) static_ext=' ' ;;
15989         *) static_ext="$ans" ;;
15990         esac
15991         ;;
15992 esac
15993
15994 set X $dynamic_ext $static_ext $nonxs_ext
15995 shift
15996 extensions="$*"
15997
15998 : Remove libraries needed only for extensions
15999 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16000 : The exception is SunOS 4.x, which needs them.
16001 case "${osname}X${osvers}" in
16002 sunos*X4*)
16003     perllibs="$libs"
16004     ;;
16005 *) case "$usedl" in
16006     $define|true|[yY]*)
16007             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16008             shift
16009             perllibs="$*"
16010             ;;
16011     *)  perllibs="$libs"
16012             ;;
16013     esac
16014     ;;
16015 esac
16016
16017 : Remove build directory name from cppstdin so it can be used from
16018 : either the present location or the final installed location.
16019 echo " "
16020 : Get out of the UU directory to get correct path name.
16021 cd ..
16022 case "$cppstdin" in
16023 `pwd`/cppstdin)
16024         echo "Stripping down cppstdin path name"
16025         cppstdin=cppstdin
16026         ;;
16027 esac
16028 cd UU
16029
16030 : end of configuration questions
16031 echo " "
16032 echo "End of configuration questions."
16033 echo " "
16034
16035 : back to where it started
16036 if test -d ../UU; then
16037         cd ..
16038 fi
16039
16040 : configuration may be patched via a 'config.over' file
16041 if $test -f config.over; then
16042         echo " "
16043         dflt=y
16044         rp='I see a config.over file.  Do you wish to load it?'
16045         . UU/myread
16046         case "$ans" in
16047         n*) echo "OK, I'll ignore it.";;
16048         *)      . ./config.over
16049                 echo "Configuration override changes have been loaded."
16050                 ;;
16051         esac
16052 fi
16053
16054 : in case they want portability, strip down executable paths
16055 case "$d_portable" in
16056 "$define")
16057         echo " "
16058         echo "Stripping down executable paths..." >&4
16059         for file in $loclist $trylist; do
16060                 eval temp=\$$file
16061                 eval $file=`basename $temp`
16062         done
16063         ;;
16064 esac
16065
16066 : create config.sh file
16067 echo " "
16068 echo "Creating config.sh..." >&4
16069 $spitshell <<EOT >config.sh
16070 $startsh
16071 #
16072 # This file was produced by running the Configure script. It holds all the
16073 # definitions figured out by Configure. Should you modify one of these values,
16074 # do not forget to propagate your changes by running "Configure -der". You may
16075 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16076 #
16077
16078 # Package name      : $package
16079 # Source directory  : $src
16080 # Configuration time: $cf_time
16081 # Configured by     : $cf_by
16082 # Target system     : $myuname
16083
16084 Author='$Author'
16085 Date='$Date'
16086 Header='$Header'
16087 Id='$Id'
16088 Locker='$Locker'
16089 Log='$Log'
16090 Mcc='$Mcc'
16091 RCSfile='$RCSfile'
16092 Revision='$Revision'
16093 Source='$Source'
16094 State='$State'
16095 _a='$_a'
16096 _exe='$_exe'
16097 _o='$_o'
16098 afs='$afs'
16099 alignbytes='$alignbytes'
16100 ansi2knr='$ansi2knr'
16101 aphostname='$aphostname'
16102 api_revision='$api_revision'
16103 api_subversion='$api_subversion'
16104 api_version='$api_version'
16105 api_versionstring='$api_versionstring'
16106 ar='$ar'
16107 archlib='$archlib'
16108 archlibexp='$archlibexp'
16109 archname64='$archname64'
16110 archname='$archname'
16111 archobjs='$archobjs'
16112 awk='$awk'
16113 baserev='$baserev'
16114 bash='$bash'
16115 bin='$bin'
16116 bincompat5005='$bincompat5005'
16117 binexp='$binexp'
16118 bison='$bison'
16119 byacc='$byacc'
16120 byteorder='$byteorder'
16121 c='$c'
16122 castflags='$castflags'
16123 cat='$cat'
16124 cc='$cc'
16125 cccdlflags='$cccdlflags'
16126 ccdlflags='$ccdlflags'
16127 ccflags='$ccflags'
16128 ccflags_uselargefiles='$ccflags_uselargefiles'
16129 ccname='$ccname'
16130 ccsymbols='$ccsymbols'
16131 ccversion='$ccversion'
16132 cf_by='$cf_by'
16133 cf_email='$cf_email'
16134 cf_time='$cf_time'
16135 charsize='$charsize'
16136 chgrp='$chgrp'
16137 chmod='$chmod'
16138 chown='$chown'
16139 clocktype='$clocktype'
16140 comm='$comm'
16141 compress='$compress'
16142 contains='$contains'
16143 cp='$cp'
16144 cpio='$cpio'
16145 cpp='$cpp'
16146 cpp_stuff='$cpp_stuff'
16147 cppccsymbols='$cppccsymbols'
16148 cppflags='$cppflags'
16149 cpplast='$cpplast'
16150 cppminus='$cppminus'
16151 cpprun='$cpprun'
16152 cppstdin='$cppstdin'
16153 cppsymbols='$cppsymbols'
16154 crosscompile='$crosscompile'
16155 cryptlib='$cryptlib'
16156 csh='$csh'
16157 d_Gconvert='$d_Gconvert'
16158 d_PRIEUldbl='$d_PRIEUldbl'
16159 d_PRIFUldbl='$d_PRIFUldbl'
16160 d_PRIGUldbl='$d_PRIGUldbl'
16161 d_PRIXU64='$d_PRIXU64'
16162 d_PRId64='$d_PRId64'
16163 d_PRIeldbl='$d_PRIeldbl'
16164 d_PRIfldbl='$d_PRIfldbl'
16165 d_PRIgldbl='$d_PRIgldbl'
16166 d_PRIi64='$d_PRIi64'
16167 d_PRIo64='$d_PRIo64'
16168 d_PRIu64='$d_PRIu64'
16169 d_PRIx64='$d_PRIx64'
16170 d_SCNfldbl='$d_SCNfldbl'
16171 d__fwalk='$d__fwalk'
16172 d_access='$d_access'
16173 d_accessx='$d_accessx'
16174 d_alarm='$d_alarm'
16175 d_archlib='$d_archlib'
16176 d_atolf='$d_atolf'
16177 d_atoll='$d_atoll'
16178 d_attribut='$d_attribut'
16179 d_bcmp='$d_bcmp'
16180 d_bcopy='$d_bcopy'
16181 d_bincompat5005='$d_bincompat5005'
16182 d_bsd='$d_bsd'
16183 d_bsdgetpgrp='$d_bsdgetpgrp'
16184 d_bsdsetpgrp='$d_bsdsetpgrp'
16185 d_bzero='$d_bzero'
16186 d_casti32='$d_casti32'
16187 d_castneg='$d_castneg'
16188 d_charvspr='$d_charvspr'
16189 d_chown='$d_chown'
16190 d_chroot='$d_chroot'
16191 d_chsize='$d_chsize'
16192 d_closedir='$d_closedir'
16193 d_cmsghdr_s='$d_cmsghdr_s'
16194 d_const='$d_const'
16195 d_crypt='$d_crypt'
16196 d_csh='$d_csh'
16197 d_cuserid='$d_cuserid'
16198 d_dbl_dig='$d_dbl_dig'
16199 d_difftime='$d_difftime'
16200 d_dirnamlen='$d_dirnamlen'
16201 d_dlerror='$d_dlerror'
16202 d_dlopen='$d_dlopen'
16203 d_dlsymun='$d_dlsymun'
16204 d_dosuid='$d_dosuid'
16205 d_drand48proto='$d_drand48proto'
16206 d_dup2='$d_dup2'
16207 d_eaccess='$d_eaccess'
16208 d_endgrent='$d_endgrent'
16209 d_endhent='$d_endhent'
16210 d_endnent='$d_endnent'
16211 d_endpent='$d_endpent'
16212 d_endpwent='$d_endpwent'
16213 d_endsent='$d_endsent'
16214 d_eofnblk='$d_eofnblk'
16215 d_eunice='$d_eunice'
16216 d_fchmod='$d_fchmod'
16217 d_fchown='$d_fchown'
16218 d_fcntl='$d_fcntl'
16219 d_fcntl_can_lock='$d_fcntl_can_lock'
16220 d_fd_macros='$d_fd_macros'
16221 d_fd_set='$d_fd_set'
16222 d_fds_bits='$d_fds_bits'
16223 d_fgetpos='$d_fgetpos'
16224 d_flexfnam='$d_flexfnam'
16225 d_flock='$d_flock'
16226 d_fork='$d_fork'
16227 d_fpathconf='$d_fpathconf'
16228 d_fpos64_t='$d_fpos64_t'
16229 d_frexpl='$d_frexpl'
16230 d_fs_data_s='$d_fs_data_s'
16231 d_fseeko='$d_fseeko'
16232 d_fsetpos='$d_fsetpos'
16233 d_fstatfs='$d_fstatfs'
16234 d_fstatvfs='$d_fstatvfs'
16235 d_fsync='$d_fsync'
16236 d_ftello='$d_ftello'
16237 d_ftime='$d_ftime'
16238 d_getcwd='$d_getcwd'
16239 d_getespwnam='$d_getespwnam'
16240 d_getfsstat='$d_getfsstat'
16241 d_getgrent='$d_getgrent'
16242 d_getgrps='$d_getgrps'
16243 d_gethbyaddr='$d_gethbyaddr'
16244 d_gethbyname='$d_gethbyname'
16245 d_gethent='$d_gethent'
16246 d_gethname='$d_gethname'
16247 d_gethostprotos='$d_gethostprotos'
16248 d_getitimer='$d_getitimer'
16249 d_getlogin='$d_getlogin'
16250 d_getmnt='$d_getmnt'
16251 d_getmntent='$d_getmntent'
16252 d_getnbyaddr='$d_getnbyaddr'
16253 d_getnbyname='$d_getnbyname'
16254 d_getnent='$d_getnent'
16255 d_getnetprotos='$d_getnetprotos'
16256 d_getpagsz='$d_getpagsz'
16257 d_getpbyname='$d_getpbyname'
16258 d_getpbynumber='$d_getpbynumber'
16259 d_getpent='$d_getpent'
16260 d_getpgid='$d_getpgid'
16261 d_getpgrp2='$d_getpgrp2'
16262 d_getpgrp='$d_getpgrp'
16263 d_getppid='$d_getppid'
16264 d_getprior='$d_getprior'
16265 d_getprotoprotos='$d_getprotoprotos'
16266 d_getprpwnam='$d_getprpwnam'
16267 d_getpwent='$d_getpwent'
16268 d_getsbyname='$d_getsbyname'
16269 d_getsbyport='$d_getsbyport'
16270 d_getsent='$d_getsent'
16271 d_getservprotos='$d_getservprotos'
16272 d_getspnam='$d_getspnam'
16273 d_gettimeod='$d_gettimeod'
16274 d_gnulibc='$d_gnulibc'
16275 d_grpasswd='$d_grpasswd'
16276 d_hasmntopt='$d_hasmntopt'
16277 d_htonl='$d_htonl'
16278 d_iconv='$d_iconv'
16279 d_index='$d_index'
16280 d_inetaton='$d_inetaton'
16281 d_int64_t='$d_int64_t'
16282 d_isascii='$d_isascii'
16283 d_isnan='$d_isnan'
16284 d_isnanl='$d_isnanl'
16285 d_killpg='$d_killpg'
16286 d_lchown='$d_lchown'
16287 d_ldbl_dig='$d_ldbl_dig'
16288 d_link='$d_link'
16289 d_locconv='$d_locconv'
16290 d_lockf='$d_lockf'
16291 d_longdbl='$d_longdbl'
16292 d_longlong='$d_longlong'
16293 d_lseekproto='$d_lseekproto'
16294 d_lstat='$d_lstat'
16295 d_madvise='$d_madvise'
16296 d_mblen='$d_mblen'
16297 d_mbstowcs='$d_mbstowcs'
16298 d_mbtowc='$d_mbtowc'
16299 d_memchr='$d_memchr'
16300 d_memcmp='$d_memcmp'
16301 d_memcpy='$d_memcpy'
16302 d_memmove='$d_memmove'
16303 d_memset='$d_memset'
16304 d_mkdir='$d_mkdir'
16305 d_mkdtemp='$d_mkdtemp'
16306 d_mkfifo='$d_mkfifo'
16307 d_mkstemp='$d_mkstemp'
16308 d_mkstemps='$d_mkstemps'
16309 d_mktime='$d_mktime'
16310 d_mmap='$d_mmap'
16311 d_modfl='$d_modfl'
16312 d_mprotect='$d_mprotect'
16313 d_msg='$d_msg'
16314 d_msg_ctrunc='$d_msg_ctrunc'
16315 d_msg_dontroute='$d_msg_dontroute'
16316 d_msg_oob='$d_msg_oob'
16317 d_msg_peek='$d_msg_peek'
16318 d_msg_proxy='$d_msg_proxy'
16319 d_msgctl='$d_msgctl'
16320 d_msgget='$d_msgget'
16321 d_msghdr_s='$d_msghdr_s'
16322 d_msgrcv='$d_msgrcv'
16323 d_msgsnd='$d_msgsnd'
16324 d_msync='$d_msync'
16325 d_munmap='$d_munmap'
16326 d_mymalloc='$d_mymalloc'
16327 d_nice='$d_nice'
16328 d_nv_preserves_uv='$d_nv_preserves_uv'
16329 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16330 d_off64_t='$d_off64_t'
16331 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16332 d_oldpthreads='$d_oldpthreads'
16333 d_oldsock='$d_oldsock'
16334 d_open3='$d_open3'
16335 d_pathconf='$d_pathconf'
16336 d_pause='$d_pause'
16337 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16338 d_phostname='$d_phostname'
16339 d_pipe='$d_pipe'
16340 d_poll='$d_poll'
16341 d_portable='$d_portable'
16342 d_pthread_yield='$d_pthread_yield'
16343 d_pwage='$d_pwage'
16344 d_pwchange='$d_pwchange'
16345 d_pwclass='$d_pwclass'
16346 d_pwcomment='$d_pwcomment'
16347 d_pwexpire='$d_pwexpire'
16348 d_pwgecos='$d_pwgecos'
16349 d_pwpasswd='$d_pwpasswd'
16350 d_pwquota='$d_pwquota'
16351 d_qgcvt='$d_qgcvt'
16352 d_quad='$d_quad'
16353 d_readdir='$d_readdir'
16354 d_readlink='$d_readlink'
16355 d_readv='$d_readv'
16356 d_recvmsg='$d_recvmsg'
16357 d_rename='$d_rename'
16358 d_rewinddir='$d_rewinddir'
16359 d_rmdir='$d_rmdir'
16360 d_safebcpy='$d_safebcpy'
16361 d_safemcpy='$d_safemcpy'
16362 d_sanemcmp='$d_sanemcmp'
16363 d_sbrkproto='$d_sbrkproto'
16364 d_sched_yield='$d_sched_yield'
16365 d_scm_rights='$d_scm_rights'
16366 d_seekdir='$d_seekdir'
16367 d_select='$d_select'
16368 d_sem='$d_sem'
16369 d_semctl='$d_semctl'
16370 d_semctl_semid_ds='$d_semctl_semid_ds'
16371 d_semctl_semun='$d_semctl_semun'
16372 d_semget='$d_semget'
16373 d_semop='$d_semop'
16374 d_sendmsg='$d_sendmsg'
16375 d_setegid='$d_setegid'
16376 d_seteuid='$d_seteuid'
16377 d_setgrent='$d_setgrent'
16378 d_setgrps='$d_setgrps'
16379 d_sethent='$d_sethent'
16380 d_setitimer='$d_setitimer'
16381 d_setlinebuf='$d_setlinebuf'
16382 d_setlocale='$d_setlocale'
16383 d_setnent='$d_setnent'
16384 d_setpent='$d_setpent'
16385 d_setpgid='$d_setpgid'
16386 d_setpgrp2='$d_setpgrp2'
16387 d_setpgrp='$d_setpgrp'
16388 d_setprior='$d_setprior'
16389 d_setproctitle='$d_setproctitle'
16390 d_setpwent='$d_setpwent'
16391 d_setregid='$d_setregid'
16392 d_setresgid='$d_setresgid'
16393 d_setresuid='$d_setresuid'
16394 d_setreuid='$d_setreuid'
16395 d_setrgid='$d_setrgid'
16396 d_setruid='$d_setruid'
16397 d_setsent='$d_setsent'
16398 d_setsid='$d_setsid'
16399 d_setvbuf='$d_setvbuf'
16400 d_sfio='$d_sfio'
16401 d_shm='$d_shm'
16402 d_shmat='$d_shmat'
16403 d_shmatprototype='$d_shmatprototype'
16404 d_shmctl='$d_shmctl'
16405 d_shmdt='$d_shmdt'
16406 d_shmget='$d_shmget'
16407 d_sigaction='$d_sigaction'
16408 d_sigprocmask='$d_sigprocmask'
16409 d_sigsetjmp='$d_sigsetjmp'
16410 d_sockatmark='$d_sockatmark'
16411 d_socket='$d_socket'
16412 d_socklen_t='$d_socklen_t'
16413 d_sockpair='$d_sockpair'
16414 d_socks5_init='$d_socks5_init'
16415 d_sqrtl='$d_sqrtl'
16416 d_statblks='$d_statblks'
16417 d_statfs_f_flags='$d_statfs_f_flags'
16418 d_statfs_s='$d_statfs_s'
16419 d_statvfs='$d_statvfs'
16420 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16421 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16422 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16423 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16424 d_stdio_stream_array='$d_stdio_stream_array'
16425 d_stdiobase='$d_stdiobase'
16426 d_stdstdio='$d_stdstdio'
16427 d_strchr='$d_strchr'
16428 d_strcoll='$d_strcoll'
16429 d_strctcpy='$d_strctcpy'
16430 d_strerrm='$d_strerrm'
16431 d_strerror='$d_strerror'
16432 d_strftime='$d_strftime'
16433 d_strtod='$d_strtod'
16434 d_strtol='$d_strtol'
16435 d_strtold='$d_strtold'
16436 d_strtoll='$d_strtoll'
16437 d_strtoq='$d_strtoq'
16438 d_strtoul='$d_strtoul'
16439 d_strtoull='$d_strtoull'
16440 d_strtouq='$d_strtouq'
16441 d_strxfrm='$d_strxfrm'
16442 d_suidsafe='$d_suidsafe'
16443 d_symlink='$d_symlink'
16444 d_syscall='$d_syscall'
16445 d_sysconf='$d_sysconf'
16446 d_sysernlst='$d_sysernlst'
16447 d_syserrlst='$d_syserrlst'
16448 d_system='$d_system'
16449 d_tcgetpgrp='$d_tcgetpgrp'
16450 d_tcsetpgrp='$d_tcsetpgrp'
16451 d_telldir='$d_telldir'
16452 d_telldirproto='$d_telldirproto'
16453 d_time='$d_time'
16454 d_times='$d_times'
16455 d_truncate='$d_truncate'
16456 d_tzname='$d_tzname'
16457 d_u32align='$d_u32align'
16458 d_ualarm='$d_ualarm'
16459 d_umask='$d_umask'
16460 d_uname='$d_uname'
16461 d_union_semun='$d_union_semun'
16462 d_usleep='$d_usleep'
16463 d_ustat='$d_ustat'
16464 d_vendorarch='$d_vendorarch'
16465 d_vendorbin='$d_vendorbin'
16466 d_vendorlib='$d_vendorlib'
16467 d_vfork='$d_vfork'
16468 d_void_closedir='$d_void_closedir'
16469 d_voidsig='$d_voidsig'
16470 d_voidtty='$d_voidtty'
16471 d_volatile='$d_volatile'
16472 d_vprintf='$d_vprintf'
16473 d_wait4='$d_wait4'
16474 d_waitpid='$d_waitpid'
16475 d_wcstombs='$d_wcstombs'
16476 d_wctomb='$d_wctomb'
16477 d_writev='$d_writev'
16478 d_xenix='$d_xenix'
16479 date='$date'
16480 db_hashtype='$db_hashtype'
16481 db_prefixtype='$db_prefixtype'
16482 defvoidused='$defvoidused'
16483 direntrytype='$direntrytype'
16484 dlext='$dlext'
16485 dlsrc='$dlsrc'
16486 doublesize='$doublesize'
16487 drand01='$drand01'
16488 dynamic_ext='$dynamic_ext'
16489 eagain='$eagain'
16490 ebcdic='$ebcdic'
16491 echo='$echo'
16492 egrep='$egrep'
16493 emacs='$emacs'
16494 eunicefix='$eunicefix'
16495 exe_ext='$exe_ext'
16496 expr='$expr'
16497 extensions='$extensions'
16498 fflushNULL='$fflushNULL'
16499 fflushall='$fflushall'
16500 find='$find'
16501 firstmakefile='$firstmakefile'
16502 flex='$flex'
16503 fpossize='$fpossize'
16504 fpostype='$fpostype'
16505 freetype='$freetype'
16506 full_ar='$full_ar'
16507 full_csh='$full_csh'
16508 full_sed='$full_sed'
16509 gccosandvers='$gccosandvers'
16510 gccversion='$gccversion'
16511 gidformat='$gidformat'
16512 gidsign='$gidsign'
16513 gidsize='$gidsize'
16514 gidtype='$gidtype'
16515 glibpth='$glibpth'
16516 grep='$grep'
16517 groupcat='$groupcat'
16518 groupstype='$groupstype'
16519 gzip='$gzip'
16520 h_fcntl='$h_fcntl'
16521 h_sysfile='$h_sysfile'
16522 hint='$hint'
16523 hostcat='$hostcat'
16524 i16size='$i16size'
16525 i16type='$i16type'
16526 i32size='$i32size'
16527 i32type='$i32type'
16528 i64size='$i64size'
16529 i64type='$i64type'
16530 i8size='$i8size'
16531 i8type='$i8type'
16532 i_arpainet='$i_arpainet'
16533 i_bsdioctl='$i_bsdioctl'
16534 i_db='$i_db'
16535 i_dbm='$i_dbm'
16536 i_dirent='$i_dirent'
16537 i_dld='$i_dld'
16538 i_dlfcn='$i_dlfcn'
16539 i_fcntl='$i_fcntl'
16540 i_float='$i_float'
16541 i_gdbm='$i_gdbm'
16542 i_grp='$i_grp'
16543 i_iconv='$i_iconv'
16544 i_ieeefp='$i_ieeefp'
16545 i_inttypes='$i_inttypes'
16546 i_libutil='$i_libutil'
16547 i_limits='$i_limits'
16548 i_locale='$i_locale'
16549 i_machcthr='$i_machcthr'
16550 i_malloc='$i_malloc'
16551 i_math='$i_math'
16552 i_memory='$i_memory'
16553 i_mntent='$i_mntent'
16554 i_ndbm='$i_ndbm'
16555 i_netdb='$i_netdb'
16556 i_neterrno='$i_neterrno'
16557 i_netinettcp='$i_netinettcp'
16558 i_niin='$i_niin'
16559 i_poll='$i_poll'
16560 i_prot='$i_prot'
16561 i_pthread='$i_pthread'
16562 i_pwd='$i_pwd'
16563 i_rpcsvcdbm='$i_rpcsvcdbm'
16564 i_sfio='$i_sfio'
16565 i_sgtty='$i_sgtty'
16566 i_shadow='$i_shadow'
16567 i_socks='$i_socks'
16568 i_stdarg='$i_stdarg'
16569 i_stddef='$i_stddef'
16570 i_stdlib='$i_stdlib'
16571 i_string='$i_string'
16572 i_sunmath='$i_sunmath'
16573 i_sysaccess='$i_sysaccess'
16574 i_sysdir='$i_sysdir'
16575 i_sysfile='$i_sysfile'
16576 i_sysfilio='$i_sysfilio'
16577 i_sysin='$i_sysin'
16578 i_sysioctl='$i_sysioctl'
16579 i_syslog='$i_syslog'
16580 i_sysmman='$i_sysmman'
16581 i_sysmode='$i_sysmode'
16582 i_sysmount='$i_sysmount'
16583 i_sysndir='$i_sysndir'
16584 i_sysparam='$i_sysparam'
16585 i_sysresrc='$i_sysresrc'
16586 i_syssecrt='$i_syssecrt'
16587 i_sysselct='$i_sysselct'
16588 i_syssockio='$i_syssockio'
16589 i_sysstat='$i_sysstat'
16590 i_sysstatfs='$i_sysstatfs'
16591 i_sysstatvfs='$i_sysstatvfs'
16592 i_systime='$i_systime'
16593 i_systimek='$i_systimek'
16594 i_systimes='$i_systimes'
16595 i_systypes='$i_systypes'
16596 i_sysuio='$i_sysuio'
16597 i_sysun='$i_sysun'
16598 i_sysutsname='$i_sysutsname'
16599 i_sysvfs='$i_sysvfs'
16600 i_syswait='$i_syswait'
16601 i_termio='$i_termio'
16602 i_termios='$i_termios'
16603 i_time='$i_time'
16604 i_unistd='$i_unistd'
16605 i_ustat='$i_ustat'
16606 i_utime='$i_utime'
16607 i_values='$i_values'
16608 i_varargs='$i_varargs'
16609 i_varhdr='$i_varhdr'
16610 i_vfork='$i_vfork'
16611 ignore_versioned_solibs='$ignore_versioned_solibs'
16612 inc_version_list='$inc_version_list'
16613 inc_version_list_init='$inc_version_list_init'
16614 incpath='$incpath'
16615 inews='$inews'
16616 installarchlib='$installarchlib'
16617 installbin='$installbin'
16618 installman1dir='$installman1dir'
16619 installman3dir='$installman3dir'
16620 installprefix='$installprefix'
16621 installprefixexp='$installprefixexp'
16622 installprivlib='$installprivlib'
16623 installscript='$installscript'
16624 installsitearch='$installsitearch'
16625 installsitebin='$installsitebin'
16626 installsitelib='$installsitelib'
16627 installstyle='$installstyle'
16628 installusrbinperl='$installusrbinperl'
16629 installvendorarch='$installvendorarch'
16630 installvendorbin='$installvendorbin'
16631 installvendorlib='$installvendorlib'
16632 intsize='$intsize'
16633 issymlink='$issymlink'
16634 ivdformat='$ivdformat'
16635 ivsize='$ivsize'
16636 ivtype='$ivtype'
16637 known_extensions='$known_extensions'
16638 ksh='$ksh'
16639 ld='$ld'
16640 lddlflags='$lddlflags'
16641 ldflags='$ldflags'
16642 ldflags_uselargefiles='$ldflags_uselargefiles'
16643 ldlibpthname='$ldlibpthname'
16644 less='$less'
16645 lib_ext='$lib_ext'
16646 libc='$libc'
16647 libperl='$libperl'
16648 libpth='$libpth'
16649 libs='$libs'
16650 libsdirs='$libsdirs'
16651 libsfiles='$libsfiles'
16652 libsfound='$libsfound'
16653 libspath='$libspath'
16654 libswanted='$libswanted'
16655 libswanted_uselargefiles='$libswanted_uselargefiles'
16656 line='$line'
16657 lint='$lint'
16658 lkflags='$lkflags'
16659 ln='$ln'
16660 lns='$lns'
16661 locincpth='$locincpth'
16662 loclibpth='$loclibpth'
16663 longdblsize='$longdblsize'
16664 longlongsize='$longlongsize'
16665 longsize='$longsize'
16666 lp='$lp'
16667 lpr='$lpr'
16668 ls='$ls'
16669 lseeksize='$lseeksize'
16670 lseektype='$lseektype'
16671 mail='$mail'
16672 mailx='$mailx'
16673 make='$make'
16674 make_set_make='$make_set_make'
16675 mallocobj='$mallocobj'
16676 mallocsrc='$mallocsrc'
16677 malloctype='$malloctype'
16678 man1dir='$man1dir'
16679 man1direxp='$man1direxp'
16680 man1ext='$man1ext'
16681 man3dir='$man3dir'
16682 man3direxp='$man3direxp'
16683 man3ext='$man3ext'
16684 mips_type='$mips_type'
16685 mkdir='$mkdir'
16686 mmaptype='$mmaptype'
16687 modetype='$modetype'
16688 more='$more'
16689 multiarch='$multiarch'
16690 mv='$mv'
16691 myarchname='$myarchname'
16692 mydomain='$mydomain'
16693 myhostname='$myhostname'
16694 myuname='$myuname'
16695 n='$n'
16696 need_va_copy='$need_va_copy'
16697 netdb_hlen_type='$netdb_hlen_type'
16698 netdb_host_type='$netdb_host_type'
16699 netdb_name_type='$netdb_name_type'
16700 netdb_net_type='$netdb_net_type'
16701 nm='$nm'
16702 nm_opt='$nm_opt'
16703 nm_so_opt='$nm_so_opt'
16704 nonxs_ext='$nonxs_ext'
16705 nroff='$nroff'
16706 nvEUformat='$nvEUformat'
16707 nvFUformat='$nvFUformat'
16708 nvGUformat='$nvGUformat'
16709 nveformat='$nveformat'
16710 nvfformat='$nvfformat'
16711 nvgformat='$nvgformat'
16712 nvsize='$nvsize'
16713 nvtype='$nvtype'
16714 o_nonblock='$o_nonblock'
16715 obj_ext='$obj_ext'
16716 old_pthread_create_joinable='$old_pthread_create_joinable'
16717 optimize='$optimize'
16718 orderlib='$orderlib'
16719 osname='$osname'
16720 osvers='$osvers'
16721 otherlibdirs='$otherlibdirs'
16722 package='$package'
16723 pager='$pager'
16724 passcat='$passcat'
16725 patchlevel='$patchlevel'
16726 path_sep='$path_sep'
16727 perl5='$perl5'
16728 perl='$perl'
16729 perl_patchlevel='$perl_patchlevel'
16730 perladmin='$perladmin'
16731 perllibs='$perllibs'
16732 perlpath='$perlpath'
16733 pg='$pg'
16734 phostname='$phostname'
16735 pidtype='$pidtype'
16736 plibpth='$plibpth'
16737 pm_apiversion='$pm_apiversion'
16738 pmake='$pmake'
16739 pr='$pr'
16740 prefix='$prefix'
16741 prefixexp='$prefixexp'
16742 privlib='$privlib'
16743 privlibexp='$privlibexp'
16744 prototype='$prototype'
16745 ptrsize='$ptrsize'
16746 quadkind='$quadkind'
16747 quadtype='$quadtype'
16748 randbits='$randbits'
16749 randfunc='$randfunc'
16750 randseedtype='$randseedtype'
16751 ranlib='$ranlib'
16752 rd_nodata='$rd_nodata'
16753 revision='$revision'
16754 rm='$rm'
16755 rmail='$rmail'
16756 runnm='$runnm'
16757 sPRIEUldbl='$sPRIEUldbl'
16758 sPRIFUldbl='$sPRIFUldbl'
16759 sPRIGUldbl='$sPRIGUldbl'
16760 sPRIXU64='$sPRIXU64'
16761 sPRId64='$sPRId64'
16762 sPRIeldbl='$sPRIeldbl'
16763 sPRIfldbl='$sPRIfldbl'
16764 sPRIgldbl='$sPRIgldbl'
16765 sPRIi64='$sPRIi64'
16766 sPRIo64='$sPRIo64'
16767 sPRIu64='$sPRIu64'
16768 sPRIx64='$sPRIx64'
16769 sSCNfldbl='$sSCNfldbl'
16770 sched_yield='$sched_yield'
16771 scriptdir='$scriptdir'
16772 scriptdirexp='$scriptdirexp'
16773 sed='$sed'
16774 seedfunc='$seedfunc'
16775 selectminbits='$selectminbits'
16776 selecttype='$selecttype'
16777 sendmail='$sendmail'
16778 sh='$sh'
16779 shar='$shar'
16780 sharpbang='$sharpbang'
16781 shmattype='$shmattype'
16782 shortsize='$shortsize'
16783 shrpenv='$shrpenv'
16784 shsharp='$shsharp'
16785 sig_count='$sig_count'
16786 sig_name='$sig_name'
16787 sig_name_init='$sig_name_init'
16788 sig_num='$sig_num'
16789 sig_num_init='$sig_num_init'
16790 sig_size='$sig_size'
16791 signal_t='$signal_t'
16792 sitearch='$sitearch'
16793 sitearchexp='$sitearchexp'
16794 sitebin='$sitebin'
16795 sitebinexp='$sitebinexp'
16796 sitelib='$sitelib'
16797 sitelib_stem='$sitelib_stem'
16798 sitelibexp='$sitelibexp'
16799 siteprefix='$siteprefix'
16800 siteprefixexp='$siteprefixexp'
16801 sizesize='$sizesize'
16802 sizetype='$sizetype'
16803 sleep='$sleep'
16804 smail='$smail'
16805 so='$so'
16806 sockethdr='$sockethdr'
16807 socketlib='$socketlib'
16808 socksizetype='$socksizetype'
16809 sort='$sort'
16810 spackage='$spackage'
16811 spitshell='$spitshell'
16812 src='$src'
16813 ssizetype='$ssizetype'
16814 startperl='$startperl'
16815 startsh='$startsh'
16816 static_ext='$static_ext'
16817 stdchar='$stdchar'
16818 stdio_base='$stdio_base'
16819 stdio_bufsiz='$stdio_bufsiz'
16820 stdio_cnt='$stdio_cnt'
16821 stdio_filbuf='$stdio_filbuf'
16822 stdio_ptr='$stdio_ptr'
16823 stdio_stream_array='$stdio_stream_array'
16824 strings='$strings'
16825 submit='$submit'
16826 subversion='$subversion'
16827 sysman='$sysman'
16828 tail='$tail'
16829 tar='$tar'
16830 tbl='$tbl'
16831 tee='$tee'
16832 test='$test'
16833 timeincl='$timeincl'
16834 timetype='$timetype'
16835 touch='$touch'
16836 tr='$tr'
16837 trnl='$trnl'
16838 troff='$troff'
16839 u16size='$u16size'
16840 u16type='$u16type'
16841 u32size='$u32size'
16842 u32type='$u32type'
16843 u64size='$u64size'
16844 u64type='$u64type'
16845 u8size='$u8size'
16846 u8type='$u8type'
16847 uidformat='$uidformat'
16848 uidsign='$uidsign'
16849 uidsize='$uidsize'
16850 uidtype='$uidtype'
16851 uname='$uname'
16852 uniq='$uniq'
16853 uquadtype='$uquadtype'
16854 use5005threads='$use5005threads'
16855 use64bitall='$use64bitall'
16856 use64bitint='$use64bitint'
16857 usedl='$usedl'
16858 useithreads='$useithreads'
16859 uselargefiles='$uselargefiles'
16860 uselongdouble='$uselongdouble'
16861 usemorebits='$usemorebits'
16862 usemultiplicity='$usemultiplicity'
16863 usemymalloc='$usemymalloc'
16864 usenm='$usenm'
16865 useopcode='$useopcode'
16866 useperlio='$useperlio'
16867 useposix='$useposix'
16868 usesfio='$usesfio'
16869 useshrplib='$useshrplib'
16870 usesocks='$usesocks'
16871 usethreads='$usethreads'
16872 usevendorprefix='$usevendorprefix'
16873 usevfork='$usevfork'
16874 usrinc='$usrinc'
16875 uuname='$uuname'
16876 uvXUformat='$uvXUformat'
16877 uvoformat='$uvoformat'
16878 uvsize='$uvsize'
16879 uvtype='$uvtype'
16880 uvuformat='$uvuformat'
16881 uvxformat='$uvxformat'
16882 vendorarch='$vendorarch'
16883 vendorarchexp='$vendorarchexp'
16884 vendorbin='$vendorbin'
16885 vendorbinexp='$vendorbinexp'
16886 vendorlib='$vendorlib'
16887 vendorlib_stem='$vendorlib_stem'
16888 vendorlibexp='$vendorlibexp'
16889 vendorprefix='$vendorprefix'
16890 vendorprefixexp='$vendorprefixexp'
16891 version='$version'
16892 versiononly='$versiononly'
16893 vi='$vi'
16894 voidflags='$voidflags'
16895 xlibpth='$xlibpth'
16896 xs_apiversion='$xs_apiversion'
16897 yacc='$yacc'
16898 yaccflags='$yaccflags'
16899 zcat='$zcat'
16900 zip='$zip'
16901 EOT
16902
16903 : Add in command line options if available
16904 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16905
16906 : add special variables
16907 $test -f $src/patchlevel.h && \
16908 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16909 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
16910 echo "PERL_CONFIG_SH=true" >>config.sh
16911
16912 : propagate old symbols
16913 if $test -f UU/config.sh; then
16914         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16915         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16916         $sort | $uniq -u >UU/oldsyms
16917         set X `cat UU/oldsyms`
16918         shift
16919         case $# in
16920         0) ;;
16921         *)
16922                 cat <<EOM
16923 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16924 EOM
16925                 echo "# Variables propagated from previous config.sh file." >>config.sh
16926                 for sym in `cat UU/oldsyms`; do
16927                         echo "    Propagating $hint variable "'$'"$sym..."
16928                         eval 'tmp="$'"${sym}"'"'
16929                         echo "$tmp" | \
16930                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16931                 done
16932                 ;;
16933         esac
16934 fi
16935
16936 : Finish up by extracting the .SH files
16937 case "$alldone" in
16938 exit)
16939         $rm -rf UU
16940         echo "Done."
16941         exit 0
16942         ;;
16943 cont)
16944         ;;
16945 '')
16946         dflt=''
16947         nostick=true
16948         $cat <<EOM
16949
16950 If you'd like to make any changes to the config.sh file before I begin
16951 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16952
16953 EOM
16954         rp="Press return or use a shell escape to edit config.sh:"
16955         . UU/myread
16956         nostick=''
16957         case "$ans" in
16958         '') ;;
16959         *) : in case they cannot read
16960                 sh 1>&4 -c "$ans";;
16961         esac
16962         ;;
16963 esac
16964
16965 : if this fails, just run all the .SH files by hand
16966 . ./config.sh
16967
16968 echo " "
16969 exec 1>&4
16970 . ./UU/extract
16971
16972 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16973         dflt=y
16974         case "$silent" in
16975         true) ;;
16976         *)
16977                 $cat <<EOM
16978
16979 Now you need to generate make dependencies by running "$make depend".
16980 You might prefer to run it in background: "$make depend > makedepend.out &"
16981 It can take a while, so you might not want to run it right now.
16982
16983 EOM
16984                 ;;
16985         esac
16986         rp="Run $make depend now?"
16987         . UU/myread
16988         case "$ans" in
16989         y*)
16990                 $make depend && echo "Now you must run '$make'."
16991                 ;;
16992         *)
16993                 echo "You must run '$make depend' then '$make'."
16994                 ;;
16995         esac
16996 elif test -f [Mm]akefile; then
16997         echo " "
16998         echo "Now you must run a $make."
16999 else
17000         echo "Done."
17001 fi
17002
17003 if $test -f Policy.sh; then
17004     $cat <<EOM
17005
17006 If you compile $package on a different machine or from a different object
17007 directory, copy the Policy.sh file from this object directory to the
17008 new one before you run Configure -- this will help you with most of
17009 the policy defaults.
17010
17011 EOM
17012 fi
17013 if $test -f config.msg; then
17014     echo "Hmm.  I also noted the following information while running:"
17015     echo " "
17016     $cat config.msg >&4
17017     $rm -f config.msg
17018 fi
17019 $rm -f kit*isdone ark*isdone
17020 $rm -rf UU
17021
17022 : End of Configure
17023