Raw integrate of mainline for S_grok_number debug
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Jun  7 00:46: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 case "$d_longdbl$d_modfl" in
10480 $define$define)
10481         $cat <<EOM
10482 Checking to see whether your modfl() is okay for large values...
10483 EOM
10484 $cat >try.c <<EOCP
10485 #include <math.h> 
10486 #include <stdio.h>
10487 int main() {
10488     long double nv = 4294967303.15;
10489     long double v, w;
10490     v = modfl(nv, &w);         
10491 #ifdef __GLIBC__
10492     printf("glibc");
10493 #endif
10494     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10495     return 0;
10496 }
10497 EOCP
10498         set try
10499         if eval $compile; then
10500                 foo=`./try`
10501                 case "$foo" in
10502                 *" 4294967303.150000 1.150000 4294967302.000000")
10503                         echo >&4 "Your modfl() is broken for large values."
10504                         d_modfl="$undef"
10505                         case "$foo" in
10506                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10507                         ;;
10508                         esac
10509                         ;;
10510                 *" 4294967303.150000 0.150000 4294967303.000000")
10511                         echo >&4 "Your modfl() seems okay for large values."
10512                         ;;
10513                 *)      echo >&4 "I don't understand your modfl() at all."
10514                         d_modfl="$undef"
10515                         ;;
10516                 esac
10517                 $rm -f try.* try core core.try.*
10518         else
10519                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10520                 d_modfl="$undef"
10521         fi
10522         ;;
10523 esac
10524
10525 : see if mprotect exists
10526 set mprotect d_mprotect
10527 eval $inlibc
10528
10529 : see if msgctl exists
10530 set msgctl d_msgctl
10531 eval $inlibc
10532
10533 : see if msgget exists
10534 set msgget d_msgget
10535 eval $inlibc
10536
10537 : see if msgsnd exists
10538 set msgsnd d_msgsnd
10539 eval $inlibc
10540
10541 : see if msgrcv exists
10542 set msgrcv d_msgrcv
10543 eval $inlibc
10544
10545 : see how much of the 'msg*(2)' library is present.
10546 h_msg=true
10547 echo " "
10548 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10549 *"$undef"*) h_msg=false;;
10550 esac
10551 case "$osname" in
10552 freebsd)
10553     case "`ipcs 2>&1`" in
10554     "SVID messages"*"not configured"*)
10555         echo "Your $osname does not have the msg*(2) configured." >&4
10556         h_msg=false
10557         val="$undef"
10558         set msgctl d_msgctl
10559         eval $setvar
10560         set msgget d_msgget
10561         eval $setvar
10562         set msgsnd d_msgsnd
10563         eval $setvar
10564         set msgrcv d_msgrcv
10565         eval $setvar
10566         ;;
10567     esac
10568     ;;
10569 esac
10570 : we could also check for sys/ipc.h ...
10571 if $h_msg && $test `./findhdr sys/msg.h`; then
10572         echo "You have the full msg*(2) library." >&4
10573         val="$define"
10574 else
10575         echo "You don't have the full msg*(2) library." >&4
10576         val="$undef"
10577 fi
10578 set d_msg
10579 eval $setvar
10580
10581
10582 echo " "
10583 echo "Checking to see if your system supports struct msghdr..." >&4
10584 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10585 eval $hasstruct
10586 case "$d_msghdr_s" in
10587 "$define")      echo "Yes, it does."   ;;
10588 *)              echo "No, it doesn't." ;;
10589 esac
10590
10591
10592 : see if msync exists
10593 set msync d_msync
10594 eval $inlibc
10595
10596 : see if munmap exists
10597 set munmap d_munmap
10598 eval $inlibc
10599
10600 : see if nice exists
10601 set nice d_nice
10602 eval $inlibc
10603
10604 : check for length of character
10605 echo " "
10606 case "$charsize" in
10607 '')
10608         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10609         $cat >try.c <<'EOCP'
10610 #include <stdio.h>
10611 int main()
10612 {
10613     printf("%d\n", (int)sizeof(char));
10614     exit(0);
10615 }
10616 EOCP
10617         set try
10618         if eval $compile_ok; then
10619                 dflt=`./try`
10620         else
10621                 dflt='1'
10622                 echo "(I can't seem to compile the test program.  Guessing...)"
10623         fi
10624         ;;
10625 *)
10626         dflt="$charsize"
10627         ;;
10628 esac
10629 rp="What is the size of a character (in bytes)?"
10630 . ./myread
10631 charsize="$ans"
10632 $rm -f try.c try
10633
10634 : check for volatile keyword
10635 echo " "
10636 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10637 $cat >try.c <<'EOCP'
10638 int main()
10639 {
10640         typedef struct _goo_struct goo_struct;
10641         goo_struct * volatile goo = ((goo_struct *)0);
10642         struct _goo_struct {
10643                 long long_int;
10644                 int reg_int;
10645                 char char_var;
10646         };
10647         typedef unsigned short foo_t;
10648         char *volatile foo;
10649         volatile int bar;
10650         volatile foo_t blech;
10651         foo = foo;
10652 }
10653 EOCP
10654 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10655         val="$define"
10656         echo "Yup, it does."
10657 else
10658         val="$undef"
10659         echo "Nope, it doesn't."
10660 fi
10661 set d_volatile
10662 eval $setvar
10663 $rm -f try.*
10664
10665
10666 echo " "
10667 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10668
10669 case "$use64bitint:$d_quad:$quadtype" in
10670 define:define:?*)
10671         ivtype="$quadtype"
10672         uvtype="$uquadtype"
10673         ivsize=8
10674         uvsize=8
10675         ;;
10676 *)      ivtype="long"
10677         uvtype="unsigned long"
10678         ivsize=$longsize
10679         uvsize=$longsize
10680         ;;
10681 esac
10682
10683 case "$uselongdouble:$d_longdbl" in
10684 define:define)
10685         nvtype="long double"
10686         nvsize=$longdblsize
10687         ;;
10688 *)      nvtype=double
10689         nvsize=$doublesize
10690         ;;
10691 esac
10692
10693 $echo "(IV will be "$ivtype", $ivsize bytes)"
10694 $echo "(UV will be "$uvtype", $uvsize bytes)"
10695 $echo "(NV will be "$nvtype", $nvsize bytes)"
10696
10697 $cat >try.c <<EOCP
10698 #$i_inttypes I_INTTYPES
10699 #ifdef I_INTTYPES
10700 #include <inttypes.h>
10701 #endif
10702 #include <stdio.h>
10703 int main() {
10704 #ifdef INT8
10705    int8_t i =  INT8_MAX;
10706   uint8_t u = UINT8_MAX;
10707   printf("int8_t\n");
10708 #endif
10709 #ifdef INT16
10710    int16_t i =  INT16_MAX;
10711   uint16_t i = UINT16_MAX;
10712   printf("int16_t\n");
10713 #endif
10714 #ifdef INT32
10715    int32_t i =  INT32_MAX;
10716   uint32_t u = UINT32_MAX;
10717   printf("int32_t\n");
10718 #endif
10719 }
10720 EOCP
10721
10722 case "$i8type" in
10723 '')     case "$charsize" in
10724         1)      i8type=char
10725                 u8type="unsigned char"
10726                 i8size=$charsize
10727                 u8size=$charsize
10728                 ;;
10729         esac
10730         ;;
10731 esac
10732 case "$i8type" in
10733 '')     set try -DINT8
10734         if eval $compile; then
10735                 case "`./try$exe_ext`" in
10736                 int8_t) i8type=int8_t
10737                         u8type=uint8_t
10738                         i8size=1
10739                         u8size=1
10740                         ;;
10741                 esac
10742         fi
10743         ;;
10744 esac
10745 case "$i8type" in
10746 '')     if $test $charsize -ge 1; then
10747                 i8type=char
10748                 u8type="unsigned char"
10749                 i8size=$charsize
10750                 u8size=$charsize
10751         fi
10752         ;;
10753 esac
10754
10755 case "$i16type" in
10756 '')     case "$shortsize" in
10757         2)      i16type=short
10758                 u16type="unsigned short"
10759                 i16size=$shortsize
10760                 u16size=$shortsize
10761                 ;;
10762         esac
10763         ;;
10764 esac
10765 case "$i16type" in
10766 '')     set try -DINT16
10767         if eval $compile; then
10768                 case "`./try$exe_ext`" in
10769                 int16_t)
10770                         i16type=int16_t
10771                         u16type=uint16_t
10772                         i16size=2
10773                         u16size=2
10774                         ;;
10775                 esac
10776         fi
10777         ;;
10778 esac
10779 case "$i16type" in
10780 '')     if $test $shortsize -ge 2; then
10781                 i16type=short
10782                 u16type="unsigned short"
10783                 i16size=$shortsize
10784                 u16size=$shortsize
10785         fi
10786         ;;
10787 esac
10788
10789 case "$i32type" in
10790 '')     case "$longsize" in
10791         4)      i32type=long
10792                 u32type="unsigned long"
10793                 i32size=$longsize
10794                 u32size=$longsize
10795                 ;;
10796         *)      case "$intsize" in
10797                 4)      i32type=int
10798                         u32type="unsigned int"
10799                         i32size=$intsize
10800                         u32size=$intsize
10801                         ;;
10802                 esac
10803                 ;;
10804         esac
10805         ;;
10806 esac
10807 case "$i32type" in
10808 '')     set try -DINT32
10809         if eval $compile; then
10810                 case "`./try$exe_ext`" in
10811                 int32_t)
10812                         i32type=int32_t
10813                         u32type=uint32_t
10814                         i32size=4
10815                         u32size=4
10816                         ;;
10817                 esac
10818         fi
10819         ;;
10820 esac
10821 case "$i32type" in
10822 '')     if $test $intsize -ge 4; then
10823                 i32type=int
10824                 u32type="unsigned int"
10825                 i32size=$intsize
10826                 u32size=$intsize
10827         fi
10828         ;;
10829 esac
10830
10831 case "$i64type" in
10832 '')     case "$d_quad:$quadtype" in
10833         define:?*)
10834                 i64type="$quadtype"
10835                 u64type="$uquadtype"
10836                 i64size=8
10837                 u64size=8
10838                 ;;
10839         esac
10840         ;;
10841 esac
10842
10843 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10844 : volatile so that the compiler has to store it out to memory.
10845 if test X"$d_volatile" = X"$define"; then
10846         volatile=volatile
10847 fi
10848 $cat <<EOP >try.c
10849 #include <stdio.h>
10850 #include <sys/types.h>
10851 #include <signal.h>
10852 #ifdef SIGFPE
10853 $volatile int bletched = 0;
10854 $signal_t blech(s) int s; { bletched = 1; }
10855 #endif
10856 int main() {
10857     $uvtype u = 0;
10858     $nvtype d;
10859     int     n = 8 * $uvsize;
10860     int     i;
10861 #ifdef SIGFPE
10862     signal(SIGFPE, blech);
10863 #endif
10864
10865     for (i = 0; i < n; i++) {
10866       u = u << 1 | ($uvtype)1;
10867       d = ($nvtype)u;
10868       if (($uvtype)d != u)
10869         break;
10870       if (d <= 0)
10871         break;
10872       d = ($nvtype)(u - 1);
10873       if (($uvtype)d != (u - 1))
10874         break;
10875 #ifdef SIGFPE
10876       if (bletched) {
10877         break;
10878 #endif
10879       } 
10880     }
10881     printf("%d\n", ((i == n) ? -n : i));
10882     exit(0);
10883 }
10884 EOP
10885 set try
10886
10887 d_nv_preserves_uv="$undef"
10888 if eval $compile; then
10889         d_nv_preserves_uv_bits="`./try$exe_ext`"
10890 fi
10891 case "$d_nv_preserves_uv_bits" in
10892 \-[1-9]*)       
10893         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10894         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10895         d_nv_preserves_uv="$define"
10896         ;;
10897 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10898         d_nv_preserves_uv="$undef" ;;
10899 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10900         d_nv_preserves_uv_bits="$undef" ;;
10901 esac
10902
10903 $rm -f try.* try
10904
10905
10906 : check for off64_t
10907 echo " "
10908 echo "Checking to see if you have off64_t..." >&4
10909 $cat >try.c <<EOCP
10910 #include <sys/types.h>
10911 #include <unistd.h>
10912 int main() { off64_t x = 7; }
10913 EOCP
10914 set try
10915 if eval $compile; then
10916         val="$define"
10917         echo "You have off64_t."
10918 else
10919         val="$undef"
10920         echo "You do not have off64_t."
10921         case "$lseeksize" in
10922         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10923         esac
10924 fi
10925 $rm -f try.* try
10926 set d_off64_t
10927 eval $setvar
10928
10929 : see if POSIX threads are available
10930 set pthread.h i_pthread
10931 eval $inhdr
10932
10933
10934
10935
10936 : how to create joinable pthreads
10937 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10938         echo " "
10939         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10940         $cat >try.c <<'EOCP'
10941 #include <pthread.h>
10942 int main() {
10943     int detachstate = JOINABLE;
10944 }
10945 EOCP
10946         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10947         if eval $compile; then
10948                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10949                 val="$undef" # Yes, undef.
10950                 set d_old_pthread_create_joinable
10951                 eval $setvar
10952                 val=""
10953                 set old_pthread_create_joinable
10954                 eval $setvar
10955         else
10956                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10957                 if eval $compile; then
10958                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10959                         val="$define"
10960                         set d_old_pthread_create_joinable
10961                         eval $setvar
10962                         val=PTHREAD_CREATE_UNDETACHED
10963                         set old_pthread_create_joinable
10964                         eval $setvar
10965                 else            
10966                         set try -DJOINABLE=__UNDETACHED
10967                         if eval $compile; then
10968                                 echo "You seem to use __UNDETACHED." >&4
10969                                 val="$define"
10970                                 set d_old_pthread_create_joinable
10971                                 eval $setvar
10972                                 val=__UNDETACHED
10973                                 set old_pthread_create_joinable
10974                                 eval $setvar
10975                         else
10976                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10977                                 val="$define"
10978                                 set d_old_pthread_create_joinable
10979                                 eval $setvar
10980                                 val=0
10981                                 set old_pthread_create_joinable
10982                                 eval $setvar
10983                         fi
10984                 fi
10985         fi
10986         $rm -f try try.*
10987 else
10988     d_old_pthread_create_joinable="$undef"
10989     old_pthread_create_joinable=""
10990 fi
10991
10992 : see if pause exists
10993 set pause d_pause
10994 eval $inlibc
10995
10996 : see if pipe exists
10997 set pipe d_pipe
10998 eval $inlibc
10999
11000 : see if poll exists
11001 set poll d_poll
11002 eval $inlibc
11003
11004
11005 : see whether the various POSIXish _yields exist
11006 $cat >try.c <<EOP
11007 #include <pthread.h>
11008 #include <stdio.h>
11009 int main() {
11010 #ifdef SCHED_YIELD
11011         sched_yield();
11012 #else
11013 #ifdef PTHREAD_YIELD
11014         pthread_yield();
11015 #else
11016 #ifdef PTHREAD_YIELD_NULL
11017         pthread_yield(NULL);
11018 #endif
11019 #endif
11020 #endif
11021 }
11022 EOP
11023 : see if sched_yield exists
11024 set try -DSCHED_YIELD
11025 if eval $compile; then
11026     val="$define"
11027     sched_yield='sched_yield()'
11028 else
11029     val="$undef"
11030 fi
11031 case "$usethreads" in
11032 $define)
11033         case "$val" in
11034         $define) echo 'sched_yield() found.' >&4        ;;
11035         *)       echo 'sched_yield() NOT found.' >&4    ;;
11036         esac
11037 esac
11038 set d_sched_yield
11039 eval $setvar
11040
11041 : see if pthread_yield exists
11042 set try -DPTHREAD_YIELD
11043 if eval $compile; then
11044     val="$define"
11045     case "$sched_yield" in
11046     '') sched_yield='pthread_yield()' ;;
11047     esac
11048 else
11049     set try -DPTHREAD_YIELD_NULL
11050     if eval $compile; then
11051         val="$define"
11052         case "$sched_yield" in
11053         '') sched_yield='pthread_yield(NULL)' ;;
11054         esac
11055     else
11056         val="$undef"
11057     fi
11058 fi
11059 case "$usethreads" in
11060 $define)
11061         case "$val" in
11062         $define) echo 'pthread_yield() found.' >&4      ;;
11063         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11064         esac
11065         ;;
11066 esac
11067 set d_pthread_yield
11068 eval $setvar
11069
11070 case "$sched_yield" in
11071 '') sched_yield=undef ;;
11072 esac
11073
11074 $rm -f try try.*
11075
11076 : see if this is a pwd.h system
11077 set pwd.h i_pwd
11078 eval $inhdr
11079
11080 case "$i_pwd" in
11081 $define)
11082         xxx=`./findhdr pwd.h`
11083         $cppstdin $cppflags $cppminus < $xxx >$$.h
11084
11085         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11086                 val="$define"
11087         else
11088                 val="$undef"
11089         fi
11090         set d_pwquota
11091         eval $setvar
11092
11093         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11094                 val="$define"
11095         else
11096                 val="$undef"
11097         fi
11098         set d_pwage
11099         eval $setvar
11100
11101         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11102                 val="$define"
11103         else
11104                 val="$undef"
11105         fi
11106         set d_pwchange
11107         eval $setvar
11108
11109         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11110                 val="$define"
11111         else
11112                 val="$undef"
11113         fi
11114         set d_pwclass
11115         eval $setvar
11116
11117         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11118                 val="$define"
11119         else
11120                 val="$undef"
11121         fi
11122         set d_pwexpire
11123         eval $setvar
11124
11125         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11126                 val="$define"
11127         else
11128                 val="$undef"
11129         fi
11130         set d_pwcomment
11131         eval $setvar
11132
11133         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11134                 val="$define"
11135         else
11136                 val="$undef"
11137         fi
11138         set d_pwgecos
11139         eval $setvar
11140
11141         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11142                 val="$define"
11143         else
11144                 val="$undef"
11145         fi
11146         set d_pwpasswd
11147         eval $setvar
11148
11149         $rm -f $$.h
11150         ;;
11151 *)
11152         val="$undef"; 
11153         set d_pwquota; eval $setvar
11154         set d_pwage; eval $setvar
11155         set d_pwchange; eval $setvar
11156         set d_pwclass; eval $setvar
11157         set d_pwexpire; eval $setvar
11158         set d_pwcomment; eval $setvar
11159         set d_pwgecos; eval $setvar
11160         set d_pwpasswd; eval $setvar
11161         ;;
11162 esac
11163
11164 : see if readdir and friends exist
11165 set readdir d_readdir
11166 eval $inlibc
11167 set seekdir d_seekdir
11168 eval $inlibc
11169 set telldir d_telldir
11170 eval $inlibc
11171 set rewinddir d_rewinddir
11172 eval $inlibc
11173
11174 : see if readlink exists
11175 set readlink d_readlink
11176 eval $inlibc
11177
11178 : see if readv exists
11179 set readv d_readv
11180 eval $inlibc
11181
11182 : see if realpath exists
11183 set realpath d_realpath
11184 eval $inlibc
11185
11186 : see if recvmsg exists
11187 set recvmsg d_recvmsg
11188 eval $inlibc
11189
11190 : see if rename exists
11191 set rename d_rename
11192 eval $inlibc
11193
11194 : see if rmdir exists
11195 set rmdir d_rmdir
11196 eval $inlibc
11197
11198 : see if memory.h is available.
11199 val=''
11200 set memory.h val
11201 eval $inhdr
11202
11203 : See if it conflicts with string.h
11204 case "$val" in
11205 $define)
11206         case "$strings" in
11207         '') ;;
11208         *)
11209                 $cppstdin $cppflags $cppminus < $strings > mem.h
11210                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11211                         echo " "
11212                         echo "We won't be including <memory.h>."
11213                         val="$undef"
11214                 fi
11215                 $rm -f mem.h
11216                 ;;
11217         esac
11218 esac
11219 set i_memory
11220 eval $setvar
11221
11222 : can bcopy handle overlapping blocks?
11223 val="$undef"
11224 case "$d_bcopy" in
11225 "$define")
11226         echo " "
11227         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11228         $cat >try.c <<EOCP
11229 #$i_memory I_MEMORY
11230 #$i_stdlib I_STDLIB
11231 #$i_string I_STRING
11232 #$i_unistd I_UNISTD
11233 EOCP
11234         $cat >>try.c <<'EOCP'
11235 #include <stdio.h>
11236 #ifdef I_MEMORY
11237 #  include <memory.h>
11238 #endif
11239 #ifdef I_STDLIB
11240 #  include <stdlib.h>
11241 #endif
11242 #ifdef I_STRING
11243 #  include <string.h>
11244 #else
11245 #  include <strings.h>
11246 #endif
11247 #ifdef I_UNISTD
11248 #  include <unistd.h>  /* Needed for NetBSD */
11249 #endif
11250 int main()
11251 {
11252 char buf[128], abc[128];
11253 char *b;
11254 int len;
11255 int off;
11256 int align;
11257
11258 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11259
11260 for (align = 7; align >= 0; align--) {
11261         for (len = 36; len; len--) {
11262                 b = buf+align;
11263                 bcopy(abc, b, len);
11264                 for (off = 1; off <= len; off++) {
11265                         bcopy(b, b+off, len);
11266                         bcopy(b+off, b, len);
11267                         if (bcmp(b, abc, len))
11268                                 exit(1);
11269                 }
11270         }
11271 }
11272 exit(0);
11273 }
11274 EOCP
11275         set try
11276         if eval $compile_ok; then
11277                 if ./try 2>/dev/null; then
11278                         echo "Yes, it can."
11279                         val="$define"
11280                 else
11281                         echo "It can't, sorry."
11282                         case "$d_memmove" in
11283                         "$define") echo "But that's Ok since you have memmove()." ;;
11284                         esac
11285                 fi
11286         else
11287                 echo "(I can't compile the test program, so we'll assume not...)"
11288                 case "$d_memmove" in
11289                 "$define") echo "But that's Ok since you have memmove()." ;;
11290                 esac
11291         fi
11292         ;;
11293 esac
11294 $rm -f try.* try core
11295 set d_safebcpy
11296 eval $setvar
11297
11298 : can memcpy handle overlapping blocks?
11299 val="$undef"
11300 case "$d_memcpy" in
11301 "$define")
11302         echo " "
11303         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11304         $cat >try.c <<EOCP
11305 #$i_memory I_MEMORY
11306 #$i_stdlib I_STDLIB
11307 #$i_string I_STRING
11308 #$i_unistd I_UNISTD
11309 EOCP
11310         $cat >>try.c <<'EOCP'
11311 #include <stdio.h>
11312 #ifdef I_MEMORY
11313 #  include <memory.h>
11314 #endif
11315 #ifdef I_STDLIB
11316 #  include <stdlib.h>
11317 #endif
11318 #ifdef I_STRING
11319 #  include <string.h>
11320 #else
11321 #  include <strings.h>
11322 #endif
11323 #ifdef I_UNISTD
11324 #  include <unistd.h>  /* Needed for NetBSD */
11325 #endif
11326 int main()
11327 {
11328 char buf[128], abc[128];
11329 char *b;
11330 int len;
11331 int off;
11332 int align;
11333
11334 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11335    try to store the string in read-only memory. */
11336 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11337
11338 for (align = 7; align >= 0; align--) {
11339         for (len = 36; len; len--) {
11340                 b = buf+align;
11341                 memcpy(b, abc, len);
11342                 for (off = 1; off <= len; off++) {
11343                         memcpy(b+off, b, len);
11344                         memcpy(b, b+off, len);
11345                         if (memcmp(b, abc, len))
11346                                 exit(1);
11347                 }
11348         }
11349 }
11350 exit(0);
11351 }
11352 EOCP
11353         set try
11354         if eval $compile_ok; then
11355                 if ./try 2>/dev/null; then
11356                         echo "Yes, it can."
11357                         val="$define"
11358                 else
11359                         echo "It can't, sorry."
11360                         case "$d_memmove" in
11361                         "$define") echo "But that's Ok since you have memmove()." ;;
11362                         esac
11363                 fi
11364         else
11365                 echo "(I can't compile the test program, so we'll assume not...)"
11366                 case "$d_memmove" in
11367                 "$define") echo "But that's Ok since you have memmove()." ;;
11368                 esac
11369         fi
11370         ;;
11371 esac
11372 $rm -f try.* try core
11373 set d_safemcpy
11374 eval $setvar
11375
11376 : can memcmp be trusted to compare relative magnitude?
11377 val="$undef"
11378 case "$d_memcmp" in
11379 "$define")
11380         echo " "
11381         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11382         $cat >try.c <<EOCP
11383 #$i_memory I_MEMORY
11384 #$i_stdlib I_STDLIB
11385 #$i_string I_STRING
11386 #$i_unistd I_UNISTD
11387 EOCP
11388         $cat >>try.c <<'EOCP'
11389 #include <stdio.h>
11390 #ifdef I_MEMORY
11391 #  include <memory.h>
11392 #endif
11393 #ifdef I_STDLIB
11394 #  include <stdlib.h>
11395 #endif
11396 #ifdef I_STRING
11397 #  include <string.h>
11398 #else
11399 #  include <strings.h>
11400 #endif
11401 #ifdef I_UNISTD
11402 #  include <unistd.h>  /* Needed for NetBSD */
11403 #endif
11404 int main()
11405 {
11406 char a = -1;
11407 char b = 0;
11408 if ((a < b) && memcmp(&a, &b, 1) < 0)
11409         exit(1);
11410 exit(0);
11411 }
11412 EOCP
11413         set try
11414         if eval $compile_ok; then
11415                 if ./try 2>/dev/null; then
11416                         echo "Yes, it can."
11417                         val="$define"
11418                 else
11419                         echo "No, it can't (it uses signed chars)."
11420                 fi
11421         else
11422                 echo "(I can't compile the test program, so we'll assume not...)"
11423         fi
11424         ;;
11425 esac
11426 $rm -f try.* try core
11427 set d_sanemcmp
11428 eval $setvar
11429
11430 : see if prototype for sbrk is available
11431 echo " "
11432 set d_sbrkproto sbrk $i_unistd unistd.h
11433 eval $hasproto
11434
11435 : see if select exists
11436 set select d_select
11437 eval $inlibc
11438
11439 : see if semctl exists
11440 set semctl d_semctl
11441 eval $inlibc
11442
11443 : see if semget exists
11444 set semget d_semget
11445 eval $inlibc
11446
11447 : see if semop exists
11448 set semop d_semop
11449 eval $inlibc
11450
11451 : see how much of the 'sem*(2)' library is present.
11452 h_sem=true
11453 echo " "
11454 case "$d_semctl$d_semget$d_semop" in
11455 *"$undef"*) h_sem=false;;
11456 esac
11457 case "$osname" in
11458 freebsd)
11459     case "`ipcs 2>&1`" in
11460     "SVID messages"*"not configured"*)
11461         echo "Your $osname does not have the sem*(2) configured." >&4
11462         h_sem=false
11463         val="$undef"
11464         set semctl d_semctl
11465         eval $setvar
11466         set semget d_semget
11467         eval $setvar
11468         set semop d_semop
11469         eval $setvar
11470         ;;
11471     esac
11472     ;;
11473 esac
11474 : we could also check for sys/ipc.h ...
11475 if $h_sem && $test `./findhdr sys/sem.h`; then
11476         echo "You have the full sem*(2) library." >&4
11477         val="$define"
11478 else
11479         echo "You don't have the full sem*(2) library." >&4
11480         val="$undef"
11481 fi
11482 set d_sem
11483 eval $setvar
11484
11485 : see whether sys/sem.h defines union semun
11486 echo " "
11487 $cat > try.c <<'END'
11488 #include <sys/types.h>
11489 #include <sys/ipc.h>
11490 #include <sys/sem.h>
11491 int main () { union semun semun; semun.buf = 0; }
11492 END
11493 set try
11494 if eval $compile; then
11495     echo "You have union semun in <sys/sem.h>." >&4
11496     val="$define"
11497 else
11498     echo "You do not have union semun in <sys/sem.h>." >&4
11499     val="$undef"
11500 fi
11501 $rm -f try try.c try.h
11502 set d_union_semun
11503 eval $setvar
11504
11505 : see how to do semctl IPC_STAT
11506 case "$d_sem" in
11507 $define)
11508     : see whether semctl IPC_STAT can use union semun
11509     echo " "
11510     $cat > try.h <<END
11511 #ifndef S_IRUSR
11512 #   ifdef S_IREAD
11513 #       define S_IRUSR S_IREAD
11514 #       define S_IWUSR S_IWRITE
11515 #       define S_IXUSR S_IEXEC
11516 #   else
11517 #       define S_IRUSR 0400
11518 #       define S_IWUSR 0200
11519 #       define S_IXUSR 0100
11520 #   endif
11521 #   define S_IRGRP (S_IRUSR>>3)
11522 #   define S_IWGRP (S_IWUSR>>3)
11523 #   define S_IXGRP (S_IXUSR>>3)
11524 #   define S_IROTH (S_IRUSR>>6)
11525 #   define S_IWOTH (S_IWUSR>>6)
11526 #   define S_IXOTH (S_IXUSR>>6)
11527 #endif
11528 #ifndef S_IRWXU
11529 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11530 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11531 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11532 #endif
11533 END
11534
11535     $cat > try.c <<END
11536 #include <sys/types.h>
11537 #include <sys/ipc.h>
11538 #include <sys/sem.h>
11539 #include <sys/stat.h>
11540 #include <stdio.h>
11541 #include <errno.h>
11542 #include "try.h"
11543 #ifndef errno
11544 extern int errno;
11545 #endif
11546 #$d_union_semun HAS_UNION_SEMUN
11547 int main() {
11548     union semun
11549 #ifndef HAS_UNION_SEMUN
11550     {
11551         int val;
11552         struct semid_ds *buf;
11553         unsigned short *array;
11554     }
11555 #endif
11556     arg;
11557     int sem, st;
11558
11559 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11560     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11561     if (sem > -1) {
11562         struct semid_ds argbuf;
11563         arg.buf = &argbuf;
11564 #       ifdef IPC_STAT
11565         st = semctl(sem, 0, IPC_STAT, arg);
11566         if (st == 0)
11567             printf("semun\n");
11568         else
11569 #       endif /* IPC_STAT */
11570             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11571 #       ifdef IPC_RMID
11572         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11573 #       endif /* IPC_RMID */
11574             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11575     } else
11576 #endif /* IPC_PRIVATE && ... */
11577         printf("semget failed: errno = %d\n", errno);
11578   return 0;
11579 }
11580 END
11581     val="$undef"
11582     set try
11583     if eval $compile; then
11584         xxx=`./try`
11585         case "$xxx" in
11586         semun) val="$define" ;;
11587         esac
11588     fi
11589     $rm -f try try.c
11590     set d_semctl_semun
11591     eval $setvar
11592     case "$d_semctl_semun" in
11593     $define)
11594         echo "You can use union semun for semctl IPC_STAT." >&4
11595         also='also'
11596         ;;
11597     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11598         also=''
11599         ;;
11600     esac
11601
11602     : see whether semctl IPC_STAT can use struct semid_ds pointer
11603     $cat > try.c <<'END'
11604 #include <sys/types.h>
11605 #include <sys/ipc.h>
11606 #include <sys/sem.h>
11607 #include <sys/stat.h>
11608 #include "try.h"
11609 #include <stdio.h>
11610 #include <errno.h>
11611 #ifndef errno
11612 extern int errno;
11613 #endif
11614 int main() {
11615     struct semid_ds arg;
11616     int sem, st;
11617
11618 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11619     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11620     if (sem > -1) {
11621 #       ifdef IPC_STAT
11622         st = semctl(sem, 0, IPC_STAT, &arg);
11623         if (st == 0)
11624             printf("semid_ds\n");
11625         else
11626 #       endif /* IPC_STAT */
11627             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11628 #       ifdef IPC_RMID
11629         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11630 #       endif /* IPC_RMID */
11631             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11632     } else
11633 #endif /* IPC_PRIVATE && ... */
11634         printf("semget failed: errno = %d\n", errno);
11635
11636     return 0;
11637 }
11638 END
11639     val="$undef"
11640     set try
11641     if eval $compile; then
11642         xxx=`./try`
11643         case "$xxx" in
11644         semid_ds) val="$define" ;;
11645         esac
11646     fi
11647     $rm -f try try.c
11648     set d_semctl_semid_ds
11649     eval $setvar
11650     case "$d_semctl_semid_ds" in
11651     $define)
11652         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11653         ;;
11654     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11655         ;;
11656     esac
11657     $rm -f try.h
11658     ;;
11659 *)  val="$undef"
11660
11661     # We do not have the full sem*(2) library, so assume we can not
11662     # use either.
11663
11664     set d_semctl_semun
11665     eval $setvar
11666
11667     set d_semctl_semid_ds
11668     eval $setvar
11669     ;;
11670 esac
11671
11672 : see if sendmsg exists
11673 set sendmsg d_sendmsg
11674 eval $inlibc
11675
11676 : see if setegid exists
11677 set setegid d_setegid
11678 eval $inlibc
11679
11680 : see if seteuid exists
11681 set seteuid d_seteuid
11682 eval $inlibc
11683
11684 : see if setgrent exists
11685 set setgrent d_setgrent
11686 eval $inlibc
11687
11688 : see if sethostent exists
11689 set sethostent d_sethent
11690 eval $inlibc
11691
11692 : see if setitimer exists
11693 set setitimer d_setitimer
11694 eval $inlibc
11695
11696 : see if setlinebuf exists
11697 set setlinebuf d_setlinebuf
11698 eval $inlibc
11699
11700 : see if setlocale exists
11701 set setlocale d_setlocale
11702 eval $inlibc
11703
11704 : see if setnetent exists
11705 set setnetent d_setnent
11706 eval $inlibc
11707
11708 : see if setprotoent exists
11709 set setprotoent d_setpent
11710 eval $inlibc
11711
11712 : see if setpgid exists
11713 set setpgid d_setpgid
11714 eval $inlibc
11715
11716 : see if setpgrp2 exists
11717 set setpgrp2 d_setpgrp2
11718 eval $inlibc
11719
11720 : see if setpriority exists
11721 set setpriority d_setprior
11722 eval $inlibc
11723
11724 : see if setproctitle exists
11725 set setproctitle d_setproctitle
11726 eval $inlibc
11727
11728 : see if setpwent exists
11729 set setpwent d_setpwent
11730 eval $inlibc
11731
11732 : see if setregid exists
11733 set setregid d_setregid
11734 eval $inlibc
11735 set setresgid d_setresgid
11736 eval $inlibc
11737
11738 : see if setreuid exists
11739 set setreuid d_setreuid
11740 eval $inlibc
11741 set setresuid d_setresuid
11742 eval $inlibc
11743
11744 : see if setrgid exists
11745 set setrgid d_setrgid
11746 eval $inlibc
11747
11748 : see if setruid exists
11749 set setruid d_setruid
11750 eval $inlibc
11751
11752 : see if setservent exists
11753 set setservent d_setsent
11754 eval $inlibc
11755
11756 : see if setsid exists
11757 set setsid d_setsid
11758 eval $inlibc
11759
11760 : see if setvbuf exists
11761 set setvbuf d_setvbuf
11762 eval $inlibc
11763
11764 : see if sfio.h is available
11765 set sfio.h i_sfio
11766 eval $inhdr
11767
11768
11769 : see if sfio library is available
11770 case "$i_sfio" in
11771 $define)
11772         val=''
11773         set sfreserve val
11774         eval $inlibc
11775         ;;
11776 *)
11777         val="$undef"
11778         ;;
11779 esac
11780 : Ok, but do we want to use it.
11781 case "$val" in
11782 $define)
11783         case "$usesfio" in
11784         true|$define|[yY]*) dflt='y';;
11785         *) dflt='n';;
11786         esac
11787         echo "$package can use the sfio library, but it is experimental."
11788         case "$useperlio" in
11789         "$undef")
11790             echo "For sfio also the PerlIO abstraction layer is needed."
11791             echo "Earlier you said you wouldn't want that."
11792             ;;
11793         esac
11794         rp="You seem to have sfio available, do you want to try using it?"
11795         . ./myread
11796         case "$ans" in
11797         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11798                 useperlio="$define"
11799                 val="$define"
11800                 ;;
11801         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11802                 val="$undef"
11803                 ;;
11804         esac
11805         ;;
11806 *)      case "$usesfio" in
11807         true|$define|[yY]*)
11808                 echo "Sorry, cannot find sfio on this machine." >&4
11809                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11810                 val="$undef"
11811                 ;;
11812         esac
11813         ;;
11814 esac
11815 set d_sfio
11816 eval $setvar
11817 case "$d_sfio" in
11818 $define) usesfio='true';;
11819 *) usesfio='false';;
11820 esac
11821 case "$d_sfio" in
11822 $define) ;;
11823 *)      : Remove sfio from list of libraries to use
11824         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11825         shift
11826         libs="$*"
11827         echo "libs = $libs" >&4
11828 ;;
11829 esac
11830
11831
11832 : see if shmctl exists
11833 set shmctl d_shmctl
11834 eval $inlibc
11835
11836 : see if shmget exists
11837 set shmget d_shmget
11838 eval $inlibc
11839
11840 : see if shmat exists
11841 set shmat d_shmat
11842 eval $inlibc
11843 : see what shmat returns
11844 case "$d_shmat" in
11845 "$define")
11846         $cat >shmat.c <<'END'
11847 #include <sys/shm.h>
11848 void *shmat();
11849 END
11850         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11851                 shmattype='void *'
11852         else
11853                 shmattype='char *'
11854         fi
11855         echo "and it returns ($shmattype)." >&4
11856         : see if a prototype for shmat is available
11857         xxx=`./findhdr sys/shm.h`
11858         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11859         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11860                 val="$define"
11861         else
11862                 val="$undef"
11863         fi
11864         $rm -f shmat.[co]
11865         ;;
11866 *)
11867         val="$undef"
11868         ;;
11869 esac
11870 set d_shmatprototype
11871 eval $setvar
11872
11873 : see if shmdt exists
11874 set shmdt d_shmdt
11875 eval $inlibc
11876
11877 : see how much of the 'shm*(2)' library is present.
11878 h_shm=true
11879 echo " "
11880 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11881 *"$undef"*) h_shm=false;;
11882 esac
11883 case "$osname" in
11884 freebsd)
11885     case "`ipcs 2>&1`" in
11886     "SVID shared memory"*"not configured"*)
11887         echo "Your $osname does not have the shm*(2) configured." >&4
11888         h_shm=false
11889         val="$undef"
11890         set shmctl d_shmctl
11891         evat $setvar
11892         set shmget d_shmget
11893         evat $setvar
11894         set shmat d_shmat
11895         evat $setvar
11896         set shmdt d_shmdt
11897         evat $setvar
11898         ;;
11899     esac
11900     ;;
11901 esac
11902 : we could also check for sys/ipc.h ...
11903 if $h_shm && $test `./findhdr sys/shm.h`; then
11904         echo "You have the full shm*(2) library." >&4
11905         val="$define"
11906 else
11907         echo "You don't have the full shm*(2) library." >&4
11908         val="$undef"
11909 fi
11910 set d_shm
11911 eval $setvar
11912
11913 echo " "
11914 : see if we have sigaction
11915 if set sigaction val -f d_sigaction; eval $csym; $val; then
11916         echo 'sigaction() found.' >&4
11917         $cat > try.c <<'EOP'
11918 #include <stdio.h>
11919 #include <sys/types.h>
11920 #include <signal.h>
11921 int main()
11922 {
11923     struct sigaction act, oact;
11924     act.sa_flags = 0;
11925     oact.sa_handler = 0;
11926     /* so that act and oact are used */
11927     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11928 }
11929 EOP
11930         set try
11931         if eval $compile_ok; then
11932                 val="$define"
11933         else
11934                 echo "But you don't seem to have a useable struct sigaction." >&4
11935                 val="$undef"
11936         fi
11937 else
11938         echo 'sigaction NOT found.' >&4
11939         val="$undef"
11940 fi
11941 set d_sigaction; eval $setvar
11942 $rm -f try try$_o try.c
11943
11944 : see if sigprocmask exists
11945 set sigprocmask d_sigprocmask
11946 eval $inlibc
11947
11948 : see if sigsetjmp exists
11949 echo " "
11950 case "$d_sigsetjmp" in
11951 '')
11952         $cat >try.c <<'EOP'
11953 #include <setjmp.h>
11954 sigjmp_buf env;
11955 int set = 1;
11956 int main()
11957 {
11958         if (sigsetjmp(env,1))
11959                 exit(set);
11960         set = 0;
11961         siglongjmp(env, 1);
11962         exit(1);
11963 }
11964 EOP
11965         set try
11966         if eval $compile; then
11967                 if ./try >/dev/null 2>&1; then
11968                         echo "POSIX sigsetjmp found." >&4
11969                         val="$define"
11970                 else
11971                         $cat >&4 <<EOM
11972 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11973 I'll ignore them.
11974 EOM
11975                         val="$undef"
11976                 fi
11977         else
11978                 echo "sigsetjmp not found." >&4
11979                 val="$undef"
11980         fi
11981         ;;
11982 *) val="$d_sigsetjmp"
11983         case "$d_sigsetjmp" in
11984         $define) echo "POSIX sigsetjmp found." >&4;;
11985         $undef) echo "sigsetjmp not found." >&4;;
11986         esac
11987         ;;
11988 esac
11989 set d_sigsetjmp
11990 eval $setvar
11991 $rm -f try.c try
11992
11993 : see if sockatmark exists
11994 set sockatmark d_sockatmark
11995 eval $inlibc
11996
11997 : see if prototype for sockatmark is available
11998 echo " "
11999 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12000 eval $hasproto
12001
12002 : see if socks5_init exists
12003 set socks5_init d_socks5_init
12004 eval $inlibc
12005
12006 : see if prototype for setresgid is available
12007 echo " "
12008 set d_sresgproto setresgid $i_unistd unistd.h
12009 eval $hasproto
12010
12011 : see if prototype for setresuid is available
12012 echo " "
12013 set d_sresuproto setresuid $i_unistd unistd.h
12014 eval $hasproto
12015
12016 : see if sys/stat.h is available
12017 set sys/stat.h i_sysstat
12018 eval $inhdr
12019
12020
12021 : see if stat knows about block sizes
12022 echo " "
12023 echo "Checking to see if your struct stat has st_blocks field..." >&4
12024 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12025 eval $hasfield
12026
12027
12028 : see if this is a sys/vfs.h system
12029 set sys/vfs.h i_sysvfs
12030 eval $inhdr
12031
12032
12033 : see if this is a sys/statfs.h system
12034 set sys/statfs.h i_sysstatfs
12035 eval $inhdr
12036
12037
12038 echo " "
12039 echo "Checking to see if your system supports struct statfs..." >&4
12040 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
12041 eval $hasstruct
12042 case "$d_statfs_s" in
12043 "$define")      echo "Yes, it does."   ;;
12044 *)              echo "No, it doesn't." ;;
12045 esac
12046
12047
12048
12049 : see if struct statfs knows about f_flags
12050 case "$d_statfs_s" in
12051 define) 
12052         echo " "
12053         echo "Checking to see if your struct statfs has f_flags field..." >&4
12054         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
12055         eval $hasfield
12056         ;;
12057 *)      val="$undef"
12058         set d_statfs_f_flags
12059         eval $setvar
12060         ;;
12061 esac
12062 case "$d_statfs_f_flags" in
12063 "$define")      echo "Yes, it does."   ;;
12064 *)              echo "No, it doesn't." ;;
12065 esac
12066
12067 : see if _ptr and _cnt from stdio act std
12068 echo " "
12069
12070 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12071         echo "(Looks like you have stdio.h from BSD.)"
12072         case "$stdio_ptr" in
12073         '') stdio_ptr='((fp)->_p)'
12074                 ptr_lval=$define
12075                 ;;
12076         *)      ptr_lval=$d_stdio_ptr_lval;;
12077         esac
12078         case "$stdio_cnt" in
12079         '') stdio_cnt='((fp)->_r)'
12080                 cnt_lval=$define
12081                 ;;
12082         *)      cnt_lval=$d_stdio_cnt_lval;;
12083         esac
12084         case "$stdio_base" in
12085         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12086         esac
12087         case "$stdio_bufsiz" in
12088         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12089         esac
12090 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12091         echo "(Looks like you have stdio.h from Linux.)"
12092         case "$stdio_ptr" in
12093         '') stdio_ptr='((fp)->_IO_read_ptr)'
12094                 ptr_lval=$define
12095                 ;;
12096         *)      ptr_lval=$d_stdio_ptr_lval;;
12097         esac
12098         case "$stdio_cnt" in
12099         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12100                 cnt_lval=$undef
12101                 ;;
12102         *)      cnt_lval=$d_stdio_cnt_lval;;
12103         esac
12104         case "$stdio_base" in
12105         '') stdio_base='((fp)->_IO_read_base)';;
12106         esac
12107         case "$stdio_bufsiz" in
12108         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12109         esac
12110 else
12111         case "$stdio_ptr" in
12112         '') stdio_ptr='((fp)->_ptr)'
12113                 ptr_lval=$define
12114                 ;;
12115         *)      ptr_lval=$d_stdio_ptr_lval;;
12116         esac
12117         case "$stdio_cnt" in
12118         '') stdio_cnt='((fp)->_cnt)'
12119                 cnt_lval=$define
12120                 ;;
12121         *)      cnt_lval=$d_stdio_cnt_lval;;
12122         esac
12123         case "$stdio_base" in
12124         '') stdio_base='((fp)->_base)';;
12125         esac
12126         case "$stdio_bufsiz" in
12127         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12128         esac
12129 fi
12130
12131 : test whether _ptr and _cnt really work
12132 echo "Checking how std your stdio is..." >&4
12133 $cat >try.c <<EOP
12134 #include <stdio.h>
12135 #define FILE_ptr(fp)    $stdio_ptr
12136 #define FILE_cnt(fp)    $stdio_cnt
12137 int main() {
12138         FILE *fp = fopen("try.c", "r");
12139         char c = getc(fp);
12140         if (
12141                 18 <= FILE_cnt(fp) &&
12142                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12143         )
12144                 exit(0);
12145         exit(1);
12146 }
12147 EOP
12148 val="$undef"
12149 set try
12150 if eval $compile; then
12151         if ./try; then
12152                 echo "Your stdio acts pretty std."
12153                 val="$define"
12154         else
12155                 echo "Your stdio isn't very std."
12156         fi
12157 else
12158         echo "Your stdio doesn't appear very std."
12159 fi
12160 $rm -f try.c try
12161 set d_stdstdio
12162 eval $setvar
12163
12164 : Can _ptr be used as an lvalue?
12165 case "$d_stdstdio$ptr_lval" in
12166 $define$define) val=$define ;;
12167 *) val=$undef ;;
12168 esac
12169 set d_stdio_ptr_lval
12170 eval $setvar
12171
12172 : Can _cnt be used as an lvalue?
12173 case "$d_stdstdio$cnt_lval" in
12174 $define$define) val=$define ;;
12175 *) val=$undef ;;
12176 esac
12177 set d_stdio_cnt_lval
12178 eval $setvar
12179
12180
12181 : test whether setting _ptr sets _cnt as a side effect
12182 d_stdio_ptr_lval_sets_cnt="$undef"
12183 d_stdio_ptr_lval_nochange_cnt="$undef"
12184 case "$d_stdio_ptr_lval$d_stdstdio" in
12185 $define$define)
12186         echo "Checking to see what happens if we set the stdio ptr..." >&4
12187 $cat >try.c <<EOP
12188 #include <stdio.h>
12189 /* Can we scream? */
12190 /* Eat dust sed :-) */
12191 /* In the buffer space, no one can hear you scream. */
12192 #define FILE_ptr(fp)    $stdio_ptr
12193 #define FILE_cnt(fp)    $stdio_cnt
12194 #include <sys/types.h>
12195 int main() {
12196         FILE *fp = fopen("try.c", "r");
12197         int c;
12198         char *ptr;
12199         size_t cnt;
12200         if (!fp) {
12201             puts("Fail even to read");
12202             exit(1);
12203         }
12204         c = getc(fp); /* Read away the first # */
12205         if (c == EOF) {
12206             puts("Fail even to read");
12207             exit(1);
12208         }
12209         if (!(
12210                 18 <= FILE_cnt(fp) &&
12211                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12212         )) {
12213                 puts("Fail even to read");
12214                 exit (1);
12215         }
12216         ptr = (char*) FILE_ptr(fp);
12217         cnt = (size_t)FILE_cnt(fp);
12218
12219         FILE_ptr(fp) += 42;
12220
12221         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12222                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12223                 exit (1);
12224         }
12225         if (FILE_cnt(fp) <= 20) {
12226                 printf ("Fail (<20 chars to test)");
12227                 exit (1);
12228         }
12229         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12230                 puts("Fail compare");
12231                 exit (1);
12232         }
12233         if (cnt == FILE_cnt(fp)) {
12234                 puts("Pass_unchanged");
12235                 exit (0);
12236         }       
12237         if (FILE_cnt(fp) == (cnt - 42)) {
12238                 puts("Pass_changed");
12239                 exit (0);
12240         }
12241         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12242         return 1;
12243
12244 }
12245 EOP
12246         set try
12247         if eval $compile; then
12248                 case `./try$exe_ext` in
12249                 Pass_changed)
12250                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12251                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12252                 Pass_unchanged)
12253                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12254                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12255                 Fail*)
12256                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12257                 *)
12258                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12259         esac
12260         else
12261                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12262         fi
12263         $rm -f try.c try
12264         ;;
12265 esac
12266
12267 : see if _base is also standard
12268 val="$undef"
12269 case "$d_stdstdio" in
12270 $define)
12271         $cat >try.c <<EOP
12272 #include <stdio.h>
12273 #define FILE_base(fp)   $stdio_base
12274 #define FILE_bufsiz(fp) $stdio_bufsiz
12275 int main() {
12276         FILE *fp = fopen("try.c", "r");
12277         char c = getc(fp);
12278         if (
12279                 19 <= FILE_bufsiz(fp) &&
12280                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12281         )
12282                 exit(0);
12283         exit(1);
12284 }
12285 EOP
12286         set try
12287         if eval $compile; then
12288                 if ./try; then
12289                         echo "And its _base field acts std."
12290                         val="$define"
12291                 else
12292                         echo "But its _base field isn't std."
12293                 fi
12294         else
12295                 echo "However, it seems to be lacking the _base field."
12296         fi
12297         $rm -f try.c try
12298         ;;
12299 esac
12300 set d_stdiobase
12301 eval $setvar
12302
12303 $cat >&4 <<EOM
12304 Checking how to access stdio streams by file descriptor number...
12305 EOM
12306 case "$stdio_stream_array" in
12307 '')     $cat >try.c <<EOCP
12308 #include <stdio.h>
12309 int main() {
12310   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12311     printf("yes\n");
12312 }
12313 EOCP
12314         for s in _iob __iob __sF
12315         do
12316                 set try -DSTDIO_STREAM_ARRAY=$s
12317                 if eval $compile; then
12318                         case "`./try$exe_ext`" in
12319                         yes)    stdio_stream_array=$s; break ;;
12320                         esac
12321                 fi
12322         done
12323         $rm -f try.* try$exe_ext
12324 esac
12325 case "$stdio_stream_array" in
12326 '')     $cat >&4 <<EOM
12327 I can't figure out how to access stdio streams by file descriptor number.
12328 EOM
12329         d_stdio_stream_array="$undef"
12330         ;;
12331 *)      $cat >&4 <<EOM
12332 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12333 EOM
12334         d_stdio_stream_array="$define"
12335         ;;
12336 esac
12337
12338 : see if strcoll exists
12339 set strcoll d_strcoll
12340 eval $inlibc
12341
12342 : check for structure copying
12343 echo " "
12344 echo "Checking to see if your C compiler can copy structs..." >&4
12345 $cat >try.c <<'EOCP'
12346 int main()
12347 {
12348         struct blurfl {
12349                 int dyick;
12350         } foo, bar;
12351
12352         foo = bar;
12353 }
12354 EOCP
12355 if $cc -c try.c >/dev/null 2>&1 ; then
12356         val="$define"
12357         echo "Yup, it can."
12358 else
12359         val="$undef"
12360         echo "Nope, it can't."
12361 fi
12362 set d_strctcpy
12363 eval $setvar
12364 $rm -f try.*
12365
12366 : see if strerror and/or sys_errlist[] exist
12367 echo " "
12368 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12369     if set strerror val -f d_strerror; eval $csym; $val; then
12370                 echo 'strerror() found.' >&4
12371                 d_strerror="$define"
12372                 d_strerrm='strerror(e)'
12373                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12374                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12375                         d_syserrlst="$define"
12376                 else
12377                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12378                         d_syserrlst="$undef"
12379                 fi
12380     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12381                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12382                 echo 'strerror() found in string header.' >&4
12383                 d_strerror="$define"
12384                 d_strerrm='strerror(e)'
12385                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12386                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12387                                 d_syserrlst="$define"
12388                 else
12389                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12390                         d_syserrlst="$undef"
12391                 fi
12392     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12393                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12394                 d_strerror="$undef"
12395                 d_syserrlst="$define"
12396                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12397     else
12398                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12399                 d_strerror="$undef"
12400                 d_syserrlst="$undef"
12401                 d_strerrm='"unknown"'
12402     fi
12403 fi
12404
12405 : see if strftime exists
12406 set strftime d_strftime
12407 eval $inlibc
12408
12409 : see if strtod exists
12410 set strtod d_strtod
12411 eval $inlibc
12412
12413 : see if strtol exists
12414 set strtol d_strtol
12415 eval $inlibc
12416
12417 : see if strtold exists
12418 set strtold d_strtold
12419 eval $inlibc
12420
12421 : see if strtoll exists
12422 set strtoll d_strtoll
12423 eval $inlibc
12424
12425 case "$d_longlong-$d_strtoll" in
12426 "$define-$define")
12427         $cat <<EOM
12428 Checking whether your strtoll() works okay...
12429 EOM
12430         $cat >try.c <<'EOCP'
12431 #include <errno.h>
12432 #ifdef __hpux
12433 #define strtoll __strtoll
12434 #endif
12435 #ifdef __EMX__
12436 #define strtoll _strtoll
12437 #endif
12438 #include <stdio.h>
12439 extern long long int strtoll(char *s, char **, int); 
12440 static int bad = 0;
12441 int check(char *s, long long ell, int een) {
12442         long long gll;
12443         errno = 0;
12444         gll = strtoll(s, 0, 10);
12445         if (!((gll == ell) && (errno == een)))
12446                 bad++;
12447 }
12448 int main() {
12449         check(" 1",                                      1LL, 0);
12450         check(" 0",                                      0LL, 0);
12451         check("-1",                                     -1LL, 0);
12452         check("-9223372036854775808", -9223372036854775808LL, 0);
12453         check("-9223372036854775808", -9223372036854775808LL, 0);
12454         check(" 9223372036854775807",  9223372036854775807LL, 0);
12455         check("-9223372036854775808", -9223372036854775808LL, 0);
12456         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12457         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12458         if (!bad)
12459                 printf("ok\n");
12460 }
12461 EOCP
12462         set try
12463         if eval $compile; then
12464                 yyy=`./try`
12465                 case "$yyy" in
12466                 ok) echo "Your strtoll() seems to be working okay." ;;
12467                 *) cat <<EOM >&4
12468 Your strtoll() doesn't seem to be working okay.
12469 EOM
12470                    d_strtoll="$undef"
12471                    ;;
12472                 esac
12473         else
12474                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12475                 d_strtoll="$undef"
12476         fi
12477         ;;
12478 esac
12479
12480 : see if strtoq exists
12481 set strtoq d_strtoq
12482 eval $inlibc
12483
12484 : see if strtoul exists
12485 set strtoul d_strtoul
12486 eval $inlibc
12487
12488 case "$d_strtoul" in
12489 "$define")
12490         $cat <<EOM
12491 Checking whether your strtoul() works okay...
12492 EOM
12493         $cat >try.c <<'EOCP'
12494 #include <errno.h>
12495 #include <stdio.h>
12496 extern unsigned long int strtoul(char *s, char **, int); 
12497 static int bad = 0;
12498 void check(char *s, unsigned long eul, int een) {
12499         unsigned long gul;
12500         errno = 0;
12501         gul = strtoul(s, 0, 10);
12502         if (!((gul == eul) && (errno == een)))
12503                 bad++;
12504 }
12505 int main() {
12506         check(" 1", 1L, 0);
12507         check(" 0", 0L, 0);
12508 EOCP
12509         case "$longsize" in
12510         8)
12511             $cat >>try.c <<'EOCP'
12512         check("18446744073709551615", 18446744073709551615UL, 0);
12513         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12514 #if 0 /* strtoul() for /^-/ strings is undefined. */
12515         check("-1", 18446744073709551615UL, 0);
12516         check("-18446744073709551614", 2, 0);
12517         check("-18446744073709551615", 1, 0);
12518         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12519         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12520 #endif
12521 EOCP
12522                 ;;
12523         4)
12524                     $cat >>try.c <<'EOCP'
12525         check("4294967295", 4294967295UL, 0);
12526         check("4294967296", 4294967295UL, ERANGE);
12527 #if 0 /* strtoul() for /^-/ strings is undefined. */
12528         check("-1", 4294967295UL, 0);
12529         check("-4294967294", 2, 0);
12530         check("-4294967295", 1, 0);
12531         check("-4294967296", 4294967295UL, ERANGE);
12532         check("-4294967297", 4294967295UL, ERANGE);
12533 #endif
12534 EOCP
12535                 ;;
12536         *)
12537 : Should we write these tests to be more portable by sprintf-ing
12538 : ~0 and then manipulating that char string as input for strtol?
12539                 ;;
12540         esac
12541         $cat >>try.c <<'EOCP'
12542         if (!bad)
12543                 printf("ok\n");
12544         return 0;
12545 }
12546 EOCP
12547         set try
12548         if eval $compile; then
12549                 case "`./try`" in
12550                 ok) echo "Your strtoul() seems to be working okay." ;;
12551                 *) cat <<EOM >&4
12552 Your strtoul() doesn't seem to be working okay.
12553 EOM
12554                    d_strtoul="$undef"
12555                    ;;
12556                 esac
12557         fi
12558         ;;
12559 esac
12560
12561 : see if strtoull exists
12562 set strtoull d_strtoull
12563 eval $inlibc
12564
12565 case "$d_longlong-$d_strtoull" in
12566 "$define-$define")
12567         $cat <<EOM
12568 Checking whether your strtoull() works okay...
12569 EOM
12570         $cat >try.c <<'EOCP'
12571 #include <errno.h>
12572 #ifdef __hpux
12573 #define strtoull __strtoull
12574 #endif
12575 #include <stdio.h>
12576 extern unsigned long long int strtoull(char *s, char **, int); 
12577 static int bad = 0;
12578 int check(char *s, long long eull, int een) {
12579         long long gull;
12580         errno = 0;
12581         gull = strtoull(s, 0, 10);
12582         if (!((gull == eull) && (errno == een)))
12583                 bad++;
12584 }
12585 int main() {
12586         check(" 1",                                        1LL, 0);
12587         check(" 0",                                        0LL, 0);
12588         check("18446744073709551615",  18446744073709551615ULL, 0);
12589         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12590 #if 0 /* strtoull() for /^-/ strings is undefined. */
12591         check("-1",                    18446744073709551615ULL, 0);
12592         check("-18446744073709551614",                     2LL, 0);
12593         check("-18446744073709551615",                     1LL, 0);
12594         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12595         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12596 #endif
12597         if (!bad)
12598                 printf("ok\n");
12599 }
12600 EOCP
12601         set try
12602         if eval $compile; then
12603                 case "`./try`" in
12604                 ok) echo "Your strtoull() seems to be working okay." ;;
12605                 *) cat <<EOM >&4
12606 Your strtoull() doesn't seem to be working okay.
12607 EOM
12608                    d_strtoull="$undef"
12609                    ;;
12610                 esac
12611         fi
12612         ;;
12613 esac
12614
12615 : see if strtouq exists
12616 set strtouq d_strtouq
12617 eval $inlibc
12618
12619 case "$d_strtouq" in
12620 "$define")
12621         $cat <<EOM
12622 Checking whether your strtouq() works okay...
12623 EOM
12624         $cat >try.c <<'EOCP'
12625 #include <errno.h>
12626 #include <stdio.h>
12627 extern unsigned long long int strtouq(char *s, char **, int); 
12628 static int bad = 0;
12629 void check(char *s, unsigned long long eull, int een) {
12630         unsigned long long gull;
12631         errno = 0;
12632         gull = strtouq(s, 0, 10);
12633         if (!((gull == eull) && (errno == een)))
12634                 bad++;
12635 }
12636 int main() {
12637         check(" 1",                                        1LL, 0);
12638         check(" 0",                                        0LL, 0);
12639         check("18446744073709551615",  18446744073709551615ULL, 0);
12640         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12641 #if 0 /* strtouq() for /^-/ strings is undefined. */
12642         check("-1",                    18446744073709551615ULL, 0);
12643         check("-18446744073709551614",                     2LL, 0);
12644         check("-18446744073709551615",                     1LL, 0);
12645         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12646         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12647 #endif
12648         if (!bad)
12649                 printf("ok\n");
12650         return 0;
12651 }
12652 EOCP
12653         set try
12654         if eval $compile; then
12655                 case "`./try`" in
12656                 ok) echo "Your strtouq() seems to be working okay." ;;
12657                 *) cat <<EOM >&4
12658 Your strtouq() doesn't seem to be working okay.
12659 EOM
12660                    d_strtouq="$undef"
12661                    ;;
12662                 esac
12663         fi
12664         ;;
12665 esac
12666
12667 : see if strxfrm exists
12668 set strxfrm d_strxfrm
12669 eval $inlibc
12670
12671 : see if symlink exists
12672 set symlink d_symlink
12673 eval $inlibc
12674
12675 : see if syscall exists
12676 set syscall d_syscall
12677 eval $inlibc
12678
12679 : see if prototype for syscall is available
12680 echo " "
12681 set d_syscallproto syscall $i_unistd unistd.h
12682 eval $hasproto
12683
12684 : see if sysconf exists
12685 set sysconf d_sysconf
12686 eval $inlibc
12687
12688 : see if system exists
12689 set system d_system
12690 eval $inlibc
12691
12692 : see if tcgetpgrp exists
12693 set tcgetpgrp d_tcgetpgrp
12694 eval $inlibc
12695
12696 : see if tcsetpgrp exists
12697 set tcsetpgrp d_tcsetpgrp
12698 eval $inlibc
12699
12700 : see if prototype for telldir is available
12701 echo " "
12702 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12703 eval $hasproto
12704
12705 : see if this is a sys/times.h system
12706 set sys/times.h i_systimes
12707 eval $inhdr
12708
12709 : see if times exists
12710 echo " "
12711 if set times val -f d_times; eval $csym; $val; then
12712         echo 'times() found.' >&4
12713         d_times="$define"
12714         inc=''
12715         case "$i_systimes" in
12716         "$define") inc='sys/times.h';;
12717         esac
12718         rp="What is the type returned by times() on this system?"
12719         set clock_t clocktype long stdio.h sys/types.h $inc
12720         eval $typedef_ask
12721 else
12722         echo 'times() NOT found, hope that will do.' >&4
12723         d_times="$undef"
12724         clocktype='int'
12725 fi
12726
12727 : see if truncate exists
12728 set truncate d_truncate
12729 eval $inlibc
12730
12731 : see if tzname[] exists
12732 echo " "
12733 if set tzname val -a d_tzname; eval $csym; $val; then
12734         val="$define"
12735         echo 'tzname[] found.' >&4
12736 else
12737         val="$undef"
12738         echo 'tzname[] NOT found.' >&4
12739 fi
12740 set d_tzname
12741 eval $setvar
12742
12743 case "$crosscompile" in
12744 ''|[nN]*) crosscompile="$undef" ;;
12745 esac
12746
12747 case "$osname" in
12748 next|rhapsody|darwin) multiarch="$define" ;;
12749 esac
12750 case "$multiarch" in
12751 ''|[nN]*) multiarch="$undef" ;;
12752 esac
12753
12754 : check for ordering of bytes in a long
12755 echo " "
12756 case "$crosscompile$multiarch" in
12757 *$define*)
12758         $cat <<EOM
12759 You seem to be either cross-compiling or doing a multiarchitecture build,
12760 skipping the byteorder check.
12761
12762 EOM
12763         byteorder='0xffff'
12764         ;;
12765 *)
12766         case "$byteorder" in
12767         '')
12768                 $cat <<'EOM'
12769 In the following, larger digits indicate more significance.  A big-endian
12770 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12771 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12772 machines may have weird orders like 3412.  A Cray will report 87654321,
12773 an Alpha will report 12345678. If the test program works the default is
12774 probably right.
12775 I'm now running the test program...
12776 EOM
12777                 $cat >try.c <<'EOCP'
12778 #include <stdio.h>
12779 int main()
12780 {
12781         int i;
12782         union {
12783                 unsigned long l;
12784                 char c[sizeof(long)];
12785         } u;
12786
12787         if (sizeof(long) > 4)
12788                 u.l = (0x08070605L << 32) | 0x04030201L;
12789         else
12790                 u.l = 0x04030201L;
12791         for (i = 0; i < sizeof(long); i++)
12792                 printf("%c", u.c[i]+'0');
12793         printf("\n");
12794         exit(0);
12795 }
12796 EOCP
12797                 xxx_prompt=y
12798                 set try
12799                 if eval $compile && ./try > /dev/null; then
12800                         dflt=`./try`
12801                         case "$dflt" in
12802                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12803                                 echo "(The test program ran ok.)"
12804                                 echo "byteorder=$dflt"
12805                                 xxx_prompt=n
12806                         ;;
12807                         ????|????????) echo "(The test program ran ok.)" ;;
12808                         *) echo "(The test program didn't run right for some reason.)" ;;
12809                         esac
12810                 else
12811                         dflt='4321'
12812                         cat <<'EOM'
12813 (I can't seem to compile the test program.  Guessing big-endian...)
12814 EOM
12815                 fi
12816                 case "$xxx_prompt" in
12817                 y)
12818                         rp="What is the order of bytes in a long?"
12819                         . ./myread
12820                         byteorder="$ans"
12821                         ;;
12822                 *)      byteorder=$dflt
12823                         ;;
12824                 esac
12825                 ;;
12826         esac
12827         $rm -f try.c try
12828         ;;
12829 esac
12830
12831
12832 $cat <<EOM
12833
12834 Checking to see whether you can access character data unalignedly...
12835 EOM
12836 $cat >try.c <<EOCP
12837 #include <stdio.h>
12838 #define U32 $u32type
12839 #define BYTEORDER $byteorder
12840 int main() {
12841 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12842     U8 buf[] = "\0\0\0\1\0\0\0\0";
12843     U32 *up;
12844     int i;
12845
12846     if (sizeof(U32) != 4) {
12847         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12848         exit(1);
12849     }
12850
12851     fflush(stdout);
12852
12853     for (i = 0; i < 4; i++) {
12854         up = (U32*)(buf + i);
12855         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12856                (*up == 1 << (8*(3-i)))  /* little-endian */
12857               )
12858            )
12859         {
12860             printf("read failed (%x)\n", *up);
12861             exit(2);
12862         }
12863     }
12864
12865     /* write test */
12866     for (i = 0; i < 4; i++) {
12867         up = (U32*)(buf + i);
12868         *up = 0xBeef;
12869         if (*up != 0xBeef) {
12870             printf("write failed (%x)\n", *up);
12871             exit(3);
12872         }
12873     }
12874
12875     exit(0);
12876 #else
12877     printf("1\n");
12878     exit(1);
12879 #endif
12880     return 0;
12881 }
12882 EOCP
12883 set try
12884 if eval $compile_ok; then
12885         echo "(This test may dump core.)" >&4
12886         ./try >&2 >/dev/null
12887         case "$?" in
12888         0)      cat >&4 <<EOM
12889 You can access character data pretty unalignedly.
12890 EOM
12891                 d_u32align="$undef"
12892                 ;;
12893         *)      cat >&4 <<EOM
12894 It seems that you must access character data in an aligned manner.
12895 EOM
12896                 d_u32align="$define"
12897                 ;;
12898         esac
12899         $rm -f core core.try.* try.core
12900 else
12901         rp='Can you access character data at unaligned addresses?'
12902         dflt='n'
12903         . ./myread
12904         case "$ans" in
12905         [yY]*)  d_u32align="$undef"  ;;
12906         *)      d_u32align="$define" ;;
12907         esac
12908 fi
12909
12910 : see if ualarm exists
12911 set ualarm d_ualarm
12912 eval $inlibc
12913
12914 : see if umask exists
12915 set umask d_umask
12916 eval $inlibc
12917
12918 : see if usleep exists
12919 set usleep d_usleep
12920 eval $inlibc
12921
12922 : see if prototype for usleep is available
12923 echo " "
12924 set d_usleepproto usleep $i_unistd unistd.h
12925 eval $hasproto
12926
12927 : see if ustat exists
12928 set ustat d_ustat
12929 eval $inlibc
12930
12931 : backward compatibility for d_hvfork
12932 if test X$d_hvfork != X; then
12933         d_vfork="$d_hvfork"
12934         d_hvfork=''
12935 fi
12936 : see if there is a vfork
12937 val=''
12938 set vfork val
12939 eval $inlibc
12940
12941 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12942 : perl on Solaris 2.x, and probably elsewhere.
12943 case "$val" in
12944 $define)
12945         echo " "
12946         case "$usevfork" in
12947         false) dflt='n';;
12948         *) dflt='y';;
12949         esac
12950         cat <<'EOM'
12951  
12952 Perl can only use a vfork() that doesn't suffer from strict
12953 restrictions on calling functions or modifying global data in
12954 the child.  For example, glibc-2.1 contains such a vfork()
12955 that is unsuitable.  If your system provides a proper fork()
12956 call, chances are that you do NOT want perl to use vfork().
12957
12958 EOM
12959         rp="Do you still want to use vfork()?"
12960         . ./myread
12961         case "$ans" in
12962         y|Y) ;;
12963         *)
12964                 echo "Ok, we won't use vfork()."
12965                 val="$undef"
12966                 ;;
12967         esac
12968         ;;
12969 esac
12970 set d_vfork
12971 eval $setvar
12972 case "$d_vfork" in
12973 $define) usevfork='true';;
12974 *) usevfork='false';;
12975 esac
12976
12977 : see if this is an sysdir system
12978 set sys/dir.h i_sysdir
12979 eval $inhdr
12980
12981 : see if this is an sysndir system
12982 set sys/ndir.h i_sysndir
12983 eval $inhdr
12984
12985 : see if closedir exists
12986 set closedir d_closedir
12987 eval $inlibc
12988
12989 case "$d_closedir" in
12990 "$define")
12991         echo " "
12992         echo "Checking whether closedir() returns a status..." >&4
12993         cat > closedir.c <<EOM
12994 #$i_dirent I_DIRENT             /**/
12995 #$i_sysdir I_SYS_DIR            /**/
12996 #$i_sysndir I_SYS_NDIR          /**/
12997 #$i_systypes I_SYS_TYPES        /**/
12998
12999 #if defined(I_SYS_TYPES)
13000 #include <sys/types.h>
13001 #endif
13002 #if defined(I_DIRENT)
13003 #include <dirent.h>
13004 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13005 #include <sys/dir.h>
13006 #endif
13007 #else
13008 #ifdef I_SYS_NDIR
13009 #include <sys/ndir.h>
13010 #else
13011 #ifdef I_SYS_DIR
13012 #ifdef hp9000s500
13013 #include <ndir.h>       /* may be wrong in the future */
13014 #else
13015 #include <sys/dir.h>
13016 #endif
13017 #endif
13018 #endif
13019 #endif 
13020 int main() { return closedir(opendir(".")); }
13021 EOM
13022         set closedir
13023         if eval $compile_ok; then
13024                 if ./closedir > /dev/null 2>&1 ; then
13025                         echo "Yes, it does."
13026                         val="$undef"
13027                 else
13028                         echo "No, it doesn't."
13029                         val="$define"
13030                 fi
13031         else
13032                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13033                 val="$define"
13034         fi
13035         ;;
13036 *)
13037         val="$undef";
13038         ;;
13039 esac
13040 set d_void_closedir
13041 eval $setvar
13042 $rm -f closedir*
13043 : see if there is a wait4
13044 set wait4 d_wait4
13045 eval $inlibc
13046
13047 : see if waitpid exists
13048 set waitpid d_waitpid
13049 eval $inlibc
13050
13051 : see if wcstombs exists
13052 set wcstombs d_wcstombs
13053 eval $inlibc
13054
13055 : see if wctomb exists
13056 set wctomb d_wctomb
13057 eval $inlibc
13058
13059 : see if writev exists
13060 set writev d_writev
13061 eval $inlibc
13062
13063 : preserve RCS keywords in files with variable substitution, grrr
13064 Date='$Date'
13065 Id='$Id'
13066 Log='$Log'
13067 RCSfile='$RCSfile'
13068 Revision='$Revision'
13069
13070 : check for alignment requirements
13071 echo " "
13072 case "$crosscompile$multiarch" in
13073 *$define*)
13074         $cat <<EOM
13075 You seem to be either cross-compiling or doing a multiarchitecture build,
13076 skipping the memory alignment check.
13077
13078 EOM
13079         case "$alignbytes" in
13080         '') alignbytes=8 ;;
13081         esac
13082         ;;
13083 *)
13084         case "$alignbytes" in
13085         '') echo "Checking alignment constraints..." >&4
13086                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13087                         $cat >try.c <<'EOCP'
13088 typedef long double NV;
13089 EOCP
13090                 else
13091                         $cat >try.c <<'EOCP'
13092 typedef double NV;
13093 EOCP
13094                 fi
13095                 $cat >>try.c <<'EOCP'
13096 #include <stdio.h>
13097 struct foobar {
13098         char foo;
13099         NV bar;
13100 } try_algn;
13101 int main()
13102 {
13103     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13104     return(0);
13105 }
13106 EOCP
13107                 set try
13108                 if eval $compile_ok; then
13109                         dflt=`./try`
13110                 else
13111                         dflt='8'
13112                         echo "(I can't seem to compile the test program...)"
13113                 fi
13114                 ;;
13115         *) dflt="$alignbytes"
13116                 ;;
13117         esac
13118         rp="Doubles must be aligned on a how-many-byte boundary?"
13119         . ./myread
13120         alignbytes="$ans"
13121         $rm -f try.c try
13122         ;;
13123 esac
13124
13125
13126 : set the base revision
13127 baserev=5.0
13128
13129 : how do we catenate cpp tokens here?
13130 echo " "
13131 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13132 $cat >cpp_stuff.c <<'EOCP'
13133 #define RCAT(a,b)a/**/b
13134 #define ACAT(a,b)a ## b
13135 RCAT(Rei,ser)
13136 ACAT(Cir,cus)
13137 EOCP
13138 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13139 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13140         echo "Oh!  Smells like ANSI's been here." >&4
13141         echo "We can catify or stringify, separately or together!"
13142         cpp_stuff=42
13143 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13144         echo "Ah, yes!  The good old days!" >&4
13145         echo "However, in the good old days we don't know how to stringify and"
13146         echo "catify at the same time."
13147         cpp_stuff=1
13148 else
13149         $cat >&4 <<EOM
13150 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13151 to have to edit the values of CAT[2-5] in config.h...
13152 EOM
13153         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13154 fi
13155 $rm -f cpp_stuff.*
13156
13157 : see if this is a db.h system
13158 set db.h i_db
13159 eval $inhdr
13160
13161 case "$i_db" in
13162 $define)
13163         : Check db version.
13164         echo " "
13165         echo "Checking Berkeley DB version ..." >&4
13166         $cat >try.c <<EOCP
13167 #$d_const HASCONST
13168 #ifndef HASCONST
13169 #define const
13170 #endif
13171 #include <sys/types.h>
13172 #include <stdio.h>
13173 #include <db.h>
13174 int main(int argc, char *argv[])
13175 {
13176 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13177     int Major, Minor, Patch ;
13178     unsigned long Version ;
13179     (void)db_version(&Major, &Minor, &Patch) ;
13180     if (argc == 2) {
13181         printf("%d %d %d %d %d %d\n",
13182                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13183                Major, Minor, Patch);
13184         exit(0);
13185     }
13186     printf("You have Berkeley DB Version 2 or greater.\n");
13187
13188     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13189                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13190     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13191                 Major, Minor, Patch) ;
13192
13193     /* check that db.h & libdb are compatible */
13194     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13195         printf("db.h and libdb are incompatible.\n") ;
13196         exit(3);        
13197     }
13198
13199     printf("db.h and libdb are compatible.\n") ;
13200
13201     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13202                 + DB_VERSION_PATCH ;
13203
13204     /* needs to be >= 2.3.4 */
13205     if (Version < 2003004) {
13206     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13207         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13208         exit(2);        
13209     }
13210
13211     exit(0);
13212 #else
13213 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13214     if (argc == 2) {
13215         printf("1 0 0\n");
13216         exit(0);
13217     }
13218     printf("You have Berkeley DB Version 1.\n");
13219     exit(0);    /* DB version < 2: the coast is clear. */
13220 #else
13221     exit(1);    /* <db.h> not Berkeley DB? */
13222 #endif
13223 #endif
13224 }
13225 EOCP
13226         set try
13227         if eval $compile_ok && ./try; then
13228                 echo 'Looks OK.' >&4
13229                 set `./try 1`
13230                 db_version_major=$1
13231                 db_version_minor=$2
13232                 db_version_patch=$3
13233         else
13234                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13235                 i_db=$undef
13236                 case " $libs " in
13237                 *"-ldb "*)
13238                         : Remove db from list of libraries to use
13239                         echo "Removing unusable -ldb from library list" >&4
13240                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13241                         shift
13242                         libs="$*"
13243                         echo "libs = $libs" >&4
13244                         ;;
13245                 esac
13246         fi
13247         $rm -f try.*
13248         ;;
13249 esac
13250
13251 case "$i_db" in
13252 define)
13253         : Check the return type needed for hash 
13254         echo " "
13255         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13256         $cat >try.c <<EOCP
13257 #$d_const HASCONST
13258 #ifndef HASCONST
13259 #define const
13260 #endif
13261 #include <sys/types.h>
13262 #include <db.h>
13263
13264 #ifndef DB_VERSION_MAJOR
13265 u_int32_t hash_cb (ptr, size)
13266 const void *ptr;
13267 size_t size;
13268 {
13269 }
13270 HASHINFO info;
13271 int main()
13272 {
13273         info.hash = hash_cb;
13274 }
13275 #endif
13276 EOCP
13277         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13278                 if $contains warning try.out >>/dev/null 2>&1 ; then
13279                         db_hashtype='int'
13280                 else
13281                         db_hashtype='u_int32_t'
13282                 fi
13283         else
13284                 : XXX Maybe we should just give up here.
13285                 db_hashtype=u_int32_t
13286                 $cat try.out >&4
13287                 echo "Help:  I can't seem to compile the db test program." >&4
13288                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13289         fi
13290         $rm -f try.*
13291         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13292         ;;
13293 *)      db_hashtype=u_int32_t
13294         ;;
13295 esac
13296 case "$i_db" in
13297 define)
13298         : Check the return type needed for prefix 
13299         echo " "
13300         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13301         cat >try.c <<EOCP
13302 #$d_const HASCONST
13303 #ifndef HASCONST
13304 #define const
13305 #endif
13306 #include <sys/types.h>
13307 #include <db.h>
13308
13309 #ifndef DB_VERSION_MAJOR
13310 size_t prefix_cb (key1, key2)
13311 const DBT *key1;
13312 const DBT *key2;
13313 {
13314 }
13315 BTREEINFO info;
13316 int main()
13317 {
13318         info.prefix = prefix_cb;
13319 }
13320 #endif
13321 EOCP
13322         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13323                 if $contains warning try.out >>/dev/null 2>&1 ; then
13324                         db_prefixtype='int'
13325                 else
13326                         db_prefixtype='size_t'
13327                 fi
13328         else
13329                 db_prefixtype='size_t'
13330                 : XXX Maybe we should just give up here.
13331                 $cat try.out >&4
13332                 echo "Help:  I can't seem to compile the db test program." >&4
13333                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13334         fi
13335         $rm -f try.*
13336         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13337         ;;
13338 *)      db_prefixtype='size_t'
13339         ;;
13340 esac
13341
13342
13343 : How can we generate normalized random numbers ?
13344 echo " "
13345 echo "Looking for a random number function..." >&4
13346 case "$randfunc" in
13347 '')
13348         if set drand48 val -f; eval $csym; $val; then
13349                 dflt="drand48"
13350                 echo "Good, found drand48()." >&4
13351         elif set random val -f; eval $csym; $val; then
13352                 dflt="random"
13353                 echo "OK, found random()." >&4
13354         else
13355                 dflt="rand"
13356                 echo "Yick, looks like I have to use rand()." >&4
13357         fi
13358         echo " "
13359         ;;
13360 *)
13361         dflt="$randfunc"
13362         ;;
13363 esac
13364 cont=true
13365
13366 case "$ccflags" in
13367 *-Dmy_rand=*|*-Dmy_srand=*)
13368         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13369         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13370         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13371         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13372         ;;
13373 esac
13374
13375 while $test "$cont"; do
13376         rp="Use which function to generate random numbers?"
13377         . ./myread
13378         if $test "$ans" = "$dflt"; then
13379                 : null
13380         else
13381                 randbits=''
13382         fi
13383         randfunc="$ans"
13384         if set $ans val -f; eval $csym; $val; then
13385                 cont=''
13386         else
13387                 dflt=y
13388                 rp="I cannot find function $ans. Use that name anyway?"
13389                 . ./myread
13390                 dflt=rand
13391                 case "$ans" in
13392                         [yY]*) cont='';;
13393                 esac
13394         fi
13395         case "$cont" in
13396         '')
13397                 case "$randfunc" in
13398                 drand48)
13399                         drand01="drand48()"
13400                         seedfunc="srand48"
13401                         randbits=48
13402                         randseedtype=long
13403                         ;;
13404                 rand|random)
13405                         case "$randbits" in
13406                         '')
13407 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13408                                 $cat >try.c <<EOCP
13409 #$i_unistd I_UNISTD
13410 #$i_stdlib I_STDLIB
13411 #include <stdio.h>
13412 #ifdef I_UNISTD
13413 #  include <unistd.h>
13414 #endif
13415 #ifdef I_STDLIB
13416 #  include <stdlib.h>
13417 #endif
13418 int main()
13419 {
13420         register int i;
13421         register unsigned long tmp;
13422         register unsigned long max = 0L;
13423
13424         for (i = 1000; i; i--) {
13425                 tmp = (unsigned long) $randfunc();
13426                 if (tmp > max) max = tmp;
13427         }
13428         for (i = 0; max; i++)
13429                 max /= 2;
13430         printf("%d\n",i);
13431 }
13432 EOCP
13433                                 set try
13434                                 if eval $compile_ok; then
13435                                         dflt=`try`
13436                                 else
13437                                         dflt='?'
13438                                         echo "(I can't seem to compile the test program...)"
13439                                 fi
13440                                 ;;
13441                         *)
13442                                 dflt="$randbits"
13443                                 ;;
13444                         esac
13445                         rp="How many bits does your $randfunc() function produce?"
13446                         . ./myread
13447                         randbits="$ans"
13448                         $rm -f try.c try
13449                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13450                         seedfunc="s$randfunc"
13451                         randseedtype=unsigned
13452                         ;;
13453                 *)
13454                         dflt="31"
13455                         rp="How many bits does your $randfunc() function produce?"
13456                         . ./myread
13457                         randbits="$ans"
13458                         seedfunc="s$randfunc"
13459                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13460                         if set $seedfunc val -f; eval $csym; $val; then
13461                                 echo "(Using $seedfunc() to seed random generator)"
13462                         else
13463                                 echo "(Warning: no $seedfunc() to seed random generator)"
13464                                 seedfunc=rand
13465                         fi
13466                         randseedtype=unsigned
13467                         ;;
13468                 esac
13469                 ;;
13470         esac
13471 done
13472
13473 echo " "
13474 echo "Determining whether or not we are on an EBCDIC system..." >&4
13475 $cat >tebcdic.c <<'EOM'
13476 int main()
13477 {
13478   if ('M'==0xd4) return 0;
13479   return 1;
13480 }
13481 EOM
13482
13483 val=$undef
13484 set tebcdic
13485 if eval $compile_ok; then
13486         if ./tebcdic; then
13487                 echo "You seem to speak EBCDIC." >&4
13488                 val="$define"
13489         else
13490                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13491         fi
13492 else
13493         echo "I'm unable to compile the test program." >&4
13494         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13495 fi
13496 $rm -f tebcdic.c tebcdic
13497 set ebcdic
13498 eval $setvar
13499
13500 echo " "
13501 $cat >&4 <<EOM
13502 Checking how to flush all pending stdio output...
13503 EOM
13504 # I only know how to find the first 32 possibly open files on SunOS.
13505 # See also hints/sunos_4_1.sh and util.c  --AD
13506 case "$osname" in
13507 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13508 esac
13509 $cat >>try.c <<EOCP
13510 #include <stdio.h>
13511 #$i_unistd I_UNISTD
13512 #ifdef I_UNISTD
13513 # include <unistd.h>
13514 #endif
13515 #$d_sysconf HAS_SYSCONF
13516 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13517 #ifdef HAS_STDIO_STREAM_ARRAY
13518 # define STDIO_STREAM_ARRAY $stdio_stream_array
13519 #endif
13520 int main() {
13521   FILE* p = fopen("try.out", "w");
13522 #ifdef TRY_FPUTC
13523   fputc('x', p);
13524 #else
13525 # ifdef TRY_FPRINTF
13526   fprintf(p, "x");
13527 # endif
13528 #endif
13529 #ifdef TRY_FFLUSH_NULL
13530   fflush(NULL);
13531 #endif
13532 #ifdef TRY_FFLUSH_ALL
13533   {
13534     long open_max = -1;
13535 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13536     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13537 # else
13538 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13539     open_max = sysconf(_SC_OPEN_MAX);
13540 #  else
13541 #   ifdef FOPEN_MAX
13542     open_max = FOPEN_MAX;
13543 #   else
13544 #    ifdef OPEN_MAX
13545     open_max = OPEN_MAX;
13546 #    else
13547 #     ifdef _NFILE
13548     open_max = _NFILE;
13549 #     endif
13550 #    endif
13551 #   endif
13552 #  endif
13553 # endif 
13554 # ifdef HAS_STDIO_STREAM_ARRAY
13555     if (open_max > 0) {
13556       long i;
13557       for (i = 0; i < open_max; i++)
13558             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13559                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13560                 STDIO_STREAM_ARRAY[i]._flag)
13561                 fflush(&STDIO_STREAM_ARRAY[i]);
13562     }   
13563   }
13564 # endif
13565 #endif
13566   _exit(42);
13567 }
13568 EOCP
13569 : first we have to find out how _not_ to flush
13570 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13571     output=''
13572     set try -DTRY_FPUTC
13573     if eval $compile; then
13574             $rm -f try.out
13575             ./try$exe_ext 2>/dev/null
13576             if $test ! -s try.out -a "X$?" = X42; then
13577                 output=-DTRY_FPUTC
13578             fi
13579     fi
13580     case "$output" in
13581     '')
13582             set try -DTRY_FPRINTF
13583             $rm -f try.out
13584             if eval $compile; then
13585                     $rm -f try.out
13586                     ./try$exe_ext 2>/dev/null
13587                     if $test ! -s try.out -a "X$?" = X42; then
13588                         output=-DTRY_FPRINTF
13589                     fi
13590             fi
13591         ;;
13592     esac
13593 fi
13594 : check for fflush NULL behaviour
13595 case "$fflushNULL" in
13596 '')     set try -DTRY_FFLUSH_NULL $output
13597         if eval $compile; then
13598                 $rm -f try.out
13599                 ./try$exe_ext 2>/dev/null
13600                 code="$?"
13601                 if $test -s try.out -a "X$code" = X42; then
13602                         fflushNULL="`$cat try.out`"
13603                 else
13604                         if $test "X$code" != X42; then
13605                                 $cat >&4 <<EOM
13606 (If this test failed, don't worry, we'll try another method shortly.)
13607 EOM
13608                         fi
13609                 fi
13610         fi
13611         $rm -f core try.core core.try.*
13612         case "$fflushNULL" in
13613         x)      $cat >&4 <<EOM
13614 Your fflush(NULL) works okay for output streams.
13615 Let's see if it clobbers input pipes...
13616 EOM
13617 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13618 # bug that improperly flushes the input end of pipes.  So we avoid the
13619 # autoflush on fork/system/exec support for now. :-(
13620 $cat >tryp.c <<EOCP
13621 #include <stdio.h>
13622 int
13623 main(int argc, char **argv)
13624 {
13625     char buf[1024];
13626     int i;
13627     char *bp = buf;
13628     while (1) {
13629         while ((i = getc(stdin)) != -1
13630                && (*bp++ = i) != '\n'
13631                && bp < &buf[1024])
13632         /* DO NOTHING */ ;
13633         *bp = '\0';
13634         fprintf(stdout, "%s", buf);
13635         fflush(NULL);
13636         if (i == -1)
13637             return 0;
13638         bp = buf;
13639     }
13640 }
13641 EOCP
13642                 fflushNULL="$define"
13643                 set tryp
13644                 if eval $compile; then
13645                     $rm -f tryp.out
13646                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13647                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13648                        $cat >&4 <<EOM
13649 fflush(NULL) seems to behave okay with input streams.
13650 EOM
13651                         fflushNULL="$define"
13652                     else
13653                         $cat >&4 <<EOM
13654 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13655 EOM
13656                         fflushNULL="$undef"
13657                     fi
13658                 fi
13659                 $rm -f core tryp.c tryp.core core.tryp.*
13660                 ;;
13661         '')     $cat >&4 <<EOM
13662 Your fflush(NULL) isn't working (contrary to ANSI C).
13663 EOM
13664                 fflushNULL="$undef"
13665                 ;;
13666         *)      $cat >&4 <<EOM
13667 Cannot figure out whether your fflush(NULL) works or not.
13668 I'm assuming it doesn't (contrary to ANSI C).
13669 EOM
13670                 fflushNULL="$undef"
13671                 ;;
13672         esac
13673         ;;
13674 $define|true|[yY]*)
13675         fflushNULL="$define"
13676         ;;
13677 *)
13678         fflushNULL="$undef"
13679         ;;
13680 esac
13681 : check explicit looping only if NULL did not work, and if the pipe
13682 : bug does not show up on an explicit flush too
13683 case "$fflushNULL" in
13684 "$undef")
13685         $cat >tryp.c <<EOCP
13686 #include <stdio.h>
13687 int
13688 main(int argc, char **argv)
13689 {
13690     char buf[1024];
13691     int i;
13692     char *bp = buf;
13693     while (1) {
13694         while ((i = getc(stdin)) != -1
13695                && (*bp++ = i) != '\n'
13696                && bp < &buf[1024])
13697         /* DO NOTHING */ ;
13698         *bp = '\0';
13699         fprintf(stdout, "%s", buf);
13700         fflush(stdin);
13701         if (i == -1)
13702             return 0;
13703         bp = buf;
13704     }
13705 }
13706 EOCP
13707         set tryp
13708         if eval $compile; then
13709             $rm -f tryp.out
13710             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13711             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13712                $cat >&4 <<EOM
13713 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13714 EOM
13715                 : now check for fflushall behaviour
13716                 case "$fflushall" in
13717                 '')     set try -DTRY_FFLUSH_ALL $output
13718                         if eval $compile; then
13719                                 $cat >&4 <<EOM
13720 (Now testing the other method--but note that this also may fail.)
13721 EOM
13722                                 $rm -f try.out
13723                                 ./try$exe_ext 2>/dev/null
13724                                 if $test -s try.out -a "X$?" = X42; then
13725                                         fflushall="`$cat try.out`"
13726                                 fi
13727                         fi
13728                         $rm -f core try.core core.try.*
13729                         case "$fflushall" in
13730                         x)      $cat >&4 <<EOM
13731 Whew. Flushing explicitly all the stdio streams works.
13732 EOM
13733                                 fflushall="$define"
13734                                 ;;
13735                         '')     $cat >&4 <<EOM
13736 Sigh. Flushing explicitly all the stdio streams doesn't work.
13737 EOM
13738                                 fflushall="$undef"
13739                                 ;;
13740                         *)      $cat >&4 <<EOM
13741 Cannot figure out whether flushing stdio streams explicitly works or not.
13742 I'm assuming it doesn't.
13743 EOM
13744                                 fflushall="$undef"
13745                                 ;;
13746                         esac
13747                         ;;
13748                 "$define"|true|[yY]*)
13749                         fflushall="$define"
13750                         ;;
13751                 *)
13752                         fflushall="$undef"
13753                         ;;
13754                 esac
13755             else
13756                 $cat >&4 <<EOM
13757 All is futile.  Even fflush(stdin) clobbers input pipes!
13758 EOM
13759                 fflushall="$undef"
13760             fi
13761         else
13762             fflushall="$undef"
13763         fi
13764         $rm -f core tryp.c tryp.core core.tryp.*
13765         ;;
13766 *)      fflushall="$undef"
13767         ;;
13768 esac
13769
13770 case "$fflushNULL$fflushall" in
13771 undefundef)
13772         $cat <<EOM
13773 OK, I give up.  I cannot figure out how to flush pending stdio output.
13774 We won't be flushing handles at all before fork/exec/popen.
13775 EOM
13776         ;;
13777 esac
13778 $rm -f try.* try$exe_ext
13779
13780 : Store the full pathname to the ar program for use in the C program
13781 : Respect a hint or command line value for full_ar.
13782 case "$full_ar" in
13783 '') full_ar=$ar ;;
13784 esac
13785
13786 : Store the full pathname to the sed program for use in the C program
13787 full_sed=$sed
13788
13789 : see what type gids are declared as in the kernel
13790 echo " "
13791 echo "Looking for the type for group ids returned by getgid()."
13792 set gid_t gidtype xxx stdio.h sys/types.h
13793 eval $typedef
13794 case "$gidtype" in
13795 xxx)
13796         xxx=`./findhdr sys/user.h`
13797         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13798         case $1 in
13799         unsigned) dflt="$1 $2" ;;
13800         *) dflt="$1" ;;
13801         esac
13802         ;;
13803 *) dflt="$gidtype";;
13804 esac
13805 case "$gidtype" in
13806 gid_t) echo "gid_t found." ;;
13807 *)      rp="What is the type for group ids returned by getgid()?"
13808         . ./myread
13809         gidtype="$ans"
13810         ;;
13811 esac
13812
13813 echo " "
13814 case "$gidtype" in
13815 *_t) zzz="$gidtype"     ;;
13816 *)   zzz="gid"          ;;
13817 esac
13818 echo "Checking the size of $zzz..." >&4 
13819 cat > try.c <<EOCP
13820 #include <sys/types.h>
13821 #include <stdio.h>
13822 int main() {
13823     printf("%d\n", (int)sizeof($gidtype));
13824     exit(0);
13825 }
13826 EOCP
13827 set try
13828 if eval $compile_ok; then
13829         yyy=`./try`
13830         case "$yyy" in
13831         '')     gidsize=4
13832                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13833                 ;;
13834         *)      gidsize=$yyy
13835                 echo "Your $zzz is $gidsize bytes long."
13836                 ;;
13837         esac
13838 else
13839         gidsize=4
13840         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13841 fi
13842
13843
13844 echo " "
13845 case "$gidtype" in
13846 *_t) zzz="$gidtype"     ;;
13847 *)   zzz="gid"          ;;
13848 esac
13849 echo "Checking the sign of $zzz..." >&4 
13850 cat > try.c <<EOCP
13851 #include <sys/types.h>
13852 #include <stdio.h>
13853 int main() {
13854         $gidtype foo = -1;
13855         if (foo < 0)
13856                 printf("-1\n");
13857         else
13858                 printf("1\n");
13859 }
13860 EOCP
13861 set try
13862 if eval $compile; then
13863         yyy=`./try`
13864         case "$yyy" in
13865         '')     gidsign=1
13866                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13867                 ;;
13868         *)      gidsign=$yyy
13869                 case "$gidsign" in
13870                  1) echo "Your $zzz is unsigned." ;;
13871                 -1) echo "Your $zzz is signed."   ;;
13872                 esac
13873                 ;;
13874         esac
13875 else
13876         gidsign=1
13877         echo "(I can't compile the test program--guessing unsigned.)" >&4
13878 fi
13879
13880
13881 echo " "
13882
13883 if $test X"$quadtype" != X; then
13884
13885 echo "Checking how to print 64-bit integers..." >&4
13886
13887 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13888         $cat >try.c <<'EOCP'
13889 #include <sys/types.h>
13890 #include <stdio.h>
13891 int main() {
13892   int q = 12345678901;
13893   printf("%ld\n", q);
13894 }
13895 EOCP
13896         set try
13897         if eval $compile; then
13898                 yyy=`./try$exe_ext`
13899                 case "$yyy" in
13900                 12345678901)
13901                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13902                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13903                         echo "We will use %d."
13904                         ;;
13905                 esac
13906         fi
13907 fi
13908
13909 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13910         $cat >try.c <<'EOCP'
13911 #include <sys/types.h>
13912 #include <stdio.h>
13913 int main() {
13914   long q = 12345678901;
13915   printf("%ld\n", q);
13916 }
13917 EOCP
13918         set try
13919         if eval $compile; then
13920                 yyy=`./try$exe_ext`
13921                 case "$yyy" in
13922                 12345678901)
13923                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13924                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13925                         echo "We will use %ld."
13926                         ;;
13927                 esac
13928         fi
13929 fi
13930
13931 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13932         $cat >try.c <<'EOCP'
13933 #include <sys/types.h>
13934 #include <inttypes.h>
13935 #include <stdio.h>
13936 int main() {
13937   int64_t q = 12345678901;
13938   printf("%" PRId64 "\n", q);
13939 }
13940 EOCP
13941         set try
13942         if eval $compile; then
13943                 yyy=`./try$exe_ext`
13944                 case "$yyy" in
13945                 12345678901)
13946                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13947                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13948                         echo "We will use the C9X style."
13949                         ;;
13950                 esac
13951         fi
13952 fi
13953
13954 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13955         $cat >try.c <<EOCP
13956 #include <sys/types.h>
13957 #include <stdio.h>
13958 int main() {
13959   $quadtype q = 12345678901;
13960   printf("%Ld\n", q);
13961 }
13962 EOCP
13963         set try
13964         if eval $compile; then
13965                 yyy=`./try$exe_ext`
13966                 case "$yyy" in
13967                 12345678901)
13968                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13969                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13970                         echo "We will use %Ld."
13971                         ;;
13972                 esac
13973         fi
13974 fi
13975
13976 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13977         $cat >try.c <<'EOCP'
13978 #include <sys/types.h>
13979 #include <stdio.h>
13980 int main() {
13981   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13982   printf("%lld\n", q);
13983 }
13984 EOCP
13985         set try
13986         if eval $compile; then
13987                 yyy=`./try$exe_ext`
13988                 case "$yyy" in
13989                 12345678901)
13990                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13991                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13992                         echo "We will use the %lld style."
13993                         ;;
13994                 esac
13995         fi
13996 fi
13997
13998 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13999         $cat >try.c <<EOCP
14000 #include <sys/types.h>
14001 #include <stdio.h>
14002 int main() {
14003   $quadtype q = 12345678901;
14004   printf("%qd\n", q);
14005 }
14006 EOCP
14007         set try
14008         if eval $compile; then
14009                 yyy=`./try$exe_ext`
14010                 case "$yyy" in
14011                 12345678901)
14012                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14013                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14014                         echo "We will use %qd."
14015                         ;;
14016                 esac
14017         fi
14018 fi
14019
14020 if $test X"$sPRId64" = X; then
14021         echo "Cannot figure out how to print 64-bit integers." >&4
14022 fi
14023
14024 $rm -f try try.*
14025
14026 fi
14027
14028 case "$sPRId64" in
14029 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14030         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14031         ;;
14032 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14033         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14034         ;;
14035 esac
14036
14037
14038 echo " "
14039 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14040
14041 if $test X"$ivsize" = X8; then
14042         ivdformat="$sPRId64"
14043         uvuformat="$sPRIu64"
14044         uvoformat="$sPRIo64"
14045         uvxformat="$sPRIx64"
14046         uvXUformat="$sPRIXU64"
14047 else
14048         if $test X"$ivsize" = X"$longsize"; then
14049                 ivdformat='"ld"'
14050                 uvuformat='"lu"'
14051                 uvoformat='"lo"'
14052                 uvxformat='"lx"'
14053                 uvXUformat='"lX"'
14054         else
14055                 if $test X"$ivsize" = X"$intsize"; then
14056                         ivdformat='"d"'
14057                         uvuformat='"u"'
14058                         uvoformat='"o"'
14059                         uvxformat='"x"'
14060                         uvXUformat='"X"'
14061                 else
14062                         : far out
14063                         if $test X"$ivsize" = X"$shortsize"; then
14064                                 ivdformat='"hd"'
14065                                 uvuformat='"hu"'
14066                                 uvoformat='"ho"'
14067                                 uvxformat='"hx"'
14068                                 uvXUformat='"hX"'
14069                         fi
14070                 fi
14071         fi
14072 fi
14073
14074 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14075         nveformat="$sPRIeldbl"
14076         nvfformat="$sPRIfldbl"
14077         nvgformat="$sPRIgldbl"
14078         nvEUformat="$sPRIEUldbl"
14079         nvFUformat="$sPRIFUldbl"
14080         nvGUformat="$sPRIGUldbl"
14081 else
14082         nveformat='"e"'
14083         nvfformat='"f"'
14084         nvgformat='"g"'
14085         nvEUformat='"E"'
14086         nvFUformat='"F"'
14087         nvGUformat='"G"'
14088 fi
14089
14090 case "$ivdformat" in
14091 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14092     exit 1
14093     ;;
14094 esac
14095
14096
14097 echo " "
14098 $echo "Checking the format string to be used for gids..." >&4
14099
14100 case "$gidsign" in
14101 -1)     if $test X"$gidsize" = X"$ivsize"; then
14102                 gidformat="$ivdformat"
14103         else
14104                 if $test X"$gidsize" = X"$longsize"; then
14105                         gidformat='"ld"'
14106                 else
14107                         if $test X"$gidsize" = X"$intsize"; then
14108                                 gidformat='"d"'
14109                         else
14110                                 if $test X"$gidsize" = X"$shortsize"; then
14111                                         gidformat='"hd"'
14112                                 fi
14113                         fi
14114                 fi
14115         fi
14116         ;;
14117 *)      if $test X"$gidsize" = X"$uvsize"; then
14118                 gidformat="$uvuformat"
14119         else
14120                 if $test X"$gidsize" = X"$longsize"; then
14121                         gidformat='"lu"'
14122                 else
14123                         if $test X"$gidsize" = X"$intsize"; then
14124                                 gidformat='"u"'
14125                         else
14126                                 if $test X"$gidsize" = X"$shortsize"; then
14127                                         gidformat='"hu"'
14128                                 fi
14129                         fi
14130                 fi
14131         fi
14132         ;;
14133 esac
14134
14135 : see if getgroups exists
14136 set getgroups d_getgrps
14137 eval $inlibc
14138
14139 : see if setgroups exists
14140 set setgroups d_setgrps
14141 eval $inlibc
14142
14143
14144 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14145 echo " "
14146 case "$d_getgrps$d_setgrps" in
14147 *define*)
14148         case "$groupstype" in
14149         '') dflt="$gidtype" ;;
14150         *)  dflt="$groupstype" ;;
14151         esac
14152         $cat <<EOM
14153 What type of pointer is the second argument to getgroups() and setgroups()?
14154 Usually this is the same as group ids, $gidtype, but not always.
14155
14156 EOM
14157         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14158         . ./myread
14159         groupstype="$ans"
14160         ;;
14161 *)  groupstype="$gidtype";;
14162 esac
14163
14164 echo " "
14165 echo "Checking if your $make program sets \$(MAKE)..." >&4
14166 case "$make_set_make" in
14167 '')
14168         $sed 's/^X //' > testmake.mak << 'EOF'
14169 Xall:
14170 X       @echo 'maketemp="$(MAKE)"'
14171 EOF
14172         case "`$make -f testmake.mak 2>/dev/null`" in
14173         *maketemp=*) make_set_make='#' ;;
14174         *)      make_set_make="MAKE=$make" ;;
14175         esac
14176         $rm -f testmake.mak
14177         ;;
14178 esac
14179 case "$make_set_make" in
14180 '#') echo "Yup, it does.";;
14181 *) echo "Nope, it doesn't.";;
14182 esac
14183
14184 : see what type is used for mode_t
14185 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14186 set mode_t modetype int stdio.h sys/types.h
14187 eval $typedef_ask
14188
14189 : see if stdarg is available
14190 echo " "
14191 if $test `./findhdr stdarg.h`; then
14192         echo "<stdarg.h> found." >&4
14193         valstd="$define"
14194 else
14195         echo "<stdarg.h> NOT found." >&4
14196         valstd="$undef"
14197 fi
14198
14199 : see if varags is available
14200 echo " "
14201 if $test `./findhdr varargs.h`; then
14202         echo "<varargs.h> found." >&4
14203 else
14204         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14205 fi
14206
14207 : set up the varargs testing programs
14208 $cat > varargs.c <<EOP
14209 #ifdef I_STDARG
14210 #include <stdarg.h>
14211 #endif
14212 #ifdef I_VARARGS
14213 #include <varargs.h>
14214 #endif
14215
14216 #ifdef I_STDARG
14217 int f(char *p, ...)
14218 #else
14219 int f(va_alist)
14220 va_dcl
14221 #endif
14222 {
14223         va_list ap;
14224 #ifndef I_STDARG
14225         char *p;
14226 #endif
14227 #ifdef I_STDARG
14228         va_start(ap,p);
14229 #else
14230         va_start(ap);
14231         p = va_arg(ap, char *);
14232 #endif
14233         va_end(ap);
14234 }
14235 EOP
14236 $cat > varargs <<EOP
14237 $startsh
14238 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14239         echo "true"
14240 else
14241         echo "false"
14242 fi
14243 $rm -f varargs$_o
14244 EOP
14245 chmod +x varargs
14246
14247 : now check which varargs header should be included
14248 echo " "
14249 i_varhdr=''
14250 case "$valstd" in
14251 "$define")
14252         if `./varargs I_STDARG`; then
14253                 val='stdarg.h'
14254         elif `./varargs I_VARARGS`; then
14255                 val='varargs.h'
14256         fi
14257         ;;
14258 *)
14259         if `./varargs I_VARARGS`; then
14260                 val='varargs.h'
14261         fi
14262         ;;
14263 esac
14264 case "$val" in
14265 '')
14266 echo "I could not find the definition for va_dcl... You have problems..." >&4
14267         val="$undef"; set i_stdarg; eval $setvar
14268         val="$undef"; set i_varargs; eval $setvar
14269         ;;
14270 *) 
14271         set i_varhdr
14272         eval $setvar
14273         case "$i_varhdr" in
14274         stdarg.h)
14275                 val="$define"; set i_stdarg; eval $setvar
14276                 val="$undef"; set i_varargs; eval $setvar
14277                 ;;
14278         varargs.h)
14279                 val="$undef"; set i_stdarg; eval $setvar
14280                 val="$define"; set i_varargs; eval $setvar
14281                 ;;
14282         esac
14283         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14284 esac
14285 $rm -f varargs*
14286
14287 : see if we need va_copy
14288 echo " "
14289 case "$i_stdarg" in
14290 "$define")
14291         $cat >try.c <<EOCP
14292 #include <stdarg.h>
14293 #include <stdio.h>
14294 #$i_stdlib I_STDLIB
14295 #ifdef I_STDLIB
14296 #include <stdlib.h>
14297 #endif
14298 #include <signal.h>
14299
14300 int
14301 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14302 {
14303   return vfprintf(f, fmt, *valp);
14304 }
14305  
14306 int    
14307 myvfprintf(FILE *f, const  char *fmt, va_list val)
14308 {
14309   return ivfprintf(f, fmt, &val);
14310 }
14311       
14312 int
14313 myprintf(char *fmt, ...) 
14314 {
14315   va_list val;
14316   va_start(val, fmt);
14317   return myvfprintf(stdout, fmt, val); 
14318 }         
14319
14320 int
14321 main(int ac, char **av)
14322 {
14323   signal(SIGSEGV, exit);
14324
14325   myprintf("%s%cs all right, then\n", "that", '\'');                            
14326   exit(0);      
14327 }
14328 EOCP
14329         set try
14330         if eval $compile && ./try 2>&1 >/dev/null; then
14331                 case "`./try`" in
14332                 "that's all right, then")
14333                         okay=yes
14334                         ;;
14335                 esac
14336         fi
14337         case "$okay" in
14338         yes)    echo "It seems that you don't need va_copy()." >&4
14339                 need_va_copy="$undef"
14340                 ;;
14341         *)      echo "It seems that va_copy() or similar will be needed." >&4
14342                 need_va_copy="$define"
14343                 ;;
14344         esac
14345         $rm -f try.* core core.* *.core *.core.*
14346         ;;
14347 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14348         ;;
14349 esac
14350
14351 : define a fucntion to check prototypes
14352 $cat > protochk <<EOSH
14353 $startsh
14354 cc="$cc"
14355 optimize="$optimize"
14356 ccflags="$ccflags"
14357 prototype="$prototype"
14358 define="$define"
14359 rm=$rm
14360 EOSH
14361
14362 $cat >> protochk <<'EOSH'
14363
14364 $rm -f try.c
14365 foo="$1"
14366 shift
14367 while test $# -ge 2; do
14368         case "$1" in
14369                 $define) echo "#include <$2>" >> try.c ;;
14370                 literal) echo "$2" >> try.c ;;
14371         esac
14372     shift 2
14373 done
14374 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14375 cat >> try.c <<'EOCP'
14376 #ifdef CAN_PROTOTYPE
14377 #define _(args) args
14378 #else
14379 #define _(args) ()
14380 #endif
14381 EOCP
14382 echo "$foo" >> try.c
14383 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14384 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14385 status=$?
14386 $rm -f try.[co]
14387 exit $status
14388 EOSH
14389 chmod +x protochk
14390 $eunicefix protochk
14391
14392 : see what type is used for size_t
14393 rp="What is the type used for the length parameter for string functions?"
14394 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14395 eval $typedef_ask
14396
14397 : check for type of arguments to gethostbyaddr. 
14398 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14399         case "$d_gethbyaddr" in
14400         $define)
14401                 $cat <<EOM
14402
14403 Checking to see what type of arguments are accepted by gethostbyaddr().
14404 EOM
14405                 hdrs="$define sys/types.h
14406                         $d_socket sys/socket.h 
14407                         $i_niin netinet/in.h 
14408                         $i_netdb netdb.h
14409                         $i_unistd unistd.h"
14410                 : The first arg can 'char *' or 'void *'
14411                 : The second arg is some of integral type
14412                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14413                         for yyy in size_t long int; do
14414                                 case "$netdb_host_type" in
14415                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14416                                         if ./protochk "$try" $hdrs; then
14417                                                 echo "Your system accepts $xxx for the first arg."
14418                                                 echo "...and $yyy for the second arg."
14419                                                 netdb_host_type="$xxx"
14420                                                 netdb_hlen_type="$yyy"
14421                                         fi
14422                                         ;;
14423                                 esac
14424                         done
14425                 done
14426                 : In case none of those worked, prompt the user.
14427                 case "$netdb_host_type" in
14428                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14429                         dflt='char *'
14430                         . ./myread
14431                         netdb_host_type=$ans
14432                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14433                         dflt="$sizetype"
14434                         . ./myread
14435                         netdb_hlen_type=$ans
14436                         ;;
14437                 esac
14438                 ;;
14439         *)      : no gethostbyaddr, so pick harmless defaults
14440                 netdb_host_type='char *'
14441                 netdb_hlen_type="$sizetype"
14442                 ;;
14443         esac
14444         # Remove the "const" if needed. -- but then we'll have a 
14445         # prototype clash!
14446         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14447 fi
14448
14449 : check for type of argument to gethostbyname. 
14450 if test "X$netdb_name_type" = X ; then
14451         case "$d_gethbyname" in
14452         $define)
14453                 $cat <<EOM
14454
14455 Checking to see what type of argument is accepted by gethostbyname().
14456 EOM
14457                 hdrs="$define sys/types.h
14458                         $d_socket sys/socket.h 
14459                         $i_niin netinet/in.h 
14460                         $i_netdb netdb.h
14461                         $i_unistd unistd.h"
14462                 for xxx in "const char *" "char *"; do
14463                         case "$netdb_name_type" in
14464                         '')     try="extern struct hostent *gethostbyname($xxx);"
14465                                 if ./protochk "$try" $hdrs; then
14466                                         echo "Your system accepts $xxx."
14467                                         netdb_name_type="$xxx"
14468                                 fi
14469                                 ;;
14470                         esac
14471                 done
14472                 : In case none of those worked, prompt the user.
14473                 case "$netdb_name_type" in
14474                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14475                         dflt='char *'
14476                         . ./myread
14477                         netdb_name_type=$ans
14478                         ;;
14479                 esac
14480                 ;;
14481         *)      : no gethostbyname, so pick harmless default
14482                 netdb_name_type='char *'
14483                 ;;
14484         esac
14485 fi
14486
14487 : check for type of 1st argument to getnetbyaddr. 
14488 if test "X$netdb_net_type" = X ; then
14489         case "$d_getnbyaddr" in
14490         $define)
14491                 $cat <<EOM
14492
14493 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14494 EOM
14495                 hdrs="$define sys/types.h
14496                         $d_socket sys/socket.h 
14497                         $i_niin netinet/in.h 
14498                         $i_netdb netdb.h
14499                         $i_unistd unistd.h"
14500                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14501                         case "$netdb_net_type" in
14502                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14503                                 if ./protochk "$try" $hdrs; then
14504                                         echo "Your system accepts $xxx."
14505                                         netdb_net_type="$xxx"
14506                                 fi
14507                                 ;;
14508                         esac
14509                 done
14510                 : In case none of those worked, prompt the user.
14511                 case "$netdb_net_type" in
14512                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14513                         dflt='long'
14514                         . ./myread
14515                         netdb_net_type=$ans
14516                         ;;
14517                 esac
14518                 ;;
14519         *)      : no getnetbyaddr, so pick harmless default
14520                 netdb_net_type='long'
14521                 ;;
14522         esac
14523 fi
14524 : locate the preferred pager for this system
14525 case "$pager" in
14526 '')
14527         dflt=''
14528         case "$pg" in
14529         /*) dflt=$pg;;
14530         [a-zA-Z]:/*) dflt=$pg;;
14531         esac
14532         case "$more" in
14533         /*) dflt=$more;;
14534         [a-zA-Z]:/*) dflt=$more;;
14535         esac
14536         case "$less" in
14537         /*) dflt=$less;;
14538         [a-zA-Z]:/*) dflt=$less;;
14539         esac
14540         case "$dflt" in
14541         '') dflt=/usr/ucb/more;;
14542         esac
14543         ;;
14544 *) dflt="$pager";;
14545 esac
14546 echo " "
14547 fn=f/
14548 rp='What pager is used on your system?'
14549 . ./getfile
14550 pager="$ans"
14551
14552 : see what type pids are declared as in the kernel
14553 rp="What is the type of process ids on this system?"
14554 set pid_t pidtype int stdio.h sys/types.h
14555 eval $typedef_ask
14556
14557 : Find earliest binary compatible site_perl subdirectory perl can use.
14558 case "$bincompat5005" in
14559 "$define") xs_apiversion='5.005' ;;
14560 *) xs_apiversion=$version ;;   # The current site_perl version.
14561 esac
14562 : Find earliest pure perl site_perl subdirectory perl can use.
14563 : The versioned directories started at 5.005.
14564 pm_apiversion='5.005'
14565
14566 : see if ar generates random libraries by itself
14567 echo " "
14568 echo "Checking how to generate random libraries on your machine..." >&4
14569 echo 'int bar1() { return bar2(); }' > bar1.c
14570 echo 'int bar2() { return 2; }' > bar2.c
14571 $cat > foo.c <<'EOP'
14572 int main() { printf("%d\n", bar1()); exit(0); }
14573 EOP
14574 $cc $ccflags -c bar1.c >/dev/null 2>&1
14575 $cc $ccflags -c bar2.c >/dev/null 2>&1
14576 $cc $ccflags -c foo.c >/dev/null 2>&1
14577 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14578 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14579         ./foobar >/dev/null 2>&1; then
14580         echo "$ar appears to generate random libraries itself."
14581         orderlib=false
14582         ranlib=":"
14583 elif $ar ts bar$_a >/dev/null 2>&1 &&
14584         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14585         ./foobar >/dev/null 2>&1; then
14586                 echo "a table of contents needs to be added with '$ar ts'."
14587                 orderlib=false
14588                 ranlib="$ar ts"
14589 else
14590         case "$ranlib" in
14591         :) ranlib='';;
14592         '')
14593                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14594                 $test -f $ranlib || ranlib=''
14595                 ;;
14596         esac
14597         if $test -n "$ranlib"; then
14598                 echo "your system has '$ranlib'; we'll use that."
14599                 orderlib=false
14600         else
14601                 echo "your system doesn't seem to support random libraries"
14602                 echo "so we'll use lorder and tsort to order the libraries."
14603                 orderlib=true
14604                 ranlib=":"
14605         fi
14606 fi
14607 $rm -f foo* bar* 
14608
14609 : check for type of arguments to select. 
14610 case "$selecttype" in
14611 '') case "$d_select" in
14612         $define)
14613                 echo " "
14614                 $cat <<EOM
14615 Checking to see what type of arguments are accepted by select().
14616 EOM
14617                 hdrs="$define sys/types.h
14618                         $i_systime sys/time.h 
14619                         $i_sysselct sys/select.h
14620                         $d_socket sys/socket.h"
14621                 : The first arg can be int, unsigned, or size_t
14622                 : The last arg may or may not be 'const'
14623                 val=''
14624                 : void pointer has been seen but using that
14625                 : breaks the selectminbits test
14626                 for xxx in 'fd_set *' 'int *'; do
14627                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14628                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14629                                         case "$val" in
14630                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14631                                                 if ./protochk "$try" $hdrs; then
14632                                                         echo "Your system accepts $xxx."
14633                                                         val="$xxx"
14634                                                 fi
14635                                                 ;;
14636                                         esac
14637                                 done
14638                         done
14639                 done
14640                 case "$val" in
14641                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14642                         case "$d_fd_set" in
14643                                 $define) dflt="fd_set *" ;;
14644                                 *)              dflt="int *" ;;
14645                         esac
14646                         . ./myread
14647                         val=$ans
14648                         ;;
14649                 esac
14650                 selecttype="$val"
14651                 ;;
14652         *)      : no select, so pick a harmless default
14653                 selecttype='int *'
14654                 ;;
14655         esac
14656         ;;
14657 esac
14658
14659 : check for the select 'width'
14660 case "$selectminbits" in
14661 '') case "$d_select" in
14662         $define)
14663                 $cat <<EOM
14664
14665 Checking to see on how many bits at a time your select() operates...
14666 EOM
14667                 $cat >try.c <<EOCP
14668 #include <sys/types.h>
14669 #$i_time I_TIME
14670 #$i_systime I_SYS_TIME
14671 #$i_systimek I_SYS_TIME_KERNEL
14672 #ifdef I_TIME
14673 #   include <time.h>
14674 #endif
14675 #ifdef I_SYS_TIME
14676 #   ifdef I_SYS_TIME_KERNEL
14677 #       define KERNEL
14678 #   endif
14679 #   include <sys/time.h>
14680 #   ifdef I_SYS_TIME_KERNEL
14681 #       undef KERNEL
14682 #   endif
14683 #endif
14684 #$i_sysselct I_SYS_SELECT
14685 #ifdef I_SYS_SELECT
14686 #include <sys/select.h>
14687 #endif
14688 #$d_socket HAS_SOCKET
14689 #ifdef HAS_SOCKET
14690 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14691 #endif
14692 #include <stdio.h>
14693 $selecttype b;
14694 #define S sizeof(*(b))
14695 #define MINBITS 64
14696 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14697 #define NBITS  (NBYTES * 8)
14698 int main() {
14699     char s[NBYTES];
14700     struct timeval t;
14701     int i;
14702     FILE* fp;
14703     int fd;
14704
14705     fclose(stdin);
14706     fp = fopen("try.c", "r");
14707     if (fp == 0)
14708       exit(1);
14709     fd = fileno(fp);
14710     if (fd < 0)
14711       exit(2);
14712     b = ($selecttype)s;
14713     for (i = 0; i < NBITS; i++)
14714         FD_SET(i, b);
14715     t.tv_sec  = 0;
14716     t.tv_usec = 0;
14717     select(fd + 1, b, 0, 0, &t);
14718     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14719     printf("%d\n", i + 1);
14720     return 0;
14721 }
14722 EOCP
14723                 set try
14724                 if eval $compile_ok; then
14725                         selectminbits=`./try`
14726                         case "$selectminbits" in
14727                         '')     cat >&4 <<EOM
14728 Cannot figure out on how many bits at a time your select() operates.
14729 I'll play safe and guess it is 32 bits.
14730 EOM
14731                                 selectminbits=32
14732                                 bits="32 bits"
14733                                 ;;
14734                         1)      bits="1 bit" ;;
14735                         *)      bits="$selectminbits bits" ;;
14736                         esac
14737                         echo "Your select() operates on $bits at a time." >&4
14738                 else
14739                         rp='What is the minimum number of bits your select() operates on?'
14740                         case "$byteorder" in
14741                         1234|12345678)  dflt=32 ;;
14742                         *)              dflt=1  ;;
14743                         esac
14744                         . ./myread
14745                         val=$ans
14746                         selectminbits="$val"
14747                 fi
14748                 $rm -f try.* try
14749                 ;;
14750         *)      : no select, so pick a harmless default
14751                 selectminbits='32'
14752                 ;;
14753         esac
14754         ;;
14755 esac
14756
14757 : Trace out the files included by signal.h, then look for SIGxxx names.
14758 : Remove SIGARRAYSIZE used by HPUX.
14759 : Remove SIGSTKSIZE used by Linux.
14760 : Remove SIGSTKSZ used by Posix.
14761 : Remove SIGTYP void lines used by OS2.
14762 : Some cpps, like os390, dont give the file name anywhere
14763 if [ "X$fieldn" = X ]; then
14764         : Just make some guesses.  We check them later.
14765         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14766 else
14767         xxx=`echo '#include <signal.h>' |
14768         $cppstdin $cppminus $cppflags 2>/dev/null |
14769         $grep '^[       ]*#.*include' | 
14770         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14771 fi
14772 : Check this list of files to be sure we have parsed the cpp output ok.
14773 : This will also avoid potentially non-existent files, such 
14774 : as ../foo/bar.h
14775 xxxfiles=''
14776 for xx in $xxx /dev/null ; do
14777         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14778 done
14779 : If we have found no files, at least try signal.h
14780 case "$xxxfiles" in
14781 '')     xxxfiles=`./findhdr signal.h` ;;
14782 esac
14783 xxx=`awk '
14784 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14785         print substr($2, 4, 20)
14786 }
14787 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14788         print substr($3, 4, 20)
14789 }' $xxxfiles`
14790 : Append some common names just in case the awk scan failed.
14791 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14792 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14793 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14794 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14795 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14796
14797 : generate a few handy files for later
14798 $cat > signal.c <<'EOCP'
14799 #include <sys/types.h>
14800 #include <signal.h>
14801 #include <stdio.h>
14802 int main() {
14803
14804 /* Strange style to avoid deeply-nested #if/#else/#endif */
14805 #ifndef NSIG
14806 #  ifdef _NSIG
14807 #    define NSIG (_NSIG)
14808 #  endif
14809 #endif
14810
14811 #ifndef NSIG
14812 #  ifdef SIGMAX
14813 #    define NSIG (SIGMAX+1)
14814 #  endif
14815 #endif
14816
14817 #ifndef NSIG
14818 #  ifdef SIG_MAX
14819 #    define NSIG (SIG_MAX+1)
14820 #  endif
14821 #endif
14822
14823 #ifndef NSIG
14824 #  ifdef MAXSIG
14825 #    define NSIG (MAXSIG+1)
14826 #  endif
14827 #endif
14828
14829 #ifndef NSIG
14830 #  ifdef MAX_SIG
14831 #    define NSIG (MAX_SIG+1)
14832 #  endif
14833 #endif
14834
14835 #ifndef NSIG
14836 #  ifdef SIGARRAYSIZE
14837 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14838 #  endif
14839 #endif
14840
14841 #ifndef NSIG
14842 #  ifdef _sys_nsig
14843 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14844 #  endif
14845 #endif
14846
14847 /* Default to some arbitrary number that's big enough to get most
14848    of the common signals.
14849 */
14850 #ifndef NSIG
14851 #    define NSIG 50
14852 #endif
14853
14854 printf("NSIG %d\n", NSIG);
14855
14856 #ifndef JUST_NSIG
14857
14858 EOCP
14859
14860 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14861 {
14862         printf "#ifdef SIG"; printf $1; printf "\n"
14863         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14864         printf $1; printf ");\n"
14865         printf "#endif\n"
14866 }
14867 END {
14868         printf "#endif /* JUST_NSIG */\n";
14869         printf "exit(0);\n}\n";
14870 }
14871 ' >>signal.c
14872 $cat >signal.awk <<'EOP'
14873 BEGIN { ndups = 0 }
14874 $1 ~ /^NSIG$/ { nsig = $2 }
14875 ($1 !~ /^NSIG$/) && (NF == 2) {
14876     if ($2 > maxsig) { maxsig = $2 }
14877     if (sig_name[$2]) {
14878         dup_name[ndups] = $1
14879         dup_num[ndups] = $2
14880         ndups++ 
14881     }
14882     else {
14883         sig_name[$2] = $1
14884         sig_num[$2] = $2
14885     }
14886 }
14887 END { 
14888     if (nsig == 0) {
14889         nsig = maxsig + 1
14890     }
14891     printf("NSIG %d\n", nsig);
14892     for (n = 1; n < nsig; n++) {
14893         if (sig_name[n]) {
14894             printf("%s %d\n", sig_name[n], sig_num[n])
14895         }
14896         else {
14897             printf("NUM%d %d\n", n, n) 
14898         }
14899     }
14900     for (n = 0; n < ndups; n++) {
14901         printf("%s %d\n", dup_name[n], dup_num[n])
14902     }
14903 }
14904 EOP
14905 $cat >signal_cmd <<EOS
14906 $startsh
14907 if $test -s signal.lst; then
14908     echo "Using your existing signal.lst file"
14909         exit 0
14910 fi
14911 xxx="$xxx"
14912 EOS
14913 $cat >>signal_cmd <<'EOS'
14914
14915 set signal
14916 if eval $compile_ok; then
14917         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14918 else
14919         echo "(I can't seem be able to compile the whole test program)" >&4
14920         echo "(I'll try it in little pieces.)" >&4
14921         set signal -DJUST_NSIG
14922         if eval $compile_ok; then
14923                 ./signal$_exe > signal.nsg
14924                 $cat signal.nsg
14925         else
14926                 echo "I can't seem to figure out how many signals you have." >&4
14927                 echo "Guessing 50." >&4
14928                 echo 'NSIG 50' > signal.nsg
14929         fi
14930         : Now look at all the signal names, one at a time.
14931         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14932                 $cat > signal.c <<EOCP
14933 #include <sys/types.h>
14934 #include <signal.h>
14935 #include <stdio.h>
14936 int main() {
14937 printf("$xx %d\n", SIG${xx});
14938 return 0;
14939 }
14940 EOCP
14941                 set signal
14942                 if eval $compile; then
14943                         echo "SIG${xx} found."
14944                         ./signal$_exe  >> signal.ls1
14945                 else
14946                         echo "SIG${xx} NOT found."
14947                 fi
14948         done
14949         if $test -s signal.ls1; then
14950                 $cat signal.nsg signal.ls1 |
14951                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14952         fi
14953
14954 fi
14955 if $test -s signal.lst; then
14956         :
14957 else
14958         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14959         echo 'kill -l' >signal
14960         set X `csh -f <signal`
14961         $rm -f signal
14962         shift
14963         case $# in
14964         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14965         esac
14966         echo $@ | $tr ' ' $trnl | \
14967             $awk '{ printf "%s %d\n", $1, ++s; }
14968                   END { printf "NSIG %d\n", ++s }' >signal.lst
14969 fi
14970 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14971 EOS
14972 chmod a+x signal_cmd
14973 $eunicefix signal_cmd
14974
14975 : generate list of signal names
14976 echo " "
14977 case "$sig_name_init" in
14978 '') doinit=yes ;;
14979 *)  case "$sig_num_init" in
14980     ''|*,*) doinit=yes ;;
14981     esac ;;
14982 esac
14983 case "$doinit" in
14984 yes)
14985         echo "Generating a list of signal names and numbers..." >&4
14986         . ./signal_cmd
14987         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14988         sig_name=`$awk 'BEGIN { printf "ZERO " }
14989                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14990         sig_num=`$awk  'BEGIN { printf "0 " }
14991                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14992         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14993                              !/^NSIG/   { printf "\"%s\", ", $1 }
14994                              END        { printf "0\n" }' signal.lst`
14995         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14996                              !/^NSIG/   { printf "%d, ", $2}
14997                              END        { printf "0\n"}' signal.lst`
14998         ;;
14999 esac
15000 echo "The following $sig_count signals are available:"
15001 echo " "
15002 echo $sig_name | $awk \
15003 'BEGIN { linelen = 0 }
15004 {
15005         for (i = 1; i <= NF; i++) {
15006                 name = "SIG" $i " "
15007                 linelen = linelen + length(name)
15008                 if (linelen > 70) {
15009                         printf "\n"
15010                         linelen = length(name)
15011                 }
15012                 printf "%s", name
15013         }
15014         printf "\n"
15015 }'
15016 sig_size=`echo $sig_name | awk '{print NF}'`
15017 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15018
15019 echo " "
15020 case "$sizetype" in
15021 *_t) zzz="$sizetype"    ;;
15022 *)   zzz="filesize"     ;;
15023 esac
15024 echo "Checking the size of $zzz..." >&4 
15025 cat > try.c <<EOCP
15026 #include <sys/types.h>
15027 #include <stdio.h>
15028 int main() {
15029     printf("%d\n", (int)sizeof($sizetype));
15030     exit(0);
15031 }
15032 EOCP
15033 set try
15034 if eval $compile_ok; then
15035         yyy=`./try`
15036         case "$yyy" in
15037         '')     sizesize=4
15038                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15039                 ;;
15040         *)      sizesize=$yyy
15041                 echo "Your $zzz size is $sizesize bytes."
15042                 ;;
15043         esac
15044 else
15045         sizesize=4
15046         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15047 fi
15048
15049
15050 : check for socklen_t
15051 echo " "
15052 echo "Checking to see if you have socklen_t..." >&4
15053 $cat >try.c <<EOCP
15054 #include <sys/types.h>
15055 #$d_socket HAS_SOCKET
15056 #ifdef HAS_SOCKET
15057 #include <sys/socket.h>
15058 #endif
15059 int main() { socklen_t x = 16; }
15060 EOCP
15061 set try
15062 if eval $compile; then
15063         val="$define"
15064         echo "You have socklen_t."
15065 else
15066         val="$undef"
15067         echo "You do not have socklen_t."
15068         case "$sizetype" in
15069         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15070         esac
15071 fi
15072 $rm -f try try.*
15073 set d_socklen_t
15074 eval $setvar
15075
15076 : see if this is a socks.h system
15077 set socks.h i_socks
15078 eval $inhdr
15079
15080 : check for type of the size argument to socket calls
15081 case "$d_socket" in
15082 "$define")
15083         $cat <<EOM
15084
15085 Checking to see what type is the last argument of accept().
15086 EOM
15087         yyy=''
15088         case "$d_socklen_t" in
15089         "$define") yyy="$yyy socklen_t"
15090         esac
15091         yyy="$yyy $sizetype int long unsigned"
15092         for xxx in $yyy; do
15093                 case "$socksizetype" in
15094                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15095                         case "$usesocks" in
15096                         "$define")
15097                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15098                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15099                                         socksizetype="$xxx"
15100                                 fi
15101                                 ;;
15102                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15103                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15104                                         socksizetype="$xxx"
15105                                 fi
15106                                 ;;
15107                         esac
15108                         ;;
15109                 esac
15110         done
15111 : In case none of those worked, prompt the user.
15112         case "$socksizetype" in
15113         '')     rp='What is the type for socket address structure sizes?'
15114                 dflt='int'
15115                 . ./myread
15116                 socksizetype=$ans
15117                 ;;
15118         esac
15119         ;;
15120 *)      : no sockets, so pick relatively harmless default
15121         socksizetype='int'
15122         ;;
15123 esac
15124
15125 : see what type is used for signed size_t
15126 set ssize_t ssizetype int stdio.h sys/types.h
15127 eval $typedef
15128 dflt="$ssizetype"
15129 $cat > ssize.c <<EOM
15130 #include <stdio.h>
15131 #include <sys/types.h>
15132 #define Size_t $sizetype
15133 #define SSize_t $dflt
15134 int main()
15135 {
15136         if (sizeof(Size_t) == sizeof(SSize_t))
15137                 printf("$dflt\n");
15138         else if (sizeof(Size_t) == sizeof(int))
15139                 printf("int\n");
15140         else 
15141                 printf("long\n");
15142         exit(0);
15143 }
15144 EOM
15145 echo " "
15146 set ssize
15147 if eval $compile_ok && ./ssize > /dev/null; then
15148         ssizetype=`./ssize`
15149         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15150 else
15151         $cat >&4 <<EOM
15152 Help! I can't compile and run the ssize_t test program: please enlighten me!
15153 (This is probably a misconfiguration in your system or libraries, and
15154 you really ought to fix it.  Still, I'll try anyway.)
15155
15156 I need a type that is the same size as $sizetype, but is guaranteed to
15157 be signed.  Common values are ssize_t, int and long.
15158
15159 EOM
15160         rp="What signed type is the same size as $sizetype?"
15161         . ./myread
15162         ssizetype="$ans"
15163 fi
15164 $rm -f ssize ssize.*
15165
15166 : see what type of char stdio uses.
15167 echo " "
15168 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15169 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15170         echo "Your stdio uses unsigned chars." >&4
15171         stdchar="unsigned char"
15172 else
15173         echo "Your stdio uses signed chars." >&4
15174         stdchar="char"
15175 fi
15176 $rm -f stdioh
15177
15178
15179
15180 : see if time exists
15181 echo " "
15182 if test "X$d_time" = X -o X"$timetype" = X; then
15183     if set time val -f d_time; eval $csym; $val; then
15184                 echo 'time() found.' >&4
15185                 val="$define"
15186                 rp="What is the type returned by time() on this system?"
15187                 set time_t timetype long stdio.h sys/types.h
15188                 eval $typedef_ask
15189     else
15190                 echo 'time() not found, hope that will do.' >&4
15191                 val="$undef"
15192                 timetype='int';
15193     fi
15194     set d_time
15195     eval $setvar
15196 fi
15197
15198 : see what type uids are declared as in the kernel
15199 echo " "
15200 echo "Looking for the type for user ids returned by getuid()."
15201 set uid_t uidtype xxx stdio.h sys/types.h
15202 eval $typedef
15203 case "$uidtype" in
15204 xxx)
15205         xxx=`./findhdr sys/user.h`
15206         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15207         case $1 in
15208         unsigned) dflt="$1 $2" ;;
15209         *) dflt="$1" ;;
15210         esac
15211         ;;
15212 *) dflt="$uidtype";;
15213 esac
15214 case "$uidtype" in
15215 uid_t)  echo "uid_t found." ;;
15216 *)      rp="What is the type for user ids returned by getuid()?"
15217         . ./myread
15218         uidtype="$ans"
15219         ;;
15220 esac
15221
15222 echo " "
15223 case "$uidtype" in
15224 *_t) zzz="$uidtype"     ;;
15225 *)   zzz="uid"          ;;
15226 esac
15227 echo "Checking the size of $zzz..." >&4 
15228 cat > try.c <<EOCP
15229 #include <sys/types.h>
15230 #include <stdio.h>
15231 int main() {
15232     printf("%d\n", (int)sizeof($uidtype));
15233     exit(0);
15234 }
15235 EOCP
15236 set try
15237 if eval $compile_ok; then
15238         yyy=`./try`
15239         case "$yyy" in
15240         '')     uidsize=4
15241                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15242                 ;;
15243         *)      uidsize=$yyy
15244                 echo "Your $zzz is $uidsize bytes long."
15245                 ;;
15246         esac
15247 else
15248         uidsize=4
15249         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15250 fi
15251
15252 echo " "
15253 case "$uidtype" in
15254 *_t) zzz="$uidtype"     ;;
15255 *)   zzz="uid"          ;;
15256 esac
15257 echo "Checking the sign of $zzz..." >&4
15258 cat > try.c <<EOCP
15259 #include <sys/types.h>
15260 #include <stdio.h>
15261 int main() {
15262         $uidtype foo = -1;
15263         if (foo < 0)
15264                 printf("-1\n");
15265         else
15266                 printf("1\n");
15267 }
15268 EOCP
15269 set try
15270 if eval $compile; then
15271         yyy=`./try`
15272         case "$yyy" in
15273         '')     uidsign=1
15274                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15275                 ;;
15276         *)      uidsign=$yyy
15277                 case "$uidsign" in
15278                  1) echo "Your $zzz is unsigned." ;;
15279                 -1) echo "Your $zzz is signed."   ;;
15280                 esac
15281                 ;;
15282         esac
15283 else
15284         uidsign=1
15285         echo "(I can't compile the test program--guessing unsigned.)" >&4
15286 fi
15287
15288
15289
15290 echo " "
15291 $echo "Checking the format string to be used for uids..." >&4
15292
15293 case "$uidsign" in
15294 -1)     if $test X"$uidsize" = X"$ivsize"; then
15295                 uidformat="$ivdformat"
15296         else
15297                 if $test X"$uidsize" = X"$longsize"; then
15298                         uidformat='"ld"'
15299                 else
15300                         if $test X"$uidsize" = X"$intsize"; then
15301                                 uidformat='"d"'
15302                         else
15303                                 if $test X"$uidsize" = X"$shortsize"; then
15304                                         uidformat='"hd"'
15305                                 fi
15306                         fi
15307                 fi
15308         fi
15309         ;;
15310 *)      if $test X"$uidsize" = X"$uvsize"; then
15311                 uidformat="$uvuformat"
15312         else
15313                 if $test X"$uidsize" = X"$longsize"; then
15314                         uidformat='"lu"'
15315                 else
15316                         if $test X"$uidsize" = X"$intsize"; then
15317                                 uidformat='"u"'
15318                         else
15319                                 if $test X"$uidsize" = X"$shortsize"; then
15320                                         uidformat='"hu"'
15321                                 fi
15322                         fi
15323                 fi
15324         fi
15325         ;;
15326 esac
15327
15328 : determine compiler compiler
15329 case "$yacc" in
15330 '')
15331         dflt=yacc;;
15332 *)
15333         dflt="$yacc";;
15334 esac
15335 echo " "
15336 comp='yacc'
15337 if $test -f "$byacc"; then
15338         dflt="$byacc"
15339         comp="byacc or $comp"
15340 fi
15341 if $test -f "$bison"; then
15342         comp="$comp or bison -y"
15343 fi
15344 rp="Which compiler compiler ($comp) shall I use?"
15345 . ./myread
15346 yacc="$ans"
15347 case "$yacc" in
15348 *bis*)
15349         case "$yacc" in
15350         *-y*) ;;
15351         *)
15352                 yacc="$yacc -y"
15353                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15354                 ;;
15355         esac
15356         ;;
15357 esac
15358
15359 : see if fcntl.h is there
15360 val=''
15361 set fcntl.h val
15362 eval $inhdr
15363
15364 : see if we can include fcntl.h
15365 case "$val" in
15366 "$define")
15367         echo " "
15368         if $h_fcntl; then
15369                 val="$define"
15370                 echo "We'll be including <fcntl.h>." >&4
15371         else
15372                 val="$undef"
15373                 if $h_sysfile; then
15374         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15375                 else
15376                         echo "We won't be including <fcntl.h>." >&4
15377                 fi
15378         fi
15379         ;;
15380 *)
15381         h_fcntl=false
15382         val="$undef"
15383         ;;
15384 esac
15385 set i_fcntl
15386 eval $setvar
15387
15388 : see if this is a iconv.h system
15389 set iconv.h i_iconv
15390 eval $inhdr
15391
15392 : see if this is a ieeefp.h system
15393 set ieeefp.h i_ieeefp
15394 eval $inhdr
15395
15396 : see if this is a libutil.h system
15397 set libutil.h i_libutil
15398 eval $inhdr
15399
15400 : see if locale.h is available
15401 set locale.h i_locale
15402 eval $inhdr
15403
15404 : see if mach cthreads are available
15405 if test "X$usethreads" = "X$define"; then
15406         set mach/cthreads.h i_machcthr
15407         eval $inhdr
15408 else
15409         i_machcthr="$undef"
15410 fi
15411
15412
15413
15414 : see if this is a math.h system
15415 set math.h i_math
15416 eval $inhdr
15417
15418 : see if this is a mntent.h system
15419 set mntent.h i_mntent
15420 eval $inhdr
15421
15422 : see if ndbm.h is available
15423 set ndbm.h t_ndbm
15424 eval $inhdr
15425 case "$t_ndbm" in
15426 $define)
15427         : see if dbm_open exists
15428         set dbm_open d_dbm_open
15429         eval $inlibc
15430         case "$d_dbm_open" in
15431         $undef)
15432                 t_ndbm="$undef"
15433                 echo "We won't be including <ndbm.h>"
15434                 ;;
15435         esac
15436         ;;
15437 esac
15438 val="$t_ndbm"
15439 set i_ndbm
15440 eval $setvar
15441
15442 : see if net/errno.h is available
15443 val=''
15444 set net/errno.h val
15445 eval $inhdr
15446
15447 : Unfortunately, it causes problems on some systems.  Arrgh.
15448 case "$val" in
15449 $define)
15450         cat > try.c <<'EOM'
15451 #include <stdio.h>
15452 #include <errno.h>
15453 #include <net/errno.h>
15454 int func()
15455 {
15456         return ENOTSOCK;
15457 }
15458 EOM
15459         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15460                 echo "We'll be including <net/errno.h>." >&4
15461         else
15462                 echo "We won't be including <net/errno.h>." >&4
15463                 val="$undef"
15464         fi
15465         $rm -f try.* try
15466         ;;
15467 esac
15468 set i_neterrno
15469 eval $setvar
15470
15471 : see if netinet/tcp.h is available
15472 set netinet/tcp.h i_netinettcp
15473 eval $inhdr
15474
15475 : see if this is a poll.h system
15476 set poll.h i_poll
15477 eval $inhdr
15478
15479 : see if this is a prot.h system
15480 set prot.h i_prot
15481 eval $inhdr
15482
15483 echo " "
15484 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15485 $cat <<'EOSH' > Cppsym.know
15486 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15487 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15488 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15489 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15490 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15491 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15492 bull c cadmus clipper CMU COFF COMPILER_VERSION
15493 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15494 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15495 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15496 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15497 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15498 H3050R H3050RX hbullx20 hcx host_mips
15499 hp200 hp300 hp700 HP700 hp800 hp9000
15500 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15501 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15502 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15503 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15504 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15505 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15506 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15507 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15508 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15509 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15510 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15511 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15512 MATH_HAS_NO_SIDE_EFFECTS
15513 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15514 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15515 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15516 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15517 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15518 NetBSD news1500 news1700 news1800 news1900 news3700
15519 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15520 ns32016 ns32332 ns32k nsc32000
15521 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15522 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15523 pc532 pdp11 PGC PIC plexus PORTAR posix
15524 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15525 POSIX_C_SOURCE POSIX_SOURCE POWER
15526 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15527 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15528 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15529 sony sony_news sonyrisc sparc sparclite spectrum
15530 stardent stdc STDC_EXT stratos sun sun3 sun386
15531 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15532 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15533 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15534 sysV68 sysV88 Tek4132 Tek4300 titan
15535 TM3200 TM5400 TM5600
15536 tower tower32 tower32_200 tower32_600 tower32_700
15537 tower32_800 tower32_850 tss
15538 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15539 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15540 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15541 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15542 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15543 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15544 z8000
15545 EOSH
15546 # Maybe put other stuff here too.
15547 cat <<EOSH >>Cppsym.know
15548 $osname
15549 EOSH
15550 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15551 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15552 $cat Cppsym.know > Cppsym.c
15553 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15554 $rm -f Cppsym.a Cppsym.b Cppsym.c
15555 cat <<EOSH > Cppsym
15556 $startsh
15557 if $test \$# -gt 0; then
15558     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15559     if $test -s Cppsym.got; then
15560         $rm -f Cppsym.got
15561         exit 0
15562     fi
15563     $rm -f Cppsym.got
15564     exit 1
15565 else
15566     $tr " " "$trnl" | ./Cppsym.try
15567     exit 0
15568 fi
15569 EOSH
15570 chmod +x Cppsym
15571 $eunicefix Cppsym
15572 cat <<EOSH > Cppsym.try
15573 $startsh
15574 cat <<'EOCP' > try.c
15575 #include <stdio.h>
15576 int main() {
15577 EOCP
15578 $awk \\
15579 EOSH
15580 cat <<'EOSH' >> Cppsym.try
15581 'length($1) > 0 {
15582     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
15583     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
15584     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
15585     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
15586 }'       >> try.c
15587 echo 'return 0;}' >> try.c
15588 EOSH
15589 cat <<EOSH >> Cppsym.try
15590 ccflags="$ccflags"
15591 case "$osname-$gccversion" in
15592 irix-) ccflags="\$ccflags -woff 1178" ;;
15593 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15594 esac
15595 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15596 EOSH
15597 chmod +x Cppsym.try
15598 $eunicefix Cppsym.try
15599 ./Cppsym < Cppsym.know > Cppsym.true
15600 : now check the C compiler for additional symbols
15601 postprocess_cc_v=''
15602 case "$osname" in
15603 aix) postprocess_cc_v="|$tr , ' '" ;;
15604 esac
15605 $cat >ccsym <<EOS
15606 $startsh
15607 $cat >tmp.c <<EOF
15608 extern int foo;
15609 EOF
15610 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15611 do
15612         case "\$i" in
15613         -D*) echo "\$i" | $sed 's/^-D//';;
15614         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15615         esac
15616 done
15617 $rm -f try.c
15618 EOS
15619 postprocess_cc_v=''
15620 chmod +x ccsym
15621 $eunicefix ccsym
15622 ./ccsym > ccsym1.raw
15623 if $test -s ccsym1.raw; then
15624        $sort ccsym1.raw | $uniq >ccsym.raw
15625 else
15626        mv ccsym1.raw ccsym.raw
15627 fi
15628
15629 $awk '/\=/ { print $0; next }
15630         { print $0"=1" }' ccsym.raw >ccsym.list
15631 $awk '/\=/ { print $0; next }
15632         { print $0"=1" }' Cppsym.true >ccsym.true
15633 $comm -13 ccsym.true ccsym.list >ccsym.own
15634 $comm -12 ccsym.true ccsym.list >ccsym.com
15635 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15636 also=''
15637 if $test -z ccsym.raw; then
15638         echo "Your C compiler doesn't seem to define any symbols!" >&4
15639         echo " "
15640         echo "However, your C preprocessor defines the following symbols:"
15641         $cat Cppsym.true
15642         ccsymbols=''
15643         cppsymbols=`$cat Cppsym.true`
15644         cppsymbols=`echo $cppsymbols`
15645         cppccsymbols="$cppsymbols"
15646 else
15647         if $test -s ccsym.com; then
15648                 echo "Your C compiler and pre-processor define these symbols:"
15649                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15650                 also='also '
15651                 symbols='ones'
15652                 cppccsymbols=`$cat ccsym.com`
15653                 cppccsymbols=`echo $cppccsymbols`
15654                 $test "$silent" || sleep 1
15655         fi
15656         if $test -s ccsym.cpp; then
15657                 $test "$also" && echo " "
15658                 echo "Your C pre-processor ${also}defines the following symbols:"
15659                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15660                 also='further '
15661                 cppsymbols=`$cat ccsym.cpp`
15662                 cppsymbols=`echo $cppsymbols`
15663                 $test "$silent" || sleep 1
15664         fi
15665         if $test -s ccsym.own; then
15666                 $test "$also" && echo " "
15667                 echo "Your C compiler ${also}defines the following cpp symbols:"
15668                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15669                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15670                 ccsymbols=`$cat ccsym.own`
15671                 ccsymbols=`echo $ccsymbols`
15672                 $test "$silent" || sleep 1
15673         fi
15674 fi
15675 $rm -f ccsym* Cppsym.*
15676
15677 : see if this is a termio system
15678 val="$undef"
15679 val2="$undef"
15680 val3="$undef"
15681 if $test `./findhdr termios.h`; then
15682         set tcsetattr i_termios
15683         eval $inlibc
15684         val3="$i_termios"
15685 fi
15686 echo " "
15687 case "$val3" in
15688 "$define") echo "You have POSIX termios.h... good!" >&4;;
15689 *) if ./Cppsym pyr; then
15690                 case "`/bin/universe`" in
15691                 ucb) if $test `./findhdr sgtty.h`; then
15692                                 val2="$define"
15693                                 echo "<sgtty.h> found." >&4
15694                         else
15695                                 echo "System is pyramid with BSD universe."
15696                                 echo "<sgtty.h> not found--you could have problems." >&4
15697                         fi;;
15698                 *) if $test `./findhdr termio.h`; then
15699                                 val="$define"
15700                                 echo "<termio.h> found." >&4
15701                         else
15702                                 echo "System is pyramid with USG universe."
15703                                 echo "<termio.h> not found--you could have problems." >&4
15704                         fi;;
15705                 esac
15706         elif ./usg; then
15707                 if $test `./findhdr termio.h`; then
15708                         echo "<termio.h> found." >&4
15709                         val="$define"
15710                 elif $test `./findhdr sgtty.h`; then
15711                         echo "<sgtty.h> found." >&4
15712                         val2="$define"
15713                 else
15714 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15715                 fi
15716         else
15717                 if $test `./findhdr sgtty.h`; then
15718                         echo "<sgtty.h> found." >&4
15719                         val2="$define"
15720                 elif $test `./findhdr termio.h`; then
15721                         echo "<termio.h> found." >&4
15722                         val="$define"
15723                 else
15724 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15725                 fi
15726         fi;;
15727 esac
15728 set i_termio; eval $setvar
15729 val=$val2; set i_sgtty; eval $setvar
15730 val=$val3; set i_termios; eval $setvar
15731
15732 : see if this is a shadow.h system
15733 set shadow.h i_shadow
15734 eval $inhdr
15735
15736 : see if stddef is available
15737 set stddef.h i_stddef
15738 eval $inhdr
15739
15740 : see if this is a sunmath.h system
15741 set sunmath.h i_sunmath
15742 eval $inhdr
15743
15744 : see if sys/access.h is available
15745 set sys/access.h i_sysaccess
15746 eval $inhdr
15747
15748 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15749 set sys/filio.h i_sysfilio
15750 eval $inhdr
15751 echo " "
15752 if $test `./findhdr sys/ioctl.h`; then
15753         val="$define"
15754         echo '<sys/ioctl.h> found.' >&4
15755 else
15756         val="$undef"
15757         if $test $i_sysfilio = "$define"; then
15758             echo '<sys/ioctl.h> NOT found.' >&4
15759         else
15760                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15761                 $test $i_termio = "$define" && xxx="termio.h"
15762                 $test $i_termios = "$define" && xxx="termios.h"
15763 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15764         fi
15765 fi
15766 set i_sysioctl
15767 eval $setvar
15768
15769 : see if socket ioctl defs are in sys/sockio.h
15770 echo " "
15771 xxx=`./findhdr sys/sockio.h`
15772 if $test "$xxx"; then
15773         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15774                 val="$define"
15775                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15776         else
15777                 val="$undef"
15778                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15779         fi
15780 else
15781         val="$undef"
15782         $cat <<EOM
15783 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15784 EOM
15785 fi
15786 set i_syssockio
15787 eval $setvar
15788
15789
15790 : see if this is a syslog.h system
15791 set syslog.h i_syslog
15792 eval $inhdr
15793
15794
15795 : see if this is a sys/mode.h system
15796 set sys/mode.h i_sysmode
15797 eval $inhdr
15798
15799 : see if sys/resource.h has to be included
15800 set sys/resource.h i_sysresrc
15801 eval $inhdr
15802
15803 : see if sys/security.h is available
15804 set sys/security.h i_syssecrt
15805 eval $inhdr
15806
15807 : see if this is a sys/statvfs.h system
15808 set sys/statvfs.h i_sysstatvfs
15809 eval $inhdr
15810
15811 : see if this is a sys/un.h system
15812 set sys/un.h i_sysun
15813 eval $inhdr
15814
15815
15816 : see if this is a sys/utsname.h system
15817 set sys/utsname.h i_sysutsname
15818 eval $inhdr
15819
15820 : see if this is a syswait system
15821 set sys/wait.h i_syswait
15822 eval $inhdr
15823
15824 : see if this is a ustat.h system
15825 set ustat.h i_ustat
15826 eval $inhdr
15827
15828 : see if this is an utime system
15829 set utime.h i_utime
15830 eval $inhdr
15831
15832 : see if this is a values.h system
15833 set values.h i_values
15834 eval $inhdr
15835
15836 : see if this is a vfork system
15837 case "$d_vfork" in
15838 "$define")
15839         set vfork.h i_vfork
15840         eval $inhdr
15841         ;;
15842 *)
15843         i_vfork="$undef"
15844         ;;
15845 esac
15846
15847 : see if gdbm.h is available
15848 set gdbm.h t_gdbm
15849 eval $inhdr
15850 case "$t_gdbm" in
15851 $define)
15852         : see if gdbm_open exists
15853         set gdbm_open d_gdbm_open
15854         eval $inlibc
15855         case "$d_gdbm_open" in
15856         $undef)
15857                 t_gdbm="$undef"
15858                 echo "We won't be including <gdbm.h>"
15859                 ;;
15860         esac
15861         ;;
15862 esac
15863 val="$t_gdbm"
15864 set i_gdbm
15865 eval $setvar
15866
15867 echo " "
15868 echo "Looking for extensions..." >&4
15869 : If we are using the old config.sh, known_extensions may contain
15870 : old or inaccurate or duplicate values.
15871 known_extensions=''
15872 nonxs_extensions=''
15873 : We do not use find because it might not be available.
15874 : We do not just use MANIFEST because the user may have dropped
15875 : some additional extensions into the source tree and expect them
15876 : to be built.
15877
15878 : Function to recursively find available extensions, ignoring DynaLoader
15879 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15880 find_extensions='
15881     for xxx in *; do
15882        case "$xxx" in
15883            DynaLoader|dynaload) ;;
15884            *)
15885            if $test -f $xxx/$xxx.xs; then
15886                known_extensions="$known_extensions $1$xxx";
15887            elif $test -f $xxx/Makefile.PL; then
15888                nonxs_extensions="$nonxs_extensions $1$xxx";
15889            else
15890                if $test -d $xxx -a $# -lt 10; then
15891                    set $1$xxx/ $*;
15892                    cd $xxx;
15893                    eval $find_extensions;
15894                    cd ..;
15895                    shift;
15896                fi;
15897            fi
15898            ;;
15899        esac;
15900     done'
15901 tdir=`pwd`
15902 cd $rsrc/ext
15903 set X
15904 shift
15905 eval $find_extensions
15906 set X $nonxs_extensions
15907 shift
15908 nonxs_extensions="$*"
15909 set X $known_extensions
15910 shift
15911 known_extensions="$*"
15912 cd $tdir
15913
15914 : Now see which are supported on this system.
15915 avail_ext=''
15916 for xxx in $known_extensions ; do
15917         case "$xxx" in
15918         DB_File|db_file)
15919                 case "$i_db" in
15920                 $define) avail_ext="$avail_ext $xxx" ;;
15921                 esac
15922                 ;;
15923         GDBM_File|gdbm_fil)
15924                 case "$i_gdbm" in 
15925                 $define) avail_ext="$avail_ext $xxx" ;;
15926                 esac
15927                 ;;
15928         NDBM_File|ndbm_fil)
15929                 case "$i_ndbm" in
15930                 $define)
15931                     case "$osname-$use64bitint" in
15932                     hpux-define)
15933                         case "$libs" in
15934                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15935                         esac
15936                         ;;
15937                     *) avail_ext="$avail_ext $xxx" ;;
15938                     esac
15939                     ;;
15940                 esac
15941                 ;;
15942         ODBM_File|odbm_fil) 
15943                 case "${i_dbm}${i_rpcsvcdbm}" in
15944                 *"${define}"*)
15945                     case "$osname-$use64bitint" in
15946                     hpux-define)
15947                         case "$libs" in
15948                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15949                         esac
15950                         ;;
15951                     *) avail_ext="$avail_ext $xxx" ;;
15952                     esac
15953                     ;;
15954                 esac
15955                 ;;
15956         POSIX|posix)
15957                 case "$useposix" in
15958                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15959                 esac
15960                 ;;
15961         Opcode|opcode)
15962                 case "$useopcode" in
15963                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15964                 esac
15965                 ;;
15966         Socket|socket)
15967                 case "$d_socket" in 
15968                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15969                 esac
15970                 ;;
15971         Sys/Syslog|sys/syslog)
15972                 : XXX syslog requires socket
15973                 case "$d_socket" in 
15974                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15975                 esac
15976                 ;;
15977         Thread|thread)
15978                 case "$usethreads" in 
15979                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15980                 esac
15981                 ;;
15982         IPC/SysV|ipc/sysv)
15983                 : XXX Do we need a useipcsysv variable here
15984                 case "${d_msg}${d_sem}${d_shm}" in 
15985                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15986                 esac
15987                 ;;
15988         *)      avail_ext="$avail_ext $xxx"
15989                 ;;
15990         esac
15991 done
15992
15993 set X $avail_ext
15994 shift
15995 avail_ext="$*"
15996
15997 : Now see which nonxs extensions are supported on this system.
15998 : For now assume all are.
15999 nonxs_ext=''
16000 for xxx in $nonxs_extensions ; do
16001         case "$xxx" in
16002         *)      nonxs_ext="$nonxs_ext $xxx"
16003                 ;;
16004         esac
16005 done
16006
16007 set X $nonxs_ext
16008 shift
16009 nonxs_ext="$*"
16010
16011 case $usedl in
16012 $define)
16013         $cat <<EOM
16014 A number of extensions are supplied with $package.  You may choose to
16015 compile these extensions for dynamic loading (the default), compile
16016 them into the $package executable (static loading), or not include
16017 them at all.  Answer "none" to include no extensions.
16018 Note that DynaLoader is always built and need not be mentioned here.
16019
16020 EOM
16021         case "$dynamic_ext" in
16022         '') dflt="$avail_ext" ;;
16023         *)      dflt="$dynamic_ext"
16024                 # Perhaps we are reusing an old out-of-date config.sh.
16025                 case "$hint" in
16026                 previous)
16027                         if test X"$dynamic_ext" != X"$avail_ext"; then
16028                                 $cat <<EOM
16029 NOTICE:  Your previous config.sh list may be incorrect. 
16030 The extensions now available to you are 
16031         ${avail_ext}
16032 but the default list from your previous config.sh is
16033         ${dynamic_ext} 
16034
16035 EOM
16036                         fi
16037                         ;;
16038                 esac
16039                 ;;
16040         esac
16041         case "$dflt" in
16042         '')     dflt=none;;
16043         esac
16044         rp="What extensions do you wish to load dynamically?"
16045         . ./myread
16046         case "$ans" in
16047         none) dynamic_ext=' ' ;;
16048         *) dynamic_ext="$ans" ;;
16049         esac
16050
16051         case "$static_ext" in
16052         '')
16053                 : Exclude those already listed in dynamic linking
16054                 dflt=''
16055                 for xxx in $avail_ext; do
16056                         case " $dynamic_ext " in
16057                         *" $xxx "*) ;;
16058                         *) dflt="$dflt $xxx" ;;
16059                         esac
16060                 done
16061                 set X $dflt
16062                 shift
16063                 dflt="$*"
16064                 ;;
16065         *)  dflt="$static_ext" 
16066                 ;;
16067         esac
16068
16069         case "$dflt" in
16070         '')     dflt=none;;
16071         esac
16072         rp="What extensions do you wish to load statically?"
16073         . ./myread
16074         case "$ans" in
16075         none) static_ext=' ' ;;
16076         *) static_ext="$ans" ;;
16077         esac
16078         ;;
16079 *)
16080         $cat <<EOM
16081 A number of extensions are supplied with $package.  Answer "none" 
16082 to include no extensions. 
16083 Note that DynaLoader is always built and need not be mentioned here.
16084
16085 EOM
16086         case "$static_ext" in
16087         '') dflt="$avail_ext" ;;
16088         *)      dflt="$static_ext"
16089                 # Perhaps we are reusing an old out-of-date config.sh.
16090                 case "$hint" in
16091                 previous)
16092                         if test X"$static_ext" != X"$avail_ext"; then
16093                                 $cat <<EOM
16094 NOTICE:  Your previous config.sh list may be incorrect. 
16095 The extensions now available to you are 
16096         ${avail_ext}
16097 but the default list from your previous config.sh is
16098         ${static_ext} 
16099
16100 EOM
16101                         fi
16102                         ;;
16103                 esac
16104                 ;;
16105         esac
16106         : Exclude those that are not xs extensions
16107         case "$dflt" in
16108         '')     dflt=none;;
16109         esac
16110         rp="What extensions do you wish to include?"
16111         . ./myread
16112         case "$ans" in
16113         none) static_ext=' ' ;;
16114         *) static_ext="$ans" ;;
16115         esac
16116         ;;
16117 esac
16118
16119 set X $dynamic_ext $static_ext $nonxs_ext
16120 shift
16121 extensions="$*"
16122
16123 : Remove libraries needed only for extensions
16124 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16125 : The exception is SunOS 4.x, which needs them.
16126 case "${osname}X${osvers}" in
16127 sunos*X4*)
16128     perllibs="$libs"
16129     ;;
16130 *) case "$usedl" in
16131     $define|true|[yY]*)
16132             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16133             shift
16134             perllibs="$*"
16135             ;;
16136     *)  perllibs="$libs"
16137             ;;
16138     esac
16139     ;;
16140 esac
16141
16142 : Remove build directory name from cppstdin so it can be used from
16143 : either the present location or the final installed location.
16144 echo " "
16145 : Get out of the UU directory to get correct path name.
16146 cd ..
16147 case "$cppstdin" in
16148 `pwd`/cppstdin)
16149         echo "Stripping down cppstdin path name"
16150         cppstdin=cppstdin
16151         ;;
16152 esac
16153 cd UU
16154
16155 : end of configuration questions
16156 echo " "
16157 echo "End of configuration questions."
16158 echo " "
16159
16160 : back to where it started
16161 if test -d ../UU; then
16162         cd ..
16163 fi
16164
16165 : configuration may be patched via a 'config.over' file
16166 if $test -f config.over; then
16167         echo " "
16168         dflt=y
16169         rp='I see a config.over file.  Do you wish to load it?'
16170         . UU/myread
16171         case "$ans" in
16172         n*) echo "OK, I'll ignore it.";;
16173         *)      . ./config.over
16174                 echo "Configuration override changes have been loaded."
16175                 ;;
16176         esac
16177 fi
16178
16179 : in case they want portability, strip down executable paths
16180 case "$d_portable" in
16181 "$define")
16182         echo " "
16183         echo "Stripping down executable paths..." >&4
16184         for file in $loclist $trylist; do
16185                 eval temp=\$$file
16186                 eval $file=`basename $temp`
16187         done
16188         ;;
16189 esac
16190
16191 : create config.sh file
16192 echo " "
16193 echo "Creating config.sh..." >&4
16194 $spitshell <<EOT >config.sh
16195 $startsh
16196 #
16197 # This file was produced by running the Configure script. It holds all the
16198 # definitions figured out by Configure. Should you modify one of these values,
16199 # do not forget to propagate your changes by running "Configure -der". You may
16200 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16201 #
16202
16203 # Package name      : $package
16204 # Source directory  : $src
16205 # Configuration time: $cf_time
16206 # Configured by     : $cf_by
16207 # Target system     : $myuname
16208
16209 Author='$Author'
16210 Date='$Date'
16211 Header='$Header'
16212 Id='$Id'
16213 Locker='$Locker'
16214 Log='$Log'
16215 Mcc='$Mcc'
16216 RCSfile='$RCSfile'
16217 Revision='$Revision'
16218 Source='$Source'
16219 State='$State'
16220 _a='$_a'
16221 _exe='$_exe'
16222 _o='$_o'
16223 afs='$afs'
16224 afsroot='$afsroot'
16225 alignbytes='$alignbytes'
16226 ansi2knr='$ansi2knr'
16227 aphostname='$aphostname'
16228 api_revision='$api_revision'
16229 api_subversion='$api_subversion'
16230 api_version='$api_version'
16231 api_versionstring='$api_versionstring'
16232 ar='$ar'
16233 archlib='$archlib'
16234 archlibexp='$archlibexp'
16235 archname64='$archname64'
16236 archname='$archname'
16237 archobjs='$archobjs'
16238 awk='$awk'
16239 baserev='$baserev'
16240 bash='$bash'
16241 bin='$bin'
16242 bincompat5005='$bincompat5005'
16243 binexp='$binexp'
16244 bison='$bison'
16245 byacc='$byacc'
16246 byteorder='$byteorder'
16247 c='$c'
16248 castflags='$castflags'
16249 cat='$cat'
16250 cc='$cc'
16251 cccdlflags='$cccdlflags'
16252 ccdlflags='$ccdlflags'
16253 ccflags='$ccflags'
16254 ccflags_uselargefiles='$ccflags_uselargefiles'
16255 ccname='$ccname'
16256 ccsymbols='$ccsymbols'
16257 ccversion='$ccversion'
16258 cf_by='$cf_by'
16259 cf_email='$cf_email'
16260 cf_time='$cf_time'
16261 charsize='$charsize'
16262 chgrp='$chgrp'
16263 chmod='$chmod'
16264 chown='$chown'
16265 clocktype='$clocktype'
16266 comm='$comm'
16267 compress='$compress'
16268 contains='$contains'
16269 cp='$cp'
16270 cpio='$cpio'
16271 cpp='$cpp'
16272 cpp_stuff='$cpp_stuff'
16273 cppccsymbols='$cppccsymbols'
16274 cppflags='$cppflags'
16275 cpplast='$cpplast'
16276 cppminus='$cppminus'
16277 cpprun='$cpprun'
16278 cppstdin='$cppstdin'
16279 cppsymbols='$cppsymbols'
16280 crosscompile='$crosscompile'
16281 cryptlib='$cryptlib'
16282 csh='$csh'
16283 d_Gconvert='$d_Gconvert'
16284 d_PRIEUldbl='$d_PRIEUldbl'
16285 d_PRIFUldbl='$d_PRIFUldbl'
16286 d_PRIGUldbl='$d_PRIGUldbl'
16287 d_PRIXU64='$d_PRIXU64'
16288 d_PRId64='$d_PRId64'
16289 d_PRIeldbl='$d_PRIeldbl'
16290 d_PRIfldbl='$d_PRIfldbl'
16291 d_PRIgldbl='$d_PRIgldbl'
16292 d_PRIi64='$d_PRIi64'
16293 d_PRIo64='$d_PRIo64'
16294 d_PRIu64='$d_PRIu64'
16295 d_PRIx64='$d_PRIx64'
16296 d_SCNfldbl='$d_SCNfldbl'
16297 d__fwalk='$d__fwalk'
16298 d_access='$d_access'
16299 d_accessx='$d_accessx'
16300 d_alarm='$d_alarm'
16301 d_archlib='$d_archlib'
16302 d_atolf='$d_atolf'
16303 d_atoll='$d_atoll'
16304 d_attribut='$d_attribut'
16305 d_bcmp='$d_bcmp'
16306 d_bcopy='$d_bcopy'
16307 d_bincompat5005='$d_bincompat5005'
16308 d_bsd='$d_bsd'
16309 d_bsdgetpgrp='$d_bsdgetpgrp'
16310 d_bsdsetpgrp='$d_bsdsetpgrp'
16311 d_bzero='$d_bzero'
16312 d_casti32='$d_casti32'
16313 d_castneg='$d_castneg'
16314 d_charvspr='$d_charvspr'
16315 d_chown='$d_chown'
16316 d_chroot='$d_chroot'
16317 d_chsize='$d_chsize'
16318 d_closedir='$d_closedir'
16319 d_cmsghdr_s='$d_cmsghdr_s'
16320 d_const='$d_const'
16321 d_crypt='$d_crypt'
16322 d_csh='$d_csh'
16323 d_cuserid='$d_cuserid'
16324 d_dbl_dig='$d_dbl_dig'
16325 d_dbminitproto='$d_dbminitproto'
16326 d_difftime='$d_difftime'
16327 d_dirnamlen='$d_dirnamlen'
16328 d_dlerror='$d_dlerror'
16329 d_dlopen='$d_dlopen'
16330 d_dlsymun='$d_dlsymun'
16331 d_dosuid='$d_dosuid'
16332 d_drand48proto='$d_drand48proto'
16333 d_dup2='$d_dup2'
16334 d_eaccess='$d_eaccess'
16335 d_endgrent='$d_endgrent'
16336 d_endhent='$d_endhent'
16337 d_endnent='$d_endnent'
16338 d_endpent='$d_endpent'
16339 d_endpwent='$d_endpwent'
16340 d_endsent='$d_endsent'
16341 d_eofnblk='$d_eofnblk'
16342 d_eunice='$d_eunice'
16343 d_fchmod='$d_fchmod'
16344 d_fchown='$d_fchown'
16345 d_fcntl='$d_fcntl'
16346 d_fcntl_can_lock='$d_fcntl_can_lock'
16347 d_fd_macros='$d_fd_macros'
16348 d_fd_set='$d_fd_set'
16349 d_fds_bits='$d_fds_bits'
16350 d_fgetpos='$d_fgetpos'
16351 d_flexfnam='$d_flexfnam'
16352 d_flock='$d_flock'
16353 d_flockproto='$d_flockproto'
16354 d_fork='$d_fork'
16355 d_fpathconf='$d_fpathconf'
16356 d_fpos64_t='$d_fpos64_t'
16357 d_frexpl='$d_frexpl'
16358 d_fs_data_s='$d_fs_data_s'
16359 d_fseeko='$d_fseeko'
16360 d_fsetpos='$d_fsetpos'
16361 d_fstatfs='$d_fstatfs'
16362 d_fstatvfs='$d_fstatvfs'
16363 d_fsync='$d_fsync'
16364 d_ftello='$d_ftello'
16365 d_ftime='$d_ftime'
16366 d_getcwd='$d_getcwd'
16367 d_getespwnam='$d_getespwnam'
16368 d_getfsstat='$d_getfsstat'
16369 d_getgrent='$d_getgrent'
16370 d_getgrps='$d_getgrps'
16371 d_gethbyaddr='$d_gethbyaddr'
16372 d_gethbyname='$d_gethbyname'
16373 d_gethent='$d_gethent'
16374 d_gethname='$d_gethname'
16375 d_gethostprotos='$d_gethostprotos'
16376 d_getitimer='$d_getitimer'
16377 d_getlogin='$d_getlogin'
16378 d_getmnt='$d_getmnt'
16379 d_getmntent='$d_getmntent'
16380 d_getnbyaddr='$d_getnbyaddr'
16381 d_getnbyname='$d_getnbyname'
16382 d_getnent='$d_getnent'
16383 d_getnetprotos='$d_getnetprotos'
16384 d_getpagsz='$d_getpagsz'
16385 d_getpbyname='$d_getpbyname'
16386 d_getpbynumber='$d_getpbynumber'
16387 d_getpent='$d_getpent'
16388 d_getpgid='$d_getpgid'
16389 d_getpgrp2='$d_getpgrp2'
16390 d_getpgrp='$d_getpgrp'
16391 d_getppid='$d_getppid'
16392 d_getprior='$d_getprior'
16393 d_getprotoprotos='$d_getprotoprotos'
16394 d_getprpwnam='$d_getprpwnam'
16395 d_getpwent='$d_getpwent'
16396 d_getsbyname='$d_getsbyname'
16397 d_getsbyport='$d_getsbyport'
16398 d_getsent='$d_getsent'
16399 d_getservprotos='$d_getservprotos'
16400 d_getspnam='$d_getspnam'
16401 d_gettimeod='$d_gettimeod'
16402 d_gnulibc='$d_gnulibc'
16403 d_grpasswd='$d_grpasswd'
16404 d_hasmntopt='$d_hasmntopt'
16405 d_htonl='$d_htonl'
16406 d_iconv='$d_iconv'
16407 d_index='$d_index'
16408 d_inetaton='$d_inetaton'
16409 d_int64_t='$d_int64_t'
16410 d_isascii='$d_isascii'
16411 d_isnan='$d_isnan'
16412 d_isnanl='$d_isnanl'
16413 d_killpg='$d_killpg'
16414 d_lchown='$d_lchown'
16415 d_ldbl_dig='$d_ldbl_dig'
16416 d_link='$d_link'
16417 d_locconv='$d_locconv'
16418 d_lockf='$d_lockf'
16419 d_longdbl='$d_longdbl'
16420 d_longlong='$d_longlong'
16421 d_lseekproto='$d_lseekproto'
16422 d_lstat='$d_lstat'
16423 d_madvise='$d_madvise'
16424 d_mblen='$d_mblen'
16425 d_mbstowcs='$d_mbstowcs'
16426 d_mbtowc='$d_mbtowc'
16427 d_memchr='$d_memchr'
16428 d_memcmp='$d_memcmp'
16429 d_memcpy='$d_memcpy'
16430 d_memmove='$d_memmove'
16431 d_memset='$d_memset'
16432 d_mkdir='$d_mkdir'
16433 d_mkdtemp='$d_mkdtemp'
16434 d_mkfifo='$d_mkfifo'
16435 d_mkstemp='$d_mkstemp'
16436 d_mkstemps='$d_mkstemps'
16437 d_mktime='$d_mktime'
16438 d_mmap='$d_mmap'
16439 d_modfl='$d_modfl'
16440 d_mprotect='$d_mprotect'
16441 d_msg='$d_msg'
16442 d_msg_ctrunc='$d_msg_ctrunc'
16443 d_msg_dontroute='$d_msg_dontroute'
16444 d_msg_oob='$d_msg_oob'
16445 d_msg_peek='$d_msg_peek'
16446 d_msg_proxy='$d_msg_proxy'
16447 d_msgctl='$d_msgctl'
16448 d_msgget='$d_msgget'
16449 d_msghdr_s='$d_msghdr_s'
16450 d_msgrcv='$d_msgrcv'
16451 d_msgsnd='$d_msgsnd'
16452 d_msync='$d_msync'
16453 d_munmap='$d_munmap'
16454 d_mymalloc='$d_mymalloc'
16455 d_nice='$d_nice'
16456 d_nv_preserves_uv='$d_nv_preserves_uv'
16457 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16458 d_off64_t='$d_off64_t'
16459 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16460 d_oldpthreads='$d_oldpthreads'
16461 d_oldsock='$d_oldsock'
16462 d_open3='$d_open3'
16463 d_pathconf='$d_pathconf'
16464 d_pause='$d_pause'
16465 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16466 d_phostname='$d_phostname'
16467 d_pipe='$d_pipe'
16468 d_poll='$d_poll'
16469 d_portable='$d_portable'
16470 d_pthread_yield='$d_pthread_yield'
16471 d_pwage='$d_pwage'
16472 d_pwchange='$d_pwchange'
16473 d_pwclass='$d_pwclass'
16474 d_pwcomment='$d_pwcomment'
16475 d_pwexpire='$d_pwexpire'
16476 d_pwgecos='$d_pwgecos'
16477 d_pwpasswd='$d_pwpasswd'
16478 d_pwquota='$d_pwquota'
16479 d_qgcvt='$d_qgcvt'
16480 d_quad='$d_quad'
16481 d_readdir='$d_readdir'
16482 d_readlink='$d_readlink'
16483 d_readv='$d_readv'
16484 d_realpath='$d_realpath'
16485 d_recvmsg='$d_recvmsg'
16486 d_rename='$d_rename'
16487 d_rewinddir='$d_rewinddir'
16488 d_rmdir='$d_rmdir'
16489 d_safebcpy='$d_safebcpy'
16490 d_safemcpy='$d_safemcpy'
16491 d_sanemcmp='$d_sanemcmp'
16492 d_sbrkproto='$d_sbrkproto'
16493 d_sched_yield='$d_sched_yield'
16494 d_scm_rights='$d_scm_rights'
16495 d_seekdir='$d_seekdir'
16496 d_select='$d_select'
16497 d_sem='$d_sem'
16498 d_semctl='$d_semctl'
16499 d_semctl_semid_ds='$d_semctl_semid_ds'
16500 d_semctl_semun='$d_semctl_semun'
16501 d_semget='$d_semget'
16502 d_semop='$d_semop'
16503 d_sendmsg='$d_sendmsg'
16504 d_setegid='$d_setegid'
16505 d_seteuid='$d_seteuid'
16506 d_setgrent='$d_setgrent'
16507 d_setgrps='$d_setgrps'
16508 d_sethent='$d_sethent'
16509 d_setitimer='$d_setitimer'
16510 d_setlinebuf='$d_setlinebuf'
16511 d_setlocale='$d_setlocale'
16512 d_setnent='$d_setnent'
16513 d_setpent='$d_setpent'
16514 d_setpgid='$d_setpgid'
16515 d_setpgrp2='$d_setpgrp2'
16516 d_setpgrp='$d_setpgrp'
16517 d_setprior='$d_setprior'
16518 d_setproctitle='$d_setproctitle'
16519 d_setpwent='$d_setpwent'
16520 d_setregid='$d_setregid'
16521 d_setresgid='$d_setresgid'
16522 d_setresuid='$d_setresuid'
16523 d_setreuid='$d_setreuid'
16524 d_setrgid='$d_setrgid'
16525 d_setruid='$d_setruid'
16526 d_setsent='$d_setsent'
16527 d_setsid='$d_setsid'
16528 d_setvbuf='$d_setvbuf'
16529 d_sfio='$d_sfio'
16530 d_shm='$d_shm'
16531 d_shmat='$d_shmat'
16532 d_shmatprototype='$d_shmatprototype'
16533 d_shmctl='$d_shmctl'
16534 d_shmdt='$d_shmdt'
16535 d_shmget='$d_shmget'
16536 d_sigaction='$d_sigaction'
16537 d_sigprocmask='$d_sigprocmask'
16538 d_sigsetjmp='$d_sigsetjmp'
16539 d_sockatmark='$d_sockatmark'
16540 d_sockatmarkproto='$d_sockatmarkproto'
16541 d_socket='$d_socket'
16542 d_socklen_t='$d_socklen_t'
16543 d_sockpair='$d_sockpair'
16544 d_socks5_init='$d_socks5_init'
16545 d_sqrtl='$d_sqrtl'
16546 d_sresgproto='$d_sresgproto'
16547 d_sresuproto='$d_sresuproto'
16548 d_statblks='$d_statblks'
16549 d_statfs_f_flags='$d_statfs_f_flags'
16550 d_statfs_s='$d_statfs_s'
16551 d_statvfs='$d_statvfs'
16552 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16553 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16554 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16555 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16556 d_stdio_stream_array='$d_stdio_stream_array'
16557 d_stdiobase='$d_stdiobase'
16558 d_stdstdio='$d_stdstdio'
16559 d_strchr='$d_strchr'
16560 d_strcoll='$d_strcoll'
16561 d_strctcpy='$d_strctcpy'
16562 d_strerrm='$d_strerrm'
16563 d_strerror='$d_strerror'
16564 d_strftime='$d_strftime'
16565 d_strtod='$d_strtod'
16566 d_strtol='$d_strtol'
16567 d_strtold='$d_strtold'
16568 d_strtoll='$d_strtoll'
16569 d_strtoq='$d_strtoq'
16570 d_strtoul='$d_strtoul'
16571 d_strtoull='$d_strtoull'
16572 d_strtouq='$d_strtouq'
16573 d_strxfrm='$d_strxfrm'
16574 d_suidsafe='$d_suidsafe'
16575 d_symlink='$d_symlink'
16576 d_syscall='$d_syscall'
16577 d_syscallproto='$d_syscallproto'
16578 d_sysconf='$d_sysconf'
16579 d_sysernlst='$d_sysernlst'
16580 d_syserrlst='$d_syserrlst'
16581 d_system='$d_system'
16582 d_tcgetpgrp='$d_tcgetpgrp'
16583 d_tcsetpgrp='$d_tcsetpgrp'
16584 d_telldir='$d_telldir'
16585 d_telldirproto='$d_telldirproto'
16586 d_time='$d_time'
16587 d_times='$d_times'
16588 d_truncate='$d_truncate'
16589 d_tzname='$d_tzname'
16590 d_u32align='$d_u32align'
16591 d_ualarm='$d_ualarm'
16592 d_umask='$d_umask'
16593 d_uname='$d_uname'
16594 d_union_semun='$d_union_semun'
16595 d_usleep='$d_usleep'
16596 d_usleepproto='$d_usleepproto'
16597 d_ustat='$d_ustat'
16598 d_vendorarch='$d_vendorarch'
16599 d_vendorbin='$d_vendorbin'
16600 d_vendorlib='$d_vendorlib'
16601 d_vfork='$d_vfork'
16602 d_void_closedir='$d_void_closedir'
16603 d_voidsig='$d_voidsig'
16604 d_voidtty='$d_voidtty'
16605 d_volatile='$d_volatile'
16606 d_vprintf='$d_vprintf'
16607 d_wait4='$d_wait4'
16608 d_waitpid='$d_waitpid'
16609 d_wcstombs='$d_wcstombs'
16610 d_wctomb='$d_wctomb'
16611 d_writev='$d_writev'
16612 d_xenix='$d_xenix'
16613 date='$date'
16614 db_hashtype='$db_hashtype'
16615 db_prefixtype='$db_prefixtype'
16616 db_version_major='$db_version_major'
16617 db_version_minor='$db_version_minor'
16618 db_version_patch='$db_version_patch'
16619 defvoidused='$defvoidused'
16620 direntrytype='$direntrytype'
16621 dlext='$dlext'
16622 dlsrc='$dlsrc'
16623 doublesize='$doublesize'
16624 drand01='$drand01'
16625 dynamic_ext='$dynamic_ext'
16626 eagain='$eagain'
16627 ebcdic='$ebcdic'
16628 echo='$echo'
16629 egrep='$egrep'
16630 emacs='$emacs'
16631 eunicefix='$eunicefix'
16632 exe_ext='$exe_ext'
16633 expr='$expr'
16634 extensions='$extensions'
16635 fflushNULL='$fflushNULL'
16636 fflushall='$fflushall'
16637 find='$find'
16638 firstmakefile='$firstmakefile'
16639 flex='$flex'
16640 fpossize='$fpossize'
16641 fpostype='$fpostype'
16642 freetype='$freetype'
16643 full_ar='$full_ar'
16644 full_csh='$full_csh'
16645 full_sed='$full_sed'
16646 gccosandvers='$gccosandvers'
16647 gccversion='$gccversion'
16648 gidformat='$gidformat'
16649 gidsign='$gidsign'
16650 gidsize='$gidsize'
16651 gidtype='$gidtype'
16652 glibpth='$glibpth'
16653 grep='$grep'
16654 groupcat='$groupcat'
16655 groupstype='$groupstype'
16656 gzip='$gzip'
16657 h_fcntl='$h_fcntl'
16658 h_sysfile='$h_sysfile'
16659 hint='$hint'
16660 hostcat='$hostcat'
16661 i16size='$i16size'
16662 i16type='$i16type'
16663 i32size='$i32size'
16664 i32type='$i32type'
16665 i64size='$i64size'
16666 i64type='$i64type'
16667 i8size='$i8size'
16668 i8type='$i8type'
16669 i_arpainet='$i_arpainet'
16670 i_bsdioctl='$i_bsdioctl'
16671 i_db='$i_db'
16672 i_dbm='$i_dbm'
16673 i_dirent='$i_dirent'
16674 i_dld='$i_dld'
16675 i_dlfcn='$i_dlfcn'
16676 i_fcntl='$i_fcntl'
16677 i_float='$i_float'
16678 i_gdbm='$i_gdbm'
16679 i_grp='$i_grp'
16680 i_iconv='$i_iconv'
16681 i_ieeefp='$i_ieeefp'
16682 i_inttypes='$i_inttypes'
16683 i_libutil='$i_libutil'
16684 i_limits='$i_limits'
16685 i_locale='$i_locale'
16686 i_machcthr='$i_machcthr'
16687 i_malloc='$i_malloc'
16688 i_math='$i_math'
16689 i_memory='$i_memory'
16690 i_mntent='$i_mntent'
16691 i_ndbm='$i_ndbm'
16692 i_netdb='$i_netdb'
16693 i_neterrno='$i_neterrno'
16694 i_netinettcp='$i_netinettcp'
16695 i_niin='$i_niin'
16696 i_poll='$i_poll'
16697 i_prot='$i_prot'
16698 i_pthread='$i_pthread'
16699 i_pwd='$i_pwd'
16700 i_rpcsvcdbm='$i_rpcsvcdbm'
16701 i_sfio='$i_sfio'
16702 i_sgtty='$i_sgtty'
16703 i_shadow='$i_shadow'
16704 i_socks='$i_socks'
16705 i_stdarg='$i_stdarg'
16706 i_stddef='$i_stddef'
16707 i_stdlib='$i_stdlib'
16708 i_string='$i_string'
16709 i_sunmath='$i_sunmath'
16710 i_sysaccess='$i_sysaccess'
16711 i_sysdir='$i_sysdir'
16712 i_sysfile='$i_sysfile'
16713 i_sysfilio='$i_sysfilio'
16714 i_sysin='$i_sysin'
16715 i_sysioctl='$i_sysioctl'
16716 i_syslog='$i_syslog'
16717 i_sysmman='$i_sysmman'
16718 i_sysmode='$i_sysmode'
16719 i_sysmount='$i_sysmount'
16720 i_sysndir='$i_sysndir'
16721 i_sysparam='$i_sysparam'
16722 i_sysresrc='$i_sysresrc'
16723 i_syssecrt='$i_syssecrt'
16724 i_sysselct='$i_sysselct'
16725 i_syssockio='$i_syssockio'
16726 i_sysstat='$i_sysstat'
16727 i_sysstatfs='$i_sysstatfs'
16728 i_sysstatvfs='$i_sysstatvfs'
16729 i_systime='$i_systime'
16730 i_systimek='$i_systimek'
16731 i_systimes='$i_systimes'
16732 i_systypes='$i_systypes'
16733 i_sysuio='$i_sysuio'
16734 i_sysun='$i_sysun'
16735 i_sysutsname='$i_sysutsname'
16736 i_sysvfs='$i_sysvfs'
16737 i_syswait='$i_syswait'
16738 i_termio='$i_termio'
16739 i_termios='$i_termios'
16740 i_time='$i_time'
16741 i_unistd='$i_unistd'
16742 i_ustat='$i_ustat'
16743 i_utime='$i_utime'
16744 i_values='$i_values'
16745 i_varargs='$i_varargs'
16746 i_varhdr='$i_varhdr'
16747 i_vfork='$i_vfork'
16748 ignore_versioned_solibs='$ignore_versioned_solibs'
16749 inc_version_list='$inc_version_list'
16750 inc_version_list_init='$inc_version_list_init'
16751 incpath='$incpath'
16752 inews='$inews'
16753 installarchlib='$installarchlib'
16754 installbin='$installbin'
16755 installman1dir='$installman1dir'
16756 installman3dir='$installman3dir'
16757 installprefix='$installprefix'
16758 installprefixexp='$installprefixexp'
16759 installprivlib='$installprivlib'
16760 installscript='$installscript'
16761 installsitearch='$installsitearch'
16762 installsitebin='$installsitebin'
16763 installsitelib='$installsitelib'
16764 installstyle='$installstyle'
16765 installusrbinperl='$installusrbinperl'
16766 installvendorarch='$installvendorarch'
16767 installvendorbin='$installvendorbin'
16768 installvendorlib='$installvendorlib'
16769 intsize='$intsize'
16770 issymlink='$issymlink'
16771 ivdformat='$ivdformat'
16772 ivsize='$ivsize'
16773 ivtype='$ivtype'
16774 known_extensions='$known_extensions'
16775 ksh='$ksh'
16776 ld='$ld'
16777 lddlflags='$lddlflags'
16778 ldflags='$ldflags'
16779 ldflags_uselargefiles='$ldflags_uselargefiles'
16780 ldlibpthname='$ldlibpthname'
16781 less='$less'
16782 lib_ext='$lib_ext'
16783 libc='$libc'
16784 libperl='$libperl'
16785 libpth='$libpth'
16786 libs='$libs'
16787 libsdirs='$libsdirs'
16788 libsfiles='$libsfiles'
16789 libsfound='$libsfound'
16790 libspath='$libspath'
16791 libswanted='$libswanted'
16792 libswanted_uselargefiles='$libswanted_uselargefiles'
16793 line='$line'
16794 lint='$lint'
16795 lkflags='$lkflags'
16796 ln='$ln'
16797 lns='$lns'
16798 locincpth='$locincpth'
16799 loclibpth='$loclibpth'
16800 longdblsize='$longdblsize'
16801 longlongsize='$longlongsize'
16802 longsize='$longsize'
16803 lp='$lp'
16804 lpr='$lpr'
16805 ls='$ls'
16806 lseeksize='$lseeksize'
16807 lseektype='$lseektype'
16808 mail='$mail'
16809 mailx='$mailx'
16810 make='$make'
16811 make_set_make='$make_set_make'
16812 mallocobj='$mallocobj'
16813 mallocsrc='$mallocsrc'
16814 malloctype='$malloctype'
16815 man1dir='$man1dir'
16816 man1direxp='$man1direxp'
16817 man1ext='$man1ext'
16818 man3dir='$man3dir'
16819 man3direxp='$man3direxp'
16820 man3ext='$man3ext'
16821 mips_type='$mips_type'
16822 mkdir='$mkdir'
16823 mmaptype='$mmaptype'
16824 modetype='$modetype'
16825 more='$more'
16826 multiarch='$multiarch'
16827 mv='$mv'
16828 myarchname='$myarchname'
16829 mydomain='$mydomain'
16830 myhostname='$myhostname'
16831 myuname='$myuname'
16832 n='$n'
16833 need_va_copy='$need_va_copy'
16834 netdb_hlen_type='$netdb_hlen_type'
16835 netdb_host_type='$netdb_host_type'
16836 netdb_name_type='$netdb_name_type'
16837 netdb_net_type='$netdb_net_type'
16838 nm='$nm'
16839 nm_opt='$nm_opt'
16840 nm_so_opt='$nm_so_opt'
16841 nonxs_ext='$nonxs_ext'
16842 nroff='$nroff'
16843 nvEUformat='$nvEUformat'
16844 nvFUformat='$nvFUformat'
16845 nvGUformat='$nvGUformat'
16846 nveformat='$nveformat'
16847 nvfformat='$nvfformat'
16848 nvgformat='$nvgformat'
16849 nvsize='$nvsize'
16850 nvtype='$nvtype'
16851 o_nonblock='$o_nonblock'
16852 obj_ext='$obj_ext'
16853 old_pthread_create_joinable='$old_pthread_create_joinable'
16854 optimize='$optimize'
16855 orderlib='$orderlib'
16856 osname='$osname'
16857 osvers='$osvers'
16858 otherlibdirs='$otherlibdirs'
16859 package='$package'
16860 pager='$pager'
16861 passcat='$passcat'
16862 patchlevel='$patchlevel'
16863 path_sep='$path_sep'
16864 perl5='$perl5'
16865 perl='$perl'
16866 perl_patchlevel='$perl_patchlevel'
16867 perladmin='$perladmin'
16868 perllibs='$perllibs'
16869 perlpath='$perlpath'
16870 pg='$pg'
16871 phostname='$phostname'
16872 pidtype='$pidtype'
16873 plibpth='$plibpth'
16874 pm_apiversion='$pm_apiversion'
16875 pmake='$pmake'
16876 pr='$pr'
16877 prefix='$prefix'
16878 prefixexp='$prefixexp'
16879 privlib='$privlib'
16880 privlibexp='$privlibexp'
16881 prototype='$prototype'
16882 ptrsize='$ptrsize'
16883 quadkind='$quadkind'
16884 quadtype='$quadtype'
16885 randbits='$randbits'
16886 randfunc='$randfunc'
16887 randseedtype='$randseedtype'
16888 ranlib='$ranlib'
16889 rd_nodata='$rd_nodata'
16890 revision='$revision'
16891 rm='$rm'
16892 rmail='$rmail'
16893 runnm='$runnm'
16894 sPRIEUldbl='$sPRIEUldbl'
16895 sPRIFUldbl='$sPRIFUldbl'
16896 sPRIGUldbl='$sPRIGUldbl'
16897 sPRIXU64='$sPRIXU64'
16898 sPRId64='$sPRId64'
16899 sPRIeldbl='$sPRIeldbl'
16900 sPRIfldbl='$sPRIfldbl'
16901 sPRIgldbl='$sPRIgldbl'
16902 sPRIi64='$sPRIi64'
16903 sPRIo64='$sPRIo64'
16904 sPRIu64='$sPRIu64'
16905 sPRIx64='$sPRIx64'
16906 sSCNfldbl='$sSCNfldbl'
16907 sched_yield='$sched_yield'
16908 scriptdir='$scriptdir'
16909 scriptdirexp='$scriptdirexp'
16910 sed='$sed'
16911 seedfunc='$seedfunc'
16912 selectminbits='$selectminbits'
16913 selecttype='$selecttype'
16914 sendmail='$sendmail'
16915 sh='$sh'
16916 shar='$shar'
16917 sharpbang='$sharpbang'
16918 shmattype='$shmattype'
16919 shortsize='$shortsize'
16920 shrpenv='$shrpenv'
16921 shsharp='$shsharp'
16922 sig_count='$sig_count'
16923 sig_name='$sig_name'
16924 sig_name_init='$sig_name_init'
16925 sig_num='$sig_num'
16926 sig_num_init='$sig_num_init'
16927 sig_size='$sig_size'
16928 signal_t='$signal_t'
16929 sitearch='$sitearch'
16930 sitearchexp='$sitearchexp'
16931 sitebin='$sitebin'
16932 sitebinexp='$sitebinexp'
16933 sitelib='$sitelib'
16934 sitelib_stem='$sitelib_stem'
16935 sitelibexp='$sitelibexp'
16936 siteprefix='$siteprefix'
16937 siteprefixexp='$siteprefixexp'
16938 sizesize='$sizesize'
16939 sizetype='$sizetype'
16940 sleep='$sleep'
16941 smail='$smail'
16942 so='$so'
16943 sockethdr='$sockethdr'
16944 socketlib='$socketlib'
16945 socksizetype='$socksizetype'
16946 sort='$sort'
16947 spackage='$spackage'
16948 spitshell='$spitshell'
16949 src='$src'
16950 ssizetype='$ssizetype'
16951 startperl='$startperl'
16952 startsh='$startsh'
16953 static_ext='$static_ext'
16954 stdchar='$stdchar'
16955 stdio_base='$stdio_base'
16956 stdio_bufsiz='$stdio_bufsiz'
16957 stdio_cnt='$stdio_cnt'
16958 stdio_filbuf='$stdio_filbuf'
16959 stdio_ptr='$stdio_ptr'
16960 stdio_stream_array='$stdio_stream_array'
16961 strings='$strings'
16962 submit='$submit'
16963 subversion='$subversion'
16964 sysman='$sysman'
16965 tail='$tail'
16966 tar='$tar'
16967 tbl='$tbl'
16968 tee='$tee'
16969 test='$test'
16970 timeincl='$timeincl'
16971 timetype='$timetype'
16972 touch='$touch'
16973 tr='$tr'
16974 trnl='$trnl'
16975 troff='$troff'
16976 u16size='$u16size'
16977 u16type='$u16type'
16978 u32size='$u32size'
16979 u32type='$u32type'
16980 u64size='$u64size'
16981 u64type='$u64type'
16982 u8size='$u8size'
16983 u8type='$u8type'
16984 uidformat='$uidformat'
16985 uidsign='$uidsign'
16986 uidsize='$uidsize'
16987 uidtype='$uidtype'
16988 uname='$uname'
16989 uniq='$uniq'
16990 uquadtype='$uquadtype'
16991 use5005threads='$use5005threads'
16992 use64bitall='$use64bitall'
16993 use64bitint='$use64bitint'
16994 usedl='$usedl'
16995 useithreads='$useithreads'
16996 uselargefiles='$uselargefiles'
16997 uselongdouble='$uselongdouble'
16998 usemorebits='$usemorebits'
16999 usemultiplicity='$usemultiplicity'
17000 usemymalloc='$usemymalloc'
17001 usenm='$usenm'
17002 useopcode='$useopcode'
17003 useperlio='$useperlio'
17004 useposix='$useposix'
17005 usesfio='$usesfio'
17006 useshrplib='$useshrplib'
17007 usesocks='$usesocks'
17008 usethreads='$usethreads'
17009 usevendorprefix='$usevendorprefix'
17010 usevfork='$usevfork'
17011 usrinc='$usrinc'
17012 uuname='$uuname'
17013 uvXUformat='$uvXUformat'
17014 uvoformat='$uvoformat'
17015 uvsize='$uvsize'
17016 uvtype='$uvtype'
17017 uvuformat='$uvuformat'
17018 uvxformat='$uvxformat'
17019 vendorarch='$vendorarch'
17020 vendorarchexp='$vendorarchexp'
17021 vendorbin='$vendorbin'
17022 vendorbinexp='$vendorbinexp'
17023 vendorlib='$vendorlib'
17024 vendorlib_stem='$vendorlib_stem'
17025 vendorlibexp='$vendorlibexp'
17026 vendorprefix='$vendorprefix'
17027 vendorprefixexp='$vendorprefixexp'
17028 version='$version'
17029 versiononly='$versiononly'
17030 vi='$vi'
17031 voidflags='$voidflags'
17032 xlibpth='$xlibpth'
17033 xs_apiversion='$xs_apiversion'
17034 yacc='$yacc'
17035 yaccflags='$yaccflags'
17036 zcat='$zcat'
17037 zip='$zip'
17038 EOT
17039
17040 : Add in command line options if available
17041 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17042
17043 : add special variables
17044 $test -f $src/patchlevel.h && \
17045 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17046 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17047 echo "PERL_CONFIG_SH=true" >>config.sh
17048
17049 : propagate old symbols
17050 if $test -f UU/config.sh; then
17051         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17052         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17053         $sort | $uniq -u >UU/oldsyms
17054         set X `cat UU/oldsyms`
17055         shift
17056         case $# in
17057         0) ;;
17058         *)
17059                 cat <<EOM
17060 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17061 EOM
17062                 echo "# Variables propagated from previous config.sh file." >>config.sh
17063                 for sym in `cat UU/oldsyms`; do
17064                         echo "    Propagating $hint variable "'$'"$sym..."
17065                         eval 'tmp="$'"${sym}"'"'
17066                         echo "$tmp" | \
17067                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17068                 done
17069                 ;;
17070         esac
17071 fi
17072
17073 : Finish up by extracting the .SH files
17074 case "$alldone" in
17075 exit)
17076         $rm -rf UU
17077         echo "Extraction done."
17078         exit 0
17079         ;;
17080 cont)
17081         ;;
17082 '')
17083         dflt=''
17084         nostick=true
17085         $cat <<EOM
17086
17087 If you'd like to make any changes to the config.sh file before I begin
17088 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17089
17090 EOM
17091         rp="Press return or use a shell escape to edit config.sh:"
17092         . UU/myread
17093         nostick=''
17094         case "$ans" in
17095         '') ;;
17096         *) : in case they cannot read
17097                 sh 1>&4 -c "$ans";;
17098         esac
17099         ;;
17100 esac
17101
17102 : if this fails, just run all the .SH files by hand
17103 . ./config.sh
17104
17105 echo " "
17106 exec 1>&4
17107 . ./UU/extract
17108
17109 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17110         dflt=y
17111         case "$silent" in
17112         true) ;;
17113         *)
17114                 $cat <<EOM
17115
17116 Now you need to generate make dependencies by running "$make depend".
17117 You might prefer to run it in background: "$make depend > makedepend.out &"
17118 It can take a while, so you might not want to run it right now.
17119
17120 EOM
17121                 ;;
17122         esac
17123         rp="Run $make depend now?"
17124         . UU/myread
17125         case "$ans" in
17126         y*)
17127                 $make depend && echo "Now you must run '$make'."
17128                 ;;
17129         *)
17130                 echo "You must run '$make depend' then '$make'."
17131                 ;;
17132         esac
17133 elif test -f [Mm]akefile; then
17134         echo " "
17135         echo "Now you must run a $make."
17136 else
17137         echo "Configure done."
17138 fi
17139
17140 if $test -f Policy.sh; then
17141     $cat <<EOM
17142
17143 If you compile $package on a different machine or from a different object
17144 directory, copy the Policy.sh file from this object directory to the
17145 new one before you run Configure -- this will help you with most of
17146 the policy defaults.
17147
17148 EOM
17149 fi
17150 if $test -f config.msg; then
17151     echo "Hmm.  I also noted the following information while running:"
17152     echo " "
17153     $cat config.msg >&4
17154     $rm -f config.msg
17155 fi
17156 $rm -f kit*isdone ark*isdone
17157 $rm -rf UU
17158
17159 : End of Configure
17160