Comment on comment.
[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 Sun Nov 26 20:19:22 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigsetjmp=''
523 d_msg_ctrunc=''
524 d_msg_dontroute=''
525 d_msg_oob=''
526 d_msg_peek=''
527 d_msg_proxy=''
528 d_oldsock=''
529 d_scm_rights=''
530 d_socket=''
531 d_sockpair=''
532 sockethdr=''
533 socketlib=''
534 d_socklen_t=''
535 d_socks5_init=''
536 d_sqrtl=''
537 d_statblks=''
538 d_statfs_f_flags=''
539 d_statfs_s=''
540 d_fstatvfs=''
541 d_statvfs=''
542 d_stdio_cnt_lval=''
543 d_stdio_ptr_lval=''
544 d_stdio_ptr_lval_nochange_cnt=''
545 d_stdio_ptr_lval_sets_cnt=''
546 d_stdiobase=''
547 d_stdstdio=''
548 stdio_base=''
549 stdio_bufsiz=''
550 stdio_cnt=''
551 stdio_filbuf=''
552 stdio_ptr=''
553 d_index=''
554 d_strchr=''
555 d_strcoll=''
556 d_strctcpy=''
557 d_strerrm=''
558 d_strerror=''
559 d_sysernlst=''
560 d_syserrlst=''
561 d_strtod=''
562 d_strtol=''
563 d_strtold=''
564 d_strtoll=''
565 d_strtoul=''
566 d_strtoull=''
567 d_strtouq=''
568 d_strxfrm=''
569 d_symlink=''
570 d_syscall=''
571 d_sysconf=''
572 d_system=''
573 d_tcgetpgrp=''
574 d_tcsetpgrp=''
575 d_telldirproto=''
576 d_time=''
577 timetype=''
578 clocktype=''
579 d_times=''
580 d_truncate=''
581 d_tzname=''
582 d_umask=''
583 d_semctl_semid_ds=''
584 d_semctl_semun=''
585 d_union_semun=''
586 d_ustat=''
587 d_vfork=''
588 usevfork=''
589 d_voidsig=''
590 signal_t=''
591 d_volatile=''
592 d_charvspr=''
593 d_vprintf=''
594 d_wait4=''
595 d_waitpid=''
596 d_wcstombs=''
597 d_wctomb=''
598 dlext=''
599 cccdlflags=''
600 ccdlflags=''
601 dlsrc=''
602 ld=''
603 lddlflags=''
604 usedl=''
605 doublesize=''
606 ebcdic=''
607 fflushNULL=''
608 fflushall=''
609 fpossize=''
610 fpostype=''
611 gccosandvers=''
612 gccversion=''
613 gidformat=''
614 gidsign=''
615 gidsize=''
616 gidtype=''
617 groupstype=''
618 h_fcntl=''
619 h_sysfile=''
620 i_arpainet=''
621 db_hashtype=''
622 db_prefixtype=''
623 i_db=''
624 i_dbm=''
625 i_rpcsvcdbm=''
626 d_dirnamlen=''
627 direntrytype=''
628 i_dirent=''
629 i_dld=''
630 i_dlfcn=''
631 i_fcntl=''
632 i_float=''
633 i_gdbm=''
634 d_grpasswd=''
635 i_grp=''
636 i_iconv=''
637 i_ieeefp=''
638 i_inttypes=''
639 i_libutil=''
640 i_limits=''
641 i_locale=''
642 i_machcthr=''
643 i_malloc=''
644 i_math=''
645 i_memory=''
646 i_mntent=''
647 i_ndbm=''
648 i_netdb=''
649 i_neterrno=''
650 i_netinettcp=''
651 i_niin=''
652 i_sysin=''
653 i_poll=''
654 i_prot=''
655 i_pthread=''
656 d_pwage=''
657 d_pwchange=''
658 d_pwclass=''
659 d_pwcomment=''
660 d_pwexpire=''
661 d_pwgecos=''
662 d_pwpasswd=''
663 d_pwquota=''
664 i_pwd=''
665 i_sfio=''
666 i_shadow=''
667 i_socks=''
668 i_stddef=''
669 i_stdlib=''
670 i_string=''
671 strings=''
672 i_sunmath=''
673 i_sysaccess=''
674 i_sysdir=''
675 i_sysfile=''
676 d_voidtty=''
677 i_bsdioctl=''
678 i_sysfilio=''
679 i_sysioctl=''
680 i_syssockio=''
681 i_syslog=''
682 i_sysmman=''
683 i_sysmode=''
684 i_sysmount=''
685 i_sysndir=''
686 i_sysparam=''
687 i_sysresrc=''
688 i_syssecrt=''
689 i_sysselct=''
690 i_sysstat=''
691 i_sysstatfs=''
692 i_sysstatvfs=''
693 i_systimes=''
694 i_systypes=''
695 i_sysuio=''
696 i_sysun=''
697 i_sysutsname=''
698 i_sysvfs=''
699 i_syswait=''
700 i_sgtty=''
701 i_termio=''
702 i_termios=''
703 i_systime=''
704 i_systimek=''
705 i_time=''
706 timeincl=''
707 i_unistd=''
708 i_ustat=''
709 i_utime=''
710 i_values=''
711 i_stdarg=''
712 i_varargs=''
713 i_varhdr=''
714 i_vfork=''
715 inc_version_list=''
716 inc_version_list_init=''
717 installprefix=''
718 installprefixexp=''
719 installstyle=''
720 installusrbinperl=''
721 intsize=''
722 longsize=''
723 shortsize=''
724 libc=''
725 ldlibpthname=''
726 libperl=''
727 shrpenv=''
728 useshrplib=''
729 glibpth=''
730 libpth=''
731 loclibpth=''
732 plibpth=''
733 xlibpth=''
734 ignore_versioned_solibs=''
735 libs=''
736 libsdirs=''
737 libsfiles=''
738 libsfound=''
739 libspath=''
740 lns=''
741 d_PRIEUldbl=''
742 d_PRIFUldbl=''
743 d_PRIGUldbl=''
744 d_PRIeldbl=''
745 d_PRIfldbl=''
746 d_PRIgldbl=''
747 d_SCNfldbl=''
748 sPRIEUldbl=''
749 sPRIFUldbl=''
750 sPRIGUldbl=''
751 sPRIeldbl=''
752 sPRIfldbl=''
753 sPRIgldbl=''
754 sSCNfldbl=''
755 lseeksize=''
756 lseektype=''
757 make_set_make=''
758 d_mymalloc=''
759 freetype=''
760 mallocobj=''
761 mallocsrc=''
762 malloctype=''
763 usemymalloc=''
764 installman1dir=''
765 man1dir=''
766 man1direxp=''
767 man1ext=''
768 installman3dir=''
769 man3dir=''
770 man3direxp=''
771 man3ext=''
772 modetype=''
773 multiarch=''
774 mydomain=''
775 myhostname=''
776 phostname=''
777 c=''
778 n=''
779 d_eofnblk=''
780 eagain=''
781 o_nonblock=''
782 rd_nodata=''
783 need_va_copy=''
784 netdb_hlen_type=''
785 netdb_host_type=''
786 netdb_name_type=''
787 netdb_net_type=''
788 groupcat=''
789 hostcat=''
790 passcat=''
791 orderlib=''
792 ranlib=''
793 d_perl_otherlibdirs=''
794 otherlibdirs=''
795 package=''
796 spackage=''
797 pager=''
798 api_revision=''
799 api_subversion=''
800 api_version=''
801 api_versionstring=''
802 patchlevel=''
803 revision=''
804 subversion=''
805 version=''
806 perl5=''
807 perladmin=''
808 perlpath=''
809 d_nv_preserves_uv=''
810 d_nv_preserves_uv_bits=''
811 i16size=''
812 i16type=''
813 i32size=''
814 i32type=''
815 i64size=''
816 i64type=''
817 i8size=''
818 i8type=''
819 ivsize=''
820 ivtype=''
821 nvsize=''
822 nvtype=''
823 u16size=''
824 u16type=''
825 u32size=''
826 u32type=''
827 u64size=''
828 u64type=''
829 u8size=''
830 u8type=''
831 uvsize=''
832 uvtype=''
833 ivdformat=''
834 nvEUformat=''
835 nvFUformat=''
836 nvGUformat=''
837 nveformat=''
838 nvfformat=''
839 nvgformat=''
840 uvXUformat=''
841 uvoformat=''
842 uvuformat=''
843 uvxformat=''
844 pidtype=''
845 prefix=''
846 prefixexp=''
847 installprivlib=''
848 privlib=''
849 privlibexp=''
850 prototype=''
851 ptrsize=''
852 d_PRIXU64=''
853 d_PRId64=''
854 d_PRIi64=''
855 d_PRIo64=''
856 d_PRIu64=''
857 d_PRIx64=''
858 sPRIXU64=''
859 sPRId64=''
860 sPRIi64=''
861 sPRIo64=''
862 sPRIu64=''
863 sPRIx64=''
864 d_quad=''
865 quadkind=''
866 quadtype=''
867 uquadtype=''
868 drand01=''
869 randbits=''
870 randfunc=''
871 randseedtype=''
872 seedfunc=''
873 installscript=''
874 scriptdir=''
875 scriptdirexp=''
876 selectminbits=''
877 selecttype=''
878 sh=''
879 sig_count=''
880 sig_name=''
881 sig_name_init=''
882 sig_num=''
883 sig_num_init=''
884 installsitearch=''
885 sitearch=''
886 sitearchexp=''
887 installsitebin=''
888 sitebin=''
889 sitebinexp=''
890 installsitelib=''
891 sitelib=''
892 sitelib_stem=''
893 sitelibexp=''
894 siteprefix=''
895 siteprefixexp=''
896 sizesize=''
897 sizetype=''
898 so=''
899 socksizetype=''
900 sharpbang=''
901 shsharp=''
902 spitshell=''
903 src=''
904 ssizetype=''
905 startperl=''
906 startsh=''
907 stdchar=''
908 d_stdio_stream_array=''
909 stdio_stream_array=''
910 sysman=''
911 trnl=''
912 uidformat=''
913 uidsign=''
914 uidsize=''
915 uidtype=''
916 archname64=''
917 use64bitall=''
918 use64bitint=''
919 ccflags_uselargefiles=''
920 ldflags_uselargefiles=''
921 libswanted_uselargefiles=''
922 uselargefiles=''
923 uselongdouble=''
924 usemorebits=''
925 usemultiplicity=''
926 nm_opt=''
927 nm_so_opt=''
928 runnm=''
929 usenm=''
930 useperlio=''
931 usesocks=''
932 d_oldpthreads=''
933 use5005threads=''
934 useithreads=''
935 usethreads=''
936 incpath=''
937 mips_type=''
938 usrinc=''
939 d_vendorarch=''
940 installvendorarch=''
941 vendorarch=''
942 vendorarchexp=''
943 d_vendorbin=''
944 installvendorbin=''
945 vendorbin=''
946 vendorbinexp=''
947 d_vendorlib=''
948 installvendorlib=''
949 vendorlib=''
950 vendorlib_stem=''
951 vendorlibexp=''
952 usevendorprefix=''
953 vendorprefix=''
954 vendorprefixexp=''
955 versiononly=''
956 defvoidused=''
957 voidflags=''
958 pm_apiversion=''
959 xs_apiversion=''
960 CONFIG=''
961
962 define='define'
963 undef='undef'
964 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
965 rmlist=''
966
967 : We must find out about Eunice early
968 eunicefix=':'
969 if test -f /etc/unixtovms; then
970         eunicefix=/etc/unixtovms
971 fi
972 if test -f /etc/unixtovms.exe; then
973         eunicefix=/etc/unixtovms.exe
974 fi
975
976 i_whoami=''
977 ccname=''
978 ccversion=''
979 perllibs=''
980 : set useposix=false in your hint file to disable the POSIX extension.
981 useposix=true
982 : set useopcode=false in your hint file to disable the Opcode extension.
983 useopcode=true
984 : Trailing extension.  Override this in a hint file, if needed.
985 _exe=''
986 : Extra object files, if any, needed on this platform.
987 archobjs=''
988 archname=''
989 : Possible local include directories to search.
990 : Set locincpth to "" in a hint file to defeat local include searches.
991 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
992 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
993 :
994 : no include file wanted by default
995 inclwanted=''
996
997 groupstype=''
998 : change the next line if compiling for Xenix/286 on Xenix/386
999 xlibpth='/usr/lib/386 /lib/386'
1000 : Possible local library directories to search.
1001 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1002 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1003
1004 : general looking path for locating libraries
1005 glibpth="/lib /usr/lib $xlibpth"
1006 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1007 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1008 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1009
1010 : Private path used by Configure to find libraries.  Its value
1011 : is prepended to libpth. This variable takes care of special
1012 : machines, like the mips.  Usually, it should be empty.
1013 plibpth=''
1014
1015 : default library list
1016 libswanted=''
1017 : some systems want to use only the non-versioned libso:s
1018 ignore_versioned_solibs=''
1019 archname64=''
1020 ccflags_uselargefiles=''
1021 ldflags_uselargefiles=''
1022 libswanted_uselargefiles=''
1023 : set usemultiplicity on the Configure command line to enable multiplicity.
1024 : set usesocks on the Configure command line to enable socks.
1025 : set usethreads on the Configure command line to enable threads.
1026 : full support for void wanted by default
1027 defvoidused=15
1028
1029 : List of libraries we want.
1030 : If anyone needs -lnet, put it in a hint file.
1031 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1032 libswanted="$libswanted dld ld sun m c cposix posix"
1033 libswanted="$libswanted ndir dir crypt sec"
1034 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1035 : We probably want to search /usr/shlib before most other libraries.
1036 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1037 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1038 glibpth="/usr/shlib $glibpth"
1039 : Do not use vfork unless overridden by a hint file.
1040 usevfork=false
1041
1042 : Find the basic shell for Bourne shell scripts
1043 case "$sh" in
1044 '')
1045         case "$SYSTYPE" in
1046         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1047         *) xxx='/bin/sh';;
1048         esac
1049         if test -f "$xxx"; then
1050                 sh="$xxx"
1051         else
1052                 : Build up a list and do a single loop so we can 'break' out.
1053                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1054                 for xxx in sh bash ksh pdksh ash; do
1055                         for p in $pth; do
1056                                 try="$try ${p}/${xxx}"
1057                         done
1058                 done
1059                 for xxx in $try; do
1060                         if test -f "$xxx"; then
1061                                 sh="$xxx";
1062                                 break
1063                         elif test -f "$xxx.exe"; then
1064                                 sh="$xxx";
1065                                 break
1066                         fi
1067                 done
1068         fi
1069         ;;
1070 esac
1071
1072 case "$sh" in
1073 '')     cat <<EOM >&2
1074 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1075
1076 Usually it's in /bin/sh.  How did you even get this far?
1077 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1078 we'll try to straighten this all out.
1079 EOM
1080         exit 1
1081         ;;
1082 esac
1083
1084 : see if sh knows # comments
1085 if `$sh -c '#' >/dev/null 2>&1`; then
1086         shsharp=true
1087         spitshell=cat
1088         xcat=/bin/cat
1089         test -f $xcat || xcat=/usr/bin/cat
1090         echo "#!$xcat" >try
1091         $eunicefix try
1092         chmod +x try
1093         ./try > today
1094         if test -s today; then
1095                 sharpbang='#!'
1096         else
1097                 echo "#! $xcat" > try
1098                 $eunicefix try
1099                 chmod +x try
1100                 ./try > today
1101                 if test -s today; then
1102                         sharpbang='#! '
1103                 else
1104                         sharpbang=': use '
1105                 fi
1106         fi
1107 else
1108         echo " "
1109         echo "Your $sh doesn't grok # comments--I will strip them later on."
1110         shsharp=false
1111         cd ..
1112         echo "exec grep -v '^[  ]*#'" >spitshell
1113         chmod +x spitshell
1114         $eunicefix spitshell
1115         spitshell=`pwd`/spitshell
1116         cd UU
1117         echo "I presume that if # doesn't work, #! won't work either!"
1118         sharpbang=': use '
1119 fi
1120 rm -f try today
1121
1122 : figure out how to guarantee sh startup
1123 case "$startsh" in
1124 '') startsh=${sharpbang}${sh} ;;
1125 *)
1126 esac
1127 cat >try <<EOSS
1128 $startsh
1129 set abc
1130 test "$?abc" != 1
1131 EOSS
1132
1133 chmod +x try
1134 $eunicefix try
1135 if ./try; then
1136         : echo "Yup, it does."
1137 else
1138         echo "Hmm... '$startsh' does not guarantee sh startup..."
1139         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1140 fi
1141 rm -f try
1142
1143
1144 : Save command line options in file UU/cmdline.opt for later use in
1145 : generating config.sh.
1146 cat > cmdline.opt <<EOSH
1147 # Configure command line arguments.
1148 config_arg0='$0'
1149 config_args='$*'
1150 config_argc=$#
1151 EOSH
1152 argn=1
1153 for arg in "$@"; do
1154         cat >>cmdline.opt <<EOSH
1155 config_arg$argn='$arg'
1156 EOSH
1157         argn=`expr $argn + 1`
1158 done
1159
1160 : produce awk script to parse command line options
1161 cat >options.awk <<'EOF'
1162 BEGIN {
1163         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1164
1165         len = length(optstr);
1166         for (i = 1; i <= len; i++) {
1167                 c = substr(optstr, i, 1);
1168                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1169                 if (a == ":") {
1170                         arg[c] = 1;
1171                         i++;
1172                 }
1173                 opt[c] = 1;
1174         }
1175 }
1176 {
1177         expect = 0;
1178         str = $0;
1179         if (substr(str, 1, 1) != "-") {
1180                 printf("'%s'\n", str);
1181                 next;
1182         }
1183         len = length($0);
1184         for (i = 2; i <= len; i++) {
1185                 c = substr(str, i, 1);
1186                 if (!opt[c]) {
1187                         printf("-%s\n", substr(str, i));
1188                         next;
1189                 }
1190                 printf("-%s\n", c);
1191                 if (arg[c]) {
1192                         if (i < len)
1193                                 printf("'%s'\n", substr(str, i + 1));
1194                         else
1195                                 expect = 1;
1196                         next;
1197                 }
1198         }
1199 }
1200 END {
1201         if (expect)
1202                 print "?";
1203 }
1204 EOF
1205
1206 : process the command line options
1207 set X `for arg in "$@"; do echo "X$arg"; done |
1208         sed -e s/X// | awk -f options.awk`
1209 eval "set $*"
1210 shift
1211 rm -f options.awk
1212
1213 : set up default values
1214 fastread=''
1215 reuseval=false
1216 config_sh=''
1217 alldone=''
1218 error=''
1219 silent=''
1220 extractsh=''
1221 override=''
1222 knowitall=''
1223 rm -f optdef.sh posthint.sh
1224 cat >optdef.sh <<EOS
1225 $startsh
1226 EOS
1227
1228
1229 : option parsing
1230 while test $# -gt 0; do
1231         case "$1" in
1232         -d) shift; fastread=yes;;
1233         -e) shift; alldone=cont;;
1234         -f)
1235                 shift
1236                 cd ..
1237                 if test -r "$1"; then
1238                         config_sh="$1"
1239                 else
1240                         echo "$me: cannot read config file $1." >&2
1241                         error=true
1242                 fi
1243                 cd UU
1244                 shift;;
1245         -h) shift; error=true;;
1246         -r) shift; reuseval=true;;
1247         -s) shift; silent=true; realsilent=true;;
1248         -E) shift; alldone=exit;;
1249         -K) shift; knowitall=true;;
1250         -O) shift; override=true;;
1251         -S) shift; silent=true; extractsh=true;;
1252         -D)
1253                 shift
1254                 case "$1" in
1255                 *=)
1256                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1257                         echo "$me: ignoring -D $1" >&2
1258                         ;;
1259                 *=*) echo "$1" | \
1260                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1261                 *) echo "$1='define'" >> optdef.sh;;
1262                 esac
1263                 shift
1264                 ;;
1265         -U)
1266                 shift
1267                 case "$1" in
1268                 *=) echo "$1" >> optdef.sh;;
1269                 *=*)
1270                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1271                         echo "$me: ignoring -U $1" >&2
1272                         ;;
1273                 *) echo "$1='undef'" >> optdef.sh;;
1274                 esac
1275                 shift
1276                 ;;
1277         -A)
1278             shift
1279             xxx=''
1280             yyy="$1"
1281             zzz=''
1282             uuu=undef
1283             case "$yyy" in
1284             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1285                  case "$zzz" in
1286                  *:*) zzz='' ;;
1287                  *)   xxx=append
1288                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1289                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1290                  esac
1291                  ;;
1292             esac
1293             case "$xxx" in
1294             '')  case "$yyy" in
1295                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1296                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1297                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1298                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1299                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1300                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1301                  esac
1302                  ;;       
1303             esac
1304             case "$xxx" in
1305             append)
1306                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1307             clear)
1308                 echo "$yyy=''"                  >> posthint.sh ;;
1309             define)
1310                 case "$zzz" in
1311                 '') zzz=define ;;
1312                 esac
1313                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1314             eval)
1315                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1316             prepend)
1317                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1318             undef)
1319                 case "$zzz" in
1320                 '') zzz="$uuu" ;;
1321                 esac
1322                 echo "$yyy=$zzz"                >> posthint.sh ;;
1323             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1324             esac
1325             shift
1326             ;;
1327         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1328             exit 0;;
1329         --) break;;
1330         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1331         *) break;;
1332         esac
1333 done
1334
1335 case "$error" in
1336 true)
1337         cat >&2 <<EOM
1338 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1339                  [-U symbol] [-U symbol=] [-A command:symbol...]
1340   -d : use defaults for all answers.
1341   -e : go on without questioning past the production of config.sh.
1342   -f : specify an alternate default configuration file.
1343   -h : print this help message and exit (with an error status).
1344   -r : reuse C symbols value if possible (skips costly nm extraction).
1345   -s : silent mode, only echoes questions and essential information.
1346   -D : define symbol to have some value:
1347          -D symbol         symbol gets the value 'define'
1348          -D symbol=value   symbol gets the value 'value'
1349   -E : stop at the end of questions, after having produced config.sh.
1350   -K : do not use unless you know what you are doing.
1351   -O : let -D and -U override definitions from loaded configuration file.
1352   -S : perform variable substitutions on all .SH files (can mix with -f)
1353   -U : undefine symbol:
1354          -U symbol    symbol gets the value 'undef'
1355          -U symbol=   symbol gets completely empty
1356   -A : manipulate symbol after the platform specific hints have been applied:
1357          -A symbol=value                append " "value to symbol
1358          -A append:symbol=value         append value to symbol
1359          -A define:symbol=value         define symbol to have value
1360          -A clear:symbol                define symbol to be ''
1361          -A define:symbol               define symbol to be 'define'
1362          -A eval:symbol=value           define symbol to be eval of value
1363          -A prepend:symbol=value        prepend value to symbol
1364          -A undef:symbol                define symbol to be 'undef'
1365          -A undef:symbol=               define symbol to be ''
1366   -V : print version number and exit (with a zero status).
1367 EOM
1368         exit 1
1369         ;;
1370 esac
1371
1372 : Sanity checks
1373 case "$fastread$alldone" in
1374 yescont|yesexit) ;;
1375 *)
1376         case "$extractsh" in
1377         true) ;;
1378         *)
1379                 if test ! -t 0; then
1380                         echo "Say 'sh Configure', not 'sh <Configure'"
1381                         exit 1
1382                 fi
1383                 ;;
1384         esac
1385         ;;
1386 esac
1387
1388 exec 4>&1
1389 case "$silent" in
1390 true) exec 1>/dev/null;;
1391 esac
1392
1393 : run the defines and the undefines, if any, but leave the file out there...
1394 touch optdef.sh
1395 . ./optdef.sh
1396 : create the posthint manipulation script and leave the file out there...
1397 touch posthint.sh
1398
1399 : set package name
1400 package=perl5
1401 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1402 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1403 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1404 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1405 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1406 esac
1407
1408 : Some greps do not return status, grrr.
1409 echo "grimblepritz" >grimble
1410 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1411         contains=contains
1412 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1413         contains=grep
1414 else
1415         contains=contains
1416 fi
1417 rm -f grimble
1418 : the following should work in any shell
1419 case "$contains" in
1420 contains*)
1421         echo " "
1422         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1423         cat >contains <<'EOSS'
1424 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1425 EOSS
1426 chmod +x contains
1427 esac
1428
1429 : Find the path to the source tree
1430 case "$src" in
1431 '') case "$0" in
1432     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1433          case "$src" in
1434          /*)    ;;
1435          *)     src=`cd ../$src && pwd` ;;
1436          esac
1437          ;;
1438     *)   src='.';;
1439     esac;;
1440 esac
1441 case "$src" in
1442 '')     src=/
1443         rsrc=/
1444         ;;
1445 /*) rsrc="$src";;
1446 *) rsrc="../$src";;
1447 esac
1448 if test -f $rsrc/Configure && \
1449         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1450 then
1451    : found it, so we are ok.
1452 else
1453         rsrc=''
1454         for src in . .. ../.. ../../.. ../../../..; do
1455                 if test -f ../$src/Configure && \
1456                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1457                 then
1458                         rsrc=../$src
1459                         break
1460                 fi
1461         done
1462 fi
1463 case "$rsrc" in
1464 '')
1465         cat <<EOM >&4
1466
1467 Sorry, I can't seem to locate the source dir for $package.  Please start
1468 Configure with an explicit path -- i.e. /some/path/Configure.
1469
1470 EOM
1471         exit 1
1472         ;;
1473 ../.)   rsrc='..';;
1474 *)
1475         echo " "
1476         echo "Sources for $package found in \"$src\"." >&4
1477         ;;
1478 esac
1479
1480 : script used to extract .SH files with variable substitutions
1481 cat >extract <<'EOS'
1482 CONFIGDOTSH=true
1483 echo "Doing variable substitutions on .SH files..."
1484 if test -f $src/MANIFEST; then
1485         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1486 else
1487         echo "(Looking for .SH files under the source directory.)"
1488         set x `(cd $src; find . -name "*.SH" -print)`
1489 fi
1490 shift
1491 case $# in
1492 0) set x `(cd $src; echo *.SH)`; shift;;
1493 esac
1494 if test ! -f $src/$1; then
1495         shift
1496 fi
1497 mkdir_p='
1498 name=$1;
1499 create="";
1500 while test $name; do
1501         if test ! -d "$name"; then
1502                 create="$name $create";
1503                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1504                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1505         else
1506                 name="";
1507         fi;
1508 done;
1509 for file in $create; do
1510         mkdir $file;
1511 done
1512 '
1513 for file in $*; do
1514         case "$src" in
1515         ".")
1516                 case "$file" in
1517                 */*)
1518                         dir=`expr X$file : 'X\(.*\)/'`
1519                         file=`expr X$file : 'X.*/\(.*\)'`
1520                         (cd $dir && . ./$file)
1521                         ;;
1522                 *)
1523                         . ./$file
1524                         ;;
1525                 esac
1526                 ;;
1527         *)
1528                 case "$file" in
1529                 */*)
1530                         dir=`expr X$file : 'X\(.*\)/'`
1531                         file=`expr X$file : 'X.*/\(.*\)'`
1532                         (set x $dir; shift; eval $mkdir_p)
1533                         sh <$src/$dir/$file
1534                         ;;
1535                 *)
1536                         sh <$src/$file
1537                         ;;
1538                 esac
1539                 ;;
1540         esac
1541 done
1542 if test -f $src/config_h.SH; then
1543         if test ! -f config.h; then
1544         : oops, they left it out of MANIFEST, probably, so do it anyway.
1545         . $src/config_h.SH
1546         fi
1547 fi
1548 EOS
1549
1550 : extract files and exit if asked to do so
1551 case "$extractsh" in
1552 true)
1553         case "$realsilent" in
1554         true) ;;
1555         *) exec 1>&4;;
1556         esac
1557         case "$config_sh" in
1558         '') config_sh='config.sh';;
1559         esac
1560         echo " "
1561         echo "Fetching answers from $config_sh..."
1562         cd ..
1563         . $config_sh
1564         test "$override" && . ./optdef.sh
1565         echo " "
1566         . UU/extract
1567         rm -rf UU
1568         echo "Done."
1569         exit 0
1570         ;;
1571 esac
1572
1573 : Eunice requires " " instead of "", can you believe it
1574 echo " "
1575 : Here we go...
1576 echo "Beginning of configuration questions for $package."
1577
1578 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1579
1580 : first determine how to suppress newline on echo command
1581 echo " "
1582 echo "Checking echo to see how to suppress newlines..."
1583 (echo "hi there\c" ; echo " ") >.echotmp
1584 if $contains c .echotmp >/dev/null 2>&1 ; then
1585         echo "...using -n."
1586         n='-n'
1587         c=''
1588 else
1589         cat <<'EOM'
1590 ...using \c
1591 EOM
1592         n=''
1593         c='\c'
1594 fi
1595 echo $n "The star should be here-->$c"
1596 echo '*'
1597 rm -f .echotmp
1598
1599 : Now test for existence of everything in MANIFEST
1600 echo " "
1601 if test -f $rsrc/MANIFEST; then
1602         echo "First let's make sure your kit is complete.  Checking..." >&4
1603         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1604         rm -f missing
1605         tmppwd=`pwd`
1606         for filelist in x??; do
1607                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1608         done
1609         if test -s missing; then
1610                 cat missing >&4
1611                 cat >&4 <<'EOM'
1612
1613 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1614
1615 You have the option of continuing the configuration process, despite the
1616 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1617 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1618 and contact the author (perlbug@perl.org).
1619
1620 EOM
1621                 echo $n "Continue? [n] $c" >&4
1622                 read ans
1623                 case "$ans" in
1624                 y*)
1625                         echo "Continuing..." >&4
1626                         rm -f missing
1627                         ;;
1628                 *)
1629                         echo "ABORTING..." >&4
1630                         kill $$
1631                         ;;
1632                 esac
1633         else
1634                 echo "Looks good..."
1635         fi
1636 else
1637         echo "There is no MANIFEST file.  I hope your kit is complete !"
1638 fi
1639 rm -f missing x??
1640
1641 echo " "
1642 : Find the appropriate value for a newline for tr
1643 if test -n "$DJGPP"; then
1644        trnl='\012'
1645 fi
1646 if test X"$trnl" = X; then
1647         case "`echo foo|tr '\n' x 2>/dev/null`" in
1648         foox) trnl='\n' ;;
1649         esac
1650 fi
1651 if test X"$trnl" = X; then
1652         case "`echo foo|tr '\012' x 2>/dev/null`" in
1653         foox) trnl='\012' ;;
1654         esac
1655 fi
1656 if test X"$trnl" = X; then
1657         cat <<EOM >&2
1658
1659 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1660
1661 EOM
1662         exit 1
1663 fi
1664
1665 : compute the number of columns on the terminal for proper question formatting
1666 case "$COLUMNS" in
1667 '') COLUMNS='80';;
1668 esac
1669
1670 : set up the echo used in my read
1671 myecho="case \"\$xxxm\" in
1672 '') echo $n \"\$rp $c\" >&4;;
1673 *) case \"\$rp\" in
1674         '') echo $n \"[\$xxxm] $c\";;
1675         *)
1676                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1677                         echo \"\$rp\" >&4
1678                         echo $n \"[\$xxxm] $c\" >&4
1679                 else
1680                         echo $n \"\$rp [\$xxxm] $c\" >&4
1681                 fi
1682                 ;;
1683         esac;;
1684 esac"
1685
1686 : now set up to do reads with possible shell escape and default assignment
1687 cat <<EOSC >myread
1688 $startsh
1689 xxxm=\$dflt
1690 $myecho
1691 ans='!'
1692 case "\$fastread" in
1693 yes) case "\$dflt" in
1694         '') ;;
1695         *) ans='';
1696                 case "\$silent-\$rp" in
1697                 true-) ;;
1698                 *) echo " " >&4;;
1699                 esac;;
1700         esac;;
1701 *) case "\$silent" in
1702         true) case "\$rp" in
1703                 '') ans='';;
1704                 esac;;
1705         esac;;
1706 esac
1707 while expr "X\$ans" : "X!" >/dev/null; do
1708         read answ
1709         set x \$xxxm
1710         shift
1711         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1712         case  "\$answ" in
1713         "!")
1714                 sh 1>&4
1715                 echo " "
1716                 $myecho
1717                 ;;
1718         !*)
1719                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1720                 shift
1721                 sh 1>&4 -c "\$*"
1722                 echo " "
1723                 $myecho
1724                 ;;
1725         "\$ans")
1726                 case "\$ans" in
1727                 \\&*)
1728                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1729                         shift
1730                         case "\$1" in
1731                         -d)
1732                                 fastread=yes
1733                                 echo "(OK, I'll run with -d after this question.)" >&4
1734                                 ;;
1735                         -*)
1736                                 echo "*** Sorry, \$1 not supported yet." >&4
1737                                 ;;
1738                         esac
1739                         $myecho
1740                         ans=!
1741                         ;;
1742                 esac;;
1743         *)
1744                 case "\$aok" in
1745                 y)
1746                         echo "*** Substitution done -- please confirm."
1747                         xxxm="\$ans"
1748                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1749                         xxxm="\$ans"
1750                         ans=!
1751                         ;;
1752                 *)
1753                         echo "*** Error -- try again."
1754                         ans=!
1755                         ;;
1756                 esac
1757                 $myecho
1758                 ;;
1759         esac
1760         case "\$ans\$xxxm\$nostick" in
1761         '')
1762                 ans=!
1763                 $myecho
1764                 ;;
1765         esac
1766 done
1767 case "\$ans" in
1768 '') ans="\$xxxm";;
1769 esac
1770 EOSC
1771
1772 : create .config dir to save info across Configure sessions
1773 test -d ../.config || mkdir ../.config
1774 cat >../.config/README <<EOF
1775 This directory created by Configure to save information that should
1776 persist across sessions for $package.
1777
1778 You may safely delete it if you wish.
1779 EOF
1780
1781 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1782 case "$usedevel" in
1783 $define|true|[yY]*) ;;
1784 *) case "$xversion" in
1785    *[13579])
1786         cat >&4 <<EOH
1787 *** WHOA THERE!!! ***
1788
1789     This is an UNSTABLE DEVELOPMENT release.
1790     The version of this $package distribution is $xversion, that is, odd,
1791     (as opposed to even) and that signifies a development release.
1792     If you want a maintenance release, you want an even-numbered version.
1793
1794     Do ***NOT*** install this into production use.
1795     Data corruption and crashes are possible.
1796
1797     It is most seriously suggested that you do not continue any further
1798     unless you want to help in developing and debugging Perl.
1799
1800 EOH
1801         rp='Do you really want to continue?'
1802         dflt='n'
1803         . ./myread
1804         case "$ans" in
1805         [yY]) echo >&4 "Okay, continuing." ;;
1806         *) echo >&4 "Okay, bye."
1807            exit 1
1808            ;;
1809         esac
1810         ;;
1811     esac
1812     ;;
1813 esac
1814
1815 : general instructions
1816 needman=true
1817 firsttime=true
1818 user=`(logname) 2>/dev/null`
1819 case "$user" in
1820 '') user=`whoami 2>&1`;;
1821 esac
1822 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1823         firsttime=false
1824         echo " "
1825         rp='Would you like to see the instructions?'
1826         dflt=n
1827         . ./myread
1828         case "$ans" in
1829         [yY]*) ;;
1830         *) needman=false;;
1831         esac
1832 fi
1833 if $needman; then
1834         cat <<EOH
1835
1836 This installation shell script will examine your system and ask you questions
1837 to determine how the perl5 package should be installed. If you get
1838 stuck on a question, you may use a ! shell escape to start a subshell or
1839 execute a command.  Many of the questions will have default answers in square
1840 brackets; typing carriage return will give you the default.
1841
1842 On some of the questions which ask for file or directory names you are allowed
1843 to use the ~name construct to specify the login directory belonging to "name",
1844 even if you don't have a shell which knows about that.  Questions where this is
1845 allowed will be marked "(~name ok)".
1846
1847 EOH
1848         rp=''
1849         dflt='Type carriage return to continue'
1850         . ./myread
1851         cat <<'EOH'
1852
1853 The prompter used in this script allows you to use shell variables and
1854 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1855 in the default answer, as if the default line was a set of arguments given to a
1856 script shell.  This means you may also use $* to repeat the whole default line,
1857 so you do not have to re-type everything to add something to the default.
1858
1859 Everytime there is a substitution, you will have to confirm.  If there is an
1860 error (e.g. an unmatched backtick), the default answer will remain unchanged
1861 and you will be prompted again.
1862
1863 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1864 the questions and use the computed defaults (or the previous answers if there
1865 was already a config.sh file). Type 'Configure -h' for a list of options.
1866 You may also start interactively and then answer '& -d' at any prompt to turn
1867 on the non-interactive behaviour for the remainder of the execution.
1868
1869 EOH
1870         . ./myread
1871         cat <<EOH
1872
1873 Much effort has been expended to ensure that this shell script will run on any
1874 Unix system.  If despite that it blows up on yours, your best bet is to edit
1875 Configure and run it again.  If you can't run Configure for some reason,
1876 you'll have to generate a config.sh file by hand.  Whatever problems you
1877 have, let me (perlbug@perl.org) know how I blew it.
1878
1879 This installation script affects things in two ways:
1880
1881 1) it may do direct variable substitutions on some of the files included
1882    in this kit.
1883 2) it builds a config.h file for inclusion in C programs.  You may edit
1884    any of these files as the need arises after running this script.
1885
1886 If you make a mistake on a question, there is no easy way to back up to it
1887 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1888 files.  Configure will offer to let you do this before it runs the SH files.
1889
1890 EOH
1891         dflt='Type carriage return to continue'
1892         . ./myread
1893         case "$firsttime" in
1894         true) echo $user >>../.config/instruct;;
1895         esac
1896 fi
1897
1898 : find out where common programs are
1899 echo " "
1900 echo "Locating common programs..." >&4
1901 cat <<EOSC >loc
1902 $startsh
1903 case \$# in
1904 0) exit 1;;
1905 esac
1906 thing=\$1
1907 shift
1908 dflt=\$1
1909 shift
1910 for dir in \$*; do
1911         case "\$thing" in
1912         .)
1913         if test -d \$dir/\$thing; then
1914                 echo \$dir
1915                 exit 0
1916         fi
1917         ;;
1918         *)
1919         for thisthing in \$dir/\$thing; do
1920                 : just loop through to pick last item
1921         done
1922         if test -f \$thisthing; then
1923                 echo \$thisthing
1924                 exit 0
1925         elif test -f \$dir/\$thing.exe; then
1926                 if test -n "$DJGPP"; then
1927                         echo \$dir/\$thing.exe
1928                 else
1929                         : on Eunice apparently
1930                         echo \$dir/\$thing
1931                 fi
1932                 exit 0
1933         fi
1934         ;;
1935         esac
1936 done
1937 echo \$dflt
1938 exit 1
1939 EOSC
1940 chmod +x loc
1941 $eunicefix loc
1942 loclist="
1943 awk
1944 cat
1945 comm
1946 cp
1947 echo
1948 expr
1949 grep
1950 ls
1951 make
1952 mkdir
1953 rm
1954 sed
1955 sort
1956 touch
1957 tr
1958 uniq
1959 "
1960 trylist="
1961 Mcc
1962 ar
1963 byacc
1964 cpp
1965 csh
1966 date
1967 egrep
1968 gzip
1969 less
1970 ln
1971 more
1972 nm
1973 nroff
1974 pg
1975 test
1976 uname
1977 zip
1978 "
1979 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1980 pth="$pth /lib /usr/lib"
1981 for file in $loclist; do
1982         eval xxx=\$$file
1983         case "$xxx" in
1984         /*|?:[\\/]*)
1985                 if test -f "$xxx"; then
1986                         : ok
1987                 else
1988                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1989                         xxx=`./loc $file $file $pth`
1990                 fi
1991                 ;;
1992         '') xxx=`./loc $file $file $pth`;;
1993         *) xxx=`./loc $xxx $xxx $pth`;;
1994         esac
1995         eval $file=$xxx
1996         eval _$file=$xxx
1997         case "$xxx" in
1998         /*)
1999                 echo $file is in $xxx.
2000                 ;;
2001         ?:[\\/]*)
2002                 echo $file is in $xxx.
2003                 ;;
2004         *)
2005                 echo "I don't know where '$file' is, and my life depends on it." >&4
2006                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2007                 exit 1
2008                 ;;
2009         esac
2010 done
2011 echo " "
2012 echo "Don't worry if any of the following aren't found..."
2013 say=offhand
2014 for file in $trylist; do
2015         eval xxx=\$$file
2016         case "$xxx" in
2017         /*|?:[\\/]*)
2018                 if test -f "$xxx"; then
2019                         : ok
2020                 else
2021                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2022                         xxx=`./loc $file $file $pth`
2023                 fi
2024                 ;;
2025         '') xxx=`./loc $file $file $pth`;;
2026         *) xxx=`./loc $xxx $xxx $pth`;;
2027         esac
2028         eval $file=$xxx
2029         eval _$file=$xxx
2030         case "$xxx" in
2031         /*)
2032                 echo $file is in $xxx.
2033                 ;;
2034         ?:[\\/]*)
2035                 echo $file is in $xxx.
2036                 ;;
2037         *)
2038                 echo "I don't see $file out there, $say."
2039                 say=either
2040                 ;;
2041         esac
2042 done
2043 case "$egrep" in
2044 egrep)
2045         echo "Substituting grep for egrep."
2046         egrep=$grep
2047         ;;
2048 esac
2049 case "$ln" in
2050 ln)
2051         echo "Substituting cp for ln."
2052         ln=$cp
2053         ;;
2054 esac
2055 case "$test" in
2056 test)
2057         echo "Hopefully test is built into your sh."
2058         ;;
2059 *)
2060         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2061                 echo "Using the test built into your sh."
2062                 test=test
2063                 _test=test
2064         fi
2065         ;;
2066 esac
2067 case "$echo" in
2068 echo)
2069         echo "Hopefully echo is built into your sh."
2070         ;;
2071 '') ;;
2072 *)
2073         echo " "
2074 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2075         $echo $n "hi there$c" >foo1
2076         echo $n "hi there$c" >foo2
2077         if cmp foo1 foo2 >/dev/null 2>&1; then
2078                 echo "They are compatible.  In fact, they may be identical."
2079         else
2080                 case "$n" in
2081                 '-n') n='' c='\c';;
2082                 *) n='-n' c='';;
2083                 esac
2084                 cat <<FOO
2085 They are not compatible!  You are probably running ksh on a non-USG system.
2086 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2087 have echo built in and we may have to run some Bourne shell scripts.  That
2088 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2089
2090 FOO
2091                 $echo $n "The star should be here-->$c"
2092                 $echo "*"
2093         fi
2094         $rm -f foo1 foo2
2095         ;;
2096 esac
2097
2098 cat <<EOS >checkcc
2099 $startsh
2100 EOS
2101 cat <<'EOSC' >>checkcc
2102 case "$cc" in
2103 '') ;;
2104 *)  $rm -f try try.*
2105     $cat >try.c <<EOM
2106 int main(int argc, char *argv[]) {
2107   return 0;
2108 }
2109 EOM
2110     if $cc -o try $ccflags try.c; then
2111        :
2112     else
2113         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2114         despair=yes
2115         trygcc=yes
2116         case "$cc" in
2117         *gcc*) trygcc=no ;;
2118         esac
2119         case "`$cc -v -c try.c 2>&1`" in
2120         *gcc*) trygcc=no ;;
2121         esac
2122         if $test X"$trygcc" = Xyes; then
2123             if gcc -o try -c try.c; then
2124                 echo " "
2125                 echo "You seem to have a working gcc, though." >&4
2126                 rp="Would you like to use it?"
2127                 dflt=y
2128                 if $test -f myread; then
2129                     . ./myread
2130                 else
2131                     if $test -f UU/myread; then
2132                         . ./UU/myread
2133                     else
2134                         echo "Cannot find myread, sorry.  Aborting." >&2
2135                         exit 1
2136                     fi
2137                 fi  
2138                 case "$ans" in
2139                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2140                 esac
2141             fi
2142         fi
2143         if $test X"$despair" = Xyes; then
2144             $cat >&4 <<EOM
2145 You need to find a working C compiler.
2146 Either (purchase and) install the C compiler supplied by your OS vendor,
2147 or for a free C compiler try http://gcc.gnu.org/
2148 I cannot continue any further, aborting.
2149 EOM
2150             exit 1
2151         fi
2152     fi
2153     $rm -f try try.*
2154     ;;
2155 esac
2156 EOSC
2157
2158 : determine whether symbolic links are supported
2159 echo " "
2160 $touch blurfl
2161 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2162         echo "Symbolic links are supported." >&4
2163         lns="$ln -s"
2164 else
2165         echo "Symbolic links are NOT supported." >&4
2166         lns="$ln"
2167 fi
2168 $rm -f blurfl sym
2169
2170 : see whether [:lower:] and [:upper:] are supported character classes
2171 echo " "
2172 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2173 ABYZ)
2174         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2175         up='[:upper:]'
2176         low='[:lower:]'
2177         ;;
2178 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2179         # (0xc9 and 0xd1), therefore that is a nice testing point.
2180         if test "X$up" = X -o "X$low" = X; then
2181             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2182             ij) up='[A-Z]'
2183                 low='[a-z]'
2184                 ;;
2185             esac
2186         fi
2187         if test "X$up" = X -o "X$low" = X; then
2188             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2189             ij) up='A-Z'
2190                 low='a-z'
2191                 ;;
2192             esac
2193         fi
2194         if test "X$up" = X -o "X$low" = X; then
2195             case "`echo IJ | od -x 2>/dev/null`" in
2196             *C9D1*|*c9d1*)
2197                 echo "Hey, this might be EBCDIC." >&4
2198                 if test "X$up" = X -o "X$low" = X; then
2199                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2200                     ij) up='[A-IJ-RS-Z]'
2201                         low='[a-ij-rs-z]'
2202                         ;;
2203                     esac
2204                 fi
2205                 if test "X$up" = X -o "X$low" = X; then
2206                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2207                     ij) up='A-IJ-RS-Z'
2208                         low='a-ij-rs-z'
2209                         ;;
2210                     esac
2211                 fi
2212                 ;;
2213             esac
2214         fi
2215 esac
2216 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2217 ij)
2218     echo "Using $up and $low to convert case." >&4
2219     ;;
2220 *)
2221     echo "I don't know how to translate letters from upper to lower case." >&4
2222     echo "Your tr is not acting any way I know of." >&4
2223     exit 1
2224     ;;
2225 esac
2226 : set up the translation script tr, must be called with ./tr of course
2227 cat >tr <<EOSC
2228 $startsh
2229 case "\$1\$2" in
2230 '[A-Z][a-z]') exec $tr '$up' '$low';;
2231 '[a-z][A-Z]') exec $tr '$low' '$up';;
2232 esac
2233 exec $tr "\$@"
2234 EOSC
2235 chmod +x tr
2236 $eunicefix tr
2237
2238 : Try to determine whether config.sh was made on this system
2239 case "$config_sh" in
2240 '')
2241 myuname=`$uname -a 2>/dev/null`
2242 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2243 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2244 # because the A-Z/a-z are not consecutive.
2245 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2246         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2247 newmyuname="$myuname"
2248 dflt=n
2249 case "$knowitall" in
2250 '')
2251         if test -f ../config.sh; then
2252                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2253                         eval "`grep myuname= ../config.sh`"
2254                 fi
2255                 if test "X$myuname" = "X$newmyuname"; then
2256                         dflt=y
2257                 fi
2258         fi
2259         ;;
2260 *) dflt=y;;
2261 esac
2262
2263 : Get old answers from old config file if Configure was run on the
2264 : same system, otherwise use the hints.
2265 hint=default
2266 cd ..
2267 if test -f config.sh; then
2268         echo " "
2269         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2270         . UU/myread
2271         case "$ans" in
2272         n*|N*) echo "OK, I'll ignore it."
2273                 mv config.sh config.sh.old
2274                 myuname="$newmyuname"
2275                 ;;
2276         *)  echo "Fetching default answers from your old config.sh file..." >&4
2277                 tmp_n="$n"
2278                 tmp_c="$c"
2279                 tmp_sh="$sh"
2280                 . ./config.sh
2281                 cp config.sh UU
2282                 n="$tmp_n"
2283                 c="$tmp_c"
2284                 : Older versions did not always set $sh.  Catch re-use of such
2285                 : an old config.sh.
2286                 case "$sh" in
2287                 '') sh="$tmp_sh" ;;
2288                 esac
2289                 hint=previous
2290                 ;;
2291         esac
2292 fi
2293 . ./UU/checkcc
2294 if test ! -f config.sh; then
2295         $cat <<EOM
2296
2297 First time through, eh?  I have some defaults handy for some systems
2298 that need some extra help getting the Configure answers right:
2299
2300 EOM
2301         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2302         dflt=''
2303         : Half the following guesses are probably wrong... If you have better
2304         : tests or hints, please send them to perlbug@perl.org
2305         : The metaconfig authors would also appreciate a copy...
2306         $test -f /irix && osname=irix
2307         $test -f /xenix && osname=sco_xenix
2308         $test -f /dynix && osname=dynix
2309         $test -f /dnix && osname=dnix
2310         $test -f /lynx.os && osname=lynxos
2311         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2312         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2313         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2314         $test -f /bin/mips && /bin/mips && osname=mips
2315         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2316                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2317         $test -d /usr/apollo/bin && osname=apollo
2318         $test -f /etc/saf/_sactab && osname=svr4
2319         $test -d /usr/include/minix && osname=minix
2320         if $test -d /MachTen -o -d /MachTen_Folder; then
2321                 osname=machten
2322                 if $test -x /sbin/version; then
2323                         osvers=`/sbin/version | $awk '{print $2}' |
2324                         $sed -e 's/[A-Za-z]$//'`
2325                 elif $test -x /usr/etc/version; then
2326                         osvers=`/usr/etc/version | $awk '{print $2}' |
2327                         $sed -e 's/[A-Za-z]$//'`
2328                 else
2329                         osvers="$2.$3"
2330                 fi
2331         fi
2332
2333         $test -f /sys/posix.dll &&
2334                 $test -f /usr/bin/what &&
2335                 set X `/usr/bin/what /sys/posix.dll` &&
2336                 $test "$3" = UWIN &&
2337                 osname=uwin &&
2338                 osvers="$5"
2339
2340         if $test -f $uname; then
2341                 set X $myuname
2342                 shift
2343
2344                 case "$5" in
2345                 fps*) osname=fps ;;
2346                 mips*)
2347                         case "$4" in
2348                         umips) osname=umips ;;
2349                         *) osname=mips ;;
2350                         esac;;
2351                 [23]100) osname=mips ;;
2352                 next*) osname=next ;;
2353                 i386*)
2354                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2355                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2356                                 osname='sco'
2357                                 osvers=$tmp
2358                         elif $test -f /etc/kconfig; then
2359                                 osname=isc
2360                                 if test "$lns" = "$ln -s"; then
2361                                         osvers=4
2362                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2363                                         osvers=3
2364                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2365                                         osvers=2
2366                                 fi
2367                         fi
2368                         tmp=''
2369                         ;;
2370                 pc*)
2371                         if test -n "$DJGPP"; then
2372                                 osname=dos
2373                                 osvers=djgpp
2374                         fi
2375                         ;;
2376                 esac
2377
2378                 case "$1" in
2379                 aix) osname=aix
2380                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2381                         case "$tmp" in
2382                         'not found') osvers="$4"."$3" ;;
2383                         '<3240'|'<>3240') osvers=3.2.0 ;;
2384                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2385                         '=3250'|'>3250') osvers=3.2.5 ;;
2386                         *) osvers=$tmp;;
2387                         esac
2388                         ;;
2389                 bsd386) osname=bsd386
2390                         osvers=`$uname -r`
2391                         ;;
2392                 cygwin*) osname=cygwin
2393                         osvers="$3"
2394                         ;;
2395                 *dc.osx) osname=dcosx
2396                         osvers="$3"
2397                         ;;
2398                 dnix) osname=dnix
2399                         osvers="$3"
2400                         ;;
2401                 domainos) osname=apollo
2402                         osvers="$3"
2403                         ;;
2404                 dgux) osname=dgux 
2405                         osvers="$3"
2406                         ;;
2407                 dynixptx*) osname=dynixptx
2408                         osvers=`echo "$4"|sed 's/^v//'`
2409                         ;;
2410                 freebsd) osname=freebsd 
2411                         osvers="$3" ;;
2412                 genix) osname=genix ;;
2413                 hp*) osname=hpux 
2414                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2415                         ;;
2416                 irix*) osname=irix
2417                         case "$3" in
2418                         4*) osvers=4 ;;
2419                         5*) osvers=5 ;;
2420                         *)      osvers="$3" ;;
2421                         esac
2422                         ;;
2423                 linux) osname=linux
2424                         case "$3" in
2425                         *)      osvers="$3" ;;
2426                         esac
2427                         ;;
2428                 MiNT) osname=mint
2429                         ;;
2430                 netbsd*) osname=netbsd
2431                         osvers="$3"
2432                         ;;
2433                 news-os) osvers="$3"
2434                         case "$3" in
2435                         4*) osname=newsos4 ;;
2436                         *) osname=newsos ;;
2437                         esac
2438                         ;;
2439                 next*) osname=next ;;
2440                 nonstop-ux) osname=nonstopux ;;
2441                 POSIX-BC | posix-bc ) osname=posix-bc
2442                         osvers="$3"
2443                         ;;
2444                 powerux | power_ux | powermax_os | powermaxos | \
2445                 powerunix | power_unix) osname=powerux
2446                         osvers="$3"
2447                         ;;
2448                 qnx) osname=qnx
2449                         osvers="$4"
2450                         ;;
2451                 solaris) osname=solaris
2452                         case "$3" in
2453                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2454                         *)      osvers="$3" ;;
2455                         esac
2456                         ;;
2457                 sunos) osname=sunos
2458                         case "$3" in
2459                         5*) osname=solaris
2460                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2461                         *)      osvers="$3" ;;
2462                         esac
2463                         ;;
2464                 titanos) osname=titanos
2465                         case "$3" in
2466                         1*) osvers=1 ;;
2467                         2*) osvers=2 ;;
2468                         3*) osvers=3 ;;
2469                         4*) osvers=4 ;;
2470                         *)      osvers="$3" ;;
2471                         esac
2472                         ;;
2473                 ultrix) osname=ultrix
2474                         osvers="$3"
2475                         ;;
2476                 osf1|mls+)      case "$5" in
2477                                 alpha)
2478                                         osname=dec_osf
2479                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2480                                         case "$osvers" in
2481                                         [1-9].[0-9]*) ;;
2482                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2483                                         esac
2484                                         ;;
2485                         hp*)    osname=hp_osf1  ;;
2486                         mips)   osname=mips_osf1 ;;
2487                         esac
2488                         ;;
2489                 unixware) osname=svr5
2490                         osvers="$4"
2491                         ;;
2492                 uts) osname=uts
2493                         osvers="$3"
2494                         ;;
2495                 $2) case "$osname" in
2496                         *isc*) ;;
2497                         *freebsd*) ;;
2498                         svr*)
2499                                 : svr4.x or possibly later
2500                                 case "svr$3" in 
2501                                 ${osname}*)
2502                                         osname=svr$3
2503                                         osvers=$4
2504                                         ;;
2505                                 esac
2506                                 case "$osname" in
2507                                 svr4.0)
2508                                         : Check for ESIX
2509                                         if test -f /stand/boot ; then
2510                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2511                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2512                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2513                                                         if test -n "$isesix"; then
2514                                                                 osname=esix4
2515                                                         fi
2516                                                 fi
2517                                         fi
2518                                         ;;
2519                                 esac
2520                                 ;;
2521                         *)      if test -f /etc/systemid; then
2522                                         osname=sco
2523                                         set `echo $3 | $sed 's/\./ /g'` $4
2524                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2525                                                 osvers=$1.$2.$3
2526                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2527                                                 osvers=$1.$2
2528                                         elif $test -f $src/hints/sco_$1.sh; then
2529                                                 osvers=$1
2530                                         fi
2531                                 else
2532                                         case "$osname" in
2533                                         '') : Still unknown.  Probably a generic Sys V.
2534                                                 osname="sysv"
2535                                                 osvers="$3"
2536                                                 ;;
2537                                         esac
2538                                 fi
2539                                 ;;
2540                         esac
2541                         ;;
2542                 *)      case "$osname" in
2543                         '') : Still unknown.  Probably a generic BSD.
2544                                 osname="$1"
2545                                 osvers="$3"
2546                                 ;;
2547                         esac
2548                         ;;
2549                 esac
2550         else
2551                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2552                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2553                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2554                                 osname=news_os
2555                         fi
2556                         $rm -f UU/kernel.what
2557                 elif test -d c:/.; then
2558                         set X $myuname
2559                         osname=os2
2560                         osvers="$5"
2561                 fi
2562         fi
2563         
2564         : Now look for a hint file osname_osvers, unless one has been
2565         : specified already.
2566         case "$hintfile" in
2567         ''|' ')
2568                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2569                 : Also try without trailing minor version numbers.
2570                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2571                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2572                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2573                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2574                 case "$file" in
2575                 '') dflt=none ;;
2576                 *)  case "$osvers" in
2577                         '') dflt=$file
2578                                 ;;
2579                         *)  if $test -f $src/hints/$file.sh ; then
2580                                         dflt=$file
2581                                 elif $test -f $src/hints/$xfile.sh ; then
2582                                         dflt=$xfile
2583                                 elif $test -f $src/hints/$xxfile.sh ; then
2584                                         dflt=$xxfile
2585                                 elif $test -f $src/hints/$xxxfile.sh ; then
2586                                         dflt=$xxxfile
2587                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2588                                         dflt=$xxxxfile
2589                                 elif $test -f "$src/hints/${osname}.sh" ; then
2590                                         dflt="${osname}"
2591                                 else
2592                                         dflt=none
2593                                 fi
2594                                 ;;
2595                         esac
2596                         ;;
2597                 esac
2598                 if $test -f Policy.sh ; then
2599                         case "$dflt" in
2600                         *Policy*) ;;
2601                         none) dflt="Policy" ;;
2602                         *) dflt="Policy $dflt" ;;
2603                         esac
2604                 fi
2605                 ;;
2606         *)
2607                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2608                 ;;
2609         esac
2610
2611         if $test -f Policy.sh ; then
2612                 $cat <<EOM
2613
2614 There's also a Policy hint file available, which should make the
2615 site-specific (policy) questions easier to answer.
2616 EOM
2617
2618         fi
2619
2620         $cat <<EOM
2621
2622 You may give one or more space-separated answers, or "none" if appropriate.
2623 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2624 is a good thing.  DO NOT give a wrong version or a wrong OS.
2625
2626 EOM
2627
2628         rp="Which of these apply, if any?"
2629         . UU/myread
2630         tans=$ans
2631         for file in $tans; do
2632                 if $test X$file = XPolicy -a -f Policy.sh; then
2633                         . Policy.sh
2634                         $cat Policy.sh >> UU/config.sh
2635                 elif $test -f $src/hints/$file.sh; then
2636                         . $src/hints/$file.sh
2637                         $cat $src/hints/$file.sh >> UU/config.sh
2638                 elif $test X$tans = X -o X$tans = Xnone ; then
2639                         : nothing
2640                 else
2641                         : Give one chance to correct a possible typo.
2642                         echo "$file.sh does not exist"
2643                         dflt=$file
2644                         rp="hint to use instead?"
2645                         . UU/myread
2646                         for file in $ans; do
2647                                 if $test -f "$src/hints/$file.sh"; then
2648                                         . $src/hints/$file.sh
2649                                         $cat $src/hints/$file.sh >> UU/config.sh
2650                                 elif $test X$ans = X -o X$ans = Xnone ; then
2651                                         : nothing
2652                                 else
2653                                         echo "$file.sh does not exist -- ignored."
2654                                 fi
2655                         done
2656                 fi
2657         done
2658
2659         hint=recommended
2660         : Remember our hint file for later.
2661         if $test -f "$src/hints/$file.sh" ; then
2662                 hintfile="$file"
2663         else
2664                 hintfile=''
2665         fi
2666 fi
2667 cd UU
2668 ;;
2669 *)
2670         echo " "
2671         echo "Fetching default answers from $config_sh..." >&4
2672         tmp_n="$n"
2673         tmp_c="$c"
2674         cd ..
2675         cp $config_sh config.sh 2>/dev/null
2676         chmod +w config.sh
2677         . ./config.sh
2678         cd UU
2679         cp ../config.sh .
2680         n="$tmp_n"
2681         c="$tmp_c"
2682         hint=previous
2683         ;;
2684 esac
2685 test "$override" && . ./optdef.sh
2686
2687 : Restore computed paths
2688 for file in $loclist $trylist; do
2689         eval $file="\$_$file"
2690 done
2691
2692 cat << EOM
2693
2694 Configure uses the operating system name and version to set some defaults.
2695 The default value is probably right if the name rings a bell. Otherwise,
2696 since spelling matters for me, either accept the default or answer "none"
2697 to leave it blank.
2698
2699 EOM
2700 case "$osname" in
2701         ''|' ')
2702                 case "$hintfile" in
2703                 ''|' '|none) dflt=none ;;
2704                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2705                 esac
2706                 ;;
2707         *) dflt="$osname" ;;
2708 esac
2709 rp="Operating system name?"
2710 . ./myread
2711 case "$ans" in
2712 none)  osname='' ;;
2713 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2714 esac
2715 echo " "
2716 case "$osvers" in
2717         ''|' ')
2718                 case "$hintfile" in
2719                 ''|' '|none) dflt=none ;;
2720                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2721                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2722                         case "$dflt" in
2723                         ''|' ') dflt=none ;;
2724                         esac
2725                         ;;
2726                 esac
2727                 ;;
2728         *) dflt="$osvers" ;;
2729 esac
2730 rp="Operating system version?"
2731 . ./myread
2732 case "$ans" in
2733 none)  osvers='' ;;
2734 *) osvers="$ans" ;;
2735 esac
2736
2737
2738 . ./posthint.sh
2739
2740 : who configured the system
2741 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2742 cf_by=`(logname) 2>/dev/null`
2743 case "$cf_by" in
2744 "")
2745         cf_by=`(whoami) 2>/dev/null`
2746         case "$cf_by" in
2747         "") cf_by=unknown ;;
2748         esac ;;
2749 esac
2750
2751 : set up the script used to warn in case of inconsistency
2752 cat <<EOS >whoa
2753 $startsh
2754 EOS
2755 cat <<'EOSC' >>whoa
2756 dflt=y
2757 echo " "
2758 echo "*** WHOA THERE!!! ***" >&4
2759 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2760 rp="    Keep the $hint value?"
2761 . ./myread
2762 case "$ans" in
2763 y) td=$was; tu=$was;;
2764 esac
2765 EOSC
2766
2767 : function used to set $1 to $val
2768 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2769 case "$val$was" in
2770 $define$undef) . ./whoa; eval "$var=\$td";;
2771 $undef$define) . ./whoa; eval "$var=\$tu";;
2772 *) eval "$var=$val";;
2773 esac'
2774
2775 case "$usethreads" in
2776 $define|true|[yY]*)     dflt='y';;
2777 *) dflt='n';;
2778 esac
2779 cat <<EOM
2780
2781 Perl can be built to take advantage of threads on some systems.
2782 To do so, Configure can be run with -Dusethreads.
2783
2784 Note that threading is a highly experimental feature, and
2785 some known race conditions still remain.  If you choose to try
2786 it, be very sure to not actually deploy it for production
2787 purposes.  README.threads has more details, and is required
2788 reading if you enable threads.
2789
2790 If this doesn't make any sense to you, just accept the default '$dflt'.
2791 EOM
2792 rp='Build a threading Perl?'
2793 . ./myread
2794 case "$ans" in
2795 y|Y)    val="$define" ;;
2796 *)      val="$undef" ;;
2797 esac
2798 set usethreads
2799 eval $setvar
2800
2801 case "$usethreads" in
2802 $define)
2803         $cat <<EOM
2804
2805 As of 5.5.640, Perl has two different internal threading implementations,
2806 the 5.005 version (5005threads) and an interpreter-based version
2807 (ithreads) that has one interpreter per thread.  Both are very 
2808 experimental.  This arrangement exists to help developers work out
2809 which one is better.
2810
2811 If you're a casual user, you probably don't want interpreter-threads
2812 at this time.  There doesn't yet exist a way to create threads from
2813 within Perl in this model, i.e., "use Thread;" will NOT work.
2814 EOM
2815         : Default to ithreads unless overridden on command line or with
2816         : old config.sh
2817         dflt='y'
2818         case "$use5005threads" in
2819                 $define|true|[yY]*) dflt='n';;
2820         esac
2821         case "$useithreads" in
2822                 $undef|false|[nN]*) dflt='n';;
2823         esac
2824         rp='Use interpreter-based ithreads?'
2825         . ./myread
2826         case "$ans" in
2827         y|Y)    val="$define" ;;
2828         *)      val="$undef" ;;
2829         esac
2830         set useithreads
2831         eval $setvar
2832         : Now set use5005threads to the opposite value.
2833         case "$useithreads" in
2834         $define) val="$undef" ;;
2835         *) val="$define" ;;
2836         esac
2837         set use5005threads
2838         eval $setvar
2839         ;;
2840 *)
2841         useithreads="$undef"
2842         use5005threads="$undef"
2843         ;;
2844 esac
2845
2846 case "$d_oldpthreads" in
2847 '')     : Configure tests would be welcome here.  For now, assume undef.
2848         val="$undef" ;;
2849 *)      val="$d_oldpthreads" ;;
2850 esac
2851 set d_oldpthreads
2852 eval $setvar
2853
2854
2855 case "$usethreads" in
2856 "$define"|true|[yY]*)
2857 : Look for a hint-file generated 'call-back-unit'.  If the
2858 : user has specified that a threading perl is to be built,
2859 : we may need to set or change some other defaults.
2860         if $test -f usethreads.cbu; then
2861                 echo "Your platform has some specific hints for threaded builds, using them..."
2862                 . ./usethreads.cbu
2863         else
2864                 $cat <<EOM
2865 (Your platform doesn't have any specific hints for threaded builds.
2866  Assuming POSIX threads, then.)
2867 EOM
2868         fi
2869         ;;
2870 esac
2871
2872 cat <<EOM
2873
2874 Perl can be built so that multiple Perl interpreters can coexist
2875 within the same Perl executable.
2876 EOM
2877
2878 case "$useithreads" in
2879 $define)
2880         cat <<EOM
2881 This multiple interpreter support is required for interpreter-based threads.
2882 EOM
2883         val="$define"
2884         ;;
2885 *)      case "$usemultiplicity" in
2886         $define|true|[yY]*)     dflt='y';;
2887         *) dflt='n';;
2888         esac
2889         echo " "
2890         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2891         rp='Build Perl for multiplicity?'
2892         . ./myread
2893         case "$ans" in
2894         y|Y)    val="$define" ;;
2895         *)      val="$undef" ;;
2896         esac
2897         ;;
2898 esac
2899 set usemultiplicity
2900 eval $setvar
2901
2902 : make some quick guesses about what we are up against
2903 echo " "
2904 $echo $n "Hmm...  $c"
2905 echo exit 1 >bsd
2906 echo exit 1 >usg
2907 echo exit 1 >v7
2908 echo exit 1 >osf1
2909 echo exit 1 >eunice
2910 echo exit 1 >xenix
2911 echo exit 1 >venix
2912 echo exit 1 >os2
2913 d_bsd="$undef"
2914 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2915 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2916 then
2917         echo "Looks kind of like an OSF/1 system, but we'll see..."
2918         echo exit 0 >osf1
2919 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2920         xxx=`./loc addbib blurfl $pth`
2921         if $test -f $xxx; then
2922         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2923                 echo exit 0 >bsd
2924                 echo exit 0 >usg
2925         else
2926                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2927                         echo "Looks kind of like an extended USG system, but we'll see..."
2928                 else
2929                         echo "Looks kind of like a USG system, but we'll see..."
2930                 fi
2931                 echo exit 0 >usg
2932         fi
2933 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2934         echo "Looks kind of like a BSD system, but we'll see..."
2935         d_bsd="$define"
2936         echo exit 0 >bsd
2937 else
2938         echo "Looks kind of like a Version 7 system, but we'll see..."
2939         echo exit 0 >v7
2940 fi
2941 case "$eunicefix" in
2942 *unixtovms*)
2943         $cat <<'EOI'
2944 There is, however, a strange, musty smell in the air that reminds me of
2945 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2946 EOI
2947         echo exit 0 >eunice
2948         d_eunice="$define"
2949 : it so happens the Eunice I know will not run shell scripts in Unix format
2950         ;;
2951 *)
2952         echo " "
2953         echo "Congratulations.  You aren't running Eunice."
2954         d_eunice="$undef"
2955         ;;
2956 esac
2957 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2958 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2959 : semicolon as a patch separator
2960 case "$p_" in
2961 :) ;;
2962 *)
2963         $cat <<'EOI'
2964 I have the feeling something is not exactly right, however...don't tell me...
2965 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2966 (Or you may be running DOS with DJGPP.)
2967 EOI
2968         echo exit 0 >os2
2969         ;;
2970 esac
2971 if test -f /xenix; then
2972         echo "Actually, this looks more like a XENIX system..."
2973         echo exit 0 >xenix
2974         d_xenix="$define"
2975 else
2976         echo " "
2977         echo "It's not Xenix..."
2978         d_xenix="$undef"
2979 fi
2980 chmod +x xenix
2981 $eunicefix xenix
2982 if test -f /venix; then
2983         echo "Actually, this looks more like a VENIX system..."
2984         echo exit 0 >venix
2985 else
2986         echo " "
2987         if ./xenix; then
2988                 : null
2989         else
2990                 echo "Nor is it Venix..."
2991         fi
2992 fi
2993 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2994 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2995 $rm -f foo
2996
2997 case "$cc" in
2998 '') dflt=cc;;
2999 *) dflt="$cc";;
3000 esac
3001 rp="Use which C compiler?"
3002 . ./myread
3003 cc="$ans"
3004 : Look for a hint-file generated 'call-back-unit'.  Now that the
3005 : user has specified the compiler, we may need to set or change some
3006 : other defaults.
3007 if $test -f cc.cbu; then
3008     . ./cc.cbu
3009 fi
3010 . ./checkcc
3011
3012 echo " "
3013 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3014 $cat >gccvers.c <<EOM
3015 #include <stdio.h>
3016 int main() {
3017 #ifdef __GNUC__
3018 #ifdef __VERSION__
3019         printf("%s\n", __VERSION__);
3020 #else
3021         printf("%s\n", "1");
3022 #endif
3023 #endif
3024         exit(0);
3025 }
3026 EOM
3027 if $cc -o gccvers $ldflags gccvers.c; then
3028         gccversion=`./gccvers`
3029         case "$gccversion" in
3030         '') echo "You are not using GNU cc." ;;
3031         *)  echo "You are using GNU cc $gccversion."
3032             ccname=gcc  
3033             ;;
3034         esac
3035 else
3036         echo " "
3037         echo "*** WHOA THERE!!! ***" >&4
3038         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3039         case "$knowitall" in
3040         '')
3041         echo "    You'd better start hunting for one and let me know about it." >&4
3042                 exit 1
3043                 ;;
3044         esac
3045 fi
3046 $rm -f gccvers*
3047 case "$gccversion" in
3048 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3049 esac
3050 case "$gccversion" in
3051 '') gccosandvers='' ;;
3052 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3053    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3054    gccshortvers=''
3055    case "$gccosandvers" in
3056    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3057    $osname$osvers) ;; # looking good
3058    $osname*) cat <<EOM >&4
3059
3060 *** WHOA THERE!!! ***
3061
3062     Your gcc has not been compiled for the exact release of
3063     your operating system ($gccosandvers versus $osname$osvers).
3064
3065     In general it is a good idea to keep gcc synchronized with
3066     the operating system because otherwise serious problems
3067     may ensue when trying to compile software, like Perl.
3068
3069     I'm trying to be optimistic here, though, and will continue.
3070     If later during the configuration and build icky compilation
3071     problems appear (headerfile conflicts being the most common
3072     manifestation), I suggest reinstalling the gcc to match
3073     your operating system release.
3074
3075 EOM
3076       ;;
3077    *) gccosandvers='' ;; # failed to parse, better be silent
3078    esac
3079    ;;
3080 esac
3081 case "$ccname" in
3082 '') ccname="$cc" ;;
3083 esac
3084
3085 : see how we invoke the C preprocessor
3086 echo " "
3087 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3088 cat <<'EOT' >testcpp.c
3089 #define ABC abc
3090 #define XYZ xyz
3091 ABC.XYZ
3092 EOT
3093 cd ..
3094 if test ! -f cppstdin; then
3095         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3096                 # AIX cc -E doesn't show the absolute headerfile
3097                 # locations but we'll cheat by using the -M flag.
3098                 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
3099         else
3100                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3101         fi
3102 else
3103         echo "Keeping your $hint cppstdin wrapper."
3104 fi
3105 chmod 755 cppstdin
3106 wrapper=`pwd`/cppstdin
3107 ok='false'
3108 cd UU
3109
3110 if $test "X$cppstdin" != "X" && \
3111         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3112         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3113 then
3114         echo "You used to use $cppstdin $cppminus so we'll use that again."
3115         case "$cpprun" in
3116         '') echo "But let's see if we can live without a wrapper..." ;;
3117         *)
3118                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3119                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3120                 then
3121                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3122                         ok='true'
3123                 else
3124                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3125                 fi
3126                 ;;
3127         esac
3128 else
3129         case "$cppstdin" in
3130         '') ;;
3131         *)
3132                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3133                 ;;
3134         esac
3135 fi
3136
3137 if $ok; then
3138         : nothing
3139 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3140         $cc -E <testcpp.c >testcpp.out 2>&1; \
3141         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3142         echo "Yup, it does."
3143         x_cpp="$cc -E"
3144         x_minus='';
3145 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3146         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3148         echo "Yup, it does."
3149         x_cpp="$cc -E"
3150         x_minus='-';
3151 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3152         $cc -P <testcpp.c >testcpp.out 2>&1; \
3153         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3154         echo "Yipee, that works!"
3155         x_cpp="$cc -P"
3156         x_minus='';
3157 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3158         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3159         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3160         echo "At long last!"
3161         x_cpp="$cc -P"
3162         x_minus='-';
3163 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3164         $cpp <testcpp.c >testcpp.out 2>&1; \
3165         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3166         echo "It works!"
3167         x_cpp="$cpp"
3168         x_minus='';
3169 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3170         $cpp - <testcpp.c >testcpp.out 2>&1; \
3171         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3172         echo "Hooray, it works!  I was beginning to wonder."
3173         x_cpp="$cpp"
3174         x_minus='-';
3175 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3176         $wrapper <testcpp.c >testcpp.out 2>&1; \
3177         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3178         x_cpp="$wrapper"
3179         x_minus=''
3180         echo "Eureka!"
3181 else
3182         dflt=''
3183         rp="No dice.  I can't find a C preprocessor.  Name one:"
3184         . ./myread
3185         x_cpp="$ans"
3186         x_minus=''
3187         $x_cpp <testcpp.c >testcpp.out 2>&1
3188         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3189                 echo "OK, that will do." >&4
3190         else
3191 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3192                 exit 1
3193         fi
3194 fi
3195
3196 case "$ok" in
3197 false)
3198         cppstdin="$x_cpp"
3199         cppminus="$x_minus"
3200         cpprun="$x_cpp"
3201         cpplast="$x_minus"
3202         set X $x_cpp
3203         shift
3204         case "$1" in
3205         "$cpp")
3206                 echo "Perhaps can we force $cc -E using a wrapper..."
3207                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3208                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3209                 then
3210                         echo "Yup, we can."
3211                         cppstdin="$wrapper"
3212                         cppminus='';
3213                 else
3214                         echo "Nope, we'll have to live without it..."
3215                 fi
3216                 ;;
3217         esac
3218         case "$cpprun" in
3219         "$wrapper")
3220                 cpprun=''
3221                 cpplast=''
3222                 ;;
3223         esac
3224         ;;
3225 esac
3226
3227 case "$cppstdin" in
3228 "$wrapper"|'cppstdin') ;;
3229 *) $rm -f $wrapper;;
3230 esac
3231 $rm -f testcpp.c testcpp.out
3232
3233 : decide how portable to be.  Allow command line overrides.
3234 case "$d_portable" in
3235 "$undef") ;;
3236 *)      d_portable="$define" ;;
3237 esac
3238
3239 : set up shell script to do ~ expansion
3240 cat >filexp <<EOSS
3241 $startsh
3242 : expand filename
3243 case "\$1" in
3244  ~/*|~)
3245         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3246         ;;
3247  ~*)
3248         if $test -f /bin/csh; then
3249                 /bin/csh -f -c "glob \$1"
3250                 failed=\$?
3251                 echo ""
3252                 exit \$failed
3253         else
3254                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3255                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3256                 if $test ! -d "\$dir"; then
3257                         me=\`basename \$0\`
3258                         echo "\$me: can't locate home directory for: \$name" >&2
3259                         exit 1
3260                 fi
3261                 case "\$1" in
3262                 */*)
3263                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3264                         ;;
3265                 *)
3266                         echo \$dir
3267                         ;;
3268                 esac
3269         fi
3270         ;;
3271 *)
3272         echo \$1
3273         ;;
3274 esac
3275 EOSS
3276 chmod +x filexp
3277 $eunicefix filexp
3278
3279 : now set up to get a file name
3280 cat <<EOS >getfile
3281 $startsh
3282 EOS
3283 cat <<'EOSC' >>getfile
3284 tilde=''
3285 fullpath=''
3286 already=''
3287 skip=''
3288 none_ok=''
3289 exp_file=''
3290 nopath_ok=''
3291 orig_rp="$rp"
3292 orig_dflt="$dflt"
3293 case "$gfpth" in
3294 '') gfpth='.' ;;
3295 esac
3296
3297 case "$fn" in
3298 *\(*)
3299         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3300         fn=`echo $fn | sed 's/(.*)//'`
3301         ;;
3302 esac
3303
3304 case "$fn" in
3305 *:*)
3306         loc_file=`expr $fn : '.*:\(.*\)'`
3307         fn=`expr $fn : '\(.*\):.*'`
3308         ;;
3309 esac
3310
3311 case "$fn" in
3312 *~*) tilde=true;;
3313 esac
3314 case "$fn" in
3315 */*) fullpath=true;;
3316 esac
3317 case "$fn" in
3318 *+*) skip=true;;
3319 esac
3320 case "$fn" in
3321 *n*) none_ok=true;;
3322 esac
3323 case "$fn" in
3324 *e*) exp_file=true;;
3325 esac
3326 case "$fn" in
3327 *p*) nopath_ok=true;;
3328 esac
3329
3330 case "$fn" in
3331 *f*) type='File';;
3332 *d*) type='Directory';;
3333 *l*) type='Locate';;
3334 esac
3335
3336 what="$type"
3337 case "$what" in
3338 Locate) what='File';;
3339 esac
3340
3341 case "$exp_file" in
3342 '')
3343         case "$d_portable" in
3344         "$define") ;;
3345         *) exp_file=true;;
3346         esac
3347         ;;
3348 esac
3349
3350 cd ..
3351 while test "$type"; do
3352         redo=''
3353         rp="$orig_rp"
3354         dflt="$orig_dflt"
3355         case "$tilde" in
3356         true) rp="$rp (~name ok)";;
3357         esac
3358         . UU/myread
3359         if test -f UU/getfile.ok && \
3360                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3361         then
3362                 value="$ans"
3363                 ansexp="$ans"
3364                 break
3365         fi
3366         case "$ans" in
3367         none)
3368                 value=''
3369                 ansexp=''
3370                 case "$none_ok" in
3371                 true) type='';;
3372                 esac
3373                 ;;
3374         *)
3375                 case "$tilde" in
3376                 '') value="$ans"
3377                         ansexp="$ans";;
3378                 *)
3379                         value=`UU/filexp $ans`
3380                         case $? in
3381                         0)
3382                                 if test "$ans" != "$value"; then
3383                                         echo "(That expands to $value on this system.)"
3384                                 fi
3385                                 ;;
3386                         *) value="$ans";;
3387                         esac
3388                         ansexp="$value"
3389                         case "$exp_file" in
3390                         '') value="$ans";;
3391                         esac
3392                         ;;
3393                 esac
3394                 case "$fullpath" in
3395                 true)
3396                         case "$ansexp" in
3397                         /*) value="$ansexp" ;;
3398                         [a-zA-Z]:/*) value="$ansexp" ;;
3399                         *)
3400                                 redo=true
3401                                 case "$already" in
3402                                 true)
3403                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3404                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3405                                         ;;
3406                                 *)
3407                                 echo "Please give a full path name, starting with slash." >&4
3408                                         case "$tilde" in
3409                                         true)
3410                                 echo "Note that using ~name is ok provided it expands well." >&4
3411                                                 already=true
3412                                                 ;;
3413                                         esac
3414                                 esac
3415                                 ;;
3416                         esac
3417                         ;;
3418                 esac
3419                 case "$redo" in
3420                 '')
3421                         case "$type" in
3422                         File)
3423                                 for fp in $gfpth; do
3424                                         if test "X$fp" = X.; then
3425                                             pf="$ansexp"
3426                                         else    
3427                                             pf="$fp/$ansexp"
3428                                         fi
3429                                         if test -f "$pf"; then
3430                                                 type=''
3431                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3432                                         then
3433                                                 echo "($value is not a plain file, but that's ok.)"
3434                                                 type=''
3435                                         fi
3436                                         if test X"$type" = X; then
3437                                             value="$pf"
3438                                             break
3439                                         fi
3440                                 done
3441                                 ;;
3442                         Directory)
3443                                 for fp in $gfpth; do
3444                                         if test "X$fp" = X.; then
3445                                             dir="$ans"
3446                                             direxp="$ansexp"
3447                                         else    
3448                                             dir="$fp/$ansexp"
3449                                             direxp="$fp/$ansexp"
3450                                         fi
3451                                         if test -d "$direxp"; then
3452                                                 type=''
3453                                                 value="$dir"
3454                                                 break
3455                                         fi
3456                                 done
3457                                 ;;
3458                         Locate)
3459                                 if test -d "$ansexp"; then
3460                                         echo "(Looking for $loc_file in directory $value.)"
3461                                         value="$value/$loc_file"
3462                                         ansexp="$ansexp/$loc_file"
3463                                 fi
3464                                 if test -f "$ansexp"; then
3465                                         type=''
3466                                 fi
3467                                 case "$nopath_ok" in
3468                                 true)   case "$value" in
3469                                         */*) ;;
3470                                         *)      echo "Assuming $value will be in people's path."
3471                                                 type=''
3472                                                 ;;
3473                                         esac
3474                                         ;;
3475                                 esac
3476                                 ;;
3477                         esac
3478
3479                         case "$skip" in
3480                         true) type='';
3481                         esac
3482
3483                         case "$type" in
3484                         '') ;;
3485                         *)
3486                                 if test "$fastread" = yes; then
3487                                         dflt=y
3488                                 else
3489                                         dflt=n
3490                                 fi
3491                                 rp="$what $value doesn't exist.  Use that name anyway?"
3492                                 . UU/myread
3493                                 dflt=''
3494                                 case "$ans" in
3495                                 y*) type='';;
3496                                 *) echo " ";;
3497                                 esac
3498                                 ;;
3499                         esac
3500                         ;;
3501                 esac
3502                 ;;
3503         esac
3504 done
3505 cd UU
3506 ans="$value"
3507 rp="$orig_rp"
3508 dflt="$orig_dflt"
3509 rm -f getfile.ok
3510 test "X$gfpthkeep" != Xy && gfpth=""
3511 EOSC
3512
3513 : What should the include directory be ?
3514 echo " "
3515 $echo $n "Hmm...  $c"
3516 dflt='/usr/include'
3517 incpath=''
3518 mips_type=''
3519 if $test -f /bin/mips && /bin/mips; then
3520         echo "Looks like a MIPS system..."
3521         $cat >usr.c <<'EOCP'
3522 #ifdef SYSTYPE_BSD43
3523 /bsd43
3524 #endif
3525 EOCP
3526         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3527                 dflt='/bsd43/usr/include'
3528                 incpath='/bsd43'
3529                 mips_type='BSD 4.3'
3530         else
3531                 mips_type='System V'
3532         fi
3533         $rm -f usr.c usr.out
3534         echo "and you're compiling with the $mips_type compiler and libraries."
3535         xxx_prompt=y
3536         echo "exit 0" >mips
3537 else
3538         echo "Doesn't look like a MIPS system."
3539         xxx_prompt=n
3540         echo "exit 1" >mips
3541 fi
3542 chmod +x mips
3543 $eunicefix mips
3544 case "$usrinc" in
3545 '') ;;
3546 *) dflt="$usrinc";;
3547 esac
3548 case "$xxx_prompt" in
3549 y)      fn=d/
3550         echo " "
3551         rp='Where are the include files you want to use?'
3552         . ./getfile
3553         usrinc="$ans"
3554         ;;
3555 *)      usrinc="$dflt"
3556         ;;
3557 esac
3558
3559 : Set private lib path
3560 case "$plibpth" in
3561 '') if ./mips; then
3562                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3563         fi;;
3564 esac
3565 case "$libpth" in
3566 ' ') dlist='';;
3567 '') dlist="$loclibpth $plibpth $glibpth";;
3568 *) dlist="$libpth";;
3569 esac
3570
3571 : Now check and see which directories actually exist, avoiding duplicates
3572 libpth=''
3573 for xxx in $dlist
3574 do
3575     if $test -d $xxx; then
3576                 case " $libpth " in
3577                 *" $xxx "*) ;;
3578                 *) libpth="$libpth $xxx";;
3579                 esac
3580     fi
3581 done
3582 $cat <<'EOM'
3583
3584 Some systems have incompatible or broken versions of libraries.  Among
3585 the directories listed in the question below, please remove any you
3586 know not to be holding relevant libraries, and add any that are needed.
3587 Say "none" for none.
3588
3589 EOM
3590 case "$libpth" in
3591 '') dflt='none';;
3592 *)
3593         set X $libpth
3594         shift
3595         dflt=${1+"$@"}
3596         ;;
3597 esac
3598 rp="Directories to use for library searches?"
3599 . ./myread
3600 case "$ans" in
3601 none) libpth=' ';;
3602 *) libpth="$ans";;
3603 esac
3604
3605 : compute shared library extension
3606 case "$so" in
3607 '')
3608         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3609                 dflt='sl'
3610         else
3611                 dflt='so'
3612         fi
3613         ;;
3614 *) dflt="$so";;
3615 esac
3616 $cat <<EOM
3617
3618 On some systems, shared libraries may be available.  Answer 'none' if
3619 you want to suppress searching of shared libraries for the remainder
3620 of this configuration.
3621
3622 EOM
3623 rp='What is the file extension used for shared libraries?'
3624 . ./myread
3625 so="$ans"
3626
3627 : Define several unixisms.
3628 : Hints files or command line option can be used to override them.
3629 : The convoluted testing is in case hints files set either the old
3630 : or the new name.
3631 case "$_exe" in
3632 '')     case "$exe_ext" in
3633     '') ;;
3634         *)      _exe="$exe_ext" ;;
3635         esac
3636         ;;
3637 esac
3638 case "$_a" in
3639 '')     case "$lib_ext" in
3640     '') _a='.a';;
3641         *)      _a="$lib_ext" ;;
3642         esac
3643         ;;
3644 esac
3645 case "$_o" in
3646 '') case "$obj_ext" in
3647         '')     _o='.o';;
3648         *)      _o="$obj_ext";;
3649         esac
3650         ;;
3651 esac
3652 case "$p_" in
3653 '') case "$path_sep" in
3654         '')     p_=':';;
3655         *)      p_="$path_sep";;
3656         esac
3657         ;;
3658 esac
3659 exe_ext=$_exe
3660 lib_ext=$_a
3661 obj_ext=$_o
3662 path_sep=$p_
3663
3664 : Which makefile gets called first.  This is used by make depend.
3665 case "$firstmakefile" in
3666 '') firstmakefile='makefile';;
3667 esac
3668
3669 case "$usesocks" in
3670 $define|true|[yY]*)     dflt='y';;
3671 *) dflt='n';;
3672 esac
3673 cat <<EOM
3674
3675 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3676 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3677 to use the PerlIO abstraction layer, this will be implicitly selected.
3678
3679 If this doesn't make any sense to you, just accept the default '$dflt'.
3680 EOM
3681 rp='Build Perl for SOCKS?'
3682 . ./myread
3683 case "$ans" in
3684 y|Y)    val="$define" ;;     
3685 *)      val="$undef" ;;
3686 esac
3687 set usesocks
3688 eval $setvar
3689
3690 case "$usesocks" in
3691 $define|true|[yY]*) useperlio="$define";;
3692 esac
3693
3694 : Looking for optional libraries
3695 echo " "
3696 echo "Checking for optional libraries..." >&4
3697 case "$libs" in
3698 ' '|'') dflt='';;
3699 *) dflt="$libs";;
3700 esac
3701 case "$libswanted" in
3702 '') libswanted='c_s';;
3703 esac
3704 case "$usesocks" in
3705 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3706 esac
3707 libsfound=''
3708 libsfiles=''
3709 libsdirs=''
3710 libspath=''
3711 for thisdir in $libpth $xlibpth; do
3712   test -d $thisdir && libspath="$libspath $thisdir"
3713 done
3714 for thislib in $libswanted; do
3715         for thisdir in $libspath; do
3716             xxx=''
3717             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3718                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3719                 $test -f "$xxx" && eval $libscheck
3720                 $test -f "$xxx" && libstyle=shared
3721             fi
3722             if test ! -f "$xxx"; then
3723                 xxx=$thisdir/lib$thislib.$so
3724                 $test -f "$xxx" && eval $libscheck
3725                 $test -f "$xxx" && libstyle=shared
3726             fi  
3727             if test ! -f "$xxx"; then
3728                 xxx=$thisdir/lib$thislib$_a
3729                 $test -f "$xxx" && eval $libscheck
3730                 $test -f "$xxx" && libstyle=static
3731             fi
3732             if test ! -f "$xxx"; then
3733                 xxx=$thisdir/$thislib$_a
3734                 $test -f "$xxx" && eval $libscheck
3735                 $test -f "$xxx" && libstyle=static
3736             fi
3737             if test ! -f "$xxx"; then
3738                 xxx=$thisdir/lib${thislib}_s$_a
3739                 $test -f "$xxx" && eval $libscheck
3740                 $test -f "$xxx" && libstyle=static
3741                 $test -f "$xxx" && thislib=${thislib}_s
3742             fi
3743             if test ! -f "$xxx"; then
3744                 xxx=$thisdir/Slib$thislib$_a
3745                 $test -f "$xxx" && eval $libscheck
3746                 $test -f "$xxx" && libstyle=static
3747             fi
3748             if $test -f "$xxx"; then
3749                 case "$libstyle" in
3750                 shared) echo "Found -l$thislib (shared)." ;;
3751                 static) echo "Found -l$thislib." ;;
3752                 *)      echo "Found -l$thislib ($libstyle)." ;;
3753                 esac
3754                 case " $dflt " in
3755                 *"-l$thislib "*);;
3756                 *) dflt="$dflt -l$thislib"
3757                    libsfound="$libsfound $xxx"
3758                    yyy=`basename $xxx`
3759                    libsfiles="$libsfiles $yyy"
3760                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3761                    case " $libsdirs " in
3762                    *" $yyy "*) ;;
3763                    *) libsdirs="$libsdirs $yyy" ;;
3764                    esac
3765                    ;;
3766                 esac
3767                 break
3768             fi  
3769         done
3770         if $test ! -f "$xxx"; then
3771             echo "No -l$thislib."
3772         fi
3773 done
3774 set X $dflt
3775 shift
3776 dflt="$*"
3777 case "$libs" in
3778 '') dflt="$dflt";;
3779 *) dflt="$libs";;
3780 esac
3781 case "$dflt" in
3782 ' '|'') dflt='none';;
3783 esac
3784
3785 $cat <<EOM
3786
3787 In order to compile $package on your machine, a number of libraries
3788 are usually needed.  Include any other special libraries here as well.
3789 Say "none" for none.  The default list is almost always right.
3790 EOM
3791
3792 echo " "
3793 rp="What libraries to use?"
3794 . ./myread
3795 case "$ans" in
3796 none) libs=' ';;
3797 *) libs="$ans";;
3798 esac
3799
3800 : determine optimization, if desired, or use for debug flag also
3801 case "$optimize" in
3802 ' '|$undef) dflt='none';;
3803 '') dflt='-O';;
3804 *) dflt="$optimize";;
3805 esac
3806 $cat <<EOH
3807
3808 By default, $package compiles with the -O flag to use the optimizer.
3809 Alternately, you might want to use the symbolic debugger, which uses
3810 the -g flag (on traditional Unix systems).  Either flag can be
3811 specified here.  To use neither flag, specify the word "none".
3812
3813 EOH
3814 rp="What optimizer/debugger flag should be used?"
3815 . ./myread
3816 optimize="$ans"
3817 case "$optimize" in
3818 'none') optimize=" ";;
3819 esac
3820
3821 dflt=''
3822 : We will not override a previous value, but we might want to
3823 : augment a hint file
3824 case "$hint" in
3825 default|recommended)
3826         case "$gccversion" in
3827         1*) dflt='-fpcc-struct-return' ;;
3828         esac
3829         case "$optimize" in
3830         *-g*) dflt="$dflt -DDEBUGGING";;
3831         esac
3832         case "$gccversion" in
3833         2*) if test -d /etc/conf/kconfig.d &&
3834                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3835                 then
3836                         dflt="$dflt -posix"
3837                 fi
3838                 ;;
3839         esac
3840         case "$gccversion" in
3841         1*) ;;
3842         2.[0-8]*) ;;
3843         ?*)     echo " "
3844                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3845                 echo 'int main(void) { return 0; }' > gcctest.c
3846                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3847                         echo "Yes, it does." 2>&1
3848                         case "$ccflags" in
3849                         *strict-aliasing*) 
3850                                 echo "Leaving current flags $ccflags alone." 2>&1
3851                                 ;;
3852                         *) dflt="$dflt -fno-strict-aliasing" ;;
3853                         esac
3854                 else
3855                         echo "Nope, it doesn't, but that's ok." 2>&1
3856                 fi
3857                 ;;
3858         esac
3859         ;;
3860 esac
3861
3862 case "$mips_type" in
3863 *BSD*|'') inclwanted="$locincpth $usrinc";;
3864 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3865 esac
3866 for thisincl in $inclwanted; do
3867         if $test -d $thisincl; then
3868                 if $test x$thisincl != x$usrinc; then
3869                         case "$dflt" in
3870                         *" -I$thisincl "*);;
3871                         *) dflt="$dflt -I$thisincl ";;
3872                         esac
3873                 fi
3874         fi
3875 done
3876
3877 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3878         xxx=true;
3879 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3880         xxx=true;
3881 else
3882         xxx=false;
3883 fi;
3884 if $xxx; then
3885         case "$dflt" in
3886         *$2*);;
3887         *) dflt="$dflt -D$2";;
3888         esac;
3889 fi'
3890
3891 set signal.h LANGUAGE_C; eval $inctest
3892
3893 case "$usesocks" in
3894 $define)
3895         ccflags="$ccflags -DSOCKS"
3896         ;;
3897 esac
3898
3899 case "$hint" in
3900 default|recommended) dflt="$ccflags $dflt" ;;
3901 *) dflt="$ccflags";;
3902 esac
3903
3904 case "$dflt" in
3905 ''|' ') dflt=none;;
3906 esac
3907
3908 $cat <<EOH
3909
3910 Your C compiler may want other flags.  For this question you should include
3911 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3912 but you should NOT include libraries or ld flags like -lwhatever.  If you
3913 want $package to honor its debug switch, you should include -DDEBUGGING here.
3914 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3915
3916 To use no flags, specify the word "none".
3917
3918 EOH
3919 set X $dflt
3920 shift
3921 dflt=${1+"$@"}
3922 rp="Any additional cc flags?"
3923 . ./myread
3924 case "$ans" in
3925 none) ccflags='';;
3926 *) ccflags="$ans";;
3927 esac
3928
3929 : the following weeds options from ccflags that are of no interest to cpp
3930 cppflags="$ccflags"
3931 case "$gccversion" in
3932 1*) cppflags="$cppflags -D__GNUC__"
3933 esac
3934 case "$mips_type" in
3935 '');;
3936 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3937 esac
3938 case "$cppflags" in
3939 '');;
3940 *)
3941         echo " "
3942         echo "Let me guess what the preprocessor flags are..." >&4
3943         set X $cppflags
3944         shift
3945         cppflags=''
3946         $cat >cpp.c <<'EOM'
3947 #define BLURFL foo
3948
3949 BLURFL xx LFRULB
3950 EOM
3951         previous=''
3952         for flag in $*
3953         do
3954                 case "$flag" in
3955                 -*) ftry="$flag";;
3956                 *) ftry="$previous $flag";;
3957                 esac
3958                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3959                         >cpp1.out 2>/dev/null && \
3960                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3961                         >cpp2.out 2>/dev/null && \
3962                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3963                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3964                 then
3965                         cppflags="$cppflags $ftry"
3966                         previous=''
3967                 else
3968                         previous="$flag"
3969                 fi
3970         done
3971         set X $cppflags
3972         shift
3973         cppflags=${1+"$@"}
3974         case "$cppflags" in
3975         *-*)  echo "They appear to be: $cppflags";;
3976         esac
3977         $rm -f cpp.c cpp?.out
3978         ;;
3979 esac
3980
3981 : flags used in final linking phase
3982 case "$ldflags" in
3983 '') if ./venix; then
3984                 dflt='-i -z'
3985         else
3986                 dflt=''
3987         fi
3988         case "$ccflags" in
3989         *-posix*) dflt="$dflt -posix" ;;
3990         esac
3991         ;;
3992 *) dflt="$ldflags";;
3993 esac
3994
3995 : Try to guess additional flags to pick up local libraries.
3996 for thislibdir in $libpth; do
3997         case " $loclibpth " in
3998         *" $thislibdir "*)
3999                 case "$dflt " in 
4000                 *"-L$thislibdir "*) ;;
4001                 *)  dflt="$dflt -L$thislibdir" ;;
4002                 esac
4003                 ;;
4004         esac
4005 done
4006
4007 case "$dflt" in
4008 '') dflt='none' ;;
4009 esac
4010
4011 $cat <<EOH
4012
4013 Your C linker may need flags.  For this question you should
4014 include -L/whatever and any other flags used by the C linker, but you
4015 should NOT include libraries like -lwhatever.
4016
4017 Make sure you include the appropriate -L/path flags if your C linker
4018 does not normally search all of the directories you specified above,
4019 namely
4020         $libpth
4021 To use no flags, specify the word "none".
4022
4023 EOH
4024
4025 rp="Any additional ld flags (NOT including libraries)?"
4026 . ./myread
4027 case "$ans" in
4028 none) ldflags='';;
4029 *) ldflags="$ans";;
4030 esac
4031 rmlist="$rmlist pdp11"
4032
4033 : coherency check
4034 echo " "
4035 echo "Checking your choice of C compiler and flags for coherency..." >&4
4036 $cat > try.c <<'EOF'
4037 #include <stdio.h>
4038 int main() { printf("Ok\n"); exit(0); }
4039 EOF
4040 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4041 shift
4042 $cat >try.msg <<'EOM'
4043 I've tried to compile and run the following simple program:
4044
4045 EOM
4046 $cat try.c >> try.msg
4047
4048 $cat >> try.msg <<EOM
4049
4050 I used the command:
4051
4052         $*
4053         ./try
4054
4055 and I got the following output:
4056
4057 EOM
4058 dflt=y
4059 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4060         if sh -c './try' >>try.msg 2>&1; then
4061                 xxx=`./try`
4062                 case "$xxx" in
4063                 "Ok") dflt=n ;;
4064                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4065                         case " $libs " in
4066                         *" -lsfio "*)
4067                                 cat >> try.msg <<'EOQS'
4068 If $libs contains -lsfio, and sfio is mis-configured, then it
4069 sometimes (apparently) runs and exits with a 0 status, but with no
4070 output!  It may have to do with sfio's use of _exit vs. exit.
4071
4072 EOQS
4073                                 rp="You have a big problem.  Shall I abort Configure"
4074                                 dflt=y
4075                                 ;;
4076                         esac
4077                         ;;
4078                 esac
4079         else
4080                 echo "The program compiled OK, but exited with status $?." >>try.msg
4081                 rp="You have a problem.  Shall I abort Configure"
4082                 dflt=y
4083         fi
4084 else
4085         echo "I can't compile the test program." >>try.msg
4086         rp="You have a BIG problem.  Shall I abort Configure"
4087         dflt=y
4088 fi
4089 case "$dflt" in
4090 y)
4091         $cat try.msg >&4
4092         case "$knowitall" in
4093         '')
4094                 echo "(The supplied flags or libraries might be incorrect.)"
4095                 ;;
4096         *) dflt=n;;
4097         esac
4098         echo " "
4099         . ./myread
4100         case "$ans" in
4101         n*|N*) ;;
4102         *)      echo "Ok.  Stopping Configure." >&4
4103                 exit 1
4104                 ;;
4105         esac
4106         ;;
4107 n) echo "OK, that should do.";;
4108 esac
4109 $rm -f try try.* core
4110
4111 : define an is-a-typedef? function
4112 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4113 case "$inclist" in
4114 "") inclist="sys/types.h";;
4115 esac;
4116 eval "varval=\$$var";
4117 case "$varval" in
4118 "")
4119         $rm -f temp.c;
4120         for inc in $inclist; do
4121                 echo "#include <$inc>" >>temp.c;
4122         done;
4123         echo "#ifdef $type" >> temp.c;
4124         echo "printf(\"We have $type\");" >> temp.c;
4125         echo "#endif" >> temp.c;
4126         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4127         if $contains $type temp.E >/dev/null 2>&1; then
4128                 eval "$var=\$type";
4129         else
4130                 eval "$var=\$def";
4131         fi;
4132         $rm -f temp.?;;
4133 *) eval "$var=\$varval";;
4134 esac'
4135
4136 : define an is-a-typedef? function that prompts if the type is not available.
4137 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138 case "$inclist" in
4139 "") inclist="sys/types.h";;
4140 esac;
4141 eval "varval=\$$var";
4142 case "$varval" in
4143 "")
4144         $rm -f temp.c;
4145         for inc in $inclist; do
4146                 echo "#include <$inc>" >>temp.c;
4147         done;
4148         echo "#ifdef $type" >> temp.c;
4149         echo "printf(\"We have $type\");" >> temp.c;
4150         echo "#endif" >> temp.c;
4151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152         echo " " ;
4153         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4154         if $contains $type temp.E >/dev/null 2>&1; then
4155                 echo "$type found." >&4;
4156                 eval "$var=\$type";
4157         else
4158                 echo "$type NOT found." >&4;
4159                 dflt="$def";
4160                 . ./myread ;
4161                 eval "$var=\$ans";
4162         fi;
4163         $rm -f temp.?;;
4164 *) eval "$var=\$varval";;
4165 esac'
4166
4167 : define a shorthand compile call
4168 compile='
4169 mc_file=$1;
4170 shift;
4171 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4172 : define a shorthand compile call for compilations that should be ok.
4173 compile_ok='
4174 mc_file=$1;
4175 shift;
4176 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4177
4178 : check for lengths of integral types
4179 echo " "
4180 case "$intsize" in
4181 '')
4182         echo "Checking to see how big your integers are..." >&4
4183         $cat >intsize.c <<'EOCP'
4184 #include <stdio.h>
4185 int main()
4186 {
4187         printf("intsize=%d;\n", (int)sizeof(int));
4188         printf("longsize=%d;\n", (int)sizeof(long));
4189         printf("shortsize=%d;\n", (int)sizeof(short));
4190         exit(0);
4191 }
4192 EOCP
4193         set intsize
4194         if eval $compile_ok && ./intsize > /dev/null; then
4195                 eval `./intsize`
4196                 echo "Your integers are $intsize bytes long."
4197                 echo "Your long integers are $longsize bytes long."
4198                 echo "Your short integers are $shortsize bytes long."
4199         else
4200                 $cat >&4 <<EOM
4201 !
4202 Help! I can't compile and run the intsize test program: please enlighten me!
4203 (This is probably a misconfiguration in your system or libraries, and
4204 you really ought to fix it.  Still, I'll try anyway.)
4205 !
4206 EOM
4207                 dflt=4
4208                 rp="What is the size of an integer (in bytes)?"
4209                 . ./myread
4210                 intsize="$ans"
4211                 dflt=$intsize
4212                 rp="What is the size of a long integer (in bytes)?"
4213                 . ./myread
4214                 longsize="$ans"
4215                 dflt=2
4216                 rp="What is the size of a short integer (in bytes)?"
4217                 . ./myread
4218                 shortsize="$ans"
4219         fi
4220         ;;
4221 esac
4222 $rm -f intsize intsize.*
4223
4224 : see what type lseek is declared as in the kernel
4225 rp="What is the type used for lseek's offset on this system?"
4226 set off_t lseektype long stdio.h sys/types.h
4227 eval $typedef_ask
4228
4229 echo " "
4230 echo "Checking to see how big your file offsets are..." >&4
4231 $cat >try.c <<EOCP
4232 #include <sys/types.h>
4233 #include <stdio.h>
4234 int main()
4235 {
4236     printf("%d\n", (int)sizeof($lseektype));
4237     return(0); 
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         lseeksize=`./try`
4243         echo "Your file offsets are $lseeksize bytes long."
4244 else
4245         dflt=$longsize
4246         echo " "
4247         echo "(I can't seem to compile the test program.  Guessing...)"
4248         rp="What is the size of your file offsets (in bytes)?"
4249         . ./myread
4250         lseeksize="$ans"
4251 fi
4252 $rm -f try.c try
4253
4254 : see what type file positions are declared as in the library
4255 rp="What is the type for file position used by fsetpos()?"
4256 set fpos_t fpostype long stdio.h sys/types.h
4257 eval $typedef_ask
4258
4259 echo " "
4260 case "$fpostype" in
4261 *_t) zzz="$fpostype"    ;;
4262 *)   zzz="fpos_t"       ;;
4263 esac
4264 echo "Checking the size of $zzz..." >&4 
4265 cat > try.c <<EOCP
4266 #include <sys/types.h>
4267 #include <stdio.h>
4268 int main() {
4269     printf("%d\n", (int)sizeof($fpostype));
4270     exit(0);
4271 }
4272 EOCP
4273 set try
4274 if eval $compile_ok; then
4275         yyy=`./try`
4276         case "$yyy" in
4277         '')     fpossize=4
4278                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4279                 ;;
4280         *)      fpossize=$yyy
4281                 echo "Your $zzz is $fpossize bytes long."
4282                 ;;
4283         esac
4284 else
4285         dflt="$longsize"
4286         echo " " >&4
4287         echo "(I can't compile the test program.  Guessing...)" >&4
4288         rp="What is the size of your file positions (in bytes)?"
4289         . ./myread
4290         fpossize="$ans"
4291 fi
4292
4293
4294
4295 # Backward compatibility (uselfs is deprecated).
4296 case "$uselfs" in
4297 "$define"|true|[yY]*)
4298         cat <<EOM >&4
4299
4300 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4301 EOM
4302         uselargefiles="$define"
4303         ;;
4304 esac                          
4305
4306 case "$lseeksize:$fpossize" in
4307 8:8) cat <<EOM
4308
4309 You can have files larger than 2 gigabytes.
4310 EOM
4311    val="$define" ;;
4312 *)    case "$uselargefiles" in
4313    "$undef"|false|[nN]*) dflt='n' ;;
4314    *)   dflt='y' ;;
4315    esac
4316    cat <<EOM
4317
4318 Perl can be built to understand large files (files larger than 2 gigabytes)
4319 on some systems.  To do so, Configure can be run with -Duselargefiles.
4320
4321 If this doesn't make any sense to you, just accept the default '$dflt'.
4322 EOM
4323    rp='Try to understand large files, if available?'
4324    . ./myread
4325    case "$ans" in
4326    y|Y)         val="$define" ;;
4327    *)           val="$undef"  ;;
4328    esac
4329    ;;
4330 esac
4331 set uselargefiles
4332 eval $setvar
4333 case "$uselargefiles" in
4334 "$define")
4335 : Look for a hint-file generated 'call-back-unit'.  If the
4336 : user has specified that a large files perl is to be built,
4337 : we may need to set or change some other defaults.
4338         if $test -f uselargefiles.cbu; then
4339                 echo "Your platform has some specific hints for large file builds, using them..."
4340                 . ./uselargefiles.cbu
4341                 echo " "
4342                 echo "Rechecking to see how big your file offsets are..." >&4
4343                 $cat >try.c <<EOCP
4344 #include <sys/types.h>
4345 #include <stdio.h>
4346 int main()
4347 {
4348     printf("%d\n", (int)sizeof($lseektype));
4349     return(0); 
4350 }
4351 EOCP
4352                 set try
4353                 if eval $compile_ok; then
4354                         lseeksize=`./try`
4355                         $echo "Your file offsets are now $lseeksize bytes long."
4356                 else
4357                         dflt="$lseeksize"
4358                         echo " "
4359                         echo "(I can't seem to compile the test program.  Guessing...)"
4360                         rp="What is the size of your file offsets (in bytes)?"
4361                         . ./myread
4362                         lseeksize="$ans"
4363                 fi
4364                 case "$fpostype" in
4365                 *_t) zzz="$fpostype"    ;;
4366                 *)   zzz="fpos_t"       ;;
4367                 esac
4368                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4369                 $cat > try.c <<EOCP
4370 #include <sys/types.h>
4371 #include <stdio.h>
4372 int main() {
4373     printf("%d\n", (int)sizeof($fpostype));
4374     exit(0);
4375 }
4376 EOCP
4377                 set try
4378                 if eval $compile_ok; then
4379                         yyy=`./try`
4380                         dflt="$lseeksize"
4381                         case "$yyy" in
4382                         '')     echo " "
4383                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4384                                 ;;
4385                         *)      fpossize=$yyy
4386                                 echo " $fpossize bytes." >&4
4387                                 ;;
4388                         esac
4389                 else
4390                         dflt="$fpossize"
4391                         echo " "
4392                         echo "(I can't compile the test program.  Guessing...)" >&4
4393                         rp="What is the size of your file positions (in bytes)?"
4394                         . ./myread
4395                         fpossize="$ans"
4396                 fi
4397                 $rm -f try.c try
4398         fi
4399         ;;
4400 esac
4401
4402
4403 case "$usemorebits" in
4404 "$define"|true|[yY]*)
4405         use64bitint="$define"
4406         uselongdouble="$define"
4407         usemorebits="$define"
4408         ;;
4409 *)      usemorebits="$undef"
4410         ;;
4411 esac
4412
4413
4414 case "$uselonglong" in
4415 "$define"|true|[yY]*)
4416         cat <<EOM >&4
4417
4418 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4419 EOM
4420         use64bitint="$define"
4421         ;;
4422 esac                          
4423 case "$use64bits" in
4424 "$define"|true|[yY]*)
4425         cat <<EOM >&4
4426
4427 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4428 EOM
4429         use64bitint="$define"
4430         ;;
4431 esac                          
4432 case "$use64bitints" in
4433 "$define"|true|[yY]*)
4434         cat <<EOM >&4
4435
4436 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4437 EOM
4438         use64bitint="$define"
4439         ;;
4440 esac                          
4441 case "$use64bitsint" in
4442 "$define"|true|[yY]*)
4443         cat <<EOM >&4
4444
4445 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4446 EOM
4447         use64bitint="$define"
4448         ;;
4449 esac                          
4450 case "$uselonglongs" in
4451 "$define"|true|[yY]*)
4452         cat <<EOM >&4
4453
4454 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4455 EOM
4456         use64bitint="$define"
4457         ;;
4458 esac                          
4459 case "$use64bitsall" in
4460 "$define"|true|[yY]*)
4461         cat <<EOM >&4
4462
4463 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4464 EOM
4465         use64bitall="$define"
4466         ;;
4467 esac                          
4468
4469 case "$ccflags" in
4470 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4471 esac
4472 case "$use64bitall" in
4473 "$define"|true|[yY]*) use64bitint="$define" ;;
4474 esac
4475
4476 case "$longsize" in
4477 8) cat <<EOM
4478
4479 You have natively 64-bit long integers.
4480 EOM
4481    val="$define"
4482    ;;
4483 *) case "$use64bitint" in
4484    "$define"|true|[yY]*) dflt='y';;
4485    *) dflt='n';;
4486    esac
4487    cat <<EOM
4488
4489 Perl can be built to take advantage of 64-bit integer types
4490 on some systems.  To do so, Configure can be run with -Duse64bitint.
4491 Choosing this option will most probably introduce binary incompatibilities.
4492
4493 If this doesn't make any sense to you, just accept the default '$dflt'.
4494 EOM
4495    rp='Try to use 64-bit integers, if available?'
4496    . ./myread
4497    case "$ans" in
4498    [yY]*) val="$define" ;;
4499    *)     val="$undef"  ;;
4500    esac
4501    ;;
4502 esac
4503 set use64bitint
4504 eval $setvar
4505
4506 case "$use64bitall" in
4507 "$define"|true|[yY]*) dflt='y' ;;
4508 *) case "$longsize" in
4509    8) dflt='y' ;;
4510    *) dflt='n' ;;
4511    esac
4512    ;;
4513 esac    
4514 cat <<EOM
4515
4516 You may also choose to try maximal 64-bitness.  It means using as much
4517 64-bitness as possible on the platform.  This in turn means even more
4518 binary incompatibilities.  On the other hand, your platform may not
4519 have any more 64-bitness available than what you already have chosen.
4520
4521 If this doesn't make any sense to you, just accept the default '$dflt'.
4522 EOM
4523 rp='Try to use maximal 64-bit support, if available?'
4524 . ./myread
4525 case "$ans" in
4526 [yY]*) val="$define" ;;
4527 *)     val="$undef"  ;;
4528 esac
4529 set use64bitall
4530 eval $setvar
4531 case "$use64bitall" in
4532 "$define")
4533         case "$use64bitint" in
4534         "$undef")
4535                 cat <<EOM
4536
4537 Since you have chosen a maximally 64-bit build, I'm also turning on
4538 the use of 64-bit integers.
4539 EOM
4540                 use64bitint="$define" ;;
4541         esac
4542         ;;
4543 esac
4544
4545 case "$use64bitint" in
4546 "$define"|true|[yY]*)
4547 : Look for a hint-file generated 'call-back-unit'.  If the
4548 : user has specified that a 64-bit perl is to be built,
4549 : we may need to set or change some other defaults.
4550         if $test -f use64bitint.cbu; then
4551                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4552                 . ./use64bitint.cbu
4553         fi
4554         case "$longsize" in
4555         4) case "$archname64" in
4556            '') archname64=64int ;;
4557            esac
4558            ;;
4559         esac
4560         ;;
4561 esac
4562
4563 case "$use64bitall" in
4564 "$define"|true|[yY]*)
4565 : Look for a hint-file generated 'call-back-unit'.  If the
4566 : user has specified that a maximally 64-bit perl is to be built,
4567 : we may need to set or change some other defaults.
4568         if $test -f use64bitall.cbu; then
4569                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4570                 . ./use64bitall.cbu
4571         fi
4572         case "$longsize" in
4573         4) case "$archname64" in
4574            ''|64int) archname64=64all ;;
4575            esac
4576            ;;
4577         esac
4578         ;;
4579 esac
4580
4581 echo " "
4582 echo "Checking for GNU C Library..." >&4
4583 cat >gnulibc.c <<EOM
4584 #include <stdio.h>
4585 int main()
4586 {
4587 #ifdef __GLIBC__
4588     exit(0);
4589 #else
4590     exit(1);
4591 #endif
4592 }
4593 EOM
4594 set gnulibc
4595 if eval $compile_ok && ./gnulibc; then
4596         val="$define"
4597         echo "You are using the GNU C Library"
4598 else
4599         val="$undef"
4600         echo "You are not using the GNU C Library"
4601 fi
4602 $rm -f gnulibc*
4603 set d_gnulibc
4604 eval $setvar
4605
4606 : see if nm is to be used to determine whether a symbol is defined or not
4607 case "$usenm" in
4608 '')
4609         dflt=''
4610         case "$d_gnulibc" in
4611         "$define")
4612                 echo " "
4613                 echo "nm probably won't work on the GNU C Library." >&4
4614                 dflt=n
4615                 ;;
4616         esac
4617         case "$dflt" in
4618         '') 
4619                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4620                         echo " "
4621                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4622                         echo "'nm' won't be sufficient on this sytem." >&4
4623                         dflt=n
4624                 fi
4625                 ;;
4626         esac
4627         case "$dflt" in
4628         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4629                 if $test $dflt -gt 20; then
4630                         dflt=y
4631                 else
4632                         dflt=n
4633                 fi
4634                 ;;
4635         esac
4636         ;;
4637 *)
4638         case "$usenm" in
4639         true|$define) dflt=y;;
4640         *) dflt=n;;
4641         esac
4642         ;;
4643 esac
4644 $cat <<EOM
4645
4646 I can use $nm to extract the symbols from your C libraries. This
4647 is a time consuming task which may generate huge output on the disk (up
4648 to 3 megabytes) but that should make the symbols extraction faster. The
4649 alternative is to skip the 'nm' extraction part and to compile a small
4650 test program instead to determine whether each symbol is present. If
4651 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4652 this may be the best solution.
4653
4654 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4655
4656 EOM
4657 rp="Shall I use $nm to extract C symbols from the libraries?"
4658 . ./myread
4659 case "$ans" in
4660 [Nn]*) usenm=false;;
4661 *) usenm=true;;
4662 esac
4663
4664 runnm=$usenm
4665 case "$reuseval" in
4666 true) runnm=false;;
4667 esac
4668
4669 : nm options which may be necessary
4670 case "$nm_opt" in
4671 '') if $test -f /mach_boot; then
4672                 nm_opt=''       # Mach
4673         elif $test -d /usr/ccs/lib; then
4674                 nm_opt='-p'     # Solaris (and SunOS?)
4675         elif $test -f /dgux; then
4676                 nm_opt='-p'     # DG-UX
4677         elif $test -f /lib64/rld; then
4678                 nm_opt='-p'     # 64-bit Irix
4679         else
4680                 nm_opt=''
4681         fi;;
4682 esac
4683
4684 : nm options which may be necessary for shared libraries but illegal
4685 : for archive libraries.  Thank you, Linux.
4686 case "$nm_so_opt" in
4687 '')     case "$myuname" in
4688         *linux*)
4689                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4690                         nm_so_opt='--dynamic'
4691                 fi
4692                 ;;
4693         esac
4694         ;;
4695 esac
4696
4697 case "$runnm" in
4698 true)
4699 : get list of predefined functions in a handy place
4700 echo " "
4701 case "$libc" in
4702 '') libc=unknown
4703         case "$libs" in
4704         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4705         esac
4706         ;;
4707 esac
4708 libnames='';
4709 case "$libs" in
4710 '') ;;
4711 *)  for thislib in $libs; do
4712         case "$thislib" in
4713         -lc|-lc_s)
4714                 : Handle C library specially below.
4715                 ;;
4716         -l*)
4717                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4718                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4719                         :
4720                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4721                         :
4722                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4723                         :
4724                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4725                         :
4726                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4727                         :
4728                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4729                         :
4730                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4731                         :
4732                 else
4733                         try=''
4734                 fi
4735                 libnames="$libnames $try"
4736                 ;;
4737         *) libnames="$libnames $thislib" ;;
4738         esac
4739         done
4740         ;;
4741 esac
4742 xxx=normal
4743 case "$libc" in
4744 unknown)
4745         set /lib/libc.$so
4746         for xxx in $libpth; do
4747                 $test -r $1 || set $xxx/libc.$so
4748                 : The messy sed command sorts on library version numbers.
4749                 $test -r $1 || \
4750                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4751                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4752                                 h
4753                                 s/[0-9][0-9]*/0000&/g
4754                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4755                                 G
4756                                 s/\n/ /' | \
4757                          $sort | $sed -e 's/^.* //'`
4758                 eval set \$$#
4759         done
4760         $test -r $1 || set /usr/ccs/lib/libc.$so
4761         $test -r $1 || set /lib/libsys_s$_a
4762         ;;
4763 *)
4764         set blurfl
4765         ;;
4766 esac
4767 if $test -r "$1"; then
4768         echo "Your (shared) C library seems to be in $1."
4769         libc="$1"
4770 elif $test -r /lib/libc && $test -r /lib/clib; then
4771         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4772         xxx=apollo
4773         libc='/lib/clib /lib/libc'
4774         if $test -r /lib/syslib; then
4775                 echo "(Your math library is in /lib/syslib.)"
4776                 libc="$libc /lib/syslib"
4777         fi
4778 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4779         echo "Your C library seems to be in $libc, as you said before."
4780 elif $test -r $incpath/usr/lib/libc$_a; then
4781         libc=$incpath/usr/lib/libc$_a;
4782         echo "Your C library seems to be in $libc.  That's fine."
4783 elif $test -r /lib/libc$_a; then
4784         libc=/lib/libc$_a;
4785         echo "Your C library seems to be in $libc.  You're normal."
4786 else
4787         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4788                 :
4789         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4790                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4791         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4792                 :
4793         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4794                 :
4795         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4796                 :
4797         else
4798                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4799         fi
4800         if $test -r "$tans"; then
4801                 echo "Your C library seems to be in $tans, of all places."
4802                 libc=$tans
4803         else
4804                 libc='blurfl'
4805         fi
4806 fi
4807 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4808         dflt="$libc"
4809         cat <<EOM
4810
4811 If the guess above is wrong (which it might be if you're using a strange
4812 compiler, or your machine supports multiple models), you can override it here.
4813
4814 EOM
4815 else
4816         dflt=''
4817         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4818         cat >&4 <<EOM
4819 I can't seem to find your C library.  I've looked in the following places:
4820
4821 EOM
4822         $sed 's/^/      /' libpath
4823         cat <<EOM
4824
4825 None of these seems to contain your C library. I need to get its name...
4826
4827 EOM
4828 fi
4829 fn=f
4830 rp='Where is your C library?'
4831 . ./getfile
4832 libc="$ans"
4833
4834 echo " "
4835 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4836 set X `cat libnames`
4837 shift
4838 xxx=files
4839 case $# in 1) xxx=file; esac
4840 echo "Extracting names from the following $xxx for later perusal:" >&4
4841 echo " "
4842 $sed 's/^/      /' libnames >&4
4843 echo " "
4844 $echo $n "This may take a while...$c" >&4
4845
4846 for file in $*; do
4847         case $file in
4848         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4849         *) $nm $nm_opt $file 2>/dev/null;;
4850         esac
4851 done >libc.tmp
4852
4853 $echo $n ".$c"
4854 $grep fprintf libc.tmp > libc.ptf
4855 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4856 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4857 xxx='[ADTSIW]'
4858 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4859         eval $xscan;\
4860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861                 eval $xrun
4862 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4863         eval $xscan;\
4864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865                 eval $xrun
4866 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4867         eval $xscan;\
4868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869                 eval $xrun
4870 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4871         eval $xscan;\
4872         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4873                 eval $xrun
4874 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4875         eval $xscan;\
4876         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4877                 eval $xrun
4878 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4879         eval $xscan;\
4880         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4881                 eval $xrun
4882 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4883                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4884         eval $xscan;\
4885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886                 eval $xrun
4887 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4888         eval $xscan;\
4889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890                 eval $xrun
4891 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4892         eval $xscan;\
4893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894                 eval $xrun
4895 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4896         eval $xscan;\
4897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898                 eval $xrun
4899 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4900         eval $xscan;\
4901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902                 eval $xrun
4903 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4904         eval $xscan;\
4905         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4906                 eval $xrun
4907 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4908         eval $xscan;\
4909         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4910                 eval $xrun
4911 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4912         eval $xscan;\
4913         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4914                 eval $xrun
4915 else
4916         $nm -p $* 2>/dev/null >libc.tmp
4917         $grep fprintf libc.tmp > libc.ptf
4918         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4919                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4920         then
4921                 nm_opt='-p'
4922                 eval $xrun
4923         else
4924                 echo " "
4925                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4926                 com=''
4927                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4928                         for thisname in $libnames $libc; do
4929                                 $ar t $thisname >>libc.tmp
4930                         done
4931                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4932                         echo "Ok." >&4
4933                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4934                         # Repeat libc to extract forwarders to DLL entries too
4935                         for thisname in $libnames $libc; do
4936                                 $ar tv $thisname >>libc.tmp
4937                                 # Revision 50 of EMX has bug in $ar.
4938                                 # it will not extract forwarders to DLL entries
4939                                 # Use emximp which will extract exactly them.
4940                                 emximp -o tmp.imp $thisname \
4941                                     2>/dev/null && \
4942                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4943                                     < tmp.imp >>libc.tmp
4944                                 $rm tmp.imp
4945                         done
4946                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4947                         echo "Ok." >&4
4948                 else
4949                         echo "$ar didn't seem to work right." >&4
4950                         echo "Maybe this is a Cray...trying bld instead..." >&4
4951                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4952                         then
4953                                 for thisname in $libnames; do
4954                                         bld t $libnames | \
4955                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4956                                         $ar t $thisname >>libc.tmp
4957                                 done
4958                                 echo "Ok." >&4
4959                         else
4960                                 echo "That didn't work either.  Giving up." >&4
4961                                 exit 1
4962                         fi
4963                 fi
4964         fi
4965 fi
4966 nm_extract="$com"
4967 if $test -f /lib/syscalls.exp; then
4968         echo " "
4969         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4970         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4971 fi
4972 ;;
4973 esac
4974 $rm -f libnames libpath
4975
4976 : is a C symbol defined?
4977 csym='tlook=$1;
4978 case "$3" in
4979 -v) tf=libc.tmp; tc=""; tdc="";;
4980 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4981 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4982 esac;
4983 tx=yes;
4984 case "$reuseval-$4" in
4985 true-) ;;
4986 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4987 esac;
4988 case "$tx" in
4989 yes)
4990         case "$runnm" in
4991         true)
4992                 if $contains $tlook $tf >/dev/null 2>&1;
4993                 then tval=true;
4994                 else tval=false;
4995                 fi;;
4996         *)
4997                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4998                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4999                 then tval=true;
5000                 else tval=false;
5001                 fi;
5002                 $rm -f t t.c;;
5003         esac;;
5004 *)
5005         case "$tval" in
5006         $define) tval=true;;
5007         *) tval=false;;
5008         esac;;
5009 esac;
5010 eval "$2=$tval"'
5011
5012 : define an is-in-libc? function
5013 inlibc='echo " "; td=$define; tu=$undef;
5014 sym=$1; var=$2; eval "was=\$$2";
5015 tx=yes;
5016 case "$reuseval$was" in
5017 true) ;;
5018 true*) tx=no;;
5019 esac;
5020 case "$tx" in
5021 yes)
5022         set $sym tres -f;
5023         eval $csym;
5024         case "$tres" in
5025         true)
5026                 echo "$sym() found." >&4;
5027                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5028         *)
5029                 echo "$sym() NOT found." >&4;
5030                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5031         esac;;
5032 *)
5033         case "$was" in
5034         $define) echo "$sym() found." >&4;;
5035         *) echo "$sym() NOT found." >&4;;
5036         esac;;
5037 esac'
5038
5039 : see if sqrtl exists
5040 set sqrtl d_sqrtl
5041 eval $inlibc
5042
5043 case "$ccflags" in
5044 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5045 esac
5046
5047 case "$uselongdouble" in
5048 $define|true|[yY]*)     dflt='y';;
5049 *) dflt='n';;
5050 esac
5051 cat <<EOM
5052
5053 Perl can be built to take advantage of long doubles which
5054 (if available) may give more accuracy and range for floating point numbers.
5055
5056 If this doesn't make any sense to you, just accept the default '$dflt'.
5057 EOM
5058 rp='Try to use long doubles if available?'
5059 . ./myread
5060 case "$ans" in
5061 y|Y)    val="$define"   ;;
5062 *)      val="$undef"    ;;
5063 esac
5064 set uselongdouble
5065 eval $setvar
5066
5067 case "$uselongdouble" in
5068 true|[yY]*) uselongdouble="$define" ;;
5069 esac
5070
5071 case "$uselongdouble" in
5072 $define)
5073 : Look for a hint-file generated 'call-back-unit'.  If the
5074 : user has specified that long doubles should be used,
5075 : we may need to set or change some other defaults.
5076         if $test -f uselongdouble.cbu; then
5077                 echo "Your platform has some specific hints for long doubles, using them..."
5078                 . ./uselongdouble.cbu
5079         else
5080                 $cat <<EOM
5081 (Your platform doesn't have any specific hints for long doubles.)
5082 EOM
5083         fi
5084         ;;
5085 esac
5086
5087 case "$uselongdouble:$d_sqrtl" in
5088 $define:$undef)
5089                 $cat <<EOM >&4
5090
5091 *** You requested the use of long doubles but you do not seem to have
5092 *** the mathematic functions for long doubles.  I'm disabling the use
5093 *** of long doubles.
5094
5095 EOM
5096         uselongdouble=$undef
5097         ;;
5098 esac
5099
5100 : check for length of double
5101 echo " "
5102 case "$doublesize" in
5103 '')
5104         echo "Checking to see how big your double precision numbers are..." >&4
5105         $cat >try.c <<'EOCP'
5106 #include <stdio.h>
5107 int main()
5108 {
5109     printf("%d\n", (int)sizeof(double));
5110     exit(0);
5111 }
5112 EOCP
5113         set try
5114         if eval $compile_ok; then
5115                 doublesize=`./try`
5116                 echo "Your double is $doublesize bytes long."
5117         else
5118                 dflt='8'
5119                 echo "(I can't seem to compile the test program.  Guessing...)"
5120                 rp="What is the size of a double precision number (in bytes)?"
5121                 . ./myread
5122                 doublesize="$ans"
5123         fi
5124         ;;
5125 esac
5126 $rm -f try.c try
5127
5128 : check for long doubles
5129 echo " "
5130 echo "Checking to see if you have long double..." >&4
5131 echo 'int main() { long double x = 7.0; }' > try.c
5132 set try
5133 if eval $compile; then
5134         val="$define"
5135         echo "You have long double."
5136 else
5137         val="$undef"
5138         echo "You do not have long double."
5139 fi
5140 $rm try.*
5141 set d_longdbl
5142 eval $setvar
5143
5144 : check for length of long double
5145 case "${d_longdbl}${longdblsize}" in
5146 $define)
5147         echo " "
5148         echo "Checking to see how big your long doubles are..." >&4
5149         $cat >try.c <<'EOCP'
5150 #include <stdio.h>
5151 int main()
5152 {
5153         printf("%d\n", sizeof(long double));
5154 }
5155 EOCP
5156         set try
5157         set try
5158         if eval $compile; then
5159                 longdblsize=`./try$exe_ext`
5160                 echo "Your long doubles are $longdblsize bytes long."
5161         else
5162                 dflt='8'
5163                 echo " "
5164                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5165                 rp="What is the size of a long double (in bytes)?"
5166                 . ./myread
5167                 longdblsize="$ans"
5168         fi
5169         if $test "X$doublesize" = "X$longdblsize"; then
5170                 echo "(That isn't any different from an ordinary double.)"
5171         fi      
5172         ;;
5173 esac
5174 $rm -f try.* try
5175
5176 : determine the architecture name
5177 echo " "
5178 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5179         tarch=`arch`"-$osname"
5180 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5181         if uname -m > tmparch 2>&1 ; then
5182                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5183                         -e 's/$/'"-$osname/" tmparch`
5184         else
5185                 tarch="$osname"
5186         fi
5187         $rm -f tmparch
5188 else
5189         tarch="$osname"
5190 fi
5191 case "$myarchname" in
5192 ''|"$tarch") ;;
5193 *)
5194         echo "(Your architecture name used to be $myarchname.)"
5195         archname=''
5196         ;;
5197 esac
5198 myarchname="$tarch"
5199 case "$archname" in
5200 '') dflt="$tarch";;
5201 *) dflt="$archname";;
5202 esac
5203 rp='What is your architecture name'
5204 . ./myread
5205 archname="$ans"
5206 case "$usethreads" in
5207 $define)
5208         echo "Threads selected." >&4
5209         case "$archname" in
5210         *-thread*) echo "...and architecture name already has -thread." >&4
5211                 ;;
5212         *)      archname="$archname-thread"
5213                 echo "...setting architecture name to $archname." >&4
5214                 ;;
5215         esac
5216         ;;
5217 esac
5218 case "$usemultiplicity" in
5219 $define)
5220         echo "Multiplicity selected." >&4
5221         case "$archname" in
5222         *-multi*) echo "...and architecture name already has -multi." >&4
5223                 ;;
5224         *)      archname="$archname-multi"
5225                 echo "...setting architecture name to $archname." >&4
5226                 ;;
5227         esac
5228         ;;
5229 esac
5230 case "$use64bitint$use64bitall" in
5231 *"$define"*)
5232         case "$archname64" in
5233         '')
5234                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5235                 ;;
5236         *)
5237                 case "$use64bitint" in
5238                 "$define") echo "64 bit integers selected." >&4 ;;
5239                 esac
5240                 case "$use64bitall" in
5241                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5242                 esac
5243                 case "$archname" in
5244                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5245                         ;;
5246                 *)      archname="$archname-$archname64"
5247                         echo "...setting architecture name to $archname." >&4
5248                         ;;
5249                 esac
5250                 ;;
5251         esac
5252 esac
5253 case "$uselongdouble" in
5254 $define)
5255         echo "Long doubles selected." >&4
5256         case "$longdblsize" in
5257         $doublesize)
5258                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5259                 ;;
5260         *)
5261                 case "$archname" in
5262                 *-ld*) echo "...and architecture name already has -ld." >&4
5263                         ;;
5264                 *)      archname="$archname-ld"
5265                         echo "...setting architecture name to $archname." >&4
5266                         ;;
5267                 esac
5268                 ;;
5269         esac
5270         ;;
5271 esac
5272
5273 : determine root of directory hierarchy where package will be installed.
5274 case "$prefix" in
5275 '')
5276         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5277         ;;
5278 *)
5279         dflt="$prefix"
5280         ;;
5281 esac
5282 $cat <<EOM
5283
5284 By default, $package will be installed in $dflt/bin, manual pages
5285 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5286 installation directories. Typically this is something like /usr/local.
5287 If you wish to have binaries under /usr/bin but other parts of the
5288 installation under /usr/local, that's ok: you will be prompted
5289 separately for each of the installation directories, the prefix being
5290 only used to set the defaults.
5291
5292 EOM
5293 fn=d~
5294 rp='Installation prefix to use?'
5295 . ./getfile
5296 oldprefix=''
5297 case "$prefix" in
5298 '') ;;
5299 *)
5300         case "$ans" in
5301         "$prefix") ;;
5302         *) oldprefix="$prefix";;
5303         esac
5304         ;;
5305 esac
5306 prefix="$ans"
5307 prefixexp="$ansexp"
5308
5309 : is AFS running?
5310 echo " "
5311 case "$afs" in
5312 $define|true)   afs=true ;;
5313 $undef|false)   afs=false ;;
5314 *)      if test -d /afs; then
5315                 afs=true
5316         else
5317                 afs=false
5318         fi
5319         ;;
5320 esac
5321 if $afs; then
5322         echo "AFS may be running... I'll be extra cautious then..." >&4
5323 else
5324         echo "AFS does not seem to be running..." >&4
5325 fi
5326
5327 : determine installation prefix for where package is to be installed.
5328 if $afs; then 
5329 $cat <<EOM
5330
5331 Since you are running AFS, I need to distinguish the directory in which
5332 files will reside from the directory in which they are installed (and from
5333 which they are presumably copied to the former directory by occult means).
5334
5335 EOM
5336         case "$installprefix" in
5337         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5338         *) dflt="$installprefix";;
5339         esac
5340 else
5341 $cat <<EOM
5342
5343 In some special cases, particularly when building $package for distribution,
5344 it is convenient to distinguish between the directory in which files should 
5345 be installed from the directory ($prefix) in which they 
5346 will eventually reside.  For most users, these two directories are the same.
5347
5348 EOM
5349         case "$installprefix" in
5350         '') dflt=$prefix ;;
5351         *) dflt=$installprefix;;
5352         esac
5353 fi
5354 fn=d~
5355 rp='What installation prefix should I use for installing files?'
5356 . ./getfile
5357 installprefix="$ans"
5358 installprefixexp="$ansexp"
5359
5360 : set the prefixit variable, to compute a suitable default value
5361 prefixit='case "$3" in
5362 ""|none)
5363         case "$oldprefix" in
5364         "") eval "$1=\"\$$2\"";;
5365         *)
5366                 case "$3" in
5367                 "") eval "$1=";;
5368                 none)
5369                         eval "tp=\"\$$2\"";
5370                         case "$tp" in
5371                         ""|" ") eval "$1=\"\$$2\"";;
5372                         *) eval "$1=";;
5373                         esac;;
5374                 esac;;
5375         esac;;
5376 *)
5377         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5378         case "$tp" in
5379         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5380         /*-$oldprefix/*|\~*-$oldprefix/*)
5381                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5382         *) eval "$1=\"\$$2\"";;
5383         esac;;
5384 esac'
5385
5386
5387 : get the patchlevel
5388 echo " "
5389 echo "Getting the current patchlevel..." >&4
5390 if $test -r $rsrc/patchlevel.h;then
5391         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5392         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5393         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5394         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5395         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5396         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5397 else
5398         revision=0
5399         patchlevel=0
5400         subversion=0
5401         api_revision=0
5402         api_version=0
5403         api_subversion=0
5404 fi
5405 $echo "(You have $package version $patchlevel subversion $subversion.)"
5406 case "$osname" in
5407 dos|vms)
5408         : XXX Should be a Configure test for double-dots in filenames.
5409         version=`echo $revision $patchlevel $subversion | \
5410                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5411         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5412                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5413         ;;
5414 *)
5415         version=`echo $revision $patchlevel $subversion | \
5416                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5417         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5418                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5419         ;;
5420 esac
5421 : Special case the 5.005_xx maintenance series, which used 5.005
5422 : without any subversion label as a subdirectory in $sitelib
5423 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5424         api_versionstring='5.005'
5425 fi
5426
5427 : determine installation style
5428 : For now, try to deduce it from prefix unless it is already set.
5429 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5430 case "$installstyle" in
5431 '')     case "$prefix" in
5432                 *perl*) dflt='lib';;
5433                 *) dflt='lib/perl5' ;;
5434         esac
5435         ;;
5436 *)      dflt="$installstyle" ;;
5437 esac
5438 : Probably not worth prompting for this since we prompt for all
5439 : the directories individually, and the prompt would be too long and
5440 : confusing anyway.
5441 installstyle=$dflt
5442
5443 : determine where private library files go
5444 : Usual default is /usr/local/lib/perl5/$version.
5445 : Also allow things like /opt/perl/lib/$version, since 
5446 : /opt/perl/lib/perl5... would be redundant.
5447 : The default "style" setting is made in installstyle.U
5448 case "$installstyle" in
5449 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5450 *)       set dflt privlib lib/$version ;;
5451 esac
5452 eval $prefixit
5453 $cat <<EOM
5454
5455 There are some auxiliary files for $package that need to be put into a
5456 private library directory that is accessible by everyone.
5457
5458 EOM
5459 fn=d~+
5460 rp='Pathname where the private library files will reside?'
5461 . ./getfile
5462 privlib="$ans"
5463 privlibexp="$ansexp"
5464 : Change installation prefix, if necessary.
5465 if $test X"$prefix" != X"$installprefix"; then
5466         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5467 else
5468         installprivlib="$privlibexp"
5469 fi
5470
5471 : set the prefixup variable, to restore leading tilda escape
5472 prefixup='case "$prefixexp" in
5473 "$prefix") ;;
5474 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5475 esac'
5476
5477 : determine where public architecture dependent libraries go
5478 set archlib archlib
5479 eval $prefixit
5480 : privlib default is /usr/local/lib/$package/$version
5481 : archlib default is /usr/local/lib/$package/$version/$archname
5482 : privlib may have an optional trailing /share.
5483 tdflt=`echo $privlib | $sed 's,/share$,,'`
5484 tdflt=$tdflt/$archname
5485 case "$archlib" in
5486 '')     dflt=$tdflt
5487         ;;
5488 *)      dflt="$archlib"
5489     ;;
5490 esac
5491 $cat <<EOM
5492
5493 $spackage contains architecture-dependent library files.  If you are
5494 sharing libraries in a heterogeneous environment, you might store
5495 these files in a separate location.  Otherwise, you can just include
5496 them with the rest of the public library files.
5497
5498 EOM
5499 fn=d+~
5500 rp='Where do you want to put the public architecture-dependent libraries?'
5501 . ./getfile
5502 archlib="$ans"
5503 archlibexp="$ansexp"
5504 if $test X"$archlib" = X"$privlib"; then
5505         d_archlib="$undef"
5506 else
5507         d_archlib="$define"
5508 fi
5509 : Change installation prefix, if necessary.
5510 if $test X"$prefix" != X"$installprefix"; then
5511         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5512 else
5513         installarchlib="$archlibexp"
5514 fi
5515
5516
5517 : Binary compatibility with 5.005 is not possible for builds
5518 : with advanced features
5519 case "$usethreads$usemultiplicity" in
5520 *define*)
5521         bincompat5005="$undef"
5522         d_bincompat5005="$undef"
5523         ;;
5524 *)      $cat <<EOM
5525
5526 This version of Perl can be compiled for binary compatibility with 5.005.
5527 If you decide to do so, you will be able to continue using most of the
5528 extensions that were compiled for Perl 5.005.
5529
5530 EOM
5531         case "$bincompat5005$d_bincompat5005" in
5532         *"$undef"*) dflt=n ;;
5533         *) dflt=y ;;
5534         esac
5535         rp='Binary compatibility with Perl 5.005?'
5536         . ./myread
5537         case "$ans" in
5538         y*) val="$define" ;;
5539         *)  val="$undef" ;;
5540         esac
5541         set d_bincompat5005
5542         eval $setvar
5543         case "$d_bincompat5005" in
5544         "$define")
5545                 bincompat5005="$define"
5546                 ;;
5547         *)      bincompat5005="$undef"
5548                 d_bincompat5005="$undef"
5549                 ;;
5550         esac
5551         ;;
5552 esac
5553
5554
5555 : see if setuid scripts can be secure
5556 $cat <<EOM
5557
5558 Some kernels have a bug that prevents setuid #! scripts from being
5559 secure.  Some sites have disabled setuid #! scripts because of this.
5560
5561 First let's decide if your kernel supports secure setuid #! scripts.
5562 (If setuid #! scripts would be secure but have been disabled anyway,
5563 don't say that they are secure if asked.)
5564
5565 EOM
5566
5567 val="$undef"
5568 if $test -d /dev/fd; then
5569         echo "#!$ls" >reflect
5570         chmod +x,u+s reflect
5571         ./reflect >flect 2>&1
5572         if $contains "/dev/fd" flect >/dev/null; then
5573                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5574                 val="$define"
5575         else
5576                 $cat <<EOM
5577 If you are not sure if they are secure, I can check but I'll need a
5578 username and password different from the one you are using right now.
5579 If you don't have such a username or don't want me to test, simply
5580 enter 'none'.
5581
5582 EOM
5583                 rp='Other username to test security of setuid scripts with?'
5584                 dflt='none'
5585                 . ./myread
5586                 case "$ans" in
5587                 n|none)
5588                         case "$d_suidsafe" in
5589                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5590                                 dflt=n;;
5591                         "$undef")
5592                                 echo "Well, the $hint value is *not* secure." >&4
5593                                 dflt=n;;
5594                         *)      echo "Well, the $hint value *is* secure." >&4
5595                                 dflt=y;;
5596                         esac
5597                         ;;
5598                 *)
5599                         $rm -f reflect flect
5600                         echo "#!$ls" >reflect
5601                         chmod +x,u+s reflect
5602                         echo >flect
5603                         chmod a+w flect
5604                         echo '"su" will (probably) prompt you for '"$ans's password."
5605                         su $ans -c './reflect >flect'
5606                         if $contains "/dev/fd" flect >/dev/null; then
5607                                 echo "Okay, it looks like setuid scripts are secure." >&4
5608                                 dflt=y
5609                         else
5610                                 echo "I don't think setuid scripts are secure." >&4
5611                                 dflt=n
5612                         fi
5613                         ;;
5614                 esac
5615                 rp='Does your kernel have *secure* setuid scripts?'
5616                 . ./myread
5617                 case "$ans" in
5618                 [yY]*)  val="$define";;
5619                 *)      val="$undef";;
5620                 esac
5621         fi
5622 else
5623         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5624         echo "(That's for file descriptors, not floppy disks.)"
5625         val="$undef"
5626 fi
5627 set d_suidsafe
5628 eval $setvar
5629
5630 $rm -f reflect flect
5631
5632 : now see if they want to do setuid emulation
5633 echo " "
5634 val="$undef"
5635 case "$d_suidsafe" in
5636 "$define")
5637         val="$undef"
5638         echo "No need to emulate SUID scripts since they are secure here." >& 4
5639         ;;
5640 *)
5641         $cat <<EOM
5642 Some systems have disabled setuid scripts, especially systems where
5643 setuid scripts cannot be secure.  On systems where setuid scripts have
5644 been disabled, the setuid/setgid bits on scripts are currently
5645 useless.  It is possible for $package to detect those bits and emulate
5646 setuid/setgid in a secure fashion.  This emulation will only work if
5647 setuid scripts have been disabled in your kernel.
5648
5649 EOM
5650         case "$d_dosuid" in
5651         "$define") dflt=y ;;
5652         *) dflt=n ;;
5653         esac
5654         rp="Do you want to do setuid/setgid emulation?"
5655         . ./myread
5656         case "$ans" in
5657         [yY]*)  val="$define";;
5658         *)      val="$undef";;
5659         esac
5660         ;;
5661 esac
5662 set d_dosuid
5663 eval $setvar
5664
5665 : determine filename position in cpp output
5666 echo " "
5667 echo "Computing filename position in cpp output for #include directives..." >&4
5668 echo '#include <stdio.h>' > foo.c
5669 $cat >fieldn <<EOF
5670 $startsh
5671 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5672 $grep '^[       ]*#.*stdio\.h' | \
5673 while read cline; do
5674         pos=1
5675         set \$cline
5676         while $test \$# -gt 0; do
5677                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5678                         echo "\$pos"
5679                         exit 0
5680                 fi
5681                 shift
5682                 pos=\`expr \$pos + 1\`
5683         done
5684 done
5685 EOF
5686 chmod +x fieldn
5687 fieldn=`./fieldn`
5688 $rm -f foo.c fieldn
5689 case $fieldn in
5690 '') pos='???';;
5691 1) pos=first;;
5692 2) pos=second;;
5693 3) pos=third;;
5694 *) pos="${fieldn}th";;
5695 esac
5696 echo "Your cpp writes the filename in the $pos field of the line."
5697
5698 : locate header file
5699 $cat >findhdr <<EOF
5700 $startsh
5701 wanted=\$1
5702 name=''
5703 for usrincdir in $usrinc
5704 do
5705         if test -f \$usrincdir/\$wanted; then
5706                 echo "\$usrincdir/\$wanted"
5707                 exit 0
5708         fi
5709 done
5710 awkprg='{ print \$$fieldn }'
5711 echo "#include <\$wanted>" > foo\$\$.c
5712 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5713 $grep "^[       ]*#.*\$wanted" | \
5714 while read cline; do
5715         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5716         case "\$name" in
5717         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5718         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5719         *) exit 2;;
5720         esac;
5721 done;
5722 #
5723 # status = 0: grep returned 0 lines, case statement not executed
5724 # status = 1: headerfile found
5725 # status = 2: while loop executed, no headerfile found
5726 #
5727 status=\$?
5728 $rm -f foo\$\$.c;
5729 if test \$status -eq 1; then
5730         exit 0;
5731 fi
5732 exit 1
5733 EOF
5734 chmod +x findhdr
5735
5736 : define an alternate in-header-list? function
5737 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5738 cont=true; xxf="echo \"<\$1> found.\" >&4";
5739 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5740 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5741 esac;
5742 case $# in 4) instead=instead;; *) instead="at last";; esac;
5743 while $test "$cont"; do
5744         xxx=`./findhdr $1`
5745         var=$2; eval "was=\$$2";
5746         if $test "$xxx" && $test -r "$xxx";
5747         then eval $xxf;
5748         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5749                 cont="";
5750         else eval $xxnf;
5751         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5752         set $yyy; shift; shift; yyy=$@;
5753         case $# in 0) cont="";;
5754         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5755                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5756         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5757                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5758         esac;
5759 done;
5760 while $test "$yyy";
5761 do set $yyy; var=$2; eval "was=\$$2";
5762         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5763         set $yyy; shift; shift; yyy=$@;
5764 done'
5765
5766 : see if this is a malloc.h system
5767 set malloc.h i_malloc
5768 eval $inhdr
5769
5770 : see if stdlib is available
5771 set stdlib.h i_stdlib
5772 eval $inhdr
5773
5774 : determine which malloc to compile in
5775 echo " "
5776 case "$usemymalloc" in
5777 ''|[yY]*|true|$define)  dflt='y' ;;
5778 *)      dflt='n' ;;
5779 esac
5780 rp="Do you wish to attempt to use the malloc that comes with $package?"
5781 . ./myread
5782 usemymalloc="$ans"
5783 case "$ans" in
5784 y*|true)
5785         usemymalloc='y'
5786         mallocsrc='malloc.c'
5787         mallocobj="malloc$_o"
5788         d_mymalloc="$define"
5789         case "$libs" in
5790         *-lmalloc*)
5791                 : Remove malloc from list of libraries to use
5792                 echo "Removing unneeded -lmalloc from library list" >&4
5793                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5794                 shift
5795                 libs="$*"
5796                 echo "libs = $libs" >&4
5797                 ;;
5798         esac
5799         ;;
5800 *)
5801         usemymalloc='n'
5802         mallocsrc=''
5803         mallocobj=''
5804         d_mymalloc="$undef"
5805         ;;
5806 esac
5807
5808 : compute the return types of malloc and free
5809 echo " "
5810 $cat >malloc.c <<END
5811 #$i_malloc I_MALLOC
5812 #$i_stdlib I_STDLIB
5813 #include <stdio.h>
5814 #include <sys/types.h>
5815 #ifdef I_MALLOC
5816 #include <malloc.h>
5817 #endif
5818 #ifdef I_STDLIB
5819 #include <stdlib.h>
5820 #endif
5821 #ifdef TRY_MALLOC
5822 void *malloc();
5823 #endif
5824 #ifdef TRY_FREE
5825 void free();
5826 #endif
5827 END
5828 case "$malloctype" in
5829 '')
5830         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5831                 malloctype='void *'
5832         else
5833                 malloctype='char *'
5834         fi
5835         ;;
5836 esac
5837 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5838
5839 case "$freetype" in
5840 '')
5841         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5842                 freetype='void'
5843         else
5844                 freetype='int'
5845         fi
5846         ;;
5847 esac
5848 echo "Your system uses $freetype free(), it would seem." >&4
5849 $rm -f malloc.[co]
5850 $cat <<EOM
5851
5852 After $package is installed, you may wish to install various
5853 add-on modules and utilities.  Typically, these add-ons will
5854 be installed under $prefix with the rest
5855 of this package.  However, you may wish to install such add-ons
5856 elsewhere under a different prefix.
5857
5858 If you do not wish to put everything under a single prefix, that's
5859 ok.  You will be prompted for the individual locations; this siteprefix
5860 is only used to suggest the defaults.
5861
5862 The default should be fine for most people.
5863
5864 EOM
5865 fn=d~+
5866 rp='Installation prefix to use for add-on modules and utilities?'
5867 : XXX Here might be another good place for an installstyle setting.
5868 case "$siteprefix" in
5869 '') dflt=$prefix ;;
5870 *)  dflt=$siteprefix ;;
5871 esac
5872 . ./getfile
5873 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5874 oldsiteprefix=''
5875 case "$siteprefix" in
5876 '') ;;
5877 *)      case "$ans" in
5878         "$prefix") ;;
5879         *) oldsiteprefix="$prefix";;
5880         esac
5881         ;;
5882 esac
5883 siteprefix="$ans"
5884 siteprefixexp="$ansexp"
5885
5886 : determine where site specific libraries go.
5887 : Usual default is /usr/local/lib/perl5/site_perl/$version
5888 : The default "style" setting is made in installstyle.U
5889 : XXX No longer works with Prefixit stuff.
5890 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5891 case "$sitelib" in
5892 '') case "$installstyle" in
5893         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5894         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5895         esac
5896         ;;
5897 *)      dflt="$sitelib"
5898         ;;
5899 esac
5900 $cat <<EOM
5901
5902 The installation process will create a directory for
5903 site-specific extensions and modules.  Most users find it convenient
5904 to place all site-specific files in this directory rather than in the
5905 main distribution directory.
5906
5907 EOM
5908 fn=d~+
5909 rp='Pathname for the site-specific library files?'
5910 . ./getfile
5911 sitelib="$ans"
5912 sitelibexp="$ansexp"
5913 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5914 : Change installation prefix, if necessary.
5915 if $test X"$prefix" != X"$installprefix"; then
5916         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5917 else
5918         installsitelib="$sitelibexp"
5919 fi
5920
5921 : determine where site specific architecture-dependent libraries go.
5922 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5923 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5924 : sitelib may have an optional trailing /share.
5925 case "$sitearch" in
5926 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5927         dflt="$dflt/$archname"
5928         ;;
5929 *)      dflt="$sitearch"
5930         ;;
5931 esac
5932 set sitearch sitearch none
5933 eval $prefixit
5934 $cat <<EOM
5935
5936 The installation process will also create a directory for
5937 architecture-dependent site-specific extensions and modules.
5938
5939 EOM
5940 fn=d~+
5941 rp='Pathname for the site-specific architecture-dependent library files?'
5942 . ./getfile
5943 sitearch="$ans"
5944 sitearchexp="$ansexp"
5945 : Change installation prefix, if necessary.
5946 if $test X"$prefix" != X"$installprefix"; then
5947         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5948 else
5949         installsitearch="$sitearchexp"
5950 fi
5951
5952 $cat <<EOM
5953
5954 The installation process will also create a directory for
5955 vendor-supplied add-ons.  Vendors who supply perl with their system
5956 may find it convenient to place all vendor-supplied files in this
5957 directory rather than in the main distribution directory.  This will
5958 ease upgrades between binary-compatible maintenance versions of perl.
5959
5960 Of course you may also use these directories in whatever way you see
5961 fit.  For example, you might use them to access modules shared over a
5962 company-wide network.
5963
5964 The default answer should be fine for most people.
5965 This causes further questions about vendor add-ons to be skipped
5966 and no vendor-specific directories will be configured for perl.
5967
5968 EOM
5969 rp='Do you want to configure vendor-specific add-on directories?'
5970 case "$usevendorprefix" in
5971 define|true|[yY]*) dflt=y ;;
5972 *)      : User may have set vendorprefix directly on Configure command line.
5973         case "$vendorprefix" in
5974         ''|' ') dflt=n ;;
5975         *)      dflt=y ;;
5976         esac
5977         ;;
5978 esac
5979 . ./myread
5980 case "$ans" in
5981 [yY]*)  fn=d~+
5982         rp='Installation prefix to use for vendor-supplied add-ons?'
5983         case "$vendorprefix" in
5984         '') dflt='' ;;
5985         *)  dflt=$vendorprefix ;;
5986         esac
5987         . ./getfile
5988         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5989         oldvendorprefix=''
5990         case "$vendorprefix" in
5991         '') ;;
5992         *)      case "$ans" in
5993                 "$prefix") ;;
5994                 *) oldvendorprefix="$prefix";;
5995                 esac
5996                 ;;
5997         esac
5998         usevendorprefix="$define"
5999         vendorprefix="$ans"
6000         vendorprefixexp="$ansexp"
6001         ;;
6002 *)      usevendorprefix="$undef"
6003         vendorprefix=''
6004         vendorprefixexp=''
6005         ;;
6006 esac
6007
6008 case "$vendorprefix" in
6009 '')     d_vendorlib="$undef"
6010         vendorlib=''
6011         vendorlibexp=''
6012         ;;
6013 *)      d_vendorlib="$define"
6014         : determine where vendor-supplied modules go.
6015         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6016         case "$vendorlib" in
6017         '')
6018                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6019                 case "$installstyle" in
6020                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6021                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6022                 esac
6023                 ;;
6024         *)      dflt="$vendorlib"
6025                 ;;
6026         esac
6027         fn=d~+
6028         rp='Pathname for the vendor-supplied library files?'
6029         . ./getfile
6030         vendorlib="$ans"
6031         vendorlibexp="$ansexp"
6032         ;;
6033 esac
6034 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6035 : Change installation prefix, if necessary.
6036 if $test X"$prefix" != X"$installprefix"; then
6037         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6038 else
6039         installvendorlib="$vendorlibexp"
6040 fi
6041
6042 case "$vendorprefix" in
6043 '')     d_vendorarch="$undef"
6044         vendorarch=''
6045         vendorarchexp=''
6046         ;;
6047 *)      d_vendorarch="$define"
6048         : determine where vendor-supplied architecture-dependent libraries go.
6049         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6050         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6051         : vendorlib may have an optional trailing /share.
6052         case "$vendorarch" in
6053         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6054                 dflt="$dflt/$archname"
6055                 ;;
6056         *)      dflt="$vendorarch" ;;
6057         esac
6058         fn=d~+
6059         rp='Pathname for vendor-supplied architecture-dependent files?'
6060         . ./getfile
6061         vendorarch="$ans"
6062         vendorarchexp="$ansexp"
6063         ;;
6064 esac
6065 : Change installation prefix, if necessary.
6066 if $test X"$prefix" != X"$installprefix"; then
6067         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6068 else
6069         installvendorarch="$vendorarchexp"
6070 fi
6071
6072 : Final catch-all directories to search
6073 $cat <<EOM
6074
6075 Lastly, you can have perl look in other directories for extensions and
6076 modules in addition to those already specified.
6077 These directories will be searched after 
6078         $sitearch 
6079         $sitelib 
6080 EOM
6081 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6082 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6083 echo ' '
6084 case "$otherlibdirs" in
6085 ''|' ') dflt='none' ;;
6086 *)      dflt="$otherlibdirs" ;;
6087 esac
6088 $cat <<EOM
6089 Enter a colon-separated set of extra paths to include in perl's @INC
6090 search path, or enter 'none' for no extra paths.
6091
6092 EOM
6093
6094 rp='Colon-separated list of additional directories for perl to search?'
6095 . ./myread
6096 case "$ans" in
6097 ' '|''|none)    otherlibdirs=' ' ;;     
6098 *)      otherlibdirs="$ans" ;;
6099 esac
6100 case "$otherlibdirs" in
6101 ' ') val=$undef ;;
6102 *)      val=$define ;;
6103 esac
6104 set d_perl_otherlibdirs
6105 eval $setvar
6106
6107 : Cruising for prototypes
6108 echo " "
6109 echo "Checking out function prototypes..." >&4
6110 $cat >prototype.c <<'EOCP'
6111 int main(int argc, char *argv[]) {
6112         exit(0);}
6113 EOCP
6114 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6115         echo "Your C compiler appears to support function prototypes."
6116         val="$define"
6117 else
6118         echo "Your C compiler doesn't seem to understand function prototypes."
6119         val="$undef"
6120 fi
6121 set prototype
6122 eval $setvar
6123 $rm -f prototype*
6124
6125 case "$prototype" in
6126 "$define") ;;
6127 *)      ansi2knr='ansi2knr'
6128         echo " "
6129         cat <<EOM >&4
6130
6131 $me:  FATAL ERROR:
6132 This version of $package can only be compiled by a compiler that 
6133 understands function prototypes.  Unfortunately, your C compiler 
6134         $cc $ccflags
6135 doesn't seem to understand them.  Sorry about that.
6136
6137 If GNU cc is available for your system, perhaps you could try that instead.  
6138
6139 Eventually, we hope to support building Perl with pre-ANSI compilers.
6140 If you would like to help in that effort, please contact <perlbug@perl.org>.
6141
6142 Aborting Configure now.
6143 EOM
6144         exit 2
6145         ;;
6146 esac
6147
6148 : determine where public executables go
6149 echo " "
6150 set dflt bin bin
6151 eval $prefixit
6152 fn=d~
6153 rp='Pathname where the public executables will reside?'
6154 . ./getfile
6155 if $test "X$ansexp" != "X$binexp"; then
6156         installbin=''
6157 fi
6158 bin="$ans"
6159 binexp="$ansexp"
6160 : Change installation prefix, if necessary.
6161 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6162 if $test X"$prefix" != X"$installprefix"; then
6163         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6164 else
6165         installbin="$binexp"
6166 fi
6167
6168 : Find perl5.005 or later.
6169 echo "Looking for a previously installed perl5.005 or later... "
6170 case "$perl5" in
6171 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6172                 : Check if this perl is recent and can load a simple module
6173                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6174                         perl5=$tdir/perl
6175                         break;
6176                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6177                         perl5=$tdir/perl
6178                         break;
6179                 fi
6180         done
6181         ;;
6182 *)      perl5="$perl5"
6183         ;;
6184 esac
6185 case "$perl5" in
6186 '')     echo "None found.  That's ok.";;
6187 *)      echo "Using $perl5." ;;
6188 esac
6189
6190 : Determine list of previous versions to include in @INC
6191 $cat > getverlist <<EOPL
6192 #!$perl5 -w
6193 use File::Basename;
6194 \$api_versionstring = "$api_versionstring";
6195 \$version = "$version";
6196 \$stem = "$sitelib_stem";
6197 \$archname = "$archname";
6198 EOPL
6199         $cat >> getverlist <<'EOPL'
6200 # Can't have leading @ because metaconfig interprets it as a command!
6201 ;@inc_version_list=();
6202 # XXX Redo to do opendir/readdir? 
6203 if (-d $stem) {
6204     chdir($stem);
6205     ;@candidates = glob("5.*");
6206 }
6207 else {
6208     ;@candidates = ();
6209 }
6210
6211 # XXX ToDo:  These comparisons must be reworked when two-digit
6212 # subversions come along, so that 5.7.10 compares as greater than
6213 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6214 # widespread that we can use the built-in version vectors rather
6215 # than reinventing them here.  For 5.6.0, however, we must
6216 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6217 foreach $d (@candidates) {
6218     if ($d lt $version) {
6219         if ($d ge $api_versionstring) {
6220             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6221         }
6222         elsif ($d ge "5.005") {
6223             unshift(@inc_version_list, grep { -d } $d);
6224         }
6225     }
6226     else {
6227         # Skip newer version.  I.e. don't look in
6228         # 5.7.0 if we're installing 5.6.1.
6229     }
6230 }
6231
6232 if (@inc_version_list) {
6233     print join(' ', @inc_version_list);
6234 }
6235 else {
6236     # Blank space to preserve value for next Configure run.
6237     print " ";
6238 }
6239 EOPL
6240 chmod +x getverlist
6241 case "$inc_version_list" in
6242 '')     if test -x "$perl5"; then
6243                 dflt=`$perl5 getverlist`
6244         else
6245                 dflt='none'
6246         fi
6247         ;;
6248 $undef) dflt='none' ;;
6249 *)  dflt="$inc_version_list" ;;
6250 esac
6251 case "$dflt" in
6252 ''|' ') dflt=none ;;
6253 esac
6254 case "$dflt" in
6255 5.005) case "$bincompat5005" in
6256        $define|true|[yY]*) ;;
6257        *) dflt=none ;;
6258        esac
6259        ;;
6260 esac
6261 $cat <<'EOM'
6262
6263 In order to ease the process of upgrading, this version of perl 
6264 can be configured to use modules built and installed with earlier 
6265 versions of perl that were installed under $prefix.  Specify here
6266 the list of earlier versions that this version of perl should check.
6267 If Configure detected no earlier versions of perl installed under
6268 $prefix, then the list will be empty.  Answer 'none' to tell perl
6269 to not search earlier versions.
6270
6271 The default should almost always be sensible, so if you're not sure,
6272 just accept the default.
6273 EOM
6274
6275 rp='List of earlier versions to include in @INC?'
6276 . ./myread
6277 case "$ans" in
6278 [Nn]one|''|' ') inc_version_list=' ' ;;
6279 *) inc_version_list="$ans" ;;
6280 esac
6281 case "$inc_version_list" in
6282 ''|' ') 
6283         inc_version_list_init='0';;
6284 *)      inc_version_list_init=`echo $inc_version_list |
6285                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6286         ;;
6287 esac
6288 $rm -f getverlist
6289
6290 : determine whether to install perl also as /usr/bin/perl
6291
6292 echo " "
6293 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6294         $cat <<EOM
6295 Many scripts expect perl to be installed as /usr/bin/perl.
6296 I can install the perl you are about to compile also as /usr/bin/perl
6297 (in addition to $installbin/perl).
6298 EOM
6299         case "$installusrbinperl" in
6300         "$undef"|[nN]*) dflt='n';;
6301         *)              dflt='y';;
6302         esac
6303         rp="Do you want to install perl as /usr/bin/perl?"
6304         . ./myread
6305         case "$ans" in
6306         [yY]*)  val="$define";;
6307         *)      val="$undef" ;;
6308         esac
6309 else
6310         val="$undef"
6311 fi
6312 set installusrbinperl
6313 eval $setvar
6314
6315 : see if dld is available
6316 set dld.h i_dld
6317 eval $inhdr
6318
6319 : see if dlopen exists
6320 xxx_runnm="$runnm"
6321 runnm=false
6322 set dlopen d_dlopen
6323 eval $inlibc
6324 runnm="$xxx_runnm"
6325
6326 : determine which dynamic loading, if any, to compile in
6327 echo " "
6328 dldir="ext/DynaLoader"
6329 case "$usedl" in
6330 $define|y|true)
6331         dflt='y'
6332         usedl="$define"
6333         ;;
6334 $undef|n|false)
6335         dflt='n'
6336         usedl="$undef"
6337         ;;
6338 *) 
6339         dflt='n'
6340         case "$d_dlopen" in
6341             $define) dflt='y' ;;
6342         esac
6343         case "$i_dld" in
6344             $define) dflt='y' ;;
6345         esac
6346         : Does a dl_xxx.xs file exist for this operating system
6347         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6348         ;;
6349 esac
6350 rp="Do you wish to use dynamic loading?"
6351 . ./myread
6352 usedl="$ans"
6353 case "$ans" in
6354 y*) usedl="$define"
6355         case "$dlsrc" in
6356         '')
6357                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6358                         dflt="$dldir/dl_${osname}.xs"
6359                 elif $test "$d_dlopen" = "$define" ; then
6360                         dflt="$dldir/dl_dlopen.xs"
6361                 elif $test "$i_dld" = "$define" ; then
6362                         dflt="$dldir/dl_dld.xs"
6363                 else
6364                         dflt=''
6365                 fi
6366                 ;;
6367         *)      dflt="$dldir/$dlsrc"
6368                 ;;
6369         esac
6370     echo "The following dynamic loading files are available:"
6371         : Can not go over to $dldir because getfile has path hard-coded in.
6372         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6373         rp="Source file to use for dynamic loading"
6374         fn="fne"
6375         gfpth="$src"
6376         . ./getfile
6377         usedl="$define"
6378         : emulate basename
6379         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6380
6381         $cat << EOM
6382
6383 Some systems may require passing special flags to $cc -c to
6384 compile modules that will be used to create a shared library.
6385 To use no flags, say "none".
6386
6387 EOM
6388     case "$cccdlflags" in
6389     '') case "$gccversion" in
6390                 '') case "$osname" in
6391                         hpux)   dflt='+z' ;;
6392                         next)   dflt='none' ;;
6393                         irix*)  dflt='-KPIC' ;;
6394                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6395                         sunos)  dflt='-pic' ;;
6396                         *)      dflt='none' ;;
6397                     esac
6398                         ;;
6399                 *)  case "$osname" in
6400                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6401                         *)      dflt='-fpic' ;;
6402                     esac ;;
6403             esac ;;
6404         ' ') dflt='none' ;;
6405     *)  dflt="$cccdlflags" ;;
6406     esac
6407     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6408     . ./myread
6409     case "$ans" in
6410     none) cccdlflags=' ' ;;
6411     *) cccdlflags="$ans" ;;
6412     esac
6413
6414     cat << EOM
6415
6416 Some systems use ld to create libraries that can be dynamically loaded,
6417 while other systems (such as those using ELF) use $cc.
6418
6419 EOM
6420         case "$ld" in
6421         '')     $cat >try.c <<'EOM'
6422 /* Test for whether ELF binaries are produced */
6423 #include <fcntl.h>
6424 #include <stdlib.h>
6425 int main() {
6426         char b[4];
6427         int i = open("a.out",O_RDONLY);
6428         if(i == -1) 
6429                 exit(1); /* fail */
6430         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6431                 exit(0); /* succeed (yes, it's ELF) */
6432         else
6433                 exit(1); /* fail */
6434 }
6435 EOM
6436                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6437                         cat <<EOM
6438 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6439 EOM
6440                         dflt="$cc"
6441                 else
6442                         echo "I'll use ld to build dynamic libraries."
6443                         dflt='ld'
6444                 fi
6445                 rm -f try.c a.out
6446                 ;;
6447         *)      dflt="$ld"
6448                 ;;
6449         esac
6450
6451     rp="What command should be used to create dynamic libraries?"
6452     . ./myread
6453         ld="$ans"
6454
6455     cat << EOM
6456
6457 Some systems may require passing special flags to $ld to create a
6458 library that can be dynamically loaded.  If your ld flags include
6459 -L/other/path options to locate libraries outside your loader's normal
6460 search path, you may need to specify those -L options here as well.  To
6461 use no flags, say "none".
6462
6463 EOM
6464     case "$lddlflags" in
6465     '') case "$osname" in
6466                         beos) dflt='-nostart' ;;
6467                         hpux) dflt='-b';
6468                               case "$gccversion" in
6469                               '') dflt="$dflt +vnocompatwarnings" ;;
6470                               esac
6471                               ;;        
6472                         linux|irix*)    dflt='-shared' ;;
6473                         next)  dflt='none' ;;
6474                         solaris) dflt='-G' ;;
6475                         sunos) dflt='-assert nodefinitions' ;;
6476                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6477                 *)     dflt='none' ;;
6478                         esac
6479                         ;;
6480     *) dflt="$lddlflags" ;;
6481     esac
6482
6483         : Try to guess additional flags to pick up local libraries.
6484         : Be careful not to append to a plain 'none'
6485         case "$dflt" in
6486         none) dflt='' ;;
6487         esac
6488         for thisflag in $ldflags; do
6489                 case "$thisflag" in
6490                 -L*|-R*)
6491                         case " $dflt " in
6492                         *" $thisflag "*) ;;
6493                         *) dflt="$dflt $thisflag" ;;
6494                         esac
6495                         ;;
6496                 esac
6497         done
6498
6499         case "$dflt" in
6500         ''|' ') dflt='none' ;;
6501         esac
6502
6503     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6504     . ./myread
6505     case "$ans" in
6506     none) lddlflags=' ' ;;
6507     *) lddlflags="$ans" ;;
6508     esac
6509
6510         cat <<EOM
6511
6512 Some systems may require passing special flags to $cc to indicate that
6513 the resulting executable will use dynamic linking.  To use no flags,
6514 say "none".
6515
6516 EOM
6517     case "$ccdlflags" in
6518     '') case "$osname" in
6519                 hpux)   dflt='-Wl,-E' ;;
6520                 linux)  dflt='-rdynamic' ;;
6521                 next)   dflt='none' ;;
6522                 sunos)  dflt='none' ;;
6523                 *)      dflt='none' ;;
6524             esac ;;
6525     ' ')  dflt='none' ;;
6526     *)  dflt="$ccdlflags" ;;
6527     esac
6528     rp="Any special flags to pass to $cc to use dynamic linking?"
6529     . ./myread
6530     case "$ans" in
6531     none) ccdlflags=' ' ;;
6532     *) ccdlflags="$ans" ;;
6533     esac
6534     ;;
6535 *)  usedl="$undef"
6536         ld='ld'
6537     dlsrc='dl_none.xs'
6538     lddlflags=''
6539     ccdlflags=''
6540     ;;
6541 esac
6542
6543 also=''
6544 case "$usedl" in
6545 $undef)
6546         # No dynamic loading being used, so don't bother even to prompt.
6547         useshrplib='false'
6548         ;;
6549 *)      case "$useshrplib" in
6550         '')     case "$osname" in
6551                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6552                         dflt=y
6553                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6554                         ;;
6555                 next*)
6556                         case "$osvers" in
6557                         4*)     dflt=y
6558                                 also='Building a shared libperl is needed for MAB support.'
6559                                 ;;
6560                         *)      dflt=n
6561                                 ;;
6562                         esac
6563                         ;;
6564                 *)      dflt=n
6565                         ;;
6566                 esac
6567                 ;;
6568         $define|true|[Yy]*)
6569                 dflt=y
6570                 ;;
6571         *)      dflt=n
6572                 ;;
6573         esac
6574         $cat << EOM
6575
6576 The perl executable is normally obtained by linking perlmain.c with
6577 libperl${_a}, any static extensions (usually just DynaLoader), and
6578 any other libraries needed on this system (such as -lm, etc.).  Since
6579 your system supports dynamic loading, it is probably possible to build
6580 a shared libperl.$so.  If you will have more than one executable linked
6581 to libperl.$so, this will significantly reduce the size of each
6582 executable, but it may have a noticeable affect on performance.  The
6583 default is probably sensible for your system.
6584 $also
6585
6586 EOM
6587         rp="Build a shared libperl.$so (y/n)"
6588         . ./myread
6589         case "$ans" in
6590         true|$define|[Yy]*)
6591                 useshrplib='true'  ;;
6592         *)      useshrplib='false' ;;
6593         esac
6594         ;;
6595 esac
6596
6597 case "$useshrplib" in
6598 true)
6599         case "$libperl" in
6600         '')
6601                 # Figure out a good name for libperl.so.  Since it gets stored in
6602                 # a version-specific architecture-dependent library, the version
6603                 # number isn't really that important, except for making cc/ld happy.
6604                 #
6605                 # A name such as libperl.so.3.1
6606                 majmin="libperl.$so.$patchlevel.$subversion"
6607                 # A name such as libperl.so.301
6608                 majonly=`echo $patchlevel $subversion |
6609                         $awk '{printf "%d%02d", $1, $2}'`
6610                 majonly=libperl.$so.$majonly
6611                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6612                 # rely on figuring it out from the naming of libc.
6613                 case "${osname}${osvers}" in
6614                 next4*)
6615                         dflt=libperl.5.$so
6616                         # XXX How handle the --version stuff for MAB?
6617                         ;;
6618                 linux*)  # ld won't link with a bare -lperl otherwise.
6619                         dflt=libperl.$so
6620                         ;;
6621                 cygwin*) # include version
6622                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6623                         ;;
6624                 *)      # Try to guess based on whether libc has major.minor.
6625                         case "$libc" in
6626                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6627                         *libc.$so.[0-9]*) dflt=$majonly ;;
6628                         *)      dflt=libperl.$so ;;
6629                         esac
6630                         ;;
6631                 esac
6632                 ;;
6633         *)      dflt=$libperl
6634                 ;;
6635         esac
6636         cat << EOM
6637
6638 I need to select a good name for the shared libperl.  If your system uses
6639 library names with major and minor numbers, then you might want something
6640 like $majmin.  Alternatively, if your system uses a single version
6641 number for shared libraries, then you might want to use $majonly.
6642 Or, your system might be quite happy with a simple libperl.$so.
6643
6644 Since the shared libperl will get installed into a version-specific
6645 architecture-dependent directory, the version number of the shared perl
6646 library probably isn't important, so the default should be o.k.
6647
6648 EOM
6649         rp='What name do you want to give to the shared libperl?'
6650         . ./myread
6651         libperl=$ans
6652         echo "Ok, I'll use $libperl"
6653         ;;
6654 *)
6655         libperl="libperl${_a}"
6656         ;;
6657 esac
6658
6659 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6660 case "$shrpdir" in
6661 '') ;;
6662 *)      $cat >&4 <<EOM
6663 WARNING:  Use of the shrpdir variable for the installation location of
6664 the shared $libperl is not supported.  It was never documented and
6665 will not work in this version.  Let me (perlbug@perl.org)
6666 know of any problems this may cause.
6667
6668 EOM
6669         case "$shrpdir" in
6670         "$archlibexp/CORE")
6671                 $cat >&4 <<EOM
6672 But your current setting of $shrpdir is
6673 the default anyway, so it's harmless.
6674 EOM
6675                 ;;
6676         *)
6677                 $cat >&4 <<EOM
6678 Further, your current attempted setting of $shrpdir
6679 conflicts with the value of $archlibexp/CORE
6680 that installperl will use.
6681 EOM
6682                 ;;
6683         esac
6684         ;;
6685 esac
6686
6687 # How will the perl executable find the installed shared $libperl?
6688 # Add $xxx to ccdlflags.
6689 # If we can't figure out a command-line option, use $shrpenv to
6690 # set env LD_RUN_PATH.  The main perl makefile uses this.
6691 shrpdir=$archlibexp/CORE
6692 xxx=''
6693 tmp_shrpenv=''
6694 if "$useshrplib"; then
6695     case "$osname" in 
6696         aix)
6697                 # We'll set it in Makefile.SH...
6698                 ;;
6699         solaris|netbsd)
6700                 xxx="-R $shrpdir"
6701                 ;;
6702         freebsd)
6703                 xxx="-Wl,-R$shrpdir"
6704                 ;;
6705         linux|irix*|dec_osf)
6706                 xxx="-Wl,-rpath,$shrpdir"
6707                 ;;
6708         next)
6709                 # next doesn't like the default...
6710                 ;;
6711         beos)
6712                 # beos doesn't like the default, either.
6713                 ;;
6714         hpux*)
6715                 # hpux doesn't like the default, either.
6716                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6717                 ;;
6718         *)
6719                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6720                 ;;
6721         esac
6722         case "$xxx" in
6723         '') ;;
6724         *)      
6725                 # Only add $xxx if it isn't already in ccdlflags.
6726                 case " $ccdlflags " in
6727                 *" $xxx "*)     ;;
6728                 *)      ccdlflags="$ccdlflags $xxx"
6729                         cat <<EOM >&4
6730
6731 Adding $xxx to the flags
6732 passed to $ld so that the perl executable will find the 
6733 installed shared $libperl.
6734
6735 EOM
6736                         ;;
6737                 esac
6738                 ;;
6739         esac
6740 fi
6741 # Fix ccdlflags in AIX for building external extensions.
6742 # (For building Perl itself bare -bE:perl.exp is needed,
6743 #  Makefile.SH takes care of this.)
6744 case "$osname" in
6745 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6746 esac
6747 # Respect a hint or command-line value.
6748 case "$shrpenv" in
6749 '') shrpenv="$tmp_shrpenv" ;;
6750 esac
6751 case "$ldlibpthname" in
6752 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6753 none)   ldlibpthname='' ;;
6754 esac
6755
6756 : determine where manual pages are on this system
6757 echo " "
6758 case "$sysman" in
6759 '') 
6760         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6761         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6762         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6763         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6764         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6765         sysman=`./loc . /usr/man/man1 $syspath`
6766         ;;
6767 esac
6768 if $test -d "$sysman"; then
6769         echo "System manual is in $sysman." >&4
6770 else
6771         echo "Could not find manual pages in source form." >&4
6772 fi
6773
6774 : determine where manual pages go
6775 set man1dir man1dir none
6776 eval $prefixit
6777 $cat <<EOM
6778
6779 $spackage has manual pages available in source form.
6780 EOM
6781 case "$nroff" in
6782 nroff)
6783         echo "However, you don't have nroff, so they're probably useless to you."
6784         case "$man1dir" in
6785         '') man1dir="none";;
6786         esac;;
6787 esac
6788 echo "If you don't want the manual sources installed, answer 'none'."
6789 case "$man1dir" in
6790 ' ') dflt=none
6791         ;;
6792 '')
6793         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6794         lookpath="$lookpath $prefixexp/man/p_man/man1"
6795         lookpath="$lookpath $prefixexp/man/u_man/man1"
6796         lookpath="$lookpath $prefixexp/man/man.1"
6797         case "$sysman" in
6798         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6799         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6800         esac
6801         set dflt
6802         eval $prefixup
6803         ;;
6804 *)  dflt="$man1dir"
6805         ;;
6806 esac
6807 echo " "
6808 fn=dn+~
6809 rp="Where do the main $spackage manual pages (source) go?"
6810 . ./getfile
6811 if $test "X$man1direxp" != "X$ansexp"; then
6812         installman1dir=''
6813 fi
6814 man1dir="$ans"
6815 man1direxp="$ansexp"
6816 case "$man1dir" in
6817 '')     man1dir=' '
6818         installman1dir='';;
6819 esac
6820
6821 : Change installation prefix, if necessary.
6822 if $test X"$prefix" != X"$installprefix"; then
6823         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6824 else
6825         installman1dir="$man1direxp"
6826 fi
6827
6828 : What suffix to use on installed man pages
6829
6830 case "$man1dir" in
6831 ' ')
6832         man1ext='0'
6833         ;;
6834 *)
6835         rp="What suffix should be used for the main $spackage man pages?"
6836         case "$man1ext" in
6837         '')     case "$man1dir" in
6838                 *1)  dflt=1 ;;
6839                 *1p) dflt=1p ;;
6840                 *1pm) dflt=1pm ;;
6841                 *l) dflt=l;;
6842                 *n) dflt=n;;
6843                 *o) dflt=o;;
6844                 *p) dflt=p;;
6845                 *C) dflt=C;;
6846                 *L) dflt=L;;
6847                 *L1) dflt=L1;;
6848                 *) dflt=1;;
6849                 esac
6850                 ;;
6851         *)      dflt="$man1ext";;
6852         esac
6853         . ./myread
6854         man1ext="$ans"
6855         ;;
6856 esac
6857
6858 : see if we can have long filenames
6859 echo " "
6860 first=123456789abcdef
6861 $rm -f $first
6862 if (echo hi >$first) 2>/dev/null; then
6863         if $test -f 123456789abcde; then
6864                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6865                 val="$undef"
6866         else
6867                 echo 'You can have filenames longer than 14 characters.'>&4
6868                 val="$define"
6869         fi
6870 else
6871         $cat <<'EOM'
6872 You can't have filenames longer than 14 chars.
6873 You can't even think about them!
6874 EOM
6875         val="$undef"
6876 fi 
6877 set d_flexfnam
6878 eval $setvar
6879 $rm -rf 123456789abcde*
6880
6881 : determine where library module manual pages go
6882 set man3dir man3dir none
6883 eval $prefixit
6884 $cat <<EOM
6885
6886 $spackage has manual pages for many of the library modules.
6887 EOM
6888
6889 case "$nroff" in
6890 nroff)
6891         $cat <<'EOM'
6892 However, you don't have nroff, so they're probably useless to you.
6893 EOM
6894         case "$man3dir" in
6895         '') man3dir="none";;
6896         esac;;
6897 esac
6898
6899 case "$d_flexfnam" in
6900 undef)
6901         $cat <<'EOM'
6902 However, your system can't handle the long file names like File::Basename.3. 
6903 EOM
6904         case "$man3dir" in
6905         '') man3dir="none";;
6906         esac;;
6907 esac
6908
6909 echo "If you don't want the manual sources installed, answer 'none'."
6910 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6911 case "$man3dir" in
6912 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6913         if $test -d "$privlib/man/man3"; then
6914                 cat <<EOM >&4
6915
6916 WARNING:  Previous versions of perl installed man3 pages into
6917 $privlib/man/man3.  This version will suggest a 
6918 new default of $dflt.  
6919 EOM
6920                 tdflt=$dflt
6921                 dflt='n'
6922                 rp='Do you wish to preserve the old behavior?(y/n)'
6923                 . ./myread
6924                 case "$ans" in
6925                 y*) dflt="$privlib/man/man3" ;;
6926                 *)  dflt=$tdflt ;;
6927                 esac
6928     fi
6929         ;;
6930 *)      dflt="$man3dir" ;;
6931 esac
6932 case "$dflt" in
6933 ' ') dflt=none ;;
6934 esac
6935 echo " "
6936 fn=dn+~
6937 rp="Where do the $package library man pages (source) go?"
6938 . ./getfile
6939 man3dir="$ans"
6940 man3direxp="$ansexp"
6941 case "$man3dir" in
6942 '')     man3dir=' '
6943         installman3dir='';;
6944 esac
6945
6946 : Change installation prefix, if necessary.
6947 if $test X"$prefix" != X"$installprefix"; then
6948         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6949 else
6950         installman3dir="$man3direxp"
6951 fi
6952
6953 : What suffix to use on installed man pages
6954 case "$man3dir" in
6955 ' ')
6956         man3ext='0'
6957         ;;
6958 *)
6959         rp="What suffix should be used for the $package library man pages?"
6960         case "$man3ext" in
6961         '')     case "$man3dir" in
6962                 *3)  dflt=3 ;;
6963                 *3p) dflt=3p ;;
6964                 *3pm) dflt=3pm ;;
6965                 *l) dflt=l;;
6966                 *n) dflt=n;;
6967                 *o) dflt=o;;
6968                 *p) dflt=p;;
6969                 *C) dflt=C;;
6970                 *L) dflt=L;;
6971                 *L3) dflt=L3;;
6972                 *) dflt=3;;
6973                 esac
6974                 ;;
6975         *)      dflt="$man3ext";;
6976         esac
6977         . ./myread
6978         man3ext="$ans"
6979         ;;
6980 esac
6981
6982 : see if we have to deal with yellow pages, now NIS.
6983 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6984         if $test -f /usr/etc/nibindd; then
6985                 echo " "
6986                 echo "I'm fairly confident you're on a NeXT."
6987                 echo " "
6988                 rp='Do you get the hosts file via NetInfo?'
6989                 dflt=y
6990                 case "$hostcat" in
6991                 nidump*) ;;
6992                 '') ;;
6993                 *) dflt=n;;
6994                 esac
6995                 . ./myread
6996                 case "$ans" in
6997                 y*) hostcat='nidump hosts .';;
6998                 *)      case "$hostcat" in
6999                         nidump*) hostcat='';;
7000                         esac
7001                         ;;
7002                 esac
7003         fi
7004         case "$hostcat" in
7005         nidump*) ;;
7006         *)
7007                 case "$hostcat" in
7008                 *ypcat*) dflt=y;;
7009                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7010                                 dflt=y
7011                         else
7012                                 dflt=n
7013                         fi;;
7014                 *) dflt=n;;
7015                 esac
7016                 echo " "
7017                 rp='Are you getting the hosts file via yellow pages?'
7018                 . ./myread
7019                 case "$ans" in
7020                 y*) hostcat='ypcat hosts';;
7021                 *) hostcat='cat /etc/hosts';;
7022                 esac
7023                 ;;
7024         esac
7025 fi
7026 case "$hostcat" in
7027 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7028 esac
7029 case "$groupcat" in
7030 '') test -f /etc/group && groupcat='cat /etc/group';;
7031 esac
7032 case "$passcat" in
7033 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7034 esac
7035
7036 : now get the host name
7037 echo " "
7038 echo "Figuring out host name..." >&4
7039 case "$myhostname" in
7040 '') cont=true
7041         echo 'Maybe "hostname" will work...'
7042         if tans=`sh -c hostname 2>&1` ; then
7043                 myhostname=$tans
7044                 phostname=hostname
7045                 cont=''
7046         fi
7047         ;;
7048 *) cont='';;
7049 esac
7050 if $test "$cont"; then
7051         if ./xenix; then
7052                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7053                 if tans=`cat /etc/systemid 2>&1` ; then
7054                         myhostname=$tans
7055                         phostname='cat /etc/systemid'
7056                         echo "Whadyaknow.  Xenix always was a bit strange..."
7057                         cont=''
7058                 fi
7059         elif $test -r /etc/systemid; then
7060                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7061         fi
7062 fi
7063 if $test "$cont"; then
7064         echo 'No, maybe "uuname -l" will work...'
7065         if tans=`sh -c 'uuname -l' 2>&1` ; then
7066                 myhostname=$tans
7067                 phostname='uuname -l'
7068         else
7069                 echo 'Strange.  Maybe "uname -n" will work...'
7070                 if tans=`sh -c 'uname -n' 2>&1` ; then
7071                         myhostname=$tans
7072                         phostname='uname -n'
7073                 else
7074                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7075                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7076                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7077                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7078                         else
7079                                 case "$myhostname" in
7080                                 '') echo "Does this machine have an identity crisis or something?"
7081                                         phostname='';;
7082                                 *)
7083                                         echo "Well, you said $myhostname before..."
7084                                         phostname='echo $myhostname';;
7085                                 esac
7086                         fi
7087                 fi
7088         fi
7089 fi
7090 : you do not want to know about this
7091 set $myhostname
7092 myhostname=$1
7093
7094 : verify guess
7095 if $test "$myhostname" ; then
7096         dflt=y
7097         rp='Your host name appears to be "'$myhostname'".'" Right?"
7098         . ./myread
7099         case "$ans" in
7100         y*) ;;
7101         *) myhostname='';;
7102         esac
7103 fi
7104
7105 : bad guess or no guess
7106 while $test "X$myhostname" = X ; do
7107         dflt=''
7108         rp="Please type the (one word) name of your host:"
7109         . ./myread
7110         myhostname="$ans"
7111 done
7112
7113 : translate upper to lower if necessary
7114 case "$myhostname" in
7115 *[A-Z]*)
7116         echo "(Normalizing case in your host name)"
7117         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7118         ;;
7119 esac
7120
7121 case "$myhostname" in
7122 *.*)
7123         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7124         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7125         echo "(Trimming domain name from host name--host name is now $myhostname)"
7126         ;;
7127 *) case "$mydomain" in
7128         '')
7129                 {
7130                         test "X$hostcat" = "Xypcat hosts" &&
7131                         ypmatch "$myhostname" hosts 2>/dev/null |\
7132                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7133                         $test -s hosts
7134                 } || {
7135                         test "X$hostcat" != "X" &&
7136                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7137                                         /[       ]$myhostname[  . ]/p" > hosts
7138                 }
7139                 tmp_re="[       . ]"
7140                 if $test -f hosts; then
7141                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7142                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7143                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7144                                 hosts | $sort | $uniq | \
7145                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7146                         case `$echo X$dflt` in
7147                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7148                                 dflt=.
7149                                 ;;
7150                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7151                                 ;;
7152                         esac
7153                 else
7154                         echo "(I cannot locate a hosts database anywhere)"
7155                         dflt=.
7156                 fi
7157                 case "$dflt" in
7158                 .)
7159                         tans=`./loc resolv.conf X /etc /usr/etc`
7160                         if $test -f "$tans"; then
7161                                 echo "(Attempting domain name extraction from $tans)"
7162                                 dflt=.`$sed -n -e 's/   / /g' \
7163                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7164                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7165                                 case "$dflt" in
7166                                 .) dflt=.`$sed -n -e 's/        / /g' \
7167                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7168                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7169                                         ;;
7170                                 esac
7171                         fi
7172                         ;;
7173                 esac
7174                 case "$dflt" in
7175                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7176                         dflt=.`sh -c domainname 2>/dev/null`
7177                         case "$dflt" in
7178                         '') dflt='.';;
7179                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7180                         esac
7181                         ;;
7182                 esac
7183                 case "$dflt" in
7184                 .) echo "(Lost all hope -- silly guess then)"
7185                         dflt='.uucp'
7186                         ;;
7187                 esac
7188                 $rm -f hosts
7189                 ;;
7190         *) dflt="$mydomain";;
7191         esac;;
7192 esac
7193 echo " "
7194 rp="What is your domain name?"
7195 . ./myread
7196 tans="$ans"
7197 case "$ans" in
7198 '') ;;
7199 .*) ;;
7200 *) tans=".$tans";;
7201 esac
7202 mydomain="$tans"
7203
7204 : translate upper to lower if necessary
7205 case "$mydomain" in
7206 *[A-Z]*)
7207         echo "(Normalizing case in your domain name)"
7208         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7209         ;;
7210 esac
7211
7212 : a little sanity check here
7213 case "$phostname" in
7214 '') ;;
7215 *)
7216         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7217         $myhostname$mydomain|$myhostname) ;;
7218         *)
7219                 case "$phostname" in
7220                 sed*)
7221                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7222                         ;;
7223                 *)
7224                         echo "(That doesn't agree with your $phostname command, by the way.)"
7225                         ;;
7226                 esac
7227         ;;
7228         esac
7229         ;;
7230 esac
7231
7232 $cat <<EOM
7233
7234 I need to get your e-mail address in Internet format if possible, i.e.
7235 something like user@host.domain. Please answer accurately since I have
7236 no easy means to double check it. The default value provided below
7237 is most probably close to reality but may not be valid from outside
7238 your organization...
7239
7240 EOM
7241 cont=x
7242 while test "$cont"; do
7243         case "$cf_email" in
7244         '') dflt="$cf_by@$myhostname$mydomain";;
7245         *) dflt="$cf_email";;
7246         esac
7247         rp='What is your e-mail address?'
7248         . ./myread
7249         cf_email="$ans"
7250         case "$cf_email" in
7251         *@*.*) cont='' ;;
7252         *)
7253                 rp='Address does not look like an Internet one.  Use it anyway?'
7254                 case "$fastread" in
7255                 yes) dflt=y ;;
7256                 *) dflt=n ;;
7257                 esac
7258                 . ./myread
7259                 case "$ans" in
7260                 y*) cont='' ;;
7261                 *) echo " " ;;
7262                 esac
7263                 ;;
7264         esac
7265 done
7266
7267 $cat <<EOM
7268
7269 If you or somebody else will be maintaining perl at your site, please
7270 fill in the correct e-mail address here so that they may be contacted
7271 if necessary. Currently, the "perlbug" program included with perl
7272 will send mail to this address in addition to perlbug@perl.org. You may
7273 enter "none" for no administrator.
7274
7275 EOM
7276 case "$perladmin" in
7277 '') dflt="$cf_email";;
7278 *) dflt="$perladmin";;
7279 esac
7280 rp='Perl administrator e-mail address'
7281 . ./myread
7282 perladmin="$ans"
7283
7284 : determine whether to only install version-specific parts.
7285 echo " "
7286 $cat <<EOM
7287 Do you want to install only the version-specific parts of the perl
7288 distribution?  Usually you do *not* want to do this.
7289 EOM
7290 case "$versiononly" in
7291 "$define"|[Yy]*|true) dflt='y' ;;
7292 *) dflt='n';
7293 esac
7294 rp="Do you want to install only the version-specific parts of perl?"
7295 . ./myread
7296 case "$ans" in
7297 [yY]*)  val="$define";;
7298 *)      val="$undef" ;;
7299 esac
7300 set versiononly
7301 eval $setvar
7302
7303 : figure out how to guarantee perl startup
7304 case "$startperl" in
7305 '')
7306         case "$sharpbang" in
7307         *!)
7308                 $cat <<EOH
7309
7310 I can use the #! construct to start perl on your system. This will
7311 make startup of perl scripts faster, but may cause problems if you
7312 want to share those scripts and perl is not in a standard place
7313 ($binexp/perl) on all your platforms. The alternative is to force
7314 a shell by starting the script with a single ':' character.
7315
7316 EOH
7317                 case "$versiononly" in
7318                 "$define")      dflt="$binexp/perl$version";;  
7319                 *)              dflt="$binexp/perl";;
7320                 esac
7321                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7322                 . ./myread
7323                 case "$ans" in
7324                 none)   startperl=": # use perl";;
7325                 *)      startperl="#!$ans"
7326                         if $test 30 -lt `echo "$ans" | wc -c`; then
7327                                 $cat >&4 <<EOM
7328
7329 WARNING:  Some systems limit the #! command to 32 characters.
7330 If you experience difficulty running Perl scripts with #!, try
7331 installing Perl in a directory with a shorter pathname.
7332
7333 EOM
7334                         fi ;;
7335                 esac
7336                 ;;
7337         *) startperl=": # use perl"
7338                 ;;
7339         esac
7340         ;;
7341 esac
7342 echo "I'll use $startperl to start perl scripts."
7343
7344 : figure best path for perl in scripts
7345 case "$perlpath" in
7346 '')
7347         perlpath="$binexp/perl"
7348         case "$startperl" in
7349         *!*) ;;
7350         *)
7351                 $cat <<EOH
7352
7353 I will use the "eval 'exec'" idiom to start Perl on your system.
7354 I can use the full path of your Perl binary for this purpose, but
7355 doing so may cause problems if you want to share those scripts and
7356 Perl is not always in a standard place ($binexp/perl).
7357
7358 EOH
7359                 dflt="$binexp/perl"
7360                 rp="What path shall I use in \"eval 'exec'\"?"
7361                 . ./myread
7362                 perlpath="$ans"
7363                 ;;
7364         esac
7365         ;;
7366 esac
7367 case "$startperl" in
7368 *!*)    ;;
7369 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7370 esac
7371
7372 : determine where public executable scripts go
7373 set scriptdir scriptdir
7374 eval $prefixit
7375 case "$scriptdir" in
7376 '')
7377         dflt="$bin"
7378         : guess some guesses
7379         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7380         $test -d /usr/share/bin     && dflt=/usr/share/bin
7381         $test -d /usr/local/script  && dflt=/usr/local/script
7382         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7383         $test -d $prefixexp/script  && dflt=$prefixexp/script
7384         set dflt
7385         eval $prefixup
7386         ;;
7387 *)  dflt="$scriptdir"
7388         ;;
7389 esac
7390 $cat <<EOM
7391  
7392 Some installations have a separate directory just for executable scripts so
7393 that they can mount it across multiple architectures but keep the scripts in
7394 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7395 Or you might just lump your scripts in with all your other executables.
7396  
7397 EOM
7398 fn=d~
7399 rp='Where do you keep publicly executable scripts?'
7400 . ./getfile
7401 if $test "X$ansexp" != "X$scriptdirexp"; then
7402         installscript=''
7403 fi
7404 scriptdir="$ans"
7405 scriptdirexp="$ansexp"
7406 : Change installation prefix, if necessary.
7407 if $test X"$prefix" != X"$installprefix"; then
7408         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7409 else
7410         installscript="$scriptdirexp"
7411 fi
7412
7413 : determine where add-on public executables go
7414 case "$sitebin" in
7415 '')     dflt=$siteprefix/bin ;;
7416 *)      dflt=$sitebin ;;
7417 esac
7418 fn=d~
7419 rp='Pathname where the add-on public executables should be installed?'
7420 . ./getfile
7421 sitebin="$ans"
7422 sitebinexp="$ansexp"
7423 : Change installation prefix, if necessary.
7424 if $test X"$prefix" != X"$installprefix"; then
7425         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7426 else
7427         installsitebin="$sitebinexp"
7428 fi
7429
7430 case "$useperlio" in
7431 $define|true|[yY]*)     dflt='y';;
7432 *) dflt='n';;
7433 esac
7434 cat <<EOM
7435
7436 Previous version of $package used the standard IO mechanisms as
7437 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7438 alternate IO mechanisms via the PerlIO abstraction layer, but the
7439 stdio mechanism is still the default.  This abstraction layer can
7440 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7441 Using PerlIO with sfio may cause problems with some extension modules.
7442
7443 If this doesn't make any sense to you, just accept the default '$dflt'.
7444 EOM
7445 rp='Use the experimental PerlIO abstraction layer?'
7446 . ./myread
7447 case "$ans" in
7448 y|Y) 
7449         val="$define"
7450         ;;     
7451 *)      
7452         echo "Ok, doing things the stdio way."
7453         val="$undef"
7454         ;;
7455 esac
7456 set useperlio
7457 eval $setvar 
7458
7459 case "$usesocks" in
7460 $define|true|[yY]*)
7461         case "$useperlio" in
7462         $define|true|[yY]*) ;;
7463         *)      cat >&4 <<EOM
7464
7465 You are using the SOCKS proxy protocol library which means that you
7466 should also use the PerlIO layer.  You may be headed for trouble.
7467
7468 EOM
7469                 ;;
7470         esac
7471         ;;
7472 esac
7473
7474         
7475 case "$vendorprefix" in
7476 '')     d_vendorbin="$undef"
7477         vendorbin=''
7478         vendorbinexp=''
7479         ;;
7480 *)      d_vendorbin="$define"
7481         : determine where vendor-supplied executables go.
7482         case "$vendorbin" in
7483         '') dflt=$vendorprefix/bin ;;
7484         *)      dflt="$vendorbin" ;;
7485         esac
7486         fn=d~+
7487         rp='Pathname for the vendor-supplied executables directory?'
7488         . ./getfile
7489         vendorbin="$ans"
7490         vendorbinexp="$ansexp"
7491         ;;
7492 esac
7493 : Change installation prefix, if necessary.
7494 if $test X"$prefix" != X"$installprefix"; then
7495         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7496 else
7497         installvendorbin="$vendorbinexp"
7498 fi
7499
7500 : see if qgcvt exists
7501 set qgcvt d_qgcvt
7502 eval $inlibc
7503
7504 echo " "
7505
7506 if $test X"$d_longdbl" = X"$define"; then
7507
7508 echo "Checking how to print long doubles..." >&4
7509
7510 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7511         $cat >try.c <<'EOCP'
7512 #include <sys/types.h>
7513 #include <stdio.h>
7514 int main() {
7515   double d = 123.456;
7516   printf("%.3f\n", d);
7517 }
7518 EOCP
7519         set try
7520         if eval $compile; then
7521                 yyy=`./try$exe_ext`
7522                 case "$yyy" in
7523                 123.456)
7524                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7525                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7526                         echo "We will use %f."
7527                         ;;
7528                 esac
7529         fi
7530 fi
7531
7532 if $test X"$sPRIfldbl" = X; then
7533         $cat >try.c <<'EOCP'
7534 #include <sys/types.h>
7535 #include <stdio.h>
7536 int main() {
7537   long double d = 123.456;
7538   printf("%.3llf\n", d);
7539 }
7540 EOCP
7541         set try
7542         if eval $compile; then
7543                 yyy=`./try$exe_ext`
7544                 case "$yyy" in
7545                 123.456)
7546                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7547                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7548                         echo "We will use %llf."
7549                         ;;
7550                 esac
7551         fi
7552 fi
7553
7554 if $test X"$sPRIfldbl" = X; then
7555         $cat >try.c <<'EOCP'
7556 #include <sys/types.h>
7557 #include <stdio.h>
7558 int main() {
7559   long double d = 123.456;
7560   printf("%.3Lf\n", d);
7561 }
7562 EOCP
7563         set try
7564         if eval $compile; then
7565                 yyy=`./try$exe_ext`
7566                 case "$yyy" in
7567                 123.456)
7568                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7569                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7570                         echo "We will use %Lf."
7571                         ;;
7572                 esac
7573         fi
7574 fi
7575
7576 if $test X"$sPRIfldbl" = X; then
7577         $cat >try.c <<'EOCP'
7578 #include <sys/types.h>
7579 #include <stdio.h>
7580 int main() {
7581   long double d = 123.456;
7582   printf("%.3lf\n", d);
7583 }
7584 EOCP
7585         set try
7586         if eval $compile; then
7587                 yyy=`./try$exe_ext`
7588                 case "$yyy" in
7589                 123.456)
7590                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7591                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7592                         echo "We will use %lf."
7593                         ;;
7594                 esac
7595         fi
7596 fi
7597
7598 if $test X"$sPRIfldbl" = X; then
7599         echo "Cannot figure out how to print long doubles." >&4
7600 else
7601         sSCNfldbl=$sPRIfldbl    # expect consistency
7602 fi
7603
7604 $rm -f try try.*
7605
7606 fi # d_longdbl
7607
7608 case "$sPRIfldbl" in
7609 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7610         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7611         d_SCNfldbl="$undef";
7612         ;;
7613 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7614         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7615         d_SCNfldbl="$define";
7616         ;;
7617 esac
7618
7619 : Check how to convert floats to strings.
7620 echo " "
7621 echo "Checking for an efficient way to convert floats to strings."
7622 echo " " > try.c
7623 case "$uselongdouble" in
7624 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7625 esac
7626 case "$d_longdbl" in
7627 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7628 esac
7629 case "$d_PRIgldbl" in
7630 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7631 esac
7632 $cat >>try.c <<EOP
7633 #ifdef TRY_gconvert
7634 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7635 char *myname = "gconvert";
7636 #endif
7637 #ifdef TRY_gcvt
7638 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7639 char *myname = "gcvt";
7640 #endif
7641 #ifdef TRY_qgcvt
7642 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7643 char *myname = "qgcvt";
7644 #define DOUBLETYPE long double
7645 #endif
7646 #ifdef TRY_sprintf
7647 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7648 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7649 #else
7650 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7651 #endif
7652 char *myname = "sprintf";
7653 #endif
7654
7655 #ifndef DOUBLETYPE
7656 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7657 #define DOUBLETYPE long double
7658 #else
7659 #define DOUBLETYPE double
7660 #endif
7661 #endif
7662
7663 #include <stdio.h>
7664
7665 #define I_STDLIB $i_stdlib
7666 #ifdef I_STDLIB
7667 #include <stdlib.h>
7668 #endif
7669
7670 int
7671 checkit(expect, got)
7672 char *expect;
7673 char *got;
7674 {
7675     if (strcmp(expect, got)) {
7676                 printf("%s oddity:  Expected %s, got %s\n",
7677                         myname, expect, got);
7678                 exit(1);
7679         }
7680 }
7681
7682 int main()
7683
7684         char buf[64]; 
7685         buf[63] = '\0';
7686
7687         /* This must be 1st test on (which?) platform */
7688         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7689         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7690         checkit("0.1", buf);
7691
7692         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7693         checkit("1", buf);
7694
7695         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7696         checkit("1.1", buf);
7697
7698         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7699         checkit("1.01", buf);
7700
7701         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7702         checkit("1.001", buf);
7703
7704         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7705         checkit("1.0001", buf);
7706
7707         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7708         checkit("1.00001", buf);
7709
7710         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7711         checkit("1.000001", buf);
7712
7713         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7714         checkit("0", buf);
7715
7716         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7717         checkit("-1", buf);
7718
7719         /* Some Linux gcvt's give 1.e+5 here. */
7720         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7721         checkit("100000", buf);
7722         
7723         /* Some Linux gcvt's give -1.e+5 here. */
7724         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7725         checkit("-100000", buf);
7726
7727         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7728         checkit("123.456", buf);
7729
7730         exit(0);
7731 }
7732 EOP
7733 case "$d_Gconvert" in
7734 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7735 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7736 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7737 *) xxx_list='gconvert gcvt sprintf' ;;
7738 esac
7739
7740 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7741 "$define$define$define")
7742     # for long doubles prefer first qgcvt, then sprintf
7743     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7744     xxx_list="sprintf $xxx_list"
7745     case "$d_qgcvt" in
7746     "$define") xxx_list="qgcvt $xxx_list" ;;
7747     esac
7748     ;;
7749 esac
7750
7751 for xxx_convert in $xxx_list; do
7752         echo "Trying $xxx_convert..."
7753         $rm -f try try$_o
7754         set try -DTRY_$xxx_convert
7755         if eval $compile; then
7756                 echo "$xxx_convert() found." >&4
7757                 if ./try; then
7758                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7759                         break;
7760                 else
7761                         echo "...But $xxx_convert didn't work as I expected."
7762                 fi
7763         else
7764                 echo "$xxx_convert NOT found." >&4
7765         fi
7766 done
7767         
7768 case "$xxx_convert" in
7769 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7770 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7771 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7772 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7773    "$define$define$define")
7774       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7775    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7776    esac
7777    ;;  
7778 esac
7779
7780 : see if _fwalk exists
7781 set fwalk d__fwalk
7782 eval $inlibc
7783
7784 : Initialize h_fcntl
7785 h_fcntl=false
7786
7787 : Initialize h_sysfile
7788 h_sysfile=false
7789
7790 : access call always available on UNIX
7791 set access d_access
7792 eval $inlibc
7793
7794 : locate the flags for 'access()'
7795 case "$d_access" in
7796 "$define")
7797         echo " "
7798         $cat >access.c <<'EOCP'
7799 #include <sys/types.h>
7800 #ifdef I_FCNTL
7801 #include <fcntl.h>
7802 #endif
7803 #ifdef I_SYS_FILE
7804 #include <sys/file.h>
7805 #endif
7806 #ifdef I_UNISTD
7807 #include <unistd.h>
7808 #endif
7809 int main() {
7810         exit(R_OK);
7811 }
7812 EOCP
7813         : check sys/file.h first, no particular reason here
7814         if $test `./findhdr sys/file.h` && \
7815                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7816                 h_sysfile=true;
7817                 echo "<sys/file.h> defines the *_OK access constants." >&4
7818         elif $test `./findhdr fcntl.h` && \
7819                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7820                 h_fcntl=true;
7821                 echo "<fcntl.h> defines the *_OK access constants." >&4
7822         elif $test `./findhdr unistd.h` && \
7823                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7824                 echo "<unistd.h> defines the *_OK access constants." >&4
7825         else
7826                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7827         fi
7828         ;;
7829 esac
7830 $rm -f access*
7831
7832 : see if accessx exists
7833 set accessx d_accessx
7834 eval $inlibc
7835
7836 : see if alarm exists
7837 set alarm d_alarm
7838 eval $inlibc
7839
7840 : see if atolf exists
7841 set atolf d_atolf
7842 eval $inlibc
7843
7844 : see if atoll exists
7845 set atoll d_atoll
7846 eval $inlibc
7847
7848 : Look for GNU-cc style attribute checking
7849 echo " "
7850 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7851 $cat >attrib.c <<'EOCP'
7852 #include <stdio.h>
7853 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7854 EOCP
7855 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7856         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7857                 echo "Your C compiler doesn't fully support __attribute__."
7858                 val="$undef"
7859         else
7860                 echo "Your C compiler supports __attribute__."
7861                 val="$define"
7862         fi
7863 else
7864         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7865         val="$undef"
7866 fi
7867 set d_attribut
7868 eval $setvar
7869 $rm -f attrib*
7870
7871 : see if bcmp exists
7872 set bcmp d_bcmp
7873 eval $inlibc
7874
7875 : see if bcopy exists
7876 set bcopy d_bcopy
7877 eval $inlibc
7878
7879 : see if this is a unistd.h system
7880 set unistd.h i_unistd
7881 eval $inhdr
7882
7883 : see if getpgrp exists
7884 set getpgrp d_getpgrp
7885 eval $inlibc
7886
7887 case "$d_getpgrp" in
7888 "$define")
7889         echo " "
7890         echo "Checking to see which flavor of getpgrp is in use..."
7891         $cat >set.c <<EOP
7892 #$i_unistd I_UNISTD
7893 #include <sys/types.h>
7894 #ifdef I_UNISTD
7895 #  include <unistd.h>
7896 #endif
7897 int main()
7898 {
7899         if (getuid() == 0) {
7900                 printf("(I see you are running Configure as super-user...)\n");
7901                 setuid(1);
7902         }
7903 #ifdef TRY_BSD_PGRP
7904         if (getpgrp(1) == 0)
7905                 exit(0);
7906 #else
7907         if (getpgrp() > 0)
7908                 exit(0);
7909 #endif
7910         exit(1);
7911 }
7912 EOP
7913         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7914                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7915                 val="$define"
7916         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7917                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7918                 val="$undef"
7919         else
7920                 echo "I can't seem to compile and run the test program."
7921                 if ./usg; then
7922                         xxx="a USG one, i.e. you use getpgrp()."
7923                 else
7924                         # SVR4 systems can appear rather BSD-ish.
7925                         case "$i_unistd" in
7926                         $undef)
7927                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7928                                 val="$define"
7929                                 ;;
7930                         $define)
7931                                 xxx="probably a USG one, i.e. you use getpgrp()."
7932                                 val="$undef"
7933                                 ;;
7934                         esac
7935                 fi
7936                 echo "Assuming your getpgrp is $xxx" >&4
7937         fi
7938         ;;
7939 *) val="$undef";;
7940 esac
7941 set d_bsdgetpgrp
7942 eval $setvar
7943 $rm -f set set.c
7944
7945 : see if setpgrp exists
7946 set setpgrp d_setpgrp
7947 eval $inlibc
7948
7949 case "$d_setpgrp" in
7950 "$define")
7951         echo " "
7952         echo "Checking to see which flavor of setpgrp is in use..."
7953         $cat >set.c <<EOP
7954 #$i_unistd I_UNISTD
7955 #include <sys/types.h>
7956 #ifdef I_UNISTD
7957 #  include <unistd.h>
7958 #endif
7959 int main()
7960 {
7961         if (getuid() == 0) {
7962                 printf("(I see you are running Configure as super-user...)\n");
7963                 setuid(1);
7964         }
7965 #ifdef TRY_BSD_PGRP
7966         if (-1 == setpgrp(1, 1))
7967                 exit(0);
7968 #else
7969         if (setpgrp() != -1)
7970                 exit(0);
7971 #endif
7972         exit(1);
7973 }
7974 EOP
7975         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7976                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7977                 val="$define"
7978         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7979                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7980                 val="$undef"
7981         else
7982                 echo "(I can't seem to compile and run the test program.)"
7983                 if ./usg; then
7984                         xxx="a USG one, i.e. you use setpgrp()."
7985                 else
7986                         # SVR4 systems can appear rather BSD-ish.
7987                         case "$i_unistd" in
7988                         $undef)
7989                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7990                                 val="$define"
7991                                 ;;
7992                         $define)
7993                                 xxx="probably a USG one, i.e. you use setpgrp()."
7994                                 val="$undef"
7995                                 ;;
7996                         esac
7997                 fi
7998                 echo "Assuming your setpgrp is $xxx" >&4
7999         fi
8000         ;;
8001 *) val="$undef";;
8002 esac
8003 set d_bsdsetpgrp
8004 eval $setvar
8005 $rm -f set set.c
8006 : see if bzero exists
8007 set bzero d_bzero
8008 eval $inlibc
8009
8010 : see if signal is declared as pointer to function returning int or void
8011 echo " "
8012 xxx=`./findhdr signal.h`
8013 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8014 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8015         echo "You have int (*signal())() instead of void." >&4
8016         val="$undef"
8017 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8018         echo "You have void (*signal())()." >&4
8019         val="$define"
8020 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8021         echo "You have int (*signal())() instead of void." >&4
8022         val="$undef"
8023 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8024         echo "You have void (*signal())()." >&4
8025         val="$define"
8026 else
8027         case "$d_voidsig" in
8028         '')
8029         echo "I can't determine whether signal handler returns void or int..." >&4
8030                 dflt=void
8031                 rp="What type does your signal handler return?"
8032                 . ./myread
8033                 case "$ans" in
8034                 v*) val="$define";;
8035                 *) val="$undef";;
8036                 esac;;
8037         "$define")
8038                 echo "As you already told me, signal handler returns void." >&4
8039                 val="$define"
8040                 ;;
8041         *)      echo "As you already told me, signal handler returns int." >&4
8042                 val="$undef"
8043                 ;;
8044         esac
8045 fi
8046 set d_voidsig
8047 eval $setvar
8048 case "$d_voidsig" in
8049 "$define") signal_t="void";;
8050 *) signal_t="int";;
8051 esac
8052 $rm -f $$.tmp
8053
8054 : check for ability to cast large floats to 32-bit ints.
8055 echo " "
8056 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8057 if $test "$intsize" -ge 4; then
8058         xxx=int
8059 else
8060         xxx=long
8061 fi
8062 $cat >try.c <<EOCP
8063 #include <stdio.h>
8064 #include <sys/types.h>
8065 #include <signal.h>
8066 $signal_t blech(s) int s; { exit(3); }
8067 int main()
8068 {
8069         $xxx i32;
8070         double f, g;
8071         int result = 0;
8072         char str[16];
8073         signal(SIGFPE, blech);
8074
8075         /* Don't let compiler optimize the test away.  Store the number 
8076            in a writable string for gcc to pass to sscanf under HP/UX.
8077         */
8078         sprintf(str, "2147483647");
8079         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8080         g = 10 * f;
8081         i32  = ($xxx) g;
8082
8083         /* x86 processors will probably give 0x8000 0000, which is a
8084        sign change.  We don't want that.  We want to mimic SPARC
8085            behavior here, which is to preserve the sign and give
8086            back 0x7fff ffff.
8087         */
8088         if (i32 != ($xxx) f)
8089                 result |= 1;
8090         exit(result);
8091 }
8092 EOCP
8093 set try
8094 if eval $compile_ok; then
8095         ./try
8096         yyy=$?
8097 else
8098         echo "(I can't seem to compile the test program--assuming it can't)"
8099         yyy=1
8100 fi
8101 case "$yyy" in
8102 0)      val="$define"
8103         echo "Yup, it can."
8104         ;;
8105 *)      val="$undef"
8106         echo "Nope, it can't."
8107         ;;
8108 esac
8109 set d_casti32
8110 eval $setvar
8111 $rm -f try try.*
8112
8113 : check for ability to cast negative floats to unsigned
8114 echo " "
8115 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8116 $cat >try.c <<EOCP
8117 #include <stdio.h>
8118 #include <sys/types.h>
8119 #include <signal.h>
8120 $signal_t blech(s) int s; { exit(7); }
8121 $signal_t blech_in_list(s) int s; { exit(4); }
8122 unsigned long dummy_long(p) unsigned long p; { return p; }
8123 unsigned int dummy_int(p) unsigned int p; { return p; }
8124 unsigned short dummy_short(p) unsigned short p; { return p; }
8125 int main()
8126 {
8127         double f;
8128         unsigned long along;
8129         unsigned int aint;
8130         unsigned short ashort;
8131         int result = 0;
8132         char str[16];
8133         
8134         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8135            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8136            optimized the whole file away
8137         */
8138         /* Store the number in a writable string for gcc to pass to 
8139            sscanf under HP/UX.
8140         */
8141         sprintf(str, "-123");
8142         sscanf(str, "%lf", &f);  /* f = -123.; */
8143
8144         signal(SIGFPE, blech);
8145         along = (unsigned long)f;
8146         aint = (unsigned int)f;
8147         ashort = (unsigned short)f;
8148         if (along != (unsigned long)-123)
8149                 result |= 1;
8150         if (aint != (unsigned int)-123)
8151                 result |= 1;
8152         if (ashort != (unsigned short)-123)
8153                 result |= 1;
8154         sprintf(str, "1073741824.");
8155         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8156         f = f + f;
8157         along = 0;
8158         along = (unsigned long)f;
8159         if (along != 0x80000000)
8160                 result |= 2;
8161         f -= 1.;
8162         along = 0;
8163         along = (unsigned long)f;
8164         if (along != 0x7fffffff)
8165                 result |= 1;
8166         f += 2.;
8167         along = 0;
8168         along = (unsigned long)f;
8169         if (along != 0x80000001)
8170                 result |= 2;
8171         if (result)
8172                 exit(result);
8173         signal(SIGFPE, blech_in_list);
8174         sprintf(str, "123.");
8175         sscanf(str, "%lf", &f);  /* f = 123.; */
8176         along = dummy_long((unsigned long)f);
8177         aint = dummy_int((unsigned int)f);
8178         ashort = dummy_short((unsigned short)f);
8179         if (along != (unsigned long)123)
8180                 result |= 4;
8181         if (aint != (unsigned int)123)
8182                 result |= 4;
8183         if (ashort != (unsigned short)123)
8184                 result |= 4;
8185         exit(result);
8186
8187 }
8188 EOCP
8189 set try
8190 if eval $compile_ok; then
8191         ./try
8192         castflags=$?
8193 else
8194         echo "(I can't seem to compile the test program--assuming it can't)"
8195         castflags=7
8196 fi
8197 case "$castflags" in
8198 0)      val="$define"
8199         echo "Yup, it can."
8200         ;;
8201 *)      val="$undef"
8202         echo "Nope, it can't."
8203         ;;
8204 esac
8205 set d_castneg
8206 eval $setvar
8207 $rm -f try.*
8208
8209 : see if vprintf exists
8210 echo " "
8211 if set vprintf val -f d_vprintf; eval $csym; $val; then
8212         echo 'vprintf() found.' >&4
8213         val="$define"
8214         $cat >vprintf.c <<'EOF'
8215 #include <varargs.h>
8216
8217 int main() { xxx("foo"); }
8218
8219 xxx(va_alist)
8220 va_dcl
8221 {
8222         va_list args;
8223         char buf[10];
8224
8225         va_start(args);
8226         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8227 }
8228 EOF
8229         set vprintf
8230         if eval $compile && ./vprintf; then
8231                 echo "Your vsprintf() returns (int)." >&4
8232                 val2="$undef"
8233         else
8234                 echo "Your vsprintf() returns (char*)." >&4
8235                 val2="$define"
8236         fi
8237 else
8238         echo 'vprintf() NOT found.' >&4
8239                 val="$undef"
8240                 val2="$undef"
8241 fi
8242 set d_vprintf
8243 eval $setvar
8244 val=$val2
8245 set d_charvspr
8246 eval $setvar
8247
8248 : see if chown exists
8249 set chown d_chown
8250 eval $inlibc
8251
8252 : see if chroot exists
8253 set chroot d_chroot
8254 eval $inlibc
8255
8256 : see if chsize exists
8257 set chsize d_chsize
8258 eval $inlibc
8259
8260 : check for const keyword
8261 echo " "
8262 echo 'Checking to see if your C compiler knows about "const"...' >&4
8263 $cat >const.c <<'EOCP'
8264 typedef struct spug { int drokk; } spug;
8265 int main()
8266 {
8267         const char *foo;
8268         const spug y;
8269 }
8270 EOCP
8271 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8272         val="$define"
8273         echo "Yup, it does."
8274 else
8275         val="$undef"
8276         echo "Nope, it doesn't."
8277 fi
8278 set d_const
8279 eval $setvar
8280
8281 : see if crypt exists
8282 echo " "
8283 if set crypt val -f d_crypt; eval $csym; $val; then
8284         echo 'crypt() found.' >&4
8285         val="$define"
8286         cryptlib=''
8287 else
8288         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8289         if $test -z "$cryptlib"; then
8290                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8291         else
8292                 cryptlib=-lcrypt
8293         fi
8294         if $test -z "$cryptlib"; then
8295                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8296         else
8297                 cryptlib=-lcrypt
8298         fi
8299         if $test -z "$cryptlib"; then
8300                 cryptlib=`./loc libcrypt$_a "" $libpth`
8301         else
8302                 cryptlib=-lcrypt
8303         fi
8304         if $test -z "$cryptlib"; then
8305                 echo 'crypt() NOT found.' >&4
8306                 val="$undef"
8307         else
8308                 val="$define"
8309         fi
8310 fi
8311 set d_crypt
8312 eval $setvar
8313
8314 : get csh whereabouts
8315 case "$csh" in
8316 'csh') val="$undef" ;;
8317 *) val="$define" ;;
8318 esac
8319 set d_csh
8320 eval $setvar
8321 : Respect a hint or command line value for full_csh.
8322 case "$full_csh" in
8323 '') full_csh=$csh ;;
8324 esac
8325
8326 : see if cuserid exists
8327 set cuserid d_cuserid
8328 eval $inlibc
8329
8330 : see if this is a limits.h system
8331 set limits.h i_limits
8332 eval $inhdr
8333
8334 : see if this is a float.h system
8335 set float.h i_float
8336 eval $inhdr
8337
8338 : See if number of significant digits in a double precision number is known
8339 echo " "
8340 $cat >dbl_dig.c <<EOM
8341 #$i_limits I_LIMITS
8342 #$i_float I_FLOAT
8343 #ifdef I_LIMITS
8344 #include <limits.h>
8345 #endif
8346 #ifdef I_FLOAT
8347 #include <float.h>
8348 #endif
8349 #ifdef DBL_DIG
8350 printf("Contains DBL_DIG");
8351 #endif
8352 EOM
8353 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8354 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8355         echo "DBL_DIG found." >&4
8356         val="$define"
8357 else
8358         echo "DBL_DIG NOT found." >&4
8359         val="$undef"
8360 fi
8361 $rm -f dbl_dig.?
8362 set d_dbl_dig
8363 eval $setvar
8364
8365 : see if difftime exists
8366 set difftime d_difftime
8367 eval $inlibc
8368
8369 : see if this is a dirent system
8370 echo " "
8371 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8372         val="$define"
8373         echo "<dirent.h> found." >&4
8374 else
8375         val="$undef"
8376         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8377                 echo "<sys/dir.h> found." >&4
8378                 echo " "
8379         else
8380                 xinc=`./findhdr sys/ndir.h`
8381         fi
8382         echo "<dirent.h> NOT found." >&4
8383 fi
8384 set i_dirent
8385 eval $setvar
8386
8387 : Look for type of directory structure.
8388 echo " "
8389 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8390
8391 case "$direntrytype" in
8392 ''|' ')
8393         case "$i_dirent" in
8394         $define) guess1='struct dirent' ;;
8395         *) guess1='struct direct'  ;;
8396         esac
8397         ;;
8398 *)      guess1="$direntrytype"
8399         ;;
8400 esac
8401
8402 case "$guess1" in
8403 'struct dirent') guess2='struct direct' ;;
8404 *) guess2='struct dirent' ;;
8405 esac
8406                 
8407 if $contains "$guess1" try.c >/dev/null 2>&1; then
8408         direntrytype="$guess1"
8409         echo "Your directory entries are $direntrytype." >&4
8410 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8411         direntrytype="$guess2"
8412         echo "Your directory entries seem to be $direntrytype." >&4
8413 else
8414         echo "I don't recognize your system's directory entries." >&4
8415         rp="What type is used for directory entries on this system?"
8416         dflt="$guess1"
8417         . ./myread
8418         direntrytype="$ans"
8419 fi
8420 $rm -f try.c
8421
8422
8423 : see if the directory entry stores field length
8424 echo " "
8425 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8426 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8427         echo "Good, your directory entry keeps length information in d_namlen." >&4
8428         val="$define"
8429 else
8430         echo "Your directory entry does not know about the d_namlen field." >&4
8431         val="$undef"
8432 fi
8433 set d_dirnamlen
8434 eval $setvar
8435 $rm -f try.c
8436
8437 : see if dlerror exists
8438 xxx_runnm="$runnm"
8439 runnm=false
8440 set dlerror d_dlerror
8441 eval $inlibc
8442 runnm="$xxx_runnm"
8443
8444 : see if dlfcn is available
8445 set dlfcn.h i_dlfcn
8446 eval $inhdr
8447
8448 case "$usedl" in
8449 $define|y|true)
8450         $cat << EOM
8451
8452 On a few systems, the dynamically loaded modules that perl generates and uses
8453 will need a different extension than shared libs. The default will probably
8454 be appropriate.
8455
8456 EOM
8457         case "$dlext" in
8458         '')     dflt="$so" ;;
8459         *)      dflt="$dlext" ;;
8460         esac
8461         rp='What is the extension of dynamically loaded modules'
8462         . ./myread
8463         dlext="$ans"
8464         ;;
8465 *)
8466         dlext="none"
8467         ;;
8468 esac
8469
8470 : Check if dlsym need a leading underscore
8471 echo " "
8472 val="$undef"
8473
8474 case "$dlsrc" in
8475 dl_dlopen.xs)
8476         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8477         $cat >dyna.c <<'EOM'
8478 fred () { }
8479 EOM
8480
8481 $cat >fred.c<<EOM
8482
8483 #include <stdio.h>
8484 #$i_dlfcn I_DLFCN
8485 #ifdef I_DLFCN
8486 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8487 #else
8488 #include <sys/types.h>
8489 #include <nlist.h>
8490 #include <link.h>
8491 #endif
8492
8493 extern int fred() ;
8494
8495 int main()
8496 {
8497     void * handle ;
8498     void * symbol ;
8499 #ifndef RTLD_LAZY
8500     int mode = 1 ;
8501 #else
8502     int mode = RTLD_LAZY ;
8503 #endif
8504     handle = dlopen("./dyna.$dlext", mode) ;
8505     if (handle == NULL) {
8506         printf ("1\n") ;
8507         fflush (stdout) ;
8508         exit(0);
8509     }
8510     symbol = dlsym(handle, "fred") ;
8511     if (symbol == NULL) {
8512         /* try putting a leading underscore */
8513         symbol = dlsym(handle, "_fred") ;
8514         if (symbol == NULL) {
8515             printf ("2\n") ;
8516             fflush (stdout) ;
8517             exit(0);
8518         }
8519         printf ("3\n") ;
8520     }
8521     else
8522         printf ("4\n") ;
8523     fflush (stdout) ;
8524     exit(0);
8525 }
8526 EOM
8527         : Call the object file tmp-dyna.o in case dlext=o.
8528         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8529                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8530                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8531                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8532                 xxx=`./fred`
8533                 case $xxx in
8534                 1)      echo "Test program failed using dlopen." >&4
8535                         echo "Perhaps you should not use dynamic loading." >&4;;
8536                 2)      echo "Test program failed using dlsym." >&4
8537                         echo "Perhaps you should not use dynamic loading." >&4;;
8538                 3)      echo "dlsym needs a leading underscore" >&4
8539                         val="$define" ;;
8540                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8541                 esac
8542         else
8543                 echo "I can't compile and run the test program." >&4
8544                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8545         fi
8546         ;;
8547 esac
8548                 
8549 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8550
8551 set d_dlsymun
8552 eval $setvar
8553
8554 hasproto='varname=$1; func=$2; shift; shift;
8555 while $test $# -ge 2; do
8556         case "$1" in
8557         $define) echo "#include <$2>";;
8558         esac ;
8559     shift 2;
8560 done > try.c;
8561 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8562 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8563         echo "$func() prototype found.";
8564         val="$define";
8565 else
8566         echo "$func() prototype NOT found.";
8567         val="$undef";
8568 fi;
8569 set $varname;
8570 eval $setvar;
8571 $rm -f try.c tryout.c'
8572
8573 : see if prototype for drand48 is available
8574 echo " "
8575 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8576 eval $hasproto
8577
8578 : see if dup2 exists
8579 set dup2 d_dup2
8580 eval $inlibc
8581
8582 : see if eaccess exists
8583 set eaccess d_eaccess
8584 eval $inlibc
8585
8586 : see if endgrent exists
8587 set endgrent d_endgrent
8588 eval $inlibc
8589
8590 : see if endhostent exists
8591 set endhostent d_endhent
8592 eval $inlibc
8593
8594 : see if endnetent exists
8595 set endnetent d_endnent
8596 eval $inlibc
8597
8598 : see if endprotoent exists
8599 set endprotoent d_endpent
8600 eval $inlibc
8601
8602 : see if endpwent exists
8603 set endpwent d_endpwent
8604 eval $inlibc
8605
8606 : see if endservent exists
8607 set endservent d_endsent
8608 eval $inlibc
8609
8610 : Locate the flags for 'open()'
8611 echo " "
8612 $cat >open3.c <<'EOCP'
8613 #include <sys/types.h>
8614 #ifdef I_FCNTL
8615 #include <fcntl.h>
8616 #endif
8617 #ifdef I_SYS_FILE
8618 #include <sys/file.h>
8619 #endif
8620 int main() {
8621         if(O_RDONLY);
8622 #ifdef O_TRUNC
8623         exit(0);
8624 #else
8625         exit(1);
8626 #endif
8627 }
8628 EOCP
8629 : check sys/file.h first to get FREAD on Sun
8630 if $test `./findhdr sys/file.h` && \
8631                 set open3 -DI_SYS_FILE && eval $compile; then
8632         h_sysfile=true;
8633         echo "<sys/file.h> defines the O_* constants..." >&4
8634         if ./open3; then
8635                 echo "and you have the 3 argument form of open()." >&4
8636                 val="$define"
8637         else
8638                 echo "but not the 3 argument form of open().  Oh, well." >&4
8639                 val="$undef"
8640         fi
8641 elif $test `./findhdr fcntl.h` && \
8642                 set open3 -DI_FCNTL && eval $compile; then
8643         h_fcntl=true;
8644         echo "<fcntl.h> defines the O_* constants..." >&4
8645         if ./open3; then
8646                 echo "and you have the 3 argument form of open()." >&4
8647                 val="$define"
8648         else
8649                 echo "but not the 3 argument form of open().  Oh, well." >&4
8650                 val="$undef"
8651         fi
8652 else
8653         val="$undef"
8654         echo "I can't find the O_* constant definitions!  You got problems." >&4
8655 fi
8656 set d_open3
8657 eval $setvar
8658 $rm -f open3*
8659
8660 : see which of string.h or strings.h is needed
8661 echo " "
8662 strings=`./findhdr string.h`
8663 if $test "$strings" && $test -r "$strings"; then
8664         echo "Using <string.h> instead of <strings.h>." >&4
8665         val="$define"
8666 else
8667         val="$undef"
8668         strings=`./findhdr strings.h`
8669         if $test "$strings" && $test -r "$strings"; then
8670                 echo "Using <strings.h> instead of <string.h>." >&4
8671         else
8672                 echo "No string header found -- You'll surely have problems." >&4
8673         fi
8674 fi
8675 set i_string
8676 eval $setvar
8677 case "$i_string" in
8678 "$undef") strings=`./findhdr strings.h`;;
8679 *)        strings=`./findhdr string.h`;;
8680 esac
8681
8682 : check for non-blocking I/O stuff
8683 case "$h_sysfile" in
8684 true) echo "#include <sys/file.h>" > head.c;;
8685 *)
8686         case "$h_fcntl" in
8687         true) echo "#include <fcntl.h>" > head.c;;
8688         *) echo "#include <sys/fcntl.h>" > head.c;;
8689         esac
8690         ;;
8691 esac
8692 echo " "
8693 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8694 case "$o_nonblock" in
8695 '')
8696         $cat head.c > try.c
8697         $cat >>try.c <<'EOCP'
8698 #include <stdio.h>
8699 int main() {
8700 #ifdef O_NONBLOCK
8701         printf("O_NONBLOCK\n");
8702         exit(0);
8703 #endif
8704 #ifdef O_NDELAY
8705         printf("O_NDELAY\n");
8706         exit(0);
8707 #endif
8708 #ifdef FNDELAY
8709         printf("FNDELAY\n");
8710         exit(0);
8711 #endif
8712         exit(0);
8713 }
8714 EOCP
8715         set try
8716         if eval $compile_ok; then
8717                 o_nonblock=`./try`
8718                 case "$o_nonblock" in
8719                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8720                 *) echo "Seems like we can use $o_nonblock.";;
8721                 esac
8722         else
8723                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8724         fi
8725         ;;
8726 *) echo "Using $hint value $o_nonblock.";;
8727 esac
8728 $rm -f try try.* .out core
8729
8730 echo " "
8731 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8732 case "$eagain" in
8733 '')
8734         $cat head.c > try.c
8735         $cat >>try.c <<EOCP
8736 #include <errno.h>
8737 #include <sys/types.h>
8738 #include <signal.h>
8739 #include <stdio.h> 
8740 #define MY_O_NONBLOCK $o_nonblock
8741 #ifndef errno  /* XXX need better Configure test */
8742 extern int errno;
8743 #endif
8744 #$i_unistd I_UNISTD
8745 #ifdef I_UNISTD
8746 #include <unistd.h>
8747 #endif
8748 #$i_string I_STRING
8749 #ifdef I_STRING
8750 #include <string.h>
8751 #else
8752 #include <strings.h>
8753 #endif
8754 $signal_t blech(x) int x; { exit(3); }
8755 EOCP
8756         $cat >> try.c <<'EOCP'
8757 int main()
8758 {
8759         int pd[2];
8760         int pu[2];
8761         char buf[1];
8762         char string[100];
8763
8764         pipe(pd);       /* Down: child -> parent */
8765         pipe(pu);       /* Up: parent -> child */
8766         if (0 != fork()) {
8767                 int ret;
8768                 close(pd[1]);   /* Parent reads from pd[0] */
8769                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8770                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8771                         exit(1);
8772                 signal(SIGALRM, blech);
8773                 alarm(5);
8774                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8775                         exit(2);
8776                 sprintf(string, "%d\n", ret);
8777                 write(2, string, strlen(string));
8778                 alarm(0);
8779 #ifdef EAGAIN
8780                 if (errno == EAGAIN) {
8781                         printf("EAGAIN\n");
8782                         goto ok;
8783                 }
8784 #endif
8785 #ifdef EWOULDBLOCK
8786                 if (errno == EWOULDBLOCK)
8787                         printf("EWOULDBLOCK\n");
8788 #endif
8789         ok:
8790                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8791                 sleep(2);                               /* Give it time to close our pipe */
8792                 alarm(5);
8793                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8794                 alarm(0);
8795                 sprintf(string, "%d\n", ret);
8796                 write(3, string, strlen(string));
8797                 exit(0);
8798         }
8799
8800         close(pd[0]);                   /* We write to pd[1] */
8801         close(pu[1]);                   /* We read from pu[0] */
8802         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8803         close(pd[1]);                   /* Pipe pd is now fully closed! */
8804         exit(0);                                /* Bye bye, thank you for playing! */
8805 }
8806 EOCP
8807         set try
8808         if eval $compile_ok; then
8809                 echo "$startsh" >mtry
8810                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8811                 chmod +x mtry
8812                 ./mtry >/dev/null 2>&1
8813                 case $? in
8814                 0) eagain=`$cat try.out`;;
8815                 1) echo "Could not perform non-blocking setting!";;
8816                 2) echo "I did a successful read() for something that was not there!";;
8817                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8818                 *) echo "Something terribly wrong happened during testing.";;
8819                 esac
8820                 rd_nodata=`$cat try.ret`
8821                 echo "A read() system call with no data present returns $rd_nodata."
8822                 case "$rd_nodata" in
8823                 0|-1) ;;
8824                 *)
8825                         echo "(That's peculiar, fixing that to be -1.)"
8826                         rd_nodata=-1
8827                         ;;
8828                 esac
8829                 case "$eagain" in
8830                 '')
8831                         echo "Forcing errno EAGAIN on read() with no data available."
8832                         eagain=EAGAIN
8833                         ;;
8834                 *)
8835                         echo "Your read() sets errno to $eagain when no data is available."
8836                         ;;
8837                 esac
8838                 status=`$cat try.err`
8839                 case "$status" in
8840                 0) echo "And it correctly returns 0 to signal EOF.";;
8841                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8842                 *) echo "However, your read() returns '$status' on EOF??";;
8843                 esac
8844                 val="$define"
8845                 if test "$status" = "$rd_nodata"; then
8846                         echo "WARNING: you can't distinguish between EOF and no data!"
8847                         val="$undef"
8848                 fi
8849         else
8850                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8851                 eagain=EAGAIN
8852         fi
8853         set d_eofnblk
8854         eval $setvar
8855         ;;
8856 *)
8857         echo "Using $hint value $eagain."
8858         echo "Your read() returns $rd_nodata when no data is present."
8859         case "$d_eofnblk" in
8860         "$define") echo "And you can see EOF because read() returns 0.";;
8861         "$undef") echo "But you can't see EOF status from read() returned value.";;
8862         *)
8863                 echo "(Assuming you can't see EOF status from read anyway.)"
8864                 d_eofnblk=$undef
8865                 ;;
8866         esac
8867         ;;
8868 esac
8869 $rm -f try try.* .out core head.c mtry
8870
8871 : see if fchmod exists
8872 set fchmod d_fchmod
8873 eval $inlibc
8874
8875 : see if fchown exists
8876 set fchown d_fchown
8877 eval $inlibc
8878
8879 : see if this is an fcntl system
8880 set fcntl d_fcntl
8881 eval $inlibc
8882
8883 echo " "
8884 : See if fcntl-based locking works.
8885 $cat >try.c <<'EOCP'
8886 #include <stdlib.h>
8887 #include <unistd.h>
8888 #include <fcntl.h>
8889 int main() {
8890 #if defined(F_SETLK) && defined(F_SETLKW)
8891      struct flock flock;
8892      int retval, fd;
8893      fd = open("try.c", O_RDONLY);
8894      flock.l_type = F_RDLCK;
8895      flock.l_whence = SEEK_SET;
8896      flock.l_start = flock.l_len = 0;
8897      retval = fcntl(fd, F_SETLK, &flock);
8898      close(fd);
8899      (retval < 0 ? exit(2) : exit(0));
8900 #else
8901      exit(2);
8902 #endif
8903 }
8904 EOCP
8905 echo "Checking if fcntl-based file locking works... "
8906 case "$d_fcntl" in
8907 "$define")
8908         set try
8909         if eval $compile_ok; then
8910                 if ./try; then
8911                         echo "Yes, it seems to work."
8912                         val="$define"
8913                 else
8914                         echo "Nope, it didn't work."
8915                         val="$undef"
8916                 fi
8917         else
8918                 echo "I'm unable to compile the test program, so I'll assume not."
8919                 val="$undef"
8920         fi
8921         ;;
8922 *) val="$undef";
8923         echo "Nope, since you don't even have fcntl()."
8924         ;;
8925 esac
8926 set d_fcntl_can_lock
8927 eval $setvar
8928 $rm -f try*
8929
8930
8931 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8932 while $test $# -ge 2; do
8933         case "$1" in
8934         $define) echo "#include <$2>";;
8935         esac ;
8936     shift 2;
8937 done > try.c;
8938 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8939 set try;
8940 if eval $compile; then
8941         val="$define";
8942 else
8943         val="$undef";
8944 fi;
8945 set $varname;
8946 eval $setvar;
8947 $rm -f try.c try.o'
8948
8949 socketlib=''
8950 sockethdr=''
8951 : see whether socket exists
8952 echo " "
8953 $echo $n "Hmm... $c" >&4
8954 if set socket val -f d_socket; eval $csym; $val; then
8955         echo "Looks like you have Berkeley networking support." >&4
8956         d_socket="$define"
8957         if set setsockopt val -f; eval $csym; $val; then
8958                 d_oldsock="$undef"
8959         else
8960                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8961                 d_oldsock="$define"
8962         fi
8963 else
8964         if $contains socklib libc.list >/dev/null 2>&1; then
8965                 echo "Looks like you have Berkeley networking support." >&4
8966                 d_socket="$define"
8967                 : we will have to assume that it supports the 4.2 BSD interface
8968                 d_oldsock="$undef"
8969         else
8970                 echo "You don't have Berkeley networking in libc$_a..." >&4
8971                 if test "X$d_socket" = "X$define"; then
8972                    echo "...but you seem to believe that you have sockets." >&4
8973                 else
8974                         for net in net socket
8975                         do
8976                                 if test -f /usr/lib/lib$net$_a; then
8977                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8978                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8979                                         if $contains socket libc.list >/dev/null 2>&1; then
8980                                                 d_socket="$define"
8981                                                 socketlib="-l$net"
8982                                                 case "$net" in
8983                                                 net)
8984                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8985                                                         sockethdr="-I/usr/netinclude"
8986                                                         ;;
8987                                                 esac
8988                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8989                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8990                                                         d_oldsock="$undef"
8991                                                 else
8992                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8993                                                         d_oldsock="$define"
8994                                                 fi
8995                                                 break
8996                                         fi
8997                                 fi
8998                         done
8999                         if test "X$d_socket" != "X$define"; then
9000                            echo "or anywhere else I see." >&4
9001                            d_socket="$undef"
9002                            d_oldsock="$undef"
9003                         fi
9004                 fi
9005         fi
9006 fi
9007
9008 : see if socketpair exists
9009 set socketpair d_sockpair
9010 eval $inlibc
9011
9012
9013 echo " "
9014 echo "Checking the availability of certain socket constants..." >& 4
9015 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9016         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9017         $cat >try.c <<EOF
9018 #include <sys/types.h>
9019 #include <sys/socket.h>
9020 int main() {
9021     int i = $ENUM;
9022 }
9023 EOF
9024         val="$undef"
9025         set try; if eval $compile; then
9026                 val="$define"
9027         fi
9028         set d_${enum}; eval $setvar
9029         $rm -f try.c try
9030 done
9031
9032 : see if sys/select.h has to be included
9033 set sys/select.h i_sysselct
9034 eval $inhdr
9035
9036 : see if we should include time.h, sys/time.h, or both
9037 echo " "
9038 if test "X$timeincl" = X; then
9039         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9040         $echo $n "I'm now running the test program...$c"
9041         $cat >try.c <<'EOCP'
9042 #include <sys/types.h>
9043 #ifdef I_TIME
9044 #include <time.h>
9045 #endif
9046 #ifdef I_SYSTIME
9047 #ifdef SYSTIMEKERNEL
9048 #define KERNEL
9049 #endif
9050 #include <sys/time.h>
9051 #endif
9052 #ifdef I_SYSSELECT
9053 #include <sys/select.h>
9054 #endif
9055 int main()
9056 {
9057         struct tm foo;
9058 #ifdef S_TIMEVAL
9059         struct timeval bar;
9060 #endif
9061 #ifdef S_TIMEZONE
9062         struct timezone tzp;
9063 #endif
9064         if (foo.tm_sec == foo.tm_sec)
9065                 exit(0);
9066 #ifdef S_TIMEVAL
9067         if (bar.tv_sec == bar.tv_sec)
9068                 exit(0);
9069 #endif
9070         exit(1);
9071 }
9072 EOCP
9073         flags=''
9074         for s_timezone in '-DS_TIMEZONE' ''; do
9075         sysselect=''
9076         for s_timeval in '-DS_TIMEVAL' ''; do
9077         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9078         for i_time in '' '-DI_TIME'; do
9079         for i_systime in '-DI_SYSTIME' ''; do
9080                 case "$flags" in
9081                 '') $echo $n ".$c"
9082                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9083                         if eval $compile; then
9084                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9085                                 shift
9086                                 flags="$*"
9087                                 echo " "
9088                                 $echo $n "Succeeded with $flags$c"
9089                         fi
9090                         ;;
9091                 esac
9092         done
9093         done
9094         done
9095         done
9096         done
9097         timeincl=''
9098         echo " "
9099         case "$flags" in
9100         *SYSTIMEKERNEL*) i_systimek="$define"
9101                 timeincl=`./findhdr sys/time.h`
9102                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9103         *) i_systimek="$undef";;
9104         esac
9105         case "$flags" in
9106         *I_TIME*) i_time="$define"
9107                 timeincl=`./findhdr time.h`" $timeincl"
9108                 echo "We'll include <time.h>." >&4;;
9109         *) i_time="$undef";;
9110         esac
9111         case "$flags" in
9112         *I_SYSTIME*) i_systime="$define"
9113                 timeincl=`./findhdr sys/time.h`" $timeincl"
9114                 echo "We'll include <sys/time.h>." >&4;;
9115         *) i_systime="$undef";;
9116         esac
9117         $rm -f try.c try
9118 fi
9119
9120 : check for fd_set items
9121 $cat <<EOM
9122
9123 Checking to see how well your C compiler handles fd_set and friends ...
9124 EOM
9125 $cat >fd_set.c <<EOCP
9126 #$i_systime I_SYS_TIME
9127 #$i_sysselct I_SYS_SELECT
9128 #$d_socket HAS_SOCKET
9129 #include <sys/types.h>
9130 #ifdef HAS_SOCKET
9131 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9132 #endif
9133 #ifdef I_SYS_TIME
9134 #include <sys/time.h>
9135 #endif
9136 #ifdef I_SYS_SELECT
9137 #include <sys/select.h>
9138 #endif
9139 int main() {
9140         fd_set fds;
9141
9142 #ifdef TRYBITS
9143         if(fds.fds_bits);
9144 #endif
9145
9146 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9147         exit(0);
9148 #else
9149         exit(1);
9150 #endif
9151 }
9152 EOCP
9153 set fd_set -DTRYBITS
9154 if eval $compile; then
9155         d_fds_bits="$define"
9156         d_fd_set="$define"
9157         echo "Well, your system knows about the normal fd_set typedef..." >&4
9158         if ./fd_set; then
9159                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9160                 d_fd_macros="$define"
9161         else
9162                 $cat >&4 <<'EOM'
9163 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9164 EOM
9165                 d_fd_macros="$undef"
9166         fi
9167 else
9168         $cat <<'EOM'
9169 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9170 EOM
9171         set fd_set
9172         if eval $compile; then
9173                 d_fds_bits="$undef"
9174                 d_fd_set="$define"
9175                 echo "Well, your system has some sort of fd_set available..." >&4
9176                 if ./fd_set; then
9177                         echo "and you have the normal fd_set macros." >&4
9178                         d_fd_macros="$define"
9179                 else
9180                         $cat <<'EOM'
9181 but not the normal fd_set macros!  Gross!  More work for me...
9182 EOM
9183                         d_fd_macros="$undef"
9184                 fi
9185         else
9186         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9187                 d_fd_set="$undef"
9188                 d_fds_bits="$undef"
9189                 d_fd_macros="$undef"
9190         fi
9191 fi
9192 $rm -f fd_set*
9193
9194 : see if fgetpos exists
9195 set fgetpos d_fgetpos
9196 eval $inlibc
9197
9198 : see if flock exists
9199 set flock d_flock
9200 eval $inlibc
9201
9202 : see if fork exists
9203 set fork d_fork
9204 eval $inlibc
9205
9206 : see if pathconf exists
9207 set pathconf d_pathconf
9208 eval $inlibc
9209
9210 : see if fpathconf exists
9211 set fpathconf d_fpathconf
9212 eval $inlibc
9213
9214
9215 : check for fpos64_t
9216 echo " "
9217 echo "Checking to see if you have fpos64_t..." >&4
9218 $cat >try.c <<EOCP
9219 #include <stdio.h>
9220 int main() { fpos64_t x = 7; }
9221 EOCP
9222 set try
9223 if eval $compile; then
9224         val="$define"
9225         echo "You have fpos64_t."
9226 else
9227         val="$undef"
9228         echo "You do not have fpos64_t."
9229         case "$fpossize" in
9230         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9231         esac
9232 fi
9233 $rm -f try.* try
9234 set d_fpos64_t
9235 eval $setvar
9236
9237 : see if frexpl exists
9238 set frexpl d_frexpl
9239 eval $inlibc
9240
9241 hasstruct='varname=$1; struct=$2; shift; shift;
9242 while $test $# -ge 2; do
9243         case "$1" in
9244         $define) echo "#include <$2>";;
9245         esac ;
9246     shift 2;
9247 done > try.c;
9248 echo "int main () { struct $struct foo; }" >> try.c;
9249 set try;
9250 if eval $compile; then
9251         val="$define";
9252 else
9253         val="$undef";
9254 fi;
9255 set $varname;
9256 eval $setvar;
9257 $rm -f try.c try.o'
9258
9259 : see if this is a sys/param system
9260 set sys/param.h i_sysparam
9261 eval $inhdr
9262
9263 : see if this is a sys/mount.h system
9264 set sys/mount.h i_sysmount
9265 eval $inhdr
9266
9267 : see if sys/types.h has to be included
9268 set sys/types.h i_systypes
9269 eval $inhdr
9270
9271
9272 echo " "
9273 echo "Checking to see if your system supports struct fs_data..." >&4
9274 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9275 eval $hasstruct
9276 case "$d_fs_data_s" in
9277 "$define")      echo "Yes, it does."   ;;
9278 *)              echo "No, it doesn't." ;;
9279 esac
9280
9281 : see if fseeko exists
9282 set fseeko d_fseeko
9283 eval $inlibc
9284 case "$longsize" in
9285 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9286 esac
9287
9288 : see if fsetpos exists
9289 set fsetpos d_fsetpos
9290 eval $inlibc
9291
9292
9293 : see if fstatfs exists
9294 set fstatfs d_fstatfs
9295 eval $inlibc
9296
9297
9298 : see if statvfs exists
9299 set statvfs d_statvfs
9300 eval $inlibc
9301
9302 : see if fstatvfs exists
9303 set fstatvfs d_fstatvfs
9304 eval $inlibc
9305
9306
9307 : see if fsync exists
9308 set fsync d_fsync
9309 eval $inlibc
9310
9311 : see if ftello exists
9312 set ftello d_ftello
9313 eval $inlibc
9314 case "$longsize" in
9315 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9316 esac
9317
9318 : see if getcwd exists
9319 set getcwd d_getcwd
9320 eval $inlibc
9321
9322 : see if getespwnam exists
9323 set getespwnam d_getespwnam
9324 eval $inlibc
9325
9326
9327 : see if getfsstat exists
9328 set getfsstat d_getfsstat
9329 eval $inlibc
9330
9331 : see if getgrent exists
9332 set getgrent d_getgrent
9333 eval $inlibc
9334
9335 : see if gethostbyaddr exists
9336 set gethostbyaddr d_gethbyaddr
9337 eval $inlibc
9338
9339 : see if gethostbyname exists
9340 set gethostbyname d_gethbyname
9341 eval $inlibc
9342
9343 : see if gethostent exists
9344 set gethostent d_gethent
9345 eval $inlibc
9346
9347 : see how we will look up host name
9348 echo " "
9349 call=''
9350 if set gethostname val -f d_gethname; eval $csym; $val; then
9351         echo 'gethostname() found.' >&4
9352         d_gethname="$define"
9353         call=gethostname
9354 fi
9355 if set uname val -f d_uname; eval $csym; $val; then
9356         if ./xenix; then
9357                 $cat <<'EOM'
9358 uname() was found, but you're running xenix, and older versions of xenix
9359 have a broken uname(). If you don't really know whether your xenix is old
9360 enough to have a broken system call, use the default answer.
9361
9362 EOM
9363                 dflt=y
9364                 case "$d_uname" in
9365                 "$define") dflt=n;;
9366                 esac
9367                 rp='Is your uname() broken?'
9368                 . ./myread
9369                 case "$ans" in
9370                 n*) d_uname="$define"; call=uname;;
9371                 esac
9372         else
9373                 echo 'uname() found.' >&4
9374                 d_uname="$define"
9375                 case "$call" in
9376                 '') call=uname ;;
9377                 esac
9378         fi
9379 fi
9380 case "$d_gethname" in
9381 '') d_gethname="$undef";;
9382 esac
9383 case "$d_uname" in
9384 '') d_uname="$undef";;
9385 esac
9386 case "$d_uname$d_gethname" in
9387 *define*)
9388         dflt=n
9389         cat <<EOM
9390  
9391 Every now and then someone has a $call() that lies about the hostname
9392 but can't be fixed for political or economic reasons.  If you wish, I can
9393 pretend $call() isn't there and maybe compute hostname at run-time
9394 thanks to the '$phostname' command.
9395
9396 EOM
9397         rp="Shall I ignore $call() from now on?"
9398         . ./myread
9399         case "$ans" in
9400         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9401         esac;;
9402 esac
9403 case "$phostname" in
9404 '') aphostname='';;
9405 *) case "$aphostname" in
9406         /*) ;;
9407         *) set X $phostname
9408                 shift
9409                 file=$1
9410                 shift
9411                 file=`./loc $file $file $pth`
9412                 aphostname=`echo $file $*`
9413                 ;;
9414         esac
9415         ;;
9416 esac
9417 case "$d_uname$d_gethname" in
9418 *define*) ;;
9419 *)
9420         case "$phostname" in
9421         '')
9422                 echo "There will be no way for $package to get your hostname." >&4;;
9423         *)
9424         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9425                 ;;
9426         esac;;
9427 esac
9428 case "$d_phostname" in
9429 '') d_phostname="$undef";;
9430 esac
9431
9432 : see if this is a netdb.h system
9433 set netdb.h i_netdb
9434 eval $inhdr
9435
9436 : see if prototypes for various gethostxxx netdb.h functions are available
9437 echo " "
9438 set d_gethostprotos gethostent $i_netdb netdb.h
9439 eval $hasproto
9440
9441 : see if getlogin exists
9442 set getlogin d_getlogin
9443 eval $inlibc
9444
9445 : see if getmnt exists
9446 set getmnt d_getmnt
9447 eval $inlibc
9448
9449 : see if getmntent exists
9450 set getmntent d_getmntent
9451 eval $inlibc
9452
9453 : see if getnetbyaddr exists
9454 set getnetbyaddr d_getnbyaddr
9455 eval $inlibc
9456
9457 : see if getnetbyname exists
9458 set getnetbyname d_getnbyname
9459 eval $inlibc
9460
9461 : see if getnetent exists
9462 set getnetent d_getnent
9463 eval $inlibc
9464
9465 : see if prototypes for various getnetxxx netdb.h functions are available
9466 echo " "
9467 set d_getnetprotos getnetent $i_netdb netdb.h
9468 eval $hasproto
9469
9470 : see if getpagesize exists
9471 set getpagesize d_getpagsz
9472 eval $inlibc
9473
9474
9475 : see if getprotobyname exists
9476 set getprotobyname d_getpbyname
9477 eval $inlibc
9478
9479 : see if getprotobynumber exists
9480 set getprotobynumber d_getpbynumber
9481 eval $inlibc
9482
9483 : see if getprotoent exists
9484 set getprotoent d_getpent
9485 eval $inlibc
9486
9487 : see if getpgid exists
9488 set getpgid d_getpgid
9489 eval $inlibc
9490
9491 : see if getpgrp2 exists
9492 set getpgrp2 d_getpgrp2
9493 eval $inlibc
9494
9495 : see if getppid exists
9496 set getppid d_getppid
9497 eval $inlibc
9498
9499 : see if getpriority exists
9500 set getpriority d_getprior
9501 eval $inlibc
9502
9503 : see if prototypes for various getprotoxxx netdb.h functions are available
9504 echo " "
9505 set d_getprotoprotos getprotoent $i_netdb netdb.h
9506 eval $hasproto
9507
9508 : see if getprpwnam exists
9509 set getprpwnam d_getprpwnam
9510 eval $inlibc
9511
9512 : see if getpwent exists
9513 set getpwent d_getpwent
9514 eval $inlibc
9515
9516
9517 : see if getservbyname exists
9518 set getservbyname d_getsbyname
9519 eval $inlibc
9520
9521 : see if getservbyport exists
9522 set getservbyport d_getsbyport
9523 eval $inlibc
9524
9525 : see if getservent exists
9526 set getservent d_getsent
9527 eval $inlibc
9528
9529 : see if prototypes for various getservxxx netdb.h functions are available
9530 echo " "
9531 set d_getservprotos getservent $i_netdb netdb.h
9532 eval $hasproto
9533
9534 : see if getspnam exists
9535 set getspnam d_getspnam
9536 eval $inlibc
9537
9538 : see if gettimeofday or ftime exists
9539 set gettimeofday d_gettimeod
9540 eval $inlibc
9541 case "$d_gettimeod" in
9542 "$undef")
9543         set ftime d_ftime 
9544         eval $inlibc
9545         ;;
9546 *)
9547         val="$undef"; set d_ftime; eval $setvar
9548         ;;
9549 esac
9550 case "$d_gettimeod$d_ftime" in
9551 "$undef$undef")
9552         echo " "
9553         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9554         ;;
9555 esac
9556
9557 : see if this is an grp system
9558 set grp.h i_grp
9559 eval $inhdr
9560
9561 case "$i_grp" in
9562 $define)
9563         xxx=`./findhdr grp.h`
9564         $cppstdin $cppflags $cppminus < $xxx >$$.h
9565
9566         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9567                 val="$define"
9568         else
9569                 val="$undef"
9570         fi
9571         set d_grpasswd
9572         eval $setvar
9573
9574         $rm -f $$.h
9575         ;;
9576 *)
9577         val="$undef";
9578         set d_grpasswd; eval $setvar
9579         ;;
9580 esac
9581
9582 : see if hasmntopt exists
9583 set hasmntopt d_hasmntopt
9584 eval $inlibc
9585
9586 : see if this is a netinet/in.h or sys/in.h system
9587 set netinet/in.h i_niin sys/in.h i_sysin
9588 eval $inhdr
9589
9590 : see if arpa/inet.h has to be included
9591 set arpa/inet.h i_arpainet
9592 eval $inhdr
9593
9594 : see if htonl --and friends-- exists
9595 val=''
9596 set htonl val
9597 eval $inlibc
9598
9599 : Maybe they are macros.
9600 case "$val" in
9601 $undef)
9602         $cat >htonl.c <<EOM
9603 #include <stdio.h>
9604 #include <sys/types.h>
9605 #$i_niin I_NETINET_IN
9606 #$i_sysin I_SYS_IN
9607 #$i_arpainet I_ARPA_INET
9608 #ifdef I_NETINET_IN
9609 #include <netinet/in.h>
9610 #endif
9611 #ifdef I_SYS_IN
9612 #include <sys/in.h>
9613 #endif
9614 #ifdef I_ARPA_INET
9615 #include <arpa/inet.h>
9616 #endif
9617 #ifdef htonl
9618 printf("Defined as a macro.");
9619 #endif
9620 EOM
9621         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9622         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9623                 val="$define"
9624                 echo "But it seems to be defined as a macro." >&4
9625         fi
9626         $rm -f htonl.?
9627         ;;
9628 esac
9629 set d_htonl
9630 eval $setvar
9631
9632 : see if iconv exists
9633 set iconv d_iconv
9634 eval $inlibc
9635
9636 : index or strchr
9637 echo " "
9638 if set index val -f; eval $csym; $val; then
9639         if set strchr val -f d_strchr; eval $csym; $val; then
9640                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9641                         val="$define"
9642                         vali="$undef"
9643                         echo "strchr() found." >&4
9644                 else
9645                         val="$undef"
9646                         vali="$define"
9647                         echo "index() found." >&4
9648                 fi
9649         else
9650                 val="$undef"
9651                 vali="$define"
9652                 echo "index() found." >&4
9653         fi
9654 else
9655         if set strchr val -f d_strchr; eval $csym; $val; then
9656                 val="$define"
9657                 vali="$undef"
9658                 echo "strchr() found." >&4
9659         else
9660                 echo "No index() or strchr() found!" >&4
9661                 val="$undef"
9662                 vali="$undef"
9663         fi
9664 fi
9665 set d_strchr; eval $setvar
9666 val="$vali"
9667 set d_index; eval $setvar
9668
9669 : check whether inet_aton exists
9670 set inet_aton d_inetaton
9671 eval $inlibc
9672
9673 : see if inttypes.h is available
9674 : we want a real compile instead of Inhdr because some systems
9675 : have an inttypes.h which includes non-existent headers
9676 echo " "
9677 $cat >try.c <<EOCP
9678 #include <inttypes.h>
9679 int main() {
9680         static int32_t foo32 = 0x12345678;
9681 }
9682 EOCP
9683 set try
9684 if eval $compile; then
9685         echo "<inttypes.h> found." >&4
9686         val="$define"
9687 else
9688         echo "<inttypes.h> NOT found." >&4
9689         val="$undef"
9690 fi
9691 $rm -f try.c try
9692 set i_inttypes
9693 eval $setvar
9694
9695 : check for int64_t
9696 echo " "
9697 echo "Checking to see if you have int64_t..." >&4
9698 $cat >try.c <<EOCP
9699 #include <sys/types.h>
9700 #$i_inttypes I_INTTYPES
9701 #ifdef I_INTTYPES
9702 #include <inttypes.h>
9703 #endif
9704 int main() { int64_t x = 7; }
9705 EOCP
9706 set try
9707 if eval $compile; then
9708         val="$define"
9709         echo "You have int64_t."
9710 else
9711         val="$undef"
9712         echo "You do not have int64_t."
9713 fi
9714 $rm -f try try.*
9715 set d_int64_t
9716 eval $setvar
9717
9718 : Look for isascii
9719 echo " "
9720 $cat >isascii.c <<'EOCP'
9721 #include <stdio.h>
9722 #include <ctype.h>
9723 int main() {
9724         int c = 'A';
9725         if (isascii(c))
9726                 exit(0);
9727         else
9728                 exit(1);
9729 }
9730 EOCP
9731 set isascii
9732 if eval $compile; then
9733         echo "isascii() found." >&4
9734         val="$define"
9735 else
9736         echo "isascii() NOT found." >&4
9737         val="$undef"
9738 fi
9739 set d_isascii
9740 eval $setvar
9741 $rm -f isascii*
9742
9743 : see if isnan exists
9744 set isnan d_isnan
9745 eval $inlibc
9746
9747 : see if isnanl exists
9748 set isnanl d_isnanl
9749 eval $inlibc
9750
9751 : see if killpg exists
9752 set killpg d_killpg
9753 eval $inlibc
9754
9755 : see if lchown exists
9756 echo " "
9757 $cat > try.c <<'EOCP'
9758 /* System header to define __stub macros and hopefully few prototypes,
9759     which can conflict with char lchown(); below.  */
9760 #include <assert.h>
9761 /* Override any gcc2 internal prototype to avoid an error.  */
9762 /* We use char because int might match the return type of a gcc2
9763    builtin and then its argument prototype would still apply.  */
9764 char lchown();
9765 int main() {
9766     /*  The GNU C library defines this for functions which it implements
9767         to always fail with ENOSYS.  Some functions are actually named
9768         something starting with __ and the normal name is an alias.  */
9769 #if defined (__stub_lchown) || defined (__stub___lchown)
9770 choke me
9771 #else
9772 lchown();
9773 #endif
9774 ; return 0; }
9775 EOCP
9776 set try
9777 if eval $compile; then
9778     $echo "lchown() found." >&4
9779     val="$define"
9780 else
9781     $echo "lchown() NOT found." >&4
9782     val="$undef"
9783 fi
9784 set d_lchown
9785 eval $setvar
9786
9787 : See if number of significant digits in a double precision number is known
9788 echo " "
9789 $cat >ldbl_dig.c <<EOM
9790 #$i_limits I_LIMITS
9791 #$i_float I_FLOAT
9792 #ifdef I_LIMITS
9793 #include <limits.h>
9794 #endif
9795 #ifdef I_FLOAT
9796 #include <float.h>
9797 #endif
9798 #ifdef LDBL_DIG
9799 printf("Contains LDBL_DIG");
9800 #endif
9801 EOM
9802 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9803 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9804         echo "LDBL_DIG found." >&4
9805         val="$define"
9806 else
9807         echo "LDBL_DIG NOT found." >&4
9808         val="$undef"
9809 fi
9810 $rm -f ldbl_dig.?
9811 set d_ldbl_dig
9812 eval $setvar
9813
9814 : see if link exists
9815 set link d_link
9816 eval $inlibc
9817
9818 : see if localeconv exists
9819 set localeconv d_locconv
9820 eval $inlibc
9821
9822 : see if lockf exists
9823 set lockf d_lockf
9824 eval $inlibc
9825
9826 : check for long long
9827 echo " "
9828 echo "Checking to see if you have long long..." >&4
9829 echo 'int main() { long long x = 7; return 0; }' > try.c
9830 set try
9831 if eval $compile; then
9832         val="$define"
9833         echo "You have long long."
9834 else
9835         val="$undef"
9836         echo "You do not have long long."
9837 fi
9838 $rm try.*
9839 set d_longlong
9840 eval $setvar
9841
9842 : check for length of long long
9843 case "${d_longlong}${longlongsize}" in
9844 $define)
9845         echo " "
9846         echo "Checking to see how big your long longs are..." >&4
9847         $cat >try.c <<'EOCP'
9848 #include <stdio.h>
9849 int main()
9850 {
9851     printf("%d\n", (int)sizeof(long long));
9852     return(0);
9853 }
9854 EOCP
9855         set try
9856         if eval $compile_ok; then
9857                 longlongsize=`./try$exe_ext`
9858                 echo "Your long longs are $longlongsize bytes long."
9859         else
9860                 dflt='8'
9861                 echo " "
9862                 echo "(I can't seem to compile the test program.  Guessing...)"
9863                 rp="What is the size of a long long (in bytes)?"
9864                 . ./myread
9865                 longlongsize="$ans"
9866         fi
9867         if $test "X$longsize" = "X$longlongsize"; then
9868                 echo "(That isn't any different from an ordinary long.)"
9869         fi      
9870         ;;
9871 esac
9872 $rm -f try.* try
9873
9874 : see if prototype for lseek is available
9875 echo " "
9876 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9877 eval $hasproto
9878
9879 : see if lstat exists
9880 set lstat d_lstat
9881 eval $inlibc
9882
9883 : see if madvise exists
9884 set madvise d_madvise
9885 eval $inlibc
9886
9887 : see if mblen exists
9888 set mblen d_mblen
9889 eval $inlibc
9890
9891 : see if mbstowcs exists
9892 set mbstowcs d_mbstowcs
9893 eval $inlibc
9894
9895 : see if mbtowc exists
9896 set mbtowc d_mbtowc
9897 eval $inlibc
9898
9899 : see if memchr exists
9900 set memchr d_memchr
9901 eval $inlibc
9902
9903 : see if memcmp exists
9904 set memcmp d_memcmp
9905 eval $inlibc
9906
9907 : see if memcpy exists
9908 set memcpy d_memcpy
9909 eval $inlibc
9910
9911 : see if memmove exists
9912 set memmove d_memmove
9913 eval $inlibc
9914
9915 : see if memset exists
9916 set memset d_memset
9917 eval $inlibc
9918
9919 : see if mkdir exists
9920 set mkdir d_mkdir
9921 eval $inlibc
9922
9923 : see if mkdtemp exists
9924 set mkdtemp d_mkdtemp
9925 eval $inlibc
9926
9927 : see if mkfifo exists
9928 set mkfifo d_mkfifo
9929 eval $inlibc
9930
9931 : see if mkstemp exists
9932 set mkstemp d_mkstemp
9933 eval $inlibc
9934
9935 : see if mkstemps exists
9936 set mkstemps d_mkstemps
9937 eval $inlibc
9938
9939 : see if mktime exists
9940 set mktime d_mktime
9941 eval $inlibc
9942
9943 : see if this is a sys/mman.h system
9944 set sys/mman.h i_sysmman
9945 eval $inhdr
9946
9947 : see if mmap exists
9948 set mmap d_mmap
9949 eval $inlibc
9950 : see what shmat returns
9951 : default to something harmless
9952 mmaptype='void *'
9953 case "$i_sysmman$d_mmap" in
9954 "$define$define")
9955         $cat >mmap.c <<'END'
9956 #include <sys/mman.h>
9957 void *mmap();
9958 END
9959         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9960                 mmaptype='void *'
9961         else
9962                 mmaptype='caddr_t'
9963         fi
9964         echo "and it returns ($mmaptype)." >&4
9965         ;;
9966 esac
9967
9968
9969
9970 : see if modfl exists
9971 set modfl d_modfl
9972 eval $inlibc
9973
9974 : see if mprotect exists
9975 set mprotect d_mprotect
9976 eval $inlibc
9977
9978 : see if msgctl exists
9979 set msgctl d_msgctl
9980 eval $inlibc
9981
9982 : see if msgget exists
9983 set msgget d_msgget
9984 eval $inlibc
9985
9986 : see if msgsnd exists
9987 set msgsnd d_msgsnd
9988 eval $inlibc
9989
9990 : see if msgrcv exists
9991 set msgrcv d_msgrcv
9992 eval $inlibc
9993
9994 : see how much of the 'msg*(2)' library is present.
9995 h_msg=true
9996 echo " "
9997 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9998 *"$undef"*) h_msg=false;;
9999 esac
10000 case "$osname" in
10001 freebsd)
10002     case "`ipcs 2>&1`" in
10003     "SVID messages"*"not configured"*)
10004         echo "Your $osname does not have the msg*(2) configured." >&4
10005         h_msg=false
10006         val="$undef"
10007         set msgctl d_msgctl
10008         eval $setvar
10009         set msgget d_msgget
10010         eval $setvar
10011         set msgsnd d_msgsnd
10012         eval $setvar
10013         set msgrcv d_msgrcv
10014         eval $setvar
10015         ;;
10016     esac
10017     ;;
10018 esac
10019 : we could also check for sys/ipc.h ...
10020 if $h_msg && $test `./findhdr sys/msg.h`; then
10021         echo "You have the full msg*(2) library." >&4
10022         val="$define"
10023 else
10024         echo "You don't have the full msg*(2) library." >&4
10025         val="$undef"
10026 fi
10027 set d_msg
10028 eval $setvar
10029
10030 : see if msync exists
10031 set msync d_msync
10032 eval $inlibc
10033
10034 : see if munmap exists
10035 set munmap d_munmap
10036 eval $inlibc
10037
10038 : see if nice exists
10039 set nice d_nice
10040 eval $inlibc
10041
10042
10043 echo " "
10044 echo "Checking which 64-bit integer type we could use..." >&4
10045
10046 case "$intsize" in
10047 8) val=int
10048    set quadtype
10049    eval $setvar
10050    val='"unsigned int"'
10051    set uquadtype
10052    eval $setvar
10053    quadkind=1
10054    ;;
10055 *) case "$longsize" in
10056    8) val=long
10057       set quadtype
10058       eval $setvar
10059       val='"unsigned long"'
10060       set uquadtype
10061       eval $setvar
10062       quadkind=2
10063       ;;
10064    *) case "$d_longlong:$longlongsize" in
10065       define:8)
10066         val='"long long"'
10067         set quadtype
10068         eval $setvar
10069         val='"unsigned long long"'
10070         set uquadtype
10071         eval $setvar
10072         quadkind=3
10073         ;;
10074       *) case "$d_int64_t" in
10075          define)
10076            val=int64_t
10077            set quadtype
10078            eval $setvar
10079            val=uint64_t
10080            set uquadtype
10081            eval $setvar
10082            quadkind=4
10083            ;;
10084          esac
10085          ;;
10086       esac
10087       ;;
10088    esac
10089    ;;
10090 esac
10091
10092 case "$quadtype" in
10093 '')     echo "Alas, no 64-bit integer types in sight." >&4
10094         d_quad="$undef"
10095         ;;
10096 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10097             verb="will"
10098         else
10099             verb="could"
10100         fi
10101         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10102         d_quad="$define"
10103         ;;
10104 esac
10105
10106 : check for length of character
10107 echo " "
10108 case "$charsize" in
10109 '')
10110         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10111         $cat >try.c <<'EOCP'
10112 #include <stdio.h>
10113 int main()
10114 {
10115     printf("%d\n", (int)sizeof(char));
10116     exit(0);
10117 }
10118 EOCP
10119         set try
10120         if eval $compile_ok; then
10121                 dflt=`./try`
10122         else
10123                 dflt='1'
10124                 echo "(I can't seem to compile the test program.  Guessing...)"
10125         fi
10126         ;;
10127 *)
10128         dflt="$charsize"
10129         ;;
10130 esac
10131 rp="What is the size of a character (in bytes)?"
10132 . ./myread
10133 charsize="$ans"
10134 $rm -f try.c try
10135
10136 : check for volatile keyword
10137 echo " "
10138 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10139 $cat >try.c <<'EOCP'
10140 int main()
10141 {
10142         typedef struct _goo_struct goo_struct;
10143         goo_struct * volatile goo = ((goo_struct *)0);
10144         struct _goo_struct {
10145                 long long_int;
10146                 int reg_int;
10147                 char char_var;
10148         };
10149         typedef unsigned short foo_t;
10150         char *volatile foo;
10151         volatile int bar;
10152         volatile foo_t blech;
10153         foo = foo;
10154 }
10155 EOCP
10156 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10157         val="$define"
10158         echo "Yup, it does."
10159 else
10160         val="$undef"
10161         echo "Nope, it doesn't."
10162 fi
10163 set d_volatile
10164 eval $setvar
10165 $rm -f try.*
10166
10167
10168 echo " "
10169 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10170
10171 case "$use64bitint:$d_quad:$quadtype" in
10172 define:define:?*)
10173         ivtype="$quadtype"
10174         uvtype="$uquadtype"
10175         ivsize=8
10176         uvsize=8
10177         ;;
10178 *)      ivtype="long"
10179         uvtype="unsigned long"
10180         ivsize=$longsize
10181         uvsize=$longsize
10182         ;;
10183 esac
10184
10185 case "$uselongdouble:$d_longdbl" in
10186 define:define)
10187         nvtype="long double"
10188         nvsize=$longdblsize
10189         ;;
10190 *)      nvtype=double
10191         nvsize=$doublesize
10192         ;;
10193 esac
10194
10195 $echo "(IV will be "$ivtype", $ivsize bytes)"
10196 $echo "(UV will be "$uvtype", $uvsize bytes)"
10197 $echo "(NV will be "$nvtype", $nvsize bytes)"
10198
10199 $cat >try.c <<EOCP
10200 #$i_inttypes I_INTTYPES
10201 #ifdef I_INTTYPES
10202 #include <inttypes.h>
10203 #endif
10204 #include <stdio.h>
10205 int main() {
10206 #ifdef INT8
10207    int8_t i =  INT8_MAX;
10208   uint8_t u = UINT8_MAX;
10209   printf("int8_t\n");
10210 #endif
10211 #ifdef INT16
10212    int16_t i =  INT16_MAX;
10213   uint16_t i = UINT16_MAX;
10214   printf("int16_t\n");
10215 #endif
10216 #ifdef INT32
10217    int32_t i =  INT32_MAX;
10218   uint32_t u = UINT32_MAX;
10219   printf("int32_t\n");
10220 #endif
10221 }
10222 EOCP
10223
10224 case "$i8type" in
10225 '')     case "$charsize" in
10226         1)      i8type=char
10227                 u8type="unsigned char"
10228                 i8size=$charsize
10229                 u8size=$charsize
10230                 ;;
10231         esac
10232         ;;
10233 esac
10234 case "$i8type" in
10235 '')     set try -DINT8
10236         if eval $compile; then
10237                 case "`./try$exe_ext`" in
10238                 int8_t) i8type=int8_t
10239                         u8type=uint8_t
10240                         i8size=1
10241                         u8size=1
10242                         ;;
10243                 esac
10244         fi
10245         ;;
10246 esac
10247 case "$i8type" in
10248 '')     if $test $charsize -ge 1; then
10249                 i8type=char
10250                 u8type="unsigned char"
10251                 i8size=$charsize
10252                 u8size=$charsize
10253         fi
10254         ;;
10255 esac
10256
10257 case "$i16type" in
10258 '')     case "$shortsize" in
10259         2)      i16type=short
10260                 u16type="unsigned short"
10261                 i16size=$shortsize
10262                 u16size=$shortsize
10263                 ;;
10264         esac
10265         ;;
10266 esac
10267 case "$i16type" in
10268 '')     set try -DINT16
10269         if eval $compile; then
10270                 case "`./try$exe_ext`" in
10271                 int16_t)
10272                         i16type=int16_t
10273                         u16type=uint16_t
10274                         i16size=2
10275                         u16size=2
10276                         ;;
10277                 esac
10278         fi
10279         ;;
10280 esac
10281 case "$i16type" in
10282 '')     if $test $shortsize -ge 2; then
10283                 i16type=short
10284                 u16type="unsigned short"
10285                 i16size=$shortsize
10286                 u16size=$shortsize
10287         fi
10288         ;;
10289 esac
10290
10291 case "$i32type" in
10292 '')     case "$longsize" in
10293         4)      i32type=long
10294                 u32type="unsigned long"
10295                 i32size=$longsize
10296                 u32size=$longsize
10297                 ;;
10298         *)      case "$intsize" in
10299                 4)      i32type=int
10300                         u32type="unsigned int"
10301                         i32size=$intsize
10302                         u32size=$intsize
10303                         ;;
10304                 esac
10305                 ;;
10306         esac
10307         ;;
10308 esac
10309 case "$i32type" in
10310 '')     set try -DINT32
10311         if eval $compile; then
10312                 case "`./try$exe_ext`" in
10313                 int32_t)
10314                         i32type=int32_t
10315                         u32type=uint32_t
10316                         i32size=4
10317                         u32size=4
10318                         ;;
10319                 esac
10320         fi
10321         ;;
10322 esac
10323 case "$i32type" in
10324 '')     if $test $intsize -ge 4; then
10325                 i32type=int
10326                 u32type="unsigned int"
10327                 i32size=$intsize
10328                 u32size=$intsize
10329         fi
10330         ;;
10331 esac
10332
10333 case "$i64type" in
10334 '')     case "$d_quad:$quadtype" in
10335         define:?*)
10336                 i64type="$quadtype"
10337                 u64type="$uquadtype"
10338                 i64size=8
10339                 u64size=8
10340                 ;;
10341         esac
10342         ;;
10343 esac
10344
10345 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10346 : volatile so that the compiler has to store it out to memory.
10347 if test X"$d_volatile" = X"$define"; then
10348         volatile=volatile
10349 fi
10350 $cat <<EOP >try.c
10351 #include <stdio.h>
10352 #include <sys/types.h>
10353 #include <signal.h>
10354 #ifdef SIGFPE
10355 $volatile int bletched = 0;
10356 $signal_t blech(s) int s; { bletched = 1; }
10357 #endif
10358 int main() {
10359     $uvtype u = 0;
10360     $nvtype d;
10361     int     n = 8 * $uvsize;
10362     int     i;
10363 #ifdef SIGFPE
10364     signal(SIGFPE, blech);
10365 #endif
10366
10367     for (i = 0; i < n; i++) {
10368       u = u << 1 | ($uvtype)1;
10369       d = ($nvtype)u;
10370       if (($uvtype)d != u)
10371         break;
10372       if (d <= 0)
10373         break;
10374       d = ($nvtype)(u - 1);
10375       if (($uvtype)d != (u - 1))
10376         break;
10377 #ifdef SIGFPE
10378       if (bletched) {
10379         break;
10380 #endif
10381       } 
10382     }
10383     printf("%d\n", ((i == n) ? -n : i));
10384     exit(0);
10385 }
10386 EOP
10387 set try
10388
10389 d_nv_preserves_uv="$undef"
10390 if eval $compile; then
10391         d_nv_preserves_uv_bits="`./try$exe_ext`"
10392 fi
10393 case "$d_nv_preserves_uv_bits" in
10394 \-[1-9]*)       
10395         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10396         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10397         d_nv_preserves_uv="$define"
10398         ;;
10399 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10400         d_nv_preserves_uv="$undef" ;;
10401 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10402         d_nv_preserves_uv_bits="$undef" ;;
10403 esac
10404
10405 $rm -f try.* try
10406
10407
10408 : check for off64_t
10409 echo " "
10410 echo "Checking to see if you have off64_t..." >&4
10411 $cat >try.c <<EOCP
10412 #include <sys/types.h>
10413 #include <unistd.h>
10414 int main() { off64_t x = 7; }
10415 EOCP
10416 set try
10417 if eval $compile; then
10418         val="$define"
10419         echo "You have off64_t."
10420 else
10421         val="$undef"
10422         echo "You do not have off64_t."
10423         case "$lseeksize" in
10424         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10425         esac
10426 fi
10427 $rm -f try.* try
10428 set d_off64_t
10429 eval $setvar
10430
10431 : see if POSIX threads are available
10432 set pthread.h i_pthread
10433 eval $inhdr
10434
10435
10436
10437
10438 : how to create joinable pthreads
10439 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10440         echo " "
10441         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10442         $cat >try.c <<'EOCP'
10443 #include <pthread.h>
10444 int main() {
10445     int detachstate = JOINABLE;
10446 }
10447 EOCP
10448         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10449         if eval $compile; then
10450                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10451                 val="$undef" # Yes, undef.
10452                 set d_old_pthread_create_joinable
10453                 eval $setvar
10454                 val=""
10455                 set old_pthread_create_joinable
10456                 eval $setvar
10457         else
10458                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10459                 if eval $compile; then
10460                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10461                         val="$define"
10462                         set d_old_pthread_create_joinable
10463                         eval $setvar
10464                         val=PTHREAD_CREATE_UNDETACHED
10465                         set old_pthread_create_joinable
10466                         eval $setvar
10467                 else            
10468                         set try -DJOINABLE=__UNDETACHED
10469                         if eval $compile; then
10470                                 echo "You seem to use __UNDETACHED." >&4
10471                                 val="$define"
10472                                 set d_old_pthread_create_joinable
10473                                 eval $setvar
10474                                 val=__UNDETACHED
10475                                 set old_pthread_create_joinable
10476                                 eval $setvar
10477                         else
10478                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10479                                 val="$define"
10480                                 set d_old_pthread_create_joinable
10481                                 eval $setvar
10482                                 val=0
10483                                 set old_pthread_create_joinable
10484                                 eval $setvar
10485                         fi
10486                 fi
10487         fi
10488         $rm -f try try.*
10489 else
10490     d_old_pthread_create_joinable="$undef"
10491     old_pthread_create_joinable=""
10492 fi
10493
10494 : see if pause exists
10495 set pause d_pause
10496 eval $inlibc
10497
10498 : see if pipe exists
10499 set pipe d_pipe
10500 eval $inlibc
10501
10502 : see if poll exists
10503 set poll d_poll
10504 eval $inlibc
10505
10506
10507 : see whether the various POSIXish _yields exist
10508 $cat >try.c <<EOP
10509 #include <pthread.h>
10510 #include <stdio.h>
10511 int main() {
10512 #ifdef SCHED_YIELD
10513         sched_yield();
10514 #else
10515 #ifdef PTHREAD_YIELD
10516         pthread_yield();
10517 #else
10518 #ifdef PTHREAD_YIELD_NULL
10519         pthread_yield(NULL);
10520 #endif
10521 #endif
10522 #endif
10523 }
10524 EOP
10525 : see if sched_yield exists
10526 set try -DSCHED_YIELD
10527 if eval $compile; then
10528     val="$define"
10529     sched_yield='sched_yield()'
10530 else
10531     val="$undef"
10532 fi
10533 case "$usethreads" in
10534 $define)
10535         case "$val" in
10536         $define) echo 'sched_yield() found.' >&4        ;;
10537         *)       echo 'sched_yield() NOT found.' >&4    ;;
10538         esac
10539 esac
10540 set d_sched_yield
10541 eval $setvar
10542
10543 : see if pthread_yield exists
10544 set try -DPTHREAD_YIELD
10545 if eval $compile; then
10546     val="$define"
10547     case "$sched_yield" in
10548     '') sched_yield='pthread_yield()' ;;
10549     esac
10550 else
10551     set try -DPTHREAD_YIELD_NULL
10552     if eval $compile; then
10553         val="$define"
10554         case "$sched_yield" in
10555         '') sched_yield='pthread_yield(NULL)' ;;
10556         esac
10557     else
10558         val="$undef"
10559     fi
10560 fi
10561 case "$usethreads" in
10562 $define)
10563         case "$val" in
10564         $define) echo 'pthread_yield() found.' >&4      ;;
10565         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10566         esac
10567         ;;
10568 esac
10569 set d_pthread_yield
10570 eval $setvar
10571
10572 case "$sched_yield" in
10573 '') sched_yield=undef ;;
10574 esac
10575
10576 $rm -f try try.*
10577
10578 : see if this is a pwd.h system
10579 set pwd.h i_pwd
10580 eval $inhdr
10581
10582 case "$i_pwd" in
10583 $define)
10584         xxx=`./findhdr pwd.h`
10585         $cppstdin $cppflags $cppminus < $xxx >$$.h
10586
10587         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10588                 val="$define"
10589         else
10590                 val="$undef"
10591         fi
10592         set d_pwquota
10593         eval $setvar
10594
10595         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10596                 val="$define"
10597         else
10598                 val="$undef"
10599         fi
10600         set d_pwage
10601         eval $setvar
10602
10603         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10604                 val="$define"
10605         else
10606                 val="$undef"
10607         fi
10608         set d_pwchange
10609         eval $setvar
10610
10611         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10612                 val="$define"
10613         else
10614                 val="$undef"
10615         fi
10616         set d_pwclass
10617         eval $setvar
10618
10619         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10620                 val="$define"
10621         else
10622                 val="$undef"
10623         fi
10624         set d_pwexpire
10625         eval $setvar
10626
10627         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10628                 val="$define"
10629         else
10630                 val="$undef"
10631         fi
10632         set d_pwcomment
10633         eval $setvar
10634
10635         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10636                 val="$define"
10637         else
10638                 val="$undef"
10639         fi
10640         set d_pwgecos
10641         eval $setvar
10642
10643         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10644                 val="$define"
10645         else
10646                 val="$undef"
10647         fi
10648         set d_pwpasswd
10649         eval $setvar
10650
10651         $rm -f $$.h
10652         ;;
10653 *)
10654         val="$undef"; 
10655         set d_pwquota; eval $setvar
10656         set d_pwage; eval $setvar
10657         set d_pwchange; eval $setvar
10658         set d_pwclass; eval $setvar
10659         set d_pwexpire; eval $setvar
10660         set d_pwcomment; eval $setvar
10661         set d_pwgecos; eval $setvar
10662         set d_pwpasswd; eval $setvar
10663         ;;
10664 esac
10665
10666 : see if readdir and friends exist
10667 set readdir d_readdir
10668 eval $inlibc
10669 set seekdir d_seekdir
10670 eval $inlibc
10671 set telldir d_telldir
10672 eval $inlibc
10673 set rewinddir d_rewinddir
10674 eval $inlibc
10675
10676 : see if readlink exists
10677 set readlink d_readlink
10678 eval $inlibc
10679
10680 : see if rename exists
10681 set rename d_rename
10682 eval $inlibc
10683
10684 : see if rmdir exists
10685 set rmdir d_rmdir
10686 eval $inlibc
10687
10688 : see if memory.h is available.
10689 val=''
10690 set memory.h val
10691 eval $inhdr
10692
10693 : See if it conflicts with string.h
10694 case "$val" in
10695 $define)
10696         case "$strings" in
10697         '') ;;
10698         *)
10699                 $cppstdin $cppflags $cppminus < $strings > mem.h
10700                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10701                         echo " "
10702                         echo "We won't be including <memory.h>."
10703                         val="$undef"
10704                 fi
10705                 $rm -f mem.h
10706                 ;;
10707         esac
10708 esac
10709 set i_memory
10710 eval $setvar
10711
10712 : can bcopy handle overlapping blocks?
10713 val="$undef"
10714 case "$d_bcopy" in
10715 "$define")
10716         echo " "
10717         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10718         $cat >try.c <<EOCP
10719 #$i_memory I_MEMORY
10720 #$i_stdlib I_STDLIB
10721 #$i_string I_STRING
10722 #$i_unistd I_UNISTD
10723 EOCP
10724         $cat >>try.c <<'EOCP'
10725 #include <stdio.h>
10726 #ifdef I_MEMORY
10727 #  include <memory.h>
10728 #endif
10729 #ifdef I_STDLIB
10730 #  include <stdlib.h>
10731 #endif
10732 #ifdef I_STRING
10733 #  include <string.h>
10734 #else
10735 #  include <strings.h>
10736 #endif
10737 #ifdef I_UNISTD
10738 #  include <unistd.h>  /* Needed for NetBSD */
10739 #endif
10740 int main()
10741 {
10742 char buf[128], abc[128];
10743 char *b;
10744 int len;
10745 int off;
10746 int align;
10747
10748 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10749
10750 for (align = 7; align >= 0; align--) {
10751         for (len = 36; len; len--) {
10752                 b = buf+align;
10753                 bcopy(abc, b, len);
10754                 for (off = 1; off <= len; off++) {
10755                         bcopy(b, b+off, len);
10756                         bcopy(b+off, b, len);
10757                         if (bcmp(b, abc, len))
10758                                 exit(1);
10759                 }
10760         }
10761 }
10762 exit(0);
10763 }
10764 EOCP
10765         set try
10766         if eval $compile_ok; then
10767                 if ./try 2>/dev/null; then
10768                         echo "Yes, it can."
10769                         val="$define"
10770                 else
10771                         echo "It can't, sorry."
10772                         case "$d_memmove" in
10773                         "$define") echo "But that's Ok since you have memmove()." ;;
10774                         esac
10775                 fi
10776         else
10777                 echo "(I can't compile the test program, so we'll assume not...)"
10778                 case "$d_memmove" in
10779                 "$define") echo "But that's Ok since you have memmove()." ;;
10780                 esac
10781         fi
10782         ;;
10783 esac
10784 $rm -f try.* try core
10785 set d_safebcpy
10786 eval $setvar
10787
10788 : can memcpy handle overlapping blocks?
10789 val="$undef"
10790 case "$d_memcpy" in
10791 "$define")
10792         echo " "
10793         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10794         $cat >try.c <<EOCP
10795 #$i_memory I_MEMORY
10796 #$i_stdlib I_STDLIB
10797 #$i_string I_STRING
10798 #$i_unistd I_UNISTD
10799 EOCP
10800         $cat >>try.c <<'EOCP'
10801 #include <stdio.h>
10802 #ifdef I_MEMORY
10803 #  include <memory.h>
10804 #endif
10805 #ifdef I_STDLIB
10806 #  include <stdlib.h>
10807 #endif
10808 #ifdef I_STRING
10809 #  include <string.h>
10810 #else
10811 #  include <strings.h>
10812 #endif
10813 #ifdef I_UNISTD
10814 #  include <unistd.h>  /* Needed for NetBSD */
10815 #endif
10816 int main()
10817 {
10818 char buf[128], abc[128];
10819 char *b;
10820 int len;
10821 int off;
10822 int align;
10823
10824 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10825    try to store the string in read-only memory. */
10826 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10827
10828 for (align = 7; align >= 0; align--) {
10829         for (len = 36; len; len--) {
10830                 b = buf+align;
10831                 memcpy(b, abc, len);
10832                 for (off = 1; off <= len; off++) {
10833                         memcpy(b+off, b, len);
10834                         memcpy(b, b+off, len);
10835                         if (memcmp(b, abc, len))
10836                                 exit(1);
10837                 }
10838         }
10839 }
10840 exit(0);
10841 }
10842 EOCP
10843         set try
10844         if eval $compile_ok; then
10845                 if ./try 2>/dev/null; then
10846                         echo "Yes, it can."
10847                         val="$define"
10848                 else
10849                         echo "It can't, sorry."
10850                         case "$d_memmove" in
10851                         "$define") echo "But that's Ok since you have memmove()." ;;
10852                         esac
10853                 fi
10854         else
10855                 echo "(I can't compile the test program, so we'll assume not...)"
10856                 case "$d_memmove" in
10857                 "$define") echo "But that's Ok since you have memmove()." ;;
10858                 esac
10859         fi
10860         ;;
10861 esac
10862 $rm -f try.* try core
10863 set d_safemcpy
10864 eval $setvar
10865
10866 : can memcmp be trusted to compare relative magnitude?
10867 val="$undef"
10868 case "$d_memcmp" in
10869 "$define")
10870         echo " "
10871         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10872         $cat >try.c <<EOCP
10873 #$i_memory I_MEMORY
10874 #$i_stdlib I_STDLIB
10875 #$i_string I_STRING
10876 #$i_unistd I_UNISTD
10877 EOCP
10878         $cat >>try.c <<'EOCP'
10879 #include <stdio.h>
10880 #ifdef I_MEMORY
10881 #  include <memory.h>
10882 #endif
10883 #ifdef I_STDLIB
10884 #  include <stdlib.h>
10885 #endif
10886 #ifdef I_STRING
10887 #  include <string.h>
10888 #else
10889 #  include <strings.h>
10890 #endif
10891 #ifdef I_UNISTD
10892 #  include <unistd.h>  /* Needed for NetBSD */
10893 #endif
10894 int main()
10895 {
10896 char a = -1;
10897 char b = 0;
10898 if ((a < b) && memcmp(&a, &b, 1) < 0)
10899         exit(1);
10900 exit(0);
10901 }
10902 EOCP
10903         set try
10904         if eval $compile_ok; then
10905                 if ./try 2>/dev/null; then
10906                         echo "Yes, it can."
10907                         val="$define"
10908                 else
10909                         echo "No, it can't (it uses signed chars)."
10910                 fi
10911         else
10912                 echo "(I can't compile the test program, so we'll assume not...)"
10913         fi
10914         ;;
10915 esac
10916 $rm -f try.* try core
10917 set d_sanemcmp
10918 eval $setvar
10919
10920 : see if prototype for sbrk is available
10921 echo " "
10922 set d_sbrkproto sbrk $i_unistd unistd.h
10923 eval $hasproto
10924
10925 : see if select exists
10926 set select d_select
10927 eval $inlibc
10928
10929 : see if semctl exists
10930 set semctl d_semctl
10931 eval $inlibc
10932
10933 : see if semget exists
10934 set semget d_semget
10935 eval $inlibc
10936
10937 : see if semop exists
10938 set semop d_semop
10939 eval $inlibc
10940
10941 : see how much of the 'sem*(2)' library is present.
10942 h_sem=true
10943 echo " "
10944 case "$d_semctl$d_semget$d_semop" in
10945 *"$undef"*) h_sem=false;;
10946 esac
10947 case "$osname" in
10948 freebsd)
10949     case "`ipcs 2>&1`" in
10950     "SVID messages"*"not configured"*)
10951         echo "Your $osname does not have the sem*(2) configured." >&4
10952         h_sem=false
10953         val="$undef"
10954         set semctl d_semctl
10955         eval $setvar
10956         set semget d_semget
10957         eval $setvar
10958         set semop d_semop
10959         eval $setvar
10960         ;;
10961     esac
10962     ;;
10963 esac
10964 : we could also check for sys/ipc.h ...
10965 if $h_sem && $test `./findhdr sys/sem.h`; then
10966         echo "You have the full sem*(2) library." >&4
10967         val="$define"
10968 else
10969         echo "You don't have the full sem*(2) library." >&4
10970         val="$undef"
10971 fi
10972 set d_sem
10973 eval $setvar
10974
10975 : see whether sys/sem.h defines union semun
10976 echo " "
10977 $cat > try.c <<'END'
10978 #include <sys/types.h>
10979 #include <sys/ipc.h>
10980 #include <sys/sem.h>
10981 int main () { union semun semun; semun.buf = 0; }
10982 END
10983 set try
10984 if eval $compile; then
10985     echo "You have union semun in <sys/sem.h>." >&4
10986     val="$define"
10987 else
10988     echo "You do not have union semun in <sys/sem.h>." >&4
10989     val="$undef"
10990 fi
10991 $rm -f try try.c try.h
10992 set d_union_semun
10993 eval $setvar
10994
10995 : see how to do semctl IPC_STAT
10996 case "$d_sem" in
10997 $define)
10998     : see whether semctl IPC_STAT can use union semun
10999     echo " "
11000     $cat > try.h <<END
11001 #ifndef S_IRUSR
11002 #   ifdef S_IREAD
11003 #       define S_IRUSR S_IREAD
11004 #       define S_IWUSR S_IWRITE
11005 #       define S_IXUSR S_IEXEC
11006 #   else
11007 #       define S_IRUSR 0400
11008 #       define S_IWUSR 0200
11009 #       define S_IXUSR 0100
11010 #   endif
11011 #   define S_IRGRP (S_IRUSR>>3)
11012 #   define S_IWGRP (S_IWUSR>>3)
11013 #   define S_IXGRP (S_IXUSR>>3)
11014 #   define S_IROTH (S_IRUSR>>6)
11015 #   define S_IWOTH (S_IWUSR>>6)
11016 #   define S_IXOTH (S_IXUSR>>6)
11017 #endif
11018 #ifndef S_IRWXU
11019 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11020 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11021 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11022 #endif
11023 END
11024
11025     $cat > try.c <<END
11026 #include <sys/types.h>
11027 #include <sys/ipc.h>
11028 #include <sys/sem.h>
11029 #include <sys/stat.h>
11030 #include <stdio.h>
11031 #include <errno.h>
11032 #include "try.h"
11033 #ifndef errno
11034 extern int errno;
11035 #endif
11036 #$d_union_semun HAS_UNION_SEMUN
11037 int main() {
11038     union semun
11039 #ifndef HAS_UNION_SEMUN
11040     {
11041         int val;
11042         struct semid_ds *buf;
11043         unsigned short *array;
11044     }
11045 #endif
11046     arg;
11047     int sem, st;
11048
11049 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11050     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11051     if (sem > -1) {
11052         struct semid_ds argbuf;
11053         arg.buf = &argbuf;
11054 #       ifdef IPC_STAT
11055         st = semctl(sem, 0, IPC_STAT, arg);
11056         if (st == 0)
11057             printf("semun\n");
11058         else
11059 #       endif /* IPC_STAT */
11060             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11061 #       ifdef IPC_RMID
11062         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11063 #       endif /* IPC_RMID */
11064             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11065     } else
11066 #endif /* IPC_PRIVATE && ... */
11067         printf("semget failed: errno = %d\n", errno);
11068   return 0;
11069 }
11070 END
11071     val="$undef"
11072     set try
11073     if eval $compile; then
11074         xxx=`./try`
11075         case "$xxx" in
11076         semun) val="$define" ;;
11077         esac
11078     fi
11079     $rm -f try try.c
11080     set d_semctl_semun
11081     eval $setvar
11082     case "$d_semctl_semun" in
11083     $define)
11084         echo "You can use union semun for semctl IPC_STAT." >&4
11085         also='also'
11086         ;;
11087     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11088         also=''
11089         ;;
11090     esac
11091
11092     : see whether semctl IPC_STAT can use struct semid_ds pointer
11093     $cat > try.c <<'END'
11094 #include <sys/types.h>
11095 #include <sys/ipc.h>
11096 #include <sys/sem.h>
11097 #include <sys/stat.h>
11098 #include "try.h"
11099 #include <stdio.h>
11100 #include <errno.h>
11101 #ifndef errno
11102 extern int errno;
11103 #endif
11104 int main() {
11105     struct semid_ds arg;
11106     int sem, st;
11107
11108 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11109     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11110     if (sem > -1) {
11111 #       ifdef IPC_STAT
11112         st = semctl(sem, 0, IPC_STAT, &arg);
11113         if (st == 0)
11114             printf("semid_ds\n");
11115         else
11116 #       endif /* IPC_STAT */
11117             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11118 #       ifdef IPC_RMID
11119         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11120 #       endif /* IPC_RMID */
11121             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11122     } else
11123 #endif /* IPC_PRIVATE && ... */
11124         printf("semget failed: errno = %d\n", errno);
11125
11126     return 0;
11127 }
11128 END
11129     val="$undef"
11130     set try
11131     if eval $compile; then
11132         xxx=`./try`
11133         case "$xxx" in
11134         semid_ds) val="$define" ;;
11135         esac
11136     fi
11137     $rm -f try try.c
11138     set d_semctl_semid_ds
11139     eval $setvar
11140     case "$d_semctl_semid_ds" in
11141     $define)
11142         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11143         ;;
11144     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11145         ;;
11146     esac
11147     $rm -f try.h
11148     ;;
11149 *)  val="$undef"
11150
11151     # We do not have the full sem*(2) library, so assume we can not
11152     # use either.
11153
11154     set d_semctl_semun
11155     eval $setvar
11156
11157     set d_semctl_semid_ds
11158     eval $setvar
11159     ;;
11160 esac
11161
11162 : see if setegid exists
11163 set setegid d_setegid
11164 eval $inlibc
11165
11166 : see if seteuid exists
11167 set seteuid d_seteuid
11168 eval $inlibc
11169
11170 : see if setgrent exists
11171 set setgrent d_setgrent
11172 eval $inlibc
11173
11174 : see if sethostent exists
11175 set sethostent d_sethent
11176 eval $inlibc
11177
11178 : see if setlinebuf exists
11179 set setlinebuf d_setlinebuf
11180 eval $inlibc
11181
11182 : see if setlocale exists
11183 set setlocale d_setlocale
11184 eval $inlibc
11185
11186 : see if setnetent exists
11187 set setnetent d_setnent
11188 eval $inlibc
11189
11190 : see if setprotoent exists
11191 set setprotoent d_setpent
11192 eval $inlibc
11193
11194 : see if setpgid exists
11195 set setpgid d_setpgid
11196 eval $inlibc
11197
11198 : see if setpgrp2 exists
11199 set setpgrp2 d_setpgrp2
11200 eval $inlibc
11201
11202 : see if setpriority exists
11203 set setpriority d_setprior
11204 eval $inlibc
11205
11206 : see if setproctitle exists
11207 set setproctitle d_setproctitle
11208 eval $inlibc
11209
11210 : see if setpwent exists
11211 set setpwent d_setpwent
11212 eval $inlibc
11213
11214 : see if setregid exists
11215 set setregid d_setregid
11216 eval $inlibc
11217 set setresgid d_setresgid
11218 eval $inlibc
11219
11220 : see if setreuid exists
11221 set setreuid d_setreuid
11222 eval $inlibc
11223 set setresuid d_setresuid
11224 eval $inlibc
11225
11226 : see if setrgid exists
11227 set setrgid d_setrgid
11228 eval $inlibc
11229
11230 : see if setruid exists
11231 set setruid d_setruid
11232 eval $inlibc
11233
11234 : see if setservent exists
11235 set setservent d_setsent
11236 eval $inlibc
11237
11238 : see if setsid exists
11239 set setsid d_setsid
11240 eval $inlibc
11241
11242 : see if setvbuf exists
11243 set setvbuf d_setvbuf
11244 eval $inlibc
11245
11246 : see if sfio.h is available
11247 set sfio.h i_sfio
11248 eval $inhdr
11249
11250
11251 : see if sfio library is available
11252 case "$i_sfio" in
11253 $define)
11254         val=''
11255         set sfreserve val
11256         eval $inlibc
11257         ;;
11258 *)
11259         val="$undef"
11260         ;;
11261 esac
11262 : Ok, but do we want to use it.
11263 case "$val" in
11264 $define)
11265         case "$usesfio" in
11266         true|$define|[yY]*) dflt='y';;
11267         *) dflt='n';;
11268         esac
11269         echo "$package can use the sfio library, but it is experimental."
11270         case "$useperlio" in
11271         "$undef")
11272             echo "For sfio also the PerlIO abstraction layer is needed."
11273             echo "Earlier you said you wouldn't want that."
11274             ;;
11275         esac
11276         rp="You seem to have sfio available, do you want to try using it?"
11277         . ./myread
11278         case "$ans" in
11279         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11280                 useperlio="$define"
11281                 val="$define"
11282                 ;;
11283         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11284                 val="$undef"
11285                 : Remove sfio from list of libraries to use
11286                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11287                 shift
11288                 libs="$*"
11289                 echo "libs = $libs" >&4
11290                 ;;
11291         esac
11292         ;;
11293 *)      case "$usesfio" in
11294         true|$define|[yY]*)
11295                 echo "Sorry, cannot find sfio on this machine." >&4
11296                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11297                 val="$undef"
11298                 ;;
11299         esac
11300         ;;
11301 esac
11302 set d_sfio
11303 eval $setvar
11304 case "$d_sfio" in
11305 $define) usesfio='true';;
11306 *) usesfio='false';;
11307 esac
11308
11309 : see if shmctl exists
11310 set shmctl d_shmctl
11311 eval $inlibc
11312
11313 : see if shmget exists
11314 set shmget d_shmget
11315 eval $inlibc
11316
11317 : see if shmat exists
11318 set shmat d_shmat
11319 eval $inlibc
11320 : see what shmat returns
11321 case "$d_shmat" in
11322 "$define")
11323         $cat >shmat.c <<'END'
11324 #include <sys/shm.h>
11325 void *shmat();
11326 END
11327         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11328                 shmattype='void *'
11329         else
11330                 shmattype='char *'
11331         fi
11332         echo "and it returns ($shmattype)." >&4
11333         : see if a prototype for shmat is available
11334         xxx=`./findhdr sys/shm.h`
11335         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11336         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11337                 val="$define"
11338         else
11339                 val="$undef"
11340         fi
11341         $rm -f shmat.[co]
11342         ;;
11343 *)
11344         val="$undef"
11345         ;;
11346 esac
11347 set d_shmatprototype
11348 eval $setvar
11349
11350 : see if shmdt exists
11351 set shmdt d_shmdt
11352 eval $inlibc
11353
11354 : see how much of the 'shm*(2)' library is present.
11355 h_shm=true
11356 echo " "
11357 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11358 *"$undef"*) h_shm=false;;
11359 esac
11360 case "$osname" in
11361 freebsd)
11362     case "`ipcs 2>&1`" in
11363     "SVID shared memory"*"not configured"*)
11364         echo "Your $osname does not have the shm*(2) configured." >&4
11365         h_shm=false
11366         val="$undef"
11367         set shmctl d_shmctl
11368         evat $setvar
11369         set shmget d_shmget
11370         evat $setvar
11371         set shmat d_shmat
11372         evat $setvar
11373         set shmdt d_shmdt
11374         evat $setvar
11375         ;;
11376     esac
11377     ;;
11378 esac
11379 : we could also check for sys/ipc.h ...
11380 if $h_shm && $test `./findhdr sys/shm.h`; then
11381         echo "You have the full shm*(2) library." >&4
11382         val="$define"
11383 else
11384         echo "You don't have the full shm*(2) library." >&4
11385         val="$undef"
11386 fi
11387 set d_shm
11388 eval $setvar
11389
11390 echo " "
11391 : see if we have sigaction
11392 if set sigaction val -f d_sigaction; eval $csym; $val; then
11393         echo 'sigaction() found.' >&4
11394         $cat > try.c <<'EOP'
11395 #include <stdio.h>
11396 #include <sys/types.h>
11397 #include <signal.h>
11398 int main()
11399 {
11400     struct sigaction act, oact;
11401     act.sa_flags = 0;
11402     oact.sa_handler = 0;
11403     /* so that act and oact are used */
11404     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11405 }
11406 EOP
11407         set try
11408         if eval $compile_ok; then
11409                 val="$define"
11410         else
11411                 echo "But you don't seem to have a useable struct sigaction." >&4
11412                 val="$undef"
11413         fi
11414 else
11415         echo 'sigaction NOT found.' >&4
11416         val="$undef"
11417 fi
11418 set d_sigaction; eval $setvar
11419 $rm -f try try$_o try.c
11420
11421 : see if sigsetjmp exists
11422 echo " "
11423 case "$d_sigsetjmp" in
11424 '')
11425         $cat >try.c <<'EOP'
11426 #include <setjmp.h>
11427 sigjmp_buf env;
11428 int set = 1;
11429 int main()
11430 {
11431         if (sigsetjmp(env,1))
11432                 exit(set);
11433         set = 0;
11434         siglongjmp(env, 1);
11435         exit(1);
11436 }
11437 EOP
11438         set try
11439         if eval $compile; then
11440                 if ./try >/dev/null 2>&1; then
11441                         echo "POSIX sigsetjmp found." >&4
11442                         val="$define"
11443                 else
11444                         $cat >&4 <<EOM
11445 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11446 I'll ignore them.
11447 EOM
11448                         val="$undef"
11449                 fi
11450         else
11451                 echo "sigsetjmp not found." >&4
11452                 val="$undef"
11453         fi
11454         ;;
11455 *) val="$d_sigsetjmp"
11456         case "$d_sigsetjmp" in
11457         $define) echo "POSIX sigsetjmp found." >&4;;
11458         $undef) echo "sigsetjmp not found." >&4;;
11459         esac
11460         ;;
11461 esac
11462 set d_sigsetjmp
11463 eval $setvar
11464 $rm -f try.c try
11465
11466 : see if socks5_init exists
11467 set socks5_init d_socks5_init
11468 eval $inlibc
11469
11470 : see if sys/stat.h is available
11471 set sys/stat.h i_sysstat
11472 eval $inhdr
11473
11474
11475 : see if stat knows about block sizes
11476 echo " "
11477 echo "Checking to see if your struct stat has st_blocks field..." >&4
11478 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11479 eval $hasfield
11480
11481
11482 : see if this is a sys/vfs.h system
11483 set sys/vfs.h i_sysvfs
11484 eval $inhdr
11485
11486
11487 : see if this is a sys/statfs.h system
11488 set sys/statfs.h i_sysstatfs
11489 eval $inhdr
11490
11491
11492 echo " "
11493 echo "Checking to see if your system supports struct statfs..." >&4
11494 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
11495 eval $hasstruct
11496 case "$d_statfs_s" in
11497 "$define")      echo "Yes, it does."   ;;
11498 *)              echo "No, it doesn't." ;;
11499 esac
11500
11501
11502
11503 : see if struct statfs knows about f_flags
11504 case "$d_statfs_s" in
11505 define) 
11506         echo " "
11507         echo "Checking to see if your struct statfs has f_flags field..." >&4
11508         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
11509         eval $hasfield
11510         ;;
11511 *)      val="$undef"
11512         set d_statfs_f_flags
11513         eval $setvar
11514         ;;
11515 esac
11516 case "$d_statfs_f_flags" in
11517 "$define")      echo "Yes, it does."   ;;
11518 *)              echo "No, it doesn't." ;;
11519 esac
11520
11521 : see if _ptr and _cnt from stdio act std
11522 echo " "
11523
11524 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11525         echo "(Looks like you have stdio.h from BSD.)"
11526         case "$stdio_ptr" in
11527         '') stdio_ptr='((fp)->_p)'
11528                 ptr_lval=$define
11529                 ;;
11530         *)      ptr_lval=$d_stdio_ptr_lval;;
11531         esac
11532         case "$stdio_cnt" in
11533         '') stdio_cnt='((fp)->_r)'
11534                 cnt_lval=$define
11535                 ;;
11536         *)      cnt_lval=$d_stdio_cnt_lval;;
11537         esac
11538         case "$stdio_base" in
11539         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11540         esac
11541         case "$stdio_bufsiz" in
11542         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11543         esac
11544 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11545         echo "(Looks like you have stdio.h from Linux.)"
11546         case "$stdio_ptr" in
11547         '') stdio_ptr='((fp)->_IO_read_ptr)'
11548                 ptr_lval=$define
11549                 ;;
11550         *)      ptr_lval=$d_stdio_ptr_lval;;
11551         esac
11552         case "$stdio_cnt" in
11553         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11554                 cnt_lval=$undef
11555                 ;;
11556         *)      cnt_lval=$d_stdio_cnt_lval;;
11557         esac
11558         case "$stdio_base" in
11559         '') stdio_base='((fp)->_IO_read_base)';;
11560         esac
11561         case "$stdio_bufsiz" in
11562         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11563         esac
11564 else
11565         case "$stdio_ptr" in
11566         '') stdio_ptr='((fp)->_ptr)'
11567                 ptr_lval=$define
11568                 ;;
11569         *)      ptr_lval=$d_stdio_ptr_lval;;
11570         esac
11571         case "$stdio_cnt" in
11572         '') stdio_cnt='((fp)->_cnt)'
11573                 cnt_lval=$define
11574                 ;;
11575         *)      cnt_lval=$d_stdio_cnt_lval;;
11576         esac
11577         case "$stdio_base" in
11578         '') stdio_base='((fp)->_base)';;
11579         esac
11580         case "$stdio_bufsiz" in
11581         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11582         esac
11583 fi
11584
11585 : test whether _ptr and _cnt really work
11586 echo "Checking how std your stdio is..." >&4
11587 $cat >try.c <<EOP
11588 #include <stdio.h>
11589 #define FILE_ptr(fp)    $stdio_ptr
11590 #define FILE_cnt(fp)    $stdio_cnt
11591 int main() {
11592         FILE *fp = fopen("try.c", "r");
11593         char c = getc(fp);
11594         if (
11595                 18 <= FILE_cnt(fp) &&
11596                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11597         )
11598                 exit(0);
11599         exit(1);
11600 }
11601 EOP
11602 val="$undef"
11603 set try
11604 if eval $compile; then
11605         if ./try; then
11606                 echo "Your stdio acts pretty std."
11607                 val="$define"
11608         else
11609                 echo "Your stdio isn't very std."
11610         fi
11611 else
11612         echo "Your stdio doesn't appear very std."
11613 fi
11614 $rm -f try.c try
11615 set d_stdstdio
11616 eval $setvar
11617
11618 : Can _ptr be used as an lvalue?
11619 case "$d_stdstdio$ptr_lval" in
11620 $define$define) val=$define ;;
11621 *) val=$undef ;;
11622 esac
11623 set d_stdio_ptr_lval
11624 eval $setvar
11625
11626 : Can _cnt be used as an lvalue?
11627 case "$d_stdstdio$cnt_lval" in
11628 $define$define) val=$define ;;
11629 *) val=$undef ;;
11630 esac
11631 set d_stdio_cnt_lval
11632 eval $setvar
11633
11634
11635 : test whether setting _ptr sets _cnt as a side effect
11636 d_stdio_ptr_lval_sets_cnt="$undef"
11637 d_stdio_ptr_lval_nochange_cnt="$undef"
11638 case "$d_stdio_ptr_lval$d_stdstdio" in
11639 $define$define)
11640         echo "Checking to see what happens if we set the stdio ptr..." >&4
11641 $cat >try.c <<EOP
11642 #include <stdio.h>
11643 /* Can we scream? */
11644 /* Eat dust sed :-) */
11645 /* In the buffer space, no one can hear you scream. */
11646 #define FILE_ptr(fp)    $stdio_ptr
11647 #define FILE_cnt(fp)    $stdio_cnt
11648 #include <sys/types.h>
11649 int main() {
11650         FILE *fp = fopen("try.c", "r");
11651         int c;
11652         char *ptr;
11653         size_t cnt;
11654         if (!fp) {
11655             puts("Fail even to read");
11656             exit(1);
11657         }
11658         c = getc(fp); /* Read away the first # */
11659         if (c == EOF) {
11660             puts("Fail even to read");
11661             exit(1);
11662         }
11663         if (!(
11664                 18 <= FILE_cnt(fp) &&
11665                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11666         )) {
11667                 puts("Fail even to read");
11668                 exit (1);
11669         }
11670         ptr = (char*) FILE_ptr(fp);
11671         cnt = (size_t)FILE_cnt(fp);
11672
11673         FILE_ptr(fp) += 42;
11674
11675         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11676                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11677                 exit (1);
11678         }
11679         if (FILE_cnt(fp) <= 20) {
11680                 printf ("Fail (<20 chars to test)");
11681                 exit (1);
11682         }
11683         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11684                 puts("Fail compare");
11685                 exit (1);
11686         }
11687         if (cnt == FILE_cnt(fp)) {
11688                 puts("Pass_unchanged");
11689                 exit (0);
11690         }       
11691         if (FILE_cnt(fp) == (cnt - 42)) {
11692                 puts("Pass_changed");
11693                 exit (0);
11694         }
11695         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11696         return 1;
11697
11698 }
11699 EOP
11700         set try
11701         if eval $compile; then
11702                 case `./try$exe_ext` in
11703                 Pass_changed)
11704                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11705                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11706                 Pass_unchanged)
11707                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11708                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11709                 Fail*)
11710                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11711                 *)
11712                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11713         esac
11714         else
11715                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11716         fi
11717         $rm -f try.c try
11718         ;;
11719 esac
11720
11721 : see if _base is also standard
11722 val="$undef"
11723 case "$d_stdstdio" in
11724 $define)
11725         $cat >try.c <<EOP
11726 #include <stdio.h>
11727 #define FILE_base(fp)   $stdio_base
11728 #define FILE_bufsiz(fp) $stdio_bufsiz
11729 int main() {
11730         FILE *fp = fopen("try.c", "r");
11731         char c = getc(fp);
11732         if (
11733                 19 <= FILE_bufsiz(fp) &&
11734                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11735         )
11736                 exit(0);
11737         exit(1);
11738 }
11739 EOP
11740         set try
11741         if eval $compile; then
11742                 if ./try; then
11743                         echo "And its _base field acts std."
11744                         val="$define"
11745                 else
11746                         echo "But its _base field isn't std."
11747                 fi
11748         else
11749                 echo "However, it seems to be lacking the _base field."
11750         fi
11751         $rm -f try.c try
11752         ;;
11753 esac
11754 set d_stdiobase
11755 eval $setvar
11756
11757 $cat >&4 <<EOM
11758 Checking how to access stdio streams by file descriptor number...
11759 EOM
11760 case "$stdio_stream_array" in
11761 '')     $cat >try.c <<EOCP
11762 #include <stdio.h>
11763 int main() {
11764   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11765     printf("yes\n");
11766 }
11767 EOCP
11768         for s in _iob __iob __sF
11769         do
11770                 set try -DSTDIO_STREAM_ARRAY=$s
11771                 if eval $compile; then
11772                         case "`./try$exe_ext`" in
11773                         yes)    stdio_stream_array=$s; break ;;
11774                         esac
11775                 fi
11776         done
11777         $rm -f try.* try$exe_ext
11778 esac
11779 case "$stdio_stream_array" in
11780 '')     $cat >&4 <<EOM
11781 I can't figure out how to access stdio streams by file descriptor number.
11782 EOM
11783         d_stdio_stream_array="$undef"
11784         ;;
11785 *)      $cat >&4 <<EOM
11786 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11787 EOM
11788         d_stdio_stream_array="$define"
11789         ;;
11790 esac
11791
11792 : see if strcoll exists
11793 set strcoll d_strcoll
11794 eval $inlibc
11795
11796 : check for structure copying
11797 echo " "
11798 echo "Checking to see if your C compiler can copy structs..." >&4
11799 $cat >try.c <<'EOCP'
11800 int main()
11801 {
11802         struct blurfl {
11803                 int dyick;
11804         } foo, bar;
11805
11806         foo = bar;
11807 }
11808 EOCP
11809 if $cc -c try.c >/dev/null 2>&1 ; then
11810         val="$define"
11811         echo "Yup, it can."
11812 else
11813         val="$undef"
11814         echo "Nope, it can't."
11815 fi
11816 set d_strctcpy
11817 eval $setvar
11818 $rm -f try.*
11819
11820 : see if strerror and/or sys_errlist[] exist
11821 echo " "
11822 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11823     if set strerror val -f d_strerror; eval $csym; $val; then
11824                 echo 'strerror() found.' >&4
11825                 d_strerror="$define"
11826                 d_strerrm='strerror(e)'
11827                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11828                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11829                         d_syserrlst="$define"
11830                 else
11831                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11832                         d_syserrlst="$undef"
11833                 fi
11834     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11835                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11836                 echo 'strerror() found in string header.' >&4
11837                 d_strerror="$define"
11838                 d_strerrm='strerror(e)'
11839                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11840                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11841                                 d_syserrlst="$define"
11842                 else
11843                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11844                         d_syserrlst="$undef"
11845                 fi
11846     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11847                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11848                 d_strerror="$undef"
11849                 d_syserrlst="$define"
11850                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11851     else
11852                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11853                 d_strerror="$undef"
11854                 d_syserrlst="$undef"
11855                 d_strerrm='"unknown"'
11856     fi
11857 fi
11858
11859 : see if strtod exists
11860 set strtod d_strtod
11861 eval $inlibc
11862
11863 : see if strtol exists
11864 set strtol d_strtol
11865 eval $inlibc
11866
11867 : see if strtold exists
11868 set strtold d_strtold
11869 eval $inlibc
11870
11871 : see if strtoll exists
11872 set strtoll d_strtoll
11873 eval $inlibc
11874
11875 case "$d_longlong-$d_strtoll" in
11876 "$define-$define")
11877         $cat <<EOM
11878 Checking whether your strtoll() works okay...
11879 EOM
11880         $cat >try.c <<'EOCP'
11881 #include <errno.h>
11882 #ifdef __hpux
11883 #define strtoll __strtoll
11884 #endif
11885 #ifdef __EMX__
11886 #define strtoll _strtoll
11887 #endif
11888 #include <stdio.h>
11889 extern long long int strtoll(char *s, char **, int); 
11890 static int bad = 0;
11891 int check(char *s, long long ell, int een) {
11892         long long gll;
11893         errno = 0;
11894         gll = strtoll(s, 0, 10);
11895         if (!((gll == ell) && (errno == een)))
11896                 bad++;
11897 }
11898 int main() {
11899         check(" 1",                                      1LL, 0);
11900         check(" 0",                                      0LL, 0);
11901         check("-1",                                     -1LL, 0);
11902         check("-9223372036854775808", -9223372036854775808LL, 0);
11903         check("-9223372036854775808", -9223372036854775808LL, 0);
11904         check(" 9223372036854775807",  9223372036854775807LL, 0);
11905         check("-9223372036854775808", -9223372036854775808LL, 0);
11906         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11907         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11908         if (!bad)
11909                 printf("ok\n");
11910 }
11911 EOCP
11912         set try
11913         if eval $compile; then
11914                 yyy=`./try`
11915                 case "$yyy" in
11916                 ok) echo "Your strtoll() seems to be working okay." ;;
11917                 *) cat <<EOM >&4
11918 Your strtoll() doesn't seem to be working okay.
11919 EOM
11920                    d_strtoll="$undef"
11921                    ;;
11922                 esac
11923         else
11924                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11925                 d_strtoll="$undef"
11926         fi
11927         ;;
11928 esac
11929
11930 : see if strtoul exists
11931 set strtoul d_strtoul
11932 eval $inlibc
11933
11934 : see if strtoull exists
11935 set strtoull d_strtoull
11936 eval $inlibc
11937
11938 case "$d_longlong-$d_strtoull" in
11939 "$define-$define")
11940         $cat <<EOM
11941 Checking whether your strtoull() works okay...
11942 EOM
11943         $cat >try.c <<'EOCP'
11944 #include <errno.h>
11945 #ifdef __hpux
11946 #define strtoull __strtoull
11947 #endif
11948 #include <stdio.h>
11949 extern unsigned long long int strtoull(char *s, char **, int); 
11950 static int bad = 0;
11951 int check(char *s, long long eull, int een) {
11952         long long gull;
11953         errno = 0;
11954         gull = strtoull(s, 0, 10);
11955         if (!((gull == eull) && (errno == een)))
11956                 bad++;
11957 }
11958 int main() {
11959         check(" 1",                                       1LL, 0);
11960         check(" 0",                                       0LL, 0);
11961         check("18446744073709551615", 18446744073709551615ULL, 0);
11962         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11963         if (!bad)
11964                 printf("ok\n");
11965 }
11966 EOCP
11967         set try
11968         if eval $compile; then
11969                 case "`./try`" in
11970                 ok) echo "Your strtoull() seems to be working okay." ;;
11971                 *) cat <<EOM >&4
11972 Your strtoull() doesn't seem to be working okay.
11973 EOM
11974                    d_strtoull="$undef"
11975                    ;;
11976                 esac
11977         fi
11978         ;;
11979 esac
11980
11981 : see if strtouq exists
11982 set strtouq d_strtouq
11983 eval $inlibc
11984
11985 : see if strxfrm exists
11986 set strxfrm d_strxfrm
11987 eval $inlibc
11988
11989 : see if symlink exists
11990 set symlink d_symlink
11991 eval $inlibc
11992
11993 : see if syscall exists
11994 set syscall d_syscall
11995 eval $inlibc
11996
11997 : see if sysconf exists
11998 set sysconf d_sysconf
11999 eval $inlibc
12000
12001 : see if system exists
12002 set system d_system
12003 eval $inlibc
12004
12005 : see if tcgetpgrp exists
12006 set tcgetpgrp d_tcgetpgrp
12007 eval $inlibc
12008
12009 : see if tcsetpgrp exists
12010 set tcsetpgrp d_tcsetpgrp
12011 eval $inlibc
12012
12013 : see if prototype for telldir is available
12014 echo " "
12015 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12016 eval $hasproto
12017
12018 : see if this is a sys/times.h system
12019 set sys/times.h i_systimes
12020 eval $inhdr
12021
12022 : see if times exists
12023 echo " "
12024 if set times val -f d_times; eval $csym; $val; then
12025         echo 'times() found.' >&4
12026         d_times="$define"
12027         inc=''
12028         case "$i_systimes" in
12029         "$define") inc='sys/times.h';;
12030         esac
12031         rp="What is the type returned by times() on this system?"
12032         set clock_t clocktype long stdio.h sys/types.h $inc
12033         eval $typedef_ask
12034 else
12035         echo 'times() NOT found, hope that will do.' >&4
12036         d_times="$undef"
12037         clocktype='int'
12038 fi
12039
12040 : see if truncate exists
12041 set truncate d_truncate
12042 eval $inlibc
12043
12044 : see if tzname[] exists
12045 echo " "
12046 if set tzname val -a d_tzname; eval $csym; $val; then
12047         val="$define"
12048         echo 'tzname[] found.' >&4
12049 else
12050         val="$undef"
12051         echo 'tzname[] NOT found.' >&4
12052 fi
12053 set d_tzname
12054 eval $setvar
12055
12056 : see if umask exists
12057 set umask d_umask
12058 eval $inlibc
12059
12060 : see if ustat exists
12061 set ustat d_ustat
12062 eval $inlibc
12063
12064 : backward compatibility for d_hvfork
12065 if test X$d_hvfork != X; then
12066         d_vfork="$d_hvfork"
12067         d_hvfork=''
12068 fi
12069 : see if there is a vfork
12070 val=''
12071 set vfork val
12072 eval $inlibc
12073
12074 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12075 : perl on Solaris 2.x, and probably elsewhere.
12076 case "$val" in
12077 $define)
12078         echo " "
12079         case "$usevfork" in
12080         false) dflt='n';;
12081         *) dflt='y';;
12082         esac
12083         cat <<'EOM'
12084  
12085 Perl can only use a vfork() that doesn't suffer from strict
12086 restrictions on calling functions or modifying global data in
12087 the child.  For example, glibc-2.1 contains such a vfork()
12088 that is unsuitable.  If your system provides a proper fork()
12089 call, chances are that you do NOT want perl to use vfork().
12090
12091 EOM
12092         rp="Do you still want to use vfork()?"
12093         . ./myread
12094         case "$ans" in
12095         y|Y) ;;
12096         *)
12097                 echo "Ok, we won't use vfork()."
12098                 val="$undef"
12099                 ;;
12100         esac
12101         ;;
12102 esac
12103 set d_vfork
12104 eval $setvar
12105 case "$d_vfork" in
12106 $define) usevfork='true';;
12107 *) usevfork='false';;
12108 esac
12109
12110 : see if this is an sysdir system
12111 set sys/dir.h i_sysdir
12112 eval $inhdr
12113
12114 : see if this is an sysndir system
12115 set sys/ndir.h i_sysndir
12116 eval $inhdr
12117
12118 : see if closedir exists
12119 set closedir d_closedir
12120 eval $inlibc
12121
12122 case "$d_closedir" in
12123 "$define")
12124         echo " "
12125         echo "Checking whether closedir() returns a status..." >&4
12126         cat > closedir.c <<EOM
12127 #$i_dirent I_DIRENT             /**/
12128 #$i_sysdir I_SYS_DIR            /**/
12129 #$i_sysndir I_SYS_NDIR          /**/
12130 #$i_systypes I_SYS_TYPES        /**/
12131
12132 #if defined(I_SYS_TYPES)
12133 #include <sys/types.h>
12134 #endif
12135 #if defined(I_DIRENT)
12136 #include <dirent.h>
12137 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12138 #include <sys/dir.h>
12139 #endif
12140 #else
12141 #ifdef I_SYS_NDIR
12142 #include <sys/ndir.h>
12143 #else
12144 #ifdef I_SYS_DIR
12145 #ifdef hp9000s500
12146 #include <ndir.h>       /* may be wrong in the future */
12147 #else
12148 #include <sys/dir.h>
12149 #endif
12150 #endif
12151 #endif
12152 #endif 
12153 int main() { return closedir(opendir(".")); }
12154 EOM
12155         set closedir
12156         if eval $compile_ok; then
12157                 if ./closedir > /dev/null 2>&1 ; then
12158                         echo "Yes, it does."
12159                         val="$undef"
12160                 else
12161                         echo "No, it doesn't."
12162                         val="$define"
12163                 fi
12164         else
12165                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12166                 val="$define"
12167         fi
12168         ;;
12169 *)
12170         val="$undef";
12171         ;;
12172 esac
12173 set d_void_closedir
12174 eval $setvar
12175 $rm -f closedir*
12176 : see if there is a wait4
12177 set wait4 d_wait4
12178 eval $inlibc
12179
12180 : see if waitpid exists
12181 set waitpid d_waitpid
12182 eval $inlibc
12183
12184 : see if wcstombs exists
12185 set wcstombs d_wcstombs
12186 eval $inlibc
12187
12188 : see if wctomb exists
12189 set wctomb d_wctomb
12190 eval $inlibc
12191
12192 : preserve RCS keywords in files with variable substitution, grrr
12193 Date='$Date'
12194 Id='$Id'
12195 Log='$Log'
12196 RCSfile='$RCSfile'
12197 Revision='$Revision'
12198
12199 case "$crosscompile" in
12200 ''|[nN]*) crosscompile="$undef" ;;
12201 esac
12202
12203 case "$osname" in
12204 next|rhapsody|darwin) multiarch="$define" ;;
12205 esac
12206 case "$multiarch" in
12207 ''|[nN]*) multiarch="$undef" ;;
12208 esac
12209
12210 : check for alignment requirements
12211 echo " "
12212 case "$crosscompile$multiarch" in
12213 *$define*)
12214         $cat <<EOM
12215 You seem to be either cross-compiling or doing a multiarchitecture build,
12216 skipping the memory alignment check.
12217
12218 EOM
12219         case "$alignbytes" in
12220         '') alignbytes=8 ;;
12221         esac
12222         ;;
12223 *)
12224         case "$alignbytes" in
12225         '') echo "Checking alignment constraints..." >&4
12226                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12227                         $cat >try.c <<'EOCP'
12228 typedef long double NV;
12229 EOCP
12230                 else
12231                         $cat >try.c <<'EOCP'
12232 typedef double NV;
12233 EOCP
12234                 fi
12235                 $cat >>try.c <<'EOCP'
12236 #include <stdio.h>
12237 struct foobar {
12238         char foo;
12239         NV bar;
12240 } try_algn;
12241 int main()
12242 {
12243     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12244     return(0);
12245 }
12246 EOCP
12247                 set try
12248                 if eval $compile_ok; then
12249                         dflt=`./try`
12250                 else
12251                         dflt='8'
12252                         echo "(I can't seem to compile the test program...)"
12253                 fi
12254                 ;;
12255         *) dflt="$alignbytes"
12256                 ;;
12257         esac
12258         rp="Doubles must be aligned on a how-many-byte boundary?"
12259         . ./myread
12260         alignbytes="$ans"
12261         $rm -f try.c try
12262         ;;
12263 esac
12264
12265
12266 : set the base revision
12267 baserev=5.0
12268
12269 : check for ordering of bytes in a long
12270 echo " "
12271 case "$crosscompile$multiarch" in
12272 *$define*)
12273         $cat <<EOM
12274 You seem to be either cross-compiling or doing a multiarchitecture build,
12275 skipping the byteorder check.
12276
12277 EOM
12278         byteorder='0xffff'
12279         ;;
12280 *)
12281         case "$byteorder" in
12282         '')
12283                 $cat <<'EOM'
12284 In the following, larger digits indicate more significance.  A big-endian
12285 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12286 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12287 machines may have weird orders like 3412.  A Cray will report 87654321,
12288 an Alpha will report 12345678. If the test program works the default is
12289 probably right.
12290 I'm now running the test program...
12291 EOM
12292                 $cat >try.c <<'EOCP'
12293 #include <stdio.h>
12294 int main()
12295 {
12296         int i;
12297         union {
12298                 unsigned long l;
12299                 char c[sizeof(long)];
12300         } u;
12301
12302         if (sizeof(long) > 4)
12303                 u.l = (0x08070605L << 32) | 0x04030201L;
12304         else
12305                 u.l = 0x04030201L;
12306         for (i = 0; i < sizeof(long); i++)
12307                 printf("%c", u.c[i]+'0');
12308         printf("\n");
12309         exit(0);
12310 }
12311 EOCP
12312                 xxx_prompt=y
12313                 set try
12314                 if eval $compile && ./try > /dev/null; then
12315                         dflt=`./try`
12316                         case "$dflt" in
12317                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12318                                 echo "(The test program ran ok.)"
12319                                 echo "byteorder=$dflt"
12320                                 xxx_prompt=n
12321                         ;;
12322                         ????|????????) echo "(The test program ran ok.)" ;;
12323                         *) echo "(The test program didn't run right for some reason.)" ;;
12324                         esac
12325                 else
12326                         dflt='4321'
12327                         cat <<'EOM'
12328 (I can't seem to compile the test program.  Guessing big-endian...)
12329 EOM
12330                 fi
12331                 case "$xxx_prompt" in
12332                 y)
12333                         rp="What is the order of bytes in a long?"
12334                         . ./myread
12335                         byteorder="$ans"
12336                         ;;
12337                 *)      byteorder=$dflt
12338                         ;;
12339                 esac
12340                 ;;
12341         esac
12342         $rm -f try.c try
12343         ;;
12344 esac
12345
12346
12347 : how do we catenate cpp tokens here?
12348 echo " "
12349 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12350 $cat >cpp_stuff.c <<'EOCP'
12351 #define RCAT(a,b)a/**/b
12352 #define ACAT(a,b)a ## b
12353 RCAT(Rei,ser)
12354 ACAT(Cir,cus)
12355 EOCP
12356 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12357 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12358         echo "Oh!  Smells like ANSI's been here." >&4
12359         echo "We can catify or stringify, separately or together!"
12360         cpp_stuff=42
12361 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12362         echo "Ah, yes!  The good old days!" >&4
12363         echo "However, in the good old days we don't know how to stringify and"
12364         echo "catify at the same time."
12365         cpp_stuff=1
12366 else
12367         $cat >&4 <<EOM
12368 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12369 to have to edit the values of CAT[2-5] in config.h...
12370 EOM
12371         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12372 fi
12373 $rm -f cpp_stuff.*
12374
12375 : see if this is a db.h system
12376 set db.h i_db
12377 eval $inhdr
12378
12379 case "$i_db" in
12380 $define)
12381         : Check db version.
12382         echo " "
12383         echo "Checking Berkeley DB version ..." >&4
12384         $cat >try.c <<EOCP
12385 #$d_const HASCONST
12386 #ifndef HASCONST
12387 #define const
12388 #endif
12389 #include <sys/types.h>
12390 #include <stdio.h>
12391 #include <db.h>
12392 int main()
12393 {
12394 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12395     int Major, Minor, Patch ;
12396     unsigned long Version ;
12397     (void)db_version(&Major, &Minor, &Patch) ;
12398     printf("You have Berkeley DB Version 2 or greater\n");
12399
12400     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12401                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12402     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12403                 Major, Minor, Patch) ;
12404
12405     /* check that db.h & libdb are compatible */
12406     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12407         printf("db.h and libdb are incompatible\n") ;
12408         exit(3);        
12409     }
12410
12411     printf("db.h and libdb are compatible\n") ;
12412
12413     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12414                 + DB_VERSION_PATCH ;
12415
12416     /* needs to be >= 2.3.4 */
12417     if (Version < 2003004) {
12418     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12419         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12420         exit(2);        
12421     }
12422
12423     exit(0);
12424 #else
12425 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12426     printf("You have Berkeley DB Version 1\n");
12427     exit(0);    /* DB version < 2: the coast is clear. */
12428 #else
12429     exit(1);    /* <db.h> not Berkeley DB? */
12430 #endif
12431 #endif
12432 }
12433 EOCP
12434         set try
12435         if eval $compile_ok && ./try; then
12436                 echo 'Looks OK.' >&4
12437         else
12438                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12439                 i_db=$undef
12440                 case " $libs " in
12441                 *"-ldb "*)
12442                         : Remove db from list of libraries to use
12443                         echo "Removing unusable -ldb from library list" >&4
12444                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12445                         shift
12446                         libs="$*"
12447                         echo "libs = $libs" >&4
12448                         ;;
12449                 esac
12450         fi
12451         $rm -f try.*
12452         ;;
12453 esac
12454
12455 case "$i_db" in
12456 define)
12457         : Check the return type needed for hash 
12458         echo " "
12459         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12460         $cat >try.c <<EOCP
12461 #$d_const HASCONST
12462 #ifndef HASCONST
12463 #define const
12464 #endif
12465 #include <sys/types.h>
12466 #include <db.h>
12467
12468 #ifndef DB_VERSION_MAJOR
12469 u_int32_t hash_cb (ptr, size)
12470 const void *ptr;
12471 size_t size;
12472 {
12473 }
12474 HASHINFO info;
12475 int main()
12476 {
12477         info.hash = hash_cb;
12478 }
12479 #endif
12480 EOCP
12481         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12482                 if $contains warning try.out >>/dev/null 2>&1 ; then
12483                         db_hashtype='int'
12484                 else
12485                         db_hashtype='u_int32_t'
12486                 fi
12487         else
12488                 : XXX Maybe we should just give up here.
12489                 db_hashtype=u_int32_t
12490                 $cat try.out >&4
12491                 echo "Help:  I can't seem to compile the db test program." >&4
12492                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12493         fi
12494         $rm -f try.*
12495         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12496         ;;
12497 *)      db_hashtype=u_int32_t
12498         ;;
12499 esac
12500 case "$i_db" in
12501 define)
12502         : Check the return type needed for prefix 
12503         echo " "
12504         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12505         cat >try.c <<EOCP
12506 #$d_const HASCONST
12507 #ifndef HASCONST
12508 #define const
12509 #endif
12510 #include <sys/types.h>
12511 #include <db.h>
12512
12513 #ifndef DB_VERSION_MAJOR
12514 size_t prefix_cb (key1, key2)
12515 const DBT *key1;
12516 const DBT *key2;
12517 {
12518 }
12519 BTREEINFO info;
12520 int main()
12521 {
12522         info.prefix = prefix_cb;
12523 }
12524 #endif
12525 EOCP
12526         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12527                 if $contains warning try.out >>/dev/null 2>&1 ; then
12528                         db_prefixtype='int'
12529                 else
12530                         db_prefixtype='size_t'
12531                 fi
12532         else
12533                 db_prefixtype='size_t'
12534                 : XXX Maybe we should just give up here.
12535                 $cat try.out >&4
12536                 echo "Help:  I can't seem to compile the db test program." >&4
12537                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12538         fi
12539         $rm -f try.*
12540         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12541         ;;
12542 *)      db_prefixtype='size_t'
12543         ;;
12544 esac
12545
12546 : check for void type
12547 echo " "
12548 echo "Checking to see how well your C compiler groks the void type..." >&4
12549 case "$voidflags" in
12550 '')
12551         $cat >try.c <<'EOCP'
12552 #if TRY & 1
12553 void sub() {
12554 #else
12555 sub() {
12556 #endif
12557         extern void moo();      /* function returning void */
12558         void (*goo)();          /* ptr to func returning void */
12559 #if TRY & 8
12560         void *hue;              /* generic ptr */
12561 #endif
12562 #if TRY & 2
12563         void (*foo[10])();
12564 #endif
12565
12566 #if TRY & 4
12567         if(goo == moo) {
12568                 exit(0);
12569         }
12570 #endif
12571         exit(0);
12572 }
12573 int main() { sub(); }
12574 EOCP
12575         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12576                 voidflags=$defvoidused
12577         echo "Good.  It appears to support void to the level $package wants.">&4
12578                 if $contains warning .out >/dev/null 2>&1; then
12579                         echo "However, you might get some warnings that look like this:"
12580                         $cat .out
12581                 fi
12582         else
12583 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12584                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12585                         echo "It supports 1..."
12586                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12587                                 echo "It also supports 2..."
12588                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12589                                         voidflags=7
12590                                         echo "And it supports 4 but not 8 definitely."
12591                                 else
12592                                         echo "It doesn't support 4..."
12593                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12594                                                 voidflags=11
12595                                                 echo "But it supports 8."
12596                                         else
12597                                                 voidflags=3
12598                                                 echo "Neither does it support 8."
12599                                         fi
12600                                 fi
12601                         else
12602                                 echo "It does not support 2..."
12603                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12604                                         voidflags=13
12605                                         echo "But it supports 4 and 8."
12606                                 else
12607                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12608                                                 voidflags=5
12609                                                 echo "And it supports 4 but has not heard about 8."
12610                                         else
12611                                                 echo "However it supports 8 but not 4."
12612                                         fi
12613                                 fi
12614                         fi
12615                 else
12616                         echo "There is no support at all for void."
12617                         voidflags=0
12618                 fi
12619         fi
12620 esac
12621 case "$voidflags" in
12622 "$defvoidused") ;;
12623 *)      $cat >&4 <<'EOM'
12624   Support flag bits are:
12625     1: basic void declarations.
12626     2: arrays of pointers to functions returning void.
12627     4: operations between pointers to and addresses of void functions.
12628     8: generic void pointers.
12629 EOM
12630         dflt="$voidflags";
12631         rp="Your void support flags add up to what?"
12632         . ./myread
12633         voidflags="$ans"
12634         ;;
12635 esac
12636 $rm -f try.* .out
12637
12638
12639 : How can we generate normalized random numbers ?
12640 echo " "
12641 echo "Looking for a random number function..." >&4
12642 case "$randfunc" in
12643 '')
12644         if set drand48 val -f; eval $csym; $val; then
12645                 dflt="drand48"
12646                 echo "Good, found drand48()." >&4
12647         elif set random val -f; eval $csym; $val; then
12648                 dflt="random"
12649                 echo "OK, found random()." >&4
12650         else
12651                 dflt="rand"
12652                 echo "Yick, looks like I have to use rand()." >&4
12653         fi
12654         echo " "
12655         ;;
12656 *)
12657         dflt="$randfunc"
12658         ;;
12659 esac
12660 cont=true
12661
12662 case "$ccflags" in
12663 *-Dmy_rand=*|*-Dmy_srand=*)
12664         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12665         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12666         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12667         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12668         ;;
12669 esac
12670
12671 while $test "$cont"; do
12672         rp="Use which function to generate random numbers?"
12673         . ./myread
12674         if $test "$ans" = "$dflt"; then
12675                 : null
12676         else
12677                 randbits=''
12678         fi
12679         randfunc="$ans"
12680         if set $ans val -f; eval $csym; $val; then
12681                 cont=''
12682         else
12683                 dflt=y
12684                 rp="I cannot find function $ans. Use that name anyway?"
12685                 . ./myread
12686                 dflt=rand
12687                 case "$ans" in
12688                         [yY]*) cont='';;
12689                 esac
12690         fi
12691         case "$cont" in
12692         '')
12693                 case "$randfunc" in
12694                 drand48)
12695                         drand01="drand48()"
12696                         seedfunc="srand48"
12697                         randbits=48
12698                         randseedtype=long
12699                         ;;
12700                 rand|random)
12701                         case "$randbits" in
12702                         '')
12703 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12704                                 $cat >try.c <<EOCP
12705 #$i_unistd I_UNISTD
12706 #$i_stdlib I_STDLIB
12707 #include <stdio.h>
12708 #ifdef I_UNISTD
12709 #  include <unistd.h>
12710 #endif
12711 #ifdef I_STDLIB
12712 #  include <stdlib.h>
12713 #endif
12714 int main()
12715 {
12716         register int i;
12717         register unsigned long tmp;
12718         register unsigned long max = 0L;
12719
12720         for (i = 1000; i; i--) {
12721                 tmp = (unsigned long) $randfunc();
12722                 if (tmp > max) max = tmp;
12723         }
12724         for (i = 0; max; i++)
12725                 max /= 2;
12726         printf("%d\n",i);
12727 }
12728 EOCP
12729                                 set try
12730                                 if eval $compile_ok; then
12731                                         dflt=`try`
12732                                 else
12733                                         dflt='?'
12734                                         echo "(I can't seem to compile the test program...)"
12735                                 fi
12736                                 ;;
12737                         *)
12738                                 dflt="$randbits"
12739                                 ;;
12740                         esac
12741                         rp="How many bits does your $randfunc() function produce?"
12742                         . ./myread
12743                         randbits="$ans"
12744                         $rm -f try.c try
12745                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12746                         seedfunc="s$randfunc"
12747                         randseedtype=unsigned
12748                         ;;
12749                 *)
12750                         dflt="31"
12751                         rp="How many bits does your $randfunc() function produce?"
12752                         . ./myread
12753                         randbits="$ans"
12754                         seedfunc="s$randfunc"
12755                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12756                         if set $seedfunc val -f; eval $csym; $val; then
12757                                 echo "(Using $seedfunc() to seed random generator)"
12758                         else
12759                                 echo "(Warning: no $seedfunc() to seed random generator)"
12760                                 seedfunc=rand
12761                         fi
12762                         randseedtype=unsigned
12763                         ;;
12764                 esac
12765                 ;;
12766         esac
12767 done
12768
12769 echo " "
12770 echo "Determining whether or not we are on an EBCDIC system..." >&4
12771 $cat >tebcdic.c <<'EOM'
12772 int main()
12773 {
12774   if ('M'==0xd4) return 0;
12775   return 1;
12776 }
12777 EOM
12778
12779 val=$undef
12780 set tebcdic
12781 if eval $compile_ok; then
12782         if ./tebcdic; then
12783                 echo "You seem to speak EBCDIC." >&4
12784                 val="$define"
12785         else
12786                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12787         fi
12788 else
12789         echo "I'm unable to compile the test program." >&4
12790         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12791 fi
12792 $rm -f tebcdic.c tebcdic
12793 set ebcdic
12794 eval $setvar
12795
12796 echo " "
12797 $cat >&4 <<EOM
12798 Checking how to flush all pending stdio output...
12799 EOM
12800 # I only know how to find the first 32 possibly open files on SunOS.
12801 # See also hints/sunos_4_1.sh and util.c  --AD
12802 case "$osname" in
12803 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12804 esac
12805 $cat >>try.c <<EOCP
12806 #include <stdio.h>
12807 #$i_unistd I_UNISTD
12808 #ifdef I_UNISTD
12809 # include <unistd.h>
12810 #endif
12811 #$d_sysconf HAS_SYSCONF
12812 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12813 #ifdef HAS_STDIO_STREAM_ARRAY
12814 # define STDIO_STREAM_ARRAY $stdio_stream_array
12815 #endif
12816 int main() {
12817   FILE* p = fopen("try.out", "w");
12818 #ifdef TRY_FPUTC
12819   fputc('x', p);
12820 #else
12821 # ifdef TRY_FPRINTF
12822   fprintf(p, "x");
12823 # endif
12824 #endif
12825 #ifdef TRY_FFLUSH_NULL
12826   fflush(NULL);
12827 #endif
12828 #ifdef TRY_FFLUSH_ALL
12829   {
12830     long open_max = -1;
12831 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12832     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12833 # else
12834 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12835     open_max = sysconf(_SC_OPEN_MAX);
12836 #  else
12837 #   ifdef FOPEN_MAX
12838     open_max = FOPEN_MAX;
12839 #   else
12840 #    ifdef OPEN_MAX
12841     open_max = OPEN_MAX;
12842 #    else
12843 #     ifdef _NFILE
12844     open_max = _NFILE;
12845 #     endif
12846 #    endif
12847 #   endif
12848 #  endif
12849 # endif 
12850 # ifdef HAS_STDIO_STREAM_ARRAY
12851     if (open_max > 0) {
12852       long i;
12853       for (i = 0; i < open_max; i++)
12854             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12855                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12856                 STDIO_STREAM_ARRAY[i]._flag)
12857                 fflush(&STDIO_STREAM_ARRAY[i]);
12858     }   
12859   }
12860 # endif
12861 #endif
12862   _exit(42);
12863 }
12864 EOCP
12865 : first we have to find out how _not_ to flush
12866 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12867     output=''
12868     set try -DTRY_FPUTC
12869     if eval $compile; then
12870             $rm -f try.out
12871             ./try$exe_ext 2>/dev/null
12872             if $test ! -s try.out -a "X$?" = X42; then
12873                 output=-DTRY_FPUTC
12874             fi
12875     fi
12876     case "$output" in
12877     '')
12878             set try -DTRY_FPRINTF
12879             $rm -f try.out
12880             if eval $compile; then
12881                     $rm -f try.out
12882                     ./try$exe_ext 2>/dev/null
12883                     if $test ! -s try.out -a "X$?" = X42; then
12884                         output=-DTRY_FPRINTF
12885                     fi
12886             fi
12887         ;;
12888     esac
12889 fi
12890 : check for fflush NULL behaviour
12891 case "$fflushNULL" in
12892 '')     set try -DTRY_FFLUSH_NULL $output
12893         if eval $compile; then
12894                 $rm -f try.out
12895                 ./try$exe_ext 2>/dev/null
12896                 code="$?"
12897                 if $test -s try.out -a "X$code" = X42; then
12898                         fflushNULL="`$cat try.out`"
12899                 else
12900                         if $test "X$code" != X42; then
12901                                 $cat >&4 <<EOM
12902 (If this test failed, don't worry, we'll try another method shortly.)
12903 EOM
12904                         fi
12905                 fi
12906         fi
12907         $rm -f core try.core core.try.*
12908         case "$fflushNULL" in
12909         x)      $cat >&4 <<EOM
12910 Your fflush(NULL) works okay for output streams.
12911 Let's see if it clobbers input pipes...
12912 EOM
12913 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12914 # bug that improperly flushes the input end of pipes.  So we avoid the
12915 # autoflush on fork/system/exec support for now. :-(
12916 $cat >tryp.c <<EOCP
12917 #include <stdio.h>
12918 int
12919 main(int argc, char **argv)
12920 {
12921     char buf[1024];
12922     int i;
12923     char *bp = buf;
12924     while (1) {
12925         while ((i = getc(stdin)) != -1
12926                && (*bp++ = i) != '\n'
12927                && bp < &buf[1024])
12928         /* DO NOTHING */ ;
12929         *bp = '\0';
12930         fprintf(stdout, "%s", buf);
12931         fflush(NULL);
12932         if (i == -1)
12933             return 0;
12934         bp = buf;
12935     }
12936 }
12937 EOCP
12938                 fflushNULL="$define"
12939                 set tryp
12940                 if eval $compile; then
12941                     $rm -f tryp.out
12942                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12943                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12944                        $cat >&4 <<EOM
12945 fflush(NULL) seems to behave okay with input streams.
12946 EOM
12947                         fflushNULL="$define"
12948                     else
12949                         $cat >&4 <<EOM
12950 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12951 EOM
12952                         fflushNULL="$undef"
12953                     fi
12954                 fi
12955                 $rm -f core tryp.c tryp.core core.tryp.*
12956                 ;;
12957         '')     $cat >&4 <<EOM
12958 Your fflush(NULL) isn't working (contrary to ANSI C).
12959 EOM
12960                 fflushNULL="$undef"
12961                 ;;
12962         *)      $cat >&4 <<EOM
12963 Cannot figure out whether your fflush(NULL) works or not.
12964 I'm assuming it doesn't (contrary to ANSI C).
12965 EOM
12966                 fflushNULL="$undef"
12967                 ;;
12968         esac
12969         ;;
12970 $define|true|[yY]*)
12971         fflushNULL="$define"
12972         ;;
12973 *)
12974         fflushNULL="$undef"
12975         ;;
12976 esac
12977 : check explicit looping only if NULL did not work, and if the pipe
12978 : bug does not show up on an explicit flush too
12979 case "$fflushNULL" in
12980 "$undef")
12981         $cat >tryp.c <<EOCP
12982 #include <stdio.h>
12983 int
12984 main(int argc, char **argv)
12985 {
12986     char buf[1024];
12987     int i;
12988     char *bp = buf;
12989     while (1) {
12990         while ((i = getc(stdin)) != -1
12991                && (*bp++ = i) != '\n'
12992                && bp < &buf[1024])
12993         /* DO NOTHING */ ;
12994         *bp = '\0';
12995         fprintf(stdout, "%s", buf);
12996         fflush(stdin);
12997         if (i == -1)
12998             return 0;
12999         bp = buf;
13000     }
13001 }
13002 EOCP
13003         set tryp
13004         if eval $compile; then
13005             $rm -f tryp.out
13006             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13007             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13008                $cat >&4 <<EOM
13009 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13010 EOM
13011                 : now check for fflushall behaviour
13012                 case "$fflushall" in
13013                 '')     set try -DTRY_FFLUSH_ALL $output
13014                         if eval $compile; then
13015                                 $cat >&4 <<EOM
13016 (Now testing the other method--but note that this also may fail.)
13017 EOM
13018                                 $rm -f try.out
13019                                 ./try$exe_ext 2>/dev/null
13020                                 if $test -s try.out -a "X$?" = X42; then
13021                                         fflushall="`$cat try.out`"
13022                                 fi
13023                         fi
13024                         $rm -f core try.core core.try.*
13025                         case "$fflushall" in
13026                         x)      $cat >&4 <<EOM
13027 Whew. Flushing explicitly all the stdio streams works.
13028 EOM
13029                                 fflushall="$define"
13030                                 ;;
13031                         '')     $cat >&4 <<EOM
13032 Sigh. Flushing explicitly all the stdio streams doesn't work.
13033 EOM
13034                                 fflushall="$undef"
13035                                 ;;
13036                         *)      $cat >&4 <<EOM
13037 Cannot figure out whether flushing stdio streams explicitly works or not.
13038 I'm assuming it doesn't.
13039 EOM
13040                                 fflushall="$undef"
13041                                 ;;
13042                         esac
13043                         ;;
13044                 "$define"|true|[yY]*)
13045                         fflushall="$define"
13046                         ;;
13047                 *)
13048                         fflushall="$undef"
13049                         ;;
13050                 esac
13051             else
13052                 $cat >&4 <<EOM
13053 All is futile.  Even fflush(stdin) clobbers input pipes!
13054 EOM
13055                 fflushall="$undef"
13056             fi
13057         else
13058             fflushall="$undef"
13059         fi
13060         $rm -f core tryp.c tryp.core core.tryp.*
13061         ;;
13062 *)      fflushall="$undef"
13063         ;;
13064 esac
13065
13066 case "$fflushNULL$fflushall" in
13067 undefundef)
13068         $cat <<EOM
13069 OK, I give up.  I cannot figure out how to flush pending stdio output.
13070 We won't be flushing handles at all before fork/exec/popen.
13071 EOM
13072         ;;
13073 esac
13074 $rm -f try.* try$exe_ext
13075
13076 : Store the full pathname to the ar program for use in the C program
13077 : Respect a hint or command line value for full_ar.
13078 case "$full_ar" in
13079 '') full_ar=$ar ;;
13080 esac
13081
13082 : Store the full pathname to the sed program for use in the C program
13083 full_sed=$sed
13084
13085 : see what type gids are declared as in the kernel
13086 echo " "
13087 echo "Looking for the type for group ids returned by getgid()."
13088 set gid_t gidtype xxx stdio.h sys/types.h
13089 eval $typedef
13090 case "$gidtype" in
13091 xxx)
13092         xxx=`./findhdr sys/user.h`
13093         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13094         case $1 in
13095         unsigned) dflt="$1 $2" ;;
13096         *) dflt="$1" ;;
13097         esac
13098         ;;
13099 *) dflt="$gidtype";;
13100 esac
13101 case "$gidtype" in
13102 gid_t) echo "gid_t found." ;;
13103 *)      rp="What is the type for group ids returned by getgid()?"
13104         . ./myread
13105         gidtype="$ans"
13106         ;;
13107 esac
13108
13109 echo " "
13110 case "$gidtype" in
13111 *_t) zzz="$gidtype"     ;;
13112 *)   zzz="gid"          ;;
13113 esac
13114 echo "Checking the size of $zzz..." >&4 
13115 cat > try.c <<EOCP
13116 #include <sys/types.h>
13117 #include <stdio.h>
13118 int main() {
13119     printf("%d\n", (int)sizeof($gidtype));
13120     exit(0);
13121 }
13122 EOCP
13123 set try
13124 if eval $compile_ok; then
13125         yyy=`./try`
13126         case "$yyy" in
13127         '')     gidsize=4
13128                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13129                 ;;
13130         *)      gidsize=$yyy
13131                 echo "Your $zzz is $gidsize bytes long."
13132                 ;;
13133         esac
13134 else
13135         gidsize=4
13136         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13137 fi
13138
13139
13140 echo " "
13141 case "$gidtype" in
13142 *_t) zzz="$gidtype"     ;;
13143 *)   zzz="gid"          ;;
13144 esac
13145 echo "Checking the sign of $zzz..." >&4 
13146 cat > try.c <<EOCP
13147 #include <sys/types.h>
13148 #include <stdio.h>
13149 int main() {
13150         $gidtype foo = -1;
13151         if (foo < 0)
13152                 printf("-1\n");
13153         else
13154                 printf("1\n");
13155 }
13156 EOCP
13157 set try
13158 if eval $compile; then
13159         yyy=`./try`
13160         case "$yyy" in
13161         '')     gidsign=1
13162                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13163                 ;;
13164         *)      gidsign=$yyy
13165                 case "$gidsign" in
13166                  1) echo "Your $zzz is unsigned." ;;
13167                 -1) echo "Your $zzz is signed."   ;;
13168                 esac
13169                 ;;
13170         esac
13171 else
13172         gidsign=1
13173         echo "(I can't compile the test program--guessing unsigned.)" >&4
13174 fi
13175
13176
13177 echo " "
13178
13179 if $test X"$quadtype" != X; then
13180
13181 echo "Checking how to print 64-bit integers..." >&4
13182
13183 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13184         $cat >try.c <<'EOCP'
13185 #include <sys/types.h>
13186 #include <stdio.h>
13187 int main() {
13188   int q = 12345678901;
13189   printf("%ld\n", q);
13190 }
13191 EOCP
13192         set try
13193         if eval $compile; then
13194                 yyy=`./try$exe_ext`
13195                 case "$yyy" in
13196                 12345678901)
13197                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13198                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13199                         echo "We will use %d."
13200                         ;;
13201                 esac
13202         fi
13203 fi
13204
13205 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13206         $cat >try.c <<'EOCP'
13207 #include <sys/types.h>
13208 #include <stdio.h>
13209 int main() {
13210   long q = 12345678901;
13211   printf("%ld\n", q);
13212 }
13213 EOCP
13214         set try
13215         if eval $compile; then
13216                 yyy=`./try$exe_ext`
13217                 case "$yyy" in
13218                 12345678901)
13219                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13220                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13221                         echo "We will use %ld."
13222                         ;;
13223                 esac
13224         fi
13225 fi
13226
13227 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13228         $cat >try.c <<'EOCP'
13229 #include <sys/types.h>
13230 #include <inttypes.h>
13231 #include <stdio.h>
13232 int main() {
13233   int64_t q = 12345678901;
13234   printf("%" PRId64 "\n", q);
13235 }
13236 EOCP
13237         set try
13238         if eval $compile; then
13239                 yyy=`./try$exe_ext`
13240                 case "$yyy" in
13241                 12345678901)
13242                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13243                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13244                         echo "We will use the C9X style."
13245                         ;;
13246                 esac
13247         fi
13248 fi
13249
13250 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13251         $cat >try.c <<'EOCP'
13252 #include <sys/types.h>
13253 #include <stdio.h>
13254 int main() {
13255   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13256   printf("%lld\n", q);
13257 }
13258 EOCP
13259         set try
13260         if eval $compile; then
13261                 yyy=`./try$exe_ext`
13262                 case "$yyy" in
13263                 12345678901)
13264                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13265                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13266                         echo "We will use the %lld style."
13267                         ;;
13268                 esac
13269         fi
13270 fi
13271
13272 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13273         $cat >try.c <<EOCP
13274 #include <sys/types.h>
13275 #include <stdio.h>
13276 int main() {
13277   $quadtype q = 12345678901;
13278   printf("%Ld\n", q);
13279 }
13280 EOCP
13281         set try
13282         if eval $compile; then
13283                 yyy=`./try$exe_ext`
13284                 case "$yyy" in
13285                 12345678901)
13286                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13287                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13288                         echo "We will use %Ld."
13289                         ;;
13290                 esac
13291         fi
13292 fi
13293
13294 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13295         $cat >try.c <<EOCP
13296 #include <sys/types.h>
13297 #include <stdio.h>
13298 int main() {
13299   $quadtype q = 12345678901;
13300   printf("%qd\n", q);
13301 }
13302 EOCP
13303         set try
13304         if eval $compile; then
13305                 yyy=`./try$exe_ext`
13306                 case "$yyy" in
13307                 12345678901)
13308                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13309                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13310                         echo "We will use %qd."
13311                         ;;
13312                 esac
13313         fi
13314 fi
13315
13316 if $test X"$sPRId64" = X; then
13317         echo "Cannot figure out how to print 64-bit integers." >&4
13318 fi
13319
13320 $rm -f try try.*
13321
13322 fi
13323
13324 case "$sPRId64" in
13325 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13326         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13327         ;;
13328 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13329         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13330         ;;
13331 esac
13332
13333
13334 echo " "
13335 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13336
13337 if $test X"$ivsize" = X8; then
13338         ivdformat="$sPRId64"
13339         uvuformat="$sPRIu64"
13340         uvoformat="$sPRIo64"
13341         uvxformat="$sPRIx64"
13342         uvXUformat="$sPRIXU64"
13343 else
13344         if $test X"$ivsize" = X"$longsize"; then
13345                 ivdformat='"ld"'
13346                 uvuformat='"lu"'
13347                 uvoformat='"lo"'
13348                 uvxformat='"lx"'
13349                 uvXUformat='"lX"'
13350         else
13351                 if $test X"$ivsize" = X"$intsize"; then
13352                         ivdformat='"d"'
13353                         uvuformat='"u"'
13354                         uvoformat='"o"'
13355                         uvxformat='"x"'
13356                         uvXUformat='"X"'
13357                 else
13358                         : far out
13359                         if $test X"$ivsize" = X"$shortsize"; then
13360                                 ivdformat='"hd"'
13361                                 uvuformat='"hu"'
13362                                 uvoformat='"ho"'
13363                                 uvxformat='"hx"'
13364                                 uvXUformat='"hX"'
13365                         fi
13366                 fi
13367         fi
13368 fi
13369
13370 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13371         nveformat="$sPRIeldbl"
13372         nvfformat="$sPRIfldbl"
13373         nvgformat="$sPRIgldbl"
13374         nvEUformat="$sPRIEUldbl"
13375         nvFUformat="$sPRIFUldbl"
13376         nvGUformat="$sPRIGUldbl"
13377 else
13378         nveformat='"e"'
13379         nvfformat='"f"'
13380         nvgformat='"g"'
13381         nvEUformat='"E"'
13382         nvFUformat='"F"'
13383         nvGUformat='"G"'
13384 fi
13385
13386 case "$ivdformat" in
13387 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13388     exit 1
13389     ;;
13390 esac
13391
13392
13393 echo " "
13394 $echo "Checking the format string to be used for gids..." >&4
13395
13396 case "$gidsign" in
13397 -1)     if $test X"$gidsize" = X"$ivsize"; then
13398                 gidformat="$ivdformat"
13399         else
13400                 if $test X"$gidsize" = X"$longsize"; then
13401                         gidformat='"ld"'
13402                 else
13403                         if $test X"$gidsize" = X"$intsize"; then
13404                                 gidformat='"d"'
13405                         else
13406                                 if $test X"$gidsize" = X"$shortsize"; then
13407                                         gidformat='"hd"'
13408                                 fi
13409                         fi
13410                 fi
13411         fi
13412         ;;
13413 *)      if $test X"$gidsize" = X"$uvsize"; then
13414                 gidformat="$uvuformat"
13415         else
13416                 if $test X"$gidsize" = X"$longsize"; then
13417                         gidformat='"lu"'
13418                 else
13419                         if $test X"$gidsize" = X"$intsize"; then
13420                                 gidformat='"u"'
13421                         else
13422                                 if $test X"$gidsize" = X"$shortsize"; then
13423                                         gidformat='"hu"'
13424                                 fi
13425                         fi
13426                 fi
13427         fi
13428         ;;
13429 esac
13430
13431 : see if getgroups exists
13432 set getgroups d_getgrps
13433 eval $inlibc
13434
13435 : see if setgroups exists
13436 set setgroups d_setgrps
13437 eval $inlibc
13438
13439
13440 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13441 echo " "
13442 case "$d_getgrps$d_setgrps" in
13443 *define*)
13444         case "$groupstype" in
13445         '') dflt="$gidtype" ;;
13446         *)  dflt="$groupstype" ;;
13447         esac
13448         $cat <<EOM
13449 What type of pointer is the second argument to getgroups() and setgroups()?
13450 Usually this is the same as group ids, $gidtype, but not always.
13451
13452 EOM
13453         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13454         . ./myread
13455         groupstype="$ans"
13456         ;;
13457 *)  groupstype="$gidtype";;
13458 esac
13459
13460 echo " "
13461 echo "Checking if your $make program sets \$(MAKE)..." >&4
13462 case "$make_set_make" in
13463 '')
13464         $sed 's/^X //' > testmake.mak << 'EOF'
13465 Xall:
13466 X       @echo 'maketemp="$(MAKE)"'
13467 EOF
13468         case "`$make -f testmake.mak 2>/dev/null`" in
13469         *maketemp=*) make_set_make='#' ;;
13470         *)      make_set_make="MAKE=$make" ;;
13471         esac
13472         $rm -f testmake.mak
13473         ;;
13474 esac
13475 case "$make_set_make" in
13476 '#') echo "Yup, it does.";;
13477 *) echo "Nope, it doesn't.";;
13478 esac
13479
13480 : see what type is used for mode_t
13481 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13482 set mode_t modetype int stdio.h sys/types.h
13483 eval $typedef_ask
13484
13485 : see if stdarg is available
13486 echo " "
13487 if $test `./findhdr stdarg.h`; then
13488         echo "<stdarg.h> found." >&4
13489         valstd="$define"
13490 else
13491         echo "<stdarg.h> NOT found." >&4
13492         valstd="$undef"
13493 fi
13494
13495 : see if varags is available
13496 echo " "
13497 if $test `./findhdr varargs.h`; then
13498         echo "<varargs.h> found." >&4
13499 else
13500         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13501 fi
13502
13503 : set up the varargs testing programs
13504 $cat > varargs.c <<EOP
13505 #ifdef I_STDARG
13506 #include <stdarg.h>
13507 #endif
13508 #ifdef I_VARARGS
13509 #include <varargs.h>
13510 #endif
13511
13512 #ifdef I_STDARG
13513 int f(char *p, ...)
13514 #else
13515 int f(va_alist)
13516 va_dcl
13517 #endif
13518 {
13519         va_list ap;
13520 #ifndef I_STDARG
13521         char *p;
13522 #endif
13523 #ifdef I_STDARG
13524         va_start(ap,p);
13525 #else
13526         va_start(ap);
13527         p = va_arg(ap, char *);
13528 #endif
13529         va_end(ap);
13530 }
13531 EOP
13532 $cat > varargs <<EOP
13533 $startsh
13534 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13535         echo "true"
13536 else
13537         echo "false"
13538 fi
13539 $rm -f varargs$_o
13540 EOP
13541 chmod +x varargs
13542
13543 : now check which varargs header should be included
13544 echo " "
13545 i_varhdr=''
13546 case "$valstd" in
13547 "$define")
13548         if `./varargs I_STDARG`; then
13549                 val='stdarg.h'
13550         elif `./varargs I_VARARGS`; then
13551                 val='varargs.h'
13552         fi
13553         ;;
13554 *)
13555         if `./varargs I_VARARGS`; then
13556                 val='varargs.h'
13557         fi
13558         ;;
13559 esac
13560 case "$val" in
13561 '')
13562 echo "I could not find the definition for va_dcl... You have problems..." >&4
13563         val="$undef"; set i_stdarg; eval $setvar
13564         val="$undef"; set i_varargs; eval $setvar
13565         ;;
13566 *) 
13567         set i_varhdr
13568         eval $setvar
13569         case "$i_varhdr" in
13570         stdarg.h)
13571                 val="$define"; set i_stdarg; eval $setvar
13572                 val="$undef"; set i_varargs; eval $setvar
13573                 ;;
13574         varargs.h)
13575                 val="$undef"; set i_stdarg; eval $setvar
13576                 val="$define"; set i_varargs; eval $setvar
13577                 ;;
13578         esac
13579         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13580 esac
13581 $rm -f varargs*
13582
13583 : see if we need va_copy
13584 echo " "
13585 case "$i_stdarg" in
13586 "$define")
13587         $cat >try.c <<EOCP
13588 #include <stdarg.h>
13589 #include <stdio.h>
13590
13591 int
13592 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13593 {
13594   return vfprintf(f, fmt, *valp);
13595 }
13596  
13597 int    
13598 myvfprintf(FILE *f, const  char *fmt, va_list val)
13599 {
13600   return ivfprintf(f, fmt, &val);
13601 }
13602       
13603 int
13604 myprintf(char *fmt, ...) 
13605 {
13606   va_list val;
13607   va_start(val, fmt);
13608   return myvfprintf(stdout, fmt, val); 
13609 }         
13610
13611 int
13612 main(int ac, char **av)
13613 {
13614   myprintf("%s%cs all right, then\n", "that", '\'');                            
13615   exit(0);      
13616 }
13617 EOCP
13618         set try
13619         if eval $compile && ./try 2>&1 >/dev/null; then
13620                 case "`./try`" in
13621                 "that's all right, then")
13622                         okay=yes
13623                         ;;
13624                 esac
13625         fi
13626         case "$okay" in
13627         yes)    echo "It seems that you don't need va_copy()." >&4
13628                 need_va_copy="$undef"
13629                 ;;
13630         *)      echo "It seems that va_copy() or similar will be needed." >&4
13631                 need_va_copy="$define"
13632                 ;;
13633         esac
13634         $rm -f try.* core core.* *.core *.core.*
13635         ;;
13636 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13637         ;;
13638 esac
13639
13640 : define a fucntion to check prototypes
13641 $cat > protochk <<EOSH
13642 $startsh
13643 cc="$cc"
13644 optimize="$optimize"
13645 ccflags="$ccflags"
13646 prototype="$prototype"
13647 define="$define"
13648 rm=$rm
13649 EOSH
13650
13651 $cat >> protochk <<'EOSH'
13652
13653 $rm -f try.c
13654 foo="$1"
13655 shift
13656 while test $# -ge 2; do
13657         case "$1" in
13658                 $define) echo "#include <$2>" >> try.c ;;
13659                 literal) echo "$2" >> try.c ;;
13660         esac
13661     shift 2
13662 done
13663 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13664 cat >> try.c <<'EOCP'
13665 #ifdef CAN_PROTOTYPE
13666 #define _(args) args
13667 #else
13668 #define _(args) ()
13669 #endif
13670 EOCP
13671 echo "$foo" >> try.c
13672 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13673 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13674 status=$?
13675 $rm -f try.[co]
13676 exit $status
13677 EOSH
13678 chmod +x protochk
13679 $eunicefix protochk
13680
13681 : see what type is used for size_t
13682 rp="What is the type used for the length parameter for string functions?"
13683 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13684 eval $typedef_ask
13685
13686 : check for type of arguments to gethostbyaddr. 
13687 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13688         case "$d_gethbyaddr" in
13689         $define)
13690                 $cat <<EOM
13691
13692 Checking to see what type of arguments are accepted by gethostbyaddr().
13693 EOM
13694                 hdrs="$define sys/types.h
13695                         $d_socket sys/socket.h 
13696                         $i_niin netinet/in.h 
13697                         $i_netdb netdb.h
13698                         $i_unistd unistd.h"
13699                 : The first arg can 'char *' or 'void *'
13700                 : The second arg is some of integral type
13701                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13702                         for yyy in size_t long int; do
13703                                 case "$netdb_host_type" in
13704                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13705                                         if ./protochk "$try" $hdrs; then
13706                                                 echo "Your system accepts $xxx for the first arg."
13707                                                 echo "...and $yyy for the second arg."
13708                                                 netdb_host_type="$xxx"
13709                                                 netdb_hlen_type="$yyy"
13710                                         fi
13711                                         ;;
13712                                 esac
13713                         done
13714                 done
13715                 : In case none of those worked, prompt the user.
13716                 case "$netdb_host_type" in
13717                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13718                         dflt='char *'
13719                         . ./myread
13720                         netdb_host_type=$ans
13721                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13722                         dflt="$sizetype"
13723                         . ./myread
13724                         netdb_hlen_type=$ans
13725                         ;;
13726                 esac
13727                 ;;
13728         *)      : no gethostbyaddr, so pick harmless defaults
13729                 netdb_host_type='char *'
13730                 netdb_hlen_type="$sizetype"
13731                 ;;
13732         esac
13733         # Remove the "const" if needed. -- but then we'll have a 
13734         # prototype clash!
13735         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13736 fi
13737
13738 : check for type of argument to gethostbyname. 
13739 if test "X$netdb_name_type" = X ; then
13740         case "$d_gethbyname" in
13741         $define)
13742                 $cat <<EOM
13743
13744 Checking to see what type of argument is accepted by gethostbyname().
13745 EOM
13746                 hdrs="$define sys/types.h
13747                         $d_socket sys/socket.h 
13748                         $i_niin netinet/in.h 
13749                         $i_netdb netdb.h
13750                         $i_unistd unistd.h"
13751                 for xxx in "const char *" "char *"; do
13752                         case "$netdb_name_type" in
13753                         '')     try="extern struct hostent *gethostbyname($xxx);"
13754                                 if ./protochk "$try" $hdrs; then
13755                                         echo "Your system accepts $xxx."
13756                                         netdb_name_type="$xxx"
13757                                 fi
13758                                 ;;
13759                         esac
13760                 done
13761                 : In case none of those worked, prompt the user.
13762                 case "$netdb_name_type" in
13763                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13764                         dflt='char *'
13765                         . ./myread
13766                         netdb_name_type=$ans
13767                         ;;
13768                 esac
13769                 ;;
13770         *)      : no gethostbyname, so pick harmless default
13771                 netdb_name_type='char *'
13772                 ;;
13773         esac
13774 fi
13775
13776 : check for type of 1st argument to getnetbyaddr. 
13777 if test "X$netdb_net_type" = X ; then
13778         case "$d_getnbyaddr" in
13779         $define)
13780                 $cat <<EOM
13781
13782 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13783 EOM
13784                 hdrs="$define sys/types.h
13785                         $d_socket sys/socket.h 
13786                         $i_niin netinet/in.h 
13787                         $i_netdb netdb.h
13788                         $i_unistd unistd.h"
13789                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13790                         case "$netdb_net_type" in
13791                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13792                                 if ./protochk "$try" $hdrs; then
13793                                         echo "Your system accepts $xxx."
13794                                         netdb_net_type="$xxx"
13795                                 fi
13796                                 ;;
13797                         esac
13798                 done
13799                 : In case none of those worked, prompt the user.
13800                 case "$netdb_net_type" in
13801                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13802                         dflt='long'
13803                         . ./myread
13804                         netdb_net_type=$ans
13805                         ;;
13806                 esac
13807                 ;;
13808         *)      : no getnetbyaddr, so pick harmless default
13809                 netdb_net_type='long'
13810                 ;;
13811         esac
13812 fi
13813 : locate the preferred pager for this system
13814 case "$pager" in
13815 '')
13816         dflt=''
13817         case "$pg" in
13818         /*) dflt=$pg;;
13819         [a-zA-Z]:/*) dflt=$pg;;
13820         esac
13821         case "$more" in
13822         /*) dflt=$more;;
13823         [a-zA-Z]:/*) dflt=$more;;
13824         esac
13825         case "$less" in
13826         /*) dflt=$less;;
13827         [a-zA-Z]:/*) dflt=$less;;
13828         esac
13829         case "$dflt" in
13830         '') dflt=/usr/ucb/more;;
13831         esac
13832         ;;
13833 *) dflt="$pager";;
13834 esac
13835 echo " "
13836 fn=f/
13837 rp='What pager is used on your system?'
13838 . ./getfile
13839 pager="$ans"
13840
13841 : see what type pids are declared as in the kernel
13842 rp="What is the type of process ids on this system?"
13843 set pid_t pidtype int stdio.h sys/types.h
13844 eval $typedef_ask
13845
13846 : Find earliest binary compatible site_perl subdirectory perl can use.
13847 case "$bincompat5005" in
13848 "$define") xs_apiversion='5.005' ;;
13849 *) xs_apiversion=$version ;;   # The current site_perl version.
13850 esac
13851 : Find earliest pure perl site_perl subdirectory perl can use.
13852 : The versioned directories started at 5.005.
13853 pm_apiversion='5.005'
13854
13855 : check for length of pointer
13856 echo " "
13857 case "$ptrsize" in
13858 '')
13859         echo "Checking to see how big your pointers are..." >&4
13860         if test "$voidflags" -gt 7; then
13861                 echo '#define VOID_PTR char *' > try.c
13862         else
13863                 echo '#define VOID_PTR void *' > try.c
13864         fi
13865         $cat >>try.c <<'EOCP'
13866 #include <stdio.h>
13867 int main()
13868 {
13869     printf("%d\n", (int)sizeof(VOID_PTR));
13870     exit(0);
13871 }
13872 EOCP
13873         set try
13874         if eval $compile_ok; then
13875                 ptrsize=`./try`
13876                 echo "Your pointers are $ptrsize bytes long."
13877         else
13878                 dflt='4'
13879                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13880                 rp="What is the size of a pointer (in bytes)?"
13881                 . ./myread
13882                 ptrsize="$ans"
13883         fi
13884         ;;
13885 esac
13886 $rm -f try.c try
13887
13888 : see if ar generates random libraries by itself
13889 echo " "
13890 echo "Checking how to generate random libraries on your machine..." >&4
13891 echo 'int bar1() { return bar2(); }' > bar1.c
13892 echo 'int bar2() { return 2; }' > bar2.c
13893 $cat > foo.c <<'EOP'
13894 int main() { printf("%d\n", bar1()); exit(0); }
13895 EOP
13896 $cc $ccflags -c bar1.c >/dev/null 2>&1
13897 $cc $ccflags -c bar2.c >/dev/null 2>&1
13898 $cc $ccflags -c foo.c >/dev/null 2>&1
13899 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13900 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13901         ./foobar >/dev/null 2>&1; then
13902         echo "$ar appears to generate random libraries itself."
13903         orderlib=false
13904         ranlib=":"
13905 elif $ar ts bar$_a >/dev/null 2>&1 &&
13906         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13907         ./foobar >/dev/null 2>&1; then
13908                 echo "a table of contents needs to be added with '$ar ts'."
13909                 orderlib=false
13910                 ranlib="$ar ts"
13911 else
13912         case "$ranlib" in
13913         :) ranlib='';;
13914         '')
13915                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13916                 $test -f $ranlib || ranlib=''
13917                 ;;
13918         esac
13919         if $test -n "$ranlib"; then
13920                 echo "your system has '$ranlib'; we'll use that."
13921                 orderlib=false
13922         else
13923                 echo "your system doesn't seem to support random libraries"
13924                 echo "so we'll use lorder and tsort to order the libraries."
13925                 orderlib=true
13926                 ranlib=":"
13927         fi
13928 fi
13929 $rm -f foo* bar* 
13930
13931 : check for type of arguments to select. 
13932 case "$selecttype" in
13933 '') case "$d_select" in
13934         $define)
13935                 echo " "
13936                 $cat <<EOM
13937 Checking to see what type of arguments are accepted by select().
13938 EOM
13939                 hdrs="$define sys/types.h
13940                         $i_systime sys/time.h 
13941                         $i_sysselct sys/select.h
13942                         $d_socket sys/socket.h"
13943                 : The first arg can be int, unsigned, or size_t
13944                 : The last arg may or may not be 'const'
13945                 val=''
13946                 : void pointer has been seen but using that
13947                 : breaks the selectminbits test
13948                 for xxx in 'fd_set *' 'int *'; do
13949                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13950                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13951                                         case "$val" in
13952                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13953                                                 if ./protochk "$try" $hdrs; then
13954                                                         echo "Your system accepts $xxx."
13955                                                         val="$xxx"
13956                                                 fi
13957                                                 ;;
13958                                         esac
13959                                 done
13960                         done
13961                 done
13962                 case "$val" in
13963                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13964                         case "$d_fd_set" in
13965                                 $define) dflt="fd_set *" ;;
13966                                 *)              dflt="int *" ;;
13967                         esac
13968                         . ./myread
13969                         val=$ans
13970                         ;;
13971                 esac
13972                 selecttype="$val"
13973                 ;;
13974         *)      : no select, so pick a harmless default
13975                 selecttype='int *'
13976                 ;;
13977         esac
13978         ;;
13979 esac
13980
13981 : check for the select 'width'
13982 case "$selectminbits" in
13983 '') case "$d_select" in
13984         $define)
13985                 $cat <<EOM
13986
13987 Checking to see on how many bits at a time your select() operates...
13988 EOM
13989                 $cat >try.c <<EOCP
13990 #include <sys/types.h>
13991 #$i_time I_TIME
13992 #$i_systime I_SYS_TIME
13993 #$i_systimek I_SYS_TIME_KERNEL
13994 #ifdef I_TIME
13995 #   include <time.h>
13996 #endif
13997 #ifdef I_SYS_TIME
13998 #   ifdef I_SYS_TIME_KERNEL
13999 #       define KERNEL
14000 #   endif
14001 #   include <sys/time.h>
14002 #   ifdef I_SYS_TIME_KERNEL
14003 #       undef KERNEL
14004 #   endif
14005 #endif
14006 #$i_sysselct I_SYS_SELECT
14007 #ifdef I_SYS_SELECT
14008 #include <sys/select.h>
14009 #endif
14010 #$d_socket HAS_SOCKET
14011 #ifdef HAS_SOCKET
14012 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14013 #endif
14014 #include <stdio.h>
14015 $selecttype b;
14016 #define S sizeof(*(b))
14017 #define MINBITS 64
14018 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14019 #define NBITS  (NBYTES * 8)
14020 int main() {
14021     char s[NBYTES];
14022     struct timeval t;
14023     int i;
14024     FILE* fp;
14025     int fd;
14026
14027     fclose(stdin);
14028     fp = fopen("try.c", "r");
14029     if (fp == 0)
14030       exit(1);
14031     fd = fileno(fp);
14032     if (fd < 0)
14033       exit(2);
14034     b = ($selecttype)s;
14035     for (i = 0; i < NBITS; i++)
14036         FD_SET(i, b);
14037     t.tv_sec  = 0;
14038     t.tv_usec = 0;
14039     select(fd + 1, b, 0, 0, &t);
14040     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14041     printf("%d\n", i + 1);
14042     return 0;
14043 }
14044 EOCP
14045                 set try
14046                 if eval $compile_ok; then
14047                         selectminbits=`./try`
14048                         case "$selectminbits" in
14049                         '')     cat >&4 <<EOM
14050 Cannot figure out on how many bits at a time your select() operates.
14051 I'll play safe and guess it is 32 bits.
14052 EOM
14053                                 selectminbits=32
14054                                 bits="32 bits"
14055                                 ;;
14056                         1)      bits="1 bit" ;;
14057                         *)      bits="$selectminbits bits" ;;
14058                         esac
14059                         echo "Your select() operates on $bits at a time." >&4
14060                 else
14061                         rp='What is the minimum number of bits your select() operates on?'
14062                         case "$byteorder" in
14063                         1234|12345678)  dflt=32 ;;
14064                         *)              dflt=1  ;;
14065                         esac
14066                         . ./myread
14067                         val=$ans
14068                         selectminbits="$val"
14069                 fi
14070                 $rm -f try.* try
14071                 ;;
14072         *)      : no select, so pick a harmless default
14073                 selectminbits='32'
14074                 ;;
14075         esac
14076         ;;
14077 esac
14078
14079 : Trace out the files included by signal.h, then look for SIGxxx names.
14080 : Remove SIGARRAYSIZE used by HPUX.
14081 : Remove SIGSTKSIZE used by Linux.
14082 : Remove SIGSTKSZ used by Posix.
14083 : Remove SIGTYP void lines used by OS2.
14084 : Some cpps, like os390, dont give the file name anywhere
14085 if [ "X$fieldn" = X ]; then
14086         : Just make some guesses.  We check them later.
14087         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14088 else
14089         xxx=`echo '#include <signal.h>' |
14090         $cppstdin $cppminus $cppflags 2>/dev/null |
14091         $grep '^[       ]*#.*include' | 
14092         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14093 fi
14094 : Check this list of files to be sure we have parsed the cpp output ok.
14095 : This will also avoid potentially non-existent files, such 
14096 : as ../foo/bar.h
14097 xxxfiles=''
14098 for xx in $xxx /dev/null ; do
14099         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14100 done
14101 : If we have found no files, at least try signal.h
14102 case "$xxxfiles" in
14103 '')     xxxfiles=`./findhdr signal.h` ;;
14104 esac
14105 xxx=`awk '
14106 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14107         print substr($2, 4, 20)
14108 }
14109 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14110         print substr($3, 4, 20)
14111 }' $xxxfiles`
14112 : Append some common names just in case the awk scan failed.
14113 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14114 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14115 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14116 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14117 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14118
14119 : generate a few handy files for later
14120 $cat > signal.c <<'EOCP'
14121 #include <sys/types.h>
14122 #include <signal.h>
14123 #include <stdio.h>
14124 int main() {
14125
14126 /* Strange style to avoid deeply-nested #if/#else/#endif */
14127 #ifndef NSIG
14128 #  ifdef _NSIG
14129 #    define NSIG (_NSIG)
14130 #  endif
14131 #endif
14132
14133 #ifndef NSIG
14134 #  ifdef SIGMAX
14135 #    define NSIG (SIGMAX+1)
14136 #  endif
14137 #endif
14138
14139 #ifndef NSIG
14140 #  ifdef SIG_MAX
14141 #    define NSIG (SIG_MAX+1)
14142 #  endif
14143 #endif
14144
14145 #ifndef NSIG
14146 #  ifdef MAXSIG
14147 #    define NSIG (MAXSIG+1)
14148 #  endif
14149 #endif
14150
14151 #ifndef NSIG
14152 #  ifdef MAX_SIG
14153 #    define NSIG (MAX_SIG+1)
14154 #  endif
14155 #endif
14156
14157 #ifndef NSIG
14158 #  ifdef SIGARRAYSIZE
14159 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14160 #  endif
14161 #endif
14162
14163 #ifndef NSIG
14164 #  ifdef _sys_nsig
14165 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14166 #  endif
14167 #endif
14168
14169 /* Default to some arbitrary number that's big enough to get most
14170    of the common signals.
14171 */
14172 #ifndef NSIG
14173 #    define NSIG 50
14174 #endif
14175
14176 printf("NSIG %d\n", NSIG);
14177
14178 #ifndef JUST_NSIG
14179
14180 EOCP
14181
14182 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14183 {
14184         printf "#ifdef SIG"; printf $1; printf "\n"
14185         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14186         printf $1; printf ");\n"
14187         printf "#endif\n"
14188 }
14189 END {
14190         printf "#endif /* JUST_NSIG */\n";
14191         printf "exit(0);\n}\n";
14192 }
14193 ' >>signal.c
14194 $cat >signal.awk <<'EOP'
14195 BEGIN { ndups = 0 }
14196 $1 ~ /^NSIG$/ { nsig = $2 }
14197 ($1 !~ /^NSIG$/) && (NF == 2) {
14198     if ($2 > maxsig) { maxsig = $2 }
14199     if (sig_name[$2]) {
14200         dup_name[ndups] = $1
14201         dup_num[ndups] = $2
14202         ndups++ 
14203     }
14204     else {
14205         sig_name[$2] = $1
14206         sig_num[$2] = $2
14207     }
14208 }
14209 END { 
14210     if (nsig == 0) {
14211         nsig = maxsig + 1
14212     }
14213     printf("NSIG %d\n", nsig);
14214     for (n = 1; n < nsig; n++) {
14215         if (sig_name[n]) {
14216             printf("%s %d\n", sig_name[n], sig_num[n])
14217         }
14218         else {
14219             printf("NUM%d %d\n", n, n) 
14220         }
14221     }
14222     for (n = 0; n < ndups; n++) {
14223         printf("%s %d\n", dup_name[n], dup_num[n])
14224     }
14225 }
14226 EOP
14227 $cat >signal_cmd <<EOS
14228 $startsh
14229 if $test -s signal.lst; then
14230     echo "Using your existing signal.lst file"
14231         exit 0
14232 fi
14233 xxx="$xxx"
14234 EOS
14235 $cat >>signal_cmd <<'EOS'
14236
14237 set signal
14238 if eval $compile_ok; then
14239         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14240 else
14241         echo "(I can't seem be able to compile the whole test program)" >&4
14242         echo "(I'll try it in little pieces.)" >&4
14243         set signal -DJUST_NSIG
14244         if eval $compile_ok; then
14245                 ./signal$_exe > signal.nsg
14246                 $cat signal.nsg
14247         else
14248                 echo "I can't seem to figure out how many signals you have." >&4
14249                 echo "Guessing 50." >&4
14250                 echo 'NSIG 50' > signal.nsg
14251         fi
14252         : Now look at all the signal names, one at a time.
14253         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14254                 $cat > signal.c <<EOCP
14255 #include <sys/types.h>
14256 #include <signal.h>
14257 #include <stdio.h>
14258 int main() {
14259 printf("$xx %d\n", SIG${xx});
14260 return 0;
14261 }
14262 EOCP
14263                 set signal
14264                 if eval $compile; then
14265                         echo "SIG${xx} found."
14266                         ./signal$_exe  >> signal.ls1
14267                 else
14268                         echo "SIG${xx} NOT found."
14269                 fi
14270         done
14271         if $test -s signal.ls1; then
14272                 $cat signal.nsg signal.ls1 |
14273                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14274         fi
14275
14276 fi
14277 if $test -s signal.lst; then
14278         :
14279 else
14280         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14281         echo 'kill -l' >signal
14282         set X `csh -f <signal`
14283         $rm -f signal
14284         shift
14285         case $# in
14286         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14287         esac
14288         echo $@ | $tr ' ' $trnl | \
14289             $awk '{ printf "%s %d\n", $1, ++s; }
14290                   END { printf "NSIG %d\n", ++s }' >signal.lst
14291 fi
14292 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14293 EOS
14294 chmod a+x signal_cmd
14295 $eunicefix signal_cmd
14296
14297 : generate list of signal names
14298 echo " "
14299 case "$sig_name_init" in
14300 '') doinit=yes ;;
14301 *)  case "$sig_num_init" in
14302     ''|*,*) doinit=yes ;;
14303     esac ;;
14304 esac
14305 case "$doinit" in
14306 yes)
14307         echo "Generating a list of signal names and numbers..." >&4
14308         . ./signal_cmd
14309         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14310         sig_name=`$awk 'BEGIN { printf "ZERO " }
14311                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14312         sig_num=`$awk  'BEGIN { printf "0 " }
14313                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14314         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14315                              !/^NSIG/   { printf "\"%s\", ", $1 }
14316                              END        { printf "0\n" }' signal.lst`
14317         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14318                              !/^NSIG/   { printf "%d, ", $2}
14319                              END        { printf "0\n"}' signal.lst`
14320         ;;
14321 esac
14322 echo "The following $sig_count signals are available:"
14323 echo " "
14324 echo $sig_name | $awk \
14325 'BEGIN { linelen = 0 }
14326 {
14327         for (i = 1; i <= NF; i++) {
14328                 name = "SIG" $i " "
14329                 linelen = linelen + length(name)
14330                 if (linelen > 70) {
14331                         printf "\n"
14332                         linelen = length(name)
14333                 }
14334                 printf "%s", name
14335         }
14336         printf "\n"
14337 }'
14338 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14339
14340 echo " "
14341 case "$sizetype" in
14342 *_t) zzz="$sizetype"    ;;
14343 *)   zzz="filesize"     ;;
14344 esac
14345 echo "Checking the size of $zzz..." >&4 
14346 cat > try.c <<EOCP
14347 #include <sys/types.h>
14348 #include <stdio.h>
14349 int main() {
14350     printf("%d\n", (int)sizeof($sizetype));
14351     exit(0);
14352 }
14353 EOCP
14354 set try
14355 if eval $compile_ok; then
14356         yyy=`./try`
14357         case "$yyy" in
14358         '')     sizesize=4
14359                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14360                 ;;
14361         *)      sizesize=$yyy
14362                 echo "Your $zzz size is $sizesize bytes."
14363                 ;;
14364         esac
14365 else
14366         sizesize=4
14367         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14368 fi
14369
14370
14371 : check for socklen_t
14372 echo " "
14373 echo "Checking to see if you have socklen_t..." >&4
14374 $cat >try.c <<EOCP
14375 #include <sys/types.h>
14376 #$d_socket HAS_SOCKET
14377 #ifdef HAS_SOCKET
14378 #include <sys/socket.h>
14379 #endif
14380 int main() { socklen_t x = 16; }
14381 EOCP
14382 set try
14383 if eval $compile; then
14384         val="$define"
14385         echo "You have socklen_t."
14386 else
14387         val="$undef"
14388         echo "You do not have socklen_t."
14389         case "$sizetype" in
14390         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14391         esac
14392 fi
14393 $rm -f try try.*
14394 set d_socklen_t
14395 eval $setvar
14396
14397 : see if this is a socks.h system
14398 set socks.h i_socks
14399 eval $inhdr
14400
14401 : check for type of the size argument to socket calls
14402 case "$d_socket" in
14403 "$define")
14404         $cat <<EOM
14405
14406 Checking to see what type is the last argument of accept().
14407 EOM
14408         yyy=''
14409         case "$d_socklen_t" in
14410         "$define") yyy="$yyy socklen_t"
14411         esac
14412         yyy="$yyy $sizetype int long unsigned"
14413         for xxx in $yyy; do
14414                 case "$socksizetype" in
14415                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14416                         case "$usesocks" in
14417                         "$define")
14418                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14419                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14420                                         socksizetype="$xxx"
14421                                 fi
14422                                 ;;
14423                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14424                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14425                                         socksizetype="$xxx"
14426                                 fi
14427                                 ;;
14428                         esac
14429                         ;;
14430                 esac
14431         done
14432 : In case none of those worked, prompt the user.
14433         case "$socksizetype" in
14434         '')     rp='What is the type for socket address structure sizes?'
14435                 dflt='int'
14436                 . ./myread
14437                 socksizetype=$ans
14438                 ;;
14439         esac
14440         ;;
14441 *)      : no sockets, so pick relatively harmless default
14442         socksizetype='int'
14443         ;;
14444 esac
14445
14446 : see what type is used for signed size_t
14447 set ssize_t ssizetype int stdio.h sys/types.h
14448 eval $typedef
14449 dflt="$ssizetype"
14450 $cat > ssize.c <<EOM
14451 #include <stdio.h>
14452 #include <sys/types.h>
14453 #define Size_t $sizetype
14454 #define SSize_t $dflt
14455 int main()
14456 {
14457         if (sizeof(Size_t) == sizeof(SSize_t))
14458                 printf("$dflt\n");
14459         else if (sizeof(Size_t) == sizeof(int))
14460                 printf("int\n");
14461         else 
14462                 printf("long\n");
14463         exit(0);
14464 }
14465 EOM
14466 echo " "
14467 set ssize
14468 if eval $compile_ok && ./ssize > /dev/null; then
14469         ssizetype=`./ssize`
14470         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14471 else
14472         $cat >&4 <<EOM
14473 Help! I can't compile and run the ssize_t test program: please enlighten me!
14474 (This is probably a misconfiguration in your system or libraries, and
14475 you really ought to fix it.  Still, I'll try anyway.)
14476
14477 I need a type that is the same size as $sizetype, but is guaranteed to
14478 be signed.  Common values are ssize_t, int and long.
14479
14480 EOM
14481         rp="What signed type is the same size as $sizetype?"
14482         . ./myread
14483         ssizetype="$ans"
14484 fi
14485 $rm -f ssize ssize.*
14486
14487 : see what type of char stdio uses.
14488 echo " "
14489 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14490         echo "Your stdio uses unsigned chars." >&4
14491         stdchar="unsigned char"
14492 else
14493         echo "Your stdio uses signed chars." >&4
14494         stdchar="char"
14495 fi
14496
14497 : see if time exists
14498 echo " "
14499 if test "X$d_time" = X -o X"$timetype" = X; then
14500     if set time val -f d_time; eval $csym; $val; then
14501                 echo 'time() found.' >&4
14502                 val="$define"
14503                 rp="What is the type returned by time() on this system?"
14504                 set time_t timetype long stdio.h sys/types.h
14505                 eval $typedef_ask
14506     else
14507                 echo 'time() not found, hope that will do.' >&4
14508                 val="$undef"
14509                 timetype='int';
14510     fi
14511     set d_time
14512     eval $setvar
14513 fi
14514
14515 : see what type uids are declared as in the kernel
14516 echo " "
14517 echo "Looking for the type for user ids returned by getuid()."
14518 set uid_t uidtype xxx stdio.h sys/types.h
14519 eval $typedef
14520 case "$uidtype" in
14521 xxx)
14522         xxx=`./findhdr sys/user.h`
14523         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14524         case $1 in
14525         unsigned) dflt="$1 $2" ;;
14526         *) dflt="$1" ;;
14527         esac
14528         ;;
14529 *) dflt="$uidtype";;
14530 esac
14531 case "$uidtype" in
14532 uid_t)  echo "uid_t found." ;;
14533 *)      rp="What is the type for user ids returned by getuid()?"
14534         . ./myread
14535         uidtype="$ans"
14536         ;;
14537 esac
14538
14539 echo " "
14540 case "$uidtype" in
14541 *_t) zzz="$uidtype"     ;;
14542 *)   zzz="uid"          ;;
14543 esac
14544 echo "Checking the size of $zzz..." >&4 
14545 cat > try.c <<EOCP
14546 #include <sys/types.h>
14547 #include <stdio.h>
14548 int main() {
14549     printf("%d\n", (int)sizeof($uidtype));
14550     exit(0);
14551 }
14552 EOCP
14553 set try
14554 if eval $compile_ok; then
14555         yyy=`./try`
14556         case "$yyy" in
14557         '')     uidsize=4
14558                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14559                 ;;
14560         *)      uidsize=$yyy
14561                 echo "Your $zzz is $uidsize bytes long."
14562                 ;;
14563         esac
14564 else
14565         uidsize=4
14566         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14567 fi
14568
14569 echo " "
14570 case "$uidtype" in
14571 *_t) zzz="$uidtype"     ;;
14572 *)   zzz="uid"          ;;
14573 esac
14574 echo "Checking the sign of $zzz..." >&4
14575 cat > try.c <<EOCP
14576 #include <sys/types.h>
14577 #include <stdio.h>
14578 int main() {
14579         $uidtype foo = -1;
14580         if (foo < 0)
14581                 printf("-1\n");
14582         else
14583                 printf("1\n");
14584 }
14585 EOCP
14586 set try
14587 if eval $compile; then
14588         yyy=`./try`
14589         case "$yyy" in
14590         '')     uidsign=1
14591                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14592                 ;;
14593         *)      uidsign=$yyy
14594                 case "$uidsign" in
14595                  1) echo "Your $zzz is unsigned." ;;
14596                 -1) echo "Your $zzz is signed."   ;;
14597                 esac
14598                 ;;
14599         esac
14600 else
14601         uidsign=1
14602         echo "(I can't compile the test program--guessing unsigned.)" >&4
14603 fi
14604
14605
14606
14607 echo " "
14608 $echo "Checking the format string to be used for uids..." >&4
14609
14610 case "$uidsign" in
14611 -1)     if $test X"$uidsize" = X"$ivsize"; then
14612                 uidformat="$ivdformat"
14613         else
14614                 if $test X"$uidsize" = X"$longsize"; then
14615                         uidformat='"ld"'
14616                 else
14617                         if $test X"$uidsize" = X"$intsize"; then
14618                                 uidformat='"d"'
14619                         else
14620                                 if $test X"$uidsize" = X"$shortsize"; then
14621                                         uidformat='"hd"'
14622                                 fi
14623                         fi
14624                 fi
14625         fi
14626         ;;
14627 *)      if $test X"$uidsize" = X"$uvsize"; then
14628                 uidformat="$uvuformat"
14629         else
14630                 if $test X"$uidsize" = X"$longsize"; then
14631                         uidformat='"lu"'
14632                 else
14633                         if $test X"$uidsize" = X"$intsize"; then
14634                                 uidformat='"u"'
14635                         else
14636                                 if $test X"$uidsize" = X"$shortsize"; then
14637                                         uidformat='"hu"'
14638                                 fi
14639                         fi
14640                 fi
14641         fi
14642         ;;
14643 esac
14644
14645 : see if dbm.h is available
14646 : see if dbmclose exists
14647 set dbmclose d_dbmclose
14648 eval $inlibc
14649
14650 case "$d_dbmclose" in
14651 $define)
14652         set dbm.h i_dbm
14653         eval $inhdr
14654         case "$i_dbm" in
14655         $define)
14656                 val="$undef"
14657                 set i_rpcsvcdbm
14658                 eval $setvar
14659                 ;;
14660         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14661                 eval $inhdr
14662                 ;;
14663         esac
14664         ;;
14665 *)      echo "We won't be including <dbm.h>"
14666         val="$undef"
14667         set i_dbm
14668         eval $setvar
14669         val="$undef"
14670         set i_rpcsvcdbm
14671         eval $setvar
14672         ;;
14673 esac
14674
14675 : see if this is a sys/file.h system
14676 val=''
14677 set sys/file.h val
14678 eval $inhdr
14679
14680 : do we need to include sys/file.h ?
14681 case "$val" in
14682 "$define")
14683         echo " "
14684         if $h_sysfile; then
14685                 val="$define"
14686                 echo "We'll be including <sys/file.h>." >&4
14687         else
14688                 val="$undef"
14689                 echo "We won't be including <sys/file.h>." >&4
14690         fi
14691         ;;
14692 *)
14693         h_sysfile=false
14694         ;;
14695 esac
14696 set i_sysfile
14697 eval $setvar
14698
14699 : see if fcntl.h is there
14700 val=''
14701 set fcntl.h val
14702 eval $inhdr
14703
14704 : see if we can include fcntl.h
14705 case "$val" in
14706 "$define")
14707         echo " "
14708         if $h_fcntl; then
14709                 val="$define"
14710                 echo "We'll be including <fcntl.h>." >&4
14711         else
14712                 val="$undef"
14713                 if $h_sysfile; then
14714         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14715                 else
14716                         echo "We won't be including <fcntl.h>." >&4
14717                 fi
14718         fi
14719         ;;
14720 *)
14721         h_fcntl=false
14722         val="$undef"
14723         ;;
14724 esac
14725 set i_fcntl
14726 eval $setvar
14727
14728 : see if this is a iconv.h system
14729 set iconv.h i_iconv
14730 eval $inhdr
14731
14732 : see if this is a ieeefp.h system
14733 set ieeefp.h i_ieeefp
14734 eval $inhdr
14735
14736 : see if this is a libutil.h system
14737 set libutil.h i_libutil
14738 eval $inhdr
14739
14740 : see if locale.h is available
14741 set locale.h i_locale
14742 eval $inhdr
14743
14744 : see if mach cthreads are available
14745 if test "X$usethreads" = "X$define"; then
14746         set mach/cthreads.h i_machcthr
14747         eval $inhdr
14748 else
14749         i_machcthr="$undef"
14750 fi
14751
14752
14753
14754 : see if this is a math.h system
14755 set math.h i_math
14756 eval $inhdr
14757
14758 : see if this is a mntent.h system
14759 set mntent.h i_mntent
14760 eval $inhdr
14761
14762 : see if ndbm.h is available
14763 set ndbm.h t_ndbm
14764 eval $inhdr
14765 case "$t_ndbm" in
14766 $define)
14767         : see if dbm_open exists
14768         set dbm_open d_dbm_open
14769         eval $inlibc
14770         case "$d_dbm_open" in
14771         $undef)
14772                 t_ndbm="$undef"
14773                 echo "We won't be including <ndbm.h>"
14774                 ;;
14775         esac
14776         ;;
14777 esac
14778 val="$t_ndbm"
14779 set i_ndbm
14780 eval $setvar
14781
14782 : see if net/errno.h is available
14783 val=''
14784 set net/errno.h val
14785 eval $inhdr
14786
14787 : Unfortunately, it causes problems on some systems.  Arrgh.
14788 case "$val" in
14789 $define)
14790         cat > try.c <<'EOM'
14791 #include <stdio.h>
14792 #include <errno.h>
14793 #include <net/errno.h>
14794 int func()
14795 {
14796         return ENOTSOCK;
14797 }
14798 EOM
14799         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14800                 echo "We'll be including <net/errno.h>." >&4
14801         else
14802                 echo "We won't be including <net/errno.h>." >&4
14803                 val="$undef"
14804         fi
14805         $rm -f try.* try
14806         ;;
14807 esac
14808 set i_neterrno
14809 eval $setvar
14810
14811 : see if netinet/tcp.h is available
14812 set netinet/tcp.h i_netinettcp
14813 eval $inhdr
14814
14815 : see if this is a poll.h system
14816 set poll.h i_poll
14817 eval $inhdr
14818
14819 : see if this is a prot.h system
14820 set prot.h i_prot
14821 eval $inhdr
14822
14823 echo " "
14824 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14825 $cat <<'EOSH' > Cppsym.know
14826 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14827 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14828 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14829 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14830 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14831 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14832 bull c cadmus clipper CMU COFF COMPILER_VERSION
14833 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14834 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14835 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14836 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14837 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14838 H3050R H3050RX hbullx20 hcx host_mips
14839 hp200 hp300 hp700 HP700 hp800 hp9000
14840 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14841 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14842 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14843 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14844 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14845 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14846 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14847 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14848 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14849 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14850 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14851 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14852 MATH_HAS_NO_SIDE_EFFECTS
14853 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14854 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14855 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14856 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14857 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14858 NetBSD news1500 news1700 news1800 news1900 news3700
14859 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14860 ns32016 ns32332 ns32k nsc32000
14861 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14862 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14863 pc532 pdp11 PGC PIC plexus PORTAR posix
14864 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14865 POSIX_C_SOURCE POSIX_SOURCE POWER
14866 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14867 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14868 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14869 sony sony_news sonyrisc sparc sparclite spectrum
14870 stardent stdc STDC_EXT stratos sun sun3 sun386
14871 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14872 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14873 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14874 sysV68 sysV88 Tek4132 Tek4300 titan
14875 tower tower32 tower32_200 tower32_600 tower32_700
14876 tower32_800 tower32_850 tss
14877 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14878 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14879 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14880 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14881 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14882 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14883 z8000
14884 EOSH
14885 # Maybe put other stuff here too.
14886 cat <<EOSH >>Cppsym.know
14887 $osname
14888 EOSH
14889 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14890 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14891 $cat Cppsym.know > Cppsym.c
14892 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
14893 $rm -f Cppsym.a Cppsym.b Cppsym.c
14894 cat <<EOSH > Cppsym
14895 $startsh
14896 if $test \$# -gt 0; then
14897     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14898     if $test -s Cppsym.got; then
14899         $rm -f Cppsym.got
14900         exit 0
14901     fi
14902     $rm -f Cppsym.got
14903     exit 1
14904 else
14905     $tr " " "$trnl" | ./Cppsym.try
14906     exit 0
14907 fi
14908 EOSH
14909 chmod +x Cppsym
14910 $eunicefix Cppsym
14911 cat <<EOSH > Cppsym.try
14912 $startsh
14913 cat <<'EOCP' > try.c
14914 #include <stdio.h>
14915 int main() {
14916 EOCP
14917 $awk \\
14918 EOSH
14919 cat <<'EOSH' >> Cppsym.try
14920 'length($1) > 0 {
14921     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14922     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14923     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14924     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14925 }'       >> try.c
14926 echo '}' >> try.c
14927 EOSH
14928 cat <<EOSH >> Cppsym.try
14929 ccflags="$ccflags"
14930 case "$osname-$gccversion" in
14931 irix-) ccflags="\$ccflags -woff 1178" ;;
14932 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14933 esac
14934 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
14935 EOSH
14936 chmod +x Cppsym.try
14937 $eunicefix Cppsym.try
14938 ./Cppsym < Cppsym.know > Cppsym.true
14939 : now check the C compiler for additional symbols
14940 postprocess_cc_v=''
14941 case "$osname" in
14942 aix) postprocess_cc_v="|$tr , ' '" ;;
14943 esac
14944 $cat >ccsym <<EOS
14945 $startsh
14946 $cat >tmp.c <<EOF
14947 extern int foo;
14948 EOF
14949 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14950 do
14951         case "\$i" in
14952         -D*) echo "\$i" | $sed 's/^-D//';;
14953         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14954         esac
14955 done
14956 $rm -f try.c
14957 EOS
14958 postprocess_cc_v=''
14959 chmod +x ccsym
14960 $eunicefix ccsym
14961 ./ccsym > ccsym1.raw
14962 if $test -s ccsym1.raw; then
14963        $sort ccsym1.raw | $uniq >ccsym.raw
14964 else
14965        mv ccsym1.raw ccsym.raw
14966 fi
14967
14968 $awk '/\=/ { print $0; next }
14969         { print $0"=1" }' ccsym.raw >ccsym.list
14970 $awk '/\=/ { print $0; next }
14971         { print $0"=1" }' Cppsym.true >ccsym.true
14972 $comm -13 ccsym.true ccsym.list >ccsym.own
14973 $comm -12 ccsym.true ccsym.list >ccsym.com
14974 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14975 also=''
14976 if $test -z ccsym.raw; then
14977         echo "Your C compiler doesn't seem to define any symbols!" >&4
14978         echo " "
14979         echo "However, your C preprocessor defines the following symbols:"
14980         $cat Cppsym.true
14981         ccsymbols=''
14982         cppsymbols=`$cat Cppsym.true`
14983         cppsymbols=`echo $cppsymbols`
14984         cppccsymbols="$cppsymbols"
14985 else
14986         if $test -s ccsym.com; then
14987                 echo "Your C compiler and pre-processor define these symbols:"
14988                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14989                 also='also '
14990                 symbols='ones'
14991                 cppccsymbols=`$cat ccsym.com`
14992                 cppccsymbols=`echo $cppccsymbols`
14993                 $test "$silent" || sleep 1
14994         fi
14995         if $test -s ccsym.cpp; then
14996                 $test "$also" && echo " "
14997                 echo "Your C pre-processor ${also}defines the following symbols:"
14998                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14999                 also='further '
15000                 cppsymbols=`$cat ccsym.cpp`
15001                 cppsymbols=`echo $cppsymbols`
15002                 $test "$silent" || sleep 1
15003         fi
15004         if $test -s ccsym.own; then
15005                 $test "$also" && echo " "
15006                 echo "Your C compiler ${also}defines the following cpp symbols:"
15007                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15008                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15009                 ccsymbols=`$cat ccsym.own`
15010                 ccsymbols=`echo $ccsymbols`
15011                 $test "$silent" || sleep 1
15012         fi
15013 fi
15014 $rm -f ccsym* Cppsym.*
15015
15016 : see if this is a termio system
15017 val="$undef"
15018 val2="$undef"
15019 val3="$undef"
15020 if $test `./findhdr termios.h`; then
15021         set tcsetattr i_termios
15022         eval $inlibc
15023         val3="$i_termios"
15024 fi
15025 echo " "
15026 case "$val3" in
15027 "$define") echo "You have POSIX termios.h... good!" >&4;;
15028 *) if ./Cppsym pyr; then
15029                 case "`/bin/universe`" in
15030                 ucb) if $test `./findhdr sgtty.h`; then
15031                                 val2="$define"
15032                                 echo "<sgtty.h> found." >&4
15033                         else
15034                                 echo "System is pyramid with BSD universe."
15035                                 echo "<sgtty.h> not found--you could have problems." >&4
15036                         fi;;
15037                 *) if $test `./findhdr termio.h`; then
15038                                 val="$define"
15039                                 echo "<termio.h> found." >&4
15040                         else
15041                                 echo "System is pyramid with USG universe."
15042                                 echo "<termio.h> not found--you could have problems." >&4
15043                         fi;;
15044                 esac
15045         elif ./usg; then
15046                 if $test `./findhdr termio.h`; then
15047                         echo "<termio.h> found." >&4
15048                         val="$define"
15049                 elif $test `./findhdr sgtty.h`; then
15050                         echo "<sgtty.h> found." >&4
15051                         val2="$define"
15052                 else
15053 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15054                 fi
15055         else
15056                 if $test `./findhdr sgtty.h`; then
15057                         echo "<sgtty.h> found." >&4
15058                         val2="$define"
15059                 elif $test `./findhdr termio.h`; then
15060                         echo "<termio.h> found." >&4
15061                         val="$define"
15062                 else
15063 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15064                 fi
15065         fi;;
15066 esac
15067 set i_termio; eval $setvar
15068 val=$val2; set i_sgtty; eval $setvar
15069 val=$val3; set i_termios; eval $setvar
15070
15071 : see if this is a shadow.h system
15072 set shadow.h i_shadow
15073 eval $inhdr
15074
15075 : see if stddef is available
15076 set stddef.h i_stddef
15077 eval $inhdr
15078
15079 : see if this is a sunmath.h system
15080 set sunmath.h i_sunmath
15081 eval $inhdr
15082
15083 : see if sys/access.h is available
15084 set sys/access.h i_sysaccess
15085 eval $inhdr
15086
15087 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15088 set sys/filio.h i_sysfilio
15089 eval $inhdr
15090 echo " "
15091 if $test `./findhdr sys/ioctl.h`; then
15092         val="$define"
15093         echo '<sys/ioctl.h> found.' >&4
15094 else
15095         val="$undef"
15096         if $test $i_sysfilio = "$define"; then
15097             echo '<sys/ioctl.h> NOT found.' >&4
15098         else
15099                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15100                 $test $i_termio = "$define" && xxx="termio.h"
15101                 $test $i_termios = "$define" && xxx="termios.h"
15102 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15103         fi
15104 fi
15105 set i_sysioctl
15106 eval $setvar
15107
15108
15109 : see if this is a syslog.h system
15110 set syslog.h i_syslog
15111 eval $inhdr
15112
15113
15114 : see if this is a sys/mode.h system
15115 set sys/mode.h i_sysmode
15116 eval $inhdr
15117
15118 : see if sys/resource.h has to be included
15119 set sys/resource.h i_sysresrc
15120 eval $inhdr
15121
15122 : see if sys/security.h is available
15123 set sys/security.h i_syssecrt
15124 eval $inhdr
15125
15126 : see if this is a sys/statvfs.h system
15127 set sys/statvfs.h i_sysstatvfs
15128 eval $inhdr
15129
15130 : see if this is a sys/uio.h system
15131 set sys/uio.h i_sysuio
15132 eval $inhdr
15133
15134 : see if this is a sys/un.h system
15135 set sys/un.h i_sysun
15136 eval $inhdr
15137
15138
15139 : see if this is a sys/utsname.h system
15140 set sys/utsname.h i_sysutsname
15141 eval $inhdr
15142
15143 : see if this is a syswait system
15144 set sys/wait.h i_syswait
15145 eval $inhdr
15146
15147 : see if this is a ustat.h system
15148 set ustat.h i_ustat
15149 eval $inhdr
15150
15151 : see if this is an utime system
15152 set utime.h i_utime
15153 eval $inhdr
15154
15155 : see if this is a values.h system
15156 set values.h i_values
15157 eval $inhdr
15158
15159 : see if this is a vfork system
15160 case "$d_vfork" in
15161 "$define")
15162         set vfork.h i_vfork
15163         eval $inhdr
15164         ;;
15165 *)
15166         i_vfork="$undef"
15167         ;;
15168 esac
15169
15170 : see if gdbm.h is available
15171 set gdbm.h t_gdbm
15172 eval $inhdr
15173 case "$t_gdbm" in
15174 $define)
15175         : see if gdbm_open exists
15176         set gdbm_open d_gdbm_open
15177         eval $inlibc
15178         case "$d_gdbm_open" in
15179         $undef)
15180                 t_gdbm="$undef"
15181                 echo "We won't be including <gdbm.h>"
15182                 ;;
15183         esac
15184         ;;
15185 esac
15186 val="$t_gdbm"
15187 set i_gdbm
15188 eval $setvar
15189
15190 echo " "
15191 echo "Looking for extensions..." >&4
15192 : If we are using the old config.sh, known_extensions may contain
15193 : old or inaccurate or duplicate values.
15194 known_extensions=''
15195 nonxs_extensions=''
15196 : We do not use find because it might not be available.
15197 : We do not just use MANIFEST because the user may have dropped
15198 : some additional extensions into the source tree and expect them
15199 : to be built.
15200
15201 : Function to recursively find available extensions, ignoring DynaLoader
15202 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15203 find_extensions='
15204     for xxx in *; do
15205        case "$xxx" in
15206            DynaLoader|dynaload) ;;
15207            *)
15208            if $test -f $xxx/$xxx.xs; then
15209                known_extensions="$known_extensions $1$xxx";
15210            elif $test -f $xxx/Makefile.PL; then
15211                nonxs_extensions="$nonxs_extensions $1$xxx";
15212            else
15213                if $test -d $xxx -a $# -lt 10; then
15214                    set $1$xxx/ $*;
15215                    cd $xxx;
15216                    eval $find_extensions;
15217                    cd ..;
15218                    shift;
15219                fi;
15220            fi
15221            ;;
15222        esac;
15223     done'
15224 tdir=`pwd`
15225 cd $rsrc/ext
15226 set X
15227 shift
15228 eval $find_extensions
15229 set X $nonxs_extensions
15230 shift
15231 nonxs_extensions="$*"
15232 set X $known_extensions
15233 shift
15234 known_extensions="$*"
15235 cd $tdir
15236
15237 : Now see which are supported on this system.
15238 avail_ext=''
15239 for xxx in $known_extensions ; do
15240         case "$xxx" in
15241         DB_File|db_file)
15242                 case "$i_db" in
15243                 $define) avail_ext="$avail_ext $xxx" ;;
15244                 esac
15245                 ;;
15246         GDBM_File|gdbm_fil)
15247                 case "$i_gdbm" in 
15248                 $define) avail_ext="$avail_ext $xxx" ;;
15249                 esac
15250                 ;;
15251         NDBM_File|ndbm_fil)
15252                 case "$i_ndbm" in
15253                 $define)
15254                     case "$osname-$use64bitint" in
15255                     hpux-define)
15256                         case "$libs" in
15257                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15258                         esac
15259                         ;;
15260                     *) avail_ext="$avail_ext $xxx" ;;
15261                     esac
15262                     ;;
15263                 esac
15264                 ;;
15265         ODBM_File|odbm_fil) 
15266                 case "${i_dbm}${i_rpcsvcdbm}" in
15267                 *"${define}"*)
15268                     case "$osname-$use64bitint" in
15269                     hpux-define)
15270                         case "$libs" in
15271                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15272                         esac
15273                         ;;
15274                     *) avail_ext="$avail_ext $xxx" ;;
15275                     esac
15276                     ;;
15277                 esac
15278                 ;;
15279         POSIX|posix)
15280                 case "$useposix" in
15281                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15282                 esac
15283                 ;;
15284         Opcode|opcode)
15285                 case "$useopcode" in
15286                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15287                 esac
15288                 ;;
15289         Socket|socket)
15290                 case "$d_socket" in 
15291                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15292                 esac
15293                 ;;
15294         Sys/Syslog|sys/syslog)
15295                 : XXX syslog requires socket
15296                 case "$d_socket" in 
15297                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15298                 esac
15299                 ;;
15300         Thread|thread)
15301                 case "$usethreads" in 
15302                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15303                 esac
15304                 ;;
15305         IPC/SysV|ipc/sysv)
15306                 : XXX Do we need a useipcsysv variable here
15307                 case "${d_msg}${d_sem}${d_shm}" in 
15308                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15309                 esac
15310                 ;;
15311         *)      avail_ext="$avail_ext $xxx"
15312                 ;;
15313         esac
15314 done
15315
15316 set X $avail_ext
15317 shift
15318 avail_ext="$*"
15319
15320 : Now see which nonxs extensions are supported on this system.
15321 : For now assume all are.
15322 nonxs_ext=''
15323 for xxx in $nonxs_extensions ; do
15324         case "$xxx" in
15325         *)      nonxs_ext="$nonxs_ext $xxx"
15326                 ;;
15327         esac
15328 done
15329
15330 set X $nonxs_ext
15331 shift
15332 nonxs_ext="$*"
15333
15334 case $usedl in
15335 $define)
15336         $cat <<EOM
15337 A number of extensions are supplied with $package.  You may choose to
15338 compile these extensions for dynamic loading (the default), compile
15339 them into the $package executable (static loading), or not include
15340 them at all.  Answer "none" to include no extensions.
15341 Note that DynaLoader is always built and need not be mentioned here.
15342
15343 EOM
15344         case "$dynamic_ext" in
15345         '') dflt="$avail_ext" ;;
15346         *)      dflt="$dynamic_ext"
15347                 # Perhaps we are reusing an old out-of-date config.sh.
15348                 case "$hint" in
15349                 previous)
15350                         if test X"$dynamic_ext" != X"$avail_ext"; then
15351                                 $cat <<EOM
15352 NOTICE:  Your previous config.sh list may be incorrect. 
15353 The extensions now available to you are 
15354         ${avail_ext}
15355 but the default list from your previous config.sh is
15356         ${dynamic_ext} 
15357
15358 EOM
15359                         fi
15360                         ;;
15361                 esac
15362                 ;;
15363         esac
15364         case "$dflt" in
15365         '')     dflt=none;;
15366         esac
15367         rp="What extensions do you wish to load dynamically?"
15368         . ./myread
15369         case "$ans" in
15370         none) dynamic_ext=' ' ;;
15371         *) dynamic_ext="$ans" ;;
15372         esac
15373
15374         case "$static_ext" in
15375         '')
15376                 : Exclude those already listed in dynamic linking
15377                 dflt=''
15378                 for xxx in $avail_ext; do
15379                         case " $dynamic_ext " in
15380                         *" $xxx "*) ;;
15381                         *) dflt="$dflt $xxx" ;;
15382                         esac
15383                 done
15384                 set X $dflt
15385                 shift
15386                 dflt="$*"
15387                 ;;
15388         *)  dflt="$static_ext" 
15389                 ;;
15390         esac
15391
15392         case "$dflt" in
15393         '')     dflt=none;;
15394         esac
15395         rp="What extensions do you wish to load statically?"
15396         . ./myread
15397         case "$ans" in
15398         none) static_ext=' ' ;;
15399         *) static_ext="$ans" ;;
15400         esac
15401         ;;
15402 *)
15403         $cat <<EOM
15404 A number of extensions are supplied with $package.  Answer "none" 
15405 to include no extensions. 
15406 Note that DynaLoader is always built and need not be mentioned here.
15407
15408 EOM
15409         case "$static_ext" in
15410         '') dflt="$avail_ext" ;;
15411         *)      dflt="$static_ext"
15412                 # Perhaps we are reusing an old out-of-date config.sh.
15413                 case "$hint" in
15414                 previous)
15415                         if test X"$static_ext" != X"$avail_ext"; then
15416                                 $cat <<EOM
15417 NOTICE:  Your previous config.sh list may be incorrect. 
15418 The extensions now available to you are 
15419         ${avail_ext}
15420 but the default list from your previous config.sh is
15421         ${static_ext} 
15422
15423 EOM
15424                         fi
15425                         ;;
15426                 esac
15427                 ;;
15428         esac
15429         : Exclude those that are not xs extensions
15430         case "$dflt" in
15431         '')     dflt=none;;
15432         esac
15433         rp="What extensions do you wish to include?"
15434         . ./myread
15435         case "$ans" in
15436         none) static_ext=' ' ;;
15437         *) static_ext="$ans" ;;
15438         esac
15439         ;;
15440 esac
15441
15442 set X $dynamic_ext $static_ext $nonxs_ext
15443 shift
15444 extensions="$*"
15445
15446 : Remove libraries needed only for extensions
15447 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15448 : The exception is SunOS 4.x, which needs them.
15449 case "${osname}X${osvers}" in
15450 sunos*X4*)
15451     perllibs="$libs"
15452     ;;
15453 *) case "$usedl" in
15454     $define|true|[yY]*)
15455             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15456             shift
15457             perllibs="$*"
15458             ;;
15459     *)  perllibs="$libs"
15460             ;;
15461     esac
15462     ;;
15463 esac
15464
15465 : Remove build directory name from cppstdin so it can be used from
15466 : either the present location or the final installed location.
15467 echo " "
15468 : Get out of the UU directory to get correct path name.
15469 cd ..
15470 case "$cppstdin" in
15471 `pwd`/cppstdin)
15472         echo "Stripping down cppstdin path name"
15473         cppstdin=cppstdin
15474         ;;
15475 esac
15476 cd UU
15477
15478 : end of configuration questions
15479 echo " "
15480 echo "End of configuration questions."
15481 echo " "
15482
15483 : back to where it started
15484 if test -d ../UU; then
15485         cd ..
15486 fi
15487
15488 : configuration may be patched via a 'config.over' file
15489 if $test -f config.over; then
15490         echo " "
15491         dflt=y
15492         rp='I see a config.over file.  Do you wish to load it?'
15493         . UU/myread
15494         case "$ans" in
15495         n*) echo "OK, I'll ignore it.";;
15496         *)      . ./config.over
15497                 echo "Configuration override changes have been loaded."
15498                 ;;
15499         esac
15500 fi
15501
15502 : in case they want portability, strip down executable paths
15503 case "$d_portable" in
15504 "$define")
15505         echo " "
15506         echo "Stripping down executable paths..." >&4
15507         for file in $loclist $trylist; do
15508                 eval temp=\$$file
15509                 eval $file=`basename $temp`
15510         done
15511         ;;
15512 esac
15513
15514 : create config.sh file
15515 echo " "
15516 echo "Creating config.sh..." >&4
15517 $spitshell <<EOT >config.sh
15518 $startsh
15519 #
15520 # This file was produced by running the Configure script. It holds all the
15521 # definitions figured out by Configure. Should you modify one of these values,
15522 # do not forget to propagate your changes by running "Configure -der". You may
15523 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15524 #
15525
15526 # Package name      : $package
15527 # Source directory  : $src
15528 # Configuration time: $cf_time
15529 # Configured by     : $cf_by
15530 # Target system     : $myuname
15531
15532 Author='$Author'
15533 Date='$Date'
15534 Header='$Header'
15535 Id='$Id'
15536 Locker='$Locker'
15537 Log='$Log'
15538 Mcc='$Mcc'
15539 RCSfile='$RCSfile'
15540 Revision='$Revision'
15541 Source='$Source'
15542 State='$State'
15543 _a='$_a'
15544 _exe='$_exe'
15545 _o='$_o'
15546 afs='$afs'
15547 alignbytes='$alignbytes'
15548 ansi2knr='$ansi2knr'
15549 aphostname='$aphostname'
15550 api_revision='$api_revision'
15551 api_subversion='$api_subversion'
15552 api_version='$api_version'
15553 api_versionstring='$api_versionstring'
15554 ar='$ar'
15555 archlib='$archlib'
15556 archlibexp='$archlibexp'
15557 archname64='$archname64'
15558 archname='$archname'
15559 archobjs='$archobjs'
15560 awk='$awk'
15561 baserev='$baserev'
15562 bash='$bash'
15563 bin='$bin'
15564 bincompat5005='$bincompat5005'
15565 binexp='$binexp'
15566 bison='$bison'
15567 byacc='$byacc'
15568 byteorder='$byteorder'
15569 c='$c'
15570 castflags='$castflags'
15571 cat='$cat'
15572 cc='$cc'
15573 cccdlflags='$cccdlflags'
15574 ccdlflags='$ccdlflags'
15575 ccflags='$ccflags'
15576 ccflags_uselargefiles='$ccflags_uselargefiles'
15577 ccname='$ccname'
15578 ccsymbols='$ccsymbols'
15579 ccversion='$ccversion'
15580 cf_by='$cf_by'
15581 cf_email='$cf_email'
15582 cf_time='$cf_time'
15583 charsize='$charsize'
15584 chgrp='$chgrp'
15585 chmod='$chmod'
15586 chown='$chown'
15587 clocktype='$clocktype'
15588 comm='$comm'
15589 compress='$compress'
15590 contains='$contains'
15591 cp='$cp'
15592 cpio='$cpio'
15593 cpp='$cpp'
15594 cpp_stuff='$cpp_stuff'
15595 cppccsymbols='$cppccsymbols'
15596 cppflags='$cppflags'
15597 cpplast='$cpplast'
15598 cppminus='$cppminus'
15599 cpprun='$cpprun'
15600 cppstdin='$cppstdin'
15601 cppsymbols='$cppsymbols'
15602 crosscompile='$crosscompile'
15603 cryptlib='$cryptlib'
15604 csh='$csh'
15605 d_Gconvert='$d_Gconvert'
15606 d_PRIEUldbl='$d_PRIEUldbl'
15607 d_PRIFUldbl='$d_PRIFUldbl'
15608 d_PRIGUldbl='$d_PRIGUldbl'
15609 d_PRIXU64='$d_PRIXU64'
15610 d_PRId64='$d_PRId64'
15611 d_PRIeldbl='$d_PRIeldbl'
15612 d_PRIfldbl='$d_PRIfldbl'
15613 d_PRIgldbl='$d_PRIgldbl'
15614 d_PRIi64='$d_PRIi64'
15615 d_PRIo64='$d_PRIo64'
15616 d_PRIu64='$d_PRIu64'
15617 d_PRIx64='$d_PRIx64'
15618 d_SCNfldbl='$d_SCNfldbl'
15619 d__fwalk='$d__fwalk'
15620 d_access='$d_access'
15621 d_accessx='$d_accessx'
15622 d_alarm='$d_alarm'
15623 d_archlib='$d_archlib'
15624 d_atolf='$d_atolf'
15625 d_atoll='$d_atoll'
15626 d_attribut='$d_attribut'
15627 d_bcmp='$d_bcmp'
15628 d_bcopy='$d_bcopy'
15629 d_bincompat5005='$d_bincompat5005'
15630 d_bsd='$d_bsd'
15631 d_bsdgetpgrp='$d_bsdgetpgrp'
15632 d_bsdsetpgrp='$d_bsdsetpgrp'
15633 d_bzero='$d_bzero'
15634 d_casti32='$d_casti32'
15635 d_castneg='$d_castneg'
15636 d_charvspr='$d_charvspr'
15637 d_chown='$d_chown'
15638 d_chroot='$d_chroot'
15639 d_chsize='$d_chsize'
15640 d_closedir='$d_closedir'
15641 d_const='$d_const'
15642 d_crypt='$d_crypt'
15643 d_csh='$d_csh'
15644 d_cuserid='$d_cuserid'
15645 d_dbl_dig='$d_dbl_dig'
15646 d_difftime='$d_difftime'
15647 d_dirnamlen='$d_dirnamlen'
15648 d_dlerror='$d_dlerror'
15649 d_dlopen='$d_dlopen'
15650 d_dlsymun='$d_dlsymun'
15651 d_dosuid='$d_dosuid'
15652 d_drand48proto='$d_drand48proto'
15653 d_dup2='$d_dup2'
15654 d_eaccess='$d_eaccess'
15655 d_endgrent='$d_endgrent'
15656 d_endhent='$d_endhent'
15657 d_endnent='$d_endnent'
15658 d_endpent='$d_endpent'
15659 d_endpwent='$d_endpwent'
15660 d_endsent='$d_endsent'
15661 d_eofnblk='$d_eofnblk'
15662 d_eunice='$d_eunice'
15663 d_fchmod='$d_fchmod'
15664 d_fchown='$d_fchown'
15665 d_fcntl='$d_fcntl'
15666 d_fcntl_can_lock='$d_fcntl_can_lock'
15667 d_fd_macros='$d_fd_macros'
15668 d_fd_set='$d_fd_set'
15669 d_fds_bits='$d_fds_bits'
15670 d_fgetpos='$d_fgetpos'
15671 d_flexfnam='$d_flexfnam'
15672 d_flock='$d_flock'
15673 d_fork='$d_fork'
15674 d_fpathconf='$d_fpathconf'
15675 d_fpos64_t='$d_fpos64_t'
15676 d_frexpl='$d_frexpl'
15677 d_fs_data_s='$d_fs_data_s'
15678 d_fseeko='$d_fseeko'
15679 d_fsetpos='$d_fsetpos'
15680 d_fstatfs='$d_fstatfs'
15681 d_fstatvfs='$d_fstatvfs'
15682 d_fsync='$d_fsync'
15683 d_ftello='$d_ftello'
15684 d_ftime='$d_ftime'
15685 d_getcwd='$d_getcwd'
15686 d_getespwnam='$d_getespwnam'
15687 d_getfsstat='$d_getfsstat'
15688 d_getgrent='$d_getgrent'
15689 d_getgrps='$d_getgrps'
15690 d_gethbyaddr='$d_gethbyaddr'
15691 d_gethbyname='$d_gethbyname'
15692 d_gethent='$d_gethent'
15693 d_gethname='$d_gethname'
15694 d_gethostprotos='$d_gethostprotos'
15695 d_getlogin='$d_getlogin'
15696 d_getmnt='$d_getmnt'
15697 d_getmntent='$d_getmntent'
15698 d_getnbyaddr='$d_getnbyaddr'
15699 d_getnbyname='$d_getnbyname'
15700 d_getnent='$d_getnent'
15701 d_getnetprotos='$d_getnetprotos'
15702 d_getpagsz='$d_getpagsz'
15703 d_getpbyname='$d_getpbyname'
15704 d_getpbynumber='$d_getpbynumber'
15705 d_getpent='$d_getpent'
15706 d_getpgid='$d_getpgid'
15707 d_getpgrp2='$d_getpgrp2'
15708 d_getpgrp='$d_getpgrp'
15709 d_getppid='$d_getppid'
15710 d_getprior='$d_getprior'
15711 d_getprotoprotos='$d_getprotoprotos'
15712 d_getprpwnam='$d_getprpwnam'
15713 d_getpwent='$d_getpwent'
15714 d_getsbyname='$d_getsbyname'
15715 d_getsbyport='$d_getsbyport'
15716 d_getsent='$d_getsent'
15717 d_getservprotos='$d_getservprotos'
15718 d_getspnam='$d_getspnam'
15719 d_gettimeod='$d_gettimeod'
15720 d_gnulibc='$d_gnulibc'
15721 d_grpasswd='$d_grpasswd'
15722 d_hasmntopt='$d_hasmntopt'
15723 d_htonl='$d_htonl'
15724 d_iconv='$d_iconv'
15725 d_index='$d_index'
15726 d_inetaton='$d_inetaton'
15727 d_int64_t='$d_int64_t'
15728 d_isascii='$d_isascii'
15729 d_isnan='$d_isnan'
15730 d_isnanl='$d_isnanl'
15731 d_killpg='$d_killpg'
15732 d_lchown='$d_lchown'
15733 d_ldbl_dig='$d_ldbl_dig'
15734 d_link='$d_link'
15735 d_locconv='$d_locconv'
15736 d_lockf='$d_lockf'
15737 d_longdbl='$d_longdbl'
15738 d_longlong='$d_longlong'
15739 d_lseekproto='$d_lseekproto'
15740 d_lstat='$d_lstat'
15741 d_madvise='$d_madvise'
15742 d_mblen='$d_mblen'
15743 d_mbstowcs='$d_mbstowcs'
15744 d_mbtowc='$d_mbtowc'
15745 d_memchr='$d_memchr'
15746 d_memcmp='$d_memcmp'
15747 d_memcpy='$d_memcpy'
15748 d_memmove='$d_memmove'
15749 d_memset='$d_memset'
15750 d_mkdir='$d_mkdir'
15751 d_mkdtemp='$d_mkdtemp'
15752 d_mkfifo='$d_mkfifo'
15753 d_mkstemp='$d_mkstemp'
15754 d_mkstemps='$d_mkstemps'
15755 d_mktime='$d_mktime'
15756 d_mmap='$d_mmap'
15757 d_modfl='$d_modfl'
15758 d_mprotect='$d_mprotect'
15759 d_msg='$d_msg'
15760 d_msg_ctrunc='$d_msg_ctrunc'
15761 d_msg_dontroute='$d_msg_dontroute'
15762 d_msg_oob='$d_msg_oob'
15763 d_msg_peek='$d_msg_peek'
15764 d_msg_proxy='$d_msg_proxy'
15765 d_msgctl='$d_msgctl'
15766 d_msgget='$d_msgget'
15767 d_msgrcv='$d_msgrcv'
15768 d_msgsnd='$d_msgsnd'
15769 d_msync='$d_msync'
15770 d_munmap='$d_munmap'
15771 d_mymalloc='$d_mymalloc'
15772 d_nice='$d_nice'
15773 d_nv_preserves_uv='$d_nv_preserves_uv'
15774 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15775 d_off64_t='$d_off64_t'
15776 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15777 d_oldpthreads='$d_oldpthreads'
15778 d_oldsock='$d_oldsock'
15779 d_open3='$d_open3'
15780 d_pathconf='$d_pathconf'
15781 d_pause='$d_pause'
15782 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15783 d_phostname='$d_phostname'
15784 d_pipe='$d_pipe'
15785 d_poll='$d_poll'
15786 d_portable='$d_portable'
15787 d_pthread_yield='$d_pthread_yield'
15788 d_pwage='$d_pwage'
15789 d_pwchange='$d_pwchange'
15790 d_pwclass='$d_pwclass'
15791 d_pwcomment='$d_pwcomment'
15792 d_pwexpire='$d_pwexpire'
15793 d_pwgecos='$d_pwgecos'
15794 d_pwpasswd='$d_pwpasswd'
15795 d_pwquota='$d_pwquota'
15796 d_qgcvt='$d_qgcvt'
15797 d_quad='$d_quad'
15798 d_readdir='$d_readdir'
15799 d_readlink='$d_readlink'
15800 d_rename='$d_rename'
15801 d_rewinddir='$d_rewinddir'
15802 d_rmdir='$d_rmdir'
15803 d_safebcpy='$d_safebcpy'
15804 d_safemcpy='$d_safemcpy'
15805 d_sanemcmp='$d_sanemcmp'
15806 d_sbrkproto='$d_sbrkproto'
15807 d_sched_yield='$d_sched_yield'
15808 d_scm_rights='$d_scm_rights'
15809 d_seekdir='$d_seekdir'
15810 d_select='$d_select'
15811 d_sem='$d_sem'
15812 d_semctl='$d_semctl'
15813 d_semctl_semid_ds='$d_semctl_semid_ds'
15814 d_semctl_semun='$d_semctl_semun'
15815 d_semget='$d_semget'
15816 d_semop='$d_semop'
15817 d_setegid='$d_setegid'
15818 d_seteuid='$d_seteuid'
15819 d_setgrent='$d_setgrent'
15820 d_setgrps='$d_setgrps'
15821 d_sethent='$d_sethent'
15822 d_setlinebuf='$d_setlinebuf'
15823 d_setlocale='$d_setlocale'
15824 d_setnent='$d_setnent'
15825 d_setpent='$d_setpent'
15826 d_setpgid='$d_setpgid'
15827 d_setpgrp2='$d_setpgrp2'
15828 d_setpgrp='$d_setpgrp'
15829 d_setprior='$d_setprior'
15830 d_setproctitle='$d_setproctitle'
15831 d_setpwent='$d_setpwent'
15832 d_setregid='$d_setregid'
15833 d_setresgid='$d_setresgid'
15834 d_setresuid='$d_setresuid'
15835 d_setreuid='$d_setreuid'
15836 d_setrgid='$d_setrgid'
15837 d_setruid='$d_setruid'
15838 d_setsent='$d_setsent'
15839 d_setsid='$d_setsid'
15840 d_setvbuf='$d_setvbuf'
15841 d_sfio='$d_sfio'
15842 d_shm='$d_shm'
15843 d_shmat='$d_shmat'
15844 d_shmatprototype='$d_shmatprototype'
15845 d_shmctl='$d_shmctl'
15846 d_shmdt='$d_shmdt'
15847 d_shmget='$d_shmget'
15848 d_sigaction='$d_sigaction'
15849 d_sigsetjmp='$d_sigsetjmp'
15850 d_socket='$d_socket'
15851 d_socklen_t='$d_socklen_t'
15852 d_sockpair='$d_sockpair'
15853 d_socks5_init='$d_socks5_init'
15854 d_sqrtl='$d_sqrtl'
15855 d_statblks='$d_statblks'
15856 d_statfs_f_flags='$d_statfs_f_flags'
15857 d_statfs_s='$d_statfs_s'
15858 d_statvfs='$d_statvfs'
15859 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15860 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15861 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15862 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15863 d_stdio_stream_array='$d_stdio_stream_array'
15864 d_stdiobase='$d_stdiobase'
15865 d_stdstdio='$d_stdstdio'
15866 d_strchr='$d_strchr'
15867 d_strcoll='$d_strcoll'
15868 d_strctcpy='$d_strctcpy'
15869 d_strerrm='$d_strerrm'
15870 d_strerror='$d_strerror'
15871 d_strtod='$d_strtod'
15872 d_strtol='$d_strtol'
15873 d_strtold='$d_strtold'
15874 d_strtoll='$d_strtoll'
15875 d_strtoul='$d_strtoul'
15876 d_strtoull='$d_strtoull'
15877 d_strtouq='$d_strtouq'
15878 d_strxfrm='$d_strxfrm'
15879 d_suidsafe='$d_suidsafe'
15880 d_symlink='$d_symlink'
15881 d_syscall='$d_syscall'
15882 d_sysconf='$d_sysconf'
15883 d_sysernlst='$d_sysernlst'
15884 d_syserrlst='$d_syserrlst'
15885 d_system='$d_system'
15886 d_tcgetpgrp='$d_tcgetpgrp'
15887 d_tcsetpgrp='$d_tcsetpgrp'
15888 d_telldir='$d_telldir'
15889 d_telldirproto='$d_telldirproto'
15890 d_time='$d_time'
15891 d_times='$d_times'
15892 d_truncate='$d_truncate'
15893 d_tzname='$d_tzname'
15894 d_umask='$d_umask'
15895 d_uname='$d_uname'
15896 d_union_semun='$d_union_semun'
15897 d_ustat='$d_ustat'
15898 d_vendorarch='$d_vendorarch'
15899 d_vendorbin='$d_vendorbin'
15900 d_vendorlib='$d_vendorlib'
15901 d_vfork='$d_vfork'
15902 d_void_closedir='$d_void_closedir'
15903 d_voidsig='$d_voidsig'
15904 d_voidtty='$d_voidtty'
15905 d_volatile='$d_volatile'
15906 d_vprintf='$d_vprintf'
15907 d_wait4='$d_wait4'
15908 d_waitpid='$d_waitpid'
15909 d_wcstombs='$d_wcstombs'
15910 d_wctomb='$d_wctomb'
15911 d_xenix='$d_xenix'
15912 date='$date'
15913 db_hashtype='$db_hashtype'
15914 db_prefixtype='$db_prefixtype'
15915 defvoidused='$defvoidused'
15916 direntrytype='$direntrytype'
15917 dlext='$dlext'
15918 dlsrc='$dlsrc'
15919 doublesize='$doublesize'
15920 drand01='$drand01'
15921 dynamic_ext='$dynamic_ext'
15922 eagain='$eagain'
15923 ebcdic='$ebcdic'
15924 echo='$echo'
15925 egrep='$egrep'
15926 emacs='$emacs'
15927 eunicefix='$eunicefix'
15928 exe_ext='$exe_ext'
15929 expr='$expr'
15930 extensions='$extensions'
15931 fflushNULL='$fflushNULL'
15932 fflushall='$fflushall'
15933 find='$find'
15934 firstmakefile='$firstmakefile'
15935 flex='$flex'
15936 fpossize='$fpossize'
15937 fpostype='$fpostype'
15938 freetype='$freetype'
15939 full_ar='$full_ar'
15940 full_csh='$full_csh'
15941 full_sed='$full_sed'
15942 gccosandvers='$gccosandvers'
15943 gccversion='$gccversion'
15944 gidformat='$gidformat'
15945 gidsign='$gidsign'
15946 gidsize='$gidsize'
15947 gidtype='$gidtype'
15948 glibpth='$glibpth'
15949 grep='$grep'
15950 groupcat='$groupcat'
15951 groupstype='$groupstype'
15952 gzip='$gzip'
15953 h_fcntl='$h_fcntl'
15954 h_sysfile='$h_sysfile'
15955 hint='$hint'
15956 hostcat='$hostcat'
15957 i16size='$i16size'
15958 i16type='$i16type'
15959 i32size='$i32size'
15960 i32type='$i32type'
15961 i64size='$i64size'
15962 i64type='$i64type'
15963 i8size='$i8size'
15964 i8type='$i8type'
15965 i_arpainet='$i_arpainet'
15966 i_bsdioctl='$i_bsdioctl'
15967 i_db='$i_db'
15968 i_dbm='$i_dbm'
15969 i_dirent='$i_dirent'
15970 i_dld='$i_dld'
15971 i_dlfcn='$i_dlfcn'
15972 i_fcntl='$i_fcntl'
15973 i_float='$i_float'
15974 i_gdbm='$i_gdbm'
15975 i_grp='$i_grp'
15976 i_iconv='$i_iconv'
15977 i_ieeefp='$i_ieeefp'
15978 i_inttypes='$i_inttypes'
15979 i_libutil='$i_libutil'
15980 i_limits='$i_limits'
15981 i_locale='$i_locale'
15982 i_machcthr='$i_machcthr'
15983 i_malloc='$i_malloc'
15984 i_math='$i_math'
15985 i_memory='$i_memory'
15986 i_mntent='$i_mntent'
15987 i_ndbm='$i_ndbm'
15988 i_netdb='$i_netdb'
15989 i_neterrno='$i_neterrno'
15990 i_netinettcp='$i_netinettcp'
15991 i_niin='$i_niin'
15992 i_poll='$i_poll'
15993 i_prot='$i_prot'
15994 i_pthread='$i_pthread'
15995 i_pwd='$i_pwd'
15996 i_rpcsvcdbm='$i_rpcsvcdbm'
15997 i_sfio='$i_sfio'
15998 i_sgtty='$i_sgtty'
15999 i_shadow='$i_shadow'
16000 i_socks='$i_socks'
16001 i_stdarg='$i_stdarg'
16002 i_stddef='$i_stddef'
16003 i_stdlib='$i_stdlib'
16004 i_string='$i_string'
16005 i_sunmath='$i_sunmath'
16006 i_sysaccess='$i_sysaccess'
16007 i_sysdir='$i_sysdir'
16008 i_sysfile='$i_sysfile'
16009 i_sysfilio='$i_sysfilio'
16010 i_sysin='$i_sysin'
16011 i_sysioctl='$i_sysioctl'
16012 i_syslog='$i_syslog'
16013 i_sysmman='$i_sysmman'
16014 i_sysmode='$i_sysmode'
16015 i_sysmount='$i_sysmount'
16016 i_sysndir='$i_sysndir'
16017 i_sysparam='$i_sysparam'
16018 i_sysresrc='$i_sysresrc'
16019 i_syssecrt='$i_syssecrt'
16020 i_sysselct='$i_sysselct'
16021 i_syssockio='$i_syssockio'
16022 i_sysstat='$i_sysstat'
16023 i_sysstatfs='$i_sysstatfs'
16024 i_sysstatvfs='$i_sysstatvfs'
16025 i_systime='$i_systime'
16026 i_systimek='$i_systimek'
16027 i_systimes='$i_systimes'
16028 i_systypes='$i_systypes'
16029 i_sysuio='$i_sysuio'
16030 i_sysun='$i_sysun'
16031 i_sysutsname='$i_sysutsname'
16032 i_sysvfs='$i_sysvfs'
16033 i_syswait='$i_syswait'
16034 i_termio='$i_termio'
16035 i_termios='$i_termios'
16036 i_time='$i_time'
16037 i_unistd='$i_unistd'
16038 i_ustat='$i_ustat'
16039 i_utime='$i_utime'
16040 i_values='$i_values'
16041 i_varargs='$i_varargs'
16042 i_varhdr='$i_varhdr'
16043 i_vfork='$i_vfork'
16044 ignore_versioned_solibs='$ignore_versioned_solibs'
16045 inc_version_list='$inc_version_list'
16046 inc_version_list_init='$inc_version_list_init'
16047 incpath='$incpath'
16048 inews='$inews'
16049 installarchlib='$installarchlib'
16050 installbin='$installbin'
16051 installman1dir='$installman1dir'
16052 installman3dir='$installman3dir'
16053 installprefix='$installprefix'
16054 installprefixexp='$installprefixexp'
16055 installprivlib='$installprivlib'
16056 installscript='$installscript'
16057 installsitearch='$installsitearch'
16058 installsitebin='$installsitebin'
16059 installsitelib='$installsitelib'
16060 installstyle='$installstyle'
16061 installusrbinperl='$installusrbinperl'
16062 installvendorarch='$installvendorarch'
16063 installvendorbin='$installvendorbin'
16064 installvendorlib='$installvendorlib'
16065 intsize='$intsize'
16066 ivdformat='$ivdformat'
16067 ivsize='$ivsize'
16068 ivtype='$ivtype'
16069 known_extensions='$known_extensions'
16070 ksh='$ksh'
16071 ld='$ld'
16072 lddlflags='$lddlflags'
16073 ldflags='$ldflags'
16074 ldflags_uselargefiles='$ldflags_uselargefiles'
16075 ldlibpthname='$ldlibpthname'
16076 less='$less'
16077 lib_ext='$lib_ext'
16078 libc='$libc'
16079 libperl='$libperl'
16080 libpth='$libpth'
16081 libs='$libs'
16082 libsdirs='$libsdirs'
16083 libsfiles='$libsfiles'
16084 libsfound='$libsfound'
16085 libspath='$libspath'
16086 libswanted='$libswanted'
16087 libswanted_uselargefiles='$libswanted_uselargefiles'
16088 line='$line'
16089 lint='$lint'
16090 lkflags='$lkflags'
16091 ln='$ln'
16092 lns='$lns'
16093 locincpth='$locincpth'
16094 loclibpth='$loclibpth'
16095 longdblsize='$longdblsize'
16096 longlongsize='$longlongsize'
16097 longsize='$longsize'
16098 lp='$lp'
16099 lpr='$lpr'
16100 ls='$ls'
16101 lseeksize='$lseeksize'
16102 lseektype='$lseektype'
16103 mail='$mail'
16104 mailx='$mailx'
16105 make='$make'
16106 make_set_make='$make_set_make'
16107 mallocobj='$mallocobj'
16108 mallocsrc='$mallocsrc'
16109 malloctype='$malloctype'
16110 man1dir='$man1dir'
16111 man1direxp='$man1direxp'
16112 man1ext='$man1ext'
16113 man3dir='$man3dir'
16114 man3direxp='$man3direxp'
16115 man3ext='$man3ext'
16116 mips_type='$mips_type'
16117 mkdir='$mkdir'
16118 mmaptype='$mmaptype'
16119 modetype='$modetype'
16120 more='$more'
16121 multiarch='$multiarch'
16122 mv='$mv'
16123 myarchname='$myarchname'
16124 mydomain='$mydomain'
16125 myhostname='$myhostname'
16126 myuname='$myuname'
16127 n='$n'
16128 need_va_copy='$need_va_copy'
16129 netdb_hlen_type='$netdb_hlen_type'
16130 netdb_host_type='$netdb_host_type'
16131 netdb_name_type='$netdb_name_type'
16132 netdb_net_type='$netdb_net_type'
16133 nm='$nm'
16134 nm_opt='$nm_opt'
16135 nm_so_opt='$nm_so_opt'
16136 nonxs_ext='$nonxs_ext'
16137 nroff='$nroff'
16138 nvEUformat='$nvEUformat'
16139 nvFUformat='$nvFUformat'
16140 nvGUformat='$nvGUformat'
16141 nveformat='$nveformat'
16142 nvfformat='$nvfformat'
16143 nvgformat='$nvgformat'
16144 nvsize='$nvsize'
16145 nvtype='$nvtype'
16146 o_nonblock='$o_nonblock'
16147 obj_ext='$obj_ext'
16148 old_pthread_create_joinable='$old_pthread_create_joinable'
16149 optimize='$optimize'
16150 orderlib='$orderlib'
16151 osname='$osname'
16152 osvers='$osvers'
16153 otherlibdirs='$otherlibdirs'
16154 package='$package'
16155 pager='$pager'
16156 passcat='$passcat'
16157 patchlevel='$patchlevel'
16158 path_sep='$path_sep'
16159 perl5='$perl5'
16160 perl='$perl'
16161 perladmin='$perladmin'
16162 perllibs='$perllibs'
16163 perlpath='$perlpath'
16164 pg='$pg'
16165 phostname='$phostname'
16166 pidtype='$pidtype'
16167 plibpth='$plibpth'
16168 pm_apiversion='$pm_apiversion'
16169 pmake='$pmake'
16170 pr='$pr'
16171 prefix='$prefix'
16172 prefixexp='$prefixexp'
16173 privlib='$privlib'
16174 privlibexp='$privlibexp'
16175 prototype='$prototype'
16176 ptrsize='$ptrsize'
16177 quadkind='$quadkind'
16178 quadtype='$quadtype'
16179 randbits='$randbits'
16180 randfunc='$randfunc'
16181 randseedtype='$randseedtype'
16182 ranlib='$ranlib'
16183 rd_nodata='$rd_nodata'
16184 revision='$revision'
16185 rm='$rm'
16186 rmail='$rmail'
16187 runnm='$runnm'
16188 sPRIEUldbl='$sPRIEUldbl'
16189 sPRIFUldbl='$sPRIFUldbl'
16190 sPRIGUldbl='$sPRIGUldbl'
16191 sPRIXU64='$sPRIXU64'
16192 sPRId64='$sPRId64'
16193 sPRIeldbl='$sPRIeldbl'
16194 sPRIfldbl='$sPRIfldbl'
16195 sPRIgldbl='$sPRIgldbl'
16196 sPRIi64='$sPRIi64'
16197 sPRIo64='$sPRIo64'
16198 sPRIu64='$sPRIu64'
16199 sPRIx64='$sPRIx64'
16200 sSCNfldbl='$sSCNfldbl'
16201 sched_yield='$sched_yield'
16202 scriptdir='$scriptdir'
16203 scriptdirexp='$scriptdirexp'
16204 sed='$sed'
16205 seedfunc='$seedfunc'
16206 selectminbits='$selectminbits'
16207 selecttype='$selecttype'
16208 sendmail='$sendmail'
16209 sh='$sh'
16210 shar='$shar'
16211 sharpbang='$sharpbang'
16212 shmattype='$shmattype'
16213 shortsize='$shortsize'
16214 shrpenv='$shrpenv'
16215 shsharp='$shsharp'
16216 sig_count='$sig_count'
16217 sig_name='$sig_name'
16218 sig_name_init='$sig_name_init'
16219 sig_num='$sig_num'
16220 sig_num_init='$sig_num_init'
16221 signal_t='$signal_t'
16222 sitearch='$sitearch'
16223 sitearchexp='$sitearchexp'
16224 sitebin='$sitebin'
16225 sitebinexp='$sitebinexp'
16226 sitelib='$sitelib'
16227 sitelib_stem='$sitelib_stem'
16228 sitelibexp='$sitelibexp'
16229 siteprefix='$siteprefix'
16230 siteprefixexp='$siteprefixexp'
16231 sizesize='$sizesize'
16232 sizetype='$sizetype'
16233 sleep='$sleep'
16234 smail='$smail'
16235 so='$so'
16236 sockethdr='$sockethdr'
16237 socketlib='$socketlib'
16238 socksizetype='$socksizetype'
16239 sort='$sort'
16240 spackage='$spackage'
16241 spitshell='$spitshell'
16242 src='$src'
16243 ssizetype='$ssizetype'
16244 startperl='$startperl'
16245 startsh='$startsh'
16246 static_ext='$static_ext'
16247 stdchar='$stdchar'
16248 stdio_base='$stdio_base'
16249 stdio_bufsiz='$stdio_bufsiz'
16250 stdio_cnt='$stdio_cnt'
16251 stdio_filbuf='$stdio_filbuf'
16252 stdio_ptr='$stdio_ptr'
16253 stdio_stream_array='$stdio_stream_array'
16254 strings='$strings'
16255 submit='$submit'
16256 subversion='$subversion'
16257 sysman='$sysman'
16258 tail='$tail'
16259 tar='$tar'
16260 tbl='$tbl'
16261 tee='$tee'
16262 test='$test'
16263 timeincl='$timeincl'
16264 timetype='$timetype'
16265 touch='$touch'
16266 tr='$tr'
16267 trnl='$trnl'
16268 troff='$troff'
16269 u16size='$u16size'
16270 u16type='$u16type'
16271 u32size='$u32size'
16272 u32type='$u32type'
16273 u64size='$u64size'
16274 u64type='$u64type'
16275 u8size='$u8size'
16276 u8type='$u8type'
16277 uidformat='$uidformat'
16278 uidsign='$uidsign'
16279 uidsize='$uidsize'
16280 uidtype='$uidtype'
16281 uname='$uname'
16282 uniq='$uniq'
16283 uquadtype='$uquadtype'
16284 use5005threads='$use5005threads'
16285 use64bitall='$use64bitall'
16286 use64bitint='$use64bitint'
16287 usedl='$usedl'
16288 useithreads='$useithreads'
16289 uselargefiles='$uselargefiles'
16290 uselongdouble='$uselongdouble'
16291 usemorebits='$usemorebits'
16292 usemultiplicity='$usemultiplicity'
16293 usemymalloc='$usemymalloc'
16294 usenm='$usenm'
16295 useopcode='$useopcode'
16296 useperlio='$useperlio'
16297 useposix='$useposix'
16298 usesfio='$usesfio'
16299 useshrplib='$useshrplib'
16300 usesocks='$usesocks'
16301 usethreads='$usethreads'
16302 usevendorprefix='$usevendorprefix'
16303 usevfork='$usevfork'
16304 usrinc='$usrinc'
16305 uuname='$uuname'
16306 uvXUformat='$uvXUformat'
16307 uvoformat='$uvoformat'
16308 uvsize='$uvsize'
16309 uvtype='$uvtype'
16310 uvuformat='$uvuformat'
16311 uvxformat='$uvxformat'
16312 vendorarch='$vendorarch'
16313 vendorarchexp='$vendorarchexp'
16314 vendorbin='$vendorbin'
16315 vendorbinexp='$vendorbinexp'
16316 vendorlib='$vendorlib'
16317 vendorlib_stem='$vendorlib_stem'
16318 vendorlibexp='$vendorlibexp'
16319 vendorprefix='$vendorprefix'
16320 vendorprefixexp='$vendorprefixexp'
16321 version='$version'
16322 versiononly='$versiononly'
16323 vi='$vi'
16324 voidflags='$voidflags'
16325 xlibpth='$xlibpth'
16326 xs_apiversion='$xs_apiversion'
16327 zcat='$zcat'
16328 zip='$zip'
16329 EOT
16330
16331 : Add in command line options if available
16332 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16333
16334 : add special variables
16335 $test -f $src/patchlevel.h && \
16336 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16337 echo "CONFIGDOTSH=true" >>config.sh
16338
16339 : propagate old symbols
16340 if $test -f UU/config.sh; then
16341         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16342         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16343         $sort | $uniq -u >UU/oldsyms
16344         set X `cat UU/oldsyms`
16345         shift
16346         case $# in
16347         0) ;;
16348         *)
16349                 cat <<EOM
16350 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16351 EOM
16352                 echo "# Variables propagated from previous config.sh file." >>config.sh
16353                 for sym in `cat UU/oldsyms`; do
16354                         echo "    Propagating $hint variable "'$'"$sym..."
16355                         eval 'tmp="$'"${sym}"'"'
16356                         echo "$tmp" | \
16357                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16358                 done
16359                 ;;
16360         esac
16361 fi
16362
16363 : Finish up by extracting the .SH files
16364 case "$alldone" in
16365 exit)
16366         $rm -rf UU
16367         echo "Done."
16368         exit 0
16369         ;;
16370 cont)
16371         ;;
16372 '')
16373         dflt=''
16374         nostick=true
16375         $cat <<EOM
16376
16377 If you'd like to make any changes to the config.sh file before I begin
16378 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16379
16380 EOM
16381         rp="Press return or use a shell escape to edit config.sh:"
16382         . UU/myread
16383         nostick=''
16384         case "$ans" in
16385         '') ;;
16386         *) : in case they cannot read
16387                 sh 1>&4 -c "$ans";;
16388         esac
16389         ;;
16390 esac
16391
16392 : if this fails, just run all the .SH files by hand
16393 . ./config.sh
16394
16395 echo " "
16396 exec 1>&4
16397 . ./UU/extract
16398
16399 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16400         dflt=y
16401         case "$silent" in
16402         true) ;;
16403         *)
16404                 $cat <<EOM
16405
16406 Now you need to generate make dependencies by running "$make depend".
16407 You might prefer to run it in background: "$make depend > makedepend.out &"
16408 It can take a while, so you might not want to run it right now.
16409
16410 EOM
16411                 ;;
16412         esac
16413         rp="Run $make depend now?"
16414         . UU/myread
16415         case "$ans" in
16416         y*)
16417                 $make depend && echo "Now you must run '$make'."
16418                 ;;
16419         *)
16420                 echo "You must run '$make depend' then '$make'."
16421                 ;;
16422         esac
16423 elif test -f [Mm]akefile; then
16424         echo " "
16425         echo "Now you must run a $make."
16426 else
16427         echo "Done."
16428 fi
16429
16430 if $test -f Policy.sh; then
16431     $cat <<EOM
16432
16433 If you compile $package on a different machine or from a different object
16434 directory, copy the Policy.sh file from this object directory to the
16435 new one before you run Configure -- this will help you with most of
16436 the policy defaults.
16437
16438 EOM
16439 fi
16440 if $test -f config.msg; then
16441     echo "Hmm.  I also noted the following information while running:"
16442     echo " "
16443     $cat config.msg >&4
16444     $rm -f config.msg
16445 fi
16446 $rm -f kit*isdone ark*isdone
16447 $rm -rf UU
16448
16449 : End of Configure
16450