Re: [p5p] [PATCH perlpod.pod] Digging into the =head
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Nov 16 16:33:41 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 netdb_hlen_type=''
784 netdb_host_type=''
785 netdb_name_type=''
786 netdb_net_type=''
787 groupcat=''
788 hostcat=''
789 passcat=''
790 orderlib=''
791 ranlib=''
792 d_perl_otherlibdirs=''
793 otherlibdirs=''
794 package=''
795 spackage=''
796 pager=''
797 api_revision=''
798 api_subversion=''
799 api_version=''
800 api_versionstring=''
801 patchlevel=''
802 revision=''
803 subversion=''
804 version=''
805 perl5=''
806 perladmin=''
807 perlpath=''
808 d_nv_preserves_uv=''
809 d_nv_preserves_uv_bits=''
810 i16size=''
811 i16type=''
812 i32size=''
813 i32type=''
814 i64size=''
815 i64type=''
816 i8size=''
817 i8type=''
818 ivsize=''
819 ivtype=''
820 nvsize=''
821 nvtype=''
822 u16size=''
823 u16type=''
824 u32size=''
825 u32type=''
826 u64size=''
827 u64type=''
828 u8size=''
829 u8type=''
830 uvsize=''
831 uvtype=''
832 ivdformat=''
833 nvEUformat=''
834 nvFUformat=''
835 nvGUformat=''
836 nveformat=''
837 nvfformat=''
838 nvgformat=''
839 uvXUformat=''
840 uvoformat=''
841 uvuformat=''
842 uvxformat=''
843 pidtype=''
844 prefix=''
845 prefixexp=''
846 installprivlib=''
847 privlib=''
848 privlibexp=''
849 prototype=''
850 ptrsize=''
851 d_PRIXU64=''
852 d_PRId64=''
853 d_PRIi64=''
854 d_PRIo64=''
855 d_PRIu64=''
856 d_PRIx64=''
857 sPRIXU64=''
858 sPRId64=''
859 sPRIi64=''
860 sPRIo64=''
861 sPRIu64=''
862 sPRIx64=''
863 d_quad=''
864 quadkind=''
865 quadtype=''
866 uquadtype=''
867 drand01=''
868 randbits=''
869 randfunc=''
870 randseedtype=''
871 seedfunc=''
872 installscript=''
873 scriptdir=''
874 scriptdirexp=''
875 selectminbits=''
876 selecttype=''
877 sh=''
878 sig_count=''
879 sig_name=''
880 sig_name_init=''
881 sig_num=''
882 sig_num_init=''
883 installsitearch=''
884 sitearch=''
885 sitearchexp=''
886 installsitebin=''
887 sitebin=''
888 sitebinexp=''
889 installsitelib=''
890 sitelib=''
891 sitelib_stem=''
892 sitelibexp=''
893 siteprefix=''
894 siteprefixexp=''
895 sizesize=''
896 sizetype=''
897 so=''
898 socksizetype=''
899 sharpbang=''
900 shsharp=''
901 spitshell=''
902 src=''
903 ssizetype=''
904 startperl=''
905 startsh=''
906 stdchar=''
907 d_stdio_stream_array=''
908 stdio_stream_array=''
909 sysman=''
910 trnl=''
911 uidformat=''
912 uidsign=''
913 uidsize=''
914 uidtype=''
915 archname64=''
916 use64bitall=''
917 use64bitint=''
918 ccflags_uselargefiles=''
919 ldflags_uselargefiles=''
920 libswanted_uselargefiles=''
921 uselargefiles=''
922 uselongdouble=''
923 usemorebits=''
924 usemultiplicity=''
925 nm_opt=''
926 nm_so_opt=''
927 runnm=''
928 usenm=''
929 useperlio=''
930 usesocks=''
931 d_oldpthreads=''
932 use5005threads=''
933 useithreads=''
934 usethreads=''
935 incpath=''
936 mips_type=''
937 usrinc=''
938 d_vendorarch=''
939 installvendorarch=''
940 vendorarch=''
941 vendorarchexp=''
942 d_vendorbin=''
943 installvendorbin=''
944 vendorbin=''
945 vendorbinexp=''
946 d_vendorlib=''
947 installvendorlib=''
948 vendorlib=''
949 vendorlib_stem=''
950 vendorlibexp=''
951 usevendorprefix=''
952 vendorprefix=''
953 vendorprefixexp=''
954 versiononly=''
955 defvoidused=''
956 voidflags=''
957 pm_apiversion=''
958 xs_apiversion=''
959 CONFIG=''
960
961 define='define'
962 undef='undef'
963 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
964 rmlist=''
965
966 : We must find out about Eunice early
967 eunicefix=':'
968 if test -f /etc/unixtovms; then
969         eunicefix=/etc/unixtovms
970 fi
971 if test -f /etc/unixtovms.exe; then
972         eunicefix=/etc/unixtovms.exe
973 fi
974
975 i_whoami=''
976 ccname=''
977 ccversion=''
978 perllibs=''
979 : set useposix=false in your hint file to disable the POSIX extension.
980 useposix=true
981 : set useopcode=false in your hint file to disable the Opcode extension.
982 useopcode=true
983 : Trailing extension.  Override this in a hint file, if needed.
984 _exe=''
985 : Extra object files, if any, needed on this platform.
986 archobjs=''
987 archname=''
988 : Possible local include directories to search.
989 : Set locincpth to "" in a hint file to defeat local include searches.
990 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
991 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
992 :
993 : no include file wanted by default
994 inclwanted=''
995
996 groupstype=''
997 : change the next line if compiling for Xenix/286 on Xenix/386
998 xlibpth='/usr/lib/386 /lib/386'
999 : Possible local library directories to search.
1000 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1001 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1002
1003 : general looking path for locating libraries
1004 glibpth="/lib /usr/lib $xlibpth"
1005 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1006 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1007 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1008
1009 : Private path used by Configure to find libraries.  Its value
1010 : is prepended to libpth. This variable takes care of special
1011 : machines, like the mips.  Usually, it should be empty.
1012 plibpth=''
1013
1014 : default library list
1015 libswanted=''
1016 : some systems want to use only the non-versioned libso:s
1017 ignore_versioned_solibs=''
1018 archname64=''
1019 ccflags_uselargefiles=''
1020 ldflags_uselargefiles=''
1021 libswanted_uselargefiles=''
1022 : set usemultiplicity on the Configure command line to enable multiplicity.
1023 : set usesocks on the Configure command line to enable socks.
1024 : set usethreads on the Configure command line to enable threads.
1025 : full support for void wanted by default
1026 defvoidused=15
1027
1028 : List of libraries we want.
1029 : If anyone needs -lnet, put it in a hint file.
1030 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1031 libswanted="$libswanted dld ld sun m c cposix posix"
1032 libswanted="$libswanted ndir dir crypt sec"
1033 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1034 : We probably want to search /usr/shlib before most other libraries.
1035 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1036 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1037 glibpth="/usr/shlib $glibpth"
1038 : Do not use vfork unless overridden by a hint file.
1039 usevfork=false
1040
1041 : Find the basic shell for Bourne shell scripts
1042 case "$sh" in
1043 '')
1044         case "$SYSTYPE" in
1045         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1046         *) xxx='/bin/sh';;
1047         esac
1048         if test -f "$xxx"; then
1049                 sh="$xxx"
1050         else
1051                 : Build up a list and do a single loop so we can 'break' out.
1052                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1053                 for xxx in sh bash ksh pdksh ash; do
1054                         for p in $pth; do
1055                                 try="$try ${p}/${xxx}"
1056                         done
1057                 done
1058                 for xxx in $try; do
1059                         if test -f "$xxx"; then
1060                                 sh="$xxx";
1061                                 break
1062                         elif test -f "$xxx.exe"; then
1063                                 sh="$xxx";
1064                                 break
1065                         fi
1066                 done
1067         fi
1068         ;;
1069 esac
1070
1071 case "$sh" in
1072 '')     cat <<EOM >&2
1073 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1074
1075 Usually it's in /bin/sh.  How did you even get this far?
1076 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1077 we'll try to straighten this all out.
1078 EOM
1079         exit 1
1080         ;;
1081 esac
1082
1083 : see if sh knows # comments
1084 if `$sh -c '#' >/dev/null 2>&1`; then
1085         shsharp=true
1086         spitshell=cat
1087         xcat=/bin/cat
1088         test -f $xcat || xcat=/usr/bin/cat
1089         echo "#!$xcat" >try
1090         $eunicefix try
1091         chmod +x try
1092         ./try > today
1093         if test -s today; then
1094                 sharpbang='#!'
1095         else
1096                 echo "#! $xcat" > try
1097                 $eunicefix try
1098                 chmod +x try
1099                 ./try > today
1100                 if test -s today; then
1101                         sharpbang='#! '
1102                 else
1103                         sharpbang=': use '
1104                 fi
1105         fi
1106 else
1107         echo " "
1108         echo "Your $sh doesn't grok # comments--I will strip them later on."
1109         shsharp=false
1110         cd ..
1111         echo "exec grep -v '^[  ]*#'" >spitshell
1112         chmod +x spitshell
1113         $eunicefix spitshell
1114         spitshell=`pwd`/spitshell
1115         cd UU
1116         echo "I presume that if # doesn't work, #! won't work either!"
1117         sharpbang=': use '
1118 fi
1119 rm -f try today
1120
1121 : figure out how to guarantee sh startup
1122 case "$startsh" in
1123 '') startsh=${sharpbang}${sh} ;;
1124 *)
1125 esac
1126 cat >try <<EOSS
1127 $startsh
1128 set abc
1129 test "$?abc" != 1
1130 EOSS
1131
1132 chmod +x try
1133 $eunicefix try
1134 if ./try; then
1135         : echo "Yup, it does."
1136 else
1137         echo "Hmm... '$startsh' does not guarantee sh startup..."
1138         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1139 fi
1140 rm -f try
1141
1142
1143 : Save command line options in file UU/cmdline.opt for later use in
1144 : generating config.sh.
1145 cat > cmdline.opt <<EOSH
1146 # Configure command line arguments.
1147 config_arg0='$0'
1148 config_args='$*'
1149 config_argc=$#
1150 EOSH
1151 argn=1
1152 for arg in "$@"; do
1153         cat >>cmdline.opt <<EOSH
1154 config_arg$argn='$arg'
1155 EOSH
1156         argn=`expr $argn + 1`
1157 done
1158
1159 : produce awk script to parse command line options
1160 cat >options.awk <<'EOF'
1161 BEGIN {
1162         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1163
1164         len = length(optstr);
1165         for (i = 1; i <= len; i++) {
1166                 c = substr(optstr, i, 1);
1167                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1168                 if (a == ":") {
1169                         arg[c] = 1;
1170                         i++;
1171                 }
1172                 opt[c] = 1;
1173         }
1174 }
1175 {
1176         expect = 0;
1177         str = $0;
1178         if (substr(str, 1, 1) != "-") {
1179                 printf("'%s'\n", str);
1180                 next;
1181         }
1182         len = length($0);
1183         for (i = 2; i <= len; i++) {
1184                 c = substr(str, i, 1);
1185                 if (!opt[c]) {
1186                         printf("-%s\n", substr(str, i));
1187                         next;
1188                 }
1189                 printf("-%s\n", c);
1190                 if (arg[c]) {
1191                         if (i < len)
1192                                 printf("'%s'\n", substr(str, i + 1));
1193                         else
1194                                 expect = 1;
1195                         next;
1196                 }
1197         }
1198 }
1199 END {
1200         if (expect)
1201                 print "?";
1202 }
1203 EOF
1204
1205 : process the command line options
1206 set X `for arg in "$@"; do echo "X$arg"; done |
1207         sed -e s/X// | awk -f options.awk`
1208 eval "set $*"
1209 shift
1210 rm -f options.awk
1211
1212 : set up default values
1213 fastread=''
1214 reuseval=false
1215 config_sh=''
1216 alldone=''
1217 error=''
1218 silent=''
1219 extractsh=''
1220 override=''
1221 knowitall=''
1222 rm -f optdef.sh posthint.sh
1223 cat >optdef.sh <<EOS
1224 $startsh
1225 EOS
1226
1227
1228 : option parsing
1229 while test $# -gt 0; do
1230         case "$1" in
1231         -d) shift; fastread=yes;;
1232         -e) shift; alldone=cont;;
1233         -f)
1234                 shift
1235                 cd ..
1236                 if test -r "$1"; then
1237                         config_sh="$1"
1238                 else
1239                         echo "$me: cannot read config file $1." >&2
1240                         error=true
1241                 fi
1242                 cd UU
1243                 shift;;
1244         -h) shift; error=true;;
1245         -r) shift; reuseval=true;;
1246         -s) shift; silent=true; realsilent=true;;
1247         -E) shift; alldone=exit;;
1248         -K) shift; knowitall=true;;
1249         -O) shift; override=true;;
1250         -S) shift; silent=true; extractsh=true;;
1251         -D)
1252                 shift
1253                 case "$1" in
1254                 *=)
1255                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1256                         echo "$me: ignoring -D $1" >&2
1257                         ;;
1258                 *=*) echo "$1" | \
1259                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1260                 *) echo "$1='define'" >> optdef.sh;;
1261                 esac
1262                 shift
1263                 ;;
1264         -U)
1265                 shift
1266                 case "$1" in
1267                 *=) echo "$1" >> optdef.sh;;
1268                 *=*)
1269                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1270                         echo "$me: ignoring -U $1" >&2
1271                         ;;
1272                 *) echo "$1='undef'" >> optdef.sh;;
1273                 esac
1274                 shift
1275                 ;;
1276         -A)
1277             shift
1278             xxx=''
1279             yyy="$1"
1280             zzz=''
1281             uuu=undef
1282             case "$yyy" in
1283             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1284                  case "$zzz" in
1285                  *:*) zzz='' ;;
1286                  *)   xxx=append
1287                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1288                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1289                  esac
1290                  ;;
1291             esac
1292             case "$xxx" in
1293             '')  case "$yyy" in
1294                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1295                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1296                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1297                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1298                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1299                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1300                  esac
1301                  ;;       
1302             esac
1303             case "$xxx" in
1304             append)
1305                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1306             clear)
1307                 echo "$yyy=''"                  >> posthint.sh ;;
1308             define)
1309                 case "$zzz" in
1310                 '') zzz=define ;;
1311                 esac
1312                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1313             eval)
1314                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1315             prepend)
1316                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1317             undef)
1318                 case "$zzz" in
1319                 '') zzz="$uuu" ;;
1320                 esac
1321                 echo "$yyy=$zzz"                >> posthint.sh ;;
1322             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1323             esac
1324             shift
1325             ;;
1326         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1327             exit 0;;
1328         --) break;;
1329         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1330         *) break;;
1331         esac
1332 done
1333
1334 case "$error" in
1335 true)
1336         cat >&2 <<EOM
1337 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1338                  [-U symbol] [-U symbol=] [-A command:symbol...]
1339   -d : use defaults for all answers.
1340   -e : go on without questioning past the production of config.sh.
1341   -f : specify an alternate default configuration file.
1342   -h : print this help message and exit (with an error status).
1343   -r : reuse C symbols value if possible (skips costly nm extraction).
1344   -s : silent mode, only echoes questions and essential information.
1345   -D : define symbol to have some value:
1346          -D symbol         symbol gets the value 'define'
1347          -D symbol=value   symbol gets the value 'value'
1348   -E : stop at the end of questions, after having produced config.sh.
1349   -K : do not use unless you know what you are doing.
1350   -O : let -D and -U override definitions from loaded configuration file.
1351   -S : perform variable substitutions on all .SH files (can mix with -f)
1352   -U : undefine symbol:
1353          -U symbol    symbol gets the value 'undef'
1354          -U symbol=   symbol gets completely empty
1355   -A : manipulate symbol after the platform specific hints have been applied:
1356          -A symbol=value                append " "value to symbol
1357          -A append:symbol=value         append value to symbol
1358          -A define:symbol=value         define symbol to have value
1359          -A clear:symbol                define symbol to be ''
1360          -A define:symbol               define symbol to be 'define'
1361          -A eval:symbol=value           define symbol to be eval of value
1362          -A prepend:symbol=value        prepend value to symbol
1363          -A undef:symbol                define symbol to be 'undef'
1364          -A undef:symbol=               define symbol to be ''
1365   -V : print version number and exit (with a zero status).
1366 EOM
1367         exit 1
1368         ;;
1369 esac
1370
1371 : Sanity checks
1372 case "$fastread$alldone" in
1373 yescont|yesexit) ;;
1374 *)
1375         case "$extractsh" in
1376         true) ;;
1377         *)
1378                 if test ! -t 0; then
1379                         echo "Say 'sh Configure', not 'sh <Configure'"
1380                         exit 1
1381                 fi
1382                 ;;
1383         esac
1384         ;;
1385 esac
1386
1387 exec 4>&1
1388 case "$silent" in
1389 true) exec 1>/dev/null;;
1390 esac
1391
1392 : run the defines and the undefines, if any, but leave the file out there...
1393 touch optdef.sh
1394 . ./optdef.sh
1395 : create the posthint manipulation script and leave the file out there...
1396 touch posthint.sh
1397
1398 : set package name
1399 package=perl5
1400 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1401 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1402 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1403 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1404 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1405 esac
1406
1407 : Some greps do not return status, grrr.
1408 echo "grimblepritz" >grimble
1409 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1410         contains=contains
1411 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1412         contains=grep
1413 else
1414         contains=contains
1415 fi
1416 rm -f grimble
1417 : the following should work in any shell
1418 case "$contains" in
1419 contains*)
1420         echo " "
1421         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1422         cat >contains <<'EOSS'
1423 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1424 EOSS
1425 chmod +x contains
1426 esac
1427
1428 : Find the path to the source tree
1429 case "$src" in
1430 '') case "$0" in
1431     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1432          case "$src" in
1433          /*)    ;;
1434          *)     src=`cd ../$src && pwd` ;;
1435          esac
1436          ;;
1437     *)   src='.';;
1438     esac;;
1439 esac
1440 case "$src" in
1441 '')     src=/
1442         rsrc=/
1443         ;;
1444 /*) rsrc="$src";;
1445 *) rsrc="../$src";;
1446 esac
1447 if test -f $rsrc/Configure && \
1448         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1449 then
1450    : found it, so we are ok.
1451 else
1452         rsrc=''
1453         for src in . .. ../.. ../../.. ../../../..; do
1454                 if test -f ../$src/Configure && \
1455                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1456                 then
1457                         rsrc=../$src
1458                         break
1459                 fi
1460         done
1461 fi
1462 case "$rsrc" in
1463 '')
1464         cat <<EOM >&4
1465
1466 Sorry, I can't seem to locate the source dir for $package.  Please start
1467 Configure with an explicit path -- i.e. /some/path/Configure.
1468
1469 EOM
1470         exit 1
1471         ;;
1472 ../.)   rsrc='..';;
1473 *)
1474         echo " "
1475         echo "Sources for $package found in \"$src\"." >&4
1476         ;;
1477 esac
1478
1479 : script used to extract .SH files with variable substitutions
1480 cat >extract <<'EOS'
1481 CONFIGDOTSH=true
1482 echo "Doing variable substitutions on .SH files..."
1483 if test -f $src/MANIFEST; then
1484         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1485 else
1486         echo "(Looking for .SH files under the source directory.)"
1487         set x `(cd $src; find . -name "*.SH" -print)`
1488 fi
1489 shift
1490 case $# in
1491 0) set x `(cd $src; echo *.SH)`; shift;;
1492 esac
1493 if test ! -f $src/$1; then
1494         shift
1495 fi
1496 mkdir_p='
1497 name=$1;
1498 create="";
1499 while test $name; do
1500         if test ! -d "$name"; then
1501                 create="$name $create";
1502                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1503                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1504         else
1505                 name="";
1506         fi;
1507 done;
1508 for file in $create; do
1509         mkdir $file;
1510 done
1511 '
1512 for file in $*; do
1513         case "$src" in
1514         ".")
1515                 case "$file" in
1516                 */*)
1517                         dir=`expr X$file : 'X\(.*\)/'`
1518                         file=`expr X$file : 'X.*/\(.*\)'`
1519                         (cd $dir && . ./$file)
1520                         ;;
1521                 *)
1522                         . ./$file
1523                         ;;
1524                 esac
1525                 ;;
1526         *)
1527                 case "$file" in
1528                 */*)
1529                         dir=`expr X$file : 'X\(.*\)/'`
1530                         file=`expr X$file : 'X.*/\(.*\)'`
1531                         (set x $dir; shift; eval $mkdir_p)
1532                         sh <$src/$dir/$file
1533                         ;;
1534                 *)
1535                         sh <$src/$file
1536                         ;;
1537                 esac
1538                 ;;
1539         esac
1540 done
1541 if test -f $src/config_h.SH; then
1542         if test ! -f config.h; then
1543         : oops, they left it out of MANIFEST, probably, so do it anyway.
1544         . $src/config_h.SH
1545         fi
1546 fi
1547 EOS
1548
1549 : extract files and exit if asked to do so
1550 case "$extractsh" in
1551 true)
1552         case "$realsilent" in
1553         true) ;;
1554         *) exec 1>&4;;
1555         esac
1556         case "$config_sh" in
1557         '') config_sh='config.sh';;
1558         esac
1559         echo " "
1560         echo "Fetching answers from $config_sh..."
1561         cd ..
1562         . $config_sh
1563         test "$override" && . ./optdef.sh
1564         echo " "
1565         . UU/extract
1566         rm -rf UU
1567         echo "Done."
1568         exit 0
1569         ;;
1570 esac
1571
1572 : Eunice requires " " instead of "", can you believe it
1573 echo " "
1574 : Here we go...
1575 echo "Beginning of configuration questions for $package."
1576
1577 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1578
1579 : first determine how to suppress newline on echo command
1580 echo " "
1581 echo "Checking echo to see how to suppress newlines..."
1582 (echo "hi there\c" ; echo " ") >.echotmp
1583 if $contains c .echotmp >/dev/null 2>&1 ; then
1584         echo "...using -n."
1585         n='-n'
1586         c=''
1587 else
1588         cat <<'EOM'
1589 ...using \c
1590 EOM
1591         n=''
1592         c='\c'
1593 fi
1594 echo $n "The star should be here-->$c"
1595 echo '*'
1596 rm -f .echotmp
1597
1598 : Now test for existence of everything in MANIFEST
1599 echo " "
1600 if test -f $rsrc/MANIFEST; then
1601         echo "First let's make sure your kit is complete.  Checking..." >&4
1602         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1603         rm -f missing
1604         tmppwd=`pwd`
1605         for filelist in x??; do
1606                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1607         done
1608         if test -s missing; then
1609                 cat missing >&4
1610                 cat >&4 <<'EOM'
1611
1612 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1613
1614 You have the option of continuing the configuration process, despite the
1615 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1616 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1617 and contact the author (perlbug@perl.org).
1618
1619 EOM
1620                 echo $n "Continue? [n] $c" >&4
1621                 read ans
1622                 case "$ans" in
1623                 y*)
1624                         echo "Continuing..." >&4
1625                         rm -f missing
1626                         ;;
1627                 *)
1628                         echo "ABORTING..." >&4
1629                         kill $$
1630                         ;;
1631                 esac
1632         else
1633                 echo "Looks good..."
1634         fi
1635 else
1636         echo "There is no MANIFEST file.  I hope your kit is complete !"
1637 fi
1638 rm -f missing x??
1639
1640 echo " "
1641 : Find the appropriate value for a newline for tr
1642 if test -n "$DJGPP"; then
1643        trnl='\012'
1644 fi
1645 if test X"$trnl" = X; then
1646         case "`echo foo|tr '\n' x 2>/dev/null`" in
1647         foox) trnl='\n' ;;
1648         esac
1649 fi
1650 if test X"$trnl" = X; then
1651         case "`echo foo|tr '\012' x 2>/dev/null`" in
1652         foox) trnl='\012' ;;
1653         esac
1654 fi
1655 if test X"$trnl" = X; then
1656         cat <<EOM >&2
1657
1658 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1659
1660 EOM
1661         exit 1
1662 fi
1663
1664 : compute the number of columns on the terminal for proper question formatting
1665 case "$COLUMNS" in
1666 '') COLUMNS='80';;
1667 esac
1668
1669 : set up the echo used in my read
1670 myecho="case \"\$xxxm\" in
1671 '') echo $n \"\$rp $c\" >&4;;
1672 *) case \"\$rp\" in
1673         '') echo $n \"[\$xxxm] $c\";;
1674         *)
1675                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1676                         echo \"\$rp\" >&4
1677                         echo $n \"[\$xxxm] $c\" >&4
1678                 else
1679                         echo $n \"\$rp [\$xxxm] $c\" >&4
1680                 fi
1681                 ;;
1682         esac;;
1683 esac"
1684
1685 : now set up to do reads with possible shell escape and default assignment
1686 cat <<EOSC >myread
1687 $startsh
1688 xxxm=\$dflt
1689 $myecho
1690 ans='!'
1691 case "\$fastread" in
1692 yes) case "\$dflt" in
1693         '') ;;
1694         *) ans='';
1695                 case "\$silent-\$rp" in
1696                 true-) ;;
1697                 *) echo " " >&4;;
1698                 esac;;
1699         esac;;
1700 *) case "\$silent" in
1701         true) case "\$rp" in
1702                 '') ans='';;
1703                 esac;;
1704         esac;;
1705 esac
1706 while expr "X\$ans" : "X!" >/dev/null; do
1707         read answ
1708         set x \$xxxm
1709         shift
1710         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1711         case  "\$answ" in
1712         "!")
1713                 sh 1>&4
1714                 echo " "
1715                 $myecho
1716                 ;;
1717         !*)
1718                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1719                 shift
1720                 sh 1>&4 -c "\$*"
1721                 echo " "
1722                 $myecho
1723                 ;;
1724         "\$ans")
1725                 case "\$ans" in
1726                 \\&*)
1727                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1728                         shift
1729                         case "\$1" in
1730                         -d)
1731                                 fastread=yes
1732                                 echo "(OK, I'll run with -d after this question.)" >&4
1733                                 ;;
1734                         -*)
1735                                 echo "*** Sorry, \$1 not supported yet." >&4
1736                                 ;;
1737                         esac
1738                         $myecho
1739                         ans=!
1740                         ;;
1741                 esac;;
1742         *)
1743                 case "\$aok" in
1744                 y)
1745                         echo "*** Substitution done -- please confirm."
1746                         xxxm="\$ans"
1747                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1748                         xxxm="\$ans"
1749                         ans=!
1750                         ;;
1751                 *)
1752                         echo "*** Error -- try again."
1753                         ans=!
1754                         ;;
1755                 esac
1756                 $myecho
1757                 ;;
1758         esac
1759         case "\$ans\$xxxm\$nostick" in
1760         '')
1761                 ans=!
1762                 $myecho
1763                 ;;
1764         esac
1765 done
1766 case "\$ans" in
1767 '') ans="\$xxxm";;
1768 esac
1769 EOSC
1770
1771 : create .config dir to save info across Configure sessions
1772 test -d ../.config || mkdir ../.config
1773 cat >../.config/README <<EOF
1774 This directory created by Configure to save information that should
1775 persist across sessions for $package.
1776
1777 You may safely delete it if you wish.
1778 EOF
1779
1780 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1781 case "$usedevel" in
1782 $define|true|[yY]*) ;;
1783 *) case "$xversion" in
1784    *[13579])
1785         cat >&4 <<EOH
1786 *** WHOA THERE!!! ***
1787
1788     This is an UNSTABLE DEVELOPMENT release.
1789     The version of this $package distribution is $xversion, that is, odd,
1790     (as opposed to even) and that signifies a development release.
1791     If you want a maintenance release, you want an even-numbered version.
1792
1793     Do ***NOT*** install this into production use.
1794     Data corruption and crashes are possible.
1795
1796     It is most seriously suggested that you do not continue any further
1797     unless you want to help in developing and debugging Perl.
1798
1799 EOH
1800         rp='Do you really want to continue?'
1801         dflt='n'
1802         . ./myread
1803         case "$ans" in
1804         [yY]) echo >&4 "Okay, continuing." ;;
1805         *) echo >&4 "Okay, bye."
1806            exit 1
1807            ;;
1808         esac
1809         ;;
1810     esac
1811     ;;
1812 esac
1813
1814 : general instructions
1815 needman=true
1816 firsttime=true
1817 user=`(logname) 2>/dev/null`
1818 case "$user" in
1819 '') user=`whoami 2>&1`;;
1820 esac
1821 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1822         firsttime=false
1823         echo " "
1824         rp='Would you like to see the instructions?'
1825         dflt=n
1826         . ./myread
1827         case "$ans" in
1828         [yY]*) ;;
1829         *) needman=false;;
1830         esac
1831 fi
1832 if $needman; then
1833         cat <<EOH
1834
1835 This installation shell script will examine your system and ask you questions
1836 to determine how the perl5 package should be installed. If you get
1837 stuck on a question, you may use a ! shell escape to start a subshell or
1838 execute a command.  Many of the questions will have default answers in square
1839 brackets; typing carriage return will give you the default.
1840
1841 On some of the questions which ask for file or directory names you are allowed
1842 to use the ~name construct to specify the login directory belonging to "name",
1843 even if you don't have a shell which knows about that.  Questions where this is
1844 allowed will be marked "(~name ok)".
1845
1846 EOH
1847         rp=''
1848         dflt='Type carriage return to continue'
1849         . ./myread
1850         cat <<'EOH'
1851
1852 The prompter used in this script allows you to use shell variables and
1853 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1854 in the default answer, as if the default line was a set of arguments given to a
1855 script shell.  This means you may also use $* to repeat the whole default line,
1856 so you do not have to re-type everything to add something to the default.
1857
1858 Everytime there is a substitution, you will have to confirm.  If there is an
1859 error (e.g. an unmatched backtick), the default answer will remain unchanged
1860 and you will be prompted again.
1861
1862 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1863 the questions and use the computed defaults (or the previous answers if there
1864 was already a config.sh file). Type 'Configure -h' for a list of options.
1865 You may also start interactively and then answer '& -d' at any prompt to turn
1866 on the non-interactive behaviour for the remainder of the execution.
1867
1868 EOH
1869         . ./myread
1870         cat <<EOH
1871
1872 Much effort has been expended to ensure that this shell script will run on any
1873 Unix system.  If despite that it blows up on yours, your best bet is to edit
1874 Configure and run it again.  If you can't run Configure for some reason,
1875 you'll have to generate a config.sh file by hand.  Whatever problems you
1876 have, let me (perlbug@perl.org) know how I blew it.
1877
1878 This installation script affects things in two ways:
1879
1880 1) it may do direct variable substitutions on some of the files included
1881    in this kit.
1882 2) it builds a config.h file for inclusion in C programs.  You may edit
1883    any of these files as the need arises after running this script.
1884
1885 If you make a mistake on a question, there is no easy way to back up to it
1886 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1887 files.  Configure will offer to let you do this before it runs the SH files.
1888
1889 EOH
1890         dflt='Type carriage return to continue'
1891         . ./myread
1892         case "$firsttime" in
1893         true) echo $user >>../.config/instruct;;
1894         esac
1895 fi
1896
1897 : find out where common programs are
1898 echo " "
1899 echo "Locating common programs..." >&4
1900 cat <<EOSC >loc
1901 $startsh
1902 case \$# in
1903 0) exit 1;;
1904 esac
1905 thing=\$1
1906 shift
1907 dflt=\$1
1908 shift
1909 for dir in \$*; do
1910         case "\$thing" in
1911         .)
1912         if test -d \$dir/\$thing; then
1913                 echo \$dir
1914                 exit 0
1915         fi
1916         ;;
1917         *)
1918         for thisthing in \$dir/\$thing; do
1919                 : just loop through to pick last item
1920         done
1921         if test -f \$thisthing; then
1922                 echo \$thisthing
1923                 exit 0
1924         elif test -f \$dir/\$thing.exe; then
1925                 if test -n "$DJGPP"; then
1926                         echo \$dir/\$thing.exe
1927                 else
1928                         : on Eunice apparently
1929                         echo \$dir/\$thing
1930                 fi
1931                 exit 0
1932         fi
1933         ;;
1934         esac
1935 done
1936 echo \$dflt
1937 exit 1
1938 EOSC
1939 chmod +x loc
1940 $eunicefix loc
1941 loclist="
1942 awk
1943 cat
1944 comm
1945 cp
1946 echo
1947 expr
1948 grep
1949 ls
1950 make
1951 mkdir
1952 rm
1953 sed
1954 sort
1955 touch
1956 tr
1957 uniq
1958 "
1959 trylist="
1960 Mcc
1961 ar
1962 byacc
1963 cpp
1964 csh
1965 date
1966 egrep
1967 gzip
1968 less
1969 ln
1970 more
1971 nm
1972 nroff
1973 pg
1974 test
1975 uname
1976 zip
1977 "
1978 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1979 pth="$pth /lib /usr/lib"
1980 for file in $loclist; do
1981         eval xxx=\$$file
1982         case "$xxx" in
1983         /*|?:[\\/]*)
1984                 if test -f "$xxx"; then
1985                         : ok
1986                 else
1987                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1988                         xxx=`./loc $file $file $pth`
1989                 fi
1990                 ;;
1991         '') xxx=`./loc $file $file $pth`;;
1992         *) xxx=`./loc $xxx $xxx $pth`;;
1993         esac
1994         eval $file=$xxx
1995         eval _$file=$xxx
1996         case "$xxx" in
1997         /*)
1998                 echo $file is in $xxx.
1999                 ;;
2000         ?:[\\/]*)
2001                 echo $file is in $xxx.
2002                 ;;
2003         *)
2004                 echo "I don't know where '$file' is, and my life depends on it." >&4
2005                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2006                 exit 1
2007                 ;;
2008         esac
2009 done
2010 echo " "
2011 echo "Don't worry if any of the following aren't found..."
2012 say=offhand
2013 for file in $trylist; do
2014         eval xxx=\$$file
2015         case "$xxx" in
2016         /*|?:[\\/]*)
2017                 if test -f "$xxx"; then
2018                         : ok
2019                 else
2020                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2021                         xxx=`./loc $file $file $pth`
2022                 fi
2023                 ;;
2024         '') xxx=`./loc $file $file $pth`;;
2025         *) xxx=`./loc $xxx $xxx $pth`;;
2026         esac
2027         eval $file=$xxx
2028         eval _$file=$xxx
2029         case "$xxx" in
2030         /*)
2031                 echo $file is in $xxx.
2032                 ;;
2033         ?:[\\/]*)
2034                 echo $file is in $xxx.
2035                 ;;
2036         *)
2037                 echo "I don't see $file out there, $say."
2038                 say=either
2039                 ;;
2040         esac
2041 done
2042 case "$egrep" in
2043 egrep)
2044         echo "Substituting grep for egrep."
2045         egrep=$grep
2046         ;;
2047 esac
2048 case "$ln" in
2049 ln)
2050         echo "Substituting cp for ln."
2051         ln=$cp
2052         ;;
2053 esac
2054 case "$test" in
2055 test)
2056         echo "Hopefully test is built into your sh."
2057         ;;
2058 *)
2059         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2060                 echo "Using the test built into your sh."
2061                 test=test
2062                 _test=test
2063         fi
2064         ;;
2065 esac
2066 case "$echo" in
2067 echo)
2068         echo "Hopefully echo is built into your sh."
2069         ;;
2070 '') ;;
2071 *)
2072         echo " "
2073 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2074         $echo $n "hi there$c" >foo1
2075         echo $n "hi there$c" >foo2
2076         if cmp foo1 foo2 >/dev/null 2>&1; then
2077                 echo "They are compatible.  In fact, they may be identical."
2078         else
2079                 case "$n" in
2080                 '-n') n='' c='\c';;
2081                 *) n='-n' c='';;
2082                 esac
2083                 cat <<FOO
2084 They are not compatible!  You are probably running ksh on a non-USG system.
2085 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2086 have echo built in and we may have to run some Bourne shell scripts.  That
2087 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2088
2089 FOO
2090                 $echo $n "The star should be here-->$c"
2091                 $echo "*"
2092         fi
2093         $rm -f foo1 foo2
2094         ;;
2095 esac
2096
2097 cat <<EOS >checkcc
2098 $startsh
2099 EOS
2100 cat <<'EOSC' >>checkcc
2101 case "$cc" in
2102 '') ;;
2103 *)  $rm -f try try.*
2104     $cat >try.c <<EOM
2105 int main(int argc, char *argv[]) {
2106   return 0;
2107 }
2108 EOM
2109     if $cc -o try $ccflags try.c; then
2110        :
2111     else
2112         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2113         despair=yes
2114         trygcc=yes
2115         case "$cc" in
2116         *gcc*) trygcc=no ;;
2117         esac
2118         case "`$cc -v -c try.c 2>&1`" in
2119         *gcc*) trygcc=no ;;
2120         esac
2121         if $test X"$trygcc" = Xyes; then
2122             if gcc -o try -c try.c; then
2123                 echo " "
2124                 echo "You seem to have a working gcc, though." >&4
2125                 rp="Would you like to use it?"
2126                 dflt=y
2127                 if $test -f myread; then
2128                     . ./myread
2129                 else
2130                     if $test -f UU/myread; then
2131                         . ./UU/myread
2132                     else
2133                         echo "Cannot find myread, sorry.  Aborting." >&2
2134                         exit 1
2135                     fi
2136                 fi  
2137                 case "$ans" in
2138                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2139                 esac
2140             fi
2141         fi
2142         if $test X"$despair" = Xyes; then
2143             $cat >&4 <<EOM
2144 You need to find a working C compiler.
2145 Either (purchase and) install the C compiler supplied by your OS vendor,
2146 or for a free C compiler try http://gcc.gnu.org/
2147 I cannot continue any further, aborting.
2148 EOM
2149             exit 1
2150         fi
2151     fi
2152     $rm -f try try.*
2153     ;;
2154 esac
2155 EOSC
2156
2157 : determine whether symbolic links are supported
2158 echo " "
2159 $touch blurfl
2160 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2161         echo "Symbolic links are supported." >&4
2162         lns="$ln -s"
2163 else
2164         echo "Symbolic links are NOT supported." >&4
2165         lns="$ln"
2166 fi
2167 $rm -f blurfl sym
2168
2169 : see whether [:lower:] and [:upper:] are supported character classes
2170 echo " "
2171 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2172 ABYZ)
2173         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2174         up='[:upper:]'
2175         low='[:lower:]'
2176         ;;
2177 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2178         # (0xc9 and 0xd1), therefore that is a nice testing point.
2179         if test "X$up" = X -o "X$low" = X; then
2180             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2181             ij) up='[A-Z]'
2182                 low='[a-z]'
2183                 ;;
2184             esac
2185         fi
2186         if test "X$up" = X -o "X$low" = X; then
2187             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2188             ij) up='A-Z'
2189                 low='a-z'
2190                 ;;
2191             esac
2192         fi
2193         if test "X$up" = X -o "X$low" = X; then
2194             case "`echo IJ | od -x 2>/dev/null`" in
2195             *C9D1*|*c9d1*)
2196                 echo "Hey, this might be EBCDIC." >&4
2197                 if test "X$up" = X -o "X$low" = X; then
2198                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2199                     ij) up='[A-IJ-RS-Z]'
2200                         low='[a-ij-rs-z]'
2201                         ;;
2202                     esac
2203                 fi
2204                 if test "X$up" = X -o "X$low" = X; then
2205                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2206                     ij) up='A-IJ-RS-Z'
2207                         low='a-ij-rs-z'
2208                         ;;
2209                     esac
2210                 fi
2211                 ;;
2212             esac
2213         fi
2214 esac
2215 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2216 ij)
2217     echo "Using $up and $low to convert case." >&4
2218     ;;
2219 *)
2220     echo "I don't know how to translate letters from upper to lower case." >&4
2221     echo "Your tr is not acting any way I know of." >&4
2222     exit 1
2223     ;;
2224 esac
2225 : set up the translation script tr, must be called with ./tr of course
2226 cat >tr <<EOSC
2227 $startsh
2228 case "\$1\$2" in
2229 '[A-Z][a-z]') exec $tr '$up' '$low';;
2230 '[a-z][A-Z]') exec $tr '$low' '$up';;
2231 esac
2232 exec $tr "\$@"
2233 EOSC
2234 chmod +x tr
2235 $eunicefix tr
2236
2237 : Try to determine whether config.sh was made on this system
2238 case "$config_sh" in
2239 '')
2240 myuname=`$uname -a 2>/dev/null`
2241 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2242 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2243 # because the A-Z/a-z are not consecutive.
2244 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2245         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2246 newmyuname="$myuname"
2247 dflt=n
2248 case "$knowitall" in
2249 '')
2250         if test -f ../config.sh; then
2251                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2252                         eval "`grep myuname= ../config.sh`"
2253                 fi
2254                 if test "X$myuname" = "X$newmyuname"; then
2255                         dflt=y
2256                 fi
2257         fi
2258         ;;
2259 *) dflt=y;;
2260 esac
2261
2262 : Get old answers from old config file if Configure was run on the
2263 : same system, otherwise use the hints.
2264 hint=default
2265 cd ..
2266 if test -f config.sh; then
2267         echo " "
2268         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2269         . UU/myread
2270         case "$ans" in
2271         n*|N*) echo "OK, I'll ignore it."
2272                 mv config.sh config.sh.old
2273                 myuname="$newmyuname"
2274                 ;;
2275         *)  echo "Fetching default answers from your old config.sh file..." >&4
2276                 tmp_n="$n"
2277                 tmp_c="$c"
2278                 tmp_sh="$sh"
2279                 . ./config.sh
2280                 cp config.sh UU
2281                 n="$tmp_n"
2282                 c="$tmp_c"
2283                 : Older versions did not always set $sh.  Catch re-use of such
2284                 : an old config.sh.
2285                 case "$sh" in
2286                 '') sh="$tmp_sh" ;;
2287                 esac
2288                 hint=previous
2289                 ;;
2290         esac
2291 fi
2292 . ./UU/checkcc
2293 if test ! -f config.sh; then
2294         $cat <<EOM
2295
2296 First time through, eh?  I have some defaults handy for some systems
2297 that need some extra help getting the Configure answers right:
2298
2299 EOM
2300         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2301         dflt=''
2302         : Half the following guesses are probably wrong... If you have better
2303         : tests or hints, please send them to perlbug@perl.org
2304         : The metaconfig authors would also appreciate a copy...
2305         $test -f /irix && osname=irix
2306         $test -f /xenix && osname=sco_xenix
2307         $test -f /dynix && osname=dynix
2308         $test -f /dnix && osname=dnix
2309         $test -f /lynx.os && osname=lynxos
2310         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2311         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2312         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2313         $test -f /bin/mips && /bin/mips && osname=mips
2314         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2315                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2316         $test -d /usr/apollo/bin && osname=apollo
2317         $test -f /etc/saf/_sactab && osname=svr4
2318         $test -d /usr/include/minix && osname=minix
2319         if $test -d /MachTen -o -d /MachTen_Folder; then
2320                 osname=machten
2321                 if $test -x /sbin/version; then
2322                         osvers=`/sbin/version | $awk '{print $2}' |
2323                         $sed -e 's/[A-Za-z]$//'`
2324                 elif $test -x /usr/etc/version; then
2325                         osvers=`/usr/etc/version | $awk '{print $2}' |
2326                         $sed -e 's/[A-Za-z]$//'`
2327                 else
2328                         osvers="$2.$3"
2329                 fi
2330         fi
2331
2332         $test -f /sys/posix.dll &&
2333                 $test -f /usr/bin/what &&
2334                 set X `/usr/bin/what /sys/posix.dll` &&
2335                 $test "$3" = UWIN &&
2336                 osname=uwin &&
2337                 osvers="$5"
2338
2339         if $test -f $uname; then
2340                 set X $myuname
2341                 shift
2342
2343                 case "$5" in
2344                 fps*) osname=fps ;;
2345                 mips*)
2346                         case "$4" in
2347                         umips) osname=umips ;;
2348                         *) osname=mips ;;
2349                         esac;;
2350                 [23]100) osname=mips ;;
2351                 next*) osname=next ;;
2352                 i386*)
2353                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2354                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2355                                 osname='sco'
2356                                 osvers=$tmp
2357                         elif $test -f /etc/kconfig; then
2358                                 osname=isc
2359                                 if test "$lns" = "$ln -s"; then
2360                                         osvers=4
2361                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2362                                         osvers=3
2363                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2364                                         osvers=2
2365                                 fi
2366                         fi
2367                         tmp=''
2368                         ;;
2369                 pc*)
2370                         if test -n "$DJGPP"; then
2371                                 osname=dos
2372                                 osvers=djgpp
2373                         fi
2374                         ;;
2375                 esac
2376
2377                 case "$1" in
2378                 aix) osname=aix
2379                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2380                         case "$tmp" in
2381                         'not found') osvers="$4"."$3" ;;
2382                         '<3240'|'<>3240') osvers=3.2.0 ;;
2383                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2384                         '=3250'|'>3250') osvers=3.2.5 ;;
2385                         *) osvers=$tmp;;
2386                         esac
2387                         ;;
2388                 bsd386) osname=bsd386
2389                         osvers=`$uname -r`
2390                         ;;
2391                 cygwin*) osname=cygwin
2392                         osvers="$3"
2393                         ;;
2394                 *dc.osx) osname=dcosx
2395                         osvers="$3"
2396                         ;;
2397                 dnix) osname=dnix
2398                         osvers="$3"
2399                         ;;
2400                 domainos) osname=apollo
2401                         osvers="$3"
2402                         ;;
2403                 dgux) osname=dgux 
2404                         osvers="$3"
2405                         ;;
2406                 dynixptx*) osname=dynixptx
2407                         osvers=`echo "$4"|sed 's/^v//'`
2408                         ;;
2409                 freebsd) osname=freebsd 
2410                         osvers="$3" ;;
2411                 genix) osname=genix ;;
2412                 hp*) osname=hpux 
2413                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2414                         ;;
2415                 irix*) osname=irix
2416                         case "$3" in
2417                         4*) osvers=4 ;;
2418                         5*) osvers=5 ;;
2419                         *)      osvers="$3" ;;
2420                         esac
2421                         ;;
2422                 linux) osname=linux
2423                         case "$3" in
2424                         *)      osvers="$3" ;;
2425                         esac
2426                         ;;
2427                 MiNT) osname=mint
2428                         ;;
2429                 netbsd*) osname=netbsd
2430                         osvers="$3"
2431                         ;;
2432                 news-os) osvers="$3"
2433                         case "$3" in
2434                         4*) osname=newsos4 ;;
2435                         *) osname=newsos ;;
2436                         esac
2437                         ;;
2438                 next*) osname=next ;;
2439                 nonstop-ux) osname=nonstopux ;;
2440                 POSIX-BC | posix-bc ) osname=posix-bc
2441                         osvers="$3"
2442                         ;;
2443                 powerux | power_ux | powermax_os | powermaxos | \
2444                 powerunix | power_unix) osname=powerux
2445                         osvers="$3"
2446                         ;;
2447                 qnx) osname=qnx
2448                         osvers="$4"
2449                         ;;
2450                 solaris) osname=solaris
2451                         case "$3" in
2452                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2453                         *)      osvers="$3" ;;
2454                         esac
2455                         ;;
2456                 sunos) osname=sunos
2457                         case "$3" in
2458                         5*) osname=solaris
2459                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2460                         *)      osvers="$3" ;;
2461                         esac
2462                         ;;
2463                 titanos) osname=titanos
2464                         case "$3" in
2465                         1*) osvers=1 ;;
2466                         2*) osvers=2 ;;
2467                         3*) osvers=3 ;;
2468                         4*) osvers=4 ;;
2469                         *)      osvers="$3" ;;
2470                         esac
2471                         ;;
2472                 ultrix) osname=ultrix
2473                         osvers="$3"
2474                         ;;
2475                 osf1|mls+)      case "$5" in
2476                                 alpha)
2477                                         osname=dec_osf
2478                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2479                                         case "$osvers" in
2480                                         [1-9].[0-9]*) ;;
2481                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2482                                         esac
2483                                         ;;
2484                         hp*)    osname=hp_osf1  ;;
2485                         mips)   osname=mips_osf1 ;;
2486                         esac
2487                         ;;
2488                 unixware) osname=svr5
2489                         osvers="$4"
2490                         ;;
2491                 uts) osname=uts
2492                         osvers="$3"
2493                         ;;
2494                 $2) case "$osname" in
2495                         *isc*) ;;
2496                         *freebsd*) ;;
2497                         svr*)
2498                                 : svr4.x or possibly later
2499                                 case "svr$3" in 
2500                                 ${osname}*)
2501                                         osname=svr$3
2502                                         osvers=$4
2503                                         ;;
2504                                 esac
2505                                 case "$osname" in
2506                                 svr4.0)
2507                                         : Check for ESIX
2508                                         if test -f /stand/boot ; then
2509                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2510                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2511                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2512                                                         if test -n "$isesix"; then
2513                                                                 osname=esix4
2514                                                         fi
2515                                                 fi
2516                                         fi
2517                                         ;;
2518                                 esac
2519                                 ;;
2520                         *)      if test -f /etc/systemid; then
2521                                         osname=sco
2522                                         set `echo $3 | $sed 's/\./ /g'` $4
2523                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2524                                                 osvers=$1.$2.$3
2525                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2526                                                 osvers=$1.$2
2527                                         elif $test -f $src/hints/sco_$1.sh; then
2528                                                 osvers=$1
2529                                         fi
2530                                 else
2531                                         case "$osname" in
2532                                         '') : Still unknown.  Probably a generic Sys V.
2533                                                 osname="sysv"
2534                                                 osvers="$3"
2535                                                 ;;
2536                                         esac
2537                                 fi
2538                                 ;;
2539                         esac
2540                         ;;
2541                 *)      case "$osname" in
2542                         '') : Still unknown.  Probably a generic BSD.
2543                                 osname="$1"
2544                                 osvers="$3"
2545                                 ;;
2546                         esac
2547                         ;;
2548                 esac
2549         else
2550                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2551                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2552                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2553                                 osname=news_os
2554                         fi
2555                         $rm -f UU/kernel.what
2556                 elif test -d c:/.; then
2557                         set X $myuname
2558                         osname=os2
2559                         osvers="$5"
2560                 fi
2561         fi
2562         
2563         : Now look for a hint file osname_osvers, unless one has been
2564         : specified already.
2565         case "$hintfile" in
2566         ''|' ')
2567                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2568                 : Also try without trailing minor version numbers.
2569                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2570                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2571                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2572                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2573                 case "$file" in
2574                 '') dflt=none ;;
2575                 *)  case "$osvers" in
2576                         '') dflt=$file
2577                                 ;;
2578                         *)  if $test -f $src/hints/$file.sh ; then
2579                                         dflt=$file
2580                                 elif $test -f $src/hints/$xfile.sh ; then
2581                                         dflt=$xfile
2582                                 elif $test -f $src/hints/$xxfile.sh ; then
2583                                         dflt=$xxfile
2584                                 elif $test -f $src/hints/$xxxfile.sh ; then
2585                                         dflt=$xxxfile
2586                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2587                                         dflt=$xxxxfile
2588                                 elif $test -f "$src/hints/${osname}.sh" ; then
2589                                         dflt="${osname}"
2590                                 else
2591                                         dflt=none
2592                                 fi
2593                                 ;;
2594                         esac
2595                         ;;
2596                 esac
2597                 if $test -f Policy.sh ; then
2598                         case "$dflt" in
2599                         *Policy*) ;;
2600                         none) dflt="Policy" ;;
2601                         *) dflt="Policy $dflt" ;;
2602                         esac
2603                 fi
2604                 ;;
2605         *)
2606                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2607                 ;;
2608         esac
2609
2610         if $test -f Policy.sh ; then
2611                 $cat <<EOM
2612
2613 There's also a Policy hint file available, which should make the
2614 site-specific (policy) questions easier to answer.
2615 EOM
2616
2617         fi
2618
2619         $cat <<EOM
2620
2621 You may give one or more space-separated answers, or "none" if appropriate.
2622 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2623 is a good thing.  DO NOT give a wrong version or a wrong OS.
2624
2625 EOM
2626
2627         rp="Which of these apply, if any?"
2628         . UU/myread
2629         tans=$ans
2630         for file in $tans; do
2631                 if $test X$file = XPolicy -a -f Policy.sh; then
2632                         . Policy.sh
2633                         $cat Policy.sh >> UU/config.sh
2634                 elif $test -f $src/hints/$file.sh; then
2635                         . $src/hints/$file.sh
2636                         $cat $src/hints/$file.sh >> UU/config.sh
2637                 elif $test X$tans = X -o X$tans = Xnone ; then
2638                         : nothing
2639                 else
2640                         : Give one chance to correct a possible typo.
2641                         echo "$file.sh does not exist"
2642                         dflt=$file
2643                         rp="hint to use instead?"
2644                         . UU/myread
2645                         for file in $ans; do
2646                                 if $test -f "$src/hints/$file.sh"; then
2647                                         . $src/hints/$file.sh
2648                                         $cat $src/hints/$file.sh >> UU/config.sh
2649                                 elif $test X$ans = X -o X$ans = Xnone ; then
2650                                         : nothing
2651                                 else
2652                                         echo "$file.sh does not exist -- ignored."
2653                                 fi
2654                         done
2655                 fi
2656         done
2657
2658         hint=recommended
2659         : Remember our hint file for later.
2660         if $test -f "$src/hints/$file.sh" ; then
2661                 hintfile="$file"
2662         else
2663                 hintfile=''
2664         fi
2665 fi
2666 cd UU
2667 ;;
2668 *)
2669         echo " "
2670         echo "Fetching default answers from $config_sh..." >&4
2671         tmp_n="$n"
2672         tmp_c="$c"
2673         cd ..
2674         cp $config_sh config.sh 2>/dev/null
2675         chmod +w config.sh
2676         . ./config.sh
2677         cd UU
2678         cp ../config.sh .
2679         n="$tmp_n"
2680         c="$tmp_c"
2681         hint=previous
2682         ;;
2683 esac
2684 test "$override" && . ./optdef.sh
2685
2686 : Restore computed paths
2687 for file in $loclist $trylist; do
2688         eval $file="\$_$file"
2689 done
2690
2691 cat << EOM
2692
2693 Configure uses the operating system name and version to set some defaults.
2694 The default value is probably right if the name rings a bell. Otherwise,
2695 since spelling matters for me, either accept the default or answer "none"
2696 to leave it blank.
2697
2698 EOM
2699 case "$osname" in
2700         ''|' ')
2701                 case "$hintfile" in
2702                 ''|' '|none) dflt=none ;;
2703                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2704                 esac
2705                 ;;
2706         *) dflt="$osname" ;;
2707 esac
2708 rp="Operating system name?"
2709 . ./myread
2710 case "$ans" in
2711 none)  osname='' ;;
2712 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2713 esac
2714 echo " "
2715 case "$osvers" in
2716         ''|' ')
2717                 case "$hintfile" in
2718                 ''|' '|none) dflt=none ;;
2719                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2720                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2721                         case "$dflt" in
2722                         ''|' ') dflt=none ;;
2723                         esac
2724                         ;;
2725                 esac
2726                 ;;
2727         *) dflt="$osvers" ;;
2728 esac
2729 rp="Operating system version?"
2730 . ./myread
2731 case "$ans" in
2732 none)  osvers='' ;;
2733 *) osvers="$ans" ;;
2734 esac
2735
2736
2737 . ./posthint.sh
2738
2739 : who configured the system
2740 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2741 cf_by=`(logname) 2>/dev/null`
2742 case "$cf_by" in
2743 "")
2744         cf_by=`(whoami) 2>/dev/null`
2745         case "$cf_by" in
2746         "") cf_by=unknown ;;
2747         esac ;;
2748 esac
2749
2750 : set up the script used to warn in case of inconsistency
2751 cat <<EOS >whoa
2752 $startsh
2753 EOS
2754 cat <<'EOSC' >>whoa
2755 dflt=y
2756 echo " "
2757 echo "*** WHOA THERE!!! ***" >&4
2758 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2759 rp="    Keep the $hint value?"
2760 . ./myread
2761 case "$ans" in
2762 y) td=$was; tu=$was;;
2763 esac
2764 EOSC
2765
2766 : function used to set $1 to $val
2767 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2768 case "$val$was" in
2769 $define$undef) . ./whoa; eval "$var=\$td";;
2770 $undef$define) . ./whoa; eval "$var=\$tu";;
2771 *) eval "$var=$val";;
2772 esac'
2773
2774 case "$usethreads" in
2775 $define|true|[yY]*)     dflt='y';;
2776 *) dflt='n';;
2777 esac
2778 cat <<EOM
2779
2780 Perl can be built to take advantage of threads on some systems.
2781 To do so, Configure can be run with -Dusethreads.
2782
2783 Note that threading is a highly experimental feature, and
2784 some known race conditions still remain.  If you choose to try
2785 it, be very sure to not actually deploy it for production
2786 purposes.  README.threads has more details, and is required
2787 reading if you enable threads.
2788
2789 If this doesn't make any sense to you, just accept the default '$dflt'.
2790 EOM
2791 rp='Build a threading Perl?'
2792 . ./myread
2793 case "$ans" in
2794 y|Y)    val="$define" ;;
2795 *)      val="$undef" ;;
2796 esac
2797 set usethreads
2798 eval $setvar
2799
2800 case "$usethreads" in
2801 $define)
2802         $cat <<EOM
2803
2804 As of 5.5.640, Perl has two different internal threading implementations,
2805 the 5.005 version (5005threads) and an interpreter-based version
2806 (ithreads) that has one interpreter per thread.  Both are very 
2807 experimental.  This arrangement exists to help developers work out
2808 which one is better.
2809
2810 If you're a casual user, you probably don't want interpreter-threads
2811 at this time.  There doesn't yet exist a way to create threads from
2812 within Perl in this model, i.e., "use Thread;" will NOT work.
2813 EOM
2814         : Default to ithreads unless overridden on command line or with
2815         : old config.sh
2816         dflt='y'
2817         case "$use5005threads" in
2818                 $define|true|[yY]*) dflt='n';;
2819         esac
2820         case "$useithreads" in
2821                 $undef|false|[nN]*) dflt='n';;
2822         esac
2823         rp='Use interpreter-based ithreads?'
2824         . ./myread
2825         case "$ans" in
2826         y|Y)    val="$define" ;;
2827         *)      val="$undef" ;;
2828         esac
2829         set useithreads
2830         eval $setvar
2831         : Now set use5005threads to the opposite value.
2832         case "$useithreads" in
2833         $define) val="$undef" ;;
2834         *) val="$define" ;;
2835         esac
2836         set use5005threads
2837         eval $setvar
2838         ;;
2839 *)
2840         useithreads="$undef"
2841         use5005threads="$undef"
2842         ;;
2843 esac
2844
2845 case "$d_oldpthreads" in
2846 '')     : Configure tests would be welcome here.  For now, assume undef.
2847         val="$undef" ;;
2848 *)      val="$d_oldpthreads" ;;
2849 esac
2850 set d_oldpthreads
2851 eval $setvar
2852
2853
2854 case "$usethreads" in
2855 "$define"|true|[yY]*)
2856 : Look for a hint-file generated 'call-back-unit'.  If the
2857 : user has specified that a threading perl is to be built,
2858 : we may need to set or change some other defaults.
2859         if $test -f usethreads.cbu; then
2860                 echo "Your platform has some specific hints for threaded builds, using them..."
2861                 . ./usethreads.cbu
2862         else
2863                 $cat <<EOM
2864 (Your platform doesn't have any specific hints for threaded builds.
2865  Assuming POSIX threads, then.)
2866 EOM
2867         fi
2868         ;;
2869 esac
2870
2871 cat <<EOM
2872
2873 Perl can be built so that multiple Perl interpreters can coexist
2874 within the same Perl executable.
2875 EOM
2876
2877 case "$useithreads" in
2878 $define)
2879         cat <<EOM
2880 This multiple interpreter support is required for interpreter-based threads.
2881 EOM
2882         val="$define"
2883         ;;
2884 *)      case "$usemultiplicity" in
2885         $define|true|[yY]*)     dflt='y';;
2886         *) dflt='n';;
2887         esac
2888         echo " "
2889         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2890         rp='Build Perl for multiplicity?'
2891         . ./myread
2892         case "$ans" in
2893         y|Y)    val="$define" ;;
2894         *)      val="$undef" ;;
2895         esac
2896         ;;
2897 esac
2898 set usemultiplicity
2899 eval $setvar
2900
2901 : make some quick guesses about what we are up against
2902 echo " "
2903 $echo $n "Hmm...  $c"
2904 echo exit 1 >bsd
2905 echo exit 1 >usg
2906 echo exit 1 >v7
2907 echo exit 1 >osf1
2908 echo exit 1 >eunice
2909 echo exit 1 >xenix
2910 echo exit 1 >venix
2911 echo exit 1 >os2
2912 d_bsd="$undef"
2913 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2914 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2915 then
2916         echo "Looks kind of like an OSF/1 system, but we'll see..."
2917         echo exit 0 >osf1
2918 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2919         xxx=`./loc addbib blurfl $pth`
2920         if $test -f $xxx; then
2921         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2922                 echo exit 0 >bsd
2923                 echo exit 0 >usg
2924         else
2925                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2926                         echo "Looks kind of like an extended USG system, but we'll see..."
2927                 else
2928                         echo "Looks kind of like a USG system, but we'll see..."
2929                 fi
2930                 echo exit 0 >usg
2931         fi
2932 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2933         echo "Looks kind of like a BSD system, but we'll see..."
2934         d_bsd="$define"
2935         echo exit 0 >bsd
2936 else
2937         echo "Looks kind of like a Version 7 system, but we'll see..."
2938         echo exit 0 >v7
2939 fi
2940 case "$eunicefix" in
2941 *unixtovms*)
2942         $cat <<'EOI'
2943 There is, however, a strange, musty smell in the air that reminds me of
2944 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2945 EOI
2946         echo exit 0 >eunice
2947         d_eunice="$define"
2948 : it so happens the Eunice I know will not run shell scripts in Unix format
2949         ;;
2950 *)
2951         echo " "
2952         echo "Congratulations.  You aren't running Eunice."
2953         d_eunice="$undef"
2954         ;;
2955 esac
2956 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2957 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2958 : semicolon as a patch separator
2959 case "$p_" in
2960 :) ;;
2961 *)
2962         $cat <<'EOI'
2963 I have the feeling something is not exactly right, however...don't tell me...
2964 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2965 (Or you may be running DOS with DJGPP.)
2966 EOI
2967         echo exit 0 >os2
2968         ;;
2969 esac
2970 if test -f /xenix; then
2971         echo "Actually, this looks more like a XENIX system..."
2972         echo exit 0 >xenix
2973         d_xenix="$define"
2974 else
2975         echo " "
2976         echo "It's not Xenix..."
2977         d_xenix="$undef"
2978 fi
2979 chmod +x xenix
2980 $eunicefix xenix
2981 if test -f /venix; then
2982         echo "Actually, this looks more like a VENIX system..."
2983         echo exit 0 >venix
2984 else
2985         echo " "
2986         if ./xenix; then
2987                 : null
2988         else
2989                 echo "Nor is it Venix..."
2990         fi
2991 fi
2992 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2993 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2994 $rm -f foo
2995
2996 case "$cc" in
2997 '') dflt=cc;;
2998 *) dflt="$cc";;
2999 esac
3000 rp="Use which C compiler?"
3001 . ./myread
3002 cc="$ans"
3003 : Look for a hint-file generated 'call-back-unit'.  Now that the
3004 : user has specified the compiler, we may need to set or change some
3005 : other defaults.
3006 if $test -f cc.cbu; then
3007     . ./cc.cbu
3008 fi
3009 . ./checkcc
3010
3011 echo " "
3012 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3013 $cat >gccvers.c <<EOM
3014 #include <stdio.h>
3015 int main() {
3016 #ifdef __GNUC__
3017 #ifdef __VERSION__
3018         printf("%s\n", __VERSION__);
3019 #else
3020         printf("%s\n", "1");
3021 #endif
3022 #endif
3023         exit(0);
3024 }
3025 EOM
3026 if $cc -o gccvers $ldflags gccvers.c; then
3027         gccversion=`./gccvers`
3028         case "$gccversion" in
3029         '') echo "You are not using GNU cc." ;;
3030         *)  echo "You are using GNU cc $gccversion."
3031             ccname=gcc  
3032             ;;
3033         esac
3034 else
3035         echo " "
3036         echo "*** WHOA THERE!!! ***" >&4
3037         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3038         case "$knowitall" in
3039         '')
3040         echo "    You'd better start hunting for one and let me know about it." >&4
3041                 exit 1
3042                 ;;
3043         esac
3044 fi
3045 $rm -f gccvers*
3046 case "$gccversion" in
3047 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3048 esac
3049 case "$gccversion" in
3050 '') gccosandvers='' ;;
3051 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3052    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3053    gccshortvers=''
3054    case "$gccosandvers" in
3055    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3056    $osname$osvers) ;; # looking good
3057    $osname*) cat <<EOM >&4
3058
3059 *** WHOA THERE!!! ***
3060
3061     Your gcc has not been compiled for the exact release of
3062     your operating system ($gccosandvers versus $osname$osvers).
3063
3064     In general it is a good idea to keep gcc synchronized with
3065     the operating system because otherwise serious problems
3066     may ensue when trying to compile software, like Perl.
3067
3068     I'm trying to be optimistic here, though, and will continue.
3069     If later during the configuration and build icky compilation
3070     problems appear (headerfile conflicts being the most common
3071     manifestation), I suggest reinstalling the gcc to match
3072     your operating system release.
3073
3074 EOM
3075       ;;
3076    *) gccosandvers='' ;; # failed to parse, better be silent
3077    esac
3078    ;;
3079 esac
3080 case "$ccname" in
3081 '') ccname="$cc" ;;
3082 esac
3083
3084 : see how we invoke the C preprocessor
3085 echo " "
3086 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3087 cat <<'EOT' >testcpp.c
3088 #define ABC abc
3089 #define XYZ xyz
3090 ABC.XYZ
3091 EOT
3092 cd ..
3093 if test ! -f cppstdin; then
3094         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3095                 # AIX cc -E doesn't show the absolute headerfile
3096                 # locations but we'll cheat by using the -M flag.
3097                 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
3098         else
3099                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3100         fi
3101 else
3102         echo "Keeping your $hint cppstdin wrapper."
3103 fi
3104 chmod 755 cppstdin
3105 wrapper=`pwd`/cppstdin
3106 ok='false'
3107 cd UU
3108
3109 if $test "X$cppstdin" != "X" && \
3110         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3111         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3112 then
3113         echo "You used to use $cppstdin $cppminus so we'll use that again."
3114         case "$cpprun" in
3115         '') echo "But let's see if we can live without a wrapper..." ;;
3116         *)
3117                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3118                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3119                 then
3120                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3121                         ok='true'
3122                 else
3123                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3124                 fi
3125                 ;;
3126         esac
3127 else
3128         case "$cppstdin" in
3129         '') ;;
3130         *)
3131                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3132                 ;;
3133         esac
3134 fi
3135
3136 if $ok; then
3137         : nothing
3138 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3139         $cc -E <testcpp.c >testcpp.out 2>&1; \
3140         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3141         echo "Yup, it does."
3142         x_cpp="$cc -E"
3143         x_minus='';
3144 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3145         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3146         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3147         echo "Yup, it does."
3148         x_cpp="$cc -E"
3149         x_minus='-';
3150 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3151         $cc -P <testcpp.c >testcpp.out 2>&1; \
3152         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3153         echo "Yipee, that works!"
3154         x_cpp="$cc -P"
3155         x_minus='';
3156 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3157         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3158         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3159         echo "At long last!"
3160         x_cpp="$cc -P"
3161         x_minus='-';
3162 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3163         $cpp <testcpp.c >testcpp.out 2>&1; \
3164         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3165         echo "It works!"
3166         x_cpp="$cpp"
3167         x_minus='';
3168 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3169         $cpp - <testcpp.c >testcpp.out 2>&1; \
3170         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3171         echo "Hooray, it works!  I was beginning to wonder."
3172         x_cpp="$cpp"
3173         x_minus='-';
3174 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3175         $wrapper <testcpp.c >testcpp.out 2>&1; \
3176         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3177         x_cpp="$wrapper"
3178         x_minus=''
3179         echo "Eureka!"
3180 else
3181         dflt=''
3182         rp="No dice.  I can't find a C preprocessor.  Name one:"
3183         . ./myread
3184         x_cpp="$ans"
3185         x_minus=''
3186         $x_cpp <testcpp.c >testcpp.out 2>&1
3187         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3188                 echo "OK, that will do." >&4
3189         else
3190 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3191                 exit 1
3192         fi
3193 fi
3194
3195 case "$ok" in
3196 false)
3197         cppstdin="$x_cpp"
3198         cppminus="$x_minus"
3199         cpprun="$x_cpp"
3200         cpplast="$x_minus"
3201         set X $x_cpp
3202         shift
3203         case "$1" in
3204         "$cpp")
3205                 echo "Perhaps can we force $cc -E using a wrapper..."
3206                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3207                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3208                 then
3209                         echo "Yup, we can."
3210                         cppstdin="$wrapper"
3211                         cppminus='';
3212                 else
3213                         echo "Nope, we'll have to live without it..."
3214                 fi
3215                 ;;
3216         esac
3217         case "$cpprun" in
3218         "$wrapper")
3219                 cpprun=''
3220                 cpplast=''
3221                 ;;
3222         esac
3223         ;;
3224 esac
3225
3226 case "$cppstdin" in
3227 "$wrapper"|'cppstdin') ;;
3228 *) $rm -f $wrapper;;
3229 esac
3230 $rm -f testcpp.c testcpp.out
3231
3232 : decide how portable to be.  Allow command line overrides.
3233 case "$d_portable" in
3234 "$undef") ;;
3235 *)      d_portable="$define" ;;
3236 esac
3237
3238 : set up shell script to do ~ expansion
3239 cat >filexp <<EOSS
3240 $startsh
3241 : expand filename
3242 case "\$1" in
3243  ~/*|~)
3244         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3245         ;;
3246  ~*)
3247         if $test -f /bin/csh; then
3248                 /bin/csh -f -c "glob \$1"
3249                 failed=\$?
3250                 echo ""
3251                 exit \$failed
3252         else
3253                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3254                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3255                 if $test ! -d "\$dir"; then
3256                         me=\`basename \$0\`
3257                         echo "\$me: can't locate home directory for: \$name" >&2
3258                         exit 1
3259                 fi
3260                 case "\$1" in
3261                 */*)
3262                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3263                         ;;
3264                 *)
3265                         echo \$dir
3266                         ;;
3267                 esac
3268         fi
3269         ;;
3270 *)
3271         echo \$1
3272         ;;
3273 esac
3274 EOSS
3275 chmod +x filexp
3276 $eunicefix filexp
3277
3278 : now set up to get a file name
3279 cat <<EOS >getfile
3280 $startsh
3281 EOS
3282 cat <<'EOSC' >>getfile
3283 tilde=''
3284 fullpath=''
3285 already=''
3286 skip=''
3287 none_ok=''
3288 exp_file=''
3289 nopath_ok=''
3290 orig_rp="$rp"
3291 orig_dflt="$dflt"
3292 case "$gfpth" in
3293 '') gfpth='.' ;;
3294 esac
3295
3296 case "$fn" in
3297 *\(*)
3298         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3299         fn=`echo $fn | sed 's/(.*)//'`
3300         ;;
3301 esac
3302
3303 case "$fn" in
3304 *:*)
3305         loc_file=`expr $fn : '.*:\(.*\)'`
3306         fn=`expr $fn : '\(.*\):.*'`
3307         ;;
3308 esac
3309
3310 case "$fn" in
3311 *~*) tilde=true;;
3312 esac
3313 case "$fn" in
3314 */*) fullpath=true;;
3315 esac
3316 case "$fn" in
3317 *+*) skip=true;;
3318 esac
3319 case "$fn" in
3320 *n*) none_ok=true;;
3321 esac
3322 case "$fn" in
3323 *e*) exp_file=true;;
3324 esac
3325 case "$fn" in
3326 *p*) nopath_ok=true;;
3327 esac
3328
3329 case "$fn" in
3330 *f*) type='File';;
3331 *d*) type='Directory';;
3332 *l*) type='Locate';;
3333 esac
3334
3335 what="$type"
3336 case "$what" in
3337 Locate) what='File';;
3338 esac
3339
3340 case "$exp_file" in
3341 '')
3342         case "$d_portable" in
3343         "$define") ;;
3344         *) exp_file=true;;
3345         esac
3346         ;;
3347 esac
3348
3349 cd ..
3350 while test "$type"; do
3351         redo=''
3352         rp="$orig_rp"
3353         dflt="$orig_dflt"
3354         case "$tilde" in
3355         true) rp="$rp (~name ok)";;
3356         esac
3357         . UU/myread
3358         if test -f UU/getfile.ok && \
3359                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3360         then
3361                 value="$ans"
3362                 ansexp="$ans"
3363                 break
3364         fi
3365         case "$ans" in
3366         none)
3367                 value=''
3368                 ansexp=''
3369                 case "$none_ok" in
3370                 true) type='';;
3371                 esac
3372                 ;;
3373         *)
3374                 case "$tilde" in
3375                 '') value="$ans"
3376                         ansexp="$ans";;
3377                 *)
3378                         value=`UU/filexp $ans`
3379                         case $? in
3380                         0)
3381                                 if test "$ans" != "$value"; then
3382                                         echo "(That expands to $value on this system.)"
3383                                 fi
3384                                 ;;
3385                         *) value="$ans";;
3386                         esac
3387                         ansexp="$value"
3388                         case "$exp_file" in
3389                         '') value="$ans";;
3390                         esac
3391                         ;;
3392                 esac
3393                 case "$fullpath" in
3394                 true)
3395                         case "$ansexp" in
3396                         /*) value="$ansexp" ;;
3397                         [a-zA-Z]:/*) value="$ansexp" ;;
3398                         *)
3399                                 redo=true
3400                                 case "$already" in
3401                                 true)
3402                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3403                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3404                                         ;;
3405                                 *)
3406                                 echo "Please give a full path name, starting with slash." >&4
3407                                         case "$tilde" in
3408                                         true)
3409                                 echo "Note that using ~name is ok provided it expands well." >&4
3410                                                 already=true
3411                                                 ;;
3412                                         esac
3413                                 esac
3414                                 ;;
3415                         esac
3416                         ;;
3417                 esac
3418                 case "$redo" in
3419                 '')
3420                         case "$type" in
3421                         File)
3422                                 for fp in $gfpth; do
3423                                         if test "X$fp" = X.; then
3424                                             pf="$ansexp"
3425                                         else    
3426                                             pf="$fp/$ansexp"
3427                                         fi
3428                                         if test -f "$pf"; then
3429                                                 type=''
3430                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3431                                         then
3432                                                 echo "($value is not a plain file, but that's ok.)"
3433                                                 type=''
3434                                         fi
3435                                         if test X"$type" = X; then
3436                                             value="$pf"
3437                                             break
3438                                         fi
3439                                 done
3440                                 ;;
3441                         Directory)
3442                                 for fp in $gfpth; do
3443                                         if test "X$fp" = X.; then
3444                                             dir="$ans"
3445                                             direxp="$ansexp"
3446                                         else    
3447                                             dir="$fp/$ansexp"
3448                                             direxp="$fp/$ansexp"
3449                                         fi
3450                                         if test -d "$direxp"; then
3451                                                 type=''
3452                                                 value="$dir"
3453                                                 break
3454                                         fi
3455                                 done
3456                                 ;;
3457                         Locate)
3458                                 if test -d "$ansexp"; then
3459                                         echo "(Looking for $loc_file in directory $value.)"
3460                                         value="$value/$loc_file"
3461                                         ansexp="$ansexp/$loc_file"
3462                                 fi
3463                                 if test -f "$ansexp"; then
3464                                         type=''
3465                                 fi
3466                                 case "$nopath_ok" in
3467                                 true)   case "$value" in
3468                                         */*) ;;
3469                                         *)      echo "Assuming $value will be in people's path."
3470                                                 type=''
3471                                                 ;;
3472                                         esac
3473                                         ;;
3474                                 esac
3475                                 ;;
3476                         esac
3477
3478                         case "$skip" in
3479                         true) type='';
3480                         esac
3481
3482                         case "$type" in
3483                         '') ;;
3484                         *)
3485                                 if test "$fastread" = yes; then
3486                                         dflt=y
3487                                 else
3488                                         dflt=n
3489                                 fi
3490                                 rp="$what $value doesn't exist.  Use that name anyway?"
3491                                 . UU/myread
3492                                 dflt=''
3493                                 case "$ans" in
3494                                 y*) type='';;
3495                                 *) echo " ";;
3496                                 esac
3497                                 ;;
3498                         esac
3499                         ;;
3500                 esac
3501                 ;;
3502         esac
3503 done
3504 cd UU
3505 ans="$value"
3506 rp="$orig_rp"
3507 dflt="$orig_dflt"
3508 rm -f getfile.ok
3509 test "X$gfpthkeep" != Xy && gfpth=""
3510 EOSC
3511
3512 : What should the include directory be ?
3513 echo " "
3514 $echo $n "Hmm...  $c"
3515 dflt='/usr/include'
3516 incpath=''
3517 mips_type=''
3518 if $test -f /bin/mips && /bin/mips; then
3519         echo "Looks like a MIPS system..."
3520         $cat >usr.c <<'EOCP'
3521 #ifdef SYSTYPE_BSD43
3522 /bsd43
3523 #endif
3524 EOCP
3525         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3526                 dflt='/bsd43/usr/include'
3527                 incpath='/bsd43'
3528                 mips_type='BSD 4.3'
3529         else
3530                 mips_type='System V'
3531         fi
3532         $rm -f usr.c usr.out
3533         echo "and you're compiling with the $mips_type compiler and libraries."
3534         xxx_prompt=y
3535         echo "exit 0" >mips
3536 else
3537         echo "Doesn't look like a MIPS system."
3538         xxx_prompt=n
3539         echo "exit 1" >mips
3540 fi
3541 chmod +x mips
3542 $eunicefix mips
3543 case "$usrinc" in
3544 '') ;;
3545 *) dflt="$usrinc";;
3546 esac
3547 case "$xxx_prompt" in
3548 y)      fn=d/
3549         echo " "
3550         rp='Where are the include files you want to use?'
3551         . ./getfile
3552         usrinc="$ans"
3553         ;;
3554 *)      usrinc="$dflt"
3555         ;;
3556 esac
3557
3558 : Set private lib path
3559 case "$plibpth" in
3560 '') if ./mips; then
3561                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3562         fi;;
3563 esac
3564 case "$libpth" in
3565 ' ') dlist='';;
3566 '') dlist="$loclibpth $plibpth $glibpth";;
3567 *) dlist="$libpth";;
3568 esac
3569
3570 : Now check and see which directories actually exist, avoiding duplicates
3571 libpth=''
3572 for xxx in $dlist
3573 do
3574     if $test -d $xxx; then
3575                 case " $libpth " in
3576                 *" $xxx "*) ;;
3577                 *) libpth="$libpth $xxx";;
3578                 esac
3579     fi
3580 done
3581 $cat <<'EOM'
3582
3583 Some systems have incompatible or broken versions of libraries.  Among
3584 the directories listed in the question below, please remove any you
3585 know not to be holding relevant libraries, and add any that are needed.
3586 Say "none" for none.
3587
3588 EOM
3589 case "$libpth" in
3590 '') dflt='none';;
3591 *)
3592         set X $libpth
3593         shift
3594         dflt=${1+"$@"}
3595         ;;
3596 esac
3597 rp="Directories to use for library searches?"
3598 . ./myread
3599 case "$ans" in
3600 none) libpth=' ';;
3601 *) libpth="$ans";;
3602 esac
3603
3604 : compute shared library extension
3605 case "$so" in
3606 '')
3607         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3608                 dflt='sl'
3609         else
3610                 dflt='so'
3611         fi
3612         ;;
3613 *) dflt="$so";;
3614 esac
3615 $cat <<EOM
3616
3617 On some systems, shared libraries may be available.  Answer 'none' if
3618 you want to suppress searching of shared libraries for the remainder
3619 of this configuration.
3620
3621 EOM
3622 rp='What is the file extension used for shared libraries?'
3623 . ./myread
3624 so="$ans"
3625
3626 : Define several unixisms.
3627 : Hints files or command line option can be used to override them.
3628 : The convoluted testing is in case hints files set either the old
3629 : or the new name.
3630 case "$_exe" in
3631 '')     case "$exe_ext" in
3632     '') ;;
3633         *)      _exe="$exe_ext" ;;
3634         esac
3635         ;;
3636 esac
3637 case "$_a" in
3638 '')     case "$lib_ext" in
3639     '') _a='.a';;
3640         *)      _a="$lib_ext" ;;
3641         esac
3642         ;;
3643 esac
3644 case "$_o" in
3645 '') case "$obj_ext" in
3646         '')     _o='.o';;
3647         *)      _o="$obj_ext";;
3648         esac
3649         ;;
3650 esac
3651 case "$p_" in
3652 '') case "$path_sep" in
3653         '')     p_=':';;
3654         *)      p_="$path_sep";;
3655         esac
3656         ;;
3657 esac
3658 exe_ext=$_exe
3659 lib_ext=$_a
3660 obj_ext=$_o
3661 path_sep=$p_
3662
3663 : Which makefile gets called first.  This is used by make depend.
3664 case "$firstmakefile" in
3665 '') firstmakefile='makefile';;
3666 esac
3667
3668 case "$usesocks" in
3669 $define|true|[yY]*)     dflt='y';;
3670 *) dflt='n';;
3671 esac
3672 cat <<EOM
3673
3674 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3675 Configure must be run with -Dusesocks.
3676
3677 If this doesn't make any sense to you, just accept the default '$dflt'.
3678 EOM
3679 rp='Build Perl for SOCKS?'
3680 . ./myread
3681 case "$ans" in
3682 y|Y)    val="$define" ;;     
3683 *)      val="$undef" ;;
3684 esac
3685 set usesocks
3686 eval $setvar
3687
3688 : Looking for optional libraries
3689 echo " "
3690 echo "Checking for optional libraries..." >&4
3691 case "$libs" in
3692 ' '|'') dflt='';;
3693 *) dflt="$libs";;
3694 esac
3695 case "$libswanted" in
3696 '') libswanted='c_s';;
3697 esac
3698 case "$usesocks" in
3699 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3700 esac
3701 libsfound=''
3702 libsfiles=''
3703 libsdirs=''
3704 libspath=''
3705 for thisdir in $libpth $xlibpth; do
3706   test -d $thisdir && libspath="$libspath $thisdir"
3707 done
3708 for thislib in $libswanted; do
3709         for thisdir in $libspath; do
3710             xxx=''
3711             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3712                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3713                 $test -f "$xxx" && eval $libscheck
3714                 $test -f "$xxx" && libstyle=shared
3715             fi
3716             if test ! -f "$xxx"; then
3717                 xxx=$thisdir/lib$thislib.$so
3718                 $test -f "$xxx" && eval $libscheck
3719                 $test -f "$xxx" && libstyle=shared
3720             fi  
3721             if test ! -f "$xxx"; then
3722                 xxx=$thisdir/lib$thislib$_a
3723                 $test -f "$xxx" && eval $libscheck
3724                 $test -f "$xxx" && libstyle=static
3725             fi
3726             if test ! -f "$xxx"; then
3727                 xxx=$thisdir/$thislib$_a
3728                 $test -f "$xxx" && eval $libscheck
3729                 $test -f "$xxx" && libstyle=static
3730             fi
3731             if test ! -f "$xxx"; then
3732                 xxx=$thisdir/lib${thislib}_s$_a
3733                 $test -f "$xxx" && eval $libscheck
3734                 $test -f "$xxx" && libstyle=static
3735                 $test -f "$xxx" && thislib=${thislib}_s
3736             fi
3737             if test ! -f "$xxx"; then
3738                 xxx=$thisdir/Slib$thislib$_a
3739                 $test -f "$xxx" && eval $libscheck
3740                 $test -f "$xxx" && libstyle=static
3741             fi
3742             if $test -f "$xxx"; then
3743                 case "$libstyle" in
3744                 shared) echo "Found -l$thislib (shared)." ;;
3745                 static) echo "Found -l$thislib." ;;
3746                 *)      echo "Found -l$thislib ($libstyle)." ;;
3747                 esac
3748                 case " $dflt " in
3749                 *"-l$thislib "*);;
3750                 *) dflt="$dflt -l$thislib"
3751                    libsfound="$libsfound $xxx"
3752                    yyy=`basename $xxx`
3753                    libsfiles="$libsfiles $yyy"
3754                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3755                    case " $libsdirs " in
3756                    *" $yyy "*) ;;
3757                    *) libsdirs="$libsdirs $yyy" ;;
3758                    esac
3759                    ;;
3760                 esac
3761                 break
3762             fi  
3763         done
3764         if $test ! -f "$xxx"; then
3765             echo "No -l$thislib."
3766         fi
3767 done
3768 set X $dflt
3769 shift
3770 dflt="$*"
3771 case "$libs" in
3772 '') dflt="$dflt";;
3773 *) dflt="$libs";;
3774 esac
3775 case "$dflt" in
3776 ' '|'') dflt='none';;
3777 esac
3778
3779 $cat <<EOM
3780
3781 In order to compile $package on your machine, a number of libraries
3782 are usually needed.  Include any other special libraries here as well.
3783 Say "none" for none.  The default list is almost always right.
3784 EOM
3785
3786 echo " "
3787 rp="What libraries to use?"
3788 . ./myread
3789 case "$ans" in
3790 none) libs=' ';;
3791 *) libs="$ans";;
3792 esac
3793
3794 : determine optimization, if desired, or use for debug flag also
3795 case "$optimize" in
3796 ' '|$undef) dflt='none';;
3797 '') dflt='-O';;
3798 *) dflt="$optimize";;
3799 esac
3800 $cat <<EOH
3801
3802 By default, $package compiles with the -O flag to use the optimizer.
3803 Alternately, you might want to use the symbolic debugger, which uses
3804 the -g flag (on traditional Unix systems).  Either flag can be
3805 specified here.  To use neither flag, specify the word "none".
3806
3807 EOH
3808 rp="What optimizer/debugger flag should be used?"
3809 . ./myread
3810 optimize="$ans"
3811 case "$optimize" in
3812 'none') optimize=" ";;
3813 esac
3814
3815 dflt=''
3816 : We will not override a previous value, but we might want to
3817 : augment a hint file
3818 case "$hint" in
3819 default|recommended)
3820         case "$gccversion" in
3821         1*) dflt='-fpcc-struct-return' ;;
3822         esac
3823         case "$optimize" in
3824         *-g*) dflt="$dflt -DDEBUGGING";;
3825         esac
3826         case "$gccversion" in
3827         2*) if test -d /etc/conf/kconfig.d &&
3828                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3829                 then
3830                         dflt="$dflt -posix"
3831                 fi
3832                 ;;
3833         esac
3834         case "$gccversion" in
3835         1*) ;;
3836         2.[0-8]*) ;;
3837         ?*)     echo " "
3838                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3839                 echo 'int main(void) { return 0; }' > gcctest.c
3840                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3841                         echo "Yes, it does." 2>&1
3842                         case "$ccflags" in
3843                         *strict-aliasing*) 
3844                                 echo "Leaving current flags $ccflags alone." 2>&1
3845                                 ;;
3846                         *) dflt="$dflt -fno-strict-aliasing" ;;
3847                         esac
3848                 else
3849                         echo "Nope, it doesn't, but that's ok." 2>&1
3850                 fi
3851                 ;;
3852         esac
3853         ;;
3854 esac
3855
3856 case "$mips_type" in
3857 *BSD*|'') inclwanted="$locincpth $usrinc";;
3858 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3859 esac
3860 for thisincl in $inclwanted; do
3861         if $test -d $thisincl; then
3862                 if $test x$thisincl != x$usrinc; then
3863                         case "$dflt" in
3864                         *" -I$thisincl "*);;
3865                         *) dflt="$dflt -I$thisincl ";;
3866                         esac
3867                 fi
3868         fi
3869 done
3870
3871 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3872         xxx=true;
3873 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3874         xxx=true;
3875 else
3876         xxx=false;
3877 fi;
3878 if $xxx; then
3879         case "$dflt" in
3880         *$2*);;
3881         *) dflt="$dflt -D$2";;
3882         esac;
3883 fi'
3884
3885 set signal.h LANGUAGE_C; eval $inctest
3886
3887 case "$usesocks" in
3888 $define)
3889         ccflags="$ccflags -DSOCKS"
3890         ;;
3891 esac
3892
3893 case "$hint" in
3894 default|recommended) dflt="$ccflags $dflt" ;;
3895 *) dflt="$ccflags";;
3896 esac
3897
3898 case "$dflt" in
3899 ''|' ') dflt=none;;
3900 esac
3901
3902 $cat <<EOH
3903
3904 Your C compiler may want other flags.  For this question you should include
3905 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3906 but you should NOT include libraries or ld flags like -lwhatever.  If you
3907 want $package to honor its debug switch, you should include -DDEBUGGING here.
3908 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3909
3910 To use no flags, specify the word "none".
3911
3912 EOH
3913 set X $dflt
3914 shift
3915 dflt=${1+"$@"}
3916 rp="Any additional cc flags?"
3917 . ./myread
3918 case "$ans" in
3919 none) ccflags='';;
3920 *) ccflags="$ans";;
3921 esac
3922
3923 : the following weeds options from ccflags that are of no interest to cpp
3924 cppflags="$ccflags"
3925 case "$gccversion" in
3926 1*) cppflags="$cppflags -D__GNUC__"
3927 esac
3928 case "$mips_type" in
3929 '');;
3930 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3931 esac
3932 case "$cppflags" in
3933 '');;
3934 *)
3935         echo " "
3936         echo "Let me guess what the preprocessor flags are..." >&4
3937         set X $cppflags
3938         shift
3939         cppflags=''
3940         $cat >cpp.c <<'EOM'
3941 #define BLURFL foo
3942
3943 BLURFL xx LFRULB
3944 EOM
3945         previous=''
3946         for flag in $*
3947         do
3948                 case "$flag" in
3949                 -*) ftry="$flag";;
3950                 *) ftry="$previous $flag";;
3951                 esac
3952                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3953                         >cpp1.out 2>/dev/null && \
3954                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3955                         >cpp2.out 2>/dev/null && \
3956                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3957                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3958                 then
3959                         cppflags="$cppflags $ftry"
3960                         previous=''
3961                 else
3962                         previous="$flag"
3963                 fi
3964         done
3965         set X $cppflags
3966         shift
3967         cppflags=${1+"$@"}
3968         case "$cppflags" in
3969         *-*)  echo "They appear to be: $cppflags";;
3970         esac
3971         $rm -f cpp.c cpp?.out
3972         ;;
3973 esac
3974
3975 : flags used in final linking phase
3976 case "$ldflags" in
3977 '') if ./venix; then
3978                 dflt='-i -z'
3979         else
3980                 dflt=''
3981         fi
3982         case "$ccflags" in
3983         *-posix*) dflt="$dflt -posix" ;;
3984         esac
3985         ;;
3986 *) dflt="$ldflags";;
3987 esac
3988
3989 : Try to guess additional flags to pick up local libraries.
3990 for thislibdir in $libpth; do
3991         case " $loclibpth " in
3992         *" $thislibdir "*)
3993                 case "$dflt " in 
3994                 *"-L$thislibdir "*) ;;
3995                 *)  dflt="$dflt -L$thislibdir" ;;
3996                 esac
3997                 ;;
3998         esac
3999 done
4000
4001 case "$dflt" in
4002 '') dflt='none' ;;
4003 esac
4004
4005 $cat <<EOH
4006
4007 Your C linker may need flags.  For this question you should
4008 include -L/whatever and any other flags used by the C linker, but you
4009 should NOT include libraries like -lwhatever.
4010
4011 Make sure you include the appropriate -L/path flags if your C linker
4012 does not normally search all of the directories you specified above,
4013 namely
4014         $libpth
4015 To use no flags, specify the word "none".
4016
4017 EOH
4018
4019 rp="Any additional ld flags (NOT including libraries)?"
4020 . ./myread
4021 case "$ans" in
4022 none) ldflags='';;
4023 *) ldflags="$ans";;
4024 esac
4025 rmlist="$rmlist pdp11"
4026
4027 : coherency check
4028 echo " "
4029 echo "Checking your choice of C compiler and flags for coherency..." >&4
4030 $cat > try.c <<'EOF'
4031 #include <stdio.h>
4032 int main() { printf("Ok\n"); exit(0); }
4033 EOF
4034 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4035 shift
4036 $cat >try.msg <<'EOM'
4037 I've tried to compile and run the following simple program:
4038
4039 EOM
4040 $cat try.c >> try.msg
4041
4042 $cat >> try.msg <<EOM
4043
4044 I used the command:
4045
4046         $*
4047         ./try
4048
4049 and I got the following output:
4050
4051 EOM
4052 dflt=y
4053 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4054         if sh -c './try' >>try.msg 2>&1; then
4055                 xxx=`./try`
4056                 case "$xxx" in
4057                 "Ok") dflt=n ;;
4058                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4059                         case " $libs " in
4060                         *" -lsfio "*)
4061                                 cat >> try.msg <<'EOQS'
4062 If $libs contains -lsfio, and sfio is mis-configured, then it
4063 sometimes (apparently) runs and exits with a 0 status, but with no
4064 output!  It may have to do with sfio's use of _exit vs. exit.
4065
4066 EOQS
4067                                 rp="You have a big problem.  Shall I abort Configure"
4068                                 dflt=y
4069                                 ;;
4070                         esac
4071                         ;;
4072                 esac
4073         else
4074                 echo "The program compiled OK, but exited with status $?." >>try.msg
4075                 rp="You have a problem.  Shall I abort Configure"
4076                 dflt=y
4077         fi
4078 else
4079         echo "I can't compile the test program." >>try.msg
4080         rp="You have a BIG problem.  Shall I abort Configure"
4081         dflt=y
4082 fi
4083 case "$dflt" in
4084 y)
4085         $cat try.msg >&4
4086         case "$knowitall" in
4087         '')
4088                 echo "(The supplied flags or libraries might be incorrect.)"
4089                 ;;
4090         *) dflt=n;;
4091         esac
4092         echo " "
4093         . ./myread
4094         case "$ans" in
4095         n*|N*) ;;
4096         *)      echo "Ok.  Stopping Configure." >&4
4097                 exit 1
4098                 ;;
4099         esac
4100         ;;
4101 n) echo "OK, that should do.";;
4102 esac
4103 $rm -f try try.* core
4104
4105 : define an is-a-typedef? function
4106 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4107 case "$inclist" in
4108 "") inclist="sys/types.h";;
4109 esac;
4110 eval "varval=\$$var";
4111 case "$varval" in
4112 "")
4113         $rm -f temp.c;
4114         for inc in $inclist; do
4115                 echo "#include <$inc>" >>temp.c;
4116         done;
4117         echo "#ifdef $type" >> temp.c;
4118         echo "printf(\"We have $type\");" >> temp.c;
4119         echo "#endif" >> temp.c;
4120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4121         if $contains $type temp.E >/dev/null 2>&1; then
4122                 eval "$var=\$type";
4123         else
4124                 eval "$var=\$def";
4125         fi;
4126         $rm -f temp.?;;
4127 *) eval "$var=\$varval";;
4128 esac'
4129
4130 : define an is-a-typedef? function that prompts if the type is not available.
4131 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4132 case "$inclist" in
4133 "") inclist="sys/types.h";;
4134 esac;
4135 eval "varval=\$$var";
4136 case "$varval" in
4137 "")
4138         $rm -f temp.c;
4139         for inc in $inclist; do
4140                 echo "#include <$inc>" >>temp.c;
4141         done;
4142         echo "#ifdef $type" >> temp.c;
4143         echo "printf(\"We have $type\");" >> temp.c;
4144         echo "#endif" >> temp.c;
4145         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4146         echo " " ;
4147         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4148         if $contains $type temp.E >/dev/null 2>&1; then
4149                 echo "$type found." >&4;
4150                 eval "$var=\$type";
4151         else
4152                 echo "$type NOT found." >&4;
4153                 dflt="$def";
4154                 . ./myread ;
4155                 eval "$var=\$ans";
4156         fi;
4157         $rm -f temp.?;;
4158 *) eval "$var=\$varval";;
4159 esac'
4160
4161 : define a shorthand compile call
4162 compile='
4163 mc_file=$1;
4164 shift;
4165 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4166 : define a shorthand compile call for compilations that should be ok.
4167 compile_ok='
4168 mc_file=$1;
4169 shift;
4170 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4171
4172 : check for lengths of integral types
4173 echo " "
4174 case "$intsize" in
4175 '')
4176         echo "Checking to see how big your integers are..." >&4
4177         $cat >intsize.c <<'EOCP'
4178 #include <stdio.h>
4179 int main()
4180 {
4181         printf("intsize=%d;\n", (int)sizeof(int));
4182         printf("longsize=%d;\n", (int)sizeof(long));
4183         printf("shortsize=%d;\n", (int)sizeof(short));
4184         exit(0);
4185 }
4186 EOCP
4187         set intsize
4188         if eval $compile_ok && ./intsize > /dev/null; then
4189                 eval `./intsize`
4190                 echo "Your integers are $intsize bytes long."
4191                 echo "Your long integers are $longsize bytes long."
4192                 echo "Your short integers are $shortsize bytes long."
4193         else
4194                 $cat >&4 <<EOM
4195 !
4196 Help! I can't compile and run the intsize test program: please enlighten me!
4197 (This is probably a misconfiguration in your system or libraries, and
4198 you really ought to fix it.  Still, I'll try anyway.)
4199 !
4200 EOM
4201                 dflt=4
4202                 rp="What is the size of an integer (in bytes)?"
4203                 . ./myread
4204                 intsize="$ans"
4205                 dflt=$intsize
4206                 rp="What is the size of a long integer (in bytes)?"
4207                 . ./myread
4208                 longsize="$ans"
4209                 dflt=2
4210                 rp="What is the size of a short integer (in bytes)?"
4211                 . ./myread
4212                 shortsize="$ans"
4213         fi
4214         ;;
4215 esac
4216 $rm -f intsize intsize.*
4217
4218 : see what type lseek is declared as in the kernel
4219 rp="What is the type used for lseek's offset on this system?"
4220 set off_t lseektype long stdio.h sys/types.h
4221 eval $typedef_ask
4222
4223 echo " "
4224 echo "Checking to see how big your file offsets are..." >&4
4225 $cat >try.c <<EOCP
4226 #include <sys/types.h>
4227 #include <stdio.h>
4228 int main()
4229 {
4230     printf("%d\n", (int)sizeof($lseektype));
4231     return(0); 
4232 }
4233 EOCP
4234 set try
4235 if eval $compile_ok; then
4236         lseeksize=`./try`
4237         echo "Your file offsets are $lseeksize bytes long."
4238 else
4239         dflt=$longsize
4240         echo " "
4241         echo "(I can't seem to compile the test program.  Guessing...)"
4242         rp="What is the size of your file offsets (in bytes)?"
4243         . ./myread
4244         lseeksize="$ans"
4245 fi
4246 $rm -f try.c try
4247
4248 : see what type file positions are declared as in the library
4249 rp="What is the type for file position used by fsetpos()?"
4250 set fpos_t fpostype long stdio.h sys/types.h
4251 eval $typedef_ask
4252
4253 echo " "
4254 case "$fpostype" in
4255 *_t) zzz="$fpostype"    ;;
4256 *)   zzz="fpos_t"       ;;
4257 esac
4258 echo "Checking the size of $zzz..." >&4 
4259 cat > try.c <<EOCP
4260 #include <sys/types.h>
4261 #include <stdio.h>
4262 int main() {
4263     printf("%d\n", (int)sizeof($fpostype));
4264     exit(0);
4265 }
4266 EOCP
4267 set try
4268 if eval $compile_ok; then
4269         yyy=`./try`
4270         case "$yyy" in
4271         '')     fpossize=4
4272                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4273                 ;;
4274         *)      fpossize=$yyy
4275                 echo "Your $zzz is $fpossize bytes long."
4276                 ;;
4277         esac
4278 else
4279         dflt="$longsize"
4280         echo " " >&4
4281         echo "(I can't compile the test program.  Guessing...)" >&4
4282         rp="What is the size of your file positions (in bytes)?"
4283         . ./myread
4284         fpossize="$ans"
4285 fi
4286
4287
4288
4289 # Backward compatibility (uselfs is deprecated).
4290 case "$uselfs" in
4291 "$define"|true|[yY]*)
4292         cat <<EOM >&4
4293
4294 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4295 EOM
4296         uselargefiles="$define"
4297         ;;
4298 esac                          
4299
4300 case "$lseeksize:$fpossize" in
4301 8:8) cat <<EOM
4302
4303 You can have files larger than 2 gigabytes.
4304 EOM
4305    val="$define" ;;
4306 *)    case "$uselargefiles" in
4307    "$undef"|false|[nN]*) dflt='n' ;;
4308    *)   dflt='y' ;;
4309    esac
4310    cat <<EOM
4311
4312 Perl can be built to understand large files (files larger than 2 gigabytes)
4313 on some systems.  To do so, Configure can be run with -Duselargefiles.
4314
4315 If this doesn't make any sense to you, just accept the default '$dflt'.
4316 EOM
4317    rp='Try to understand large files, if available?'
4318    . ./myread
4319    case "$ans" in
4320    y|Y)         val="$define" ;;
4321    *)           val="$undef"  ;;
4322    esac
4323    ;;
4324 esac
4325 set uselargefiles
4326 eval $setvar
4327 case "$uselargefiles" in
4328 "$define")
4329 : Look for a hint-file generated 'call-back-unit'.  If the
4330 : user has specified that a large files perl is to be built,
4331 : we may need to set or change some other defaults.
4332         if $test -f uselargefiles.cbu; then
4333                 echo "Your platform has some specific hints for large file builds, using them..."
4334                 . ./uselargefiles.cbu
4335                 echo " "
4336                 echo "Rechecking to see how big your file offsets are..." >&4
4337                 $cat >try.c <<EOCP
4338 #include <sys/types.h>
4339 #include <stdio.h>
4340 int main()
4341 {
4342     printf("%d\n", (int)sizeof($lseektype));
4343     return(0); 
4344 }
4345 EOCP
4346                 set try
4347                 if eval $compile_ok; then
4348                         lseeksize=`./try`
4349                         $echo "Your file offsets are now $lseeksize bytes long."
4350                 else
4351                         dflt="$lseeksize"
4352                         echo " "
4353                         echo "(I can't seem to compile the test program.  Guessing...)"
4354                         rp="What is the size of your file offsets (in bytes)?"
4355                         . ./myread
4356                         lseeksize="$ans"
4357                 fi
4358                 case "$fpostype" in
4359                 *_t) zzz="$fpostype"    ;;
4360                 *)   zzz="fpos_t"       ;;
4361                 esac
4362                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4363                 $cat > try.c <<EOCP
4364 #include <sys/types.h>
4365 #include <stdio.h>
4366 int main() {
4367     printf("%d\n", (int)sizeof($fpostype));
4368     exit(0);
4369 }
4370 EOCP
4371                 set try
4372                 if eval $compile_ok; then
4373                         yyy=`./try`
4374                         dflt="$lseeksize"
4375                         case "$yyy" in
4376                         '')     echo " "
4377                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4378                                 ;;
4379                         *)      fpossize=$yyy
4380                                 echo " $fpossize bytes." >&4
4381                                 ;;
4382                         esac
4383                 else
4384                         dflt="$fpossize"
4385                         echo " "
4386                         echo "(I can't compile the test program.  Guessing...)" >&4
4387                         rp="What is the size of your file positions (in bytes)?"
4388                         . ./myread
4389                         fpossize="$ans"
4390                 fi
4391                 $rm -f try.c try
4392         fi
4393         ;;
4394 esac
4395
4396
4397 case "$usemorebits" in
4398 "$define"|true|[yY]*)
4399         use64bitint="$define"
4400         uselongdouble="$define"
4401         usemorebits="$define"
4402         ;;
4403 *)      usemorebits="$undef"
4404         ;;
4405 esac
4406
4407
4408 case "$uselonglong" in
4409 "$define"|true|[yY]*)
4410         cat <<EOM >&4
4411
4412 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4413 EOM
4414         use64bitint="$define"
4415         ;;
4416 esac                          
4417 case "$use64bits" in
4418 "$define"|true|[yY]*)
4419         cat <<EOM >&4
4420
4421 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4422 EOM
4423         use64bitint="$define"
4424         ;;
4425 esac                          
4426 case "$use64bitints" in
4427 "$define"|true|[yY]*)
4428         cat <<EOM >&4
4429
4430 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4431 EOM
4432         use64bitint="$define"
4433         ;;
4434 esac                          
4435 case "$use64bitsint" in
4436 "$define"|true|[yY]*)
4437         cat <<EOM >&4
4438
4439 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4440 EOM
4441         use64bitint="$define"
4442         ;;
4443 esac                          
4444 case "$uselonglongs" in
4445 "$define"|true|[yY]*)
4446         cat <<EOM >&4
4447
4448 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4449 EOM
4450         use64bitint="$define"
4451         ;;
4452 esac                          
4453 case "$use64bitsall" in
4454 "$define"|true|[yY]*)
4455         cat <<EOM >&4
4456
4457 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4458 EOM
4459         use64bitall="$define"
4460         ;;
4461 esac                          
4462
4463 case "$ccflags" in
4464 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4465 esac
4466 case "$use64bitall" in
4467 "$define"|true|[yY]*) use64bitint="$define" ;;
4468 esac
4469
4470 case "$longsize" in
4471 8) cat <<EOM
4472
4473 You have natively 64-bit long integers.
4474 EOM
4475    val="$define"
4476    ;;
4477 *) case "$use64bitint" in
4478    "$define"|true|[yY]*) dflt='y';;
4479    *) dflt='n';;
4480    esac
4481    cat <<EOM
4482
4483 Perl can be built to take advantage of 64-bit integer types
4484 on some systems.  To do so, Configure can be run with -Duse64bitint.
4485 Choosing this option will most probably introduce binary incompatibilities.
4486
4487 If this doesn't make any sense to you, just accept the default '$dflt'.
4488 EOM
4489    rp='Try to use 64-bit integers, if available?'
4490    . ./myread
4491    case "$ans" in
4492    [yY]*) val="$define" ;;
4493    *)     val="$undef"  ;;
4494    esac
4495    ;;
4496 esac
4497 set use64bitint
4498 eval $setvar
4499
4500 case "$use64bitall" in
4501 "$define"|true|[yY]*) dflt='y' ;;
4502 *) case "$longsize" in
4503    8) dflt='y' ;;
4504    *) dflt='n' ;;
4505    esac
4506    ;;
4507 esac    
4508 cat <<EOM
4509
4510 You may also choose to try maximal 64-bitness.  It means using as much
4511 64-bitness as possible on the platform.  This in turn means even more
4512 binary incompatibilities.  On the other hand, your platform may not
4513 have any more 64-bitness available than what you already have chosen.
4514
4515 If this doesn't make any sense to you, just accept the default '$dflt'.
4516 EOM
4517 rp='Try to use maximal 64-bit support, if available?'
4518 . ./myread
4519 case "$ans" in
4520 [yY]*) val="$define" ;;
4521 *)     val="$undef"  ;;
4522 esac
4523 set use64bitall
4524 eval $setvar
4525 case "$use64bitall" in
4526 "$define")
4527         case "$use64bitint" in
4528         "$undef")
4529                 cat <<EOM
4530
4531 Since you have chosen a maximally 64-bit build, I'm also turning on
4532 the use of 64-bit integers.
4533 EOM
4534                 use64bitint="$define" ;;
4535         esac
4536         ;;
4537 esac
4538
4539 case "$use64bitint" in
4540 "$define"|true|[yY]*)
4541 : Look for a hint-file generated 'call-back-unit'.  If the
4542 : user has specified that a 64-bit perl is to be built,
4543 : we may need to set or change some other defaults.
4544         if $test -f use64bitint.cbu; then
4545                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4546                 . ./use64bitint.cbu
4547         fi
4548         case "$longsize" in
4549         4) case "$archname64" in
4550            '') archname64=64int ;;
4551            esac
4552            ;;
4553         esac
4554         ;;
4555 esac
4556
4557 case "$use64bitall" in
4558 "$define"|true|[yY]*)
4559 : Look for a hint-file generated 'call-back-unit'.  If the
4560 : user has specified that a maximally 64-bit perl is to be built,
4561 : we may need to set or change some other defaults.
4562         if $test -f use64bitall.cbu; then
4563                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4564                 . ./use64bitall.cbu
4565         fi
4566         case "$longsize" in
4567         4) case "$archname64" in
4568            ''|64int) archname64=64all ;;
4569            esac
4570            ;;
4571         esac
4572         ;;
4573 esac
4574
4575 echo " "
4576 echo "Checking for GNU C Library..." >&4
4577 cat >gnulibc.c <<EOM
4578 #include <stdio.h>
4579 int main()
4580 {
4581 #ifdef __GLIBC__
4582     exit(0);
4583 #else
4584     exit(1);
4585 #endif
4586 }
4587 EOM
4588 set gnulibc
4589 if eval $compile_ok && ./gnulibc; then
4590         val="$define"
4591         echo "You are using the GNU C Library"
4592 else
4593         val="$undef"
4594         echo "You are not using the GNU C Library"
4595 fi
4596 $rm -f gnulibc*
4597 set d_gnulibc
4598 eval $setvar
4599
4600 : see if nm is to be used to determine whether a symbol is defined or not
4601 case "$usenm" in
4602 '')
4603         dflt=''
4604         case "$d_gnulibc" in
4605         "$define")
4606                 echo " "
4607                 echo "nm probably won't work on the GNU C Library." >&4
4608                 dflt=n
4609                 ;;
4610         esac
4611         case "$dflt" in
4612         '') 
4613                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4614                         echo " "
4615                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4616                         echo "'nm' won't be sufficient on this sytem." >&4
4617                         dflt=n
4618                 fi
4619                 ;;
4620         esac
4621         case "$dflt" in
4622         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4623                 if $test $dflt -gt 20; then
4624                         dflt=y
4625                 else
4626                         dflt=n
4627                 fi
4628                 ;;
4629         esac
4630         ;;
4631 *)
4632         case "$usenm" in
4633         true|$define) dflt=y;;
4634         *) dflt=n;;
4635         esac
4636         ;;
4637 esac
4638 $cat <<EOM
4639
4640 I can use $nm to extract the symbols from your C libraries. This
4641 is a time consuming task which may generate huge output on the disk (up
4642 to 3 megabytes) but that should make the symbols extraction faster. The
4643 alternative is to skip the 'nm' extraction part and to compile a small
4644 test program instead to determine whether each symbol is present. If
4645 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4646 this may be the best solution.
4647
4648 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4649
4650 EOM
4651 rp="Shall I use $nm to extract C symbols from the libraries?"
4652 . ./myread
4653 case "$ans" in
4654 [Nn]*) usenm=false;;
4655 *) usenm=true;;
4656 esac
4657
4658 runnm=$usenm
4659 case "$reuseval" in
4660 true) runnm=false;;
4661 esac
4662
4663 : nm options which may be necessary
4664 case "$nm_opt" in
4665 '') if $test -f /mach_boot; then
4666                 nm_opt=''       # Mach
4667         elif $test -d /usr/ccs/lib; then
4668                 nm_opt='-p'     # Solaris (and SunOS?)
4669         elif $test -f /dgux; then
4670                 nm_opt='-p'     # DG-UX
4671         elif $test -f /lib64/rld; then
4672                 nm_opt='-p'     # 64-bit Irix
4673         else
4674                 nm_opt=''
4675         fi;;
4676 esac
4677
4678 : nm options which may be necessary for shared libraries but illegal
4679 : for archive libraries.  Thank you, Linux.
4680 case "$nm_so_opt" in
4681 '')     case "$myuname" in
4682         *linux*)
4683                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4684                         nm_so_opt='--dynamic'
4685                 fi
4686                 ;;
4687         esac
4688         ;;
4689 esac
4690
4691 case "$runnm" in
4692 true)
4693 : get list of predefined functions in a handy place
4694 echo " "
4695 case "$libc" in
4696 '') libc=unknown
4697         case "$libs" in
4698         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4699         esac
4700         ;;
4701 esac
4702 libnames='';
4703 case "$libs" in
4704 '') ;;
4705 *)  for thislib in $libs; do
4706         case "$thislib" in
4707         -lc|-lc_s)
4708                 : Handle C library specially below.
4709                 ;;
4710         -l*)
4711                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4712                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4713                         :
4714                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4715                         :
4716                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4717                         :
4718                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4719                         :
4720                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4721                         :
4722                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4723                         :
4724                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4725                         :
4726                 else
4727                         try=''
4728                 fi
4729                 libnames="$libnames $try"
4730                 ;;
4731         *) libnames="$libnames $thislib" ;;
4732         esac
4733         done
4734         ;;
4735 esac
4736 xxx=normal
4737 case "$libc" in
4738 unknown)
4739         set /lib/libc.$so
4740         for xxx in $libpth; do
4741                 $test -r $1 || set $xxx/libc.$so
4742                 : The messy sed command sorts on library version numbers.
4743                 $test -r $1 || \
4744                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4745                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4746                                 h
4747                                 s/[0-9][0-9]*/0000&/g
4748                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4749                                 G
4750                                 s/\n/ /' | \
4751                          $sort | $sed -e 's/^.* //'`
4752                 eval set \$$#
4753         done
4754         $test -r $1 || set /usr/ccs/lib/libc.$so
4755         $test -r $1 || set /lib/libsys_s$_a
4756         ;;
4757 *)
4758         set blurfl
4759         ;;
4760 esac
4761 if $test -r "$1"; then
4762         echo "Your (shared) C library seems to be in $1."
4763         libc="$1"
4764 elif $test -r /lib/libc && $test -r /lib/clib; then
4765         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4766         xxx=apollo
4767         libc='/lib/clib /lib/libc'
4768         if $test -r /lib/syslib; then
4769                 echo "(Your math library is in /lib/syslib.)"
4770                 libc="$libc /lib/syslib"
4771         fi
4772 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4773         echo "Your C library seems to be in $libc, as you said before."
4774 elif $test -r $incpath/usr/lib/libc$_a; then
4775         libc=$incpath/usr/lib/libc$_a;
4776         echo "Your C library seems to be in $libc.  That's fine."
4777 elif $test -r /lib/libc$_a; then
4778         libc=/lib/libc$_a;
4779         echo "Your C library seems to be in $libc.  You're normal."
4780 else
4781         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4782                 :
4783         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4784                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4785         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4786                 :
4787         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4788                 :
4789         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4790                 :
4791         else
4792                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4793         fi
4794         if $test -r "$tans"; then
4795                 echo "Your C library seems to be in $tans, of all places."
4796                 libc=$tans
4797         else
4798                 libc='blurfl'
4799         fi
4800 fi
4801 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4802         dflt="$libc"
4803         cat <<EOM
4804
4805 If the guess above is wrong (which it might be if you're using a strange
4806 compiler, or your machine supports multiple models), you can override it here.
4807
4808 EOM
4809 else
4810         dflt=''
4811         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4812         cat >&4 <<EOM
4813 I can't seem to find your C library.  I've looked in the following places:
4814
4815 EOM
4816         $sed 's/^/      /' libpath
4817         cat <<EOM
4818
4819 None of these seems to contain your C library. I need to get its name...
4820
4821 EOM
4822 fi
4823 fn=f
4824 rp='Where is your C library?'
4825 . ./getfile
4826 libc="$ans"
4827
4828 echo " "
4829 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4830 set X `cat libnames`
4831 shift
4832 xxx=files
4833 case $# in 1) xxx=file; esac
4834 echo "Extracting names from the following $xxx for later perusal:" >&4
4835 echo " "
4836 $sed 's/^/      /' libnames >&4
4837 echo " "
4838 $echo $n "This may take a while...$c" >&4
4839
4840 for file in $*; do
4841         case $file in
4842         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4843         *) $nm $nm_opt $file 2>/dev/null;;
4844         esac
4845 done >libc.tmp
4846
4847 $echo $n ".$c"
4848 $grep fprintf libc.tmp > libc.ptf
4849 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4850 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4851 xxx='[ADTSIW]'
4852 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4853         eval $xscan;\
4854         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4855                 eval $xrun
4856 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4857         eval $xscan;\
4858         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4859                 eval $xrun
4860 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4861         eval $xscan;\
4862         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4863                 eval $xrun
4864 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4865         eval $xscan;\
4866         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4867                 eval $xrun
4868 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4869         eval $xscan;\
4870         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4871                 eval $xrun
4872 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4873         eval $xscan;\
4874         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4875                 eval $xrun
4876 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4877                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4878         eval $xscan;\
4879         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4880                 eval $xrun
4881 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4882         eval $xscan;\
4883         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4884                 eval $xrun
4885 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4886         eval $xscan;\
4887         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4888                 eval $xrun
4889 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4890         eval $xscan;\
4891         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4892                 eval $xrun
4893 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4894         eval $xscan;\
4895         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4896                 eval $xrun
4897 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4898         eval $xscan;\
4899         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4900                 eval $xrun
4901 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4902         eval $xscan;\
4903         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4904                 eval $xrun
4905 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4906         eval $xscan;\
4907         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4908                 eval $xrun
4909 else
4910         $nm -p $* 2>/dev/null >libc.tmp
4911         $grep fprintf libc.tmp > libc.ptf
4912         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4913                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4914         then
4915                 nm_opt='-p'
4916                 eval $xrun
4917         else
4918                 echo " "
4919                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4920                 com=''
4921                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4922                         for thisname in $libnames $libc; do
4923                                 $ar t $thisname >>libc.tmp
4924                         done
4925                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4926                         echo "Ok." >&4
4927                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4928                         # Repeat libc to extract forwarders to DLL entries too
4929                         for thisname in $libnames $libc; do
4930                                 $ar tv $thisname >>libc.tmp
4931                                 # Revision 50 of EMX has bug in $ar.
4932                                 # it will not extract forwarders to DLL entries
4933                                 # Use emximp which will extract exactly them.
4934                                 emximp -o tmp.imp $thisname \
4935                                     2>/dev/null && \
4936                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4937                                     < tmp.imp >>libc.tmp
4938                                 $rm tmp.imp
4939                         done
4940                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4941                         echo "Ok." >&4
4942                 else
4943                         echo "$ar didn't seem to work right." >&4
4944                         echo "Maybe this is a Cray...trying bld instead..." >&4
4945                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4946                         then
4947                                 for thisname in $libnames; do
4948                                         bld t $libnames | \
4949                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4950                                         $ar t $thisname >>libc.tmp
4951                                 done
4952                                 echo "Ok." >&4
4953                         else
4954                                 echo "That didn't work either.  Giving up." >&4
4955                                 exit 1
4956                         fi
4957                 fi
4958         fi
4959 fi
4960 nm_extract="$com"
4961 if $test -f /lib/syscalls.exp; then
4962         echo " "
4963         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4964         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4965 fi
4966 ;;
4967 esac
4968 $rm -f libnames libpath
4969
4970 : is a C symbol defined?
4971 csym='tlook=$1;
4972 case "$3" in
4973 -v) tf=libc.tmp; tc=""; tdc="";;
4974 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4975 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4976 esac;
4977 tx=yes;
4978 case "$reuseval-$4" in
4979 true-) ;;
4980 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4981 esac;
4982 case "$tx" in
4983 yes)
4984         case "$runnm" in
4985         true)
4986                 if $contains $tlook $tf >/dev/null 2>&1;
4987                 then tval=true;
4988                 else tval=false;
4989                 fi;;
4990         *)
4991                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4992                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4993                 then tval=true;
4994                 else tval=false;
4995                 fi;
4996                 $rm -f t t.c;;
4997         esac;;
4998 *)
4999         case "$tval" in
5000         $define) tval=true;;
5001         *) tval=false;;
5002         esac;;
5003 esac;
5004 eval "$2=$tval"'
5005
5006 : define an is-in-libc? function
5007 inlibc='echo " "; td=$define; tu=$undef;
5008 sym=$1; var=$2; eval "was=\$$2";
5009 tx=yes;
5010 case "$reuseval$was" in
5011 true) ;;
5012 true*) tx=no;;
5013 esac;
5014 case "$tx" in
5015 yes)
5016         set $sym tres -f;
5017         eval $csym;
5018         case "$tres" in
5019         true)
5020                 echo "$sym() found." >&4;
5021                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5022         *)
5023                 echo "$sym() NOT found." >&4;
5024                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5025         esac;;
5026 *)
5027         case "$was" in
5028         $define) echo "$sym() found." >&4;;
5029         *) echo "$sym() NOT found." >&4;;
5030         esac;;
5031 esac'
5032
5033 : see if sqrtl exists
5034 set sqrtl d_sqrtl
5035 eval $inlibc
5036
5037 case "$ccflags" in
5038 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5039 esac
5040
5041 case "$uselongdouble" in
5042 $define|true|[yY]*)     dflt='y';;
5043 *) dflt='n';;
5044 esac
5045 cat <<EOM
5046
5047 Perl can be built to take advantage of long doubles which
5048 (if available) may give more accuracy and range for floating point numbers.
5049
5050 If this doesn't make any sense to you, just accept the default '$dflt'.
5051 EOM
5052 rp='Try to use long doubles if available?'
5053 . ./myread
5054 case "$ans" in
5055 y|Y)    val="$define"   ;;
5056 *)      val="$undef"    ;;
5057 esac
5058 set uselongdouble
5059 eval $setvar
5060
5061 case "$uselongdouble" in
5062 true|[yY]*) uselongdouble="$define" ;;
5063 esac
5064
5065 case "$uselongdouble" in
5066 $define)
5067 : Look for a hint-file generated 'call-back-unit'.  If the
5068 : user has specified that long doubles should be used,
5069 : we may need to set or change some other defaults.
5070         if $test -f uselongdouble.cbu; then
5071                 echo "Your platform has some specific hints for long doubles, using them..."
5072                 . ./uselongdouble.cbu
5073         else
5074                 $cat <<EOM
5075 (Your platform doesn't have any specific hints for long doubles.)
5076 EOM
5077         fi
5078         ;;
5079 esac
5080
5081 case "$uselongdouble:$d_sqrtl" in
5082 $define:$undef)
5083                 $cat <<EOM >&4
5084
5085 *** You requested the use of long doubles but you do not seem to have
5086 *** the mathematic functions for long doubles.  I'm disabling the use
5087 *** of long doubles.
5088
5089 EOM
5090         uselongdouble=$undef
5091         ;;
5092 esac
5093
5094 : check for length of double
5095 echo " "
5096 case "$doublesize" in
5097 '')
5098         echo "Checking to see how big your double precision numbers are..." >&4
5099         $cat >try.c <<'EOCP'
5100 #include <stdio.h>
5101 int main()
5102 {
5103     printf("%d\n", (int)sizeof(double));
5104     exit(0);
5105 }
5106 EOCP
5107         set try
5108         if eval $compile_ok; then
5109                 doublesize=`./try`
5110                 echo "Your double is $doublesize bytes long."
5111         else
5112                 dflt='8'
5113                 echo "(I can't seem to compile the test program.  Guessing...)"
5114                 rp="What is the size of a double precision number (in bytes)?"
5115                 . ./myread
5116                 doublesize="$ans"
5117         fi
5118         ;;
5119 esac
5120 $rm -f try.c try
5121
5122 : check for long doubles
5123 echo " "
5124 echo "Checking to see if you have long double..." >&4
5125 echo 'int main() { long double x = 7.0; }' > try.c
5126 set try
5127 if eval $compile; then
5128         val="$define"
5129         echo "You have long double."
5130 else
5131         val="$undef"
5132         echo "You do not have long double."
5133 fi
5134 $rm try.*
5135 set d_longdbl
5136 eval $setvar
5137
5138 : check for length of long double
5139 case "${d_longdbl}${longdblsize}" in
5140 $define)
5141         echo " "
5142         echo "Checking to see how big your long doubles are..." >&4
5143         $cat >try.c <<'EOCP'
5144 #include <stdio.h>
5145 int main()
5146 {
5147         printf("%d\n", sizeof(long double));
5148 }
5149 EOCP
5150         set try
5151         set try
5152         if eval $compile; then
5153                 longdblsize=`./try$exe_ext`
5154                 echo "Your long doubles are $longdblsize bytes long."
5155         else
5156                 dflt='8'
5157                 echo " "
5158                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5159                 rp="What is the size of a long double (in bytes)?"
5160                 . ./myread
5161                 longdblsize="$ans"
5162         fi
5163         if $test "X$doublesize" = "X$longdblsize"; then
5164                 echo "(That isn't any different from an ordinary double.)"
5165         fi      
5166         ;;
5167 esac
5168 $rm -f try.* try
5169
5170 : determine the architecture name
5171 echo " "
5172 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5173         tarch=`arch`"-$osname"
5174 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5175         if uname -m > tmparch 2>&1 ; then
5176                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5177                         -e 's/$/'"-$osname/" tmparch`
5178         else
5179                 tarch="$osname"
5180         fi
5181         $rm -f tmparch
5182 else
5183         tarch="$osname"
5184 fi
5185 case "$myarchname" in
5186 ''|"$tarch") ;;
5187 *)
5188         echo "(Your architecture name used to be $myarchname.)"
5189         archname=''
5190         ;;
5191 esac
5192 myarchname="$tarch"
5193 case "$archname" in
5194 '') dflt="$tarch";;
5195 *) dflt="$archname";;
5196 esac
5197 rp='What is your architecture name'
5198 . ./myread
5199 archname="$ans"
5200 case "$usethreads" in
5201 $define)
5202         echo "Threads selected." >&4
5203         case "$archname" in
5204         *-thread*) echo "...and architecture name already has -thread." >&4
5205                 ;;
5206         *)      archname="$archname-thread"
5207                 echo "...setting architecture name to $archname." >&4
5208                 ;;
5209         esac
5210         ;;
5211 esac
5212 case "$usemultiplicity" in
5213 $define)
5214         echo "Multiplicity selected." >&4
5215         case "$archname" in
5216         *-multi*) echo "...and architecture name already has -multi." >&4
5217                 ;;
5218         *)      archname="$archname-multi"
5219                 echo "...setting architecture name to $archname." >&4
5220                 ;;
5221         esac
5222         ;;
5223 esac
5224 case "$use64bitint$use64bitall" in
5225 *"$define"*)
5226         case "$archname64" in
5227         '')
5228                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5229                 ;;
5230         *)
5231                 case "$use64bitint" in
5232                 "$define") echo "64 bit integers selected." >&4 ;;
5233                 esac
5234                 case "$use64bitall" in
5235                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5236                 esac
5237                 case "$archname" in
5238                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5239                         ;;
5240                 *)      archname="$archname-$archname64"
5241                         echo "...setting architecture name to $archname." >&4
5242                         ;;
5243                 esac
5244                 ;;
5245         esac
5246 esac
5247 case "$uselongdouble" in
5248 $define)
5249         echo "Long doubles selected." >&4
5250         case "$longdblsize" in
5251         $doublesize)
5252                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5253                 ;;
5254         *)
5255                 case "$archname" in
5256                 *-ld*) echo "...and architecture name already has -ld." >&4
5257                         ;;
5258                 *)      archname="$archname-ld"
5259                         echo "...setting architecture name to $archname." >&4
5260                         ;;
5261                 esac
5262                 ;;
5263         esac
5264         ;;
5265 esac
5266
5267 : determine root of directory hierarchy where package will be installed.
5268 case "$prefix" in
5269 '')
5270         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5271         ;;
5272 *)
5273         dflt="$prefix"
5274         ;;
5275 esac
5276 $cat <<EOM
5277
5278 By default, $package will be installed in $dflt/bin, manual pages
5279 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5280 installation directories. Typically this is something like /usr/local.
5281 If you wish to have binaries under /usr/bin but other parts of the
5282 installation under /usr/local, that's ok: you will be prompted
5283 separately for each of the installation directories, the prefix being
5284 only used to set the defaults.
5285
5286 EOM
5287 fn=d~
5288 rp='Installation prefix to use?'
5289 . ./getfile
5290 oldprefix=''
5291 case "$prefix" in
5292 '') ;;
5293 *)
5294         case "$ans" in
5295         "$prefix") ;;
5296         *) oldprefix="$prefix";;
5297         esac
5298         ;;
5299 esac
5300 prefix="$ans"
5301 prefixexp="$ansexp"
5302
5303 : is AFS running?
5304 echo " "
5305 case "$afs" in
5306 $define|true)   afs=true ;;
5307 $undef|false)   afs=false ;;
5308 *)      if test -d /afs; then
5309                 afs=true
5310         else
5311                 afs=false
5312         fi
5313         ;;
5314 esac
5315 if $afs; then
5316         echo "AFS may be running... I'll be extra cautious then..." >&4
5317 else
5318         echo "AFS does not seem to be running..." >&4
5319 fi
5320
5321 : determine installation prefix for where package is to be installed.
5322 if $afs; then 
5323 $cat <<EOM
5324
5325 Since you are running AFS, I need to distinguish the directory in which
5326 files will reside from the directory in which they are installed (and from
5327 which they are presumably copied to the former directory by occult means).
5328
5329 EOM
5330         case "$installprefix" in
5331         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5332         *) dflt="$installprefix";;
5333         esac
5334 else
5335 $cat <<EOM
5336
5337 In some special cases, particularly when building $package for distribution,
5338 it is convenient to distinguish between the directory in which files should 
5339 be installed from the directory ($prefix) in which they 
5340 will eventually reside.  For most users, these two directories are the same.
5341
5342 EOM
5343         case "$installprefix" in
5344         '') dflt=$prefix ;;
5345         *) dflt=$installprefix;;
5346         esac
5347 fi
5348 fn=d~
5349 rp='What installation prefix should I use for installing files?'
5350 . ./getfile
5351 installprefix="$ans"
5352 installprefixexp="$ansexp"
5353
5354 : set the prefixit variable, to compute a suitable default value
5355 prefixit='case "$3" in
5356 ""|none)
5357         case "$oldprefix" in
5358         "") eval "$1=\"\$$2\"";;
5359         *)
5360                 case "$3" in
5361                 "") eval "$1=";;
5362                 none)
5363                         eval "tp=\"\$$2\"";
5364                         case "$tp" in
5365                         ""|" ") eval "$1=\"\$$2\"";;
5366                         *) eval "$1=";;
5367                         esac;;
5368                 esac;;
5369         esac;;
5370 *)
5371         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5372         case "$tp" in
5373         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5374         /*-$oldprefix/*|\~*-$oldprefix/*)
5375                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5376         *) eval "$1=\"\$$2\"";;
5377         esac;;
5378 esac'
5379
5380
5381 : get the patchlevel
5382 echo " "
5383 echo "Getting the current patchlevel..." >&4
5384 if $test -r $rsrc/patchlevel.h;then
5385         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5386         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5387         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5388         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5389         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5390         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5391 else
5392         revision=0
5393         patchlevel=0
5394         subversion=0
5395         api_revision=0
5396         api_version=0
5397         api_subversion=0
5398 fi
5399 $echo "(You have $package version $patchlevel subversion $subversion.)"
5400 case "$osname" in
5401 dos|vms)
5402         : XXX Should be a Configure test for double-dots in filenames.
5403         version=`echo $revision $patchlevel $subversion | \
5404                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5405         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5406                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5407         ;;
5408 *)
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 esac
5415 : Special case the 5.005_xx maintenance series, which used 5.005
5416 : without any subversion label as a subdirectory in $sitelib
5417 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5418         api_versionstring='5.005'
5419 fi
5420
5421 : determine installation style
5422 : For now, try to deduce it from prefix unless it is already set.
5423 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5424 case "$installstyle" in
5425 '')     case "$prefix" in
5426                 *perl*) dflt='lib';;
5427                 *) dflt='lib/perl5' ;;
5428         esac
5429         ;;
5430 *)      dflt="$installstyle" ;;
5431 esac
5432 : Probably not worth prompting for this since we prompt for all
5433 : the directories individually, and the prompt would be too long and
5434 : confusing anyway.
5435 installstyle=$dflt
5436
5437 : determine where private library files go
5438 : Usual default is /usr/local/lib/perl5/$version.
5439 : Also allow things like /opt/perl/lib/$version, since 
5440 : /opt/perl/lib/perl5... would be redundant.
5441 : The default "style" setting is made in installstyle.U
5442 case "$installstyle" in
5443 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5444 *)       set dflt privlib lib/$version ;;
5445 esac
5446 eval $prefixit
5447 $cat <<EOM
5448
5449 There are some auxiliary files for $package that need to be put into a
5450 private library directory that is accessible by everyone.
5451
5452 EOM
5453 fn=d~+
5454 rp='Pathname where the private library files will reside?'
5455 . ./getfile
5456 privlib="$ans"
5457 privlibexp="$ansexp"
5458 : Change installation prefix, if necessary.
5459 if $test X"$prefix" != X"$installprefix"; then
5460         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5461 else
5462         installprivlib="$privlibexp"
5463 fi
5464
5465 : set the prefixup variable, to restore leading tilda escape
5466 prefixup='case "$prefixexp" in
5467 "$prefix") ;;
5468 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5469 esac'
5470
5471 : determine where public architecture dependent libraries go
5472 set archlib archlib
5473 eval $prefixit
5474 : privlib default is /usr/local/lib/$package/$version
5475 : archlib default is /usr/local/lib/$package/$version/$archname
5476 : privlib may have an optional trailing /share.
5477 tdflt=`echo $privlib | $sed 's,/share$,,'`
5478 tdflt=$tdflt/$archname
5479 case "$archlib" in
5480 '')     dflt=$tdflt
5481         ;;
5482 *)      dflt="$archlib"
5483     ;;
5484 esac
5485 $cat <<EOM
5486
5487 $spackage contains architecture-dependent library files.  If you are
5488 sharing libraries in a heterogeneous environment, you might store
5489 these files in a separate location.  Otherwise, you can just include
5490 them with the rest of the public library files.
5491
5492 EOM
5493 fn=d+~
5494 rp='Where do you want to put the public architecture-dependent libraries?'
5495 . ./getfile
5496 archlib="$ans"
5497 archlibexp="$ansexp"
5498 if $test X"$archlib" = X"$privlib"; then
5499         d_archlib="$undef"
5500 else
5501         d_archlib="$define"
5502 fi
5503 : Change installation prefix, if necessary.
5504 if $test X"$prefix" != X"$installprefix"; then
5505         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5506 else
5507         installarchlib="$archlibexp"
5508 fi
5509
5510
5511 : Binary compatibility with 5.005 is not possible for builds
5512 : with advanced features
5513 case "$usethreads$usemultiplicity" in
5514 *define*)
5515         bincompat5005="$undef"
5516         d_bincompat5005="$undef"
5517         ;;
5518 *)      $cat <<EOM
5519
5520 This version of Perl can be compiled for binary compatibility with 5.005.
5521 If you decide to do so, you will be able to continue using most of the
5522 extensions that were compiled for Perl 5.005.
5523
5524 EOM
5525         case "$bincompat5005$d_bincompat5005" in
5526         *"$undef"*) dflt=n ;;
5527         *) dflt=y ;;
5528         esac
5529         rp='Binary compatibility with Perl 5.005?'
5530         . ./myread
5531         case "$ans" in
5532         y*) val="$define" ;;
5533         *)  val="$undef" ;;
5534         esac
5535         set d_bincompat5005
5536         eval $setvar
5537         case "$d_bincompat5005" in
5538         "$define")
5539                 bincompat5005="$define"
5540                 ;;
5541         *)      bincompat5005="$undef"
5542                 d_bincompat5005="$undef"
5543                 ;;
5544         esac
5545         ;;
5546 esac
5547
5548
5549 : see if setuid scripts can be secure
5550 $cat <<EOM
5551
5552 Some kernels have a bug that prevents setuid #! scripts from being
5553 secure.  Some sites have disabled setuid #! scripts because of this.
5554
5555 First let's decide if your kernel supports secure setuid #! scripts.
5556 (If setuid #! scripts would be secure but have been disabled anyway,
5557 don't say that they are secure if asked.)
5558
5559 EOM
5560
5561 val="$undef"
5562 if $test -d /dev/fd; then
5563         echo "#!$ls" >reflect
5564         chmod +x,u+s reflect
5565         ./reflect >flect 2>&1
5566         if $contains "/dev/fd" flect >/dev/null; then
5567                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5568                 val="$define"
5569         else
5570                 $cat <<EOM
5571 If you are not sure if they are secure, I can check but I'll need a
5572 username and password different from the one you are using right now.
5573 If you don't have such a username or don't want me to test, simply
5574 enter 'none'.
5575
5576 EOM
5577                 rp='Other username to test security of setuid scripts with?'
5578                 dflt='none'
5579                 . ./myread
5580                 case "$ans" in
5581                 n|none)
5582                         case "$d_suidsafe" in
5583                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5584                                 dflt=n;;
5585                         "$undef")
5586                                 echo "Well, the $hint value is *not* secure." >&4
5587                                 dflt=n;;
5588                         *)      echo "Well, the $hint value *is* secure." >&4
5589                                 dflt=y;;
5590                         esac
5591                         ;;
5592                 *)
5593                         $rm -f reflect flect
5594                         echo "#!$ls" >reflect
5595                         chmod +x,u+s reflect
5596                         echo >flect
5597                         chmod a+w flect
5598                         echo '"su" will (probably) prompt you for '"$ans's password."
5599                         su $ans -c './reflect >flect'
5600                         if $contains "/dev/fd" flect >/dev/null; then
5601                                 echo "Okay, it looks like setuid scripts are secure." >&4
5602                                 dflt=y
5603                         else
5604                                 echo "I don't think setuid scripts are secure." >&4
5605                                 dflt=n
5606                         fi
5607                         ;;
5608                 esac
5609                 rp='Does your kernel have *secure* setuid scripts?'
5610                 . ./myread
5611                 case "$ans" in
5612                 [yY]*)  val="$define";;
5613                 *)      val="$undef";;
5614                 esac
5615         fi
5616 else
5617         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5618         echo "(That's for file descriptors, not floppy disks.)"
5619         val="$undef"
5620 fi
5621 set d_suidsafe
5622 eval $setvar
5623
5624 $rm -f reflect flect
5625
5626 : now see if they want to do setuid emulation
5627 echo " "
5628 val="$undef"
5629 case "$d_suidsafe" in
5630 "$define")
5631         val="$undef"
5632         echo "No need to emulate SUID scripts since they are secure here." >& 4
5633         ;;
5634 *)
5635         $cat <<EOM
5636 Some systems have disabled setuid scripts, especially systems where
5637 setuid scripts cannot be secure.  On systems where setuid scripts have
5638 been disabled, the setuid/setgid bits on scripts are currently
5639 useless.  It is possible for $package to detect those bits and emulate
5640 setuid/setgid in a secure fashion.  This emulation will only work if
5641 setuid scripts have been disabled in your kernel.
5642
5643 EOM
5644         case "$d_dosuid" in
5645         "$define") dflt=y ;;
5646         *) dflt=n ;;
5647         esac
5648         rp="Do you want to do setuid/setgid emulation?"
5649         . ./myread
5650         case "$ans" in
5651         [yY]*)  val="$define";;
5652         *)      val="$undef";;
5653         esac
5654         ;;
5655 esac
5656 set d_dosuid
5657 eval $setvar
5658
5659 : determine filename position in cpp output
5660 echo " "
5661 echo "Computing filename position in cpp output for #include directives..." >&4
5662 echo '#include <stdio.h>' > foo.c
5663 $cat >fieldn <<EOF
5664 $startsh
5665 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5666 $grep '^[       ]*#.*stdio\.h' | \
5667 while read cline; do
5668         pos=1
5669         set \$cline
5670         while $test \$# -gt 0; do
5671                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5672                         echo "\$pos"
5673                         exit 0
5674                 fi
5675                 shift
5676                 pos=\`expr \$pos + 1\`
5677         done
5678 done
5679 EOF
5680 chmod +x fieldn
5681 fieldn=`./fieldn`
5682 $rm -f foo.c fieldn
5683 case $fieldn in
5684 '') pos='???';;
5685 1) pos=first;;
5686 2) pos=second;;
5687 3) pos=third;;
5688 *) pos="${fieldn}th";;
5689 esac
5690 echo "Your cpp writes the filename in the $pos field of the line."
5691
5692 : locate header file
5693 $cat >findhdr <<EOF
5694 $startsh
5695 wanted=\$1
5696 name=''
5697 for usrincdir in $usrinc
5698 do
5699         if test -f \$usrincdir/\$wanted; then
5700                 echo "\$usrincdir/\$wanted"
5701                 exit 0
5702         fi
5703 done
5704 awkprg='{ print \$$fieldn }'
5705 echo "#include <\$wanted>" > foo\$\$.c
5706 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5707 $grep "^[       ]*#.*\$wanted" | \
5708 while read cline; do
5709         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5710         case "\$name" in
5711         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5712         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5713         *) exit 2;;
5714         esac;
5715 done;
5716 #
5717 # status = 0: grep returned 0 lines, case statement not executed
5718 # status = 1: headerfile found
5719 # status = 2: while loop executed, no headerfile found
5720 #
5721 status=\$?
5722 $rm -f foo\$\$.c;
5723 if test \$status -eq 1; then
5724         exit 0;
5725 fi
5726 exit 1
5727 EOF
5728 chmod +x findhdr
5729
5730 : define an alternate in-header-list? function
5731 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5732 cont=true; xxf="echo \"<\$1> found.\" >&4";
5733 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5734 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5735 esac;
5736 case $# in 4) instead=instead;; *) instead="at last";; esac;
5737 while $test "$cont"; do
5738         xxx=`./findhdr $1`
5739         var=$2; eval "was=\$$2";
5740         if $test "$xxx" && $test -r "$xxx";
5741         then eval $xxf;
5742         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5743                 cont="";
5744         else eval $xxnf;
5745         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5746         set $yyy; shift; shift; yyy=$@;
5747         case $# in 0) cont="";;
5748         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5749                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5750         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5751                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5752         esac;
5753 done;
5754 while $test "$yyy";
5755 do set $yyy; var=$2; eval "was=\$$2";
5756         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5757         set $yyy; shift; shift; yyy=$@;
5758 done'
5759
5760 : see if this is a malloc.h system
5761 set malloc.h i_malloc
5762 eval $inhdr
5763
5764 : see if stdlib is available
5765 set stdlib.h i_stdlib
5766 eval $inhdr
5767
5768 : determine which malloc to compile in
5769 echo " "
5770 case "$usemymalloc" in
5771 ''|[yY]*|true|$define)  dflt='y' ;;
5772 *)      dflt='n' ;;
5773 esac
5774 rp="Do you wish to attempt to use the malloc that comes with $package?"
5775 . ./myread
5776 usemymalloc="$ans"
5777 case "$ans" in
5778 y*|true)
5779         usemymalloc='y'
5780         mallocsrc='malloc.c'
5781         mallocobj="malloc$_o"
5782         d_mymalloc="$define"
5783         case "$libs" in
5784         *-lmalloc*)
5785                 : Remove malloc from list of libraries to use
5786                 echo "Removing unneeded -lmalloc from library list" >&4
5787                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5788                 shift
5789                 libs="$*"
5790                 echo "libs = $libs" >&4
5791                 ;;
5792         esac
5793         ;;
5794 *)
5795         usemymalloc='n'
5796         mallocsrc=''
5797         mallocobj=''
5798         d_mymalloc="$undef"
5799         ;;
5800 esac
5801
5802 : compute the return types of malloc and free
5803 echo " "
5804 $cat >malloc.c <<END
5805 #$i_malloc I_MALLOC
5806 #$i_stdlib I_STDLIB
5807 #include <stdio.h>
5808 #include <sys/types.h>
5809 #ifdef I_MALLOC
5810 #include <malloc.h>
5811 #endif
5812 #ifdef I_STDLIB
5813 #include <stdlib.h>
5814 #endif
5815 #ifdef TRY_MALLOC
5816 void *malloc();
5817 #endif
5818 #ifdef TRY_FREE
5819 void free();
5820 #endif
5821 END
5822 case "$malloctype" in
5823 '')
5824         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5825                 malloctype='void *'
5826         else
5827                 malloctype='char *'
5828         fi
5829         ;;
5830 esac
5831 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5832
5833 case "$freetype" in
5834 '')
5835         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5836                 freetype='void'
5837         else
5838                 freetype='int'
5839         fi
5840         ;;
5841 esac
5842 echo "Your system uses $freetype free(), it would seem." >&4
5843 $rm -f malloc.[co]
5844 $cat <<EOM
5845
5846 After $package is installed, you may wish to install various
5847 add-on modules and utilities.  Typically, these add-ons will
5848 be installed under $prefix with the rest
5849 of this package.  However, you may wish to install such add-ons
5850 elsewhere under a different prefix.
5851
5852 If you do not wish to put everything under a single prefix, that's
5853 ok.  You will be prompted for the individual locations; this siteprefix
5854 is only used to suggest the defaults.
5855
5856 The default should be fine for most people.
5857
5858 EOM
5859 fn=d~+
5860 rp='Installation prefix to use for add-on modules and utilities?'
5861 : XXX Here might be another good place for an installstyle setting.
5862 case "$siteprefix" in
5863 '') dflt=$prefix ;;
5864 *)  dflt=$siteprefix ;;
5865 esac
5866 . ./getfile
5867 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5868 oldsiteprefix=''
5869 case "$siteprefix" in
5870 '') ;;
5871 *)      case "$ans" in
5872         "$prefix") ;;
5873         *) oldsiteprefix="$prefix";;
5874         esac
5875         ;;
5876 esac
5877 siteprefix="$ans"
5878 siteprefixexp="$ansexp"
5879
5880 : determine where site specific libraries go.
5881 : Usual default is /usr/local/lib/perl5/site_perl/$version
5882 : The default "style" setting is made in installstyle.U
5883 : XXX No longer works with Prefixit stuff.
5884 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5885 case "$sitelib" in
5886 '') case "$installstyle" in
5887         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5888         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5889         esac
5890         ;;
5891 *)      dflt="$sitelib"
5892         ;;
5893 esac
5894 $cat <<EOM
5895
5896 The installation process will create a directory for
5897 site-specific extensions and modules.  Most users find it convenient
5898 to place all site-specific files in this directory rather than in the
5899 main distribution directory.
5900
5901 EOM
5902 fn=d~+
5903 rp='Pathname for the site-specific library files?'
5904 . ./getfile
5905 sitelib="$ans"
5906 sitelibexp="$ansexp"
5907 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5908 : Change installation prefix, if necessary.
5909 if $test X"$prefix" != X"$installprefix"; then
5910         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5911 else
5912         installsitelib="$sitelibexp"
5913 fi
5914
5915 : determine where site specific architecture-dependent libraries go.
5916 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5917 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5918 : sitelib may have an optional trailing /share.
5919 case "$sitearch" in
5920 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5921         dflt="$dflt/$archname"
5922         ;;
5923 *)      dflt="$sitearch"
5924         ;;
5925 esac
5926 set sitearch sitearch none
5927 eval $prefixit
5928 $cat <<EOM
5929
5930 The installation process will also create a directory for
5931 architecture-dependent site-specific extensions and modules.
5932
5933 EOM
5934 fn=d~+
5935 rp='Pathname for the site-specific architecture-dependent library files?'
5936 . ./getfile
5937 sitearch="$ans"
5938 sitearchexp="$ansexp"
5939 : Change installation prefix, if necessary.
5940 if $test X"$prefix" != X"$installprefix"; then
5941         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5942 else
5943         installsitearch="$sitearchexp"
5944 fi
5945
5946 $cat <<EOM
5947
5948 The installation process will also create a directory for
5949 vendor-supplied add-ons.  Vendors who supply perl with their system
5950 may find it convenient to place all vendor-supplied files in this
5951 directory rather than in the main distribution directory.  This will
5952 ease upgrades between binary-compatible maintenance versions of perl.
5953
5954 Of course you may also use these directories in whatever way you see
5955 fit.  For example, you might use them to access modules shared over a
5956 company-wide network.
5957
5958 The default answer should be fine for most people.
5959 This causes further questions about vendor add-ons to be skipped
5960 and no vendor-specific directories will be configured for perl.
5961
5962 EOM
5963 rp='Do you want to configure vendor-specific add-on directories?'
5964 case "$usevendorprefix" in
5965 define|true|[yY]*) dflt=y ;;
5966 *)      : User may have set vendorprefix directly on Configure command line.
5967         case "$vendorprefix" in
5968         ''|' ') dflt=n ;;
5969         *)      dflt=y ;;
5970         esac
5971         ;;
5972 esac
5973 . ./myread
5974 case "$ans" in
5975 [yY]*)  fn=d~+
5976         rp='Installation prefix to use for vendor-supplied add-ons?'
5977         case "$vendorprefix" in
5978         '') dflt='' ;;
5979         *)  dflt=$vendorprefix ;;
5980         esac
5981         . ./getfile
5982         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5983         oldvendorprefix=''
5984         case "$vendorprefix" in
5985         '') ;;
5986         *)      case "$ans" in
5987                 "$prefix") ;;
5988                 *) oldvendorprefix="$prefix";;
5989                 esac
5990                 ;;
5991         esac
5992         usevendorprefix="$define"
5993         vendorprefix="$ans"
5994         vendorprefixexp="$ansexp"
5995         ;;
5996 *)      usevendorprefix="$undef"
5997         vendorprefix=''
5998         vendorprefixexp=''
5999         ;;
6000 esac
6001
6002 case "$vendorprefix" in
6003 '')     d_vendorlib="$undef"
6004         vendorlib=''
6005         vendorlibexp=''
6006         ;;
6007 *)      d_vendorlib="$define"
6008         : determine where vendor-supplied modules go.
6009         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6010         case "$vendorlib" in
6011         '')
6012                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6013                 case "$installstyle" in
6014                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6015                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6016                 esac
6017                 ;;
6018         *)      dflt="$vendorlib"
6019                 ;;
6020         esac
6021         fn=d~+
6022         rp='Pathname for the vendor-supplied library files?'
6023         . ./getfile
6024         vendorlib="$ans"
6025         vendorlibexp="$ansexp"
6026         ;;
6027 esac
6028 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6029 : Change installation prefix, if necessary.
6030 if $test X"$prefix" != X"$installprefix"; then
6031         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6032 else
6033         installvendorlib="$vendorlibexp"
6034 fi
6035
6036 case "$vendorprefix" in
6037 '')     d_vendorarch="$undef"
6038         vendorarch=''
6039         vendorarchexp=''
6040         ;;
6041 *)      d_vendorarch="$define"
6042         : determine where vendor-supplied architecture-dependent libraries go.
6043         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6044         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6045         : vendorlib may have an optional trailing /share.
6046         case "$vendorarch" in
6047         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6048                 dflt="$dflt/$archname"
6049                 ;;
6050         *)      dflt="$vendorarch" ;;
6051         esac
6052         fn=d~+
6053         rp='Pathname for vendor-supplied architecture-dependent files?'
6054         . ./getfile
6055         vendorarch="$ans"
6056         vendorarchexp="$ansexp"
6057         ;;
6058 esac
6059 : Change installation prefix, if necessary.
6060 if $test X"$prefix" != X"$installprefix"; then
6061         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6062 else
6063         installvendorarch="$vendorarchexp"
6064 fi
6065
6066 : Final catch-all directories to search
6067 $cat <<EOM
6068
6069 Lastly, you can have perl look in other directories for extensions and
6070 modules in addition to those already specified.
6071 These directories will be searched after 
6072         $sitearch 
6073         $sitelib 
6074 EOM
6075 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6076 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6077 echo ' '
6078 case "$otherlibdirs" in
6079 ''|' ') dflt='none' ;;
6080 *)      dflt="$otherlibdirs" ;;
6081 esac
6082 $cat <<EOM
6083 Enter a colon-separated set of extra paths to include in perl's @INC
6084 search path, or enter 'none' for no extra paths.
6085
6086 EOM
6087
6088 rp='Colon-separated list of additional directories for perl to search?'
6089 . ./myread
6090 case "$ans" in
6091 ' '|''|none)    otherlibdirs=' ' ;;     
6092 *)      otherlibdirs="$ans" ;;
6093 esac
6094 case "$otherlibdirs" in
6095 ' ') val=$undef ;;
6096 *)      val=$define ;;
6097 esac
6098 set d_perl_otherlibdirs
6099 eval $setvar
6100
6101 : Cruising for prototypes
6102 echo " "
6103 echo "Checking out function prototypes..." >&4
6104 $cat >prototype.c <<'EOCP'
6105 int main(int argc, char *argv[]) {
6106         exit(0);}
6107 EOCP
6108 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6109         echo "Your C compiler appears to support function prototypes."
6110         val="$define"
6111 else
6112         echo "Your C compiler doesn't seem to understand function prototypes."
6113         val="$undef"
6114 fi
6115 set prototype
6116 eval $setvar
6117 $rm -f prototype*
6118
6119 case "$prototype" in
6120 "$define") ;;
6121 *)      ansi2knr='ansi2knr'
6122         echo " "
6123         cat <<EOM >&4
6124
6125 $me:  FATAL ERROR:
6126 This version of $package can only be compiled by a compiler that 
6127 understands function prototypes.  Unfortunately, your C compiler 
6128         $cc $ccflags
6129 doesn't seem to understand them.  Sorry about that.
6130
6131 If GNU cc is available for your system, perhaps you could try that instead.  
6132
6133 Eventually, we hope to support building Perl with pre-ANSI compilers.
6134 If you would like to help in that effort, please contact <perlbug@perl.org>.
6135
6136 Aborting Configure now.
6137 EOM
6138         exit 2
6139         ;;
6140 esac
6141
6142 : determine where public executables go
6143 echo " "
6144 set dflt bin bin
6145 eval $prefixit
6146 fn=d~
6147 rp='Pathname where the public executables will reside?'
6148 . ./getfile
6149 if $test "X$ansexp" != "X$binexp"; then
6150         installbin=''
6151 fi
6152 bin="$ans"
6153 binexp="$ansexp"
6154 : Change installation prefix, if necessary.
6155 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6156 if $test X"$prefix" != X"$installprefix"; then
6157         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6158 else
6159         installbin="$binexp"
6160 fi
6161
6162 : Find perl5.005 or later.
6163 echo "Looking for a previously installed perl5.005 or later... "
6164 case "$perl5" in
6165 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6166                 : Check if this perl is recent and can load a simple module
6167                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6168                         perl5=$tdir/perl
6169                         break;
6170                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6171                         perl5=$tdir/perl
6172                         break;
6173                 fi
6174         done
6175         ;;
6176 *)      perl5="$perl5"
6177         ;;
6178 esac
6179 case "$perl5" in
6180 '')     echo "None found.  That's ok.";;
6181 *)      echo "Using $perl5." ;;
6182 esac
6183
6184 : Determine list of previous versions to include in @INC
6185 $cat > getverlist <<EOPL
6186 #!$perl5 -w
6187 use File::Basename;
6188 \$api_versionstring = "$api_versionstring";
6189 \$version = "$version";
6190 \$stem = "$sitelib_stem";
6191 \$archname = "$archname";
6192 EOPL
6193         $cat >> getverlist <<'EOPL'
6194 # Can't have leading @ because metaconfig interprets it as a command!
6195 ;@inc_version_list=();
6196 # XXX Redo to do opendir/readdir? 
6197 if (-d $stem) {
6198     chdir($stem);
6199     ;@candidates = glob("5.*");
6200 }
6201 else {
6202     ;@candidates = ();
6203 }
6204
6205 # XXX ToDo:  These comparisons must be reworked when two-digit
6206 # subversions come along, so that 5.7.10 compares as greater than
6207 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6208 # widespread that we can use the built-in version vectors rather
6209 # than reinventing them here.  For 5.6.0, however, we must
6210 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6211 foreach $d (@candidates) {
6212     if ($d lt $version) {
6213         if ($d ge $api_versionstring) {
6214             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6215         }
6216         elsif ($d ge "5.005") {
6217             unshift(@inc_version_list, grep { -d } $d);
6218         }
6219     }
6220     else {
6221         # Skip newer version.  I.e. don't look in
6222         # 5.7.0 if we're installing 5.6.1.
6223     }
6224 }
6225
6226 if (@inc_version_list) {
6227     print join(' ', @inc_version_list);
6228 }
6229 else {
6230     # Blank space to preserve value for next Configure run.
6231     print " ";
6232 }
6233 EOPL
6234 chmod +x getverlist
6235 case "$inc_version_list" in
6236 '')     if test -x "$perl5"; then
6237                 dflt=`$perl5 getverlist`
6238         else
6239                 dflt='none'
6240         fi
6241         ;;
6242 $undef) dflt='none' ;;
6243 *)  dflt="$inc_version_list" ;;
6244 esac
6245 case "$dflt" in
6246 ''|' ') dflt=none ;;
6247 esac
6248 case "$dflt" in
6249 5.005) case "$bincompat5005" in
6250        $define|true|[yY]*) ;;
6251        *) dflt=none ;;
6252        esac
6253        ;;
6254 esac
6255 $cat <<'EOM'
6256
6257 In order to ease the process of upgrading, this version of perl 
6258 can be configured to use modules built and installed with earlier 
6259 versions of perl that were installed under $prefix.  Specify here
6260 the list of earlier versions that this version of perl should check.
6261 If Configure detected no earlier versions of perl installed under
6262 $prefix, then the list will be empty.  Answer 'none' to tell perl
6263 to not search earlier versions.
6264
6265 The default should almost always be sensible, so if you're not sure,
6266 just accept the default.
6267 EOM
6268
6269 rp='List of earlier versions to include in @INC?'
6270 . ./myread
6271 case "$ans" in
6272 [Nn]one|''|' ') inc_version_list=' ' ;;
6273 *) inc_version_list="$ans" ;;
6274 esac
6275 case "$inc_version_list" in
6276 ''|' ') 
6277         inc_version_list_init='0';;
6278 *)      inc_version_list_init=`echo $inc_version_list |
6279                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6280         ;;
6281 esac
6282 $rm -f getverlist
6283
6284 : determine whether to install perl also as /usr/bin/perl
6285
6286 echo " "
6287 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6288         $cat <<EOM
6289 Many scripts expect perl to be installed as /usr/bin/perl.
6290 I can install the perl you are about to compile also as /usr/bin/perl
6291 (in addition to $installbin/perl).
6292 EOM
6293         case "$installusrbinperl" in
6294         "$undef"|[nN]*) dflt='n';;
6295         *)              dflt='y';;
6296         esac
6297         rp="Do you want to install perl as /usr/bin/perl?"
6298         . ./myread
6299         case "$ans" in
6300         [yY]*)  val="$define";;
6301         *)      val="$undef" ;;
6302         esac
6303 else
6304         val="$undef"
6305 fi
6306 set installusrbinperl
6307 eval $setvar
6308
6309 : see if dld is available
6310 set dld.h i_dld
6311 eval $inhdr
6312
6313 : see if dlopen exists
6314 xxx_runnm="$runnm"
6315 runnm=false
6316 set dlopen d_dlopen
6317 eval $inlibc
6318 runnm="$xxx_runnm"
6319
6320 : determine which dynamic loading, if any, to compile in
6321 echo " "
6322 dldir="ext/DynaLoader"
6323 case "$usedl" in
6324 $define|y|true)
6325         dflt='y'
6326         usedl="$define"
6327         ;;
6328 $undef|n|false)
6329         dflt='n'
6330         usedl="$undef"
6331         ;;
6332 *) 
6333         dflt='n'
6334         case "$d_dlopen" in
6335             $define) dflt='y' ;;
6336         esac
6337         case "$i_dld" in
6338             $define) dflt='y' ;;
6339         esac
6340         : Does a dl_xxx.xs file exist for this operating system
6341         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6342         ;;
6343 esac
6344 rp="Do you wish to use dynamic loading?"
6345 . ./myread
6346 usedl="$ans"
6347 case "$ans" in
6348 y*) usedl="$define"
6349         case "$dlsrc" in
6350         '')
6351                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6352                         dflt="$dldir/dl_${osname}.xs"
6353                 elif $test "$d_dlopen" = "$define" ; then
6354                         dflt="$dldir/dl_dlopen.xs"
6355                 elif $test "$i_dld" = "$define" ; then
6356                         dflt="$dldir/dl_dld.xs"
6357                 else
6358                         dflt=''
6359                 fi
6360                 ;;
6361         *)      dflt="$dldir/$dlsrc"
6362                 ;;
6363         esac
6364     echo "The following dynamic loading files are available:"
6365         : Can not go over to $dldir because getfile has path hard-coded in.
6366         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6367         rp="Source file to use for dynamic loading"
6368         fn="fne"
6369         gfpth="$src"
6370         . ./getfile
6371         usedl="$define"
6372         : emulate basename
6373         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6374
6375         $cat << EOM
6376
6377 Some systems may require passing special flags to $cc -c to
6378 compile modules that will be used to create a shared library.
6379 To use no flags, say "none".
6380
6381 EOM
6382     case "$cccdlflags" in
6383     '') case "$gccversion" in
6384                 '') case "$osname" in
6385                         hpux)   dflt='+z' ;;
6386                         next)   dflt='none' ;;
6387                         irix*)  dflt='-KPIC' ;;
6388                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6389                         sunos)  dflt='-pic' ;;
6390                         *)      dflt='none' ;;
6391                     esac
6392                         ;;
6393                 *)  case "$osname" in
6394                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6395                         *)      dflt='-fpic' ;;
6396                     esac ;;
6397             esac ;;
6398         ' ') dflt='none' ;;
6399     *)  dflt="$cccdlflags" ;;
6400     esac
6401     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6402     . ./myread
6403     case "$ans" in
6404     none) cccdlflags=' ' ;;
6405     *) cccdlflags="$ans" ;;
6406     esac
6407
6408     cat << EOM
6409
6410 Some systems use ld to create libraries that can be dynamically loaded,
6411 while other systems (such as those using ELF) use $cc.
6412
6413 EOM
6414         case "$ld" in
6415         '')     $cat >try.c <<'EOM'
6416 /* Test for whether ELF binaries are produced */
6417 #include <fcntl.h>
6418 #include <stdlib.h>
6419 int main() {
6420         char b[4];
6421         int i = open("a.out",O_RDONLY);
6422         if(i == -1) 
6423                 exit(1); /* fail */
6424         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6425                 exit(0); /* succeed (yes, it's ELF) */
6426         else
6427                 exit(1); /* fail */
6428 }
6429 EOM
6430                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6431                         cat <<EOM
6432 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6433 EOM
6434                         dflt="$cc"
6435                 else
6436                         echo "I'll use ld to build dynamic libraries."
6437                         dflt='ld'
6438                 fi
6439                 rm -f try.c a.out
6440                 ;;
6441         *)      dflt="$ld"
6442                 ;;
6443         esac
6444
6445     rp="What command should be used to create dynamic libraries?"
6446     . ./myread
6447         ld="$ans"
6448
6449     cat << EOM
6450
6451 Some systems may require passing special flags to $ld to create a
6452 library that can be dynamically loaded.  If your ld flags include
6453 -L/other/path options to locate libraries outside your loader's normal
6454 search path, you may need to specify those -L options here as well.  To
6455 use no flags, say "none".
6456
6457 EOM
6458     case "$lddlflags" in
6459     '') case "$osname" in
6460                         beos) dflt='-nostart' ;;
6461                         hpux) dflt='-b';
6462                               case "$gccversion" in
6463                               '') dflt="$dflt +vnocompatwarnings" ;;
6464                               esac
6465                               ;;        
6466                         linux|irix*)    dflt='-shared' ;;
6467                         next)  dflt='none' ;;
6468                         solaris) dflt='-G' ;;
6469                         sunos) dflt='-assert nodefinitions' ;;
6470                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6471                 *)     dflt='none' ;;
6472                         esac
6473                         ;;
6474     *) dflt="$lddlflags" ;;
6475     esac
6476
6477         : Try to guess additional flags to pick up local libraries.
6478         : Be careful not to append to a plain 'none'
6479         case "$dflt" in
6480         none) dflt='' ;;
6481         esac
6482         for thisflag in $ldflags; do
6483                 case "$thisflag" in
6484                 -L*|-R*)
6485                         case " $dflt " in
6486                         *" $thisflag "*) ;;
6487                         *) dflt="$dflt $thisflag" ;;
6488                         esac
6489                         ;;
6490                 esac
6491         done
6492
6493         case "$dflt" in
6494         ''|' ') dflt='none' ;;
6495         esac
6496
6497     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6498     . ./myread
6499     case "$ans" in
6500     none) lddlflags=' ' ;;
6501     *) lddlflags="$ans" ;;
6502     esac
6503
6504         cat <<EOM
6505
6506 Some systems may require passing special flags to $cc to indicate that
6507 the resulting executable will use dynamic linking.  To use no flags,
6508 say "none".
6509
6510 EOM
6511     case "$ccdlflags" in
6512     '') case "$osname" in
6513                 hpux)   dflt='-Wl,-E' ;;
6514                 linux)  dflt='-rdynamic' ;;
6515                 next)   dflt='none' ;;
6516                 sunos)  dflt='none' ;;
6517                 *)      dflt='none' ;;
6518             esac ;;
6519     ' ')  dflt='none' ;;
6520     *)  dflt="$ccdlflags" ;;
6521     esac
6522     rp="Any special flags to pass to $cc to use dynamic linking?"
6523     . ./myread
6524     case "$ans" in
6525     none) ccdlflags=' ' ;;
6526     *) ccdlflags="$ans" ;;
6527     esac
6528     ;;
6529 *)  usedl="$undef"
6530         ld='ld'
6531     dlsrc='dl_none.xs'
6532     lddlflags=''
6533     ccdlflags=''
6534     ;;
6535 esac
6536
6537 also=''
6538 case "$usedl" in
6539 $undef)
6540         # No dynamic loading being used, so don't bother even to prompt.
6541         useshrplib='false'
6542         ;;
6543 *)      case "$useshrplib" in
6544         '')     case "$osname" in
6545                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6546                         dflt=y
6547                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6548                         ;;
6549                 next*)
6550                         case "$osvers" in
6551                         4*)     dflt=y
6552                                 also='Building a shared libperl is needed for MAB support.'
6553                                 ;;
6554                         *)      dflt=n
6555                                 ;;
6556                         esac
6557                         ;;
6558                 *)      dflt=n
6559                         ;;
6560                 esac
6561                 ;;
6562         $define|true|[Yy]*)
6563                 dflt=y
6564                 ;;
6565         *)      dflt=n
6566                 ;;
6567         esac
6568         $cat << EOM
6569
6570 The perl executable is normally obtained by linking perlmain.c with
6571 libperl${_a}, any static extensions (usually just DynaLoader), and
6572 any other libraries needed on this system (such as -lm, etc.).  Since
6573 your system supports dynamic loading, it is probably possible to build
6574 a shared libperl.$so.  If you will have more than one executable linked
6575 to libperl.$so, this will significantly reduce the size of each
6576 executable, but it may have a noticeable affect on performance.  The
6577 default is probably sensible for your system.
6578 $also
6579
6580 EOM
6581         rp="Build a shared libperl.$so (y/n)"
6582         . ./myread
6583         case "$ans" in
6584         true|$define|[Yy]*)
6585                 useshrplib='true'  ;;
6586         *)      useshrplib='false' ;;
6587         esac
6588         ;;
6589 esac
6590
6591 case "$useshrplib" in
6592 true)
6593         case "$libperl" in
6594         '')
6595                 # Figure out a good name for libperl.so.  Since it gets stored in
6596                 # a version-specific architecture-dependent library, the version
6597                 # number isn't really that important, except for making cc/ld happy.
6598                 #
6599                 # A name such as libperl.so.3.1
6600                 majmin="libperl.$so.$patchlevel.$subversion"
6601                 # A name such as libperl.so.301
6602                 majonly=`echo $patchlevel $subversion |
6603                         $awk '{printf "%d%02d", $1, $2}'`
6604                 majonly=libperl.$so.$majonly
6605                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6606                 # rely on figuring it out from the naming of libc.
6607                 case "${osname}${osvers}" in
6608                 next4*)
6609                         dflt=libperl.5.$so
6610                         # XXX How handle the --version stuff for MAB?
6611                         ;;
6612                 linux*)  # ld won't link with a bare -lperl otherwise.
6613                         dflt=libperl.$so
6614                         ;;
6615                 cygwin*) # include version
6616                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6617                         ;;
6618                 *)      # Try to guess based on whether libc has major.minor.
6619                         case "$libc" in
6620                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6621                         *libc.$so.[0-9]*) dflt=$majonly ;;
6622                         *)      dflt=libperl.$so ;;
6623                         esac
6624                         ;;
6625                 esac
6626                 ;;
6627         *)      dflt=$libperl
6628                 ;;
6629         esac
6630         cat << EOM
6631
6632 I need to select a good name for the shared libperl.  If your system uses
6633 library names with major and minor numbers, then you might want something
6634 like $majmin.  Alternatively, if your system uses a single version
6635 number for shared libraries, then you might want to use $majonly.
6636 Or, your system might be quite happy with a simple libperl.$so.
6637
6638 Since the shared libperl will get installed into a version-specific
6639 architecture-dependent directory, the version number of the shared perl
6640 library probably isn't important, so the default should be o.k.
6641
6642 EOM
6643         rp='What name do you want to give to the shared libperl?'
6644         . ./myread
6645         libperl=$ans
6646         echo "Ok, I'll use $libperl"
6647         ;;
6648 *)
6649         libperl="libperl${_a}"
6650         ;;
6651 esac
6652
6653 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6654 case "$shrpdir" in
6655 '') ;;
6656 *)      $cat >&4 <<EOM
6657 WARNING:  Use of the shrpdir variable for the installation location of
6658 the shared $libperl is not supported.  It was never documented and
6659 will not work in this version.  Let me (perlbug@perl.org)
6660 know of any problems this may cause.
6661
6662 EOM
6663         case "$shrpdir" in
6664         "$archlibexp/CORE")
6665                 $cat >&4 <<EOM
6666 But your current setting of $shrpdir is
6667 the default anyway, so it's harmless.
6668 EOM
6669                 ;;
6670         *)
6671                 $cat >&4 <<EOM
6672 Further, your current attempted setting of $shrpdir
6673 conflicts with the value of $archlibexp/CORE
6674 that installperl will use.
6675 EOM
6676                 ;;
6677         esac
6678         ;;
6679 esac
6680
6681 # How will the perl executable find the installed shared $libperl?
6682 # Add $xxx to ccdlflags.
6683 # If we can't figure out a command-line option, use $shrpenv to
6684 # set env LD_RUN_PATH.  The main perl makefile uses this.
6685 shrpdir=$archlibexp/CORE
6686 xxx=''
6687 tmp_shrpenv=''
6688 if "$useshrplib"; then
6689     case "$osname" in 
6690         aix)
6691                 # We'll set it in Makefile.SH...
6692                 ;;
6693         solaris|netbsd)
6694                 xxx="-R $shrpdir"
6695                 ;;
6696         freebsd)
6697                 xxx="-Wl,-R$shrpdir"
6698                 ;;
6699         linux|irix*|dec_osf)
6700                 xxx="-Wl,-rpath,$shrpdir"
6701                 ;;
6702         next)
6703                 # next doesn't like the default...
6704                 ;;
6705         beos)
6706                 # beos doesn't like the default, either.
6707                 ;;
6708         hpux*)
6709                 # hpux doesn't like the default, either.
6710                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6711                 ;;
6712         *)
6713                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6714                 ;;
6715         esac
6716         case "$xxx" in
6717         '') ;;
6718         *)      
6719                 # Only add $xxx if it isn't already in ccdlflags.
6720                 case " $ccdlflags " in
6721                 *" $xxx "*)     ;;
6722                 *)      ccdlflags="$ccdlflags $xxx"
6723                         cat <<EOM >&4
6724
6725 Adding $xxx to the flags
6726 passed to $ld so that the perl executable will find the 
6727 installed shared $libperl.
6728
6729 EOM
6730                         ;;
6731                 esac
6732                 ;;
6733         esac
6734 fi
6735 # Fix ccdlflags in AIX for building external extensions.
6736 # (For building Perl itself bare -bE:perl.exp is needed,
6737 #  Makefile.SH takes care of this.)
6738 case "$osname" in
6739 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6740 esac
6741 # Respect a hint or command-line value.
6742 case "$shrpenv" in
6743 '') shrpenv="$tmp_shrpenv" ;;
6744 esac
6745 case "$ldlibpthname" in
6746 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6747 none)   ldlibpthname='' ;;
6748 esac
6749
6750 : determine where manual pages are on this system
6751 echo " "
6752 case "$sysman" in
6753 '') 
6754         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6755         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6756         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6757         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6758         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6759         sysman=`./loc . /usr/man/man1 $syspath`
6760         ;;
6761 esac
6762 if $test -d "$sysman"; then
6763         echo "System manual is in $sysman." >&4
6764 else
6765         echo "Could not find manual pages in source form." >&4
6766 fi
6767
6768 : determine where manual pages go
6769 set man1dir man1dir none
6770 eval $prefixit
6771 $cat <<EOM
6772
6773 $spackage has manual pages available in source form.
6774 EOM
6775 case "$nroff" in
6776 nroff)
6777         echo "However, you don't have nroff, so they're probably useless to you."
6778         case "$man1dir" in
6779         '') man1dir="none";;
6780         esac;;
6781 esac
6782 echo "If you don't want the manual sources installed, answer 'none'."
6783 case "$man1dir" in
6784 ' ') dflt=none
6785         ;;
6786 '')
6787         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6788         lookpath="$lookpath $prefixexp/man/p_man/man1"
6789         lookpath="$lookpath $prefixexp/man/u_man/man1"
6790         lookpath="$lookpath $prefixexp/man/man.1"
6791         case "$sysman" in
6792         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6793         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6794         esac
6795         set dflt
6796         eval $prefixup
6797         ;;
6798 *)  dflt="$man1dir"
6799         ;;
6800 esac
6801 echo " "
6802 fn=dn+~
6803 rp="Where do the main $spackage manual pages (source) go?"
6804 . ./getfile
6805 if $test "X$man1direxp" != "X$ansexp"; then
6806         installman1dir=''
6807 fi
6808 man1dir="$ans"
6809 man1direxp="$ansexp"
6810 case "$man1dir" in
6811 '')     man1dir=' '
6812         installman1dir='';;
6813 esac
6814
6815 : Change installation prefix, if necessary.
6816 if $test X"$prefix" != X"$installprefix"; then
6817         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6818 else
6819         installman1dir="$man1direxp"
6820 fi
6821
6822 : What suffix to use on installed man pages
6823
6824 case "$man1dir" in
6825 ' ')
6826         man1ext='0'
6827         ;;
6828 *)
6829         rp="What suffix should be used for the main $spackage man pages?"
6830         case "$man1ext" in
6831         '')     case "$man1dir" in
6832                 *1)  dflt=1 ;;
6833                 *1p) dflt=1p ;;
6834                 *1pm) dflt=1pm ;;
6835                 *l) dflt=l;;
6836                 *n) dflt=n;;
6837                 *o) dflt=o;;
6838                 *p) dflt=p;;
6839                 *C) dflt=C;;
6840                 *L) dflt=L;;
6841                 *L1) dflt=L1;;
6842                 *) dflt=1;;
6843                 esac
6844                 ;;
6845         *)      dflt="$man1ext";;
6846         esac
6847         . ./myread
6848         man1ext="$ans"
6849         ;;
6850 esac
6851
6852 : see if we can have long filenames
6853 echo " "
6854 first=123456789abcdef
6855 $rm -f $first
6856 if (echo hi >$first) 2>/dev/null; then
6857         if $test -f 123456789abcde; then
6858                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6859                 val="$undef"
6860         else
6861                 echo 'You can have filenames longer than 14 characters.'>&4
6862                 val="$define"
6863         fi
6864 else
6865         $cat <<'EOM'
6866 You can't have filenames longer than 14 chars.
6867 You can't even think about them!
6868 EOM
6869         val="$undef"
6870 fi 
6871 set d_flexfnam
6872 eval $setvar
6873 $rm -rf 123456789abcde*
6874
6875 : determine where library module manual pages go
6876 set man3dir man3dir none
6877 eval $prefixit
6878 $cat <<EOM
6879
6880 $spackage has manual pages for many of the library modules.
6881 EOM
6882
6883 case "$nroff" in
6884 nroff)
6885         $cat <<'EOM'
6886 However, you don't have nroff, so they're probably useless to you.
6887 EOM
6888         case "$man3dir" in
6889         '') man3dir="none";;
6890         esac;;
6891 esac
6892
6893 case "$d_flexfnam" in
6894 undef)
6895         $cat <<'EOM'
6896 However, your system can't handle the long file names like File::Basename.3. 
6897 EOM
6898         case "$man3dir" in
6899         '') man3dir="none";;
6900         esac;;
6901 esac
6902
6903 echo "If you don't want the manual sources installed, answer 'none'."
6904 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6905 case "$man3dir" in
6906 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6907         if $test -d "$privlib/man/man3"; then
6908                 cat <<EOM >&4
6909
6910 WARNING:  Previous versions of perl installed man3 pages into
6911 $privlib/man/man3.  This version will suggest a 
6912 new default of $dflt.  
6913 EOM
6914                 tdflt=$dflt
6915                 dflt='n'
6916                 rp='Do you wish to preserve the old behavior?(y/n)'
6917                 . ./myread
6918                 case "$ans" in
6919                 y*) dflt="$privlib/man/man3" ;;
6920                 *)  dflt=$tdflt ;;
6921                 esac
6922     fi
6923         ;;
6924 *)      dflt="$man3dir" ;;
6925 esac
6926 case "$dflt" in
6927 ' ') dflt=none ;;
6928 esac
6929 echo " "
6930 fn=dn+~
6931 rp="Where do the $package library man pages (source) go?"
6932 . ./getfile
6933 man3dir="$ans"
6934 man3direxp="$ansexp"
6935 case "$man3dir" in
6936 '')     man3dir=' '
6937         installman3dir='';;
6938 esac
6939
6940 : Change installation prefix, if necessary.
6941 if $test X"$prefix" != X"$installprefix"; then
6942         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6943 else
6944         installman3dir="$man3direxp"
6945 fi
6946
6947 : What suffix to use on installed man pages
6948 case "$man3dir" in
6949 ' ')
6950         man3ext='0'
6951         ;;
6952 *)
6953         rp="What suffix should be used for the $package library man pages?"
6954         case "$man3ext" in
6955         '')     case "$man3dir" in
6956                 *3)  dflt=3 ;;
6957                 *3p) dflt=3p ;;
6958                 *3pm) dflt=3pm ;;
6959                 *l) dflt=l;;
6960                 *n) dflt=n;;
6961                 *o) dflt=o;;
6962                 *p) dflt=p;;
6963                 *C) dflt=C;;
6964                 *L) dflt=L;;
6965                 *L3) dflt=L3;;
6966                 *) dflt=3;;
6967                 esac
6968                 ;;
6969         *)      dflt="$man3ext";;
6970         esac
6971         . ./myread
6972         man3ext="$ans"
6973         ;;
6974 esac
6975
6976 : see if we have to deal with yellow pages, now NIS.
6977 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6978         if $test -f /usr/etc/nibindd; then
6979                 echo " "
6980                 echo "I'm fairly confident you're on a NeXT."
6981                 echo " "
6982                 rp='Do you get the hosts file via NetInfo?'
6983                 dflt=y
6984                 case "$hostcat" in
6985                 nidump*) ;;
6986                 '') ;;
6987                 *) dflt=n;;
6988                 esac
6989                 . ./myread
6990                 case "$ans" in
6991                 y*) hostcat='nidump hosts .';;
6992                 *)      case "$hostcat" in
6993                         nidump*) hostcat='';;
6994                         esac
6995                         ;;
6996                 esac
6997         fi
6998         case "$hostcat" in
6999         nidump*) ;;
7000         *)
7001                 case "$hostcat" in
7002                 *ypcat*) dflt=y;;
7003                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7004                                 dflt=y
7005                         else
7006                                 dflt=n
7007                         fi;;
7008                 *) dflt=n;;
7009                 esac
7010                 echo " "
7011                 rp='Are you getting the hosts file via yellow pages?'
7012                 . ./myread
7013                 case "$ans" in
7014                 y*) hostcat='ypcat hosts';;
7015                 *) hostcat='cat /etc/hosts';;
7016                 esac
7017                 ;;
7018         esac
7019 fi
7020 case "$hostcat" in
7021 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7022 esac
7023 case "$groupcat" in
7024 '') test -f /etc/group && groupcat='cat /etc/group';;
7025 esac
7026 case "$passcat" in
7027 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7028 esac
7029
7030 : now get the host name
7031 echo " "
7032 echo "Figuring out host name..." >&4
7033 case "$myhostname" in
7034 '') cont=true
7035         echo 'Maybe "hostname" will work...'
7036         if tans=`sh -c hostname 2>&1` ; then
7037                 myhostname=$tans
7038                 phostname=hostname
7039                 cont=''
7040         fi
7041         ;;
7042 *) cont='';;
7043 esac
7044 if $test "$cont"; then
7045         if ./xenix; then
7046                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7047                 if tans=`cat /etc/systemid 2>&1` ; then
7048                         myhostname=$tans
7049                         phostname='cat /etc/systemid'
7050                         echo "Whadyaknow.  Xenix always was a bit strange..."
7051                         cont=''
7052                 fi
7053         elif $test -r /etc/systemid; then
7054                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7055         fi
7056 fi
7057 if $test "$cont"; then
7058         echo 'No, maybe "uuname -l" will work...'
7059         if tans=`sh -c 'uuname -l' 2>&1` ; then
7060                 myhostname=$tans
7061                 phostname='uuname -l'
7062         else
7063                 echo 'Strange.  Maybe "uname -n" will work...'
7064                 if tans=`sh -c 'uname -n' 2>&1` ; then
7065                         myhostname=$tans
7066                         phostname='uname -n'
7067                 else
7068                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7069                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7070                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7071                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7072                         else
7073                                 case "$myhostname" in
7074                                 '') echo "Does this machine have an identity crisis or something?"
7075                                         phostname='';;
7076                                 *)
7077                                         echo "Well, you said $myhostname before..."
7078                                         phostname='echo $myhostname';;
7079                                 esac
7080                         fi
7081                 fi
7082         fi
7083 fi
7084 : you do not want to know about this
7085 set $myhostname
7086 myhostname=$1
7087
7088 : verify guess
7089 if $test "$myhostname" ; then
7090         dflt=y
7091         rp='Your host name appears to be "'$myhostname'".'" Right?"
7092         . ./myread
7093         case "$ans" in
7094         y*) ;;
7095         *) myhostname='';;
7096         esac
7097 fi
7098
7099 : bad guess or no guess
7100 while $test "X$myhostname" = X ; do
7101         dflt=''
7102         rp="Please type the (one word) name of your host:"
7103         . ./myread
7104         myhostname="$ans"
7105 done
7106
7107 : translate upper to lower if necessary
7108 case "$myhostname" in
7109 *[A-Z]*)
7110         echo "(Normalizing case in your host name)"
7111         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7112         ;;
7113 esac
7114
7115 case "$myhostname" in
7116 *.*)
7117         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7118         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7119         echo "(Trimming domain name from host name--host name is now $myhostname)"
7120         ;;
7121 *) case "$mydomain" in
7122         '')
7123                 {
7124                         test "X$hostcat" = "Xypcat hosts" &&
7125                         ypmatch "$myhostname" hosts 2>/dev/null |\
7126                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7127                         $test -s hosts
7128                 } || {
7129                         test "X$hostcat" != "X" &&
7130                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7131                                         /[       ]$myhostname[  . ]/p" > hosts
7132                 }
7133                 tmp_re="[       . ]"
7134                 if $test -f hosts; then
7135                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7136                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7137                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7138                                 hosts | $sort | $uniq | \
7139                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7140                         case `$echo X$dflt` in
7141                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7142                                 dflt=.
7143                                 ;;
7144                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7145                                 ;;
7146                         esac
7147                 else
7148                         echo "(I cannot locate a hosts database anywhere)"
7149                         dflt=.
7150                 fi
7151                 case "$dflt" in
7152                 .)
7153                         tans=`./loc resolv.conf X /etc /usr/etc`
7154                         if $test -f "$tans"; then
7155                                 echo "(Attempting domain name extraction from $tans)"
7156                                 dflt=.`$sed -n -e 's/   / /g' \
7157                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7158                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7159                                 case "$dflt" in
7160                                 .) dflt=.`$sed -n -e 's/        / /g' \
7161                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7162                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7163                                         ;;
7164                                 esac
7165                         fi
7166                         ;;
7167                 esac
7168                 case "$dflt" in
7169                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7170                         dflt=.`sh -c domainname 2>/dev/null`
7171                         case "$dflt" in
7172                         '') dflt='.';;
7173                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7174                         esac
7175                         ;;
7176                 esac
7177                 case "$dflt" in
7178                 .) echo "(Lost all hope -- silly guess then)"
7179                         dflt='.uucp'
7180                         ;;
7181                 esac
7182                 $rm -f hosts
7183                 ;;
7184         *) dflt="$mydomain";;
7185         esac;;
7186 esac
7187 echo " "
7188 rp="What is your domain name?"
7189 . ./myread
7190 tans="$ans"
7191 case "$ans" in
7192 '') ;;
7193 .*) ;;
7194 *) tans=".$tans";;
7195 esac
7196 mydomain="$tans"
7197
7198 : translate upper to lower if necessary
7199 case "$mydomain" in
7200 *[A-Z]*)
7201         echo "(Normalizing case in your domain name)"
7202         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7203         ;;
7204 esac
7205
7206 : a little sanity check here
7207 case "$phostname" in
7208 '') ;;
7209 *)
7210         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7211         $myhostname$mydomain|$myhostname) ;;
7212         *)
7213                 case "$phostname" in
7214                 sed*)
7215                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7216                         ;;
7217                 *)
7218                         echo "(That doesn't agree with your $phostname command, by the way.)"
7219                         ;;
7220                 esac
7221         ;;
7222         esac
7223         ;;
7224 esac
7225
7226 $cat <<EOM
7227
7228 I need to get your e-mail address in Internet format if possible, i.e.
7229 something like user@host.domain. Please answer accurately since I have
7230 no easy means to double check it. The default value provided below
7231 is most probably close to reality but may not be valid from outside
7232 your organization...
7233
7234 EOM
7235 cont=x
7236 while test "$cont"; do
7237         case "$cf_email" in
7238         '') dflt="$cf_by@$myhostname$mydomain";;
7239         *) dflt="$cf_email";;
7240         esac
7241         rp='What is your e-mail address?'
7242         . ./myread
7243         cf_email="$ans"
7244         case "$cf_email" in
7245         *@*.*) cont='' ;;
7246         *)
7247                 rp='Address does not look like an Internet one.  Use it anyway?'
7248                 case "$fastread" in
7249                 yes) dflt=y ;;
7250                 *) dflt=n ;;
7251                 esac
7252                 . ./myread
7253                 case "$ans" in
7254                 y*) cont='' ;;
7255                 *) echo " " ;;
7256                 esac
7257                 ;;
7258         esac
7259 done
7260
7261 $cat <<EOM
7262
7263 If you or somebody else will be maintaining perl at your site, please
7264 fill in the correct e-mail address here so that they may be contacted
7265 if necessary. Currently, the "perlbug" program included with perl
7266 will send mail to this address in addition to perlbug@perl.org. You may
7267 enter "none" for no administrator.
7268
7269 EOM
7270 case "$perladmin" in
7271 '') dflt="$cf_email";;
7272 *) dflt="$perladmin";;
7273 esac
7274 rp='Perl administrator e-mail address'
7275 . ./myread
7276 perladmin="$ans"
7277
7278 : determine whether to only install version-specific parts.
7279 echo " "
7280 $cat <<EOM
7281 Do you want to install only the version-specific parts of the perl
7282 distribution?  Usually you do *not* want to do this.
7283 EOM
7284 case "$versiononly" in
7285 "$define"|[Yy]*|true) dflt='y' ;;
7286 *) dflt='n';
7287 esac
7288 rp="Do you want to install only the version-specific parts of perl?"
7289 . ./myread
7290 case "$ans" in
7291 [yY]*)  val="$define";;
7292 *)      val="$undef" ;;
7293 esac
7294 set versiononly
7295 eval $setvar
7296
7297 : figure out how to guarantee perl startup
7298 case "$startperl" in
7299 '')
7300         case "$sharpbang" in
7301         *!)
7302                 $cat <<EOH
7303
7304 I can use the #! construct to start perl on your system. This will
7305 make startup of perl scripts faster, but may cause problems if you
7306 want to share those scripts and perl is not in a standard place
7307 ($binexp/perl) on all your platforms. The alternative is to force
7308 a shell by starting the script with a single ':' character.
7309
7310 EOH
7311                 case "$versiononly" in
7312                 "$define")      dflt="$binexp/perl$version";;  
7313                 *)              dflt="$binexp/perl";;
7314                 esac
7315                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7316                 . ./myread
7317                 case "$ans" in
7318                 none)   startperl=": # use perl";;
7319                 *)      startperl="#!$ans"
7320                         if $test 30 -lt `echo "$ans" | wc -c`; then
7321                                 $cat >&4 <<EOM
7322
7323 WARNING:  Some systems limit the #! command to 32 characters.
7324 If you experience difficulty running Perl scripts with #!, try
7325 installing Perl in a directory with a shorter pathname.
7326
7327 EOM
7328                         fi ;;
7329                 esac
7330                 ;;
7331         *) startperl=": # use perl"
7332                 ;;
7333         esac
7334         ;;
7335 esac
7336 echo "I'll use $startperl to start perl scripts."
7337
7338 : figure best path for perl in scripts
7339 case "$perlpath" in
7340 '')
7341         perlpath="$binexp/perl"
7342         case "$startperl" in
7343         *!*) ;;
7344         *)
7345                 $cat <<EOH
7346
7347 I will use the "eval 'exec'" idiom to start Perl on your system.
7348 I can use the full path of your Perl binary for this purpose, but
7349 doing so may cause problems if you want to share those scripts and
7350 Perl is not always in a standard place ($binexp/perl).
7351
7352 EOH
7353                 dflt="$binexp/perl"
7354                 rp="What path shall I use in \"eval 'exec'\"?"
7355                 . ./myread
7356                 perlpath="$ans"
7357                 ;;
7358         esac
7359         ;;
7360 esac
7361 case "$startperl" in
7362 *!*)    ;;
7363 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7364 esac
7365
7366 : determine where public executable scripts go
7367 set scriptdir scriptdir
7368 eval $prefixit
7369 case "$scriptdir" in
7370 '')
7371         dflt="$bin"
7372         : guess some guesses
7373         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7374         $test -d /usr/share/bin     && dflt=/usr/share/bin
7375         $test -d /usr/local/script  && dflt=/usr/local/script
7376         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7377         $test -d $prefixexp/script  && dflt=$prefixexp/script
7378         set dflt
7379         eval $prefixup
7380         ;;
7381 *)  dflt="$scriptdir"
7382         ;;
7383 esac
7384 $cat <<EOM
7385  
7386 Some installations have a separate directory just for executable scripts so
7387 that they can mount it across multiple architectures but keep the scripts in
7388 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7389 Or you might just lump your scripts in with all your other executables.
7390  
7391 EOM
7392 fn=d~
7393 rp='Where do you keep publicly executable scripts?'
7394 . ./getfile
7395 if $test "X$ansexp" != "X$scriptdirexp"; then
7396         installscript=''
7397 fi
7398 scriptdir="$ans"
7399 scriptdirexp="$ansexp"
7400 : Change installation prefix, if necessary.
7401 if $test X"$prefix" != X"$installprefix"; then
7402         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7403 else
7404         installscript="$scriptdirexp"
7405 fi
7406
7407 : determine where add-on public executables go
7408 case "$sitebin" in
7409 '')     dflt=$siteprefix/bin ;;
7410 *)      dflt=$sitebin ;;
7411 esac
7412 fn=d~
7413 rp='Pathname where the add-on public executables should be installed?'
7414 . ./getfile
7415 sitebin="$ans"
7416 sitebinexp="$ansexp"
7417 : Change installation prefix, if necessary.
7418 if $test X"$prefix" != X"$installprefix"; then
7419         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7420 else
7421         installsitebin="$sitebinexp"
7422 fi
7423
7424 case "$useperlio" in
7425 $define|true|[yY]*)     dflt='y';;
7426 *) dflt='n';;
7427 esac
7428 cat <<EOM
7429
7430 Previous version of $package used the standard IO mechanisms as defined
7431 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7432 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7433 the default.  This abstraction layer can use AT&T's sfio (if you already
7434 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7435 problems with some extension modules.  Using PerlIO with stdio is safe,
7436 but it is slower than plain stdio and therefore is not the default.
7437
7438 If this doesn't make any sense to you, just accept the default '$dflt'.
7439 EOM
7440 rp='Use the experimental PerlIO abstraction layer?'
7441 . ./myread
7442 case "$ans" in
7443 y|Y) 
7444         val="$define"
7445         ;;     
7446 *)      
7447         echo "Ok, doing things the stdio way"
7448         val="$undef"
7449         ;;
7450 esac
7451 set useperlio
7452 eval $setvar 
7453
7454 case "$vendorprefix" in
7455 '')     d_vendorbin="$undef"
7456         vendorbin=''
7457         vendorbinexp=''
7458         ;;
7459 *)      d_vendorbin="$define"
7460         : determine where vendor-supplied executables go.
7461         case "$vendorbin" in
7462         '') dflt=$vendorprefix/bin ;;
7463         *)      dflt="$vendorbin" ;;
7464         esac
7465         fn=d~+
7466         rp='Pathname for the vendor-supplied executables directory?'
7467         . ./getfile
7468         vendorbin="$ans"
7469         vendorbinexp="$ansexp"
7470         ;;
7471 esac
7472 : Change installation prefix, if necessary.
7473 if $test X"$prefix" != X"$installprefix"; then
7474         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7475 else
7476         installvendorbin="$vendorbinexp"
7477 fi
7478
7479 : see if qgcvt exists
7480 set qgcvt d_qgcvt
7481 eval $inlibc
7482
7483 echo " "
7484
7485 if $test X"$d_longdbl" = X"$define"; then
7486
7487 echo "Checking how to print long doubles..." >&4
7488
7489 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7490         $cat >try.c <<'EOCP'
7491 #include <sys/types.h>
7492 #include <stdio.h>
7493 int main() {
7494   double d = 123.456;
7495   printf("%.3f\n", d);
7496 }
7497 EOCP
7498         set try
7499         if eval $compile; then
7500                 yyy=`./try$exe_ext`
7501                 case "$yyy" in
7502                 123.456)
7503                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7504                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7505                         echo "We will use %f."
7506                         ;;
7507                 esac
7508         fi
7509 fi
7510
7511 if $test X"$sPRIfldbl" = X; then
7512         $cat >try.c <<'EOCP'
7513 #include <sys/types.h>
7514 #include <stdio.h>
7515 int main() {
7516   long double d = 123.456;
7517   printf("%.3llf\n", d);
7518 }
7519 EOCP
7520         set try
7521         if eval $compile; then
7522                 yyy=`./try$exe_ext`
7523                 case "$yyy" in
7524                 123.456)
7525                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7526                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7527                         echo "We will use %llf."
7528                         ;;
7529                 esac
7530         fi
7531 fi
7532
7533 if $test X"$sPRIfldbl" = X; then
7534         $cat >try.c <<'EOCP'
7535 #include <sys/types.h>
7536 #include <stdio.h>
7537 int main() {
7538   long double d = 123.456;
7539   printf("%.3Lf\n", d);
7540 }
7541 EOCP
7542         set try
7543         if eval $compile; then
7544                 yyy=`./try$exe_ext`
7545                 case "$yyy" in
7546                 123.456)
7547                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7548                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7549                         echo "We will use %Lf."
7550                         ;;
7551                 esac
7552         fi
7553 fi
7554
7555 if $test X"$sPRIfldbl" = X; then
7556         $cat >try.c <<'EOCP'
7557 #include <sys/types.h>
7558 #include <stdio.h>
7559 int main() {
7560   long double d = 123.456;
7561   printf("%.3lf\n", d);
7562 }
7563 EOCP
7564         set try
7565         if eval $compile; then
7566                 yyy=`./try$exe_ext`
7567                 case "$yyy" in
7568                 123.456)
7569                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7570                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7571                         echo "We will use %lf."
7572                         ;;
7573                 esac
7574         fi
7575 fi
7576
7577 if $test X"$sPRIfldbl" = X; then
7578         echo "Cannot figure out how to print long doubles." >&4
7579 else
7580         sSCNfldbl=$sPRIfldbl    # expect consistency
7581 fi
7582
7583 $rm -f try try.*
7584
7585 fi # d_longdbl
7586
7587 case "$sPRIfldbl" in
7588 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7589         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7590         d_SCNfldbl="$undef";
7591         ;;
7592 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7593         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7594         d_SCNfldbl="$define";
7595         ;;
7596 esac
7597
7598 : Check how to convert floats to strings.
7599 echo " "
7600 echo "Checking for an efficient way to convert floats to strings."
7601 echo " " > try.c
7602 case "$uselongdouble" in
7603 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7604 esac
7605 case "$d_longdbl" in
7606 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7607 esac
7608 case "$d_PRIgldbl" in
7609 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7610 esac
7611 $cat >>try.c <<EOP
7612 #ifdef TRY_gconvert
7613 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7614 char *myname = "gconvert";
7615 #endif
7616 #ifdef TRY_gcvt
7617 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7618 char *myname = "gcvt";
7619 #endif
7620 #ifdef TRY_qgcvt
7621 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7622 char *myname = "qgcvt";
7623 #define DOUBLETYPE long double
7624 #endif
7625 #ifdef TRY_sprintf
7626 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7627 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7628 #else
7629 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7630 #endif
7631 char *myname = "sprintf";
7632 #endif
7633
7634 #ifndef DOUBLETYPE
7635 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7636 #define DOUBLETYPE long double
7637 #else
7638 #define DOUBLETYPE double
7639 #endif
7640 #endif
7641
7642 #include <stdio.h>
7643
7644 #define I_STDLIB $i_stdlib
7645 #ifdef I_STDLIB
7646 #include <stdlib.h>
7647 #endif
7648
7649 int
7650 checkit(expect, got)
7651 char *expect;
7652 char *got;
7653 {
7654     if (strcmp(expect, got)) {
7655                 printf("%s oddity:  Expected %s, got %s\n",
7656                         myname, expect, got);
7657                 exit(1);
7658         }
7659 }
7660
7661 int main()
7662
7663         char buf[64]; 
7664         buf[63] = '\0';
7665
7666         /* This must be 1st test on (which?) platform */
7667         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7668         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7669         checkit("0.1", buf);
7670
7671         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7672         checkit("1", buf);
7673
7674         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7675         checkit("1.1", buf);
7676
7677         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7678         checkit("1.01", buf);
7679
7680         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7681         checkit("1.001", buf);
7682
7683         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7684         checkit("1.0001", buf);
7685
7686         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7687         checkit("1.00001", buf);
7688
7689         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7690         checkit("1.000001", buf);
7691
7692         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7693         checkit("0", buf);
7694
7695         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7696         checkit("-1", buf);
7697
7698         /* Some Linux gcvt's give 1.e+5 here. */
7699         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7700         checkit("100000", buf);
7701         
7702         /* Some Linux gcvt's give -1.e+5 here. */
7703         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7704         checkit("-100000", buf);
7705
7706         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7707         checkit("123.456", buf);
7708
7709         exit(0);
7710 }
7711 EOP
7712 case "$d_Gconvert" in
7713 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7714 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7715 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7716 *) xxx_list='gconvert gcvt sprintf' ;;
7717 esac
7718
7719 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7720 "$define$define$define")
7721     # for long doubles prefer first qgcvt, then sprintf
7722     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7723     xxx_list="sprintf $xxx_list"
7724     case "$d_qgcvt" in
7725     "$define") xxx_list="qgcvt $xxx_list" ;;
7726     esac
7727     ;;
7728 esac
7729
7730 for xxx_convert in $xxx_list; do
7731         echo "Trying $xxx_convert..."
7732         $rm -f try try$_o
7733         set try -DTRY_$xxx_convert
7734         if eval $compile; then
7735                 echo "$xxx_convert() found." >&4
7736                 if ./try; then
7737                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7738                         break;
7739                 else
7740                         echo "...But $xxx_convert didn't work as I expected."
7741                 fi
7742         else
7743                 echo "$xxx_convert NOT found." >&4
7744         fi
7745 done
7746         
7747 case "$xxx_convert" in
7748 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7749 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7750 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7751 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7752    "$define$define$define")
7753       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7754    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7755    esac
7756    ;;  
7757 esac
7758
7759 : see if _fwalk exists
7760 set fwalk d__fwalk
7761 eval $inlibc
7762
7763 : Initialize h_fcntl
7764 h_fcntl=false
7765
7766 : Initialize h_sysfile
7767 h_sysfile=false
7768
7769 : access call always available on UNIX
7770 set access d_access
7771 eval $inlibc
7772
7773 : locate the flags for 'access()'
7774 case "$d_access" in
7775 "$define")
7776         echo " "
7777         $cat >access.c <<'EOCP'
7778 #include <sys/types.h>
7779 #ifdef I_FCNTL
7780 #include <fcntl.h>
7781 #endif
7782 #ifdef I_SYS_FILE
7783 #include <sys/file.h>
7784 #endif
7785 #ifdef I_UNISTD
7786 #include <unistd.h>
7787 #endif
7788 int main() {
7789         exit(R_OK);
7790 }
7791 EOCP
7792         : check sys/file.h first, no particular reason here
7793         if $test `./findhdr sys/file.h` && \
7794                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7795                 h_sysfile=true;
7796                 echo "<sys/file.h> defines the *_OK access constants." >&4
7797         elif $test `./findhdr fcntl.h` && \
7798                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7799                 h_fcntl=true;
7800                 echo "<fcntl.h> defines the *_OK access constants." >&4
7801         elif $test `./findhdr unistd.h` && \
7802                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7803                 echo "<unistd.h> defines the *_OK access constants." >&4
7804         else
7805                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7806         fi
7807         ;;
7808 esac
7809 $rm -f access*
7810
7811 : see if accessx exists
7812 set accessx d_accessx
7813 eval $inlibc
7814
7815 : see if alarm exists
7816 set alarm d_alarm
7817 eval $inlibc
7818
7819 : see if atolf exists
7820 set atolf d_atolf
7821 eval $inlibc
7822
7823 : see if atoll exists
7824 set atoll d_atoll
7825 eval $inlibc
7826
7827 : Look for GNU-cc style attribute checking
7828 echo " "
7829 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7830 $cat >attrib.c <<'EOCP'
7831 #include <stdio.h>
7832 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7833 EOCP
7834 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7835         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7836                 echo "Your C compiler doesn't fully support __attribute__."
7837                 val="$undef"
7838         else
7839                 echo "Your C compiler supports __attribute__."
7840                 val="$define"
7841         fi
7842 else
7843         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7844         val="$undef"
7845 fi
7846 set d_attribut
7847 eval $setvar
7848 $rm -f attrib*
7849
7850 : see if bcmp exists
7851 set bcmp d_bcmp
7852 eval $inlibc
7853
7854 : see if bcopy exists
7855 set bcopy d_bcopy
7856 eval $inlibc
7857
7858 : see if this is a unistd.h system
7859 set unistd.h i_unistd
7860 eval $inhdr
7861
7862 : see if getpgrp exists
7863 set getpgrp d_getpgrp
7864 eval $inlibc
7865
7866 case "$d_getpgrp" in
7867 "$define")
7868         echo " "
7869         echo "Checking to see which flavor of getpgrp is in use..."
7870         $cat >set.c <<EOP
7871 #$i_unistd I_UNISTD
7872 #include <sys/types.h>
7873 #ifdef I_UNISTD
7874 #  include <unistd.h>
7875 #endif
7876 int main()
7877 {
7878         if (getuid() == 0) {
7879                 printf("(I see you are running Configure as super-user...)\n");
7880                 setuid(1);
7881         }
7882 #ifdef TRY_BSD_PGRP
7883         if (getpgrp(1) == 0)
7884                 exit(0);
7885 #else
7886         if (getpgrp() > 0)
7887                 exit(0);
7888 #endif
7889         exit(1);
7890 }
7891 EOP
7892         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7893                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7894                 val="$define"
7895         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7896                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7897                 val="$undef"
7898         else
7899                 echo "I can't seem to compile and run the test program."
7900                 if ./usg; then
7901                         xxx="a USG one, i.e. you use getpgrp()."
7902                 else
7903                         # SVR4 systems can appear rather BSD-ish.
7904                         case "$i_unistd" in
7905                         $undef)
7906                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7907                                 val="$define"
7908                                 ;;
7909                         $define)
7910                                 xxx="probably a USG one, i.e. you use getpgrp()."
7911                                 val="$undef"
7912                                 ;;
7913                         esac
7914                 fi
7915                 echo "Assuming your getpgrp is $xxx" >&4
7916         fi
7917         ;;
7918 *) val="$undef";;
7919 esac
7920 set d_bsdgetpgrp
7921 eval $setvar
7922 $rm -f set set.c
7923
7924 : see if setpgrp exists
7925 set setpgrp d_setpgrp
7926 eval $inlibc
7927
7928 case "$d_setpgrp" in
7929 "$define")
7930         echo " "
7931         echo "Checking to see which flavor of setpgrp is in use..."
7932         $cat >set.c <<EOP
7933 #$i_unistd I_UNISTD
7934 #include <sys/types.h>
7935 #ifdef I_UNISTD
7936 #  include <unistd.h>
7937 #endif
7938 int main()
7939 {
7940         if (getuid() == 0) {
7941                 printf("(I see you are running Configure as super-user...)\n");
7942                 setuid(1);
7943         }
7944 #ifdef TRY_BSD_PGRP
7945         if (-1 == setpgrp(1, 1))
7946                 exit(0);
7947 #else
7948         if (setpgrp() != -1)
7949                 exit(0);
7950 #endif
7951         exit(1);
7952 }
7953 EOP
7954         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7955                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7956                 val="$define"
7957         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7958                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7959                 val="$undef"
7960         else
7961                 echo "(I can't seem to compile and run the test program.)"
7962                 if ./usg; then
7963                         xxx="a USG one, i.e. you use setpgrp()."
7964                 else
7965                         # SVR4 systems can appear rather BSD-ish.
7966                         case "$i_unistd" in
7967                         $undef)
7968                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7969                                 val="$define"
7970                                 ;;
7971                         $define)
7972                                 xxx="probably a USG one, i.e. you use setpgrp()."
7973                                 val="$undef"
7974                                 ;;
7975                         esac
7976                 fi
7977                 echo "Assuming your setpgrp is $xxx" >&4
7978         fi
7979         ;;
7980 *) val="$undef";;
7981 esac
7982 set d_bsdsetpgrp
7983 eval $setvar
7984 $rm -f set set.c
7985 : see if bzero exists
7986 set bzero d_bzero
7987 eval $inlibc
7988
7989 : see if signal is declared as pointer to function returning int or void
7990 echo " "
7991 xxx=`./findhdr signal.h`
7992 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7993 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7994         echo "You have int (*signal())() instead of void." >&4
7995         val="$undef"
7996 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7997         echo "You have void (*signal())()." >&4
7998         val="$define"
7999 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8000         echo "You have int (*signal())() instead of void." >&4
8001         val="$undef"
8002 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8003         echo "You have void (*signal())()." >&4
8004         val="$define"
8005 else
8006         case "$d_voidsig" in
8007         '')
8008         echo "I can't determine whether signal handler returns void or int..." >&4
8009                 dflt=void
8010                 rp="What type does your signal handler return?"
8011                 . ./myread
8012                 case "$ans" in
8013                 v*) val="$define";;
8014                 *) val="$undef";;
8015                 esac;;
8016         "$define")
8017                 echo "As you already told me, signal handler returns void." >&4
8018                 val="$define"
8019                 ;;
8020         *)      echo "As you already told me, signal handler returns int." >&4
8021                 val="$undef"
8022                 ;;
8023         esac
8024 fi
8025 set d_voidsig
8026 eval $setvar
8027 case "$d_voidsig" in
8028 "$define") signal_t="void";;
8029 *) signal_t="int";;
8030 esac
8031 $rm -f $$.tmp
8032
8033 : check for ability to cast large floats to 32-bit ints.
8034 echo " "
8035 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8036 if $test "$intsize" -ge 4; then
8037         xxx=int
8038 else
8039         xxx=long
8040 fi
8041 $cat >try.c <<EOCP
8042 #include <stdio.h>
8043 #include <sys/types.h>
8044 #include <signal.h>
8045 $signal_t blech(s) int s; { exit(3); }
8046 int main()
8047 {
8048         $xxx i32;
8049         double f, g;
8050         int result = 0;
8051         char str[16];
8052         signal(SIGFPE, blech);
8053
8054         /* Don't let compiler optimize the test away.  Store the number 
8055            in a writable string for gcc to pass to sscanf under HP/UX.
8056         */
8057         sprintf(str, "2147483647");
8058         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8059         g = 10 * f;
8060         i32  = ($xxx) g;
8061
8062         /* x86 processors will probably give 0x8000 0000, which is a
8063        sign change.  We don't want that.  We want to mimic SPARC
8064            behavior here, which is to preserve the sign and give
8065            back 0x7fff ffff.
8066         */
8067         if (i32 != ($xxx) f)
8068                 result |= 1;
8069         exit(result);
8070 }
8071 EOCP
8072 set try
8073 if eval $compile_ok; then
8074         ./try
8075         yyy=$?
8076 else
8077         echo "(I can't seem to compile the test program--assuming it can't)"
8078         yyy=1
8079 fi
8080 case "$yyy" in
8081 0)      val="$define"
8082         echo "Yup, it can."
8083         ;;
8084 *)      val="$undef"
8085         echo "Nope, it can't."
8086         ;;
8087 esac
8088 set d_casti32
8089 eval $setvar
8090 $rm -f try try.*
8091
8092 : check for ability to cast negative floats to unsigned
8093 echo " "
8094 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8095 $cat >try.c <<EOCP
8096 #include <stdio.h>
8097 #include <sys/types.h>
8098 #include <signal.h>
8099 $signal_t blech(s) int s; { exit(7); }
8100 $signal_t blech_in_list(s) int s; { exit(4); }
8101 unsigned long dummy_long(p) unsigned long p; { return p; }
8102 unsigned int dummy_int(p) unsigned int p; { return p; }
8103 unsigned short dummy_short(p) unsigned short p; { return p; }
8104 int main()
8105 {
8106         double f;
8107         unsigned long along;
8108         unsigned int aint;
8109         unsigned short ashort;
8110         int result = 0;
8111         char str[16];
8112         
8113         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8114            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8115            optimized the whole file away
8116         */
8117         /* Store the number in a writable string for gcc to pass to 
8118            sscanf under HP/UX.
8119         */
8120         sprintf(str, "-123");
8121         sscanf(str, "%lf", &f);  /* f = -123.; */
8122
8123         signal(SIGFPE, blech);
8124         along = (unsigned long)f;
8125         aint = (unsigned int)f;
8126         ashort = (unsigned short)f;
8127         if (along != (unsigned long)-123)
8128                 result |= 1;
8129         if (aint != (unsigned int)-123)
8130                 result |= 1;
8131         if (ashort != (unsigned short)-123)
8132                 result |= 1;
8133         sprintf(str, "1073741824.");
8134         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8135         f = f + f;
8136         along = 0;
8137         along = (unsigned long)f;
8138         if (along != 0x80000000)
8139                 result |= 2;
8140         f -= 1.;
8141         along = 0;
8142         along = (unsigned long)f;
8143         if (along != 0x7fffffff)
8144                 result |= 1;
8145         f += 2.;
8146         along = 0;
8147         along = (unsigned long)f;
8148         if (along != 0x80000001)
8149                 result |= 2;
8150         if (result)
8151                 exit(result);
8152         signal(SIGFPE, blech_in_list);
8153         sprintf(str, "123.");
8154         sscanf(str, "%lf", &f);  /* f = 123.; */
8155         along = dummy_long((unsigned long)f);
8156         aint = dummy_int((unsigned int)f);
8157         ashort = dummy_short((unsigned short)f);
8158         if (along != (unsigned long)123)
8159                 result |= 4;
8160         if (aint != (unsigned int)123)
8161                 result |= 4;
8162         if (ashort != (unsigned short)123)
8163                 result |= 4;
8164         exit(result);
8165
8166 }
8167 EOCP
8168 set try
8169 if eval $compile_ok; then
8170         ./try
8171         castflags=$?
8172 else
8173         echo "(I can't seem to compile the test program--assuming it can't)"
8174         castflags=7
8175 fi
8176 case "$castflags" in
8177 0)      val="$define"
8178         echo "Yup, it can."
8179         ;;
8180 *)      val="$undef"
8181         echo "Nope, it can't."
8182         ;;
8183 esac
8184 set d_castneg
8185 eval $setvar
8186 $rm -f try.*
8187
8188 : see if vprintf exists
8189 echo " "
8190 if set vprintf val -f d_vprintf; eval $csym; $val; then
8191         echo 'vprintf() found.' >&4
8192         val="$define"
8193         $cat >vprintf.c <<'EOF'
8194 #include <varargs.h>
8195
8196 int main() { xxx("foo"); }
8197
8198 xxx(va_alist)
8199 va_dcl
8200 {
8201         va_list args;
8202         char buf[10];
8203
8204         va_start(args);
8205         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8206 }
8207 EOF
8208         set vprintf
8209         if eval $compile && ./vprintf; then
8210                 echo "Your vsprintf() returns (int)." >&4
8211                 val2="$undef"
8212         else
8213                 echo "Your vsprintf() returns (char*)." >&4
8214                 val2="$define"
8215         fi
8216 else
8217         echo 'vprintf() NOT found.' >&4
8218                 val="$undef"
8219                 val2="$undef"
8220 fi
8221 set d_vprintf
8222 eval $setvar
8223 val=$val2
8224 set d_charvspr
8225 eval $setvar
8226
8227 : see if chown exists
8228 set chown d_chown
8229 eval $inlibc
8230
8231 : see if chroot exists
8232 set chroot d_chroot
8233 eval $inlibc
8234
8235 : see if chsize exists
8236 set chsize d_chsize
8237 eval $inlibc
8238
8239 : check for const keyword
8240 echo " "
8241 echo 'Checking to see if your C compiler knows about "const"...' >&4
8242 $cat >const.c <<'EOCP'
8243 typedef struct spug { int drokk; } spug;
8244 int main()
8245 {
8246         const char *foo;
8247         const spug y;
8248 }
8249 EOCP
8250 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8251         val="$define"
8252         echo "Yup, it does."
8253 else
8254         val="$undef"
8255         echo "Nope, it doesn't."
8256 fi
8257 set d_const
8258 eval $setvar
8259
8260 : see if crypt exists
8261 echo " "
8262 if set crypt val -f d_crypt; eval $csym; $val; then
8263         echo 'crypt() found.' >&4
8264         val="$define"
8265         cryptlib=''
8266 else
8267         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8268         if $test -z "$cryptlib"; then
8269                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8270         else
8271                 cryptlib=-lcrypt
8272         fi
8273         if $test -z "$cryptlib"; then
8274                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8275         else
8276                 cryptlib=-lcrypt
8277         fi
8278         if $test -z "$cryptlib"; then
8279                 cryptlib=`./loc libcrypt$_a "" $libpth`
8280         else
8281                 cryptlib=-lcrypt
8282         fi
8283         if $test -z "$cryptlib"; then
8284                 echo 'crypt() NOT found.' >&4
8285                 val="$undef"
8286         else
8287                 val="$define"
8288         fi
8289 fi
8290 set d_crypt
8291 eval $setvar
8292
8293 : get csh whereabouts
8294 case "$csh" in
8295 'csh') val="$undef" ;;
8296 *) val="$define" ;;
8297 esac
8298 set d_csh
8299 eval $setvar
8300 : Respect a hint or command line value for full_csh.
8301 case "$full_csh" in
8302 '') full_csh=$csh ;;
8303 esac
8304
8305 : see if cuserid exists
8306 set cuserid d_cuserid
8307 eval $inlibc
8308
8309 : see if this is a limits.h system
8310 set limits.h i_limits
8311 eval $inhdr
8312
8313 : see if this is a float.h system
8314 set float.h i_float
8315 eval $inhdr
8316
8317 : See if number of significant digits in a double precision number is known
8318 echo " "
8319 $cat >dbl_dig.c <<EOM
8320 #$i_limits I_LIMITS
8321 #$i_float I_FLOAT
8322 #ifdef I_LIMITS
8323 #include <limits.h>
8324 #endif
8325 #ifdef I_FLOAT
8326 #include <float.h>
8327 #endif
8328 #ifdef DBL_DIG
8329 printf("Contains DBL_DIG");
8330 #endif
8331 EOM
8332 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8333 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8334         echo "DBL_DIG found." >&4
8335         val="$define"
8336 else
8337         echo "DBL_DIG NOT found." >&4
8338         val="$undef"
8339 fi
8340 $rm -f dbl_dig.?
8341 set d_dbl_dig
8342 eval $setvar
8343
8344 : see if difftime exists
8345 set difftime d_difftime
8346 eval $inlibc
8347
8348 : see if this is a dirent system
8349 echo " "
8350 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8351         val="$define"
8352         echo "<dirent.h> found." >&4
8353 else
8354         val="$undef"
8355         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8356                 echo "<sys/dir.h> found." >&4
8357                 echo " "
8358         else
8359                 xinc=`./findhdr sys/ndir.h`
8360         fi
8361         echo "<dirent.h> NOT found." >&4
8362 fi
8363 set i_dirent
8364 eval $setvar
8365
8366 : Look for type of directory structure.
8367 echo " "
8368 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8369
8370 case "$direntrytype" in
8371 ''|' ')
8372         case "$i_dirent" in
8373         $define) guess1='struct dirent' ;;
8374         *) guess1='struct direct'  ;;
8375         esac
8376         ;;
8377 *)      guess1="$direntrytype"
8378         ;;
8379 esac
8380
8381 case "$guess1" in
8382 'struct dirent') guess2='struct direct' ;;
8383 *) guess2='struct dirent' ;;
8384 esac
8385                 
8386 if $contains "$guess1" try.c >/dev/null 2>&1; then
8387         direntrytype="$guess1"
8388         echo "Your directory entries are $direntrytype." >&4
8389 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8390         direntrytype="$guess2"
8391         echo "Your directory entries seem to be $direntrytype." >&4
8392 else
8393         echo "I don't recognize your system's directory entries." >&4
8394         rp="What type is used for directory entries on this system?"
8395         dflt="$guess1"
8396         . ./myread
8397         direntrytype="$ans"
8398 fi
8399 $rm -f try.c
8400
8401
8402 : see if the directory entry stores field length
8403 echo " "
8404 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8405 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8406         echo "Good, your directory entry keeps length information in d_namlen." >&4
8407         val="$define"
8408 else
8409         echo "Your directory entry does not know about the d_namlen field." >&4
8410         val="$undef"
8411 fi
8412 set d_dirnamlen
8413 eval $setvar
8414 $rm -f try.c
8415
8416 : see if dlerror exists
8417 xxx_runnm="$runnm"
8418 runnm=false
8419 set dlerror d_dlerror
8420 eval $inlibc
8421 runnm="$xxx_runnm"
8422
8423 : see if dlfcn is available
8424 set dlfcn.h i_dlfcn
8425 eval $inhdr
8426
8427 case "$usedl" in
8428 $define|y|true)
8429         $cat << EOM
8430
8431 On a few systems, the dynamically loaded modules that perl generates and uses
8432 will need a different extension than shared libs. The default will probably
8433 be appropriate.
8434
8435 EOM
8436         case "$dlext" in
8437         '')     dflt="$so" ;;
8438         *)      dflt="$dlext" ;;
8439         esac
8440         rp='What is the extension of dynamically loaded modules'
8441         . ./myread
8442         dlext="$ans"
8443         ;;
8444 *)
8445         dlext="none"
8446         ;;
8447 esac
8448
8449 : Check if dlsym need a leading underscore
8450 echo " "
8451 val="$undef"
8452
8453 case "$dlsrc" in
8454 dl_dlopen.xs)
8455         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8456         $cat >dyna.c <<'EOM'
8457 fred () { }
8458 EOM
8459
8460 $cat >fred.c<<EOM
8461
8462 #include <stdio.h>
8463 #$i_dlfcn I_DLFCN
8464 #ifdef I_DLFCN
8465 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8466 #else
8467 #include <sys/types.h>
8468 #include <nlist.h>
8469 #include <link.h>
8470 #endif
8471
8472 extern int fred() ;
8473
8474 int main()
8475 {
8476     void * handle ;
8477     void * symbol ;
8478 #ifndef RTLD_LAZY
8479     int mode = 1 ;
8480 #else
8481     int mode = RTLD_LAZY ;
8482 #endif
8483     handle = dlopen("./dyna.$dlext", mode) ;
8484     if (handle == NULL) {
8485         printf ("1\n") ;
8486         fflush (stdout) ;
8487         exit(0);
8488     }
8489     symbol = dlsym(handle, "fred") ;
8490     if (symbol == NULL) {
8491         /* try putting a leading underscore */
8492         symbol = dlsym(handle, "_fred") ;
8493         if (symbol == NULL) {
8494             printf ("2\n") ;
8495             fflush (stdout) ;
8496             exit(0);
8497         }
8498         printf ("3\n") ;
8499     }
8500     else
8501         printf ("4\n") ;
8502     fflush (stdout) ;
8503     exit(0);
8504 }
8505 EOM
8506         : Call the object file tmp-dyna.o in case dlext=o.
8507         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8508                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8509                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8510                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8511                 xxx=`./fred`
8512                 case $xxx in
8513                 1)      echo "Test program failed using dlopen." >&4
8514                         echo "Perhaps you should not use dynamic loading." >&4;;
8515                 2)      echo "Test program failed using dlsym." >&4
8516                         echo "Perhaps you should not use dynamic loading." >&4;;
8517                 3)      echo "dlsym needs a leading underscore" >&4
8518                         val="$define" ;;
8519                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8520                 esac
8521         else
8522                 echo "I can't compile and run the test program." >&4
8523                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8524         fi
8525         ;;
8526 esac
8527                 
8528 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8529
8530 set d_dlsymun
8531 eval $setvar
8532
8533 hasproto='varname=$1; func=$2; shift; shift;
8534 while $test $# -ge 2; do
8535         case "$1" in
8536         $define) echo "#include <$2>";;
8537         esac ;
8538     shift 2;
8539 done > try.c;
8540 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8541 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8542         echo "$func() prototype found.";
8543         val="$define";
8544 else
8545         echo "$func() prototype NOT found.";
8546         val="$undef";
8547 fi;
8548 set $varname;
8549 eval $setvar;
8550 $rm -f try.c tryout.c'
8551
8552 : see if prototype for drand48 is available
8553 echo " "
8554 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8555 eval $hasproto
8556
8557 : see if dup2 exists
8558 set dup2 d_dup2
8559 eval $inlibc
8560
8561 : see if eaccess exists
8562 set eaccess d_eaccess
8563 eval $inlibc
8564
8565 : see if endgrent exists
8566 set endgrent d_endgrent
8567 eval $inlibc
8568
8569 : see if endhostent exists
8570 set endhostent d_endhent
8571 eval $inlibc
8572
8573 : see if endnetent exists
8574 set endnetent d_endnent
8575 eval $inlibc
8576
8577 : see if endprotoent exists
8578 set endprotoent d_endpent
8579 eval $inlibc
8580
8581 : see if endpwent exists
8582 set endpwent d_endpwent
8583 eval $inlibc
8584
8585 : see if endservent exists
8586 set endservent d_endsent
8587 eval $inlibc
8588
8589 : Locate the flags for 'open()'
8590 echo " "
8591 $cat >open3.c <<'EOCP'
8592 #include <sys/types.h>
8593 #ifdef I_FCNTL
8594 #include <fcntl.h>
8595 #endif
8596 #ifdef I_SYS_FILE
8597 #include <sys/file.h>
8598 #endif
8599 int main() {
8600         if(O_RDONLY);
8601 #ifdef O_TRUNC
8602         exit(0);
8603 #else
8604         exit(1);
8605 #endif
8606 }
8607 EOCP
8608 : check sys/file.h first to get FREAD on Sun
8609 if $test `./findhdr sys/file.h` && \
8610                 set open3 -DI_SYS_FILE && eval $compile; then
8611         h_sysfile=true;
8612         echo "<sys/file.h> defines the O_* constants..." >&4
8613         if ./open3; then
8614                 echo "and you have the 3 argument form of open()." >&4
8615                 val="$define"
8616         else
8617                 echo "but not the 3 argument form of open().  Oh, well." >&4
8618                 val="$undef"
8619         fi
8620 elif $test `./findhdr fcntl.h` && \
8621                 set open3 -DI_FCNTL && eval $compile; then
8622         h_fcntl=true;
8623         echo "<fcntl.h> defines the O_* constants..." >&4
8624         if ./open3; then
8625                 echo "and you have the 3 argument form of open()." >&4
8626                 val="$define"
8627         else
8628                 echo "but not the 3 argument form of open().  Oh, well." >&4
8629                 val="$undef"
8630         fi
8631 else
8632         val="$undef"
8633         echo "I can't find the O_* constant definitions!  You got problems." >&4
8634 fi
8635 set d_open3
8636 eval $setvar
8637 $rm -f open3*
8638
8639 : see which of string.h or strings.h is needed
8640 echo " "
8641 strings=`./findhdr string.h`
8642 if $test "$strings" && $test -r "$strings"; then
8643         echo "Using <string.h> instead of <strings.h>." >&4
8644         val="$define"
8645 else
8646         val="$undef"
8647         strings=`./findhdr strings.h`
8648         if $test "$strings" && $test -r "$strings"; then
8649                 echo "Using <strings.h> instead of <string.h>." >&4
8650         else
8651                 echo "No string header found -- You'll surely have problems." >&4
8652         fi
8653 fi
8654 set i_string
8655 eval $setvar
8656 case "$i_string" in
8657 "$undef") strings=`./findhdr strings.h`;;
8658 *)        strings=`./findhdr string.h`;;
8659 esac
8660
8661 : check for non-blocking I/O stuff
8662 case "$h_sysfile" in
8663 true) echo "#include <sys/file.h>" > head.c;;
8664 *)
8665         case "$h_fcntl" in
8666         true) echo "#include <fcntl.h>" > head.c;;
8667         *) echo "#include <sys/fcntl.h>" > head.c;;
8668         esac
8669         ;;
8670 esac
8671 echo " "
8672 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8673 case "$o_nonblock" in
8674 '')
8675         $cat head.c > try.c
8676         $cat >>try.c <<'EOCP'
8677 #include <stdio.h>
8678 int main() {
8679 #ifdef O_NONBLOCK
8680         printf("O_NONBLOCK\n");
8681         exit(0);
8682 #endif
8683 #ifdef O_NDELAY
8684         printf("O_NDELAY\n");
8685         exit(0);
8686 #endif
8687 #ifdef FNDELAY
8688         printf("FNDELAY\n");
8689         exit(0);
8690 #endif
8691         exit(0);
8692 }
8693 EOCP
8694         set try
8695         if eval $compile_ok; then
8696                 o_nonblock=`./try`
8697                 case "$o_nonblock" in
8698                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8699                 *) echo "Seems like we can use $o_nonblock.";;
8700                 esac
8701         else
8702                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8703         fi
8704         ;;
8705 *) echo "Using $hint value $o_nonblock.";;
8706 esac
8707 $rm -f try try.* .out core
8708
8709 echo " "
8710 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8711 case "$eagain" in
8712 '')
8713         $cat head.c > try.c
8714         $cat >>try.c <<EOCP
8715 #include <errno.h>
8716 #include <sys/types.h>
8717 #include <signal.h>
8718 #include <stdio.h> 
8719 #define MY_O_NONBLOCK $o_nonblock
8720 #ifndef errno  /* XXX need better Configure test */
8721 extern int errno;
8722 #endif
8723 #$i_unistd I_UNISTD
8724 #ifdef I_UNISTD
8725 #include <unistd.h>
8726 #endif
8727 #$i_string I_STRING
8728 #ifdef I_STRING
8729 #include <string.h>
8730 #else
8731 #include <strings.h>
8732 #endif
8733 $signal_t blech(x) int x; { exit(3); }
8734 EOCP
8735         $cat >> try.c <<'EOCP'
8736 int main()
8737 {
8738         int pd[2];
8739         int pu[2];
8740         char buf[1];
8741         char string[100];
8742
8743         pipe(pd);       /* Down: child -> parent */
8744         pipe(pu);       /* Up: parent -> child */
8745         if (0 != fork()) {
8746                 int ret;
8747                 close(pd[1]);   /* Parent reads from pd[0] */
8748                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8749                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8750                         exit(1);
8751                 signal(SIGALRM, blech);
8752                 alarm(5);
8753                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8754                         exit(2);
8755                 sprintf(string, "%d\n", ret);
8756                 write(2, string, strlen(string));
8757                 alarm(0);
8758 #ifdef EAGAIN
8759                 if (errno == EAGAIN) {
8760                         printf("EAGAIN\n");
8761                         goto ok;
8762                 }
8763 #endif
8764 #ifdef EWOULDBLOCK
8765                 if (errno == EWOULDBLOCK)
8766                         printf("EWOULDBLOCK\n");
8767 #endif
8768         ok:
8769                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8770                 sleep(2);                               /* Give it time to close our pipe */
8771                 alarm(5);
8772                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8773                 alarm(0);
8774                 sprintf(string, "%d\n", ret);
8775                 write(3, string, strlen(string));
8776                 exit(0);
8777         }
8778
8779         close(pd[0]);                   /* We write to pd[1] */
8780         close(pu[1]);                   /* We read from pu[0] */
8781         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8782         close(pd[1]);                   /* Pipe pd is now fully closed! */
8783         exit(0);                                /* Bye bye, thank you for playing! */
8784 }
8785 EOCP
8786         set try
8787         if eval $compile_ok; then
8788                 echo "$startsh" >mtry
8789                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8790                 chmod +x mtry
8791                 ./mtry >/dev/null 2>&1
8792                 case $? in
8793                 0) eagain=`$cat try.out`;;
8794                 1) echo "Could not perform non-blocking setting!";;
8795                 2) echo "I did a successful read() for something that was not there!";;
8796                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8797                 *) echo "Something terribly wrong happened during testing.";;
8798                 esac
8799                 rd_nodata=`$cat try.ret`
8800                 echo "A read() system call with no data present returns $rd_nodata."
8801                 case "$rd_nodata" in
8802                 0|-1) ;;
8803                 *)
8804                         echo "(That's peculiar, fixing that to be -1.)"
8805                         rd_nodata=-1
8806                         ;;
8807                 esac
8808                 case "$eagain" in
8809                 '')
8810                         echo "Forcing errno EAGAIN on read() with no data available."
8811                         eagain=EAGAIN
8812                         ;;
8813                 *)
8814                         echo "Your read() sets errno to $eagain when no data is available."
8815                         ;;
8816                 esac
8817                 status=`$cat try.err`
8818                 case "$status" in
8819                 0) echo "And it correctly returns 0 to signal EOF.";;
8820                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8821                 *) echo "However, your read() returns '$status' on EOF??";;
8822                 esac
8823                 val="$define"
8824                 if test "$status" = "$rd_nodata"; then
8825                         echo "WARNING: you can't distinguish between EOF and no data!"
8826                         val="$undef"
8827                 fi
8828         else
8829                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8830                 eagain=EAGAIN
8831         fi
8832         set d_eofnblk
8833         eval $setvar
8834         ;;
8835 *)
8836         echo "Using $hint value $eagain."
8837         echo "Your read() returns $rd_nodata when no data is present."
8838         case "$d_eofnblk" in
8839         "$define") echo "And you can see EOF because read() returns 0.";;
8840         "$undef") echo "But you can't see EOF status from read() returned value.";;
8841         *)
8842                 echo "(Assuming you can't see EOF status from read anyway.)"
8843                 d_eofnblk=$undef
8844                 ;;
8845         esac
8846         ;;
8847 esac
8848 $rm -f try try.* .out core head.c mtry
8849
8850 : see if fchmod exists
8851 set fchmod d_fchmod
8852 eval $inlibc
8853
8854 : see if fchown exists
8855 set fchown d_fchown
8856 eval $inlibc
8857
8858 : see if this is an fcntl system
8859 set fcntl d_fcntl
8860 eval $inlibc
8861
8862 echo " "
8863 : See if fcntl-based locking works.
8864 $cat >try.c <<'EOCP'
8865 #include <stdlib.h>
8866 #include <unistd.h>
8867 #include <fcntl.h>
8868 int main() {
8869 #if defined(F_SETLK) && defined(F_SETLKW)
8870      struct flock flock;
8871      int retval, fd;
8872      fd = open("try.c", O_RDONLY);
8873      flock.l_type = F_RDLCK;
8874      flock.l_whence = SEEK_SET;
8875      flock.l_start = flock.l_len = 0;
8876      retval = fcntl(fd, F_SETLK, &flock);
8877      close(fd);
8878      (retval < 0 ? exit(2) : exit(0));
8879 #else
8880      exit(2);
8881 #endif
8882 }
8883 EOCP
8884 echo "Checking if fcntl-based file locking works... "
8885 case "$d_fcntl" in
8886 "$define")
8887         set try
8888         if eval $compile_ok; then
8889                 if ./try; then
8890                         echo "Yes, it seems to work."
8891                         val="$define"
8892                 else
8893                         echo "Nope, it didn't work."
8894                         val="$undef"
8895                 fi
8896         else
8897                 echo "I'm unable to compile the test program, so I'll assume not."
8898                 val="$undef"
8899         fi
8900         ;;
8901 *) val="$undef";
8902         echo "Nope, since you don't even have fcntl()."
8903         ;;
8904 esac
8905 set d_fcntl_can_lock
8906 eval $setvar
8907 $rm -f try*
8908
8909
8910 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8911 while $test $# -ge 2; do
8912         case "$1" in
8913         $define) echo "#include <$2>";;
8914         esac ;
8915     shift 2;
8916 done > try.c;
8917 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8918 set try;
8919 if eval $compile; then
8920         val="$define";
8921 else
8922         val="$undef";
8923 fi;
8924 set $varname;
8925 eval $setvar;
8926 $rm -f try.c try.o'
8927
8928 socketlib=''
8929 sockethdr=''
8930 : see whether socket exists
8931 echo " "
8932 $echo $n "Hmm... $c" >&4
8933 if set socket val -f d_socket; eval $csym; $val; then
8934         echo "Looks like you have Berkeley networking support." >&4
8935         d_socket="$define"
8936         if set setsockopt val -f; eval $csym; $val; then
8937                 d_oldsock="$undef"
8938         else
8939                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8940                 d_oldsock="$define"
8941         fi
8942 else
8943         if $contains socklib libc.list >/dev/null 2>&1; then
8944                 echo "Looks like you have Berkeley networking support." >&4
8945                 d_socket="$define"
8946                 : we will have to assume that it supports the 4.2 BSD interface
8947                 d_oldsock="$undef"
8948         else
8949                 echo "You don't have Berkeley networking in libc$_a..." >&4
8950                 if test "X$d_socket" = "X$define"; then
8951                    echo "...but you seem to believe that you have sockets." >&4
8952                 else
8953                         for net in net socket
8954                         do
8955                                 if test -f /usr/lib/lib$net$_a; then
8956                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8957                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8958                                         if $contains socket libc.list >/dev/null 2>&1; then
8959                                                 d_socket="$define"
8960                                                 socketlib="-l$net"
8961                                                 case "$net" in
8962                                                 net)
8963                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8964                                                         sockethdr="-I/usr/netinclude"
8965                                                         ;;
8966                                                 esac
8967                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8968                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8969                                                         d_oldsock="$undef"
8970                                                 else
8971                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8972                                                         d_oldsock="$define"
8973                                                 fi
8974                                                 break
8975                                         fi
8976                                 fi
8977                         done
8978                         if test "X$d_socket" != "X$define"; then
8979                            echo "or anywhere else I see." >&4
8980                            d_socket="$undef"
8981                            d_oldsock="$undef"
8982                         fi
8983                 fi
8984         fi
8985 fi
8986
8987 : see if socketpair exists
8988 set socketpair d_sockpair
8989 eval $inlibc
8990
8991
8992 echo " "
8993 echo "Checking the availability of certain socket constants..." >& 4
8994 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8995         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8996         $cat >try.c <<EOF
8997 #include <sys/types.h>
8998 #include <sys/socket.h>
8999 int main() {
9000     int i = $ENUM;
9001 }
9002 EOF
9003         val="$undef"
9004         set try; if eval $compile; then
9005                 val="$define"
9006         fi
9007         set d_${enum}; eval $setvar
9008         $rm -f try.c try
9009 done
9010
9011 : see if sys/select.h has to be included
9012 set sys/select.h i_sysselct
9013 eval $inhdr
9014
9015 : see if we should include time.h, sys/time.h, or both
9016 echo " "
9017 if test "X$timeincl" = X; then
9018         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9019         $echo $n "I'm now running the test program...$c"
9020         $cat >try.c <<'EOCP'
9021 #include <sys/types.h>
9022 #ifdef I_TIME
9023 #include <time.h>
9024 #endif
9025 #ifdef I_SYSTIME
9026 #ifdef SYSTIMEKERNEL
9027 #define KERNEL
9028 #endif
9029 #include <sys/time.h>
9030 #endif
9031 #ifdef I_SYSSELECT
9032 #include <sys/select.h>
9033 #endif
9034 int main()
9035 {
9036         struct tm foo;
9037 #ifdef S_TIMEVAL
9038         struct timeval bar;
9039 #endif
9040 #ifdef S_TIMEZONE
9041         struct timezone tzp;
9042 #endif
9043         if (foo.tm_sec == foo.tm_sec)
9044                 exit(0);
9045 #ifdef S_TIMEVAL
9046         if (bar.tv_sec == bar.tv_sec)
9047                 exit(0);
9048 #endif
9049         exit(1);
9050 }
9051 EOCP
9052         flags=''
9053         for s_timezone in '-DS_TIMEZONE' ''; do
9054         sysselect=''
9055         for s_timeval in '-DS_TIMEVAL' ''; do
9056         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9057         for i_time in '' '-DI_TIME'; do
9058         for i_systime in '-DI_SYSTIME' ''; do
9059                 case "$flags" in
9060                 '') $echo $n ".$c"
9061                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9062                         if eval $compile; then
9063                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9064                                 shift
9065                                 flags="$*"
9066                                 echo " "
9067                                 $echo $n "Succeeded with $flags$c"
9068                         fi
9069                         ;;
9070                 esac
9071         done
9072         done
9073         done
9074         done
9075         done
9076         timeincl=''
9077         echo " "
9078         case "$flags" in
9079         *SYSTIMEKERNEL*) i_systimek="$define"
9080                 timeincl=`./findhdr sys/time.h`
9081                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9082         *) i_systimek="$undef";;
9083         esac
9084         case "$flags" in
9085         *I_TIME*) i_time="$define"
9086                 timeincl=`./findhdr time.h`" $timeincl"
9087                 echo "We'll include <time.h>." >&4;;
9088         *) i_time="$undef";;
9089         esac
9090         case "$flags" in
9091         *I_SYSTIME*) i_systime="$define"
9092                 timeincl=`./findhdr sys/time.h`" $timeincl"
9093                 echo "We'll include <sys/time.h>." >&4;;
9094         *) i_systime="$undef";;
9095         esac
9096         $rm -f try.c try
9097 fi
9098
9099 : check for fd_set items
9100 $cat <<EOM
9101
9102 Checking to see how well your C compiler handles fd_set and friends ...
9103 EOM
9104 $cat >fd_set.c <<EOCP
9105 #$i_systime I_SYS_TIME
9106 #$i_sysselct I_SYS_SELECT
9107 #$d_socket HAS_SOCKET
9108 #include <sys/types.h>
9109 #ifdef HAS_SOCKET
9110 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9111 #endif
9112 #ifdef I_SYS_TIME
9113 #include <sys/time.h>
9114 #endif
9115 #ifdef I_SYS_SELECT
9116 #include <sys/select.h>
9117 #endif
9118 int main() {
9119         fd_set fds;
9120
9121 #ifdef TRYBITS
9122         if(fds.fds_bits);
9123 #endif
9124
9125 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9126         exit(0);
9127 #else
9128         exit(1);
9129 #endif
9130 }
9131 EOCP
9132 set fd_set -DTRYBITS
9133 if eval $compile; then
9134         d_fds_bits="$define"
9135         d_fd_set="$define"
9136         echo "Well, your system knows about the normal fd_set typedef..." >&4
9137         if ./fd_set; then
9138                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9139                 d_fd_macros="$define"
9140         else
9141                 $cat >&4 <<'EOM'
9142 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9143 EOM
9144                 d_fd_macros="$undef"
9145         fi
9146 else
9147         $cat <<'EOM'
9148 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9149 EOM
9150         set fd_set
9151         if eval $compile; then
9152                 d_fds_bits="$undef"
9153                 d_fd_set="$define"
9154                 echo "Well, your system has some sort of fd_set available..." >&4
9155                 if ./fd_set; then
9156                         echo "and you have the normal fd_set macros." >&4
9157                         d_fd_macros="$define"
9158                 else
9159                         $cat <<'EOM'
9160 but not the normal fd_set macros!  Gross!  More work for me...
9161 EOM
9162                         d_fd_macros="$undef"
9163                 fi
9164         else
9165         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9166                 d_fd_set="$undef"
9167                 d_fds_bits="$undef"
9168                 d_fd_macros="$undef"
9169         fi
9170 fi
9171 $rm -f fd_set*
9172
9173 : see if fgetpos exists
9174 set fgetpos d_fgetpos
9175 eval $inlibc
9176
9177 : see if flock exists
9178 set flock d_flock
9179 eval $inlibc
9180
9181 : see if fork exists
9182 set fork d_fork
9183 eval $inlibc
9184
9185 : see if pathconf exists
9186 set pathconf d_pathconf
9187 eval $inlibc
9188
9189 : see if fpathconf exists
9190 set fpathconf d_fpathconf
9191 eval $inlibc
9192
9193
9194 : check for fpos64_t
9195 echo " "
9196 echo "Checking to see if you have fpos64_t..." >&4
9197 $cat >try.c <<EOCP
9198 #include <stdio.h>
9199 int main() { fpos64_t x = 7; }
9200 EOCP
9201 set try
9202 if eval $compile; then
9203         val="$define"
9204         echo "You have fpos64_t."
9205 else
9206         val="$undef"
9207         echo "You do not have fpos64_t."
9208         case "$fpossize" in
9209         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9210         esac
9211 fi
9212 $rm -f try.* try
9213 set d_fpos64_t
9214 eval $setvar
9215
9216 : see if frexpl exists
9217 set frexpl d_frexpl
9218 eval $inlibc
9219
9220 hasstruct='varname=$1; struct=$2; shift; shift;
9221 while $test $# -ge 2; do
9222         case "$1" in
9223         $define) echo "#include <$2>";;
9224         esac ;
9225     shift 2;
9226 done > try.c;
9227 echo "int main () { struct $struct foo; }" >> try.c;
9228 set try;
9229 if eval $compile; then
9230         val="$define";
9231 else
9232         val="$undef";
9233 fi;
9234 set $varname;
9235 eval $setvar;
9236 $rm -f try.c try.o'
9237
9238 : see if this is a sys/param system
9239 set sys/param.h i_sysparam
9240 eval $inhdr
9241
9242 : see if this is a sys/mount.h system
9243 set sys/mount.h i_sysmount
9244 eval $inhdr
9245
9246 : see if sys/types.h has to be included
9247 set sys/types.h i_systypes
9248 eval $inhdr
9249
9250
9251 echo " "
9252 echo "Checking to see if your system supports struct fs_data..." >&4
9253 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9254 eval $hasstruct
9255 case "$d_fs_data_s" in
9256 "$define")      echo "Yes, it does."   ;;
9257 *)              echo "No, it doesn't." ;;
9258 esac
9259
9260 : see if fseeko exists
9261 set fseeko d_fseeko
9262 eval $inlibc
9263 case "$longsize" in
9264 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9265 esac
9266
9267 : see if fsetpos exists
9268 set fsetpos d_fsetpos
9269 eval $inlibc
9270
9271
9272 : see if fstatfs exists
9273 set fstatfs d_fstatfs
9274 eval $inlibc
9275
9276
9277 : see if statvfs exists
9278 set statvfs d_statvfs
9279 eval $inlibc
9280
9281 : see if fstatvfs exists
9282 set fstatvfs d_fstatvfs
9283 eval $inlibc
9284
9285
9286 : see if fsync exists
9287 set fsync d_fsync
9288 eval $inlibc
9289
9290 : see if ftello exists
9291 set ftello d_ftello
9292 eval $inlibc
9293 case "$longsize" in
9294 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9295 esac
9296
9297 : see if getcwd exists
9298 set getcwd d_getcwd
9299 eval $inlibc
9300
9301 : see if getespwnam exists
9302 set getespwnam d_getespwnam
9303 eval $inlibc
9304
9305
9306 : see if getfsstat exists
9307 set getfsstat d_getfsstat
9308 eval $inlibc
9309
9310 : see if getgrent exists
9311 set getgrent d_getgrent
9312 eval $inlibc
9313
9314 : see if gethostbyaddr exists
9315 set gethostbyaddr d_gethbyaddr
9316 eval $inlibc
9317
9318 : see if gethostbyname exists
9319 set gethostbyname d_gethbyname
9320 eval $inlibc
9321
9322 : see if gethostent exists
9323 set gethostent d_gethent
9324 eval $inlibc
9325
9326 : see how we will look up host name
9327 echo " "
9328 call=''
9329 if set gethostname val -f d_gethname; eval $csym; $val; then
9330         echo 'gethostname() found.' >&4
9331         d_gethname="$define"
9332         call=gethostname
9333 fi
9334 if set uname val -f d_uname; eval $csym; $val; then
9335         if ./xenix; then
9336                 $cat <<'EOM'
9337 uname() was found, but you're running xenix, and older versions of xenix
9338 have a broken uname(). If you don't really know whether your xenix is old
9339 enough to have a broken system call, use the default answer.
9340
9341 EOM
9342                 dflt=y
9343                 case "$d_uname" in
9344                 "$define") dflt=n;;
9345                 esac
9346                 rp='Is your uname() broken?'
9347                 . ./myread
9348                 case "$ans" in
9349                 n*) d_uname="$define"; call=uname;;
9350                 esac
9351         else
9352                 echo 'uname() found.' >&4
9353                 d_uname="$define"
9354                 case "$call" in
9355                 '') call=uname ;;
9356                 esac
9357         fi
9358 fi
9359 case "$d_gethname" in
9360 '') d_gethname="$undef";;
9361 esac
9362 case "$d_uname" in
9363 '') d_uname="$undef";;
9364 esac
9365 case "$d_uname$d_gethname" in
9366 *define*)
9367         dflt=n
9368         cat <<EOM
9369  
9370 Every now and then someone has a $call() that lies about the hostname
9371 but can't be fixed for political or economic reasons.  If you wish, I can
9372 pretend $call() isn't there and maybe compute hostname at run-time
9373 thanks to the '$phostname' command.
9374
9375 EOM
9376         rp="Shall I ignore $call() from now on?"
9377         . ./myread
9378         case "$ans" in
9379         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9380         esac;;
9381 esac
9382 case "$phostname" in
9383 '') aphostname='';;
9384 *) case "$aphostname" in
9385         /*) ;;
9386         *) set X $phostname
9387                 shift
9388                 file=$1
9389                 shift
9390                 file=`./loc $file $file $pth`
9391                 aphostname=`echo $file $*`
9392                 ;;
9393         esac
9394         ;;
9395 esac
9396 case "$d_uname$d_gethname" in
9397 *define*) ;;
9398 *)
9399         case "$phostname" in
9400         '')
9401                 echo "There will be no way for $package to get your hostname." >&4;;
9402         *)
9403         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9404                 ;;
9405         esac;;
9406 esac
9407 case "$d_phostname" in
9408 '') d_phostname="$undef";;
9409 esac
9410
9411 : see if this is a netdb.h system
9412 set netdb.h i_netdb
9413 eval $inhdr
9414
9415 : see if prototypes for various gethostxxx netdb.h functions are available
9416 echo " "
9417 set d_gethostprotos gethostent $i_netdb netdb.h
9418 eval $hasproto
9419
9420 : see if getlogin exists
9421 set getlogin d_getlogin
9422 eval $inlibc
9423
9424 : see if getmnt exists
9425 set getmnt d_getmnt
9426 eval $inlibc
9427
9428 : see if getmntent exists
9429 set getmntent d_getmntent
9430 eval $inlibc
9431
9432 : see if getnetbyaddr exists
9433 set getnetbyaddr d_getnbyaddr
9434 eval $inlibc
9435
9436 : see if getnetbyname exists
9437 set getnetbyname d_getnbyname
9438 eval $inlibc
9439
9440 : see if getnetent exists
9441 set getnetent d_getnent
9442 eval $inlibc
9443
9444 : see if prototypes for various getnetxxx netdb.h functions are available
9445 echo " "
9446 set d_getnetprotos getnetent $i_netdb netdb.h
9447 eval $hasproto
9448
9449 : see if getpagesize exists
9450 set getpagesize d_getpagsz
9451 eval $inlibc
9452
9453
9454 : see if getprotobyname exists
9455 set getprotobyname d_getpbyname
9456 eval $inlibc
9457
9458 : see if getprotobynumber exists
9459 set getprotobynumber d_getpbynumber
9460 eval $inlibc
9461
9462 : see if getprotoent exists
9463 set getprotoent d_getpent
9464 eval $inlibc
9465
9466 : see if getpgid exists
9467 set getpgid d_getpgid
9468 eval $inlibc
9469
9470 : see if getpgrp2 exists
9471 set getpgrp2 d_getpgrp2
9472 eval $inlibc
9473
9474 : see if getppid exists
9475 set getppid d_getppid
9476 eval $inlibc
9477
9478 : see if getpriority exists
9479 set getpriority d_getprior
9480 eval $inlibc
9481
9482 : see if prototypes for various getprotoxxx netdb.h functions are available
9483 echo " "
9484 set d_getprotoprotos getprotoent $i_netdb netdb.h
9485 eval $hasproto
9486
9487 : see if getprpwnam exists
9488 set getprpwnam d_getprpwnam
9489 eval $inlibc
9490
9491 : see if getpwent exists
9492 set getpwent d_getpwent
9493 eval $inlibc
9494
9495
9496 : see if getservbyname exists
9497 set getservbyname d_getsbyname
9498 eval $inlibc
9499
9500 : see if getservbyport exists
9501 set getservbyport d_getsbyport
9502 eval $inlibc
9503
9504 : see if getservent exists
9505 set getservent d_getsent
9506 eval $inlibc
9507
9508 : see if prototypes for various getservxxx netdb.h functions are available
9509 echo " "
9510 set d_getservprotos getservent $i_netdb netdb.h
9511 eval $hasproto
9512
9513 : see if getspnam exists
9514 set getspnam d_getspnam
9515 eval $inlibc
9516
9517 : see if gettimeofday or ftime exists
9518 set gettimeofday d_gettimeod
9519 eval $inlibc
9520 case "$d_gettimeod" in
9521 "$undef")
9522         set ftime d_ftime 
9523         eval $inlibc
9524         ;;
9525 *)
9526         val="$undef"; set d_ftime; eval $setvar
9527         ;;
9528 esac
9529 case "$d_gettimeod$d_ftime" in
9530 "$undef$undef")
9531         echo " "
9532         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9533         ;;
9534 esac
9535
9536 : see if this is an grp system
9537 set grp.h i_grp
9538 eval $inhdr
9539
9540 case "$i_grp" in
9541 $define)
9542         xxx=`./findhdr grp.h`
9543         $cppstdin $cppflags $cppminus < $xxx >$$.h
9544
9545         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9546                 val="$define"
9547         else
9548                 val="$undef"
9549         fi
9550         set d_grpasswd
9551         eval $setvar
9552
9553         $rm -f $$.h
9554         ;;
9555 *)
9556         val="$undef";
9557         set d_grpasswd; eval $setvar
9558         ;;
9559 esac
9560
9561 : see if hasmntopt exists
9562 set hasmntopt d_hasmntopt
9563 eval $inlibc
9564
9565 : see if this is a netinet/in.h or sys/in.h system
9566 set netinet/in.h i_niin sys/in.h i_sysin
9567 eval $inhdr
9568
9569 : see if arpa/inet.h has to be included
9570 set arpa/inet.h i_arpainet
9571 eval $inhdr
9572
9573 : see if htonl --and friends-- exists
9574 val=''
9575 set htonl val
9576 eval $inlibc
9577
9578 : Maybe they are macros.
9579 case "$val" in
9580 $undef)
9581         $cat >htonl.c <<EOM
9582 #include <stdio.h>
9583 #include <sys/types.h>
9584 #$i_niin I_NETINET_IN
9585 #$i_sysin I_SYS_IN
9586 #$i_arpainet I_ARPA_INET
9587 #ifdef I_NETINET_IN
9588 #include <netinet/in.h>
9589 #endif
9590 #ifdef I_SYS_IN
9591 #include <sys/in.h>
9592 #endif
9593 #ifdef I_ARPA_INET
9594 #include <arpa/inet.h>
9595 #endif
9596 #ifdef htonl
9597 printf("Defined as a macro.");
9598 #endif
9599 EOM
9600         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9601         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9602                 val="$define"
9603                 echo "But it seems to be defined as a macro." >&4
9604         fi
9605         $rm -f htonl.?
9606         ;;
9607 esac
9608 set d_htonl
9609 eval $setvar
9610
9611 : see if iconv exists
9612 set iconv d_iconv
9613 eval $inlibc
9614
9615 : index or strchr
9616 echo " "
9617 if set index val -f; eval $csym; $val; then
9618         if set strchr val -f d_strchr; eval $csym; $val; then
9619                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9620                         val="$define"
9621                         vali="$undef"
9622                         echo "strchr() found." >&4
9623                 else
9624                         val="$undef"
9625                         vali="$define"
9626                         echo "index() found." >&4
9627                 fi
9628         else
9629                 val="$undef"
9630                 vali="$define"
9631                 echo "index() found." >&4
9632         fi
9633 else
9634         if set strchr val -f d_strchr; eval $csym; $val; then
9635                 val="$define"
9636                 vali="$undef"
9637                 echo "strchr() found." >&4
9638         else
9639                 echo "No index() or strchr() found!" >&4
9640                 val="$undef"
9641                 vali="$undef"
9642         fi
9643 fi
9644 set d_strchr; eval $setvar
9645 val="$vali"
9646 set d_index; eval $setvar
9647
9648 : check whether inet_aton exists
9649 set inet_aton d_inetaton
9650 eval $inlibc
9651
9652 : see if inttypes.h is available
9653 : we want a real compile instead of Inhdr because some systems
9654 : have an inttypes.h which includes non-existent headers
9655 echo " "
9656 $cat >try.c <<EOCP
9657 #include <inttypes.h>
9658 int main() {
9659         static int32_t foo32 = 0x12345678;
9660 }
9661 EOCP
9662 set try
9663 if eval $compile; then
9664         echo "<inttypes.h> found." >&4
9665         val="$define"
9666 else
9667         echo "<inttypes.h> NOT found." >&4
9668         val="$undef"
9669 fi
9670 $rm -f try.c try
9671 set i_inttypes
9672 eval $setvar
9673
9674 : check for int64_t
9675 echo " "
9676 echo "Checking to see if you have int64_t..." >&4
9677 $cat >try.c <<EOCP
9678 #include <sys/types.h>
9679 #$i_inttypes I_INTTYPES
9680 #ifdef I_INTTYPES
9681 #include <inttypes.h>
9682 #endif
9683 int main() { int64_t x = 7; }
9684 EOCP
9685 set try
9686 if eval $compile; then
9687         val="$define"
9688         echo "You have int64_t."
9689 else
9690         val="$undef"
9691         echo "You do not have int64_t."
9692 fi
9693 $rm -f try try.*
9694 set d_int64_t
9695 eval $setvar
9696
9697 : Look for isascii
9698 echo " "
9699 $cat >isascii.c <<'EOCP'
9700 #include <stdio.h>
9701 #include <ctype.h>
9702 int main() {
9703         int c = 'A';
9704         if (isascii(c))
9705                 exit(0);
9706         else
9707                 exit(1);
9708 }
9709 EOCP
9710 set isascii
9711 if eval $compile; then
9712         echo "isascii() found." >&4
9713         val="$define"
9714 else
9715         echo "isascii() NOT found." >&4
9716         val="$undef"
9717 fi
9718 set d_isascii
9719 eval $setvar
9720 $rm -f isascii*
9721
9722 : see if isnan exists
9723 set isnan d_isnan
9724 eval $inlibc
9725
9726 : see if isnanl exists
9727 set isnanl d_isnanl
9728 eval $inlibc
9729
9730 : see if killpg exists
9731 set killpg d_killpg
9732 eval $inlibc
9733
9734 : see if lchown exists
9735 echo " "
9736 $cat > try.c <<'EOCP'
9737 /* System header to define __stub macros and hopefully few prototypes,
9738     which can conflict with char lchown(); below.  */
9739 #include <assert.h>
9740 /* Override any gcc2 internal prototype to avoid an error.  */
9741 /* We use char because int might match the return type of a gcc2
9742    builtin and then its argument prototype would still apply.  */
9743 char lchown();
9744 int main() {
9745     /*  The GNU C library defines this for functions which it implements
9746         to always fail with ENOSYS.  Some functions are actually named
9747         something starting with __ and the normal name is an alias.  */
9748 #if defined (__stub_lchown) || defined (__stub___lchown)
9749 choke me
9750 #else
9751 lchown();
9752 #endif
9753 ; return 0; }
9754 EOCP
9755 set try
9756 if eval $compile; then
9757     $echo "lchown() found." >&4
9758     val="$define"
9759 else
9760     $echo "lchown() NOT found." >&4
9761     val="$undef"
9762 fi
9763 set d_lchown
9764 eval $setvar
9765
9766 : See if number of significant digits in a double precision number is known
9767 echo " "
9768 $cat >ldbl_dig.c <<EOM
9769 #$i_limits I_LIMITS
9770 #$i_float I_FLOAT
9771 #ifdef I_LIMITS
9772 #include <limits.h>
9773 #endif
9774 #ifdef I_FLOAT
9775 #include <float.h>
9776 #endif
9777 #ifdef LDBL_DIG
9778 printf("Contains LDBL_DIG");
9779 #endif
9780 EOM
9781 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9782 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9783         echo "LDBL_DIG found." >&4
9784         val="$define"
9785 else
9786         echo "LDBL_DIG NOT found." >&4
9787         val="$undef"
9788 fi
9789 $rm -f ldbl_dig.?
9790 set d_ldbl_dig
9791 eval $setvar
9792
9793 : see if link exists
9794 set link d_link
9795 eval $inlibc
9796
9797 : see if localeconv exists
9798 set localeconv d_locconv
9799 eval $inlibc
9800
9801 : see if lockf exists
9802 set lockf d_lockf
9803 eval $inlibc
9804
9805 : check for long long
9806 echo " "
9807 echo "Checking to see if you have long long..." >&4
9808 echo 'int main() { long long x = 7; return 0; }' > try.c
9809 set try
9810 if eval $compile; then
9811         val="$define"
9812         echo "You have long long."
9813 else
9814         val="$undef"
9815         echo "You do not have long long."
9816 fi
9817 $rm try.*
9818 set d_longlong
9819 eval $setvar
9820
9821 : check for length of long long
9822 case "${d_longlong}${longlongsize}" in
9823 $define)
9824         echo " "
9825         echo "Checking to see how big your long longs are..." >&4
9826         $cat >try.c <<'EOCP'
9827 #include <stdio.h>
9828 int main()
9829 {
9830     printf("%d\n", (int)sizeof(long long));
9831     return(0);
9832 }
9833 EOCP
9834         set try
9835         if eval $compile_ok; then
9836                 longlongsize=`./try$exe_ext`
9837                 echo "Your long longs are $longlongsize bytes long."
9838         else
9839                 dflt='8'
9840                 echo " "
9841                 echo "(I can't seem to compile the test program.  Guessing...)"
9842                 rp="What is the size of a long long (in bytes)?"
9843                 . ./myread
9844                 longlongsize="$ans"
9845         fi
9846         if $test "X$longsize" = "X$longlongsize"; then
9847                 echo "(That isn't any different from an ordinary long.)"
9848         fi      
9849         ;;
9850 esac
9851 $rm -f try.* try
9852
9853 : see if prototype for lseek is available
9854 echo " "
9855 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9856 eval $hasproto
9857
9858 : see if lstat exists
9859 set lstat d_lstat
9860 eval $inlibc
9861
9862 : see if madvise exists
9863 set madvise d_madvise
9864 eval $inlibc
9865
9866 : see if mblen exists
9867 set mblen d_mblen
9868 eval $inlibc
9869
9870 : see if mbstowcs exists
9871 set mbstowcs d_mbstowcs
9872 eval $inlibc
9873
9874 : see if mbtowc exists
9875 set mbtowc d_mbtowc
9876 eval $inlibc
9877
9878 : see if memchr exists
9879 set memchr d_memchr
9880 eval $inlibc
9881
9882 : see if memcmp exists
9883 set memcmp d_memcmp
9884 eval $inlibc
9885
9886 : see if memcpy exists
9887 set memcpy d_memcpy
9888 eval $inlibc
9889
9890 : see if memmove exists
9891 set memmove d_memmove
9892 eval $inlibc
9893
9894 : see if memset exists
9895 set memset d_memset
9896 eval $inlibc
9897
9898 : see if mkdir exists
9899 set mkdir d_mkdir
9900 eval $inlibc
9901
9902 : see if mkdtemp exists
9903 set mkdtemp d_mkdtemp
9904 eval $inlibc
9905
9906 : see if mkfifo exists
9907 set mkfifo d_mkfifo
9908 eval $inlibc
9909
9910 : see if mkstemp exists
9911 set mkstemp d_mkstemp
9912 eval $inlibc
9913
9914 : see if mkstemps exists
9915 set mkstemps d_mkstemps
9916 eval $inlibc
9917
9918 : see if mktime exists
9919 set mktime d_mktime
9920 eval $inlibc
9921
9922 : see if this is a sys/mman.h system
9923 set sys/mman.h i_sysmman
9924 eval $inhdr
9925
9926 : see if mmap exists
9927 set mmap d_mmap
9928 eval $inlibc
9929 : see what shmat returns
9930 : default to something harmless
9931 mmaptype='void *'
9932 case "$i_sysmman$d_mmap" in
9933 "$define$define")
9934         $cat >mmap.c <<'END'
9935 #include <sys/mman.h>
9936 void *mmap();
9937 END
9938         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9939                 mmaptype='void *'
9940         else
9941                 mmaptype='caddr_t'
9942         fi
9943         echo "and it returns ($mmaptype)." >&4
9944         ;;
9945 esac
9946
9947
9948
9949 : see if modfl exists
9950 set modfl d_modfl
9951 eval $inlibc
9952
9953 : see if mprotect exists
9954 set mprotect d_mprotect
9955 eval $inlibc
9956
9957 : see if msgctl exists
9958 set msgctl d_msgctl
9959 eval $inlibc
9960
9961 : see if msgget exists
9962 set msgget d_msgget
9963 eval $inlibc
9964
9965 : see if msgsnd exists
9966 set msgsnd d_msgsnd
9967 eval $inlibc
9968
9969 : see if msgrcv exists
9970 set msgrcv d_msgrcv
9971 eval $inlibc
9972
9973 : see how much of the 'msg*(2)' library is present.
9974 h_msg=true
9975 echo " "
9976 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9977 *"$undef"*) h_msg=false;;
9978 esac
9979 case "$osname" in
9980 freebsd)
9981     case "`ipcs 2>&1`" in
9982     "SVID messages"*"not configured"*)
9983         echo "Your $osname does not have the msg*(2) configured." >&4
9984         h_msg=false
9985         val="$undef"
9986         set msgctl d_msgctl
9987         eval $setvar
9988         set msgget d_msgget
9989         eval $setvar
9990         set msgsnd d_msgsnd
9991         eval $setvar
9992         set msgrcv d_msgrcv
9993         eval $setvar
9994         ;;
9995     esac
9996     ;;
9997 esac
9998 : we could also check for sys/ipc.h ...
9999 if $h_msg && $test `./findhdr sys/msg.h`; then
10000         echo "You have the full msg*(2) library." >&4
10001         val="$define"
10002 else
10003         echo "You don't have the full msg*(2) library." >&4
10004         val="$undef"
10005 fi
10006 set d_msg
10007 eval $setvar
10008
10009 : see if msync exists
10010 set msync d_msync
10011 eval $inlibc
10012
10013 : see if munmap exists
10014 set munmap d_munmap
10015 eval $inlibc
10016
10017 : see if nice exists
10018 set nice d_nice
10019 eval $inlibc
10020
10021
10022 echo " "
10023 echo "Checking which 64-bit integer type we could use..." >&4
10024
10025 case "$intsize" in
10026 8) val=int
10027    set quadtype
10028    eval $setvar
10029    val='"unsigned int"'
10030    set uquadtype
10031    eval $setvar
10032    quadkind=1
10033    ;;
10034 *) case "$longsize" in
10035    8) val=long
10036       set quadtype
10037       eval $setvar
10038       val='"unsigned long"'
10039       set uquadtype
10040       eval $setvar
10041       quadkind=2
10042       ;;
10043    *) case "$d_longlong:$longlongsize" in
10044       define:8)
10045         val='"long long"'
10046         set quadtype
10047         eval $setvar
10048         val='"unsigned long long"'
10049         set uquadtype
10050         eval $setvar
10051         quadkind=3
10052         ;;
10053       *) case "$d_int64_t" in
10054          define)
10055            val=int64_t
10056            set quadtype
10057            eval $setvar
10058            val=uint64_t
10059            set uquadtype
10060            eval $setvar
10061            quadkind=4
10062            ;;
10063          esac
10064          ;;
10065       esac
10066       ;;
10067    esac
10068    ;;
10069 esac
10070
10071 case "$quadtype" in
10072 '')     echo "Alas, no 64-bit integer types in sight." >&4
10073         d_quad="$undef"
10074         ;;
10075 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10076             verb="will"
10077         else
10078             verb="could"
10079         fi
10080         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10081         d_quad="$define"
10082         ;;
10083 esac
10084
10085 : check for length of character
10086 echo " "
10087 case "$charsize" in
10088 '')
10089         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10090         $cat >try.c <<'EOCP'
10091 #include <stdio.h>
10092 int main()
10093 {
10094     printf("%d\n", (int)sizeof(char));
10095     exit(0);
10096 }
10097 EOCP
10098         set try
10099         if eval $compile_ok; then
10100                 dflt=`./try`
10101         else
10102                 dflt='1'
10103                 echo "(I can't seem to compile the test program.  Guessing...)"
10104         fi
10105         ;;
10106 *)
10107         dflt="$charsize"
10108         ;;
10109 esac
10110 rp="What is the size of a character (in bytes)?"
10111 . ./myread
10112 charsize="$ans"
10113 $rm -f try.c try
10114
10115 : check for volatile keyword
10116 echo " "
10117 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10118 $cat >try.c <<'EOCP'
10119 int main()
10120 {
10121         typedef struct _goo_struct goo_struct;
10122         goo_struct * volatile goo = ((goo_struct *)0);
10123         struct _goo_struct {
10124                 long long_int;
10125                 int reg_int;
10126                 char char_var;
10127         };
10128         typedef unsigned short foo_t;
10129         char *volatile foo;
10130         volatile int bar;
10131         volatile foo_t blech;
10132         foo = foo;
10133 }
10134 EOCP
10135 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10136         val="$define"
10137         echo "Yup, it does."
10138 else
10139         val="$undef"
10140         echo "Nope, it doesn't."
10141 fi
10142 set d_volatile
10143 eval $setvar
10144 $rm -f try.*
10145
10146
10147 echo " "
10148 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10149
10150 case "$use64bitint:$d_quad:$quadtype" in
10151 define:define:?*)
10152         ivtype="$quadtype"
10153         uvtype="$uquadtype"
10154         ivsize=8
10155         uvsize=8
10156         ;;
10157 *)      ivtype="long"
10158         uvtype="unsigned long"
10159         ivsize=$longsize
10160         uvsize=$longsize
10161         ;;
10162 esac
10163
10164 case "$uselongdouble:$d_longdbl" in
10165 define:define)
10166         nvtype="long double"
10167         nvsize=$longdblsize
10168         ;;
10169 *)      nvtype=double
10170         nvsize=$doublesize
10171         ;;
10172 esac
10173
10174 $echo "(IV will be "$ivtype", $ivsize bytes)"
10175 $echo "(UV will be "$uvtype", $uvsize bytes)"
10176 $echo "(NV will be "$nvtype", $nvsize bytes)"
10177
10178 $cat >try.c <<EOCP
10179 #$i_inttypes I_INTTYPES
10180 #ifdef I_INTTYPES
10181 #include <inttypes.h>
10182 #endif
10183 #include <stdio.h>
10184 int main() {
10185 #ifdef INT8
10186    int8_t i =  INT8_MAX;
10187   uint8_t u = UINT8_MAX;
10188   printf("int8_t\n");
10189 #endif
10190 #ifdef INT16
10191    int16_t i =  INT16_MAX;
10192   uint16_t i = UINT16_MAX;
10193   printf("int16_t\n");
10194 #endif
10195 #ifdef INT32
10196    int32_t i =  INT32_MAX;
10197   uint32_t u = UINT32_MAX;
10198   printf("int32_t\n");
10199 #endif
10200 }
10201 EOCP
10202
10203 case "$i8type" in
10204 '')     case "$charsize" in
10205         1)      i8type=char
10206                 u8type="unsigned char"
10207                 i8size=$charsize
10208                 u8size=$charsize
10209                 ;;
10210         esac
10211         ;;
10212 esac
10213 case "$i8type" in
10214 '')     set try -DINT8
10215         if eval $compile; then
10216                 case "`./try$exe_ext`" in
10217                 int8_t) i8type=int8_t
10218                         u8type=uint8_t
10219                         i8size=1
10220                         u8size=1
10221                         ;;
10222                 esac
10223         fi
10224         ;;
10225 esac
10226 case "$i8type" in
10227 '')     if $test $charsize -ge 1; then
10228                 i8type=char
10229                 u8type="unsigned char"
10230                 i8size=$charsize
10231                 u8size=$charsize
10232         fi
10233         ;;
10234 esac
10235
10236 case "$i16type" in
10237 '')     case "$shortsize" in
10238         2)      i16type=short
10239                 u16type="unsigned short"
10240                 i16size=$shortsize
10241                 u16size=$shortsize
10242                 ;;
10243         esac
10244         ;;
10245 esac
10246 case "$i16type" in
10247 '')     set try -DINT16
10248         if eval $compile; then
10249                 case "`./try$exe_ext`" in
10250                 int16_t)
10251                         i16type=int16_t
10252                         u16type=uint16_t
10253                         i16size=2
10254                         u16size=2
10255                         ;;
10256                 esac
10257         fi
10258         ;;
10259 esac
10260 case "$i16type" in
10261 '')     if $test $shortsize -ge 2; then
10262                 i16type=short
10263                 u16type="unsigned short"
10264                 i16size=$shortsize
10265                 u16size=$shortsize
10266         fi
10267         ;;
10268 esac
10269
10270 case "$i32type" in
10271 '')     case "$longsize" in
10272         4)      i32type=long
10273                 u32type="unsigned long"
10274                 i32size=$longsize
10275                 u32size=$longsize
10276                 ;;
10277         *)      case "$intsize" in
10278                 4)      i32type=int
10279                         u32type="unsigned int"
10280                         i32size=$intsize
10281                         u32size=$intsize
10282                         ;;
10283                 esac
10284                 ;;
10285         esac
10286         ;;
10287 esac
10288 case "$i32type" in
10289 '')     set try -DINT32
10290         if eval $compile; then
10291                 case "`./try$exe_ext`" in
10292                 int32_t)
10293                         i32type=int32_t
10294                         u32type=uint32_t
10295                         i32size=4
10296                         u32size=4
10297                         ;;
10298                 esac
10299         fi
10300         ;;
10301 esac
10302 case "$i32type" in
10303 '')     if $test $intsize -ge 4; then
10304                 i32type=int
10305                 u32type="unsigned int"
10306                 i32size=$intsize
10307                 u32size=$intsize
10308         fi
10309         ;;
10310 esac
10311
10312 case "$i64type" in
10313 '')     case "$d_quad:$quadtype" in
10314         define:?*)
10315                 i64type="$quadtype"
10316                 u64type="$uquadtype"
10317                 i64size=8
10318                 u64size=8
10319                 ;;
10320         esac
10321         ;;
10322 esac
10323
10324 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10325 : volatile so that the compiler has to store it out to memory.
10326 if test X"$d_volatile" = X"$define"; then
10327         volatile=volatile
10328 fi
10329 $cat <<EOP >try.c
10330 #include <stdio.h>
10331 #include <sys/types.h>
10332 #include <signal.h>
10333 #ifdef SIGFPE
10334 $volatile int bletched = 0;
10335 $signal_t blech(s) int s; { bletched = 1; }
10336 #endif
10337 int main() {
10338     $uvtype u = 0;
10339     $nvtype d;
10340     int     n = 8 * $uvsize;
10341     int     i;
10342 #ifdef SIGFPE
10343     signal(SIGFPE, blech);
10344 #endif
10345
10346     for (i = 0; i < n; i++) {
10347       u = u << 1 | ($uvtype)1;
10348       d = ($nvtype)u;
10349       if (($uvtype)d != u)
10350         break;
10351       if (d <= 0)
10352         break;
10353       d = ($nvtype)(u - 1);
10354       if (($uvtype)d != (u - 1))
10355         break;
10356 #ifdef SIGFPE
10357       if (bletched) {
10358         break;
10359 #endif
10360       } 
10361     }
10362     printf("%d\n", ((i == n) ? -n : i));
10363     exit(0);
10364 }
10365 EOP
10366 set try
10367
10368 d_nv_preserves_uv="$undef"
10369 if eval $compile; then
10370         d_nv_preserves_uv_bits="`./try$exe_ext`"
10371 fi
10372 case "$d_nv_preserves_uv_bits" in
10373 \-[1-9]*)       
10374         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10375         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10376         d_nv_preserves_uv="$define"
10377         ;;
10378 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10379         d_nv_preserves_uv="$undef" ;;
10380 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10381         d_nv_preserves_uv_bits="$undef" ;;
10382 esac
10383
10384 $rm -f try.* try
10385
10386
10387 : check for off64_t
10388 echo " "
10389 echo "Checking to see if you have off64_t..." >&4
10390 $cat >try.c <<EOCP
10391 #include <sys/types.h>
10392 #include <unistd.h>
10393 int main() { off64_t x = 7; }
10394 EOCP
10395 set try
10396 if eval $compile; then
10397         val="$define"
10398         echo "You have off64_t."
10399 else
10400         val="$undef"
10401         echo "You do not have off64_t."
10402         case "$lseeksize" in
10403         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10404         esac
10405 fi
10406 $rm -f try.* try
10407 set d_off64_t
10408 eval $setvar
10409
10410 : see if POSIX threads are available
10411 set pthread.h i_pthread
10412 eval $inhdr
10413
10414
10415
10416
10417 : how to create joinable pthreads
10418 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10419         echo " "
10420         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10421         $cat >try.c <<'EOCP'
10422 #include <pthread.h>
10423 int main() {
10424     int detachstate = JOINABLE;
10425 }
10426 EOCP
10427         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10428         if eval $compile; then
10429                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10430                 val="$undef" # Yes, undef.
10431                 set d_old_pthread_create_joinable
10432                 eval $setvar
10433                 val=""
10434                 set old_pthread_create_joinable
10435                 eval $setvar
10436         else
10437                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10438                 if eval $compile; then
10439                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10440                         val="$define"
10441                         set d_old_pthread_create_joinable
10442                         eval $setvar
10443                         val=PTHREAD_CREATE_UNDETACHED
10444                         set old_pthread_create_joinable
10445                         eval $setvar
10446                 else            
10447                         set try -DJOINABLE=__UNDETACHED
10448                         if eval $compile; then
10449                                 echo "You seem to use __UNDETACHED." >&4
10450                                 val="$define"
10451                                 set d_old_pthread_create_joinable
10452                                 eval $setvar
10453                                 val=__UNDETACHED
10454                                 set old_pthread_create_joinable
10455                                 eval $setvar
10456                         else
10457                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10458                                 val="$define"
10459                                 set d_old_pthread_create_joinable
10460                                 eval $setvar
10461                                 val=0
10462                                 set old_pthread_create_joinable
10463                                 eval $setvar
10464                         fi
10465                 fi
10466         fi
10467         $rm -f try try.*
10468 else
10469     d_old_pthread_create_joinable="$undef"
10470     old_pthread_create_joinable=""
10471 fi
10472
10473 : see if pause exists
10474 set pause d_pause
10475 eval $inlibc
10476
10477 : see if pipe exists
10478 set pipe d_pipe
10479 eval $inlibc
10480
10481 : see if poll exists
10482 set poll d_poll
10483 eval $inlibc
10484
10485
10486 : see whether the various POSIXish _yields exist
10487 $cat >try.c <<EOP
10488 #include <pthread.h>
10489 #include <stdio.h>
10490 int main() {
10491 #ifdef SCHED_YIELD
10492         sched_yield();
10493 #else
10494 #ifdef PTHREAD_YIELD
10495         pthread_yield();
10496 #else
10497 #ifdef PTHREAD_YIELD_NULL
10498         pthread_yield(NULL);
10499 #endif
10500 #endif
10501 #endif
10502 }
10503 EOP
10504 : see if sched_yield exists
10505 set try -DSCHED_YIELD
10506 if eval $compile; then
10507     val="$define"
10508     sched_yield='sched_yield()'
10509 else
10510     val="$undef"
10511 fi
10512 case "$usethreads" in
10513 $define)
10514         case "$val" in
10515         $define) echo 'sched_yield() found.' >&4        ;;
10516         *)       echo 'sched_yield() NOT found.' >&4    ;;
10517         esac
10518 esac
10519 set d_sched_yield
10520 eval $setvar
10521
10522 : see if pthread_yield exists
10523 set try -DPTHREAD_YIELD
10524 if eval $compile; then
10525     val="$define"
10526     case "$sched_yield" in
10527     '') sched_yield='pthread_yield()' ;;
10528     esac
10529 else
10530     set try -DPTHREAD_YIELD_NULL
10531     if eval $compile; then
10532         val="$define"
10533         case "$sched_yield" in
10534         '') sched_yield='pthread_yield(NULL)' ;;
10535         esac
10536     else
10537         val="$undef"
10538     fi
10539 fi
10540 case "$usethreads" in
10541 $define)
10542         case "$val" in
10543         $define) echo 'pthread_yield() found.' >&4      ;;
10544         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10545         esac
10546         ;;
10547 esac
10548 set d_pthread_yield
10549 eval $setvar
10550
10551 case "$sched_yield" in
10552 '') sched_yield=undef ;;
10553 esac
10554
10555 $rm -f try try.*
10556
10557 : see if this is a pwd.h system
10558 set pwd.h i_pwd
10559 eval $inhdr
10560
10561 case "$i_pwd" in
10562 $define)
10563         xxx=`./findhdr pwd.h`
10564         $cppstdin $cppflags $cppminus < $xxx >$$.h
10565
10566         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10567                 val="$define"
10568         else
10569                 val="$undef"
10570         fi
10571         set d_pwquota
10572         eval $setvar
10573
10574         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10575                 val="$define"
10576         else
10577                 val="$undef"
10578         fi
10579         set d_pwage
10580         eval $setvar
10581
10582         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10583                 val="$define"
10584         else
10585                 val="$undef"
10586         fi
10587         set d_pwchange
10588         eval $setvar
10589
10590         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10591                 val="$define"
10592         else
10593                 val="$undef"
10594         fi
10595         set d_pwclass
10596         eval $setvar
10597
10598         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10599                 val="$define"
10600         else
10601                 val="$undef"
10602         fi
10603         set d_pwexpire
10604         eval $setvar
10605
10606         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10607                 val="$define"
10608         else
10609                 val="$undef"
10610         fi
10611         set d_pwcomment
10612         eval $setvar
10613
10614         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10615                 val="$define"
10616         else
10617                 val="$undef"
10618         fi
10619         set d_pwgecos
10620         eval $setvar
10621
10622         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10623                 val="$define"
10624         else
10625                 val="$undef"
10626         fi
10627         set d_pwpasswd
10628         eval $setvar
10629
10630         $rm -f $$.h
10631         ;;
10632 *)
10633         val="$undef"; 
10634         set d_pwquota; eval $setvar
10635         set d_pwage; eval $setvar
10636         set d_pwchange; eval $setvar
10637         set d_pwclass; eval $setvar
10638         set d_pwexpire; eval $setvar
10639         set d_pwcomment; eval $setvar
10640         set d_pwgecos; eval $setvar
10641         set d_pwpasswd; eval $setvar
10642         ;;
10643 esac
10644
10645 : see if readdir and friends exist
10646 set readdir d_readdir
10647 eval $inlibc
10648 set seekdir d_seekdir
10649 eval $inlibc
10650 set telldir d_telldir
10651 eval $inlibc
10652 set rewinddir d_rewinddir
10653 eval $inlibc
10654
10655 : see if readlink exists
10656 set readlink d_readlink
10657 eval $inlibc
10658
10659 : see if rename exists
10660 set rename d_rename
10661 eval $inlibc
10662
10663 : see if rmdir exists
10664 set rmdir d_rmdir
10665 eval $inlibc
10666
10667 : see if memory.h is available.
10668 val=''
10669 set memory.h val
10670 eval $inhdr
10671
10672 : See if it conflicts with string.h
10673 case "$val" in
10674 $define)
10675         case "$strings" in
10676         '') ;;
10677         *)
10678                 $cppstdin $cppflags $cppminus < $strings > mem.h
10679                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10680                         echo " "
10681                         echo "We won't be including <memory.h>."
10682                         val="$undef"
10683                 fi
10684                 $rm -f mem.h
10685                 ;;
10686         esac
10687 esac
10688 set i_memory
10689 eval $setvar
10690
10691 : can bcopy handle overlapping blocks?
10692 val="$undef"
10693 case "$d_bcopy" in
10694 "$define")
10695         echo " "
10696         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10697         $cat >try.c <<EOCP
10698 #$i_memory I_MEMORY
10699 #$i_stdlib I_STDLIB
10700 #$i_string I_STRING
10701 #$i_unistd I_UNISTD
10702 EOCP
10703         $cat >>try.c <<'EOCP'
10704 #include <stdio.h>
10705 #ifdef I_MEMORY
10706 #  include <memory.h>
10707 #endif
10708 #ifdef I_STDLIB
10709 #  include <stdlib.h>
10710 #endif
10711 #ifdef I_STRING
10712 #  include <string.h>
10713 #else
10714 #  include <strings.h>
10715 #endif
10716 #ifdef I_UNISTD
10717 #  include <unistd.h>  /* Needed for NetBSD */
10718 #endif
10719 int main()
10720 {
10721 char buf[128], abc[128];
10722 char *b;
10723 int len;
10724 int off;
10725 int align;
10726
10727 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10728
10729 for (align = 7; align >= 0; align--) {
10730         for (len = 36; len; len--) {
10731                 b = buf+align;
10732                 bcopy(abc, b, len);
10733                 for (off = 1; off <= len; off++) {
10734                         bcopy(b, b+off, len);
10735                         bcopy(b+off, b, len);
10736                         if (bcmp(b, abc, len))
10737                                 exit(1);
10738                 }
10739         }
10740 }
10741 exit(0);
10742 }
10743 EOCP
10744         set try
10745         if eval $compile_ok; then
10746                 if ./try 2>/dev/null; then
10747                         echo "Yes, it can."
10748                         val="$define"
10749                 else
10750                         echo "It can't, sorry."
10751                         case "$d_memmove" in
10752                         "$define") echo "But that's Ok since you have memmove()." ;;
10753                         esac
10754                 fi
10755         else
10756                 echo "(I can't compile the test program, so we'll assume not...)"
10757                 case "$d_memmove" in
10758                 "$define") echo "But that's Ok since you have memmove()." ;;
10759                 esac
10760         fi
10761         ;;
10762 esac
10763 $rm -f try.* try core
10764 set d_safebcpy
10765 eval $setvar
10766
10767 : can memcpy handle overlapping blocks?
10768 val="$undef"
10769 case "$d_memcpy" in
10770 "$define")
10771         echo " "
10772         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10773         $cat >try.c <<EOCP
10774 #$i_memory I_MEMORY
10775 #$i_stdlib I_STDLIB
10776 #$i_string I_STRING
10777 #$i_unistd I_UNISTD
10778 EOCP
10779         $cat >>try.c <<'EOCP'
10780 #include <stdio.h>
10781 #ifdef I_MEMORY
10782 #  include <memory.h>
10783 #endif
10784 #ifdef I_STDLIB
10785 #  include <stdlib.h>
10786 #endif
10787 #ifdef I_STRING
10788 #  include <string.h>
10789 #else
10790 #  include <strings.h>
10791 #endif
10792 #ifdef I_UNISTD
10793 #  include <unistd.h>  /* Needed for NetBSD */
10794 #endif
10795 int main()
10796 {
10797 char buf[128], abc[128];
10798 char *b;
10799 int len;
10800 int off;
10801 int align;
10802
10803 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10804    try to store the string in read-only memory. */
10805 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10806
10807 for (align = 7; align >= 0; align--) {
10808         for (len = 36; len; len--) {
10809                 b = buf+align;
10810                 memcpy(b, abc, len);
10811                 for (off = 1; off <= len; off++) {
10812                         memcpy(b+off, b, len);
10813                         memcpy(b, b+off, len);
10814                         if (memcmp(b, abc, len))
10815                                 exit(1);
10816                 }
10817         }
10818 }
10819 exit(0);
10820 }
10821 EOCP
10822         set try
10823         if eval $compile_ok; then
10824                 if ./try 2>/dev/null; then
10825                         echo "Yes, it can."
10826                         val="$define"
10827                 else
10828                         echo "It can't, sorry."
10829                         case "$d_memmove" in
10830                         "$define") echo "But that's Ok since you have memmove()." ;;
10831                         esac
10832                 fi
10833         else
10834                 echo "(I can't compile the test program, so we'll assume not...)"
10835                 case "$d_memmove" in
10836                 "$define") echo "But that's Ok since you have memmove()." ;;
10837                 esac
10838         fi
10839         ;;
10840 esac
10841 $rm -f try.* try core
10842 set d_safemcpy
10843 eval $setvar
10844
10845 : can memcmp be trusted to compare relative magnitude?
10846 val="$undef"
10847 case "$d_memcmp" in
10848 "$define")
10849         echo " "
10850         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10851         $cat >try.c <<EOCP
10852 #$i_memory I_MEMORY
10853 #$i_stdlib I_STDLIB
10854 #$i_string I_STRING
10855 #$i_unistd I_UNISTD
10856 EOCP
10857         $cat >>try.c <<'EOCP'
10858 #include <stdio.h>
10859 #ifdef I_MEMORY
10860 #  include <memory.h>
10861 #endif
10862 #ifdef I_STDLIB
10863 #  include <stdlib.h>
10864 #endif
10865 #ifdef I_STRING
10866 #  include <string.h>
10867 #else
10868 #  include <strings.h>
10869 #endif
10870 #ifdef I_UNISTD
10871 #  include <unistd.h>  /* Needed for NetBSD */
10872 #endif
10873 int main()
10874 {
10875 char a = -1;
10876 char b = 0;
10877 if ((a < b) && memcmp(&a, &b, 1) < 0)
10878         exit(1);
10879 exit(0);
10880 }
10881 EOCP
10882         set try
10883         if eval $compile_ok; then
10884                 if ./try 2>/dev/null; then
10885                         echo "Yes, it can."
10886                         val="$define"
10887                 else
10888                         echo "No, it can't (it uses signed chars)."
10889                 fi
10890         else
10891                 echo "(I can't compile the test program, so we'll assume not...)"
10892         fi
10893         ;;
10894 esac
10895 $rm -f try.* try core
10896 set d_sanemcmp
10897 eval $setvar
10898
10899 : see if prototype for sbrk is available
10900 echo " "
10901 set d_sbrkproto sbrk $i_unistd unistd.h
10902 eval $hasproto
10903
10904 : see if select exists
10905 set select d_select
10906 eval $inlibc
10907
10908 : see if semctl exists
10909 set semctl d_semctl
10910 eval $inlibc
10911
10912 : see if semget exists
10913 set semget d_semget
10914 eval $inlibc
10915
10916 : see if semop exists
10917 set semop d_semop
10918 eval $inlibc
10919
10920 : see how much of the 'sem*(2)' library is present.
10921 h_sem=true
10922 echo " "
10923 case "$d_semctl$d_semget$d_semop" in
10924 *"$undef"*) h_sem=false;;
10925 esac
10926 case "$osname" in
10927 freebsd)
10928     case "`ipcs 2>&1`" in
10929     "SVID messages"*"not configured"*)
10930         echo "Your $osname does not have the sem*(2) configured." >&4
10931         h_sem=false
10932         val="$undef"
10933         set semctl d_semctl
10934         eval $setvar
10935         set semget d_semget
10936         eval $setvar
10937         set semop d_semop
10938         eval $setvar
10939         ;;
10940     esac
10941     ;;
10942 esac
10943 : we could also check for sys/ipc.h ...
10944 if $h_sem && $test `./findhdr sys/sem.h`; then
10945         echo "You have the full sem*(2) library." >&4
10946         val="$define"
10947 else
10948         echo "You don't have the full sem*(2) library." >&4
10949         val="$undef"
10950 fi
10951 set d_sem
10952 eval $setvar
10953
10954 : see whether sys/sem.h defines union semun
10955 echo " "
10956 $cat > try.c <<'END'
10957 #include <sys/types.h>
10958 #include <sys/ipc.h>
10959 #include <sys/sem.h>
10960 int main () { union semun semun; semun.buf = 0; }
10961 END
10962 set try
10963 if eval $compile; then
10964     echo "You have union semun in <sys/sem.h>." >&4
10965     val="$define"
10966 else
10967     echo "You do not have union semun in <sys/sem.h>." >&4
10968     val="$undef"
10969 fi
10970 $rm -f try try.c try.h
10971 set d_union_semun
10972 eval $setvar
10973
10974 : see how to do semctl IPC_STAT
10975 case "$d_sem" in
10976 $define)
10977     : see whether semctl IPC_STAT can use union semun
10978     echo " "
10979     $cat > try.h <<END
10980 #ifndef S_IRUSR
10981 #   ifdef S_IREAD
10982 #       define S_IRUSR S_IREAD
10983 #       define S_IWUSR S_IWRITE
10984 #       define S_IXUSR S_IEXEC
10985 #   else
10986 #       define S_IRUSR 0400
10987 #       define S_IWUSR 0200
10988 #       define S_IXUSR 0100
10989 #   endif
10990 #   define S_IRGRP (S_IRUSR>>3)
10991 #   define S_IWGRP (S_IWUSR>>3)
10992 #   define S_IXGRP (S_IXUSR>>3)
10993 #   define S_IROTH (S_IRUSR>>6)
10994 #   define S_IWOTH (S_IWUSR>>6)
10995 #   define S_IXOTH (S_IXUSR>>6)
10996 #endif
10997 #ifndef S_IRWXU
10998 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10999 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11000 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11001 #endif
11002 END
11003
11004     $cat > try.c <<END
11005 #include <sys/types.h>
11006 #include <sys/ipc.h>
11007 #include <sys/sem.h>
11008 #include <sys/stat.h>
11009 #include <stdio.h>
11010 #include <errno.h>
11011 #include "try.h"
11012 #ifndef errno
11013 extern int errno;
11014 #endif
11015 #$d_union_semun HAS_UNION_SEMUN
11016 int main() {
11017     union semun
11018 #ifndef HAS_UNION_SEMUN
11019     {
11020         int val;
11021         struct semid_ds *buf;
11022         unsigned short *array;
11023     }
11024 #endif
11025     arg;
11026     int sem, st;
11027
11028 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11029     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11030     if (sem > -1) {
11031         struct semid_ds argbuf;
11032         arg.buf = &argbuf;
11033 #       ifdef IPC_STAT
11034         st = semctl(sem, 0, IPC_STAT, arg);
11035         if (st == 0)
11036             printf("semun\n");
11037         else
11038 #       endif /* IPC_STAT */
11039             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11040 #       ifdef IPC_RMID
11041         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11042 #       endif /* IPC_RMID */
11043             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11044     } else
11045 #endif /* IPC_PRIVATE && ... */
11046         printf("semget failed: errno = %d\n", errno);
11047   return 0;
11048 }
11049 END
11050     val="$undef"
11051     set try
11052     if eval $compile; then
11053         xxx=`./try`
11054         case "$xxx" in
11055         semun) val="$define" ;;
11056         esac
11057     fi
11058     $rm -f try try.c
11059     set d_semctl_semun
11060     eval $setvar
11061     case "$d_semctl_semun" in
11062     $define)
11063         echo "You can use union semun for semctl IPC_STAT." >&4
11064         also='also'
11065         ;;
11066     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11067         also=''
11068         ;;
11069     esac
11070
11071     : see whether semctl IPC_STAT can use struct semid_ds pointer
11072     $cat > try.c <<'END'
11073 #include <sys/types.h>
11074 #include <sys/ipc.h>
11075 #include <sys/sem.h>
11076 #include <sys/stat.h>
11077 #include "try.h"
11078 #include <stdio.h>
11079 #include <errno.h>
11080 #ifndef errno
11081 extern int errno;
11082 #endif
11083 int main() {
11084     struct semid_ds arg;
11085     int sem, st;
11086
11087 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11088     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11089     if (sem > -1) {
11090 #       ifdef IPC_STAT
11091         st = semctl(sem, 0, IPC_STAT, &arg);
11092         if (st == 0)
11093             printf("semid_ds\n");
11094         else
11095 #       endif /* IPC_STAT */
11096             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11097 #       ifdef IPC_RMID
11098         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11099 #       endif /* IPC_RMID */
11100             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11101     } else
11102 #endif /* IPC_PRIVATE && ... */
11103         printf("semget failed: errno = %d\n", errno);
11104
11105     return 0;
11106 }
11107 END
11108     val="$undef"
11109     set try
11110     if eval $compile; then
11111         xxx=`./try`
11112         case "$xxx" in
11113         semid_ds) val="$define" ;;
11114         esac
11115     fi
11116     $rm -f try try.c
11117     set d_semctl_semid_ds
11118     eval $setvar
11119     case "$d_semctl_semid_ds" in
11120     $define)
11121         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11122         ;;
11123     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11124         ;;
11125     esac
11126     $rm -f try.h
11127     ;;
11128 *)  val="$undef"
11129
11130     # We do not have the full sem*(2) library, so assume we can not
11131     # use either.
11132
11133     set d_semctl_semun
11134     eval $setvar
11135
11136     set d_semctl_semid_ds
11137     eval $setvar
11138     ;;
11139 esac
11140
11141 : see if setegid exists
11142 set setegid d_setegid
11143 eval $inlibc
11144
11145 : see if seteuid exists
11146 set seteuid d_seteuid
11147 eval $inlibc
11148
11149 : see if setgrent exists
11150 set setgrent d_setgrent
11151 eval $inlibc
11152
11153 : see if sethostent exists
11154 set sethostent d_sethent
11155 eval $inlibc
11156
11157 : see if setlinebuf exists
11158 set setlinebuf d_setlinebuf
11159 eval $inlibc
11160
11161 : see if setlocale exists
11162 set setlocale d_setlocale
11163 eval $inlibc
11164
11165 : see if setnetent exists
11166 set setnetent d_setnent
11167 eval $inlibc
11168
11169 : see if setprotoent exists
11170 set setprotoent d_setpent
11171 eval $inlibc
11172
11173 : see if setpgid exists
11174 set setpgid d_setpgid
11175 eval $inlibc
11176
11177 : see if setpgrp2 exists
11178 set setpgrp2 d_setpgrp2
11179 eval $inlibc
11180
11181 : see if setpriority exists
11182 set setpriority d_setprior
11183 eval $inlibc
11184
11185 : see if setproctitle exists
11186 set setproctitle d_setproctitle
11187 eval $inlibc
11188
11189 : see if setpwent exists
11190 set setpwent d_setpwent
11191 eval $inlibc
11192
11193 : see if setregid exists
11194 set setregid d_setregid
11195 eval $inlibc
11196 set setresgid d_setresgid
11197 eval $inlibc
11198
11199 : see if setreuid exists
11200 set setreuid d_setreuid
11201 eval $inlibc
11202 set setresuid d_setresuid
11203 eval $inlibc
11204
11205 : see if setrgid exists
11206 set setrgid d_setrgid
11207 eval $inlibc
11208
11209 : see if setruid exists
11210 set setruid d_setruid
11211 eval $inlibc
11212
11213 : see if setservent exists
11214 set setservent d_setsent
11215 eval $inlibc
11216
11217 : see if setsid exists
11218 set setsid d_setsid
11219 eval $inlibc
11220
11221 : see if setvbuf exists
11222 set setvbuf d_setvbuf
11223 eval $inlibc
11224
11225 : see if sfio.h is available
11226 set sfio.h i_sfio
11227 eval $inhdr
11228
11229
11230 : see if sfio library is available
11231 case "$i_sfio" in
11232 $define)
11233         val=''
11234         set sfreserve val
11235         eval $inlibc
11236         ;;
11237 *)
11238         val="$undef"
11239         ;;
11240 esac
11241 : Ok, but do we want to use it.
11242 case "$val" in
11243 $define)
11244         case "$usesfio" in
11245         true|$define|[yY]*) dflt='y';;
11246         *) dflt='n';;
11247         esac
11248         echo "$package can use the sfio library, but it is experimental."
11249         case "$useperlio" in
11250         "$undef")
11251             echo "For sfio also the PerlIO abstraction layer is needed."
11252             echo "Earlier you said you wouldn't want that."
11253             ;;
11254         esac
11255         rp="You seem to have sfio available, do you want to try using it?"
11256         . ./myread
11257         case "$ans" in
11258         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11259                 useperlio="$define"
11260                 val="$define"
11261                 ;;
11262         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11263                 val="$undef"
11264                 : Remove sfio from list of libraries to use
11265                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11266                 shift
11267                 libs="$*"
11268                 echo "libs = $libs" >&4
11269                 ;;
11270         esac
11271         ;;
11272 *)      case "$usesfio" in
11273         true|$define|[yY]*)
11274                 echo "Sorry, cannot find sfio on this machine." >&4
11275                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11276                 val="$undef"
11277                 ;;
11278         esac
11279         ;;
11280 esac
11281 set d_sfio
11282 eval $setvar
11283 case "$d_sfio" in
11284 $define) usesfio='true';;
11285 *) usesfio='false';;
11286 esac
11287
11288 : see if shmctl exists
11289 set shmctl d_shmctl
11290 eval $inlibc
11291
11292 : see if shmget exists
11293 set shmget d_shmget
11294 eval $inlibc
11295
11296 : see if shmat exists
11297 set shmat d_shmat
11298 eval $inlibc
11299 : see what shmat returns
11300 case "$d_shmat" in
11301 "$define")
11302         $cat >shmat.c <<'END'
11303 #include <sys/shm.h>
11304 void *shmat();
11305 END
11306         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11307                 shmattype='void *'
11308         else
11309                 shmattype='char *'
11310         fi
11311         echo "and it returns ($shmattype)." >&4
11312         : see if a prototype for shmat is available
11313         xxx=`./findhdr sys/shm.h`
11314         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11315         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11316                 val="$define"
11317         else
11318                 val="$undef"
11319         fi
11320         $rm -f shmat.[co]
11321         ;;
11322 *)
11323         val="$undef"
11324         ;;
11325 esac
11326 set d_shmatprototype
11327 eval $setvar
11328
11329 : see if shmdt exists
11330 set shmdt d_shmdt
11331 eval $inlibc
11332
11333 : see how much of the 'shm*(2)' library is present.
11334 h_shm=true
11335 echo " "
11336 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11337 *"$undef"*) h_shm=false;;
11338 esac
11339 case "$osname" in
11340 freebsd)
11341     case "`ipcs 2>&1`" in
11342     "SVID shared memory"*"not configured"*)
11343         echo "Your $osname does not have the shm*(2) configured." >&4
11344         h_shm=false
11345         val="$undef"
11346         set shmctl d_shmctl
11347         evat $setvar
11348         set shmget d_shmget
11349         evat $setvar
11350         set shmat d_shmat
11351         evat $setvar
11352         set shmdt d_shmdt
11353         evat $setvar
11354         ;;
11355     esac
11356     ;;
11357 esac
11358 : we could also check for sys/ipc.h ...
11359 if $h_shm && $test `./findhdr sys/shm.h`; then
11360         echo "You have the full shm*(2) library." >&4
11361         val="$define"
11362 else
11363         echo "You don't have the full shm*(2) library." >&4
11364         val="$undef"
11365 fi
11366 set d_shm
11367 eval $setvar
11368
11369 echo " "
11370 : see if we have sigaction
11371 if set sigaction val -f d_sigaction; eval $csym; $val; then
11372         echo 'sigaction() found.' >&4
11373         $cat > try.c <<'EOP'
11374 #include <stdio.h>
11375 #include <sys/types.h>
11376 #include <signal.h>
11377 int main()
11378 {
11379     struct sigaction act, oact;
11380     act.sa_flags = 0;
11381     oact.sa_handler = 0;
11382     /* so that act and oact are used */
11383     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11384 }
11385 EOP
11386         set try
11387         if eval $compile_ok; then
11388                 val="$define"
11389         else
11390                 echo "But you don't seem to have a useable struct sigaction." >&4
11391                 val="$undef"
11392         fi
11393 else
11394         echo 'sigaction NOT found.' >&4
11395         val="$undef"
11396 fi
11397 set d_sigaction; eval $setvar
11398 $rm -f try try$_o try.c
11399
11400 : see if sigsetjmp exists
11401 echo " "
11402 case "$d_sigsetjmp" in
11403 '')
11404         $cat >try.c <<'EOP'
11405 #include <setjmp.h>
11406 sigjmp_buf env;
11407 int set = 1;
11408 int main()
11409 {
11410         if (sigsetjmp(env,1))
11411                 exit(set);
11412         set = 0;
11413         siglongjmp(env, 1);
11414         exit(1);
11415 }
11416 EOP
11417         set try
11418         if eval $compile; then
11419                 if ./try >/dev/null 2>&1; then
11420                         echo "POSIX sigsetjmp found." >&4
11421                         val="$define"
11422                 else
11423                         $cat >&4 <<EOM
11424 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11425 I'll ignore them.
11426 EOM
11427                         val="$undef"
11428                 fi
11429         else
11430                 echo "sigsetjmp not found." >&4
11431                 val="$undef"
11432         fi
11433         ;;
11434 *) val="$d_sigsetjmp"
11435         case "$d_sigsetjmp" in
11436         $define) echo "POSIX sigsetjmp found." >&4;;
11437         $undef) echo "sigsetjmp not found." >&4;;
11438         esac
11439         ;;
11440 esac
11441 set d_sigsetjmp
11442 eval $setvar
11443 $rm -f try.c try
11444
11445 : see if socks5_init exists
11446 set socks5_init d_socks5_init
11447 eval $inlibc
11448
11449 : see if sys/stat.h is available
11450 set sys/stat.h i_sysstat
11451 eval $inhdr
11452
11453
11454 : see if stat knows about block sizes
11455 echo " "
11456 echo "Checking to see if your struct stat has st_blocks field..." >&4
11457 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11458 eval $hasfield
11459
11460
11461 : see if this is a sys/vfs.h system
11462 set sys/vfs.h i_sysvfs
11463 eval $inhdr
11464
11465
11466 : see if this is a sys/statfs.h system
11467 set sys/statfs.h i_sysstatfs
11468 eval $inhdr
11469
11470
11471 echo " "
11472 echo "Checking to see if your system supports struct statfs..." >&4
11473 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
11474 eval $hasstruct
11475 case "$d_statfs_s" in
11476 "$define")      echo "Yes, it does."   ;;
11477 *)              echo "No, it doesn't." ;;
11478 esac
11479
11480
11481
11482 : see if struct statfs knows about f_flags
11483 case "$d_statfs_s" in
11484 define) 
11485         echo " "
11486         echo "Checking to see if your struct statfs has f_flags field..." >&4
11487         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
11488         eval $hasfield
11489         ;;
11490 *)      val="$undef"
11491         set d_statfs_f_flags
11492         eval $setvar
11493         ;;
11494 esac
11495 case "$d_statfs_f_flags" in
11496 "$define")      echo "Yes, it does."   ;;
11497 *)              echo "No, it doesn't." ;;
11498 esac
11499
11500 : see if _ptr and _cnt from stdio act std
11501 echo " "
11502
11503 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11504         echo "(Looks like you have stdio.h from BSD.)"
11505         case "$stdio_ptr" in
11506         '') stdio_ptr='((fp)->_p)'
11507                 ptr_lval=$define
11508                 ;;
11509         *)      ptr_lval=$d_stdio_ptr_lval;;
11510         esac
11511         case "$stdio_cnt" in
11512         '') stdio_cnt='((fp)->_r)'
11513                 cnt_lval=$define
11514                 ;;
11515         *)      cnt_lval=$d_stdio_cnt_lval;;
11516         esac
11517         case "$stdio_base" in
11518         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11519         esac
11520         case "$stdio_bufsiz" in
11521         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11522         esac
11523 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11524         echo "(Looks like you have stdio.h from Linux.)"
11525         case "$stdio_ptr" in
11526         '') stdio_ptr='((fp)->_IO_read_ptr)'
11527                 ptr_lval=$define
11528                 ;;
11529         *)      ptr_lval=$d_stdio_ptr_lval;;
11530         esac
11531         case "$stdio_cnt" in
11532         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11533                 cnt_lval=$undef
11534                 ;;
11535         *)      cnt_lval=$d_stdio_cnt_lval;;
11536         esac
11537         case "$stdio_base" in
11538         '') stdio_base='((fp)->_IO_read_base)';;
11539         esac
11540         case "$stdio_bufsiz" in
11541         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11542         esac
11543 else
11544         case "$stdio_ptr" in
11545         '') stdio_ptr='((fp)->_ptr)'
11546                 ptr_lval=$define
11547                 ;;
11548         *)      ptr_lval=$d_stdio_ptr_lval;;
11549         esac
11550         case "$stdio_cnt" in
11551         '') stdio_cnt='((fp)->_cnt)'
11552                 cnt_lval=$define
11553                 ;;
11554         *)      cnt_lval=$d_stdio_cnt_lval;;
11555         esac
11556         case "$stdio_base" in
11557         '') stdio_base='((fp)->_base)';;
11558         esac
11559         case "$stdio_bufsiz" in
11560         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11561         esac
11562 fi
11563
11564 : test whether _ptr and _cnt really work
11565 echo "Checking how std your stdio is..." >&4
11566 $cat >try.c <<EOP
11567 #include <stdio.h>
11568 #define FILE_ptr(fp)    $stdio_ptr
11569 #define FILE_cnt(fp)    $stdio_cnt
11570 int main() {
11571         FILE *fp = fopen("try.c", "r");
11572         char c = getc(fp);
11573         if (
11574                 18 <= FILE_cnt(fp) &&
11575                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11576         )
11577                 exit(0);
11578         exit(1);
11579 }
11580 EOP
11581 val="$undef"
11582 set try
11583 if eval $compile; then
11584         if ./try; then
11585                 echo "Your stdio acts pretty std."
11586                 val="$define"
11587         else
11588                 echo "Your stdio isn't very std."
11589         fi
11590 else
11591         echo "Your stdio doesn't appear very std."
11592 fi
11593 $rm -f try.c try
11594 set d_stdstdio
11595 eval $setvar
11596
11597 : Can _ptr be used as an lvalue?
11598 case "$d_stdstdio$ptr_lval" in
11599 $define$define) val=$define ;;
11600 *) val=$undef ;;
11601 esac
11602 set d_stdio_ptr_lval
11603 eval $setvar
11604
11605 : Can _cnt be used as an lvalue?
11606 case "$d_stdstdio$cnt_lval" in
11607 $define$define) val=$define ;;
11608 *) val=$undef ;;
11609 esac
11610 set d_stdio_cnt_lval
11611 eval $setvar
11612
11613
11614 : test whether setting _ptr sets _cnt as a side effect
11615 d_stdio_ptr_lval_sets_cnt="$undef"
11616 d_stdio_ptr_lval_nochange_cnt="$undef"
11617 case "$d_stdio_ptr_lval$d_stdstdio" in
11618 $define$define)
11619         echo "Checking to see what happens if we set the stdio ptr..." >&4
11620 $cat >try.c <<EOP
11621 #include <stdio.h>
11622 /* Can we scream? */
11623 /* Eat dust sed :-) */
11624 /* In the buffer space, no one can hear you scream. */
11625 #define FILE_ptr(fp)    $stdio_ptr
11626 #define FILE_cnt(fp)    $stdio_cnt
11627 #include <sys/types.h>
11628 int main() {
11629         FILE *fp = fopen("try.c", "r");
11630         int c;
11631         char *ptr;
11632         size_t cnt;
11633         if (!fp) {
11634             puts("Fail even to read");
11635             exit(1);
11636         }
11637         c = getc(fp); /* Read away the first # */
11638         if (c == EOF) {
11639             puts("Fail even to read");
11640             exit(1);
11641         }
11642         if (!(
11643                 18 <= FILE_cnt(fp) &&
11644                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11645         )) {
11646                 puts("Fail even to read");
11647                 exit (1);
11648         }
11649         ptr = (char*) FILE_ptr(fp);
11650         cnt = (size_t)FILE_cnt(fp);
11651
11652         FILE_ptr(fp) += 42;
11653
11654         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11655                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11656                 exit (1);
11657         }
11658         if (FILE_cnt(fp) <= 20) {
11659                 printf ("Fail (<20 chars to test)");
11660                 exit (1);
11661         }
11662         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11663                 puts("Fail compare");
11664                 exit (1);
11665         }
11666         if (cnt == FILE_cnt(fp)) {
11667                 puts("Pass_unchanged");
11668                 exit (0);
11669         }       
11670         if (FILE_cnt(fp) == (cnt - 42)) {
11671                 puts("Pass_changed");
11672                 exit (0);
11673         }
11674         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11675         return 1;
11676
11677 }
11678 EOP
11679         set try
11680         if eval $compile; then
11681                 case `./try$exe_ext` in
11682                 Pass_changed)
11683                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11684                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11685                 Pass_unchanged)
11686                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11687                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11688                 Fail*)
11689                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11690                 *)
11691                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11692         esac
11693         else
11694                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11695         fi
11696         $rm -f try.c try
11697         ;;
11698 esac
11699
11700 : see if _base is also standard
11701 val="$undef"
11702 case "$d_stdstdio" in
11703 $define)
11704         $cat >try.c <<EOP
11705 #include <stdio.h>
11706 #define FILE_base(fp)   $stdio_base
11707 #define FILE_bufsiz(fp) $stdio_bufsiz
11708 int main() {
11709         FILE *fp = fopen("try.c", "r");
11710         char c = getc(fp);
11711         if (
11712                 19 <= FILE_bufsiz(fp) &&
11713                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11714         )
11715                 exit(0);
11716         exit(1);
11717 }
11718 EOP
11719         set try
11720         if eval $compile; then
11721                 if ./try; then
11722                         echo "And its _base field acts std."
11723                         val="$define"
11724                 else
11725                         echo "But its _base field isn't std."
11726                 fi
11727         else
11728                 echo "However, it seems to be lacking the _base field."
11729         fi
11730         $rm -f try.c try
11731         ;;
11732 esac
11733 set d_stdiobase
11734 eval $setvar
11735
11736 $cat >&4 <<EOM
11737 Checking how to access stdio streams by file descriptor number...
11738 EOM
11739 case "$stdio_stream_array" in
11740 '')     $cat >try.c <<EOCP
11741 #include <stdio.h>
11742 int main() {
11743   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11744     printf("yes\n");
11745 }
11746 EOCP
11747         for s in _iob __iob __sF
11748         do
11749                 set try -DSTDIO_STREAM_ARRAY=$s
11750                 if eval $compile; then
11751                         case "`./try$exe_ext`" in
11752                         yes)    stdio_stream_array=$s; break ;;
11753                         esac
11754                 fi
11755         done
11756         $rm -f try.* try$exe_ext
11757 esac
11758 case "$stdio_stream_array" in
11759 '')     $cat >&4 <<EOM
11760 I can't figure out how to access stdio streams by file descriptor number.
11761 EOM
11762         d_stdio_stream_array="$undef"
11763         ;;
11764 *)      $cat >&4 <<EOM
11765 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11766 EOM
11767         d_stdio_stream_array="$define"
11768         ;;
11769 esac
11770
11771 : see if strcoll exists
11772 set strcoll d_strcoll
11773 eval $inlibc
11774
11775 : check for structure copying
11776 echo " "
11777 echo "Checking to see if your C compiler can copy structs..." >&4
11778 $cat >try.c <<'EOCP'
11779 int main()
11780 {
11781         struct blurfl {
11782                 int dyick;
11783         } foo, bar;
11784
11785         foo = bar;
11786 }
11787 EOCP
11788 if $cc -c try.c >/dev/null 2>&1 ; then
11789         val="$define"
11790         echo "Yup, it can."
11791 else
11792         val="$undef"
11793         echo "Nope, it can't."
11794 fi
11795 set d_strctcpy
11796 eval $setvar
11797 $rm -f try.*
11798
11799 : see if strerror and/or sys_errlist[] exist
11800 echo " "
11801 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11802     if set strerror val -f d_strerror; eval $csym; $val; then
11803                 echo 'strerror() found.' >&4
11804                 d_strerror="$define"
11805                 d_strerrm='strerror(e)'
11806                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11807                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11808                         d_syserrlst="$define"
11809                 else
11810                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11811                         d_syserrlst="$undef"
11812                 fi
11813     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11814                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11815                 echo 'strerror() found in string header.' >&4
11816                 d_strerror="$define"
11817                 d_strerrm='strerror(e)'
11818                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11819                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11820                                 d_syserrlst="$define"
11821                 else
11822                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11823                         d_syserrlst="$undef"
11824                 fi
11825     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11826                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11827                 d_strerror="$undef"
11828                 d_syserrlst="$define"
11829                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11830     else
11831                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11832                 d_strerror="$undef"
11833                 d_syserrlst="$undef"
11834                 d_strerrm='"unknown"'
11835     fi
11836 fi
11837
11838 : see if strtod exists
11839 set strtod d_strtod
11840 eval $inlibc
11841
11842 : see if strtol exists
11843 set strtol d_strtol
11844 eval $inlibc
11845
11846 : see if strtold exists
11847 set strtold d_strtold
11848 eval $inlibc
11849
11850 : see if strtoll exists
11851 set strtoll d_strtoll
11852 eval $inlibc
11853
11854 case "$d_longlong-$d_strtoll" in
11855 "$define-$define")
11856         $cat <<EOM
11857 Checking whether your strtoll() works okay...
11858 EOM
11859         $cat >try.c <<'EOCP'
11860 #include <errno.h>
11861 #ifdef __hpux
11862 #define strtoll __strtoll
11863 #endif
11864 #ifdef __EMX__
11865 #define strtoll _strtoll
11866 #endif
11867 #include <stdio.h>
11868 extern long long int strtoll(char *s, char **, int); 
11869 static int bad = 0;
11870 int check(char *s, long long ell, int een) {
11871         long long gll;
11872         errno = 0;
11873         gll = strtoll(s, 0, 10);
11874         if (!((gll == ell) && (errno == een)))
11875                 bad++;
11876 }
11877 int main() {
11878         check(" 1",                                      1LL, 0);
11879         check(" 0",                                      0LL, 0);
11880         check("-1",                                     -1LL, 0);
11881         check("-9223372036854775808", -9223372036854775808LL, 0);
11882         check("-9223372036854775808", -9223372036854775808LL, 0);
11883         check(" 9223372036854775807",  9223372036854775807LL, 0);
11884         check("-9223372036854775808", -9223372036854775808LL, 0);
11885         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11886         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11887         if (!bad)
11888                 printf("ok\n");
11889 }
11890 EOCP
11891         set try
11892         if eval $compile; then
11893                 yyy=`./try`
11894                 case "$yyy" in
11895                 ok) echo "Your strtoll() seems to be working okay." ;;
11896                 *) cat <<EOM >&4
11897 Your strtoll() doesn't seem to be working okay.
11898 EOM
11899                    d_strtoll="$undef"
11900                    ;;
11901                 esac
11902         else
11903                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11904                 d_strtoll="$undef"
11905         fi
11906         ;;
11907 esac
11908
11909 : see if strtoul exists
11910 set strtoul d_strtoul
11911 eval $inlibc
11912
11913 : see if strtoull exists
11914 set strtoull d_strtoull
11915 eval $inlibc
11916
11917 case "$d_longlong-$d_strtoull" in
11918 "$define-$define")
11919         $cat <<EOM
11920 Checking whether your strtoull() works okay...
11921 EOM
11922         $cat >try.c <<'EOCP'
11923 #include <errno.h>
11924 #ifdef __hpux
11925 #define strtoull __strtoull
11926 #endif
11927 #include <stdio.h>
11928 extern unsigned long long int strtoull(char *s, char **, int); 
11929 static int bad = 0;
11930 int check(char *s, long long eull, int een) {
11931         long long gull;
11932         errno = 0;
11933         gull = strtoull(s, 0, 10);
11934         if (!((gull == eull) && (errno == een)))
11935                 bad++;
11936 }
11937 int main() {
11938         check(" 1",                                       1LL, 0);
11939         check(" 0",                                       0LL, 0);
11940         check("18446744073709551615", 18446744073709551615ULL, 0);
11941         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11942         if (!bad)
11943                 printf("ok\n");
11944 }
11945 EOCP
11946         set try
11947         if eval $compile; then
11948                 case "`./try`" in
11949                 ok) echo "Your strtoull() seems to be working okay." ;;
11950                 *) cat <<EOM >&4
11951 Your strtoull() doesn't seem to be working okay.
11952 EOM
11953                    d_strtoull="$undef"
11954                    ;;
11955                 esac
11956         fi
11957         ;;
11958 esac
11959
11960 : see if strtouq exists
11961 set strtouq d_strtouq
11962 eval $inlibc
11963
11964 : see if strxfrm exists
11965 set strxfrm d_strxfrm
11966 eval $inlibc
11967
11968 : see if symlink exists
11969 set symlink d_symlink
11970 eval $inlibc
11971
11972 : see if syscall exists
11973 set syscall d_syscall
11974 eval $inlibc
11975
11976 : see if sysconf exists
11977 set sysconf d_sysconf
11978 eval $inlibc
11979
11980 : see if system exists
11981 set system d_system
11982 eval $inlibc
11983
11984 : see if tcgetpgrp exists
11985 set tcgetpgrp d_tcgetpgrp
11986 eval $inlibc
11987
11988 : see if tcsetpgrp exists
11989 set tcsetpgrp d_tcsetpgrp
11990 eval $inlibc
11991
11992 : see if prototype for telldir is available
11993 echo " "
11994 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11995 eval $hasproto
11996
11997 : see if this is a sys/times.h system
11998 set sys/times.h i_systimes
11999 eval $inhdr
12000
12001 : see if times exists
12002 echo " "
12003 if set times val -f d_times; eval $csym; $val; then
12004         echo 'times() found.' >&4
12005         d_times="$define"
12006         inc=''
12007         case "$i_systimes" in
12008         "$define") inc='sys/times.h';;
12009         esac
12010         rp="What is the type returned by times() on this system?"
12011         set clock_t clocktype long stdio.h sys/types.h $inc
12012         eval $typedef_ask
12013 else
12014         echo 'times() NOT found, hope that will do.' >&4
12015         d_times="$undef"
12016         clocktype='int'
12017 fi
12018
12019 : see if truncate exists
12020 set truncate d_truncate
12021 eval $inlibc
12022
12023 : see if tzname[] exists
12024 echo " "
12025 if set tzname val -a d_tzname; eval $csym; $val; then
12026         val="$define"
12027         echo 'tzname[] found.' >&4
12028 else
12029         val="$undef"
12030         echo 'tzname[] NOT found.' >&4
12031 fi
12032 set d_tzname
12033 eval $setvar
12034
12035 : see if umask exists
12036 set umask d_umask
12037 eval $inlibc
12038
12039 : see if ustat exists
12040 set ustat d_ustat
12041 eval $inlibc
12042
12043 : backward compatibility for d_hvfork
12044 if test X$d_hvfork != X; then
12045         d_vfork="$d_hvfork"
12046         d_hvfork=''
12047 fi
12048 : see if there is a vfork
12049 val=''
12050 set vfork val
12051 eval $inlibc
12052
12053 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12054 : perl on Solaris 2.x, and probably elsewhere.
12055 case "$val" in
12056 $define)
12057         echo " "
12058         case "$usevfork" in
12059         false) dflt='n';;
12060         *) dflt='y';;
12061         esac
12062         cat <<'EOM'
12063  
12064 Perl can only use a vfork() that doesn't suffer from strict
12065 restrictions on calling functions or modifying global data in
12066 the child.  For example, glibc-2.1 contains such a vfork()
12067 that is unsuitable.  If your system provides a proper fork()
12068 call, chances are that you do NOT want perl to use vfork().
12069
12070 EOM
12071         rp="Do you still want to use vfork()?"
12072         . ./myread
12073         case "$ans" in
12074         y|Y) ;;
12075         *)
12076                 echo "Ok, we won't use vfork()."
12077                 val="$undef"
12078                 ;;
12079         esac
12080         ;;
12081 esac
12082 set d_vfork
12083 eval $setvar
12084 case "$d_vfork" in
12085 $define) usevfork='true';;
12086 *) usevfork='false';;
12087 esac
12088
12089 : see if this is an sysdir system
12090 set sys/dir.h i_sysdir
12091 eval $inhdr
12092
12093 : see if this is an sysndir system
12094 set sys/ndir.h i_sysndir
12095 eval $inhdr
12096
12097 : see if closedir exists
12098 set closedir d_closedir
12099 eval $inlibc
12100
12101 case "$d_closedir" in
12102 "$define")
12103         echo " "
12104         echo "Checking whether closedir() returns a status..." >&4
12105         cat > closedir.c <<EOM
12106 #$i_dirent I_DIRENT             /**/
12107 #$i_sysdir I_SYS_DIR            /**/
12108 #$i_sysndir I_SYS_NDIR          /**/
12109 #$i_systypes I_SYS_TYPES        /**/
12110
12111 #if defined(I_SYS_TYPES)
12112 #include <sys/types.h>
12113 #endif
12114 #if defined(I_DIRENT)
12115 #include <dirent.h>
12116 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12117 #include <sys/dir.h>
12118 #endif
12119 #else
12120 #ifdef I_SYS_NDIR
12121 #include <sys/ndir.h>
12122 #else
12123 #ifdef I_SYS_DIR
12124 #ifdef hp9000s500
12125 #include <ndir.h>       /* may be wrong in the future */
12126 #else
12127 #include <sys/dir.h>
12128 #endif
12129 #endif
12130 #endif
12131 #endif 
12132 int main() { return closedir(opendir(".")); }
12133 EOM
12134         set closedir
12135         if eval $compile_ok; then
12136                 if ./closedir > /dev/null 2>&1 ; then
12137                         echo "Yes, it does."
12138                         val="$undef"
12139                 else
12140                         echo "No, it doesn't."
12141                         val="$define"
12142                 fi
12143         else
12144                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12145                 val="$define"
12146         fi
12147         ;;
12148 *)
12149         val="$undef";
12150         ;;
12151 esac
12152 set d_void_closedir
12153 eval $setvar
12154 $rm -f closedir*
12155 : see if there is a wait4
12156 set wait4 d_wait4
12157 eval $inlibc
12158
12159 : see if waitpid exists
12160 set waitpid d_waitpid
12161 eval $inlibc
12162
12163 : see if wcstombs exists
12164 set wcstombs d_wcstombs
12165 eval $inlibc
12166
12167 : see if wctomb exists
12168 set wctomb d_wctomb
12169 eval $inlibc
12170
12171 : preserve RCS keywords in files with variable substitution, grrr
12172 Date='$Date'
12173 Id='$Id'
12174 Log='$Log'
12175 RCSfile='$RCSfile'
12176 Revision='$Revision'
12177
12178 case "$crosscompile" in
12179 ''|[nN]*) crosscompile="$undef" ;;
12180 esac
12181
12182 case "$osname" in
12183 next|rhapsody|darwin) multiarch="$define" ;;
12184 esac
12185 case "$multiarch" in
12186 ''|[nN]*) multiarch="$undef" ;;
12187 esac
12188
12189 : check for alignment requirements
12190 echo " "
12191 case "$crosscompile$multiarch" in
12192 *$define*)
12193         $cat <<EOM
12194 You seem to be either cross-compiling or doing a multiarchitecture build,
12195 skipping the memory alignment check.
12196
12197 EOM
12198         case "$alignbytes" in
12199         '') alignbytes=8 ;;
12200         esac
12201         ;;
12202 *)
12203         case "$alignbytes" in
12204         '') echo "Checking alignment constraints..." >&4
12205                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12206                         $cat >try.c <<'EOCP'
12207 typedef long double NV;
12208 EOCP
12209                 else
12210                         $cat >try.c <<'EOCP'
12211 typedef double NV;
12212 EOCP
12213                 fi
12214                 $cat >>try.c <<'EOCP'
12215 #include <stdio.h>
12216 struct foobar {
12217         char foo;
12218         NV bar;
12219 } try_algn;
12220 int main()
12221 {
12222     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12223     return(0);
12224 }
12225 EOCP
12226                 set try
12227                 if eval $compile_ok; then
12228                         dflt=`./try`
12229                 else
12230                         dflt='8'
12231                         echo "(I can't seem to compile the test program...)"
12232                 fi
12233                 ;;
12234         *) dflt="$alignbytes"
12235                 ;;
12236         esac
12237         rp="Doubles must be aligned on a how-many-byte boundary?"
12238         . ./myread
12239         alignbytes="$ans"
12240         $rm -f try.c try
12241         ;;
12242 esac
12243
12244
12245 : set the base revision
12246 baserev=5.0
12247
12248 : check for ordering of bytes in a long
12249 echo " "
12250 case "$crosscompile$multiarch" in
12251 *$define*)
12252         $cat <<EOM
12253 You seem to be either cross-compiling or doing a multiarchitecture build,
12254 skipping the byteorder check.
12255
12256 EOM
12257         byteorder='0xffff'
12258         ;;
12259 *)
12260         case "$byteorder" in
12261         '')
12262                 $cat <<'EOM'
12263 In the following, larger digits indicate more significance.  A big-endian
12264 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12265 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12266 machines may have weird orders like 3412.  A Cray will report 87654321,
12267 an Alpha will report 12345678. If the test program works the default is
12268 probably right.
12269 I'm now running the test program...
12270 EOM
12271                 $cat >try.c <<'EOCP'
12272 #include <stdio.h>
12273 int main()
12274 {
12275         int i;
12276         union {
12277                 unsigned long l;
12278                 char c[sizeof(long)];
12279         } u;
12280
12281         if (sizeof(long) > 4)
12282                 u.l = (0x08070605L << 32) | 0x04030201L;
12283         else
12284                 u.l = 0x04030201L;
12285         for (i = 0; i < sizeof(long); i++)
12286                 printf("%c", u.c[i]+'0');
12287         printf("\n");
12288         exit(0);
12289 }
12290 EOCP
12291                 xxx_prompt=y
12292                 set try
12293                 if eval $compile && ./try > /dev/null; then
12294                         dflt=`./try`
12295                         case "$dflt" in
12296                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12297                                 echo "(The test program ran ok.)"
12298                                 echo "byteorder=$dflt"
12299                                 xxx_prompt=n
12300                         ;;
12301                         ????|????????) echo "(The test program ran ok.)" ;;
12302                         *) echo "(The test program didn't run right for some reason.)" ;;
12303                         esac
12304                 else
12305                         dflt='4321'
12306                         cat <<'EOM'
12307 (I can't seem to compile the test program.  Guessing big-endian...)
12308 EOM
12309                 fi
12310                 case "$xxx_prompt" in
12311                 y)
12312                         rp="What is the order of bytes in a long?"
12313                         . ./myread
12314                         byteorder="$ans"
12315                         ;;
12316                 *)      byteorder=$dflt
12317                         ;;
12318                 esac
12319                 ;;
12320         esac
12321         $rm -f try.c try
12322         ;;
12323 esac
12324
12325
12326 : how do we catenate cpp tokens here?
12327 echo " "
12328 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12329 $cat >cpp_stuff.c <<'EOCP'
12330 #define RCAT(a,b)a/**/b
12331 #define ACAT(a,b)a ## b
12332 RCAT(Rei,ser)
12333 ACAT(Cir,cus)
12334 EOCP
12335 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12336 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12337         echo "Oh!  Smells like ANSI's been here." >&4
12338         echo "We can catify or stringify, separately or together!"
12339         cpp_stuff=42
12340 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12341         echo "Ah, yes!  The good old days!" >&4
12342         echo "However, in the good old days we don't know how to stringify and"
12343         echo "catify at the same time."
12344         cpp_stuff=1
12345 else
12346         $cat >&4 <<EOM
12347 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12348 to have to edit the values of CAT[2-5] in config.h...
12349 EOM
12350         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12351 fi
12352 $rm -f cpp_stuff.*
12353
12354 : see if this is a db.h system
12355 set db.h i_db
12356 eval $inhdr
12357
12358 case "$i_db" in
12359 $define)
12360         : Check db version.
12361         echo " "
12362         echo "Checking Berkeley DB version ..." >&4
12363         $cat >try.c <<EOCP
12364 #$d_const HASCONST
12365 #ifndef HASCONST
12366 #define const
12367 #endif
12368 #include <sys/types.h>
12369 #include <stdio.h>
12370 #include <db.h>
12371 int main()
12372 {
12373 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12374     int Major, Minor, Patch ;
12375     unsigned long Version ;
12376     (void)db_version(&Major, &Minor, &Patch) ;
12377     printf("You have Berkeley DB Version 2 or greater\n");
12378
12379     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12380                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12381     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12382                 Major, Minor, Patch) ;
12383
12384     /* check that db.h & libdb are compatible */
12385     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12386         printf("db.h and libdb are incompatible\n") ;
12387         exit(3);        
12388     }
12389
12390     printf("db.h and libdb are compatible\n") ;
12391
12392     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12393                 + DB_VERSION_PATCH ;
12394
12395     /* needs to be >= 2.3.4 */
12396     if (Version < 2003004) {
12397     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12398         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12399         exit(2);        
12400     }
12401
12402     exit(0);
12403 #else
12404 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12405     printf("You have Berkeley DB Version 1\n");
12406     exit(0);    /* DB version < 2: the coast is clear. */
12407 #else
12408     exit(1);    /* <db.h> not Berkeley DB? */
12409 #endif
12410 #endif
12411 }
12412 EOCP
12413         set try
12414         if eval $compile_ok && ./try; then
12415                 echo 'Looks OK.' >&4
12416         else
12417                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12418                 i_db=$undef
12419                 case " $libs " in
12420                 *"-ldb "*)
12421                         : Remove db from list of libraries to use
12422                         echo "Removing unusable -ldb from library list" >&4
12423                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12424                         shift
12425                         libs="$*"
12426                         echo "libs = $libs" >&4
12427                         ;;
12428                 esac
12429         fi
12430         $rm -f try.*
12431         ;;
12432 esac
12433
12434 case "$i_db" in
12435 define)
12436         : Check the return type needed for hash 
12437         echo " "
12438         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12439         $cat >try.c <<EOCP
12440 #$d_const HASCONST
12441 #ifndef HASCONST
12442 #define const
12443 #endif
12444 #include <sys/types.h>
12445 #include <db.h>
12446
12447 #ifndef DB_VERSION_MAJOR
12448 u_int32_t hash_cb (ptr, size)
12449 const void *ptr;
12450 size_t size;
12451 {
12452 }
12453 HASHINFO info;
12454 int main()
12455 {
12456         info.hash = hash_cb;
12457 }
12458 #endif
12459 EOCP
12460         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12461                 if $contains warning try.out >>/dev/null 2>&1 ; then
12462                         db_hashtype='int'
12463                 else
12464                         db_hashtype='u_int32_t'
12465                 fi
12466         else
12467                 : XXX Maybe we should just give up here.
12468                 db_hashtype=u_int32_t
12469                 $cat try.out >&4
12470                 echo "Help:  I can't seem to compile the db test program." >&4
12471                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12472         fi
12473         $rm -f try.*
12474         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12475         ;;
12476 *)      db_hashtype=u_int32_t
12477         ;;
12478 esac
12479 case "$i_db" in
12480 define)
12481         : Check the return type needed for prefix 
12482         echo " "
12483         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12484         cat >try.c <<EOCP
12485 #$d_const HASCONST
12486 #ifndef HASCONST
12487 #define const
12488 #endif
12489 #include <sys/types.h>
12490 #include <db.h>
12491
12492 #ifndef DB_VERSION_MAJOR
12493 size_t prefix_cb (key1, key2)
12494 const DBT *key1;
12495 const DBT *key2;
12496 {
12497 }
12498 BTREEINFO info;
12499 int main()
12500 {
12501         info.prefix = prefix_cb;
12502 }
12503 #endif
12504 EOCP
12505         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12506                 if $contains warning try.out >>/dev/null 2>&1 ; then
12507                         db_prefixtype='int'
12508                 else
12509                         db_prefixtype='size_t'
12510                 fi
12511         else
12512                 db_prefixtype='size_t'
12513                 : XXX Maybe we should just give up here.
12514                 $cat try.out >&4
12515                 echo "Help:  I can't seem to compile the db test program." >&4
12516                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12517         fi
12518         $rm -f try.*
12519         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12520         ;;
12521 *)      db_prefixtype='size_t'
12522         ;;
12523 esac
12524
12525 : check for void type
12526 echo " "
12527 echo "Checking to see how well your C compiler groks the void type..." >&4
12528 case "$voidflags" in
12529 '')
12530         $cat >try.c <<'EOCP'
12531 #if TRY & 1
12532 void sub() {
12533 #else
12534 sub() {
12535 #endif
12536         extern void moo();      /* function returning void */
12537         void (*goo)();          /* ptr to func returning void */
12538 #if TRY & 8
12539         void *hue;              /* generic ptr */
12540 #endif
12541 #if TRY & 2
12542         void (*foo[10])();
12543 #endif
12544
12545 #if TRY & 4
12546         if(goo == moo) {
12547                 exit(0);
12548         }
12549 #endif
12550         exit(0);
12551 }
12552 int main() { sub(); }
12553 EOCP
12554         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12555                 voidflags=$defvoidused
12556         echo "Good.  It appears to support void to the level $package wants.">&4
12557                 if $contains warning .out >/dev/null 2>&1; then
12558                         echo "However, you might get some warnings that look like this:"
12559                         $cat .out
12560                 fi
12561         else
12562 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12563                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12564                         echo "It supports 1..."
12565                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12566                                 echo "It also supports 2..."
12567                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12568                                         voidflags=7
12569                                         echo "And it supports 4 but not 8 definitely."
12570                                 else
12571                                         echo "It doesn't support 4..."
12572                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12573                                                 voidflags=11
12574                                                 echo "But it supports 8."
12575                                         else
12576                                                 voidflags=3
12577                                                 echo "Neither does it support 8."
12578                                         fi
12579                                 fi
12580                         else
12581                                 echo "It does not support 2..."
12582                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12583                                         voidflags=13
12584                                         echo "But it supports 4 and 8."
12585                                 else
12586                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12587                                                 voidflags=5
12588                                                 echo "And it supports 4 but has not heard about 8."
12589                                         else
12590                                                 echo "However it supports 8 but not 4."
12591                                         fi
12592                                 fi
12593                         fi
12594                 else
12595                         echo "There is no support at all for void."
12596                         voidflags=0
12597                 fi
12598         fi
12599 esac
12600 case "$voidflags" in
12601 "$defvoidused") ;;
12602 *)      $cat >&4 <<'EOM'
12603   Support flag bits are:
12604     1: basic void declarations.
12605     2: arrays of pointers to functions returning void.
12606     4: operations between pointers to and addresses of void functions.
12607     8: generic void pointers.
12608 EOM
12609         dflt="$voidflags";
12610         rp="Your void support flags add up to what?"
12611         . ./myread
12612         voidflags="$ans"
12613         ;;
12614 esac
12615 $rm -f try.* .out
12616
12617
12618 : How can we generate normalized random numbers ?
12619 echo " "
12620 echo "Looking for a random number function..." >&4
12621 case "$randfunc" in
12622 '')
12623         if set drand48 val -f; eval $csym; $val; then
12624                 dflt="drand48"
12625                 echo "Good, found drand48()." >&4
12626         elif set random val -f; eval $csym; $val; then
12627                 dflt="random"
12628                 echo "OK, found random()." >&4
12629         else
12630                 dflt="rand"
12631                 echo "Yick, looks like I have to use rand()." >&4
12632         fi
12633         echo " "
12634         ;;
12635 *)
12636         dflt="$randfunc"
12637         ;;
12638 esac
12639 cont=true
12640
12641 case "$ccflags" in
12642 *-Dmy_rand=*|*-Dmy_srand=*)
12643         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12644         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12645         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12646         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12647         ;;
12648 esac
12649
12650 while $test "$cont"; do
12651         rp="Use which function to generate random numbers?"
12652         . ./myread
12653         if $test "$ans" = "$dflt"; then
12654                 : null
12655         else
12656                 randbits=''
12657         fi
12658         randfunc="$ans"
12659         if set $ans val -f; eval $csym; $val; then
12660                 cont=''
12661         else
12662                 dflt=y
12663                 rp="I cannot find function $ans. Use that name anyway?"
12664                 . ./myread
12665                 dflt=rand
12666                 case "$ans" in
12667                         [yY]*) cont='';;
12668                 esac
12669         fi
12670         case "$cont" in
12671         '')
12672                 case "$randfunc" in
12673                 drand48)
12674                         drand01="drand48()"
12675                         seedfunc="srand48"
12676                         randbits=48
12677                         randseedtype=long
12678                         ;;
12679                 rand|random)
12680                         case "$randbits" in
12681                         '')
12682 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12683                                 $cat >try.c <<EOCP
12684 #$i_unistd I_UNISTD
12685 #$i_stdlib I_STDLIB
12686 #include <stdio.h>
12687 #ifdef I_UNISTD
12688 #  include <unistd.h>
12689 #endif
12690 #ifdef I_STDLIB
12691 #  include <stdlib.h>
12692 #endif
12693 int main()
12694 {
12695         register int i;
12696         register unsigned long tmp;
12697         register unsigned long max = 0L;
12698
12699         for (i = 1000; i; i--) {
12700                 tmp = (unsigned long) $randfunc();
12701                 if (tmp > max) max = tmp;
12702         }
12703         for (i = 0; max; i++)
12704                 max /= 2;
12705         printf("%d\n",i);
12706 }
12707 EOCP
12708                                 set try
12709                                 if eval $compile_ok; then
12710                                         dflt=`try`
12711                                 else
12712                                         dflt='?'
12713                                         echo "(I can't seem to compile the test program...)"
12714                                 fi
12715                                 ;;
12716                         *)
12717                                 dflt="$randbits"
12718                                 ;;
12719                         esac
12720                         rp="How many bits does your $randfunc() function produce?"
12721                         . ./myread
12722                         randbits="$ans"
12723                         $rm -f try.c try
12724                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12725                         seedfunc="s$randfunc"
12726                         randseedtype=unsigned
12727                         ;;
12728                 *)
12729                         dflt="31"
12730                         rp="How many bits does your $randfunc() function produce?"
12731                         . ./myread
12732                         randbits="$ans"
12733                         seedfunc="s$randfunc"
12734                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12735                         if set $seedfunc val -f; eval $csym; $val; then
12736                                 echo "(Using $seedfunc() to seed random generator)"
12737                         else
12738                                 echo "(Warning: no $seedfunc() to seed random generator)"
12739                                 seedfunc=rand
12740                         fi
12741                         randseedtype=unsigned
12742                         ;;
12743                 esac
12744                 ;;
12745         esac
12746 done
12747
12748 echo " "
12749 echo "Determining whether or not we are on an EBCDIC system..." >&4
12750 $cat >tebcdic.c <<'EOM'
12751 int main()
12752 {
12753   if ('M'==0xd4) return 0;
12754   return 1;
12755 }
12756 EOM
12757
12758 val=$undef
12759 set tebcdic
12760 if eval $compile_ok; then
12761         if ./tebcdic; then
12762                 echo "You seem to speak EBCDIC." >&4
12763                 val="$define"
12764         else
12765                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12766         fi
12767 else
12768         echo "I'm unable to compile the test program." >&4
12769         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12770 fi
12771 $rm -f tebcdic.c tebcdic
12772 set ebcdic
12773 eval $setvar
12774
12775 echo " "
12776 $cat >&4 <<EOM
12777 Checking how to flush all pending stdio output...
12778 EOM
12779 # I only know how to find the first 32 possibly open files on SunOS.
12780 # See also hints/sunos_4_1.sh and util.c  --AD
12781 case "$osname" in
12782 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12783 esac
12784 $cat >>try.c <<EOCP
12785 #include <stdio.h>
12786 #$i_unistd I_UNISTD
12787 #ifdef I_UNISTD
12788 # include <unistd.h>
12789 #endif
12790 #$d_sysconf HAS_SYSCONF
12791 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12792 #ifdef HAS_STDIO_STREAM_ARRAY
12793 # define STDIO_STREAM_ARRAY $stdio_stream_array
12794 #endif
12795 int main() {
12796   FILE* p = fopen("try.out", "w");
12797 #ifdef TRY_FPUTC
12798   fputc('x', p);
12799 #else
12800 # ifdef TRY_FPRINTF
12801   fprintf(p, "x");
12802 # endif
12803 #endif
12804 #ifdef TRY_FFLUSH_NULL
12805   fflush(NULL);
12806 #endif
12807 #ifdef TRY_FFLUSH_ALL
12808   {
12809     long open_max = -1;
12810 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12811     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12812 # else
12813 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12814     open_max = sysconf(_SC_OPEN_MAX);
12815 #  else
12816 #   ifdef FOPEN_MAX
12817     open_max = FOPEN_MAX;
12818 #   else
12819 #    ifdef OPEN_MAX
12820     open_max = OPEN_MAX;
12821 #    else
12822 #     ifdef _NFILE
12823     open_max = _NFILE;
12824 #     endif
12825 #    endif
12826 #   endif
12827 #  endif
12828 # endif 
12829 # ifdef HAS_STDIO_STREAM_ARRAY
12830     if (open_max > 0) {
12831       long i;
12832       for (i = 0; i < open_max; i++)
12833             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12834                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12835                 STDIO_STREAM_ARRAY[i]._flag)
12836                 fflush(&STDIO_STREAM_ARRAY[i]);
12837     }   
12838   }
12839 # endif
12840 #endif
12841   _exit(42);
12842 }
12843 EOCP
12844 : first we have to find out how _not_ to flush
12845 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12846     output=''
12847     set try -DTRY_FPUTC
12848     if eval $compile; then
12849             $rm -f try.out
12850             ./try$exe_ext 2>/dev/null
12851             if $test ! -s try.out -a "X$?" = X42; then
12852                 output=-DTRY_FPUTC
12853             fi
12854     fi
12855     case "$output" in
12856     '')
12857             set try -DTRY_FPRINTF
12858             $rm -f try.out
12859             if eval $compile; then
12860                     $rm -f try.out
12861                     ./try$exe_ext 2>/dev/null
12862                     if $test ! -s try.out -a "X$?" = X42; then
12863                         output=-DTRY_FPRINTF
12864                     fi
12865             fi
12866         ;;
12867     esac
12868 fi
12869 : check for fflush NULL behaviour
12870 case "$fflushNULL" in
12871 '')     set try -DTRY_FFLUSH_NULL $output
12872         if eval $compile; then
12873                 $rm -f try.out
12874                 ./try$exe_ext 2>/dev/null
12875                 code="$?"
12876                 if $test -s try.out -a "X$code" = X42; then
12877                         fflushNULL="`$cat try.out`"
12878                 else
12879                         if $test "X$code" != X42; then
12880                                 $cat >&4 <<EOM
12881 (If this test failed, don't worry, we'll try another method shortly.)
12882 EOM
12883                         fi
12884                 fi
12885         fi
12886         $rm -f core try.core core.try.*
12887         case "$fflushNULL" in
12888         x)      $cat >&4 <<EOM
12889 Your fflush(NULL) works okay for output streams.
12890 Let's see if it clobbers input pipes...
12891 EOM
12892 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12893 # bug that improperly flushes the input end of pipes.  So we avoid the
12894 # autoflush on fork/system/exec support for now. :-(
12895 $cat >tryp.c <<EOCP
12896 #include <stdio.h>
12897 int
12898 main(int argc, char **argv)
12899 {
12900     char buf[1024];
12901     int i;
12902     char *bp = buf;
12903     while (1) {
12904         while ((i = getc(stdin)) != -1
12905                && (*bp++ = i) != '\n'
12906                && bp < &buf[1024])
12907         /* DO NOTHING */ ;
12908         *bp = '\0';
12909         fprintf(stdout, "%s", buf);
12910         fflush(NULL);
12911         if (i == -1)
12912             return 0;
12913         bp = buf;
12914     }
12915 }
12916 EOCP
12917                 fflushNULL="$define"
12918                 set tryp
12919                 if eval $compile; then
12920                     $rm -f tryp.out
12921                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12922                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12923                        $cat >&4 <<EOM
12924 fflush(NULL) seems to behave okay with input streams.
12925 EOM
12926                         fflushNULL="$define"
12927                     else
12928                         $cat >&4 <<EOM
12929 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12930 EOM
12931                         fflushNULL="$undef"
12932                     fi
12933                 fi
12934                 $rm -f core tryp.c tryp.core core.tryp.*
12935                 ;;
12936         '')     $cat >&4 <<EOM
12937 Your fflush(NULL) isn't working (contrary to ANSI C).
12938 EOM
12939                 fflushNULL="$undef"
12940                 ;;
12941         *)      $cat >&4 <<EOM
12942 Cannot figure out whether your fflush(NULL) works or not.
12943 I'm assuming it doesn't (contrary to ANSI C).
12944 EOM
12945                 fflushNULL="$undef"
12946                 ;;
12947         esac
12948         ;;
12949 $define|true|[yY]*)
12950         fflushNULL="$define"
12951         ;;
12952 *)
12953         fflushNULL="$undef"
12954         ;;
12955 esac
12956 : check explicit looping only if NULL did not work, and if the pipe
12957 : bug does not show up on an explicit flush too
12958 case "$fflushNULL" in
12959 "$undef")
12960         $cat >tryp.c <<EOCP
12961 #include <stdio.h>
12962 int
12963 main(int argc, char **argv)
12964 {
12965     char buf[1024];
12966     int i;
12967     char *bp = buf;
12968     while (1) {
12969         while ((i = getc(stdin)) != -1
12970                && (*bp++ = i) != '\n'
12971                && bp < &buf[1024])
12972         /* DO NOTHING */ ;
12973         *bp = '\0';
12974         fprintf(stdout, "%s", buf);
12975         fflush(stdin);
12976         if (i == -1)
12977             return 0;
12978         bp = buf;
12979     }
12980 }
12981 EOCP
12982         set tryp
12983         if eval $compile; then
12984             $rm -f tryp.out
12985             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12986             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12987                $cat >&4 <<EOM
12988 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12989 EOM
12990                 : now check for fflushall behaviour
12991                 case "$fflushall" in
12992                 '')     set try -DTRY_FFLUSH_ALL $output
12993                         if eval $compile; then
12994                                 $cat >&4 <<EOM
12995 (Now testing the other method--but note that this also may fail.)
12996 EOM
12997                                 $rm -f try.out
12998                                 ./try$exe_ext 2>/dev/null
12999                                 if $test -s try.out -a "X$?" = X42; then
13000                                         fflushall="`$cat try.out`"
13001                                 fi
13002                         fi
13003                         $rm -f core try.core core.try.*
13004                         case "$fflushall" in
13005                         x)      $cat >&4 <<EOM
13006 Whew. Flushing explicitly all the stdio streams works.
13007 EOM
13008                                 fflushall="$define"
13009                                 ;;
13010                         '')     $cat >&4 <<EOM
13011 Sigh. Flushing explicitly all the stdio streams doesn't work.
13012 EOM
13013                                 fflushall="$undef"
13014                                 ;;
13015                         *)      $cat >&4 <<EOM
13016 Cannot figure out whether flushing stdio streams explicitly works or not.
13017 I'm assuming it doesn't.
13018 EOM
13019                                 fflushall="$undef"
13020                                 ;;
13021                         esac
13022                         ;;
13023                 "$define"|true|[yY]*)
13024                         fflushall="$define"
13025                         ;;
13026                 *)
13027                         fflushall="$undef"
13028                         ;;
13029                 esac
13030             else
13031                 $cat >&4 <<EOM
13032 All is futile.  Even fflush(stdin) clobbers input pipes!
13033 EOM
13034                 fflushall="$undef"
13035             fi
13036         else
13037             fflushall="$undef"
13038         fi
13039         $rm -f core tryp.c tryp.core core.tryp.*
13040         ;;
13041 *)      fflushall="$undef"
13042         ;;
13043 esac
13044
13045 case "$fflushNULL$fflushall" in
13046 undefundef)
13047         $cat <<EOM
13048 OK, I give up.  I cannot figure out how to flush pending stdio output.
13049 We won't be flushing handles at all before fork/exec/popen.
13050 EOM
13051         ;;
13052 esac
13053 $rm -f try.* try$exe_ext
13054
13055 : Store the full pathname to the ar program for use in the C program
13056 : Respect a hint or command line value for full_ar.
13057 case "$full_ar" in
13058 '') full_ar=$ar ;;
13059 esac
13060
13061 : Store the full pathname to the sed program for use in the C program
13062 full_sed=$sed
13063
13064 : see what type gids are declared as in the kernel
13065 echo " "
13066 echo "Looking for the type for group ids returned by getgid()."
13067 set gid_t gidtype xxx stdio.h sys/types.h
13068 eval $typedef
13069 case "$gidtype" in
13070 xxx)
13071         xxx=`./findhdr sys/user.h`
13072         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13073         case $1 in
13074         unsigned) dflt="$1 $2" ;;
13075         *) dflt="$1" ;;
13076         esac
13077         ;;
13078 *) dflt="$gidtype";;
13079 esac
13080 case "$gidtype" in
13081 gid_t) echo "gid_t found." ;;
13082 *)      rp="What is the type for group ids returned by getgid()?"
13083         . ./myread
13084         gidtype="$ans"
13085         ;;
13086 esac
13087
13088 echo " "
13089 case "$gidtype" in
13090 *_t) zzz="$gidtype"     ;;
13091 *)   zzz="gid"          ;;
13092 esac
13093 echo "Checking the size of $zzz..." >&4 
13094 cat > try.c <<EOCP
13095 #include <sys/types.h>
13096 #include <stdio.h>
13097 int main() {
13098     printf("%d\n", (int)sizeof($gidtype));
13099     exit(0);
13100 }
13101 EOCP
13102 set try
13103 if eval $compile_ok; then
13104         yyy=`./try`
13105         case "$yyy" in
13106         '')     gidsize=4
13107                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13108                 ;;
13109         *)      gidsize=$yyy
13110                 echo "Your $zzz is $gidsize bytes long."
13111                 ;;
13112         esac
13113 else
13114         gidsize=4
13115         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13116 fi
13117
13118
13119 echo " "
13120 case "$gidtype" in
13121 *_t) zzz="$gidtype"     ;;
13122 *)   zzz="gid"          ;;
13123 esac
13124 echo "Checking the sign of $zzz..." >&4 
13125 cat > try.c <<EOCP
13126 #include <sys/types.h>
13127 #include <stdio.h>
13128 int main() {
13129         $gidtype foo = -1;
13130         if (foo < 0)
13131                 printf("-1\n");
13132         else
13133                 printf("1\n");
13134 }
13135 EOCP
13136 set try
13137 if eval $compile; then
13138         yyy=`./try`
13139         case "$yyy" in
13140         '')     gidsign=1
13141                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13142                 ;;
13143         *)      gidsign=$yyy
13144                 case "$gidsign" in
13145                  1) echo "Your $zzz is unsigned." ;;
13146                 -1) echo "Your $zzz is signed."   ;;
13147                 esac
13148                 ;;
13149         esac
13150 else
13151         gidsign=1
13152         echo "(I can't compile the test program--guessing unsigned.)" >&4
13153 fi
13154
13155
13156 echo " "
13157
13158 if $test X"$quadtype" != X; then
13159
13160 echo "Checking how to print 64-bit integers..." >&4
13161
13162 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13163         $cat >try.c <<'EOCP'
13164 #include <sys/types.h>
13165 #include <stdio.h>
13166 int main() {
13167   int q = 12345678901;
13168   printf("%ld\n", q);
13169 }
13170 EOCP
13171         set try
13172         if eval $compile; then
13173                 yyy=`./try$exe_ext`
13174                 case "$yyy" in
13175                 12345678901)
13176                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13177                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13178                         echo "We will use %d."
13179                         ;;
13180                 esac
13181         fi
13182 fi
13183
13184 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13185         $cat >try.c <<'EOCP'
13186 #include <sys/types.h>
13187 #include <stdio.h>
13188 int main() {
13189   long q = 12345678901;
13190   printf("%ld\n", q);
13191 }
13192 EOCP
13193         set try
13194         if eval $compile; then
13195                 yyy=`./try$exe_ext`
13196                 case "$yyy" in
13197                 12345678901)
13198                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13199                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13200                         echo "We will use %ld."
13201                         ;;
13202                 esac
13203         fi
13204 fi
13205
13206 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13207         $cat >try.c <<'EOCP'
13208 #include <sys/types.h>
13209 #include <inttypes.h>
13210 #include <stdio.h>
13211 int main() {
13212   int64_t q = 12345678901;
13213   printf("%" PRId64 "\n", q);
13214 }
13215 EOCP
13216         set try
13217         if eval $compile; then
13218                 yyy=`./try$exe_ext`
13219                 case "$yyy" in
13220                 12345678901)
13221                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13222                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13223                         echo "We will use the C9X style."
13224                         ;;
13225                 esac
13226         fi
13227 fi
13228
13229 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13230         $cat >try.c <<'EOCP'
13231 #include <sys/types.h>
13232 #include <stdio.h>
13233 int main() {
13234   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13235   printf("%lld\n", q);
13236 }
13237 EOCP
13238         set try
13239         if eval $compile; then
13240                 yyy=`./try$exe_ext`
13241                 case "$yyy" in
13242                 12345678901)
13243                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13244                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13245                         echo "We will use the %lld style."
13246                         ;;
13247                 esac
13248         fi
13249 fi
13250
13251 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13252         $cat >try.c <<EOCP
13253 #include <sys/types.h>
13254 #include <stdio.h>
13255 int main() {
13256   $quadtype q = 12345678901;
13257   printf("%Ld\n", q);
13258 }
13259 EOCP
13260         set try
13261         if eval $compile; then
13262                 yyy=`./try$exe_ext`
13263                 case "$yyy" in
13264                 12345678901)
13265                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13266                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13267                         echo "We will use %Ld."
13268                         ;;
13269                 esac
13270         fi
13271 fi
13272
13273 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13274         $cat >try.c <<EOCP
13275 #include <sys/types.h>
13276 #include <stdio.h>
13277 int main() {
13278   $quadtype q = 12345678901;
13279   printf("%qd\n", q);
13280 }
13281 EOCP
13282         set try
13283         if eval $compile; then
13284                 yyy=`./try$exe_ext`
13285                 case "$yyy" in
13286                 12345678901)
13287                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13288                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13289                         echo "We will use %qd."
13290                         ;;
13291                 esac
13292         fi
13293 fi
13294
13295 if $test X"$sPRId64" = X; then
13296         echo "Cannot figure out how to print 64-bit integers." >&4
13297 fi
13298
13299 $rm -f try try.*
13300
13301 fi
13302
13303 case "$sPRId64" in
13304 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13305         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13306         ;;
13307 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13308         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13309         ;;
13310 esac
13311
13312
13313 echo " "
13314 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13315
13316 if $test X"$ivsize" = X8; then
13317         ivdformat="$sPRId64"
13318         uvuformat="$sPRIu64"
13319         uvoformat="$sPRIo64"
13320         uvxformat="$sPRIx64"
13321         uvXUformat="$sPRIXU64"
13322 else
13323         if $test X"$ivsize" = X"$longsize"; then
13324                 ivdformat='"ld"'
13325                 uvuformat='"lu"'
13326                 uvoformat='"lo"'
13327                 uvxformat='"lx"'
13328                 uvXUformat='"lX"'
13329         else
13330                 if $test X"$ivsize" = X"$intsize"; then
13331                         ivdformat='"d"'
13332                         uvuformat='"u"'
13333                         uvoformat='"o"'
13334                         uvxformat='"x"'
13335                         uvXUformat='"X"'
13336                 else
13337                         : far out
13338                         if $test X"$ivsize" = X"$shortsize"; then
13339                                 ivdformat='"hd"'
13340                                 uvuformat='"hu"'
13341                                 uvoformat='"ho"'
13342                                 uvxformat='"hx"'
13343                                 uvXUformat='"hX"'
13344                         fi
13345                 fi
13346         fi
13347 fi
13348
13349 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13350         nveformat="$sPRIeldbl"
13351         nvfformat="$sPRIfldbl"
13352         nvgformat="$sPRIgldbl"
13353         nvEUformat="$sPRIEUldbl"
13354         nvFUformat="$sPRIFUldbl"
13355         nvGUformat="$sPRIGUldbl"
13356 else
13357         nveformat='"e"'
13358         nvfformat='"f"'
13359         nvgformat='"g"'
13360         nvEUformat='"E"'
13361         nvFUformat='"F"'
13362         nvGUformat='"G"'
13363 fi
13364
13365 case "$ivdformat" in
13366 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13367     exit 1
13368     ;;
13369 esac
13370
13371
13372 echo " "
13373 $echo "Checking the format string to be used for gids..." >&4
13374
13375 case "$gidsign" in
13376 -1)     if $test X"$gidsize" = X"$ivsize"; then
13377                 gidformat="$ivdformat"
13378         else
13379                 if $test X"$gidsize" = X"$longsize"; then
13380                         gidformat='"ld"'
13381                 else
13382                         if $test X"$gidsize" = X"$intsize"; then
13383                                 gidformat='"d"'
13384                         else
13385                                 if $test X"$gidsize" = X"$shortsize"; then
13386                                         gidformat='"hd"'
13387                                 fi
13388                         fi
13389                 fi
13390         fi
13391         ;;
13392 *)      if $test X"$gidsize" = X"$uvsize"; then
13393                 gidformat="$uvuformat"
13394         else
13395                 if $test X"$gidsize" = X"$longsize"; then
13396                         gidformat='"lu"'
13397                 else
13398                         if $test X"$gidsize" = X"$intsize"; then
13399                                 gidformat='"u"'
13400                         else
13401                                 if $test X"$gidsize" = X"$shortsize"; then
13402                                         gidformat='"hu"'
13403                                 fi
13404                         fi
13405                 fi
13406         fi
13407         ;;
13408 esac
13409
13410 : see if getgroups exists
13411 set getgroups d_getgrps
13412 eval $inlibc
13413
13414 : see if setgroups exists
13415 set setgroups d_setgrps
13416 eval $inlibc
13417
13418
13419 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13420 echo " "
13421 case "$d_getgrps$d_setgrps" in
13422 *define*)
13423         case "$groupstype" in
13424         '') dflt="$gidtype" ;;
13425         *)  dflt="$groupstype" ;;
13426         esac
13427         $cat <<EOM
13428 What type of pointer is the second argument to getgroups() and setgroups()?
13429 Usually this is the same as group ids, $gidtype, but not always.
13430
13431 EOM
13432         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13433         . ./myread
13434         groupstype="$ans"
13435         ;;
13436 *)  groupstype="$gidtype";;
13437 esac
13438
13439 echo " "
13440 echo "Checking if your $make program sets \$(MAKE)..." >&4
13441 case "$make_set_make" in
13442 '')
13443         $sed 's/^X //' > testmake.mak << 'EOF'
13444 Xall:
13445 X       @echo 'maketemp="$(MAKE)"'
13446 EOF
13447         case "`$make -f testmake.mak 2>/dev/null`" in
13448         *maketemp=*) make_set_make='#' ;;
13449         *)      make_set_make="MAKE=$make" ;;
13450         esac
13451         $rm -f testmake.mak
13452         ;;
13453 esac
13454 case "$make_set_make" in
13455 '#') echo "Yup, it does.";;
13456 *) echo "Nope, it doesn't.";;
13457 esac
13458
13459 : see what type is used for mode_t
13460 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13461 set mode_t modetype int stdio.h sys/types.h
13462 eval $typedef_ask
13463
13464 : define a fucntion to check prototypes
13465 $cat > protochk <<EOSH
13466 $startsh
13467 cc="$cc"
13468 optimize="$optimize"
13469 ccflags="$ccflags"
13470 prototype="$prototype"
13471 define="$define"
13472 rm=$rm
13473 EOSH
13474
13475 $cat >> protochk <<'EOSH'
13476
13477 $rm -f try.c
13478 foo="$1"
13479 shift
13480 while test $# -ge 2; do
13481         case "$1" in
13482                 $define) echo "#include <$2>" >> try.c ;;
13483                 literal) echo "$2" >> try.c ;;
13484         esac
13485     shift 2
13486 done
13487 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13488 cat >> try.c <<'EOCP'
13489 #ifdef CAN_PROTOTYPE
13490 #define _(args) args
13491 #else
13492 #define _(args) ()
13493 #endif
13494 EOCP
13495 echo "$foo" >> try.c
13496 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13497 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13498 status=$?
13499 $rm -f try.[co]
13500 exit $status
13501 EOSH
13502 chmod +x protochk
13503 $eunicefix protochk
13504
13505 : see what type is used for size_t
13506 rp="What is the type used for the length parameter for string functions?"
13507 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13508 eval $typedef_ask
13509
13510 : check for type of arguments to gethostbyaddr. 
13511 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13512         case "$d_gethbyaddr" in
13513         $define)
13514                 $cat <<EOM
13515
13516 Checking to see what type of arguments are accepted by gethostbyaddr().
13517 EOM
13518                 hdrs="$define sys/types.h
13519                         $d_socket sys/socket.h 
13520                         $i_niin netinet/in.h 
13521                         $i_netdb netdb.h
13522                         $i_unistd unistd.h"
13523                 : The first arg can 'char *' or 'void *'
13524                 : The second arg is some of integral type
13525                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13526                         for yyy in size_t long int; do
13527                                 case "$netdb_host_type" in
13528                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13529                                         if ./protochk "$try" $hdrs; then
13530                                                 echo "Your system accepts $xxx for the first arg."
13531                                                 echo "...and $yyy for the second arg."
13532                                                 netdb_host_type="$xxx"
13533                                                 netdb_hlen_type="$yyy"
13534                                         fi
13535                                         ;;
13536                                 esac
13537                         done
13538                 done
13539                 : In case none of those worked, prompt the user.
13540                 case "$netdb_host_type" in
13541                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13542                         dflt='char *'
13543                         . ./myread
13544                         netdb_host_type=$ans
13545                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13546                         dflt="$sizetype"
13547                         . ./myread
13548                         netdb_hlen_type=$ans
13549                         ;;
13550                 esac
13551                 ;;
13552         *)      : no gethostbyaddr, so pick harmless defaults
13553                 netdb_host_type='char *'
13554                 netdb_hlen_type="$sizetype"
13555                 ;;
13556         esac
13557         # Remove the "const" if needed. -- but then we'll have a 
13558         # prototype clash!
13559         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13560 fi
13561
13562 : check for type of argument to gethostbyname. 
13563 if test "X$netdb_name_type" = X ; then
13564         case "$d_gethbyname" in
13565         $define)
13566                 $cat <<EOM
13567
13568 Checking to see what type of argument is accepted by gethostbyname().
13569 EOM
13570                 hdrs="$define sys/types.h
13571                         $d_socket sys/socket.h 
13572                         $i_niin netinet/in.h 
13573                         $i_netdb netdb.h
13574                         $i_unistd unistd.h"
13575                 for xxx in "const char *" "char *"; do
13576                         case "$netdb_name_type" in
13577                         '')     try="extern struct hostent *gethostbyname($xxx);"
13578                                 if ./protochk "$try" $hdrs; then
13579                                         echo "Your system accepts $xxx."
13580                                         netdb_name_type="$xxx"
13581                                 fi
13582                                 ;;
13583                         esac
13584                 done
13585                 : In case none of those worked, prompt the user.
13586                 case "$netdb_name_type" in
13587                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13588                         dflt='char *'
13589                         . ./myread
13590                         netdb_name_type=$ans
13591                         ;;
13592                 esac
13593                 ;;
13594         *)      : no gethostbyname, so pick harmless default
13595                 netdb_name_type='char *'
13596                 ;;
13597         esac
13598 fi
13599
13600 : check for type of 1st argument to getnetbyaddr. 
13601 if test "X$netdb_net_type" = X ; then
13602         case "$d_getnbyaddr" in
13603         $define)
13604                 $cat <<EOM
13605
13606 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13607 EOM
13608                 hdrs="$define sys/types.h
13609                         $d_socket sys/socket.h 
13610                         $i_niin netinet/in.h 
13611                         $i_netdb netdb.h
13612                         $i_unistd unistd.h"
13613                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13614                         case "$netdb_net_type" in
13615                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13616                                 if ./protochk "$try" $hdrs; then
13617                                         echo "Your system accepts $xxx."
13618                                         netdb_net_type="$xxx"
13619                                 fi
13620                                 ;;
13621                         esac
13622                 done
13623                 : In case none of those worked, prompt the user.
13624                 case "$netdb_net_type" in
13625                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13626                         dflt='long'
13627                         . ./myread
13628                         netdb_net_type=$ans
13629                         ;;
13630                 esac
13631                 ;;
13632         *)      : no getnetbyaddr, so pick harmless default
13633                 netdb_net_type='long'
13634                 ;;
13635         esac
13636 fi
13637 : locate the preferred pager for this system
13638 case "$pager" in
13639 '')
13640         dflt=''
13641         case "$pg" in
13642         /*) dflt=$pg;;
13643         [a-zA-Z]:/*) dflt=$pg;;
13644         esac
13645         case "$more" in
13646         /*) dflt=$more;;
13647         [a-zA-Z]:/*) dflt=$more;;
13648         esac
13649         case "$less" in
13650         /*) dflt=$less;;
13651         [a-zA-Z]:/*) dflt=$less;;
13652         esac
13653         case "$dflt" in
13654         '') dflt=/usr/ucb/more;;
13655         esac
13656         ;;
13657 *) dflt="$pager";;
13658 esac
13659 echo " "
13660 fn=f/
13661 rp='What pager is used on your system?'
13662 . ./getfile
13663 pager="$ans"
13664
13665 : see what type pids are declared as in the kernel
13666 rp="What is the type of process ids on this system?"
13667 set pid_t pidtype int stdio.h sys/types.h
13668 eval $typedef_ask
13669
13670 : Find earliest binary compatible site_perl subdirectory perl can use.
13671 case "$bincompat5005" in
13672 "$define") xs_apiversion='5.005' ;;
13673 *) xs_apiversion=$version ;;   # The current site_perl version.
13674 esac
13675 : Find earliest pure perl site_perl subdirectory perl can use.
13676 : The versioned directories started at 5.005.
13677 pm_apiversion='5.005'
13678
13679 : check for length of pointer
13680 echo " "
13681 case "$ptrsize" in
13682 '')
13683         echo "Checking to see how big your pointers are..." >&4
13684         if test "$voidflags" -gt 7; then
13685                 echo '#define VOID_PTR char *' > try.c
13686         else
13687                 echo '#define VOID_PTR void *' > try.c
13688         fi
13689         $cat >>try.c <<'EOCP'
13690 #include <stdio.h>
13691 int main()
13692 {
13693     printf("%d\n", (int)sizeof(VOID_PTR));
13694     exit(0);
13695 }
13696 EOCP
13697         set try
13698         if eval $compile_ok; then
13699                 ptrsize=`./try`
13700                 echo "Your pointers are $ptrsize bytes long."
13701         else
13702                 dflt='4'
13703                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13704                 rp="What is the size of a pointer (in bytes)?"
13705                 . ./myread
13706                 ptrsize="$ans"
13707         fi
13708         ;;
13709 esac
13710 $rm -f try.c try
13711
13712 : see if ar generates random libraries by itself
13713 echo " "
13714 echo "Checking how to generate random libraries on your machine..." >&4
13715 echo 'int bar1() { return bar2(); }' > bar1.c
13716 echo 'int bar2() { return 2; }' > bar2.c
13717 $cat > foo.c <<'EOP'
13718 int main() { printf("%d\n", bar1()); exit(0); }
13719 EOP
13720 $cc $ccflags -c bar1.c >/dev/null 2>&1
13721 $cc $ccflags -c bar2.c >/dev/null 2>&1
13722 $cc $ccflags -c foo.c >/dev/null 2>&1
13723 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13724 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13725         ./foobar >/dev/null 2>&1; then
13726         echo "$ar appears to generate random libraries itself."
13727         orderlib=false
13728         ranlib=":"
13729 elif $ar ts bar$_a >/dev/null 2>&1 &&
13730         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13731         ./foobar >/dev/null 2>&1; then
13732                 echo "a table of contents needs to be added with '$ar ts'."
13733                 orderlib=false
13734                 ranlib="$ar ts"
13735 else
13736         case "$ranlib" in
13737         :) ranlib='';;
13738         '')
13739                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13740                 $test -f $ranlib || ranlib=''
13741                 ;;
13742         esac
13743         if $test -n "$ranlib"; then
13744                 echo "your system has '$ranlib'; we'll use that."
13745                 orderlib=false
13746         else
13747                 echo "your system doesn't seem to support random libraries"
13748                 echo "so we'll use lorder and tsort to order the libraries."
13749                 orderlib=true
13750                 ranlib=":"
13751         fi
13752 fi
13753 $rm -f foo* bar* 
13754
13755 : check for type of arguments to select. 
13756 case "$selecttype" in
13757 '') case "$d_select" in
13758         $define)
13759                 echo " "
13760                 $cat <<EOM
13761 Checking to see what type of arguments are accepted by select().
13762 EOM
13763                 hdrs="$define sys/types.h
13764                         $i_systime sys/time.h 
13765                         $i_sysselct sys/select.h
13766                         $d_socket sys/socket.h"
13767                 : The first arg can be int, unsigned, or size_t
13768                 : The last arg may or may not be 'const'
13769                 val=''
13770                 : void pointer has been seen but using that
13771                 : breaks the selectminbits test
13772                 for xxx in 'fd_set *' 'int *'; do
13773                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13774                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13775                                         case "$val" in
13776                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13777                                                 if ./protochk "$try" $hdrs; then
13778                                                         echo "Your system accepts $xxx."
13779                                                         val="$xxx"
13780                                                 fi
13781                                                 ;;
13782                                         esac
13783                                 done
13784                         done
13785                 done
13786                 case "$val" in
13787                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13788                         case "$d_fd_set" in
13789                                 $define) dflt="fd_set *" ;;
13790                                 *)              dflt="int *" ;;
13791                         esac
13792                         . ./myread
13793                         val=$ans
13794                         ;;
13795                 esac
13796                 selecttype="$val"
13797                 ;;
13798         *)      : no select, so pick a harmless default
13799                 selecttype='int *'
13800                 ;;
13801         esac
13802         ;;
13803 esac
13804
13805 : check for the select 'width'
13806 case "$selectminbits" in
13807 '') case "$d_select" in
13808         $define)
13809                 $cat <<EOM
13810
13811 Checking to see on how many bits at a time your select() operates...
13812 EOM
13813                 $cat >try.c <<EOCP
13814 #include <sys/types.h>
13815 #$i_time I_TIME
13816 #$i_systime I_SYS_TIME
13817 #$i_systimek I_SYS_TIME_KERNEL
13818 #ifdef I_TIME
13819 #   include <time.h>
13820 #endif
13821 #ifdef I_SYS_TIME
13822 #   ifdef I_SYS_TIME_KERNEL
13823 #       define KERNEL
13824 #   endif
13825 #   include <sys/time.h>
13826 #   ifdef I_SYS_TIME_KERNEL
13827 #       undef KERNEL
13828 #   endif
13829 #endif
13830 #$i_sysselct I_SYS_SELECT
13831 #ifdef I_SYS_SELECT
13832 #include <sys/select.h>
13833 #endif
13834 #$d_socket HAS_SOCKET
13835 #ifdef HAS_SOCKET
13836 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13837 #endif
13838 #include <stdio.h>
13839 $selecttype b;
13840 #define S sizeof(*(b))
13841 #define MINBITS 64
13842 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13843 #define NBITS  (NBYTES * 8)
13844 int main() {
13845     char s[NBYTES];
13846     struct timeval t;
13847     int i;
13848     FILE* fp;
13849     int fd;
13850
13851     fclose(stdin);
13852     fp = fopen("try.c", "r");
13853     if (fp == 0)
13854       exit(1);
13855     fd = fileno(fp);
13856     if (fd < 0)
13857       exit(2);
13858     b = ($selecttype)s;
13859     for (i = 0; i < NBITS; i++)
13860         FD_SET(i, b);
13861     t.tv_sec  = 0;
13862     t.tv_usec = 0;
13863     select(fd + 1, b, 0, 0, &t);
13864     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13865     printf("%d\n", i + 1);
13866     return 0;
13867 }
13868 EOCP
13869                 set try
13870                 if eval $compile_ok; then
13871                         selectminbits=`./try`
13872                         case "$selectminbits" in
13873                         '')     cat >&4 <<EOM
13874 Cannot figure out on how many bits at a time your select() operates.
13875 I'll play safe and guess it is 32 bits.
13876 EOM
13877                                 selectminbits=32
13878                                 bits="32 bits"
13879                                 ;;
13880                         1)      bits="1 bit" ;;
13881                         *)      bits="$selectminbits bits" ;;
13882                         esac
13883                         echo "Your select() operates on $bits at a time." >&4
13884                 else
13885                         rp='What is the minimum number of bits your select() operates on?'
13886                         case "$byteorder" in
13887                         1234|12345678)  dflt=32 ;;
13888                         *)              dflt=1  ;;
13889                         esac
13890                         . ./myread
13891                         val=$ans
13892                         selectminbits="$val"
13893                 fi
13894                 $rm -f try.* try
13895                 ;;
13896         *)      : no select, so pick a harmless default
13897                 selectminbits='32'
13898                 ;;
13899         esac
13900         ;;
13901 esac
13902
13903 : Trace out the files included by signal.h, then look for SIGxxx names.
13904 : Remove SIGARRAYSIZE used by HPUX.
13905 : Remove SIGSTKSIZE used by Linux.
13906 : Remove SIGSTKSZ used by Posix.
13907 : Remove SIGTYP void lines used by OS2.
13908 : Some cpps, like os390, dont give the file name anywhere
13909 if [ "X$fieldn" = X ]; then
13910         : Just make some guesses.  We check them later.
13911         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13912 else
13913         xxx=`echo '#include <signal.h>' |
13914         $cppstdin $cppminus $cppflags 2>/dev/null |
13915         $grep '^[       ]*#.*include' | 
13916         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13917 fi
13918 : Check this list of files to be sure we have parsed the cpp output ok.
13919 : This will also avoid potentially non-existent files, such 
13920 : as ../foo/bar.h
13921 xxxfiles=''
13922 for xx in $xxx /dev/null ; do
13923         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13924 done
13925 : If we have found no files, at least try signal.h
13926 case "$xxxfiles" in
13927 '')     xxxfiles=`./findhdr signal.h` ;;
13928 esac
13929 xxx=`awk '
13930 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13931         print substr($2, 4, 20)
13932 }
13933 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13934         print substr($3, 4, 20)
13935 }' $xxxfiles`
13936 : Append some common names just in case the awk scan failed.
13937 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13938 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13939 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13940 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13941 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13942
13943 : generate a few handy files for later
13944 $cat > signal.c <<'EOCP'
13945 #include <sys/types.h>
13946 #include <signal.h>
13947 #include <stdio.h>
13948 int main() {
13949
13950 /* Strange style to avoid deeply-nested #if/#else/#endif */
13951 #ifndef NSIG
13952 #  ifdef _NSIG
13953 #    define NSIG (_NSIG)
13954 #  endif
13955 #endif
13956
13957 #ifndef NSIG
13958 #  ifdef SIGMAX
13959 #    define NSIG (SIGMAX+1)
13960 #  endif
13961 #endif
13962
13963 #ifndef NSIG
13964 #  ifdef SIG_MAX
13965 #    define NSIG (SIG_MAX+1)
13966 #  endif
13967 #endif
13968
13969 #ifndef NSIG
13970 #  ifdef MAXSIG
13971 #    define NSIG (MAXSIG+1)
13972 #  endif
13973 #endif
13974
13975 #ifndef NSIG
13976 #  ifdef MAX_SIG
13977 #    define NSIG (MAX_SIG+1)
13978 #  endif
13979 #endif
13980
13981 #ifndef NSIG
13982 #  ifdef SIGARRAYSIZE
13983 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13984 #  endif
13985 #endif
13986
13987 #ifndef NSIG
13988 #  ifdef _sys_nsig
13989 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13990 #  endif
13991 #endif
13992
13993 /* Default to some arbitrary number that's big enough to get most
13994    of the common signals.
13995 */
13996 #ifndef NSIG
13997 #    define NSIG 50
13998 #endif
13999
14000 printf("NSIG %d\n", NSIG);
14001
14002 #ifndef JUST_NSIG
14003
14004 EOCP
14005
14006 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14007 {
14008         printf "#ifdef SIG"; printf $1; printf "\n"
14009         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14010         printf $1; printf ");\n"
14011         printf "#endif\n"
14012 }
14013 END {
14014         printf "#endif /* JUST_NSIG */\n";
14015         printf "exit(0);\n}\n";
14016 }
14017 ' >>signal.c
14018 $cat >signal.awk <<'EOP'
14019 BEGIN { ndups = 0 }
14020 $1 ~ /^NSIG$/ { nsig = $2 }
14021 ($1 !~ /^NSIG$/) && (NF == 2) {
14022     if ($2 > maxsig) { maxsig = $2 }
14023     if (sig_name[$2]) {
14024         dup_name[ndups] = $1
14025         dup_num[ndups] = $2
14026         ndups++ 
14027     }
14028     else {
14029         sig_name[$2] = $1
14030         sig_num[$2] = $2
14031     }
14032 }
14033 END { 
14034     if (nsig == 0) {
14035         nsig = maxsig + 1
14036     }
14037     printf("NSIG %d\n", nsig);
14038     for (n = 1; n < nsig; n++) {
14039         if (sig_name[n]) {
14040             printf("%s %d\n", sig_name[n], sig_num[n])
14041         }
14042         else {
14043             printf("NUM%d %d\n", n, n) 
14044         }
14045     }
14046     for (n = 0; n < ndups; n++) {
14047         printf("%s %d\n", dup_name[n], dup_num[n])
14048     }
14049 }
14050 EOP
14051 $cat >signal_cmd <<EOS
14052 $startsh
14053 if $test -s signal.lst; then
14054     echo "Using your existing signal.lst file"
14055         exit 0
14056 fi
14057 xxx="$xxx"
14058 EOS
14059 $cat >>signal_cmd <<'EOS'
14060
14061 set signal
14062 if eval $compile_ok; then
14063         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14064 else
14065         echo "(I can't seem be able to compile the whole test program)" >&4
14066         echo "(I'll try it in little pieces.)" >&4
14067         set signal -DJUST_NSIG
14068         if eval $compile_ok; then
14069                 ./signal$_exe > signal.nsg
14070                 $cat signal.nsg
14071         else
14072                 echo "I can't seem to figure out how many signals you have." >&4
14073                 echo "Guessing 50." >&4
14074                 echo 'NSIG 50' > signal.nsg
14075         fi
14076         : Now look at all the signal names, one at a time.
14077         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14078                 $cat > signal.c <<EOCP
14079 #include <sys/types.h>
14080 #include <signal.h>
14081 #include <stdio.h>
14082 int main() {
14083 printf("$xx %d\n", SIG${xx});
14084 return 0;
14085 }
14086 EOCP
14087                 set signal
14088                 if eval $compile; then
14089                         echo "SIG${xx} found."
14090                         ./signal$_exe  >> signal.ls1
14091                 else
14092                         echo "SIG${xx} NOT found."
14093                 fi
14094         done
14095         if $test -s signal.ls1; then
14096                 $cat signal.nsg signal.ls1 |
14097                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14098         fi
14099
14100 fi
14101 if $test -s signal.lst; then
14102         :
14103 else
14104         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14105         echo 'kill -l' >signal
14106         set X `csh -f <signal`
14107         $rm -f signal
14108         shift
14109         case $# in
14110         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14111         esac
14112         echo $@ | $tr ' ' $trnl | \
14113             $awk '{ printf "%s %d\n", $1, ++s; }
14114                   END { printf "NSIG %d\n", ++s }' >signal.lst
14115 fi
14116 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14117 EOS
14118 chmod a+x signal_cmd
14119 $eunicefix signal_cmd
14120
14121 : generate list of signal names
14122 echo " "
14123 case "$sig_name_init" in
14124 '') doinit=yes ;;
14125 *)  case "$sig_num_init" in
14126     ''|*,*) doinit=yes ;;
14127     esac ;;
14128 esac
14129 case "$doinit" in
14130 yes)
14131         echo "Generating a list of signal names and numbers..." >&4
14132         . ./signal_cmd
14133         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14134         sig_name=`$awk 'BEGIN { printf "ZERO " }
14135                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14136         sig_num=`$awk  'BEGIN { printf "0 " }
14137                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14138         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14139                              !/^NSIG/   { printf "\"%s\", ", $1 }
14140                              END        { printf "0\n" }' signal.lst`
14141         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14142                              !/^NSIG/   { printf "%d, ", $2}
14143                              END        { printf "0\n"}' signal.lst`
14144         ;;
14145 esac
14146 echo "The following $sig_count signals are available:"
14147 echo " "
14148 echo $sig_name | $awk \
14149 'BEGIN { linelen = 0 }
14150 {
14151         for (i = 1; i <= NF; i++) {
14152                 name = "SIG" $i " "
14153                 linelen = linelen + length(name)
14154                 if (linelen > 70) {
14155                         printf "\n"
14156                         linelen = length(name)
14157                 }
14158                 printf "%s", name
14159         }
14160         printf "\n"
14161 }'
14162 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14163
14164 echo " "
14165 case "$sizetype" in
14166 *_t) zzz="$sizetype"    ;;
14167 *)   zzz="filesize"     ;;
14168 esac
14169 echo "Checking the size of $zzz..." >&4 
14170 cat > try.c <<EOCP
14171 #include <sys/types.h>
14172 #include <stdio.h>
14173 int main() {
14174     printf("%d\n", (int)sizeof($sizetype));
14175     exit(0);
14176 }
14177 EOCP
14178 set try
14179 if eval $compile_ok; then
14180         yyy=`./try`
14181         case "$yyy" in
14182         '')     sizesize=4
14183                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14184                 ;;
14185         *)      sizesize=$yyy
14186                 echo "Your $zzz size is $sizesize bytes."
14187                 ;;
14188         esac
14189 else
14190         sizesize=4
14191         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14192 fi
14193
14194
14195 : check for socklen_t
14196 echo " "
14197 echo "Checking to see if you have socklen_t..." >&4
14198 $cat >try.c <<EOCP
14199 #include <sys/types.h>
14200 #$d_socket HAS_SOCKET
14201 #ifdef HAS_SOCKET
14202 #include <sys/socket.h>
14203 #endif
14204 int main() { socklen_t x = 16; }
14205 EOCP
14206 set try
14207 if eval $compile; then
14208         val="$define"
14209         echo "You have socklen_t."
14210 else
14211         val="$undef"
14212         echo "You do not have socklen_t."
14213         case "$sizetype" in
14214         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14215         esac
14216 fi
14217 $rm -f try try.*
14218 set d_socklen_t
14219 eval $setvar
14220
14221 : see if this is a socks.h system
14222 set socks.h i_socks
14223 eval $inhdr
14224
14225 : check for type of the size argument to socket calls
14226 case "$d_socket" in
14227 "$define")
14228         $cat <<EOM
14229
14230 Checking to see what type is the last argument of accept().
14231 EOM
14232         yyy=''
14233         case "$d_socklen_t" in
14234         "$define") yyy="$yyy socklen_t"
14235         esac
14236         yyy="$yyy $sizetype int long unsigned"
14237         for xxx in $yyy; do
14238                 case "$socksizetype" in
14239                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14240                         case "$usesocks" in
14241                         "$define")
14242                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14243                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14244                                         socksizetype="$xxx"
14245                                 fi
14246                                 ;;
14247                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14248                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14249                                         socksizetype="$xxx"
14250                                 fi
14251                                 ;;
14252                         esac
14253                         ;;
14254                 esac
14255         done
14256 : In case none of those worked, prompt the user.
14257         case "$socksizetype" in
14258         '')     rp='What is the type for socket address structure sizes?'
14259                 dflt='int'
14260                 . ./myread
14261                 socksizetype=$ans
14262                 ;;
14263         esac
14264         ;;
14265 *)      : no sockets, so pick relatively harmless default
14266         socksizetype='int'
14267         ;;
14268 esac
14269
14270 : see what type is used for signed size_t
14271 set ssize_t ssizetype int stdio.h sys/types.h
14272 eval $typedef
14273 dflt="$ssizetype"
14274 $cat > ssize.c <<EOM
14275 #include <stdio.h>
14276 #include <sys/types.h>
14277 #define Size_t $sizetype
14278 #define SSize_t $dflt
14279 int main()
14280 {
14281         if (sizeof(Size_t) == sizeof(SSize_t))
14282                 printf("$dflt\n");
14283         else if (sizeof(Size_t) == sizeof(int))
14284                 printf("int\n");
14285         else 
14286                 printf("long\n");
14287         exit(0);
14288 }
14289 EOM
14290 echo " "
14291 set ssize
14292 if eval $compile_ok && ./ssize > /dev/null; then
14293         ssizetype=`./ssize`
14294         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14295 else
14296         $cat >&4 <<EOM
14297 Help! I can't compile and run the ssize_t test program: please enlighten me!
14298 (This is probably a misconfiguration in your system or libraries, and
14299 you really ought to fix it.  Still, I'll try anyway.)
14300
14301 I need a type that is the same size as $sizetype, but is guaranteed to
14302 be signed.  Common values are ssize_t, int and long.
14303
14304 EOM
14305         rp="What signed type is the same size as $sizetype?"
14306         . ./myread
14307         ssizetype="$ans"
14308 fi
14309 $rm -f ssize ssize.*
14310
14311 : see what type of char stdio uses.
14312 echo " "
14313 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14314         echo "Your stdio uses unsigned chars." >&4
14315         stdchar="unsigned char"
14316 else
14317         echo "Your stdio uses signed chars." >&4
14318         stdchar="char"
14319 fi
14320
14321 : see if time exists
14322 echo " "
14323 if test "X$d_time" = X -o X"$timetype" = X; then
14324     if set time val -f d_time; eval $csym; $val; then
14325                 echo 'time() found.' >&4
14326                 val="$define"
14327                 rp="What is the type returned by time() on this system?"
14328                 set time_t timetype long stdio.h sys/types.h
14329                 eval $typedef_ask
14330     else
14331                 echo 'time() not found, hope that will do.' >&4
14332                 val="$undef"
14333                 timetype='int';
14334     fi
14335     set d_time
14336     eval $setvar
14337 fi
14338
14339 : see what type uids are declared as in the kernel
14340 echo " "
14341 echo "Looking for the type for user ids returned by getuid()."
14342 set uid_t uidtype xxx stdio.h sys/types.h
14343 eval $typedef
14344 case "$uidtype" in
14345 xxx)
14346         xxx=`./findhdr sys/user.h`
14347         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14348         case $1 in
14349         unsigned) dflt="$1 $2" ;;
14350         *) dflt="$1" ;;
14351         esac
14352         ;;
14353 *) dflt="$uidtype";;
14354 esac
14355 case "$uidtype" in
14356 uid_t)  echo "uid_t found." ;;
14357 *)      rp="What is the type for user ids returned by getuid()?"
14358         . ./myread
14359         uidtype="$ans"
14360         ;;
14361 esac
14362
14363 echo " "
14364 case "$uidtype" in
14365 *_t) zzz="$uidtype"     ;;
14366 *)   zzz="uid"          ;;
14367 esac
14368 echo "Checking the size of $zzz..." >&4 
14369 cat > try.c <<EOCP
14370 #include <sys/types.h>
14371 #include <stdio.h>
14372 int main() {
14373     printf("%d\n", (int)sizeof($uidtype));
14374     exit(0);
14375 }
14376 EOCP
14377 set try
14378 if eval $compile_ok; then
14379         yyy=`./try`
14380         case "$yyy" in
14381         '')     uidsize=4
14382                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14383                 ;;
14384         *)      uidsize=$yyy
14385                 echo "Your $zzz is $uidsize bytes long."
14386                 ;;
14387         esac
14388 else
14389         uidsize=4
14390         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14391 fi
14392
14393 echo " "
14394 case "$uidtype" in
14395 *_t) zzz="$uidtype"     ;;
14396 *)   zzz="uid"          ;;
14397 esac
14398 echo "Checking the sign of $zzz..." >&4
14399 cat > try.c <<EOCP
14400 #include <sys/types.h>
14401 #include <stdio.h>
14402 int main() {
14403         $uidtype foo = -1;
14404         if (foo < 0)
14405                 printf("-1\n");
14406         else
14407                 printf("1\n");
14408 }
14409 EOCP
14410 set try
14411 if eval $compile; then
14412         yyy=`./try`
14413         case "$yyy" in
14414         '')     uidsign=1
14415                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14416                 ;;
14417         *)      uidsign=$yyy
14418                 case "$uidsign" in
14419                  1) echo "Your $zzz is unsigned." ;;
14420                 -1) echo "Your $zzz is signed."   ;;
14421                 esac
14422                 ;;
14423         esac
14424 else
14425         uidsign=1
14426         echo "(I can't compile the test program--guessing unsigned.)" >&4
14427 fi
14428
14429
14430
14431 echo " "
14432 $echo "Checking the format string to be used for uids..." >&4
14433
14434 case "$uidsign" in
14435 -1)     if $test X"$uidsize" = X"$ivsize"; then
14436                 uidformat="$ivdformat"
14437         else
14438                 if $test X"$uidsize" = X"$longsize"; then
14439                         uidformat='"ld"'
14440                 else
14441                         if $test X"$uidsize" = X"$intsize"; then
14442                                 uidformat='"d"'
14443                         else
14444                                 if $test X"$uidsize" = X"$shortsize"; then
14445                                         uidformat='"hd"'
14446                                 fi
14447                         fi
14448                 fi
14449         fi
14450         ;;
14451 *)      if $test X"$uidsize" = X"$uvsize"; then
14452                 uidformat="$uvuformat"
14453         else
14454                 if $test X"$uidsize" = X"$longsize"; then
14455                         uidformat='"lu"'
14456                 else
14457                         if $test X"$uidsize" = X"$intsize"; then
14458                                 uidformat='"u"'
14459                         else
14460                                 if $test X"$uidsize" = X"$shortsize"; then
14461                                         uidformat='"hu"'
14462                                 fi
14463                         fi
14464                 fi
14465         fi
14466         ;;
14467 esac
14468
14469 : see if dbm.h is available
14470 : see if dbmclose exists
14471 set dbmclose d_dbmclose
14472 eval $inlibc
14473
14474 case "$d_dbmclose" in
14475 $define)
14476         set dbm.h i_dbm
14477         eval $inhdr
14478         case "$i_dbm" in
14479         $define)
14480                 val="$undef"
14481                 set i_rpcsvcdbm
14482                 eval $setvar
14483                 ;;
14484         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14485                 eval $inhdr
14486                 ;;
14487         esac
14488         ;;
14489 *)      echo "We won't be including <dbm.h>"
14490         val="$undef"
14491         set i_dbm
14492         eval $setvar
14493         val="$undef"
14494         set i_rpcsvcdbm
14495         eval $setvar
14496         ;;
14497 esac
14498
14499 : see if this is a sys/file.h system
14500 val=''
14501 set sys/file.h val
14502 eval $inhdr
14503
14504 : do we need to include sys/file.h ?
14505 case "$val" in
14506 "$define")
14507         echo " "
14508         if $h_sysfile; then
14509                 val="$define"
14510                 echo "We'll be including <sys/file.h>." >&4
14511         else
14512                 val="$undef"
14513                 echo "We won't be including <sys/file.h>." >&4
14514         fi
14515         ;;
14516 *)
14517         h_sysfile=false
14518         ;;
14519 esac
14520 set i_sysfile
14521 eval $setvar
14522
14523 : see if fcntl.h is there
14524 val=''
14525 set fcntl.h val
14526 eval $inhdr
14527
14528 : see if we can include fcntl.h
14529 case "$val" in
14530 "$define")
14531         echo " "
14532         if $h_fcntl; then
14533                 val="$define"
14534                 echo "We'll be including <fcntl.h>." >&4
14535         else
14536                 val="$undef"
14537                 if $h_sysfile; then
14538         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14539                 else
14540                         echo "We won't be including <fcntl.h>." >&4
14541                 fi
14542         fi
14543         ;;
14544 *)
14545         h_fcntl=false
14546         val="$undef"
14547         ;;
14548 esac
14549 set i_fcntl
14550 eval $setvar
14551
14552 : see if this is a iconv.h system
14553 set iconv.h i_iconv
14554 eval $inhdr
14555
14556 : see if this is a ieeefp.h system
14557 set ieeefp.h i_ieeefp
14558 eval $inhdr
14559
14560 : see if this is a libutil.h system
14561 set libutil.h i_libutil
14562 eval $inhdr
14563
14564 : see if locale.h is available
14565 set locale.h i_locale
14566 eval $inhdr
14567
14568 : see if mach cthreads are available
14569 if test "X$usethreads" = "X$define"; then
14570         set mach/cthreads.h i_machcthr
14571         eval $inhdr
14572 else
14573         i_machcthr="$undef"
14574 fi
14575
14576
14577
14578 : see if this is a math.h system
14579 set math.h i_math
14580 eval $inhdr
14581
14582 : see if this is a mntent.h system
14583 set mntent.h i_mntent
14584 eval $inhdr
14585
14586 : see if ndbm.h is available
14587 set ndbm.h t_ndbm
14588 eval $inhdr
14589 case "$t_ndbm" in
14590 $define)
14591         : see if dbm_open exists
14592         set dbm_open d_dbm_open
14593         eval $inlibc
14594         case "$d_dbm_open" in
14595         $undef)
14596                 t_ndbm="$undef"
14597                 echo "We won't be including <ndbm.h>"
14598                 ;;
14599         esac
14600         ;;
14601 esac
14602 val="$t_ndbm"
14603 set i_ndbm
14604 eval $setvar
14605
14606 : see if net/errno.h is available
14607 val=''
14608 set net/errno.h val
14609 eval $inhdr
14610
14611 : Unfortunately, it causes problems on some systems.  Arrgh.
14612 case "$val" in
14613 $define)
14614         cat > try.c <<'EOM'
14615 #include <stdio.h>
14616 #include <errno.h>
14617 #include <net/errno.h>
14618 int func()
14619 {
14620         return ENOTSOCK;
14621 }
14622 EOM
14623         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14624                 echo "We'll be including <net/errno.h>." >&4
14625         else
14626                 echo "We won't be including <net/errno.h>." >&4
14627                 val="$undef"
14628         fi
14629         $rm -f try.* try
14630         ;;
14631 esac
14632 set i_neterrno
14633 eval $setvar
14634
14635 : see if netinet/tcp.h is available
14636 set netinet/tcp.h i_netinettcp
14637 eval $inhdr
14638
14639 : see if this is a poll.h system
14640 set poll.h i_poll
14641 eval $inhdr
14642
14643 : see if this is a prot.h system
14644 set prot.h i_prot
14645 eval $inhdr
14646
14647 echo " "
14648 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14649 $cat <<'EOSH' > Cppsym.know
14650 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14651 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14652 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14653 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14654 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14655 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14656 bull c cadmus clipper CMU COFF COMPILER_VERSION
14657 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14658 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14659 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14660 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14661 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14662 H3050R H3050RX hbullx20 hcx host_mips
14663 hp200 hp300 hp700 HP700 hp800 hp9000
14664 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14665 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14666 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14667 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14668 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14669 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14670 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14671 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14672 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14673 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14674 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14675 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14676 MATH_HAS_NO_SIDE_EFFECTS
14677 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14678 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14679 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14680 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14681 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14682 NetBSD news1500 news1700 news1800 news1900 news3700
14683 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14684 ns32016 ns32332 ns32k nsc32000
14685 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14686 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14687 pc532 pdp11 PGC PIC plexus PORTAR posix
14688 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14689 POSIX_C_SOURCE POSIX_SOURCE POWER
14690 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14691 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14692 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14693 sony sony_news sonyrisc sparc sparclite spectrum
14694 stardent stdc STDC_EXT stratos sun sun3 sun386
14695 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14696 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14697 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14698 sysV68 sysV88 Tek4132 Tek4300 titan
14699 tower tower32 tower32_200 tower32_600 tower32_700
14700 tower32_800 tower32_850 tss
14701 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14702 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14703 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14704 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14705 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14706 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14707 z8000
14708 EOSH
14709 # Maybe put other stuff here too.
14710 cat <<EOSH >>Cppsym.know
14711 $osname
14712 EOSH
14713 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14714 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14715 $cat Cppsym.know > Cppsym.c
14716 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
14717 $rm -f Cppsym.a Cppsym.b Cppsym.c
14718 cat <<EOSH > Cppsym
14719 $startsh
14720 if $test \$# -gt 0; then
14721     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14722     if $test -s Cppsym.got; then
14723         $rm -f Cppsym.got
14724         exit 0
14725     fi
14726     $rm -f Cppsym.got
14727     exit 1
14728 else
14729     $tr " " "$trnl" | ./Cppsym.try
14730     exit 0
14731 fi
14732 EOSH
14733 chmod +x Cppsym
14734 $eunicefix Cppsym
14735 cat <<EOSH > Cppsym.try
14736 $startsh
14737 cat <<'EOCP' > try.c
14738 #include <stdio.h>
14739 int main() {
14740 EOCP
14741 $awk \\
14742 EOSH
14743 cat <<'EOSH' >> Cppsym.try
14744 'length($1) > 0 {
14745     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
14746     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
14747     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
14748     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
14749 }'       >> try.c
14750 echo '}' >> try.c
14751 EOSH
14752 cat <<EOSH >> Cppsym.try
14753 ccflags="$ccflags"
14754 case "$osname-$gccversion" in
14755 irix-) ccflags="\$ccflags -woff 1178" ;;
14756 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14757 esac
14758 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
14759 EOSH
14760 chmod +x Cppsym.try
14761 $eunicefix Cppsym.try
14762 ./Cppsym < Cppsym.know > Cppsym.true
14763 : now check the C compiler for additional symbols
14764 postprocess_cc_v=''
14765 case "$osname" in
14766 aix) postprocess_cc_v="|$tr , ' '" ;;
14767 esac
14768 $cat >ccsym <<EOS
14769 $startsh
14770 $cat >tmp.c <<EOF
14771 extern int foo;
14772 EOF
14773 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14774 do
14775         case "\$i" in
14776         -D*) echo "\$i" | $sed 's/^-D//';;
14777         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14778         esac
14779 done
14780 $rm -f try.c
14781 EOS
14782 postprocess_cc_v=''
14783 chmod +x ccsym
14784 $eunicefix ccsym
14785 ./ccsym > ccsym1.raw
14786 if $test -s ccsym1.raw; then
14787        $sort ccsym1.raw | $uniq >ccsym.raw
14788 else
14789        mv ccsym1.raw ccsym.raw
14790 fi
14791
14792 $awk '/\=/ { print $0; next }
14793         { print $0"=1" }' ccsym.raw >ccsym.list
14794 $awk '/\=/ { print $0; next }
14795         { print $0"=1" }' Cppsym.true >ccsym.true
14796 $comm -13 ccsym.true ccsym.list >ccsym.own
14797 $comm -12 ccsym.true ccsym.list >ccsym.com
14798 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14799 also=''
14800 if $test -z ccsym.raw; then
14801         echo "Your C compiler doesn't seem to define any symbols!" >&4
14802         echo " "
14803         echo "However, your C preprocessor defines the following symbols:"
14804         $cat Cppsym.true
14805         ccsymbols=''
14806         cppsymbols=`$cat Cppsym.true`
14807         cppsymbols=`echo $cppsymbols`
14808         cppccsymbols="$cppsymbols"
14809 else
14810         if $test -s ccsym.com; then
14811                 echo "Your C compiler and pre-processor define these symbols:"
14812                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14813                 also='also '
14814                 symbols='ones'
14815                 cppccsymbols=`$cat ccsym.com`
14816                 cppccsymbols=`echo $cppccsymbols`
14817                 $test "$silent" || sleep 1
14818         fi
14819         if $test -s ccsym.cpp; then
14820                 $test "$also" && echo " "
14821                 echo "Your C pre-processor ${also}defines the following symbols:"
14822                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14823                 also='further '
14824                 cppsymbols=`$cat ccsym.cpp`
14825                 cppsymbols=`echo $cppsymbols`
14826                 $test "$silent" || sleep 1
14827         fi
14828         if $test -s ccsym.own; then
14829                 $test "$also" && echo " "
14830                 echo "Your C compiler ${also}defines the following cpp symbols:"
14831                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14832                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14833                 ccsymbols=`$cat ccsym.own`
14834                 ccsymbols=`echo $ccsymbols`
14835                 $test "$silent" || sleep 1
14836         fi
14837 fi
14838 $rm -f ccsym* Cppsym.*
14839
14840 : see if this is a termio system
14841 val="$undef"
14842 val2="$undef"
14843 val3="$undef"
14844 if $test `./findhdr termios.h`; then
14845         set tcsetattr i_termios
14846         eval $inlibc
14847         val3="$i_termios"
14848 fi
14849 echo " "
14850 case "$val3" in
14851 "$define") echo "You have POSIX termios.h... good!" >&4;;
14852 *) if ./Cppsym pyr; then
14853                 case "`/bin/universe`" in
14854                 ucb) if $test `./findhdr sgtty.h`; then
14855                                 val2="$define"
14856                                 echo "<sgtty.h> found." >&4
14857                         else
14858                                 echo "System is pyramid with BSD universe."
14859                                 echo "<sgtty.h> not found--you could have problems." >&4
14860                         fi;;
14861                 *) if $test `./findhdr termio.h`; then
14862                                 val="$define"
14863                                 echo "<termio.h> found." >&4
14864                         else
14865                                 echo "System is pyramid with USG universe."
14866                                 echo "<termio.h> not found--you could have problems." >&4
14867                         fi;;
14868                 esac
14869         elif ./usg; then
14870                 if $test `./findhdr termio.h`; then
14871                         echo "<termio.h> found." >&4
14872                         val="$define"
14873                 elif $test `./findhdr sgtty.h`; then
14874                         echo "<sgtty.h> found." >&4
14875                         val2="$define"
14876                 else
14877 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14878                 fi
14879         else
14880                 if $test `./findhdr sgtty.h`; then
14881                         echo "<sgtty.h> found." >&4
14882                         val2="$define"
14883                 elif $test `./findhdr termio.h`; then
14884                         echo "<termio.h> found." >&4
14885                         val="$define"
14886                 else
14887 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14888                 fi
14889         fi;;
14890 esac
14891 set i_termio; eval $setvar
14892 val=$val2; set i_sgtty; eval $setvar
14893 val=$val3; set i_termios; eval $setvar
14894
14895 : see if this is a shadow.h system
14896 set shadow.h i_shadow
14897 eval $inhdr
14898
14899 : see if stdarg is available
14900 echo " "
14901 if $test `./findhdr stdarg.h`; then
14902         echo "<stdarg.h> found." >&4
14903         valstd="$define"
14904 else
14905         echo "<stdarg.h> NOT found." >&4
14906         valstd="$undef"
14907 fi
14908
14909 : see if varags is available
14910 echo " "
14911 if $test `./findhdr varargs.h`; then
14912         echo "<varargs.h> found." >&4
14913 else
14914         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14915 fi
14916
14917 : set up the varargs testing programs
14918 $cat > varargs.c <<EOP
14919 #ifdef I_STDARG
14920 #include <stdarg.h>
14921 #endif
14922 #ifdef I_VARARGS
14923 #include <varargs.h>
14924 #endif
14925
14926 #ifdef I_STDARG
14927 int f(char *p, ...)
14928 #else
14929 int f(va_alist)
14930 va_dcl
14931 #endif
14932 {
14933         va_list ap;
14934 #ifndef I_STDARG
14935         char *p;
14936 #endif
14937 #ifdef I_STDARG
14938         va_start(ap,p);
14939 #else
14940         va_start(ap);
14941         p = va_arg(ap, char *);
14942 #endif
14943         va_end(ap);
14944 }
14945 EOP
14946 $cat > varargs <<EOP
14947 $startsh
14948 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14949         echo "true"
14950 else
14951         echo "false"
14952 fi
14953 $rm -f varargs$_o
14954 EOP
14955 chmod +x varargs
14956
14957 : now check which varargs header should be included
14958 echo " "
14959 i_varhdr=''
14960 case "$valstd" in
14961 "$define")
14962         if `./varargs I_STDARG`; then
14963                 val='stdarg.h'
14964         elif `./varargs I_VARARGS`; then
14965                 val='varargs.h'
14966         fi
14967         ;;
14968 *)
14969         if `./varargs I_VARARGS`; then
14970                 val='varargs.h'
14971         fi
14972         ;;
14973 esac
14974 case "$val" in
14975 '')
14976 echo "I could not find the definition for va_dcl... You have problems..." >&4
14977         val="$undef"; set i_stdarg; eval $setvar
14978         val="$undef"; set i_varargs; eval $setvar
14979         ;;
14980 *) 
14981         set i_varhdr
14982         eval $setvar
14983         case "$i_varhdr" in
14984         stdarg.h)
14985                 val="$define"; set i_stdarg; eval $setvar
14986                 val="$undef"; set i_varargs; eval $setvar
14987                 ;;
14988         varargs.h)
14989                 val="$undef"; set i_stdarg; eval $setvar
14990                 val="$define"; set i_varargs; eval $setvar
14991                 ;;
14992         esac
14993         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14994 esac
14995 $rm -f varargs*
14996
14997 : see if stddef is available
14998 set stddef.h i_stddef
14999 eval $inhdr
15000
15001 : see if this is a sunmath.h system
15002 set sunmath.h i_sunmath
15003 eval $inhdr
15004
15005 : see if sys/access.h is available
15006 set sys/access.h i_sysaccess
15007 eval $inhdr
15008
15009 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15010 set sys/filio.h i_sysfilio
15011 eval $inhdr
15012 echo " "
15013 if $test `./findhdr sys/ioctl.h`; then
15014         val="$define"
15015         echo '<sys/ioctl.h> found.' >&4
15016 else
15017         val="$undef"
15018         if $test $i_sysfilio = "$define"; then
15019             echo '<sys/ioctl.h> NOT found.' >&4
15020         else
15021                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15022                 $test $i_termio = "$define" && xxx="termio.h"
15023                 $test $i_termios = "$define" && xxx="termios.h"
15024 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15025         fi
15026 fi
15027 set i_sysioctl
15028 eval $setvar
15029
15030
15031 : see if this is a syslog.h system
15032 set syslog.h i_syslog
15033 eval $inhdr
15034
15035
15036 : see if this is a sys/mode.h system
15037 set sys/mode.h i_sysmode
15038 eval $inhdr
15039
15040 : see if sys/resource.h has to be included
15041 set sys/resource.h i_sysresrc
15042 eval $inhdr
15043
15044 : see if sys/security.h is available
15045 set sys/security.h i_syssecrt
15046 eval $inhdr
15047
15048 : see if this is a sys/statvfs.h system
15049 set sys/statvfs.h i_sysstatvfs
15050 eval $inhdr
15051
15052 : see if this is a sys/uio.h system
15053 set sys/uio.h i_sysuio
15054 eval $inhdr
15055
15056 : see if this is a sys/un.h system
15057 set sys/un.h i_sysun
15058 eval $inhdr
15059
15060
15061 : see if this is a sys/utsname.h system
15062 set sys/utsname.h i_sysutsname
15063 eval $inhdr
15064
15065 : see if this is a syswait system
15066 set sys/wait.h i_syswait
15067 eval $inhdr
15068
15069 : see if this is a ustat.h system
15070 set ustat.h i_ustat
15071 eval $inhdr
15072
15073 : see if this is an utime system
15074 set utime.h i_utime
15075 eval $inhdr
15076
15077 : see if this is a values.h system
15078 set values.h i_values
15079 eval $inhdr
15080
15081 : see if this is a vfork system
15082 case "$d_vfork" in
15083 "$define")
15084         set vfork.h i_vfork
15085         eval $inhdr
15086         ;;
15087 *)
15088         i_vfork="$undef"
15089         ;;
15090 esac
15091
15092 : see if gdbm.h is available
15093 set gdbm.h t_gdbm
15094 eval $inhdr
15095 case "$t_gdbm" in
15096 $define)
15097         : see if gdbm_open exists
15098         set gdbm_open d_gdbm_open
15099         eval $inlibc
15100         case "$d_gdbm_open" in
15101         $undef)
15102                 t_gdbm="$undef"
15103                 echo "We won't be including <gdbm.h>"
15104                 ;;
15105         esac
15106         ;;
15107 esac
15108 val="$t_gdbm"
15109 set i_gdbm
15110 eval $setvar
15111
15112 echo " "
15113 echo "Looking for extensions..." >&4
15114 : If we are using the old config.sh, known_extensions may contain
15115 : old or inaccurate or duplicate values.
15116 known_extensions=''
15117 nonxs_extensions=''
15118 : We do not use find because it might not be available.
15119 : We do not just use MANIFEST because the user may have dropped
15120 : some additional extensions into the source tree and expect them
15121 : to be built.
15122
15123 : Function to recursively find available extensions, ignoring DynaLoader
15124 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15125 find_extensions='
15126     for xxx in *; do
15127        case "$xxx" in
15128            DynaLoader|dynaload) ;;
15129            *)
15130            if $test -f $xxx/$xxx.xs; then
15131                known_extensions="$known_extensions $1$xxx";
15132            elif $test -f $xxx/Makefile.PL; then
15133                nonxs_extensions="$nonxs_extensions $1$xxx";
15134            else
15135                if $test -d $xxx -a $# -lt 10; then
15136                    set $1$xxx/ $*;
15137                    cd $xxx;
15138                    eval $find_extensions;
15139                    cd ..;
15140                    shift;
15141                fi;
15142            fi
15143            ;;
15144        esac;
15145     done'
15146 tdir=`pwd`
15147 cd $rsrc/ext
15148 set X
15149 shift
15150 eval $find_extensions
15151 set X $nonxs_extensions
15152 shift
15153 nonxs_extensions="$*"
15154 set X $known_extensions
15155 shift
15156 known_extensions="$*"
15157 cd $tdir
15158
15159 : Now see which are supported on this system.
15160 avail_ext=''
15161 for xxx in $known_extensions ; do
15162         case "$xxx" in
15163         DB_File|db_file)
15164                 case "$i_db" in
15165                 $define) avail_ext="$avail_ext $xxx" ;;
15166                 esac
15167                 ;;
15168         GDBM_File|gdbm_fil)
15169                 case "$i_gdbm" in 
15170                 $define) avail_ext="$avail_ext $xxx" ;;
15171                 esac
15172                 ;;
15173         NDBM_File|ndbm_fil)
15174                 case "$i_ndbm" in
15175                 $define)
15176                     case "$osname-$use64bitint" in
15177                     hpux-define)
15178                         case "$libs" in
15179                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15180                         esac
15181                         ;;
15182                     *) avail_ext="$avail_ext $xxx" ;;
15183                     esac
15184                     ;;
15185                 esac
15186                 ;;
15187         ODBM_File|odbm_fil) 
15188                 case "${i_dbm}${i_rpcsvcdbm}" in
15189                 *"${define}"*)
15190                     case "$osname-$use64bitint" in
15191                     hpux-define)
15192                         case "$libs" in
15193                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15194                         esac
15195                         ;;
15196                     *) avail_ext="$avail_ext $xxx" ;;
15197                     esac
15198                     ;;
15199                 esac
15200                 ;;
15201         POSIX|posix)
15202                 case "$useposix" in
15203                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15204                 esac
15205                 ;;
15206         Opcode|opcode)
15207                 case "$useopcode" in
15208                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15209                 esac
15210                 ;;
15211         Socket|socket)
15212                 case "$d_socket" in 
15213                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15214                 esac
15215                 ;;
15216         Sys/Syslog|sys/syslog)
15217                 : XXX syslog requires socket
15218                 case "$d_socket" in 
15219                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15220                 esac
15221                 ;;
15222         Thread|thread)
15223                 case "$usethreads" in 
15224                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15225                 esac
15226                 ;;
15227         IPC/SysV|ipc/sysv)
15228                 : XXX Do we need a useipcsysv variable here
15229                 case "${d_msg}${d_sem}${d_shm}" in 
15230                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15231                 esac
15232                 ;;
15233         *)      avail_ext="$avail_ext $xxx"
15234                 ;;
15235         esac
15236 done
15237
15238 set X $avail_ext
15239 shift
15240 avail_ext="$*"
15241
15242 : Now see which nonxs extensions are supported on this system.
15243 : For now assume all are.
15244 nonxs_ext=''
15245 for xxx in $nonxs_extensions ; do
15246         case "$xxx" in
15247         *)      nonxs_ext="$nonxs_ext $xxx"
15248                 ;;
15249         esac
15250 done
15251
15252 set X $nonxs_ext
15253 shift
15254 nonxs_ext="$*"
15255
15256 case $usedl in
15257 $define)
15258         $cat <<EOM
15259 A number of extensions are supplied with $package.  You may choose to
15260 compile these extensions for dynamic loading (the default), compile
15261 them into the $package executable (static loading), or not include
15262 them at all.  Answer "none" to include no extensions.
15263 Note that DynaLoader is always built and need not be mentioned here.
15264
15265 EOM
15266         case "$dynamic_ext" in
15267         '') dflt="$avail_ext" ;;
15268         *)      dflt="$dynamic_ext"
15269                 # Perhaps we are reusing an old out-of-date config.sh.
15270                 case "$hint" in
15271                 previous)
15272                         if test X"$dynamic_ext" != X"$avail_ext"; then
15273                                 $cat <<EOM
15274 NOTICE:  Your previous config.sh list may be incorrect. 
15275 The extensions now available to you are 
15276         ${avail_ext}
15277 but the default list from your previous config.sh is
15278         ${dynamic_ext} 
15279
15280 EOM
15281                         fi
15282                         ;;
15283                 esac
15284                 ;;
15285         esac
15286         case "$dflt" in
15287         '')     dflt=none;;
15288         esac
15289         rp="What extensions do you wish to load dynamically?"
15290         . ./myread
15291         case "$ans" in
15292         none) dynamic_ext=' ' ;;
15293         *) dynamic_ext="$ans" ;;
15294         esac
15295
15296         case "$static_ext" in
15297         '')
15298                 : Exclude those already listed in dynamic linking
15299                 dflt=''
15300                 for xxx in $avail_ext; do
15301                         case " $dynamic_ext " in
15302                         *" $xxx "*) ;;
15303                         *) dflt="$dflt $xxx" ;;
15304                         esac
15305                 done
15306                 set X $dflt
15307                 shift
15308                 dflt="$*"
15309                 ;;
15310         *)  dflt="$static_ext" 
15311                 ;;
15312         esac
15313
15314         case "$dflt" in
15315         '')     dflt=none;;
15316         esac
15317         rp="What extensions do you wish to load statically?"
15318         . ./myread
15319         case "$ans" in
15320         none) static_ext=' ' ;;
15321         *) static_ext="$ans" ;;
15322         esac
15323         ;;
15324 *)
15325         $cat <<EOM
15326 A number of extensions are supplied with $package.  Answer "none" 
15327 to include no extensions. 
15328 Note that DynaLoader is always built and need not be mentioned here.
15329
15330 EOM
15331         case "$static_ext" in
15332         '') dflt="$avail_ext" ;;
15333         *)      dflt="$static_ext"
15334                 # Perhaps we are reusing an old out-of-date config.sh.
15335                 case "$hint" in
15336                 previous)
15337                         if test X"$static_ext" != X"$avail_ext"; then
15338                                 $cat <<EOM
15339 NOTICE:  Your previous config.sh list may be incorrect. 
15340 The extensions now available to you are 
15341         ${avail_ext}
15342 but the default list from your previous config.sh is
15343         ${static_ext} 
15344
15345 EOM
15346                         fi
15347                         ;;
15348                 esac
15349                 ;;
15350         esac
15351         : Exclude those that are not xs extensions
15352         case "$dflt" in
15353         '')     dflt=none;;
15354         esac
15355         rp="What extensions do you wish to include?"
15356         . ./myread
15357         case "$ans" in
15358         none) static_ext=' ' ;;
15359         *) static_ext="$ans" ;;
15360         esac
15361         ;;
15362 esac
15363
15364 set X $dynamic_ext $static_ext $nonxs_ext
15365 shift
15366 extensions="$*"
15367
15368 : Remove libraries needed only for extensions
15369 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15370 : The exception is SunOS 4.x, which needs them.
15371 case "${osname}X${osvers}" in
15372 sunos*X4*)
15373     perllibs="$libs"
15374     ;;
15375 *) case "$usedl" in
15376     $define|true|[yY]*)
15377             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15378             shift
15379             perllibs="$*"
15380             ;;
15381     *)  perllibs="$libs"
15382             ;;
15383     esac
15384     ;;
15385 esac
15386
15387 : Remove build directory name from cppstdin so it can be used from
15388 : either the present location or the final installed location.
15389 echo " "
15390 : Get out of the UU directory to get correct path name.
15391 cd ..
15392 case "$cppstdin" in
15393 `pwd`/cppstdin)
15394         echo "Stripping down cppstdin path name"
15395         cppstdin=cppstdin
15396         ;;
15397 esac
15398 cd UU
15399
15400 : end of configuration questions
15401 echo " "
15402 echo "End of configuration questions."
15403 echo " "
15404
15405 : back to where it started
15406 if test -d ../UU; then
15407         cd ..
15408 fi
15409
15410 : configuration may be patched via a 'config.over' file
15411 if $test -f config.over; then
15412         echo " "
15413         dflt=y
15414         rp='I see a config.over file.  Do you wish to load it?'
15415         . UU/myread
15416         case "$ans" in
15417         n*) echo "OK, I'll ignore it.";;
15418         *)      . ./config.over
15419                 echo "Configuration override changes have been loaded."
15420                 ;;
15421         esac
15422 fi
15423
15424 : in case they want portability, strip down executable paths
15425 case "$d_portable" in
15426 "$define")
15427         echo " "
15428         echo "Stripping down executable paths..." >&4
15429         for file in $loclist $trylist; do
15430                 eval temp=\$$file
15431                 eval $file=`basename $temp`
15432         done
15433         ;;
15434 esac
15435
15436 : create config.sh file
15437 echo " "
15438 echo "Creating config.sh..." >&4
15439 $spitshell <<EOT >config.sh
15440 $startsh
15441 #
15442 # This file was produced by running the Configure script. It holds all the
15443 # definitions figured out by Configure. Should you modify one of these values,
15444 # do not forget to propagate your changes by running "Configure -der". You may
15445 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15446 #
15447
15448 # Package name      : $package
15449 # Source directory  : $src
15450 # Configuration time: $cf_time
15451 # Configured by     : $cf_by
15452 # Target system     : $myuname
15453
15454 Author='$Author'
15455 Date='$Date'
15456 Header='$Header'
15457 Id='$Id'
15458 Locker='$Locker'
15459 Log='$Log'
15460 Mcc='$Mcc'
15461 RCSfile='$RCSfile'
15462 Revision='$Revision'
15463 Source='$Source'
15464 State='$State'
15465 _a='$_a'
15466 _exe='$_exe'
15467 _o='$_o'
15468 afs='$afs'
15469 alignbytes='$alignbytes'
15470 ansi2knr='$ansi2knr'
15471 aphostname='$aphostname'
15472 api_revision='$api_revision'
15473 api_subversion='$api_subversion'
15474 api_version='$api_version'
15475 api_versionstring='$api_versionstring'
15476 ar='$ar'
15477 archlib='$archlib'
15478 archlibexp='$archlibexp'
15479 archname64='$archname64'
15480 archname='$archname'
15481 archobjs='$archobjs'
15482 awk='$awk'
15483 baserev='$baserev'
15484 bash='$bash'
15485 bin='$bin'
15486 bincompat5005='$bincompat5005'
15487 binexp='$binexp'
15488 bison='$bison'
15489 byacc='$byacc'
15490 byteorder='$byteorder'
15491 c='$c'
15492 castflags='$castflags'
15493 cat='$cat'
15494 cc='$cc'
15495 cccdlflags='$cccdlflags'
15496 ccdlflags='$ccdlflags'
15497 ccflags='$ccflags'
15498 ccflags_uselargefiles='$ccflags_uselargefiles'
15499 ccname='$ccname'
15500 ccsymbols='$ccsymbols'
15501 ccversion='$ccversion'
15502 cf_by='$cf_by'
15503 cf_email='$cf_email'
15504 cf_time='$cf_time'
15505 charsize='$charsize'
15506 chgrp='$chgrp'
15507 chmod='$chmod'
15508 chown='$chown'
15509 clocktype='$clocktype'
15510 comm='$comm'
15511 compress='$compress'
15512 contains='$contains'
15513 cp='$cp'
15514 cpio='$cpio'
15515 cpp='$cpp'
15516 cpp_stuff='$cpp_stuff'
15517 cppccsymbols='$cppccsymbols'
15518 cppflags='$cppflags'
15519 cpplast='$cpplast'
15520 cppminus='$cppminus'
15521 cpprun='$cpprun'
15522 cppstdin='$cppstdin'
15523 cppsymbols='$cppsymbols'
15524 crosscompile='$crosscompile'
15525 cryptlib='$cryptlib'
15526 csh='$csh'
15527 d_Gconvert='$d_Gconvert'
15528 d_PRIEUldbl='$d_PRIEUldbl'
15529 d_PRIFUldbl='$d_PRIFUldbl'
15530 d_PRIGUldbl='$d_PRIGUldbl'
15531 d_PRIXU64='$d_PRIXU64'
15532 d_PRId64='$d_PRId64'
15533 d_PRIeldbl='$d_PRIeldbl'
15534 d_PRIfldbl='$d_PRIfldbl'
15535 d_PRIgldbl='$d_PRIgldbl'
15536 d_PRIi64='$d_PRIi64'
15537 d_PRIo64='$d_PRIo64'
15538 d_PRIu64='$d_PRIu64'
15539 d_PRIx64='$d_PRIx64'
15540 d_SCNfldbl='$d_SCNfldbl'
15541 d__fwalk='$d__fwalk'
15542 d_access='$d_access'
15543 d_accessx='$d_accessx'
15544 d_alarm='$d_alarm'
15545 d_archlib='$d_archlib'
15546 d_atolf='$d_atolf'
15547 d_atoll='$d_atoll'
15548 d_attribut='$d_attribut'
15549 d_bcmp='$d_bcmp'
15550 d_bcopy='$d_bcopy'
15551 d_bincompat5005='$d_bincompat5005'
15552 d_bsd='$d_bsd'
15553 d_bsdgetpgrp='$d_bsdgetpgrp'
15554 d_bsdsetpgrp='$d_bsdsetpgrp'
15555 d_bzero='$d_bzero'
15556 d_casti32='$d_casti32'
15557 d_castneg='$d_castneg'
15558 d_charvspr='$d_charvspr'
15559 d_chown='$d_chown'
15560 d_chroot='$d_chroot'
15561 d_chsize='$d_chsize'
15562 d_closedir='$d_closedir'
15563 d_const='$d_const'
15564 d_crypt='$d_crypt'
15565 d_csh='$d_csh'
15566 d_cuserid='$d_cuserid'
15567 d_dbl_dig='$d_dbl_dig'
15568 d_difftime='$d_difftime'
15569 d_dirnamlen='$d_dirnamlen'
15570 d_dlerror='$d_dlerror'
15571 d_dlopen='$d_dlopen'
15572 d_dlsymun='$d_dlsymun'
15573 d_dosuid='$d_dosuid'
15574 d_drand48proto='$d_drand48proto'
15575 d_dup2='$d_dup2'
15576 d_eaccess='$d_eaccess'
15577 d_endgrent='$d_endgrent'
15578 d_endhent='$d_endhent'
15579 d_endnent='$d_endnent'
15580 d_endpent='$d_endpent'
15581 d_endpwent='$d_endpwent'
15582 d_endsent='$d_endsent'
15583 d_eofnblk='$d_eofnblk'
15584 d_eunice='$d_eunice'
15585 d_fchmod='$d_fchmod'
15586 d_fchown='$d_fchown'
15587 d_fcntl='$d_fcntl'
15588 d_fcntl_can_lock='$d_fcntl_can_lock'
15589 d_fd_macros='$d_fd_macros'
15590 d_fd_set='$d_fd_set'
15591 d_fds_bits='$d_fds_bits'
15592 d_fgetpos='$d_fgetpos'
15593 d_flexfnam='$d_flexfnam'
15594 d_flock='$d_flock'
15595 d_fork='$d_fork'
15596 d_fpathconf='$d_fpathconf'
15597 d_fpos64_t='$d_fpos64_t'
15598 d_frexpl='$d_frexpl'
15599 d_fs_data_s='$d_fs_data_s'
15600 d_fseeko='$d_fseeko'
15601 d_fsetpos='$d_fsetpos'
15602 d_fstatfs='$d_fstatfs'
15603 d_fstatvfs='$d_fstatvfs'
15604 d_fsync='$d_fsync'
15605 d_ftello='$d_ftello'
15606 d_ftime='$d_ftime'
15607 d_getcwd='$d_getcwd'
15608 d_getespwnam='$d_getespwnam'
15609 d_getfsstat='$d_getfsstat'
15610 d_getgrent='$d_getgrent'
15611 d_getgrps='$d_getgrps'
15612 d_gethbyaddr='$d_gethbyaddr'
15613 d_gethbyname='$d_gethbyname'
15614 d_gethent='$d_gethent'
15615 d_gethname='$d_gethname'
15616 d_gethostprotos='$d_gethostprotos'
15617 d_getlogin='$d_getlogin'
15618 d_getmnt='$d_getmnt'
15619 d_getmntent='$d_getmntent'
15620 d_getnbyaddr='$d_getnbyaddr'
15621 d_getnbyname='$d_getnbyname'
15622 d_getnent='$d_getnent'
15623 d_getnetprotos='$d_getnetprotos'
15624 d_getpagsz='$d_getpagsz'
15625 d_getpbyname='$d_getpbyname'
15626 d_getpbynumber='$d_getpbynumber'
15627 d_getpent='$d_getpent'
15628 d_getpgid='$d_getpgid'
15629 d_getpgrp2='$d_getpgrp2'
15630 d_getpgrp='$d_getpgrp'
15631 d_getppid='$d_getppid'
15632 d_getprior='$d_getprior'
15633 d_getprotoprotos='$d_getprotoprotos'
15634 d_getprpwnam='$d_getprpwnam'
15635 d_getpwent='$d_getpwent'
15636 d_getsbyname='$d_getsbyname'
15637 d_getsbyport='$d_getsbyport'
15638 d_getsent='$d_getsent'
15639 d_getservprotos='$d_getservprotos'
15640 d_getspnam='$d_getspnam'
15641 d_gettimeod='$d_gettimeod'
15642 d_gnulibc='$d_gnulibc'
15643 d_grpasswd='$d_grpasswd'
15644 d_hasmntopt='$d_hasmntopt'
15645 d_htonl='$d_htonl'
15646 d_iconv='$d_iconv'
15647 d_index='$d_index'
15648 d_inetaton='$d_inetaton'
15649 d_int64_t='$d_int64_t'
15650 d_isascii='$d_isascii'
15651 d_isnan='$d_isnan'
15652 d_isnanl='$d_isnanl'
15653 d_killpg='$d_killpg'
15654 d_lchown='$d_lchown'
15655 d_ldbl_dig='$d_ldbl_dig'
15656 d_link='$d_link'
15657 d_locconv='$d_locconv'
15658 d_lockf='$d_lockf'
15659 d_longdbl='$d_longdbl'
15660 d_longlong='$d_longlong'
15661 d_lseekproto='$d_lseekproto'
15662 d_lstat='$d_lstat'
15663 d_madvise='$d_madvise'
15664 d_mblen='$d_mblen'
15665 d_mbstowcs='$d_mbstowcs'
15666 d_mbtowc='$d_mbtowc'
15667 d_memchr='$d_memchr'
15668 d_memcmp='$d_memcmp'
15669 d_memcpy='$d_memcpy'
15670 d_memmove='$d_memmove'
15671 d_memset='$d_memset'
15672 d_mkdir='$d_mkdir'
15673 d_mkdtemp='$d_mkdtemp'
15674 d_mkfifo='$d_mkfifo'
15675 d_mkstemp='$d_mkstemp'
15676 d_mkstemps='$d_mkstemps'
15677 d_mktime='$d_mktime'
15678 d_mmap='$d_mmap'
15679 d_modfl='$d_modfl'
15680 d_mprotect='$d_mprotect'
15681 d_msg='$d_msg'
15682 d_msg_ctrunc='$d_msg_ctrunc'
15683 d_msg_dontroute='$d_msg_dontroute'
15684 d_msg_oob='$d_msg_oob'
15685 d_msg_peek='$d_msg_peek'
15686 d_msg_proxy='$d_msg_proxy'
15687 d_msgctl='$d_msgctl'
15688 d_msgget='$d_msgget'
15689 d_msgrcv='$d_msgrcv'
15690 d_msgsnd='$d_msgsnd'
15691 d_msync='$d_msync'
15692 d_munmap='$d_munmap'
15693 d_mymalloc='$d_mymalloc'
15694 d_nice='$d_nice'
15695 d_nv_preserves_uv='$d_nv_preserves_uv'
15696 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15697 d_off64_t='$d_off64_t'
15698 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15699 d_oldpthreads='$d_oldpthreads'
15700 d_oldsock='$d_oldsock'
15701 d_open3='$d_open3'
15702 d_pathconf='$d_pathconf'
15703 d_pause='$d_pause'
15704 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15705 d_phostname='$d_phostname'
15706 d_pipe='$d_pipe'
15707 d_poll='$d_poll'
15708 d_portable='$d_portable'
15709 d_pthread_yield='$d_pthread_yield'
15710 d_pwage='$d_pwage'
15711 d_pwchange='$d_pwchange'
15712 d_pwclass='$d_pwclass'
15713 d_pwcomment='$d_pwcomment'
15714 d_pwexpire='$d_pwexpire'
15715 d_pwgecos='$d_pwgecos'
15716 d_pwpasswd='$d_pwpasswd'
15717 d_pwquota='$d_pwquota'
15718 d_qgcvt='$d_qgcvt'
15719 d_quad='$d_quad'
15720 d_readdir='$d_readdir'
15721 d_readlink='$d_readlink'
15722 d_rename='$d_rename'
15723 d_rewinddir='$d_rewinddir'
15724 d_rmdir='$d_rmdir'
15725 d_safebcpy='$d_safebcpy'
15726 d_safemcpy='$d_safemcpy'
15727 d_sanemcmp='$d_sanemcmp'
15728 d_sbrkproto='$d_sbrkproto'
15729 d_sched_yield='$d_sched_yield'
15730 d_scm_rights='$d_scm_rights'
15731 d_seekdir='$d_seekdir'
15732 d_select='$d_select'
15733 d_sem='$d_sem'
15734 d_semctl='$d_semctl'
15735 d_semctl_semid_ds='$d_semctl_semid_ds'
15736 d_semctl_semun='$d_semctl_semun'
15737 d_semget='$d_semget'
15738 d_semop='$d_semop'
15739 d_setegid='$d_setegid'
15740 d_seteuid='$d_seteuid'
15741 d_setgrent='$d_setgrent'
15742 d_setgrps='$d_setgrps'
15743 d_sethent='$d_sethent'
15744 d_setlinebuf='$d_setlinebuf'
15745 d_setlocale='$d_setlocale'
15746 d_setnent='$d_setnent'
15747 d_setpent='$d_setpent'
15748 d_setpgid='$d_setpgid'
15749 d_setpgrp2='$d_setpgrp2'
15750 d_setpgrp='$d_setpgrp'
15751 d_setprior='$d_setprior'
15752 d_setproctitle='$d_setproctitle'
15753 d_setpwent='$d_setpwent'
15754 d_setregid='$d_setregid'
15755 d_setresgid='$d_setresgid'
15756 d_setresuid='$d_setresuid'
15757 d_setreuid='$d_setreuid'
15758 d_setrgid='$d_setrgid'
15759 d_setruid='$d_setruid'
15760 d_setsent='$d_setsent'
15761 d_setsid='$d_setsid'
15762 d_setvbuf='$d_setvbuf'
15763 d_sfio='$d_sfio'
15764 d_shm='$d_shm'
15765 d_shmat='$d_shmat'
15766 d_shmatprototype='$d_shmatprototype'
15767 d_shmctl='$d_shmctl'
15768 d_shmdt='$d_shmdt'
15769 d_shmget='$d_shmget'
15770 d_sigaction='$d_sigaction'
15771 d_sigsetjmp='$d_sigsetjmp'
15772 d_socket='$d_socket'
15773 d_socklen_t='$d_socklen_t'
15774 d_sockpair='$d_sockpair'
15775 d_socks5_init='$d_socks5_init'
15776 d_sqrtl='$d_sqrtl'
15777 d_statblks='$d_statblks'
15778 d_statfs_f_flags='$d_statfs_f_flags'
15779 d_statfs_s='$d_statfs_s'
15780 d_statvfs='$d_statvfs'
15781 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15782 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15783 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15784 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15785 d_stdio_stream_array='$d_stdio_stream_array'
15786 d_stdiobase='$d_stdiobase'
15787 d_stdstdio='$d_stdstdio'
15788 d_strchr='$d_strchr'
15789 d_strcoll='$d_strcoll'
15790 d_strctcpy='$d_strctcpy'
15791 d_strerrm='$d_strerrm'
15792 d_strerror='$d_strerror'
15793 d_strtod='$d_strtod'
15794 d_strtol='$d_strtol'
15795 d_strtold='$d_strtold'
15796 d_strtoll='$d_strtoll'
15797 d_strtoul='$d_strtoul'
15798 d_strtoull='$d_strtoull'
15799 d_strtouq='$d_strtouq'
15800 d_strxfrm='$d_strxfrm'
15801 d_suidsafe='$d_suidsafe'
15802 d_symlink='$d_symlink'
15803 d_syscall='$d_syscall'
15804 d_sysconf='$d_sysconf'
15805 d_sysernlst='$d_sysernlst'
15806 d_syserrlst='$d_syserrlst'
15807 d_system='$d_system'
15808 d_tcgetpgrp='$d_tcgetpgrp'
15809 d_tcsetpgrp='$d_tcsetpgrp'
15810 d_telldir='$d_telldir'
15811 d_telldirproto='$d_telldirproto'
15812 d_time='$d_time'
15813 d_times='$d_times'
15814 d_truncate='$d_truncate'
15815 d_tzname='$d_tzname'
15816 d_umask='$d_umask'
15817 d_uname='$d_uname'
15818 d_union_semun='$d_union_semun'
15819 d_ustat='$d_ustat'
15820 d_vendorarch='$d_vendorarch'
15821 d_vendorbin='$d_vendorbin'
15822 d_vendorlib='$d_vendorlib'
15823 d_vfork='$d_vfork'
15824 d_void_closedir='$d_void_closedir'
15825 d_voidsig='$d_voidsig'
15826 d_voidtty='$d_voidtty'
15827 d_volatile='$d_volatile'
15828 d_vprintf='$d_vprintf'
15829 d_wait4='$d_wait4'
15830 d_waitpid='$d_waitpid'
15831 d_wcstombs='$d_wcstombs'
15832 d_wctomb='$d_wctomb'
15833 d_xenix='$d_xenix'
15834 date='$date'
15835 db_hashtype='$db_hashtype'
15836 db_prefixtype='$db_prefixtype'
15837 defvoidused='$defvoidused'
15838 direntrytype='$direntrytype'
15839 dlext='$dlext'
15840 dlsrc='$dlsrc'
15841 doublesize='$doublesize'
15842 drand01='$drand01'
15843 dynamic_ext='$dynamic_ext'
15844 eagain='$eagain'
15845 ebcdic='$ebcdic'
15846 echo='$echo'
15847 egrep='$egrep'
15848 emacs='$emacs'
15849 eunicefix='$eunicefix'
15850 exe_ext='$exe_ext'
15851 expr='$expr'
15852 extensions='$extensions'
15853 fflushNULL='$fflushNULL'
15854 fflushall='$fflushall'
15855 find='$find'
15856 firstmakefile='$firstmakefile'
15857 flex='$flex'
15858 fpossize='$fpossize'
15859 fpostype='$fpostype'
15860 freetype='$freetype'
15861 full_ar='$full_ar'
15862 full_csh='$full_csh'
15863 full_sed='$full_sed'
15864 gccosandvers='$gccosandvers'
15865 gccversion='$gccversion'
15866 gidformat='$gidformat'
15867 gidsign='$gidsign'
15868 gidsize='$gidsize'
15869 gidtype='$gidtype'
15870 glibpth='$glibpth'
15871 grep='$grep'
15872 groupcat='$groupcat'
15873 groupstype='$groupstype'
15874 gzip='$gzip'
15875 h_fcntl='$h_fcntl'
15876 h_sysfile='$h_sysfile'
15877 hint='$hint'
15878 hostcat='$hostcat'
15879 i16size='$i16size'
15880 i16type='$i16type'
15881 i32size='$i32size'
15882 i32type='$i32type'
15883 i64size='$i64size'
15884 i64type='$i64type'
15885 i8size='$i8size'
15886 i8type='$i8type'
15887 i_arpainet='$i_arpainet'
15888 i_bsdioctl='$i_bsdioctl'
15889 i_db='$i_db'
15890 i_dbm='$i_dbm'
15891 i_dirent='$i_dirent'
15892 i_dld='$i_dld'
15893 i_dlfcn='$i_dlfcn'
15894 i_fcntl='$i_fcntl'
15895 i_float='$i_float'
15896 i_gdbm='$i_gdbm'
15897 i_grp='$i_grp'
15898 i_iconv='$i_iconv'
15899 i_ieeefp='$i_ieeefp'
15900 i_inttypes='$i_inttypes'
15901 i_libutil='$i_libutil'
15902 i_limits='$i_limits'
15903 i_locale='$i_locale'
15904 i_machcthr='$i_machcthr'
15905 i_malloc='$i_malloc'
15906 i_math='$i_math'
15907 i_memory='$i_memory'
15908 i_mntent='$i_mntent'
15909 i_ndbm='$i_ndbm'
15910 i_netdb='$i_netdb'
15911 i_neterrno='$i_neterrno'
15912 i_netinettcp='$i_netinettcp'
15913 i_niin='$i_niin'
15914 i_poll='$i_poll'
15915 i_prot='$i_prot'
15916 i_pthread='$i_pthread'
15917 i_pwd='$i_pwd'
15918 i_rpcsvcdbm='$i_rpcsvcdbm'
15919 i_sfio='$i_sfio'
15920 i_sgtty='$i_sgtty'
15921 i_shadow='$i_shadow'
15922 i_socks='$i_socks'
15923 i_stdarg='$i_stdarg'
15924 i_stddef='$i_stddef'
15925 i_stdlib='$i_stdlib'
15926 i_string='$i_string'
15927 i_sunmath='$i_sunmath'
15928 i_sysaccess='$i_sysaccess'
15929 i_sysdir='$i_sysdir'
15930 i_sysfile='$i_sysfile'
15931 i_sysfilio='$i_sysfilio'
15932 i_sysin='$i_sysin'
15933 i_sysioctl='$i_sysioctl'
15934 i_syslog='$i_syslog'
15935 i_sysmman='$i_sysmman'
15936 i_sysmode='$i_sysmode'
15937 i_sysmount='$i_sysmount'
15938 i_sysndir='$i_sysndir'
15939 i_sysparam='$i_sysparam'
15940 i_sysresrc='$i_sysresrc'
15941 i_syssecrt='$i_syssecrt'
15942 i_sysselct='$i_sysselct'
15943 i_syssockio='$i_syssockio'
15944 i_sysstat='$i_sysstat'
15945 i_sysstatfs='$i_sysstatfs'
15946 i_sysstatvfs='$i_sysstatvfs'
15947 i_systime='$i_systime'
15948 i_systimek='$i_systimek'
15949 i_systimes='$i_systimes'
15950 i_systypes='$i_systypes'
15951 i_sysuio='$i_sysuio'
15952 i_sysun='$i_sysun'
15953 i_sysutsname='$i_sysutsname'
15954 i_sysvfs='$i_sysvfs'
15955 i_syswait='$i_syswait'
15956 i_termio='$i_termio'
15957 i_termios='$i_termios'
15958 i_time='$i_time'
15959 i_unistd='$i_unistd'
15960 i_ustat='$i_ustat'
15961 i_utime='$i_utime'
15962 i_values='$i_values'
15963 i_varargs='$i_varargs'
15964 i_varhdr='$i_varhdr'
15965 i_vfork='$i_vfork'
15966 ignore_versioned_solibs='$ignore_versioned_solibs'
15967 inc_version_list='$inc_version_list'
15968 inc_version_list_init='$inc_version_list_init'
15969 incpath='$incpath'
15970 inews='$inews'
15971 installarchlib='$installarchlib'
15972 installbin='$installbin'
15973 installman1dir='$installman1dir'
15974 installman3dir='$installman3dir'
15975 installprefix='$installprefix'
15976 installprefixexp='$installprefixexp'
15977 installprivlib='$installprivlib'
15978 installscript='$installscript'
15979 installsitearch='$installsitearch'
15980 installsitebin='$installsitebin'
15981 installsitelib='$installsitelib'
15982 installstyle='$installstyle'
15983 installusrbinperl='$installusrbinperl'
15984 installvendorarch='$installvendorarch'
15985 installvendorbin='$installvendorbin'
15986 installvendorlib='$installvendorlib'
15987 intsize='$intsize'
15988 ivdformat='$ivdformat'
15989 ivsize='$ivsize'
15990 ivtype='$ivtype'
15991 known_extensions='$known_extensions'
15992 ksh='$ksh'
15993 ld='$ld'
15994 lddlflags='$lddlflags'
15995 ldflags='$ldflags'
15996 ldflags_uselargefiles='$ldflags_uselargefiles'
15997 ldlibpthname='$ldlibpthname'
15998 less='$less'
15999 lib_ext='$lib_ext'
16000 libc='$libc'
16001 libperl='$libperl'
16002 libpth='$libpth'
16003 libs='$libs'
16004 libsdirs='$libsdirs'
16005 libsfiles='$libsfiles'
16006 libsfound='$libsfound'
16007 libspath='$libspath'
16008 libswanted='$libswanted'
16009 libswanted_uselargefiles='$libswanted_uselargefiles'
16010 line='$line'
16011 lint='$lint'
16012 lkflags='$lkflags'
16013 ln='$ln'
16014 lns='$lns'
16015 locincpth='$locincpth'
16016 loclibpth='$loclibpth'
16017 longdblsize='$longdblsize'
16018 longlongsize='$longlongsize'
16019 longsize='$longsize'
16020 lp='$lp'
16021 lpr='$lpr'
16022 ls='$ls'
16023 lseeksize='$lseeksize'
16024 lseektype='$lseektype'
16025 mail='$mail'
16026 mailx='$mailx'
16027 make='$make'
16028 make_set_make='$make_set_make'
16029 mallocobj='$mallocobj'
16030 mallocsrc='$mallocsrc'
16031 malloctype='$malloctype'
16032 man1dir='$man1dir'
16033 man1direxp='$man1direxp'
16034 man1ext='$man1ext'
16035 man3dir='$man3dir'
16036 man3direxp='$man3direxp'
16037 man3ext='$man3ext'
16038 mips_type='$mips_type'
16039 mkdir='$mkdir'
16040 mmaptype='$mmaptype'
16041 modetype='$modetype'
16042 more='$more'
16043 multiarch='$multiarch'
16044 mv='$mv'
16045 myarchname='$myarchname'
16046 mydomain='$mydomain'
16047 myhostname='$myhostname'
16048 myuname='$myuname'
16049 n='$n'
16050 netdb_hlen_type='$netdb_hlen_type'
16051 netdb_host_type='$netdb_host_type'
16052 netdb_name_type='$netdb_name_type'
16053 netdb_net_type='$netdb_net_type'
16054 nm='$nm'
16055 nm_opt='$nm_opt'
16056 nm_so_opt='$nm_so_opt'
16057 nonxs_ext='$nonxs_ext'
16058 nroff='$nroff'
16059 nvEUformat='$nvEUformat'
16060 nvFUformat='$nvFUformat'
16061 nvGUformat='$nvGUformat'
16062 nveformat='$nveformat'
16063 nvfformat='$nvfformat'
16064 nvgformat='$nvgformat'
16065 nvsize='$nvsize'
16066 nvtype='$nvtype'
16067 o_nonblock='$o_nonblock'
16068 obj_ext='$obj_ext'
16069 old_pthread_create_joinable='$old_pthread_create_joinable'
16070 optimize='$optimize'
16071 orderlib='$orderlib'
16072 osname='$osname'
16073 osvers='$osvers'
16074 otherlibdirs='$otherlibdirs'
16075 package='$package'
16076 pager='$pager'
16077 passcat='$passcat'
16078 patchlevel='$patchlevel'
16079 path_sep='$path_sep'
16080 perl5='$perl5'
16081 perl='$perl'
16082 perladmin='$perladmin'
16083 perllibs='$perllibs'
16084 perlpath='$perlpath'
16085 pg='$pg'
16086 phostname='$phostname'
16087 pidtype='$pidtype'
16088 plibpth='$plibpth'
16089 pm_apiversion='$pm_apiversion'
16090 pmake='$pmake'
16091 pr='$pr'
16092 prefix='$prefix'
16093 prefixexp='$prefixexp'
16094 privlib='$privlib'
16095 privlibexp='$privlibexp'
16096 prototype='$prototype'
16097 ptrsize='$ptrsize'
16098 quadkind='$quadkind'
16099 quadtype='$quadtype'
16100 randbits='$randbits'
16101 randfunc='$randfunc'
16102 randseedtype='$randseedtype'
16103 ranlib='$ranlib'
16104 rd_nodata='$rd_nodata'
16105 revision='$revision'
16106 rm='$rm'
16107 rmail='$rmail'
16108 runnm='$runnm'
16109 sPRIEUldbl='$sPRIEUldbl'
16110 sPRIFUldbl='$sPRIFUldbl'
16111 sPRIGUldbl='$sPRIGUldbl'
16112 sPRIXU64='$sPRIXU64'
16113 sPRId64='$sPRId64'
16114 sPRIeldbl='$sPRIeldbl'
16115 sPRIfldbl='$sPRIfldbl'
16116 sPRIgldbl='$sPRIgldbl'
16117 sPRIi64='$sPRIi64'
16118 sPRIo64='$sPRIo64'
16119 sPRIu64='$sPRIu64'
16120 sPRIx64='$sPRIx64'
16121 sSCNfldbl='$sSCNfldbl'
16122 sched_yield='$sched_yield'
16123 scriptdir='$scriptdir'
16124 scriptdirexp='$scriptdirexp'
16125 sed='$sed'
16126 seedfunc='$seedfunc'
16127 selectminbits='$selectminbits'
16128 selecttype='$selecttype'
16129 sendmail='$sendmail'
16130 sh='$sh'
16131 shar='$shar'
16132 sharpbang='$sharpbang'
16133 shmattype='$shmattype'
16134 shortsize='$shortsize'
16135 shrpenv='$shrpenv'
16136 shsharp='$shsharp'
16137 sig_count='$sig_count'
16138 sig_name='$sig_name'
16139 sig_name_init='$sig_name_init'
16140 sig_num='$sig_num'
16141 sig_num_init='$sig_num_init'
16142 signal_t='$signal_t'
16143 sitearch='$sitearch'
16144 sitearchexp='$sitearchexp'
16145 sitebin='$sitebin'
16146 sitebinexp='$sitebinexp'
16147 sitelib='$sitelib'
16148 sitelib_stem='$sitelib_stem'
16149 sitelibexp='$sitelibexp'
16150 siteprefix='$siteprefix'
16151 siteprefixexp='$siteprefixexp'
16152 sizesize='$sizesize'
16153 sizetype='$sizetype'
16154 sleep='$sleep'
16155 smail='$smail'
16156 so='$so'
16157 sockethdr='$sockethdr'
16158 socketlib='$socketlib'
16159 socksizetype='$socksizetype'
16160 sort='$sort'
16161 spackage='$spackage'
16162 spitshell='$spitshell'
16163 src='$src'
16164 ssizetype='$ssizetype'
16165 startperl='$startperl'
16166 startsh='$startsh'
16167 static_ext='$static_ext'
16168 stdchar='$stdchar'
16169 stdio_base='$stdio_base'
16170 stdio_bufsiz='$stdio_bufsiz'
16171 stdio_cnt='$stdio_cnt'
16172 stdio_filbuf='$stdio_filbuf'
16173 stdio_ptr='$stdio_ptr'
16174 stdio_stream_array='$stdio_stream_array'
16175 strings='$strings'
16176 submit='$submit'
16177 subversion='$subversion'
16178 sysman='$sysman'
16179 tail='$tail'
16180 tar='$tar'
16181 tbl='$tbl'
16182 tee='$tee'
16183 test='$test'
16184 timeincl='$timeincl'
16185 timetype='$timetype'
16186 touch='$touch'
16187 tr='$tr'
16188 trnl='$trnl'
16189 troff='$troff'
16190 u16size='$u16size'
16191 u16type='$u16type'
16192 u32size='$u32size'
16193 u32type='$u32type'
16194 u64size='$u64size'
16195 u64type='$u64type'
16196 u8size='$u8size'
16197 u8type='$u8type'
16198 uidformat='$uidformat'
16199 uidsign='$uidsign'
16200 uidsize='$uidsize'
16201 uidtype='$uidtype'
16202 uname='$uname'
16203 uniq='$uniq'
16204 uquadtype='$uquadtype'
16205 use5005threads='$use5005threads'
16206 use64bitall='$use64bitall'
16207 use64bitint='$use64bitint'
16208 usedl='$usedl'
16209 useithreads='$useithreads'
16210 uselargefiles='$uselargefiles'
16211 uselongdouble='$uselongdouble'
16212 usemorebits='$usemorebits'
16213 usemultiplicity='$usemultiplicity'
16214 usemymalloc='$usemymalloc'
16215 usenm='$usenm'
16216 useopcode='$useopcode'
16217 useperlio='$useperlio'
16218 useposix='$useposix'
16219 usesfio='$usesfio'
16220 useshrplib='$useshrplib'
16221 usesocks='$usesocks'
16222 usethreads='$usethreads'
16223 usevendorprefix='$usevendorprefix'
16224 usevfork='$usevfork'
16225 usrinc='$usrinc'
16226 uuname='$uuname'
16227 uvXUformat='$uvXUformat'
16228 uvoformat='$uvoformat'
16229 uvsize='$uvsize'
16230 uvtype='$uvtype'
16231 uvuformat='$uvuformat'
16232 uvxformat='$uvxformat'
16233 vendorarch='$vendorarch'
16234 vendorarchexp='$vendorarchexp'
16235 vendorbin='$vendorbin'
16236 vendorbinexp='$vendorbinexp'
16237 vendorlib='$vendorlib'
16238 vendorlib_stem='$vendorlib_stem'
16239 vendorlibexp='$vendorlibexp'
16240 vendorprefix='$vendorprefix'
16241 vendorprefixexp='$vendorprefixexp'
16242 version='$version'
16243 versiononly='$versiononly'
16244 vi='$vi'
16245 voidflags='$voidflags'
16246 xlibpth='$xlibpth'
16247 xs_apiversion='$xs_apiversion'
16248 zcat='$zcat'
16249 zip='$zip'
16250 EOT
16251
16252 : Add in command line options if available
16253 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16254
16255 : add special variables
16256 $test -f $src/patchlevel.h && \
16257 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16258 echo "CONFIGDOTSH=true" >>config.sh
16259
16260 : propagate old symbols
16261 if $test -f UU/config.sh; then
16262         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16263         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16264         $sort | $uniq -u >UU/oldsyms
16265         set X `cat UU/oldsyms`
16266         shift
16267         case $# in
16268         0) ;;
16269         *)
16270                 cat <<EOM
16271 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16272 EOM
16273                 echo "# Variables propagated from previous config.sh file." >>config.sh
16274                 for sym in `cat UU/oldsyms`; do
16275                         echo "    Propagating $hint variable "'$'"$sym..."
16276                         eval 'tmp="$'"${sym}"'"'
16277                         echo "$tmp" | \
16278                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16279                 done
16280                 ;;
16281         esac
16282 fi
16283
16284 : Finish up by extracting the .SH files
16285 case "$alldone" in
16286 exit)
16287         $rm -rf UU
16288         echo "Done."
16289         exit 0
16290         ;;
16291 cont)
16292         ;;
16293 '')
16294         dflt=''
16295         nostick=true
16296         $cat <<EOM
16297
16298 If you'd like to make any changes to the config.sh file before I begin
16299 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16300
16301 EOM
16302         rp="Press return or use a shell escape to edit config.sh:"
16303         . UU/myread
16304         nostick=''
16305         case "$ans" in
16306         '') ;;
16307         *) : in case they cannot read
16308                 sh 1>&4 -c "$ans";;
16309         esac
16310         ;;
16311 esac
16312
16313 : if this fails, just run all the .SH files by hand
16314 . ./config.sh
16315
16316 echo " "
16317 exec 1>&4
16318 . ./UU/extract
16319
16320 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16321         dflt=y
16322         case "$silent" in
16323         true) ;;
16324         *)
16325                 $cat <<EOM
16326
16327 Now you need to generate make dependencies by running "$make depend".
16328 You might prefer to run it in background: "$make depend > makedepend.out &"
16329 It can take a while, so you might not want to run it right now.
16330
16331 EOM
16332                 ;;
16333         esac
16334         rp="Run $make depend now?"
16335         . UU/myread
16336         case "$ans" in
16337         y*)
16338                 $make depend && echo "Now you must run '$make'."
16339                 ;;
16340         *)
16341                 echo "You must run '$make depend' then '$make'."
16342                 ;;
16343         esac
16344 elif test -f [Mm]akefile; then
16345         echo " "
16346         echo "Now you must run a $make."
16347 else
16348         echo "Done."
16349 fi
16350
16351 if $test -f Policy.sh; then
16352     $cat <<EOM
16353
16354 If you compile $package on a different machine or from a different object
16355 directory, copy the Policy.sh file from this object directory to the
16356 new one before you run Configure -- this will help you with most of
16357 the policy defaults.
16358
16359 EOM
16360 fi
16361 if $test -f config.msg; then
16362     echo "Hmm.  I also noted the following information while running:"
16363     echo " "
16364     $cat config.msg >&4
16365     $rm -f config.msg
16366 fi
16367 $rm -f kit*isdone ark*isdone
16368 $rm -rf UU
16369
16370 : End of Configure
16371