Extraction of the *.SH wasn't quite working with -Dmksymlinks.
[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 Jun  5 04:50:23 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 afsroot=''
277 alignbytes=''
278 ansi2knr=''
279 archlib=''
280 archlibexp=''
281 d_archlib=''
282 installarchlib=''
283 archname=''
284 myarchname=''
285 d_atolf=''
286 d_atoll=''
287 baserev=''
288 bin=''
289 binexp=''
290 installbin=''
291 bincompat5005=''
292 d_bincompat5005=''
293 byteorder=''
294 cc=''
295 ccflags=''
296 cppflags=''
297 ldflags=''
298 lkflags=''
299 locincpth=''
300 optimize=''
301 cf_email=''
302 cf_by=''
303 cf_time=''
304 charsize=''
305 contains=''
306 cpp_stuff=''
307 cpplast=''
308 cppminus=''
309 cpprun=''
310 cppstdin=''
311 crosscompile=''
312 d__fwalk=''
313 d_access=''
314 d_accessx=''
315 d_alarm=''
316 d_attribut=''
317 d_bcmp=''
318 d_bcopy=''
319 d_bzero=''
320 d_casti32=''
321 castflags=''
322 d_castneg=''
323 d_chown=''
324 d_chroot=''
325 d_chsize=''
326 d_closedir=''
327 d_void_closedir=''
328 d_cmsghdr_s=''
329 d_const=''
330 cryptlib=''
331 d_crypt=''
332 d_csh=''
333 full_csh=''
334 d_cuserid=''
335 d_dbl_dig=''
336 d_dbminitproto=''
337 d_difftime=''
338 d_dlerror=''
339 d_dlopen=''
340 d_dlsymun=''
341 d_dosuid=''
342 d_suidsafe=''
343 d_drand48proto=''
344 d_dup2=''
345 d_eaccess=''
346 d_endgrent=''
347 d_endhent=''
348 d_endnent=''
349 d_endpent=''
350 d_endpwent=''
351 d_endsent=''
352 d_fchmod=''
353 d_fchown=''
354 d_fcntl=''
355 d_fcntl_can_lock=''
356 d_fd_macros=''
357 d_fd_set=''
358 d_fds_bits=''
359 d_fgetpos=''
360 d_flexfnam=''
361 d_flock=''
362 d_flockproto=''
363 d_fork=''
364 d_fpos64_t=''
365 d_frexpl=''
366 d_fs_data_s=''
367 d_fseeko=''
368 d_fsetpos=''
369 d_fstatfs=''
370 d_fsync=''
371 d_ftello=''
372 d_ftime=''
373 d_gettimeod=''
374 d_Gconvert=''
375 d_getcwd=''
376 d_getespwnam=''
377 d_getfsstat=''
378 d_getgrent=''
379 d_getgrps=''
380 d_gethbyaddr=''
381 d_gethbyname=''
382 d_gethent=''
383 aphostname=''
384 d_gethname=''
385 d_phostname=''
386 d_uname=''
387 d_gethostprotos=''
388 d_getitimer=''
389 d_getlogin=''
390 d_getmnt=''
391 d_getmntent=''
392 d_getnbyaddr=''
393 d_getnbyname=''
394 d_getnent=''
395 d_getnetprotos=''
396 d_getpagsz=''
397 d_getpent=''
398 d_getpgid=''
399 d_getpgrp2=''
400 d_bsdgetpgrp=''
401 d_getpgrp=''
402 d_getppid=''
403 d_getprior=''
404 d_getpbyname=''
405 d_getpbynumber=''
406 d_getprotoprotos=''
407 d_getprpwnam=''
408 d_getpwent=''
409 d_getsent=''
410 d_getservprotos=''
411 d_getspnam=''
412 d_getsbyname=''
413 d_getsbyport=''
414 d_gnulibc=''
415 d_hasmntopt=''
416 d_htonl=''
417 d_iconv=''
418 d_inetaton=''
419 d_int64_t=''
420 d_isascii=''
421 d_isnan=''
422 d_isnanl=''
423 d_killpg=''
424 d_lchown=''
425 d_ldbl_dig=''
426 d_link=''
427 d_locconv=''
428 d_lockf=''
429 d_longdbl=''
430 longdblsize=''
431 d_longlong=''
432 longlongsize=''
433 d_lseekproto=''
434 d_lstat=''
435 d_madvise=''
436 d_mblen=''
437 d_mbstowcs=''
438 d_mbtowc=''
439 d_memchr=''
440 d_memcmp=''
441 d_memcpy=''
442 d_memmove=''
443 d_memset=''
444 d_mkdir=''
445 d_mkdtemp=''
446 d_mkfifo=''
447 d_mkstemp=''
448 d_mkstemps=''
449 d_mktime=''
450 d_mmap=''
451 mmaptype=''
452 d_modfl=''
453 d_mprotect=''
454 d_msg=''
455 d_msgctl=''
456 d_msgget=''
457 d_msghdr_s=''
458 d_msgrcv=''
459 d_msgsnd=''
460 d_msync=''
461 d_munmap=''
462 d_nice=''
463 d_off64_t=''
464 d_open3=''
465 d_fpathconf=''
466 d_pathconf=''
467 d_pause=''
468 d_pipe=''
469 d_poll=''
470 d_portable=''
471 d_old_pthread_create_joinable=''
472 old_pthread_create_joinable=''
473 d_pthread_yield=''
474 d_sched_yield=''
475 sched_yield=''
476 d_qgcvt=''
477 d_readdir=''
478 d_rewinddir=''
479 d_seekdir=''
480 d_telldir=''
481 d_readlink=''
482 d_readv=''
483 d_realpath=''
484 d_recvmsg=''
485 d_rename=''
486 d_rmdir=''
487 d_safebcpy=''
488 d_safemcpy=''
489 d_sanemcmp=''
490 d_sbrkproto=''
491 d_select=''
492 d_sem=''
493 d_semctl=''
494 d_semget=''
495 d_semop=''
496 d_sendmsg=''
497 d_setegid=''
498 d_seteuid=''
499 d_setgrent=''
500 d_setgrps=''
501 d_sethent=''
502 d_setitimer=''
503 d_setlinebuf=''
504 d_setlocale=''
505 d_setnent=''
506 d_setpent=''
507 d_setpgid=''
508 d_setpgrp2=''
509 d_bsdsetpgrp=''
510 d_setpgrp=''
511 d_setprior=''
512 d_setproctitle=''
513 d_setpwent=''
514 d_setregid=''
515 d_setresgid=''
516 d_setresuid=''
517 d_setreuid=''
518 d_setrgid=''
519 d_setruid=''
520 d_setsent=''
521 d_setsid=''
522 d_setvbuf=''
523 d_sfio=''
524 usesfio=''
525 d_shm=''
526 d_shmat=''
527 d_shmatprototype=''
528 shmattype=''
529 d_shmctl=''
530 d_shmdt=''
531 d_shmget=''
532 d_sigaction=''
533 d_sigprocmask=''
534 d_sigsetjmp=''
535 d_sockatmark=''
536 d_sockatmarkproto=''
537 d_msg_ctrunc=''
538 d_msg_dontroute=''
539 d_msg_oob=''
540 d_msg_peek=''
541 d_msg_proxy=''
542 d_oldsock=''
543 d_scm_rights=''
544 d_socket=''
545 d_sockpair=''
546 sockethdr=''
547 socketlib=''
548 d_socklen_t=''
549 d_socks5_init=''
550 d_sqrtl=''
551 d_sresgproto=''
552 d_sresuproto=''
553 d_statblks=''
554 d_statfs_f_flags=''
555 d_statfs_s=''
556 d_fstatvfs=''
557 d_statvfs=''
558 d_stdio_cnt_lval=''
559 d_stdio_ptr_lval=''
560 d_stdio_ptr_lval_nochange_cnt=''
561 d_stdio_ptr_lval_sets_cnt=''
562 d_stdiobase=''
563 d_stdstdio=''
564 stdio_base=''
565 stdio_bufsiz=''
566 stdio_cnt=''
567 stdio_filbuf=''
568 stdio_ptr=''
569 d_index=''
570 d_strchr=''
571 d_strcoll=''
572 d_strctcpy=''
573 d_strerrm=''
574 d_strerror=''
575 d_sysernlst=''
576 d_syserrlst=''
577 d_strftime=''
578 d_strtod=''
579 d_strtol=''
580 d_strtold=''
581 d_strtoll=''
582 d_strtoq=''
583 d_strtoul=''
584 d_strtoull=''
585 d_strtouq=''
586 d_strxfrm=''
587 d_symlink=''
588 d_syscall=''
589 d_syscallproto=''
590 d_sysconf=''
591 d_system=''
592 d_tcgetpgrp=''
593 d_tcsetpgrp=''
594 d_telldirproto=''
595 d_time=''
596 timetype=''
597 clocktype=''
598 d_times=''
599 d_truncate=''
600 d_tzname=''
601 d_u32align=''
602 d_ualarm=''
603 d_umask=''
604 d_semctl_semid_ds=''
605 d_semctl_semun=''
606 d_union_semun=''
607 d_usleep=''
608 d_usleepproto=''
609 d_ustat=''
610 d_vfork=''
611 usevfork=''
612 d_voidsig=''
613 signal_t=''
614 d_volatile=''
615 d_charvspr=''
616 d_vprintf=''
617 d_wait4=''
618 d_waitpid=''
619 d_wcstombs=''
620 d_wctomb=''
621 d_writev=''
622 dlext=''
623 cccdlflags=''
624 ccdlflags=''
625 dlsrc=''
626 ld=''
627 lddlflags=''
628 usedl=''
629 doublesize=''
630 ebcdic=''
631 fflushNULL=''
632 fflushall=''
633 fpossize=''
634 fpostype=''
635 gccosandvers=''
636 gccversion=''
637 gidformat=''
638 gidsign=''
639 gidsize=''
640 gidtype=''
641 groupstype=''
642 h_fcntl=''
643 h_sysfile=''
644 i_arpainet=''
645 db_hashtype=''
646 db_prefixtype=''
647 db_version_major=''
648 db_version_minor=''
649 db_version_patch=''
650 i_db=''
651 i_dbm=''
652 i_rpcsvcdbm=''
653 d_dirnamlen=''
654 direntrytype=''
655 i_dirent=''
656 i_dld=''
657 i_dlfcn=''
658 i_fcntl=''
659 i_float=''
660 i_gdbm=''
661 d_grpasswd=''
662 i_grp=''
663 i_iconv=''
664 i_ieeefp=''
665 i_inttypes=''
666 i_libutil=''
667 i_limits=''
668 i_locale=''
669 i_machcthr=''
670 i_malloc=''
671 i_math=''
672 i_memory=''
673 i_mntent=''
674 i_ndbm=''
675 i_netdb=''
676 i_neterrno=''
677 i_netinettcp=''
678 i_niin=''
679 i_sysin=''
680 i_poll=''
681 i_prot=''
682 i_pthread=''
683 d_pwage=''
684 d_pwchange=''
685 d_pwclass=''
686 d_pwcomment=''
687 d_pwexpire=''
688 d_pwgecos=''
689 d_pwpasswd=''
690 d_pwquota=''
691 i_pwd=''
692 i_sfio=''
693 i_shadow=''
694 i_socks=''
695 i_stddef=''
696 i_stdlib=''
697 i_string=''
698 strings=''
699 i_sunmath=''
700 i_sysaccess=''
701 i_sysdir=''
702 i_sysfile=''
703 d_voidtty=''
704 i_bsdioctl=''
705 i_sysfilio=''
706 i_sysioctl=''
707 i_syssockio=''
708 i_syslog=''
709 i_sysmman=''
710 i_sysmode=''
711 i_sysmount=''
712 i_sysndir=''
713 i_sysparam=''
714 i_sysresrc=''
715 i_syssecrt=''
716 i_sysselct=''
717 i_sysstat=''
718 i_sysstatfs=''
719 i_sysstatvfs=''
720 i_systimes=''
721 i_systypes=''
722 i_sysuio=''
723 i_sysun=''
724 i_sysutsname=''
725 i_sysvfs=''
726 i_syswait=''
727 i_sgtty=''
728 i_termio=''
729 i_termios=''
730 i_systime=''
731 i_systimek=''
732 i_time=''
733 timeincl=''
734 i_unistd=''
735 i_ustat=''
736 i_utime=''
737 i_values=''
738 i_stdarg=''
739 i_varargs=''
740 i_varhdr=''
741 i_vfork=''
742 inc_version_list=''
743 inc_version_list_init=''
744 installprefix=''
745 installprefixexp=''
746 installstyle=''
747 installusrbinperl=''
748 intsize=''
749 longsize=''
750 shortsize=''
751 issymlink=''
752 libc=''
753 ldlibpthname=''
754 libperl=''
755 shrpenv=''
756 useshrplib=''
757 glibpth=''
758 libpth=''
759 loclibpth=''
760 plibpth=''
761 xlibpth=''
762 ignore_versioned_solibs=''
763 libs=''
764 libsdirs=''
765 libsfiles=''
766 libsfound=''
767 libspath=''
768 lns=''
769 d_PRIEUldbl=''
770 d_PRIFUldbl=''
771 d_PRIGUldbl=''
772 d_PRIeldbl=''
773 d_PRIfldbl=''
774 d_PRIgldbl=''
775 d_SCNfldbl=''
776 sPRIEUldbl=''
777 sPRIFUldbl=''
778 sPRIGUldbl=''
779 sPRIeldbl=''
780 sPRIfldbl=''
781 sPRIgldbl=''
782 sSCNfldbl=''
783 lseeksize=''
784 lseektype=''
785 make_set_make=''
786 d_mymalloc=''
787 freetype=''
788 mallocobj=''
789 mallocsrc=''
790 malloctype=''
791 usemymalloc=''
792 installman1dir=''
793 man1dir=''
794 man1direxp=''
795 man1ext=''
796 installman3dir=''
797 man3dir=''
798 man3direxp=''
799 man3ext=''
800 modetype=''
801 multiarch=''
802 mydomain=''
803 myhostname=''
804 phostname=''
805 c=''
806 n=''
807 d_eofnblk=''
808 eagain=''
809 o_nonblock=''
810 rd_nodata=''
811 need_va_copy=''
812 netdb_hlen_type=''
813 netdb_host_type=''
814 netdb_name_type=''
815 netdb_net_type=''
816 groupcat=''
817 hostcat=''
818 passcat=''
819 orderlib=''
820 ranlib=''
821 d_perl_otherlibdirs=''
822 otherlibdirs=''
823 package=''
824 spackage=''
825 pager=''
826 api_revision=''
827 api_subversion=''
828 api_version=''
829 api_versionstring=''
830 patchlevel=''
831 perl_patchlevel=''
832 revision=''
833 subversion=''
834 version=''
835 perl5=''
836 perladmin=''
837 perlpath=''
838 d_nv_preserves_uv=''
839 d_nv_preserves_uv_bits=''
840 i16size=''
841 i16type=''
842 i32size=''
843 i32type=''
844 i64size=''
845 i64type=''
846 i8size=''
847 i8type=''
848 ivsize=''
849 ivtype=''
850 nvsize=''
851 nvtype=''
852 u16size=''
853 u16type=''
854 u32size=''
855 u32type=''
856 u64size=''
857 u64type=''
858 u8size=''
859 u8type=''
860 uvsize=''
861 uvtype=''
862 ivdformat=''
863 nvEUformat=''
864 nvFUformat=''
865 nvGUformat=''
866 nveformat=''
867 nvfformat=''
868 nvgformat=''
869 uvXUformat=''
870 uvoformat=''
871 uvuformat=''
872 uvxformat=''
873 pidtype=''
874 prefix=''
875 prefixexp=''
876 installprivlib=''
877 privlib=''
878 privlibexp=''
879 prototype=''
880 ptrsize=''
881 d_PRIXU64=''
882 d_PRId64=''
883 d_PRIi64=''
884 d_PRIo64=''
885 d_PRIu64=''
886 d_PRIx64=''
887 sPRIXU64=''
888 sPRId64=''
889 sPRIi64=''
890 sPRIo64=''
891 sPRIu64=''
892 sPRIx64=''
893 d_quad=''
894 quadkind=''
895 quadtype=''
896 uquadtype=''
897 drand01=''
898 randbits=''
899 randfunc=''
900 randseedtype=''
901 seedfunc=''
902 installscript=''
903 scriptdir=''
904 scriptdirexp=''
905 selectminbits=''
906 selecttype=''
907 sh=''
908 sig_count=''
909 sig_name=''
910 sig_name_init=''
911 sig_num=''
912 sig_num_init=''
913 sig_size=''
914 installsitearch=''
915 sitearch=''
916 sitearchexp=''
917 installsitebin=''
918 sitebin=''
919 sitebinexp=''
920 installsitelib=''
921 sitelib=''
922 sitelib_stem=''
923 sitelibexp=''
924 siteprefix=''
925 siteprefixexp=''
926 sizesize=''
927 sizetype=''
928 so=''
929 socksizetype=''
930 sharpbang=''
931 shsharp=''
932 spitshell=''
933 src=''
934 ssizetype=''
935 startperl=''
936 startsh=''
937 stdchar=''
938 d_stdio_stream_array=''
939 stdio_stream_array=''
940 sysman=''
941 trnl=''
942 uidformat=''
943 uidsign=''
944 uidsize=''
945 uidtype=''
946 archname64=''
947 use64bitall=''
948 use64bitint=''
949 ccflags_uselargefiles=''
950 ldflags_uselargefiles=''
951 libswanted_uselargefiles=''
952 uselargefiles=''
953 uselongdouble=''
954 usemorebits=''
955 usemultiplicity=''
956 nm_opt=''
957 nm_so_opt=''
958 runnm=''
959 usenm=''
960 useperlio=''
961 usesocks=''
962 d_oldpthreads=''
963 use5005threads=''
964 useithreads=''
965 usethreads=''
966 incpath=''
967 mips_type=''
968 usrinc=''
969 d_vendorarch=''
970 installvendorarch=''
971 vendorarch=''
972 vendorarchexp=''
973 d_vendorbin=''
974 installvendorbin=''
975 vendorbin=''
976 vendorbinexp=''
977 d_vendorlib=''
978 installvendorlib=''
979 vendorlib=''
980 vendorlib_stem=''
981 vendorlibexp=''
982 usevendorprefix=''
983 vendorprefix=''
984 vendorprefixexp=''
985 versiononly=''
986 defvoidused=''
987 voidflags=''
988 pm_apiversion=''
989 xs_apiversion=''
990 yacc=''
991 yaccflags=''
992 CONFIG=''
993
994 define='define'
995 undef='undef'
996 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
997 rmlist=''
998
999 : We must find out about Eunice early
1000 eunicefix=':'
1001 if test -f /etc/unixtovms; then
1002         eunicefix=/etc/unixtovms
1003 fi
1004 if test -f /etc/unixtovms.exe; then
1005         eunicefix=/etc/unixtovms.exe
1006 fi
1007
1008 i_whoami=''
1009 ccname=''
1010 ccversion=''
1011 perllibs=''
1012 : set useposix=false in your hint file to disable the POSIX extension.
1013 useposix=true
1014 : set useopcode=false in your hint file to disable the Opcode extension.
1015 useopcode=true
1016 : Trailing extension.  Override this in a hint file, if needed.
1017 _exe=''
1018 : Extra object files, if any, needed on this platform.
1019 archobjs=''
1020 archname=''
1021 : Possible local include directories to search.
1022 : Set locincpth to "" in a hint file to defeat local include searches.
1023 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1024 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1025 :
1026 : no include file wanted by default
1027 inclwanted=''
1028
1029 groupstype=''
1030 : change the next line if compiling for Xenix/286 on Xenix/386
1031 xlibpth='/usr/lib/386 /lib/386'
1032 : Possible local library directories to search.
1033 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1034 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1035
1036 : general looking path for locating libraries
1037 glibpth="/lib /usr/lib $xlibpth"
1038 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1039 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1040 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1041
1042 : Private path used by Configure to find libraries.  Its value
1043 : is prepended to libpth. This variable takes care of special
1044 : machines, like the mips.  Usually, it should be empty.
1045 plibpth=''
1046
1047 : default library list
1048 libswanted=''
1049 : some systems want to use only the non-versioned libso:s
1050 ignore_versioned_solibs=''
1051 archname64=''
1052 ccflags_uselargefiles=''
1053 ldflags_uselargefiles=''
1054 libswanted_uselargefiles=''
1055 : set usemultiplicity on the Configure command line to enable multiplicity.
1056 : set usesocks on the Configure command line to enable socks.
1057 : set usethreads on the Configure command line to enable threads.
1058 : full support for void wanted by default
1059 defvoidused=15
1060
1061 : List of libraries we want.
1062 : If anyone needs -lnet, put it in a hint file.
1063 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1064 libswanted="$libswanted dld ld sun m c cposix posix"
1065 libswanted="$libswanted ndir dir crypt sec"
1066 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1067 : We probably want to search /usr/shlib before most other libraries.
1068 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1069 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1070 glibpth="/usr/shlib $glibpth"
1071 : Do not use vfork unless overridden by a hint file.
1072 usevfork=false
1073
1074 : Find the basic shell for Bourne shell scripts
1075 case "$sh" in
1076 '')
1077         case "$SYSTYPE" in
1078         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1079         *) xxx='/bin/sh';;
1080         esac
1081         if test -f "$xxx"; then
1082                 sh="$xxx"
1083         else
1084                 : Build up a list and do a single loop so we can 'break' out.
1085                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1086                 for xxx in sh bash ksh pdksh ash; do
1087                         for p in $pth; do
1088                                 try="$try ${p}/${xxx}"
1089                         done
1090                 done
1091                 for xxx in $try; do
1092                         if test -f "$xxx"; then
1093                                 sh="$xxx";
1094                                 break
1095                         elif test -f "$xxx.exe"; then
1096                                 sh="$xxx";
1097                                 break
1098                         fi
1099                 done
1100         fi
1101         ;;
1102 esac
1103
1104 case "$sh" in
1105 '')     cat <<EOM >&2
1106 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1107
1108 Usually it's in /bin/sh.  How did you even get this far?
1109 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1110 we'll try to straighten this all out.
1111 EOM
1112         exit 1
1113         ;;
1114 esac
1115
1116 : see if sh knows # comments
1117 if `$sh -c '#' >/dev/null 2>&1`; then
1118         shsharp=true
1119         spitshell=cat
1120         xcat=/bin/cat
1121         test -f $xcat || xcat=/usr/bin/cat
1122         echo "#!$xcat" >try
1123         $eunicefix try
1124         chmod +x try
1125         ./try > today
1126         if test -s today; then
1127                 sharpbang='#!'
1128         else
1129                 echo "#! $xcat" > try
1130                 $eunicefix try
1131                 chmod +x try
1132                 ./try > today
1133                 if test -s today; then
1134                         sharpbang='#! '
1135                 else
1136                         sharpbang=': use '
1137                 fi
1138         fi
1139 else
1140         echo " "
1141         echo "Your $sh doesn't grok # comments--I will strip them later on."
1142         shsharp=false
1143         cd ..
1144         echo "exec grep -v '^[  ]*#'" >spitshell
1145         chmod +x spitshell
1146         $eunicefix spitshell
1147         spitshell=`pwd`/spitshell
1148         cd UU
1149         echo "I presume that if # doesn't work, #! won't work either!"
1150         sharpbang=': use '
1151 fi
1152 rm -f try today
1153
1154 : figure out how to guarantee sh startup
1155 case "$startsh" in
1156 '') startsh=${sharpbang}${sh} ;;
1157 *)
1158 esac
1159 cat >try <<EOSS
1160 $startsh
1161 set abc
1162 test "$?abc" != 1
1163 EOSS
1164
1165 chmod +x try
1166 $eunicefix try
1167 if ./try; then
1168         : echo "Yup, it does."
1169 else
1170         echo "Hmm... '$startsh' does not guarantee sh startup..."
1171         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1172 fi
1173 rm -f try
1174
1175
1176 : Save command line options in file UU/cmdline.opt for later use in
1177 : generating config.sh.
1178 cat > cmdline.opt <<EOSH
1179 # Configure command line arguments.
1180 config_arg0='$0'
1181 config_args='$*'
1182 config_argc=$#
1183 EOSH
1184 argn=1
1185 for arg in "$@"; do
1186         cat >>cmdline.opt <<EOSH
1187 config_arg$argn='$arg'
1188 EOSH
1189         argn=`expr $argn + 1`
1190 done
1191
1192 : produce awk script to parse command line options
1193 cat >options.awk <<'EOF'
1194 BEGIN {
1195         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1196
1197         len = length(optstr);
1198         for (i = 1; i <= len; i++) {
1199                 c = substr(optstr, i, 1);
1200                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1201                 if (a == ":") {
1202                         arg[c] = 1;
1203                         i++;
1204                 }
1205                 opt[c] = 1;
1206         }
1207 }
1208 {
1209         expect = 0;
1210         str = $0;
1211         if (substr(str, 1, 1) != "-") {
1212                 printf("'%s'\n", str);
1213                 next;
1214         }
1215         len = length($0);
1216         for (i = 2; i <= len; i++) {
1217                 c = substr(str, i, 1);
1218                 if (!opt[c]) {
1219                         printf("-%s\n", substr(str, i));
1220                         next;
1221                 }
1222                 printf("-%s\n", c);
1223                 if (arg[c]) {
1224                         if (i < len)
1225                                 printf("'%s'\n", substr(str, i + 1));
1226                         else
1227                                 expect = 1;
1228                         next;
1229                 }
1230         }
1231 }
1232 END {
1233         if (expect)
1234                 print "?";
1235 }
1236 EOF
1237
1238 : process the command line options
1239 set X `for arg in "$@"; do echo "X$arg"; done |
1240         sed -e s/X// | awk -f options.awk`
1241 eval "set $*"
1242 shift
1243 rm -f options.awk
1244
1245 : set up default values
1246 fastread=''
1247 reuseval=false
1248 config_sh=''
1249 alldone=''
1250 error=''
1251 silent=''
1252 extractsh=''
1253 override=''
1254 knowitall=''
1255 rm -f optdef.sh posthint.sh
1256 cat >optdef.sh <<EOS
1257 $startsh
1258 EOS
1259
1260
1261 : option parsing
1262 while test $# -gt 0; do
1263         case "$1" in
1264         -d) shift; fastread=yes;;
1265         -e) shift; alldone=cont;;
1266         -f)
1267                 shift
1268                 cd ..
1269                 if test -r "$1"; then
1270                         config_sh="$1"
1271                 else
1272                         echo "$me: cannot read config file $1." >&2
1273                         error=true
1274                 fi
1275                 cd UU
1276                 shift;;
1277         -h) shift; error=true;;
1278         -r) shift; reuseval=true;;
1279         -s) shift; silent=true; realsilent=true;;
1280         -E) shift; alldone=exit;;
1281         -K) shift; knowitall=true;;
1282         -O) shift; override=true;;
1283         -S) shift; silent=true; extractsh=true;;
1284         -D)
1285                 shift
1286                 case "$1" in
1287                 *=)
1288                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1289                         echo "$me: ignoring -D $1" >&2
1290                         ;;
1291                 *=*) echo "$1" | \
1292                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1293                 *) echo "$1='define'" >> optdef.sh;;
1294                 esac
1295                 shift
1296                 ;;
1297         -U)
1298                 shift
1299                 case "$1" in
1300                 *=) echo "$1" >> optdef.sh;;
1301                 *=*)
1302                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1303                         echo "$me: ignoring -U $1" >&2
1304                         ;;
1305                 *) echo "$1='undef'" >> optdef.sh;;
1306                 esac
1307                 shift
1308                 ;;
1309         -A)
1310             shift
1311             xxx=''
1312             yyy="$1"
1313             zzz=''
1314             uuu=undef
1315             case "$yyy" in
1316             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1317                  case "$zzz" in
1318                  *:*) zzz='' ;;
1319                  *)   xxx=append
1320                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1321                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1322                  esac
1323                  ;;
1324             esac
1325             case "$xxx" in
1326             '')  case "$yyy" in
1327                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1328                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1329                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1330                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1331                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1332                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1333                  esac
1334                  ;;       
1335             esac
1336             case "$xxx" in
1337             append)
1338                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1339             clear)
1340                 echo "$yyy=''"                  >> posthint.sh ;;
1341             define)
1342                 case "$zzz" in
1343                 '') zzz=define ;;
1344                 esac
1345                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1346             eval)
1347                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1348             prepend)
1349                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1350             undef)
1351                 case "$zzz" in
1352                 '') zzz="$uuu" ;;
1353                 esac
1354                 echo "$yyy=$zzz"                >> posthint.sh ;;
1355             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1356             esac
1357             shift
1358             ;;
1359         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1360             exit 0;;
1361         --) break;;
1362         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1363         *) break;;
1364         esac
1365 done
1366
1367 case "$error" in
1368 true)
1369         cat >&2 <<EOM
1370 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1371                  [-U symbol] [-U symbol=] [-A command:symbol...]
1372   -d : use defaults for all answers.
1373   -e : go on without questioning past the production of config.sh.
1374   -f : specify an alternate default configuration file.
1375   -h : print this help message and exit (with an error status).
1376   -r : reuse C symbols value if possible (skips costly nm extraction).
1377   -s : silent mode, only echoes questions and essential information.
1378   -D : define symbol to have some value:
1379          -D symbol         symbol gets the value 'define'
1380          -D symbol=value   symbol gets the value 'value'
1381   -E : stop at the end of questions, after having produced config.sh.
1382   -K : do not use unless you know what you are doing.
1383   -O : let -D and -U override definitions from loaded configuration file.
1384   -S : perform variable substitutions on all .SH files (can mix with -f)
1385   -U : undefine symbol:
1386          -U symbol    symbol gets the value 'undef'
1387          -U symbol=   symbol gets completely empty
1388   -A : manipulate symbol after the platform specific hints have been applied:
1389          -A symbol=value                append " "value to symbol
1390          -A append:symbol=value         append value to symbol
1391          -A define:symbol=value         define symbol to have value
1392          -A clear:symbol                define symbol to be ''
1393          -A define:symbol               define symbol to be 'define'
1394          -A eval:symbol=value           define symbol to be eval of value
1395          -A prepend:symbol=value        prepend value to symbol
1396          -A undef:symbol                define symbol to be 'undef'
1397          -A undef:symbol=               define symbol to be ''
1398   -V : print version number and exit (with a zero status).
1399 EOM
1400         exit 1
1401         ;;
1402 esac
1403
1404 : Sanity checks
1405 case "$fastread$alldone" in
1406 yescont|yesexit) ;;
1407 *)
1408         case "$extractsh" in
1409         true) ;;
1410         *)
1411                 if test ! -t 0; then
1412                         echo "Say 'sh Configure', not 'sh <Configure'"
1413                         exit 1
1414                 fi
1415                 ;;
1416         esac
1417         ;;
1418 esac
1419
1420 exec 4>&1
1421 case "$silent" in
1422 true) exec 1>/dev/null;;
1423 esac
1424
1425 : run the defines and the undefines, if any, but leave the file out there...
1426 touch optdef.sh
1427 . ./optdef.sh
1428 : create the posthint manipulation script and leave the file out there...
1429 touch posthint.sh
1430
1431 : set package name
1432 package=perl5
1433 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1434 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1435 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1436 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1437 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1438 esac
1439
1440 : Some greps do not return status, grrr.
1441 echo "grimblepritz" >grimble
1442 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1443         contains=contains
1444 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1445         contains=grep
1446 else
1447         contains=contains
1448 fi
1449 rm -f grimble
1450 : the following should work in any shell
1451 case "$contains" in
1452 contains*)
1453         echo " "
1454         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1455         cat >contains <<'EOSS'
1456 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1457 EOSS
1458 chmod +x contains
1459 esac
1460
1461 : Find the path to the source tree
1462 case "$src" in
1463 '') case "$0" in
1464     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1465          case "$src" in
1466          /*)    ;;
1467          .)     ;;
1468          *)     src=`cd ../$src && pwd` ;;
1469          esac
1470          ;;
1471     *)   src='.';;
1472     esac;;
1473 esac
1474 case "$src" in
1475 '')     src=/
1476         rsrc=/
1477         ;;
1478 /*) rsrc="$src";;
1479 *) rsrc="../$src";;
1480 esac
1481 if test -f $rsrc/Configure && \
1482         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1483 then
1484    : found it, so we are ok.
1485 else
1486         rsrc=''
1487         for src in . .. ../.. ../../.. ../../../..; do
1488                 if test -f ../$src/Configure && \
1489                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1490                 then
1491                         rsrc=../$src
1492                         break
1493                 fi
1494         done
1495 fi
1496 case "$rsrc" in
1497 '')
1498         cat <<EOM >&4
1499
1500 Sorry, I can't seem to locate the source dir for $package.  Please start
1501 Configure with an explicit path -- i.e. /some/path/Configure.
1502
1503 EOM
1504         exit 1
1505         ;;
1506 ../.)   rsrc='..';;
1507 *)
1508         echo " "
1509         echo "Sources for $package found in \"$src\"." >&4
1510         ;;
1511 esac
1512
1513 : script used to extract .SH files with variable substitutions
1514 cat >extract <<'EOS'
1515 PERL_CONFIG_SH=true
1516 echo "Doing variable substitutions on .SH files..."
1517 if test -f MANIFEST; then
1518         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1519 else
1520         echo "(Looking for .SH files under the source directory.)"
1521         set x `(cd $src; find . -name "*.SH" -print)`
1522 fi
1523 shift
1524 case $# in
1525 0) set x `(cd $src; echo *.SH)`; shift;;
1526 esac
1527 if test ! -f $src/$1; then
1528         shift
1529 fi
1530 mkdir_p='
1531 name=$1;
1532 create="";
1533 while test $name; do
1534         if test ! -d "$name"; then
1535                 create="$name $create";
1536                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1537                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1538         else
1539                 name="";
1540         fi;
1541 done;
1542 for file in $create; do
1543         mkdir $file;
1544 done
1545 '
1546 for file in $*; do
1547         case "$src" in
1548         ".")
1549                 case "$file" in
1550                 */*)
1551                         dir=`expr X$file : 'X\(.*\)/'`
1552                         file=`expr X$file : 'X.*/\(.*\)'`
1553                         (cd $dir && . ./$file)
1554                         ;;
1555                 *)
1556                         . ./$file
1557                         ;;
1558                 esac
1559                 ;;
1560         *)
1561                 case "$file" in
1562                 */*)
1563                         dir=`expr X$file : 'X\(.*\)/'`
1564                         file=`expr X$file : 'X.*/\(.*\)'`
1565                         (set x $dir; shift; eval $mkdir_p)
1566                         sh <$src/$dir/$file
1567                         ;;
1568                 *)
1569                         sh <$src/$file
1570                         ;;
1571                 esac
1572                 ;;
1573         esac
1574 done
1575 if test -f $src/config_h.SH; then
1576         if test ! -f config.h; then
1577         : oops, they left it out of MANIFEST, probably, so do it anyway.
1578         . $src/config_h.SH
1579         fi
1580 fi
1581 EOS
1582
1583 : extract files and exit if asked to do so
1584 case "$extractsh" in
1585 true)
1586         case "$realsilent" in
1587         true) ;;
1588         *) exec 1>&4;;
1589         esac
1590         case "$config_sh" in
1591         '') config_sh='config.sh';;
1592         esac
1593         echo " "
1594         echo "Fetching answers from $config_sh..."
1595         cd ..
1596         . $config_sh
1597         test "$override" && . ./optdef.sh
1598         echo " "
1599         . UU/extract
1600         rm -rf UU
1601         echo "Extraction done."
1602         exit 0
1603         ;;
1604 esac
1605
1606 : Eunice requires " " instead of "", can you believe it
1607 echo " "
1608 : Here we go...
1609 echo "Beginning of configuration questions for $package."
1610
1611 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1612
1613 : first determine how to suppress newline on echo command
1614 echo " "
1615 echo "Checking echo to see how to suppress newlines..."
1616 (echo "hi there\c" ; echo " ") >.echotmp
1617 if $contains c .echotmp >/dev/null 2>&1 ; then
1618         echo "...using -n."
1619         n='-n'
1620         c=''
1621 else
1622         cat <<'EOM'
1623 ...using \c
1624 EOM
1625         n=''
1626         c='\c'
1627 fi
1628 echo $n "The star should be here-->$c"
1629 echo '*'
1630 rm -f .echotmp
1631
1632 : Now test for existence of everything in MANIFEST
1633 echo " "
1634 if test -f $rsrc/MANIFEST; then
1635         echo "First let's make sure your kit is complete.  Checking..." >&4
1636         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1637         rm -f missing
1638         tmppwd=`pwd`
1639         for filelist in x??; do
1640                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1641         done
1642         if test -s missing; then
1643                 cat missing >&4
1644                 cat >&4 <<'EOM'
1645
1646 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1647
1648 You have the option of continuing the configuration process, despite the
1649 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1650 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1651 and contact the author (perlbug@perl.org).
1652
1653 EOM
1654                 echo $n "Continue? [n] $c" >&4
1655                 read ans
1656                 case "$ans" in
1657                 y*)
1658                         echo "Continuing..." >&4
1659                         rm -f missing
1660                         ;;
1661                 *)
1662                         echo "ABORTING..." >&4
1663                         kill $$
1664                         ;;
1665                 esac
1666         else
1667                 echo "Looks good..."
1668         fi
1669 else
1670         echo "There is no MANIFEST file.  I hope your kit is complete !"
1671 fi
1672 rm -f missing x??
1673
1674 echo " "
1675 : Find the appropriate value for a newline for tr
1676 if test -n "$DJGPP"; then
1677        trnl='\012'
1678 fi
1679 if test X"$trnl" = X; then
1680         case "`echo foo|tr '\n' x 2>/dev/null`" in
1681         foox) trnl='\n' ;;
1682         esac
1683 fi
1684 if test X"$trnl" = X; then
1685         case "`echo foo|tr '\012' x 2>/dev/null`" in
1686         foox) trnl='\012' ;;
1687         esac
1688 fi
1689 if test X"$trnl" = X; then
1690         cat <<EOM >&2
1691
1692 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1693
1694 EOM
1695         exit 1
1696 fi
1697
1698 : compute the number of columns on the terminal for proper question formatting
1699 case "$COLUMNS" in
1700 '') COLUMNS='80';;
1701 esac
1702
1703 : set up the echo used in my read
1704 myecho="case \"\$xxxm\" in
1705 '') echo $n \"\$rp $c\" >&4;;
1706 *) case \"\$rp\" in
1707         '') echo $n \"[\$xxxm] $c\";;
1708         *)
1709                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1710                         echo \"\$rp\" >&4
1711                         echo $n \"[\$xxxm] $c\" >&4
1712                 else
1713                         echo $n \"\$rp [\$xxxm] $c\" >&4
1714                 fi
1715                 ;;
1716         esac;;
1717 esac"
1718
1719 : now set up to do reads with possible shell escape and default assignment
1720 cat <<EOSC >myread
1721 $startsh
1722 xxxm=\$dflt
1723 $myecho
1724 ans='!'
1725 case "\$fastread" in
1726 yes) case "\$dflt" in
1727         '') ;;
1728         *) ans='';
1729                 case "\$silent-\$rp" in
1730                 true-) ;;
1731                 *) echo " " >&4;;
1732                 esac;;
1733         esac;;
1734 *) case "\$silent" in
1735         true) case "\$rp" in
1736                 '') ans='';;
1737                 esac;;
1738         esac;;
1739 esac
1740 while expr "X\$ans" : "X!" >/dev/null; do
1741         read answ
1742         set x \$xxxm
1743         shift
1744         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1745         case  "\$answ" in
1746         "!")
1747                 sh 1>&4
1748                 echo " "
1749                 $myecho
1750                 ;;
1751         !*)
1752                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1753                 shift
1754                 sh 1>&4 -c "\$*"
1755                 echo " "
1756                 $myecho
1757                 ;;
1758         "\$ans")
1759                 case "\$ans" in
1760                 \\&*)
1761                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1762                         shift
1763                         case "\$1" in
1764                         -d)
1765                                 fastread=yes
1766                                 echo "(OK, I'll run with -d after this question.)" >&4
1767                                 ;;
1768                         -*)
1769                                 echo "*** Sorry, \$1 not supported yet." >&4
1770                                 ;;
1771                         esac
1772                         $myecho
1773                         ans=!
1774                         ;;
1775                 esac;;
1776         *)
1777                 case "\$aok" in
1778                 y)
1779                         echo "*** Substitution done -- please confirm."
1780                         xxxm="\$ans"
1781                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1782                         xxxm="\$ans"
1783                         ans=!
1784                         ;;
1785                 *)
1786                         echo "*** Error -- try again."
1787                         ans=!
1788                         ;;
1789                 esac
1790                 $myecho
1791                 ;;
1792         esac
1793         case "\$ans\$xxxm\$nostick" in
1794         '')
1795                 ans=!
1796                 $myecho
1797                 ;;
1798         esac
1799 done
1800 case "\$ans" in
1801 '') ans="\$xxxm";;
1802 esac
1803 EOSC
1804
1805 : create .config dir to save info across Configure sessions
1806 test -d ../.config || mkdir ../.config
1807 cat >../.config/README <<EOF
1808 This directory created by Configure to save information that should
1809 persist across sessions for $package.
1810
1811 You may safely delete it if you wish.
1812 EOF
1813
1814 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1815 case "$usedevel" in
1816 $define|true|[yY]*) ;;
1817 *) case "$xversion" in
1818    *[13579])
1819         cat >&4 <<EOH
1820 *** WHOA THERE!!! ***
1821
1822     This is an UNSTABLE DEVELOPMENT release.
1823     The version of this $package distribution is $xversion, that is, odd,
1824     (as opposed to even) and that signifies a development release.
1825     If you want a maintenance release, you want an even-numbered version.
1826
1827     Do ***NOT*** install this into production use.
1828     Data corruption and crashes are possible.
1829
1830     It is most seriously suggested that you do not continue any further
1831     unless you want to help in developing and debugging Perl.
1832
1833     If you *still* want to build perl, you can answer 'y' now,
1834     or pass -Dusedevel to Configure.
1835
1836 EOH
1837         rp='Do you really want to continue?'
1838         dflt='n'
1839         . ./myread
1840         case "$ans" in
1841         [yY]) echo >&4 "Okay, continuing."
1842               usedevel="$define" ;;
1843         *) echo >&4 "Okay, bye."
1844            exit 1
1845            ;;
1846         esac
1847         ;;
1848     esac
1849     ;;
1850 esac
1851 case "$usedevel" in
1852 $define|true|[yY]*)
1853         case "$versiononly" in
1854         '') versiononly="$define" ;;
1855         esac
1856         case "$installusrbinperl" in
1857         '') installusrbinperl="$undef" ;;
1858         esac
1859         ;;
1860 esac
1861
1862 : general instructions
1863 needman=true
1864 firsttime=true
1865 user=`(logname) 2>/dev/null`
1866 case "$user" in
1867 '') user=`whoami 2>&1`;;
1868 esac
1869 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1870         firsttime=false
1871         echo " "
1872         rp='Would you like to see the instructions?'
1873         dflt=n
1874         . ./myread
1875         case "$ans" in
1876         [yY]*) ;;
1877         *) needman=false;;
1878         esac
1879 fi
1880 if $needman; then
1881         cat <<EOH
1882
1883 This installation shell script will examine your system and ask you questions
1884 to determine how the perl5 package should be installed. If you get
1885 stuck on a question, you may use a ! shell escape to start a subshell or
1886 execute a command.  Many of the questions will have default answers in square
1887 brackets; typing carriage return will give you the default.
1888
1889 On some of the questions which ask for file or directory names you are allowed
1890 to use the ~name construct to specify the login directory belonging to "name",
1891 even if you don't have a shell which knows about that.  Questions where this is
1892 allowed will be marked "(~name ok)".
1893
1894 EOH
1895         rp=''
1896         dflt='Type carriage return to continue'
1897         . ./myread
1898         cat <<'EOH'
1899
1900 The prompter used in this script allows you to use shell variables and
1901 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1902 in the default answer, as if the default line was a set of arguments given to a
1903 script shell.  This means you may also use $* to repeat the whole default line,
1904 so you do not have to re-type everything to add something to the default.
1905
1906 Everytime there is a substitution, you will have to confirm.  If there is an
1907 error (e.g. an unmatched backtick), the default answer will remain unchanged
1908 and you will be prompted again.
1909
1910 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1911 the questions and use the computed defaults (or the previous answers if there
1912 was already a config.sh file). Type 'Configure -h' for a list of options.
1913 You may also start interactively and then answer '& -d' at any prompt to turn
1914 on the non-interactive behaviour for the remainder of the execution.
1915
1916 EOH
1917         . ./myread
1918         cat <<EOH
1919
1920 Much effort has been expended to ensure that this shell script will run on any
1921 Unix system.  If despite that it blows up on yours, your best bet is to edit
1922 Configure and run it again.  If you can't run Configure for some reason,
1923 you'll have to generate a config.sh file by hand.  Whatever problems you
1924 have, let me (perlbug@perl.org) know how I blew it.
1925
1926 This installation script affects things in two ways:
1927
1928 1) it may do direct variable substitutions on some of the files included
1929    in this kit.
1930 2) it builds a config.h file for inclusion in C programs.  You may edit
1931    any of these files as the need arises after running this script.
1932
1933 If you make a mistake on a question, there is no easy way to back up to it
1934 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1935 files.  Configure will offer to let you do this before it runs the SH files.
1936
1937 EOH
1938         dflt='Type carriage return to continue'
1939         . ./myread
1940         case "$firsttime" in
1941         true) echo $user >>../.config/instruct;;
1942         esac
1943 fi
1944
1945 : find out where common programs are
1946 echo " "
1947 echo "Locating common programs..." >&4
1948 cat <<EOSC >loc
1949 $startsh
1950 case \$# in
1951 0) exit 1;;
1952 esac
1953 thing=\$1
1954 shift
1955 dflt=\$1
1956 shift
1957 for dir in \$*; do
1958         case "\$thing" in
1959         .)
1960         if test -d \$dir/\$thing; then
1961                 echo \$dir
1962                 exit 0
1963         fi
1964         ;;
1965         *)
1966         for thisthing in \$dir/\$thing; do
1967                 : just loop through to pick last item
1968         done
1969         if test -f \$thisthing; then
1970                 echo \$thisthing
1971                 exit 0
1972         elif test -f \$dir/\$thing.exe; then
1973                 if test -n "$DJGPP"; then
1974                         echo \$dir/\$thing.exe
1975                 else
1976                         : on Eunice apparently
1977                         echo \$dir/\$thing
1978                 fi
1979                 exit 0
1980         fi
1981         ;;
1982         esac
1983 done
1984 echo \$dflt
1985 exit 1
1986 EOSC
1987 chmod +x loc
1988 $eunicefix loc
1989 loclist="
1990 awk
1991 cat
1992 comm
1993 cp
1994 echo
1995 expr
1996 grep
1997 ls
1998 make
1999 mkdir
2000 rm
2001 sed
2002 sort
2003 touch
2004 tr
2005 uniq
2006 "
2007 trylist="
2008 Mcc
2009 ar
2010 bison
2011 byacc
2012 cpp
2013 csh
2014 date
2015 egrep
2016 gzip
2017 less
2018 ln
2019 more
2020 nm
2021 nroff
2022 pg
2023 test
2024 uname
2025 zip
2026 "
2027 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2028 pth="$pth /lib /usr/lib"
2029 for file in $loclist; do
2030         eval xxx=\$$file
2031         case "$xxx" in
2032         /*|?:[\\/]*)
2033                 if test -f "$xxx"; then
2034                         : ok
2035                 else
2036                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2037                         xxx=`./loc $file $file $pth`
2038                 fi
2039                 ;;
2040         '') xxx=`./loc $file $file $pth`;;
2041         *) xxx=`./loc $xxx $xxx $pth`;;
2042         esac
2043         eval $file=$xxx
2044         eval _$file=$xxx
2045         case "$xxx" in
2046         /*)
2047                 echo $file is in $xxx.
2048                 ;;
2049         ?:[\\/]*)
2050                 echo $file is in $xxx.
2051                 ;;
2052         *)
2053                 echo "I don't know where '$file' is, and my life depends on it." >&4
2054                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2055                 exit 1
2056                 ;;
2057         esac
2058 done
2059 echo " "
2060 echo "Don't worry if any of the following aren't found..."
2061 say=offhand
2062 for file in $trylist; do
2063         eval xxx=\$$file
2064         case "$xxx" in
2065         /*|?:[\\/]*)
2066                 if test -f "$xxx"; then
2067                         : ok
2068                 else
2069                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2070                         xxx=`./loc $file $file $pth`
2071                 fi
2072                 ;;
2073         '') xxx=`./loc $file $file $pth`;;
2074         *) xxx=`./loc $xxx $xxx $pth`;;
2075         esac
2076         eval $file=$xxx
2077         eval _$file=$xxx
2078         case "$xxx" in
2079         /*)
2080                 echo $file is in $xxx.
2081                 ;;
2082         ?:[\\/]*)
2083                 echo $file is in $xxx.
2084                 ;;
2085         *)
2086                 echo "I don't see $file out there, $say."
2087                 say=either
2088                 ;;
2089         esac
2090 done
2091 case "$egrep" in
2092 egrep)
2093         echo "Substituting grep for egrep."
2094         egrep=$grep
2095         ;;
2096 esac
2097 case "$ln" in
2098 ln)
2099         echo "Substituting cp for ln."
2100         ln=$cp
2101         ;;
2102 esac
2103 case "$test" in
2104 test)
2105         echo "Hopefully test is built into your sh."
2106         ;;
2107 *)
2108         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2109                 echo "Using the test built into your sh."
2110                 test=test
2111                 _test=test
2112         fi
2113         ;;
2114 esac
2115 case "$echo" in
2116 echo)
2117         echo "Hopefully echo is built into your sh."
2118         ;;
2119 '') ;;
2120 *)
2121         echo " "
2122 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2123         $echo $n "hi there$c" >foo1
2124         echo $n "hi there$c" >foo2
2125         if cmp foo1 foo2 >/dev/null 2>&1; then
2126                 echo "They are compatible.  In fact, they may be identical."
2127         else
2128                 case "$n" in
2129                 '-n') n='' c='\c';;
2130                 *) n='-n' c='';;
2131                 esac
2132                 cat <<FOO
2133 They are not compatible!  You are probably running ksh on a non-USG system.
2134 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2135 have echo built in and we may have to run some Bourne shell scripts.  That
2136 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2137
2138 FOO
2139                 $echo $n "The star should be here-->$c"
2140                 $echo "*"
2141         fi
2142         $rm -f foo1 foo2
2143         ;;
2144 esac
2145
2146 cat <<EOS >checkcc
2147 $startsh
2148 EOS
2149 cat <<'EOSC' >>checkcc
2150 case "$cc" in
2151 '') ;;
2152 *)  $rm -f try try.*
2153     $cat >try.c <<EOM
2154 int main(int argc, char *argv[]) {
2155   return 0;
2156 }
2157 EOM
2158     if $cc -o try $ccflags $ldflags try.c; then
2159        :
2160     else
2161         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2162         despair=yes
2163         trygcc=yes
2164         case "$cc" in
2165         *gcc*) trygcc=no ;;
2166         esac
2167         case "`$cc -v -c try.c 2>&1`" in
2168         *gcc*) trygcc=no ;;
2169         esac
2170         if $test X"$trygcc" = Xyes; then
2171             if gcc -o try -c try.c; then
2172                 echo " "
2173                 echo "You seem to have a working gcc, though." >&4
2174                 rp="Would you like to use it?"
2175                 dflt=y
2176                 if $test -f myread; then
2177                     . ./myread
2178                 else
2179                     if $test -f UU/myread; then
2180                         . ./UU/myread
2181                     else
2182                         echo "Cannot find myread, sorry.  Aborting." >&2
2183                         exit 1
2184                     fi
2185                 fi  
2186                 case "$ans" in
2187                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2188                 esac
2189             fi
2190         fi
2191         if $test X"$despair" = Xyes; then
2192             $cat >&4 <<EOM
2193 You need to find a working C compiler.
2194 Either (purchase and) install the C compiler supplied by your OS vendor,
2195 or for a free C compiler try http://gcc.gnu.org/
2196 I cannot continue any further, aborting.
2197 EOM
2198             exit 1
2199         fi
2200     fi
2201     $rm -f try try.*
2202     ;;
2203 esac
2204 EOSC
2205
2206 : determine whether symbolic links are supported
2207 echo " "
2208 $touch blurfl
2209 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2210         echo "Symbolic links are supported." >&4
2211         lns="$ln -s"
2212 else
2213         echo "Symbolic links are NOT supported." >&4
2214         lns="$ln"
2215 fi
2216 $rm -f blurfl sym
2217
2218 : determine whether symbolic links are supported
2219 echo " "
2220 case "$lns" in
2221 *"ln -s")
2222         echo "Checking how to test for symbolic links..." >&4
2223         $lns blurfl sym
2224         if $test "X$issymlink" = X; then
2225                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2226                 if test $? = 0; then
2227                         issymlink="test -h"
2228                 fi              
2229         fi
2230         if $test "X$issymlink" = X; then
2231                 if  $test -h >/dev/null 2>&1; then
2232                         issymlink="$test -h"
2233                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2234                 fi              
2235         fi
2236         if $test "X$issymlink" = X; then
2237                 if $test -L sym 2>/dev/null; then
2238                         issymlink="$test -L"
2239                 fi
2240         fi
2241         if $test "X$issymlink" != X; then
2242                 echo "You can test for symbolic links with '$issymlink'." >&4
2243         else
2244                 echo "I do not know how you can test for symbolic links." >&4
2245         fi
2246         $rm -f blurfl sym
2247         ;;
2248 *)      echo "No symbolic links, so not testing for their testing..." >&4
2249         ;;
2250 esac
2251 echo " "
2252
2253
2254 case "$mksymlinks" in
2255 $define|true|[yY]*)
2256         case "$src" in
2257         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2258                 exit 1
2259                 ;;
2260         *)      case "$lns:$issymlink" in
2261                 *"ln -s:"*"test -"?)
2262                         echo "Creating the symbolic links..." >&4
2263                         echo "(First creating the subdirectories...)" >&4
2264                         cd ..
2265                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2266                                 read directory
2267                                 test -z "$directory" && break
2268                                 mkdir -p $directory
2269                         done
2270                         # Sanity check 1.
2271                         if test ! -d t/base; then
2272                                 echo "Failed to create the subdirectories.  Aborting." >&4
2273                                 exit 1
2274                         fi
2275                         echo "(Then creating the symlinks...)" >&4
2276                         awk '{print $1}' $src/MANIFEST | while true; do
2277                                 read filename
2278                                 test -z "$filename" && break
2279                                 if test -f $filename; then
2280                                         if $issymlink $filename; then
2281                                                 rm -f $filename
2282                                         fi
2283                                 fi
2284                                 if test -f $filename; then
2285                                         echo "$filename already exists, not symlinking."
2286                                 else
2287                                         ln -s $src/$filename $filename
2288                                 fi
2289                         done
2290                         # Sanity check 2.
2291                         if test ! -f t/base/commonsense.t; then
2292                                 echo "Failed to create the symlinks.  Aborting." >&4
2293                                 exit 1
2294                         fi
2295                         cd UU
2296                         ;;
2297                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2298                         ;;
2299                 esac
2300                 ;;
2301         esac
2302         ;;
2303 esac
2304
2305 : see whether [:lower:] and [:upper:] are supported character classes
2306 echo " "
2307 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2308 ABYZ)
2309         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2310         up='[:upper:]'
2311         low='[:lower:]'
2312         ;;
2313 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2314         # (0xc9 and 0xd1), therefore that is a nice testing point.
2315         if test "X$up" = X -o "X$low" = X; then
2316             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2317             ij) up='[A-Z]'
2318                 low='[a-z]'
2319                 ;;
2320             esac
2321         fi
2322         if test "X$up" = X -o "X$low" = X; then
2323             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2324             ij) up='A-Z'
2325                 low='a-z'
2326                 ;;
2327             esac
2328         fi
2329         if test "X$up" = X -o "X$low" = X; then
2330             case "`echo IJ | od -x 2>/dev/null`" in
2331             *C9D1*|*c9d1*)
2332                 echo "Hey, this might be EBCDIC." >&4
2333                 if test "X$up" = X -o "X$low" = X; then
2334                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2335                     ij) up='[A-IJ-RS-Z]'
2336                         low='[a-ij-rs-z]'
2337                         ;;
2338                     esac
2339                 fi
2340                 if test "X$up" = X -o "X$low" = X; then
2341                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2342                     ij) up='A-IJ-RS-Z'
2343                         low='a-ij-rs-z'
2344                         ;;
2345                     esac
2346                 fi
2347                 ;;
2348             esac
2349         fi
2350 esac
2351 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2352 ij)
2353     echo "Using $up and $low to convert case." >&4
2354     ;;
2355 *)
2356     echo "I don't know how to translate letters from upper to lower case." >&4
2357     echo "Your tr is not acting any way I know of." >&4
2358     exit 1
2359     ;;
2360 esac
2361 : set up the translation script tr, must be called with ./tr of course
2362 cat >tr <<EOSC
2363 $startsh
2364 case "\$1\$2" in
2365 '[A-Z][a-z]') exec $tr '$up' '$low';;
2366 '[a-z][A-Z]') exec $tr '$low' '$up';;
2367 esac
2368 exec $tr "\$@"
2369 EOSC
2370 chmod +x tr
2371 $eunicefix tr
2372
2373 : Try to determine whether config.sh was made on this system
2374 case "$config_sh" in
2375 '')
2376 myuname=`$uname -a 2>/dev/null`
2377 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2378 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2379 # because the A-Z/a-z are not consecutive.
2380 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2381         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2382 newmyuname="$myuname"
2383 dflt=n
2384 case "$knowitall" in
2385 '')
2386         if test -f ../config.sh; then
2387                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2388                         eval "`grep myuname= ../config.sh`"
2389                 fi
2390                 if test "X$myuname" = "X$newmyuname"; then
2391                         dflt=y
2392                 fi
2393         fi
2394         ;;
2395 *) dflt=y;;
2396 esac
2397
2398 : Get old answers from old config file if Configure was run on the
2399 : same system, otherwise use the hints.
2400 hint=default
2401 cd ..
2402 if test -f config.sh; then
2403         echo " "
2404         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2405         . UU/myread
2406         case "$ans" in
2407         n*|N*) echo "OK, I'll ignore it."
2408                 mv config.sh config.sh.old
2409                 myuname="$newmyuname"
2410                 ;;
2411         *)  echo "Fetching default answers from your old config.sh file..." >&4
2412                 tmp_n="$n"
2413                 tmp_c="$c"
2414                 tmp_sh="$sh"
2415                 . ./config.sh
2416                 cp config.sh UU
2417                 n="$tmp_n"
2418                 c="$tmp_c"
2419                 : Older versions did not always set $sh.  Catch re-use of such
2420                 : an old config.sh.
2421                 case "$sh" in
2422                 '') sh="$tmp_sh" ;;
2423                 esac
2424                 hint=previous
2425                 ;;
2426         esac
2427 fi
2428 . ./UU/checkcc
2429 if test ! -f config.sh; then
2430         $cat <<EOM
2431
2432 First time through, eh?  I have some defaults handy for some systems
2433 that need some extra help getting the Configure answers right:
2434
2435 EOM
2436         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2437         dflt=''
2438         : Half the following guesses are probably wrong... If you have better
2439         : tests or hints, please send them to perlbug@perl.org
2440         : The metaconfig authors would also appreciate a copy...
2441         $test -f /irix && osname=irix
2442         $test -f /xenix && osname=sco_xenix
2443         $test -f /dynix && osname=dynix
2444         $test -f /dnix && osname=dnix
2445         $test -f /lynx.os && osname=lynxos
2446         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2447         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2448         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2449         $test -f /bin/mips && /bin/mips && osname=mips
2450         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2451                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2452         $test -d /usr/apollo/bin && osname=apollo
2453         $test -f /etc/saf/_sactab && osname=svr4
2454         $test -d /usr/include/minix && osname=minix
2455         if $test -d /MachTen -o -d /MachTen_Folder; then
2456                 osname=machten
2457                 if $test -x /sbin/version; then
2458                         osvers=`/sbin/version | $awk '{print $2}' |
2459                         $sed -e 's/[A-Za-z]$//'`
2460                 elif $test -x /usr/etc/version; then
2461                         osvers=`/usr/etc/version | $awk '{print $2}' |
2462                         $sed -e 's/[A-Za-z]$//'`
2463                 else
2464                         osvers="$2.$3"
2465                 fi
2466         fi
2467
2468         $test -f /sys/posix.dll &&
2469                 $test -f /usr/bin/what &&
2470                 set X `/usr/bin/what /sys/posix.dll` &&
2471                 $test "$3" = UWIN &&
2472                 osname=uwin &&
2473                 osvers="$5"
2474
2475         if $test -f $uname; then
2476                 set X $myuname
2477                 shift
2478
2479                 case "$5" in
2480                 fps*) osname=fps ;;
2481                 mips*)
2482                         case "$4" in
2483                         umips) osname=umips ;;
2484                         *) osname=mips ;;
2485                         esac;;
2486                 [23]100) osname=mips ;;
2487                 next*) osname=next ;;
2488                 i386*)
2489                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2490                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2491                                 osname='sco'
2492                                 osvers=$tmp
2493                         elif $test -f /etc/kconfig; then
2494                                 osname=isc
2495                                 if test "$lns" = "$ln -s"; then
2496                                         osvers=4
2497                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2498                                         osvers=3
2499                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2500                                         osvers=2
2501                                 fi
2502                         fi
2503                         tmp=''
2504                         ;;
2505                 pc*)
2506                         if test -n "$DJGPP"; then
2507                                 osname=dos
2508                                 osvers=djgpp
2509                         fi
2510                         ;;
2511                 esac
2512
2513                 case "$1" in
2514                 aix) osname=aix
2515                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2516                         case "$tmp" in
2517                         'not found') osvers="$4"."$3" ;;
2518                         '<3240'|'<>3240') osvers=3.2.0 ;;
2519                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2520                         '=3250'|'>3250') osvers=3.2.5 ;;
2521                         *) osvers=$tmp;;
2522                         esac
2523                         ;;
2524                 bsd386) osname=bsd386
2525                         osvers=`$uname -r`
2526                         ;;
2527                 cygwin*) osname=cygwin
2528                         osvers="$3"
2529                         ;;
2530                 *dc.osx) osname=dcosx
2531                         osvers="$3"
2532                         ;;
2533                 dnix) osname=dnix
2534                         osvers="$3"
2535                         ;;
2536                 domainos) osname=apollo
2537                         osvers="$3"
2538                         ;;
2539                 dgux) osname=dgux 
2540                         osvers="$3"
2541                         ;;
2542                 dynixptx*) osname=dynixptx
2543                         osvers=`echo "$4"|sed 's/^v//'`
2544                         ;;
2545                 freebsd) osname=freebsd 
2546                         osvers="$3" ;;
2547                 genix) osname=genix ;;
2548                 hp*) osname=hpux 
2549                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2550                         ;;
2551                 irix*) osname=irix
2552                         case "$3" in
2553                         4*) osvers=4 ;;
2554                         5*) osvers=5 ;;
2555                         *)      osvers="$3" ;;
2556                         esac
2557                         ;;
2558                 linux) osname=linux
2559                         case "$3" in
2560                         *)      osvers="$3" ;;
2561                         esac
2562                         ;;
2563                 MiNT) osname=mint
2564                         ;;
2565                 netbsd*) osname=netbsd
2566                         osvers="$3"
2567                         ;;
2568                 news-os) osvers="$3"
2569                         case "$3" in
2570                         4*) osname=newsos4 ;;
2571                         *) osname=newsos ;;
2572                         esac
2573                         ;;
2574                 next*) osname=next ;;
2575                 nonstop-ux) osname=nonstopux ;;
2576                 POSIX-BC | posix-bc ) osname=posix-bc
2577                         osvers="$3"
2578                         ;;
2579                 powerux | power_ux | powermax_os | powermaxos | \
2580                 powerunix | power_unix) osname=powerux
2581                         osvers="$3"
2582                         ;;
2583                 qnx) osname=qnx
2584                         osvers="$4"
2585                         ;;
2586                 solaris) osname=solaris
2587                         case "$3" in
2588                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2589                         *)      osvers="$3" ;;
2590                         esac
2591                         ;;
2592                 sunos) osname=sunos
2593                         case "$3" in
2594                         5*) osname=solaris
2595                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2596                         *)      osvers="$3" ;;
2597                         esac
2598                         ;;
2599                 titanos) osname=titanos
2600                         case "$3" in
2601                         1*) osvers=1 ;;
2602                         2*) osvers=2 ;;
2603                         3*) osvers=3 ;;
2604                         4*) osvers=4 ;;
2605                         *)      osvers="$3" ;;
2606                         esac
2607                         ;;
2608                 ultrix) osname=ultrix
2609                         osvers="$3"
2610                         ;;
2611                 osf1|mls+)      case "$5" in
2612                                 alpha)
2613                                         osname=dec_osf
2614                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2615                                         case "$osvers" in
2616                                         [1-9].[0-9]*) ;;
2617                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2618                                         esac
2619                                         ;;
2620                         hp*)    osname=hp_osf1  ;;
2621                         mips)   osname=mips_osf1 ;;
2622                         esac
2623                         ;;
2624                 unixware) osname=svr5
2625                         osvers="$4"
2626                         ;;
2627                 uts) osname=uts
2628                         osvers="$3"
2629                         ;;
2630                 $2) case "$osname" in
2631                         *isc*) ;;
2632                         *freebsd*) ;;
2633                         svr*)
2634                                 : svr4.x or possibly later
2635                                 case "svr$3" in 
2636                                 ${osname}*)
2637                                         osname=svr$3
2638                                         osvers=$4
2639                                         ;;
2640                                 esac
2641                                 case "$osname" in
2642                                 svr4.0)
2643                                         : Check for ESIX
2644                                         if test -f /stand/boot ; then
2645                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2646                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2647                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2648                                                         if test -n "$isesix"; then
2649                                                                 osname=esix4
2650                                                         fi
2651                                                 fi
2652                                         fi
2653                                         ;;
2654                                 esac
2655                                 ;;
2656                         *)      if test -f /etc/systemid; then
2657                                         osname=sco
2658                                         set `echo $3 | $sed 's/\./ /g'` $4
2659                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2660                                                 osvers=$1.$2.$3
2661                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2662                                                 osvers=$1.$2
2663                                         elif $test -f $src/hints/sco_$1.sh; then
2664                                                 osvers=$1
2665                                         fi
2666                                 else
2667                                         case "$osname" in
2668                                         '') : Still unknown.  Probably a generic Sys V.
2669                                                 osname="sysv"
2670                                                 osvers="$3"
2671                                                 ;;
2672                                         esac
2673                                 fi
2674                                 ;;
2675                         esac
2676                         ;;
2677                 *)      case "$osname" in
2678                         '') : Still unknown.  Probably a generic BSD.
2679                                 osname="$1"
2680                                 osvers="$3"
2681                                 ;;
2682                         esac
2683                         ;;
2684                 esac
2685         else
2686                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2687                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2688                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2689                                 osname=news_os
2690                         fi
2691                         $rm -f UU/kernel.what
2692                 elif test -d c:/.; then
2693                         set X $myuname
2694                         osname=os2
2695                         osvers="$5"
2696                 fi
2697         fi
2698         
2699         : Now look for a hint file osname_osvers, unless one has been
2700         : specified already.
2701         case "$hintfile" in
2702         ''|' ')
2703                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2704                 : Also try without trailing minor version numbers.
2705                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2706                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2707                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2708                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2709                 case "$file" in
2710                 '') dflt=none ;;
2711                 *)  case "$osvers" in
2712                         '') dflt=$file
2713                                 ;;
2714                         *)  if $test -f $src/hints/$file.sh ; then
2715                                         dflt=$file
2716                                 elif $test -f $src/hints/$xfile.sh ; then
2717                                         dflt=$xfile
2718                                 elif $test -f $src/hints/$xxfile.sh ; then
2719                                         dflt=$xxfile
2720                                 elif $test -f $src/hints/$xxxfile.sh ; then
2721                                         dflt=$xxxfile
2722                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2723                                         dflt=$xxxxfile
2724                                 elif $test -f "$src/hints/${osname}.sh" ; then
2725                                         dflt="${osname}"
2726                                 else
2727                                         dflt=none
2728                                 fi
2729                                 ;;
2730                         esac
2731                         ;;
2732                 esac
2733                 if $test -f Policy.sh ; then
2734                         case "$dflt" in
2735                         *Policy*) ;;
2736                         none) dflt="Policy" ;;
2737                         *) dflt="Policy $dflt" ;;
2738                         esac
2739                 fi
2740                 ;;
2741         *)
2742                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2743                 ;;
2744         esac
2745
2746         if $test -f Policy.sh ; then
2747                 $cat <<EOM
2748
2749 There's also a Policy hint file available, which should make the
2750 site-specific (policy) questions easier to answer.
2751 EOM
2752
2753         fi
2754
2755         $cat <<EOM
2756
2757 You may give one or more space-separated answers, or "none" if appropriate.
2758 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2759 is a good thing.  DO NOT give a wrong version or a wrong OS.
2760
2761 EOM
2762
2763         rp="Which of these apply, if any?"
2764         . UU/myread
2765         tans=$ans
2766         for file in $tans; do
2767                 if $test X$file = XPolicy -a -f Policy.sh; then
2768                         . Policy.sh
2769                         $cat Policy.sh >> UU/config.sh
2770                 elif $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$tans = X -o X$tans = Xnone ; then
2774                         : nothing
2775                 else
2776                         : Give one chance to correct a possible typo.
2777                         echo "$file.sh does not exist"
2778                         dflt=$file
2779                         rp="hint to use instead?"
2780                         . UU/myread
2781                         for file in $ans; do
2782                                 if $test -f "$src/hints/$file.sh"; then
2783                                         . $src/hints/$file.sh
2784                                         $cat $src/hints/$file.sh >> UU/config.sh
2785                                 elif $test X$ans = X -o X$ans = Xnone ; then
2786                                         : nothing
2787                                 else
2788                                         echo "$file.sh does not exist -- ignored."
2789                                 fi
2790                         done
2791                 fi
2792         done
2793
2794         hint=recommended
2795         : Remember our hint file for later.
2796         if $test -f "$src/hints/$file.sh" ; then
2797                 hintfile="$file"
2798         else
2799                 hintfile=''
2800         fi
2801 fi
2802 cd UU
2803 ;;
2804 *)
2805         echo " "
2806         echo "Fetching default answers from $config_sh..." >&4
2807         tmp_n="$n"
2808         tmp_c="$c"
2809         cd ..
2810         cp $config_sh config.sh 2>/dev/null
2811         chmod +w config.sh
2812         . ./config.sh
2813         cd UU
2814         cp ../config.sh .
2815         n="$tmp_n"
2816         c="$tmp_c"
2817         hint=previous
2818         ;;
2819 esac
2820 test "$override" && . ./optdef.sh
2821
2822 : Restore computed paths
2823 for file in $loclist $trylist; do
2824         eval $file="\$_$file"
2825 done
2826
2827 cat << EOM
2828
2829 Configure uses the operating system name and version to set some defaults.
2830 The default value is probably right if the name rings a bell. Otherwise,
2831 since spelling matters for me, either accept the default or answer "none"
2832 to leave it blank.
2833
2834 EOM
2835 case "$osname" in
2836         ''|' ')
2837                 case "$hintfile" in
2838                 ''|' '|none) dflt=none ;;
2839                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2840                 esac
2841                 ;;
2842         *) dflt="$osname" ;;
2843 esac
2844 rp="Operating system name?"
2845 . ./myread
2846 case "$ans" in
2847 none)  osname='' ;;
2848 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2849 esac
2850 echo " "
2851 case "$osvers" in
2852         ''|' ')
2853                 case "$hintfile" in
2854                 ''|' '|none) dflt=none ;;
2855                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2856                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2857                         case "$dflt" in
2858                         ''|' ') dflt=none ;;
2859                         esac
2860                         ;;
2861                 esac
2862                 ;;
2863         *) dflt="$osvers" ;;
2864 esac
2865 rp="Operating system version?"
2866 . ./myread
2867 case "$ans" in
2868 none)  osvers='' ;;
2869 *) osvers="$ans" ;;
2870 esac
2871
2872
2873 . ./posthint.sh
2874
2875 : who configured the system
2876 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2877 cf_by=`(logname) 2>/dev/null`
2878 case "$cf_by" in
2879 "")
2880         cf_by=`(whoami) 2>/dev/null`
2881         case "$cf_by" in
2882         "") cf_by=unknown ;;
2883         esac ;;
2884 esac
2885
2886 : set up the script used to warn in case of inconsistency
2887 cat <<EOS >whoa
2888 $startsh
2889 EOS
2890 cat <<'EOSC' >>whoa
2891 dflt=y
2892 echo " "
2893 echo "*** WHOA THERE!!! ***" >&4
2894 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2895 rp="    Keep the $hint value?"
2896 . ./myread
2897 case "$ans" in
2898 y) td=$was; tu=$was;;
2899 esac
2900 EOSC
2901
2902 : function used to set $1 to $val
2903 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2904 case "$val$was" in
2905 $define$undef) . ./whoa; eval "$var=\$td";;
2906 $undef$define) . ./whoa; eval "$var=\$tu";;
2907 *) eval "$var=$val";;
2908 esac'
2909
2910 case "$usethreads" in
2911 $define|true|[yY]*)     dflt='y';;
2912 *) dflt='n';;
2913 esac
2914 cat <<EOM
2915
2916 Perl can be built to take advantage of threads on some systems.
2917 To do so, Configure can be run with -Dusethreads.
2918
2919 Note that threading is a highly experimental feature, and
2920 some known race conditions still remain.  If you choose to try
2921 it, be very sure to not actually deploy it for production
2922 purposes.  README.threads has more details, and is required
2923 reading if you enable threads.
2924
2925 If this doesn't make any sense to you, just accept the default '$dflt'.
2926 EOM
2927 rp='Build a threading Perl?'
2928 . ./myread
2929 case "$ans" in
2930 y|Y)    val="$define" ;;
2931 *)      val="$undef" ;;
2932 esac
2933 set usethreads
2934 eval $setvar
2935
2936 case "$usethreads" in
2937 $define)
2938         $cat <<EOM
2939
2940 As of 5.5.640, Perl has two different internal threading implementations,
2941 the 5.005 version (5005threads) and an interpreter-based version
2942 (ithreads) that has one interpreter per thread.  Both are very 
2943 experimental.  This arrangement exists to help developers work out
2944 which one is better.
2945
2946 If you're a casual user, you probably don't want interpreter-threads
2947 at this time.  There doesn't yet exist a way to create threads from
2948 within Perl in this model, i.e., "use Thread;" will NOT work.
2949 EOM
2950         : Default to ithreads unless overridden on command line or with
2951         : old config.sh
2952         dflt='y'
2953         case "$use5005threads" in
2954                 $define|true|[yY]*) dflt='n';;
2955         esac
2956         case "$useithreads" in
2957                 $undef|false|[nN]*) dflt='n';;
2958         esac
2959         rp='Use interpreter-based ithreads?'
2960         . ./myread
2961         case "$ans" in
2962         y|Y)    val="$define" ;;
2963         *)      val="$undef" ;;
2964         esac
2965         set useithreads
2966         eval $setvar
2967         : Now set use5005threads to the opposite value.
2968         case "$useithreads" in
2969         $define) val="$undef" ;;
2970         *) val="$define" ;;
2971         esac
2972         set use5005threads
2973         eval $setvar
2974         ;;
2975 *)
2976         useithreads="$undef"
2977         use5005threads="$undef"
2978         ;;
2979 esac
2980
2981 case "$useithreads$use5005threads" in
2982 "$define$define")
2983         $cat >&4 <<EOM
2984
2985 You cannot have both the ithreads and the 5.005 threads enabled
2986 at the same time.  Disabling the 5.005 threads since they are
2987 much less stable than the ithreads.
2988
2989 EOM
2990         use5005threads="$undef"
2991         ;;
2992 esac
2993
2994 case "$d_oldpthreads" in
2995 '')     : Configure tests would be welcome here.  For now, assume undef.
2996         val="$undef" ;;
2997 *)      val="$d_oldpthreads" ;;
2998 esac
2999 set d_oldpthreads
3000 eval $setvar
3001
3002
3003 case "$usethreads" in
3004 "$define"|true|[yY]*)
3005 : Look for a hint-file generated 'call-back-unit'.  If the
3006 : user has specified that a threading perl is to be built,
3007 : we may need to set or change some other defaults.
3008         if $test -f usethreads.cbu; then
3009                 echo "Your platform has some specific hints for threaded builds, using them..."
3010                 . ./usethreads.cbu
3011         else
3012                 $cat <<EOM
3013 (Your platform doesn't have any specific hints for threaded builds.
3014  Assuming POSIX threads, then.)
3015 EOM
3016         fi
3017         ;;
3018 esac
3019
3020 cat <<EOM
3021
3022 Perl can be built so that multiple Perl interpreters can coexist
3023 within the same Perl executable.
3024 EOM
3025
3026 case "$useithreads" in
3027 $define)
3028         cat <<EOM
3029 This multiple interpreter support is required for interpreter-based threads.
3030 EOM
3031         val="$define"
3032         ;;
3033 *)      case "$usemultiplicity" in
3034         $define|true|[yY]*)     dflt='y';;
3035         *) dflt='n';;
3036         esac
3037         echo " "
3038         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3039         rp='Build Perl for multiplicity?'
3040         . ./myread
3041         case "$ans" in
3042         y|Y)    val="$define" ;;
3043         *)      val="$undef" ;;
3044         esac
3045         ;;
3046 esac
3047 set usemultiplicity
3048 eval $setvar
3049
3050 : make some quick guesses about what we are up against
3051 echo " "
3052 $echo $n "Hmm...  $c"
3053 echo exit 1 >bsd
3054 echo exit 1 >usg
3055 echo exit 1 >v7
3056 echo exit 1 >osf1
3057 echo exit 1 >eunice
3058 echo exit 1 >xenix
3059 echo exit 1 >venix
3060 echo exit 1 >os2
3061 d_bsd="$undef"
3062 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3063 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3064 then
3065         echo "Looks kind of like an OSF/1 system, but we'll see..."
3066         echo exit 0 >osf1
3067 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3068         xxx=`./loc addbib blurfl $pth`
3069         if $test -f $xxx; then
3070         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3071                 echo exit 0 >bsd
3072                 echo exit 0 >usg
3073         else
3074                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3075                         echo "Looks kind of like an extended USG system, but we'll see..."
3076                 else
3077                         echo "Looks kind of like a USG system, but we'll see..."
3078                 fi
3079                 echo exit 0 >usg
3080         fi
3081 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3082         echo "Looks kind of like a BSD system, but we'll see..."
3083         d_bsd="$define"
3084         echo exit 0 >bsd
3085 else
3086         echo "Looks kind of like a Version 7 system, but we'll see..."
3087         echo exit 0 >v7
3088 fi
3089 case "$eunicefix" in
3090 *unixtovms*)
3091         $cat <<'EOI'
3092 There is, however, a strange, musty smell in the air that reminds me of
3093 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3094 EOI
3095         echo exit 0 >eunice
3096         d_eunice="$define"
3097 : it so happens the Eunice I know will not run shell scripts in Unix format
3098         ;;
3099 *)
3100         echo " "
3101         echo "Congratulations.  You aren't running Eunice."
3102         d_eunice="$undef"
3103         ;;
3104 esac
3105 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3106 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3107 : semicolon as a patch separator
3108 case "$p_" in
3109 :) ;;
3110 *)
3111         $cat <<'EOI'
3112 I have the feeling something is not exactly right, however...don't tell me...
3113 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3114 (Or you may be running DOS with DJGPP.)
3115 EOI
3116         echo exit 0 >os2
3117         ;;
3118 esac
3119 if test -f /xenix; then
3120         echo "Actually, this looks more like a XENIX system..."
3121         echo exit 0 >xenix
3122         d_xenix="$define"
3123 else
3124         echo " "
3125         echo "It's not Xenix..."
3126         d_xenix="$undef"
3127 fi
3128 chmod +x xenix
3129 $eunicefix xenix
3130 if test -f /venix; then
3131         echo "Actually, this looks more like a VENIX system..."
3132         echo exit 0 >venix
3133 else
3134         echo " "
3135         if ./xenix; then
3136                 : null
3137         else
3138                 echo "Nor is it Venix..."
3139         fi
3140 fi
3141 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3142 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3143 $rm -f foo
3144
3145 case "$cc" in
3146 '') dflt=cc;;
3147 *) dflt="$cc";;
3148 esac
3149 rp="Use which C compiler?"
3150 . ./myread
3151 cc="$ans"
3152 : Look for a hint-file generated 'call-back-unit'.  Now that the
3153 : user has specified the compiler, we may need to set or change some
3154 : other defaults.
3155 if $test -f cc.cbu; then
3156     . ./cc.cbu
3157 fi
3158 . ./checkcc
3159
3160 echo " "
3161 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3162 $cat >gccvers.c <<EOM
3163 #include <stdio.h>
3164 int main() {
3165 #ifdef __GNUC__
3166 #ifdef __VERSION__
3167         printf("%s\n", __VERSION__);
3168 #else
3169         printf("%s\n", "1");
3170 #endif
3171 #endif
3172         exit(0);
3173 }
3174 EOM
3175 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3176         gccversion=`./gccvers`
3177         case "$gccversion" in
3178         '') echo "You are not using GNU cc." ;;
3179         *)  echo "You are using GNU cc $gccversion."
3180             ccname=gcc  
3181             ;;
3182         esac
3183 else
3184         echo " "
3185         echo "*** WHOA THERE!!! ***" >&4
3186         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3187         case "$knowitall" in
3188         '')
3189         echo "    You'd better start hunting for one and let me know about it." >&4
3190                 exit 1
3191                 ;;
3192         esac
3193 fi
3194 $rm -f gccvers*
3195 case "$gccversion" in
3196 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3197 esac
3198 case "$gccversion" in
3199 '') gccosandvers='' ;;
3200 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3201    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3202    gccshortvers=''
3203    case "$gccosandvers" in
3204    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3205    $osname$osvers) ;; # looking good
3206    $osname*) cat <<EOM >&4
3207
3208 *** WHOA THERE!!! ***
3209
3210     Your gcc has not been compiled for the exact release of
3211     your operating system ($gccosandvers versus $osname$osvers).
3212
3213     In general it is a good idea to keep gcc synchronized with
3214     the operating system because otherwise serious problems
3215     may ensue when trying to compile software, like Perl.
3216
3217     I'm trying to be optimistic here, though, and will continue.
3218     If later during the configuration and build icky compilation
3219     problems appear (headerfile conflicts being the most common
3220     manifestation), I suggest reinstalling the gcc to match
3221     your operating system release.
3222
3223 EOM
3224       ;;
3225    *) gccosandvers='' ;; # failed to parse, better be silent
3226    esac
3227    ;;
3228 esac
3229 case "$ccname" in
3230 '') ccname="$cc" ;;
3231 esac
3232
3233 case "$gccversion" in
3234 '') ;;
3235 *)  case "$ccflags" in
3236     *-Wall*) ;;
3237     *) ccflags="$ccflags -Wall" ;;
3238     esac
3239     ;;
3240 esac
3241
3242 : see how we invoke the C preprocessor
3243 echo " "
3244 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3245 cat <<'EOT' >testcpp.c
3246 #define ABC abc
3247 #define XYZ xyz
3248 ABC.XYZ
3249 EOT
3250 cd ..
3251 if test ! -f cppstdin; then
3252         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3253                 # AIX cc -E doesn't show the absolute headerfile
3254                 # locations but we'll cheat by using the -M flag.
3255                 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
3256         else
3257                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3258         fi
3259 else
3260         echo "Keeping your $hint cppstdin wrapper."
3261 fi
3262 chmod 755 cppstdin
3263 wrapper=`pwd`/cppstdin
3264 ok='false'
3265 cd UU
3266
3267 if $test "X$cppstdin" != "X" && \
3268         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3270 then
3271         echo "You used to use $cppstdin $cppminus so we'll use that again."
3272         case "$cpprun" in
3273         '') echo "But let's see if we can live without a wrapper..." ;;
3274         *)
3275                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3276                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3277                 then
3278                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3279                         ok='true'
3280                 else
3281                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3282                 fi
3283                 ;;
3284         esac
3285 else
3286         case "$cppstdin" in
3287         '') ;;
3288         *)
3289                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3290                 ;;
3291         esac
3292 fi
3293
3294 if $ok; then
3295         : nothing
3296 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3297         $cc -E <testcpp.c >testcpp.out 2>&1; \
3298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3299         echo "Yup, it does."
3300         x_cpp="$cc -E"
3301         x_minus='';
3302 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3303         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305         echo "Yup, it does."
3306         x_cpp="$cc -E"
3307         x_minus='-';
3308 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3309         $cc -P <testcpp.c >testcpp.out 2>&1; \
3310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311         echo "Yipee, that works!"
3312         x_cpp="$cc -P"
3313         x_minus='';
3314 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3315         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3317         echo "At long last!"
3318         x_cpp="$cc -P"
3319         x_minus='-';
3320 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3321         $cpp <testcpp.c >testcpp.out 2>&1; \
3322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3323         echo "It works!"
3324         x_cpp="$cpp"
3325         x_minus='';
3326 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3327         $cpp - <testcpp.c >testcpp.out 2>&1; \
3328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3329         echo "Hooray, it works!  I was beginning to wonder."
3330         x_cpp="$cpp"
3331         x_minus='-';
3332 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3333         $wrapper <testcpp.c >testcpp.out 2>&1; \
3334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3335         x_cpp="$wrapper"
3336         x_minus=''
3337         echo "Eureka!"
3338 else
3339         dflt=''
3340         rp="No dice.  I can't find a C preprocessor.  Name one:"
3341         . ./myread
3342         x_cpp="$ans"
3343         x_minus=''
3344         $x_cpp <testcpp.c >testcpp.out 2>&1
3345         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3346                 echo "OK, that will do." >&4
3347         else
3348 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3349                 exit 1
3350         fi
3351 fi
3352
3353 case "$ok" in
3354 false)
3355         cppstdin="$x_cpp"
3356         cppminus="$x_minus"
3357         cpprun="$x_cpp"
3358         cpplast="$x_minus"
3359         set X $x_cpp
3360         shift
3361         case "$1" in
3362         "$cpp")
3363                 echo "Perhaps can we force $cc -E using a wrapper..."
3364                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3365                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3366                 then
3367                         echo "Yup, we can."
3368                         cppstdin="$wrapper"
3369                         cppminus='';
3370                 else
3371                         echo "Nope, we'll have to live without it..."
3372                 fi
3373                 ;;
3374         esac
3375         case "$cpprun" in
3376         "$wrapper")
3377                 cpprun=''
3378                 cpplast=''
3379                 ;;
3380         esac
3381         ;;
3382 esac
3383
3384 case "$cppstdin" in
3385 "$wrapper"|'cppstdin') ;;
3386 *) $rm -f $wrapper;;
3387 esac
3388 $rm -f testcpp.c testcpp.out
3389
3390 : decide how portable to be.  Allow command line overrides.
3391 case "$d_portable" in
3392 "$undef") ;;
3393 *)      d_portable="$define" ;;
3394 esac
3395
3396 : set up shell script to do ~ expansion
3397 cat >filexp <<EOSS
3398 $startsh
3399 : expand filename
3400 case "\$1" in
3401  ~/*|~)
3402         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3403         ;;
3404  ~*)
3405         if $test -f /bin/csh; then
3406                 /bin/csh -f -c "glob \$1"
3407                 failed=\$?
3408                 echo ""
3409                 exit \$failed
3410         else
3411                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3412                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3413                 if $test ! -d "\$dir"; then
3414                         me=\`basename \$0\`
3415                         echo "\$me: can't locate home directory for: \$name" >&2
3416                         exit 1
3417                 fi
3418                 case "\$1" in
3419                 */*)
3420                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3421                         ;;
3422                 *)
3423                         echo \$dir
3424                         ;;
3425                 esac
3426         fi
3427         ;;
3428 *)
3429         echo \$1
3430         ;;
3431 esac
3432 EOSS
3433 chmod +x filexp
3434 $eunicefix filexp
3435
3436 : now set up to get a file name
3437 cat <<EOS >getfile
3438 $startsh
3439 EOS
3440 cat <<'EOSC' >>getfile
3441 tilde=''
3442 fullpath=''
3443 already=''
3444 skip=''
3445 none_ok=''
3446 exp_file=''
3447 nopath_ok=''
3448 orig_rp="$rp"
3449 orig_dflt="$dflt"
3450 case "$gfpth" in
3451 '') gfpth='.' ;;
3452 esac
3453
3454 case "$fn" in
3455 *\(*)
3456         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3457         fn=`echo $fn | sed 's/(.*)//'`
3458         ;;
3459 esac
3460
3461 case "$fn" in
3462 *:*)
3463         loc_file=`expr $fn : '.*:\(.*\)'`
3464         fn=`expr $fn : '\(.*\):.*'`
3465         ;;
3466 esac
3467
3468 case "$fn" in
3469 *~*) tilde=true;;
3470 esac
3471 case "$fn" in
3472 */*) fullpath=true;;
3473 esac
3474 case "$fn" in
3475 *+*) skip=true;;
3476 esac
3477 case "$fn" in
3478 *n*) none_ok=true;;
3479 esac
3480 case "$fn" in
3481 *e*) exp_file=true;;
3482 esac
3483 case "$fn" in
3484 *p*) nopath_ok=true;;
3485 esac
3486
3487 case "$fn" in
3488 *f*) type='File';;
3489 *d*) type='Directory';;
3490 *l*) type='Locate';;
3491 esac
3492
3493 what="$type"
3494 case "$what" in
3495 Locate) what='File';;
3496 esac
3497
3498 case "$exp_file" in
3499 '')
3500         case "$d_portable" in
3501         "$define") ;;
3502         *) exp_file=true;;
3503         esac
3504         ;;
3505 esac
3506
3507 cd ..
3508 while test "$type"; do
3509         redo=''
3510         rp="$orig_rp"
3511         dflt="$orig_dflt"
3512         case "$tilde" in
3513         true) rp="$rp (~name ok)";;
3514         esac
3515         . UU/myread
3516         if test -f UU/getfile.ok && \
3517                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3518         then
3519                 value="$ans"
3520                 ansexp="$ans"
3521                 break
3522         fi
3523         case "$ans" in
3524         none)
3525                 value=''
3526                 ansexp=''
3527                 case "$none_ok" in
3528                 true) type='';;
3529                 esac
3530                 ;;
3531         *)
3532                 case "$tilde" in
3533                 '') value="$ans"
3534                         ansexp="$ans";;
3535                 *)
3536                         value=`UU/filexp $ans`
3537                         case $? in
3538                         0)
3539                                 if test "$ans" != "$value"; then
3540                                         echo "(That expands to $value on this system.)"
3541                                 fi
3542                                 ;;
3543                         *) value="$ans";;
3544                         esac
3545                         ansexp="$value"
3546                         case "$exp_file" in
3547                         '') value="$ans";;
3548                         esac
3549                         ;;
3550                 esac
3551                 case "$fullpath" in
3552                 true)
3553                         case "$ansexp" in
3554                         /*) value="$ansexp" ;;
3555                         [a-zA-Z]:/*) value="$ansexp" ;;
3556                         *)
3557                                 redo=true
3558                                 case "$already" in
3559                                 true)
3560                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3561                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3562                                         ;;
3563                                 *)
3564                                 echo "Please give a full path name, starting with slash." >&4
3565                                         case "$tilde" in
3566                                         true)
3567                                 echo "Note that using ~name is ok provided it expands well." >&4
3568                                                 already=true
3569                                                 ;;
3570                                         esac
3571                                 esac
3572                                 ;;
3573                         esac
3574                         ;;
3575                 esac
3576                 case "$redo" in
3577                 '')
3578                         case "$type" in
3579                         File)
3580                                 for fp in $gfpth; do
3581                                         if test "X$fp" = X.; then
3582                                             pf="$ansexp"
3583                                         else    
3584                                             pf="$fp/$ansexp"
3585                                         fi
3586                                         if test -f "$pf"; then
3587                                                 type=''
3588                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3589                                         then
3590                                                 echo "($value is not a plain file, but that's ok.)"
3591                                                 type=''
3592                                         fi
3593                                         if test X"$type" = X; then
3594                                             value="$pf"
3595                                             break
3596                                         fi
3597                                 done
3598                                 ;;
3599                         Directory)
3600                                 for fp in $gfpth; do
3601                                         if test "X$fp" = X.; then
3602                                             dir="$ans"
3603                                             direxp="$ansexp"
3604                                         else    
3605                                             dir="$fp/$ansexp"
3606                                             direxp="$fp/$ansexp"
3607                                         fi
3608                                         if test -d "$direxp"; then
3609                                                 type=''
3610                                                 value="$dir"
3611                                                 break
3612                                         fi
3613                                 done
3614                                 ;;
3615                         Locate)
3616                                 if test -d "$ansexp"; then
3617                                         echo "(Looking for $loc_file in directory $value.)"
3618                                         value="$value/$loc_file"
3619                                         ansexp="$ansexp/$loc_file"
3620                                 fi
3621                                 if test -f "$ansexp"; then
3622                                         type=''
3623                                 fi
3624                                 case "$nopath_ok" in
3625                                 true)   case "$value" in
3626                                         */*) ;;
3627                                         *)      echo "Assuming $value will be in people's path."
3628                                                 type=''
3629                                                 ;;
3630                                         esac
3631                                         ;;
3632                                 esac
3633                                 ;;
3634                         esac
3635
3636                         case "$skip" in
3637                         true) type='';
3638                         esac
3639
3640                         case "$type" in
3641                         '') ;;
3642                         *)
3643                                 if test "$fastread" = yes; then
3644                                         dflt=y
3645                                 else
3646                                         dflt=n
3647                                 fi
3648                                 rp="$what $value doesn't exist.  Use that name anyway?"
3649                                 . UU/myread
3650                                 dflt=''
3651                                 case "$ans" in
3652                                 y*) type='';;
3653                                 *) echo " ";;
3654                                 esac
3655                                 ;;
3656                         esac
3657                         ;;
3658                 esac
3659                 ;;
3660         esac
3661 done
3662 cd UU
3663 ans="$value"
3664 rp="$orig_rp"
3665 dflt="$orig_dflt"
3666 rm -f getfile.ok
3667 test "X$gfpthkeep" != Xy && gfpth=""
3668 EOSC
3669
3670 : What should the include directory be ?
3671 echo " "
3672 $echo $n "Hmm...  $c"
3673 dflt='/usr/include'
3674 incpath=''
3675 mips_type=''
3676 if $test -f /bin/mips && /bin/mips; then
3677         echo "Looks like a MIPS system..."
3678         $cat >usr.c <<'EOCP'
3679 #ifdef SYSTYPE_BSD43
3680 /bsd43
3681 #endif
3682 EOCP
3683         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3684                 dflt='/bsd43/usr/include'
3685                 incpath='/bsd43'
3686                 mips_type='BSD 4.3'
3687         else
3688                 mips_type='System V'
3689         fi
3690         $rm -f usr.c usr.out
3691         echo "and you're compiling with the $mips_type compiler and libraries."
3692         xxx_prompt=y
3693         echo "exit 0" >mips
3694 else
3695         echo "Doesn't look like a MIPS system."
3696         xxx_prompt=n
3697         echo "exit 1" >mips
3698 fi
3699 chmod +x mips
3700 $eunicefix mips
3701 case "$usrinc" in
3702 '') ;;
3703 *) dflt="$usrinc";;
3704 esac
3705 case "$xxx_prompt" in
3706 y)      fn=d/
3707         echo " "
3708         rp='Where are the include files you want to use?'
3709         . ./getfile
3710         usrinc="$ans"
3711         ;;
3712 *)      usrinc="$dflt"
3713         ;;
3714 esac
3715
3716 : Set private lib path
3717 case "$plibpth" in
3718 '') if ./mips; then
3719                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3720         fi;;
3721 esac
3722 case "$libpth" in
3723 ' ') dlist='';;
3724 '') dlist="$loclibpth $plibpth $glibpth";;
3725 *) dlist="$libpth";;
3726 esac
3727
3728 : Now check and see which directories actually exist, avoiding duplicates
3729 libpth=''
3730 for xxx in $dlist
3731 do
3732     if $test -d $xxx; then
3733                 case " $libpth " in
3734                 *" $xxx "*) ;;
3735                 *) libpth="$libpth $xxx";;
3736                 esac
3737     fi
3738 done
3739 $cat <<'EOM'
3740
3741 Some systems have incompatible or broken versions of libraries.  Among
3742 the directories listed in the question below, please remove any you
3743 know not to be holding relevant libraries, and add any that are needed.
3744 Say "none" for none.
3745
3746 EOM
3747 case "$libpth" in
3748 '') dflt='none';;
3749 *)
3750         set X $libpth
3751         shift
3752         dflt=${1+"$@"}
3753         ;;
3754 esac
3755 rp="Directories to use for library searches?"
3756 . ./myread
3757 case "$ans" in
3758 none) libpth=' ';;
3759 *) libpth="$ans";;
3760 esac
3761
3762 : compute shared library extension
3763 case "$so" in
3764 '')
3765         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3766                 dflt='sl'
3767         else
3768                 dflt='so'
3769         fi
3770         ;;
3771 *) dflt="$so";;
3772 esac
3773 $cat <<EOM
3774
3775 On some systems, shared libraries may be available.  Answer 'none' if
3776 you want to suppress searching of shared libraries for the remainder
3777 of this configuration.
3778
3779 EOM
3780 rp='What is the file extension used for shared libraries?'
3781 . ./myread
3782 so="$ans"
3783
3784 : Define several unixisms.
3785 : Hints files or command line option can be used to override them.
3786 : The convoluted testing is in case hints files set either the old
3787 : or the new name.
3788 case "$_exe" in
3789 '')     case "$exe_ext" in
3790     '') ;;
3791         *)      _exe="$exe_ext" ;;
3792         esac
3793         ;;
3794 esac
3795 case "$_a" in
3796 '')     case "$lib_ext" in
3797     '') _a='.a';;
3798         *)      _a="$lib_ext" ;;
3799         esac
3800         ;;
3801 esac
3802 case "$_o" in
3803 '') case "$obj_ext" in
3804         '')     _o='.o';;
3805         *)      _o="$obj_ext";;
3806         esac
3807         ;;
3808 esac
3809 case "$p_" in
3810 '') case "$path_sep" in
3811         '')     p_=':';;
3812         *)      p_="$path_sep";;
3813         esac
3814         ;;
3815 esac
3816 exe_ext=$_exe
3817 lib_ext=$_a
3818 obj_ext=$_o
3819 path_sep=$p_
3820
3821 : Which makefile gets called first.  This is used by make depend.
3822 case "$firstmakefile" in
3823 '') firstmakefile='makefile';;
3824 esac
3825
3826 case "$usesocks" in
3827 $define|true|[yY]*)     dflt='y';;
3828 *) dflt='n';;
3829 esac
3830 cat <<EOM
3831
3832 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3833 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3834 to use the PerlIO abstraction layer, this will be implicitly selected.
3835
3836 If this doesn't make any sense to you, just accept the default '$dflt'.
3837 EOM
3838 rp='Build Perl for SOCKS?'
3839 . ./myread
3840 case "$ans" in
3841 y|Y)    val="$define" ;;     
3842 *)      val="$undef" ;;
3843 esac
3844 set usesocks
3845 eval $setvar
3846
3847 case "$usesocks" in
3848 $define|true|[yY]*) useperlio="$define";;
3849 esac
3850
3851 : Looking for optional libraries
3852 echo " "
3853 echo "Checking for optional libraries..." >&4
3854 case "$libs" in
3855 ' '|'') dflt='';;
3856 *) dflt="$libs";;
3857 esac
3858 case "$libswanted" in
3859 '') libswanted='c_s';;
3860 esac
3861 case "$usesocks" in
3862 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3863 esac
3864 libsfound=''
3865 libsfiles=''
3866 libsdirs=''
3867 libspath=''
3868 for thisdir in $libpth $xlibpth; do
3869   test -d $thisdir && libspath="$libspath $thisdir"
3870 done
3871 for thislib in $libswanted; do
3872         for thisdir in $libspath; do
3873             xxx=''
3874             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3875                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3876                 $test -f "$xxx" && eval $libscheck
3877                 $test -f "$xxx" && libstyle=shared
3878             fi
3879             if test ! -f "$xxx"; then
3880                 xxx=$thisdir/lib$thislib.$so
3881                 $test -f "$xxx" && eval $libscheck
3882                 $test -f "$xxx" && libstyle=shared
3883             fi  
3884             if test ! -f "$xxx"; then
3885                 xxx=$thisdir/lib$thislib$_a
3886                 $test -f "$xxx" && eval $libscheck
3887                 $test -f "$xxx" && libstyle=static
3888             fi
3889             if test ! -f "$xxx"; then
3890                 xxx=$thisdir/$thislib$_a
3891                 $test -f "$xxx" && eval $libscheck
3892                 $test -f "$xxx" && libstyle=static
3893             fi
3894             if test ! -f "$xxx"; then
3895                 xxx=$thisdir/lib${thislib}_s$_a
3896                 $test -f "$xxx" && eval $libscheck
3897                 $test -f "$xxx" && libstyle=static
3898                 $test -f "$xxx" && thislib=${thislib}_s
3899             fi
3900             if test ! -f "$xxx"; then
3901                 xxx=$thisdir/Slib$thislib$_a
3902                 $test -f "$xxx" && eval $libscheck
3903                 $test -f "$xxx" && libstyle=static
3904             fi
3905             if $test -f "$xxx"; then
3906                 case "$libstyle" in
3907                 shared) echo "Found -l$thislib (shared)." ;;
3908                 static) echo "Found -l$thislib." ;;
3909                 *)      echo "Found -l$thislib ($libstyle)." ;;
3910                 esac
3911                 case " $dflt " in
3912                 *"-l$thislib "*);;
3913                 *) dflt="$dflt -l$thislib"
3914                    libsfound="$libsfound $xxx"
3915                    yyy=`basename $xxx`
3916                    libsfiles="$libsfiles $yyy"
3917                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3918                    case " $libsdirs " in
3919                    *" $yyy "*) ;;
3920                    *) libsdirs="$libsdirs $yyy" ;;
3921                    esac
3922                    ;;
3923                 esac
3924                 break
3925             fi  
3926         done
3927         if $test ! -f "$xxx"; then
3928             echo "No -l$thislib."
3929         fi
3930 done
3931 set X $dflt
3932 shift
3933 dflt="$*"
3934 case "$libs" in
3935 '') dflt="$dflt";;
3936 *) dflt="$libs";;
3937 esac
3938 case "$dflt" in
3939 ' '|'') dflt='none';;
3940 esac
3941
3942 $cat <<EOM
3943
3944 In order to compile $package on your machine, a number of libraries
3945 are usually needed.  Include any other special libraries here as well.
3946 Say "none" for none.  The default list is almost always right.
3947 EOM
3948
3949 echo " "
3950 rp="What libraries to use?"
3951 . ./myread
3952 case "$ans" in
3953 none) libs=' ';;
3954 *) libs="$ans";;
3955 esac
3956
3957 : determine optimization, if desired, or use for debug flag also
3958 case "$optimize" in
3959 ' '|$undef) dflt='none';;
3960 '') dflt='-O';;
3961 *) dflt="$optimize";;
3962 esac
3963 $cat <<EOH
3964
3965 By default, $package compiles with the -O flag to use the optimizer.
3966 Alternately, you might want to use the symbolic debugger, which uses
3967 the -g flag (on traditional Unix systems).  Either flag can be
3968 specified here.  To use neither flag, specify the word "none".
3969
3970 EOH
3971 rp="What optimizer/debugger flag should be used?"
3972 . ./myread
3973 optimize="$ans"
3974 case "$optimize" in
3975 'none') optimize=" ";;
3976 esac
3977
3978 dflt=''
3979 : We will not override a previous value, but we might want to
3980 : augment a hint file
3981 case "$hint" in
3982 default|recommended)
3983         case "$gccversion" in
3984         1*) dflt='-fpcc-struct-return' ;;
3985         esac
3986         case "$optimize" in
3987         *-g*) dflt="$dflt -DDEBUGGING";;
3988         esac
3989         case "$gccversion" in
3990         2*) if test -d /etc/conf/kconfig.d &&
3991                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3992                 then
3993                         dflt="$dflt -posix"
3994                 fi
3995                 ;;
3996         esac
3997         case "$gccversion" in
3998         1*) ;;
3999         2.[0-8]*) ;;
4000         ?*)     echo " "
4001                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4002                 echo 'int main(void) { return 0; }' > gcctest.c
4003                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4004                         echo "Yes, it does." 2>&1
4005                         case "$ccflags" in
4006                         *strict-aliasing*) 
4007                                 echo "Leaving current flags $ccflags alone." 2>&1
4008                                 ;;
4009                         *) dflt="$dflt -fno-strict-aliasing" ;;
4010                         esac
4011                 else
4012                         echo "Nope, it doesn't, but that's ok." 2>&1
4013                 fi
4014                 ;;
4015         esac
4016         ;;
4017 esac
4018
4019 case "$mips_type" in
4020 *BSD*|'') inclwanted="$locincpth $usrinc";;
4021 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4022 esac
4023 for thisincl in $inclwanted; do
4024         if $test -d $thisincl; then
4025                 if $test x$thisincl != x$usrinc; then
4026                         case "$dflt" in
4027                         *" -I$thisincl "*);;
4028                         *) dflt="$dflt -I$thisincl ";;
4029                         esac
4030                 fi
4031         fi
4032 done
4033
4034 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4035         xxx=true;
4036 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4037         xxx=true;
4038 else
4039         xxx=false;
4040 fi;
4041 if $xxx; then
4042         case "$dflt" in
4043         *$2*);;
4044         *) dflt="$dflt -D$2";;
4045         esac;
4046 fi'
4047
4048 set signal.h LANGUAGE_C; eval $inctest
4049
4050 case "$usesocks" in
4051 $define)
4052         ccflags="$ccflags -DSOCKS"
4053         ;;
4054 esac
4055
4056 case "$hint" in
4057 default|recommended) dflt="$ccflags $dflt" ;;
4058 *) dflt="$ccflags";;
4059 esac
4060
4061 case "$dflt" in
4062 ''|' ') dflt=none;;
4063 esac
4064
4065 $cat <<EOH
4066
4067 Your C compiler may want other flags.  For this question you should include
4068 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4069 but you should NOT include libraries or ld flags like -lwhatever.  If you
4070 want $package to honor its debug switch, you should include -DDEBUGGING here.
4071 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4072
4073 To use no flags, specify the word "none".
4074
4075 EOH
4076 set X $dflt
4077 shift
4078 dflt=${1+"$@"}
4079 rp="Any additional cc flags?"
4080 . ./myread
4081 case "$ans" in
4082 none) ccflags='';;
4083 *) ccflags="$ans";;
4084 esac
4085
4086 : the following weeds options from ccflags that are of no interest to cpp
4087 case "$cppflags" in
4088 '') cppflags="$ccflags" ;;
4089 *)  cppflags="$cppflags $ccflags" ;;
4090 esac
4091 case "$gccversion" in
4092 1*) cppflags="$cppflags -D__GNUC__"
4093 esac
4094 case "$mips_type" in
4095 '');;
4096 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4097 esac
4098 case "$cppflags" in
4099 '');;
4100 *)
4101         echo " "
4102         echo "Let me guess what the preprocessor flags are..." >&4
4103         set X $cppflags
4104         shift
4105         cppflags=''
4106         $cat >cpp.c <<'EOM'
4107 #define BLURFL foo
4108
4109 BLURFL xx LFRULB
4110 EOM
4111         previous=''
4112         for flag in $*
4113         do
4114                 case "$flag" in
4115                 -*) ftry="$flag";;
4116                 *) ftry="$previous $flag";;
4117                 esac
4118                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4119                         >cpp1.out 2>/dev/null && \
4120                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4121                         >cpp2.out 2>/dev/null && \
4122                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4123                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4124                 then
4125                         cppflags="$cppflags $ftry"
4126                         previous=''
4127                 else
4128                         previous="$flag"
4129                 fi
4130         done
4131         set X $cppflags
4132         shift
4133         cppflags=${1+"$@"}
4134         case "$cppflags" in
4135         *-*)  echo "They appear to be: $cppflags";;
4136         esac
4137         $rm -f cpp.c cpp?.out
4138         ;;
4139 esac
4140
4141 : flags used in final linking phase
4142 case "$ldflags" in
4143 '') if ./venix; then
4144                 dflt='-i -z'
4145         else
4146                 dflt=''
4147         fi
4148         case "$ccflags" in
4149         *-posix*) dflt="$dflt -posix" ;;
4150         esac
4151         ;;
4152 *) dflt="$ldflags";;
4153 esac
4154
4155 : Try to guess additional flags to pick up local libraries.
4156 for thislibdir in $libpth; do
4157         case " $loclibpth " in
4158         *" $thislibdir "*)
4159                 case "$dflt " in 
4160                 *"-L$thislibdir "*) ;;
4161                 *)  dflt="$dflt -L$thislibdir" ;;
4162                 esac
4163                 ;;
4164         esac
4165 done
4166
4167 case "$dflt" in
4168 '') dflt='none' ;;
4169 esac
4170
4171 $cat <<EOH
4172
4173 Your C linker may need flags.  For this question you should
4174 include -L/whatever and any other flags used by the C linker, but you
4175 should NOT include libraries like -lwhatever.
4176
4177 Make sure you include the appropriate -L/path flags if your C linker
4178 does not normally search all of the directories you specified above,
4179 namely
4180         $libpth
4181 To use no flags, specify the word "none".
4182
4183 EOH
4184
4185 rp="Any additional ld flags (NOT including libraries)?"
4186 . ./myread
4187 case "$ans" in
4188 none) ldflags='';;
4189 *) ldflags="$ans";;
4190 esac
4191 rmlist="$rmlist pdp11"
4192
4193 : coherency check
4194 echo " "
4195 echo "Checking your choice of C compiler and flags for coherency..." >&4
4196 $cat > try.c <<'EOF'
4197 #include <stdio.h>
4198 int main() { printf("Ok\n"); exit(0); }
4199 EOF
4200 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4201 shift
4202 $cat >try.msg <<'EOM'
4203 I've tried to compile and run the following simple program:
4204
4205 EOM
4206 $cat try.c >> try.msg
4207
4208 $cat >> try.msg <<EOM
4209
4210 I used the command:
4211
4212         $*
4213         ./try
4214
4215 and I got the following output:
4216
4217 EOM
4218 dflt=y
4219 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4220         if $sh -c './try' >>try.msg 2>&1; then
4221                 xxx=`./try`
4222                 case "$xxx" in
4223                 "Ok") dflt=n ;;
4224                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4225                         case " $libs " in
4226                         *" -lsfio "*)
4227                                 cat >> try.msg <<'EOQS'
4228 If $libs contains -lsfio, and sfio is mis-configured, then it
4229 sometimes (apparently) runs and exits with a 0 status, but with no
4230 output!  It may have to do with sfio's use of _exit vs. exit.
4231
4232 EOQS
4233                                 rp="You have a big problem.  Shall I abort Configure"
4234                                 dflt=y
4235                                 ;;
4236                         esac
4237                         ;;
4238                 esac
4239         else
4240                 echo "The program compiled OK, but exited with status $?." >>try.msg
4241                 rp="You have a problem.  Shall I abort Configure"
4242                 dflt=y
4243         fi
4244 else
4245         echo "I can't compile the test program." >>try.msg
4246         rp="You have a BIG problem.  Shall I abort Configure"
4247         dflt=y
4248 fi
4249 case "$dflt" in
4250 y)
4251         $cat try.msg >&4
4252         case "$knowitall" in
4253         '')
4254                 echo "(The supplied flags or libraries might be incorrect.)"
4255                 ;;
4256         *) dflt=n;;
4257         esac
4258         echo " "
4259         . ./myread
4260         case "$ans" in
4261         n*|N*) ;;
4262         *)      echo "Ok.  Stopping Configure." >&4
4263                 exit 1
4264                 ;;
4265         esac
4266         ;;
4267 n) echo "OK, that should do.";;
4268 esac
4269 $rm -f try try.* core
4270
4271 : define an is-a-typedef? function
4272 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4273 case "$inclist" in
4274 "") inclist="sys/types.h";;
4275 esac;
4276 eval "varval=\$$var";
4277 case "$varval" in
4278 "")
4279         $rm -f temp.c;
4280         for inc in $inclist; do
4281                 echo "#include <$inc>" >>temp.c;
4282         done;
4283         echo "#ifdef $type" >> temp.c;
4284         echo "printf(\"We have $type\");" >> temp.c;
4285         echo "#endif" >> temp.c;
4286         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4287         if $contains $type temp.E >/dev/null 2>&1; then
4288                 eval "$var=\$type";
4289         else
4290                 eval "$var=\$def";
4291         fi;
4292         $rm -f temp.?;;
4293 *) eval "$var=\$varval";;
4294 esac'
4295
4296 : define an is-a-typedef? function that prompts if the type is not available.
4297 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4298 case "$inclist" in
4299 "") inclist="sys/types.h";;
4300 esac;
4301 eval "varval=\$$var";
4302 case "$varval" in
4303 "")
4304         $rm -f temp.c;
4305         for inc in $inclist; do
4306                 echo "#include <$inc>" >>temp.c;
4307         done;
4308         echo "#ifdef $type" >> temp.c;
4309         echo "printf(\"We have $type\");" >> temp.c;
4310         echo "#endif" >> temp.c;
4311         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4312         echo " " ;
4313         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4314         if $contains $type temp.E >/dev/null 2>&1; then
4315                 echo "$type found." >&4;
4316                 eval "$var=\$type";
4317         else
4318                 echo "$type NOT found." >&4;
4319                 dflt="$def";
4320                 . ./myread ;
4321                 eval "$var=\$ans";
4322         fi;
4323         $rm -f temp.?;;
4324 *) eval "$var=\$varval";;
4325 esac'
4326
4327 : define a shorthand compile call
4328 compile='
4329 mc_file=$1;
4330 shift;
4331 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4332 : define a shorthand compile call for compilations that should be ok.
4333 compile_ok='
4334 mc_file=$1;
4335 shift;
4336 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4337
4338 : check for lengths of integral types
4339 echo " "
4340 case "$intsize" in
4341 '')
4342         echo "Checking to see how big your integers are..." >&4
4343         $cat >intsize.c <<'EOCP'
4344 #include <stdio.h>
4345 int main()
4346 {
4347         printf("intsize=%d;\n", (int)sizeof(int));
4348         printf("longsize=%d;\n", (int)sizeof(long));
4349         printf("shortsize=%d;\n", (int)sizeof(short));
4350         exit(0);
4351 }
4352 EOCP
4353         set intsize
4354         if eval $compile_ok && ./intsize > /dev/null; then
4355                 eval `./intsize`
4356                 echo "Your integers are $intsize bytes long."
4357                 echo "Your long integers are $longsize bytes long."
4358                 echo "Your short integers are $shortsize bytes long."
4359         else
4360                 $cat >&4 <<EOM
4361 !
4362 Help! I can't compile and run the intsize test program: please enlighten me!
4363 (This is probably a misconfiguration in your system or libraries, and
4364 you really ought to fix it.  Still, I'll try anyway.)
4365 !
4366 EOM
4367                 dflt=4
4368                 rp="What is the size of an integer (in bytes)?"
4369                 . ./myread
4370                 intsize="$ans"
4371                 dflt=$intsize
4372                 rp="What is the size of a long integer (in bytes)?"
4373                 . ./myread
4374                 longsize="$ans"
4375                 dflt=2
4376                 rp="What is the size of a short integer (in bytes)?"
4377                 . ./myread
4378                 shortsize="$ans"
4379         fi
4380         ;;
4381 esac
4382 $rm -f intsize intsize.*
4383
4384 : see what type lseek is declared as in the kernel
4385 rp="What is the type used for lseek's offset on this system?"
4386 set off_t lseektype long stdio.h sys/types.h
4387 eval $typedef_ask
4388
4389 echo " "
4390 echo "Checking to see how big your file offsets are..." >&4
4391 $cat >try.c <<EOCP
4392 #include <sys/types.h>
4393 #include <stdio.h>
4394 int main()
4395 {
4396     printf("%d\n", (int)sizeof($lseektype));
4397     return(0); 
4398 }
4399 EOCP
4400 set try
4401 if eval $compile_ok; then
4402         lseeksize=`./try`
4403         echo "Your file offsets are $lseeksize bytes long."
4404 else
4405         dflt=$longsize
4406         echo " "
4407         echo "(I can't seem to compile the test program.  Guessing...)"
4408         rp="What is the size of your file offsets (in bytes)?"
4409         . ./myread
4410         lseeksize="$ans"
4411 fi
4412 $rm -f try.c try
4413
4414 : see what type file positions are declared as in the library
4415 rp="What is the type for file position used by fsetpos()?"
4416 set fpos_t fpostype long stdio.h sys/types.h
4417 eval $typedef_ask
4418
4419 echo " "
4420 case "$fpostype" in
4421 *_t) zzz="$fpostype"    ;;
4422 *)   zzz="fpos_t"       ;;
4423 esac
4424 echo "Checking the size of $zzz..." >&4 
4425 cat > try.c <<EOCP
4426 #include <sys/types.h>
4427 #include <stdio.h>
4428 int main() {
4429     printf("%d\n", (int)sizeof($fpostype));
4430     exit(0);
4431 }
4432 EOCP
4433 set try
4434 if eval $compile_ok; then
4435         yyy=`./try`
4436         case "$yyy" in
4437         '')     fpossize=4
4438                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4439                 ;;
4440         *)      fpossize=$yyy
4441                 echo "Your $zzz is $fpossize bytes long."
4442                 ;;
4443         esac
4444 else
4445         dflt="$longsize"
4446         echo " " >&4
4447         echo "(I can't compile the test program.  Guessing...)" >&4
4448         rp="What is the size of your file positions (in bytes)?"
4449         . ./myread
4450         fpossize="$ans"
4451 fi
4452
4453
4454
4455 # Backward compatibility (uselfs is deprecated).
4456 case "$uselfs" in
4457 "$define"|true|[yY]*)
4458         cat <<EOM >&4
4459
4460 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4461 EOM
4462         uselargefiles="$define"
4463         ;;
4464 esac                          
4465
4466 case "$lseeksize:$fpossize" in
4467 8:8) cat <<EOM
4468
4469 You can have files larger than 2 gigabytes.
4470 EOM
4471    val="$define" ;;
4472 *)    case "$uselargefiles" in
4473    "$undef"|false|[nN]*) dflt='n' ;;
4474    *)   dflt='y' ;;
4475    esac
4476    cat <<EOM
4477
4478 Perl can be built to understand large files (files larger than 2 gigabytes)
4479 on some systems.  To do so, Configure can be run with -Duselargefiles.
4480
4481 If this doesn't make any sense to you, just accept the default '$dflt'.
4482 EOM
4483    rp='Try to understand large files, if available?'
4484    . ./myread
4485    case "$ans" in
4486    y|Y)         val="$define" ;;
4487    *)           val="$undef"  ;;
4488    esac
4489    ;;
4490 esac
4491 set uselargefiles
4492 eval $setvar
4493 case "$uselargefiles" in
4494 "$define")
4495 : Look for a hint-file generated 'call-back-unit'.  If the
4496 : user has specified that a large files perl is to be built,
4497 : we may need to set or change some other defaults.
4498         if $test -f uselargefiles.cbu; then
4499                 echo "Your platform has some specific hints for large file builds, using them..."
4500                 . ./uselargefiles.cbu
4501                 echo " "
4502                 echo "Rechecking to see how big your file offsets are..." >&4
4503                 $cat >try.c <<EOCP
4504 #include <sys/types.h>
4505 #include <stdio.h>
4506 int main()
4507 {
4508     printf("%d\n", (int)sizeof($lseektype));
4509     return(0); 
4510 }
4511 EOCP
4512                 set try
4513                 if eval $compile_ok; then
4514                         lseeksize=`./try`
4515                         $echo "Your file offsets are now $lseeksize bytes long."
4516                 else
4517                         dflt="$lseeksize"
4518                         echo " "
4519                         echo "(I can't seem to compile the test program.  Guessing...)"
4520                         rp="What is the size of your file offsets (in bytes)?"
4521                         . ./myread
4522                         lseeksize="$ans"
4523                 fi
4524                 case "$fpostype" in
4525                 *_t) zzz="$fpostype"    ;;
4526                 *)   zzz="fpos_t"       ;;
4527                 esac
4528                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4529                 $cat > try.c <<EOCP
4530 #include <sys/types.h>
4531 #include <stdio.h>
4532 int main() {
4533     printf("%d\n", (int)sizeof($fpostype));
4534     exit(0);
4535 }
4536 EOCP
4537                 set try
4538                 if eval $compile_ok; then
4539                         yyy=`./try`
4540                         dflt="$lseeksize"
4541                         case "$yyy" in
4542                         '')     echo " "
4543                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4544                                 ;;
4545                         *)      fpossize=$yyy
4546                                 echo " $fpossize bytes." >&4
4547                                 ;;
4548                         esac
4549                 else
4550                         dflt="$fpossize"
4551                         echo " "
4552                         echo "(I can't compile the test program.  Guessing...)" >&4
4553                         rp="What is the size of your file positions (in bytes)?"
4554                         . ./myread
4555                         fpossize="$ans"
4556                 fi
4557                 $rm -f try.c try
4558         fi
4559         ;;
4560 esac
4561
4562
4563 case "$usemorebits" in
4564 "$define"|true|[yY]*)
4565         use64bitint="$define"
4566         uselongdouble="$define"
4567         usemorebits="$define"
4568         ;;
4569 *)      usemorebits="$undef"
4570         ;;
4571 esac
4572
4573 : check for void type
4574 echo " "
4575 echo "Checking to see how well your C compiler groks the void type..." >&4
4576 case "$voidflags" in
4577 '')
4578         $cat >try.c <<'EOCP'
4579 #if TRY & 1
4580 void sub() {
4581 #else
4582 sub() {
4583 #endif
4584         extern void moo();      /* function returning void */
4585         void (*goo)();          /* ptr to func returning void */
4586 #if TRY & 8
4587         void *hue;              /* generic ptr */
4588 #endif
4589 #if TRY & 2
4590         void (*foo[10])();
4591 #endif
4592
4593 #if TRY & 4
4594         if(goo == moo) {
4595                 exit(0);
4596         }
4597 #endif
4598         exit(0);
4599 }
4600 int main() { sub(); }
4601 EOCP
4602         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4603                 voidflags=$defvoidused
4604         echo "Good.  It appears to support void to the level $package wants.">&4
4605                 if $contains warning .out >/dev/null 2>&1; then
4606                         echo "However, you might get some warnings that look like this:"
4607                         $cat .out
4608                 fi
4609         else
4610 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4611                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4612                         echo "It supports 1..."
4613                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4614                                 echo "It also supports 2..."
4615                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4616                                         voidflags=7
4617                                         echo "And it supports 4 but not 8 definitely."
4618                                 else
4619                                         echo "It doesn't support 4..."
4620                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4621                                                 voidflags=11
4622                                                 echo "But it supports 8."
4623                                         else
4624                                                 voidflags=3
4625                                                 echo "Neither does it support 8."
4626                                         fi
4627                                 fi
4628                         else
4629                                 echo "It does not support 2..."
4630                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4631                                         voidflags=13
4632                                         echo "But it supports 4 and 8."
4633                                 else
4634                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4635                                                 voidflags=5
4636                                                 echo "And it supports 4 but has not heard about 8."
4637                                         else
4638                                                 echo "However it supports 8 but not 4."
4639                                         fi
4640                                 fi
4641                         fi
4642                 else
4643                         echo "There is no support at all for void."
4644                         voidflags=0
4645                 fi
4646         fi
4647 esac
4648 case "$voidflags" in
4649 "$defvoidused") ;;
4650 *)      $cat >&4 <<'EOM'
4651   Support flag bits are:
4652     1: basic void declarations.
4653     2: arrays of pointers to functions returning void.
4654     4: operations between pointers to and addresses of void functions.
4655     8: generic void pointers.
4656 EOM
4657         dflt="$voidflags";
4658         rp="Your void support flags add up to what?"
4659         . ./myread
4660         voidflags="$ans"
4661         ;;
4662 esac
4663 $rm -f try.* .out
4664
4665 : check for length of pointer
4666 echo " "
4667 case "$ptrsize" in
4668 '')
4669         echo "Checking to see how big your pointers are..." >&4
4670         if test "$voidflags" -gt 7; then
4671                 echo '#define VOID_PTR char *' > try.c
4672         else
4673                 echo '#define VOID_PTR void *' > try.c
4674         fi
4675         $cat >>try.c <<'EOCP'
4676 #include <stdio.h>
4677 int main()
4678 {
4679     printf("%d\n", (int)sizeof(VOID_PTR));
4680     exit(0);
4681 }
4682 EOCP
4683         set try
4684         if eval $compile_ok; then
4685                 ptrsize=`./try`
4686                 echo "Your pointers are $ptrsize bytes long."
4687         else
4688                 dflt='4'
4689                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4690                 rp="What is the size of a pointer (in bytes)?"
4691                 . ./myread
4692                 ptrsize="$ans"
4693         fi
4694         ;;
4695 esac
4696 $rm -f try.c try
4697
4698 : check for long long
4699 echo " "
4700 echo "Checking to see if you have long long..." >&4
4701 echo 'int main() { long long x = 7; return 0; }' > try.c
4702 set try
4703 if eval $compile; then
4704         val="$define"
4705         echo "You have long long."
4706 else
4707         val="$undef"
4708         echo "You do not have long long."
4709 fi
4710 $rm try.*
4711 set d_longlong
4712 eval $setvar
4713
4714 : check for length of long long
4715 case "${d_longlong}${longlongsize}" in
4716 $define)
4717         echo " "
4718         echo "Checking to see how big your long longs are..." >&4
4719         $cat >try.c <<'EOCP'
4720 #include <stdio.h>
4721 int main()
4722 {
4723     printf("%d\n", (int)sizeof(long long));
4724     return(0);
4725 }
4726 EOCP
4727         set try
4728         if eval $compile_ok; then
4729                 longlongsize=`./try$exe_ext`
4730                 echo "Your long longs are $longlongsize bytes long."
4731         else
4732                 dflt='8'
4733                 echo " "
4734                 echo "(I can't seem to compile the test program.  Guessing...)"
4735                 rp="What is the size of a long long (in bytes)?"
4736                 . ./myread
4737                 longlongsize="$ans"
4738         fi
4739         if $test "X$longsize" = "X$longlongsize"; then
4740                 echo "(That isn't any different from an ordinary long.)"
4741         fi      
4742         ;;
4743 esac
4744 $rm -f try.* try
4745
4746 : determine filename position in cpp output
4747 echo " "
4748 echo "Computing filename position in cpp output for #include directives..." >&4
4749 echo '#include <stdio.h>' > foo.c
4750 $cat >fieldn <<EOF
4751 $startsh
4752 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4753 $grep '^[       ]*#.*stdio\.h' | \
4754 while read cline; do
4755         pos=1
4756         set \$cline
4757         while $test \$# -gt 0; do
4758                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4759                         echo "\$pos"
4760                         exit 0
4761                 fi
4762                 shift
4763                 pos=\`expr \$pos + 1\`
4764         done
4765 done
4766 EOF
4767 chmod +x fieldn
4768 fieldn=`./fieldn`
4769 $rm -f foo.c fieldn
4770 case $fieldn in
4771 '') pos='???';;
4772 1) pos=first;;
4773 2) pos=second;;
4774 3) pos=third;;
4775 *) pos="${fieldn}th";;
4776 esac
4777 echo "Your cpp writes the filename in the $pos field of the line."
4778
4779 : locate header file
4780 $cat >findhdr <<EOF
4781 $startsh
4782 wanted=\$1
4783 name=''
4784 for usrincdir in $usrinc
4785 do
4786         if test -f \$usrincdir/\$wanted; then
4787                 echo "\$usrincdir/\$wanted"
4788                 exit 0
4789         fi
4790 done
4791 awkprg='{ print \$$fieldn }'
4792 echo "#include <\$wanted>" > foo\$\$.c
4793 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4794 $grep "^[       ]*#.*\$wanted" | \
4795 while read cline; do
4796         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4797         case "\$name" in
4798         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4799         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4800         *) exit 2;;
4801         esac;
4802 done;
4803 #
4804 # status = 0: grep returned 0 lines, case statement not executed
4805 # status = 1: headerfile found
4806 # status = 2: while loop executed, no headerfile found
4807 #
4808 status=\$?
4809 $rm -f foo\$\$.c;
4810 if test \$status -eq 1; then
4811         exit 0;
4812 fi
4813 exit 1
4814 EOF
4815 chmod +x findhdr
4816
4817 : define an alternate in-header-list? function
4818 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4819 cont=true; xxf="echo \"<\$1> found.\" >&4";
4820 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4821 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4822 esac;
4823 case $# in 4) instead=instead;; *) instead="at last";; esac;
4824 while $test "$cont"; do
4825         xxx=`./findhdr $1`
4826         var=$2; eval "was=\$$2";
4827         if $test "$xxx" && $test -r "$xxx";
4828         then eval $xxf;
4829         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4830                 cont="";
4831         else eval $xxnf;
4832         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4833         set $yyy; shift; shift; yyy=$@;
4834         case $# in 0) cont="";;
4835         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4836                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4837         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4838                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4839         esac;
4840 done;
4841 while $test "$yyy";
4842 do set $yyy; var=$2; eval "was=\$$2";
4843         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4844         set $yyy; shift; shift; yyy=$@;
4845 done'
4846
4847 : see if inttypes.h is available
4848 : we want a real compile instead of Inhdr because some systems
4849 : have an inttypes.h which includes non-existent headers
4850 echo " "
4851 $cat >try.c <<EOCP
4852 #include <inttypes.h>
4853 int main() {
4854         static int32_t foo32 = 0x12345678;
4855 }
4856 EOCP
4857 set try
4858 if eval $compile; then
4859         echo "<inttypes.h> found." >&4
4860         val="$define"
4861 else
4862         echo "<inttypes.h> NOT found." >&4
4863         val="$undef"
4864 fi
4865 $rm -f try.c try
4866 set i_inttypes
4867 eval $setvar
4868
4869 : check for int64_t
4870 echo " "
4871 echo "Checking to see if you have int64_t..." >&4
4872 $cat >try.c <<EOCP
4873 #include <sys/types.h>
4874 #$i_inttypes I_INTTYPES
4875 #ifdef I_INTTYPES
4876 #include <inttypes.h>
4877 #endif
4878 int main() { int64_t x = 7; }
4879 EOCP
4880 set try
4881 if eval $compile; then
4882         val="$define"
4883         echo "You have int64_t."
4884 else
4885         val="$undef"
4886         echo "You do not have int64_t."
4887 fi
4888 $rm -f try try.*
4889 set d_int64_t
4890 eval $setvar
4891
4892
4893 echo " "
4894 echo "Checking which 64-bit integer type we could use..." >&4
4895
4896 case "$intsize" in
4897 8) val=int
4898    set quadtype
4899    eval $setvar
4900    val='"unsigned int"'
4901    set uquadtype
4902    eval $setvar
4903    quadkind=1
4904    ;;
4905 *) case "$longsize" in
4906    8) val=long
4907       set quadtype
4908       eval $setvar
4909       val='"unsigned long"'
4910       set uquadtype
4911       eval $setvar
4912       quadkind=2
4913       ;;
4914    *) case "$d_longlong:$longlongsize" in
4915       define:8)
4916         val='"long long"'
4917         set quadtype
4918         eval $setvar
4919         val='"unsigned long long"'
4920         set uquadtype
4921         eval $setvar
4922         quadkind=3
4923         ;;
4924       *) case "$d_int64_t" in
4925          define)
4926            val=int64_t
4927            set quadtype
4928            eval $setvar
4929            val=uint64_t
4930            set uquadtype
4931            eval $setvar
4932            quadkind=4
4933            ;;
4934          esac
4935          ;;
4936       esac
4937       ;;
4938    esac
4939    ;;
4940 esac
4941
4942 case "$quadtype" in
4943 '')     echo "Alas, no 64-bit integer types in sight." >&4
4944         d_quad="$undef"
4945         ;;
4946 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4947         d_quad="$define"
4948         ;;
4949 esac
4950
4951
4952 case "$uselonglong" in
4953 "$define"|true|[yY]*)
4954         cat <<EOM >&4
4955
4956 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4957 EOM
4958         use64bitint="$define"
4959         ;;
4960 esac                          
4961 case "$use64bits" in
4962 "$define"|true|[yY]*)
4963         cat <<EOM >&4
4964
4965 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4966 EOM
4967         use64bitint="$define"
4968         ;;
4969 esac                          
4970 case "$use64bitints" in
4971 "$define"|true|[yY]*)
4972         cat <<EOM >&4
4973
4974 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4975 EOM
4976         use64bitint="$define"
4977         ;;
4978 esac                          
4979 case "$use64bitsint" in
4980 "$define"|true|[yY]*)
4981         cat <<EOM >&4
4982
4983 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4984 EOM
4985         use64bitint="$define"
4986         ;;
4987 esac                          
4988 case "$uselonglongs" in
4989 "$define"|true|[yY]*)
4990         cat <<EOM >&4
4991
4992 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4993 EOM
4994         use64bitint="$define"
4995         ;;
4996 esac                          
4997 case "$use64bitsall" in
4998 "$define"|true|[yY]*)
4999         cat <<EOM >&4
5000
5001 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5002 EOM
5003         use64bitall="$define"
5004         ;;
5005 esac                          
5006
5007 case "$ccflags" in
5008 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5009 esac
5010 case "$use64bitall" in
5011 "$define"|true|[yY]*) use64bitint="$define" ;;
5012 esac
5013
5014 case "$longsize" in
5015 8) cat <<EOM
5016
5017 You have natively 64-bit long integers.
5018 EOM
5019    val="$define"
5020    ;;
5021 *) case "$use64bitint" in
5022    "$define"|true|[yY]*) dflt='y';;
5023    *) dflt='n';;
5024    esac
5025    case "$d_quad" in
5026    "$define") ;;
5027    *) dflt='n' ;;
5028    esac
5029    cat <<EOM
5030
5031 Perl can be built to take advantage of 64-bit integer types
5032 on some systems.  To do so, Configure can be run with -Duse64bitint.
5033 Choosing this option will most probably introduce binary incompatibilities.
5034
5035 If this doesn't make any sense to you, just accept the default '$dflt'.
5036 (The default has been chosen based on your configuration.)
5037 EOM
5038    rp='Try to use 64-bit integers, if available?'
5039    . ./myread
5040    case "$ans" in
5041    [yY]*) val="$define" ;;
5042    *)     val="$undef"  ;;
5043    esac
5044    ;;
5045 esac
5046 set use64bitint
5047 eval $setvar
5048
5049 case "$use64bitall" in
5050 "$define"|true|[yY]*) dflt='y' ;;
5051 *) case "$longsize" in
5052    8) dflt='y' ;;
5053    *) dflt='n' ;;
5054    esac
5055    ;;
5056 esac    
5057 cat <<EOM
5058
5059 You may also choose to try maximal 64-bitness.  It means using as much
5060 64-bitness as possible on the platform.  This in turn means even more
5061 binary incompatibilities.  On the other hand, your platform may not
5062 have any more 64-bitness available than what you already have chosen.
5063
5064 If this doesn't make any sense to you, just accept the default '$dflt'.
5065 (The default has been chosen based on your configuration.)
5066 EOM
5067 rp='Try to use maximal 64-bit support, if available?'
5068 . ./myread
5069 case "$ans" in
5070 [yY]*) val="$define" ;;
5071 *)     val="$undef"  ;;
5072 esac
5073 set use64bitall
5074 eval $setvar
5075 case "$use64bitall" in
5076 "$define")
5077         case "$use64bitint" in
5078         "$undef")
5079                 cat <<EOM
5080
5081 Since you have chosen a maximally 64-bit build, I'm also turning on
5082 the use of 64-bit integers.
5083 EOM
5084                 use64bitint="$define" ;;
5085         esac
5086         ;;
5087 esac
5088
5089 case "$use64bitall" in
5090 "$define"|true|[yY]*)
5091         case "$ptrsize" in
5092         4)      cat <<EOM >&4
5093
5094 *** You have chosen a maximally 64-bit build, but your pointers
5095 *** are only 4 bytes wide, disabling maximal 64-bitness.
5096
5097 EOM
5098                 use64bitall="$undef"
5099                 case "$use64bitint" in
5100                 "$define"|true|[yY]*) ;;
5101                 *)      cat <<EOM >&4
5102
5103 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5104
5105 EOM
5106                         use64bitint="$define"
5107                         ;;
5108                 esac
5109                 ;;
5110         esac
5111         ;;
5112 esac
5113
5114 case "$use64bitint" in
5115 "$define"|true|[yY]*)
5116 : Look for a hint-file generated 'call-back-unit'.  If the
5117 : user has specified that a 64-bit perl is to be built,
5118 : we may need to set or change some other defaults.
5119         if $test -f use64bitint.cbu; then
5120                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5121                 . ./use64bitint.cbu
5122         fi
5123         case "$longsize" in
5124         4) case "$archname64" in
5125            '') archname64=64int ;;
5126            esac
5127            ;;
5128         esac
5129         ;;
5130 esac
5131
5132 case "$use64bitall" in
5133 "$define"|true|[yY]*)
5134 : Look for a hint-file generated 'call-back-unit'.  If the
5135 : user has specified that a maximally 64-bit perl is to be built,
5136 : we may need to set or change some other defaults.
5137         if $test -f use64bitall.cbu; then
5138                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5139                 . ./use64bitall.cbu
5140         fi
5141         case "$longsize" in
5142         4) case "$archname64" in
5143            ''|64int) archname64=64all ;;
5144            esac
5145            ;;
5146         esac
5147         ;;
5148 esac
5149
5150 echo " "
5151 echo "Checking for GNU C Library..." >&4
5152 cat >gnulibc.c <<EOM
5153 #include <stdio.h>
5154 int main()
5155 {
5156 #ifdef __GLIBC__
5157     exit(0);
5158 #else
5159     exit(1);
5160 #endif
5161 }
5162 EOM
5163 set gnulibc
5164 if eval $compile_ok && ./gnulibc; then
5165         val="$define"
5166         echo "You are using the GNU C Library"
5167 else
5168         val="$undef"
5169         echo "You are not using the GNU C Library"
5170 fi
5171 $rm -f gnulibc*
5172 set d_gnulibc
5173 eval $setvar
5174
5175 : see if nm is to be used to determine whether a symbol is defined or not
5176 case "$usenm" in
5177 '')
5178         dflt=''
5179         case "$d_gnulibc" in
5180         "$define")
5181                 echo " "
5182                 echo "nm probably won't work on the GNU C Library." >&4
5183                 dflt=n
5184                 ;;
5185         esac
5186         case "$dflt" in
5187         '') 
5188                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5189                         echo " "
5190                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5191                         echo "'nm' won't be sufficient on this sytem." >&4
5192                         dflt=n
5193                 fi
5194                 ;;
5195         esac
5196         case "$dflt" in
5197         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5198                 if $test $dflt -gt 20; then
5199                         dflt=y
5200                 else
5201                         dflt=n
5202                 fi
5203                 ;;
5204         esac
5205         ;;
5206 *)
5207         case "$usenm" in
5208         true|$define) dflt=y;;
5209         *) dflt=n;;
5210         esac
5211         ;;
5212 esac
5213 $cat <<EOM
5214
5215 I can use $nm to extract the symbols from your C libraries. This
5216 is a time consuming task which may generate huge output on the disk (up
5217 to 3 megabytes) but that should make the symbols extraction faster. The
5218 alternative is to skip the 'nm' extraction part and to compile a small
5219 test program instead to determine whether each symbol is present. If
5220 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5221 this may be the best solution.
5222
5223 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5224
5225 EOM
5226 rp="Shall I use $nm to extract C symbols from the libraries?"
5227 . ./myread
5228 case "$ans" in
5229 [Nn]*) usenm=false;;
5230 *) usenm=true;;
5231 esac
5232
5233 runnm=$usenm
5234 case "$reuseval" in
5235 true) runnm=false;;
5236 esac
5237
5238 : nm options which may be necessary
5239 case "$nm_opt" in
5240 '') if $test -f /mach_boot; then
5241                 nm_opt=''       # Mach
5242         elif $test -d /usr/ccs/lib; then
5243                 nm_opt='-p'     # Solaris (and SunOS?)
5244         elif $test -f /dgux; then
5245                 nm_opt='-p'     # DG-UX
5246         elif $test -f /lib64/rld; then
5247                 nm_opt='-p'     # 64-bit Irix
5248         else
5249                 nm_opt=''
5250         fi;;
5251 esac
5252
5253 : nm options which may be necessary for shared libraries but illegal
5254 : for archive libraries.  Thank you, Linux.
5255 case "$nm_so_opt" in
5256 '')     case "$myuname" in
5257         *linux*)
5258                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5259                         nm_so_opt='--dynamic'
5260                 fi
5261                 ;;
5262         esac
5263         ;;
5264 esac
5265
5266 case "$runnm" in
5267 true)
5268 : get list of predefined functions in a handy place
5269 echo " "
5270 case "$libc" in
5271 '') libc=unknown
5272         case "$libs" in
5273         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5274         esac
5275         ;;
5276 esac
5277 libnames='';
5278 case "$libs" in
5279 '') ;;
5280 *)  for thislib in $libs; do
5281         case "$thislib" in
5282         -lc|-lc_s)
5283                 : Handle C library specially below.
5284                 ;;
5285         -l*)
5286                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5287                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5288                         :
5289                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5290                         :
5291                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5292                         :
5293                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5294                         :
5295                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5296                         :
5297                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5298                         :
5299                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5300                         :
5301                 else
5302                         try=''
5303                 fi
5304                 libnames="$libnames $try"
5305                 ;;
5306         *) libnames="$libnames $thislib" ;;
5307         esac
5308         done
5309         ;;
5310 esac
5311 xxx=normal
5312 case "$libc" in
5313 unknown)
5314         set /lib/libc.$so
5315         for xxx in $libpth; do
5316                 $test -r $1 || set $xxx/libc.$so
5317                 : The messy sed command sorts on library version numbers.
5318                 $test -r $1 || \
5319                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5320                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5321                                 h
5322                                 s/[0-9][0-9]*/0000&/g
5323                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5324                                 G
5325                                 s/\n/ /' | \
5326                          $sort | $sed -e 's/^.* //'`
5327                 eval set \$$#
5328         done
5329         $test -r $1 || set /usr/ccs/lib/libc.$so
5330         $test -r $1 || set /lib/libsys_s$_a
5331         ;;
5332 *)
5333         set blurfl
5334         ;;
5335 esac
5336 if $test -r "$1"; then
5337         echo "Your (shared) C library seems to be in $1."
5338         libc="$1"
5339 elif $test -r /lib/libc && $test -r /lib/clib; then
5340         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5341         xxx=apollo
5342         libc='/lib/clib /lib/libc'
5343         if $test -r /lib/syslib; then
5344                 echo "(Your math library is in /lib/syslib.)"
5345                 libc="$libc /lib/syslib"
5346         fi
5347 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5348         echo "Your C library seems to be in $libc, as you said before."
5349 elif $test -r $incpath/usr/lib/libc$_a; then
5350         libc=$incpath/usr/lib/libc$_a;
5351         echo "Your C library seems to be in $libc.  That's fine."
5352 elif $test -r /lib/libc$_a; then
5353         libc=/lib/libc$_a;
5354         echo "Your C library seems to be in $libc.  You're normal."
5355 else
5356         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5357                 :
5358         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5359                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5360         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5361                 :
5362         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5363                 :
5364         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5365                 :
5366         else
5367                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5368         fi
5369         if $test -r "$tans"; then
5370                 echo "Your C library seems to be in $tans, of all places."
5371                 libc=$tans
5372         else
5373                 libc='blurfl'
5374         fi
5375 fi
5376 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5377         dflt="$libc"
5378         cat <<EOM
5379
5380 If the guess above is wrong (which it might be if you're using a strange
5381 compiler, or your machine supports multiple models), you can override it here.
5382
5383 EOM
5384 else
5385         dflt=''
5386         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5387         cat >&4 <<EOM
5388 I can't seem to find your C library.  I've looked in the following places:
5389
5390 EOM
5391         $sed 's/^/      /' libpath
5392         cat <<EOM
5393
5394 None of these seems to contain your C library. I need to get its name...
5395
5396 EOM
5397 fi
5398 fn=f
5399 rp='Where is your C library?'
5400 . ./getfile
5401 libc="$ans"
5402
5403 echo " "
5404 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5405 set X `cat libnames`
5406 shift
5407 xxx=files
5408 case $# in 1) xxx=file; esac
5409 echo "Extracting names from the following $xxx for later perusal:" >&4
5410 echo " "
5411 $sed 's/^/      /' libnames >&4
5412 echo " "
5413 $echo $n "This may take a while...$c" >&4
5414
5415 for file in $*; do
5416         case $file in
5417         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5418         *) $nm $nm_opt $file 2>/dev/null;;
5419         esac
5420 done >libc.tmp
5421
5422 $echo $n ".$c"
5423 $grep fprintf libc.tmp > libc.ptf
5424 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5425 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5426 xxx='[ADTSIW]'
5427 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5428         eval $xscan;\
5429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5430                 eval $xrun
5431 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5432         eval $xscan;\
5433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5434                 eval $xrun
5435 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5436         eval $xscan;\
5437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5438                 eval $xrun
5439 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5440         eval $xscan;\
5441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5442                 eval $xrun
5443 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5444         eval $xscan;\
5445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5446                 eval $xrun
5447 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5448         eval $xscan;\
5449         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5450                 eval $xrun
5451 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5452                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5453         eval $xscan;\
5454         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5455                 eval $xrun
5456 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5457         eval $xscan;\
5458         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5459                 eval $xrun
5460 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5461         eval $xscan;\
5462         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5463                 eval $xrun
5464 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5465         eval $xscan;\
5466         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5467                 eval $xrun
5468 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5469         eval $xscan;\
5470         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5471                 eval $xrun
5472 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5473         eval $xscan;\
5474         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5475                 eval $xrun
5476 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5477         eval $xscan;\
5478         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5479                 eval $xrun
5480 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5481         eval $xscan;\
5482         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5483                 eval $xrun
5484 else
5485         $nm -p $* 2>/dev/null >libc.tmp
5486         $grep fprintf libc.tmp > libc.ptf
5487         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5488                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5489         then
5490                 nm_opt='-p'
5491                 eval $xrun
5492         else
5493                 echo " "
5494                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5495                 com=''
5496                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5497                         for thisname in $libnames $libc; do
5498                                 $ar t $thisname >>libc.tmp
5499                         done
5500                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5501                         echo "Ok." >&4
5502                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5503                         # Repeat libc to extract forwarders to DLL entries too
5504                         for thisname in $libnames $libc; do
5505                                 $ar tv $thisname >>libc.tmp
5506                                 # Revision 50 of EMX has bug in $ar.
5507                                 # it will not extract forwarders to DLL entries
5508                                 # Use emximp which will extract exactly them.
5509                                 emximp -o tmp.imp $thisname \
5510                                     2>/dev/null && \
5511                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5512                                     < tmp.imp >>libc.tmp
5513                                 $rm tmp.imp
5514                         done
5515                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5516                         echo "Ok." >&4
5517                 else
5518                         echo "$ar didn't seem to work right." >&4
5519                         echo "Maybe this is a Cray...trying bld instead..." >&4
5520                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5521                         then
5522                                 for thisname in $libnames; do
5523                                         bld t $libnames | \
5524                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5525                                         $ar t $thisname >>libc.tmp
5526                                 done
5527                                 echo "Ok." >&4
5528                         else
5529                                 echo "That didn't work either.  Giving up." >&4
5530                                 exit 1
5531                         fi
5532                 fi
5533         fi
5534 fi
5535 nm_extract="$com"
5536 if $test -f /lib/syscalls.exp; then
5537         echo " "
5538         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5539         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5540 fi
5541 ;;
5542 esac
5543 $rm -f libnames libpath
5544
5545 : is a C symbol defined?
5546 csym='tlook=$1;
5547 case "$3" in
5548 -v) tf=libc.tmp; tc=""; tdc="";;
5549 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5550 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5551 esac;
5552 tx=yes;
5553 case "$reuseval-$4" in
5554 true-) ;;
5555 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5556 esac;
5557 case "$tx" in
5558 yes)
5559         case "$runnm" in
5560         true)
5561                 if $contains $tlook $tf >/dev/null 2>&1;
5562                 then tval=true;
5563                 else tval=false;
5564                 fi;;
5565         *)
5566                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5567                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5568                 then tval=true;
5569                 else tval=false;
5570                 fi;
5571                 $rm -f t t.c;;
5572         esac;;
5573 *)
5574         case "$tval" in
5575         $define) tval=true;;
5576         *) tval=false;;
5577         esac;;
5578 esac;
5579 eval "$2=$tval"'
5580
5581 : define an is-in-libc? function
5582 inlibc='echo " "; td=$define; tu=$undef;
5583 sym=$1; var=$2; eval "was=\$$2";
5584 tx=yes;
5585 case "$reuseval$was" in
5586 true) ;;
5587 true*) tx=no;;
5588 esac;
5589 case "$tx" in
5590 yes)
5591         set $sym tres -f;
5592         eval $csym;
5593         case "$tres" in
5594         true)
5595                 echo "$sym() found." >&4;
5596                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5597         *)
5598                 echo "$sym() NOT found." >&4;
5599                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5600         esac;;
5601 *)
5602         case "$was" in
5603         $define) echo "$sym() found." >&4;;
5604         *) echo "$sym() NOT found." >&4;;
5605         esac;;
5606 esac'
5607
5608 : see if sqrtl exists
5609 set sqrtl d_sqrtl
5610 eval $inlibc
5611
5612 case "$ccflags" in
5613 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5614 esac
5615
5616 case "$uselongdouble" in
5617 $define|true|[yY]*)     dflt='y';;
5618 *) dflt='n';;
5619 esac
5620 cat <<EOM
5621
5622 Perl can be built to take advantage of long doubles which
5623 (if available) may give more accuracy and range for floating point numbers.
5624
5625 If this doesn't make any sense to you, just accept the default '$dflt'.
5626 EOM
5627 rp='Try to use long doubles if available?'
5628 . ./myread
5629 case "$ans" in
5630 y|Y)    val="$define"   ;;
5631 *)      val="$undef"    ;;
5632 esac
5633 set uselongdouble
5634 eval $setvar
5635
5636 case "$uselongdouble" in
5637 true|[yY]*) uselongdouble="$define" ;;
5638 esac
5639
5640 case "$uselongdouble" in
5641 $define)
5642 : Look for a hint-file generated 'call-back-unit'.  If the
5643 : user has specified that long doubles should be used,
5644 : we may need to set or change some other defaults.
5645         if $test -f uselongdouble.cbu; then
5646                 echo "Your platform has some specific hints for long doubles, using them..."
5647                 . ./uselongdouble.cbu
5648         else
5649                 $cat <<EOM
5650 (Your platform doesn't have any specific hints for long doubles.)
5651 EOM
5652         fi
5653         ;;
5654 esac
5655
5656 case "$uselongdouble:$d_sqrtl" in
5657 $define:$undef)
5658                 $cat <<EOM >&4
5659
5660 *** You requested the use of long doubles but you do not seem to have
5661 *** the mathematic functions for long doubles.  I'm disabling the use
5662 *** of long doubles.
5663
5664 EOM
5665         uselongdouble=$undef
5666         ;;
5667 esac
5668
5669 : check for length of double
5670 echo " "
5671 case "$doublesize" in
5672 '')
5673         echo "Checking to see how big your double precision numbers are..." >&4
5674         $cat >try.c <<'EOCP'
5675 #include <stdio.h>
5676 int main()
5677 {
5678     printf("%d\n", (int)sizeof(double));
5679     exit(0);
5680 }
5681 EOCP
5682         set try
5683         if eval $compile_ok; then
5684                 doublesize=`./try`
5685                 echo "Your double is $doublesize bytes long."
5686         else
5687                 dflt='8'
5688                 echo "(I can't seem to compile the test program.  Guessing...)"
5689                 rp="What is the size of a double precision number (in bytes)?"
5690                 . ./myread
5691                 doublesize="$ans"
5692         fi
5693         ;;
5694 esac
5695 $rm -f try.c try
5696
5697 : check for long doubles
5698 echo " "
5699 echo "Checking to see if you have long double..." >&4
5700 echo 'int main() { long double x = 7.0; }' > try.c
5701 set try
5702 if eval $compile; then
5703         val="$define"
5704         echo "You have long double."
5705 else
5706         val="$undef"
5707         echo "You do not have long double."
5708 fi
5709 $rm try.*
5710 set d_longdbl
5711 eval $setvar
5712
5713 : check for length of long double
5714 case "${d_longdbl}${longdblsize}" in
5715 $define)
5716         echo " "
5717         echo "Checking to see how big your long doubles are..." >&4
5718         $cat >try.c <<'EOCP'
5719 #include <stdio.h>
5720 int main()
5721 {
5722         printf("%d\n", sizeof(long double));
5723 }
5724 EOCP
5725         set try
5726         set try
5727         if eval $compile; then
5728                 longdblsize=`./try$exe_ext`
5729                 echo "Your long doubles are $longdblsize bytes long."
5730         else
5731                 dflt='8'
5732                 echo " "
5733                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5734                 rp="What is the size of a long double (in bytes)?"
5735                 . ./myread
5736                 longdblsize="$ans"
5737         fi
5738         if $test "X$doublesize" = "X$longdblsize"; then
5739                 echo "(That isn't any different from an ordinary double.)"
5740         fi      
5741         ;;
5742 esac
5743 $rm -f try.* try
5744
5745 case "$useperlio" in
5746 $define|true|[yY]*|'')  dflt='y';;
5747 *) dflt='n';;
5748 esac
5749 cat <<EOM
5750
5751 Previous version of $package used the standard IO mechanisms as
5752 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5753 alternate IO mechanisms via the PerlIO abstraction layer, but the
5754 stdio mechanism is still available if needed.  The abstraction layer
5755 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5756 Using PerlIO with sfio may cause problems with some extension modules.
5757
5758 If this doesn't make any sense to you, just accept the default '$dflt'.
5759 EOM
5760 rp='Use the PerlIO abstraction layer?'
5761 . ./myread
5762 case "$ans" in
5763 y|Y) 
5764         val="$define"
5765         ;;
5766 *)      
5767         echo "Ok, doing things the stdio way."
5768         val="$undef"
5769         ;;
5770 esac
5771 set useperlio
5772 eval $setvar 
5773
5774 case "$usesocks" in
5775 $define|true|[yY]*)
5776         case "$useperlio" in
5777         $define|true|[yY]*) ;;
5778         *)      cat >&4 <<EOM
5779
5780 You are using the SOCKS proxy protocol library which means that you
5781 should also use the PerlIO layer.  You may be headed for trouble.
5782
5783 EOM
5784                 ;;
5785         esac
5786         ;;
5787 esac
5788
5789         
5790 : determine the architecture name
5791 echo " "
5792 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5793         tarch=`arch`"-$osname"
5794 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5795         if uname -m > tmparch 2>&1 ; then
5796                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5797                         -e 's/$/'"-$osname/" tmparch`
5798         else
5799                 tarch="$osname"
5800         fi
5801         $rm -f tmparch
5802 else
5803         tarch="$osname"
5804 fi
5805 case "$myarchname" in
5806 ''|"$tarch") ;;
5807 *)
5808         echo "(Your architecture name used to be $myarchname.)"
5809         archname=''
5810         ;;
5811 esac
5812 myarchname="$tarch"
5813 case "$archname" in
5814 '') dflt="$tarch";;
5815 *) dflt="$archname";;
5816 esac
5817 rp='What is your architecture name'
5818 . ./myread
5819 archname="$ans"
5820 case "$usethreads" in
5821 $define)
5822         echo "Threads selected." >&4
5823         case "$archname" in
5824         *-thread*) echo "...and architecture name already has -thread." >&4
5825                 ;;
5826         *)      archname="$archname-thread"
5827                 echo "...setting architecture name to $archname." >&4
5828                 ;;
5829         esac
5830         ;;
5831 esac
5832 case "$usemultiplicity" in
5833 $define)
5834         echo "Multiplicity selected." >&4
5835         case "$archname" in
5836         *-multi*) echo "...and architecture name already has -multi." >&4
5837                 ;;
5838         *)      archname="$archname-multi"
5839                 echo "...setting architecture name to $archname." >&4
5840                 ;;
5841         esac
5842         ;;
5843 esac
5844 case "$use64bitint$use64bitall" in
5845 *"$define"*)
5846         case "$archname64" in
5847         '')
5848                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5849                 ;;
5850         *)
5851                 case "$use64bitint" in
5852                 "$define") echo "64 bit integers selected." >&4 ;;
5853                 esac
5854                 case "$use64bitall" in
5855                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5856                 esac
5857                 case "$archname" in
5858                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5859                         ;;
5860                 *)      archname="$archname-$archname64"
5861                         echo "...setting architecture name to $archname." >&4
5862                         ;;
5863                 esac
5864                 ;;
5865         esac
5866 esac
5867 case "$uselongdouble" in
5868 $define)
5869         echo "Long doubles selected." >&4
5870         case "$longdblsize" in
5871         $doublesize)
5872                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5873                 ;;
5874         *)
5875                 case "$archname" in
5876                 *-ld*) echo "...and architecture name already has -ld." >&4
5877                         ;;
5878                 *)      archname="$archname-ld"
5879                         echo "...setting architecture name to $archname." >&4
5880                         ;;
5881                 esac
5882                 ;;
5883         esac
5884         ;;
5885 esac
5886 case "$useperlio" in
5887 $define)
5888         echo "Perlio selected." >&4
5889         ;;
5890 *)
5891         echo "Perlio not selected, using stdio." >&4
5892         case "$archname" in
5893         *-stdio*) echo "...and architecture name already has -stdio." >&4
5894                 ;;
5895         *)      archname="$archname-stdio"
5896                 echo "...setting architecture name to $archname." >&4
5897                 ;;
5898         esac
5899         ;;
5900 esac
5901
5902 : determine root of directory hierarchy where package will be installed.
5903 case "$prefix" in
5904 '')
5905         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5906         ;;
5907 *)
5908         dflt="$prefix"
5909         ;;
5910 esac
5911 $cat <<EOM
5912
5913 By default, $package will be installed in $dflt/bin, manual pages
5914 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5915 installation directories. Typically this is something like /usr/local.
5916 If you wish to have binaries under /usr/bin but other parts of the
5917 installation under /usr/local, that's ok: you will be prompted
5918 separately for each of the installation directories, the prefix being
5919 only used to set the defaults.
5920
5921 EOM
5922 fn=d~
5923 rp='Installation prefix to use?'
5924 . ./getfile
5925 oldprefix=''
5926 case "$prefix" in
5927 '') ;;
5928 *)
5929         case "$ans" in
5930         "$prefix") ;;
5931         *) oldprefix="$prefix";;
5932         esac
5933         ;;
5934 esac
5935 prefix="$ans"
5936 prefixexp="$ansexp"
5937
5938 case "$afsroot" in
5939 '')     afsroot=/afs ;;
5940 *)      afsroot=$afsroot ;;
5941 esac
5942
5943 : is AFS running?
5944 echo " "
5945 case "$afs" in
5946 $define|true)   afs=true ;;
5947 $undef|false)   afs=false ;;
5948 *)      if test -d $afsroot; then
5949                 afs=true
5950         else
5951                 afs=false
5952         fi
5953         ;;
5954 esac
5955 if $afs; then
5956         echo "AFS may be running... I'll be extra cautious then..." >&4
5957 else
5958         echo "AFS does not seem to be running..." >&4
5959 fi
5960
5961 : determine installation prefix for where package is to be installed.
5962 if $afs; then 
5963 $cat <<EOM
5964
5965 Since you are running AFS, I need to distinguish the directory in which
5966 files will reside from the directory in which they are installed (and from
5967 which they are presumably copied to the former directory by occult means).
5968
5969 EOM
5970         case "$installprefix" in
5971         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5972         *) dflt="$installprefix";;
5973         esac
5974 else
5975 $cat <<EOM
5976
5977 In some special cases, particularly when building $package for distribution,
5978 it is convenient to distinguish between the directory in which files should 
5979 be installed from the directory ($prefix) in which they 
5980 will eventually reside.  For most users, these two directories are the same.
5981
5982 EOM
5983         case "$installprefix" in
5984         '') dflt=$prefix ;;
5985         *) dflt=$installprefix;;
5986         esac
5987 fi
5988 fn=d~
5989 rp='What installation prefix should I use for installing files?'
5990 . ./getfile
5991 installprefix="$ans"
5992 installprefixexp="$ansexp"
5993
5994 : set the prefixit variable, to compute a suitable default value
5995 prefixit='case "$3" in
5996 ""|none)
5997         case "$oldprefix" in
5998         "") eval "$1=\"\$$2\"";;
5999         *)
6000                 case "$3" in
6001                 "") eval "$1=";;
6002                 none)
6003                         eval "tp=\"\$$2\"";
6004                         case "$tp" in
6005                         ""|" ") eval "$1=\"\$$2\"";;
6006                         *) eval "$1=";;
6007                         esac;;
6008                 esac;;
6009         esac;;
6010 *)
6011         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6012         case "$tp" in
6013         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6014         /*-$oldprefix/*|\~*-$oldprefix/*)
6015                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6016         *) eval "$1=\"\$$2\"";;
6017         esac;;
6018 esac'
6019
6020
6021 : get the patchlevel
6022 echo " "
6023 echo "Getting the current patchlevel..." >&4
6024 if $test -r $rsrc/patchlevel.h;then
6025         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6026         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6027         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6028         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6029         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6030         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6031        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6032 else
6033         revision=0
6034         patchlevel=0
6035         subversion=0
6036         api_revision=0
6037         api_version=0
6038         api_subversion=0
6039         perl_patchlevel=0
6040         $echo "(You do not have patchlevel.h.  Eek.)"
6041 fi
6042 if $test -r $rsrc/.patch ; then  
6043         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6044                 perl_patchlevel=`cat $rsrc/.patch`
6045         fi
6046 fi
6047 case "$perl_patchlevel" in
6048 0)  ;;
6049 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6050 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6051 esac
6052 case "$osname" in
6053 dos|vms)
6054         : XXX Should be a Configure test for double-dots in filenames.
6055         version=`echo $revision $patchlevel $subversion | \
6056                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6057         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6058                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6059         ;;
6060 *)
6061         version=`echo $revision $patchlevel $subversion | \
6062                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6063         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6064                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6065         ;;
6066 esac
6067 : Special case the 5.005_xx maintenance series, which used 5.005
6068 : without any subversion label as a subdirectory in $sitelib
6069 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6070         api_versionstring='5.005'
6071 fi
6072
6073 : determine installation style
6074 : For now, try to deduce it from prefix unless it is already set.
6075 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6076 case "$installstyle" in
6077 '')     case "$prefix" in
6078                 *perl*) dflt='lib';;
6079                 *) dflt='lib/perl5' ;;
6080         esac
6081         ;;
6082 *)      dflt="$installstyle" ;;
6083 esac
6084 : Probably not worth prompting for this since we prompt for all
6085 : the directories individually, and the prompt would be too long and
6086 : confusing anyway.
6087 installstyle=$dflt
6088
6089 : determine where private library files go
6090 : Usual default is /usr/local/lib/perl5/$version.
6091 : Also allow things like /opt/perl/lib/$version, since 
6092 : /opt/perl/lib/perl5... would be redundant.
6093 : The default "style" setting is made in installstyle.U
6094 case "$installstyle" in
6095 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6096 *)       set dflt privlib lib/$version ;;
6097 esac
6098 eval $prefixit
6099 $cat <<EOM
6100
6101 There are some auxiliary files for $package that need to be put into a
6102 private library directory that is accessible by everyone.
6103
6104 EOM
6105 fn=d~+
6106 rp='Pathname where the private library files will reside?'
6107 . ./getfile
6108 privlib="$ans"
6109 privlibexp="$ansexp"
6110 : Change installation prefix, if necessary.
6111 if $test X"$prefix" != X"$installprefix"; then
6112         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6113 else
6114         installprivlib="$privlibexp"
6115 fi
6116
6117 : set the prefixup variable, to restore leading tilda escape
6118 prefixup='case "$prefixexp" in
6119 "$prefix") ;;
6120 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6121 esac'
6122
6123 : determine where public architecture dependent libraries go
6124 set archlib archlib
6125 eval $prefixit
6126 : privlib default is /usr/local/lib/$package/$version
6127 : archlib default is /usr/local/lib/$package/$version/$archname
6128 : privlib may have an optional trailing /share.
6129 tdflt=`echo $privlib | $sed 's,/share$,,'`
6130 tdflt=$tdflt/$archname
6131 case "$archlib" in
6132 '')     dflt=$tdflt
6133         ;;
6134 *)      dflt="$archlib"
6135     ;;
6136 esac
6137 $cat <<EOM
6138
6139 $spackage contains architecture-dependent library files.  If you are
6140 sharing libraries in a heterogeneous environment, you might store
6141 these files in a separate location.  Otherwise, you can just include
6142 them with the rest of the public library files.
6143
6144 EOM
6145 fn=d+~
6146 rp='Where do you want to put the public architecture-dependent libraries?'
6147 . ./getfile
6148 archlib="$ans"
6149 archlibexp="$ansexp"
6150 if $test X"$archlib" = X"$privlib"; then
6151         d_archlib="$undef"
6152 else
6153         d_archlib="$define"
6154 fi
6155 : Change installation prefix, if necessary.
6156 if $test X"$prefix" != X"$installprefix"; then
6157         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6158 else
6159         installarchlib="$archlibexp"
6160 fi
6161
6162
6163 : Binary compatibility with 5.005 is not possible for builds
6164 : with advanced features
6165 case "$usethreads$usemultiplicity" in
6166 *define*)
6167         bincompat5005="$undef"
6168         d_bincompat5005="$undef"
6169         ;;
6170 *)      $cat <<EOM
6171
6172 This version of Perl can be compiled for binary compatibility with 5.005.
6173 If you decide to do so, you will be able to continue using most of the
6174 extensions that were compiled for Perl 5.005.
6175
6176 EOM
6177         case "$bincompat5005$d_bincompat5005" in
6178         *"$undef"*) dflt=n ;;
6179         *) dflt=y ;;
6180         esac
6181         rp='Binary compatibility with Perl 5.005?'
6182         . ./myread
6183         case "$ans" in
6184         y*) val="$define" ;;
6185         *)  val="$undef" ;;
6186         esac
6187         set d_bincompat5005
6188         eval $setvar
6189         case "$d_bincompat5005" in
6190         "$define")
6191                 bincompat5005="$define"
6192                 ;;
6193         *)      bincompat5005="$undef"
6194                 d_bincompat5005="$undef"
6195                 ;;
6196         esac
6197         ;;
6198 esac
6199
6200
6201 : see if setuid scripts can be secure
6202 $cat <<EOM
6203
6204 Some kernels have a bug that prevents setuid #! scripts from being
6205 secure.  Some sites have disabled setuid #! scripts because of this.
6206
6207 First let's decide if your kernel supports secure setuid #! scripts.
6208 (If setuid #! scripts would be secure but have been disabled anyway,
6209 don't say that they are secure if asked.)
6210
6211 EOM
6212
6213 val="$undef"
6214 if $test -d /dev/fd; then
6215         echo "#!$ls" >reflect
6216         chmod +x,u+s reflect
6217         ./reflect >flect 2>&1
6218         if $contains "/dev/fd" flect >/dev/null; then
6219                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6220                 val="$define"
6221         else
6222                 $cat <<EOM
6223 If you are not sure if they are secure, I can check but I'll need a
6224 username and password different from the one you are using right now.
6225 If you don't have such a username or don't want me to test, simply
6226 enter 'none'.
6227
6228 EOM
6229                 rp='Other username to test security of setuid scripts with?'
6230                 dflt='none'
6231                 . ./myread
6232                 case "$ans" in
6233                 n|none)
6234                         case "$d_suidsafe" in
6235                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6236                                 dflt=n;;
6237                         "$undef")
6238                                 echo "Well, the $hint value is *not* secure." >&4
6239                                 dflt=n;;
6240                         *)      echo "Well, the $hint value *is* secure." >&4
6241                                 dflt=y;;
6242                         esac
6243                         ;;
6244                 *)
6245                         $rm -f reflect flect
6246                         echo "#!$ls" >reflect
6247                         chmod +x,u+s reflect
6248                         echo >flect
6249                         chmod a+w flect
6250                         echo '"su" will (probably) prompt you for '"$ans's password."
6251                         su $ans -c './reflect >flect'
6252                         if $contains "/dev/fd" flect >/dev/null; then
6253                                 echo "Okay, it looks like setuid scripts are secure." >&4
6254                                 dflt=y
6255                         else
6256                                 echo "I don't think setuid scripts are secure." >&4
6257                                 dflt=n
6258                         fi
6259                         ;;
6260                 esac
6261                 rp='Does your kernel have *secure* setuid scripts?'
6262                 . ./myread
6263                 case "$ans" in
6264                 [yY]*)  val="$define";;
6265                 *)      val="$undef";;
6266                 esac
6267         fi
6268 else
6269         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6270         echo "(That's for file descriptors, not floppy disks.)"
6271         val="$undef"
6272 fi
6273 set d_suidsafe
6274 eval $setvar
6275
6276 $rm -f reflect flect
6277
6278 : now see if they want to do setuid emulation
6279 echo " "
6280 val="$undef"
6281 case "$d_suidsafe" in
6282 "$define")
6283         val="$undef"
6284         echo "No need to emulate SUID scripts since they are secure here." >& 4
6285         ;;
6286 *)
6287         $cat <<EOM
6288 Some systems have disabled setuid scripts, especially systems where
6289 setuid scripts cannot be secure.  On systems where setuid scripts have
6290 been disabled, the setuid/setgid bits on scripts are currently
6291 useless.  It is possible for $package to detect those bits and emulate
6292 setuid/setgid in a secure fashion.  This emulation will only work if
6293 setuid scripts have been disabled in your kernel.
6294
6295 EOM
6296         case "$d_dosuid" in
6297         "$define") dflt=y ;;
6298         *) dflt=n ;;
6299         esac
6300         rp="Do you want to do setuid/setgid emulation?"
6301         . ./myread
6302         case "$ans" in
6303         [yY]*)  val="$define";;
6304         *)      val="$undef";;
6305         esac
6306         ;;
6307 esac
6308 set d_dosuid
6309 eval $setvar
6310
6311 : see if this is a malloc.h system
6312 set malloc.h i_malloc
6313 eval $inhdr
6314
6315 : see if stdlib is available
6316 set stdlib.h i_stdlib
6317 eval $inhdr
6318
6319 : determine which malloc to compile in
6320 echo " "
6321 case "$usemymalloc" in
6322 [yY]*|true|$define)     dflt='y' ;;
6323 [nN]*|false|$undef)     dflt='n' ;;
6324 *)      case "$ptrsize" in
6325         4) dflt='y' ;;
6326         *) dflt='n' ;;
6327         esac
6328         ;;
6329 esac
6330 rp="Do you wish to attempt to use the malloc that comes with $package?"
6331 . ./myread
6332 usemymalloc="$ans"
6333 case "$ans" in
6334 y*|true)
6335         usemymalloc='y'
6336         mallocsrc='malloc.c'
6337         mallocobj="malloc$_o"
6338         d_mymalloc="$define"
6339         case "$libs" in
6340         *-lmalloc*)
6341                 : Remove malloc from list of libraries to use
6342                 echo "Removing unneeded -lmalloc from library list" >&4
6343                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6344                 shift
6345                 libs="$*"
6346                 echo "libs = $libs" >&4
6347                 ;;
6348         esac
6349         ;;
6350 *)
6351         usemymalloc='n'
6352         mallocsrc=''
6353         mallocobj=''
6354         d_mymalloc="$undef"
6355         ;;
6356 esac
6357
6358 : compute the return types of malloc and free
6359 echo " "
6360 $cat >malloc.c <<END
6361 #$i_malloc I_MALLOC
6362 #$i_stdlib I_STDLIB
6363 #include <stdio.h>
6364 #include <sys/types.h>
6365 #ifdef I_MALLOC
6366 #include <malloc.h>
6367 #endif
6368 #ifdef I_STDLIB
6369 #include <stdlib.h>
6370 #endif
6371 #ifdef TRY_MALLOC
6372 void *malloc();
6373 #endif
6374 #ifdef TRY_FREE
6375 void free();
6376 #endif
6377 END
6378 case "$malloctype" in
6379 '')
6380         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6381                 malloctype='void *'
6382         else
6383                 malloctype='char *'
6384         fi
6385         ;;
6386 esac
6387 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6388
6389 case "$freetype" in
6390 '')
6391         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6392                 freetype='void'
6393         else
6394                 freetype='int'
6395         fi
6396         ;;
6397 esac
6398 echo "Your system uses $freetype free(), it would seem." >&4
6399 $rm -f malloc.[co]
6400 $cat <<EOM
6401
6402 After $package is installed, you may wish to install various
6403 add-on modules and utilities.  Typically, these add-ons will
6404 be installed under $prefix with the rest
6405 of this package.  However, you may wish to install such add-ons
6406 elsewhere under a different prefix.
6407
6408 If you do not wish to put everything under a single prefix, that's
6409 ok.  You will be prompted for the individual locations; this siteprefix
6410 is only used to suggest the defaults.
6411
6412 The default should be fine for most people.
6413
6414 EOM
6415 fn=d~+
6416 rp='Installation prefix to use for add-on modules and utilities?'
6417 : XXX Here might be another good place for an installstyle setting.
6418 case "$siteprefix" in
6419 '') dflt=$prefix ;;
6420 *)  dflt=$siteprefix ;;
6421 esac
6422 . ./getfile
6423 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6424 oldsiteprefix=''
6425 case "$siteprefix" in
6426 '') ;;
6427 *)      case "$ans" in
6428         "$prefix") ;;
6429         *) oldsiteprefix="$prefix";;
6430         esac
6431         ;;
6432 esac
6433 siteprefix="$ans"
6434 siteprefixexp="$ansexp"
6435
6436 : determine where site specific libraries go.
6437 : Usual default is /usr/local/lib/perl5/site_perl/$version
6438 : The default "style" setting is made in installstyle.U
6439 : XXX No longer works with Prefixit stuff.
6440 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6441 case "$sitelib" in
6442 '') case "$installstyle" in
6443         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6444         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6445         esac
6446         ;;
6447 *)      dflt="$sitelib"
6448         ;;
6449 esac
6450 $cat <<EOM
6451
6452 The installation process will create a directory for
6453 site-specific extensions and modules.  Most users find it convenient
6454 to place all site-specific files in this directory rather than in the
6455 main distribution directory.
6456
6457 EOM
6458 fn=d~+
6459 rp='Pathname for the site-specific library files?'
6460 . ./getfile
6461 sitelib="$ans"
6462 sitelibexp="$ansexp"
6463 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6464 : Change installation prefix, if necessary.
6465 if $test X"$prefix" != X"$installprefix"; then
6466         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6467 else
6468         installsitelib="$sitelibexp"
6469 fi
6470
6471 : determine where site specific architecture-dependent libraries go.
6472 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6473 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6474 : sitelib may have an optional trailing /share.
6475 case "$sitearch" in
6476 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6477         dflt="$dflt/$archname"
6478         ;;
6479 *)      dflt="$sitearch"
6480         ;;
6481 esac
6482 set sitearch sitearch none
6483 eval $prefixit
6484 $cat <<EOM
6485
6486 The installation process will also create a directory for
6487 architecture-dependent site-specific extensions and modules.
6488
6489 EOM
6490 fn=d~+
6491 rp='Pathname for the site-specific architecture-dependent library files?'
6492 . ./getfile
6493 sitearch="$ans"
6494 sitearchexp="$ansexp"
6495 : Change installation prefix, if necessary.
6496 if $test X"$prefix" != X"$installprefix"; then
6497         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6498 else
6499         installsitearch="$sitearchexp"
6500 fi
6501
6502 $cat <<EOM
6503
6504 The installation process will also create a directory for
6505 vendor-supplied add-ons.  Vendors who supply perl with their system
6506 may find it convenient to place all vendor-supplied files in this
6507 directory rather than in the main distribution directory.  This will
6508 ease upgrades between binary-compatible maintenance versions of perl.
6509
6510 Of course you may also use these directories in whatever way you see
6511 fit.  For example, you might use them to access modules shared over a
6512 company-wide network.
6513
6514 The default answer should be fine for most people.
6515 This causes further questions about vendor add-ons to be skipped
6516 and no vendor-specific directories will be configured for perl.
6517
6518 EOM
6519 rp='Do you want to configure vendor-specific add-on directories?'
6520 case "$usevendorprefix" in
6521 define|true|[yY]*) dflt=y ;;
6522 *)      : User may have set vendorprefix directly on Configure command line.
6523         case "$vendorprefix" in
6524         ''|' ') dflt=n ;;
6525         *)      dflt=y ;;
6526         esac
6527         ;;
6528 esac
6529 . ./myread
6530 case "$ans" in
6531 [yY]*)  fn=d~+
6532         rp='Installation prefix to use for vendor-supplied add-ons?'
6533         case "$vendorprefix" in
6534         '') dflt='' ;;
6535         *)  dflt=$vendorprefix ;;
6536         esac
6537         . ./getfile
6538         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6539         oldvendorprefix=''
6540         case "$vendorprefix" in
6541         '') ;;
6542         *)      case "$ans" in
6543                 "$prefix") ;;
6544                 *) oldvendorprefix="$prefix";;
6545                 esac
6546                 ;;
6547         esac
6548         usevendorprefix="$define"
6549         vendorprefix="$ans"
6550         vendorprefixexp="$ansexp"
6551         ;;
6552 *)      usevendorprefix="$undef"
6553         vendorprefix=''
6554         vendorprefixexp=''
6555         ;;
6556 esac
6557
6558 case "$vendorprefix" in
6559 '')     d_vendorlib="$undef"
6560         vendorlib=''
6561         vendorlibexp=''
6562         ;;
6563 *)      d_vendorlib="$define"
6564         : determine where vendor-supplied modules go.
6565         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6566         case "$vendorlib" in
6567         '')
6568                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6569                 case "$installstyle" in
6570                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6571                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6572                 esac
6573                 ;;
6574         *)      dflt="$vendorlib"
6575                 ;;
6576         esac
6577         fn=d~+
6578         rp='Pathname for the vendor-supplied library files?'
6579         . ./getfile
6580         vendorlib="$ans"
6581         vendorlibexp="$ansexp"
6582         ;;
6583 esac
6584 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6585 : Change installation prefix, if necessary.
6586 if $test X"$prefix" != X"$installprefix"; then
6587         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6588 else
6589         installvendorlib="$vendorlibexp"
6590 fi
6591
6592 case "$vendorprefix" in
6593 '')     d_vendorarch="$undef"
6594         vendorarch=''
6595         vendorarchexp=''
6596         ;;
6597 *)      d_vendorarch="$define"
6598         : determine where vendor-supplied architecture-dependent libraries go.
6599         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6600         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6601         : vendorlib may have an optional trailing /share.
6602         case "$vendorarch" in
6603         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6604                 dflt="$dflt/$archname"
6605                 ;;
6606         *)      dflt="$vendorarch" ;;
6607         esac
6608         fn=d~+
6609         rp='Pathname for vendor-supplied architecture-dependent files?'
6610         . ./getfile
6611         vendorarch="$ans"
6612         vendorarchexp="$ansexp"
6613         ;;
6614 esac
6615 : Change installation prefix, if necessary.
6616 if $test X"$prefix" != X"$installprefix"; then
6617         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6618 else
6619         installvendorarch="$vendorarchexp"
6620 fi
6621
6622 : Final catch-all directories to search
6623 $cat <<EOM
6624
6625 Lastly, you can have perl look in other directories for extensions and
6626 modules in addition to those already specified.
6627 These directories will be searched after 
6628         $sitearch 
6629         $sitelib 
6630 EOM
6631 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6632 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6633 echo ' '
6634 case "$otherlibdirs" in
6635 ''|' ') dflt='none' ;;
6636 *)      dflt="$otherlibdirs" ;;
6637 esac
6638 $cat <<EOM
6639 Enter a colon-separated set of extra paths to include in perl's @INC
6640 search path, or enter 'none' for no extra paths.
6641
6642 EOM
6643
6644 rp='Colon-separated list of additional directories for perl to search?'
6645 . ./myread
6646 case "$ans" in
6647 ' '|''|none)    otherlibdirs=' ' ;;     
6648 *)      otherlibdirs="$ans" ;;
6649 esac
6650 case "$otherlibdirs" in
6651 ' ') val=$undef ;;
6652 *)      val=$define ;;
6653 esac
6654 set d_perl_otherlibdirs
6655 eval $setvar
6656
6657 : Cruising for prototypes
6658 echo " "
6659 echo "Checking out function prototypes..." >&4
6660 $cat >prototype.c <<'EOCP'
6661 int main(int argc, char *argv[]) {
6662         exit(0);}
6663 EOCP
6664 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6665         echo "Your C compiler appears to support function prototypes."
6666         val="$define"
6667 else
6668         echo "Your C compiler doesn't seem to understand function prototypes."
6669         val="$undef"
6670 fi
6671 set prototype
6672 eval $setvar
6673 $rm -f prototype*
6674
6675 case "$prototype" in
6676 "$define") ;;
6677 *)      ansi2knr='ansi2knr'
6678         echo " "
6679         cat <<EOM >&4
6680
6681 $me:  FATAL ERROR:
6682 This version of $package can only be compiled by a compiler that 
6683 understands function prototypes.  Unfortunately, your C compiler 
6684         $cc $ccflags
6685 doesn't seem to understand them.  Sorry about that.
6686
6687 If GNU cc is available for your system, perhaps you could try that instead.  
6688
6689 Eventually, we hope to support building Perl with pre-ANSI compilers.
6690 If you would like to help in that effort, please contact <perlbug@perl.org>.
6691
6692 Aborting Configure now.
6693 EOM
6694         exit 2
6695         ;;
6696 esac
6697
6698 : determine where public executables go
6699 echo " "
6700 set dflt bin bin
6701 eval $prefixit
6702 fn=d~
6703 rp='Pathname where the public executables will reside?'
6704 . ./getfile
6705 if $test "X$ansexp" != "X$binexp"; then
6706         installbin=''
6707 fi
6708 bin="$ans"
6709 binexp="$ansexp"
6710 : Change installation prefix, if necessary.
6711 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6712 if $test X"$prefix" != X"$installprefix"; then
6713         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6714 else
6715         installbin="$binexp"
6716 fi
6717
6718 : Find perl5.005 or later.
6719 echo "Looking for a previously installed perl5.005 or later... "
6720 case "$perl5" in
6721 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6722                 : Check if this perl is recent and can load a simple module
6723                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6724                         perl5=$tdir/perl
6725                         break;
6726                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6727                         perl5=$tdir/perl5
6728                         break;
6729                 fi
6730         done
6731         ;;
6732 *)      perl5="$perl5"
6733         ;;
6734 esac
6735 case "$perl5" in
6736 '')     echo "None found.  That's ok.";;
6737 *)      echo "Using $perl5." ;;
6738 esac
6739
6740 : Determine list of previous versions to include in @INC
6741 $cat > getverlist <<EOPL
6742 #!$perl5 -w
6743 use File::Basename;
6744 \$api_versionstring = "$api_versionstring";
6745 \$version = "$version";
6746 \$stem = "$sitelib_stem";
6747 \$archname = "$archname";
6748 EOPL
6749         $cat >> getverlist <<'EOPL'
6750 # Can't have leading @ because metaconfig interprets it as a command!
6751 ;@inc_version_list=();
6752 # XXX Redo to do opendir/readdir? 
6753 if (-d $stem) {
6754     chdir($stem);
6755     ;@candidates = glob("5.*");
6756 }
6757 else {
6758     ;@candidates = ();
6759 }
6760
6761 # XXX ToDo:  These comparisons must be reworked when two-digit
6762 # subversions come along, so that 5.7.10 compares as greater than
6763 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6764 # widespread that we can use the built-in version vectors rather
6765 # than reinventing them here.  For 5.6.0, however, we must
6766 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6767 foreach $d (@candidates) {
6768     if ($d lt $version) {
6769         if ($d ge $api_versionstring) {
6770             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6771         }
6772         elsif ($d ge "5.005") {
6773             unshift(@inc_version_list, grep { -d } $d);
6774         }
6775     }
6776     else {
6777         # Skip newer version.  I.e. don't look in
6778         # 5.7.0 if we're installing 5.6.1.
6779     }
6780 }
6781
6782 if (@inc_version_list) {
6783     print join(' ', @inc_version_list);
6784 }
6785 else {
6786     # Blank space to preserve value for next Configure run.
6787     print " ";
6788 }
6789 EOPL
6790 chmod +x getverlist
6791 case "$inc_version_list" in
6792 '')     if test -x "$perl5$exe_ext"; then
6793                 dflt=`$perl5 getverlist`
6794         else
6795                 dflt='none'
6796         fi
6797         ;;
6798 $undef) dflt='none' ;;
6799 *)  eval dflt=\"$inc_version_list\" ;;
6800 esac
6801 case "$dflt" in
6802 ''|' ') dflt=none ;;
6803 esac
6804 case "$dflt" in
6805 5.005) case "$bincompat5005" in
6806        $define|true|[yY]*) ;;
6807        *) dflt=none ;;
6808        esac
6809        ;;
6810 esac
6811 $cat <<'EOM'
6812
6813 In order to ease the process of upgrading, this version of perl 
6814 can be configured to use modules built and installed with earlier 
6815 versions of perl that were installed under $prefix.  Specify here
6816 the list of earlier versions that this version of perl should check.
6817 If Configure detected no earlier versions of perl installed under
6818 $prefix, then the list will be empty.  Answer 'none' to tell perl
6819 to not search earlier versions.
6820
6821 The default should almost always be sensible, so if you're not sure,
6822 just accept the default.
6823 EOM
6824
6825 rp='List of earlier versions to include in @INC?'
6826 . ./myread
6827 case "$ans" in
6828 [Nn]one|''|' ') inc_version_list=' ' ;;
6829 *) inc_version_list="$ans" ;;
6830 esac
6831 case "$inc_version_list" in
6832 ''|' ') 
6833         inc_version_list_init='0';;
6834 *)      inc_version_list_init=`echo $inc_version_list |
6835                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6836         ;;
6837 esac
6838 $rm -f getverlist
6839
6840 : determine whether to install perl also as /usr/bin/perl
6841
6842 echo " "
6843 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6844         $cat <<EOM
6845 Many scripts expect perl to be installed as /usr/bin/perl.
6846 I can install the perl you are about to compile also as /usr/bin/perl
6847 (in addition to $installbin/perl).
6848 EOM
6849         case "$installusrbinperl" in
6850         "$undef"|[nN]*) dflt='n';;
6851         *)              dflt='y';;
6852         esac
6853         rp="Do you want to install perl as /usr/bin/perl?"
6854         . ./myread
6855         case "$ans" in
6856         [yY]*)  val="$define";;
6857         *)      val="$undef" ;;
6858         esac
6859 else
6860         val="$undef"
6861 fi
6862 set installusrbinperl
6863 eval $setvar
6864
6865 : see if dld is available
6866 set dld.h i_dld
6867 eval $inhdr
6868
6869 : see if dlopen exists
6870 xxx_runnm="$runnm"
6871 runnm=false
6872 set dlopen d_dlopen
6873 eval $inlibc
6874 runnm="$xxx_runnm"
6875
6876 : determine which dynamic loading, if any, to compile in
6877 echo " "
6878 dldir="ext/DynaLoader"
6879 case "$usedl" in
6880 $define|y|true)
6881         dflt='y'
6882         usedl="$define"
6883         ;;
6884 $undef|n|false)
6885         dflt='n'
6886         usedl="$undef"
6887         ;;
6888 *) 
6889         dflt='n'
6890         case "$d_dlopen" in
6891             $define) dflt='y' ;;
6892         esac
6893         case "$i_dld" in
6894             $define) dflt='y' ;;
6895         esac
6896         : Does a dl_xxx.xs file exist for this operating system
6897         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6898         ;;
6899 esac
6900 rp="Do you wish to use dynamic loading?"
6901 . ./myread
6902 usedl="$ans"
6903 case "$ans" in
6904 y*) usedl="$define"
6905         case "$dlsrc" in
6906         '')
6907                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6908                         dflt="$dldir/dl_${osname}.xs"
6909                 elif $test "$d_dlopen" = "$define" ; then
6910                         dflt="$dldir/dl_dlopen.xs"
6911                 elif $test "$i_dld" = "$define" ; then
6912                         dflt="$dldir/dl_dld.xs"
6913                 else
6914                         dflt=''
6915                 fi
6916                 ;;
6917         *)      dflt="$dldir/$dlsrc"
6918                 ;;
6919         esac
6920     echo "The following dynamic loading files are available:"
6921         : Can not go over to $dldir because getfile has path hard-coded in.
6922         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6923         rp="Source file to use for dynamic loading"
6924         fn="fne"
6925         gfpth="$src"
6926         . ./getfile
6927         usedl="$define"
6928         : emulate basename
6929         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6930
6931         $cat << EOM
6932
6933 Some systems may require passing special flags to $cc -c to
6934 compile modules that will be used to create a shared library.
6935 To use no flags, say "none".
6936
6937 EOM
6938     case "$cccdlflags" in
6939     '') case "$gccversion" in
6940                 '') case "$osname" in
6941                         hpux)   dflt='+z' ;;
6942                         next)   dflt='none' ;;
6943                         irix*)  dflt='-KPIC' ;;
6944                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6945                         sunos)  dflt='-pic' ;;
6946                         *)      dflt='none' ;;
6947                     esac
6948                         ;;
6949                 *)  case "$osname" in
6950                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6951                         *)      dflt='-fpic' ;;
6952                     esac ;;
6953             esac ;;
6954         ' ') dflt='none' ;;
6955     *)  dflt="$cccdlflags" ;;
6956     esac
6957     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6958     . ./myread
6959     case "$ans" in
6960     none) cccdlflags=' ' ;;
6961     *) cccdlflags="$ans" ;;
6962     esac
6963
6964     cat << EOM
6965
6966 Some systems use ld to create libraries that can be dynamically loaded,
6967 while other systems (such as those using ELF) use $cc.
6968
6969 EOM
6970         case "$ld" in
6971         '')     $cat >try.c <<'EOM'
6972 /* Test for whether ELF binaries are produced */
6973 #include <fcntl.h>
6974 #include <stdlib.h>
6975 int main() {
6976         char b[4];
6977         int i = open("a.out",O_RDONLY);
6978         if(i == -1) 
6979                 exit(1); /* fail */
6980         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6981                 exit(0); /* succeed (yes, it's ELF) */
6982         else
6983                 exit(1); /* fail */
6984 }
6985 EOM
6986                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6987                         cat <<EOM
6988 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6989 EOM
6990                         dflt="$cc"
6991                 else
6992                         echo "I'll use ld to build dynamic libraries."
6993                         dflt='ld'
6994                 fi
6995                 rm -f try.c a.out
6996                 ;;
6997         *)      dflt="$ld"
6998                 ;;
6999         esac
7000
7001     rp="What command should be used to create dynamic libraries?"
7002     . ./myread
7003         ld="$ans"
7004
7005     cat << EOM
7006
7007 Some systems may require passing special flags to $ld to create a
7008 library that can be dynamically loaded.  If your ld flags include
7009 -L/other/path options to locate libraries outside your loader's normal
7010 search path, you may need to specify those -L options here as well.  To
7011 use no flags, say "none".
7012
7013 EOM
7014     case "$lddlflags" in
7015     '') case "$osname" in
7016                         beos) dflt='-nostart' ;;
7017                         hpux) dflt='-b';
7018                               case "$gccversion" in
7019                               '') dflt="$dflt +vnocompatwarnings" ;;
7020                               esac
7021                               ;;        
7022                         linux|irix*)    dflt='-shared' ;;
7023                         next)  dflt='none' ;;
7024                         solaris) dflt='-G' ;;
7025                         sunos) dflt='-assert nodefinitions' ;;
7026                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7027                 *)     dflt='none' ;;
7028                         esac
7029                         ;;
7030     *) dflt="$lddlflags" ;;
7031     esac
7032
7033         : Try to guess additional flags to pick up local libraries.
7034         : Be careful not to append to a plain 'none'
7035         case "$dflt" in
7036         none) dflt='' ;;
7037         esac
7038         for thisflag in $ldflags; do
7039                 case "$thisflag" in
7040                 -L*|-R*)
7041                         case " $dflt " in
7042                         *" $thisflag "*) ;;
7043                         *) dflt="$dflt $thisflag" ;;
7044                         esac
7045                         ;;
7046                 esac
7047         done
7048
7049         case "$dflt" in
7050         ''|' ') dflt='none' ;;
7051         esac
7052
7053     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7054     . ./myread
7055     case "$ans" in
7056     none) lddlflags=' ' ;;
7057     *) lddlflags="$ans" ;;
7058     esac
7059
7060         cat <<EOM
7061
7062 Some systems may require passing special flags to $cc to indicate that
7063 the resulting executable will use dynamic linking.  To use no flags,
7064 say "none".
7065
7066 EOM
7067     case "$ccdlflags" in
7068     '') case "$osname" in
7069                 hpux)   dflt='-Wl,-E' ;;
7070                 linux)  dflt='-rdynamic' ;;
7071                 next)   dflt='none' ;;
7072                 sunos)  dflt='none' ;;
7073                 *)      dflt='none' ;;
7074             esac ;;
7075     ' ')  dflt='none' ;;
7076     *)  dflt="$ccdlflags" ;;
7077     esac
7078     rp="Any special flags to pass to $cc to use dynamic linking?"
7079     . ./myread
7080     case "$ans" in
7081     none) ccdlflags=' ' ;;
7082     *) ccdlflags="$ans" ;;
7083     esac
7084     ;;
7085 *)  usedl="$undef"
7086         ld='ld'
7087     dlsrc='dl_none.xs'
7088     lddlflags=''
7089     ccdlflags=''
7090     ;;
7091 esac
7092
7093 also=''
7094 case "$usedl" in
7095 $undef)
7096         # No dynamic loading being used, so don't bother even to prompt.
7097         useshrplib='false'
7098         ;;
7099 *)      case "$useshrplib" in
7100         '')     case "$osname" in
7101                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7102                         dflt=y
7103                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7104                         ;;
7105                 next*)
7106                         case "$osvers" in
7107                         4*)     dflt=y
7108                                 also='Building a shared libperl is needed for MAB support.'
7109                                 ;;
7110                         *)      dflt=n
7111                                 ;;
7112                         esac
7113                         ;;
7114                 *)      dflt=n
7115                         ;;
7116                 esac
7117                 ;;
7118         $define|true|[Yy]*)
7119                 dflt=y
7120                 ;;
7121         *)      dflt=n
7122                 ;;
7123         esac
7124         $cat << EOM
7125
7126 The perl executable is normally obtained by linking perlmain.c with
7127 libperl${_a}, any static extensions (usually just DynaLoader), and
7128 any other libraries needed on this system (such as -lm, etc.).  Since
7129 your system supports dynamic loading, it is probably possible to build
7130 a shared libperl.$so.  If you will have more than one executable linked
7131 to libperl.$so, this will significantly reduce the size of each
7132 executable, but it may have a noticeable affect on performance.  The
7133 default is probably sensible for your system.
7134 $also
7135
7136 EOM
7137         rp="Build a shared libperl.$so (y/n)"
7138         . ./myread
7139         case "$ans" in
7140         true|$define|[Yy]*)
7141                 useshrplib='true'  ;;
7142         *)      useshrplib='false' ;;
7143         esac
7144         ;;
7145 esac
7146
7147 case "$useshrplib" in
7148 true)
7149         case "$libperl" in
7150         '')
7151                 # Figure out a good name for libperl.so.  Since it gets stored in
7152                 # a version-specific architecture-dependent library, the version
7153                 # number isn't really that important, except for making cc/ld happy.
7154                 #
7155                 # A name such as libperl.so.3.1
7156                 majmin="libperl.$so.$patchlevel.$subversion"
7157                 # A name such as libperl.so.301
7158                 majonly=`echo $patchlevel $subversion |
7159                         $awk '{printf "%d%02d", $1, $2}'`
7160                 majonly=libperl.$so.$majonly
7161                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7162                 # rely on figuring it out from the naming of libc.
7163                 case "${osname}${osvers}" in
7164                 next4*)
7165                         dflt=libperl.5.$so
7166                         # XXX How handle the --version stuff for MAB?
7167                         ;;
7168                 linux*)  # ld won't link with a bare -lperl otherwise.
7169                         dflt=libperl.$so
7170                         ;;
7171                 cygwin*) # include version
7172                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7173                         ;;
7174                 *)      # Try to guess based on whether libc has major.minor.
7175                         case "$libc" in
7176                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7177                         *libc.$so.[0-9]*) dflt=$majonly ;;
7178                         *)      dflt=libperl.$so ;;
7179                         esac
7180                         ;;
7181                 esac
7182                 ;;
7183         *)      dflt=$libperl
7184                 ;;
7185         esac
7186         cat << EOM
7187
7188 I need to select a good name for the shared libperl.  If your system uses
7189 library names with major and minor numbers, then you might want something
7190 like $majmin.  Alternatively, if your system uses a single version
7191 number for shared libraries, then you might want to use $majonly.
7192 Or, your system might be quite happy with a simple libperl.$so.
7193
7194 Since the shared libperl will get installed into a version-specific
7195 architecture-dependent directory, the version number of the shared perl
7196 library probably isn't important, so the default should be o.k.
7197
7198 EOM
7199         rp='What name do you want to give to the shared libperl?'
7200         . ./myread
7201         libperl=$ans
7202         echo "Ok, I'll use $libperl"
7203         ;;
7204 *)
7205         libperl="libperl${_a}"
7206         ;;
7207 esac
7208
7209 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7210 case "$shrpdir" in
7211 '') ;;
7212 *)      $cat >&4 <<EOM
7213 WARNING:  Use of the shrpdir variable for the installation location of
7214 the shared $libperl is not supported.  It was never documented and
7215 will not work in this version.  Let me (perlbug@perl.org)
7216 know of any problems this may cause.
7217
7218 EOM
7219         case "$shrpdir" in
7220         "$archlibexp/CORE")
7221                 $cat >&4 <<EOM
7222 But your current setting of $shrpdir is
7223 the default anyway, so it's harmless.
7224 EOM
7225                 ;;
7226         *)
7227                 $cat >&4 <<EOM
7228 Further, your current attempted setting of $shrpdir
7229 conflicts with the value of $archlibexp/CORE
7230 that installperl will use.
7231 EOM
7232                 ;;
7233         esac
7234         ;;
7235 esac
7236
7237 # How will the perl executable find the installed shared $libperl?
7238 # Add $xxx to ccdlflags.
7239 # If we can't figure out a command-line option, use $shrpenv to
7240 # set env LD_RUN_PATH.  The main perl makefile uses this.
7241 shrpdir=$archlibexp/CORE
7242 xxx=''
7243 tmp_shrpenv=''
7244 if "$useshrplib"; then
7245     case "$osname" in 
7246         aix)
7247                 # We'll set it in Makefile.SH...
7248                 ;;
7249         solaris|netbsd)
7250                 xxx="-R $shrpdir"
7251                 ;;
7252         freebsd)
7253                 xxx="-Wl,-R$shrpdir"
7254                 ;;
7255         linux|irix*|dec_osf)
7256                 xxx="-Wl,-rpath,$shrpdir"
7257                 ;;
7258         next)
7259                 # next doesn't like the default...
7260                 ;;
7261         beos)
7262                 # beos doesn't like the default, either.
7263                 ;;
7264         hpux*)
7265                 # hpux doesn't like the default, either.
7266                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7267                 ;;
7268         *)
7269                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7270                 ;;
7271         esac
7272         case "$xxx" in
7273         '') ;;
7274         *)      
7275                 # Only add $xxx if it isn't already in ccdlflags.
7276                 case " $ccdlflags " in
7277                 *" $xxx "*)     ;;
7278                 *)      ccdlflags="$ccdlflags $xxx"
7279                         cat <<EOM >&4
7280
7281 Adding $xxx to the flags
7282 passed to $ld so that the perl executable will find the 
7283 installed shared $libperl.
7284
7285 EOM
7286                         ;;
7287                 esac
7288                 ;;
7289         esac
7290 fi
7291 # Fix ccdlflags in AIX for building external extensions.
7292 # (For building Perl itself bare -bE:perl.exp is needed,
7293 #  Makefile.SH takes care of this.)
7294 case "$osname" in
7295 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7296 esac
7297 # Respect a hint or command-line value.
7298 case "$shrpenv" in
7299 '') shrpenv="$tmp_shrpenv" ;;
7300 esac
7301 case "$ldlibpthname" in
7302 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7303 none)   ldlibpthname='' ;;
7304 esac
7305
7306 : determine where manual pages are on this system
7307 echo " "
7308 case "$sysman" in
7309 '') 
7310         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7311         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7312         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7313         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7314         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7315         sysman=`./loc . /usr/man/man1 $syspath`
7316         ;;
7317 esac
7318 if $test -d "$sysman"; then
7319         echo "System manual is in $sysman." >&4
7320 else
7321         echo "Could not find manual pages in source form." >&4
7322 fi
7323
7324 : determine where manual pages go
7325 set man1dir man1dir none
7326 eval $prefixit
7327 $cat <<EOM
7328
7329 $spackage has manual pages available in source form.
7330 EOM
7331 case "$nroff" in
7332 nroff)
7333         echo "However, you don't have nroff, so they're probably useless to you."
7334         case "$man1dir" in
7335         '') man1dir="none";;
7336         esac;;
7337 esac
7338 echo "If you don't want the manual sources installed, answer 'none'."
7339 case "$man1dir" in
7340 ' ') dflt=none
7341         ;;
7342 '')
7343         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7344         lookpath="$lookpath $prefixexp/man/p_man/man1"
7345         lookpath="$lookpath $prefixexp/man/u_man/man1"
7346         lookpath="$lookpath $prefixexp/man/man.1"
7347         case "$sysman" in
7348         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7349         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7350         esac
7351         set dflt
7352         eval $prefixup
7353         ;;
7354 *)  dflt="$man1dir"
7355         ;;
7356 esac
7357 echo " "
7358 fn=dn+~
7359 rp="Where do the main $spackage manual pages (source) go?"
7360 . ./getfile
7361 if $test "X$man1direxp" != "X$ansexp"; then
7362         installman1dir=''
7363 fi
7364 man1dir="$ans"
7365 man1direxp="$ansexp"
7366 case "$man1dir" in
7367 '')     man1dir=' '
7368         installman1dir='';;
7369 esac
7370
7371 : Change installation prefix, if necessary.
7372 if $test X"$prefix" != X"$installprefix"; then
7373         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7374 else
7375         installman1dir="$man1direxp"
7376 fi
7377
7378 : What suffix to use on installed man pages
7379
7380 case "$man1dir" in
7381 ' ')
7382         man1ext='0'
7383         ;;
7384 *)
7385         rp="What suffix should be used for the main $spackage man pages?"
7386         case "$man1ext" in
7387         '')     case "$man1dir" in
7388                 *1)  dflt=1 ;;
7389                 *1p) dflt=1p ;;
7390                 *1pm) dflt=1pm ;;
7391                 *l) dflt=l;;
7392                 *n) dflt=n;;
7393                 *o) dflt=o;;
7394                 *p) dflt=p;;
7395                 *C) dflt=C;;
7396                 *L) dflt=L;;
7397                 *L1) dflt=L1;;
7398                 *) dflt=1;;
7399                 esac
7400                 ;;
7401         *)      dflt="$man1ext";;
7402         esac
7403         . ./myread
7404         man1ext="$ans"
7405         ;;
7406 esac
7407
7408 : see if we can have long filenames
7409 echo " "
7410 first=123456789abcdef
7411 $rm -f $first
7412 if (echo hi >$first) 2>/dev/null; then
7413         if $test -f 123456789abcde; then
7414                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7415                 val="$undef"
7416         else
7417                 echo 'You can have filenames longer than 14 characters.'>&4
7418                 val="$define"
7419         fi
7420 else
7421         $cat <<'EOM'
7422 You can't have filenames longer than 14 chars.
7423 You can't even think about them!
7424 EOM
7425         val="$undef"
7426 fi 
7427 set d_flexfnam
7428 eval $setvar
7429 $rm -rf 123456789abcde*
7430
7431 : determine where library module manual pages go
7432 set man3dir man3dir none
7433 eval $prefixit
7434 $cat <<EOM
7435
7436 $spackage has manual pages for many of the library modules.
7437 EOM
7438
7439 case "$nroff" in
7440 nroff)
7441         $cat <<'EOM'
7442 However, you don't have nroff, so they're probably useless to you.
7443 EOM
7444         case "$man3dir" in
7445         '') man3dir="none";;
7446         esac;;
7447 esac
7448
7449 case "$d_flexfnam" in
7450 undef)
7451         $cat <<'EOM'
7452 However, your system can't handle the long file names like File::Basename.3. 
7453 EOM
7454         case "$man3dir" in
7455         '') man3dir="none";;
7456         esac;;
7457 esac
7458
7459 echo "If you don't want the manual sources installed, answer 'none'."
7460 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7461 case "$man3dir" in
7462 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7463         if $test -d "$privlib/man/man3"; then
7464                 cat <<EOM >&4
7465
7466 WARNING:  Previous versions of perl installed man3 pages into
7467 $privlib/man/man3.  This version will suggest a 
7468 new default of $dflt.  
7469 EOM
7470                 tdflt=$dflt
7471                 dflt='n'
7472                 rp='Do you wish to preserve the old behavior?(y/n)'
7473                 . ./myread
7474                 case "$ans" in
7475                 y*) dflt="$privlib/man/man3" ;;
7476                 *)  dflt=$tdflt ;;
7477                 esac
7478     fi
7479         ;;
7480 *)      dflt="$man3dir" ;;
7481 esac
7482 case "$dflt" in
7483 ' ') dflt=none ;;
7484 esac
7485 echo " "
7486 fn=dn+~
7487 rp="Where do the $package library man pages (source) go?"
7488 . ./getfile
7489 man3dir="$ans"
7490 man3direxp="$ansexp"
7491 case "$man3dir" in
7492 '')     man3dir=' '
7493         installman3dir='';;
7494 esac
7495
7496 : Change installation prefix, if necessary.
7497 if $test X"$prefix" != X"$installprefix"; then
7498         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7499 else
7500         installman3dir="$man3direxp"
7501 fi
7502
7503 : What suffix to use on installed man pages
7504 case "$man3dir" in
7505 ' ')
7506         man3ext='0'
7507         ;;
7508 *)
7509         rp="What suffix should be used for the $package library man pages?"
7510         case "$man3ext" in
7511         '')     case "$man3dir" in
7512                 *3)  dflt=3 ;;
7513                 *3p) dflt=3p ;;
7514                 *3pm) dflt=3pm ;;
7515                 *l) dflt=l;;
7516                 *n) dflt=n;;
7517                 *o) dflt=o;;
7518                 *p) dflt=p;;
7519                 *C) dflt=C;;
7520                 *L) dflt=L;;
7521                 *L3) dflt=L3;;
7522                 *) dflt=3;;
7523                 esac
7524                 ;;
7525         *)      dflt="$man3ext";;
7526         esac
7527         . ./myread
7528         man3ext="$ans"
7529         ;;
7530 esac
7531
7532 : see if we have to deal with yellow pages, now NIS.
7533 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7534         if $test -f /usr/etc/nibindd; then
7535                 echo " "
7536                 echo "I'm fairly confident you're on a NeXT."
7537                 echo " "
7538                 rp='Do you get the hosts file via NetInfo?'
7539                 dflt=y
7540                 case "$hostcat" in
7541                 nidump*) ;;
7542                 '') ;;
7543                 *) dflt=n;;
7544                 esac
7545                 . ./myread
7546                 case "$ans" in
7547                 y*) hostcat='nidump hosts .';;
7548                 *)      case "$hostcat" in
7549                         nidump*) hostcat='';;
7550                         esac
7551                         ;;
7552                 esac
7553         fi
7554         case "$hostcat" in
7555         nidump*) ;;
7556         *)
7557                 case "$hostcat" in
7558                 *ypcat*) dflt=y;;
7559                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7560                                 dflt=y
7561                         else
7562                                 dflt=n
7563                         fi;;
7564                 *) dflt=n;;
7565                 esac
7566                 echo " "
7567                 rp='Are you getting the hosts file via yellow pages?'
7568                 . ./myread
7569                 case "$ans" in
7570                 y*) hostcat='ypcat hosts';;
7571                 *) hostcat='cat /etc/hosts';;
7572                 esac
7573                 ;;
7574         esac
7575 fi
7576 case "$hostcat" in
7577 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7578 esac
7579 case "$groupcat" in
7580 '') test -f /etc/group && groupcat='cat /etc/group';;
7581 esac
7582 case "$passcat" in
7583 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7584 esac
7585
7586 : now get the host name
7587 echo " "
7588 echo "Figuring out host name..." >&4
7589 case "$myhostname" in
7590 '') cont=true
7591         echo 'Maybe "hostname" will work...'
7592         if tans=`sh -c hostname 2>&1` ; then
7593                 myhostname=$tans
7594                 phostname=hostname
7595                 cont=''
7596         fi
7597         ;;
7598 *) cont='';;
7599 esac
7600 if $test "$cont"; then
7601         if ./xenix; then
7602                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7603                 if tans=`cat /etc/systemid 2>&1` ; then
7604                         myhostname=$tans
7605                         phostname='cat /etc/systemid'
7606                         echo "Whadyaknow.  Xenix always was a bit strange..."
7607                         cont=''
7608                 fi
7609         elif $test -r /etc/systemid; then
7610                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7611         fi
7612 fi
7613 if $test "$cont"; then
7614         echo 'No, maybe "uuname -l" will work...'
7615         if tans=`sh -c 'uuname -l' 2>&1` ; then
7616                 myhostname=$tans
7617                 phostname='uuname -l'
7618         else
7619                 echo 'Strange.  Maybe "uname -n" will work...'
7620                 if tans=`sh -c 'uname -n' 2>&1` ; then
7621                         myhostname=$tans
7622                         phostname='uname -n'
7623                 else
7624                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7625                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7626                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7627                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7628                         else
7629                                 case "$myhostname" in
7630                                 '') echo "Does this machine have an identity crisis or something?"
7631                                         phostname='';;
7632                                 *)
7633                                         echo "Well, you said $myhostname before..."
7634                                         phostname='echo $myhostname';;
7635                                 esac
7636                         fi
7637                 fi
7638         fi
7639 fi
7640 : you do not want to know about this
7641 set $myhostname
7642 myhostname=$1
7643
7644 : verify guess
7645 if $test "$myhostname" ; then
7646         dflt=y
7647         rp='Your host name appears to be "'$myhostname'".'" Right?"
7648         . ./myread
7649         case "$ans" in
7650         y*) ;;
7651         *) myhostname='';;
7652         esac
7653 fi
7654
7655 : bad guess or no guess
7656 while $test "X$myhostname" = X ; do
7657         dflt=''
7658         rp="Please type the (one word) name of your host:"
7659         . ./myread
7660         myhostname="$ans"
7661 done
7662
7663 : translate upper to lower if necessary
7664 case "$myhostname" in
7665 *[A-Z]*)
7666         echo "(Normalizing case in your host name)"
7667         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7668         ;;
7669 esac
7670
7671 case "$myhostname" in
7672 *.*)
7673         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7674         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7675         echo "(Trimming domain name from host name--host name is now $myhostname)"
7676         ;;
7677 *) case "$mydomain" in
7678         '')
7679                 {
7680                         test "X$hostcat" = "Xypcat hosts" &&
7681                         ypmatch "$myhostname" hosts 2>/dev/null |\
7682                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7683                         $test -s hosts
7684                 } || {
7685                         test "X$hostcat" != "X" &&
7686                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7687                                         /[       ]$myhostname[  . ]/p" > hosts
7688                 }
7689                 tmp_re="[       . ]"
7690                 if $test -f hosts; then
7691                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7692                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7693                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7694                                 hosts | $sort | $uniq | \
7695                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7696                         case `$echo X$dflt` in
7697                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7698                                 dflt=.
7699                                 ;;
7700                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7701                                 ;;
7702                         esac
7703                 else
7704                         echo "(I cannot locate a hosts database anywhere)"
7705                         dflt=.
7706                 fi
7707                 case "$dflt" in
7708                 .)
7709                         tans=`./loc resolv.conf X /etc /usr/etc`
7710                         if $test -f "$tans"; then
7711                                 echo "(Attempting domain name extraction from $tans)"
7712                                 dflt=.`$sed -n -e 's/   / /g' \
7713                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7714                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7715                                 case "$dflt" in
7716                                 .) dflt=.`$sed -n -e 's/        / /g' \
7717                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7718                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7719                                         ;;
7720                                 esac
7721                         fi
7722                         ;;
7723                 esac
7724                 case "$dflt" in
7725                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7726                         dflt=.`sh -c domainname 2>/dev/null`
7727                         case "$dflt" in
7728                         '') dflt='.';;
7729                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7730                         esac
7731                         ;;
7732                 esac
7733                 case "$dflt$osname" in
7734                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7735                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7736                         ;;
7737                 esac
7738                 case "$dflt" in
7739                 .) echo "(Lost all hope -- silly guess then)"
7740                         dflt='.uucp'
7741                         ;;
7742                 esac
7743                 $rm -f hosts
7744                 ;;
7745         *) dflt="$mydomain";;
7746         esac;;
7747 esac
7748 echo " "
7749 rp="What is your domain name?"
7750 . ./myread
7751 tans="$ans"
7752 case "$ans" in
7753 '') ;;
7754 .*) ;;
7755 *) tans=".$tans";;
7756 esac
7757 mydomain="$tans"
7758
7759 : translate upper to lower if necessary
7760 case "$mydomain" in
7761 *[A-Z]*)
7762         echo "(Normalizing case in your domain name)"
7763         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7764         ;;
7765 esac
7766
7767 : a little sanity check here
7768 case "$phostname" in
7769 '') ;;
7770 *)
7771         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7772         $myhostname$mydomain|$myhostname) ;;
7773         *)
7774                 case "$phostname" in
7775                 sed*)
7776                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7777                         ;;
7778                 *)
7779                         echo "(That doesn't agree with your $phostname command, by the way.)"
7780                         ;;
7781                 esac
7782         ;;
7783         esac
7784         ;;
7785 esac
7786
7787 $cat <<EOM
7788
7789 I need to get your e-mail address in Internet format if possible, i.e.
7790 something like user@host.domain. Please answer accurately since I have
7791 no easy means to double check it. The default value provided below
7792 is most probably close to reality but may not be valid from outside
7793 your organization...
7794
7795 EOM
7796 cont=x
7797 while test "$cont"; do
7798         case "$cf_email" in
7799         '') dflt="$cf_by@$myhostname$mydomain";;
7800         *) dflt="$cf_email";;
7801         esac
7802         rp='What is your e-mail address?'
7803         . ./myread
7804         cf_email="$ans"
7805         case "$cf_email" in
7806         *@*.*) cont='' ;;
7807         *)
7808                 rp='Address does not look like an Internet one.  Use it anyway?'
7809                 case "$fastread" in
7810                 yes) dflt=y ;;
7811                 *) dflt=n ;;
7812                 esac
7813                 . ./myread
7814                 case "$ans" in
7815                 y*) cont='' ;;
7816                 *) echo " " ;;
7817                 esac
7818                 ;;
7819         esac
7820 done
7821
7822 $cat <<EOM
7823
7824 If you or somebody else will be maintaining perl at your site, please
7825 fill in the correct e-mail address here so that they may be contacted
7826 if necessary. Currently, the "perlbug" program included with perl
7827 will send mail to this address in addition to perlbug@perl.org. You may
7828 enter "none" for no administrator.
7829
7830 EOM
7831 case "$perladmin" in
7832 '') dflt="$cf_email";;
7833 *) dflt="$perladmin";;
7834 esac
7835 rp='Perl administrator e-mail address'
7836 . ./myread
7837 perladmin="$ans"
7838
7839 : determine whether to only install version-specific parts.
7840 echo " "
7841 $cat <<EOM
7842 Do you want to install only the version-specific parts of the perl
7843 distribution?  Usually you do *not* want to do this.
7844 EOM
7845 case "$versiononly" in
7846 "$define"|[Yy]*|true) dflt='y' ;;
7847 *) dflt='n';
7848 esac
7849 rp="Do you want to install only the version-specific parts of perl?"
7850 . ./myread
7851 case "$ans" in
7852 [yY]*)  val="$define";;
7853 *)      val="$undef" ;;
7854 esac
7855 set versiononly
7856 eval $setvar
7857
7858 : figure out how to guarantee perl startup
7859 case "$startperl" in
7860 '')
7861         case "$sharpbang" in
7862         *!)
7863                 $cat <<EOH
7864
7865 I can use the #! construct to start perl on your system. This will
7866 make startup of perl scripts faster, but may cause problems if you
7867 want to share those scripts and perl is not in a standard place
7868 ($binexp/perl) on all your platforms. The alternative is to force
7869 a shell by starting the script with a single ':' character.
7870
7871 EOH
7872                 case "$versiononly" in
7873                 "$define")      dflt="$binexp/perl$version";;  
7874                 *)              dflt="$binexp/perl";;
7875                 esac
7876                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7877                 . ./myread
7878                 case "$ans" in
7879                 none)   startperl=": # use perl";;
7880                 *)      startperl="#!$ans"
7881                         if $test 30 -lt `echo "$ans" | wc -c`; then
7882                                 $cat >&4 <<EOM
7883
7884 WARNING:  Some systems limit the #! command to 32 characters.
7885 If you experience difficulty running Perl scripts with #!, try
7886 installing Perl in a directory with a shorter pathname.
7887
7888 EOM
7889                         fi ;;
7890                 esac
7891                 ;;
7892         *) startperl=": # use perl"
7893                 ;;
7894         esac
7895         ;;
7896 esac
7897 echo "I'll use $startperl to start perl scripts."
7898
7899 : figure best path for perl in scripts
7900 case "$perlpath" in
7901 '')
7902         perlpath="$binexp/perl"
7903         case "$startperl" in
7904         *!*) ;;
7905         *)
7906                 $cat <<EOH
7907
7908 I will use the "eval 'exec'" idiom to start Perl on your system.
7909 I can use the full path of your Perl binary for this purpose, but
7910 doing so may cause problems if you want to share those scripts and
7911 Perl is not always in a standard place ($binexp/perl).
7912
7913 EOH
7914                 dflt="$binexp/perl"
7915                 rp="What path shall I use in \"eval 'exec'\"?"
7916                 . ./myread
7917                 perlpath="$ans"
7918                 ;;
7919         esac
7920         ;;
7921 esac
7922 case "$startperl" in
7923 *!*)    ;;
7924 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7925 esac
7926
7927 : determine where public executable scripts go
7928 set scriptdir scriptdir
7929 eval $prefixit
7930 case "$scriptdir" in
7931 '')
7932         dflt="$bin"
7933         : guess some guesses
7934         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7935         $test -d /usr/share/bin     && dflt=/usr/share/bin
7936         $test -d /usr/local/script  && dflt=/usr/local/script
7937         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7938         $test -d $prefixexp/script  && dflt=$prefixexp/script
7939         set dflt
7940         eval $prefixup
7941         ;;
7942 *)  dflt="$scriptdir"
7943         ;;
7944 esac
7945 $cat <<EOM
7946  
7947 Some installations have a separate directory just for executable scripts so
7948 that they can mount it across multiple architectures but keep the scripts in
7949 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7950 Or you might just lump your scripts in with all your other executables.
7951  
7952 EOM
7953 fn=d~
7954 rp='Where do you keep publicly executable scripts?'
7955 . ./getfile
7956 if $test "X$ansexp" != "X$scriptdirexp"; then
7957         installscript=''
7958 fi
7959 scriptdir="$ans"
7960 scriptdirexp="$ansexp"
7961 : Change installation prefix, if necessary.
7962 if $test X"$prefix" != X"$installprefix"; then
7963         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7964 else
7965         installscript="$scriptdirexp"
7966 fi
7967
7968 : determine where add-on public executables go
7969 case "$sitebin" in
7970 '')     dflt=$siteprefix/bin ;;
7971 *)      dflt=$sitebin ;;
7972 esac
7973 fn=d~
7974 rp='Pathname where the add-on public executables should be installed?'
7975 . ./getfile
7976 sitebin="$ans"
7977 sitebinexp="$ansexp"
7978 : Change installation prefix, if necessary.
7979 if $test X"$prefix" != X"$installprefix"; then
7980         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7981 else
7982         installsitebin="$sitebinexp"
7983 fi
7984
7985 case "$vendorprefix" in
7986 '')     d_vendorbin="$undef"
7987         vendorbin=''
7988         vendorbinexp=''
7989         ;;
7990 *)      d_vendorbin="$define"
7991         : determine where vendor-supplied executables go.
7992         case "$vendorbin" in
7993         '') dflt=$vendorprefix/bin ;;
7994         *)      dflt="$vendorbin" ;;
7995         esac
7996         fn=d~+
7997         rp='Pathname for the vendor-supplied executables directory?'
7998         . ./getfile
7999         vendorbin="$ans"
8000         vendorbinexp="$ansexp"
8001         ;;
8002 esac
8003 : Change installation prefix, if necessary.
8004 if $test X"$prefix" != X"$installprefix"; then
8005         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8006 else
8007         installvendorbin="$vendorbinexp"
8008 fi
8009
8010 : see if qgcvt exists
8011 set qgcvt d_qgcvt
8012 eval $inlibc
8013
8014 echo " "
8015
8016 if $test X"$d_longdbl" = X"$define"; then
8017
8018 echo "Checking how to print long doubles..." >&4
8019
8020 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8021         $cat >try.c <<'EOCP'
8022 #include <sys/types.h>
8023 #include <stdio.h>
8024 int main() {
8025   double d = 123.456;
8026   printf("%.3f\n", d);
8027 }
8028 EOCP
8029         set try
8030         if eval $compile; then
8031                 yyy=`./try$exe_ext`
8032                 case "$yyy" in
8033                 123.456)
8034                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8035                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8036                         echo "We will use %f."
8037                         ;;
8038                 esac
8039         fi
8040 fi
8041
8042 if $test X"$sPRIfldbl" = X; then
8043         $cat >try.c <<'EOCP'
8044 #include <sys/types.h>
8045 #include <stdio.h>
8046 int main() {
8047   long double d = 123.456;
8048   printf("%.3Lf\n", d);
8049 }
8050 EOCP
8051         set try
8052         if eval $compile; then
8053                 yyy=`./try$exe_ext`
8054                 case "$yyy" in
8055                 123.456)
8056                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8057                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8058                         echo "We will use %Lf."
8059                         ;;
8060                 esac
8061         fi
8062 fi
8063
8064 if $test X"$sPRIfldbl" = X; then
8065         $cat >try.c <<'EOCP'
8066 #include <sys/types.h>
8067 #include <stdio.h>
8068 int main() {
8069   long double d = 123.456;
8070   printf("%.3llf\n", d);
8071 }
8072 EOCP
8073         set try
8074         if eval $compile; then
8075                 yyy=`./try$exe_ext`
8076                 case "$yyy" in
8077                 123.456)
8078                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8079                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8080                         echo "We will use %llf."
8081                         ;;
8082                 esac
8083         fi
8084 fi
8085
8086 if $test X"$sPRIfldbl" = X; then
8087         $cat >try.c <<'EOCP'
8088 #include <sys/types.h>
8089 #include <stdio.h>
8090 int main() {
8091   long double d = 123.456;
8092   printf("%.3lf\n", d);
8093 }
8094 EOCP
8095         set try
8096         if eval $compile; then
8097                 yyy=`./try$exe_ext`
8098                 case "$yyy" in
8099                 123.456)
8100                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8101                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8102                         echo "We will use %lf."
8103                         ;;
8104                 esac
8105         fi
8106 fi
8107
8108 if $test X"$sPRIfldbl" = X; then
8109         echo "Cannot figure out how to print long doubles." >&4
8110 else
8111         sSCNfldbl=$sPRIfldbl    # expect consistency
8112 fi
8113
8114 $rm -f try try.*
8115
8116 fi # d_longdbl
8117
8118 case "$sPRIfldbl" in
8119 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8120         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8121         d_SCNfldbl="$undef";
8122         ;;
8123 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8124         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8125         d_SCNfldbl="$define";
8126         ;;
8127 esac
8128
8129 : Check how to convert floats to strings.
8130 echo " "
8131 echo "Checking for an efficient way to convert floats to strings."
8132 echo " " > try.c
8133 case "$uselongdouble" in
8134 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8135 esac
8136 case "$d_longdbl" in
8137 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8138 esac
8139 case "$d_PRIgldbl" in
8140 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8141 esac
8142 $cat >>try.c <<EOP
8143 #ifdef TRY_gconvert
8144 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8145 char *myname = "gconvert";
8146 #endif
8147 #ifdef TRY_gcvt
8148 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8149 char *myname = "gcvt";
8150 #endif
8151 #ifdef TRY_qgcvt
8152 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8153 char *myname = "qgcvt";
8154 #define DOUBLETYPE long double
8155 #endif
8156 #ifdef TRY_sprintf
8157 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8158 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8159 #else
8160 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8161 #endif
8162 char *myname = "sprintf";
8163 #endif
8164
8165 #ifndef DOUBLETYPE
8166 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8167 #define DOUBLETYPE long double
8168 #else
8169 #define DOUBLETYPE double
8170 #endif
8171 #endif
8172
8173 #include <stdio.h>
8174
8175 #define I_STDLIB $i_stdlib
8176 #ifdef I_STDLIB
8177 #include <stdlib.h>
8178 #endif
8179
8180 int
8181 checkit(expect, got)
8182 char *expect;
8183 char *got;
8184 {
8185     if (strcmp(expect, got)) {
8186                 printf("%s oddity:  Expected %s, got %s\n",
8187                         myname, expect, got);
8188                 exit(1);
8189         }
8190 }
8191
8192 int main()
8193
8194         char buf[64]; 
8195         buf[63] = '\0';
8196
8197         /* This must be 1st test on (which?) platform */
8198         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8199         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8200         checkit("0.1", buf);
8201
8202         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8203         checkit("1", buf);
8204
8205         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8206         checkit("1.1", buf);
8207
8208         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8209         checkit("1.01", buf);
8210
8211         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8212         checkit("1.001", buf);
8213
8214         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8215         checkit("1.0001", buf);
8216
8217         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8218         checkit("1.00001", buf);
8219
8220         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8221         checkit("1.000001", buf);
8222
8223         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8224         checkit("0", buf);
8225
8226         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8227         checkit("-1", buf);
8228
8229         /* Some Linux gcvt's give 1.e+5 here. */
8230         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8231         checkit("100000", buf);
8232         
8233         /* Some Linux gcvt's give -1.e+5 here. */
8234         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8235         checkit("-100000", buf);
8236
8237         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8238         checkit("123.456", buf);
8239
8240         exit(0);
8241 }
8242 EOP
8243 case "$d_Gconvert" in
8244 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8245 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8246 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8247 *) xxx_list='gconvert gcvt sprintf' ;;
8248 esac
8249
8250 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8251 "$define$define$define")
8252     # for long doubles prefer first qgcvt, then sprintf
8253     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8254     xxx_list="sprintf $xxx_list"
8255     case "$d_qgcvt" in
8256     "$define") xxx_list="qgcvt $xxx_list" ;;
8257     esac
8258     ;;
8259 esac
8260
8261 for xxx_convert in $xxx_list; do
8262         echo "Trying $xxx_convert..."
8263         $rm -f try try$_o
8264         set try -DTRY_$xxx_convert
8265         if eval $compile; then
8266                 echo "$xxx_convert() found." >&4
8267                 if ./try; then
8268                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8269                         break;
8270                 else
8271                         echo "...But $xxx_convert didn't work as I expected."
8272                 fi
8273         else
8274                 echo "$xxx_convert NOT found." >&4
8275         fi
8276 done
8277         
8278 case "$xxx_convert" in
8279 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8280 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8281 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8282 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8283    "$define$define$define")
8284       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8285    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8286    esac
8287    ;;  
8288 esac
8289
8290 : see if _fwalk exists
8291 set fwalk d__fwalk
8292 eval $inlibc
8293
8294 : Initialize h_fcntl
8295 h_fcntl=false
8296
8297 : Initialize h_sysfile
8298 h_sysfile=false
8299
8300 : access call always available on UNIX
8301 set access d_access
8302 eval $inlibc
8303
8304 : locate the flags for 'access()'
8305 case "$d_access" in
8306 "$define")
8307         echo " "
8308         $cat >access.c <<'EOCP'
8309 #include <sys/types.h>
8310 #ifdef I_FCNTL
8311 #include <fcntl.h>
8312 #endif
8313 #ifdef I_SYS_FILE
8314 #include <sys/file.h>
8315 #endif
8316 #ifdef I_UNISTD
8317 #include <unistd.h>
8318 #endif
8319 int main() {
8320         exit(R_OK);
8321 }
8322 EOCP
8323         : check sys/file.h first, no particular reason here
8324         if $test `./findhdr sys/file.h` && \
8325                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8326                 h_sysfile=true;
8327                 echo "<sys/file.h> defines the *_OK access constants." >&4
8328         elif $test `./findhdr fcntl.h` && \
8329                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8330                 h_fcntl=true;
8331                 echo "<fcntl.h> defines the *_OK access constants." >&4
8332         elif $test `./findhdr unistd.h` && \
8333                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8334                 echo "<unistd.h> defines the *_OK access constants." >&4
8335         else
8336                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8337         fi
8338         ;;
8339 esac
8340 $rm -f access*
8341
8342 : see if accessx exists
8343 set accessx d_accessx
8344 eval $inlibc
8345
8346 : see if alarm exists
8347 set alarm d_alarm
8348 eval $inlibc
8349
8350 : see if atolf exists
8351 set atolf d_atolf
8352 eval $inlibc
8353
8354 : see if atoll exists
8355 set atoll d_atoll
8356 eval $inlibc
8357
8358 : Look for GNU-cc style attribute checking
8359 echo " "
8360 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8361 $cat >attrib.c <<'EOCP'
8362 #include <stdio.h>
8363 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8364 EOCP
8365 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8366         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8367                 echo "Your C compiler doesn't fully support __attribute__."
8368                 val="$undef"
8369         else
8370                 echo "Your C compiler supports __attribute__."
8371                 val="$define"
8372         fi
8373 else
8374         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8375         val="$undef"
8376 fi
8377 set d_attribut
8378 eval $setvar
8379 $rm -f attrib*
8380
8381 : see if bcmp exists
8382 set bcmp d_bcmp
8383 eval $inlibc
8384
8385 : see if bcopy exists
8386 set bcopy d_bcopy
8387 eval $inlibc
8388
8389 : see if this is a unistd.h system
8390 set unistd.h i_unistd
8391 eval $inhdr
8392
8393 : see if getpgrp exists
8394 set getpgrp d_getpgrp
8395 eval $inlibc
8396
8397 case "$d_getpgrp" in
8398 "$define")
8399         echo " "
8400         echo "Checking to see which flavor of getpgrp is in use..."
8401         $cat >set.c <<EOP
8402 #$i_unistd I_UNISTD
8403 #include <sys/types.h>
8404 #ifdef I_UNISTD
8405 #  include <unistd.h>
8406 #endif
8407 int main()
8408 {
8409         if (getuid() == 0) {
8410                 printf("(I see you are running Configure as super-user...)\n");
8411                 setuid(1);
8412         }
8413 #ifdef TRY_BSD_PGRP
8414         if (getpgrp(1) == 0)
8415                 exit(0);
8416 #else
8417         if (getpgrp() > 0)
8418                 exit(0);
8419 #endif
8420         exit(1);
8421 }
8422 EOP
8423         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8424                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8425                 val="$define"
8426         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8427                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8428                 val="$undef"
8429         else
8430                 echo "I can't seem to compile and run the test program."
8431                 if ./usg; then
8432                         xxx="a USG one, i.e. you use getpgrp()."
8433                 else
8434                         # SVR4 systems can appear rather BSD-ish.
8435                         case "$i_unistd" in
8436                         $undef)
8437                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8438                                 val="$define"
8439                                 ;;
8440                         $define)
8441                                 xxx="probably a USG one, i.e. you use getpgrp()."
8442                                 val="$undef"
8443                                 ;;
8444                         esac
8445                 fi
8446                 echo "Assuming your getpgrp is $xxx" >&4
8447         fi
8448         ;;
8449 *) val="$undef";;
8450 esac
8451 set d_bsdgetpgrp
8452 eval $setvar
8453 $rm -f set set.c
8454
8455 : see if setpgrp exists
8456 set setpgrp d_setpgrp
8457 eval $inlibc
8458
8459 case "$d_setpgrp" in
8460 "$define")
8461         echo " "
8462         echo "Checking to see which flavor of setpgrp is in use..."
8463         $cat >set.c <<EOP
8464 #$i_unistd I_UNISTD
8465 #include <sys/types.h>
8466 #ifdef I_UNISTD
8467 #  include <unistd.h>
8468 #endif
8469 int main()
8470 {
8471         if (getuid() == 0) {
8472                 printf("(I see you are running Configure as super-user...)\n");
8473                 setuid(1);
8474         }
8475 #ifdef TRY_BSD_PGRP
8476         if (-1 == setpgrp(1, 1))
8477                 exit(0);
8478 #else
8479         if (setpgrp() != -1)
8480                 exit(0);
8481 #endif
8482         exit(1);
8483 }
8484 EOP
8485         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8486                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8487                 val="$define"
8488         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8489                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8490                 val="$undef"
8491         else
8492                 echo "(I can't seem to compile and run the test program.)"
8493                 if ./usg; then
8494                         xxx="a USG one, i.e. you use setpgrp()."
8495                 else
8496                         # SVR4 systems can appear rather BSD-ish.
8497                         case "$i_unistd" in
8498                         $undef)
8499                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8500                                 val="$define"
8501                                 ;;
8502                         $define)
8503                                 xxx="probably a USG one, i.e. you use setpgrp()."
8504                                 val="$undef"
8505                                 ;;
8506                         esac
8507                 fi
8508                 echo "Assuming your setpgrp is $xxx" >&4
8509         fi
8510         ;;
8511 *) val="$undef";;
8512 esac
8513 set d_bsdsetpgrp
8514 eval $setvar
8515 $rm -f set set.c
8516 : see if bzero exists
8517 set bzero d_bzero
8518 eval $inlibc
8519
8520 : see if signal is declared as pointer to function returning int or void
8521 echo " "
8522 xxx=`./findhdr signal.h`
8523 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8524 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8525         echo "You have int (*signal())() instead of void." >&4
8526         val="$undef"
8527 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8528         echo "You have void (*signal())()." >&4
8529         val="$define"
8530 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8531         echo "You have int (*signal())() instead of void." >&4
8532         val="$undef"
8533 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8534         echo "You have void (*signal())()." >&4
8535         val="$define"
8536 else
8537         case "$d_voidsig" in
8538         '')
8539         echo "I can't determine whether signal handler returns void or int..." >&4
8540                 dflt=void
8541                 rp="What type does your signal handler return?"
8542                 . ./myread
8543                 case "$ans" in
8544                 v*) val="$define";;
8545                 *) val="$undef";;
8546                 esac;;
8547         "$define")
8548                 echo "As you already told me, signal handler returns void." >&4
8549                 val="$define"
8550                 ;;
8551         *)      echo "As you already told me, signal handler returns int." >&4
8552                 val="$undef"
8553                 ;;
8554         esac
8555 fi
8556 set d_voidsig
8557 eval $setvar
8558 case "$d_voidsig" in
8559 "$define") signal_t="void";;
8560 *) signal_t="int";;
8561 esac
8562 $rm -f $$.tmp
8563
8564 : check for ability to cast large floats to 32-bit ints.
8565 echo " "
8566 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8567 if $test "$intsize" -ge 4; then
8568         xxx=int
8569 else
8570         xxx=long
8571 fi
8572 $cat >try.c <<EOCP
8573 #include <stdio.h>
8574 #include <sys/types.h>
8575 #include <signal.h>
8576 $signal_t blech(s) int s; { exit(3); }
8577 int main()
8578 {
8579         $xxx i32;
8580         double f, g;
8581         int result = 0;
8582         char str[16];
8583         signal(SIGFPE, blech);
8584
8585         /* Don't let compiler optimize the test away.  Store the number 
8586            in a writable string for gcc to pass to sscanf under HP/UX.
8587         */
8588         sprintf(str, "2147483647");
8589         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8590         g = 10 * f;
8591         i32  = ($xxx) g;
8592
8593         /* x86 processors will probably give 0x8000 0000, which is a
8594        sign change.  We don't want that.  We want to mimic SPARC
8595            behavior here, which is to preserve the sign and give
8596            back 0x7fff ffff.
8597         */
8598         if (i32 != ($xxx) f)
8599                 result |= 1;
8600         exit(result);
8601 }
8602 EOCP
8603 set try
8604 if eval $compile_ok; then
8605         ./try
8606         yyy=$?
8607 else
8608         echo "(I can't seem to compile the test program--assuming it can't)"
8609         yyy=1
8610 fi
8611 case "$yyy" in
8612 0)      val="$define"
8613         echo "Yup, it can."
8614         ;;
8615 *)      val="$undef"
8616         echo "Nope, it can't."
8617         ;;
8618 esac
8619 set d_casti32
8620 eval $setvar
8621 $rm -f try try.*
8622
8623 : check for ability to cast negative floats to unsigned
8624 echo " "
8625 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8626 $cat >try.c <<EOCP
8627 #include <stdio.h>
8628 #include <sys/types.h>
8629 #include <signal.h>
8630 $signal_t blech(s) int s; { exit(7); }
8631 $signal_t blech_in_list(s) int s; { exit(4); }
8632 unsigned long dummy_long(p) unsigned long p; { return p; }
8633 unsigned int dummy_int(p) unsigned int p; { return p; }
8634 unsigned short dummy_short(p) unsigned short p; { return p; }
8635 int main()
8636 {
8637         double f;
8638         unsigned long along;
8639         unsigned int aint;
8640         unsigned short ashort;
8641         int result = 0;
8642         char str[16];
8643         
8644         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8645            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8646            optimized the whole file away
8647         */
8648         /* Store the number in a writable string for gcc to pass to 
8649            sscanf under HP/UX.
8650         */
8651         sprintf(str, "-123");
8652         sscanf(str, "%lf", &f);  /* f = -123.; */
8653
8654         signal(SIGFPE, blech);
8655         along = (unsigned long)f;
8656         aint = (unsigned int)f;
8657         ashort = (unsigned short)f;
8658         if (along != (unsigned long)-123)
8659                 result |= 1;
8660         if (aint != (unsigned int)-123)
8661                 result |= 1;
8662         if (ashort != (unsigned short)-123)
8663                 result |= 1;
8664         sprintf(str, "1073741824.");
8665         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8666         f = f + f;
8667         along = 0;
8668         along = (unsigned long)f;
8669         if (along != 0x80000000)
8670                 result |= 2;
8671         f -= 1.;
8672         along = 0;
8673         along = (unsigned long)f;
8674         if (along != 0x7fffffff)
8675                 result |= 1;
8676         f += 2.;
8677         along = 0;
8678         along = (unsigned long)f;
8679         if (along != 0x80000001)
8680                 result |= 2;
8681         if (result)
8682                 exit(result);
8683         signal(SIGFPE, blech_in_list);
8684         sprintf(str, "123.");
8685         sscanf(str, "%lf", &f);  /* f = 123.; */
8686         along = dummy_long((unsigned long)f);
8687         aint = dummy_int((unsigned int)f);
8688         ashort = dummy_short((unsigned short)f);
8689         if (along != (unsigned long)123)
8690                 result |= 4;
8691         if (aint != (unsigned int)123)
8692                 result |= 4;
8693         if (ashort != (unsigned short)123)
8694                 result |= 4;
8695         exit(result);
8696
8697 }
8698 EOCP
8699 set try
8700 if eval $compile_ok; then
8701         ./try
8702         castflags=$?
8703 else
8704         echo "(I can't seem to compile the test program--assuming it can't)"
8705         castflags=7
8706 fi
8707 case "$castflags" in
8708 0)      val="$define"
8709         echo "Yup, it can."
8710         ;;
8711 *)      val="$undef"
8712         echo "Nope, it can't."
8713         ;;
8714 esac
8715 set d_castneg
8716 eval $setvar
8717 $rm -f try.*
8718
8719 : see if vprintf exists
8720 echo " "
8721 if set vprintf val -f d_vprintf; eval $csym; $val; then
8722         echo 'vprintf() found.' >&4
8723         val="$define"
8724         $cat >vprintf.c <<'EOF'
8725 #include <varargs.h>
8726
8727 int main() { xxx("foo"); }
8728
8729 xxx(va_alist)
8730 va_dcl
8731 {
8732         va_list args;
8733         char buf[10];
8734
8735         va_start(args);
8736         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8737 }
8738 EOF
8739         set vprintf
8740         if eval $compile && ./vprintf; then
8741                 echo "Your vsprintf() returns (int)." >&4
8742                 val2="$undef"
8743         else
8744                 echo "Your vsprintf() returns (char*)." >&4
8745                 val2="$define"
8746         fi
8747 else
8748         echo 'vprintf() NOT found.' >&4
8749                 val="$undef"
8750                 val2="$undef"
8751 fi
8752 set d_vprintf
8753 eval $setvar
8754 val=$val2
8755 set d_charvspr
8756 eval $setvar
8757
8758 : see if chown exists
8759 set chown d_chown
8760 eval $inlibc
8761
8762 : see if chroot exists
8763 set chroot d_chroot
8764 eval $inlibc
8765
8766 : see if chsize exists
8767 set chsize d_chsize
8768 eval $inlibc
8769
8770 hasstruct='varname=$1; struct=$2; shift; shift;
8771 while $test $# -ge 2; do
8772         case "$1" in
8773         $define) echo "#include <$2>";;
8774         esac ;
8775     shift 2;
8776 done > try.c;
8777 echo "int main () { struct $struct foo; }" >> try.c;
8778 set try;
8779 if eval $compile; then
8780         val="$define";
8781 else
8782         val="$undef";
8783 fi;
8784 set $varname;
8785 eval $setvar;
8786 $rm -f try.c try.o'
8787
8788 : see if sys/types.h has to be included
8789 set sys/types.h i_systypes
8790 eval $inhdr
8791
8792 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8793 while $test $# -ge 2; do
8794         case "$1" in
8795         $define) echo "#include <$2>";;
8796         esac ;
8797     shift 2;
8798 done > try.c;
8799 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8800 set try;
8801 if eval $compile; then
8802         val="$define";
8803 else
8804         val="$undef";
8805 fi;
8806 set $varname;
8807 eval $setvar;
8808 $rm -f try.c try.o'
8809
8810 socketlib=''
8811 sockethdr=''
8812 : see whether socket exists
8813 echo " "
8814 $echo $n "Hmm... $c" >&4
8815 if set socket val -f d_socket; eval $csym; $val; then
8816         echo "Looks like you have Berkeley networking support." >&4
8817         d_socket="$define"
8818         if set setsockopt val -f; eval $csym; $val; then
8819                 d_oldsock="$undef"
8820         else
8821                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8822                 d_oldsock="$define"
8823         fi
8824 else
8825         if $contains socklib libc.list >/dev/null 2>&1; then
8826                 echo "Looks like you have Berkeley networking support." >&4
8827                 d_socket="$define"
8828                 : we will have to assume that it supports the 4.2 BSD interface
8829                 d_oldsock="$undef"
8830         else
8831                 echo "You don't have Berkeley networking in libc$_a..." >&4
8832                 if test "X$d_socket" = "X$define"; then
8833                    echo "...but you seem to believe that you have sockets." >&4
8834                 else
8835                         for net in net socket
8836                         do
8837                                 if test -f /usr/lib/lib$net$_a; then
8838                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8839                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8840                                         if $contains socket libc.list >/dev/null 2>&1; then
8841                                                 d_socket="$define"
8842                                                 socketlib="-l$net"
8843                                                 case "$net" in
8844                                                 net)
8845                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8846                                                         sockethdr="-I/usr/netinclude"
8847                                                         ;;
8848                                                 esac
8849                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8850                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8851                                                         d_oldsock="$undef"
8852                                                 else
8853                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8854                                                         d_oldsock="$define"
8855                                                 fi
8856                                                 break
8857                                         fi
8858                                 fi
8859                         done
8860                         if test "X$d_socket" != "X$define"; then
8861                            echo "or anywhere else I see." >&4
8862                            d_socket="$undef"
8863                            d_oldsock="$undef"
8864                         fi
8865                 fi
8866         fi
8867 fi
8868
8869 : see if socketpair exists
8870 set socketpair d_sockpair
8871 eval $inlibc
8872
8873
8874 echo " "
8875 echo "Checking the availability of certain socket constants..." >& 4
8876 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8877         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8878         $cat >try.c <<EOF
8879 #include <sys/types.h>
8880 #include <sys/socket.h>
8881 int main() {
8882     int i = $ENUM;
8883 }
8884 EOF
8885         val="$undef"
8886         set try; if eval $compile; then
8887                 val="$define"
8888         fi
8889         set d_${enum}; eval $setvar
8890         $rm -f try.c try
8891 done
8892
8893 : see if this is a sys/uio.h system
8894 set sys/uio.h i_sysuio
8895 eval $inhdr
8896
8897
8898 echo " "
8899 echo "Checking to see if your system supports struct cmsghdr..." >&4
8900 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8901 eval $hasstruct
8902 case "$d_cmsghdr_s" in
8903 "$define")      echo "Yes, it does."   ;;
8904 *)              echo "No, it doesn't." ;;
8905 esac
8906
8907
8908 : check for const keyword
8909 echo " "
8910 echo 'Checking to see if your C compiler knows about "const"...' >&4
8911 $cat >const.c <<'EOCP'
8912 typedef struct spug { int drokk; } spug;
8913 int main()
8914 {
8915         const char *foo;
8916         const spug y;
8917 }
8918 EOCP
8919 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8920         val="$define"
8921         echo "Yup, it does."
8922 else
8923         val="$undef"
8924         echo "Nope, it doesn't."
8925 fi
8926 set d_const
8927 eval $setvar
8928
8929 : see if crypt exists
8930 echo " "
8931 if set crypt val -f d_crypt; eval $csym; $val; then
8932         echo 'crypt() found.' >&4
8933         val="$define"
8934         cryptlib=''
8935 else
8936         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8937         if $test -z "$cryptlib"; then
8938                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8939         else
8940                 cryptlib=-lcrypt
8941         fi
8942         if $test -z "$cryptlib"; then
8943                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8944         else
8945                 cryptlib=-lcrypt
8946         fi
8947         if $test -z "$cryptlib"; then
8948                 cryptlib=`./loc libcrypt$_a "" $libpth`
8949         else
8950                 cryptlib=-lcrypt
8951         fi
8952         if $test -z "$cryptlib"; then
8953                 echo 'crypt() NOT found.' >&4
8954                 val="$undef"
8955         else
8956                 val="$define"
8957         fi
8958 fi
8959 set d_crypt
8960 eval $setvar
8961
8962 : get csh whereabouts
8963 case "$csh" in
8964 'csh') val="$undef" ;;
8965 *) val="$define" ;;
8966 esac
8967 set d_csh
8968 eval $setvar
8969 : Respect a hint or command line value for full_csh.
8970 case "$full_csh" in
8971 '') full_csh=$csh ;;
8972 esac
8973
8974 : see if cuserid exists
8975 set cuserid d_cuserid
8976 eval $inlibc
8977
8978 : see if this is a limits.h system
8979 set limits.h i_limits
8980 eval $inhdr
8981
8982 : see if this is a float.h system
8983 set float.h i_float
8984 eval $inhdr
8985
8986 : See if number of significant digits in a double precision number is known
8987 echo " "
8988 $cat >dbl_dig.c <<EOM
8989 #$i_limits I_LIMITS
8990 #$i_float I_FLOAT
8991 #ifdef I_LIMITS
8992 #include <limits.h>
8993 #endif
8994 #ifdef I_FLOAT
8995 #include <float.h>
8996 #endif
8997 #ifdef DBL_DIG
8998 printf("Contains DBL_DIG");
8999 #endif
9000 EOM
9001 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9002 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9003         echo "DBL_DIG found." >&4
9004         val="$define"
9005 else
9006         echo "DBL_DIG NOT found." >&4
9007         val="$undef"
9008 fi
9009 $rm -f dbl_dig.?
9010 set d_dbl_dig
9011 eval $setvar
9012
9013 hasproto='varname=$1; func=$2; shift; shift;
9014 while $test $# -ge 2; do
9015         case "$1" in
9016         $define) echo "#include <$2>";;
9017         esac ;
9018     shift 2;
9019 done > try.c;
9020 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9021 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9022         echo "$func() prototype found.";
9023         val="$define";
9024 else
9025         echo "$func() prototype NOT found.";
9026         val="$undef";
9027 fi;
9028 set $varname;
9029 eval $setvar;
9030 $rm -f try.c tryout.c'
9031
9032 : see if dbm.h is available
9033 : see if dbmclose exists
9034 set dbmclose d_dbmclose
9035 eval $inlibc
9036
9037 case "$d_dbmclose" in
9038 $define)
9039         set dbm.h i_dbm
9040         eval $inhdr
9041         case "$i_dbm" in
9042         $define)
9043                 val="$undef"
9044                 set i_rpcsvcdbm
9045                 eval $setvar
9046                 ;;
9047         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9048                 eval $inhdr
9049                 ;;
9050         esac
9051         ;;
9052 *)      echo "We won't be including <dbm.h>"
9053         val="$undef"
9054         set i_dbm
9055         eval $setvar
9056         val="$undef"
9057         set i_rpcsvcdbm
9058         eval $setvar
9059         ;;
9060 esac
9061
9062 : see if prototype for dbminit is available
9063 echo " "
9064 set d_dbminitproto dbminit $i_dbm dbm.h
9065 eval $hasproto
9066
9067 : see if difftime exists
9068 set difftime d_difftime
9069 eval $inlibc
9070
9071 : see if this is a dirent system
9072 echo " "
9073 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9074         val="$define"
9075         echo "<dirent.h> found." >&4
9076 else
9077         val="$undef"
9078         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9079                 echo "<sys/dir.h> found." >&4
9080                 echo " "
9081         else
9082                 xinc=`./findhdr sys/ndir.h`
9083         fi
9084         echo "<dirent.h> NOT found." >&4
9085 fi
9086 set i_dirent
9087 eval $setvar
9088
9089 : Look for type of directory structure.
9090 echo " "
9091 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9092
9093 case "$direntrytype" in
9094 ''|' ')
9095         case "$i_dirent" in
9096         $define) guess1='struct dirent' ;;
9097         *) guess1='struct direct'  ;;
9098         esac
9099         ;;
9100 *)      guess1="$direntrytype"
9101         ;;
9102 esac
9103
9104 case "$guess1" in
9105 'struct dirent') guess2='struct direct' ;;
9106 *) guess2='struct dirent' ;;
9107 esac
9108                 
9109 if $contains "$guess1" try.c >/dev/null 2>&1; then
9110         direntrytype="$guess1"
9111         echo "Your directory entries are $direntrytype." >&4
9112 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9113         direntrytype="$guess2"
9114         echo "Your directory entries seem to be $direntrytype." >&4
9115 else
9116         echo "I don't recognize your system's directory entries." >&4
9117         rp="What type is used for directory entries on this system?"
9118         dflt="$guess1"
9119         . ./myread
9120         direntrytype="$ans"
9121 fi
9122 $rm -f try.c
9123
9124
9125 : see if the directory entry stores field length
9126 echo " "
9127 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9128 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9129         echo "Good, your directory entry keeps length information in d_namlen." >&4
9130         val="$define"
9131 else
9132         echo "Your directory entry does not know about the d_namlen field." >&4
9133         val="$undef"
9134 fi
9135 set d_dirnamlen
9136 eval $setvar
9137 $rm -f try.c
9138
9139 : see if dlerror exists
9140 xxx_runnm="$runnm"
9141 runnm=false
9142 set dlerror d_dlerror
9143 eval $inlibc
9144 runnm="$xxx_runnm"
9145
9146 : see if dlfcn is available
9147 set dlfcn.h i_dlfcn
9148 eval $inhdr
9149
9150 case "$usedl" in
9151 $define|y|true)
9152         $cat << EOM
9153
9154 On a few systems, the dynamically loaded modules that perl generates and uses
9155 will need a different extension than shared libs. The default will probably
9156 be appropriate.
9157
9158 EOM
9159         case "$dlext" in
9160         '')     dflt="$so" ;;
9161         *)      dflt="$dlext" ;;
9162         esac
9163         rp='What is the extension of dynamically loaded modules'
9164         . ./myread
9165         dlext="$ans"
9166         ;;
9167 *)
9168         dlext="none"
9169         ;;
9170 esac
9171
9172 : Check if dlsym need a leading underscore
9173 echo " "
9174 val="$undef"
9175
9176 case "$dlsrc" in
9177 dl_dlopen.xs)
9178         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9179         $cat >dyna.c <<'EOM'
9180 fred () { }
9181 EOM
9182
9183 $cat >fred.c<<EOM
9184
9185 #include <stdio.h>
9186 #$i_dlfcn I_DLFCN
9187 #ifdef I_DLFCN
9188 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9189 #else
9190 #include <sys/types.h>
9191 #include <nlist.h>
9192 #include <link.h>
9193 #endif
9194
9195 extern int fred() ;
9196
9197 int main()
9198 {
9199     void * handle ;
9200     void * symbol ;
9201 #ifndef RTLD_LAZY
9202     int mode = 1 ;
9203 #else
9204     int mode = RTLD_LAZY ;
9205 #endif
9206     handle = dlopen("./dyna.$dlext", mode) ;
9207     if (handle == NULL) {
9208         printf ("1\n") ;
9209         fflush (stdout) ;
9210         exit(0);
9211     }
9212     symbol = dlsym(handle, "fred") ;
9213     if (symbol == NULL) {
9214         /* try putting a leading underscore */
9215         symbol = dlsym(handle, "_fred") ;
9216         if (symbol == NULL) {
9217             printf ("2\n") ;
9218             fflush (stdout) ;
9219             exit(0);
9220         }
9221         printf ("3\n") ;
9222     }
9223     else
9224         printf ("4\n") ;
9225     fflush (stdout) ;
9226     exit(0);
9227 }
9228 EOM
9229         : Call the object file tmp-dyna.o in case dlext=o.
9230         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9231                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9232                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9233                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9234                 xxx=`./fred`
9235                 case $xxx in
9236                 1)      echo "Test program failed using dlopen." >&4
9237                         echo "Perhaps you should not use dynamic loading." >&4;;
9238                 2)      echo "Test program failed using dlsym." >&4
9239                         echo "Perhaps you should not use dynamic loading." >&4;;
9240                 3)      echo "dlsym needs a leading underscore" >&4
9241                         val="$define" ;;
9242                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9243                 esac
9244         else
9245                 echo "I can't compile and run the test program." >&4
9246                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9247         fi
9248         ;;
9249 esac
9250                 
9251 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9252
9253 set d_dlsymun
9254 eval $setvar
9255
9256 : see if prototype for drand48 is available
9257 echo " "
9258 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9259 eval $hasproto
9260
9261 : see if dup2 exists
9262 set dup2 d_dup2
9263 eval $inlibc
9264
9265 : see if eaccess exists
9266 set eaccess d_eaccess
9267 eval $inlibc
9268
9269 : see if endgrent exists
9270 set endgrent d_endgrent
9271 eval $inlibc
9272
9273 : see if endhostent exists
9274 set endhostent d_endhent
9275 eval $inlibc
9276
9277 : see if endnetent exists
9278 set endnetent d_endnent
9279 eval $inlibc
9280
9281 : see if endprotoent exists
9282 set endprotoent d_endpent
9283 eval $inlibc
9284
9285 : see if endpwent exists
9286 set endpwent d_endpwent
9287 eval $inlibc
9288
9289 : see if endservent exists
9290 set endservent d_endsent
9291 eval $inlibc
9292
9293 : Locate the flags for 'open()'
9294 echo " "
9295 $cat >open3.c <<'EOCP'
9296 #include <sys/types.h>
9297 #ifdef I_FCNTL
9298 #include <fcntl.h>
9299 #endif
9300 #ifdef I_SYS_FILE
9301 #include <sys/file.h>
9302 #endif
9303 int main() {
9304         if(O_RDONLY);
9305 #ifdef O_TRUNC
9306         exit(0);
9307 #else
9308         exit(1);
9309 #endif
9310 }
9311 EOCP
9312 : check sys/file.h first to get FREAD on Sun
9313 if $test `./findhdr sys/file.h` && \
9314                 set open3 -DI_SYS_FILE && eval $compile; then
9315         h_sysfile=true;
9316         echo "<sys/file.h> defines the O_* constants..." >&4
9317         if ./open3; then
9318                 echo "and you have the 3 argument form of open()." >&4
9319                 val="$define"
9320         else
9321                 echo "but not the 3 argument form of open().  Oh, well." >&4
9322                 val="$undef"
9323         fi
9324 elif $test `./findhdr fcntl.h` && \
9325                 set open3 -DI_FCNTL && eval $compile; then
9326         h_fcntl=true;
9327         echo "<fcntl.h> defines the O_* constants..." >&4
9328         if ./open3; then
9329                 echo "and you have the 3 argument form of open()." >&4
9330                 val="$define"
9331         else
9332                 echo "but not the 3 argument form of open().  Oh, well." >&4
9333                 val="$undef"
9334         fi
9335 else
9336         val="$undef"
9337         echo "I can't find the O_* constant definitions!  You got problems." >&4
9338 fi
9339 set d_open3
9340 eval $setvar
9341 $rm -f open3*
9342
9343 : see which of string.h or strings.h is needed
9344 echo " "
9345 strings=`./findhdr string.h`
9346 if $test "$strings" && $test -r "$strings"; then
9347         echo "Using <string.h> instead of <strings.h>." >&4
9348         val="$define"
9349 else
9350         val="$undef"
9351         strings=`./findhdr strings.h`
9352         if $test "$strings" && $test -r "$strings"; then
9353                 echo "Using <strings.h> instead of <string.h>." >&4
9354         else
9355                 echo "No string header found -- You'll surely have problems." >&4
9356         fi
9357 fi
9358 set i_string
9359 eval $setvar
9360 case "$i_string" in
9361 "$undef") strings=`./findhdr strings.h`;;
9362 *)        strings=`./findhdr string.h`;;
9363 esac
9364
9365 : check for non-blocking I/O stuff
9366 case "$h_sysfile" in
9367 true) echo "#include <sys/file.h>" > head.c;;
9368 *)
9369        case "$h_fcntl" in
9370        true) echo "#include <fcntl.h>" > head.c;;
9371        *) echo "#include <sys/fcntl.h>" > head.c;;
9372        esac
9373        ;;
9374 esac
9375 echo " "
9376 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9377 case "$o_nonblock" in
9378 '')
9379         $cat head.c > try.c
9380         $cat >>try.c <<'EOCP'
9381 #include <stdio.h>
9382 int main() {
9383 #ifdef O_NONBLOCK
9384         printf("O_NONBLOCK\n");
9385         exit(0);
9386 #endif
9387 #ifdef O_NDELAY
9388         printf("O_NDELAY\n");
9389         exit(0);
9390 #endif
9391 #ifdef FNDELAY
9392         printf("FNDELAY\n");
9393         exit(0);
9394 #endif
9395         exit(0);
9396 }
9397 EOCP
9398         set try
9399         if eval $compile_ok; then
9400                 o_nonblock=`./try`
9401                 case "$o_nonblock" in
9402                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9403                 *) echo "Seems like we can use $o_nonblock.";;
9404                 esac
9405         else
9406                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9407         fi
9408         ;;
9409 *) echo "Using $hint value $o_nonblock.";;
9410 esac
9411 $rm -f try try.* .out core
9412
9413 echo " "
9414 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9415 case "$eagain" in
9416 '')
9417         $cat head.c > try.c
9418         $cat >>try.c <<EOCP
9419 #include <errno.h>
9420 #include <sys/types.h>
9421 #include <signal.h>
9422 #include <stdio.h> 
9423 #define MY_O_NONBLOCK $o_nonblock
9424 #ifndef errno  /* XXX need better Configure test */
9425 extern int errno;
9426 #endif
9427 #$i_unistd I_UNISTD
9428 #ifdef I_UNISTD
9429 #include <unistd.h>
9430 #endif
9431 #$i_string I_STRING
9432 #ifdef I_STRING
9433 #include <string.h>
9434 #else
9435 #include <strings.h>
9436 #endif
9437 $signal_t blech(x) int x; { exit(3); }
9438 EOCP
9439         $cat >> try.c <<'EOCP'
9440 int main()
9441 {
9442         int pd[2];
9443         int pu[2];
9444         char buf[1];
9445         char string[100];
9446
9447         pipe(pd);       /* Down: child -> parent */
9448         pipe(pu);       /* Up: parent -> child */
9449         if (0 != fork()) {
9450                 int ret;
9451                 close(pd[1]);   /* Parent reads from pd[0] */
9452                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9453 #ifdef F_SETFL
9454                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9455                         exit(1);
9456 #else
9457                 exit(4);
9458 #endif
9459                 signal(SIGALRM, blech);
9460                 alarm(5);
9461                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9462                         exit(2);
9463                 sprintf(string, "%d\n", ret);
9464                 write(2, string, strlen(string));
9465                 alarm(0);
9466 #ifdef EAGAIN
9467                 if (errno == EAGAIN) {
9468                         printf("EAGAIN\n");
9469                         goto ok;
9470                 }
9471 #endif
9472 #ifdef EWOULDBLOCK
9473                 if (errno == EWOULDBLOCK)
9474                         printf("EWOULDBLOCK\n");
9475 #endif
9476         ok:
9477                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9478                 sleep(2);                               /* Give it time to close our pipe */
9479                 alarm(5);
9480                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9481                 alarm(0);
9482                 sprintf(string, "%d\n", ret);
9483                 write(3, string, strlen(string));
9484                 exit(0);
9485         }
9486
9487         close(pd[0]);                   /* We write to pd[1] */
9488         close(pu[1]);                   /* We read from pu[0] */
9489         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9490         close(pd[1]);                   /* Pipe pd is now fully closed! */
9491         exit(0);                                /* Bye bye, thank you for playing! */
9492 }
9493 EOCP
9494         set try
9495         if eval $compile_ok; then
9496                 echo "$startsh" >mtry
9497                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9498                 chmod +x mtry
9499                 ./mtry >/dev/null 2>&1
9500                 case $? in
9501                 0) eagain=`$cat try.out`;;
9502                 1) echo "Could not perform non-blocking setting!";;
9503                 2) echo "I did a successful read() for something that was not there!";;
9504                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9505                 4) echo "Could not find F_SETFL!";;
9506                 *) echo "Something terribly wrong happened during testing.";;
9507                 esac
9508                 rd_nodata=`$cat try.ret`
9509                 echo "A read() system call with no data present returns $rd_nodata."
9510                 case "$rd_nodata" in
9511                 0|-1) ;;
9512                 *)
9513                         echo "(That's peculiar, fixing that to be -1.)"
9514                         rd_nodata=-1
9515                         ;;
9516                 esac
9517                 case "$eagain" in
9518                 '')
9519                         echo "Forcing errno EAGAIN on read() with no data available."
9520                         eagain=EAGAIN
9521                         ;;
9522                 *)
9523                         echo "Your read() sets errno to $eagain when no data is available."
9524                         ;;
9525                 esac
9526                 status=`$cat try.err`
9527                 case "$status" in
9528                 0) echo "And it correctly returns 0 to signal EOF.";;
9529                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9530                 *) echo "However, your read() returns '$status' on EOF??";;
9531                 esac
9532                 val="$define"
9533                 if test "$status" = "$rd_nodata"; then
9534                         echo "WARNING: you can't distinguish between EOF and no data!"
9535                         val="$undef"
9536                 fi
9537         else
9538                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9539                 eagain=EAGAIN
9540         fi
9541         set d_eofnblk
9542         eval $setvar
9543         ;;
9544 *)
9545         echo "Using $hint value $eagain."
9546         echo "Your read() returns $rd_nodata when no data is present."
9547         case "$d_eofnblk" in
9548         "$define") echo "And you can see EOF because read() returns 0.";;
9549         "$undef") echo "But you can't see EOF status from read() returned value.";;
9550         *)
9551                 echo "(Assuming you can't see EOF status from read anyway.)"
9552                 d_eofnblk=$undef
9553                 ;;
9554         esac
9555         ;;
9556 esac
9557 $rm -f try try.* .out core head.c mtry
9558
9559 : see if fchmod exists
9560 set fchmod d_fchmod
9561 eval $inlibc
9562
9563 : see if fchown exists
9564 set fchown d_fchown
9565 eval $inlibc
9566
9567 : see if this is an fcntl system
9568 set fcntl d_fcntl
9569 eval $inlibc
9570
9571 echo " "
9572 : See if fcntl-based locking works.
9573 $cat >try.c <<'EOCP'
9574 #include <stdlib.h>
9575 #include <unistd.h>
9576 #include <fcntl.h>
9577 int main() {
9578 #if defined(F_SETLK) && defined(F_SETLKW)
9579      struct flock flock;
9580      int retval, fd;
9581      fd = open("try.c", O_RDONLY);
9582      flock.l_type = F_RDLCK;
9583      flock.l_whence = SEEK_SET;
9584      flock.l_start = flock.l_len = 0;
9585      retval = fcntl(fd, F_SETLK, &flock);
9586      close(fd);
9587      (retval < 0 ? exit(2) : exit(0));
9588 #else
9589      exit(2);
9590 #endif
9591 }
9592 EOCP
9593 echo "Checking if fcntl-based file locking works... "
9594 case "$d_fcntl" in
9595 "$define")
9596         set try
9597         if eval $compile_ok; then
9598                 if ./try; then
9599                         echo "Yes, it seems to work."
9600                         val="$define"
9601                 else
9602                         echo "Nope, it didn't work."
9603                         val="$undef"
9604                 fi
9605         else
9606                 echo "I'm unable to compile the test program, so I'll assume not."
9607                 val="$undef"
9608         fi
9609         ;;
9610 *) val="$undef";
9611         echo "Nope, since you don't even have fcntl()."
9612         ;;
9613 esac
9614 set d_fcntl_can_lock
9615 eval $setvar
9616 $rm -f try*
9617
9618
9619 : see if sys/select.h has to be included
9620 set sys/select.h i_sysselct
9621 eval $inhdr
9622
9623 : see if we should include time.h, sys/time.h, or both
9624 echo " "
9625 if test "X$timeincl" = X; then
9626         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9627         $echo $n "I'm now running the test program...$c"
9628         $cat >try.c <<'EOCP'
9629 #include <sys/types.h>
9630 #ifdef I_TIME
9631 #include <time.h>
9632 #endif
9633 #ifdef I_SYSTIME
9634 #ifdef SYSTIMEKERNEL
9635 #define KERNEL
9636 #endif
9637 #include <sys/time.h>
9638 #endif
9639 #ifdef I_SYSSELECT
9640 #include <sys/select.h>
9641 #endif
9642 int main()
9643 {
9644         struct tm foo;
9645 #ifdef S_TIMEVAL
9646         struct timeval bar;
9647 #endif
9648 #ifdef S_TIMEZONE
9649         struct timezone tzp;
9650 #endif
9651         if (foo.tm_sec == foo.tm_sec)
9652                 exit(0);
9653 #ifdef S_TIMEVAL
9654         if (bar.tv_sec == bar.tv_sec)
9655                 exit(0);
9656 #endif
9657         exit(1);
9658 }
9659 EOCP
9660         flags=''
9661         for s_timezone in '-DS_TIMEZONE' ''; do
9662         sysselect=''
9663         for s_timeval in '-DS_TIMEVAL' ''; do
9664         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9665         for i_time in '' '-DI_TIME'; do
9666         for i_systime in '-DI_SYSTIME' ''; do
9667                 case "$flags" in
9668                 '') $echo $n ".$c"
9669                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9670                         if eval $compile; then
9671                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9672                                 shift
9673                                 flags="$*"
9674                                 echo " "
9675                                 $echo $n "Succeeded with $flags$c"
9676                         fi
9677                         ;;
9678                 esac
9679         done
9680         done
9681         done
9682         done
9683         done
9684         timeincl=''
9685         echo " "
9686         case "$flags" in
9687         *SYSTIMEKERNEL*) i_systimek="$define"
9688                 timeincl=`./findhdr sys/time.h`
9689                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9690         *) i_systimek="$undef";;
9691         esac
9692         case "$flags" in
9693         *I_TIME*) i_time="$define"
9694                 timeincl=`./findhdr time.h`" $timeincl"
9695                 echo "We'll include <time.h>." >&4;;
9696         *) i_time="$undef";;
9697         esac
9698         case "$flags" in
9699         *I_SYSTIME*) i_systime="$define"
9700                 timeincl=`./findhdr sys/time.h`" $timeincl"
9701                 echo "We'll include <sys/time.h>." >&4;;
9702         *) i_systime="$undef";;
9703         esac
9704         $rm -f try.c try
9705 fi
9706
9707 : check for fd_set items
9708 $cat <<EOM
9709
9710 Checking to see how well your C compiler handles fd_set and friends ...
9711 EOM
9712 $cat >fd_set.c <<EOCP
9713 #$i_systime I_SYS_TIME
9714 #$i_sysselct I_SYS_SELECT
9715 #$d_socket HAS_SOCKET
9716 #include <sys/types.h>
9717 #ifdef HAS_SOCKET
9718 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9719 #endif
9720 #ifdef I_SYS_TIME
9721 #include <sys/time.h>
9722 #endif
9723 #ifdef I_SYS_SELECT
9724 #include <sys/select.h>
9725 #endif
9726 int main() {
9727         fd_set fds;
9728
9729 #ifdef TRYBITS
9730         if(fds.fds_bits);
9731 #endif
9732
9733 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9734         exit(0);
9735 #else
9736         exit(1);
9737 #endif
9738 }
9739 EOCP
9740 set fd_set -DTRYBITS
9741 if eval $compile; then
9742         d_fds_bits="$define"
9743         d_fd_set="$define"
9744         echo "Well, your system knows about the normal fd_set typedef..." >&4
9745         if ./fd_set; then
9746                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9747                 d_fd_macros="$define"
9748         else
9749                 $cat >&4 <<'EOM'
9750 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9751 EOM
9752                 d_fd_macros="$undef"
9753         fi
9754 else
9755         $cat <<'EOM'
9756 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9757 EOM
9758         set fd_set
9759         if eval $compile; then
9760                 d_fds_bits="$undef"
9761                 d_fd_set="$define"
9762                 echo "Well, your system has some sort of fd_set available..." >&4
9763                 if ./fd_set; then
9764                         echo "and you have the normal fd_set macros." >&4
9765                         d_fd_macros="$define"
9766                 else
9767                         $cat <<'EOM'
9768 but not the normal fd_set macros!  Gross!  More work for me...
9769 EOM
9770                         d_fd_macros="$undef"
9771                 fi
9772         else
9773         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9774                 d_fd_set="$undef"
9775                 d_fds_bits="$undef"
9776                 d_fd_macros="$undef"
9777         fi
9778 fi
9779 $rm -f fd_set*
9780
9781 : see if fgetpos exists
9782 set fgetpos d_fgetpos
9783 eval $inlibc
9784
9785 : see if flock exists
9786 set flock d_flock
9787 eval $inlibc
9788
9789 : see if this is a sys/file.h system
9790 val=''
9791 set sys/file.h val
9792 eval $inhdr
9793
9794 : do we need to include sys/file.h ?
9795 case "$val" in
9796 "$define")
9797         echo " "
9798         if $h_sysfile; then
9799                 val="$define"
9800                 echo "We'll be including <sys/file.h>." >&4
9801         else
9802                 val="$undef"
9803                 echo "We won't be including <sys/file.h>." >&4
9804         fi
9805         ;;
9806 *)
9807         h_sysfile=false
9808         ;;
9809 esac
9810 set i_sysfile
9811 eval $setvar
9812
9813 : see if prototype for flock is available
9814 echo " "
9815 set d_flockproto flock $i_sysfile sys/file.h
9816 eval $hasproto
9817
9818 : see if fork exists
9819 set fork d_fork
9820 eval $inlibc
9821
9822 : see if pathconf exists
9823 set pathconf d_pathconf
9824 eval $inlibc
9825
9826 : see if fpathconf exists
9827 set fpathconf d_fpathconf
9828 eval $inlibc
9829
9830
9831 : check for fpos64_t
9832 echo " "
9833 echo "Checking to see if you have fpos64_t..." >&4
9834 $cat >try.c <<EOCP
9835 #include <stdio.h>
9836 int main() { fpos64_t x = 7; }
9837 EOCP
9838 set try
9839 if eval $compile; then
9840         val="$define"
9841         echo "You have fpos64_t."
9842 else
9843         val="$undef"
9844         echo "You do not have fpos64_t."
9845         case "$fpossize" in
9846         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9847         esac
9848 fi
9849 $rm -f try.* try
9850 set d_fpos64_t
9851 eval $setvar
9852
9853 : see if frexpl exists
9854 set frexpl d_frexpl
9855 eval $inlibc
9856
9857 : see if this is a sys/param system
9858 set sys/param.h i_sysparam
9859 eval $inhdr
9860
9861 : see if this is a sys/mount.h system
9862 set sys/mount.h i_sysmount
9863 eval $inhdr
9864
9865
9866 echo " "
9867 echo "Checking to see if your system supports struct fs_data..." >&4
9868 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9869 eval $hasstruct
9870 case "$d_fs_data_s" in
9871 "$define")      echo "Yes, it does."   ;;
9872 *)              echo "No, it doesn't." ;;
9873 esac
9874
9875 : see if fseeko exists
9876 set fseeko d_fseeko
9877 eval $inlibc
9878 case "$longsize" in
9879 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9880 esac
9881
9882 : see if fsetpos exists
9883 set fsetpos d_fsetpos
9884 eval $inlibc
9885
9886
9887 : see if fstatfs exists
9888 set fstatfs d_fstatfs
9889 eval $inlibc
9890
9891
9892 : see if statvfs exists
9893 set statvfs d_statvfs
9894 eval $inlibc
9895
9896 : see if fstatvfs exists
9897 set fstatvfs d_fstatvfs
9898 eval $inlibc
9899
9900
9901 : see if fsync exists
9902 set fsync d_fsync
9903 eval $inlibc
9904
9905 : see if ftello exists
9906 set ftello d_ftello
9907 eval $inlibc
9908 case "$longsize" in
9909 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9910 esac
9911
9912 : see if getcwd exists
9913 set getcwd d_getcwd
9914 eval $inlibc
9915
9916 : see if getespwnam exists
9917 set getespwnam d_getespwnam
9918 eval $inlibc
9919
9920
9921 : see if getfsstat exists
9922 set getfsstat d_getfsstat
9923 eval $inlibc
9924
9925 : see if getgrent exists
9926 set getgrent d_getgrent
9927 eval $inlibc
9928
9929 : see if gethostbyaddr exists
9930 set gethostbyaddr d_gethbyaddr
9931 eval $inlibc
9932
9933 : see if gethostbyname exists
9934 set gethostbyname d_gethbyname
9935 eval $inlibc
9936
9937 : see if gethostent exists
9938 set gethostent d_gethent
9939 eval $inlibc
9940
9941 : see how we will look up host name
9942 echo " "
9943 call=''
9944 if set gethostname val -f d_gethname; eval $csym; $val; then
9945         echo 'gethostname() found.' >&4
9946         d_gethname="$define"
9947         call=gethostname
9948 fi
9949 if set uname val -f d_uname; eval $csym; $val; then
9950         if ./xenix; then
9951                 $cat <<'EOM'
9952 uname() was found, but you're running xenix, and older versions of xenix
9953 have a broken uname(). If you don't really know whether your xenix is old
9954 enough to have a broken system call, use the default answer.
9955
9956 EOM
9957                 dflt=y
9958                 case "$d_uname" in
9959                 "$define") dflt=n;;
9960                 esac
9961                 rp='Is your uname() broken?'
9962                 . ./myread
9963                 case "$ans" in
9964                 n*) d_uname="$define"; call=uname;;
9965                 esac
9966         else
9967                 echo 'uname() found.' >&4
9968                 d_uname="$define"
9969                 case "$call" in
9970                 '') call=uname ;;
9971                 esac
9972         fi
9973 fi
9974 case "$d_gethname" in
9975 '') d_gethname="$undef";;
9976 esac
9977 case "$d_uname" in
9978 '') d_uname="$undef";;
9979 esac
9980 case "$d_uname$d_gethname" in
9981 *define*)
9982         dflt=n
9983         cat <<EOM
9984  
9985 Every now and then someone has a $call() that lies about the hostname
9986 but can't be fixed for political or economic reasons.  If you wish, I can
9987 pretend $call() isn't there and maybe compute hostname at run-time
9988 thanks to the '$phostname' command.
9989
9990 EOM
9991         rp="Shall I ignore $call() from now on?"
9992         . ./myread
9993         case "$ans" in
9994         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9995         esac;;
9996 esac
9997 case "$phostname" in
9998 '') aphostname='';;
9999 *) case "$aphostname" in
10000         /*) ;;
10001         *) set X $phostname
10002                 shift
10003                 file=$1
10004                 shift
10005                 file=`./loc $file $file $pth`
10006                 aphostname=`echo $file $*`
10007                 ;;
10008         esac
10009         ;;
10010 esac
10011 case "$d_uname$d_gethname" in
10012 *define*) ;;
10013 *)
10014         case "$phostname" in
10015         '')
10016                 echo "There will be no way for $package to get your hostname." >&4;;
10017         *)
10018         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10019                 ;;
10020         esac;;
10021 esac
10022 case "$d_phostname" in
10023 '') d_phostname="$undef";;
10024 esac
10025
10026 : see if this is a netdb.h system
10027 set netdb.h i_netdb
10028 eval $inhdr
10029
10030 : see if prototypes for various gethostxxx netdb.h functions are available
10031 echo " "
10032 set d_gethostprotos gethostent $i_netdb netdb.h
10033 eval $hasproto
10034
10035 : see if getitimer exists
10036 set getitimer d_getitimer
10037 eval $inlibc
10038
10039 : see if getlogin exists
10040 set getlogin d_getlogin
10041 eval $inlibc
10042
10043 : see if getmnt exists
10044 set getmnt d_getmnt
10045 eval $inlibc
10046
10047 : see if getmntent exists
10048 set getmntent d_getmntent
10049 eval $inlibc
10050
10051 : see if getnetbyaddr exists
10052 set getnetbyaddr d_getnbyaddr
10053 eval $inlibc
10054
10055 : see if getnetbyname exists
10056 set getnetbyname d_getnbyname
10057 eval $inlibc
10058
10059 : see if getnetent exists
10060 set getnetent d_getnent
10061 eval $inlibc
10062
10063 : see if prototypes for various getnetxxx netdb.h functions are available
10064 echo " "
10065 set d_getnetprotos getnetent $i_netdb netdb.h
10066 eval $hasproto
10067
10068 : see if getpagesize exists
10069 set getpagesize d_getpagsz
10070 eval $inlibc
10071
10072
10073 : see if getprotobyname exists
10074 set getprotobyname d_getpbyname
10075 eval $inlibc
10076
10077 : see if getprotobynumber exists
10078 set getprotobynumber d_getpbynumber
10079 eval $inlibc
10080
10081 : see if getprotoent exists
10082 set getprotoent d_getpent
10083 eval $inlibc
10084
10085 : see if getpgid exists
10086 set getpgid d_getpgid
10087 eval $inlibc
10088
10089 : see if getpgrp2 exists
10090 set getpgrp2 d_getpgrp2
10091 eval $inlibc
10092
10093 : see if getppid exists
10094 set getppid d_getppid
10095 eval $inlibc
10096
10097 : see if getpriority exists
10098 set getpriority d_getprior
10099 eval $inlibc
10100
10101 : see if prototypes for various getprotoxxx netdb.h functions are available
10102 echo " "
10103 set d_getprotoprotos getprotoent $i_netdb netdb.h
10104 eval $hasproto
10105
10106 : see if getprpwnam exists
10107 set getprpwnam d_getprpwnam
10108 eval $inlibc
10109
10110 : see if getpwent exists
10111 set getpwent d_getpwent
10112 eval $inlibc
10113
10114
10115 : see if getservbyname exists
10116 set getservbyname d_getsbyname
10117 eval $inlibc
10118
10119 : see if getservbyport exists
10120 set getservbyport d_getsbyport
10121 eval $inlibc
10122
10123 : see if getservent exists
10124 set getservent d_getsent
10125 eval $inlibc
10126
10127 : see if prototypes for various getservxxx netdb.h functions are available
10128 echo " "
10129 set d_getservprotos getservent $i_netdb netdb.h
10130 eval $hasproto
10131
10132 : see if getspnam exists
10133 set getspnam d_getspnam
10134 eval $inlibc
10135
10136 : see if gettimeofday or ftime exists
10137 set gettimeofday d_gettimeod
10138 eval $inlibc
10139 case "$d_gettimeod" in
10140 "$undef")
10141         set ftime d_ftime 
10142         eval $inlibc
10143         ;;
10144 *)
10145         val="$undef"; set d_ftime; eval $setvar
10146         ;;
10147 esac
10148 case "$d_gettimeod$d_ftime" in
10149 "$undef$undef")
10150         echo " "
10151         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10152         ;;
10153 esac
10154
10155 : see if this is an grp system
10156 set grp.h i_grp
10157 eval $inhdr
10158
10159 case "$i_grp" in
10160 $define)
10161         xxx=`./findhdr grp.h`
10162         $cppstdin $cppflags $cppminus < $xxx >$$.h
10163
10164         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10165                 val="$define"
10166         else
10167                 val="$undef"
10168         fi
10169         set d_grpasswd
10170         eval $setvar
10171
10172         $rm -f $$.h
10173         ;;
10174 *)
10175         val="$undef";
10176         set d_grpasswd; eval $setvar
10177         ;;
10178 esac
10179
10180 : see if hasmntopt exists
10181 set hasmntopt d_hasmntopt
10182 eval $inlibc
10183
10184 : see if this is a netinet/in.h or sys/in.h system
10185 set netinet/in.h i_niin sys/in.h i_sysin
10186 eval $inhdr
10187
10188 : see if arpa/inet.h has to be included
10189 set arpa/inet.h i_arpainet
10190 eval $inhdr
10191
10192 : see if htonl --and friends-- exists
10193 val=''
10194 set htonl val
10195 eval $inlibc
10196
10197 : Maybe they are macros.
10198 case "$val" in
10199 $undef)
10200         $cat >htonl.c <<EOM
10201 #include <stdio.h>
10202 #include <sys/types.h>
10203 #$i_niin I_NETINET_IN
10204 #$i_sysin I_SYS_IN
10205 #$i_arpainet I_ARPA_INET
10206 #ifdef I_NETINET_IN
10207 #include <netinet/in.h>
10208 #endif
10209 #ifdef I_SYS_IN
10210 #include <sys/in.h>
10211 #endif
10212 #ifdef I_ARPA_INET
10213 #include <arpa/inet.h>
10214 #endif
10215 #ifdef htonl
10216 printf("Defined as a macro.");
10217 #endif
10218 EOM
10219         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10220         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10221                 val="$define"
10222                 echo "But it seems to be defined as a macro." >&4
10223         fi
10224         $rm -f htonl.?
10225         ;;
10226 esac
10227 set d_htonl
10228 eval $setvar
10229
10230 : see if iconv exists
10231 set iconv d_iconv
10232 eval $inlibc
10233
10234 : index or strchr
10235 echo " "
10236 if set index val -f; eval $csym; $val; then
10237         if set strchr val -f d_strchr; eval $csym; $val; then
10238                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10239                         val="$define"
10240                         vali="$undef"
10241                         echo "strchr() found." >&4
10242                 else
10243                         val="$undef"
10244                         vali="$define"
10245                         echo "index() found." >&4
10246                 fi
10247         else
10248                 val="$undef"
10249                 vali="$define"
10250                 echo "index() found." >&4
10251         fi
10252 else
10253         if set strchr val -f d_strchr; eval $csym; $val; then
10254                 val="$define"
10255                 vali="$undef"
10256                 echo "strchr() found." >&4
10257         else
10258                 echo "No index() or strchr() found!" >&4
10259                 val="$undef"
10260                 vali="$undef"
10261         fi
10262 fi
10263 set d_strchr; eval $setvar
10264 val="$vali"
10265 set d_index; eval $setvar
10266
10267 : check whether inet_aton exists
10268 set inet_aton d_inetaton
10269 eval $inlibc
10270
10271 : Look for isascii
10272 echo " "
10273 $cat >isascii.c <<'EOCP'
10274 #include <stdio.h>
10275 #include <ctype.h>
10276 int main() {
10277         int c = 'A';
10278         if (isascii(c))
10279                 exit(0);
10280         else
10281                 exit(1);
10282 }
10283 EOCP
10284 set isascii
10285 if eval $compile; then
10286         echo "isascii() found." >&4
10287         val="$define"
10288 else
10289         echo "isascii() NOT found." >&4
10290         val="$undef"
10291 fi
10292 set d_isascii
10293 eval $setvar
10294 $rm -f isascii*
10295
10296 : see if isnan exists
10297 set isnan d_isnan
10298 eval $inlibc
10299
10300 : see if isnanl exists
10301 set isnanl d_isnanl
10302 eval $inlibc
10303
10304 : see if killpg exists
10305 set killpg d_killpg
10306 eval $inlibc
10307
10308 : see if lchown exists
10309 echo " "
10310 $cat > try.c <<'EOCP'
10311 /* System header to define __stub macros and hopefully few prototypes,
10312     which can conflict with char lchown(); below.  */
10313 #include <assert.h>
10314 /* Override any gcc2 internal prototype to avoid an error.  */
10315 /* We use char because int might match the return type of a gcc2
10316    builtin and then its argument prototype would still apply.  */
10317 char lchown();
10318 int main() {
10319     /*  The GNU C library defines this for functions which it implements
10320         to always fail with ENOSYS.  Some functions are actually named
10321         something starting with __ and the normal name is an alias.  */
10322 #if defined (__stub_lchown) || defined (__stub___lchown)
10323 choke me
10324 #else
10325 lchown();
10326 #endif
10327 ; return 0; }
10328 EOCP
10329 set try
10330 if eval $compile; then
10331     $echo "lchown() found." >&4
10332     val="$define"
10333 else
10334     $echo "lchown() NOT found." >&4
10335     val="$undef"
10336 fi
10337 set d_lchown
10338 eval $setvar
10339
10340 : See if number of significant digits in a double precision number is known
10341 echo " "
10342 $cat >ldbl_dig.c <<EOM
10343 #$i_limits I_LIMITS
10344 #$i_float I_FLOAT
10345 #ifdef I_LIMITS
10346 #include <limits.h>
10347 #endif
10348 #ifdef I_FLOAT
10349 #include <float.h>
10350 #endif
10351 #ifdef LDBL_DIG
10352 printf("Contains LDBL_DIG");
10353 #endif
10354 EOM
10355 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10356 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10357         echo "LDBL_DIG found." >&4
10358         val="$define"
10359 else
10360         echo "LDBL_DIG NOT found." >&4
10361         val="$undef"
10362 fi
10363 $rm -f ldbl_dig.?
10364 set d_ldbl_dig
10365 eval $setvar
10366
10367 : see if link exists
10368 set link d_link
10369 eval $inlibc
10370
10371 : see if localeconv exists
10372 set localeconv d_locconv
10373 eval $inlibc
10374
10375 : see if lockf exists
10376 set lockf d_lockf
10377 eval $inlibc
10378
10379 : see if prototype for lseek is available
10380 echo " "
10381 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10382 eval $hasproto
10383
10384 : see if lstat exists
10385 set lstat d_lstat
10386 eval $inlibc
10387
10388 : see if madvise exists
10389 set madvise d_madvise
10390 eval $inlibc
10391
10392 : see if mblen exists
10393 set mblen d_mblen
10394 eval $inlibc
10395
10396 : see if mbstowcs exists
10397 set mbstowcs d_mbstowcs
10398 eval $inlibc
10399
10400 : see if mbtowc exists
10401 set mbtowc d_mbtowc
10402 eval $inlibc
10403
10404 : see if memchr exists
10405 set memchr d_memchr
10406 eval $inlibc
10407
10408 : see if memcmp exists
10409 set memcmp d_memcmp
10410 eval $inlibc
10411
10412 : see if memcpy exists
10413 set memcpy d_memcpy
10414 eval $inlibc
10415
10416 : see if memmove exists
10417 set memmove d_memmove
10418 eval $inlibc
10419
10420 : see if memset exists
10421 set memset d_memset
10422 eval $inlibc
10423
10424 : see if mkdir exists
10425 set mkdir d_mkdir
10426 eval $inlibc
10427
10428 : see if mkdtemp exists
10429 set mkdtemp d_mkdtemp
10430 eval $inlibc
10431
10432 : see if mkfifo exists
10433 set mkfifo d_mkfifo
10434 eval $inlibc
10435
10436 : see if mkstemp exists
10437 set mkstemp d_mkstemp
10438 eval $inlibc
10439
10440 : see if mkstemps exists
10441 set mkstemps d_mkstemps
10442 eval $inlibc
10443
10444 : see if mktime exists
10445 set mktime d_mktime
10446 eval $inlibc
10447
10448 : see if this is a sys/mman.h system
10449 set sys/mman.h i_sysmman
10450 eval $inhdr
10451
10452 : see if mmap exists
10453 set mmap d_mmap
10454 eval $inlibc
10455 : see what shmat returns
10456 : default to something harmless
10457 mmaptype='void *'
10458 case "$i_sysmman$d_mmap" in
10459 "$define$define")
10460         $cat >mmap.c <<'END'
10461 #include <sys/mman.h>
10462 void *mmap();
10463 END
10464         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10465                 mmaptype='void *'
10466         else
10467                 mmaptype='caddr_t'
10468         fi
10469         echo "and it returns ($mmaptype)." >&4
10470         ;;
10471 esac
10472
10473
10474
10475 : see if modfl exists
10476 set modfl d_modfl
10477 eval $inlibc
10478
10479 : see if mprotect exists
10480 set mprotect d_mprotect
10481 eval $inlibc
10482
10483 : see if msgctl exists
10484 set msgctl d_msgctl
10485 eval $inlibc
10486
10487 : see if msgget exists
10488 set msgget d_msgget
10489 eval $inlibc
10490
10491 : see if msgsnd exists
10492 set msgsnd d_msgsnd
10493 eval $inlibc
10494
10495 : see if msgrcv exists
10496 set msgrcv d_msgrcv
10497 eval $inlibc
10498
10499 : see how much of the 'msg*(2)' library is present.
10500 h_msg=true
10501 echo " "
10502 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10503 *"$undef"*) h_msg=false;;
10504 esac
10505 case "$osname" in
10506 freebsd)
10507     case "`ipcs 2>&1`" in
10508     "SVID messages"*"not configured"*)
10509         echo "Your $osname does not have the msg*(2) configured." >&4
10510         h_msg=false
10511         val="$undef"
10512         set msgctl d_msgctl
10513         eval $setvar
10514         set msgget d_msgget
10515         eval $setvar
10516         set msgsnd d_msgsnd
10517         eval $setvar
10518         set msgrcv d_msgrcv
10519         eval $setvar
10520         ;;
10521     esac
10522     ;;
10523 esac
10524 : we could also check for sys/ipc.h ...
10525 if $h_msg && $test `./findhdr sys/msg.h`; then
10526         echo "You have the full msg*(2) library." >&4
10527         val="$define"
10528 else
10529         echo "You don't have the full msg*(2) library." >&4
10530         val="$undef"
10531 fi
10532 set d_msg
10533 eval $setvar
10534
10535
10536 echo " "
10537 echo "Checking to see if your system supports struct msghdr..." >&4
10538 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10539 eval $hasstruct
10540 case "$d_msghdr_s" in
10541 "$define")      echo "Yes, it does."   ;;
10542 *)              echo "No, it doesn't." ;;
10543 esac
10544
10545
10546 : see if msync exists
10547 set msync d_msync
10548 eval $inlibc
10549
10550 : see if munmap exists
10551 set munmap d_munmap
10552 eval $inlibc
10553
10554 : see if nice exists
10555 set nice d_nice
10556 eval $inlibc
10557
10558 : check for length of character
10559 echo " "
10560 case "$charsize" in
10561 '')
10562         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10563         $cat >try.c <<'EOCP'
10564 #include <stdio.h>
10565 int main()
10566 {
10567     printf("%d\n", (int)sizeof(char));
10568     exit(0);
10569 }
10570 EOCP
10571         set try
10572         if eval $compile_ok; then
10573                 dflt=`./try`
10574         else
10575                 dflt='1'
10576                 echo "(I can't seem to compile the test program.  Guessing...)"
10577         fi
10578         ;;
10579 *)
10580         dflt="$charsize"
10581         ;;
10582 esac
10583 rp="What is the size of a character (in bytes)?"
10584 . ./myread
10585 charsize="$ans"
10586 $rm -f try.c try
10587
10588 : check for volatile keyword
10589 echo " "
10590 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10591 $cat >try.c <<'EOCP'
10592 int main()
10593 {
10594         typedef struct _goo_struct goo_struct;
10595         goo_struct * volatile goo = ((goo_struct *)0);
10596         struct _goo_struct {
10597                 long long_int;
10598                 int reg_int;
10599                 char char_var;
10600         };
10601         typedef unsigned short foo_t;
10602         char *volatile foo;
10603         volatile int bar;
10604         volatile foo_t blech;
10605         foo = foo;
10606 }
10607 EOCP
10608 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10609         val="$define"
10610         echo "Yup, it does."
10611 else
10612         val="$undef"
10613         echo "Nope, it doesn't."
10614 fi
10615 set d_volatile
10616 eval $setvar
10617 $rm -f try.*
10618
10619
10620 echo " "
10621 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10622
10623 case "$use64bitint:$d_quad:$quadtype" in
10624 define:define:?*)
10625         ivtype="$quadtype"
10626         uvtype="$uquadtype"
10627         ivsize=8
10628         uvsize=8
10629         ;;
10630 *)      ivtype="long"
10631         uvtype="unsigned long"
10632         ivsize=$longsize
10633         uvsize=$longsize
10634         ;;
10635 esac
10636
10637 case "$uselongdouble:$d_longdbl" in
10638 define:define)
10639         nvtype="long double"
10640         nvsize=$longdblsize
10641         ;;
10642 *)      nvtype=double
10643         nvsize=$doublesize
10644         ;;
10645 esac
10646
10647 $echo "(IV will be "$ivtype", $ivsize bytes)"
10648 $echo "(UV will be "$uvtype", $uvsize bytes)"
10649 $echo "(NV will be "$nvtype", $nvsize bytes)"
10650
10651 $cat >try.c <<EOCP
10652 #$i_inttypes I_INTTYPES
10653 #ifdef I_INTTYPES
10654 #include <inttypes.h>
10655 #endif
10656 #include <stdio.h>
10657 int main() {
10658 #ifdef INT8
10659    int8_t i =  INT8_MAX;
10660   uint8_t u = UINT8_MAX;
10661   printf("int8_t\n");
10662 #endif
10663 #ifdef INT16
10664    int16_t i =  INT16_MAX;
10665   uint16_t i = UINT16_MAX;
10666   printf("int16_t\n");
10667 #endif
10668 #ifdef INT32
10669    int32_t i =  INT32_MAX;
10670   uint32_t u = UINT32_MAX;
10671   printf("int32_t\n");
10672 #endif
10673 }
10674 EOCP
10675
10676 case "$i8type" in
10677 '')     case "$charsize" in
10678         1)      i8type=char
10679                 u8type="unsigned char"
10680                 i8size=$charsize
10681                 u8size=$charsize
10682                 ;;
10683         esac
10684         ;;
10685 esac
10686 case "$i8type" in
10687 '')     set try -DINT8
10688         if eval $compile; then
10689                 case "`./try$exe_ext`" in
10690                 int8_t) i8type=int8_t
10691                         u8type=uint8_t
10692                         i8size=1
10693                         u8size=1
10694                         ;;
10695                 esac
10696         fi
10697         ;;
10698 esac
10699 case "$i8type" in
10700 '')     if $test $charsize -ge 1; then
10701                 i8type=char
10702                 u8type="unsigned char"
10703                 i8size=$charsize
10704                 u8size=$charsize
10705         fi
10706         ;;
10707 esac
10708
10709 case "$i16type" in
10710 '')     case "$shortsize" in
10711         2)      i16type=short
10712                 u16type="unsigned short"
10713                 i16size=$shortsize
10714                 u16size=$shortsize
10715                 ;;
10716         esac
10717         ;;
10718 esac
10719 case "$i16type" in
10720 '')     set try -DINT16
10721         if eval $compile; then
10722                 case "`./try$exe_ext`" in
10723                 int16_t)
10724                         i16type=int16_t
10725                         u16type=uint16_t
10726                         i16size=2
10727                         u16size=2
10728                         ;;
10729                 esac
10730         fi
10731         ;;
10732 esac
10733 case "$i16type" in
10734 '')     if $test $shortsize -ge 2; then
10735                 i16type=short
10736                 u16type="unsigned short"
10737                 i16size=$shortsize
10738                 u16size=$shortsize
10739         fi
10740         ;;
10741 esac
10742
10743 case "$i32type" in
10744 '')     case "$longsize" in
10745         4)      i32type=long
10746                 u32type="unsigned long"
10747                 i32size=$longsize
10748                 u32size=$longsize
10749                 ;;
10750         *)      case "$intsize" in
10751                 4)      i32type=int
10752                         u32type="unsigned int"
10753                         i32size=$intsize
10754                         u32size=$intsize
10755                         ;;
10756                 esac
10757                 ;;
10758         esac
10759         ;;
10760 esac
10761 case "$i32type" in
10762 '')     set try -DINT32
10763         if eval $compile; then
10764                 case "`./try$exe_ext`" in
10765                 int32_t)
10766                         i32type=int32_t
10767                         u32type=uint32_t
10768                         i32size=4
10769                         u32size=4
10770                         ;;
10771                 esac
10772         fi
10773         ;;
10774 esac
10775 case "$i32type" in
10776 '')     if $test $intsize -ge 4; then
10777                 i32type=int
10778                 u32type="unsigned int"
10779                 i32size=$intsize
10780                 u32size=$intsize
10781         fi
10782         ;;
10783 esac
10784
10785 case "$i64type" in
10786 '')     case "$d_quad:$quadtype" in
10787         define:?*)
10788                 i64type="$quadtype"
10789                 u64type="$uquadtype"
10790                 i64size=8
10791                 u64size=8
10792                 ;;
10793         esac
10794         ;;
10795 esac
10796
10797 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10798 : volatile so that the compiler has to store it out to memory.
10799 if test X"$d_volatile" = X"$define"; then
10800         volatile=volatile
10801 fi
10802 $cat <<EOP >try.c
10803 #include <stdio.h>
10804 #include <sys/types.h>
10805 #include <signal.h>
10806 #ifdef SIGFPE
10807 $volatile int bletched = 0;
10808 $signal_t blech(s) int s; { bletched = 1; }
10809 #endif
10810 int main() {
10811     $uvtype u = 0;
10812     $nvtype d;
10813     int     n = 8 * $uvsize;
10814     int     i;
10815 #ifdef SIGFPE
10816     signal(SIGFPE, blech);
10817 #endif
10818
10819     for (i = 0; i < n; i++) {
10820       u = u << 1 | ($uvtype)1;
10821       d = ($nvtype)u;
10822       if (($uvtype)d != u)
10823         break;
10824       if (d <= 0)
10825         break;
10826       d = ($nvtype)(u - 1);
10827       if (($uvtype)d != (u - 1))
10828         break;
10829 #ifdef SIGFPE
10830       if (bletched) {
10831         break;
10832 #endif
10833       } 
10834     }
10835     printf("%d\n", ((i == n) ? -n : i));
10836     exit(0);
10837 }
10838 EOP
10839 set try
10840
10841 d_nv_preserves_uv="$undef"
10842 if eval $compile; then
10843         d_nv_preserves_uv_bits="`./try$exe_ext`"
10844 fi
10845 case "$d_nv_preserves_uv_bits" in
10846 \-[1-9]*)       
10847         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10848         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10849         d_nv_preserves_uv="$define"
10850         ;;
10851 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10852         d_nv_preserves_uv="$undef" ;;
10853 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10854         d_nv_preserves_uv_bits="$undef" ;;
10855 esac
10856
10857 $rm -f try.* try
10858
10859
10860 : check for off64_t
10861 echo " "
10862 echo "Checking to see if you have off64_t..." >&4
10863 $cat >try.c <<EOCP
10864 #include <sys/types.h>
10865 #include <unistd.h>
10866 int main() { off64_t x = 7; }
10867 EOCP
10868 set try
10869 if eval $compile; then
10870         val="$define"
10871         echo "You have off64_t."
10872 else
10873         val="$undef"
10874         echo "You do not have off64_t."
10875         case "$lseeksize" in
10876         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10877         esac
10878 fi
10879 $rm -f try.* try
10880 set d_off64_t
10881 eval $setvar
10882
10883 : see if POSIX threads are available
10884 set pthread.h i_pthread
10885 eval $inhdr
10886
10887
10888
10889
10890 : how to create joinable pthreads
10891 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10892         echo " "
10893         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10894         $cat >try.c <<'EOCP'
10895 #include <pthread.h>
10896 int main() {
10897     int detachstate = JOINABLE;
10898 }
10899 EOCP
10900         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10901         if eval $compile; then
10902                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10903                 val="$undef" # Yes, undef.
10904                 set d_old_pthread_create_joinable
10905                 eval $setvar
10906                 val=""
10907                 set old_pthread_create_joinable
10908                 eval $setvar
10909         else
10910                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10911                 if eval $compile; then
10912                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10913                         val="$define"
10914                         set d_old_pthread_create_joinable
10915                         eval $setvar
10916                         val=PTHREAD_CREATE_UNDETACHED
10917                         set old_pthread_create_joinable
10918                         eval $setvar
10919                 else            
10920                         set try -DJOINABLE=__UNDETACHED
10921                         if eval $compile; then
10922                                 echo "You seem to use __UNDETACHED." >&4
10923                                 val="$define"
10924                                 set d_old_pthread_create_joinable
10925                                 eval $setvar
10926                                 val=__UNDETACHED
10927                                 set old_pthread_create_joinable
10928                                 eval $setvar
10929                         else
10930                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10931                                 val="$define"
10932                                 set d_old_pthread_create_joinable
10933                                 eval $setvar
10934                                 val=0
10935                                 set old_pthread_create_joinable
10936                                 eval $setvar
10937                         fi
10938                 fi
10939         fi
10940         $rm -f try try.*
10941 else
10942     d_old_pthread_create_joinable="$undef"
10943     old_pthread_create_joinable=""
10944 fi
10945
10946 : see if pause exists
10947 set pause d_pause
10948 eval $inlibc
10949
10950 : see if pipe exists
10951 set pipe d_pipe
10952 eval $inlibc
10953
10954 : see if poll exists
10955 set poll d_poll
10956 eval $inlibc
10957
10958
10959 : see whether the various POSIXish _yields exist
10960 $cat >try.c <<EOP
10961 #include <pthread.h>
10962 #include <stdio.h>
10963 int main() {
10964 #ifdef SCHED_YIELD
10965         sched_yield();
10966 #else
10967 #ifdef PTHREAD_YIELD
10968         pthread_yield();
10969 #else
10970 #ifdef PTHREAD_YIELD_NULL
10971         pthread_yield(NULL);
10972 #endif
10973 #endif
10974 #endif
10975 }
10976 EOP
10977 : see if sched_yield exists
10978 set try -DSCHED_YIELD
10979 if eval $compile; then
10980     val="$define"
10981     sched_yield='sched_yield()'
10982 else
10983     val="$undef"
10984 fi
10985 case "$usethreads" in
10986 $define)
10987         case "$val" in
10988         $define) echo 'sched_yield() found.' >&4        ;;
10989         *)       echo 'sched_yield() NOT found.' >&4    ;;
10990         esac
10991 esac
10992 set d_sched_yield
10993 eval $setvar
10994
10995 : see if pthread_yield exists
10996 set try -DPTHREAD_YIELD
10997 if eval $compile; then
10998     val="$define"
10999     case "$sched_yield" in
11000     '') sched_yield='pthread_yield()' ;;
11001     esac
11002 else
11003     set try -DPTHREAD_YIELD_NULL
11004     if eval $compile; then
11005         val="$define"
11006         case "$sched_yield" in
11007         '') sched_yield='pthread_yield(NULL)' ;;
11008         esac
11009     else
11010         val="$undef"
11011     fi
11012 fi
11013 case "$usethreads" in
11014 $define)
11015         case "$val" in
11016         $define) echo 'pthread_yield() found.' >&4      ;;
11017         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11018         esac
11019         ;;
11020 esac
11021 set d_pthread_yield
11022 eval $setvar
11023
11024 case "$sched_yield" in
11025 '') sched_yield=undef ;;
11026 esac
11027
11028 $rm -f try try.*
11029
11030 : see if this is a pwd.h system
11031 set pwd.h i_pwd
11032 eval $inhdr
11033
11034 case "$i_pwd" in
11035 $define)
11036         xxx=`./findhdr pwd.h`
11037         $cppstdin $cppflags $cppminus < $xxx >$$.h
11038
11039         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11040                 val="$define"
11041         else
11042                 val="$undef"
11043         fi
11044         set d_pwquota
11045         eval $setvar
11046
11047         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11048                 val="$define"
11049         else
11050                 val="$undef"
11051         fi
11052         set d_pwage
11053         eval $setvar
11054
11055         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11056                 val="$define"
11057         else
11058                 val="$undef"
11059         fi
11060         set d_pwchange
11061         eval $setvar
11062
11063         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11064                 val="$define"
11065         else
11066                 val="$undef"
11067         fi
11068         set d_pwclass
11069         eval $setvar
11070
11071         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11072                 val="$define"
11073         else
11074                 val="$undef"
11075         fi
11076         set d_pwexpire
11077         eval $setvar
11078
11079         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11080                 val="$define"
11081         else
11082                 val="$undef"
11083         fi
11084         set d_pwcomment
11085         eval $setvar
11086
11087         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11088                 val="$define"
11089         else
11090                 val="$undef"
11091         fi
11092         set d_pwgecos
11093         eval $setvar
11094
11095         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11096                 val="$define"
11097         else
11098                 val="$undef"
11099         fi
11100         set d_pwpasswd
11101         eval $setvar
11102
11103         $rm -f $$.h
11104         ;;
11105 *)
11106         val="$undef"; 
11107         set d_pwquota; eval $setvar
11108         set d_pwage; eval $setvar
11109         set d_pwchange; eval $setvar
11110         set d_pwclass; eval $setvar
11111         set d_pwexpire; eval $setvar
11112         set d_pwcomment; eval $setvar
11113         set d_pwgecos; eval $setvar
11114         set d_pwpasswd; eval $setvar
11115         ;;
11116 esac
11117
11118 : see if readdir and friends exist
11119 set readdir d_readdir
11120 eval $inlibc
11121 set seekdir d_seekdir
11122 eval $inlibc
11123 set telldir d_telldir
11124 eval $inlibc
11125 set rewinddir d_rewinddir
11126 eval $inlibc
11127
11128 : see if readlink exists
11129 set readlink d_readlink
11130 eval $inlibc
11131
11132 : see if readv exists
11133 set readv d_readv
11134 eval $inlibc
11135
11136 : see if realpath exists
11137 set realpath d_realpath
11138 eval $inlibc
11139
11140 : see if recvmsg exists
11141 set recvmsg d_recvmsg
11142 eval $inlibc
11143
11144 : see if rename exists
11145 set rename d_rename
11146 eval $inlibc
11147
11148 : see if rmdir exists
11149 set rmdir d_rmdir
11150 eval $inlibc
11151
11152 : see if memory.h is available.
11153 val=''
11154 set memory.h val
11155 eval $inhdr
11156
11157 : See if it conflicts with string.h
11158 case "$val" in
11159 $define)
11160         case "$strings" in
11161         '') ;;
11162         *)
11163                 $cppstdin $cppflags $cppminus < $strings > mem.h
11164                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11165                         echo " "
11166                         echo "We won't be including <memory.h>."
11167                         val="$undef"
11168                 fi
11169                 $rm -f mem.h
11170                 ;;
11171         esac
11172 esac
11173 set i_memory
11174 eval $setvar
11175
11176 : can bcopy handle overlapping blocks?
11177 val="$undef"
11178 case "$d_bcopy" in
11179 "$define")
11180         echo " "
11181         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11182         $cat >try.c <<EOCP
11183 #$i_memory I_MEMORY
11184 #$i_stdlib I_STDLIB
11185 #$i_string I_STRING
11186 #$i_unistd I_UNISTD
11187 EOCP
11188         $cat >>try.c <<'EOCP'
11189 #include <stdio.h>
11190 #ifdef I_MEMORY
11191 #  include <memory.h>
11192 #endif
11193 #ifdef I_STDLIB
11194 #  include <stdlib.h>
11195 #endif
11196 #ifdef I_STRING
11197 #  include <string.h>
11198 #else
11199 #  include <strings.h>
11200 #endif
11201 #ifdef I_UNISTD
11202 #  include <unistd.h>  /* Needed for NetBSD */
11203 #endif
11204 int main()
11205 {
11206 char buf[128], abc[128];
11207 char *b;
11208 int len;
11209 int off;
11210 int align;
11211
11212 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11213
11214 for (align = 7; align >= 0; align--) {
11215         for (len = 36; len; len--) {
11216                 b = buf+align;
11217                 bcopy(abc, b, len);
11218                 for (off = 1; off <= len; off++) {
11219                         bcopy(b, b+off, len);
11220                         bcopy(b+off, b, len);
11221                         if (bcmp(b, abc, len))
11222                                 exit(1);
11223                 }
11224         }
11225 }
11226 exit(0);
11227 }
11228 EOCP
11229         set try
11230         if eval $compile_ok; then
11231                 if ./try 2>/dev/null; then
11232                         echo "Yes, it can."
11233                         val="$define"
11234                 else
11235                         echo "It can't, sorry."
11236                         case "$d_memmove" in
11237                         "$define") echo "But that's Ok since you have memmove()." ;;
11238                         esac
11239                 fi
11240         else
11241                 echo "(I can't compile the test program, so we'll assume not...)"
11242                 case "$d_memmove" in
11243                 "$define") echo "But that's Ok since you have memmove()." ;;
11244                 esac
11245         fi
11246         ;;
11247 esac
11248 $rm -f try.* try core
11249 set d_safebcpy
11250 eval $setvar
11251
11252 : can memcpy handle overlapping blocks?
11253 val="$undef"
11254 case "$d_memcpy" in
11255 "$define")
11256         echo " "
11257         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11258         $cat >try.c <<EOCP
11259 #$i_memory I_MEMORY
11260 #$i_stdlib I_STDLIB
11261 #$i_string I_STRING
11262 #$i_unistd I_UNISTD
11263 EOCP
11264         $cat >>try.c <<'EOCP'
11265 #include <stdio.h>
11266 #ifdef I_MEMORY
11267 #  include <memory.h>
11268 #endif
11269 #ifdef I_STDLIB
11270 #  include <stdlib.h>
11271 #endif
11272 #ifdef I_STRING
11273 #  include <string.h>
11274 #else
11275 #  include <strings.h>
11276 #endif
11277 #ifdef I_UNISTD
11278 #  include <unistd.h>  /* Needed for NetBSD */
11279 #endif
11280 int main()
11281 {
11282 char buf[128], abc[128];
11283 char *b;
11284 int len;
11285 int off;
11286 int align;
11287
11288 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11289    try to store the string in read-only memory. */
11290 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11291
11292 for (align = 7; align >= 0; align--) {
11293         for (len = 36; len; len--) {
11294                 b = buf+align;
11295                 memcpy(b, abc, len);
11296                 for (off = 1; off <= len; off++) {
11297                         memcpy(b+off, b, len);
11298                         memcpy(b, b+off, len);
11299                         if (memcmp(b, abc, len))
11300                                 exit(1);
11301                 }
11302         }
11303 }
11304 exit(0);
11305 }
11306 EOCP
11307         set try
11308         if eval $compile_ok; then
11309                 if ./try 2>/dev/null; then
11310                         echo "Yes, it can."
11311                         val="$define"
11312                 else
11313                         echo "It can't, sorry."
11314                         case "$d_memmove" in
11315                         "$define") echo "But that's Ok since you have memmove()." ;;
11316                         esac
11317                 fi
11318         else
11319                 echo "(I can't compile the test program, so we'll assume not...)"
11320                 case "$d_memmove" in
11321                 "$define") echo "But that's Ok since you have memmove()." ;;
11322                 esac
11323         fi
11324         ;;
11325 esac
11326 $rm -f try.* try core
11327 set d_safemcpy
11328 eval $setvar
11329
11330 : can memcmp be trusted to compare relative magnitude?
11331 val="$undef"
11332 case "$d_memcmp" in
11333 "$define")
11334         echo " "
11335         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11336         $cat >try.c <<EOCP
11337 #$i_memory I_MEMORY
11338 #$i_stdlib I_STDLIB
11339 #$i_string I_STRING
11340 #$i_unistd I_UNISTD
11341 EOCP
11342         $cat >>try.c <<'EOCP'
11343 #include <stdio.h>
11344 #ifdef I_MEMORY
11345 #  include <memory.h>
11346 #endif
11347 #ifdef I_STDLIB
11348 #  include <stdlib.h>
11349 #endif
11350 #ifdef I_STRING
11351 #  include <string.h>
11352 #else
11353 #  include <strings.h>
11354 #endif
11355 #ifdef I_UNISTD
11356 #  include <unistd.h>  /* Needed for NetBSD */
11357 #endif
11358 int main()
11359 {
11360 char a = -1;
11361 char b = 0;
11362 if ((a < b) && memcmp(&a, &b, 1) < 0)
11363         exit(1);
11364 exit(0);
11365 }
11366 EOCP
11367         set try
11368         if eval $compile_ok; then
11369                 if ./try 2>/dev/null; then
11370                         echo "Yes, it can."
11371                         val="$define"
11372                 else
11373                         echo "No, it can't (it uses signed chars)."
11374                 fi
11375         else
11376                 echo "(I can't compile the test program, so we'll assume not...)"
11377         fi
11378         ;;
11379 esac
11380 $rm -f try.* try core
11381 set d_sanemcmp
11382 eval $setvar
11383
11384 : see if prototype for sbrk is available
11385 echo " "
11386 set d_sbrkproto sbrk $i_unistd unistd.h
11387 eval $hasproto
11388
11389 : see if select exists
11390 set select d_select
11391 eval $inlibc
11392
11393 : see if semctl exists
11394 set semctl d_semctl
11395 eval $inlibc
11396
11397 : see if semget exists
11398 set semget d_semget
11399 eval $inlibc
11400
11401 : see if semop exists
11402 set semop d_semop
11403 eval $inlibc
11404
11405 : see how much of the 'sem*(2)' library is present.
11406 h_sem=true
11407 echo " "
11408 case "$d_semctl$d_semget$d_semop" in
11409 *"$undef"*) h_sem=false;;
11410 esac
11411 case "$osname" in
11412 freebsd)
11413     case "`ipcs 2>&1`" in
11414     "SVID messages"*"not configured"*)
11415         echo "Your $osname does not have the sem*(2) configured." >&4
11416         h_sem=false
11417         val="$undef"
11418         set semctl d_semctl
11419         eval $setvar
11420         set semget d_semget
11421         eval $setvar
11422         set semop d_semop
11423         eval $setvar
11424         ;;
11425     esac
11426     ;;
11427 esac
11428 : we could also check for sys/ipc.h ...
11429 if $h_sem && $test `./findhdr sys/sem.h`; then
11430         echo "You have the full sem*(2) library." >&4
11431         val="$define"
11432 else
11433         echo "You don't have the full sem*(2) library." >&4
11434         val="$undef"
11435 fi
11436 set d_sem
11437 eval $setvar
11438
11439 : see whether sys/sem.h defines union semun
11440 echo " "
11441 $cat > try.c <<'END'
11442 #include <sys/types.h>
11443 #include <sys/ipc.h>
11444 #include <sys/sem.h>
11445 int main () { union semun semun; semun.buf = 0; }
11446 END
11447 set try
11448 if eval $compile; then
11449     echo "You have union semun in <sys/sem.h>." >&4
11450     val="$define"
11451 else
11452     echo "You do not have union semun in <sys/sem.h>." >&4
11453     val="$undef"
11454 fi
11455 $rm -f try try.c try.h
11456 set d_union_semun
11457 eval $setvar
11458
11459 : see how to do semctl IPC_STAT
11460 case "$d_sem" in
11461 $define)
11462     : see whether semctl IPC_STAT can use union semun
11463     echo " "
11464     $cat > try.h <<END
11465 #ifndef S_IRUSR
11466 #   ifdef S_IREAD
11467 #       define S_IRUSR S_IREAD
11468 #       define S_IWUSR S_IWRITE
11469 #       define S_IXUSR S_IEXEC
11470 #   else
11471 #       define S_IRUSR 0400
11472 #       define S_IWUSR 0200
11473 #       define S_IXUSR 0100
11474 #   endif
11475 #   define S_IRGRP (S_IRUSR>>3)
11476 #   define S_IWGRP (S_IWUSR>>3)
11477 #   define S_IXGRP (S_IXUSR>>3)
11478 #   define S_IROTH (S_IRUSR>>6)
11479 #   define S_IWOTH (S_IWUSR>>6)
11480 #   define S_IXOTH (S_IXUSR>>6)
11481 #endif
11482 #ifndef S_IRWXU
11483 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11484 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11485 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11486 #endif
11487 END
11488
11489     $cat > try.c <<END
11490 #include <sys/types.h>
11491 #include <sys/ipc.h>
11492 #include <sys/sem.h>
11493 #include <sys/stat.h>
11494 #include <stdio.h>
11495 #include <errno.h>
11496 #include "try.h"
11497 #ifndef errno
11498 extern int errno;
11499 #endif
11500 #$d_union_semun HAS_UNION_SEMUN
11501 int main() {
11502     union semun
11503 #ifndef HAS_UNION_SEMUN
11504     {
11505         int val;
11506         struct semid_ds *buf;
11507         unsigned short *array;
11508     }
11509 #endif
11510     arg;
11511     int sem, st;
11512
11513 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11514     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11515     if (sem > -1) {
11516         struct semid_ds argbuf;
11517         arg.buf = &argbuf;
11518 #       ifdef IPC_STAT
11519         st = semctl(sem, 0, IPC_STAT, arg);
11520         if (st == 0)
11521             printf("semun\n");
11522         else
11523 #       endif /* IPC_STAT */
11524             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11525 #       ifdef IPC_RMID
11526         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11527 #       endif /* IPC_RMID */
11528             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11529     } else
11530 #endif /* IPC_PRIVATE && ... */
11531         printf("semget failed: errno = %d\n", errno);
11532   return 0;
11533 }
11534 END
11535     val="$undef"
11536     set try
11537     if eval $compile; then
11538         xxx=`./try`
11539         case "$xxx" in
11540         semun) val="$define" ;;
11541         esac
11542     fi
11543     $rm -f try try.c
11544     set d_semctl_semun
11545     eval $setvar
11546     case "$d_semctl_semun" in
11547     $define)
11548         echo "You can use union semun for semctl IPC_STAT." >&4
11549         also='also'
11550         ;;
11551     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11552         also=''
11553         ;;
11554     esac
11555
11556     : see whether semctl IPC_STAT can use struct semid_ds pointer
11557     $cat > try.c <<'END'
11558 #include <sys/types.h>
11559 #include <sys/ipc.h>
11560 #include <sys/sem.h>
11561 #include <sys/stat.h>
11562 #include "try.h"
11563 #include <stdio.h>
11564 #include <errno.h>
11565 #ifndef errno
11566 extern int errno;
11567 #endif
11568 int main() {
11569     struct semid_ds arg;
11570     int sem, st;
11571
11572 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11573     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11574     if (sem > -1) {
11575 #       ifdef IPC_STAT
11576         st = semctl(sem, 0, IPC_STAT, &arg);
11577         if (st == 0)
11578             printf("semid_ds\n");
11579         else
11580 #       endif /* IPC_STAT */
11581             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11582 #       ifdef IPC_RMID
11583         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11584 #       endif /* IPC_RMID */
11585             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11586     } else
11587 #endif /* IPC_PRIVATE && ... */
11588         printf("semget failed: errno = %d\n", errno);
11589
11590     return 0;
11591 }
11592 END
11593     val="$undef"
11594     set try
11595     if eval $compile; then
11596         xxx=`./try`
11597         case "$xxx" in
11598         semid_ds) val="$define" ;;
11599         esac
11600     fi
11601     $rm -f try try.c
11602     set d_semctl_semid_ds
11603     eval $setvar
11604     case "$d_semctl_semid_ds" in
11605     $define)
11606         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11607         ;;
11608     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11609         ;;
11610     esac
11611     $rm -f try.h
11612     ;;
11613 *)  val="$undef"
11614
11615     # We do not have the full sem*(2) library, so assume we can not
11616     # use either.
11617
11618     set d_semctl_semun
11619     eval $setvar
11620
11621     set d_semctl_semid_ds
11622     eval $setvar
11623     ;;
11624 esac
11625
11626 : see if sendmsg exists
11627 set sendmsg d_sendmsg
11628 eval $inlibc
11629
11630 : see if setegid exists
11631 set setegid d_setegid
11632 eval $inlibc
11633
11634 : see if seteuid exists
11635 set seteuid d_seteuid
11636 eval $inlibc
11637
11638 : see if setgrent exists
11639 set setgrent d_setgrent
11640 eval $inlibc
11641
11642 : see if sethostent exists
11643 set sethostent d_sethent
11644 eval $inlibc
11645
11646 : see if setitimer exists
11647 set setitimer d_setitimer
11648 eval $inlibc
11649
11650 : see if setlinebuf exists
11651 set setlinebuf d_setlinebuf
11652 eval $inlibc
11653
11654 : see if setlocale exists
11655 set setlocale d_setlocale
11656 eval $inlibc
11657
11658 : see if setnetent exists
11659 set setnetent d_setnent
11660 eval $inlibc
11661
11662 : see if setprotoent exists
11663 set setprotoent d_setpent
11664 eval $inlibc
11665
11666 : see if setpgid exists
11667 set setpgid d_setpgid
11668 eval $inlibc
11669
11670 : see if setpgrp2 exists
11671 set setpgrp2 d_setpgrp2
11672 eval $inlibc
11673
11674 : see if setpriority exists
11675 set setpriority d_setprior
11676 eval $inlibc
11677
11678 : see if setproctitle exists
11679 set setproctitle d_setproctitle
11680 eval $inlibc
11681
11682 : see if setpwent exists
11683 set setpwent d_setpwent
11684 eval $inlibc
11685
11686 : see if setregid exists
11687 set setregid d_setregid
11688 eval $inlibc
11689 set setresgid d_setresgid
11690 eval $inlibc
11691
11692 : see if setreuid exists
11693 set setreuid d_setreuid
11694 eval $inlibc
11695 set setresuid d_setresuid
11696 eval $inlibc
11697
11698 : see if setrgid exists
11699 set setrgid d_setrgid
11700 eval $inlibc
11701
11702 : see if setruid exists
11703 set setruid d_setruid
11704 eval $inlibc
11705
11706 : see if setservent exists
11707 set setservent d_setsent
11708 eval $inlibc
11709
11710 : see if setsid exists
11711 set setsid d_setsid
11712 eval $inlibc
11713
11714 : see if setvbuf exists
11715 set setvbuf d_setvbuf
11716 eval $inlibc
11717
11718 : see if sfio.h is available
11719 set sfio.h i_sfio
11720 eval $inhdr
11721
11722
11723 : see if sfio library is available
11724 case "$i_sfio" in
11725 $define)
11726         val=''
11727         set sfreserve val
11728         eval $inlibc
11729         ;;
11730 *)
11731         val="$undef"
11732         ;;
11733 esac
11734 : Ok, but do we want to use it.
11735 case "$val" in
11736 $define)
11737         case "$usesfio" in
11738         true|$define|[yY]*) dflt='y';;
11739         *) dflt='n';;
11740         esac
11741         echo "$package can use the sfio library, but it is experimental."
11742         case "$useperlio" in
11743         "$undef")
11744             echo "For sfio also the PerlIO abstraction layer is needed."
11745             echo "Earlier you said you wouldn't want that."
11746             ;;
11747         esac
11748         rp="You seem to have sfio available, do you want to try using it?"
11749         . ./myread
11750         case "$ans" in
11751         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11752                 useperlio="$define"
11753                 val="$define"
11754                 ;;
11755         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11756                 val="$undef"
11757                 ;;
11758         esac
11759         ;;
11760 *)      case "$usesfio" in
11761         true|$define|[yY]*)
11762                 echo "Sorry, cannot find sfio on this machine." >&4
11763                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11764                 val="$undef"
11765                 ;;
11766         esac
11767         ;;
11768 esac
11769 set d_sfio
11770 eval $setvar
11771 case "$d_sfio" in
11772 $define) usesfio='true';;
11773 *) usesfio='false';;
11774 esac
11775 case "$d_sfio" in
11776 $define) ;;
11777 *)      : Remove sfio from list of libraries to use
11778         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11779         shift
11780         libs="$*"
11781         echo "libs = $libs" >&4
11782 ;;
11783 esac
11784
11785
11786 : see if shmctl exists
11787 set shmctl d_shmctl
11788 eval $inlibc
11789
11790 : see if shmget exists
11791 set shmget d_shmget
11792 eval $inlibc
11793
11794 : see if shmat exists
11795 set shmat d_shmat
11796 eval $inlibc
11797 : see what shmat returns
11798 case "$d_shmat" in
11799 "$define")
11800         $cat >shmat.c <<'END'
11801 #include <sys/shm.h>
11802 void *shmat();
11803 END
11804         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11805                 shmattype='void *'
11806         else
11807                 shmattype='char *'
11808         fi
11809         echo "and it returns ($shmattype)." >&4
11810         : see if a prototype for shmat is available
11811         xxx=`./findhdr sys/shm.h`
11812         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11813         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11814                 val="$define"
11815         else
11816                 val="$undef"
11817         fi
11818         $rm -f shmat.[co]
11819         ;;
11820 *)
11821         val="$undef"
11822         ;;
11823 esac
11824 set d_shmatprototype
11825 eval $setvar
11826
11827 : see if shmdt exists
11828 set shmdt d_shmdt
11829 eval $inlibc
11830
11831 : see how much of the 'shm*(2)' library is present.
11832 h_shm=true
11833 echo " "
11834 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11835 *"$undef"*) h_shm=false;;
11836 esac
11837 case "$osname" in
11838 freebsd)
11839     case "`ipcs 2>&1`" in
11840     "SVID shared memory"*"not configured"*)
11841         echo "Your $osname does not have the shm*(2) configured." >&4
11842         h_shm=false
11843         val="$undef"
11844         set shmctl d_shmctl
11845         evat $setvar
11846         set shmget d_shmget
11847         evat $setvar
11848         set shmat d_shmat
11849         evat $setvar
11850         set shmdt d_shmdt
11851         evat $setvar
11852         ;;
11853     esac
11854     ;;
11855 esac
11856 : we could also check for sys/ipc.h ...
11857 if $h_shm && $test `./findhdr sys/shm.h`; then
11858         echo "You have the full shm*(2) library." >&4
11859         val="$define"
11860 else
11861         echo "You don't have the full shm*(2) library." >&4
11862         val="$undef"
11863 fi
11864 set d_shm
11865 eval $setvar
11866
11867 echo " "
11868 : see if we have sigaction
11869 if set sigaction val -f d_sigaction; eval $csym; $val; then
11870         echo 'sigaction() found.' >&4
11871         $cat > try.c <<'EOP'
11872 #include <stdio.h>
11873 #include <sys/types.h>
11874 #include <signal.h>
11875 int main()
11876 {
11877     struct sigaction act, oact;
11878     act.sa_flags = 0;
11879     oact.sa_handler = 0;
11880     /* so that act and oact are used */
11881     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11882 }
11883 EOP
11884         set try
11885         if eval $compile_ok; then
11886                 val="$define"
11887         else
11888                 echo "But you don't seem to have a useable struct sigaction." >&4
11889                 val="$undef"
11890         fi
11891 else
11892         echo 'sigaction NOT found.' >&4
11893         val="$undef"
11894 fi
11895 set d_sigaction; eval $setvar
11896 $rm -f try try$_o try.c
11897
11898 : see if sigprocmask exists
11899 set sigprocmask d_sigprocmask
11900 eval $inlibc
11901
11902 : see if sigsetjmp exists
11903 echo " "
11904 case "$d_sigsetjmp" in
11905 '')
11906         $cat >try.c <<'EOP'
11907 #include <setjmp.h>
11908 sigjmp_buf env;
11909 int set = 1;
11910 int main()
11911 {
11912         if (sigsetjmp(env,1))
11913                 exit(set);
11914         set = 0;
11915         siglongjmp(env, 1);
11916         exit(1);
11917 }
11918 EOP
11919         set try
11920         if eval $compile; then
11921                 if ./try >/dev/null 2>&1; then
11922                         echo "POSIX sigsetjmp found." >&4
11923                         val="$define"
11924                 else
11925                         $cat >&4 <<EOM
11926 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11927 I'll ignore them.
11928 EOM
11929                         val="$undef"
11930                 fi
11931         else
11932                 echo "sigsetjmp not found." >&4
11933                 val="$undef"
11934         fi
11935         ;;
11936 *) val="$d_sigsetjmp"
11937         case "$d_sigsetjmp" in
11938         $define) echo "POSIX sigsetjmp found." >&4;;
11939         $undef) echo "sigsetjmp not found." >&4;;
11940         esac
11941         ;;
11942 esac
11943 set d_sigsetjmp
11944 eval $setvar
11945 $rm -f try.c try
11946
11947 : see if sockatmark exists
11948 set sockatmark d_sockatmark
11949 eval $inlibc
11950
11951 : see if prototype for sockatmark is available
11952 echo " "
11953 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
11954 eval $hasproto
11955
11956 : see if socks5_init exists
11957 set socks5_init d_socks5_init
11958 eval $inlibc
11959
11960 : see if prototype for setresgid is available
11961 echo " "
11962 set d_sresgproto setresgid $i_unistd unistd.h
11963 eval $hasproto
11964
11965 : see if prototype for setresuid is available
11966 echo " "
11967 set d_sresuproto setresuid $i_unistd unistd.h
11968 eval $hasproto
11969
11970 : see if sys/stat.h is available
11971 set sys/stat.h i_sysstat
11972 eval $inhdr
11973
11974
11975 : see if stat knows about block sizes
11976 echo " "
11977 echo "Checking to see if your struct stat has st_blocks field..." >&4
11978 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11979 eval $hasfield
11980
11981
11982 : see if this is a sys/vfs.h system
11983 set sys/vfs.h i_sysvfs
11984 eval $inhdr
11985
11986
11987 : see if this is a sys/statfs.h system
11988 set sys/statfs.h i_sysstatfs
11989 eval $inhdr
11990
11991
11992 echo " "
11993 echo "Checking to see if your system supports struct statfs..." >&4
11994 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
11995 eval $hasstruct
11996 case "$d_statfs_s" in
11997 "$define")      echo "Yes, it does."   ;;
11998 *)              echo "No, it doesn't." ;;
11999 esac
12000
12001
12002
12003 : see if struct statfs knows about f_flags
12004 case "$d_statfs_s" in
12005 define) 
12006         echo " "
12007         echo "Checking to see if your struct statfs has f_flags field..." >&4
12008         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
12009         eval $hasfield
12010         ;;
12011 *)      val="$undef"
12012         set d_statfs_f_flags
12013         eval $setvar
12014         ;;
12015 esac
12016 case "$d_statfs_f_flags" in
12017 "$define")      echo "Yes, it does."   ;;
12018 *)              echo "No, it doesn't." ;;
12019 esac
12020
12021 : see if _ptr and _cnt from stdio act std
12022 echo " "
12023
12024 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12025         echo "(Looks like you have stdio.h from BSD.)"
12026         case "$stdio_ptr" in
12027         '') stdio_ptr='((fp)->_p)'
12028                 ptr_lval=$define
12029                 ;;
12030         *)      ptr_lval=$d_stdio_ptr_lval;;
12031         esac
12032         case "$stdio_cnt" in
12033         '') stdio_cnt='((fp)->_r)'
12034                 cnt_lval=$define
12035                 ;;
12036         *)      cnt_lval=$d_stdio_cnt_lval;;
12037         esac
12038         case "$stdio_base" in
12039         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12040         esac
12041         case "$stdio_bufsiz" in
12042         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12043         esac
12044 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12045         echo "(Looks like you have stdio.h from Linux.)"
12046         case "$stdio_ptr" in
12047         '') stdio_ptr='((fp)->_IO_read_ptr)'
12048                 ptr_lval=$define
12049                 ;;
12050         *)      ptr_lval=$d_stdio_ptr_lval;;
12051         esac
12052         case "$stdio_cnt" in
12053         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12054                 cnt_lval=$undef
12055                 ;;
12056         *)      cnt_lval=$d_stdio_cnt_lval;;
12057         esac
12058         case "$stdio_base" in
12059         '') stdio_base='((fp)->_IO_read_base)';;
12060         esac
12061         case "$stdio_bufsiz" in
12062         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12063         esac
12064 else
12065         case "$stdio_ptr" in
12066         '') stdio_ptr='((fp)->_ptr)'
12067                 ptr_lval=$define
12068                 ;;
12069         *)      ptr_lval=$d_stdio_ptr_lval;;
12070         esac
12071         case "$stdio_cnt" in
12072         '') stdio_cnt='((fp)->_cnt)'
12073                 cnt_lval=$define
12074                 ;;
12075         *)      cnt_lval=$d_stdio_cnt_lval;;
12076         esac
12077         case "$stdio_base" in
12078         '') stdio_base='((fp)->_base)';;
12079         esac
12080         case "$stdio_bufsiz" in
12081         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12082         esac
12083 fi
12084
12085 : test whether _ptr and _cnt really work
12086 echo "Checking how std your stdio is..." >&4
12087 $cat >try.c <<EOP
12088 #include <stdio.h>
12089 #define FILE_ptr(fp)    $stdio_ptr
12090 #define FILE_cnt(fp)    $stdio_cnt
12091 int main() {
12092         FILE *fp = fopen("try.c", "r");
12093         char c = getc(fp);
12094         if (
12095                 18 <= FILE_cnt(fp) &&
12096                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12097         )
12098                 exit(0);
12099         exit(1);
12100 }
12101 EOP
12102 val="$undef"
12103 set try
12104 if eval $compile; then
12105         if ./try; then
12106                 echo "Your stdio acts pretty std."
12107                 val="$define"
12108         else
12109                 echo "Your stdio isn't very std."
12110         fi
12111 else
12112         echo "Your stdio doesn't appear very std."
12113 fi
12114 $rm -f try.c try
12115 set d_stdstdio
12116 eval $setvar
12117
12118 : Can _ptr be used as an lvalue?
12119 case "$d_stdstdio$ptr_lval" in
12120 $define$define) val=$define ;;
12121 *) val=$undef ;;
12122 esac
12123 set d_stdio_ptr_lval
12124 eval $setvar
12125
12126 : Can _cnt be used as an lvalue?
12127 case "$d_stdstdio$cnt_lval" in
12128 $define$define) val=$define ;;
12129 *) val=$undef ;;
12130 esac
12131 set d_stdio_cnt_lval
12132 eval $setvar
12133
12134
12135 : test whether setting _ptr sets _cnt as a side effect
12136 d_stdio_ptr_lval_sets_cnt="$undef"
12137 d_stdio_ptr_lval_nochange_cnt="$undef"
12138 case "$d_stdio_ptr_lval$d_stdstdio" in
12139 $define$define)
12140         echo "Checking to see what happens if we set the stdio ptr..." >&4
12141 $cat >try.c <<EOP
12142 #include <stdio.h>
12143 /* Can we scream? */
12144 /* Eat dust sed :-) */
12145 /* In the buffer space, no one can hear you scream. */
12146 #define FILE_ptr(fp)    $stdio_ptr
12147 #define FILE_cnt(fp)    $stdio_cnt
12148 #include <sys/types.h>
12149 int main() {
12150         FILE *fp = fopen("try.c", "r");
12151         int c;
12152         char *ptr;
12153         size_t cnt;
12154         if (!fp) {
12155             puts("Fail even to read");
12156             exit(1);
12157         }
12158         c = getc(fp); /* Read away the first # */
12159         if (c == EOF) {
12160             puts("Fail even to read");
12161             exit(1);
12162         }
12163         if (!(
12164                 18 <= FILE_cnt(fp) &&
12165                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12166         )) {
12167                 puts("Fail even to read");
12168                 exit (1);
12169         }
12170         ptr = (char*) FILE_ptr(fp);
12171         cnt = (size_t)FILE_cnt(fp);
12172
12173         FILE_ptr(fp) += 42;
12174
12175         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12176                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12177                 exit (1);
12178         }
12179         if (FILE_cnt(fp) <= 20) {
12180                 printf ("Fail (<20 chars to test)");
12181                 exit (1);
12182         }
12183         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12184                 puts("Fail compare");
12185                 exit (1);
12186         }
12187         if (cnt == FILE_cnt(fp)) {
12188                 puts("Pass_unchanged");
12189                 exit (0);
12190         }       
12191         if (FILE_cnt(fp) == (cnt - 42)) {
12192                 puts("Pass_changed");
12193                 exit (0);
12194         }
12195         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12196         return 1;
12197
12198 }
12199 EOP
12200         set try
12201         if eval $compile; then
12202                 case `./try$exe_ext` in
12203                 Pass_changed)
12204                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12205                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12206                 Pass_unchanged)
12207                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12208                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12209                 Fail*)
12210                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12211                 *)
12212                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12213         esac
12214         else
12215                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12216         fi
12217         $rm -f try.c try
12218         ;;
12219 esac
12220
12221 : see if _base is also standard
12222 val="$undef"
12223 case "$d_stdstdio" in
12224 $define)
12225         $cat >try.c <<EOP
12226 #include <stdio.h>
12227 #define FILE_base(fp)   $stdio_base
12228 #define FILE_bufsiz(fp) $stdio_bufsiz
12229 int main() {
12230         FILE *fp = fopen("try.c", "r");
12231         char c = getc(fp);
12232         if (
12233                 19 <= FILE_bufsiz(fp) &&
12234                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12235         )
12236                 exit(0);
12237         exit(1);
12238 }
12239 EOP
12240         set try
12241         if eval $compile; then
12242                 if ./try; then
12243                         echo "And its _base field acts std."
12244                         val="$define"
12245                 else
12246                         echo "But its _base field isn't std."
12247                 fi
12248         else
12249                 echo "However, it seems to be lacking the _base field."
12250         fi
12251         $rm -f try.c try
12252         ;;
12253 esac
12254 set d_stdiobase
12255 eval $setvar
12256
12257 $cat >&4 <<EOM
12258 Checking how to access stdio streams by file descriptor number...
12259 EOM
12260 case "$stdio_stream_array" in
12261 '')     $cat >try.c <<EOCP
12262 #include <stdio.h>
12263 int main() {
12264   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12265     printf("yes\n");
12266 }
12267 EOCP
12268         for s in _iob __iob __sF
12269         do
12270                 set try -DSTDIO_STREAM_ARRAY=$s
12271                 if eval $compile; then
12272                         case "`./try$exe_ext`" in
12273                         yes)    stdio_stream_array=$s; break ;;
12274                         esac
12275                 fi
12276         done
12277         $rm -f try.* try$exe_ext
12278 esac
12279 case "$stdio_stream_array" in
12280 '')     $cat >&4 <<EOM
12281 I can't figure out how to access stdio streams by file descriptor number.
12282 EOM
12283         d_stdio_stream_array="$undef"
12284         ;;
12285 *)      $cat >&4 <<EOM
12286 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12287 EOM
12288         d_stdio_stream_array="$define"
12289         ;;
12290 esac
12291
12292 : see if strcoll exists
12293 set strcoll d_strcoll
12294 eval $inlibc
12295
12296 : check for structure copying
12297 echo " "
12298 echo "Checking to see if your C compiler can copy structs..." >&4
12299 $cat >try.c <<'EOCP'
12300 int main()
12301 {
12302         struct blurfl {
12303                 int dyick;
12304         } foo, bar;
12305
12306         foo = bar;
12307 }
12308 EOCP
12309 if $cc -c try.c >/dev/null 2>&1 ; then
12310         val="$define"
12311         echo "Yup, it can."
12312 else
12313         val="$undef"
12314         echo "Nope, it can't."
12315 fi
12316 set d_strctcpy
12317 eval $setvar
12318 $rm -f try.*
12319
12320 : see if strerror and/or sys_errlist[] exist
12321 echo " "
12322 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12323     if set strerror val -f d_strerror; eval $csym; $val; then
12324                 echo 'strerror() found.' >&4
12325                 d_strerror="$define"
12326                 d_strerrm='strerror(e)'
12327                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12328                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12329                         d_syserrlst="$define"
12330                 else
12331                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12332                         d_syserrlst="$undef"
12333                 fi
12334     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12335                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12336                 echo 'strerror() found in string header.' >&4
12337                 d_strerror="$define"
12338                 d_strerrm='strerror(e)'
12339                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12340                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12341                                 d_syserrlst="$define"
12342                 else
12343                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12344                         d_syserrlst="$undef"
12345                 fi
12346     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12347                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12348                 d_strerror="$undef"
12349                 d_syserrlst="$define"
12350                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12351     else
12352                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12353                 d_strerror="$undef"
12354                 d_syserrlst="$undef"
12355                 d_strerrm='"unknown"'
12356     fi
12357 fi
12358
12359 : see if strftime exists
12360 set strftime d_strftime
12361 eval $inlibc
12362
12363 : see if strtod exists
12364 set strtod d_strtod
12365 eval $inlibc
12366
12367 : see if strtol exists
12368 set strtol d_strtol
12369 eval $inlibc
12370
12371 : see if strtold exists
12372 set strtold d_strtold
12373 eval $inlibc
12374
12375 : see if strtoll exists
12376 set strtoll d_strtoll
12377 eval $inlibc
12378
12379 case "$d_longlong-$d_strtoll" in
12380 "$define-$define")
12381         $cat <<EOM
12382 Checking whether your strtoll() works okay...
12383 EOM
12384         $cat >try.c <<'EOCP'
12385 #include <errno.h>
12386 #ifdef __hpux
12387 #define strtoll __strtoll
12388 #endif
12389 #ifdef __EMX__
12390 #define strtoll _strtoll
12391 #endif
12392 #include <stdio.h>
12393 extern long long int strtoll(char *s, char **, int); 
12394 static int bad = 0;
12395 int check(char *s, long long ell, int een) {
12396         long long gll;
12397         errno = 0;
12398         gll = strtoll(s, 0, 10);
12399         if (!((gll == ell) && (errno == een)))
12400                 bad++;
12401 }
12402 int main() {
12403         check(" 1",                                      1LL, 0);
12404         check(" 0",                                      0LL, 0);
12405         check("-1",                                     -1LL, 0);
12406         check("-9223372036854775808", -9223372036854775808LL, 0);
12407         check("-9223372036854775808", -9223372036854775808LL, 0);
12408         check(" 9223372036854775807",  9223372036854775807LL, 0);
12409         check("-9223372036854775808", -9223372036854775808LL, 0);
12410         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12411         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12412         if (!bad)
12413                 printf("ok\n");
12414 }
12415 EOCP
12416         set try
12417         if eval $compile; then
12418                 yyy=`./try`
12419                 case "$yyy" in
12420                 ok) echo "Your strtoll() seems to be working okay." ;;
12421                 *) cat <<EOM >&4
12422 Your strtoll() doesn't seem to be working okay.
12423 EOM
12424                    d_strtoll="$undef"
12425                    ;;
12426                 esac
12427         else
12428                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12429                 d_strtoll="$undef"
12430         fi
12431         ;;
12432 esac
12433
12434 : see if strtoq exists
12435 set strtoq d_strtoq
12436 eval $inlibc
12437
12438 : see if strtoul exists
12439 set strtoul d_strtoul
12440 eval $inlibc
12441
12442 case "$d_strtoul" in
12443 "$define")
12444         $cat <<EOM
12445 Checking whether your strtoul() works okay...
12446 EOM
12447         $cat >try.c <<'EOCP'
12448 #include <errno.h>
12449 #include <stdio.h>
12450 extern unsigned long int strtoul(char *s, char **, int); 
12451 static int bad = 0;
12452 void check(char *s, unsigned long eul, int een) {
12453         unsigned long gul;
12454         errno = 0;
12455         gul = strtoul(s, 0, 10);
12456         if (!((gul == eul) && (errno == een)))
12457                 bad++;
12458 }
12459 int main() {
12460         check(" 1", 1L, 0);
12461         check(" 0", 0L, 0);
12462 EOCP
12463         case "$longsize" in
12464         8)
12465             $cat >>try.c <<'EOCP'
12466         check("18446744073709551615", 18446744073709551615UL, 0);
12467         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12468 #if 0 /* strtoul() for /^-/ strings is undefined. */
12469         check("-1", 18446744073709551615UL, 0);
12470         check("-18446744073709551614", 2, 0);
12471         check("-18446744073709551615", 1, 0);
12472         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12473         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12474 #endif
12475 EOCP
12476                 ;;
12477         4)
12478                     $cat >>try.c <<'EOCP'
12479         check("4294967295", 4294967295UL, 0);
12480         check("4294967296", 4294967295UL, ERANGE);
12481 #if 0 /* strtoul() for /^-/ strings is undefined. */
12482         check("-1", 4294967295UL, 0);
12483         check("-4294967294", 2, 0);
12484         check("-4294967295", 1, 0);
12485         check("-4294967296", 4294967295UL, ERANGE);
12486         check("-4294967297", 4294967295UL, ERANGE);
12487 #endif
12488 EOCP
12489                 ;;
12490         *)
12491 : Should we write these tests to be more portable by sprintf-ing
12492 : ~0 and then manipulating that char string as input for strtol?
12493                 ;;
12494         esac
12495         $cat >>try.c <<'EOCP'
12496         if (!bad)
12497                 printf("ok\n");
12498         return 0;
12499 }
12500 EOCP
12501         set try
12502         if eval $compile; then
12503                 case "`./try`" in
12504                 ok) echo "Your strtoul() seems to be working okay." ;;
12505                 *) cat <<EOM >&4
12506 Your strtoul() doesn't seem to be working okay.
12507 EOM
12508                    d_strtoul="$undef"
12509                    ;;
12510                 esac
12511         fi
12512         ;;
12513 esac
12514
12515 : see if strtoull exists
12516 set strtoull d_strtoull
12517 eval $inlibc
12518
12519 case "$d_longlong-$d_strtoull" in
12520 "$define-$define")
12521         $cat <<EOM
12522 Checking whether your strtoull() works okay...
12523 EOM
12524         $cat >try.c <<'EOCP'
12525 #include <errno.h>
12526 #ifdef __hpux
12527 #define strtoull __strtoull
12528 #endif
12529 #include <stdio.h>
12530 extern unsigned long long int strtoull(char *s, char **, int); 
12531 static int bad = 0;
12532 int check(char *s, long long eull, int een) {
12533         long long gull;
12534         errno = 0;
12535         gull = strtoull(s, 0, 10);
12536         if (!((gull == eull) && (errno == een)))
12537                 bad++;
12538 }
12539 int main() {
12540         check(" 1",                                        1LL, 0);
12541         check(" 0",                                        0LL, 0);
12542         check("18446744073709551615",  18446744073709551615ULL, 0);
12543         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12544 #if 0 /* strtoull() for /^-/ strings is undefined. */
12545         check("-1",                    18446744073709551615ULL, 0);
12546         check("-18446744073709551614",                     2LL, 0);
12547         check("-18446744073709551615",                     1LL, 0);
12548         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12549         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12550 #endif
12551         if (!bad)
12552                 printf("ok\n");
12553 }
12554 EOCP
12555         set try
12556         if eval $compile; then
12557                 case "`./try`" in
12558                 ok) echo "Your strtoull() seems to be working okay." ;;
12559                 *) cat <<EOM >&4
12560 Your strtoull() doesn't seem to be working okay.
12561 EOM
12562                    d_strtoull="$undef"
12563                    ;;
12564                 esac
12565         fi
12566         ;;
12567 esac
12568
12569 : see if strtouq exists
12570 set strtouq d_strtouq
12571 eval $inlibc
12572
12573 case "$d_strtouq" in
12574 "$define")
12575         $cat <<EOM
12576 Checking whether your strtouq() works okay...
12577 EOM
12578         $cat >try.c <<'EOCP'
12579 #include <errno.h>
12580 #include <stdio.h>
12581 extern unsigned long long int strtouq(char *s, char **, int); 
12582 static int bad = 0;
12583 void check(char *s, unsigned long long eull, int een) {
12584         unsigned long long gull;
12585         errno = 0;
12586         gull = strtouq(s, 0, 10);
12587         if (!((gull == eull) && (errno == een)))
12588                 bad++;
12589 }
12590 int main() {
12591         check(" 1",                                        1LL, 0);
12592         check(" 0",                                        0LL, 0);
12593         check("18446744073709551615",  18446744073709551615ULL, 0);
12594         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12595 #if 0 /* strtouq() for /^-/ strings is undefined. */
12596         check("-1",                    18446744073709551615ULL, 0);
12597         check("-18446744073709551614",                     2LL, 0);
12598         check("-18446744073709551615",                     1LL, 0);
12599         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12600         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12601 #endif
12602         if (!bad)
12603                 printf("ok\n");
12604         return 0;
12605 }
12606 EOCP
12607         set try
12608         if eval $compile; then
12609                 case "`./try`" in
12610                 ok) echo "Your strtouq() seems to be working okay." ;;
12611                 *) cat <<EOM >&4
12612 Your strtouq() doesn't seem to be working okay.
12613 EOM
12614                    d_strtouq="$undef"
12615                    ;;
12616                 esac
12617         fi
12618         ;;
12619 esac
12620
12621 : see if strxfrm exists
12622 set strxfrm d_strxfrm
12623 eval $inlibc
12624
12625 : see if symlink exists
12626 set symlink d_symlink
12627 eval $inlibc
12628
12629 : see if syscall exists
12630 set syscall d_syscall
12631 eval $inlibc
12632
12633 : see if prototype for syscall is available
12634 echo " "
12635 set d_syscallproto syscall $i_unistd unistd.h
12636 eval $hasproto
12637
12638 : see if sysconf exists
12639 set sysconf d_sysconf
12640 eval $inlibc
12641
12642 : see if system exists
12643 set system d_system
12644 eval $inlibc
12645
12646 : see if tcgetpgrp exists
12647 set tcgetpgrp d_tcgetpgrp
12648 eval $inlibc
12649
12650 : see if tcsetpgrp exists
12651 set tcsetpgrp d_tcsetpgrp
12652 eval $inlibc
12653
12654 : see if prototype for telldir is available
12655 echo " "
12656 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12657 eval $hasproto
12658
12659 : see if this is a sys/times.h system
12660 set sys/times.h i_systimes
12661 eval $inhdr
12662
12663 : see if times exists
12664 echo " "
12665 if set times val -f d_times; eval $csym; $val; then
12666         echo 'times() found.' >&4
12667         d_times="$define"
12668         inc=''
12669         case "$i_systimes" in
12670         "$define") inc='sys/times.h';;
12671         esac
12672         rp="What is the type returned by times() on this system?"
12673         set clock_t clocktype long stdio.h sys/types.h $inc
12674         eval $typedef_ask
12675 else
12676         echo 'times() NOT found, hope that will do.' >&4
12677         d_times="$undef"
12678         clocktype='int'
12679 fi
12680
12681 : see if truncate exists
12682 set truncate d_truncate
12683 eval $inlibc
12684
12685 : see if tzname[] exists
12686 echo " "
12687 if set tzname val -a d_tzname; eval $csym; $val; then
12688         val="$define"
12689         echo 'tzname[] found.' >&4
12690 else
12691         val="$undef"
12692         echo 'tzname[] NOT found.' >&4
12693 fi
12694 set d_tzname
12695 eval $setvar
12696
12697 case "$crosscompile" in
12698 ''|[nN]*) crosscompile="$undef" ;;
12699 esac
12700
12701 case "$osname" in
12702 next|rhapsody|darwin) multiarch="$define" ;;
12703 esac
12704 case "$multiarch" in
12705 ''|[nN]*) multiarch="$undef" ;;
12706 esac
12707
12708 : check for ordering of bytes in a long
12709 echo " "
12710 case "$crosscompile$multiarch" in
12711 *$define*)
12712         $cat <<EOM
12713 You seem to be either cross-compiling or doing a multiarchitecture build,
12714 skipping the byteorder check.
12715
12716 EOM
12717         byteorder='0xffff'
12718         ;;
12719 *)
12720         case "$byteorder" in
12721         '')
12722                 $cat <<'EOM'
12723 In the following, larger digits indicate more significance.  A big-endian
12724 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12725 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12726 machines may have weird orders like 3412.  A Cray will report 87654321,
12727 an Alpha will report 12345678. If the test program works the default is
12728 probably right.
12729 I'm now running the test program...
12730 EOM
12731                 $cat >try.c <<'EOCP'
12732 #include <stdio.h>
12733 int main()
12734 {
12735         int i;
12736         union {
12737                 unsigned long l;
12738                 char c[sizeof(long)];
12739         } u;
12740
12741         if (sizeof(long) > 4)
12742                 u.l = (0x08070605L << 32) | 0x04030201L;
12743         else
12744                 u.l = 0x04030201L;
12745         for (i = 0; i < sizeof(long); i++)
12746                 printf("%c", u.c[i]+'0');
12747         printf("\n");
12748         exit(0);
12749 }
12750 EOCP
12751                 xxx_prompt=y
12752                 set try
12753                 if eval $compile && ./try > /dev/null; then
12754                         dflt=`./try`
12755                         case "$dflt" in
12756                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12757                                 echo "(The test program ran ok.)"
12758                                 echo "byteorder=$dflt"
12759                                 xxx_prompt=n
12760                         ;;
12761                         ????|????????) echo "(The test program ran ok.)" ;;
12762                         *) echo "(The test program didn't run right for some reason.)" ;;
12763                         esac
12764                 else
12765                         dflt='4321'
12766                         cat <<'EOM'
12767 (I can't seem to compile the test program.  Guessing big-endian...)
12768 EOM
12769                 fi
12770                 case "$xxx_prompt" in
12771                 y)
12772                         rp="What is the order of bytes in a long?"
12773                         . ./myread
12774                         byteorder="$ans"
12775                         ;;
12776                 *)      byteorder=$dflt
12777                         ;;
12778                 esac
12779                 ;;
12780         esac
12781         $rm -f try.c try
12782         ;;
12783 esac
12784
12785
12786 $cat <<EOM
12787
12788 Checking to see whether you can access character data unalignedly...
12789 EOM
12790 $cat >try.c <<EOCP
12791 #include <stdio.h>
12792 #define U32 $u32type
12793 #define BYTEORDER $byteorder
12794 int main() {
12795 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12796     U8 buf[] = "\0\0\0\1\0\0\0\0";
12797     U32 *up;
12798     int i;
12799
12800     if (sizeof(U32) != 4) {
12801         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12802         exit(1);
12803     }
12804
12805     fflush(stdout);
12806
12807     for (i = 0; i < 4; i++) {
12808         up = (U32*)(buf + i);
12809         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12810                (*up == 1 << (8*(3-i)))  /* little-endian */
12811               )
12812            )
12813         {
12814             printf("read failed (%x)\n", *up);
12815             exit(2);
12816         }
12817     }
12818
12819     /* write test */
12820     for (i = 0; i < 4; i++) {
12821         up = (U32*)(buf + i);
12822         *up = 0xBeef;
12823         if (*up != 0xBeef) {
12824             printf("write failed (%x)\n", *up);
12825             exit(3);
12826         }
12827     }
12828
12829     exit(0);
12830 #else
12831     printf("1\n");
12832     exit(1);
12833 #endif
12834     return 0;
12835 }
12836 EOCP
12837 set try
12838 if eval $compile_ok; then
12839         echo "(This test may dump core.)" >&4
12840         ./try >&2 >/dev/null
12841         case "$?" in
12842         0)      cat >&4 <<EOM
12843 You can access character data pretty unalignedly.
12844 EOM
12845                 d_u32align="$undef"
12846                 ;;
12847         *)      cat >&4 <<EOM
12848 It seems that you must access character data in an aligned manner.
12849 EOM
12850                 d_u32align="$define"
12851                 ;;
12852         esac
12853         $rm -f core core.try.* try.core
12854 else
12855         rp='Can you access character data at unaligned addresses?'
12856         dflt='n'
12857         . ./myread
12858         case "$ans" in
12859         [yY]*)  d_u32align="$undef"  ;;
12860         *)      d_u32align="$define" ;;
12861         esac
12862 fi
12863
12864 : see if ualarm exists
12865 set ualarm d_ualarm
12866 eval $inlibc
12867
12868 : see if umask exists
12869 set umask d_umask
12870 eval $inlibc
12871
12872 : see if usleep exists
12873 set usleep d_usleep
12874 eval $inlibc
12875
12876 : see if prototype for usleep is available
12877 echo " "
12878 set d_usleepproto usleep $i_unistd unistd.h
12879 eval $hasproto
12880
12881 : see if ustat exists
12882 set ustat d_ustat
12883 eval $inlibc
12884
12885 : backward compatibility for d_hvfork
12886 if test X$d_hvfork != X; then
12887         d_vfork="$d_hvfork"
12888         d_hvfork=''
12889 fi
12890 : see if there is a vfork
12891 val=''
12892 set vfork val
12893 eval $inlibc
12894
12895 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12896 : perl on Solaris 2.x, and probably elsewhere.
12897 case "$val" in
12898 $define)
12899         echo " "
12900         case "$usevfork" in
12901         false) dflt='n';;
12902         *) dflt='y';;
12903         esac
12904         cat <<'EOM'
12905  
12906 Perl can only use a vfork() that doesn't suffer from strict
12907 restrictions on calling functions or modifying global data in
12908 the child.  For example, glibc-2.1 contains such a vfork()
12909 that is unsuitable.  If your system provides a proper fork()
12910 call, chances are that you do NOT want perl to use vfork().
12911
12912 EOM
12913         rp="Do you still want to use vfork()?"
12914         . ./myread
12915         case "$ans" in
12916         y|Y) ;;
12917         *)
12918                 echo "Ok, we won't use vfork()."
12919                 val="$undef"
12920                 ;;
12921         esac
12922         ;;
12923 esac
12924 set d_vfork
12925 eval $setvar
12926 case "$d_vfork" in
12927 $define) usevfork='true';;
12928 *) usevfork='false';;
12929 esac
12930
12931 : see if this is an sysdir system
12932 set sys/dir.h i_sysdir
12933 eval $inhdr
12934
12935 : see if this is an sysndir system
12936 set sys/ndir.h i_sysndir
12937 eval $inhdr
12938
12939 : see if closedir exists
12940 set closedir d_closedir
12941 eval $inlibc
12942
12943 case "$d_closedir" in
12944 "$define")
12945         echo " "
12946         echo "Checking whether closedir() returns a status..." >&4
12947         cat > closedir.c <<EOM
12948 #$i_dirent I_DIRENT             /**/
12949 #$i_sysdir I_SYS_DIR            /**/
12950 #$i_sysndir I_SYS_NDIR          /**/
12951 #$i_systypes I_SYS_TYPES        /**/
12952
12953 #if defined(I_SYS_TYPES)
12954 #include <sys/types.h>
12955 #endif
12956 #if defined(I_DIRENT)
12957 #include <dirent.h>
12958 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12959 #include <sys/dir.h>
12960 #endif
12961 #else
12962 #ifdef I_SYS_NDIR
12963 #include <sys/ndir.h>
12964 #else
12965 #ifdef I_SYS_DIR
12966 #ifdef hp9000s500
12967 #include <ndir.h>       /* may be wrong in the future */
12968 #else
12969 #include <sys/dir.h>
12970 #endif
12971 #endif
12972 #endif
12973 #endif 
12974 int main() { return closedir(opendir(".")); }
12975 EOM
12976         set closedir
12977         if eval $compile_ok; then
12978                 if ./closedir > /dev/null 2>&1 ; then
12979                         echo "Yes, it does."
12980                         val="$undef"
12981                 else
12982                         echo "No, it doesn't."
12983                         val="$define"
12984                 fi
12985         else
12986                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12987                 val="$define"
12988         fi
12989         ;;
12990 *)
12991         val="$undef";
12992         ;;
12993 esac
12994 set d_void_closedir
12995 eval $setvar
12996 $rm -f closedir*
12997 : see if there is a wait4
12998 set wait4 d_wait4
12999 eval $inlibc
13000
13001 : see if waitpid exists
13002 set waitpid d_waitpid
13003 eval $inlibc
13004
13005 : see if wcstombs exists
13006 set wcstombs d_wcstombs
13007 eval $inlibc
13008
13009 : see if wctomb exists
13010 set wctomb d_wctomb
13011 eval $inlibc
13012
13013 : see if writev exists
13014 set writev d_writev
13015 eval $inlibc
13016
13017 : preserve RCS keywords in files with variable substitution, grrr
13018 Date='$Date'
13019 Id='$Id'
13020 Log='$Log'
13021 RCSfile='$RCSfile'
13022 Revision='$Revision'
13023
13024 : check for alignment requirements
13025 echo " "
13026 case "$crosscompile$multiarch" in
13027 *$define*)
13028         $cat <<EOM
13029 You seem to be either cross-compiling or doing a multiarchitecture build,
13030 skipping the memory alignment check.
13031
13032 EOM
13033         case "$alignbytes" in
13034         '') alignbytes=8 ;;
13035         esac
13036         ;;
13037 *)
13038         case "$alignbytes" in
13039         '') echo "Checking alignment constraints..." >&4
13040                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13041                         $cat >try.c <<'EOCP'
13042 typedef long double NV;
13043 EOCP
13044                 else
13045                         $cat >try.c <<'EOCP'
13046 typedef double NV;
13047 EOCP
13048                 fi
13049                 $cat >>try.c <<'EOCP'
13050 #include <stdio.h>
13051 struct foobar {
13052         char foo;
13053         NV bar;
13054 } try_algn;
13055 int main()
13056 {
13057     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13058     return(0);
13059 }
13060 EOCP
13061                 set try
13062                 if eval $compile_ok; then
13063                         dflt=`./try`
13064                 else
13065                         dflt='8'
13066                         echo "(I can't seem to compile the test program...)"
13067                 fi
13068                 ;;
13069         *) dflt="$alignbytes"
13070                 ;;
13071         esac
13072         rp="Doubles must be aligned on a how-many-byte boundary?"
13073         . ./myread
13074         alignbytes="$ans"
13075         $rm -f try.c try
13076         ;;
13077 esac
13078
13079
13080 : set the base revision
13081 baserev=5.0
13082
13083 : how do we catenate cpp tokens here?
13084 echo " "
13085 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13086 $cat >cpp_stuff.c <<'EOCP'
13087 #define RCAT(a,b)a/**/b
13088 #define ACAT(a,b)a ## b
13089 RCAT(Rei,ser)
13090 ACAT(Cir,cus)
13091 EOCP
13092 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13093 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13094         echo "Oh!  Smells like ANSI's been here." >&4
13095         echo "We can catify or stringify, separately or together!"
13096         cpp_stuff=42
13097 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13098         echo "Ah, yes!  The good old days!" >&4
13099         echo "However, in the good old days we don't know how to stringify and"
13100         echo "catify at the same time."
13101         cpp_stuff=1
13102 else
13103         $cat >&4 <<EOM
13104 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13105 to have to edit the values of CAT[2-5] in config.h...
13106 EOM
13107         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13108 fi
13109 $rm -f cpp_stuff.*
13110
13111 : see if this is a db.h system
13112 set db.h i_db
13113 eval $inhdr
13114
13115 case "$i_db" in
13116 $define)
13117         : Check db version.
13118         echo " "
13119         echo "Checking Berkeley DB version ..." >&4
13120         $cat >try.c <<EOCP
13121 #$d_const HASCONST
13122 #ifndef HASCONST
13123 #define const
13124 #endif
13125 #include <sys/types.h>
13126 #include <stdio.h>
13127 #include <db.h>
13128 int main(int argc, char *argv[])
13129 {
13130 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13131     int Major, Minor, Patch ;
13132     unsigned long Version ;
13133     (void)db_version(&Major, &Minor, &Patch) ;
13134     if (argc == 2) {
13135         printf("%d %d %d %d %d %d\n",
13136                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13137                Major, Minor, Patch);
13138         exit(0);
13139     }
13140     printf("You have Berkeley DB Version 2 or greater.\n");
13141
13142     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13143                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13144     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13145                 Major, Minor, Patch) ;
13146
13147     /* check that db.h & libdb are compatible */
13148     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13149         printf("db.h and libdb are incompatible.\n") ;
13150         exit(3);        
13151     }
13152
13153     printf("db.h and libdb are compatible.\n") ;
13154
13155     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13156                 + DB_VERSION_PATCH ;
13157
13158     /* needs to be >= 2.3.4 */
13159     if (Version < 2003004) {
13160     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13161         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13162         exit(2);        
13163     }
13164
13165     exit(0);
13166 #else
13167 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13168     if (argc == 2) {
13169         printf("1 0 0\n");
13170         exit(0);
13171     }
13172     printf("You have Berkeley DB Version 1.\n");
13173     exit(0);    /* DB version < 2: the coast is clear. */
13174 #else
13175     exit(1);    /* <db.h> not Berkeley DB? */
13176 #endif
13177 #endif
13178 }
13179 EOCP
13180         set try
13181         if eval $compile_ok && ./try; then
13182                 echo 'Looks OK.' >&4
13183                 set `./try 1`
13184                 db_version_major=$1
13185                 db_version_minor=$2
13186                 db_version_patch=$3
13187         else
13188                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13189                 i_db=$undef
13190                 case " $libs " in
13191                 *"-ldb "*)
13192                         : Remove db from list of libraries to use
13193                         echo "Removing unusable -ldb from library list" >&4
13194                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13195                         shift
13196                         libs="$*"
13197                         echo "libs = $libs" >&4
13198                         ;;
13199                 esac
13200         fi
13201         $rm -f try.*
13202         ;;
13203 esac
13204
13205 case "$i_db" in
13206 define)
13207         : Check the return type needed for hash 
13208         echo " "
13209         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13210         $cat >try.c <<EOCP
13211 #$d_const HASCONST
13212 #ifndef HASCONST
13213 #define const
13214 #endif
13215 #include <sys/types.h>
13216 #include <db.h>
13217
13218 #ifndef DB_VERSION_MAJOR
13219 u_int32_t hash_cb (ptr, size)
13220 const void *ptr;
13221 size_t size;
13222 {
13223 }
13224 HASHINFO info;
13225 int main()
13226 {
13227         info.hash = hash_cb;
13228 }
13229 #endif
13230 EOCP
13231         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13232                 if $contains warning try.out >>/dev/null 2>&1 ; then
13233                         db_hashtype='int'
13234                 else
13235                         db_hashtype='u_int32_t'
13236                 fi
13237         else
13238                 : XXX Maybe we should just give up here.
13239                 db_hashtype=u_int32_t
13240                 $cat try.out >&4
13241                 echo "Help:  I can't seem to compile the db test program." >&4
13242                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13243         fi
13244         $rm -f try.*
13245         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13246         ;;
13247 *)      db_hashtype=u_int32_t
13248         ;;
13249 esac
13250 case "$i_db" in
13251 define)
13252         : Check the return type needed for prefix 
13253         echo " "
13254         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13255         cat >try.c <<EOCP
13256 #$d_const HASCONST
13257 #ifndef HASCONST
13258 #define const
13259 #endif
13260 #include <sys/types.h>
13261 #include <db.h>
13262
13263 #ifndef DB_VERSION_MAJOR
13264 size_t prefix_cb (key1, key2)
13265 const DBT *key1;
13266 const DBT *key2;
13267 {
13268 }
13269 BTREEINFO info;
13270 int main()
13271 {
13272         info.prefix = prefix_cb;
13273 }
13274 #endif
13275 EOCP
13276         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13277                 if $contains warning try.out >>/dev/null 2>&1 ; then
13278                         db_prefixtype='int'
13279                 else
13280                         db_prefixtype='size_t'
13281                 fi
13282         else
13283                 db_prefixtype='size_t'
13284                 : XXX Maybe we should just give up here.
13285                 $cat try.out >&4
13286                 echo "Help:  I can't seem to compile the db test program." >&4
13287                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13288         fi
13289         $rm -f try.*
13290         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13291         ;;
13292 *)      db_prefixtype='size_t'
13293         ;;
13294 esac
13295
13296
13297 : How can we generate normalized random numbers ?
13298 echo " "
13299 echo "Looking for a random number function..." >&4
13300 case "$randfunc" in
13301 '')
13302         if set drand48 val -f; eval $csym; $val; then
13303                 dflt="drand48"
13304                 echo "Good, found drand48()." >&4
13305         elif set random val -f; eval $csym; $val; then
13306                 dflt="random"
13307                 echo "OK, found random()." >&4
13308         else
13309                 dflt="rand"
13310                 echo "Yick, looks like I have to use rand()." >&4
13311         fi
13312         echo " "
13313         ;;
13314 *)
13315         dflt="$randfunc"
13316         ;;
13317 esac
13318 cont=true
13319
13320 case "$ccflags" in
13321 *-Dmy_rand=*|*-Dmy_srand=*)
13322         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13323         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13324         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13325         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13326         ;;
13327 esac
13328
13329 while $test "$cont"; do
13330         rp="Use which function to generate random numbers?"
13331         . ./myread
13332         if $test "$ans" = "$dflt"; then
13333                 : null
13334         else
13335                 randbits=''
13336         fi
13337         randfunc="$ans"
13338         if set $ans val -f; eval $csym; $val; then
13339                 cont=''
13340         else
13341                 dflt=y
13342                 rp="I cannot find function $ans. Use that name anyway?"
13343                 . ./myread
13344                 dflt=rand
13345                 case "$ans" in
13346                         [yY]*) cont='';;
13347                 esac
13348         fi
13349         case "$cont" in
13350         '')
13351                 case "$randfunc" in
13352                 drand48)
13353                         drand01="drand48()"
13354                         seedfunc="srand48"
13355                         randbits=48
13356                         randseedtype=long
13357                         ;;
13358                 rand|random)
13359                         case "$randbits" in
13360                         '')
13361 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13362                                 $cat >try.c <<EOCP
13363 #$i_unistd I_UNISTD
13364 #$i_stdlib I_STDLIB
13365 #include <stdio.h>
13366 #ifdef I_UNISTD
13367 #  include <unistd.h>
13368 #endif
13369 #ifdef I_STDLIB
13370 #  include <stdlib.h>
13371 #endif
13372 int main()
13373 {
13374         register int i;
13375         register unsigned long tmp;
13376         register unsigned long max = 0L;
13377
13378         for (i = 1000; i; i--) {
13379                 tmp = (unsigned long) $randfunc();
13380                 if (tmp > max) max = tmp;
13381         }
13382         for (i = 0; max; i++)
13383                 max /= 2;
13384         printf("%d\n",i);
13385 }
13386 EOCP
13387                                 set try
13388                                 if eval $compile_ok; then
13389                                         dflt=`try`
13390                                 else
13391                                         dflt='?'
13392                                         echo "(I can't seem to compile the test program...)"
13393                                 fi
13394                                 ;;
13395                         *)
13396                                 dflt="$randbits"
13397                                 ;;
13398                         esac
13399                         rp="How many bits does your $randfunc() function produce?"
13400                         . ./myread
13401                         randbits="$ans"
13402                         $rm -f try.c try
13403                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13404                         seedfunc="s$randfunc"
13405                         randseedtype=unsigned
13406                         ;;
13407                 *)
13408                         dflt="31"
13409                         rp="How many bits does your $randfunc() function produce?"
13410                         . ./myread
13411                         randbits="$ans"
13412                         seedfunc="s$randfunc"
13413                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13414                         if set $seedfunc val -f; eval $csym; $val; then
13415                                 echo "(Using $seedfunc() to seed random generator)"
13416                         else
13417                                 echo "(Warning: no $seedfunc() to seed random generator)"
13418                                 seedfunc=rand
13419                         fi
13420                         randseedtype=unsigned
13421                         ;;
13422                 esac
13423                 ;;
13424         esac
13425 done
13426
13427 echo " "
13428 echo "Determining whether or not we are on an EBCDIC system..." >&4
13429 $cat >tebcdic.c <<'EOM'
13430 int main()
13431 {
13432   if ('M'==0xd4) return 0;
13433   return 1;
13434 }
13435 EOM
13436
13437 val=$undef
13438 set tebcdic
13439 if eval $compile_ok; then
13440         if ./tebcdic; then
13441                 echo "You seem to speak EBCDIC." >&4
13442                 val="$define"
13443         else
13444                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13445         fi
13446 else
13447         echo "I'm unable to compile the test program." >&4
13448         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13449 fi
13450 $rm -f tebcdic.c tebcdic
13451 set ebcdic
13452 eval $setvar
13453
13454 echo " "
13455 $cat >&4 <<EOM
13456 Checking how to flush all pending stdio output...
13457 EOM
13458 # I only know how to find the first 32 possibly open files on SunOS.
13459 # See also hints/sunos_4_1.sh and util.c  --AD
13460 case "$osname" in
13461 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13462 esac
13463 $cat >>try.c <<EOCP
13464 #include <stdio.h>
13465 #$i_unistd I_UNISTD
13466 #ifdef I_UNISTD
13467 # include <unistd.h>
13468 #endif
13469 #$d_sysconf HAS_SYSCONF
13470 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13471 #ifdef HAS_STDIO_STREAM_ARRAY
13472 # define STDIO_STREAM_ARRAY $stdio_stream_array
13473 #endif
13474 int main() {
13475   FILE* p = fopen("try.out", "w");
13476 #ifdef TRY_FPUTC
13477   fputc('x', p);
13478 #else
13479 # ifdef TRY_FPRINTF
13480   fprintf(p, "x");
13481 # endif
13482 #endif
13483 #ifdef TRY_FFLUSH_NULL
13484   fflush(NULL);
13485 #endif
13486 #ifdef TRY_FFLUSH_ALL
13487   {
13488     long open_max = -1;
13489 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13490     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13491 # else
13492 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13493     open_max = sysconf(_SC_OPEN_MAX);
13494 #  else
13495 #   ifdef FOPEN_MAX
13496     open_max = FOPEN_MAX;
13497 #   else
13498 #    ifdef OPEN_MAX
13499     open_max = OPEN_MAX;
13500 #    else
13501 #     ifdef _NFILE
13502     open_max = _NFILE;
13503 #     endif
13504 #    endif
13505 #   endif
13506 #  endif
13507 # endif 
13508 # ifdef HAS_STDIO_STREAM_ARRAY
13509     if (open_max > 0) {
13510       long i;
13511       for (i = 0; i < open_max; i++)
13512             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13513                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13514                 STDIO_STREAM_ARRAY[i]._flag)
13515                 fflush(&STDIO_STREAM_ARRAY[i]);
13516     }   
13517   }
13518 # endif
13519 #endif
13520   _exit(42);
13521 }
13522 EOCP
13523 : first we have to find out how _not_ to flush
13524 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13525     output=''
13526     set try -DTRY_FPUTC
13527     if eval $compile; then
13528             $rm -f try.out
13529             ./try$exe_ext 2>/dev/null
13530             if $test ! -s try.out -a "X$?" = X42; then
13531                 output=-DTRY_FPUTC
13532             fi
13533     fi
13534     case "$output" in
13535     '')
13536             set try -DTRY_FPRINTF
13537             $rm -f try.out
13538             if eval $compile; then
13539                     $rm -f try.out
13540                     ./try$exe_ext 2>/dev/null
13541                     if $test ! -s try.out -a "X$?" = X42; then
13542                         output=-DTRY_FPRINTF
13543                     fi
13544             fi
13545         ;;
13546     esac
13547 fi
13548 : check for fflush NULL behaviour
13549 case "$fflushNULL" in
13550 '')     set try -DTRY_FFLUSH_NULL $output
13551         if eval $compile; then
13552                 $rm -f try.out
13553                 ./try$exe_ext 2>/dev/null
13554                 code="$?"
13555                 if $test -s try.out -a "X$code" = X42; then
13556                         fflushNULL="`$cat try.out`"
13557                 else
13558                         if $test "X$code" != X42; then
13559                                 $cat >&4 <<EOM
13560 (If this test failed, don't worry, we'll try another method shortly.)
13561 EOM
13562                         fi
13563                 fi
13564         fi
13565         $rm -f core try.core core.try.*
13566         case "$fflushNULL" in
13567         x)      $cat >&4 <<EOM
13568 Your fflush(NULL) works okay for output streams.
13569 Let's see if it clobbers input pipes...
13570 EOM
13571 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13572 # bug that improperly flushes the input end of pipes.  So we avoid the
13573 # autoflush on fork/system/exec support for now. :-(
13574 $cat >tryp.c <<EOCP
13575 #include <stdio.h>
13576 int
13577 main(int argc, char **argv)
13578 {
13579     char buf[1024];
13580     int i;
13581     char *bp = buf;
13582     while (1) {
13583         while ((i = getc(stdin)) != -1
13584                && (*bp++ = i) != '\n'
13585                && bp < &buf[1024])
13586         /* DO NOTHING */ ;
13587         *bp = '\0';
13588         fprintf(stdout, "%s", buf);
13589         fflush(NULL);
13590         if (i == -1)
13591             return 0;
13592         bp = buf;
13593     }
13594 }
13595 EOCP
13596                 fflushNULL="$define"
13597                 set tryp
13598                 if eval $compile; then
13599                     $rm -f tryp.out
13600                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13601                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13602                        $cat >&4 <<EOM
13603 fflush(NULL) seems to behave okay with input streams.
13604 EOM
13605                         fflushNULL="$define"
13606                     else
13607                         $cat >&4 <<EOM
13608 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13609 EOM
13610                         fflushNULL="$undef"
13611                     fi
13612                 fi
13613                 $rm -f core tryp.c tryp.core core.tryp.*
13614                 ;;
13615         '')     $cat >&4 <<EOM
13616 Your fflush(NULL) isn't working (contrary to ANSI C).
13617 EOM
13618                 fflushNULL="$undef"
13619                 ;;
13620         *)      $cat >&4 <<EOM
13621 Cannot figure out whether your fflush(NULL) works or not.
13622 I'm assuming it doesn't (contrary to ANSI C).
13623 EOM
13624                 fflushNULL="$undef"
13625                 ;;
13626         esac
13627         ;;
13628 $define|true|[yY]*)
13629         fflushNULL="$define"
13630         ;;
13631 *)
13632         fflushNULL="$undef"
13633         ;;
13634 esac
13635 : check explicit looping only if NULL did not work, and if the pipe
13636 : bug does not show up on an explicit flush too
13637 case "$fflushNULL" in
13638 "$undef")
13639         $cat >tryp.c <<EOCP
13640 #include <stdio.h>
13641 int
13642 main(int argc, char **argv)
13643 {
13644     char buf[1024];
13645     int i;
13646     char *bp = buf;
13647     while (1) {
13648         while ((i = getc(stdin)) != -1
13649                && (*bp++ = i) != '\n'
13650                && bp < &buf[1024])
13651         /* DO NOTHING */ ;
13652         *bp = '\0';
13653         fprintf(stdout, "%s", buf);
13654         fflush(stdin);
13655         if (i == -1)
13656             return 0;
13657         bp = buf;
13658     }
13659 }
13660 EOCP
13661         set tryp
13662         if eval $compile; then
13663             $rm -f tryp.out
13664             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13665             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13666                $cat >&4 <<EOM
13667 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13668 EOM
13669                 : now check for fflushall behaviour
13670                 case "$fflushall" in
13671                 '')     set try -DTRY_FFLUSH_ALL $output
13672                         if eval $compile; then
13673                                 $cat >&4 <<EOM
13674 (Now testing the other method--but note that this also may fail.)
13675 EOM
13676                                 $rm -f try.out
13677                                 ./try$exe_ext 2>/dev/null
13678                                 if $test -s try.out -a "X$?" = X42; then
13679                                         fflushall="`$cat try.out`"
13680                                 fi
13681                         fi
13682                         $rm -f core try.core core.try.*
13683                         case "$fflushall" in
13684                         x)      $cat >&4 <<EOM
13685 Whew. Flushing explicitly all the stdio streams works.
13686 EOM
13687                                 fflushall="$define"
13688                                 ;;
13689                         '')     $cat >&4 <<EOM
13690 Sigh. Flushing explicitly all the stdio streams doesn't work.
13691 EOM
13692                                 fflushall="$undef"
13693                                 ;;
13694                         *)      $cat >&4 <<EOM
13695 Cannot figure out whether flushing stdio streams explicitly works or not.
13696 I'm assuming it doesn't.
13697 EOM
13698                                 fflushall="$undef"
13699                                 ;;
13700                         esac
13701                         ;;
13702                 "$define"|true|[yY]*)
13703                         fflushall="$define"
13704                         ;;
13705                 *)
13706                         fflushall="$undef"
13707                         ;;
13708                 esac
13709             else
13710                 $cat >&4 <<EOM
13711 All is futile.  Even fflush(stdin) clobbers input pipes!
13712 EOM
13713                 fflushall="$undef"
13714             fi
13715         else
13716             fflushall="$undef"
13717         fi
13718         $rm -f core tryp.c tryp.core core.tryp.*
13719         ;;
13720 *)      fflushall="$undef"
13721         ;;
13722 esac
13723
13724 case "$fflushNULL$fflushall" in
13725 undefundef)
13726         $cat <<EOM
13727 OK, I give up.  I cannot figure out how to flush pending stdio output.
13728 We won't be flushing handles at all before fork/exec/popen.
13729 EOM
13730         ;;
13731 esac
13732 $rm -f try.* try$exe_ext
13733
13734 : Store the full pathname to the ar program for use in the C program
13735 : Respect a hint or command line value for full_ar.
13736 case "$full_ar" in
13737 '') full_ar=$ar ;;
13738 esac
13739
13740 : Store the full pathname to the sed program for use in the C program
13741 full_sed=$sed
13742
13743 : see what type gids are declared as in the kernel
13744 echo " "
13745 echo "Looking for the type for group ids returned by getgid()."
13746 set gid_t gidtype xxx stdio.h sys/types.h
13747 eval $typedef
13748 case "$gidtype" in
13749 xxx)
13750         xxx=`./findhdr sys/user.h`
13751         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13752         case $1 in
13753         unsigned) dflt="$1 $2" ;;
13754         *) dflt="$1" ;;
13755         esac
13756         ;;
13757 *) dflt="$gidtype";;
13758 esac
13759 case "$gidtype" in
13760 gid_t) echo "gid_t found." ;;
13761 *)      rp="What is the type for group ids returned by getgid()?"
13762         . ./myread
13763         gidtype="$ans"
13764         ;;
13765 esac
13766
13767 echo " "
13768 case "$gidtype" in
13769 *_t) zzz="$gidtype"     ;;
13770 *)   zzz="gid"          ;;
13771 esac
13772 echo "Checking the size of $zzz..." >&4 
13773 cat > try.c <<EOCP
13774 #include <sys/types.h>
13775 #include <stdio.h>
13776 int main() {
13777     printf("%d\n", (int)sizeof($gidtype));
13778     exit(0);
13779 }
13780 EOCP
13781 set try
13782 if eval $compile_ok; then
13783         yyy=`./try`
13784         case "$yyy" in
13785         '')     gidsize=4
13786                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13787                 ;;
13788         *)      gidsize=$yyy
13789                 echo "Your $zzz is $gidsize bytes long."
13790                 ;;
13791         esac
13792 else
13793         gidsize=4
13794         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13795 fi
13796
13797
13798 echo " "
13799 case "$gidtype" in
13800 *_t) zzz="$gidtype"     ;;
13801 *)   zzz="gid"          ;;
13802 esac
13803 echo "Checking the sign of $zzz..." >&4 
13804 cat > try.c <<EOCP
13805 #include <sys/types.h>
13806 #include <stdio.h>
13807 int main() {
13808         $gidtype foo = -1;
13809         if (foo < 0)
13810                 printf("-1\n");
13811         else
13812                 printf("1\n");
13813 }
13814 EOCP
13815 set try
13816 if eval $compile; then
13817         yyy=`./try`
13818         case "$yyy" in
13819         '')     gidsign=1
13820                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13821                 ;;
13822         *)      gidsign=$yyy
13823                 case "$gidsign" in
13824                  1) echo "Your $zzz is unsigned." ;;
13825                 -1) echo "Your $zzz is signed."   ;;
13826                 esac
13827                 ;;
13828         esac
13829 else
13830         gidsign=1
13831         echo "(I can't compile the test program--guessing unsigned.)" >&4
13832 fi
13833
13834
13835 echo " "
13836
13837 if $test X"$quadtype" != X; then
13838
13839 echo "Checking how to print 64-bit integers..." >&4
13840
13841 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13842         $cat >try.c <<'EOCP'
13843 #include <sys/types.h>
13844 #include <stdio.h>
13845 int main() {
13846   int q = 12345678901;
13847   printf("%ld\n", q);
13848 }
13849 EOCP
13850         set try
13851         if eval $compile; then
13852                 yyy=`./try$exe_ext`
13853                 case "$yyy" in
13854                 12345678901)
13855                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13856                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13857                         echo "We will use %d."
13858                         ;;
13859                 esac
13860         fi
13861 fi
13862
13863 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13864         $cat >try.c <<'EOCP'
13865 #include <sys/types.h>
13866 #include <stdio.h>
13867 int main() {
13868   long q = 12345678901;
13869   printf("%ld\n", q);
13870 }
13871 EOCP
13872         set try
13873         if eval $compile; then
13874                 yyy=`./try$exe_ext`
13875                 case "$yyy" in
13876                 12345678901)
13877                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13878                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13879                         echo "We will use %ld."
13880                         ;;
13881                 esac
13882         fi
13883 fi
13884
13885 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13886         $cat >try.c <<'EOCP'
13887 #include <sys/types.h>
13888 #include <inttypes.h>
13889 #include <stdio.h>
13890 int main() {
13891   int64_t q = 12345678901;
13892   printf("%" PRId64 "\n", q);
13893 }
13894 EOCP
13895         set try
13896         if eval $compile; then
13897                 yyy=`./try$exe_ext`
13898                 case "$yyy" in
13899                 12345678901)
13900                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13901                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13902                         echo "We will use the C9X style."
13903                         ;;
13904                 esac
13905         fi
13906 fi
13907
13908 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13909         $cat >try.c <<EOCP
13910 #include <sys/types.h>
13911 #include <stdio.h>
13912 int main() {
13913   $quadtype q = 12345678901;
13914   printf("%Ld\n", q);
13915 }
13916 EOCP
13917         set try
13918         if eval $compile; then
13919                 yyy=`./try$exe_ext`
13920                 case "$yyy" in
13921                 12345678901)
13922                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13923                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13924                         echo "We will use %Ld."
13925                         ;;
13926                 esac
13927         fi
13928 fi
13929
13930 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13931         $cat >try.c <<'EOCP'
13932 #include <sys/types.h>
13933 #include <stdio.h>
13934 int main() {
13935   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13936   printf("%lld\n", q);
13937 }
13938 EOCP
13939         set try
13940         if eval $compile; then
13941                 yyy=`./try$exe_ext`
13942                 case "$yyy" in
13943                 12345678901)
13944                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13945                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13946                         echo "We will use the %lld style."
13947                         ;;
13948                 esac
13949         fi
13950 fi
13951
13952 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13953         $cat >try.c <<EOCP
13954 #include <sys/types.h>
13955 #include <stdio.h>
13956 int main() {
13957   $quadtype q = 12345678901;
13958   printf("%qd\n", q);
13959 }
13960 EOCP
13961         set try
13962         if eval $compile; then
13963                 yyy=`./try$exe_ext`
13964                 case "$yyy" in
13965                 12345678901)
13966                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13967                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13968                         echo "We will use %qd."
13969                         ;;
13970                 esac
13971         fi
13972 fi
13973
13974 if $test X"$sPRId64" = X; then
13975         echo "Cannot figure out how to print 64-bit integers." >&4
13976 fi
13977
13978 $rm -f try try.*
13979
13980 fi
13981
13982 case "$sPRId64" in
13983 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13984         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13985         ;;
13986 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13987         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13988         ;;
13989 esac
13990
13991
13992 echo " "
13993 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13994
13995 if $test X"$ivsize" = X8; then
13996         ivdformat="$sPRId64"
13997         uvuformat="$sPRIu64"
13998         uvoformat="$sPRIo64"
13999         uvxformat="$sPRIx64"
14000         uvXUformat="$sPRIXU64"
14001 else
14002         if $test X"$ivsize" = X"$longsize"; then
14003                 ivdformat='"ld"'
14004                 uvuformat='"lu"'
14005                 uvoformat='"lo"'
14006                 uvxformat='"lx"'
14007                 uvXUformat='"lX"'
14008         else
14009                 if $test X"$ivsize" = X"$intsize"; then
14010                         ivdformat='"d"'
14011                         uvuformat='"u"'
14012                         uvoformat='"o"'
14013                         uvxformat='"x"'
14014                         uvXUformat='"X"'
14015                 else
14016                         : far out
14017                         if $test X"$ivsize" = X"$shortsize"; then
14018                                 ivdformat='"hd"'
14019                                 uvuformat='"hu"'
14020                                 uvoformat='"ho"'
14021                                 uvxformat='"hx"'
14022                                 uvXUformat='"hX"'
14023                         fi
14024                 fi
14025         fi
14026 fi
14027
14028 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14029         nveformat="$sPRIeldbl"
14030         nvfformat="$sPRIfldbl"
14031         nvgformat="$sPRIgldbl"
14032         nvEUformat="$sPRIEUldbl"
14033         nvFUformat="$sPRIFUldbl"
14034         nvGUformat="$sPRIGUldbl"
14035 else
14036         nveformat='"e"'
14037         nvfformat='"f"'
14038         nvgformat='"g"'
14039         nvEUformat='"E"'
14040         nvFUformat='"F"'
14041         nvGUformat='"G"'
14042 fi
14043
14044 case "$ivdformat" in
14045 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14046     exit 1
14047     ;;
14048 esac
14049
14050
14051 echo " "
14052 $echo "Checking the format string to be used for gids..." >&4
14053
14054 case "$gidsign" in
14055 -1)     if $test X"$gidsize" = X"$ivsize"; then
14056                 gidformat="$ivdformat"
14057         else
14058                 if $test X"$gidsize" = X"$longsize"; then
14059                         gidformat='"ld"'
14060                 else
14061                         if $test X"$gidsize" = X"$intsize"; then
14062                                 gidformat='"d"'
14063                         else
14064                                 if $test X"$gidsize" = X"$shortsize"; then
14065                                         gidformat='"hd"'
14066                                 fi
14067                         fi
14068                 fi
14069         fi
14070         ;;
14071 *)      if $test X"$gidsize" = X"$uvsize"; then
14072                 gidformat="$uvuformat"
14073         else
14074                 if $test X"$gidsize" = X"$longsize"; then
14075                         gidformat='"lu"'
14076                 else
14077                         if $test X"$gidsize" = X"$intsize"; then
14078                                 gidformat='"u"'
14079                         else
14080                                 if $test X"$gidsize" = X"$shortsize"; then
14081                                         gidformat='"hu"'
14082                                 fi
14083                         fi
14084                 fi
14085         fi
14086         ;;
14087 esac
14088
14089 : see if getgroups exists
14090 set getgroups d_getgrps
14091 eval $inlibc
14092
14093 : see if setgroups exists
14094 set setgroups d_setgrps
14095 eval $inlibc
14096
14097
14098 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14099 echo " "
14100 case "$d_getgrps$d_setgrps" in
14101 *define*)
14102         case "$groupstype" in
14103         '') dflt="$gidtype" ;;
14104         *)  dflt="$groupstype" ;;
14105         esac
14106         $cat <<EOM
14107 What type of pointer is the second argument to getgroups() and setgroups()?
14108 Usually this is the same as group ids, $gidtype, but not always.
14109
14110 EOM
14111         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14112         . ./myread
14113         groupstype="$ans"
14114         ;;
14115 *)  groupstype="$gidtype";;
14116 esac
14117
14118 echo " "
14119 echo "Checking if your $make program sets \$(MAKE)..." >&4
14120 case "$make_set_make" in
14121 '')
14122         $sed 's/^X //' > testmake.mak << 'EOF'
14123 Xall:
14124 X       @echo 'maketemp="$(MAKE)"'
14125 EOF
14126         case "`$make -f testmake.mak 2>/dev/null`" in
14127         *maketemp=*) make_set_make='#' ;;
14128         *)      make_set_make="MAKE=$make" ;;
14129         esac
14130         $rm -f testmake.mak
14131         ;;
14132 esac
14133 case "$make_set_make" in
14134 '#') echo "Yup, it does.";;
14135 *) echo "Nope, it doesn't.";;
14136 esac
14137
14138 : see what type is used for mode_t
14139 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14140 set mode_t modetype int stdio.h sys/types.h
14141 eval $typedef_ask
14142
14143 : see if stdarg is available
14144 echo " "
14145 if $test `./findhdr stdarg.h`; then
14146         echo "<stdarg.h> found." >&4
14147         valstd="$define"
14148 else
14149         echo "<stdarg.h> NOT found." >&4
14150         valstd="$undef"
14151 fi
14152
14153 : see if varags is available
14154 echo " "
14155 if $test `./findhdr varargs.h`; then
14156         echo "<varargs.h> found." >&4
14157 else
14158         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14159 fi
14160
14161 : set up the varargs testing programs
14162 $cat > varargs.c <<EOP
14163 #ifdef I_STDARG
14164 #include <stdarg.h>
14165 #endif
14166 #ifdef I_VARARGS
14167 #include <varargs.h>
14168 #endif
14169
14170 #ifdef I_STDARG
14171 int f(char *p, ...)
14172 #else
14173 int f(va_alist)
14174 va_dcl
14175 #endif
14176 {
14177         va_list ap;
14178 #ifndef I_STDARG
14179         char *p;
14180 #endif
14181 #ifdef I_STDARG
14182         va_start(ap,p);
14183 #else
14184         va_start(ap);
14185         p = va_arg(ap, char *);
14186 #endif
14187         va_end(ap);
14188 }
14189 EOP
14190 $cat > varargs <<EOP
14191 $startsh
14192 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14193         echo "true"
14194 else
14195         echo "false"
14196 fi
14197 $rm -f varargs$_o
14198 EOP
14199 chmod +x varargs
14200
14201 : now check which varargs header should be included
14202 echo " "
14203 i_varhdr=''
14204 case "$valstd" in
14205 "$define")
14206         if `./varargs I_STDARG`; then
14207                 val='stdarg.h'
14208         elif `./varargs I_VARARGS`; then
14209                 val='varargs.h'
14210         fi
14211         ;;
14212 *)
14213         if `./varargs I_VARARGS`; then
14214                 val='varargs.h'
14215         fi
14216         ;;
14217 esac
14218 case "$val" in
14219 '')
14220 echo "I could not find the definition for va_dcl... You have problems..." >&4
14221         val="$undef"; set i_stdarg; eval $setvar
14222         val="$undef"; set i_varargs; eval $setvar
14223         ;;
14224 *) 
14225         set i_varhdr
14226         eval $setvar
14227         case "$i_varhdr" in
14228         stdarg.h)
14229                 val="$define"; set i_stdarg; eval $setvar
14230                 val="$undef"; set i_varargs; eval $setvar
14231                 ;;
14232         varargs.h)
14233                 val="$undef"; set i_stdarg; eval $setvar
14234                 val="$define"; set i_varargs; eval $setvar
14235                 ;;
14236         esac
14237         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14238 esac
14239 $rm -f varargs*
14240
14241 : see if we need va_copy
14242 echo " "
14243 case "$i_stdarg" in
14244 "$define")
14245         $cat >try.c <<EOCP
14246 #include <stdarg.h>
14247 #include <stdio.h>
14248 #$i_stdlib I_STDLIB
14249 #ifdef I_STDLIB
14250 #include <stdlib.h>
14251 #endif
14252 #include <signal.h>
14253
14254 int
14255 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14256 {
14257   return vfprintf(f, fmt, *valp);
14258 }
14259  
14260 int    
14261 myvfprintf(FILE *f, const  char *fmt, va_list val)
14262 {
14263   return ivfprintf(f, fmt, &val);
14264 }
14265       
14266 int
14267 myprintf(char *fmt, ...) 
14268 {
14269   va_list val;
14270   va_start(val, fmt);
14271   return myvfprintf(stdout, fmt, val); 
14272 }         
14273
14274 int
14275 main(int ac, char **av)
14276 {
14277   signal(SIGSEGV, exit);
14278
14279   myprintf("%s%cs all right, then\n", "that", '\'');                            
14280   exit(0);      
14281 }
14282 EOCP
14283         set try
14284         if eval $compile && ./try 2>&1 >/dev/null; then
14285                 case "`./try`" in
14286                 "that's all right, then")
14287                         okay=yes
14288                         ;;
14289                 esac
14290         fi
14291         case "$okay" in
14292         yes)    echo "It seems that you don't need va_copy()." >&4
14293                 need_va_copy="$undef"
14294                 ;;
14295         *)      echo "It seems that va_copy() or similar will be needed." >&4
14296                 need_va_copy="$define"
14297                 ;;
14298         esac
14299         $rm -f try.* core core.* *.core *.core.*
14300         ;;
14301 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14302         ;;
14303 esac
14304
14305 : define a fucntion to check prototypes
14306 $cat > protochk <<EOSH
14307 $startsh
14308 cc="$cc"
14309 optimize="$optimize"
14310 ccflags="$ccflags"
14311 prototype="$prototype"
14312 define="$define"
14313 rm=$rm
14314 EOSH
14315
14316 $cat >> protochk <<'EOSH'
14317
14318 $rm -f try.c
14319 foo="$1"
14320 shift
14321 while test $# -ge 2; do
14322         case "$1" in
14323                 $define) echo "#include <$2>" >> try.c ;;
14324                 literal) echo "$2" >> try.c ;;
14325         esac
14326     shift 2
14327 done
14328 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14329 cat >> try.c <<'EOCP'
14330 #ifdef CAN_PROTOTYPE
14331 #define _(args) args
14332 #else
14333 #define _(args) ()
14334 #endif
14335 EOCP
14336 echo "$foo" >> try.c
14337 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14338 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14339 status=$?
14340 $rm -f try.[co]
14341 exit $status
14342 EOSH
14343 chmod +x protochk
14344 $eunicefix protochk
14345
14346 : see what type is used for size_t
14347 rp="What is the type used for the length parameter for string functions?"
14348 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14349 eval $typedef_ask
14350
14351 : check for type of arguments to gethostbyaddr. 
14352 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14353         case "$d_gethbyaddr" in
14354         $define)
14355                 $cat <<EOM
14356
14357 Checking to see what type of arguments are accepted by gethostbyaddr().
14358 EOM
14359                 hdrs="$define sys/types.h
14360                         $d_socket sys/socket.h 
14361                         $i_niin netinet/in.h 
14362                         $i_netdb netdb.h
14363                         $i_unistd unistd.h"
14364                 : The first arg can 'char *' or 'void *'
14365                 : The second arg is some of integral type
14366                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14367                         for yyy in size_t long int; do
14368                                 case "$netdb_host_type" in
14369                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14370                                         if ./protochk "$try" $hdrs; then
14371                                                 echo "Your system accepts $xxx for the first arg."
14372                                                 echo "...and $yyy for the second arg."
14373                                                 netdb_host_type="$xxx"
14374                                                 netdb_hlen_type="$yyy"
14375                                         fi
14376                                         ;;
14377                                 esac
14378                         done
14379                 done
14380                 : In case none of those worked, prompt the user.
14381                 case "$netdb_host_type" in
14382                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14383                         dflt='char *'
14384                         . ./myread
14385                         netdb_host_type=$ans
14386                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14387                         dflt="$sizetype"
14388                         . ./myread
14389                         netdb_hlen_type=$ans
14390                         ;;
14391                 esac
14392                 ;;
14393         *)      : no gethostbyaddr, so pick harmless defaults
14394                 netdb_host_type='char *'
14395                 netdb_hlen_type="$sizetype"
14396                 ;;
14397         esac
14398         # Remove the "const" if needed. -- but then we'll have a 
14399         # prototype clash!
14400         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14401 fi
14402
14403 : check for type of argument to gethostbyname. 
14404 if test "X$netdb_name_type" = X ; then
14405         case "$d_gethbyname" in
14406         $define)
14407                 $cat <<EOM
14408
14409 Checking to see what type of argument is accepted by gethostbyname().
14410 EOM
14411                 hdrs="$define sys/types.h
14412                         $d_socket sys/socket.h 
14413                         $i_niin netinet/in.h 
14414                         $i_netdb netdb.h
14415                         $i_unistd unistd.h"
14416                 for xxx in "const char *" "char *"; do
14417                         case "$netdb_name_type" in
14418                         '')     try="extern struct hostent *gethostbyname($xxx);"
14419                                 if ./protochk "$try" $hdrs; then
14420                                         echo "Your system accepts $xxx."
14421                                         netdb_name_type="$xxx"
14422                                 fi
14423                                 ;;
14424                         esac
14425                 done
14426                 : In case none of those worked, prompt the user.
14427                 case "$netdb_name_type" in
14428                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14429                         dflt='char *'
14430                         . ./myread
14431                         netdb_name_type=$ans
14432                         ;;
14433                 esac
14434                 ;;
14435         *)      : no gethostbyname, so pick harmless default
14436                 netdb_name_type='char *'
14437                 ;;
14438         esac
14439 fi
14440
14441 : check for type of 1st argument to getnetbyaddr. 
14442 if test "X$netdb_net_type" = X ; then
14443         case "$d_getnbyaddr" in
14444         $define)
14445                 $cat <<EOM
14446
14447 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14448 EOM
14449                 hdrs="$define sys/types.h
14450                         $d_socket sys/socket.h 
14451                         $i_niin netinet/in.h 
14452                         $i_netdb netdb.h
14453                         $i_unistd unistd.h"
14454                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14455                         case "$netdb_net_type" in
14456                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14457                                 if ./protochk "$try" $hdrs; then
14458                                         echo "Your system accepts $xxx."
14459                                         netdb_net_type="$xxx"
14460                                 fi
14461                                 ;;
14462                         esac
14463                 done
14464                 : In case none of those worked, prompt the user.
14465                 case "$netdb_net_type" in
14466                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14467                         dflt='long'
14468                         . ./myread
14469                         netdb_net_type=$ans
14470                         ;;
14471                 esac
14472                 ;;
14473         *)      : no getnetbyaddr, so pick harmless default
14474                 netdb_net_type='long'
14475                 ;;
14476         esac
14477 fi
14478 : locate the preferred pager for this system
14479 case "$pager" in
14480 '')
14481         dflt=''
14482         case "$pg" in
14483         /*) dflt=$pg;;
14484         [a-zA-Z]:/*) dflt=$pg;;
14485         esac
14486         case "$more" in
14487         /*) dflt=$more;;
14488         [a-zA-Z]:/*) dflt=$more;;
14489         esac
14490         case "$less" in
14491         /*) dflt=$less;;
14492         [a-zA-Z]:/*) dflt=$less;;
14493         esac
14494         case "$dflt" in
14495         '') dflt=/usr/ucb/more;;
14496         esac
14497         ;;
14498 *) dflt="$pager";;
14499 esac
14500 echo " "
14501 fn=f/
14502 rp='What pager is used on your system?'
14503 . ./getfile
14504 pager="$ans"
14505
14506 : see what type pids are declared as in the kernel
14507 rp="What is the type of process ids on this system?"
14508 set pid_t pidtype int stdio.h sys/types.h
14509 eval $typedef_ask
14510
14511 : Find earliest binary compatible site_perl subdirectory perl can use.
14512 case "$bincompat5005" in
14513 "$define") xs_apiversion='5.005' ;;
14514 *) xs_apiversion=$version ;;   # The current site_perl version.
14515 esac
14516 : Find earliest pure perl site_perl subdirectory perl can use.
14517 : The versioned directories started at 5.005.
14518 pm_apiversion='5.005'
14519
14520 : see if ar generates random libraries by itself
14521 echo " "
14522 echo "Checking how to generate random libraries on your machine..." >&4
14523 echo 'int bar1() { return bar2(); }' > bar1.c
14524 echo 'int bar2() { return 2; }' > bar2.c
14525 $cat > foo.c <<'EOP'
14526 int main() { printf("%d\n", bar1()); exit(0); }
14527 EOP
14528 $cc $ccflags -c bar1.c >/dev/null 2>&1
14529 $cc $ccflags -c bar2.c >/dev/null 2>&1
14530 $cc $ccflags -c foo.c >/dev/null 2>&1
14531 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14532 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14533         ./foobar >/dev/null 2>&1; then
14534         echo "$ar appears to generate random libraries itself."
14535         orderlib=false
14536         ranlib=":"
14537 elif $ar ts bar$_a >/dev/null 2>&1 &&
14538         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14539         ./foobar >/dev/null 2>&1; then
14540                 echo "a table of contents needs to be added with '$ar ts'."
14541                 orderlib=false
14542                 ranlib="$ar ts"
14543 else
14544         case "$ranlib" in
14545         :) ranlib='';;
14546         '')
14547                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14548                 $test -f $ranlib || ranlib=''
14549                 ;;
14550         esac
14551         if $test -n "$ranlib"; then
14552                 echo "your system has '$ranlib'; we'll use that."
14553                 orderlib=false
14554         else
14555                 echo "your system doesn't seem to support random libraries"
14556                 echo "so we'll use lorder and tsort to order the libraries."
14557                 orderlib=true
14558                 ranlib=":"
14559         fi
14560 fi
14561 $rm -f foo* bar* 
14562
14563 : check for type of arguments to select. 
14564 case "$selecttype" in
14565 '') case "$d_select" in
14566         $define)
14567                 echo " "
14568                 $cat <<EOM
14569 Checking to see what type of arguments are accepted by select().
14570 EOM
14571                 hdrs="$define sys/types.h
14572                         $i_systime sys/time.h 
14573                         $i_sysselct sys/select.h
14574                         $d_socket sys/socket.h"
14575                 : The first arg can be int, unsigned, or size_t
14576                 : The last arg may or may not be 'const'
14577                 val=''
14578                 : void pointer has been seen but using that
14579                 : breaks the selectminbits test
14580                 for xxx in 'fd_set *' 'int *'; do
14581                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14582                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14583                                         case "$val" in
14584                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14585                                                 if ./protochk "$try" $hdrs; then
14586                                                         echo "Your system accepts $xxx."
14587                                                         val="$xxx"
14588                                                 fi
14589                                                 ;;
14590                                         esac
14591                                 done
14592                         done
14593                 done
14594                 case "$val" in
14595                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14596                         case "$d_fd_set" in
14597                                 $define) dflt="fd_set *" ;;
14598                                 *)              dflt="int *" ;;
14599                         esac
14600                         . ./myread
14601                         val=$ans
14602                         ;;
14603                 esac
14604                 selecttype="$val"
14605                 ;;
14606         *)      : no select, so pick a harmless default
14607                 selecttype='int *'
14608                 ;;
14609         esac
14610         ;;
14611 esac
14612
14613 : check for the select 'width'
14614 case "$selectminbits" in
14615 '') case "$d_select" in
14616         $define)
14617                 $cat <<EOM
14618
14619 Checking to see on how many bits at a time your select() operates...
14620 EOM
14621                 $cat >try.c <<EOCP
14622 #include <sys/types.h>
14623 #$i_time I_TIME
14624 #$i_systime I_SYS_TIME
14625 #$i_systimek I_SYS_TIME_KERNEL
14626 #ifdef I_TIME
14627 #   include <time.h>
14628 #endif
14629 #ifdef I_SYS_TIME
14630 #   ifdef I_SYS_TIME_KERNEL
14631 #       define KERNEL
14632 #   endif
14633 #   include <sys/time.h>
14634 #   ifdef I_SYS_TIME_KERNEL
14635 #       undef KERNEL
14636 #   endif
14637 #endif
14638 #$i_sysselct I_SYS_SELECT
14639 #ifdef I_SYS_SELECT
14640 #include <sys/select.h>
14641 #endif
14642 #$d_socket HAS_SOCKET
14643 #ifdef HAS_SOCKET
14644 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14645 #endif
14646 #include <stdio.h>
14647 $selecttype b;
14648 #define S sizeof(*(b))
14649 #define MINBITS 64
14650 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14651 #define NBITS  (NBYTES * 8)
14652 int main() {
14653     char s[NBYTES];
14654     struct timeval t;
14655     int i;
14656     FILE* fp;
14657     int fd;
14658
14659     fclose(stdin);
14660     fp = fopen("try.c", "r");
14661     if (fp == 0)
14662       exit(1);
14663     fd = fileno(fp);
14664     if (fd < 0)
14665       exit(2);
14666     b = ($selecttype)s;
14667     for (i = 0; i < NBITS; i++)
14668         FD_SET(i, b);
14669     t.tv_sec  = 0;
14670     t.tv_usec = 0;
14671     select(fd + 1, b, 0, 0, &t);
14672     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14673     printf("%d\n", i + 1);
14674     return 0;
14675 }
14676 EOCP
14677                 set try
14678                 if eval $compile_ok; then
14679                         selectminbits=`./try`
14680                         case "$selectminbits" in
14681                         '')     cat >&4 <<EOM
14682 Cannot figure out on how many bits at a time your select() operates.
14683 I'll play safe and guess it is 32 bits.
14684 EOM
14685                                 selectminbits=32
14686                                 bits="32 bits"
14687                                 ;;
14688                         1)      bits="1 bit" ;;
14689                         *)      bits="$selectminbits bits" ;;
14690                         esac
14691                         echo "Your select() operates on $bits at a time." >&4
14692                 else
14693                         rp='What is the minimum number of bits your select() operates on?'
14694                         case "$byteorder" in
14695                         1234|12345678)  dflt=32 ;;
14696                         *)              dflt=1  ;;
14697                         esac
14698                         . ./myread
14699                         val=$ans
14700                         selectminbits="$val"
14701                 fi
14702                 $rm -f try.* try
14703                 ;;
14704         *)      : no select, so pick a harmless default
14705                 selectminbits='32'
14706                 ;;
14707         esac
14708         ;;
14709 esac
14710
14711 : Trace out the files included by signal.h, then look for SIGxxx names.
14712 : Remove SIGARRAYSIZE used by HPUX.
14713 : Remove SIGSTKSIZE used by Linux.
14714 : Remove SIGSTKSZ used by Posix.
14715 : Remove SIGTYP void lines used by OS2.
14716 : Some cpps, like os390, dont give the file name anywhere
14717 if [ "X$fieldn" = X ]; then
14718         : Just make some guesses.  We check them later.
14719         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14720 else
14721         xxx=`echo '#include <signal.h>' |
14722         $cppstdin $cppminus $cppflags 2>/dev/null |
14723         $grep '^[       ]*#.*include' | 
14724         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14725 fi
14726 : Check this list of files to be sure we have parsed the cpp output ok.
14727 : This will also avoid potentially non-existent files, such 
14728 : as ../foo/bar.h
14729 xxxfiles=''
14730 for xx in $xxx /dev/null ; do
14731         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14732 done
14733 : If we have found no files, at least try signal.h
14734 case "$xxxfiles" in
14735 '')     xxxfiles=`./findhdr signal.h` ;;
14736 esac
14737 xxx=`awk '
14738 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14739         print substr($2, 4, 20)
14740 }
14741 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14742         print substr($3, 4, 20)
14743 }' $xxxfiles`
14744 : Append some common names just in case the awk scan failed.
14745 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14746 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14747 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14748 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14749 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14750
14751 : generate a few handy files for later
14752 $cat > signal.c <<'EOCP'
14753 #include <sys/types.h>
14754 #include <signal.h>
14755 #include <stdio.h>
14756 int main() {
14757
14758 /* Strange style to avoid deeply-nested #if/#else/#endif */
14759 #ifndef NSIG
14760 #  ifdef _NSIG
14761 #    define NSIG (_NSIG)
14762 #  endif
14763 #endif
14764
14765 #ifndef NSIG
14766 #  ifdef SIGMAX
14767 #    define NSIG (SIGMAX+1)
14768 #  endif
14769 #endif
14770
14771 #ifndef NSIG
14772 #  ifdef SIG_MAX
14773 #    define NSIG (SIG_MAX+1)
14774 #  endif
14775 #endif
14776
14777 #ifndef NSIG
14778 #  ifdef MAXSIG
14779 #    define NSIG (MAXSIG+1)
14780 #  endif
14781 #endif
14782
14783 #ifndef NSIG
14784 #  ifdef MAX_SIG
14785 #    define NSIG (MAX_SIG+1)
14786 #  endif
14787 #endif
14788
14789 #ifndef NSIG
14790 #  ifdef SIGARRAYSIZE
14791 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14792 #  endif
14793 #endif
14794
14795 #ifndef NSIG
14796 #  ifdef _sys_nsig
14797 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14798 #  endif
14799 #endif
14800
14801 /* Default to some arbitrary number that's big enough to get most
14802    of the common signals.
14803 */
14804 #ifndef NSIG
14805 #    define NSIG 50
14806 #endif
14807
14808 printf("NSIG %d\n", NSIG);
14809
14810 #ifndef JUST_NSIG
14811
14812 EOCP
14813
14814 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14815 {
14816         printf "#ifdef SIG"; printf $1; printf "\n"
14817         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14818         printf $1; printf ");\n"
14819         printf "#endif\n"
14820 }
14821 END {
14822         printf "#endif /* JUST_NSIG */\n";
14823         printf "exit(0);\n}\n";
14824 }
14825 ' >>signal.c
14826 $cat >signal.awk <<'EOP'
14827 BEGIN { ndups = 0 }
14828 $1 ~ /^NSIG$/ { nsig = $2 }
14829 ($1 !~ /^NSIG$/) && (NF == 2) {
14830     if ($2 > maxsig) { maxsig = $2 }
14831     if (sig_name[$2]) {
14832         dup_name[ndups] = $1
14833         dup_num[ndups] = $2
14834         ndups++ 
14835     }
14836     else {
14837         sig_name[$2] = $1
14838         sig_num[$2] = $2
14839     }
14840 }
14841 END { 
14842     if (nsig == 0) {
14843         nsig = maxsig + 1
14844     }
14845     printf("NSIG %d\n", nsig);
14846     for (n = 1; n < nsig; n++) {
14847         if (sig_name[n]) {
14848             printf("%s %d\n", sig_name[n], sig_num[n])
14849         }
14850         else {
14851             printf("NUM%d %d\n", n, n) 
14852         }
14853     }
14854     for (n = 0; n < ndups; n++) {
14855         printf("%s %d\n", dup_name[n], dup_num[n])
14856     }
14857 }
14858 EOP
14859 $cat >signal_cmd <<EOS
14860 $startsh
14861 if $test -s signal.lst; then
14862     echo "Using your existing signal.lst file"
14863         exit 0
14864 fi
14865 xxx="$xxx"
14866 EOS
14867 $cat >>signal_cmd <<'EOS'
14868
14869 set signal
14870 if eval $compile_ok; then
14871         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14872 else
14873         echo "(I can't seem be able to compile the whole test program)" >&4
14874         echo "(I'll try it in little pieces.)" >&4
14875         set signal -DJUST_NSIG
14876         if eval $compile_ok; then
14877                 ./signal$_exe > signal.nsg
14878                 $cat signal.nsg
14879         else
14880                 echo "I can't seem to figure out how many signals you have." >&4
14881                 echo "Guessing 50." >&4
14882                 echo 'NSIG 50' > signal.nsg
14883         fi
14884         : Now look at all the signal names, one at a time.
14885         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14886                 $cat > signal.c <<EOCP
14887 #include <sys/types.h>
14888 #include <signal.h>
14889 #include <stdio.h>
14890 int main() {
14891 printf("$xx %d\n", SIG${xx});
14892 return 0;
14893 }
14894 EOCP
14895                 set signal
14896                 if eval $compile; then
14897                         echo "SIG${xx} found."
14898                         ./signal$_exe  >> signal.ls1
14899                 else
14900                         echo "SIG${xx} NOT found."
14901                 fi
14902         done
14903         if $test -s signal.ls1; then
14904                 $cat signal.nsg signal.ls1 |
14905                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14906         fi
14907
14908 fi
14909 if $test -s signal.lst; then
14910         :
14911 else
14912         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14913         echo 'kill -l' >signal
14914         set X `csh -f <signal`
14915         $rm -f signal
14916         shift
14917         case $# in
14918         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14919         esac
14920         echo $@ | $tr ' ' $trnl | \
14921             $awk '{ printf "%s %d\n", $1, ++s; }
14922                   END { printf "NSIG %d\n", ++s }' >signal.lst
14923 fi
14924 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14925 EOS
14926 chmod a+x signal_cmd
14927 $eunicefix signal_cmd
14928
14929 : generate list of signal names
14930 echo " "
14931 case "$sig_name_init" in
14932 '') doinit=yes ;;
14933 *)  case "$sig_num_init" in
14934     ''|*,*) doinit=yes ;;
14935     esac ;;
14936 esac
14937 case "$doinit" in
14938 yes)
14939         echo "Generating a list of signal names and numbers..." >&4
14940         . ./signal_cmd
14941         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14942         sig_name=`$awk 'BEGIN { printf "ZERO " }
14943                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14944         sig_num=`$awk  'BEGIN { printf "0 " }
14945                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14946         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14947                              !/^NSIG/   { printf "\"%s\", ", $1 }
14948                              END        { printf "0\n" }' signal.lst`
14949         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14950                              !/^NSIG/   { printf "%d, ", $2}
14951                              END        { printf "0\n"}' signal.lst`
14952         ;;
14953 esac
14954 echo "The following $sig_count signals are available:"
14955 echo " "
14956 echo $sig_name | $awk \
14957 'BEGIN { linelen = 0 }
14958 {
14959         for (i = 1; i <= NF; i++) {
14960                 name = "SIG" $i " "
14961                 linelen = linelen + length(name)
14962                 if (linelen > 70) {
14963                         printf "\n"
14964                         linelen = length(name)
14965                 }
14966                 printf "%s", name
14967         }
14968         printf "\n"
14969 }'
14970 sig_size=`echo $sig_name | awk '{print NF}'`
14971 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14972
14973 echo " "
14974 case "$sizetype" in
14975 *_t) zzz="$sizetype"    ;;
14976 *)   zzz="filesize"     ;;
14977 esac
14978 echo "Checking the size of $zzz..." >&4 
14979 cat > try.c <<EOCP
14980 #include <sys/types.h>
14981 #include <stdio.h>
14982 int main() {
14983     printf("%d\n", (int)sizeof($sizetype));
14984     exit(0);
14985 }
14986 EOCP
14987 set try
14988 if eval $compile_ok; then
14989         yyy=`./try`
14990         case "$yyy" in
14991         '')     sizesize=4
14992                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14993                 ;;
14994         *)      sizesize=$yyy
14995                 echo "Your $zzz size is $sizesize bytes."
14996                 ;;
14997         esac
14998 else
14999         sizesize=4
15000         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15001 fi
15002
15003
15004 : check for socklen_t
15005 echo " "
15006 echo "Checking to see if you have socklen_t..." >&4
15007 $cat >try.c <<EOCP
15008 #include <sys/types.h>
15009 #$d_socket HAS_SOCKET
15010 #ifdef HAS_SOCKET
15011 #include <sys/socket.h>
15012 #endif
15013 int main() { socklen_t x = 16; }
15014 EOCP
15015 set try
15016 if eval $compile; then
15017         val="$define"
15018         echo "You have socklen_t."
15019 else
15020         val="$undef"
15021         echo "You do not have socklen_t."
15022         case "$sizetype" in
15023         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15024         esac
15025 fi
15026 $rm -f try try.*
15027 set d_socklen_t
15028 eval $setvar
15029
15030 : see if this is a socks.h system
15031 set socks.h i_socks
15032 eval $inhdr
15033
15034 : check for type of the size argument to socket calls
15035 case "$d_socket" in
15036 "$define")
15037         $cat <<EOM
15038
15039 Checking to see what type is the last argument of accept().
15040 EOM
15041         yyy=''
15042         case "$d_socklen_t" in
15043         "$define") yyy="$yyy socklen_t"
15044         esac
15045         yyy="$yyy $sizetype int long unsigned"
15046         for xxx in $yyy; do
15047                 case "$socksizetype" in
15048                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15049                         case "$usesocks" in
15050                         "$define")
15051                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15052                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15053                                         socksizetype="$xxx"
15054                                 fi
15055                                 ;;
15056                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15057                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15058                                         socksizetype="$xxx"
15059                                 fi
15060                                 ;;
15061                         esac
15062                         ;;
15063                 esac
15064         done
15065 : In case none of those worked, prompt the user.
15066         case "$socksizetype" in
15067         '')     rp='What is the type for socket address structure sizes?'
15068                 dflt='int'
15069                 . ./myread
15070                 socksizetype=$ans
15071                 ;;
15072         esac
15073         ;;
15074 *)      : no sockets, so pick relatively harmless default
15075         socksizetype='int'
15076         ;;
15077 esac
15078
15079 : see what type is used for signed size_t
15080 set ssize_t ssizetype int stdio.h sys/types.h
15081 eval $typedef
15082 dflt="$ssizetype"
15083 $cat > ssize.c <<EOM
15084 #include <stdio.h>
15085 #include <sys/types.h>
15086 #define Size_t $sizetype
15087 #define SSize_t $dflt
15088 int main()
15089 {
15090         if (sizeof(Size_t) == sizeof(SSize_t))
15091                 printf("$dflt\n");
15092         else if (sizeof(Size_t) == sizeof(int))
15093                 printf("int\n");
15094         else 
15095                 printf("long\n");
15096         exit(0);
15097 }
15098 EOM
15099 echo " "
15100 set ssize
15101 if eval $compile_ok && ./ssize > /dev/null; then
15102         ssizetype=`./ssize`
15103         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15104 else
15105         $cat >&4 <<EOM
15106 Help! I can't compile and run the ssize_t test program: please enlighten me!
15107 (This is probably a misconfiguration in your system or libraries, and
15108 you really ought to fix it.  Still, I'll try anyway.)
15109
15110 I need a type that is the same size as $sizetype, but is guaranteed to
15111 be signed.  Common values are ssize_t, int and long.
15112
15113 EOM
15114         rp="What signed type is the same size as $sizetype?"
15115         . ./myread
15116         ssizetype="$ans"
15117 fi
15118 $rm -f ssize ssize.*
15119
15120 : see what type of char stdio uses.
15121 echo " "
15122 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15123 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15124         echo "Your stdio uses unsigned chars." >&4
15125         stdchar="unsigned char"
15126 else
15127         echo "Your stdio uses signed chars." >&4
15128         stdchar="char"
15129 fi
15130 $rm -f stdioh
15131
15132
15133
15134 : see if time exists
15135 echo " "
15136 if test "X$d_time" = X -o X"$timetype" = X; then
15137     if set time val -f d_time; eval $csym; $val; then
15138                 echo 'time() found.' >&4
15139                 val="$define"
15140                 rp="What is the type returned by time() on this system?"
15141                 set time_t timetype long stdio.h sys/types.h
15142                 eval $typedef_ask
15143     else
15144                 echo 'time() not found, hope that will do.' >&4
15145                 val="$undef"
15146                 timetype='int';
15147     fi
15148     set d_time
15149     eval $setvar
15150 fi
15151
15152 : see what type uids are declared as in the kernel
15153 echo " "
15154 echo "Looking for the type for user ids returned by getuid()."
15155 set uid_t uidtype xxx stdio.h sys/types.h
15156 eval $typedef
15157 case "$uidtype" in
15158 xxx)
15159         xxx=`./findhdr sys/user.h`
15160         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15161         case $1 in
15162         unsigned) dflt="$1 $2" ;;
15163         *) dflt="$1" ;;
15164         esac
15165         ;;
15166 *) dflt="$uidtype";;
15167 esac
15168 case "$uidtype" in
15169 uid_t)  echo "uid_t found." ;;
15170 *)      rp="What is the type for user ids returned by getuid()?"
15171         . ./myread
15172         uidtype="$ans"
15173         ;;
15174 esac
15175
15176 echo " "
15177 case "$uidtype" in
15178 *_t) zzz="$uidtype"     ;;
15179 *)   zzz="uid"          ;;
15180 esac
15181 echo "Checking the size of $zzz..." >&4 
15182 cat > try.c <<EOCP
15183 #include <sys/types.h>
15184 #include <stdio.h>
15185 int main() {
15186     printf("%d\n", (int)sizeof($uidtype));
15187     exit(0);
15188 }
15189 EOCP
15190 set try
15191 if eval $compile_ok; then
15192         yyy=`./try`
15193         case "$yyy" in
15194         '')     uidsize=4
15195                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15196                 ;;
15197         *)      uidsize=$yyy
15198                 echo "Your $zzz is $uidsize bytes long."
15199                 ;;
15200         esac
15201 else
15202         uidsize=4
15203         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15204 fi
15205
15206 echo " "
15207 case "$uidtype" in
15208 *_t) zzz="$uidtype"     ;;
15209 *)   zzz="uid"          ;;
15210 esac
15211 echo "Checking the sign of $zzz..." >&4
15212 cat > try.c <<EOCP
15213 #include <sys/types.h>
15214 #include <stdio.h>
15215 int main() {
15216         $uidtype foo = -1;
15217         if (foo < 0)
15218                 printf("-1\n");
15219         else
15220                 printf("1\n");
15221 }
15222 EOCP
15223 set try
15224 if eval $compile; then
15225         yyy=`./try`
15226         case "$yyy" in
15227         '')     uidsign=1
15228                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15229                 ;;
15230         *)      uidsign=$yyy
15231                 case "$uidsign" in
15232                  1) echo "Your $zzz is unsigned." ;;
15233                 -1) echo "Your $zzz is signed."   ;;
15234                 esac
15235                 ;;
15236         esac
15237 else
15238         uidsign=1
15239         echo "(I can't compile the test program--guessing unsigned.)" >&4
15240 fi
15241
15242
15243
15244 echo " "
15245 $echo "Checking the format string to be used for uids..." >&4
15246
15247 case "$uidsign" in
15248 -1)     if $test X"$uidsize" = X"$ivsize"; then
15249                 uidformat="$ivdformat"
15250         else
15251                 if $test X"$uidsize" = X"$longsize"; then
15252                         uidformat='"ld"'
15253                 else
15254                         if $test X"$uidsize" = X"$intsize"; then
15255                                 uidformat='"d"'
15256                         else
15257                                 if $test X"$uidsize" = X"$shortsize"; then
15258                                         uidformat='"hd"'
15259                                 fi
15260                         fi
15261                 fi
15262         fi
15263         ;;
15264 *)      if $test X"$uidsize" = X"$uvsize"; then
15265                 uidformat="$uvuformat"
15266         else
15267                 if $test X"$uidsize" = X"$longsize"; then
15268                         uidformat='"lu"'
15269                 else
15270                         if $test X"$uidsize" = X"$intsize"; then
15271                                 uidformat='"u"'
15272                         else
15273                                 if $test X"$uidsize" = X"$shortsize"; then
15274                                         uidformat='"hu"'
15275                                 fi
15276                         fi
15277                 fi
15278         fi
15279         ;;
15280 esac
15281
15282 : determine compiler compiler
15283 case "$yacc" in
15284 '')
15285         dflt=yacc;;
15286 *)
15287         dflt="$yacc";;
15288 esac
15289 echo " "
15290 comp='yacc'
15291 if $test -f "$byacc"; then
15292         dflt="$byacc"
15293         comp="byacc or $comp"
15294 fi
15295 if $test -f "$bison"; then
15296         comp="$comp or bison -y"
15297 fi
15298 rp="Which compiler compiler ($comp) shall I use?"
15299 . ./myread
15300 yacc="$ans"
15301 case "$yacc" in
15302 *bis*)
15303         case "$yacc" in
15304         *-y*) ;;
15305         *)
15306                 yacc="$yacc -y"
15307                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15308                 ;;
15309         esac
15310         ;;
15311 esac
15312
15313 : see if fcntl.h is there
15314 val=''
15315 set fcntl.h val
15316 eval $inhdr
15317
15318 : see if we can include fcntl.h
15319 case "$val" in
15320 "$define")
15321         echo " "
15322         if $h_fcntl; then
15323                 val="$define"
15324                 echo "We'll be including <fcntl.h>." >&4
15325         else
15326                 val="$undef"
15327                 if $h_sysfile; then
15328         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15329                 else
15330                         echo "We won't be including <fcntl.h>." >&4
15331                 fi
15332         fi
15333         ;;
15334 *)
15335         h_fcntl=false
15336         val="$undef"
15337         ;;
15338 esac
15339 set i_fcntl
15340 eval $setvar
15341
15342 : see if this is a iconv.h system
15343 set iconv.h i_iconv
15344 eval $inhdr
15345
15346 : see if this is a ieeefp.h system
15347 set ieeefp.h i_ieeefp
15348 eval $inhdr
15349
15350 : see if this is a libutil.h system
15351 set libutil.h i_libutil
15352 eval $inhdr
15353
15354 : see if locale.h is available
15355 set locale.h i_locale
15356 eval $inhdr
15357
15358 : see if mach cthreads are available
15359 if test "X$usethreads" = "X$define"; then
15360         set mach/cthreads.h i_machcthr
15361         eval $inhdr
15362 else
15363         i_machcthr="$undef"
15364 fi
15365
15366
15367
15368 : see if this is a math.h system
15369 set math.h i_math
15370 eval $inhdr
15371
15372 : see if this is a mntent.h system
15373 set mntent.h i_mntent
15374 eval $inhdr
15375
15376 : see if ndbm.h is available
15377 set ndbm.h t_ndbm
15378 eval $inhdr
15379 case "$t_ndbm" in
15380 $define)
15381         : see if dbm_open exists
15382         set dbm_open d_dbm_open
15383         eval $inlibc
15384         case "$d_dbm_open" in
15385         $undef)
15386                 t_ndbm="$undef"
15387                 echo "We won't be including <ndbm.h>"
15388                 ;;
15389         esac
15390         ;;
15391 esac
15392 val="$t_ndbm"
15393 set i_ndbm
15394 eval $setvar
15395
15396 : see if net/errno.h is available
15397 val=''
15398 set net/errno.h val
15399 eval $inhdr
15400
15401 : Unfortunately, it causes problems on some systems.  Arrgh.
15402 case "$val" in
15403 $define)
15404         cat > try.c <<'EOM'
15405 #include <stdio.h>
15406 #include <errno.h>
15407 #include <net/errno.h>
15408 int func()
15409 {
15410         return ENOTSOCK;
15411 }
15412 EOM
15413         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15414                 echo "We'll be including <net/errno.h>." >&4
15415         else
15416                 echo "We won't be including <net/errno.h>." >&4
15417                 val="$undef"
15418         fi
15419         $rm -f try.* try
15420         ;;
15421 esac
15422 set i_neterrno
15423 eval $setvar
15424
15425 : see if netinet/tcp.h is available
15426 set netinet/tcp.h i_netinettcp
15427 eval $inhdr
15428
15429 : see if this is a poll.h system
15430 set poll.h i_poll
15431 eval $inhdr
15432
15433 : see if this is a prot.h system
15434 set prot.h i_prot
15435 eval $inhdr
15436
15437 echo " "
15438 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15439 $cat <<'EOSH' > Cppsym.know
15440 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15441 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15442 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15443 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15444 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15445 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15446 bull c cadmus clipper CMU COFF COMPILER_VERSION
15447 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15448 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15449 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15450 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15451 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15452 H3050R H3050RX hbullx20 hcx host_mips
15453 hp200 hp300 hp700 HP700 hp800 hp9000
15454 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15455 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15456 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15457 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15458 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15459 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15460 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15461 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15462 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15463 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15464 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15465 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15466 MATH_HAS_NO_SIDE_EFFECTS
15467 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15468 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15469 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15470 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15471 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15472 NetBSD news1500 news1700 news1800 news1900 news3700
15473 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15474 ns32016 ns32332 ns32k nsc32000
15475 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15476 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15477 pc532 pdp11 PGC PIC plexus PORTAR posix
15478 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15479 POSIX_C_SOURCE POSIX_SOURCE POWER
15480 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15481 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15482 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15483 sony sony_news sonyrisc sparc sparclite spectrum
15484 stardent stdc STDC_EXT stratos sun sun3 sun386
15485 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15486 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15487 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15488 sysV68 sysV88 Tek4132 Tek4300 titan
15489 TM3200 TM5400 TM5600
15490 tower tower32 tower32_200 tower32_600 tower32_700
15491 tower32_800 tower32_850 tss
15492 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15493 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15494 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15495 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15496 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15497 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15498 z8000
15499 EOSH
15500 # Maybe put other stuff here too.
15501 cat <<EOSH >>Cppsym.know
15502 $osname
15503 EOSH
15504 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15505 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15506 $cat Cppsym.know > Cppsym.c
15507 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15508 $rm -f Cppsym.a Cppsym.b Cppsym.c
15509 cat <<EOSH > Cppsym
15510 $startsh
15511 if $test \$# -gt 0; then
15512     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15513     if $test -s Cppsym.got; then
15514         $rm -f Cppsym.got
15515         exit 0
15516     fi
15517     $rm -f Cppsym.got
15518     exit 1
15519 else
15520     $tr " " "$trnl" | ./Cppsym.try
15521     exit 0
15522 fi
15523 EOSH
15524 chmod +x Cppsym
15525 $eunicefix Cppsym
15526 cat <<EOSH > Cppsym.try
15527 $startsh
15528 cat <<'EOCP' > try.c
15529 #include <stdio.h>
15530 int main() {
15531 EOCP
15532 $awk \\
15533 EOSH
15534 cat <<'EOSH' >> Cppsym.try
15535 'length($1) > 0 {
15536     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15537     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15538     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15539     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15540 }'       >> try.c
15541 echo 'return 0;}' >> try.c
15542 EOSH
15543 cat <<EOSH >> Cppsym.try
15544 ccflags="$ccflags"
15545 case "$osname-$gccversion" in
15546 irix-) ccflags="\$ccflags -woff 1178" ;;
15547 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15548 esac
15549 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15550 EOSH
15551 chmod +x Cppsym.try
15552 $eunicefix Cppsym.try
15553 ./Cppsym < Cppsym.know > Cppsym.true
15554 : now check the C compiler for additional symbols
15555 postprocess_cc_v=''
15556 case "$osname" in
15557 aix) postprocess_cc_v="|$tr , ' '" ;;
15558 esac
15559 $cat >ccsym <<EOS
15560 $startsh
15561 $cat >tmp.c <<EOF
15562 extern int foo;
15563 EOF
15564 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15565 do
15566         case "\$i" in
15567         -D*) echo "\$i" | $sed 's/^-D//';;
15568         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15569         esac
15570 done
15571 $rm -f try.c
15572 EOS
15573 postprocess_cc_v=''
15574 chmod +x ccsym
15575 $eunicefix ccsym
15576 ./ccsym > ccsym1.raw
15577 if $test -s ccsym1.raw; then
15578        $sort ccsym1.raw | $uniq >ccsym.raw
15579 else
15580        mv ccsym1.raw ccsym.raw
15581 fi
15582
15583 $awk '/\=/ { print $0; next }
15584         { print $0"=1" }' ccsym.raw >ccsym.list
15585 $awk '/\=/ { print $0; next }
15586         { print $0"=1" }' Cppsym.true >ccsym.true
15587 $comm -13 ccsym.true ccsym.list >ccsym.own
15588 $comm -12 ccsym.true ccsym.list >ccsym.com
15589 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15590 also=''
15591 if $test -z ccsym.raw; then
15592         echo "Your C compiler doesn't seem to define any symbols!" >&4
15593         echo " "
15594         echo "However, your C preprocessor defines the following symbols:"
15595         $cat Cppsym.true
15596         ccsymbols=''
15597         cppsymbols=`$cat Cppsym.true`
15598         cppsymbols=`echo $cppsymbols`
15599         cppccsymbols="$cppsymbols"
15600 else
15601         if $test -s ccsym.com; then
15602                 echo "Your C compiler and pre-processor define these symbols:"
15603                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15604                 also='also '
15605                 symbols='ones'
15606                 cppccsymbols=`$cat ccsym.com`
15607                 cppccsymbols=`echo $cppccsymbols`
15608                 $test "$silent" || sleep 1
15609         fi
15610         if $test -s ccsym.cpp; then
15611                 $test "$also" && echo " "
15612                 echo "Your C pre-processor ${also}defines the following symbols:"
15613                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15614                 also='further '
15615                 cppsymbols=`$cat ccsym.cpp`
15616                 cppsymbols=`echo $cppsymbols`
15617                 $test "$silent" || sleep 1
15618         fi
15619         if $test -s ccsym.own; then
15620                 $test "$also" && echo " "
15621                 echo "Your C compiler ${also}defines the following cpp symbols:"
15622                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15623                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15624                 ccsymbols=`$cat ccsym.own`
15625                 ccsymbols=`echo $ccsymbols`
15626                 $test "$silent" || sleep 1
15627         fi
15628 fi
15629 $rm -f ccsym* Cppsym.*
15630
15631 : see if this is a termio system
15632 val="$undef"
15633 val2="$undef"
15634 val3="$undef"
15635 if $test `./findhdr termios.h`; then
15636         set tcsetattr i_termios
15637         eval $inlibc
15638         val3="$i_termios"
15639 fi
15640 echo " "
15641 case "$val3" in
15642 "$define") echo "You have POSIX termios.h... good!" >&4;;
15643 *) if ./Cppsym pyr; then
15644                 case "`/bin/universe`" in
15645                 ucb) if $test `./findhdr sgtty.h`; then
15646                                 val2="$define"
15647                                 echo "<sgtty.h> found." >&4
15648                         else
15649                                 echo "System is pyramid with BSD universe."
15650                                 echo "<sgtty.h> not found--you could have problems." >&4
15651                         fi;;
15652                 *) if $test `./findhdr termio.h`; then
15653                                 val="$define"
15654                                 echo "<termio.h> found." >&4
15655                         else
15656                                 echo "System is pyramid with USG universe."
15657                                 echo "<termio.h> not found--you could have problems." >&4
15658                         fi;;
15659                 esac
15660         elif ./usg; then
15661                 if $test `./findhdr termio.h`; then
15662                         echo "<termio.h> found." >&4
15663                         val="$define"
15664                 elif $test `./findhdr sgtty.h`; then
15665                         echo "<sgtty.h> found." >&4
15666                         val2="$define"
15667                 else
15668 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15669                 fi
15670         else
15671                 if $test `./findhdr sgtty.h`; then
15672                         echo "<sgtty.h> found." >&4
15673                         val2="$define"
15674                 elif $test `./findhdr termio.h`; then
15675                         echo "<termio.h> found." >&4
15676                         val="$define"
15677                 else
15678 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15679                 fi
15680         fi;;
15681 esac
15682 set i_termio; eval $setvar
15683 val=$val2; set i_sgtty; eval $setvar
15684 val=$val3; set i_termios; eval $setvar
15685
15686 : see if this is a shadow.h system
15687 set shadow.h i_shadow
15688 eval $inhdr
15689
15690 : see if stddef is available
15691 set stddef.h i_stddef
15692 eval $inhdr
15693
15694 : see if this is a sunmath.h system
15695 set sunmath.h i_sunmath
15696 eval $inhdr
15697
15698 : see if sys/access.h is available
15699 set sys/access.h i_sysaccess
15700 eval $inhdr
15701
15702 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15703 set sys/filio.h i_sysfilio
15704 eval $inhdr
15705 echo " "
15706 if $test `./findhdr sys/ioctl.h`; then
15707         val="$define"
15708         echo '<sys/ioctl.h> found.' >&4
15709 else
15710         val="$undef"
15711         if $test $i_sysfilio = "$define"; then
15712             echo '<sys/ioctl.h> NOT found.' >&4
15713         else
15714                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15715                 $test $i_termio = "$define" && xxx="termio.h"
15716                 $test $i_termios = "$define" && xxx="termios.h"
15717 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15718         fi
15719 fi
15720 set i_sysioctl
15721 eval $setvar
15722
15723 : see if socket ioctl defs are in sys/sockio.h
15724 echo " "
15725 xxx=`./findhdr sys/sockio.h`
15726 if $test "$xxx"; then
15727         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15728                 val="$define"
15729                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15730         else
15731                 val="$undef"
15732                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15733         fi
15734 else
15735         val="$undef"
15736         $cat <<EOM
15737 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15738 EOM
15739 fi
15740 set i_syssockio
15741 eval $setvar
15742
15743
15744 : see if this is a syslog.h system
15745 set syslog.h i_syslog
15746 eval $inhdr
15747
15748
15749 : see if this is a sys/mode.h system
15750 set sys/mode.h i_sysmode
15751 eval $inhdr
15752
15753 : see if sys/resource.h has to be included
15754 set sys/resource.h i_sysresrc
15755 eval $inhdr
15756
15757 : see if sys/security.h is available
15758 set sys/security.h i_syssecrt
15759 eval $inhdr
15760
15761 : see if this is a sys/statvfs.h system
15762 set sys/statvfs.h i_sysstatvfs
15763 eval $inhdr
15764
15765 : see if this is a sys/un.h system
15766 set sys/un.h i_sysun
15767 eval $inhdr
15768
15769
15770 : see if this is a sys/utsname.h system
15771 set sys/utsname.h i_sysutsname
15772 eval $inhdr
15773
15774 : see if this is a syswait system
15775 set sys/wait.h i_syswait
15776 eval $inhdr
15777
15778 : see if this is a ustat.h system
15779 set ustat.h i_ustat
15780 eval $inhdr
15781
15782 : see if this is an utime system
15783 set utime.h i_utime
15784 eval $inhdr
15785
15786 : see if this is a values.h system
15787 set values.h i_values
15788 eval $inhdr
15789
15790 : see if this is a vfork system
15791 case "$d_vfork" in
15792 "$define")
15793         set vfork.h i_vfork
15794         eval $inhdr
15795         ;;
15796 *)
15797         i_vfork="$undef"
15798         ;;
15799 esac
15800
15801 : see if gdbm.h is available
15802 set gdbm.h t_gdbm
15803 eval $inhdr
15804 case "$t_gdbm" in
15805 $define)
15806         : see if gdbm_open exists
15807         set gdbm_open d_gdbm_open
15808         eval $inlibc
15809         case "$d_gdbm_open" in
15810         $undef)
15811                 t_gdbm="$undef"
15812                 echo "We won't be including <gdbm.h>"
15813                 ;;
15814         esac
15815         ;;
15816 esac
15817 val="$t_gdbm"
15818 set i_gdbm
15819 eval $setvar
15820
15821 echo " "
15822 echo "Looking for extensions..." >&4
15823 : If we are using the old config.sh, known_extensions may contain
15824 : old or inaccurate or duplicate values.
15825 known_extensions=''
15826 nonxs_extensions=''
15827 : We do not use find because it might not be available.
15828 : We do not just use MANIFEST because the user may have dropped
15829 : some additional extensions into the source tree and expect them
15830 : to be built.
15831
15832 : Function to recursively find available extensions, ignoring DynaLoader
15833 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15834 find_extensions='
15835     for xxx in *; do
15836        case "$xxx" in
15837            DynaLoader|dynaload) ;;
15838            *)
15839            if $test -f $xxx/$xxx.xs; then
15840                known_extensions="$known_extensions $1$xxx";
15841            elif $test -f $xxx/Makefile.PL; then
15842                nonxs_extensions="$nonxs_extensions $1$xxx";
15843            else
15844                if $test -d $xxx -a $# -lt 10; then
15845                    set $1$xxx/ $*;
15846                    cd $xxx;
15847                    eval $find_extensions;
15848                    cd ..;
15849                    shift;
15850                fi;
15851            fi
15852            ;;
15853        esac;
15854     done'
15855 tdir=`pwd`
15856 cd $rsrc/ext
15857 set X
15858 shift
15859 eval $find_extensions
15860 set X $nonxs_extensions
15861 shift
15862 nonxs_extensions="$*"
15863 set X $known_extensions
15864 shift
15865 known_extensions="$*"
15866 cd $tdir
15867
15868 : Now see which are supported on this system.
15869 avail_ext=''
15870 for xxx in $known_extensions ; do
15871         case "$xxx" in
15872         DB_File|db_file)
15873                 case "$i_db" in
15874                 $define) avail_ext="$avail_ext $xxx" ;;
15875                 esac
15876                 ;;
15877         GDBM_File|gdbm_fil)
15878                 case "$i_gdbm" in 
15879                 $define) avail_ext="$avail_ext $xxx" ;;
15880                 esac
15881                 ;;
15882         NDBM_File|ndbm_fil)
15883                 case "$i_ndbm" in
15884                 $define)
15885                     case "$osname-$use64bitint" in
15886                     hpux-define)
15887                         case "$libs" in
15888                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15889                         esac
15890                         ;;
15891                     *) avail_ext="$avail_ext $xxx" ;;
15892                     esac
15893                     ;;
15894                 esac
15895                 ;;
15896         ODBM_File|odbm_fil) 
15897                 case "${i_dbm}${i_rpcsvcdbm}" in
15898                 *"${define}"*)
15899                     case "$osname-$use64bitint" in
15900                     hpux-define)
15901                         case "$libs" in
15902                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15903                         esac
15904                         ;;
15905                     *) avail_ext="$avail_ext $xxx" ;;
15906                     esac
15907                     ;;
15908                 esac
15909                 ;;
15910         POSIX|posix)
15911                 case "$useposix" in
15912                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15913                 esac
15914                 ;;
15915         Opcode|opcode)
15916                 case "$useopcode" in
15917                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15918                 esac
15919                 ;;
15920         Socket|socket)
15921                 case "$d_socket" in 
15922                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15923                 esac
15924                 ;;
15925         Sys/Syslog|sys/syslog)
15926                 : XXX syslog requires socket
15927                 case "$d_socket" in 
15928                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15929                 esac
15930                 ;;
15931         Thread|thread)
15932                 case "$usethreads" in 
15933                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15934                 esac
15935                 ;;
15936         IPC/SysV|ipc/sysv)
15937                 : XXX Do we need a useipcsysv variable here
15938                 case "${d_msg}${d_sem}${d_shm}" in 
15939                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15940                 esac
15941                 ;;
15942         *)      avail_ext="$avail_ext $xxx"
15943                 ;;
15944         esac
15945 done
15946
15947 set X $avail_ext
15948 shift
15949 avail_ext="$*"
15950
15951 : Now see which nonxs extensions are supported on this system.
15952 : For now assume all are.
15953 nonxs_ext=''
15954 for xxx in $nonxs_extensions ; do
15955         case "$xxx" in
15956         *)      nonxs_ext="$nonxs_ext $xxx"
15957                 ;;
15958         esac
15959 done
15960
15961 set X $nonxs_ext
15962 shift
15963 nonxs_ext="$*"
15964
15965 case $usedl in
15966 $define)
15967         $cat <<EOM
15968 A number of extensions are supplied with $package.  You may choose to
15969 compile these extensions for dynamic loading (the default), compile
15970 them into the $package executable (static loading), or not include
15971 them at all.  Answer "none" to include no extensions.
15972 Note that DynaLoader is always built and need not be mentioned here.
15973
15974 EOM
15975         case "$dynamic_ext" in
15976         '') dflt="$avail_ext" ;;
15977         *)      dflt="$dynamic_ext"
15978                 # Perhaps we are reusing an old out-of-date config.sh.
15979                 case "$hint" in
15980                 previous)
15981                         if test X"$dynamic_ext" != X"$avail_ext"; then
15982                                 $cat <<EOM
15983 NOTICE:  Your previous config.sh list may be incorrect. 
15984 The extensions now available to you are 
15985         ${avail_ext}
15986 but the default list from your previous config.sh is
15987         ${dynamic_ext} 
15988
15989 EOM
15990                         fi
15991                         ;;
15992                 esac
15993                 ;;
15994         esac
15995         case "$dflt" in
15996         '')     dflt=none;;
15997         esac
15998         rp="What extensions do you wish to load dynamically?"
15999         . ./myread
16000         case "$ans" in
16001         none) dynamic_ext=' ' ;;
16002         *) dynamic_ext="$ans" ;;
16003         esac
16004
16005         case "$static_ext" in
16006         '')
16007                 : Exclude those already listed in dynamic linking
16008                 dflt=''
16009                 for xxx in $avail_ext; do
16010                         case " $dynamic_ext " in
16011                         *" $xxx "*) ;;
16012                         *) dflt="$dflt $xxx" ;;
16013                         esac
16014                 done
16015                 set X $dflt
16016                 shift
16017                 dflt="$*"
16018                 ;;
16019         *)  dflt="$static_ext" 
16020                 ;;
16021         esac
16022
16023         case "$dflt" in
16024         '')     dflt=none;;
16025         esac
16026         rp="What extensions do you wish to load statically?"
16027         . ./myread
16028         case "$ans" in
16029         none) static_ext=' ' ;;
16030         *) static_ext="$ans" ;;
16031         esac
16032         ;;
16033 *)
16034         $cat <<EOM
16035 A number of extensions are supplied with $package.  Answer "none" 
16036 to include no extensions. 
16037 Note that DynaLoader is always built and need not be mentioned here.
16038
16039 EOM
16040         case "$static_ext" in
16041         '') dflt="$avail_ext" ;;
16042         *)      dflt="$static_ext"
16043                 # Perhaps we are reusing an old out-of-date config.sh.
16044                 case "$hint" in
16045                 previous)
16046                         if test X"$static_ext" != X"$avail_ext"; then
16047                                 $cat <<EOM
16048 NOTICE:  Your previous config.sh list may be incorrect. 
16049 The extensions now available to you are 
16050         ${avail_ext}
16051 but the default list from your previous config.sh is
16052         ${static_ext} 
16053
16054 EOM
16055                         fi
16056                         ;;
16057                 esac
16058                 ;;
16059         esac
16060         : Exclude those that are not xs extensions
16061         case "$dflt" in
16062         '')     dflt=none;;
16063         esac
16064         rp="What extensions do you wish to include?"
16065         . ./myread
16066         case "$ans" in
16067         none) static_ext=' ' ;;
16068         *) static_ext="$ans" ;;
16069         esac
16070         ;;
16071 esac
16072
16073 set X $dynamic_ext $static_ext $nonxs_ext
16074 shift
16075 extensions="$*"
16076
16077 : Remove libraries needed only for extensions
16078 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16079 : The exception is SunOS 4.x, which needs them.
16080 case "${osname}X${osvers}" in
16081 sunos*X4*)
16082     perllibs="$libs"
16083     ;;
16084 *) case "$usedl" in
16085     $define|true|[yY]*)
16086             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16087             shift
16088             perllibs="$*"
16089             ;;
16090     *)  perllibs="$libs"
16091             ;;
16092     esac
16093     ;;
16094 esac
16095
16096 : Remove build directory name from cppstdin so it can be used from
16097 : either the present location or the final installed location.
16098 echo " "
16099 : Get out of the UU directory to get correct path name.
16100 cd ..
16101 case "$cppstdin" in
16102 `pwd`/cppstdin)
16103         echo "Stripping down cppstdin path name"
16104         cppstdin=cppstdin
16105         ;;
16106 esac
16107 cd UU
16108
16109 : end of configuration questions
16110 echo " "
16111 echo "End of configuration questions."
16112 echo " "
16113
16114 : back to where it started
16115 if test -d ../UU; then
16116         cd ..
16117 fi
16118
16119 : configuration may be patched via a 'config.over' file
16120 if $test -f config.over; then
16121         echo " "
16122         dflt=y
16123         rp='I see a config.over file.  Do you wish to load it?'
16124         . UU/myread
16125         case "$ans" in
16126         n*) echo "OK, I'll ignore it.";;
16127         *)      . ./config.over
16128                 echo "Configuration override changes have been loaded."
16129                 ;;
16130         esac
16131 fi
16132
16133 : in case they want portability, strip down executable paths
16134 case "$d_portable" in
16135 "$define")
16136         echo " "
16137         echo "Stripping down executable paths..." >&4
16138         for file in $loclist $trylist; do
16139                 eval temp=\$$file
16140                 eval $file=`basename $temp`
16141         done
16142         ;;
16143 esac
16144
16145 : create config.sh file
16146 echo " "
16147 echo "Creating config.sh..." >&4
16148 $spitshell <<EOT >config.sh
16149 $startsh
16150 #
16151 # This file was produced by running the Configure script. It holds all the
16152 # definitions figured out by Configure. Should you modify one of these values,
16153 # do not forget to propagate your changes by running "Configure -der". You may
16154 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16155 #
16156
16157 # Package name      : $package
16158 # Source directory  : $src
16159 # Configuration time: $cf_time
16160 # Configured by     : $cf_by
16161 # Target system     : $myuname
16162
16163 Author='$Author'
16164 Date='$Date'
16165 Header='$Header'
16166 Id='$Id'
16167 Locker='$Locker'
16168 Log='$Log'
16169 Mcc='$Mcc'
16170 RCSfile='$RCSfile'
16171 Revision='$Revision'
16172 Source='$Source'
16173 State='$State'
16174 _a='$_a'
16175 _exe='$_exe'
16176 _o='$_o'
16177 afs='$afs'
16178 afsroot='$afsroot'
16179 alignbytes='$alignbytes'
16180 ansi2knr='$ansi2knr'
16181 aphostname='$aphostname'
16182 api_revision='$api_revision'
16183 api_subversion='$api_subversion'
16184 api_version='$api_version'
16185 api_versionstring='$api_versionstring'
16186 ar='$ar'
16187 archlib='$archlib'
16188 archlibexp='$archlibexp'
16189 archname64='$archname64'
16190 archname='$archname'
16191 archobjs='$archobjs'
16192 awk='$awk'
16193 baserev='$baserev'
16194 bash='$bash'
16195 bin='$bin'
16196 bincompat5005='$bincompat5005'
16197 binexp='$binexp'
16198 bison='$bison'
16199 byacc='$byacc'
16200 byteorder='$byteorder'
16201 c='$c'
16202 castflags='$castflags'
16203 cat='$cat'
16204 cc='$cc'
16205 cccdlflags='$cccdlflags'
16206 ccdlflags='$ccdlflags'
16207 ccflags='$ccflags'
16208 ccflags_uselargefiles='$ccflags_uselargefiles'
16209 ccname='$ccname'
16210 ccsymbols='$ccsymbols'
16211 ccversion='$ccversion'
16212 cf_by='$cf_by'
16213 cf_email='$cf_email'
16214 cf_time='$cf_time'
16215 charsize='$charsize'
16216 chgrp='$chgrp'
16217 chmod='$chmod'
16218 chown='$chown'
16219 clocktype='$clocktype'
16220 comm='$comm'
16221 compress='$compress'
16222 contains='$contains'
16223 cp='$cp'
16224 cpio='$cpio'
16225 cpp='$cpp'
16226 cpp_stuff='$cpp_stuff'
16227 cppccsymbols='$cppccsymbols'
16228 cppflags='$cppflags'
16229 cpplast='$cpplast'
16230 cppminus='$cppminus'
16231 cpprun='$cpprun'
16232 cppstdin='$cppstdin'
16233 cppsymbols='$cppsymbols'
16234 crosscompile='$crosscompile'
16235 cryptlib='$cryptlib'
16236 csh='$csh'
16237 d_Gconvert='$d_Gconvert'
16238 d_PRIEUldbl='$d_PRIEUldbl'
16239 d_PRIFUldbl='$d_PRIFUldbl'
16240 d_PRIGUldbl='$d_PRIGUldbl'
16241 d_PRIXU64='$d_PRIXU64'
16242 d_PRId64='$d_PRId64'
16243 d_PRIeldbl='$d_PRIeldbl'
16244 d_PRIfldbl='$d_PRIfldbl'
16245 d_PRIgldbl='$d_PRIgldbl'
16246 d_PRIi64='$d_PRIi64'
16247 d_PRIo64='$d_PRIo64'
16248 d_PRIu64='$d_PRIu64'
16249 d_PRIx64='$d_PRIx64'
16250 d_SCNfldbl='$d_SCNfldbl'
16251 d__fwalk='$d__fwalk'
16252 d_access='$d_access'
16253 d_accessx='$d_accessx'
16254 d_alarm='$d_alarm'
16255 d_archlib='$d_archlib'
16256 d_atolf='$d_atolf'
16257 d_atoll='$d_atoll'
16258 d_attribut='$d_attribut'
16259 d_bcmp='$d_bcmp'
16260 d_bcopy='$d_bcopy'
16261 d_bincompat5005='$d_bincompat5005'
16262 d_bsd='$d_bsd'
16263 d_bsdgetpgrp='$d_bsdgetpgrp'
16264 d_bsdsetpgrp='$d_bsdsetpgrp'
16265 d_bzero='$d_bzero'
16266 d_casti32='$d_casti32'
16267 d_castneg='$d_castneg'
16268 d_charvspr='$d_charvspr'
16269 d_chown='$d_chown'
16270 d_chroot='$d_chroot'
16271 d_chsize='$d_chsize'
16272 d_closedir='$d_closedir'
16273 d_cmsghdr_s='$d_cmsghdr_s'
16274 d_const='$d_const'
16275 d_crypt='$d_crypt'
16276 d_csh='$d_csh'
16277 d_cuserid='$d_cuserid'
16278 d_dbl_dig='$d_dbl_dig'
16279 d_dbminitproto='$d_dbminitproto'
16280 d_difftime='$d_difftime'
16281 d_dirnamlen='$d_dirnamlen'
16282 d_dlerror='$d_dlerror'
16283 d_dlopen='$d_dlopen'
16284 d_dlsymun='$d_dlsymun'
16285 d_dosuid='$d_dosuid'
16286 d_drand48proto='$d_drand48proto'
16287 d_dup2='$d_dup2'
16288 d_eaccess='$d_eaccess'
16289 d_endgrent='$d_endgrent'
16290 d_endhent='$d_endhent'
16291 d_endnent='$d_endnent'
16292 d_endpent='$d_endpent'
16293 d_endpwent='$d_endpwent'
16294 d_endsent='$d_endsent'
16295 d_eofnblk='$d_eofnblk'
16296 d_eunice='$d_eunice'
16297 d_fchmod='$d_fchmod'
16298 d_fchown='$d_fchown'
16299 d_fcntl='$d_fcntl'
16300 d_fcntl_can_lock='$d_fcntl_can_lock'
16301 d_fd_macros='$d_fd_macros'
16302 d_fd_set='$d_fd_set'
16303 d_fds_bits='$d_fds_bits'
16304 d_fgetpos='$d_fgetpos'
16305 d_flexfnam='$d_flexfnam'
16306 d_flock='$d_flock'
16307 d_flockproto='$d_flockproto'
16308 d_fork='$d_fork'
16309 d_fpathconf='$d_fpathconf'
16310 d_fpos64_t='$d_fpos64_t'
16311 d_frexpl='$d_frexpl'
16312 d_fs_data_s='$d_fs_data_s'
16313 d_fseeko='$d_fseeko'
16314 d_fsetpos='$d_fsetpos'
16315 d_fstatfs='$d_fstatfs'
16316 d_fstatvfs='$d_fstatvfs'
16317 d_fsync='$d_fsync'
16318 d_ftello='$d_ftello'
16319 d_ftime='$d_ftime'
16320 d_getcwd='$d_getcwd'
16321 d_getespwnam='$d_getespwnam'
16322 d_getfsstat='$d_getfsstat'
16323 d_getgrent='$d_getgrent'
16324 d_getgrps='$d_getgrps'
16325 d_gethbyaddr='$d_gethbyaddr'
16326 d_gethbyname='$d_gethbyname'
16327 d_gethent='$d_gethent'
16328 d_gethname='$d_gethname'
16329 d_gethostprotos='$d_gethostprotos'
16330 d_getitimer='$d_getitimer'
16331 d_getlogin='$d_getlogin'
16332 d_getmnt='$d_getmnt'
16333 d_getmntent='$d_getmntent'
16334 d_getnbyaddr='$d_getnbyaddr'
16335 d_getnbyname='$d_getnbyname'
16336 d_getnent='$d_getnent'
16337 d_getnetprotos='$d_getnetprotos'
16338 d_getpagsz='$d_getpagsz'
16339 d_getpbyname='$d_getpbyname'
16340 d_getpbynumber='$d_getpbynumber'
16341 d_getpent='$d_getpent'
16342 d_getpgid='$d_getpgid'
16343 d_getpgrp2='$d_getpgrp2'
16344 d_getpgrp='$d_getpgrp'
16345 d_getppid='$d_getppid'
16346 d_getprior='$d_getprior'
16347 d_getprotoprotos='$d_getprotoprotos'
16348 d_getprpwnam='$d_getprpwnam'
16349 d_getpwent='$d_getpwent'
16350 d_getsbyname='$d_getsbyname'
16351 d_getsbyport='$d_getsbyport'
16352 d_getsent='$d_getsent'
16353 d_getservprotos='$d_getservprotos'
16354 d_getspnam='$d_getspnam'
16355 d_gettimeod='$d_gettimeod'
16356 d_gnulibc='$d_gnulibc'
16357 d_grpasswd='$d_grpasswd'
16358 d_hasmntopt='$d_hasmntopt'
16359 d_htonl='$d_htonl'
16360 d_iconv='$d_iconv'
16361 d_index='$d_index'
16362 d_inetaton='$d_inetaton'
16363 d_int64_t='$d_int64_t'
16364 d_isascii='$d_isascii'
16365 d_isnan='$d_isnan'
16366 d_isnanl='$d_isnanl'
16367 d_killpg='$d_killpg'
16368 d_lchown='$d_lchown'
16369 d_ldbl_dig='$d_ldbl_dig'
16370 d_link='$d_link'
16371 d_locconv='$d_locconv'
16372 d_lockf='$d_lockf'
16373 d_longdbl='$d_longdbl'
16374 d_longlong='$d_longlong'
16375 d_lseekproto='$d_lseekproto'
16376 d_lstat='$d_lstat'
16377 d_madvise='$d_madvise'
16378 d_mblen='$d_mblen'
16379 d_mbstowcs='$d_mbstowcs'
16380 d_mbtowc='$d_mbtowc'
16381 d_memchr='$d_memchr'
16382 d_memcmp='$d_memcmp'
16383 d_memcpy='$d_memcpy'
16384 d_memmove='$d_memmove'
16385 d_memset='$d_memset'
16386 d_mkdir='$d_mkdir'
16387 d_mkdtemp='$d_mkdtemp'
16388 d_mkfifo='$d_mkfifo'
16389 d_mkstemp='$d_mkstemp'
16390 d_mkstemps='$d_mkstemps'
16391 d_mktime='$d_mktime'
16392 d_mmap='$d_mmap'
16393 d_modfl='$d_modfl'
16394 d_mprotect='$d_mprotect'
16395 d_msg='$d_msg'
16396 d_msg_ctrunc='$d_msg_ctrunc'
16397 d_msg_dontroute='$d_msg_dontroute'
16398 d_msg_oob='$d_msg_oob'
16399 d_msg_peek='$d_msg_peek'
16400 d_msg_proxy='$d_msg_proxy'
16401 d_msgctl='$d_msgctl'
16402 d_msgget='$d_msgget'
16403 d_msghdr_s='$d_msghdr_s'
16404 d_msgrcv='$d_msgrcv'
16405 d_msgsnd='$d_msgsnd'
16406 d_msync='$d_msync'
16407 d_munmap='$d_munmap'
16408 d_mymalloc='$d_mymalloc'
16409 d_nice='$d_nice'
16410 d_nv_preserves_uv='$d_nv_preserves_uv'
16411 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16412 d_off64_t='$d_off64_t'
16413 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16414 d_oldpthreads='$d_oldpthreads'
16415 d_oldsock='$d_oldsock'
16416 d_open3='$d_open3'
16417 d_pathconf='$d_pathconf'
16418 d_pause='$d_pause'
16419 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16420 d_phostname='$d_phostname'
16421 d_pipe='$d_pipe'
16422 d_poll='$d_poll'
16423 d_portable='$d_portable'
16424 d_pthread_yield='$d_pthread_yield'
16425 d_pwage='$d_pwage'
16426 d_pwchange='$d_pwchange'
16427 d_pwclass='$d_pwclass'
16428 d_pwcomment='$d_pwcomment'
16429 d_pwexpire='$d_pwexpire'
16430 d_pwgecos='$d_pwgecos'
16431 d_pwpasswd='$d_pwpasswd'
16432 d_pwquota='$d_pwquota'
16433 d_qgcvt='$d_qgcvt'
16434 d_quad='$d_quad'
16435 d_readdir='$d_readdir'
16436 d_readlink='$d_readlink'
16437 d_readv='$d_readv'
16438 d_realpath='$d_realpath'
16439 d_recvmsg='$d_recvmsg'
16440 d_rename='$d_rename'
16441 d_rewinddir='$d_rewinddir'
16442 d_rmdir='$d_rmdir'
16443 d_safebcpy='$d_safebcpy'
16444 d_safemcpy='$d_safemcpy'
16445 d_sanemcmp='$d_sanemcmp'
16446 d_sbrkproto='$d_sbrkproto'
16447 d_sched_yield='$d_sched_yield'
16448 d_scm_rights='$d_scm_rights'
16449 d_seekdir='$d_seekdir'
16450 d_select='$d_select'
16451 d_sem='$d_sem'
16452 d_semctl='$d_semctl'
16453 d_semctl_semid_ds='$d_semctl_semid_ds'
16454 d_semctl_semun='$d_semctl_semun'
16455 d_semget='$d_semget'
16456 d_semop='$d_semop'
16457 d_sendmsg='$d_sendmsg'
16458 d_setegid='$d_setegid'
16459 d_seteuid='$d_seteuid'
16460 d_setgrent='$d_setgrent'
16461 d_setgrps='$d_setgrps'
16462 d_sethent='$d_sethent'
16463 d_setitimer='$d_setitimer'
16464 d_setlinebuf='$d_setlinebuf'
16465 d_setlocale='$d_setlocale'
16466 d_setnent='$d_setnent'
16467 d_setpent='$d_setpent'
16468 d_setpgid='$d_setpgid'
16469 d_setpgrp2='$d_setpgrp2'
16470 d_setpgrp='$d_setpgrp'
16471 d_setprior='$d_setprior'
16472 d_setproctitle='$d_setproctitle'
16473 d_setpwent='$d_setpwent'
16474 d_setregid='$d_setregid'
16475 d_setresgid='$d_setresgid'
16476 d_setresuid='$d_setresuid'
16477 d_setreuid='$d_setreuid'
16478 d_setrgid='$d_setrgid'
16479 d_setruid='$d_setruid'
16480 d_setsent='$d_setsent'
16481 d_setsid='$d_setsid'
16482 d_setvbuf='$d_setvbuf'
16483 d_sfio='$d_sfio'
16484 d_shm='$d_shm'
16485 d_shmat='$d_shmat'
16486 d_shmatprototype='$d_shmatprototype'
16487 d_shmctl='$d_shmctl'
16488 d_shmdt='$d_shmdt'
16489 d_shmget='$d_shmget'
16490 d_sigaction='$d_sigaction'
16491 d_sigprocmask='$d_sigprocmask'
16492 d_sigsetjmp='$d_sigsetjmp'
16493 d_sockatmark='$d_sockatmark'
16494 d_sockatmarkproto='$d_sockatmarkproto'
16495 d_socket='$d_socket'
16496 d_socklen_t='$d_socklen_t'
16497 d_sockpair='$d_sockpair'
16498 d_socks5_init='$d_socks5_init'
16499 d_sqrtl='$d_sqrtl'
16500 d_sresgproto='$d_sresgproto'
16501 d_sresuproto='$d_sresuproto'
16502 d_statblks='$d_statblks'
16503 d_statfs_f_flags='$d_statfs_f_flags'
16504 d_statfs_s='$d_statfs_s'
16505 d_statvfs='$d_statvfs'
16506 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16507 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16508 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16509 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16510 d_stdio_stream_array='$d_stdio_stream_array'
16511 d_stdiobase='$d_stdiobase'
16512 d_stdstdio='$d_stdstdio'
16513 d_strchr='$d_strchr'
16514 d_strcoll='$d_strcoll'
16515 d_strctcpy='$d_strctcpy'
16516 d_strerrm='$d_strerrm'
16517 d_strerror='$d_strerror'
16518 d_strftime='$d_strftime'
16519 d_strtod='$d_strtod'
16520 d_strtol='$d_strtol'
16521 d_strtold='$d_strtold'
16522 d_strtoll='$d_strtoll'
16523 d_strtoq='$d_strtoq'
16524 d_strtoul='$d_strtoul'
16525 d_strtoull='$d_strtoull'
16526 d_strtouq='$d_strtouq'
16527 d_strxfrm='$d_strxfrm'
16528 d_suidsafe='$d_suidsafe'
16529 d_symlink='$d_symlink'
16530 d_syscall='$d_syscall'
16531 d_syscallproto='$d_syscallproto'
16532 d_sysconf='$d_sysconf'
16533 d_sysernlst='$d_sysernlst'
16534 d_syserrlst='$d_syserrlst'
16535 d_system='$d_system'
16536 d_tcgetpgrp='$d_tcgetpgrp'
16537 d_tcsetpgrp='$d_tcsetpgrp'
16538 d_telldir='$d_telldir'
16539 d_telldirproto='$d_telldirproto'
16540 d_time='$d_time'
16541 d_times='$d_times'
16542 d_truncate='$d_truncate'
16543 d_tzname='$d_tzname'
16544 d_u32align='$d_u32align'
16545 d_ualarm='$d_ualarm'
16546 d_umask='$d_umask'
16547 d_uname='$d_uname'
16548 d_union_semun='$d_union_semun'
16549 d_usleep='$d_usleep'
16550 d_usleepproto='$d_usleepproto'
16551 d_ustat='$d_ustat'
16552 d_vendorarch='$d_vendorarch'
16553 d_vendorbin='$d_vendorbin'
16554 d_vendorlib='$d_vendorlib'
16555 d_vfork='$d_vfork'
16556 d_void_closedir='$d_void_closedir'
16557 d_voidsig='$d_voidsig'
16558 d_voidtty='$d_voidtty'
16559 d_volatile='$d_volatile'
16560 d_vprintf='$d_vprintf'
16561 d_wait4='$d_wait4'
16562 d_waitpid='$d_waitpid'
16563 d_wcstombs='$d_wcstombs'
16564 d_wctomb='$d_wctomb'
16565 d_writev='$d_writev'
16566 d_xenix='$d_xenix'
16567 date='$date'
16568 db_hashtype='$db_hashtype'
16569 db_prefixtype='$db_prefixtype'
16570 db_version_major='$db_version_major'
16571 db_version_minor='$db_version_minor'
16572 db_version_patch='$db_version_patch'
16573 defvoidused='$defvoidused'
16574 direntrytype='$direntrytype'
16575 dlext='$dlext'
16576 dlsrc='$dlsrc'
16577 doublesize='$doublesize'
16578 drand01='$drand01'
16579 dynamic_ext='$dynamic_ext'
16580 eagain='$eagain'
16581 ebcdic='$ebcdic'
16582 echo='$echo'
16583 egrep='$egrep'
16584 emacs='$emacs'
16585 eunicefix='$eunicefix'
16586 exe_ext='$exe_ext'
16587 expr='$expr'
16588 extensions='$extensions'
16589 fflushNULL='$fflushNULL'
16590 fflushall='$fflushall'
16591 find='$find'
16592 firstmakefile='$firstmakefile'
16593 flex='$flex'
16594 fpossize='$fpossize'
16595 fpostype='$fpostype'
16596 freetype='$freetype'
16597 full_ar='$full_ar'
16598 full_csh='$full_csh'
16599 full_sed='$full_sed'
16600 gccosandvers='$gccosandvers'
16601 gccversion='$gccversion'
16602 gidformat='$gidformat'
16603 gidsign='$gidsign'
16604 gidsize='$gidsize'
16605 gidtype='$gidtype'
16606 glibpth='$glibpth'
16607 grep='$grep'
16608 groupcat='$groupcat'
16609 groupstype='$groupstype'
16610 gzip='$gzip'
16611 h_fcntl='$h_fcntl'
16612 h_sysfile='$h_sysfile'
16613 hint='$hint'
16614 hostcat='$hostcat'
16615 i16size='$i16size'
16616 i16type='$i16type'
16617 i32size='$i32size'
16618 i32type='$i32type'
16619 i64size='$i64size'
16620 i64type='$i64type'
16621 i8size='$i8size'
16622 i8type='$i8type'
16623 i_arpainet='$i_arpainet'
16624 i_bsdioctl='$i_bsdioctl'
16625 i_db='$i_db'
16626 i_dbm='$i_dbm'
16627 i_dirent='$i_dirent'
16628 i_dld='$i_dld'
16629 i_dlfcn='$i_dlfcn'
16630 i_fcntl='$i_fcntl'
16631 i_float='$i_float'
16632 i_gdbm='$i_gdbm'
16633 i_grp='$i_grp'
16634 i_iconv='$i_iconv'
16635 i_ieeefp='$i_ieeefp'
16636 i_inttypes='$i_inttypes'
16637 i_libutil='$i_libutil'
16638 i_limits='$i_limits'
16639 i_locale='$i_locale'
16640 i_machcthr='$i_machcthr'
16641 i_malloc='$i_malloc'
16642 i_math='$i_math'
16643 i_memory='$i_memory'
16644 i_mntent='$i_mntent'
16645 i_ndbm='$i_ndbm'
16646 i_netdb='$i_netdb'
16647 i_neterrno='$i_neterrno'
16648 i_netinettcp='$i_netinettcp'
16649 i_niin='$i_niin'
16650 i_poll='$i_poll'
16651 i_prot='$i_prot'
16652 i_pthread='$i_pthread'
16653 i_pwd='$i_pwd'
16654 i_rpcsvcdbm='$i_rpcsvcdbm'
16655 i_sfio='$i_sfio'
16656 i_sgtty='$i_sgtty'
16657 i_shadow='$i_shadow'
16658 i_socks='$i_socks'
16659 i_stdarg='$i_stdarg'
16660 i_stddef='$i_stddef'
16661 i_stdlib='$i_stdlib'
16662 i_string='$i_string'
16663 i_sunmath='$i_sunmath'
16664 i_sysaccess='$i_sysaccess'
16665 i_sysdir='$i_sysdir'
16666 i_sysfile='$i_sysfile'
16667 i_sysfilio='$i_sysfilio'
16668 i_sysin='$i_sysin'
16669 i_sysioctl='$i_sysioctl'
16670 i_syslog='$i_syslog'
16671 i_sysmman='$i_sysmman'
16672 i_sysmode='$i_sysmode'
16673 i_sysmount='$i_sysmount'
16674 i_sysndir='$i_sysndir'
16675 i_sysparam='$i_sysparam'
16676 i_sysresrc='$i_sysresrc'
16677 i_syssecrt='$i_syssecrt'
16678 i_sysselct='$i_sysselct'
16679 i_syssockio='$i_syssockio'
16680 i_sysstat='$i_sysstat'
16681 i_sysstatfs='$i_sysstatfs'
16682 i_sysstatvfs='$i_sysstatvfs'
16683 i_systime='$i_systime'
16684 i_systimek='$i_systimek'
16685 i_systimes='$i_systimes'
16686 i_systypes='$i_systypes'
16687 i_sysuio='$i_sysuio'
16688 i_sysun='$i_sysun'
16689 i_sysutsname='$i_sysutsname'
16690 i_sysvfs='$i_sysvfs'
16691 i_syswait='$i_syswait'
16692 i_termio='$i_termio'
16693 i_termios='$i_termios'
16694 i_time='$i_time'
16695 i_unistd='$i_unistd'
16696 i_ustat='$i_ustat'
16697 i_utime='$i_utime'
16698 i_values='$i_values'
16699 i_varargs='$i_varargs'
16700 i_varhdr='$i_varhdr'
16701 i_vfork='$i_vfork'
16702 ignore_versioned_solibs='$ignore_versioned_solibs'
16703 inc_version_list='$inc_version_list'
16704 inc_version_list_init='$inc_version_list_init'
16705 incpath='$incpath'
16706 inews='$inews'
16707 installarchlib='$installarchlib'
16708 installbin='$installbin'
16709 installman1dir='$installman1dir'
16710 installman3dir='$installman3dir'
16711 installprefix='$installprefix'
16712 installprefixexp='$installprefixexp'
16713 installprivlib='$installprivlib'
16714 installscript='$installscript'
16715 installsitearch='$installsitearch'
16716 installsitebin='$installsitebin'
16717 installsitelib='$installsitelib'
16718 installstyle='$installstyle'
16719 installusrbinperl='$installusrbinperl'
16720 installvendorarch='$installvendorarch'
16721 installvendorbin='$installvendorbin'
16722 installvendorlib='$installvendorlib'
16723 intsize='$intsize'
16724 issymlink='$issymlink'
16725 ivdformat='$ivdformat'
16726 ivsize='$ivsize'
16727 ivtype='$ivtype'
16728 known_extensions='$known_extensions'
16729 ksh='$ksh'
16730 ld='$ld'
16731 lddlflags='$lddlflags'
16732 ldflags='$ldflags'
16733 ldflags_uselargefiles='$ldflags_uselargefiles'
16734 ldlibpthname='$ldlibpthname'
16735 less='$less'
16736 lib_ext='$lib_ext'
16737 libc='$libc'
16738 libperl='$libperl'
16739 libpth='$libpth'
16740 libs='$libs'
16741 libsdirs='$libsdirs'
16742 libsfiles='$libsfiles'
16743 libsfound='$libsfound'
16744 libspath='$libspath'
16745 libswanted='$libswanted'
16746 libswanted_uselargefiles='$libswanted_uselargefiles'
16747 line='$line'
16748 lint='$lint'
16749 lkflags='$lkflags'
16750 ln='$ln'
16751 lns='$lns'
16752 locincpth='$locincpth'
16753 loclibpth='$loclibpth'
16754 longdblsize='$longdblsize'
16755 longlongsize='$longlongsize'
16756 longsize='$longsize'
16757 lp='$lp'
16758 lpr='$lpr'
16759 ls='$ls'
16760 lseeksize='$lseeksize'
16761 lseektype='$lseektype'
16762 mail='$mail'
16763 mailx='$mailx'
16764 make='$make'
16765 make_set_make='$make_set_make'
16766 mallocobj='$mallocobj'
16767 mallocsrc='$mallocsrc'
16768 malloctype='$malloctype'
16769 man1dir='$man1dir'
16770 man1direxp='$man1direxp'
16771 man1ext='$man1ext'
16772 man3dir='$man3dir'
16773 man3direxp='$man3direxp'
16774 man3ext='$man3ext'
16775 mips_type='$mips_type'
16776 mkdir='$mkdir'
16777 mmaptype='$mmaptype'
16778 modetype='$modetype'
16779 more='$more'
16780 multiarch='$multiarch'
16781 mv='$mv'
16782 myarchname='$myarchname'
16783 mydomain='$mydomain'
16784 myhostname='$myhostname'
16785 myuname='$myuname'
16786 n='$n'
16787 need_va_copy='$need_va_copy'
16788 netdb_hlen_type='$netdb_hlen_type'
16789 netdb_host_type='$netdb_host_type'
16790 netdb_name_type='$netdb_name_type'
16791 netdb_net_type='$netdb_net_type'
16792 nm='$nm'
16793 nm_opt='$nm_opt'
16794 nm_so_opt='$nm_so_opt'
16795 nonxs_ext='$nonxs_ext'
16796 nroff='$nroff'
16797 nvEUformat='$nvEUformat'
16798 nvFUformat='$nvFUformat'
16799 nvGUformat='$nvGUformat'
16800 nveformat='$nveformat'
16801 nvfformat='$nvfformat'
16802 nvgformat='$nvgformat'
16803 nvsize='$nvsize'
16804 nvtype='$nvtype'
16805 o_nonblock='$o_nonblock'
16806 obj_ext='$obj_ext'
16807 old_pthread_create_joinable='$old_pthread_create_joinable'
16808 optimize='$optimize'
16809 orderlib='$orderlib'
16810 osname='$osname'
16811 osvers='$osvers'
16812 otherlibdirs='$otherlibdirs'
16813 package='$package'
16814 pager='$pager'
16815 passcat='$passcat'
16816 patchlevel='$patchlevel'
16817 path_sep='$path_sep'
16818 perl5='$perl5'
16819 perl='$perl'
16820 perl_patchlevel='$perl_patchlevel'
16821 perladmin='$perladmin'
16822 perllibs='$perllibs'
16823 perlpath='$perlpath'
16824 pg='$pg'
16825 phostname='$phostname'
16826 pidtype='$pidtype'
16827 plibpth='$plibpth'
16828 pm_apiversion='$pm_apiversion'
16829 pmake='$pmake'
16830 pr='$pr'
16831 prefix='$prefix'
16832 prefixexp='$prefixexp'
16833 privlib='$privlib'
16834 privlibexp='$privlibexp'
16835 prototype='$prototype'
16836 ptrsize='$ptrsize'
16837 quadkind='$quadkind'
16838 quadtype='$quadtype'
16839 randbits='$randbits'
16840 randfunc='$randfunc'
16841 randseedtype='$randseedtype'
16842 ranlib='$ranlib'
16843 rd_nodata='$rd_nodata'
16844 revision='$revision'
16845 rm='$rm'
16846 rmail='$rmail'
16847 runnm='$runnm'
16848 sPRIEUldbl='$sPRIEUldbl'
16849 sPRIFUldbl='$sPRIFUldbl'
16850 sPRIGUldbl='$sPRIGUldbl'
16851 sPRIXU64='$sPRIXU64'
16852 sPRId64='$sPRId64'
16853 sPRIeldbl='$sPRIeldbl'
16854 sPRIfldbl='$sPRIfldbl'
16855 sPRIgldbl='$sPRIgldbl'
16856 sPRIi64='$sPRIi64'
16857 sPRIo64='$sPRIo64'
16858 sPRIu64='$sPRIu64'
16859 sPRIx64='$sPRIx64'
16860 sSCNfldbl='$sSCNfldbl'
16861 sched_yield='$sched_yield'
16862 scriptdir='$scriptdir'
16863 scriptdirexp='$scriptdirexp'
16864 sed='$sed'
16865 seedfunc='$seedfunc'
16866 selectminbits='$selectminbits'
16867 selecttype='$selecttype'
16868 sendmail='$sendmail'
16869 sh='$sh'
16870 shar='$shar'
16871 sharpbang='$sharpbang'
16872 shmattype='$shmattype'
16873 shortsize='$shortsize'
16874 shrpenv='$shrpenv'
16875 shsharp='$shsharp'
16876 sig_count='$sig_count'
16877 sig_name='$sig_name'
16878 sig_name_init='$sig_name_init'
16879 sig_num='$sig_num'
16880 sig_num_init='$sig_num_init'
16881 sig_size='$sig_size'
16882 signal_t='$signal_t'
16883 sitearch='$sitearch'
16884 sitearchexp='$sitearchexp'
16885 sitebin='$sitebin'
16886 sitebinexp='$sitebinexp'
16887 sitelib='$sitelib'
16888 sitelib_stem='$sitelib_stem'
16889 sitelibexp='$sitelibexp'
16890 siteprefix='$siteprefix'
16891 siteprefixexp='$siteprefixexp'
16892 sizesize='$sizesize'
16893 sizetype='$sizetype'
16894 sleep='$sleep'
16895 smail='$smail'
16896 so='$so'
16897 sockethdr='$sockethdr'
16898 socketlib='$socketlib'
16899 socksizetype='$socksizetype'
16900 sort='$sort'
16901 spackage='$spackage'
16902 spitshell='$spitshell'
16903 src='$src'
16904 ssizetype='$ssizetype'
16905 startperl='$startperl'
16906 startsh='$startsh'
16907 static_ext='$static_ext'
16908 stdchar='$stdchar'
16909 stdio_base='$stdio_base'
16910 stdio_bufsiz='$stdio_bufsiz'
16911 stdio_cnt='$stdio_cnt'
16912 stdio_filbuf='$stdio_filbuf'
16913 stdio_ptr='$stdio_ptr'
16914 stdio_stream_array='$stdio_stream_array'
16915 strings='$strings'
16916 submit='$submit'
16917 subversion='$subversion'
16918 sysman='$sysman'
16919 tail='$tail'
16920 tar='$tar'
16921 tbl='$tbl'
16922 tee='$tee'
16923 test='$test'
16924 timeincl='$timeincl'
16925 timetype='$timetype'
16926 touch='$touch'
16927 tr='$tr'
16928 trnl='$trnl'
16929 troff='$troff'
16930 u16size='$u16size'
16931 u16type='$u16type'
16932 u32size='$u32size'
16933 u32type='$u32type'
16934 u64size='$u64size'
16935 u64type='$u64type'
16936 u8size='$u8size'
16937 u8type='$u8type'
16938 uidformat='$uidformat'
16939 uidsign='$uidsign'
16940 uidsize='$uidsize'
16941 uidtype='$uidtype'
16942 uname='$uname'
16943 uniq='$uniq'
16944 uquadtype='$uquadtype'
16945 use5005threads='$use5005threads'
16946 use64bitall='$use64bitall'
16947 use64bitint='$use64bitint'
16948 usedl='$usedl'
16949 useithreads='$useithreads'
16950 uselargefiles='$uselargefiles'
16951 uselongdouble='$uselongdouble'
16952 usemorebits='$usemorebits'
16953 usemultiplicity='$usemultiplicity'
16954 usemymalloc='$usemymalloc'
16955 usenm='$usenm'
16956 useopcode='$useopcode'
16957 useperlio='$useperlio'
16958 useposix='$useposix'
16959 usesfio='$usesfio'
16960 useshrplib='$useshrplib'
16961 usesocks='$usesocks'
16962 usethreads='$usethreads'
16963 usevendorprefix='$usevendorprefix'
16964 usevfork='$usevfork'
16965 usrinc='$usrinc'
16966 uuname='$uuname'
16967 uvXUformat='$uvXUformat'
16968 uvoformat='$uvoformat'
16969 uvsize='$uvsize'
16970 uvtype='$uvtype'
16971 uvuformat='$uvuformat'
16972 uvxformat='$uvxformat'
16973 vendorarch='$vendorarch'
16974 vendorarchexp='$vendorarchexp'
16975 vendorbin='$vendorbin'
16976 vendorbinexp='$vendorbinexp'
16977 vendorlib='$vendorlib'
16978 vendorlib_stem='$vendorlib_stem'
16979 vendorlibexp='$vendorlibexp'
16980 vendorprefix='$vendorprefix'
16981 vendorprefixexp='$vendorprefixexp'
16982 version='$version'
16983 versiononly='$versiononly'
16984 vi='$vi'
16985 voidflags='$voidflags'
16986 xlibpth='$xlibpth'
16987 xs_apiversion='$xs_apiversion'
16988 yacc='$yacc'
16989 yaccflags='$yaccflags'
16990 zcat='$zcat'
16991 zip='$zip'
16992 EOT
16993
16994 : Add in command line options if available
16995 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16996
16997 : add special variables
16998 $test -f $src/patchlevel.h && \
16999 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17000 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17001 echo "PERL_CONFIG_SH=true" >>config.sh
17002
17003 : propagate old symbols
17004 if $test -f UU/config.sh; then
17005         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17006         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17007         $sort | $uniq -u >UU/oldsyms
17008         set X `cat UU/oldsyms`
17009         shift
17010         case $# in
17011         0) ;;
17012         *)
17013                 cat <<EOM
17014 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17015 EOM
17016                 echo "# Variables propagated from previous config.sh file." >>config.sh
17017                 for sym in `cat UU/oldsyms`; do
17018                         echo "    Propagating $hint variable "'$'"$sym..."
17019                         eval 'tmp="$'"${sym}"'"'
17020                         echo "$tmp" | \
17021                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17022                 done
17023                 ;;
17024         esac
17025 fi
17026
17027 : Finish up by extracting the .SH files
17028 case "$alldone" in
17029 exit)
17030         $rm -rf UU
17031         echo "Extraction done."
17032         exit 0
17033         ;;
17034 cont)
17035         ;;
17036 '')
17037         dflt=''
17038         nostick=true
17039         $cat <<EOM
17040
17041 If you'd like to make any changes to the config.sh file before I begin
17042 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17043
17044 EOM
17045         rp="Press return or use a shell escape to edit config.sh:"
17046         . UU/myread
17047         nostick=''
17048         case "$ans" in
17049         '') ;;
17050         *) : in case they cannot read
17051                 sh 1>&4 -c "$ans";;
17052         esac
17053         ;;
17054 esac
17055
17056 : if this fails, just run all the .SH files by hand
17057 . ./config.sh
17058
17059 echo " "
17060 exec 1>&4
17061 . ./UU/extract
17062
17063 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17064         dflt=y
17065         case "$silent" in
17066         true) ;;
17067         *)
17068                 $cat <<EOM
17069
17070 Now you need to generate make dependencies by running "$make depend".
17071 You might prefer to run it in background: "$make depend > makedepend.out &"
17072 It can take a while, so you might not want to run it right now.
17073
17074 EOM
17075                 ;;
17076         esac
17077         rp="Run $make depend now?"
17078         . UU/myread
17079         case "$ans" in
17080         y*)
17081                 $make depend && echo "Now you must run '$make'."
17082                 ;;
17083         *)
17084                 echo "You must run '$make depend' then '$make'."
17085                 ;;
17086         esac
17087 elif test -f [Mm]akefile; then
17088         echo " "
17089         echo "Now you must run a $make."
17090 else
17091         echo "Configure done."
17092 fi
17093
17094 if $test -f Policy.sh; then
17095     $cat <<EOM
17096
17097 If you compile $package on a different machine or from a different object
17098 directory, copy the Policy.sh file from this object directory to the
17099 new one before you run Configure -- this will help you with most of
17100 the policy defaults.
17101
17102 EOM
17103 fi
17104 if $test -f config.msg; then
17105     echo "Hmm.  I also noted the following information while running:"
17106     echo " "
17107     $cat config.msg >&4
17108     $rm -f config.msg
17109 fi
17110 $rm -f kit*isdone ark*isdone
17111 $rm -rf UU
17112
17113 : End of Configure
17114