This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
XS module loading fixup for VMS
[perl5.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 Wed May 31 23:34:04 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
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 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fpos64_t=''
357 d_frexpl=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getespwnam=''
368 d_getfsstat=''
369 d_getgrent=''
370 d_getgrps=''
371 d_gethbyaddr=''
372 d_gethbyname=''
373 d_gethent=''
374 aphostname=''
375 d_gethname=''
376 d_phostname=''
377 d_uname=''
378 d_gethostprotos=''
379 d_getlogin=''
380 d_getmnt=''
381 d_getmntent=''
382 d_getnbyaddr=''
383 d_getnbyname=''
384 d_getnent=''
385 d_getnetprotos=''
386 d_getpent=''
387 d_getpgid=''
388 d_getpgrp2=''
389 d_bsdgetpgrp=''
390 d_getpgrp=''
391 d_getppid=''
392 d_getprior=''
393 d_getpbyname=''
394 d_getpbynumber=''
395 d_getprotoprotos=''
396 d_getprpwnam=''
397 d_getpwent=''
398 d_getsent=''
399 d_getservprotos=''
400 d_getspnam=''
401 d_getsbyname=''
402 d_getsbyport=''
403 d_gnulibc=''
404 d_hasmntopt=''
405 d_htonl=''
406 d_iconv=''
407 d_inetaton=''
408 d_int64_t=''
409 d_isascii=''
410 d_isnan=''
411 d_isnanl=''
412 d_killpg=''
413 d_lchown=''
414 d_ldbl_dig=''
415 d_link=''
416 d_locconv=''
417 d_lockf=''
418 d_longdbl=''
419 longdblsize=''
420 d_longlong=''
421 longlongsize=''
422 d_lseekproto=''
423 d_lstat=''
424 d_madvise=''
425 d_mblen=''
426 d_mbstowcs=''
427 d_mbtowc=''
428 d_memchr=''
429 d_memcmp=''
430 d_memcpy=''
431 d_memmove=''
432 d_memset=''
433 d_mkdir=''
434 d_mkdtemp=''
435 d_mkfifo=''
436 d_mkstemp=''
437 d_mkstemps=''
438 d_mktime=''
439 d_mmap=''
440 mmaptype=''
441 d_modfl=''
442 d_mprotect=''
443 d_msg=''
444 d_msgctl=''
445 d_msgget=''
446 d_msgrcv=''
447 d_msgsnd=''
448 d_msync=''
449 d_munmap=''
450 d_nice=''
451 d_off64_t=''
452 d_open3=''
453 d_fpathconf=''
454 d_pathconf=''
455 d_pause=''
456 d_pipe=''
457 d_poll=''
458 d_portable=''
459 d_old_pthread_create_joinable=''
460 old_pthread_create_joinable=''
461 d_pthread_yield=''
462 d_sched_yield=''
463 sched_yield=''
464 d_qgcvt=''
465 d_readdir=''
466 d_rewinddir=''
467 d_seekdir=''
468 d_telldir=''
469 d_readlink=''
470 d_rename=''
471 d_rmdir=''
472 d_safebcpy=''
473 d_safemcpy=''
474 d_sanemcmp=''
475 d_select=''
476 d_sem=''
477 d_semctl=''
478 d_semget=''
479 d_semop=''
480 d_setegid=''
481 d_seteuid=''
482 d_setgrent=''
483 d_setgrps=''
484 d_sethent=''
485 d_setlinebuf=''
486 d_setlocale=''
487 d_setnent=''
488 d_setpent=''
489 d_setpgid=''
490 d_setpgrp2=''
491 d_bsdsetpgrp=''
492 d_setpgrp=''
493 d_setprior=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setvbuf=''
504 d_sfio=''
505 usesfio=''
506 d_shm=''
507 d_shmat=''
508 d_shmatprototype=''
509 shmattype=''
510 d_shmctl=''
511 d_shmdt=''
512 d_shmget=''
513 d_sigaction=''
514 d_sigsetjmp=''
515 d_msg_ctrunc=''
516 d_msg_dontroute=''
517 d_msg_oob=''
518 d_msg_peek=''
519 d_msg_proxy=''
520 d_oldsock=''
521 d_scm_rights=''
522 d_socket=''
523 d_sockpair=''
524 sockethdr=''
525 socketlib=''
526 d_socklen_t=''
527 d_sqrtl=''
528 d_statblks=''
529 d_statfs_f_flags=''
530 d_statfs_s=''
531 d_fstatvfs=''
532 d_statvfs=''
533 d_stdio_cnt_lval=''
534 d_stdio_ptr_lval=''
535 d_stdiobase=''
536 d_stdstdio=''
537 stdio_base=''
538 stdio_bufsiz=''
539 stdio_cnt=''
540 stdio_filbuf=''
541 stdio_ptr=''
542 d_index=''
543 d_strchr=''
544 d_strcoll=''
545 d_strctcpy=''
546 d_strerrm=''
547 d_strerror=''
548 d_sysernlst=''
549 d_syserrlst=''
550 d_strtod=''
551 d_strtol=''
552 d_strtold=''
553 d_strtoll=''
554 d_strtoul=''
555 d_strtoull=''
556 d_strtouq=''
557 d_strxfrm=''
558 d_symlink=''
559 d_syscall=''
560 d_sysconf=''
561 d_system=''
562 d_tcgetpgrp=''
563 d_tcsetpgrp=''
564 d_telldirproto=''
565 d_time=''
566 timetype=''
567 clocktype=''
568 d_times=''
569 d_truncate=''
570 d_tzname=''
571 d_umask=''
572 d_semctl_semid_ds=''
573 d_semctl_semun=''
574 d_union_semun=''
575 d_ustat=''
576 d_vfork=''
577 usevfork=''
578 d_voidsig=''
579 signal_t=''
580 d_volatile=''
581 d_charvspr=''
582 d_vprintf=''
583 d_wait4=''
584 d_waitpid=''
585 d_wcstombs=''
586 d_wctomb=''
587 dlext=''
588 cccdlflags=''
589 ccdlflags=''
590 dlsrc=''
591 ld=''
592 lddlflags=''
593 usedl=''
594 doublesize=''
595 ebcdic=''
596 fflushNULL=''
597 fflushall=''
598 fpossize=''
599 fpostype=''
600 gidformat=''
601 gidsign=''
602 gidsize=''
603 gidtype=''
604 groupstype=''
605 h_fcntl=''
606 h_sysfile=''
607 i_arpainet=''
608 db_hashtype=''
609 db_prefixtype=''
610 i_db=''
611 i_dbm=''
612 i_rpcsvcdbm=''
613 d_dirnamlen=''
614 direntrytype=''
615 i_dirent=''
616 i_dld=''
617 i_dlfcn=''
618 i_fcntl=''
619 i_float=''
620 i_gdbm=''
621 d_grpasswd=''
622 i_grp=''
623 i_iconv=''
624 i_ieeefp=''
625 i_inttypes=''
626 i_limits=''
627 i_locale=''
628 i_machcthr=''
629 i_malloc=''
630 i_math=''
631 i_memory=''
632 i_mntent=''
633 i_ndbm=''
634 i_netdb=''
635 i_neterrno=''
636 i_netinettcp=''
637 i_niin=''
638 i_sysin=''
639 i_poll=''
640 i_prot=''
641 i_pthread=''
642 d_pwage=''
643 d_pwchange=''
644 d_pwclass=''
645 d_pwcomment=''
646 d_pwexpire=''
647 d_pwgecos=''
648 d_pwpasswd=''
649 d_pwquota=''
650 i_pwd=''
651 i_sfio=''
652 i_shadow=''
653 i_socks=''
654 i_stddef=''
655 i_stdlib=''
656 i_string=''
657 strings=''
658 i_sunmath=''
659 i_sysaccess=''
660 i_sysdir=''
661 i_sysfile=''
662 d_voidtty=''
663 i_bsdioctl=''
664 i_sysfilio=''
665 i_sysioctl=''
666 i_syssockio=''
667 i_syslog=''
668 i_sysmman=''
669 i_sysmode=''
670 i_sysmount=''
671 i_sysndir=''
672 i_sysparam=''
673 i_sysresrc=''
674 i_syssecrt=''
675 i_sysselct=''
676 i_sysstat=''
677 i_sysstatfs=''
678 i_sysstatvfs=''
679 i_systimes=''
680 i_systypes=''
681 i_sysuio=''
682 i_sysun=''
683 i_sysutsname=''
684 i_sysvfs=''
685 i_syswait=''
686 i_sgtty=''
687 i_termio=''
688 i_termios=''
689 i_systime=''
690 i_systimek=''
691 i_time=''
692 timeincl=''
693 i_unistd=''
694 i_ustat=''
695 i_utime=''
696 i_values=''
697 i_stdarg=''
698 i_varargs=''
699 i_varhdr=''
700 i_vfork=''
701 inc_version_list=''
702 inc_version_list_init=''
703 installprefix=''
704 installprefixexp=''
705 installstyle=''
706 installusrbinperl=''
707 intsize=''
708 longsize=''
709 shortsize=''
710 libc=''
711 ldlibpthname=''
712 libperl=''
713 shrpenv=''
714 useshrplib=''
715 glibpth=''
716 libpth=''
717 loclibpth=''
718 plibpth=''
719 xlibpth=''
720 ignore_versioned_solibs=''
721 libs=''
722 libsdirs=''
723 libsfiles=''
724 libsfound=''
725 libspath=''
726 lns=''
727 d_PRIEldbl=''
728 d_PRIFldbl=''
729 d_PRIGldbl=''
730 d_PRIeldbl=''
731 d_PRIfldbl=''
732 d_PRIgldbl=''
733 sPRIEldbl=''
734 sPRIFldbl=''
735 sPRIGldbl=''
736 sPRIeldbl=''
737 sPRIfldbl=''
738 sPRIgldbl=''
739 lseeksize=''
740 lseektype=''
741 make_set_make=''
742 d_mymalloc=''
743 freetype=''
744 mallocobj=''
745 mallocsrc=''
746 malloctype=''
747 usemymalloc=''
748 installman1dir=''
749 man1dir=''
750 man1direxp=''
751 man1ext=''
752 installman3dir=''
753 man3dir=''
754 man3direxp=''
755 man3ext=''
756 huge=''
757 large=''
758 medium=''
759 models=''
760 small=''
761 split=''
762 modetype=''
763 multiarch=''
764 mydomain=''
765 myhostname=''
766 phostname=''
767 c=''
768 n=''
769 d_eofnblk=''
770 eagain=''
771 o_nonblock=''
772 rd_nodata=''
773 netdb_hlen_type=''
774 netdb_host_type=''
775 netdb_name_type=''
776 netdb_net_type=''
777 groupcat=''
778 hostcat=''
779 passcat=''
780 orderlib=''
781 ranlib=''
782 d_perl_otherlibdirs=''
783 otherlibdirs=''
784 package=''
785 spackage=''
786 pager=''
787 api_revision=''
788 api_subversion=''
789 api_version=''
790 api_versionstring=''
791 patchlevel=''
792 revision=''
793 subversion=''
794 version=''
795 perl5=''
796 perladmin=''
797 perlpath=''
798 d_nv_preserves_uv=''
799 d_nv_preserves_uv_bits=''
800 i16size=''
801 i16type=''
802 i32size=''
803 i32type=''
804 i64size=''
805 i64type=''
806 i8size=''
807 i8type=''
808 ivsize=''
809 ivtype=''
810 nvsize=''
811 nvtype=''
812 u16size=''
813 u16type=''
814 u32size=''
815 u32type=''
816 u64size=''
817 u64type=''
818 u8size=''
819 u8type=''
820 uvsize=''
821 uvtype=''
822 ivdformat=''
823 uvoformat=''
824 uvuformat=''
825 uvxformat=''
826 pidtype=''
827 prefix=''
828 prefixexp=''
829 installprivlib=''
830 privlib=''
831 privlibexp=''
832 prototype=''
833 ptrsize=''
834 d_PRIX64=''
835 d_PRId64=''
836 d_PRIi64=''
837 d_PRIo64=''
838 d_PRIu64=''
839 d_PRIx64=''
840 sPRIX64=''
841 sPRId64=''
842 sPRIi64=''
843 sPRIo64=''
844 sPRIu64=''
845 sPRIx64=''
846 d_quad=''
847 quadkind=''
848 quadtype=''
849 uquadtype=''
850 drand01=''
851 randbits=''
852 randfunc=''
853 randseedtype=''
854 seedfunc=''
855 installscript=''
856 scriptdir=''
857 scriptdirexp=''
858 selectminbits=''
859 selecttype=''
860 sh=''
861 sig_count=''
862 sig_name=''
863 sig_name_init=''
864 sig_num=''
865 sig_num_init=''
866 installsitearch=''
867 sitearch=''
868 sitearchexp=''
869 installsitebin=''
870 sitebin=''
871 sitebinexp=''
872 installsitelib=''
873 sitelib=''
874 sitelib_stem=''
875 sitelibexp=''
876 siteprefix=''
877 siteprefixexp=''
878 sizesize=''
879 sizetype=''
880 so=''
881 socksizetype=''
882 sharpbang=''
883 shsharp=''
884 spitshell=''
885 src=''
886 ssizetype=''
887 startperl=''
888 startsh=''
889 stdchar=''
890 d_stdio_stream_array=''
891 stdio_stream_array=''
892 sysman=''
893 trnl=''
894 uidformat=''
895 uidsign=''
896 uidsize=''
897 uidtype=''
898 archname64=''
899 use64bitall=''
900 use64bitint=''
901 uselargefiles=''
902 uselongdouble=''
903 usemorebits=''
904 usemultiplicity=''
905 nm_opt=''
906 nm_so_opt=''
907 runnm=''
908 usenm=''
909 useperlio=''
910 usesocks=''
911 d_oldpthreads=''
912 use5005threads=''
913 useithreads=''
914 usethreads=''
915 incpath=''
916 mips_type=''
917 usrinc=''
918 d_vendorarch=''
919 installvendorarch=''
920 vendorarch=''
921 vendorarchexp=''
922 d_vendorbin=''
923 installvendorbin=''
924 vendorbin=''
925 vendorbinexp=''
926 d_vendorlib=''
927 installvendorlib=''
928 vendorlib=''
929 vendorlib_stem=''
930 vendorlibexp=''
931 usevendorprefix=''
932 vendorprefix=''
933 vendorprefixexp=''
934 defvoidused=''
935 voidflags=''
936 pm_apiversion=''
937 xs_apiversion=''
938 CONFIG=''
939
940 define='define'
941 undef='undef'
942 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
943 rmlist=''
944
945 : We must find out about Eunice early
946 eunicefix=':'
947 if test -f /etc/unixtovms; then
948         eunicefix=/etc/unixtovms
949 fi
950 if test -f /etc/unixtovms.exe; then
951         eunicefix=/etc/unixtovms.exe
952 fi
953
954 i_whoami=''
955 : set useposix=false in your hint file to disable the POSIX extension.
956 useposix=true
957 : set useopcode=false in your hint file to disable the Opcode extension.
958 useopcode=true
959 : Trailing extension.  Override this in a hint file, if needed.
960 _exe=''
961 : Extra object files, if any, needed on this platform.
962 archobjs=''
963 : Possible local include directories to search.
964 : Set locincpth to "" in a hint file to defeat local include searches.
965 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
966 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
967 :
968 : no include file wanted by default
969 inclwanted=''
970
971 groupstype=''
972 : change the next line if compiling for Xenix/286 on Xenix/386
973 xlibpth='/usr/lib/386 /lib/386'
974 : Possible local library directories to search.
975 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
976 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
977
978 : general looking path for locating libraries
979 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
980 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
981 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
982 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
983 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
984
985 : Private path used by Configure to find libraries.  Its value
986 : is prepended to libpth. This variable takes care of special
987 : machines, like the mips.  Usually, it should be empty.
988 plibpth=''
989
990 : default library list
991 libswanted=''
992 : some systems want to use only the non-versioned libso:s
993 ignore_versioned_solibs=''
994 : set usemultiplicity on the Configure command line to enable multiplicity.
995 : set usesocks on the Configure command line to enable socks.
996 : set usethreads on the Configure command line to enable threads.
997 : full support for void wanted by default
998 defvoidused=15
999
1000 : List of libraries we want.
1001 : If anyone needs -lnet, put it in a hint file.
1002 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1003 libswanted="$libswanted dld ld sun m c cposix posix"
1004 libswanted="$libswanted ndir dir crypt sec"
1005 libswanted="$libswanted ucb bsd BSD PW x iconv"
1006 : We probably want to search /usr/shlib before most other libraries.
1007 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1008 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1009 glibpth="/usr/shlib $glibpth"
1010 : Do not use vfork unless overridden by a hint file.
1011 usevfork=false
1012
1013 : Find the basic shell for Bourne shell scripts
1014 case "$sh" in
1015 '')
1016         case "$SYSTYPE" in
1017         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1018         *) xxx='/bin/sh';;
1019         esac
1020         if test -f "$xxx"; then
1021                 sh="$xxx"
1022         else
1023                 : Build up a list and do a single loop so we can 'break' out.
1024                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1025                 for xxx in sh bash ksh pdksh ash; do
1026                         for p in $pth; do
1027                                 try="$try ${p}/${xxx}"
1028                         done
1029                 done
1030                 for xxx in $try; do
1031                         if test -f "$xxx"; then
1032                                 sh="$xxx";
1033                                 break
1034                         elif test -f "$xxx.exe"; then
1035                                 sh="$xxx";
1036                                 break
1037                         fi
1038                 done
1039         fi
1040         ;;
1041 esac
1042
1043 case "$sh" in
1044 '')     cat <<EOM >&2
1045 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1046
1047 Usually it's in /bin/sh.  How did you even get this far?
1048 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1049 we'll try to straighten this all out.
1050 EOM
1051         exit 1
1052         ;;
1053 esac
1054
1055 : see if sh knows # comments
1056 if `$sh -c '#' >/dev/null 2>&1`; then
1057         shsharp=true
1058         spitshell=cat
1059         xcat=/bin/cat
1060         test -f $xcat || xcat=/usr/bin/cat
1061         echo "#!$xcat" >try
1062         $eunicefix try
1063         chmod +x try
1064         ./try > today
1065         if test -s today; then
1066                 sharpbang='#!'
1067         else
1068                 echo "#! $xcat" > try
1069                 $eunicefix try
1070                 chmod +x try
1071                 ./try > today
1072                 if test -s today; then
1073                         sharpbang='#! '
1074                 else
1075                         sharpbang=': use '
1076                 fi
1077         fi
1078 else
1079         echo " "
1080         echo "Your $sh doesn't grok # comments--I will strip them later on."
1081         shsharp=false
1082         cd ..
1083         echo "exec grep -v '^[  ]*#'" >spitshell
1084         chmod +x spitshell
1085         $eunicefix spitshell
1086         spitshell=`pwd`/spitshell
1087         cd UU
1088         echo "I presume that if # doesn't work, #! won't work either!"
1089         sharpbang=': use '
1090 fi
1091 rm -f try today
1092
1093 : figure out how to guarantee sh startup
1094 case "$startsh" in
1095 '') startsh=${sharpbang}${sh} ;;
1096 *)
1097 esac
1098 cat >try <<EOSS
1099 $startsh
1100 set abc
1101 test "$?abc" != 1
1102 EOSS
1103
1104 chmod +x try
1105 $eunicefix try
1106 if ./try; then
1107         : echo "Yup, it does."
1108 else
1109         echo "Hmm... '$startsh' does not guarantee sh startup..."
1110         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1111 fi
1112 rm -f try
1113
1114
1115 : Save command line options in file UU/cmdline.opt for later use in
1116 : generating config.sh.
1117 cat > cmdline.opt <<EOSH
1118 # Configure command line arguments.
1119 config_arg0='$0'
1120 config_args='$*'
1121 config_argc=$#
1122 EOSH
1123 argn=1
1124 for arg in "$@"; do
1125         cat >>cmdline.opt <<EOSH
1126 config_arg$argn='$arg'
1127 EOSH
1128         argn=`expr $argn + 1`
1129 done
1130
1131 : produce awk script to parse command line options
1132 cat >options.awk <<'EOF'
1133 BEGIN {
1134         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1135
1136         len = length(optstr);
1137         for (i = 1; i <= len; i++) {
1138                 c = substr(optstr, i, 1);
1139                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1140                 if (a == ":") {
1141                         arg[c] = 1;
1142                         i++;
1143                 }
1144                 opt[c] = 1;
1145         }
1146 }
1147 {
1148         expect = 0;
1149         str = $0;
1150         if (substr(str, 1, 1) != "-") {
1151                 printf("'%s'\n", str);
1152                 next;
1153         }
1154         len = length($0);
1155         for (i = 2; i <= len; i++) {
1156                 c = substr(str, i, 1);
1157                 if (!opt[c]) {
1158                         printf("-%s\n", substr(str, i));
1159                         next;
1160                 }
1161                 printf("-%s\n", c);
1162                 if (arg[c]) {
1163                         if (i < len)
1164                                 printf("'%s'\n", substr(str, i + 1));
1165                         else
1166                                 expect = 1;
1167                         next;
1168                 }
1169         }
1170 }
1171 END {
1172         if (expect)
1173                 print "?";
1174 }
1175 EOF
1176
1177 : process the command line options
1178 set X `for arg in "$@"; do echo "X$arg"; done |
1179         sed -e s/X// | awk -f options.awk`
1180 eval "set $*"
1181 shift
1182 rm -f options.awk
1183
1184 : set up default values
1185 fastread=''
1186 reuseval=false
1187 config_sh=''
1188 alldone=''
1189 error=''
1190 silent=''
1191 extractsh=''
1192 override=''
1193 knowitall=''
1194 rm -f optdef.sh posthint.sh
1195 cat >optdef.sh <<EOS
1196 $startsh
1197 EOS
1198
1199
1200 : option parsing
1201 while test $# -gt 0; do
1202         case "$1" in
1203         -d) shift; fastread=yes;;
1204         -e) shift; alldone=cont;;
1205         -f)
1206                 shift
1207                 cd ..
1208                 if test -r "$1"; then
1209                         config_sh="$1"
1210                 else
1211                         echo "$me: cannot read config file $1." >&2
1212                         error=true
1213                 fi
1214                 cd UU
1215                 shift;;
1216         -h) shift; error=true;;
1217         -r) shift; reuseval=true;;
1218         -s) shift; silent=true; realsilent=true;;
1219         -E) shift; alldone=exit;;
1220         -K) shift; knowitall=true;;
1221         -O) shift; override=true;;
1222         -S) shift; silent=true; extractsh=true;;
1223         -D)
1224                 shift
1225                 case "$1" in
1226                 *=)
1227                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1228                         echo "$me: ignoring -D $1" >&2
1229                         ;;
1230                 *=*) echo "$1" | \
1231                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1232                 *) echo "$1='define'" >> optdef.sh;;
1233                 esac
1234                 shift
1235                 ;;
1236         -U)
1237                 shift
1238                 case "$1" in
1239                 *=) echo "$1" >> optdef.sh;;
1240                 *=*)
1241                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1242                         echo "$me: ignoring -U $1" >&2
1243                         ;;
1244                 *) echo "$1='undef'" >> optdef.sh;;
1245                 esac
1246                 shift
1247                 ;;
1248         -A)
1249             shift
1250             xxx=''
1251             yyy="$1"
1252             zzz=''
1253             uuu=undef
1254             case "$yyy" in
1255             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1256                  case "$zzz" in
1257                  *:*) zzz='' ;;
1258                  *)   xxx=append
1259                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1260                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1261                  esac
1262                  ;;
1263             esac
1264             case "$xxx" in
1265             '')  case "$yyy" in
1266                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1267                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1268                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1269                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1270                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1271                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1272                  esac
1273                  ;;       
1274             esac
1275             case "$xxx" in
1276             append)
1277                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1278             clear)
1279                 echo "$yyy=''"                  >> posthint.sh ;;
1280             define)
1281                 case "$zzz" in
1282                 '') zzz=define ;;
1283                 esac
1284                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1285             eval)
1286                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1287             prepend)
1288                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1289             undef)
1290                 case "$zzz" in
1291                 '') zzz="$uuu" ;;
1292                 esac
1293                 echo "$yyy=$zzz"                >> posthint.sh ;;
1294             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1295             esac
1296             shift
1297             ;;
1298         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1299             exit 0;;
1300         --) break;;
1301         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1302         *) break;;
1303         esac
1304 done
1305
1306 case "$error" in
1307 true)
1308         cat >&2 <<EOM
1309 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1310                  [-U symbol] [-U symbol=] [-A command:symbol...]
1311   -d : use defaults for all answers.
1312   -e : go on without questioning past the production of config.sh.
1313   -f : specify an alternate default configuration file.
1314   -h : print this help message and exit (with an error status).
1315   -r : reuse C symbols value if possible (skips costly nm extraction).
1316   -s : silent mode, only echoes questions and essential information.
1317   -D : define symbol to have some value:
1318          -D symbol         symbol gets the value 'define'
1319          -D symbol=value   symbol gets the value 'value'
1320   -E : stop at the end of questions, after having produced config.sh.
1321   -K : do not use unless you know what you are doing.
1322   -O : let -D and -U override definitions from loaded configuration file.
1323   -S : perform variable substitutions on all .SH files (can mix with -f)
1324   -U : undefine symbol:
1325          -U symbol    symbol gets the value 'undef'
1326          -U symbol=   symbol gets completely empty
1327   -A : manipulate symbol after the platform specific hints have been applied:
1328          -A symbol=value                append " "value to symbol
1329          -A append:symbol=value         append value to symbol
1330          -A define:symbol=value         define symbol to have value
1331          -A clear:symbol                define symbol to be ''
1332          -A define:symbol               define symbol to be 'define'
1333          -A eval:symbol=value           define symbol to be eval of value
1334          -A prepend:symbol=value        prepend value to symbol
1335          -A undef:symbol                define symbol to be 'undef'
1336          -A undef:symbol=               define symbol to be ''
1337   -V : print version number and exit (with a zero status).
1338 EOM
1339         exit 1
1340         ;;
1341 esac
1342
1343 : Sanity checks
1344 case "$fastread$alldone" in
1345 yescont|yesexit) ;;
1346 *)
1347         case "$extractsh" in
1348         true) ;;
1349         *)
1350                 if test ! -t 0; then
1351                         echo "Say 'sh Configure', not 'sh <Configure'"
1352                         exit 1
1353                 fi
1354                 ;;
1355         esac
1356         ;;
1357 esac
1358
1359 exec 4>&1
1360 case "$silent" in
1361 true) exec 1>/dev/null;;
1362 esac
1363
1364 : run the defines and the undefines, if any, but leave the file out there...
1365 touch optdef.sh
1366 . ./optdef.sh
1367 : create the posthint manipulation script and leave the file out there...
1368 touch posthint.sh
1369
1370 : set package name
1371 package=perl5
1372 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1373 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1374 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1375 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1376 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1377 esac
1378
1379 : Some greps do not return status, grrr.
1380 echo "grimblepritz" >grimble
1381 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1382         contains=contains
1383 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1384         contains=grep
1385 else
1386         contains=contains
1387 fi
1388 rm -f grimble
1389 : the following should work in any shell
1390 case "$contains" in
1391 contains*)
1392         echo " "
1393         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1394         cat >contains <<'EOSS'
1395 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1396 EOSS
1397 chmod +x contains
1398 esac
1399
1400 : Find the path to the source tree
1401 case "$src" in
1402 '') case "$0" in
1403     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1404          case "$src" in
1405          /*)    ;;
1406          *)     src=`cd ../$src && pwd` ;;
1407          esac
1408          ;;
1409     *)   src='.';;
1410     esac;;
1411 esac
1412 case "$src" in
1413 '')     src=/
1414         rsrc=/
1415         ;;
1416 /*) rsrc="$src";;
1417 *) rsrc="../$src";;
1418 esac
1419 if test -f $rsrc/Configure && \
1420         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1421 then
1422    : found it, so we are ok.
1423 else
1424         rsrc=''
1425         for src in . .. ../.. ../../.. ../../../..; do
1426                 if test -f ../$src/Configure && \
1427                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1428                 then
1429                         rsrc=../$src
1430                         break
1431                 fi
1432         done
1433 fi
1434 case "$rsrc" in
1435 '')
1436         cat <<EOM >&4
1437
1438 Sorry, I can't seem to locate the source dir for $package.  Please start
1439 Configure with an explicit path -- i.e. /some/path/Configure.
1440
1441 EOM
1442         exit 1
1443         ;;
1444 ../.)   rsrc='..';;
1445 *)
1446         echo " "
1447         echo "Sources for $package found in \"$src\"." >&4
1448         ;;
1449 esac
1450
1451 : script used to extract .SH files with variable substitutions
1452 cat >extract <<'EOS'
1453 CONFIGDOTSH=true
1454 echo "Doing variable substitutions on .SH files..."
1455 if test -f $src/MANIFEST; then
1456         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1457 else
1458         echo "(Looking for .SH files under the source directory.)"
1459         set x `(cd $src; find . -name "*.SH" -print)`
1460 fi
1461 shift
1462 case $# in
1463 0) set x `(cd $src; echo *.SH)`; shift;;
1464 esac
1465 if test ! -f $src/$1; then
1466         shift
1467 fi
1468 mkdir_p='
1469 name=$1;
1470 create="";
1471 while test $name; do
1472         if test ! -d "$name"; then
1473                 create="$name $create";
1474                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1475                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1476         else
1477                 name="";
1478         fi;
1479 done;
1480 for file in $create; do
1481         mkdir $file;
1482 done
1483 '
1484 for file in $*; do
1485         case "$src" in
1486         ".")
1487                 case "$file" in
1488                 */*)
1489                         dir=`expr X$file : 'X\(.*\)/'`
1490                         file=`expr X$file : 'X.*/\(.*\)'`
1491                         (cd $dir && . ./$file)
1492                         ;;
1493                 *)
1494                         . ./$file
1495                         ;;
1496                 esac
1497                 ;;
1498         *)
1499                 case "$file" in
1500                 */*)
1501                         dir=`expr X$file : 'X\(.*\)/'`
1502                         file=`expr X$file : 'X.*/\(.*\)'`
1503                         (set x $dir; shift; eval $mkdir_p)
1504                         sh <$src/$dir/$file
1505                         ;;
1506                 *)
1507                         sh <$src/$file
1508                         ;;
1509                 esac
1510                 ;;
1511         esac
1512 done
1513 if test -f $src/config_h.SH; then
1514         if test ! -f config.h; then
1515         : oops, they left it out of MANIFEST, probably, so do it anyway.
1516         . $src/config_h.SH
1517         fi
1518 fi
1519 EOS
1520
1521 : extract files and exit if asked to do so
1522 case "$extractsh" in
1523 true)
1524         case "$realsilent" in
1525         true) ;;
1526         *) exec 1>&4;;
1527         esac
1528         case "$config_sh" in
1529         '') config_sh='config.sh';;
1530         esac
1531         echo " "
1532         echo "Fetching answers from $config_sh..."
1533         cd ..
1534         . $config_sh
1535         test "$override" && . ./optdef.sh
1536         echo " "
1537         . UU/extract
1538         rm -rf UU
1539         echo "Done."
1540         exit 0
1541         ;;
1542 esac
1543
1544 : Eunice requires " " instead of "", can you believe it
1545 echo " "
1546 : Here we go...
1547 echo "Beginning of configuration questions for $package."
1548
1549 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1550
1551 : first determine how to suppress newline on echo command
1552 echo " "
1553 echo "Checking echo to see how to suppress newlines..."
1554 (echo "hi there\c" ; echo " ") >.echotmp
1555 if $contains c .echotmp >/dev/null 2>&1 ; then
1556         echo "...using -n."
1557         n='-n'
1558         c=''
1559 else
1560         cat <<'EOM'
1561 ...using \c
1562 EOM
1563         n=''
1564         c='\c'
1565 fi
1566 echo $n "The star should be here-->$c"
1567 echo '*'
1568 rm -f .echotmp
1569
1570 : Now test for existence of everything in MANIFEST
1571 echo " "
1572 if test -f $rsrc/MANIFEST; then
1573         echo "First let's make sure your kit is complete.  Checking..." >&4
1574         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1575         rm -f missing
1576         tmppwd=`pwd`
1577         for filelist in x??; do
1578                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1579         done
1580         if test -s missing; then
1581                 cat missing >&4
1582                 cat >&4 <<'EOM'
1583
1584 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1585
1586 You have the option of continuing the configuration process, despite the
1587 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1588 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1589 and contact the author (perlbug@perl.com).
1590
1591 EOM
1592                 echo $n "Continue? [n] $c" >&4
1593                 read ans
1594                 case "$ans" in
1595                 y*)
1596                         echo "Continuing..." >&4
1597                         rm -f missing
1598                         ;;
1599                 *)
1600                         echo "ABORTING..." >&4
1601                         kill $$
1602                         ;;
1603                 esac
1604         else
1605                 echo "Looks good..."
1606         fi
1607 else
1608         echo "There is no MANIFEST file.  I hope your kit is complete !"
1609 fi
1610 rm -f missing x??
1611
1612 echo " "
1613 : Find the appropriate value for a newline for tr
1614 if test -n "$DJGPP"; then
1615        trnl='\012'
1616 fi
1617 if test X"$trnl" = X; then
1618         case "`echo foo|tr '\n' x 2>/dev/null`" in
1619         foox) trnl='\n' ;;
1620         esac
1621 fi
1622 if test X"$trnl" = X; then
1623         case "`echo foo|tr '\012' x 2>/dev/null`" in
1624         foox) trnl='\012' ;;
1625         esac
1626 fi
1627 if test X"$trnl" = X; then
1628         cat <<EOM >&2
1629
1630 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1631
1632 EOM
1633         exit 1
1634 fi
1635
1636 : compute the number of columns on the terminal for proper question formatting
1637 case "$COLUMNS" in
1638 '') COLUMNS='80';;
1639 esac
1640
1641 : set up the echo used in my read
1642 myecho="case \"\$xxxm\" in
1643 '') echo $n \"\$rp $c\" >&4;;
1644 *) case \"\$rp\" in
1645         '') echo $n \"[\$xxxm] $c\";;
1646         *)
1647                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1648                         echo \"\$rp\" >&4
1649                         echo $n \"[\$xxxm] $c\" >&4
1650                 else
1651                         echo $n \"\$rp [\$xxxm] $c\" >&4
1652                 fi
1653                 ;;
1654         esac;;
1655 esac"
1656
1657 : now set up to do reads with possible shell escape and default assignment
1658 cat <<EOSC >myread
1659 $startsh
1660 xxxm=\$dflt
1661 $myecho
1662 ans='!'
1663 case "\$fastread" in
1664 yes) case "\$dflt" in
1665         '') ;;
1666         *) ans='';
1667                 case "\$silent-\$rp" in
1668                 true-) ;;
1669                 *) echo " " >&4;;
1670                 esac;;
1671         esac;;
1672 *) case "\$silent" in
1673         true) case "\$rp" in
1674                 '') ans='';;
1675                 esac;;
1676         esac;;
1677 esac
1678 while expr "X\$ans" : "X!" >/dev/null; do
1679         read answ
1680         set x \$xxxm
1681         shift
1682         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1683         case  "\$answ" in
1684         "!")
1685                 sh 1>&4
1686                 echo " "
1687                 $myecho
1688                 ;;
1689         !*)
1690                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1691                 shift
1692                 sh 1>&4 -c "\$*"
1693                 echo " "
1694                 $myecho
1695                 ;;
1696         "\$ans")
1697                 case "\$ans" in
1698                 \\&*)
1699                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1700                         shift
1701                         case "\$1" in
1702                         -d)
1703                                 fastread=yes
1704                                 echo "(OK, I'll run with -d after this question.)" >&4
1705                                 ;;
1706                         -*)
1707                                 echo "*** Sorry, \$1 not supported yet." >&4
1708                                 ;;
1709                         esac
1710                         $myecho
1711                         ans=!
1712                         ;;
1713                 esac;;
1714         *)
1715                 case "\$aok" in
1716                 y)
1717                         echo "*** Substitution done -- please confirm."
1718                         xxxm="\$ans"
1719                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1720                         xxxm="\$ans"
1721                         ans=!
1722                         ;;
1723                 *)
1724                         echo "*** Error -- try again."
1725                         ans=!
1726                         ;;
1727                 esac
1728                 $myecho
1729                 ;;
1730         esac
1731         case "\$ans\$xxxm\$nostick" in
1732         '')
1733                 ans=!
1734                 $myecho
1735                 ;;
1736         esac
1737 done
1738 case "\$ans" in
1739 '') ans="\$xxxm";;
1740 esac
1741 EOSC
1742
1743 : create .config dir to save info across Configure sessions
1744 test -d ../.config || mkdir ../.config
1745 cat >../.config/README <<EOF
1746 This directory created by Configure to save information that should
1747 persist across sessions for $package.
1748
1749 You may safely delete it if you wish.
1750 EOF
1751
1752 : general instructions
1753 needman=true
1754 firsttime=true
1755 user=`(logname) 2>/dev/null`
1756 case "$user" in
1757 '') user=`whoami 2>&1`;;
1758 esac
1759 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1760         firsttime=false
1761         echo " "
1762         rp='Would you like to see the instructions?'
1763         dflt=n
1764         . ./myread
1765         case "$ans" in
1766         [yY]*) ;;
1767         *) needman=false;;
1768         esac
1769 fi
1770 if $needman; then
1771         cat <<EOH
1772
1773 This installation shell script will examine your system and ask you questions
1774 to determine how the perl5 package should be installed. If you get
1775 stuck on a question, you may use a ! shell escape to start a subshell or
1776 execute a command.  Many of the questions will have default answers in square
1777 brackets; typing carriage return will give you the default.
1778
1779 On some of the questions which ask for file or directory names you are allowed
1780 to use the ~name construct to specify the login directory belonging to "name",
1781 even if you don't have a shell which knows about that.  Questions where this is
1782 allowed will be marked "(~name ok)".
1783
1784 EOH
1785         rp=''
1786         dflt='Type carriage return to continue'
1787         . ./myread
1788         cat <<'EOH'
1789
1790 The prompter used in this script allows you to use shell variables and
1791 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1792 in the default answer, as if the default line was a set of arguments given to a
1793 script shell.  This means you may also use $* to repeat the whole default line,
1794 so you do not have to re-type everything to add something to the default.
1795
1796 Everytime there is a substitution, you will have to confirm.  If there is an
1797 error (e.g. an unmatched backtick), the default answer will remain unchanged
1798 and you will be prompted again.
1799
1800 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1801 the questions and use the computed defaults (or the previous answers if there
1802 was already a config.sh file). Type 'Configure -h' for a list of options.
1803 You may also start interactively and then answer '& -d' at any prompt to turn
1804 on the non-interactive behaviour for the remainder of the execution.
1805
1806 EOH
1807         . ./myread
1808         cat <<EOH
1809
1810 Much effort has been expended to ensure that this shell script will run on any
1811 Unix system.  If despite that it blows up on yours, your best bet is to edit
1812 Configure and run it again.  If you can't run Configure for some reason,
1813 you'll have to generate a config.sh file by hand.  Whatever problems you
1814 have, let me (perlbug@perl.com) know how I blew it.
1815
1816 This installation script affects things in two ways:
1817
1818 1) it may do direct variable substitutions on some of the files included
1819    in this kit.
1820 2) it builds a config.h file for inclusion in C programs.  You may edit
1821    any of these files as the need arises after running this script.
1822
1823 If you make a mistake on a question, there is no easy way to back up to it
1824 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1825 files.  Configure will offer to let you do this before it runs the SH files.
1826
1827 EOH
1828         dflt='Type carriage return to continue'
1829         . ./myread
1830         case "$firsttime" in
1831         true) echo $user >>../.config/instruct;;
1832         esac
1833 fi
1834
1835 : find out where common programs are
1836 echo " "
1837 echo "Locating common programs..." >&4
1838 cat <<EOSC >loc
1839 $startsh
1840 case \$# in
1841 0) exit 1;;
1842 esac
1843 thing=\$1
1844 shift
1845 dflt=\$1
1846 shift
1847 for dir in \$*; do
1848         case "\$thing" in
1849         .)
1850         if test -d \$dir/\$thing; then
1851                 echo \$dir
1852                 exit 0
1853         fi
1854         ;;
1855         *)
1856         for thisthing in \$dir/\$thing; do
1857                 : just loop through to pick last item
1858         done
1859         if test -f \$thisthing; then
1860                 echo \$thisthing
1861                 exit 0
1862         elif test -f \$dir/\$thing.exe; then
1863                 if test -n "$DJGPP"; then
1864                         echo \$dir/\$thing.exe
1865                 else
1866                         : on Eunice apparently
1867                         echo \$dir/\$thing
1868                 fi
1869                 exit 0
1870         fi
1871         ;;
1872         esac
1873 done
1874 echo \$dflt
1875 exit 1
1876 EOSC
1877 chmod +x loc
1878 $eunicefix loc
1879 loclist="
1880 awk
1881 cat
1882 comm
1883 cp
1884 echo
1885 expr
1886 grep
1887 ls
1888 make
1889 mkdir
1890 rm
1891 sed
1892 sort
1893 touch
1894 tr
1895 uniq
1896 "
1897 trylist="
1898 Mcc
1899 ar
1900 byacc
1901 cpp
1902 csh
1903 date
1904 egrep
1905 gzip
1906 less
1907 ln
1908 more
1909 nm
1910 nroff
1911 pg
1912 test
1913 uname
1914 zip
1915 "
1916 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1917 pth="$pth /lib /usr/lib"
1918 for file in $loclist; do
1919         eval xxx=\$$file
1920         case "$xxx" in
1921         /*|?:[\\/]*)
1922                 if test -f "$xxx"; then
1923                         : ok
1924                 else
1925                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1926                         xxx=`./loc $file $file $pth`
1927                 fi
1928                 ;;
1929         '') xxx=`./loc $file $file $pth`;;
1930         *) xxx=`./loc $xxx $xxx $pth`;;
1931         esac
1932         eval $file=$xxx
1933         eval _$file=$xxx
1934         case "$xxx" in
1935         /*)
1936                 echo $file is in $xxx.
1937                 ;;
1938         ?:[\\/]*)
1939                 echo $file is in $xxx.
1940                 ;;
1941         *)
1942                 echo "I don't know where '$file' is, and my life depends on it." >&4
1943                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1944                 exit 1
1945                 ;;
1946         esac
1947 done
1948 echo " "
1949 echo "Don't worry if any of the following aren't found..."
1950 say=offhand
1951 for file in $trylist; do
1952         eval xxx=\$$file
1953         case "$xxx" in
1954         /*|?:[\\/]*)
1955                 if test -f "$xxx"; then
1956                         : ok
1957                 else
1958                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1959                         xxx=`./loc $file $file $pth`
1960                 fi
1961                 ;;
1962         '') xxx=`./loc $file $file $pth`;;
1963         *) xxx=`./loc $xxx $xxx $pth`;;
1964         esac
1965         eval $file=$xxx
1966         eval _$file=$xxx
1967         case "$xxx" in
1968         /*)
1969                 echo $file is in $xxx.
1970                 ;;
1971         ?:[\\/]*)
1972                 echo $file is in $xxx.
1973                 ;;
1974         *)
1975                 echo "I don't see $file out there, $say."
1976                 say=either
1977                 ;;
1978         esac
1979 done
1980 case "$egrep" in
1981 egrep)
1982         echo "Substituting grep for egrep."
1983         egrep=$grep
1984         ;;
1985 esac
1986 case "$ln" in
1987 ln)
1988         echo "Substituting cp for ln."
1989         ln=$cp
1990         ;;
1991 esac
1992 case "$test" in
1993 test)
1994         echo "Hopefully test is built into your sh."
1995         ;;
1996 *)
1997         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1998                 echo "Using the test built into your sh."
1999                 test=test
2000                 _test=test
2001         fi
2002         ;;
2003 esac
2004 case "$echo" in
2005 echo)
2006         echo "Hopefully echo is built into your sh."
2007         ;;
2008 '') ;;
2009 *)
2010         echo " "
2011 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2012         $echo $n "hi there$c" >foo1
2013         echo $n "hi there$c" >foo2
2014         if cmp foo1 foo2 >/dev/null 2>&1; then
2015                 echo "They are compatible.  In fact, they may be identical."
2016         else
2017                 case "$n" in
2018                 '-n') n='' c='\c';;
2019                 *) n='-n' c='';;
2020                 esac
2021                 cat <<FOO
2022 They are not compatible!  You are probably running ksh on a non-USG system.
2023 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2024 have echo built in and we may have to run some Bourne shell scripts.  That
2025 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2026
2027 FOO
2028                 $echo $n "The star should be here-->$c"
2029                 $echo "*"
2030         fi
2031         $rm -f foo1 foo2
2032         ;;
2033 esac
2034
2035 : determine whether symbolic links are supported
2036 echo " "
2037 $touch blurfl
2038 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2039         echo "Symbolic links are supported." >&4
2040         lns="$ln -s"
2041 else
2042         echo "Symbolic links are NOT supported." >&4
2043         lns="$ln"
2044 fi
2045 $rm -f blurfl sym
2046
2047 : see whether [:lower:] and [:upper:] are supported character classes
2048 echo " "
2049 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2050 ABYZ)
2051         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2052         up='[:upper:]'
2053         low='[:lower:]'
2054         ;;
2055 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2056         # (0xc9 and 0xd1), therefore that is a nice testing point.
2057         if test "X$up" = X -o "X$low" = X; then
2058             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2059             ij) up='[A-Z]'
2060                 low='[a-z]'
2061                 ;;
2062             esac
2063         fi
2064         if test "X$up" = X -o "X$low" = X; then
2065             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2066             ij) up='A-Z'
2067                 low='a-z'
2068                 ;;
2069             esac
2070         fi
2071         if test "X$up" = X -o "X$low" = X; then
2072             case "`echo IJ | od -x 2>/dev/null`" in
2073             *C9D1*|*c9d1*)
2074                 echo "Hey, this might be EBCDIC." >&4
2075                 if test "X$up" = X -o "X$low" = X; then
2076                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2077                     ij) up='[A-IJ-RS-Z]'
2078                         low='[a-ij-rs-z]'
2079                         ;;
2080                     esac
2081                 fi
2082                 if test "X$up" = X -o "X$low" = X; then
2083                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2084                     ij) up='A-IJ-RS-Z'
2085                         low='a-ij-rs-z'
2086                         ;;
2087                     esac
2088                 fi
2089                 ;;
2090             esac
2091         fi
2092 esac
2093 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2094 ij)
2095     echo "Using $up and $low to convert case." >&4
2096     ;;
2097 *)
2098     echo "I don't know how to translate letters from upper to lower case." >&4
2099     echo "Your tr is not acting any way I know of." >&4
2100     exit 1
2101     ;;
2102 esac
2103 : set up the translation script tr, must be called with ./tr of course
2104 cat >tr <<EOSC
2105 $startsh
2106 case "\$1\$2" in
2107 '[A-Z][a-z]') exec $tr '$up' '$low';;
2108 '[a-z][A-Z]') exec $tr '$low' '$up';;
2109 esac
2110 exec $tr "\$@"
2111 EOSC
2112 chmod +x tr
2113 $eunicefix tr
2114
2115 : Try to determine whether config.sh was made on this system
2116 case "$config_sh" in
2117 '')
2118 myuname=`$uname -a 2>/dev/null`
2119 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2120 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2121 # because the A-Z/a-z are not consecutive.
2122 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2123         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2124 newmyuname="$myuname"
2125 dflt=n
2126 case "$knowitall" in
2127 '')
2128         if test -f ../config.sh; then
2129                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2130                         eval "`grep myuname= ../config.sh`"
2131                 fi
2132                 if test "X$myuname" = "X$newmyuname"; then
2133                         dflt=y
2134                 fi
2135         fi
2136         ;;
2137 *) dflt=y;;
2138 esac
2139
2140 : Get old answers from old config file if Configure was run on the
2141 : same system, otherwise use the hints.
2142 hint=default
2143 cd ..
2144 if test -f config.sh; then
2145         echo " "
2146         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2147         . UU/myread
2148         case "$ans" in
2149         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2150         *)  echo "Fetching default answers from your old config.sh file..." >&4
2151                 tmp_n="$n"
2152                 tmp_c="$c"
2153                 tmp_sh="$sh"
2154                 . ./config.sh
2155                 cp config.sh UU
2156                 n="$tmp_n"
2157                 c="$tmp_c"
2158                 : Older versions did not always set $sh.  Catch re-use of such
2159                 : an old config.sh.
2160                 case "$sh" in
2161                 '') sh="$tmp_sh" ;;
2162                 esac
2163                 hint=previous
2164                 ;;
2165         esac
2166 fi
2167 if test ! -f config.sh; then
2168         $cat <<EOM
2169
2170 First time through, eh?  I have some defaults handy for some systems
2171 that need some extra help getting the Configure answers right:
2172
2173 EOM
2174         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2175         dflt=''
2176         : Half the following guesses are probably wrong... If you have better
2177         : tests or hints, please send them to perlbug@perl.com
2178         : The metaconfig authors would also appreciate a copy...
2179         $test -f /irix && osname=irix
2180         $test -f /xenix && osname=sco_xenix
2181         $test -f /dynix && osname=dynix
2182         $test -f /dnix && osname=dnix
2183         $test -f /lynx.os && osname=lynxos
2184         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2185         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2186         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2187         $test -f /bin/mips && /bin/mips && osname=mips
2188         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2189                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2190         $test -d /usr/apollo/bin && osname=apollo
2191         $test -f /etc/saf/_sactab && osname=svr4
2192         $test -d /usr/include/minix && osname=minix
2193         if $test -d /MachTen -o -d /MachTen_Folder; then
2194                 osname=machten
2195                 if $test -x /sbin/version; then
2196                         osvers=`/sbin/version | $awk '{print $2}' |
2197                         $sed -e 's/[A-Za-z]$//'`
2198                 elif $test -x /usr/etc/version; then
2199                         osvers=`/usr/etc/version | $awk '{print $2}' |
2200                         $sed -e 's/[A-Za-z]$//'`
2201                 else
2202                         osvers="$2.$3"
2203                 fi
2204         fi
2205
2206         $test -f /sys/posix.dll &&
2207                 $test -f /usr/bin/what &&
2208                 set X `/usr/bin/what /sys/posix.dll` &&
2209                 $test "$3" = UWIN &&
2210                 osname=uwin &&
2211                 osvers="$5"
2212
2213         if $test -f $uname; then
2214                 set X $myuname
2215                 shift
2216
2217                 case "$5" in
2218                 fps*) osname=fps ;;
2219                 mips*)
2220                         case "$4" in
2221                         umips) osname=umips ;;
2222                         *) osname=mips ;;
2223                         esac;;
2224                 [23]100) osname=mips ;;
2225                 next*) osname=next ;;
2226                 i386*)
2227                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2228                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2229                                 osname='sco'
2230                                 osvers=$tmp
2231                         elif $test -f /etc/kconfig; then
2232                                 osname=isc
2233                                 if test "$lns" = "$ln -s"; then
2234                                         osvers=4
2235                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2236                                         osvers=3
2237                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2238                                         osvers=2
2239                                 fi
2240                         fi
2241                         tmp=''
2242                         ;;
2243                 pc*)
2244                         if test -n "$DJGPP"; then
2245                                 osname=dos
2246                                 osvers=djgpp
2247                         fi
2248                         ;;
2249                 esac
2250
2251                 case "$1" in
2252                 aix) osname=aix
2253                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2254                         case "$tmp" in
2255                         'not found') osvers="$4"."$3" ;;
2256                         '<3240'|'<>3240') osvers=3.2.0 ;;
2257                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2258                         '=3250'|'>3250') osvers=3.2.5 ;;
2259                         *) osvers=$tmp;;
2260                         esac
2261                         ;;
2262                 bsd386) osname=bsd386
2263                         osvers=`$uname -r`
2264                         ;;
2265                 cygwin*) osname=cygwin
2266                         osvers="$3"
2267                         ;;
2268                 *dc.osx) osname=dcosx
2269                         osvers="$3"
2270                         ;;
2271                 dnix) osname=dnix
2272                         osvers="$3"
2273                         ;;
2274                 domainos) osname=apollo
2275                         osvers="$3"
2276                         ;;
2277                 dgux) osname=dgux 
2278                         osvers="$3"
2279                         ;;
2280                 dynixptx*) osname=dynixptx
2281                         osvers=`echo "$4"|sed 's/^v//'`
2282                         ;;
2283                 freebsd) osname=freebsd 
2284                         osvers="$3" ;;
2285                 genix) osname=genix ;;
2286                 hp*) osname=hpux 
2287                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2288                         ;;
2289                 irix*) osname=irix
2290                         case "$3" in
2291                         4*) osvers=4 ;;
2292                         5*) osvers=5 ;;
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 linux) osname=linux
2297                         case "$3" in
2298                         *)      osvers="$3" ;;
2299                         esac
2300                         ;;
2301                 MiNT) osname=mint
2302                         ;;
2303                 netbsd*) osname=netbsd
2304                         osvers="$3"
2305                         ;;
2306                 news-os) osvers="$3"
2307                         case "$3" in
2308                         4*) osname=newsos4 ;;
2309                         *) osname=newsos ;;
2310                         esac
2311                         ;;
2312                 next*) osname=next ;;
2313                 POSIX-BC | posix-bc ) osname=posix-bc
2314                         osvers="$3"
2315                         ;;
2316                 powerux | power_ux | powermax_os | powermaxos | \
2317                 powerunix | power_unix) osname=powerux
2318                         osvers="$3"
2319                         ;;
2320                 qnx) osname=qnx
2321                         osvers="$4"
2322                         ;;
2323                 solaris) osname=solaris
2324                         case "$3" in
2325                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2326                         *)      osvers="$3" ;;
2327                         esac
2328                         ;;
2329                 sunos) osname=sunos
2330                         case "$3" in
2331                         5*) osname=solaris
2332                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2333                         *)      osvers="$3" ;;
2334                         esac
2335                         ;;
2336                 titanos) osname=titanos
2337                         case "$3" in
2338                         1*) osvers=1 ;;
2339                         2*) osvers=2 ;;
2340                         3*) osvers=3 ;;
2341                         4*) osvers=4 ;;
2342                         *)      osvers="$3" ;;
2343                         esac
2344                         ;;
2345                 ultrix) osname=ultrix
2346                         osvers="$3"
2347                         ;;
2348                 osf1|mls+)      case "$5" in
2349                                 alpha)
2350                                         osname=dec_osf
2351                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2352                                         ;;
2353                         hp*)    osname=hp_osf1  ;;
2354                         mips)   osname=mips_osf1 ;;
2355                         esac
2356                         ;;
2357                 unixware) osname=svr5
2358                         osvers="$4"
2359                         ;;
2360                 uts) osname=uts
2361                         osvers="$3"
2362                         ;;
2363                 $2) case "$osname" in
2364                         *isc*) ;;
2365                         *freebsd*) ;;
2366                         svr*)
2367                                 : svr4.x or possibly later
2368                                 case "svr$3" in 
2369                                 ${osname}*)
2370                                         osname=svr$3
2371                                         osvers=$4
2372                                         ;;
2373                                 esac
2374                                 case "$osname" in
2375                                 svr4.0)
2376                                         : Check for ESIX
2377                                         if test -f /stand/boot ; then
2378                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2379                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2380                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2381                                                         if test -n "$isesix"; then
2382                                                                 osname=esix4
2383                                                         fi
2384                                                 fi
2385                                         fi
2386                                         ;;
2387                                 esac
2388                                 ;;
2389                         *)      if test -f /etc/systemid; then
2390                                         osname=sco
2391                                         set `echo $3 | $sed 's/\./ /g'` $4
2392                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2393                                                 osvers=$1.$2.$3
2394                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2395                                                 osvers=$1.$2
2396                                         elif $test -f $src/hints/sco_$1.sh; then
2397                                                 osvers=$1
2398                                         fi
2399                                 else
2400                                         case "$osname" in
2401                                         '') : Still unknown.  Probably a generic Sys V.
2402                                                 osname="sysv"
2403                                                 osvers="$3"
2404                                                 ;;
2405                                         esac
2406                                 fi
2407                                 ;;
2408                         esac
2409                         ;;
2410                 *)      case "$osname" in
2411                         '') : Still unknown.  Probably a generic BSD.
2412                                 osname="$1"
2413                                 osvers="$3"
2414                                 ;;
2415                         esac
2416                         ;;
2417                 esac
2418         else
2419                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2420                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2421                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2422                                 osname=news_os
2423                         fi
2424                         $rm -f UU/kernel.what
2425                 elif test -d c:/.; then
2426                         set X $myuname
2427                         osname=os2
2428                         osvers="$5"
2429                 fi
2430         fi
2431         
2432         : Now look for a hint file osname_osvers, unless one has been
2433         : specified already.
2434         case "$hintfile" in
2435         ''|' ')
2436                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2437                 : Also try without trailing minor version numbers.
2438                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2439                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2440                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2441                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2442                 case "$file" in
2443                 '') dflt=none ;;
2444                 *)  case "$osvers" in
2445                         '') dflt=$file
2446                                 ;;
2447                         *)  if $test -f $src/hints/$file.sh ; then
2448                                         dflt=$file
2449                                 elif $test -f $src/hints/$xfile.sh ; then
2450                                         dflt=$xfile
2451                                 elif $test -f $src/hints/$xxfile.sh ; then
2452                                         dflt=$xxfile
2453                                 elif $test -f $src/hints/$xxxfile.sh ; then
2454                                         dflt=$xxxfile
2455                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2456                                         dflt=$xxxxfile
2457                                 elif $test -f "$src/hints/${osname}.sh" ; then
2458                                         dflt="${osname}"
2459                                 else
2460                                         dflt=none
2461                                 fi
2462                                 ;;
2463                         esac
2464                         ;;
2465                 esac
2466                 if $test -f Policy.sh ; then
2467                         case "$dflt" in
2468                         *Policy*) ;;
2469                         none) dflt="Policy" ;;
2470                         *) dflt="Policy $dflt" ;;
2471                         esac
2472                 fi
2473                 ;;
2474         *)
2475                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2476                 ;;
2477         esac
2478
2479         if $test -f Policy.sh ; then
2480                 $cat <<EOM
2481
2482 There's also a Policy hint file available, which should make the
2483 site-specific (policy) questions easier to answer.
2484 EOM
2485
2486         fi
2487
2488         $cat <<EOM
2489
2490 You may give one or more space-separated answers, or "none" if appropriate.
2491 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2492 is a good thing.  DO NOT give a wrong version or a wrong OS.
2493
2494 EOM
2495
2496         rp="Which of these apply, if any?"
2497         . UU/myread
2498         tans=$ans
2499         for file in $tans; do
2500                 if $test X$file = XPolicy -a -f Policy.sh; then
2501                         . Policy.sh
2502                         $cat Policy.sh >> UU/config.sh
2503                 elif $test -f $src/hints/$file.sh; then
2504                         . $src/hints/$file.sh
2505                         $cat $src/hints/$file.sh >> UU/config.sh
2506                 elif $test X$tans = X -o X$tans = Xnone ; then
2507                         : nothing
2508                 else
2509                         : Give one chance to correct a possible typo.
2510                         echo "$file.sh does not exist"
2511                         dflt=$file
2512                         rp="hint to use instead?"
2513                         . UU/myread
2514                         for file in $ans; do
2515                                 if $test -f "$src/hints/$file.sh"; then
2516                                         . $src/hints/$file.sh
2517                                         $cat $src/hints/$file.sh >> UU/config.sh
2518                                 elif $test X$ans = X -o X$ans = Xnone ; then
2519                                         : nothing
2520                                 else
2521                                         echo "$file.sh does not exist -- ignored."
2522                                 fi
2523                         done
2524                 fi
2525         done
2526
2527         hint=recommended
2528         : Remember our hint file for later.
2529         if $test -f "$src/hints/$file.sh" ; then
2530                 hintfile="$file"
2531         else
2532                 hintfile=''
2533         fi
2534 fi
2535 cd UU
2536 ;;
2537 *)
2538         echo " "
2539         echo "Fetching default answers from $config_sh..." >&4
2540         tmp_n="$n"
2541         tmp_c="$c"
2542         cd ..
2543         cp $config_sh config.sh 2>/dev/null
2544         chmod +w config.sh
2545         . ./config.sh
2546         cd UU
2547         cp ../config.sh .
2548         n="$tmp_n"
2549         c="$tmp_c"
2550         hint=previous
2551         ;;
2552 esac
2553 test "$override" && . ./optdef.sh
2554 myuname="$newmyuname"
2555
2556 : Restore computed paths
2557 for file in $loclist $trylist; do
2558         eval $file="\$_$file"
2559 done
2560
2561 cat << EOM
2562
2563 Configure uses the operating system name and version to set some defaults.
2564 The default value is probably right if the name rings a bell. Otherwise,
2565 since spelling matters for me, either accept the default or answer "none"
2566 to leave it blank.
2567
2568 EOM
2569 case "$osname" in
2570         ''|' ')
2571                 case "$hintfile" in
2572                 ''|' '|none) dflt=none ;;
2573                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2574                 esac
2575                 ;;
2576         *) dflt="$osname" ;;
2577 esac
2578 rp="Operating system name?"
2579 . ./myread
2580 case "$ans" in
2581 none)  osname='' ;;
2582 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2583 esac
2584 echo " "
2585 case "$osvers" in
2586         ''|' ')
2587                 case "$hintfile" in
2588                 ''|' '|none) dflt=none ;;
2589                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2590                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2591                         case "$dflt" in
2592                         ''|' ') dflt=none ;;
2593                         esac
2594                         ;;
2595                 esac
2596                 ;;
2597         *) dflt="$osvers" ;;
2598 esac
2599 rp="Operating system version?"
2600 . ./myread
2601 case "$ans" in
2602 none)  osvers='' ;;
2603 *) osvers="$ans" ;;
2604 esac
2605
2606
2607 . ./posthint.sh
2608
2609 : who configured the system
2610 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2611 cf_by=`(logname) 2>/dev/null`
2612 case "$cf_by" in
2613 "")
2614         cf_by=`(whoami) 2>/dev/null`
2615         case "$cf_by" in
2616         "") cf_by=unknown ;;
2617         esac ;;
2618 esac
2619
2620 : set up the script used to warn in case of inconsistency
2621 cat <<EOS >whoa
2622 $startsh
2623 EOS
2624 cat <<'EOSC' >>whoa
2625 dflt=y
2626 echo " "
2627 echo "*** WHOA THERE!!! ***" >&4
2628 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2629 rp="    Keep the $hint value?"
2630 . ./myread
2631 case "$ans" in
2632 y) td=$was; tu=$was;;
2633 esac
2634 EOSC
2635
2636 : function used to set $1 to $val
2637 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2638 case "$val$was" in
2639 $define$undef) . ./whoa; eval "$var=\$td";;
2640 $undef$define) . ./whoa; eval "$var=\$tu";;
2641 *) eval "$var=$val";;
2642 esac'
2643
2644 case "$usethreads" in
2645 $define|true|[yY]*)     dflt='y';;
2646 *) dflt='n';;
2647 esac
2648 cat <<EOM
2649
2650 Perl can be built to take advantage of threads on some systems.
2651 To do so, Configure can be run with -Dusethreads.
2652
2653 Note that threading is a highly experimental feature, and
2654 some known race conditions still remain.  If you choose to try
2655 it, be very sure to not actually deploy it for production
2656 purposes.  README.threads has more details, and is required
2657 reading if you enable threads.
2658
2659 If this doesn't make any sense to you, just accept the default '$dflt'.
2660 EOM
2661 rp='Build a threading Perl?'
2662 . ./myread
2663 case "$ans" in
2664 y|Y)    val="$define" ;;
2665 *)      val="$undef" ;;
2666 esac
2667 set usethreads
2668 eval $setvar
2669
2670 case "$usethreads" in
2671 $define)
2672         $cat <<EOM
2673
2674 As of 5.5.640, Perl has two different internal threading implementations,
2675 the 5.005 version (5005threads) and an interpreter-based version
2676 (ithreads) that has one interpreter per thread.  Both are very 
2677 experimental.  This arrangement exists to help developers work out
2678 which one is better.
2679
2680 If you're a casual user, you probably don't want interpreter-threads
2681 at this time.  There doesn't yet exist a way to create threads from
2682 within Perl in this model, i.e., "use Thread;" will NOT work.
2683 EOM
2684         : Default to ithreads unless overridden on command line or with
2685         : old config.sh
2686         dflt='y'
2687         case "$use5005threads" in
2688                 $define|true|[yY]*) dflt='n';;
2689         esac
2690         case "$useithreads" in
2691                 $undef|false|[nN]*) dflt='n';;
2692         esac
2693         rp='Use interpreter-based ithreads?'
2694         . ./myread
2695         case "$ans" in
2696         y|Y)    val="$define" ;;
2697         *)      val="$undef" ;;
2698         esac
2699         set useithreads
2700         eval $setvar
2701         : Now set use5005threads to the opposite value.
2702         case "$useithreads" in
2703         $define) val="$undef" ;;
2704         *) val="$define" ;;
2705         esac
2706         set use5005threads
2707         eval $setvar
2708         ;;
2709 *)
2710         useithreads="$undef"
2711         use5005threads="$undef"
2712         ;;
2713 esac
2714
2715 case "$d_oldpthreads" in
2716 '')     : Configure tests would be welcome here.  For now, assume undef.
2717         val="$undef" ;;
2718 *)      val="$d_oldpthreads" ;;
2719 esac
2720 set d_oldpthreads
2721 eval $setvar
2722
2723
2724 case "$usethreads" in
2725 "$define"|true|[yY]*)
2726 : Look for a hint-file generated 'call-back-unit'.  If the
2727 : user has specified that a threading perl is to be built,
2728 : we may need to set or change some other defaults.
2729         if $test -f usethreads.cbu; then
2730                 echo "Your platform has some specific hints for threaded builds, using them..."
2731                 . ./usethreads.cbu
2732         else
2733                 $cat <<EOM
2734 (Your platform doesn't have any specific hints for threaded builds.
2735  Assuming POSIX threads, then.)
2736 EOM
2737         fi
2738         ;;
2739 esac
2740
2741 cat <<EOM
2742
2743 Perl can be built so that multiple Perl interpreters can coexist
2744 within the same Perl executable.
2745 EOM
2746
2747 case "$useithreads" in
2748 $define)
2749         cat <<EOM
2750 This multiple interpreter support is required for interpreter-based threads.
2751 EOM
2752         val="$define"
2753         ;;
2754 *)      case "$usemultiplicity" in
2755         $define|true|[yY]*)     dflt='y';;
2756         *) dflt='n';;
2757         esac
2758         echo " "
2759         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2760         rp='Build Perl for multiplicity?'
2761         . ./myread
2762         case "$ans" in
2763         y|Y)    val="$define" ;;
2764         *)      val="$undef" ;;
2765         esac
2766         ;;
2767 esac
2768 set usemultiplicity
2769 eval $setvar
2770
2771 : determine where manual pages are on this system
2772 echo " "
2773 case "$sysman" in
2774 '') 
2775         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2776         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2777         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2778         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2779         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2780         sysman=`./loc . /usr/man/man1 $syspath`
2781         ;;
2782 esac
2783 if $test -d "$sysman"; then
2784         echo "System manual is in $sysman." >&4
2785 else
2786         echo "Could not find manual pages in source form." >&4
2787 fi
2788
2789 : see what memory models we can support
2790 case "$models" in
2791 '')
2792         $cat >pdp11.c <<'EOP'
2793 int main() {
2794 #ifdef pdp11
2795         exit(0);
2796 #else
2797         exit(1);
2798 #endif
2799 }
2800 EOP
2801         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2802         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2803                 dflt='unsplit split'
2804         else
2805                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2806                 case "$tans" in
2807                 X) dflt='none';;
2808                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2809                                 dflt='small'
2810                         else
2811                                 dflt=''
2812                         fi
2813                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2814                                 dflt="$dflt medium"
2815                         fi
2816                         if $test -d /lib/large || $test -d /usr/lib/large; then
2817                                 dflt="$dflt large"
2818                         fi
2819                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2820                                 dflt="$dflt huge"
2821                         fi
2822                 esac
2823         fi;;
2824 *) dflt="$models";;
2825 esac
2826 $cat <<EOM
2827  
2828 Some systems have different model sizes.  On most systems they are called
2829 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2830 split.  If your system doesn't support different memory models, say "none".
2831 If you wish to force everything to one memory model, say "none" here and
2832 put the appropriate flags later when it asks you for other cc and ld flags.
2833 Venix systems may wish to put "none" and let the compiler figure things out.
2834 (In the following question multiple model names should be space separated.)
2835
2836 The default for most systems is "none".
2837
2838 EOM
2839 rp="Which memory models are supported?"
2840 . ./myread
2841 models="$ans"
2842
2843 case "$models" in
2844 none)
2845         small=''
2846         medium=''
2847         large=''
2848         huge=''
2849         unsplit=''
2850         split=''
2851         ;;
2852 *split)
2853         case "$split" in
2854         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2855                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2856                         dflt='-i'
2857                 else
2858                         dflt='none'
2859                 fi;;
2860         *) dflt="$split";;
2861         esac
2862         rp="What flag indicates separate I and D space?"
2863         . ./myread
2864         tans="$ans"
2865         case "$tans" in
2866         none) tans='';;
2867         esac
2868         split="$tans"
2869         unsplit='';;
2870 *large*|*small*|*medium*|*huge*)
2871         case "$models" in
2872         *large*)
2873                 case "$large" in
2874                 '') dflt='-Ml';;
2875                 *) dflt="$large";;
2876                 esac
2877         rp="What flag indicates large model?"
2878         . ./myread
2879         tans="$ans"
2880         case "$tans" in
2881         none) tans='';
2882         esac
2883         large="$tans";;
2884         *) large='';;
2885         esac
2886         case "$models" in
2887         *huge*) case "$huge" in
2888                 '') dflt='-Mh';;
2889                 *) dflt="$huge";;
2890                 esac
2891                 rp="What flag indicates huge model?"
2892                 . ./myread
2893                 tans="$ans"
2894                 case "$tans" in
2895                 none) tans='';
2896                 esac
2897                 huge="$tans";;
2898         *) huge="$large";;
2899         esac
2900         case "$models" in
2901         *medium*) case "$medium" in
2902                 '') dflt='-Mm';;
2903                 *) dflt="$medium";;
2904                 esac
2905                 rp="What flag indicates medium model?"
2906                 . ./myread
2907                 tans="$ans"
2908                 case "$tans" in
2909                 none) tans='';
2910                 esac
2911                 medium="$tans";;
2912         *) medium="$large";;
2913         esac
2914         case "$models" in
2915         *small*) case "$small" in
2916                 '') dflt='none';;
2917                 *) dflt="$small";;
2918                 esac
2919                 rp="What flag indicates small model?"
2920                 . ./myread
2921                 tans="$ans"
2922                 case "$tans" in
2923                 none) tans='';
2924                 esac
2925                 small="$tans";;
2926         *) small='';;
2927         esac
2928         ;;
2929 *)
2930         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2931         ;;
2932 esac
2933 $rm -f pdp11.* pdp11
2934
2935 : make some quick guesses about what we are up against
2936 echo " "
2937 $echo $n "Hmm...  $c"
2938 echo exit 1 >bsd
2939 echo exit 1 >usg
2940 echo exit 1 >v7
2941 echo exit 1 >osf1
2942 echo exit 1 >eunice
2943 echo exit 1 >xenix
2944 echo exit 1 >venix
2945 echo exit 1 >os2
2946 d_bsd="$undef"
2947 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2948 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2949 then
2950         echo "Looks kind of like an OSF/1 system, but we'll see..."
2951         echo exit 0 >osf1
2952 elif test `echo abc | tr a-z A-Z` = Abc ; then
2953         xxx=`./loc addbib blurfl $pth`
2954         if $test -f $xxx; then
2955         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2956                 echo exit 0 >bsd
2957                 echo exit 0 >usg
2958         else
2959                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2960                         echo "Looks kind of like an extended USG system, but we'll see..."
2961                 else
2962                         echo "Looks kind of like a USG system, but we'll see..."
2963                 fi
2964                 echo exit 0 >usg
2965         fi
2966 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2967         echo "Looks kind of like a BSD system, but we'll see..."
2968         d_bsd="$define"
2969         echo exit 0 >bsd
2970 else
2971         echo "Looks kind of like a Version 7 system, but we'll see..."
2972         echo exit 0 >v7
2973 fi
2974 case "$eunicefix" in
2975 *unixtovms*)
2976         $cat <<'EOI'
2977 There is, however, a strange, musty smell in the air that reminds me of
2978 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2979 EOI
2980         echo exit 0 >eunice
2981         d_eunice="$define"
2982 : it so happens the Eunice I know will not run shell scripts in Unix format
2983         ;;
2984 *)
2985         echo " "
2986         echo "Congratulations.  You aren't running Eunice."
2987         d_eunice="$undef"
2988         ;;
2989 esac
2990 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2991 case "$p_" in
2992 :) ;;
2993 *)
2994         $cat <<'EOI'
2995 I have the feeling something is not exactly right, however...don't tell me...
2996 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2997 EOI
2998         echo exit 0 >os2
2999         ;;
3000 esac
3001 if test -f /xenix; then
3002         echo "Actually, this looks more like a XENIX system..."
3003         echo exit 0 >xenix
3004         d_xenix="$define"
3005 else
3006         echo " "
3007         echo "It's not Xenix..."
3008         d_xenix="$undef"
3009 fi
3010 chmod +x xenix
3011 $eunicefix xenix
3012 if test -f /venix; then
3013         echo "Actually, this looks more like a VENIX system..."
3014         echo exit 0 >venix
3015 else
3016         echo " "
3017         if ./xenix; then
3018                 : null
3019         else
3020                 echo "Nor is it Venix..."
3021         fi
3022 fi
3023 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3024 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3025 $rm -f foo
3026
3027 : see if we need a special compiler
3028 echo " "
3029 if ./usg; then
3030         case "$cc" in
3031         '') case "$Mcc" in
3032                 /*) dflt='Mcc';;
3033                 *) case "$large" in
3034                         -M*) dflt='cc';;
3035                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3036                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3037                                                 dflt='cc'
3038                                         else
3039                                                 dflt='cc -M'
3040                                         fi
3041                                 else
3042                                         dflt='cc'
3043                                 fi;;
3044                         esac;;
3045                 esac;;
3046         *)  dflt="$cc";;
3047         esac
3048         case "$dflt" in
3049         *M*)    $cat <<'EOM'
3050 On some older systems the default C compiler will not resolve multiple global
3051 references that happen to have the same name.  On some such systems the "Mcc"
3052 command may be used to force these to be resolved.  On other systems a "cc -M"
3053 command is required.  (Note that the -M flag on other systems indicates a
3054 memory model to use!) If you have the Gnu C compiler, you might wish to use
3055 that instead.
3056
3057 EOM
3058         ;;
3059         esac
3060         rp="Use which C compiler?"
3061         . ./myread
3062         cc="$ans"
3063 else
3064         case "$cc" in
3065         '') dflt=cc;;
3066         *) dflt="$cc";;
3067         esac
3068         rp="Use which C compiler?"
3069         . ./myread
3070         cc="$ans"
3071 fi
3072 : Look for a hint-file generated 'call-back-unit'.  Now that the
3073 : user has specified the compiler, we may need to set or change some
3074 : other defaults.
3075 if $test -f cc.cbu; then
3076     . ./cc.cbu
3077 fi
3078 echo " "
3079 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3080 $cat >gccvers.c <<EOM
3081 #include <stdio.h>
3082 int main() {
3083 #ifdef __GNUC__
3084 #ifdef __VERSION__
3085         printf("%s\n", __VERSION__);
3086 #else
3087         printf("%s\n", "1");
3088 #endif
3089 #endif
3090         exit(0);
3091 }
3092 EOM
3093 if $cc $ldflags -o gccvers gccvers.c; then
3094         gccversion=`./gccvers`
3095         case "$gccversion" in
3096         '') echo "You are not using GNU cc." ;;
3097         *)  echo "You are using GNU cc $gccversion."
3098             ;;
3099         esac
3100 else
3101         echo " "
3102         echo "*** WHOA THERE!!! ***" >&4
3103         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3104         case "$knowitall" in
3105         '')
3106         echo "    You'd better start hunting for one and let me know about it." >&4
3107                 exit 1
3108                 ;;
3109         esac
3110 fi
3111 $rm -f gccvers*
3112 case "$gccversion" in
3113 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3114 esac
3115
3116 : decide how portable to be.  Allow command line overrides.
3117 case "$d_portable" in
3118 "$undef") ;;
3119 *)      d_portable="$define" ;;
3120 esac
3121
3122 : set up shell script to do ~ expansion
3123 cat >filexp <<EOSS
3124 $startsh
3125 : expand filename
3126 case "\$1" in
3127  ~/*|~)
3128         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3129         ;;
3130  ~*)
3131         if $test -f /bin/csh; then
3132                 /bin/csh -f -c "glob \$1"
3133                 failed=\$?
3134                 echo ""
3135                 exit \$failed
3136         else
3137                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3138                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3139                 if $test ! -d "\$dir"; then
3140                         me=\`basename \$0\`
3141                         echo "\$me: can't locate home directory for: \$name" >&2
3142                         exit 1
3143                 fi
3144                 case "\$1" in
3145                 */*)
3146                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3147                         ;;
3148                 *)
3149                         echo \$dir
3150                         ;;
3151                 esac
3152         fi
3153         ;;
3154 *)
3155         echo \$1
3156         ;;
3157 esac
3158 EOSS
3159 chmod +x filexp
3160 $eunicefix filexp
3161
3162 : now set up to get a file name
3163 cat <<EOS >getfile
3164 $startsh
3165 EOS
3166 cat <<'EOSC' >>getfile
3167 tilde=''
3168 fullpath=''
3169 already=''
3170 skip=''
3171 none_ok=''
3172 exp_file=''
3173 nopath_ok=''
3174 orig_rp="$rp"
3175 orig_dflt="$dflt"
3176 case "$gfpth" in
3177 '') gfpth='.' ;;
3178 esac
3179
3180 case "$fn" in
3181 *\(*)
3182         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3183         fn=`echo $fn | sed 's/(.*)//'`
3184         ;;
3185 esac
3186
3187 case "$fn" in
3188 *:*)
3189         loc_file=`expr $fn : '.*:\(.*\)'`
3190         fn=`expr $fn : '\(.*\):.*'`
3191         ;;
3192 esac
3193
3194 case "$fn" in
3195 *~*) tilde=true;;
3196 esac
3197 case "$fn" in
3198 */*) fullpath=true;;
3199 esac
3200 case "$fn" in
3201 *+*) skip=true;;
3202 esac
3203 case "$fn" in
3204 *n*) none_ok=true;;
3205 esac
3206 case "$fn" in
3207 *e*) exp_file=true;;
3208 esac
3209 case "$fn" in
3210 *p*) nopath_ok=true;;
3211 esac
3212
3213 case "$fn" in
3214 *f*) type='File';;
3215 *d*) type='Directory';;
3216 *l*) type='Locate';;
3217 esac
3218
3219 what="$type"
3220 case "$what" in
3221 Locate) what='File';;
3222 esac
3223
3224 case "$exp_file" in
3225 '')
3226         case "$d_portable" in
3227         "$define") ;;
3228         *) exp_file=true;;
3229         esac
3230         ;;
3231 esac
3232
3233 cd ..
3234 while test "$type"; do
3235         redo=''
3236         rp="$orig_rp"
3237         dflt="$orig_dflt"
3238         case "$tilde" in
3239         true) rp="$rp (~name ok)";;
3240         esac
3241         . UU/myread
3242         if test -f UU/getfile.ok && \
3243                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3244         then
3245                 value="$ans"
3246                 ansexp="$ans"
3247                 break
3248         fi
3249         case "$ans" in
3250         none)
3251                 value=''
3252                 ansexp=''
3253                 case "$none_ok" in
3254                 true) type='';;
3255                 esac
3256                 ;;
3257         *)
3258                 case "$tilde" in
3259                 '') value="$ans"
3260                         ansexp="$ans";;
3261                 *)
3262                         value=`UU/filexp $ans`
3263                         case $? in
3264                         0)
3265                                 if test "$ans" != "$value"; then
3266                                         echo "(That expands to $value on this system.)"
3267                                 fi
3268                                 ;;
3269                         *) value="$ans";;
3270                         esac
3271                         ansexp="$value"
3272                         case "$exp_file" in
3273                         '') value="$ans";;
3274                         esac
3275                         ;;
3276                 esac
3277                 case "$fullpath" in
3278                 true)
3279                         case "$ansexp" in
3280                         /*) value="$ansexp" ;;
3281                         [a-zA-Z]:/*) value="$ansexp" ;;
3282                         *)
3283                                 redo=true
3284                                 case "$already" in
3285                                 true)
3286                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3287                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3288                                         ;;
3289                                 *)
3290                                 echo "Please give a full path name, starting with slash." >&4
3291                                         case "$tilde" in
3292                                         true)
3293                                 echo "Note that using ~name is ok provided it expands well." >&4
3294                                                 already=true
3295                                                 ;;
3296                                         esac
3297                                 esac
3298                                 ;;
3299                         esac
3300                         ;;
3301                 esac
3302                 case "$redo" in
3303                 '')
3304                         case "$type" in
3305                         File)
3306                                 for fp in $gfpth; do
3307                                         if test "X$fp" = X.; then
3308                                             pf="$ansexp"
3309                                         else    
3310                                             pf="$fp/$ansexp"
3311                                         fi
3312                                         if test -f "$pf"; then
3313                                                 type=''
3314                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3315                                         then
3316                                                 echo "($value is not a plain file, but that's ok.)"
3317                                                 type=''
3318                                         fi
3319                                         if test X"$type" = X; then
3320                                             value="$pf"
3321                                             break
3322                                         fi
3323                                 done
3324                                 ;;
3325                         Directory)
3326                                 for fp in $gfpth; do
3327                                         if test "X$fp" = X.; then
3328                                             dir="$ans"
3329                                             direxp="$ansexp"
3330                                         else    
3331                                             dir="$fp/$ansexp"
3332                                             direxp="$fp/$ansexp"
3333                                         fi
3334                                         if test -d "$direxp"; then
3335                                                 type=''
3336                                                 value="$dir"
3337                                                 break
3338                                         fi
3339                                 done
3340                                 ;;
3341                         Locate)
3342                                 if test -d "$ansexp"; then
3343                                         echo "(Looking for $loc_file in directory $value.)"
3344                                         value="$value/$loc_file"
3345                                         ansexp="$ansexp/$loc_file"
3346                                 fi
3347                                 if test -f "$ansexp"; then
3348                                         type=''
3349                                 fi
3350                                 case "$nopath_ok" in
3351                                 true)   case "$value" in
3352                                         */*) ;;
3353                                         *)      echo "Assuming $value will be in people's path."
3354                                                 type=''
3355                                                 ;;
3356                                         esac
3357                                         ;;
3358                                 esac
3359                                 ;;
3360                         esac
3361
3362                         case "$skip" in
3363                         true) type='';
3364                         esac
3365
3366                         case "$type" in
3367                         '') ;;
3368                         *)
3369                                 if test "$fastread" = yes; then
3370                                         dflt=y
3371                                 else
3372                                         dflt=n
3373                                 fi
3374                                 rp="$what $value doesn't exist.  Use that name anyway?"
3375                                 . UU/myread
3376                                 dflt=''
3377                                 case "$ans" in
3378                                 y*) type='';;
3379                                 *) echo " ";;
3380                                 esac
3381                                 ;;
3382                         esac
3383                         ;;
3384                 esac
3385                 ;;
3386         esac
3387 done
3388 cd UU
3389 ans="$value"
3390 rp="$orig_rp"
3391 dflt="$orig_dflt"
3392 rm -f getfile.ok
3393 test "X$gfpthkeep" != Xy && gfpth=""
3394 EOSC
3395
3396 : What should the include directory be ?
3397 echo " "
3398 $echo $n "Hmm...  $c"
3399 dflt='/usr/include'
3400 incpath=''
3401 mips_type=''
3402 if $test -f /bin/mips && /bin/mips; then
3403         echo "Looks like a MIPS system..."
3404         $cat >usr.c <<'EOCP'
3405 #ifdef SYSTYPE_BSD43
3406 /bsd43
3407 #endif
3408 EOCP
3409         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3410                 dflt='/bsd43/usr/include'
3411                 incpath='/bsd43'
3412                 mips_type='BSD 4.3'
3413         else
3414                 mips_type='System V'
3415         fi
3416         $rm -f usr.c usr.out
3417         echo "and you're compiling with the $mips_type compiler and libraries."
3418         xxx_prompt=y
3419         echo "exit 0" >mips
3420 else
3421         echo "Doesn't look like a MIPS system."
3422         xxx_prompt=n
3423         echo "exit 1" >mips
3424 fi
3425 chmod +x mips
3426 $eunicefix mips
3427 case "$usrinc" in
3428 '') ;;
3429 *) dflt="$usrinc";;
3430 esac
3431 case "$xxx_prompt" in
3432 y)      fn=d/
3433         echo " "
3434         rp='Where are the include files you want to use?'
3435         . ./getfile
3436         usrinc="$ans"
3437         ;;
3438 *)      usrinc="$dflt"
3439         ;;
3440 esac
3441
3442 : see how we invoke the C preprocessor
3443 echo " "
3444 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3445 cat <<'EOT' >testcpp.c
3446 #define ABC abc
3447 #define XYZ xyz
3448 ABC.XYZ
3449 EOT
3450 cd ..
3451 if test ! -f cppstdin; then
3452         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3453                 # AIX cc -E doesn't show the absolute headerfile
3454                 # locations but we'll cheat by using the -M flag.
3455                 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
3456         else
3457                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3458         fi
3459 else
3460         echo "Keeping your $hint cppstdin wrapper."
3461 fi
3462 chmod 755 cppstdin
3463 wrapper=`pwd`/cppstdin
3464 ok='false'
3465 cd UU
3466
3467 if $test "X$cppstdin" != "X" && \
3468         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3469         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3470 then
3471         echo "You used to use $cppstdin $cppminus so we'll use that again."
3472         case "$cpprun" in
3473         '') echo "But let's see if we can live without a wrapper..." ;;
3474         *)
3475                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3476                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3477                 then
3478                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3479                         ok='true'
3480                 else
3481                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3482                 fi
3483                 ;;
3484         esac
3485 else
3486         case "$cppstdin" in
3487         '') ;;
3488         *)
3489                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3490                 ;;
3491         esac
3492 fi
3493
3494 if $ok; then
3495         : nothing
3496 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3497         $cc -E <testcpp.c >testcpp.out 2>&1; \
3498         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3499         echo "Yup, it does."
3500         x_cpp="$cc -E"
3501         x_minus='';
3502 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3503         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3504         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3505         echo "Yup, it does."
3506         x_cpp="$cc -E"
3507         x_minus='-';
3508 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3509         $cc -P <testcpp.c >testcpp.out 2>&1; \
3510         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3511         echo "Yipee, that works!"
3512         x_cpp="$cc -P"
3513         x_minus='';
3514 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3515         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3516         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3517         echo "At long last!"
3518         x_cpp="$cc -P"
3519         x_minus='-';
3520 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3521         $cpp <testcpp.c >testcpp.out 2>&1; \
3522         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3523         echo "It works!"
3524         x_cpp="$cpp"
3525         x_minus='';
3526 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3527         $cpp - <testcpp.c >testcpp.out 2>&1; \
3528         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3529         echo "Hooray, it works!  I was beginning to wonder."
3530         x_cpp="$cpp"
3531         x_minus='-';
3532 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3533         $wrapper <testcpp.c >testcpp.out 2>&1; \
3534         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3535         x_cpp="$wrapper"
3536         x_minus=''
3537         echo "Eureka!"
3538 else
3539         dflt=''
3540         rp="No dice.  I can't find a C preprocessor.  Name one:"
3541         . ./myread
3542         x_cpp="$ans"
3543         x_minus=''
3544         $x_cpp <testcpp.c >testcpp.out 2>&1
3545         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3546                 echo "OK, that will do." >&4
3547         else
3548 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3549                 exit 1
3550         fi
3551 fi
3552
3553 case "$ok" in
3554 false)
3555         cppstdin="$x_cpp"
3556         cppminus="$x_minus"
3557         cpprun="$x_cpp"
3558         cpplast="$x_minus"
3559         set X $x_cpp
3560         shift
3561         case "$1" in
3562         "$cpp")
3563                 echo "Perhaps can we force $cc -E using a wrapper..."
3564                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3565                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3566                 then
3567                         echo "Yup, we can."
3568                         cppstdin="$wrapper"
3569                         cppminus='';
3570                 else
3571                         echo "Nope, we'll have to live without it..."
3572                 fi
3573                 ;;
3574         esac
3575         case "$cpprun" in
3576         "$wrapper")
3577                 cpprun=''
3578                 cpplast=''
3579                 ;;
3580         esac
3581         ;;
3582 esac
3583
3584 case "$cppstdin" in
3585 "$wrapper"|'cppstdin') ;;
3586 *) $rm -f $wrapper;;
3587 esac
3588 $rm -f testcpp.c testcpp.out
3589
3590 : Set private lib path
3591 case "$plibpth" in
3592 '') if ./mips; then
3593                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3594         fi;;
3595 esac
3596 case "$libpth" in
3597 ' ') dlist='';;
3598 '') dlist="$loclibpth $plibpth $glibpth";;
3599 *) dlist="$libpth";;
3600 esac
3601
3602 : Now check and see which directories actually exist, avoiding duplicates
3603 libpth=''
3604 for xxx in $dlist
3605 do
3606     if $test -d $xxx; then
3607                 case " $libpth " in
3608                 *" $xxx "*) ;;
3609                 *) libpth="$libpth $xxx";;
3610                 esac
3611     fi
3612 done
3613 $cat <<'EOM'
3614
3615 Some systems have incompatible or broken versions of libraries.  Among
3616 the directories listed in the question below, please remove any you
3617 know not to be holding relevant libraries, and add any that are needed.
3618 Say "none" for none.
3619
3620 EOM
3621 case "$libpth" in
3622 '') dflt='none';;
3623 *)
3624         set X $libpth
3625         shift
3626         dflt=${1+"$@"}
3627         ;;
3628 esac
3629 rp="Directories to use for library searches?"
3630 . ./myread
3631 case "$ans" in
3632 none) libpth=' ';;
3633 *) libpth="$ans";;
3634 esac
3635
3636 : compute shared library extension
3637 case "$so" in
3638 '')
3639         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3640                 dflt='sl'
3641         else
3642                 dflt='so'
3643         fi
3644         ;;
3645 *) dflt="$so";;
3646 esac
3647 $cat <<EOM
3648
3649 On some systems, shared libraries may be available.  Answer 'none' if
3650 you want to suppress searching of shared libraries for the remainder
3651 of this configuration.
3652
3653 EOM
3654 rp='What is the file extension used for shared libraries?'
3655 . ./myread
3656 so="$ans"
3657
3658 : Define several unixisms.
3659 : Hints files or command line option can be used to override them.
3660 : The convoluted testing is in case hints files set either the old
3661 : or the new name.
3662 case "$_exe" in
3663 '')     case "$exe_ext" in
3664     '') ;;
3665         *)      _exe="$exe_ext" ;;
3666         esac
3667         ;;
3668 esac
3669 case "$_a" in
3670 '')     case "$lib_ext" in
3671     '') _a='.a';;
3672         *)      _a="$lib_ext" ;;
3673         esac
3674         ;;
3675 esac
3676 case "$_o" in
3677 '') case "$obj_ext" in
3678         '')     _o='.o';;
3679         *)      _o="$obj_ext";;
3680         esac
3681         ;;
3682 esac
3683 case "$p_" in
3684 '') case "$path_sep" in
3685         '')     p_=':';;
3686         *)      p_="$path_sep";;
3687         esac
3688         ;;
3689 esac
3690 exe_ext=$_exe
3691 lib_ext=$_a
3692 obj_ext=$_o
3693 path_sep=$p_
3694
3695 : Which makefile gets called first.  This is used by make depend.
3696 case "$firstmakefile" in
3697 '') firstmakefile='makefile';;
3698 esac
3699
3700 case "$usesocks" in
3701 $define|true|[yY]*)     dflt='y';;
3702 *) dflt='n';;
3703 esac
3704 cat <<EOM
3705
3706 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3707 Configure must be run with -Dusesocks.
3708
3709 If this doesn't make any sense to you, just accept the default '$dflt'.
3710 EOM
3711 rp='Build Perl for SOCKS?'
3712 . ./myread
3713 case "$ans" in
3714 y|Y)    val="$define" ;;     
3715 *)      val="$undef" ;;
3716 esac
3717 set usesocks
3718 eval $setvar
3719
3720 : Looking for optional libraries
3721 echo " "
3722 echo "Checking for optional libraries..." >&4
3723 case "$libs" in
3724 ' '|'') dflt='';;
3725 *) dflt="$libs";;
3726 esac
3727 case "$libswanted" in
3728 '') libswanted='c_s';;
3729 esac
3730 case "$usesocks" in
3731 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3732 esac
3733 libsfound=''
3734 libsfiles=''
3735 libsdirs=''
3736 libspath=''
3737 for thisdir in $libpth $xlibpth; do
3738   test -d $thisdir && libspath="$libspath $thisdir"
3739 done
3740 for thislib in $libswanted; do
3741         for thisdir in $libspath; do
3742             xxx=''
3743             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3744                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3745                 $test -f "$xxx" && eval $libscheck
3746                 $test -f "$xxx" && libstyle=shared
3747             fi
3748             if test ! -f "$xxx"; then
3749                 xxx=$thisdir/lib$thislib.$so
3750                 $test -f "$xxx" && eval $libscheck
3751                 $test -f "$xxx" && libstyle=shared
3752             fi  
3753             if test ! -f "$xxx"; then
3754                 xxx=$thisdir/lib$thislib$_a
3755                 $test -f "$xxx" && eval $libscheck
3756                 $test -f "$xxx" && libstyle=static
3757             fi
3758             if test ! -f "$xxx"; then
3759                 xxx=$thisdir/$thislib$_a
3760                 $test -f "$xxx" && eval $libscheck
3761                 $test -f "$xxx" && libstyle=static
3762             fi
3763             if test ! -f "$xxx"; then
3764                 xxx=$thisdir/lib${thislib}_s$_a
3765                 $test -f "$xxx" && eval $libscheck
3766                 $test -f "$xxx" && libstyle=static
3767                 $test -f "$xxx" && thislib=${thislib}_s
3768             fi
3769             if test ! -f "$xxx"; then
3770                 xxx=$thisdir/Slib$thislib$_a
3771                 $test -f "$xxx" && eval $libscheck
3772                 $test -f "$xxx" && libstyle=static
3773             fi
3774             if $test -f "$xxx"; then
3775                 case "$libstyle" in
3776                 shared) echo "Found -l$thislib (shared)." ;;
3777                 static) echo "Found -l$thislib." ;;
3778                 *)      echo "Found -l$thislib ($libstyle)." ;;
3779                 esac
3780                 case " $dflt " in
3781                 *"-l$thislib "*);;
3782                 *) dflt="$dflt -l$thislib"
3783                    libsfound="$libsfound $xxx"
3784                    yyy=`basename $xxx`
3785                    libsfiles="$libsfiles $yyy"
3786                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3787                    case " $libsdirs " in
3788                    *" $yyy "*) ;;
3789                    *) libsdirs="$libsdirs $yyy" ;;
3790                    esac
3791                    ;;
3792                 esac
3793                 break
3794             fi  
3795         done
3796         if $test ! -f "$xxx"; then
3797             echo "No -l$thislib."
3798         fi
3799 done
3800 set X $dflt
3801 shift
3802 dflt="$*"
3803 case "$libs" in
3804 '') dflt="$dflt";;
3805 *) dflt="$libs";;
3806 esac
3807 case "$dflt" in
3808 ' '|'') dflt='none';;
3809 esac
3810
3811 $cat <<EOM
3812
3813 In order to compile $package on your machine, a number of libraries
3814 are usually needed.  Include any other special libraries here as well.
3815 Say "none" for none.  The default list is almost always right.
3816 EOM
3817
3818 echo " "
3819 rp="What libraries to use?"
3820 . ./myread
3821 case "$ans" in
3822 none) libs=' ';;
3823 *) libs="$ans";;
3824 esac
3825
3826 : determine optimization, if desired, or use for debug flag also
3827 case "$optimize" in
3828 ' '|$undef) dflt='none';;
3829 '') dflt='-O';;
3830 *) dflt="$optimize";;
3831 esac
3832 $cat <<EOH
3833
3834 By default, $package compiles with the -O flag to use the optimizer.
3835 Alternately, you might want to use the symbolic debugger, which uses
3836 the -g flag (on traditional Unix systems).  Either flag can be
3837 specified here.  To use neither flag, specify the word "none".
3838
3839 EOH
3840 rp="What optimizer/debugger flag should be used?"
3841 . ./myread
3842 optimize="$ans"
3843 case "$optimize" in
3844 'none') optimize=" ";;
3845 esac
3846
3847 dflt=''
3848 : We will not override a previous value, but we might want to
3849 : augment a hint file
3850 case "$hint" in
3851 default|recommended)
3852         case "$gccversion" in
3853         1*) dflt='-fpcc-struct-return' ;;
3854         esac
3855         case "$optimize" in
3856         *-g*) dflt="$dflt -DDEBUGGING";;
3857         esac
3858         case "$gccversion" in
3859         2*) if test -d /etc/conf/kconfig.d &&
3860                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3861                 then
3862                         dflt="$dflt -posix"
3863                 fi
3864                 ;;
3865         esac
3866         case "$gccversion" in
3867         1*) ;;
3868         2.[0-8]*) ;;
3869         ?*)     echo " "
3870                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3871                 echo 'int main(void) { return 0; }' > gcctest.c
3872                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3873                         echo "Yes, it does." 2>&1
3874                         case "$ccflags" in
3875                         *strict-aliasing*) 
3876                                 echo "Leaving current flags $ccflags alone." 2>&1
3877                                 ;;
3878                         *) dflt="$dflt -fno-strict-aliasing" ;;
3879                         esac
3880                 else
3881                         echo "Nope, it doesn't, but that's ok." 2>&1
3882                 fi
3883                 ;;
3884         esac
3885         ;;
3886 esac
3887
3888 case "$mips_type" in
3889 *BSD*|'') inclwanted="$locincpth $usrinc";;
3890 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3891 esac
3892 for thisincl in $inclwanted; do
3893         if $test -d $thisincl; then
3894                 if $test x$thisincl != x$usrinc; then
3895                         case "$dflt" in
3896                         *$thisincl*);;
3897                         *) dflt="$dflt -I$thisincl";;
3898                         esac
3899                 fi
3900         fi
3901 done
3902
3903 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3904         xxx=true;
3905 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3906         xxx=true;
3907 else
3908         xxx=false;
3909 fi;
3910 if $xxx; then
3911         case "$dflt" in
3912         *$2*);;
3913         *) dflt="$dflt -D$2";;
3914         esac;
3915 fi'
3916
3917 set signal.h LANGUAGE_C; eval $inctest
3918
3919 case "$usesocks" in
3920 $define)
3921         ccflags="$ccflags -DSOCKS"
3922         ;;
3923 esac
3924
3925 case "$hint" in
3926 default|recommended) dflt="$ccflags $dflt" ;;
3927 *) dflt="$ccflags";;
3928 esac
3929
3930 case "$dflt" in
3931 ''|' ') dflt=none;;
3932 esac
3933 $cat <<EOH
3934
3935 Your C compiler may want other flags.  For this question you should include
3936 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3937 but you should NOT include libraries or ld flags like -lwhatever.  If you
3938 want $package to honor its debug switch, you should include -DDEBUGGING here.
3939 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3940
3941 To use no flags, specify the word "none".
3942
3943 EOH
3944 set X $dflt
3945 shift
3946 dflt=${1+"$@"}
3947 rp="Any additional cc flags?"
3948 . ./myread
3949 case "$ans" in
3950 none) ccflags='';;
3951 *) ccflags="$ans";;
3952 esac
3953
3954 : the following weeds options from ccflags that are of no interest to cpp
3955 cppflags="$ccflags"
3956 case "$gccversion" in
3957 1*) cppflags="$cppflags -D__GNUC__"
3958 esac
3959 case "$mips_type" in
3960 '');;
3961 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3962 esac
3963 case "$cppflags" in
3964 '');;
3965 *)
3966         echo " "
3967         echo "Let me guess what the preprocessor flags are..." >&4
3968         set X $cppflags
3969         shift
3970         cppflags=''
3971         $cat >cpp.c <<'EOM'
3972 #define BLURFL foo
3973
3974 BLURFL xx LFRULB
3975 EOM
3976         previous=''
3977         for flag in $*
3978         do
3979                 case "$flag" in
3980                 -*) ftry="$flag";;
3981                 *) ftry="$previous $flag";;
3982                 esac
3983                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3984                         >cpp1.out 2>/dev/null && \
3985                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3986                         >cpp2.out 2>/dev/null && \
3987                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3988                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3989                 then
3990                         cppflags="$cppflags $ftry"
3991                         previous=''
3992                 else
3993                         previous="$flag"
3994                 fi
3995         done
3996         set X $cppflags
3997         shift
3998         cppflags=${1+"$@"}
3999         case "$cppflags" in
4000         *-*)  echo "They appear to be: $cppflags";;
4001         esac
4002         $rm -f cpp.c cpp?.out
4003         ;;
4004 esac
4005
4006 : flags used in final linking phase
4007 case "$ldflags" in
4008 '') if ./venix; then
4009                 dflt='-i -z'
4010         else
4011                 dflt=''
4012         fi
4013         case "$ccflags" in
4014         *-posix*) dflt="$dflt -posix" ;;
4015         esac
4016         ;;
4017 *) dflt="$ldflags";;
4018 esac
4019
4020 : Try to guess additional flags to pick up local libraries.
4021 for thislibdir in $libpth; do
4022         case " $loclibpth " in
4023         *" $thislibdir "*)
4024                 case "$dflt " in 
4025                 *"-L$thislibdir "*) ;;
4026                 *)  dflt="$dflt -L$thislibdir" ;;
4027                 esac
4028                 ;;
4029         esac
4030 done
4031
4032 case "$dflt" in
4033 '') dflt='none' ;;
4034 esac
4035
4036 $cat <<EOH
4037
4038 Your C linker may need flags.  For this question you should
4039 include -L/whatever and any other flags used by the C linker, but you
4040 should NOT include libraries like -lwhatever.
4041
4042 Make sure you include the appropriate -L/path flags if your C linker
4043 does not normally search all of the directories you specified above,
4044 namely
4045         $libpth
4046 To use no flags, specify the word "none".
4047
4048 EOH
4049
4050 rp="Any additional ld flags (NOT including libraries)?"
4051 . ./myread
4052 case "$ans" in
4053 none) ldflags='';;
4054 *) ldflags="$ans";;
4055 esac
4056 rmlist="$rmlist pdp11"
4057
4058 : coherency check
4059 echo " "
4060 echo "Checking your choice of C compiler and flags for coherency..." >&4
4061 $cat > try.c <<'EOF'
4062 #include <stdio.h>
4063 int main() { printf("Ok\n"); exit(0); }
4064 EOF
4065 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4066 shift
4067 $cat >try.msg <<'EOM'
4068 I've tried to compile and run the following simple program:
4069
4070 EOM
4071 $cat try.c >> try.msg
4072
4073 $cat >> try.msg <<EOM
4074
4075 I used the command:
4076
4077         $*
4078         ./try
4079
4080 and I got the following output:
4081
4082 EOM
4083 dflt=y
4084 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4085         if sh -c './try' >>try.msg 2>&1; then
4086                 xxx=`./try`
4087                 case "$xxx" in
4088                 "Ok") dflt=n ;;
4089                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4090                         case " $libs " in
4091                         *" -lsfio "*)
4092                                 cat >> try.msg <<'EOQS'
4093 If $libs contains -lsfio, and sfio is mis-configured, then it
4094 sometimes (apparently) runs and exits with a 0 status, but with no
4095 output!  It may have to do with sfio's use of _exit vs. exit.
4096
4097 EOQS
4098                                 rp="You have a big problem.  Shall I abort Configure"
4099                                 dflt=y
4100                                 ;;
4101                         esac
4102                         ;;
4103                 esac
4104         else
4105                 echo "The program compiled OK, but exited with status $?." >>try.msg
4106                 rp="You have a problem.  Shall I abort Configure"
4107                 dflt=y
4108         fi
4109 else
4110         echo "I can't compile the test program." >>try.msg
4111         rp="You have a BIG problem.  Shall I abort Configure"
4112         dflt=y
4113 fi
4114 case "$dflt" in
4115 y)
4116         $cat try.msg >&4
4117         case "$knowitall" in
4118         '')
4119                 echo "(The supplied flags or libraries might be incorrect.)"
4120                 ;;
4121         *) dflt=n;;
4122         esac
4123         echo " "
4124         . ./myread
4125         case "$ans" in
4126         n*|N*) ;;
4127         *)      echo "Ok.  Stopping Configure." >&4
4128                 exit 1
4129                 ;;
4130         esac
4131         ;;
4132 n) echo "OK, that should do.";;
4133 esac
4134 $rm -f try try.* core
4135
4136 : define an is-a-typedef? function
4137 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138 case "$inclist" in
4139 "") inclist="sys/types.h";;
4140 esac;
4141 eval "varval=\$$var";
4142 case "$varval" in
4143 "")
4144         $rm -f temp.c;
4145         for inc in $inclist; do
4146                 echo "#include <$inc>" >>temp.c;
4147         done;
4148         echo "#ifdef $type" >> temp.c;
4149         echo "printf(\"We have $type\");" >> temp.c;
4150         echo "#endif" >> temp.c;
4151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152         if $contains $type temp.E >/dev/null 2>&1; then
4153                 eval "$var=\$type";
4154         else
4155                 eval "$var=\$def";
4156         fi;
4157         $rm -f temp.?;;
4158 *) eval "$var=\$varval";;
4159 esac'
4160
4161 : define an is-a-typedef? function that prompts if the type is not available.
4162 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4163 case "$inclist" in
4164 "") inclist="sys/types.h";;
4165 esac;
4166 eval "varval=\$$var";
4167 case "$varval" in
4168 "")
4169         $rm -f temp.c;
4170         for inc in $inclist; do
4171                 echo "#include <$inc>" >>temp.c;
4172         done;
4173         echo "#ifdef $type" >> temp.c;
4174         echo "printf(\"We have $type\");" >> temp.c;
4175         echo "#endif" >> temp.c;
4176         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4177         echo " " ;
4178         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4179         if $contains $type temp.E >/dev/null 2>&1; then
4180                 echo "$type found." >&4;
4181                 eval "$var=\$type";
4182         else
4183                 echo "$type NOT found." >&4;
4184                 dflt="$def";
4185                 . ./myread ;
4186                 eval "$var=\$ans";
4187         fi;
4188         $rm -f temp.?;;
4189 *) eval "$var=\$varval";;
4190 esac'
4191
4192 : define a shorthand compile call
4193 compile='
4194 mc_file=$1;
4195 shift;
4196 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4197 : define a shorthand compile call for compilations that should be ok.
4198 compile_ok='
4199 mc_file=$1;
4200 shift;
4201 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4202
4203 : check for lengths of integral types
4204 echo " "
4205 case "$intsize" in
4206 '')
4207         echo "Checking to see how big your integers are..." >&4
4208         $cat >intsize.c <<'EOCP'
4209 #include <stdio.h>
4210 int main()
4211 {
4212         printf("intsize=%d;\n", (int)sizeof(int));
4213         printf("longsize=%d;\n", (int)sizeof(long));
4214         printf("shortsize=%d;\n", (int)sizeof(short));
4215         exit(0);
4216 }
4217 EOCP
4218         set intsize
4219         if eval $compile_ok && ./intsize > /dev/null; then
4220                 eval `./intsize`
4221                 echo "Your integers are $intsize bytes long."
4222                 echo "Your long integers are $longsize bytes long."
4223                 echo "Your short integers are $shortsize bytes long."
4224         else
4225                 $cat >&4 <<EOM
4226 !
4227 Help! I can't compile and run the intsize test program: please enlighten me!
4228 (This is probably a misconfiguration in your system or libraries, and
4229 you really ought to fix it.  Still, I'll try anyway.)
4230 !
4231 EOM
4232                 dflt=4
4233                 rp="What is the size of an integer (in bytes)?"
4234                 . ./myread
4235                 intsize="$ans"
4236                 dflt=$intsize
4237                 rp="What is the size of a long integer (in bytes)?"
4238                 . ./myread
4239                 longsize="$ans"
4240                 dflt=2
4241                 rp="What is the size of a short integer (in bytes)?"
4242                 . ./myread
4243                 shortsize="$ans"
4244         fi
4245         ;;
4246 esac
4247 $rm -f intsize intsize.*
4248
4249 : see what type lseek is declared as in the kernel
4250 rp="What is the type used for lseek's offset on this system?"
4251 set off_t lseektype long stdio.h sys/types.h
4252 eval $typedef_ask
4253
4254 echo " "
4255 echo "Checking to see how big your file offsets are..." >&4
4256 $cat >try.c <<EOCP
4257 #include <sys/types.h>
4258 #include <stdio.h>
4259 int main()
4260 {
4261     printf("%d\n", (int)sizeof($lseektype));
4262     return(0); 
4263 }
4264 EOCP
4265 set try
4266 if eval $compile_ok; then
4267         lseeksize=`./try`
4268         echo "Your file offsets are $lseeksize bytes long."
4269 else
4270         dflt=$longsize
4271         echo " "
4272         echo "(I can't seem to compile the test program.  Guessing...)"
4273         rp="What is the size of your file offsets (in bytes)?"
4274         . ./myread
4275         lseeksize="$ans"
4276 fi
4277 $rm -f try.c try
4278
4279 : see what type file positions are declared as in the library
4280 rp="What is the type for file position used by fsetpos()?"
4281 set fpos_t fpostype long stdio.h sys/types.h
4282 eval $typedef_ask
4283
4284 echo " "
4285 case "$fpostype" in
4286 *_t) zzz="$fpostype"    ;;
4287 *)   zzz="fpos_t"       ;;
4288 esac
4289 echo "Checking the size of $zzz..." >&4 
4290 cat > try.c <<EOCP
4291 #include <sys/types.h>
4292 #include <stdio.h>
4293 int main() {
4294     printf("%d\n", (int)sizeof($fpostype));
4295     exit(0);
4296 }
4297 EOCP
4298 set try
4299 if eval $compile_ok; then
4300         yyy=`./try`
4301         case "$yyy" in
4302         '')     fpossize=4
4303                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4304                 ;;
4305         *)      fpossize=$yyy
4306                 echo "Your $zzz is $fpossize bytes long."
4307                 ;;
4308         esac
4309 else
4310         dflt="$longsize"
4311         echo " " >&4
4312         echo "(I can't compile the test program.  Guessing...)" >&4
4313         rp="What is the size of your file positions (in bytes)?"
4314         . ./myread
4315         fpossize="$ans"
4316 fi
4317
4318
4319
4320 # Backward compatibility (uselfs is deprecated).
4321 case "$uselfs" in
4322 "$define"|true|[yY]*)
4323         cat <<EOM >&4
4324
4325 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4326 EOM
4327         uselargefiles="$define"
4328         ;;
4329 esac                          
4330
4331 case "$lseeksize:$fpossize" in
4332 8:8) cat <<EOM
4333
4334 You can have files larger than 2 gigabytes.
4335 EOM
4336    val="$define" ;;
4337 *)    case "$uselargefiles" in
4338    "$undef"|false|[nN]*) dflt='n' ;;
4339    *)   dflt='y' ;;
4340    esac
4341    cat <<EOM
4342
4343 Perl can be built to understand large files (files larger than 2 gigabytes)
4344 on some systems.  To do so, Configure can be run with -Duselargefiles.
4345
4346 If this doesn't make any sense to you, just accept the default '$dflt'.
4347 EOM
4348    rp='Try to understand large files, if available?'
4349    . ./myread
4350    case "$ans" in
4351    y|Y)         val="$define" ;;
4352    *)           val="$undef"  ;;
4353    esac
4354    ;;
4355 esac
4356 set uselargefiles
4357 eval $setvar
4358 case "$uselargefiles" in
4359 "$define")
4360 : Look for a hint-file generated 'call-back-unit'.  If the
4361 : user has specified that a large files perl is to be built,
4362 : we may need to set or change some other defaults.
4363         if $test -f uselargefiles.cbu; then
4364                 echo "Your platform has some specific hints for large file builds, using them..."
4365                 . ./uselargefiles.cbu
4366                 echo " "
4367                 echo "Rechecking to see how big your file offsets are..." >&4
4368                 $cat >try.c <<EOCP
4369 #include <sys/types.h>
4370 #include <stdio.h>
4371 int main()
4372 {
4373     printf("%d\n", (int)sizeof($lseektype));
4374     return(0); 
4375 }
4376 EOCP
4377                 set try
4378                 if eval $compile_ok; then
4379                         lseeksize=`./try`
4380                         $echo "Your file offsets are now $lseeksize bytes long."
4381                 else
4382                         dflt="$lseeksize"
4383                         echo " "
4384                         echo "(I can't seem to compile the test program.  Guessing...)"
4385                         rp="What is the size of your file offsets (in bytes)?"
4386                         . ./myread
4387                         lseeksize="$ans"
4388                 fi
4389                 case "$fpostype" in
4390                 *_t) zzz="$fpostype"    ;;
4391                 *)   zzz="fpos_t"       ;;
4392                 esac
4393                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4394                 $cat > try.c <<EOCP
4395 #include <sys/types.h>
4396 #include <stdio.h>
4397 int main() {
4398     printf("%d\n", (int)sizeof($fpostype));
4399     exit(0);
4400 }
4401 EOCP
4402                 set try
4403                 if eval $compile_ok; then
4404                         yyy=`./try`
4405                         dflt="$lseeksize"
4406                         case "$yyy" in
4407                         '')     echo " "
4408                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4409                                 ;;
4410                         *)      fpossize=$yyy
4411                                 echo " $fpossize bytes." >&4
4412                                 ;;
4413                         esac
4414                 else
4415                         dflt="$fpossize"
4416                         echo " "
4417                         echo "(I can't compile the test program.  Guessing...)" >&4
4418                         rp="What is the size of your file positions (in bytes)?"
4419                         . ./myread
4420                         fpossize="$ans"
4421                 fi
4422                 $rm -f try.c try
4423         fi
4424         ;;
4425 esac
4426
4427
4428 case "$usemorebits" in
4429 "$define"|true|[yY]*)
4430         use64bitint="$define"
4431         uselongdouble="$define"
4432         usemorebits="$define"
4433         ;;
4434 *)      usemorebits="$undef"
4435         ;;
4436 esac
4437
4438
4439 case "$uselonglong" in
4440 "$define"|true|[yY]*)
4441         cat <<EOM >&4
4442
4443 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4444 EOM
4445         use64bitint="$define"
4446         ;;
4447 esac                          
4448 case "$use64bits" in
4449 "$define"|true|[yY]*)
4450         cat <<EOM >&4
4451
4452 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4453 EOM
4454         use64bitint="$define"
4455         ;;
4456 esac                          
4457 case "$use64bitints" in
4458 "$define"|true|[yY]*)
4459         cat <<EOM >&4
4460
4461 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4462 EOM
4463         use64bitint="$define"
4464         ;;
4465 esac                          
4466 case "$use64bitsint" in
4467 "$define"|true|[yY]*)
4468         cat <<EOM >&4
4469
4470 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4471 EOM
4472         use64bitint="$define"
4473         ;;
4474 esac                          
4475 case "$uselonglongs" in
4476 "$define"|true|[yY]*)
4477         cat <<EOM >&4
4478
4479 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4480 EOM
4481         use64bitint="$define"
4482         ;;
4483 esac                          
4484 case "$use64bitsall" in
4485 "$define"|true|[yY]*)
4486         cat <<EOM >&4
4487
4488 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4489 EOM
4490         use64bitall="$define"
4491         ;;
4492 esac                          
4493
4494 case "$ccflags" in
4495 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4496 esac
4497 case "$use64bitall" in
4498 "$define"|true|[yY]*) use64bitint="$define" ;;
4499 esac
4500
4501 case "$longsize" in
4502 8) cat <<EOM
4503
4504 You have natively 64-bit long integers.
4505 EOM
4506    val="$define"
4507    ;;
4508 *) case "$use64bitint" in
4509    "$define"|true|[yY]*) dflt='y';;
4510    *) dflt='n';;
4511    esac
4512    cat <<EOM
4513
4514 Perl can be built to take advantage of 64-bit integer types
4515 on some systems.  To do so, Configure can be run with -Duse64bitint.
4516 Choosing this option will most probably introduce binary incompatibilities.
4517
4518 If this doesn't make any sense to you, just accept the default '$dflt'.
4519 EOM
4520    rp='Try to use 64-bit integers, if available?'
4521    . ./myread
4522    case "$ans" in
4523    [yY]*) val="$define" ;;
4524    *)     val="$undef"  ;;
4525    esac
4526    ;;
4527 esac
4528 set use64bitint
4529 eval $setvar
4530
4531 case "$use64bitall" in
4532 "$define"|true|[yY]*) dflt='y' ;;
4533 *) case "$longsize" in
4534    8) dflt='y' ;;
4535    *) dflt='n' ;;
4536    esac
4537    ;;
4538 esac    
4539 cat <<EOM
4540
4541 You may also choose to try maximal 64-bitness.  It means using as much
4542 64-bitness as possible on the platform.  This in turn means even more
4543 binary incompatibilities.  On the other hand, your platform may not
4544 have any more 64-bitness available than what you already have chosen.
4545
4546 If this doesn't make any sense to you, just accept the default '$dflt'.
4547 EOM
4548 rp='Try to use maximal 64-bit support, if available?'
4549 . ./myread
4550 case "$ans" in
4551 [yY]*) val="$define" ;;
4552 *)     val="$undef"  ;;
4553 esac
4554 set use64bitall
4555 eval $setvar
4556 case "$use64bitall" in
4557 "$define")
4558         case "$use64bitint" in
4559         "$undef")
4560                 cat <<EOM
4561
4562 Since you have chosen a maximally 64-bit build, I'm also turning on
4563 the use of 64-bit integers.
4564 EOM
4565                 use64bitint="$define" ;;
4566         esac
4567         ;;
4568 esac
4569
4570 case "$use64bitint" in
4571 "$define"|true|[yY]*)
4572 : Look for a hint-file generated 'call-back-unit'.  If the
4573 : user has specified that a 64-bit perl is to be built,
4574 : we may need to set or change some other defaults.
4575         if $test -f use64bitint.cbu; then
4576                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4577                 . ./use64bitint.cbu
4578         fi
4579         case "$longsize" in
4580         4) case "$archname64" in
4581            '') archname64=64int ;;
4582            esac
4583            ;;
4584         esac
4585         ;;
4586 esac
4587
4588 case "$use64bitall" in
4589 "$define"|true|[yY]*)
4590 : Look for a hint-file generated 'call-back-unit'.  If the
4591 : user has specified that a maximally 64-bit perl is to be built,
4592 : we may need to set or change some other defaults.
4593         if $test -f use64bitall.cbu; then
4594                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4595                 . ./use64bitall.cbu
4596         fi
4597         case "$longsize" in
4598         4) case "$archname64" in
4599            ''|64int) archname64=64all ;;
4600            esac
4601            ;;
4602         esac
4603         ;;
4604 esac
4605
4606 : determine the architecture name
4607 echo " "
4608 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4609         tarch=`arch`"-$osname"
4610 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4611         if uname -m > tmparch 2>&1 ; then
4612                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4613                         -e 's/$/'"-$osname/" tmparch`
4614         else
4615                 tarch="$osname"
4616         fi
4617         $rm -f tmparch
4618 else
4619         tarch="$osname"
4620 fi
4621 case "$myarchname" in
4622 ''|"$tarch") ;;
4623 *)
4624         echo "(Your architecture name used to be $myarchname.)"
4625         archname=''
4626         ;;
4627 esac
4628 myarchname="$tarch"
4629 case "$archname" in
4630 '') dflt="$tarch";;
4631 *) dflt="$archname";;
4632 esac
4633 rp='What is your architecture name'
4634 . ./myread
4635 archname="$ans"
4636 case "$usethreads" in
4637 $define)
4638         echo "Threads selected." >&4
4639         case "$archname" in
4640         *-thread*) echo "...and architecture name already has -thread." >&4
4641                 ;;
4642         *)      archname="$archname-thread"
4643                 echo "...setting architecture name to $archname." >&4
4644                 ;;
4645         esac
4646         ;;
4647 esac
4648 case "$usemultiplicity" in
4649 $define)
4650         echo "Multiplicity selected." >&4
4651         case "$archname" in
4652         *-multi*) echo "...and architecture name already has -multi." >&4
4653                 ;;
4654         *)      archname="$archname-multi"
4655                 echo "...setting architecture name to $archname." >&4
4656                 ;;
4657         esac
4658         ;;
4659 esac
4660 case "$use64bitint" in
4661 $define)
4662         case "$archname64" in
4663         '')
4664                 ;;
4665         *)
4666                 case "$archname" in
4667                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4668                         ;;
4669                 *)      archname="$archname-$archname64"
4670                         echo "...setting architecture name to $archname." >&4
4671                         ;;
4672                 esac
4673                 ;;
4674         esac
4675 esac
4676
4677 : determine root of directory hierarchy where package will be installed.
4678 case "$prefix" in
4679 '')
4680         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4681         ;;
4682 *)
4683         dflt="$prefix"
4684         ;;
4685 esac
4686 $cat <<EOM
4687
4688 By default, $package will be installed in $dflt/bin, manual pages
4689 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4690 installation directories. Typically this is something like /usr/local.
4691 If you wish to have binaries under /usr/bin but other parts of the
4692 installation under /usr/local, that's ok: you will be prompted
4693 separately for each of the installation directories, the prefix being
4694 only used to set the defaults.
4695
4696 EOM
4697 fn=d~
4698 rp='Installation prefix to use?'
4699 . ./getfile
4700 oldprefix=''
4701 case "$prefix" in
4702 '') ;;
4703 *)
4704         case "$ans" in
4705         "$prefix") ;;
4706         *) oldprefix="$prefix";;
4707         esac
4708         ;;
4709 esac
4710 prefix="$ans"
4711 prefixexp="$ansexp"
4712
4713 : is AFS running?
4714 echo " "
4715 case "$afs" in
4716 $define|true)   afs=true ;;
4717 $undef|false)   afs=false ;;
4718 *)      if test -d /afs; then
4719                 afs=true
4720         else
4721                 afs=false
4722         fi
4723         ;;
4724 esac
4725 if $afs; then
4726         echo "AFS may be running... I'll be extra cautious then..." >&4
4727 else
4728         echo "AFS does not seem to be running..." >&4
4729 fi
4730
4731 : determine installation prefix for where package is to be installed.
4732 if $afs; then 
4733 $cat <<EOM
4734
4735 Since you are running AFS, I need to distinguish the directory in which
4736 files will reside from the directory in which they are installed (and from
4737 which they are presumably copied to the former directory by occult means).
4738
4739 EOM
4740         case "$installprefix" in
4741         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4742         *) dflt="$installprefix";;
4743         esac
4744 else
4745 $cat <<EOM
4746
4747 In some special cases, particularly when building $package for distribution,
4748 it is convenient to distinguish between the directory in which files should 
4749 be installed from the directory ($prefix) in which they 
4750 will eventually reside.  For most users, these two directories are the same.
4751
4752 EOM
4753         case "$installprefix" in
4754         '') dflt=$prefix ;;
4755         *) dflt=$installprefix;;
4756         esac
4757 fi
4758 fn=d~
4759 rp='What installation prefix should I use for installing files?'
4760 . ./getfile
4761 installprefix="$ans"
4762 installprefixexp="$ansexp"
4763
4764 : set the prefixit variable, to compute a suitable default value
4765 prefixit='case "$3" in
4766 ""|none)
4767         case "$oldprefix" in
4768         "") eval "$1=\"\$$2\"";;
4769         *)
4770                 case "$3" in
4771                 "") eval "$1=";;
4772                 none)
4773                         eval "tp=\"\$$2\"";
4774                         case "$tp" in
4775                         ""|" ") eval "$1=\"\$$2\"";;
4776                         *) eval "$1=";;
4777                         esac;;
4778                 esac;;
4779         esac;;
4780 *)
4781         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4782         case "$tp" in
4783         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4784         /*-$oldprefix/*|\~*-$oldprefix/*)
4785                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4786         *) eval "$1=\"\$$2\"";;
4787         esac;;
4788 esac'
4789
4790
4791 : get the patchlevel
4792 echo " "
4793 echo "Getting the current patchlevel..." >&4
4794 if $test -r $rsrc/patchlevel.h;then
4795         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4796         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4797         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4798         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4799         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4800         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4801 else
4802         revision=0
4803         patchlevel=0
4804         subversion=0
4805         api_revision=0
4806         api_version=0
4807         api_subversion=0
4808 fi
4809 $echo $n "(You have $package revision $revision" $c
4810 $echo $n " patchlevel $patchlevel" $c
4811 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4812 echo ".)"
4813 case "$osname" in
4814 dos|vms)
4815         : XXX Should be a Configure test for double-dots in filenames.
4816         version=`echo $revision $patchlevel $subversion | \
4817                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4818         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4819                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4820         ;;
4821 *)
4822         version=`echo $revision $patchlevel $subversion | \
4823                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4824         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4825                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4826         ;;
4827 esac
4828 : Special case the 5.005_xx maintenance series, which used 5.005
4829 : without any subversion label as a subdirectory in $sitelib
4830 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4831         api_versionstring='5.005'
4832 fi
4833
4834 : determine installation style
4835 : For now, try to deduce it from prefix unless it is already set.
4836 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4837 case "$installstyle" in
4838 '')     case "$prefix" in
4839                 *perl*) dflt='lib';;
4840                 *) dflt='lib/perl5' ;;
4841         esac
4842         ;;
4843 *)      dflt="$installstyle" ;;
4844 esac
4845 : Probably not worth prompting for this since we prompt for all
4846 : the directories individually, and the prompt would be too long and
4847 : confusing anyway.
4848 installstyle=$dflt
4849
4850 : determine where private library files go
4851 : Usual default is /usr/local/lib/perl5/$version.
4852 : Also allow things like /opt/perl/lib/$version, since 
4853 : /opt/perl/lib/perl5... would be redundant.
4854 : The default "style" setting is made in installstyle.U
4855 case "$installstyle" in
4856 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4857 *)       set dflt privlib lib/$version ;;
4858 esac
4859 eval $prefixit
4860 $cat <<EOM
4861
4862 There are some auxiliary files for $package that need to be put into a
4863 private library directory that is accessible by everyone.
4864
4865 EOM
4866 fn=d~+
4867 rp='Pathname where the private library files will reside?'
4868 . ./getfile
4869 privlib="$ans"
4870 privlibexp="$ansexp"
4871 : Change installation prefix, if necessary.
4872 if $test X"$prefix" != X"$installprefix"; then
4873         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4874 else
4875         installprivlib="$privlibexp"
4876 fi
4877
4878 : set the prefixup variable, to restore leading tilda escape
4879 prefixup='case "$prefixexp" in
4880 "$prefix") ;;
4881 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4882 esac'
4883
4884 : determine where public architecture dependent libraries go
4885 set archlib archlib
4886 eval $prefixit
4887 : privlib default is /usr/local/lib/$package/$version
4888 : archlib default is /usr/local/lib/$package/$version/$archname
4889 : privlib may have an optional trailing /share.
4890 tdflt=`echo $privlib | $sed 's,/share$,,'`
4891 tdflt=$tdflt/$archname
4892 case "$archlib" in
4893 '')     dflt=$tdflt
4894         ;;
4895 *)      dflt="$archlib"
4896     ;;
4897 esac
4898 $cat <<EOM
4899
4900 $spackage contains architecture-dependent library files.  If you are
4901 sharing libraries in a heterogeneous environment, you might store
4902 these files in a separate location.  Otherwise, you can just include
4903 them with the rest of the public library files.
4904
4905 EOM
4906 fn=d+~
4907 rp='Where do you want to put the public architecture-dependent libraries?'
4908 . ./getfile
4909 archlib="$ans"
4910 archlibexp="$ansexp"
4911 if $test X"$archlib" = X"$privlib"; then
4912         d_archlib="$undef"
4913 else
4914         d_archlib="$define"
4915 fi
4916 : Change installation prefix, if necessary.
4917 if $test X"$prefix" != X"$installprefix"; then
4918         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4919 else
4920         installarchlib="$archlibexp"
4921 fi
4922
4923
4924 : Binary compatibility with 5.005 is not possible for builds
4925 : with advanced features
4926 case "$usethreads$usemultiplicity" in
4927 *define*)
4928         bincompat5005="$undef"
4929         d_bincompat5005="$undef"
4930         ;;
4931 *)      $cat <<EOM
4932
4933 This version of Perl can be compiled for binary compatibility with 5.005.
4934 If you decide to do so, you will be able to continue using most of the
4935 extensions that were compiled for Perl 5.005.
4936
4937 EOM
4938         case "$bincompat5005$d_bincompat5005" in
4939         *"$undef"*) dflt=n ;;
4940         *) dflt=y ;;
4941         esac
4942         rp='Binary compatibility with Perl 5.005?'
4943         . ./myread
4944         case "$ans" in
4945         y*) val="$define" ;;
4946         *)  val="$undef" ;;
4947         esac
4948         set d_bincompat5005
4949         eval $setvar
4950         case "$d_bincompat5005" in
4951         "$define")
4952                 bincompat5005="$define"
4953                 ;;
4954         *)      bincompat5005="$undef"
4955                 d_bincompat5005="$undef"
4956                 ;;
4957         esac
4958         ;;
4959 esac
4960
4961
4962 : see if setuid scripts can be secure
4963 $cat <<EOM
4964
4965 Some kernels have a bug that prevents setuid #! scripts from being
4966 secure.  Some sites have disabled setuid #! scripts because of this.
4967
4968 First let's decide if your kernel supports secure setuid #! scripts.
4969 (If setuid #! scripts would be secure but have been disabled anyway,
4970 don't say that they are secure if asked.)
4971
4972 EOM
4973
4974 val="$undef"
4975 if $test -d /dev/fd; then
4976         echo "#!$ls" >reflect
4977         chmod +x,u+s reflect
4978         ./reflect >flect 2>&1
4979         if $contains "/dev/fd" flect >/dev/null; then
4980                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4981                 val="$define"
4982         else
4983                 $cat <<EOM
4984 If you are not sure if they are secure, I can check but I'll need a
4985 username and password different from the one you are using right now.
4986 If you don't have such a username or don't want me to test, simply
4987 enter 'none'.
4988
4989 EOM
4990                 rp='Other username to test security of setuid scripts with?'
4991                 dflt='none'
4992                 . ./myread
4993                 case "$ans" in
4994                 n|none)
4995                         case "$d_suidsafe" in
4996                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4997                                 dflt=n;;
4998                         "$undef")
4999                                 echo "Well, the $hint value is *not* secure." >&4
5000                                 dflt=n;;
5001                         *)      echo "Well, the $hint value *is* secure." >&4
5002                                 dflt=y;;
5003                         esac
5004                         ;;
5005                 *)
5006                         $rm -f reflect flect
5007                         echo "#!$ls" >reflect
5008                         chmod +x,u+s reflect
5009                         echo >flect
5010                         chmod a+w flect
5011                         echo '"su" will (probably) prompt you for '"$ans's password."
5012                         su $ans -c './reflect >flect'
5013                         if $contains "/dev/fd" flect >/dev/null; then
5014                                 echo "Okay, it looks like setuid scripts are secure." >&4
5015                                 dflt=y
5016                         else
5017                                 echo "I don't think setuid scripts are secure." >&4
5018                                 dflt=n
5019                         fi
5020                         ;;
5021                 esac
5022                 rp='Does your kernel have *secure* setuid scripts?'
5023                 . ./myread
5024                 case "$ans" in
5025                 [yY]*)  val="$define";;
5026                 *)      val="$undef";;
5027                 esac
5028         fi
5029 else
5030         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5031         echo "(That's for file descriptors, not floppy disks.)"
5032         val="$undef"
5033 fi
5034 set d_suidsafe
5035 eval $setvar
5036
5037 $rm -f reflect flect
5038
5039 : now see if they want to do setuid emulation
5040 echo " "
5041 val="$undef"
5042 case "$d_suidsafe" in
5043 "$define")
5044         val="$undef"
5045         echo "No need to emulate SUID scripts since they are secure here." >& 4
5046         ;;
5047 *)
5048         $cat <<EOM
5049 Some systems have disabled setuid scripts, especially systems where
5050 setuid scripts cannot be secure.  On systems where setuid scripts have
5051 been disabled, the setuid/setgid bits on scripts are currently
5052 useless.  It is possible for $package to detect those bits and emulate
5053 setuid/setgid in a secure fashion.  This emulation will only work if
5054 setuid scripts have been disabled in your kernel.
5055
5056 EOM
5057         case "$d_dosuid" in
5058         "$define") dflt=y ;;
5059         *) dflt=n ;;
5060         esac
5061         rp="Do you want to do setuid/setgid emulation?"
5062         . ./myread
5063         case "$ans" in
5064         [yY]*)  val="$define";;
5065         *)      val="$undef";;
5066         esac
5067         ;;
5068 esac
5069 set d_dosuid
5070 eval $setvar
5071
5072 : determine filename position in cpp output
5073 echo " "
5074 echo "Computing filename position in cpp output for #include directives..." >&4
5075 echo '#include <stdio.h>' > foo.c
5076 $cat >fieldn <<EOF
5077 $startsh
5078 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5079 $grep '^[       ]*#.*stdio\.h' | \
5080 while read cline; do
5081         pos=1
5082         set \$cline
5083         while $test \$# -gt 0; do
5084                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5085                         echo "\$pos"
5086                         exit 0
5087                 fi
5088                 shift
5089                 pos=\`expr \$pos + 1\`
5090         done
5091 done
5092 EOF
5093 chmod +x fieldn
5094 fieldn=`./fieldn`
5095 $rm -f foo.c fieldn
5096 case $fieldn in
5097 '') pos='???';;
5098 1) pos=first;;
5099 2) pos=second;;
5100 3) pos=third;;
5101 *) pos="${fieldn}th";;
5102 esac
5103 echo "Your cpp writes the filename in the $pos field of the line."
5104
5105 : locate header file
5106 $cat >findhdr <<EOF
5107 $startsh
5108 wanted=\$1
5109 name=''
5110 for usrincdir in $usrinc
5111 do
5112         if test -f \$usrincdir/\$wanted; then
5113                 echo "\$usrincdir/\$wanted"
5114                 exit 0
5115         fi
5116 done
5117 awkprg='{ print \$$fieldn }'
5118 echo "#include <\$wanted>" > foo\$\$.c
5119 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5120 $grep "^[       ]*#.*\$wanted" | \
5121 while read cline; do
5122         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5123         case "\$name" in
5124         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5125         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5126         *) exit 2;;
5127         esac;
5128 done;
5129 #
5130 # status = 0: grep returned 0 lines, case statement not executed
5131 # status = 1: headerfile found
5132 # status = 2: while loop executed, no headerfile found
5133 #
5134 status=\$?
5135 $rm -f foo\$\$.c;
5136 if test \$status -eq 1; then
5137         exit 0;
5138 fi
5139 exit 1
5140 EOF
5141 chmod +x findhdr
5142
5143 : define an alternate in-header-list? function
5144 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5145 cont=true; xxf="echo \"<\$1> found.\" >&4";
5146 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5147 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5148 esac;
5149 case $# in 4) instead=instead;; *) instead="at last";; esac;
5150 while $test "$cont"; do
5151         xxx=`./findhdr $1`
5152         var=$2; eval "was=\$$2";
5153         if $test "$xxx" && $test -r "$xxx";
5154         then eval $xxf;
5155         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5156                 cont="";
5157         else eval $xxnf;
5158         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5159         set $yyy; shift; shift; yyy=$@;
5160         case $# in 0) cont="";;
5161         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5162                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5163         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5164                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5165         esac;
5166 done;
5167 while $test "$yyy";
5168 do set $yyy; var=$2; eval "was=\$$2";
5169         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5170         set $yyy; shift; shift; yyy=$@;
5171 done'
5172
5173 : see if this is a malloc.h system
5174 set malloc.h i_malloc
5175 eval $inhdr
5176
5177 : see if stdlib is available
5178 set stdlib.h i_stdlib
5179 eval $inhdr
5180
5181 : determine which malloc to compile in
5182 echo " "
5183 case "$usemymalloc" in
5184 ''|[yY]*|true|$define)  dflt='y' ;;
5185 *)      dflt='n' ;;
5186 esac
5187 rp="Do you wish to attempt to use the malloc that comes with $package?"
5188 . ./myread
5189 usemymalloc="$ans"
5190 case "$ans" in
5191 y*|true)
5192         usemymalloc='y'
5193         mallocsrc='malloc.c'
5194         mallocobj="malloc$_o"
5195         d_mymalloc="$define"
5196         case "$libs" in
5197         *-lmalloc*)
5198                 : Remove malloc from list of libraries to use
5199                 echo "Removing unneeded -lmalloc from library list" >&4
5200                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5201                 shift
5202                 libs="$*"
5203                 echo "libs = $libs" >&4
5204                 ;;
5205         esac
5206         ;;
5207 *)
5208         usemymalloc='n'
5209         mallocsrc=''
5210         mallocobj=''
5211         d_mymalloc="$undef"
5212         ;;
5213 esac
5214
5215 : compute the return types of malloc and free
5216 echo " "
5217 $cat >malloc.c <<END
5218 #$i_malloc I_MALLOC
5219 #$i_stdlib I_STDLIB
5220 #include <stdio.h>
5221 #include <sys/types.h>
5222 #ifdef I_MALLOC
5223 #include <malloc.h>
5224 #endif
5225 #ifdef I_STDLIB
5226 #include <stdlib.h>
5227 #endif
5228 #ifdef TRY_MALLOC
5229 void *malloc();
5230 #endif
5231 #ifdef TRY_FREE
5232 void free();
5233 #endif
5234 END
5235 case "$malloctype" in
5236 '')
5237         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5238                 malloctype='void *'
5239         else
5240                 malloctype='char *'
5241         fi
5242         ;;
5243 esac
5244 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5245
5246 case "$freetype" in
5247 '')
5248         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5249                 freetype='void'
5250         else
5251                 freetype='int'
5252         fi
5253         ;;
5254 esac
5255 echo "Your system uses $freetype free(), it would seem." >&4
5256 $rm -f malloc.[co]
5257 $cat <<EOM
5258
5259 After $package is installed, you may wish to install various
5260 add-on modules and utilities.  Typically, these add-ons will
5261 be installed under $prefix with the rest
5262 of this package.  However, you may wish to install such add-ons
5263 elsewhere under a different prefix.
5264
5265 If you do not wish to put everything under a single prefix, that's
5266 ok.  You will be prompted for the individual locations; this siteprefix
5267 is only used to suggest the defaults.
5268
5269 The default should be fine for most people.
5270
5271 EOM
5272 fn=d~+
5273 rp='Installation prefix to use for add-on modules and utilities?'
5274 : XXX Here might be another good place for an installstyle setting.
5275 case "$siteprefix" in
5276 '') dflt=$prefix ;;
5277 *)  dflt=$siteprefix ;;
5278 esac
5279 . ./getfile
5280 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5281 oldsiteprefix=''
5282 case "$siteprefix" in
5283 '') ;;
5284 *)      case "$ans" in
5285         "$prefix") ;;
5286         *) oldsiteprefix="$prefix";;
5287         esac
5288         ;;
5289 esac
5290 siteprefix="$ans"
5291 siteprefixexp="$ansexp"
5292
5293 : determine where site specific libraries go.
5294 : Usual default is /usr/local/lib/perl5/site_perl/$version
5295 : The default "style" setting is made in installstyle.U
5296 : XXX No longer works with Prefixit stuff.
5297 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5298 case "$sitelib" in
5299 '') case "$installstyle" in
5300         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5301         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5302         esac
5303         ;;
5304 *)      dflt="$sitelib"
5305         ;;
5306 esac
5307 $cat <<EOM
5308
5309 The installation process will create a directory for
5310 site-specific extensions and modules.  Most users find it convenient
5311 to place all site-specific files in this directory rather than in the
5312 main distribution directory.
5313
5314 EOM
5315 fn=d~+
5316 rp='Pathname for the site-specific library files?'
5317 . ./getfile
5318 sitelib="$ans"
5319 sitelibexp="$ansexp"
5320 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5321 : Change installation prefix, if necessary.
5322 if $test X"$prefix" != X"$installprefix"; then
5323         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5324 else
5325         installsitelib="$sitelibexp"
5326 fi
5327
5328 : determine where site specific architecture-dependent libraries go.
5329 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5330 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5331 : sitelib may have an optional trailing /share.
5332 case "$sitearch" in
5333 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5334         dflt="$dflt/$archname"
5335         ;;
5336 *)      dflt="$sitearch"
5337         ;;
5338 esac
5339 set sitearch sitearch none
5340 eval $prefixit
5341 $cat <<EOM
5342
5343 The installation process will also create a directory for
5344 architecture-dependent site-specific extensions and modules.
5345
5346 EOM
5347 fn=d~+
5348 rp='Pathname for the site-specific architecture-dependent library files?'
5349 . ./getfile
5350 sitearch="$ans"
5351 sitearchexp="$ansexp"
5352 : Change installation prefix, if necessary.
5353 if $test X"$prefix" != X"$installprefix"; then
5354         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5355 else
5356         installsitearch="$sitearchexp"
5357 fi
5358
5359 $cat <<EOM
5360
5361 The installation process will also create a directory for
5362 vendor-supplied add-ons.  Vendors who supply perl with their system
5363 may find it convenient to place all vendor-supplied files in this
5364 directory rather than in the main distribution directory.  This will
5365 ease upgrades between binary-compatible maintenance versions of perl.
5366
5367 Of course you may also use these directories in whatever way you see
5368 fit.  For example, you might use them to access modules shared over a
5369 company-wide network.
5370
5371 The default answer should be fine for most people.
5372 This causes further questions about vendor add-ons to be skipped
5373 and no vendor-specific directories will be configured for perl.
5374
5375 EOM
5376 rp='Do you want to configure vendor-specific add-on directories?'
5377 case "$usevendorprefix" in
5378 define|true|[yY]*) dflt=y ;;
5379 *)      : User may have set vendorprefix directly on Configure command line.
5380         case "$vendorprefix" in
5381         ''|' ') dflt=n ;;
5382         *)      dflt=y ;;
5383         esac
5384         ;;
5385 esac
5386 . ./myread
5387 case "$ans" in
5388 [yY]*)  fn=d~+
5389         rp='Installation prefix to use for vendor-supplied add-ons?'
5390         case "$vendorprefix" in
5391         '') dflt='' ;;
5392         *)  dflt=$vendorprefix ;;
5393         esac
5394         . ./getfile
5395         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5396         oldvendorprefix=''
5397         case "$vendorprefix" in
5398         '') ;;
5399         *)      case "$ans" in
5400                 "$prefix") ;;
5401                 *) oldvendorprefix="$prefix";;
5402                 esac
5403                 ;;
5404         esac
5405         usevendorprefix="$define"
5406         vendorprefix="$ans"
5407         vendorprefixexp="$ansexp"
5408         ;;
5409 *)      usevendorprefix="$undef"
5410         vendorprefix=''
5411         vendorprefixexp=''
5412         ;;
5413 esac
5414
5415 case "$vendorprefix" in
5416 '')     d_vendorlib="$undef"
5417         vendorlib=''
5418         vendorlibexp=''
5419         ;;
5420 *)      d_vendorlib="$define"
5421         : determine where vendor-supplied modules go.
5422         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5423         case "$vendorlib" in
5424         '')
5425                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5426                 case "$installstyle" in
5427                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5428                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5429                 esac
5430                 ;;
5431         *)      dflt="$vendorlib"
5432                 ;;
5433         esac
5434         fn=d~+
5435         rp='Pathname for the vendor-supplied library files?'
5436         . ./getfile
5437         vendorlib="$ans"
5438         vendorlibexp="$ansexp"
5439         ;;
5440 esac
5441 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5442 : Change installation prefix, if necessary.
5443 if $test X"$prefix" != X"$installprefix"; then
5444         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5445 else
5446         installvendorlib="$vendorlibexp"
5447 fi
5448
5449 case "$vendorprefix" in
5450 '')     d_vendorarch="$undef"
5451         vendorarch=''
5452         vendorarchexp=''
5453         ;;
5454 *)      d_vendorarch="$define"
5455         : determine where vendor-supplied architecture-dependent libraries go.
5456         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5457         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5458         : vendorlib may have an optional trailing /share.
5459         case "$vendorarch" in
5460         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5461                 dflt="$dflt/$archname"
5462                 ;;
5463         *)      dflt="$vendorarch" ;;
5464         esac
5465         fn=d~+
5466         rp='Pathname for vendor-supplied architecture-dependent files?'
5467         . ./getfile
5468         vendorarch="$ans"
5469         vendorarchexp="$ansexp"
5470         ;;
5471 esac
5472 : Change installation prefix, if necessary.
5473 if $test X"$prefix" != X"$installprefix"; then
5474         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5475 else
5476         installvendorarch="$vendorarchexp"
5477 fi
5478
5479 : Final catch-all directories to search
5480 $cat <<EOM
5481
5482 Lastly, you can have perl look in other directories for extensions and
5483 modules in addition to those already specified.
5484 These directories will be searched after 
5485         $sitearch 
5486         $sitelib 
5487 EOM
5488 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5489 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5490 echo ' '
5491 case "$otherlibdirs" in
5492 ''|' ') dflt='none' ;;
5493 *)      dflt="$otherlibdirs" ;;
5494 esac
5495 $cat <<EOM
5496 Enter a colon-separated set of extra paths to include in perl's @INC
5497 search path, or enter 'none' for no extra paths.
5498
5499 EOM
5500
5501 rp='Colon-separated list of additional directories for perl to search?'
5502 . ./myread
5503 case "$ans" in
5504 ' '|''|none)    otherlibdirs=' ' ;;     
5505 *)      otherlibdirs="$ans" ;;
5506 esac
5507 case "$otherlibdirs" in
5508 ' ') val=$undef ;;
5509 *)      val=$define ;;
5510 esac
5511 set d_perl_otherlibdirs
5512 eval $setvar
5513
5514 : Cruising for prototypes
5515 echo " "
5516 echo "Checking out function prototypes..." >&4
5517 $cat >prototype.c <<'EOCP'
5518 int main(int argc, char *argv[]) {
5519         exit(0);}
5520 EOCP
5521 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5522         echo "Your C compiler appears to support function prototypes."
5523         val="$define"
5524 else
5525         echo "Your C compiler doesn't seem to understand function prototypes."
5526         val="$undef"
5527 fi
5528 set prototype
5529 eval $setvar
5530 $rm -f prototype*
5531
5532 case "$prototype" in
5533 "$define") ;;
5534 *)      ansi2knr='ansi2knr'
5535         echo " "
5536         cat <<EOM >&4
5537
5538 $me:  FATAL ERROR:
5539 This version of $package can only be compiled by a compiler that 
5540 understands function prototypes.  Unfortunately, your C compiler 
5541         $cc $ccflags
5542 doesn't seem to understand them.  Sorry about that.
5543
5544 If GNU cc is available for your system, perhaps you could try that instead.  
5545
5546 Eventually, we hope to support building Perl with pre-ANSI compilers.
5547 If you would like to help in that effort, please contact <perlbug@perl.org>.
5548
5549 Aborting Configure now.
5550 EOM
5551         exit 2
5552         ;;
5553 esac
5554
5555 : determine where public executables go
5556 echo " "
5557 set dflt bin bin
5558 eval $prefixit
5559 fn=d~
5560 rp='Pathname where the public executables will reside?'
5561 . ./getfile
5562 if $test "X$ansexp" != "X$binexp"; then
5563         installbin=''
5564 fi
5565 bin="$ans"
5566 binexp="$ansexp"
5567 : Change installation prefix, if necessary.
5568 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5569 if $test X"$prefix" != X"$installprefix"; then
5570         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5571 else
5572         installbin="$binexp"
5573 fi
5574
5575 : Find perl5.005 or later.
5576 echo "Looking for a previously installed perl5.005 or later... "
5577 case "$perl5" in
5578 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5579                 : Check if this perl is recent and can load a simple module
5580                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5581                         perl5=$tdir/perl
5582                         break;
5583                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5584                         perl5=$tdir/perl
5585                         break;
5586                 fi
5587         done
5588         ;;
5589 *)      perl5="$perl5"
5590         ;;
5591 esac
5592 case "$perl5" in
5593 '')     echo "None found.  That's ok.";;
5594 *)      echo "Using $perl5." ;;
5595 esac
5596
5597 : Determine list of previous versions to include in @INC
5598 $cat > getverlist <<EOPL
5599 #!$perl5 -w
5600 use File::Basename;
5601 \$api_versionstring = "$api_versionstring";
5602 \$version = "$version";
5603 \$stem = "$sitelib_stem";
5604 \$archname = "$archname";
5605 EOPL
5606         $cat >> getverlist <<'EOPL'
5607 # Can't have leading @ because metaconfig interprets it as a command!
5608 ;@inc_version_list=();
5609 # XXX Redo to do opendir/readdir? 
5610 if (-d $stem) {
5611     chdir($stem);
5612     ;@candidates = glob("5.*");
5613 }
5614 else {
5615     ;@candidates = ();
5616 }
5617
5618 # XXX ToDo:  These comparisons must be reworked when two-digit
5619 # subversions come along, so that 5.7.10 compares as greater than
5620 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5621 # widespread that we can use the built-in version vectors rather
5622 # than reinventing them here.  For 5.6.0, however, we must
5623 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5624 foreach $d (@candidates) {
5625     if ($d lt $version) {
5626         if ($d ge $api_versionstring) {
5627             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5628         }
5629         elsif ($d ge "5.005") {
5630             unshift(@inc_version_list, grep { -d } $d);
5631         }
5632     }
5633     else {
5634         # Skip newer version.  I.e. don't look in
5635         # 5.7.0 if we're installing 5.6.1.
5636     }
5637 }
5638
5639 if (@inc_version_list) {
5640     print join(' ', @inc_version_list);
5641 }
5642 else {
5643     # Blank space to preserve value for next Configure run.
5644     print " ";
5645 }
5646 EOPL
5647 chmod +x getverlist
5648 case "$inc_version_list" in
5649 '')     if test -x "$perl5"; then
5650                 dflt=`$perl5 getverlist`
5651         else
5652                 dflt='none'
5653         fi
5654         ;;
5655 $undef) dflt='none' ;;
5656 *)  dflt="$inc_version_list" ;;
5657 esac
5658 case "$dflt" in
5659 ''|' ') dflt=none ;;
5660 esac
5661 $cat <<'EOM'
5662
5663 In order to ease the process of upgrading, this version of perl 
5664 can be configured to use modules built and installed with earlier 
5665 versions of perl that were installed under $prefix.  Specify here
5666 the list of earlier versions that this version of perl should check.
5667 If Configure detected no earlier versions of perl installed under
5668 $prefix, then the list will be empty.  Answer 'none' to tell perl
5669 to not search earlier versions.
5670
5671 The default should almost always be sensible, so if you're not sure,
5672 just accept the default.
5673 EOM
5674
5675 rp='List of earlier versions to include in @INC?'
5676 . ./myread
5677 case "$ans" in
5678 [Nn]one|''|' ') inc_version_list=' ' ;;
5679 *) inc_version_list="$ans" ;;
5680 esac
5681 case "$inc_version_list" in
5682 ''|' ') 
5683         inc_version_list_init='0';;
5684 *)      inc_version_list_init=`echo $inc_version_list |
5685                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5686         ;;
5687 esac
5688 $rm -f getverlist
5689
5690 : determine whether to install perl also as /usr/bin/perl
5691
5692 echo " "
5693 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5694         $cat <<EOM
5695 Many scripts expect perl to be installed as /usr/bin/perl.
5696 I can install the perl you are about to compile also as /usr/bin/perl
5697 (in addition to $installbin/perl).
5698 EOM
5699         case "$installusrbinperl" in
5700         "$undef"|[nN]*) dflt='n';;
5701         *)              dflt='y';;
5702         esac
5703         rp="Do you want to install perl as /usr/bin/perl?"
5704         . ./myread
5705         case "$ans" in
5706         [yY]*)  val="$define";;
5707         *)      val="$undef" ;;
5708         esac
5709 else
5710         val="$undef"
5711 fi
5712 set installusrbinperl
5713 eval $setvar
5714
5715 echo " "
5716 echo "Checking for GNU C Library..." >&4
5717 cat >gnulibc.c <<EOM
5718 #include <stdio.h>
5719 int main()
5720 {
5721 #ifdef __GLIBC__
5722     exit(0);
5723 #else
5724     exit(1);
5725 #endif
5726 }
5727 EOM
5728 set gnulibc
5729 if eval $compile_ok && ./gnulibc; then
5730         val="$define"
5731         echo "You are using the GNU C Library"
5732 else
5733         val="$undef"
5734         echo "You are not using the GNU C Library"
5735 fi
5736 $rm -f gnulibc*
5737 set d_gnulibc
5738 eval $setvar
5739
5740 : see if nm is to be used to determine whether a symbol is defined or not
5741 case "$usenm" in
5742 '')
5743         dflt=''
5744         case "$d_gnulibc" in
5745         "$define")
5746                 echo " "
5747                 echo "nm probably won't work on the GNU C Library." >&4
5748                 dflt=n
5749                 ;;
5750         esac
5751         case "$dflt" in
5752         '') 
5753                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5754                         echo " "
5755                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5756                         echo "'nm' won't be sufficient on this sytem." >&4
5757                         dflt=n
5758                 fi
5759                 ;;
5760         esac
5761         case "$dflt" in
5762         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5763                 if $test $dflt -gt 20; then
5764                         dflt=y
5765                 else
5766                         dflt=n
5767                 fi
5768                 ;;
5769         esac
5770         ;;
5771 *)
5772         case "$usenm" in
5773         true|$define) dflt=y;;
5774         *) dflt=n;;
5775         esac
5776         ;;
5777 esac
5778 $cat <<EOM
5779
5780 I can use $nm to extract the symbols from your C libraries. This
5781 is a time consuming task which may generate huge output on the disk (up
5782 to 3 megabytes) but that should make the symbols extraction faster. The
5783 alternative is to skip the 'nm' extraction part and to compile a small
5784 test program instead to determine whether each symbol is present. If
5785 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5786 this may be the best solution.
5787
5788 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5789
5790 EOM
5791 rp="Shall I use $nm to extract C symbols from the libraries?"
5792 . ./myread
5793 case "$ans" in
5794 [Nn]*) usenm=false;;
5795 *) usenm=true;;
5796 esac
5797
5798 runnm=$usenm
5799 case "$reuseval" in
5800 true) runnm=false;;
5801 esac
5802
5803 : nm options which may be necessary
5804 case "$nm_opt" in
5805 '') if $test -f /mach_boot; then
5806                 nm_opt=''       # Mach
5807         elif $test -d /usr/ccs/lib; then
5808                 nm_opt='-p'     # Solaris (and SunOS?)
5809         elif $test -f /dgux; then
5810                 nm_opt='-p'     # DG-UX
5811         elif $test -f /lib64/rld; then
5812                 nm_opt='-p'     # 64-bit Irix
5813         else
5814                 nm_opt=''
5815         fi;;
5816 esac
5817
5818 : nm options which may be necessary for shared libraries but illegal
5819 : for archive libraries.  Thank you, Linux.
5820 case "$nm_so_opt" in
5821 '')     case "$myuname" in
5822         *linux*)
5823                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5824                         nm_so_opt='--dynamic'
5825                 fi
5826                 ;;
5827         esac
5828         ;;
5829 esac
5830
5831 case "$runnm" in
5832 true)
5833 : get list of predefined functions in a handy place
5834 echo " "
5835 case "$libc" in
5836 '') libc=unknown
5837         case "$libs" in
5838         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5839         esac
5840         ;;
5841 esac
5842 libnames='';
5843 case "$libs" in
5844 '') ;;
5845 *)  for thislib in $libs; do
5846         case "$thislib" in
5847         -lc|-lc_s)
5848                 : Handle C library specially below.
5849                 ;;
5850         -l*)
5851                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5852                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5853                         :
5854                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5855                         :
5856                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5857                         :
5858                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5859                         :
5860                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5861                         :
5862                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5863                         :
5864                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5865                         :
5866                 else
5867                         try=''
5868                 fi
5869                 libnames="$libnames $try"
5870                 ;;
5871         *) libnames="$libnames $thislib" ;;
5872         esac
5873         done
5874         ;;
5875 esac
5876 xxx=normal
5877 case "$libc" in
5878 unknown)
5879         set /lib/libc.$so
5880         for xxx in $libpth; do
5881                 $test -r $1 || set $xxx/libc.$so
5882                 : The messy sed command sorts on library version numbers.
5883                 $test -r $1 || \
5884                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5885                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5886                                 h
5887                                 s/[0-9][0-9]*/0000&/g
5888                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5889                                 G
5890                                 s/\n/ /' | \
5891                          sort | $sed -e 's/^.* //'`
5892                 eval set \$$#
5893         done
5894         $test -r $1 || set /usr/ccs/lib/libc.$so
5895         $test -r $1 || set /lib/libsys_s$_a
5896         ;;
5897 *)
5898         set blurfl
5899         ;;
5900 esac
5901 if $test -r "$1"; then
5902         echo "Your (shared) C library seems to be in $1."
5903         libc="$1"
5904 elif $test -r /lib/libc && $test -r /lib/clib; then
5905         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5906         xxx=apollo
5907         libc='/lib/clib /lib/libc'
5908         if $test -r /lib/syslib; then
5909                 echo "(Your math library is in /lib/syslib.)"
5910                 libc="$libc /lib/syslib"
5911         fi
5912 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5913         echo "Your C library seems to be in $libc, as you said before."
5914 elif $test -r $incpath/usr/lib/libc$_a; then
5915         libc=$incpath/usr/lib/libc$_a;
5916         echo "Your C library seems to be in $libc.  That's fine."
5917 elif $test -r /lib/libc$_a; then
5918         libc=/lib/libc$_a;
5919         echo "Your C library seems to be in $libc.  You're normal."
5920 else
5921         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5922                 :
5923         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5924                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5925         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5926                 :
5927         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5928                 :
5929         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5930                 :
5931         else
5932                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5933         fi
5934         if $test -r "$tans"; then
5935                 echo "Your C library seems to be in $tans, of all places."
5936                 libc=$tans
5937         else
5938                 libc='blurfl'
5939         fi
5940 fi
5941 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5942         dflt="$libc"
5943         cat <<EOM
5944
5945 If the guess above is wrong (which it might be if you're using a strange
5946 compiler, or your machine supports multiple models), you can override it here.
5947
5948 EOM
5949 else
5950         dflt=''
5951         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5952         cat >&4 <<EOM
5953 I can't seem to find your C library.  I've looked in the following places:
5954
5955 EOM
5956         $sed 's/^/      /' libpath
5957         cat <<EOM
5958
5959 None of these seems to contain your C library. I need to get its name...
5960
5961 EOM
5962 fi
5963 fn=f
5964 rp='Where is your C library?'
5965 . ./getfile
5966 libc="$ans"
5967
5968 echo " "
5969 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5970 set X `cat libnames`
5971 shift
5972 xxx=files
5973 case $# in 1) xxx=file; esac
5974 echo "Extracting names from the following $xxx for later perusal:" >&4
5975 echo " "
5976 $sed 's/^/      /' libnames >&4
5977 echo " "
5978 $echo $n "This may take a while...$c" >&4
5979
5980 for file in $*; do
5981         case $file in
5982         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5983         *) $nm $nm_opt $file 2>/dev/null;;
5984         esac
5985 done >libc.tmp
5986
5987 $echo $n ".$c"
5988 $grep fprintf libc.tmp > libc.ptf
5989 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5990 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5991 xxx='[ADTSIW]'
5992 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5993         eval $xscan;\
5994         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5995                 eval $xrun
5996 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5997         eval $xscan;\
5998         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5999                 eval $xrun
6000 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6001         eval $xscan;\
6002         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6003                 eval $xrun
6004 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6005         eval $xscan;\
6006         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6007                 eval $xrun
6008 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6009         eval $xscan;\
6010         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6011                 eval $xrun
6012 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6013         eval $xscan;\
6014         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6015                 eval $xrun
6016 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6017                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6018         eval $xscan;\
6019         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6020                 eval $xrun
6021 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6022         eval $xscan;\
6023         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6024                 eval $xrun
6025 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6026         eval $xscan;\
6027         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6028                 eval $xrun
6029 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6030         eval $xscan;\
6031         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6032                 eval $xrun
6033 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6034         eval $xscan;\
6035         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6036                 eval $xrun
6037 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6038         eval $xscan;\
6039         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6040                 eval $xrun
6041 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6042         eval $xscan;\
6043         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6044                 eval $xrun
6045 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6046         eval $xscan;\
6047         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6048                 eval $xrun
6049 else
6050         $nm -p $* 2>/dev/null >libc.tmp
6051         $grep fprintf libc.tmp > libc.ptf
6052         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6053                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6054         then
6055                 nm_opt='-p'
6056                 eval $xrun
6057         else
6058                 echo " "
6059                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6060                 com=''
6061                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6062                         for thisname in $libnames $libc; do
6063                                 $ar t $thisname >>libc.tmp
6064                         done
6065                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6066                         echo "Ok." >&4
6067                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6068                         # Repeat libc to extract forwarders to DLL entries too
6069                         for thisname in $libnames $libc; do
6070                                 $ar tv $thisname >>libc.tmp
6071                                 # Revision 50 of EMX has bug in $ar.
6072                                 # it will not extract forwarders to DLL entries
6073                                 # Use emximp which will extract exactly them.
6074                                 emximp -o tmp.imp $thisname \
6075                                     2>/dev/null && \
6076                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6077                                     < tmp.imp >>libc.tmp
6078                                 $rm tmp.imp
6079                         done
6080                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6081                         echo "Ok." >&4
6082                 else
6083                         echo "$ar didn't seem to work right." >&4
6084                         echo "Maybe this is a Cray...trying bld instead..." >&4
6085                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6086                         then
6087                                 for thisname in $libnames; do
6088                                         bld t $libnames | \
6089                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6090                                         $ar t $thisname >>libc.tmp
6091                                 done
6092                                 echo "Ok." >&4
6093                         else
6094                                 echo "That didn't work either.  Giving up." >&4
6095                                 exit 1
6096                         fi
6097                 fi
6098         fi
6099 fi
6100 nm_extract="$com"
6101 if $test -f /lib/syscalls.exp; then
6102         echo " "
6103         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6104         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6105 fi
6106 ;;
6107 esac
6108 $rm -f libnames libpath
6109
6110 : see if dld is available
6111 set dld.h i_dld
6112 eval $inhdr
6113
6114 : is a C symbol defined?
6115 csym='tlook=$1;
6116 case "$3" in
6117 -v) tf=libc.tmp; tc=""; tdc="";;
6118 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6119 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6120 esac;
6121 tx=yes;
6122 case "$reuseval-$4" in
6123 true-) ;;
6124 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6125 esac;
6126 case "$tx" in
6127 yes)
6128         case "$runnm" in
6129         true)
6130                 if $contains $tlook $tf >/dev/null 2>&1;
6131                 then tval=true;
6132                 else tval=false;
6133                 fi;;
6134         *)
6135                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6136                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6137                 then tval=true;
6138                 else tval=false;
6139                 fi;
6140                 $rm -f t t.c;;
6141         esac;;
6142 *)
6143         case "$tval" in
6144         $define) tval=true;;
6145         *) tval=false;;
6146         esac;;
6147 esac;
6148 eval "$2=$tval"'
6149
6150 : define an is-in-libc? function
6151 inlibc='echo " "; td=$define; tu=$undef;
6152 sym=$1; var=$2; eval "was=\$$2";
6153 tx=yes;
6154 case "$reuseval$was" in
6155 true) ;;
6156 true*) tx=no;;
6157 esac;
6158 case "$tx" in
6159 yes)
6160         set $sym tres -f;
6161         eval $csym;
6162         case "$tres" in
6163         true)
6164                 echo "$sym() found." >&4;
6165                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6166         *)
6167                 echo "$sym() NOT found." >&4;
6168                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6169         esac;;
6170 *)
6171         case "$was" in
6172         $define) echo "$sym() found." >&4;;
6173         *) echo "$sym() NOT found." >&4;;
6174         esac;;
6175 esac'
6176
6177 : see if dlopen exists
6178 xxx_runnm="$runnm"
6179 runnm=false
6180 set dlopen d_dlopen
6181 eval $inlibc
6182 runnm="$xxx_runnm"
6183
6184 : determine which dynamic loading, if any, to compile in
6185 echo " "
6186 dldir="ext/DynaLoader"
6187 case "$usedl" in
6188 $define|y|true)
6189         dflt='y'
6190         usedl="$define"
6191         ;;
6192 $undef|n|false)
6193         dflt='n'
6194         usedl="$undef"
6195         ;;
6196 *) 
6197         dflt='n'
6198         case "$d_dlopen" in
6199             $define) dflt='y' ;;
6200         esac
6201         case "$i_dld" in
6202             $define) dflt='y' ;;
6203         esac
6204         : Does a dl_xxx.xs file exist for this operating system
6205         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6206         ;;
6207 esac
6208 rp="Do you wish to use dynamic loading?"
6209 . ./myread
6210 usedl="$ans"
6211 case "$ans" in
6212 y*) usedl="$define"
6213         case "$dlsrc" in
6214         '')
6215                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6216                         dflt="$dldir/dl_${osname}.xs"
6217                 elif $test "$d_dlopen" = "$define" ; then
6218                         dflt="$dldir/dl_dlopen.xs"
6219                 elif $test "$i_dld" = "$define" ; then
6220                         dflt="$dldir/dl_dld.xs"
6221                 else
6222                         dflt=''
6223                 fi
6224                 ;;
6225         *)      dflt="$dldir/$dlsrc"
6226                 ;;
6227         esac
6228     echo "The following dynamic loading files are available:"
6229         : Can not go over to $dldir because getfile has path hard-coded in.
6230         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6231         rp="Source file to use for dynamic loading"
6232         fn="fne"
6233         gfpth="$src"
6234         . ./getfile
6235         usedl="$define"
6236         : emulate basename
6237         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6238
6239         $cat << EOM
6240
6241 Some systems may require passing special flags to $cc -c to
6242 compile modules that will be used to create a shared library.
6243 To use no flags, say "none".
6244
6245 EOM
6246     case "$cccdlflags" in
6247     '') case "$gccversion" in
6248                 '') case "$osname" in
6249                         hpux)   dflt='+z' ;;
6250                         next)   dflt='none' ;;
6251                         irix*)  dflt='-KPIC' ;;
6252                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6253                         sunos)  dflt='-pic' ;;
6254                         *)      dflt='none' ;;
6255                     esac
6256                         ;;
6257                 *)  case "$osname" in
6258                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6259                         *)      dflt='-fpic' ;;
6260                     esac ;;
6261             esac ;;
6262         ' ') dflt='none' ;;
6263     *)  dflt="$cccdlflags" ;;
6264     esac
6265     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6266     . ./myread
6267     case "$ans" in
6268     none) cccdlflags=' ' ;;
6269     *) cccdlflags="$ans" ;;
6270     esac
6271
6272     cat << EOM
6273
6274 Some systems use ld to create libraries that can be dynamically loaded,
6275 while other systems (such as those using ELF) use $cc.
6276
6277 EOM
6278         case "$ld" in
6279         '')     $cat >try.c <<'EOM'
6280 /* Test for whether ELF binaries are produced */
6281 #include <fcntl.h>
6282 #include <stdlib.h>
6283 int main() {
6284         char b[4];
6285         int i = open("a.out",O_RDONLY);
6286         if(i == -1) 
6287                 exit(1); /* fail */
6288         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6289                 exit(0); /* succeed (yes, it's ELF) */
6290         else
6291                 exit(1); /* fail */
6292 }
6293 EOM
6294                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6295                         cat <<EOM
6296 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6297 EOM
6298                         dflt="$cc"
6299                 else
6300                         echo "I'll use ld to build dynamic libraries."
6301                         dflt='ld'
6302                 fi
6303                 rm -f try.c a.out
6304                 ;;
6305         *)      dflt="$ld"
6306                 ;;
6307         esac
6308
6309     rp="What command should be used to create dynamic libraries?"
6310     . ./myread
6311         ld="$ans"
6312
6313     cat << EOM
6314
6315 Some systems may require passing special flags to $ld to create a
6316 library that can be dynamically loaded.  If your ld flags include
6317 -L/other/path options to locate libraries outside your loader's normal
6318 search path, you may need to specify those -L options here as well.  To
6319 use no flags, say "none".
6320
6321 EOM
6322     case "$lddlflags" in
6323     '') case "$osname" in
6324                         beos) dflt='-nostart' ;;
6325                         hpux) dflt='-b';
6326                               case "$gccversion" in
6327                               '') dflt="$dflt +vnocompatwarnings" ;;
6328                               esac
6329                               ;;        
6330                         linux|irix*)    dflt='-shared' ;;
6331                         next)  dflt='none' ;;
6332                         solaris) dflt='-G' ;;
6333                         sunos) dflt='-assert nodefinitions' ;;
6334                         svr4*|esix*) dflt="-G $ldflags" ;;
6335                 *)     dflt='none' ;;
6336                         esac
6337                         ;;
6338     *) dflt="$lddlflags" ;;
6339     esac
6340
6341         : Try to guess additional flags to pick up local libraries.
6342         : Be careful not to append to a plain 'none'
6343         case "$dflt" in
6344         none) dflt='' ;;
6345         esac
6346         for thisflag in $ldflags; do
6347                 case "$thisflag" in
6348                 -L*)
6349                         case " $dflt " in
6350                         *" $thisflag "*) ;;
6351                         *) dflt="$dflt $thisflag" ;;
6352                         esac
6353                         ;;
6354                 esac
6355         done
6356
6357         case "$dflt" in
6358         ''|' ') dflt='none' ;;
6359         esac
6360
6361     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6362     . ./myread
6363     case "$ans" in
6364     none) lddlflags=' ' ;;
6365     *) lddlflags="$ans" ;;
6366     esac
6367
6368         cat <<EOM
6369
6370 Some systems may require passing special flags to $cc to indicate that
6371 the resulting executable will use dynamic linking.  To use no flags,
6372 say "none".
6373
6374 EOM
6375     case "$ccdlflags" in
6376     '') case "$osname" in
6377                 hpux)   dflt='-Wl,-E' ;;
6378                 linux)  dflt='-rdynamic' ;;
6379                 next)   dflt='none' ;;
6380                 sunos)  dflt='none' ;;
6381                 *)      dflt='none' ;;
6382             esac ;;
6383     ' ')  dflt='none' ;;
6384     *)  dflt="$ccdlflags" ;;
6385     esac
6386     rp="Any special flags to pass to $cc to use dynamic linking?"
6387     . ./myread
6388     case "$ans" in
6389     none) ccdlflags=' ' ;;
6390     *) ccdlflags="$ans" ;;
6391     esac
6392     ;;
6393 *)  usedl="$undef"
6394         ld='ld'
6395     dlsrc='dl_none.xs'
6396     lddlflags=''
6397     ccdlflags=''
6398     ;;
6399 esac
6400
6401 also=''
6402 case "$usedl" in
6403 $undef)
6404         # No dynamic loading being used, so don't bother even to prompt.
6405         useshrplib='false'
6406         ;;
6407 *)      case "$useshrplib" in
6408         '')     case "$osname" in
6409                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6410                         dflt=y
6411                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6412                         ;;
6413                 next*)
6414                         case "$osvers" in
6415                         4*)     dflt=y
6416                                 also='Building a shared libperl is needed for MAB support.'
6417                                 ;;
6418                         *)      dflt=n
6419                                 ;;
6420                         esac
6421                         ;;
6422                 *)      dflt=n
6423                         ;;
6424                 esac
6425                 ;;
6426         $define|true|[Yy]*)
6427                 dflt=y
6428                 ;;
6429         *)      dflt=n
6430                 ;;
6431         esac
6432         $cat << EOM
6433
6434 The perl executable is normally obtained by linking perlmain.c with
6435 libperl${_a}, any static extensions (usually just DynaLoader), and
6436 any other libraries needed on this system (such as -lm, etc.).  Since
6437 your system supports dynamic loading, it is probably possible to build
6438 a shared libperl.$so.  If you will have more than one executable linked
6439 to libperl.$so, this will significantly reduce the size of each
6440 executable, but it may have a noticeable affect on performance.  The
6441 default is probably sensible for your system.
6442 $also
6443
6444 EOM
6445         rp="Build a shared libperl.$so (y/n)"
6446         . ./myread
6447         case "$ans" in
6448         true|$define|[Yy]*)
6449                 useshrplib='true'  ;;
6450         *)      useshrplib='false' ;;
6451         esac
6452         ;;
6453 esac
6454
6455 case "$useshrplib" in
6456 true)
6457         case "$libperl" in
6458         '')
6459                 # Figure out a good name for libperl.so.  Since it gets stored in
6460                 # a version-specific architecture-dependent library, the version
6461                 # number isn't really that important, except for making cc/ld happy.
6462                 #
6463                 # A name such as libperl.so.3.1
6464                 majmin="libperl.$so.$patchlevel.$subversion"
6465                 # A name such as libperl.so.301
6466                 majonly=`echo $patchlevel $subversion |
6467                         $awk '{printf "%d%02d", $1, $2}'`
6468                 majonly=libperl.$so.$majonly
6469                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6470                 # rely on figuring it out from the naming of libc.
6471                 case "${osname}${osvers}" in
6472                 next4*)
6473                         dflt=libperl.5.$so
6474                         # XXX How handle the --version stuff for MAB?
6475                         ;;
6476                 linux*)  # ld won't link with a bare -lperl otherwise.
6477                         dflt=libperl.$so
6478                         ;;
6479                 cygwin*) # include version
6480                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6481                         ;;
6482                 *)      # Try to guess based on whether libc has major.minor.
6483                         case "$libc" in
6484                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6485                         *libc.$so.[0-9]*) dflt=$majonly ;;
6486                         *)      dflt=libperl.$so ;;
6487                         esac
6488                         ;;
6489                 esac
6490                 ;;
6491         *)      dflt=$libperl
6492                 ;;
6493         esac
6494         cat << EOM
6495
6496 I need to select a good name for the shared libperl.  If your system uses
6497 library names with major and minor numbers, then you might want something
6498 like $majmin.  Alternatively, if your system uses a single version
6499 number for shared libraries, then you might want to use $majonly.
6500 Or, your system might be quite happy with a simple libperl.$so.
6501
6502 Since the shared libperl will get installed into a version-specific
6503 architecture-dependent directory, the version number of the shared perl
6504 library probably isn't important, so the default should be o.k.
6505
6506 EOM
6507         rp='What name do you want to give to the shared libperl?'
6508         . ./myread
6509         libperl=$ans
6510         echo "Ok, I'll use $libperl"
6511         ;;
6512 *)
6513         libperl="libperl${_a}"
6514         ;;
6515 esac
6516
6517 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6518 case "$shrpdir" in
6519 '') ;;
6520 *)      $cat >&4 <<EOM
6521 WARNING:  Use of the shrpdir variable for the installation location of
6522 the shared $libperl is not supported.  It was never documented and
6523 will not work in this version.  Let me (perlbug@perl.com)
6524 know of any problems this may cause.
6525
6526 EOM
6527         case "$shrpdir" in
6528         "$archlibexp/CORE")
6529                 $cat >&4 <<EOM
6530 But your current setting of $shrpdir is
6531 the default anyway, so it's harmless.
6532 EOM
6533                 ;;
6534         *)
6535                 $cat >&4 <<EOM
6536 Further, your current attempted setting of $shrpdir
6537 conflicts with the value of $archlibexp/CORE
6538 that installperl will use.
6539 EOM
6540                 ;;
6541         esac
6542         ;;
6543 esac
6544
6545 # How will the perl executable find the installed shared $libperl?
6546 # Add $xxx to ccdlflags.
6547 # If we can't figure out a command-line option, use $shrpenv to
6548 # set env LD_RUN_PATH.  The main perl makefile uses this.
6549 shrpdir=$archlibexp/CORE
6550 xxx=''
6551 tmp_shrpenv=''
6552 if "$useshrplib"; then
6553     case "$osname" in 
6554         aix)
6555                 # We'll set it in Makefile.SH...
6556                 ;;
6557         solaris|netbsd)
6558                 xxx="-R $shrpdir"
6559                 ;;
6560         freebsd)
6561                 xxx="-Wl,-R$shrpdir"
6562                 ;;
6563         linux|irix*|dec_osf)
6564                 xxx="-Wl,-rpath,$shrpdir"
6565                 ;;
6566         next)
6567                 # next doesn't like the default...
6568                 ;;
6569         beos)
6570                 # beos doesn't like the default, either.
6571                 ;;
6572         hpux*)
6573                 # hpux doesn't like the default, either.
6574                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6575                 ;;
6576         *)
6577                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6578                 ;;
6579         esac
6580         case "$xxx" in
6581         '') ;;
6582         *)      
6583                 # Only add $xxx if it isn't already in ccdlflags.
6584                 case " $ccdlflags " in
6585                 *" $xxx "*)     ;;
6586                 *)      ccdlflags="$ccdlflags $xxx"
6587                         cat <<EOM >&4
6588
6589 Adding $xxx to the flags
6590 passed to $ld so that the perl executable will find the 
6591 installed shared $libperl.
6592
6593 EOM
6594                         ;;
6595                 esac
6596                 ;;
6597         esac
6598 fi
6599 # Fix ccdlflags in AIX for building external extensions.
6600 # (For building Perl itself bare -bE:perl.exp is needed,
6601 #  Makefile.SH takes care of this.)
6602 case "$osname" in
6603 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6604 esac
6605 # Respect a hint or command-line value.
6606 case "$shrpenv" in
6607 '') shrpenv="$tmp_shrpenv" ;;
6608 esac
6609 case "$ldlibpthname" in
6610 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6611 none)   ldlibpthname='' ;;
6612 esac
6613
6614 : determine where manual pages go
6615 set man1dir man1dir none
6616 eval $prefixit
6617 $cat <<EOM
6618
6619 $spackage has manual pages available in source form.
6620 EOM
6621 case "$nroff" in
6622 nroff)
6623         echo "However, you don't have nroff, so they're probably useless to you."
6624         case "$man1dir" in
6625         '') man1dir="none";;
6626         esac;;
6627 esac
6628 echo "If you don't want the manual sources installed, answer 'none'."
6629 case "$man1dir" in
6630 ' ') dflt=none
6631         ;;
6632 '')
6633         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6634         lookpath="$lookpath $prefixexp/man/p_man/man1"
6635         lookpath="$lookpath $prefixexp/man/u_man/man1"
6636         lookpath="$lookpath $prefixexp/man/man.1"
6637         case "$sysman" in
6638         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6639         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6640         esac
6641         set dflt
6642         eval $prefixup
6643         ;;
6644 *)  dflt="$man1dir"
6645         ;;
6646 esac
6647 echo " "
6648 fn=dn+~
6649 rp="Where do the main $spackage manual pages (source) go?"
6650 . ./getfile
6651 if $test "X$man1direxp" != "X$ansexp"; then
6652         installman1dir=''
6653 fi
6654 man1dir="$ans"
6655 man1direxp="$ansexp"
6656 case "$man1dir" in
6657 '')     man1dir=' '
6658         installman1dir='';;
6659 esac
6660
6661 : Change installation prefix, if necessary.
6662 if $test X"$prefix" != X"$installprefix"; then
6663         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6664 else
6665         installman1dir="$man1direxp"
6666 fi
6667
6668 : What suffix to use on installed man pages
6669
6670 case "$man1dir" in
6671 ' ')
6672         man1ext='0'
6673         ;;
6674 *)
6675         rp="What suffix should be used for the main $spackage man pages?"
6676         case "$man1ext" in
6677         '')     case "$man1dir" in
6678                 *1)  dflt=1 ;;
6679                 *1p) dflt=1p ;;
6680                 *1pm) dflt=1pm ;;
6681                 *l) dflt=l;;
6682                 *n) dflt=n;;
6683                 *o) dflt=o;;
6684                 *p) dflt=p;;
6685                 *C) dflt=C;;
6686                 *L) dflt=L;;
6687                 *L1) dflt=L1;;
6688                 *) dflt=1;;
6689                 esac
6690                 ;;
6691         *)      dflt="$man1ext";;
6692         esac
6693         . ./myread
6694         man1ext="$ans"
6695         ;;
6696 esac
6697
6698 : see if we can have long filenames
6699 echo " "
6700 first=123456789abcdef
6701 $rm -f $first
6702 if (echo hi >$first) 2>/dev/null; then
6703         if $test -f 123456789abcde; then
6704                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6705                 val="$undef"
6706         else
6707                 echo 'You can have filenames longer than 14 characters.'>&4
6708                 val="$define"
6709         fi
6710 else
6711         $cat <<'EOM'
6712 You can't have filenames longer than 14 chars.
6713 You can't even think about them!
6714 EOM
6715         val="$undef"
6716 fi 
6717 set d_flexfnam
6718 eval $setvar
6719 $rm -rf 123456789abcde*
6720
6721 : determine where library module manual pages go
6722 set man3dir man3dir none
6723 eval $prefixit
6724 $cat <<EOM
6725
6726 $spackage has manual pages for many of the library modules.
6727 EOM
6728
6729 case "$nroff" in
6730 nroff)
6731         $cat <<'EOM'
6732 However, you don't have nroff, so they're probably useless to you.
6733 EOM
6734         case "$man3dir" in
6735         '') man3dir="none";;
6736         esac;;
6737 esac
6738
6739 case "$d_flexfnam" in
6740 undef)
6741         $cat <<'EOM'
6742 However, your system can't handle the long file names like File::Basename.3. 
6743 EOM
6744         case "$man3dir" in
6745         '') man3dir="none";;
6746         esac;;
6747 esac
6748
6749 echo "If you don't want the manual sources installed, answer 'none'."
6750 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6751 case "$man3dir" in
6752 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6753         if $test -d "$privlib/man/man3"; then
6754                 cat <<EOM >&4
6755
6756 WARNING:  Previous versions of perl installed man3 pages into
6757 $privlib/man/man3.  This version will suggest a 
6758 new default of $dflt.  
6759 EOM
6760                 tdflt=$dflt
6761                 dflt='n'
6762                 rp='Do you wish to preserve the old behavior?(y/n)'
6763                 . ./myread
6764                 case "$ans" in
6765                 y*) dflt="$privlib/man/man3" ;;
6766                 *)  dflt=$tdflt ;;
6767                 esac
6768     fi
6769         ;;
6770 *)      dflt="$man3dir" ;;
6771 esac
6772 case "$dflt" in
6773 ' ') dflt=none ;;
6774 esac
6775 echo " "
6776 fn=dn+~
6777 rp="Where do the $package library man pages (source) go?"
6778 . ./getfile
6779 man3dir="$ans"
6780 man3direxp="$ansexp"
6781 case "$man3dir" in
6782 '')     man3dir=' '
6783         installman3dir='';;
6784 esac
6785
6786 : Change installation prefix, if necessary.
6787 if $test X"$prefix" != X"$installprefix"; then
6788         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6789 else
6790         installman3dir="$man3direxp"
6791 fi
6792
6793 : What suffix to use on installed man pages
6794 case "$man3dir" in
6795 ' ')
6796         man3ext='0'
6797         ;;
6798 *)
6799         rp="What suffix should be used for the $package library man pages?"
6800         case "$man3ext" in
6801         '')     case "$man3dir" in
6802                 *3)  dflt=3 ;;
6803                 *3p) dflt=3p ;;
6804                 *3pm) dflt=3pm ;;
6805                 *l) dflt=l;;
6806                 *n) dflt=n;;
6807                 *o) dflt=o;;
6808                 *p) dflt=p;;
6809                 *C) dflt=C;;
6810                 *L) dflt=L;;
6811                 *L3) dflt=L3;;
6812                 *) dflt=3;;
6813                 esac
6814                 ;;
6815         *)      dflt="$man3ext";;
6816         esac
6817         . ./myread
6818         man3ext="$ans"
6819         ;;
6820 esac
6821
6822 : see if we have to deal with yellow pages, now NIS.
6823 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6824         if $test -f /usr/etc/nibindd; then
6825                 echo " "
6826                 echo "I'm fairly confident you're on a NeXT."
6827                 echo " "
6828                 rp='Do you get the hosts file via NetInfo?'
6829                 dflt=y
6830                 case "$hostcat" in
6831                 nidump*) ;;
6832                 '') ;;
6833                 *) dflt=n;;
6834                 esac
6835                 . ./myread
6836                 case "$ans" in
6837                 y*) hostcat='nidump hosts .';;
6838                 *)      case "$hostcat" in
6839                         nidump*) hostcat='';;
6840                         esac
6841                         ;;
6842                 esac
6843         fi
6844         case "$hostcat" in
6845         nidump*) ;;
6846         *)
6847                 case "$hostcat" in
6848                 *ypcat*) dflt=y;;
6849                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6850                                 dflt=y
6851                         else
6852                                 dflt=n
6853                         fi;;
6854                 *) dflt=n;;
6855                 esac
6856                 echo " "
6857                 rp='Are you getting the hosts file via yellow pages?'
6858                 . ./myread
6859                 case "$ans" in
6860                 y*) hostcat='ypcat hosts';;
6861                 *) hostcat='cat /etc/hosts';;
6862                 esac
6863                 ;;
6864         esac
6865 fi
6866 case "$hostcat" in
6867 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6868 esac
6869 case "$groupcat" in
6870 '') test -f /etc/group && groupcat='cat /etc/group';;
6871 esac
6872 case "$passcat" in
6873 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6874 esac
6875
6876 : now get the host name
6877 echo " "
6878 echo "Figuring out host name..." >&4
6879 case "$myhostname" in
6880 '') cont=true
6881         echo 'Maybe "hostname" will work...'
6882         if tans=`sh -c hostname 2>&1` ; then
6883                 myhostname=$tans
6884                 phostname=hostname
6885                 cont=''
6886         fi
6887         ;;
6888 *) cont='';;
6889 esac
6890 if $test "$cont"; then
6891         if ./xenix; then
6892                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6893                 if tans=`cat /etc/systemid 2>&1` ; then
6894                         myhostname=$tans
6895                         phostname='cat /etc/systemid'
6896                         echo "Whadyaknow.  Xenix always was a bit strange..."
6897                         cont=''
6898                 fi
6899         elif $test -r /etc/systemid; then
6900                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6901         fi
6902 fi
6903 if $test "$cont"; then
6904         echo 'No, maybe "uuname -l" will work...'
6905         if tans=`sh -c 'uuname -l' 2>&1` ; then
6906                 myhostname=$tans
6907                 phostname='uuname -l'
6908         else
6909                 echo 'Strange.  Maybe "uname -n" will work...'
6910                 if tans=`sh -c 'uname -n' 2>&1` ; then
6911                         myhostname=$tans
6912                         phostname='uname -n'
6913                 else
6914                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6915                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6916                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6917                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6918                         else
6919                                 case "$myhostname" in
6920                                 '') echo "Does this machine have an identity crisis or something?"
6921                                         phostname='';;
6922                                 *)
6923                                         echo "Well, you said $myhostname before..."
6924                                         phostname='echo $myhostname';;
6925                                 esac
6926                         fi
6927                 fi
6928         fi
6929 fi
6930 : you do not want to know about this
6931 set $myhostname
6932 myhostname=$1
6933
6934 : verify guess
6935 if $test "$myhostname" ; then
6936         dflt=y
6937         rp='Your host name appears to be "'$myhostname'".'" Right?"
6938         . ./myread
6939         case "$ans" in
6940         y*) ;;
6941         *) myhostname='';;
6942         esac
6943 fi
6944
6945 : bad guess or no guess
6946 while $test "X$myhostname" = X ; do
6947         dflt=''
6948         rp="Please type the (one word) name of your host:"
6949         . ./myread
6950         myhostname="$ans"
6951 done
6952
6953 : translate upper to lower if necessary
6954 case "$myhostname" in
6955 *[A-Z]*)
6956         echo "(Normalizing case in your host name)"
6957         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6958         ;;
6959 esac
6960
6961 case "$myhostname" in
6962 *.*)
6963         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6964         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6965         echo "(Trimming domain name from host name--host name is now $myhostname)"
6966         ;;
6967 *) case "$mydomain" in
6968         '')
6969                 {
6970                         test "X$hostcat" = "Xypcat hosts" &&
6971                         ypmatch "$myhostname" hosts 2>/dev/null |\
6972                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6973                         $test -s hosts
6974                 } || {
6975                         test "X$hostcat" != "X" &&
6976                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6977                                         /[       ]$myhostname[  . ]/p" > hosts
6978                 }
6979                 tmp_re="[       . ]"
6980                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6981                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6982                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6983                         hosts | $sort | $uniq | \
6984                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6985                 case `$echo X$dflt` in
6986                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6987                         dflt=.
6988                         ;;
6989                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6990                         ;;
6991                 esac
6992                 case "$dflt" in
6993                 .)
6994                         tans=`./loc resolv.conf X /etc /usr/etc`
6995                         if $test -f "$tans"; then
6996                                 echo "(Attempting domain name extraction from $tans)"
6997                                 dflt=.`$sed -n -e 's/   / /g' \
6998                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6999                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7000                                 case "$dflt" in
7001                                 .) dflt=.`$sed -n -e 's/        / /g' \
7002                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7003                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7004                                         ;;
7005                                 esac
7006                         fi
7007                         ;;
7008                 esac
7009                 case "$dflt" in
7010                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7011                         dflt=.`sh -c domainname 2>/dev/null`
7012                         case "$dflt" in
7013                         '') dflt='.';;
7014                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7015                         esac
7016                         ;;
7017                 esac
7018                 case "$dflt" in
7019                 .) echo "(Lost all hope -- silly guess then)"
7020                         dflt='.uucp'
7021                         ;;
7022                 esac
7023                 $rm -f hosts
7024                 ;;
7025         *) dflt="$mydomain";;
7026         esac;;
7027 esac
7028 echo " "
7029 rp="What is your domain name?"
7030 . ./myread
7031 tans="$ans"
7032 case "$ans" in
7033 '') ;;
7034 .*) ;;
7035 *) tans=".$tans";;
7036 esac
7037 mydomain="$tans"
7038
7039 : translate upper to lower if necessary
7040 case "$mydomain" in
7041 *[A-Z]*)
7042         echo "(Normalizing case in your domain name)"
7043         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7044         ;;
7045 esac
7046
7047 : a little sanity check here
7048 case "$phostname" in
7049 '') ;;
7050 *)
7051         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7052         $myhostname$mydomain|$myhostname) ;;
7053         *)
7054                 case "$phostname" in
7055                 sed*)
7056                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7057                         ;;
7058                 *)
7059                         echo "(That doesn't agree with your $phostname command, by the way.)"
7060                         ;;
7061                 esac
7062         ;;
7063         esac
7064         ;;
7065 esac
7066
7067 $cat <<EOM
7068
7069 I need to get your e-mail address in Internet format if possible, i.e.
7070 something like user@host.domain. Please answer accurately since I have
7071 no easy means to double check it. The default value provided below
7072 is most probably close to reality but may not be valid from outside
7073 your organization...
7074
7075 EOM
7076 cont=x
7077 while test "$cont"; do
7078         case "$cf_email" in
7079         '') dflt="$cf_by@$myhostname$mydomain";;
7080         *) dflt="$cf_email";;
7081         esac
7082         rp='What is your e-mail address?'
7083         . ./myread
7084         cf_email="$ans"
7085         case "$cf_email" in
7086         *@*.*) cont='' ;;
7087         *)
7088                 rp='Address does not look like an Internet one.  Use it anyway?'
7089                 case "$fastread" in
7090                 yes) dflt=y ;;
7091                 *) dflt=n ;;
7092                 esac
7093                 . ./myread
7094                 case "$ans" in
7095                 y*) cont='' ;;
7096                 *) echo " " ;;
7097                 esac
7098                 ;;
7099         esac
7100 done
7101
7102 $cat <<EOM
7103
7104 If you or somebody else will be maintaining perl at your site, please
7105 fill in the correct e-mail address here so that they may be contacted
7106 if necessary. Currently, the "perlbug" program included with perl
7107 will send mail to this address in addition to perlbug@perl.com. You may
7108 enter "none" for no administrator.
7109
7110 EOM
7111 case "$perladmin" in
7112 '') dflt="$cf_email";;
7113 *) dflt="$perladmin";;
7114 esac
7115 rp='Perl administrator e-mail address'
7116 . ./myread
7117 perladmin="$ans"
7118
7119 : figure out how to guarantee perl startup
7120 case "$startperl" in
7121 '')
7122         case "$sharpbang" in
7123         *!)
7124                 $cat <<EOH
7125
7126 I can use the #! construct to start perl on your system. This will
7127 make startup of perl scripts faster, but may cause problems if you
7128 want to share those scripts and perl is not in a standard place
7129 ($binexp/perl) on all your platforms. The alternative is to force
7130 a shell by starting the script with a single ':' character.
7131
7132 EOH
7133                 dflt="$binexp/perl"
7134                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7135                 . ./myread
7136                 case "$ans" in
7137                 none)   startperl=": # use perl";;
7138                 *)      startperl="#!$ans"
7139                         if $test 30 -lt `echo "$ans" | wc -c`; then
7140                                 $cat >&4 <<EOM
7141
7142 WARNING:  Some systems limit the #! command to 32 characters.
7143 If you experience difficulty running Perl scripts with #!, try
7144 installing Perl in a directory with a shorter pathname.
7145
7146 EOM
7147                         fi ;;
7148                 esac
7149                 ;;
7150         *) startperl=": # use perl"
7151                 ;;
7152         esac
7153         ;;
7154 esac
7155 echo "I'll use $startperl to start perl scripts."
7156
7157 : figure best path for perl in scripts
7158 case "$perlpath" in
7159 '')
7160         perlpath="$binexp/perl"
7161         case "$startperl" in
7162         *!*) ;;
7163         *)
7164                 $cat <<EOH
7165
7166 I will use the "eval 'exec'" idiom to start Perl on your system.
7167 I can use the full path of your Perl binary for this purpose, but
7168 doing so may cause problems if you want to share those scripts and
7169 Perl is not always in a standard place ($binexp/perl).
7170
7171 EOH
7172                 dflt="$binexp/perl"
7173                 rp="What path shall I use in \"eval 'exec'\"?"
7174                 . ./myread
7175                 perlpath="$ans"
7176                 ;;
7177         esac
7178         ;;
7179 esac
7180 case "$startperl" in
7181 *!*)    ;;
7182 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7183 esac
7184
7185 : determine where public executable scripts go
7186 set scriptdir scriptdir
7187 eval $prefixit
7188 case "$scriptdir" in
7189 '')
7190         dflt="$bin"
7191         : guess some guesses
7192         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7193         $test -d /usr/share/bin     && dflt=/usr/share/bin
7194         $test -d /usr/local/script  && dflt=/usr/local/script
7195         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7196         $test -d $prefixexp/script  && dflt=$prefixexp/script
7197         set dflt
7198         eval $prefixup
7199         ;;
7200 *)  dflt="$scriptdir"
7201         ;;
7202 esac
7203 $cat <<EOM
7204  
7205 Some installations have a separate directory just for executable scripts so
7206 that they can mount it across multiple architectures but keep the scripts in
7207 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7208 Or you might just lump your scripts in with all your other executables.
7209  
7210 EOM
7211 fn=d~
7212 rp='Where do you keep publicly executable scripts?'
7213 . ./getfile
7214 if $test "X$ansexp" != "X$scriptdirexp"; then
7215         installscript=''
7216 fi
7217 scriptdir="$ans"
7218 scriptdirexp="$ansexp"
7219 : Change installation prefix, if necessary.
7220 if $test X"$prefix" != X"$installprefix"; then
7221         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7222 else
7223         installscript="$scriptdirexp"
7224 fi
7225
7226 : determine where add-on public executables go
7227 case "$sitebin" in
7228 '')     dflt=$siteprefix/bin ;;
7229 *)      dflt=$sitebin ;;
7230 esac
7231 fn=d~
7232 rp='Pathname where the add-on public executables should be installed?'
7233 . ./getfile
7234 sitebin="$ans"
7235 sitebinexp="$ansexp"
7236 : Change installation prefix, if necessary.
7237 if $test X"$prefix" != X"$installprefix"; then
7238         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7239 else
7240         installsitebin="$sitebinexp"
7241 fi
7242
7243 : see if sqrtl exists
7244 set sqrtl d_sqrtl
7245 eval $inlibc
7246
7247 case "$ccflags" in
7248 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7249 esac
7250
7251 case "$uselongdouble" in
7252 $define|true|[yY]*)     dflt='y';;
7253 *) dflt='n';;
7254 esac
7255 cat <<EOM
7256
7257 Perl can be built to take advantage of long doubles which
7258 (if available) may give more accuracy and range for floating point numbers.
7259
7260 If this doesn't make any sense to you, just accept the default '$dflt'.
7261 EOM
7262 rp='Try to use long doubles if available?'
7263 . ./myread
7264 case "$ans" in
7265 y|Y)    val="$define"   ;;
7266 *)      val="$undef"    ;;
7267 esac
7268 set uselongdouble
7269 eval $setvar
7270
7271 case "$uselongdouble" in
7272 true|[yY]*) uselongdouble="$define" ;;
7273 esac
7274
7275 case "$uselongdouble" in
7276 $define)
7277 : Look for a hint-file generated 'call-back-unit'.  If the
7278 : user has specified that long doubles should be used,
7279 : we may need to set or change some other defaults.
7280         if $test -f uselongdouble.cbu; then
7281                 echo "Your platform has some specific hints for long doubles, using them..."
7282                 . ./uselongdouble.cbu
7283         else
7284                 $cat <<EOM
7285 (Your platform doesn't have any specific hints for long doubles.)
7286 EOM
7287         fi
7288         ;;
7289 esac
7290
7291 case "$uselongdouble:$d_sqrtl" in
7292 $define:$undef)
7293                 $cat <<EOM >&4
7294
7295 *** You requested the use of long doubles but you do not seem to have
7296 *** the mathematic functions for long doubles.  I'm disabling the use
7297 *** of long doubles.
7298
7299 EOM
7300         uselongdouble=$undef
7301         ;;
7302 esac
7303
7304 case "$useperlio" in
7305 $define|true|[yY]*)     dflt='y';;
7306 *) dflt='n';;
7307 esac
7308 cat <<EOM
7309
7310 Previous version of $package used the standard IO mechanisms as defined
7311 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7312 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7313 the default.  This abstraction layer can use AT&T's sfio (if you already
7314 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7315 problems with some extension modules.  Using PerlIO with stdio is safe,
7316 but it is slower than plain stdio and therefore is not the default.
7317
7318 If this doesn't make any sense to you, just accept the default '$dflt'.
7319 EOM
7320 rp='Use the experimental PerlIO abstraction layer?'
7321 . ./myread
7322 case "$ans" in
7323 y|Y) 
7324         val="$define"
7325         ;;     
7326 *)      
7327         echo "Ok, doing things the stdio way"
7328         val="$undef"
7329         ;;
7330 esac
7331 set useperlio
7332 eval $setvar 
7333
7334 case "$vendorprefix" in
7335 '')     d_vendorbin="$undef"
7336         vendorbin=''
7337         vendorbinexp=''
7338         ;;
7339 *)      d_vendorbin="$define"
7340         : determine where vendor-supplied executables go.
7341         case "$vendorbin" in
7342         '') dflt=$vendorprefix/bin ;;
7343         *)      dflt="$vendorbin" ;;
7344         esac
7345         fn=d~+
7346         rp='Pathname for the vendor-supplied executables directory?'
7347         . ./getfile
7348         vendorbin="$ans"
7349         vendorbinexp="$ansexp"
7350         ;;
7351 esac
7352 : Change installation prefix, if necessary.
7353 if $test X"$prefix" != X"$installprefix"; then
7354         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7355 else
7356         installvendorbin="$vendorbinexp"
7357 fi
7358
7359 : see if qgcvt exists
7360 set qgcvt d_qgcvt
7361 eval $inlibc
7362
7363 : check for length of double
7364 echo " "
7365 case "$doublesize" in
7366 '')
7367         echo "Checking to see how big your double precision numbers are..." >&4
7368         $cat >try.c <<'EOCP'
7369 #include <stdio.h>
7370 int main()
7371 {
7372     printf("%d\n", (int)sizeof(double));
7373     exit(0);
7374 }
7375 EOCP
7376         set try
7377         if eval $compile_ok; then
7378                 doublesize=`./try`
7379                 echo "Your double is $doublesize bytes long."
7380         else
7381                 dflt='8'
7382                 echo "(I can't seem to compile the test program.  Guessing...)"
7383                 rp="What is the size of a double precision number (in bytes)?"
7384                 . ./myread
7385                 doublesize="$ans"
7386         fi
7387         ;;
7388 esac
7389 $rm -f try.c try
7390
7391 : check for long doubles
7392 echo " "
7393 echo "Checking to see if you have long double..." >&4
7394 echo 'int main() { long double x = 7.0; }' > try.c
7395 set try
7396 if eval $compile; then
7397         val="$define"
7398         echo "You have long double."
7399 else
7400         val="$undef"
7401         echo "You do not have long double."
7402 fi
7403 $rm try.*
7404 set d_longdbl
7405 eval $setvar
7406
7407 : check for length of long double
7408 case "${d_longdbl}${longdblsize}" in
7409 $define)
7410         echo " "
7411         echo "Checking to see how big your long doubles are..." >&4
7412         $cat >try.c <<'EOCP'
7413 #include <stdio.h>
7414 int main()
7415 {
7416         printf("%d\n", sizeof(long double));
7417 }
7418 EOCP
7419         set try
7420         set try
7421         if eval $compile; then
7422                 longdblsize=`./try$exe_ext`
7423                 echo "Your long doubles are $longdblsize bytes long."
7424         else
7425                 dflt='8'
7426                 echo " "
7427                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7428                 rp="What is the size of a long double (in bytes)?"
7429                 . ./myread
7430                 longdblsize="$ans"
7431         fi
7432         if $test "X$doublesize" = "X$longdblsize"; then
7433                 echo "(That isn't any different from an ordinary double.)"
7434         fi      
7435         ;;
7436 esac
7437 $rm -f try.* try
7438
7439 echo " "
7440
7441 if $test X"$d_longdbl" = X"$define"; then
7442
7443 echo "Checking how to print long doubles..." >&4
7444
7445 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7446         $cat >try.c <<'EOCP'
7447 #include <sys/types.h>
7448 #include <stdio.h>
7449 int main() {
7450   double d = 123.456;
7451   printf("%.3f\n", d);
7452 }
7453 EOCP
7454         set try
7455         if eval $compile; then
7456                 yyy=`./try$exe_ext`
7457                 case "$yyy" in
7458                 123.456)
7459                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7460                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7461                         echo "We will use %f."
7462                         ;;
7463                 esac
7464         fi
7465 fi
7466
7467 if $test X"$sPRIfldbl" = X; then
7468         $cat >try.c <<'EOCP'
7469 #include <sys/types.h>
7470 #include <stdio.h>
7471 int main() {
7472   long double d = 123.456;
7473   printf("%.3llf\n", d);
7474 }
7475 EOCP
7476         set try
7477         if eval $compile; then
7478                 yyy=`./try$exe_ext`
7479                 case "$yyy" in
7480                 123.456)
7481                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7482                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7483                         echo "We will use %llf."
7484                         ;;
7485                 esac
7486         fi
7487 fi
7488
7489 if $test X"$sPRIfldbl" = X; then
7490         $cat >try.c <<'EOCP'
7491 #include <sys/types.h>
7492 #include <stdio.h>
7493 int main() {
7494   long double d = 123.456;
7495   printf("%.3Lf\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='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7504                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7505                         echo "We will use %Lf."
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("%.3lf\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='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7526                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7527                         echo "We will use %lf."
7528                         ;;
7529                 esac
7530         fi
7531 fi
7532
7533 if $test X"$sPRIfldbl" = X; then
7534         echo "Cannot figure out how to print long doubles." >&4
7535 fi
7536
7537 $rm -f try try.*
7538
7539 fi # d_longdbl
7540
7541 case "$sPRIfldbl" in
7542 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7543         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7544         ;;
7545 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7546         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7547         ;;
7548 esac
7549
7550 : Check how to convert floats to strings.
7551 if test "X$d_Gconvert" = X; then
7552         echo " "
7553         echo "Checking for an efficient way to convert floats to strings."
7554         echo " " > try.c
7555         case "$uselongdouble" in
7556         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7557         esac
7558         case "$d_longdbl" in
7559         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7560         esac
7561         case "$d_PRIgldbl" in
7562         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7563         esac
7564         $cat >>try.c <<EOP
7565 #ifdef TRY_gconvert
7566 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7567 char *myname = "gconvert";
7568 #endif
7569 #ifdef TRY_gcvt
7570 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7571 char *myname = "gcvt";
7572 #endif
7573 #ifdef TRY_qgcvt
7574 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7575 char *myname = "qgcvt";
7576 #define DOUBLETYPE long double
7577 #endif
7578 #ifdef TRY_sprintf
7579 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7580 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7581 #else
7582 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7583 #endif
7584 char *myname = "sprintf";
7585 #endif
7586
7587 #ifndef DOUBLETYPE
7588 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7589 #define DOUBLETYPE long double
7590 #else
7591 #define DOUBLETYPE double
7592 #endif
7593 #endif
7594
7595 #include <stdio.h>
7596
7597 #define I_STDLIB $i_stdlib
7598 #ifdef I_STDLIB
7599 #include <stdlib.h>
7600 #endif
7601
7602 int
7603 checkit(expect, got)
7604 char *expect;
7605 char *got;
7606 {
7607     if (strcmp(expect, got)) {
7608                 printf("%s oddity:  Expected %s, got %s\n",
7609                         myname, expect, got);
7610                 exit(1);
7611         }
7612 }
7613
7614 int main()
7615
7616         char buf[64]; 
7617         buf[63] = '\0';
7618
7619         /* This must be 1st test on (which?) platform */
7620         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7621         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7622         checkit("0.1", buf);
7623
7624         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7625         checkit("1", buf);
7626
7627         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7628         checkit("1.1", buf);
7629
7630         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7631         checkit("1.01", buf);
7632
7633         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7634         checkit("1.001", buf);
7635
7636         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7637         checkit("1.0001", buf);
7638
7639         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7640         checkit("1.00001", buf);
7641
7642         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7643         checkit("1.000001", buf);
7644
7645         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7646         checkit("0", buf);
7647
7648         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7649         checkit("-1", buf);
7650
7651         /* Some Linux gcvt's give 1.e+5 here. */
7652         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7653         checkit("100000", buf);
7654         
7655         /* Some Linux gcvt's give -1.e+5 here. */
7656         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7657         checkit("-100000", buf);
7658
7659         exit(0);
7660 }
7661 EOP
7662         case "$d_Gconvert" in
7663         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7664         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7665         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7666         *) xxx_list='gconvert gcvt sprintf' ;;
7667         esac
7668
7669         case "$d_longdbl$uselongdouble$d_qgcvt" in
7670         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7671         esac
7672
7673         for xxx_convert in $xxx_list; do
7674                 echo "Trying $xxx_convert..."
7675                 $rm -f try try$_o
7676                 set try -DTRY_$xxx_convert
7677                 if eval $compile; then
7678                         echo "$xxx_convert() found." >&4
7679                         if ./try; then
7680                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7681                                 break;
7682                         else
7683                                 echo "...But $xxx_convert didn't work as I expected."
7684                         fi
7685                 else
7686                         echo "$xxx_convert NOT found." >&4
7687                 fi
7688         done
7689                 
7690         case "$xxx_convert" in
7691         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7692         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7693         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7694         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7695            "$define$define$define")
7696               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7697            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7698            esac
7699            ;;  
7700         esac
7701 fi
7702
7703 : Initialize h_fcntl
7704 h_fcntl=false
7705
7706 : Initialize h_sysfile
7707 h_sysfile=false
7708
7709 : access call always available on UNIX
7710 set access d_access
7711 eval $inlibc
7712
7713 : locate the flags for 'access()'
7714 case "$d_access" in
7715 "$define")
7716         echo " "
7717         $cat >access.c <<'EOCP'
7718 #include <sys/types.h>
7719 #ifdef I_FCNTL
7720 #include <fcntl.h>
7721 #endif
7722 #ifdef I_SYS_FILE
7723 #include <sys/file.h>
7724 #endif
7725 #ifdef I_UNISTD
7726 #include <unistd.h>
7727 #endif
7728 int main() {
7729         exit(R_OK);
7730 }
7731 EOCP
7732         : check sys/file.h first, no particular reason here
7733         if $test `./findhdr sys/file.h` && \
7734                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7735                 h_sysfile=true;
7736                 echo "<sys/file.h> defines the *_OK access constants." >&4
7737         elif $test `./findhdr fcntl.h` && \
7738                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7739                 h_fcntl=true;
7740                 echo "<fcntl.h> defines the *_OK access constants." >&4
7741         elif $test `./findhdr unistd.h` && \
7742                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7743                 echo "<unistd.h> defines the *_OK access constants." >&4
7744         else
7745                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7746         fi
7747         ;;
7748 esac
7749 $rm -f access*
7750
7751 : see if accessx exists
7752 set accessx d_accessx
7753 eval $inlibc
7754
7755 : see if alarm exists
7756 set alarm d_alarm
7757 eval $inlibc
7758
7759 : see if atolf exists
7760 set atolf d_atolf
7761 eval $inlibc
7762
7763 : see if atoll exists
7764 set atoll d_atoll
7765 eval $inlibc
7766
7767 : Look for GNU-cc style attribute checking
7768 echo " "
7769 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7770 $cat >attrib.c <<'EOCP'
7771 #include <stdio.h>
7772 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7773 EOCP
7774 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7775         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7776                 echo "Your C compiler doesn't fully support __attribute__."
7777                 val="$undef"
7778         else
7779                 echo "Your C compiler supports __attribute__."
7780                 val="$define"
7781         fi
7782 else
7783         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7784         val="$undef"
7785 fi
7786 set d_attribut
7787 eval $setvar
7788 $rm -f attrib*
7789
7790 : see if bcmp exists
7791 set bcmp d_bcmp
7792 eval $inlibc
7793
7794 : see if bcopy exists
7795 set bcopy d_bcopy
7796 eval $inlibc
7797
7798 : see if this is a unistd.h system
7799 set unistd.h i_unistd
7800 eval $inhdr
7801
7802 : see if getpgrp exists
7803 set getpgrp d_getpgrp
7804 eval $inlibc
7805
7806 case "$d_getpgrp" in
7807 "$define")
7808         echo " "
7809         echo "Checking to see which flavor of getpgrp is in use..."
7810         $cat >set.c <<EOP
7811 #$i_unistd I_UNISTD
7812 #include <sys/types.h>
7813 #ifdef I_UNISTD
7814 #  include <unistd.h>
7815 #endif
7816 int main()
7817 {
7818         if (getuid() == 0) {
7819                 printf("(I see you are running Configure as super-user...)\n");
7820                 setuid(1);
7821         }
7822 #ifdef TRY_BSD_PGRP
7823         if (getpgrp(1) == 0)
7824                 exit(0);
7825 #else
7826         if (getpgrp() > 0)
7827                 exit(0);
7828 #endif
7829         exit(1);
7830 }
7831 EOP
7832         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7833                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7834                 val="$define"
7835         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7836                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7837                 val="$undef"
7838         else
7839                 echo "I can't seem to compile and run the test program."
7840                 if ./usg; then
7841                         xxx="a USG one, i.e. you use getpgrp()."
7842                 else
7843                         # SVR4 systems can appear rather BSD-ish.
7844                         case "$i_unistd" in
7845                         $undef)
7846                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7847                                 val="$define"
7848                                 ;;
7849                         $define)
7850                                 xxx="probably a USG one, i.e. you use getpgrp()."
7851                                 val="$undef"
7852                                 ;;
7853                         esac
7854                 fi
7855                 echo "Assuming your getpgrp is $xxx" >&4
7856         fi
7857         ;;
7858 *) val="$undef";;
7859 esac
7860 set d_bsdgetpgrp
7861 eval $setvar
7862 $rm -f set set.c
7863
7864 : see if setpgrp exists
7865 set setpgrp d_setpgrp
7866 eval $inlibc
7867
7868 case "$d_setpgrp" in
7869 "$define")
7870         echo " "
7871         echo "Checking to see which flavor of setpgrp is in use..."
7872         $cat >set.c <<EOP
7873 #$i_unistd I_UNISTD
7874 #include <sys/types.h>
7875 #ifdef I_UNISTD
7876 #  include <unistd.h>
7877 #endif
7878 int main()
7879 {
7880         if (getuid() == 0) {
7881                 printf("(I see you are running Configure as super-user...)\n");
7882                 setuid(1);
7883         }
7884 #ifdef TRY_BSD_PGRP
7885         if (-1 == setpgrp(1, 1))
7886                 exit(0);
7887 #else
7888         if (setpgrp() != -1)
7889                 exit(0);
7890 #endif
7891         exit(1);
7892 }
7893 EOP
7894         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7895                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7896                 val="$define"
7897         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7898                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7899                 val="$undef"
7900         else
7901                 echo "(I can't seem to compile and run the test program.)"
7902                 if ./usg; then
7903                         xxx="a USG one, i.e. you use setpgrp()."
7904                 else
7905                         # SVR4 systems can appear rather BSD-ish.
7906                         case "$i_unistd" in
7907                         $undef)
7908                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7909                                 val="$define"
7910                                 ;;
7911                         $define)
7912                                 xxx="probably a USG one, i.e. you use setpgrp()."
7913                                 val="$undef"
7914                                 ;;
7915                         esac
7916                 fi
7917                 echo "Assuming your setpgrp is $xxx" >&4
7918         fi
7919         ;;
7920 *) val="$undef";;
7921 esac
7922 set d_bsdsetpgrp
7923 eval $setvar
7924 $rm -f set set.c
7925 : see if bzero exists
7926 set bzero d_bzero
7927 eval $inlibc
7928
7929 : see if signal is declared as pointer to function returning int or void
7930 echo " "
7931 xxx=`./findhdr signal.h`
7932 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7933 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7934         echo "You have int (*signal())() instead of void." >&4
7935         val="$undef"
7936 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7937         echo "You have void (*signal())()." >&4
7938         val="$define"
7939 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7940         echo "You have int (*signal())() instead of void." >&4
7941         val="$undef"
7942 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7943         echo "You have void (*signal())()." >&4
7944         val="$define"
7945 else
7946         case "$d_voidsig" in
7947         '')
7948         echo "I can't determine whether signal handler returns void or int..." >&4
7949                 dflt=void
7950                 rp="What type does your signal handler return?"
7951                 . ./myread
7952                 case "$ans" in
7953                 v*) val="$define";;
7954                 *) val="$undef";;
7955                 esac;;
7956         "$define")
7957                 echo "As you already told me, signal handler returns void." >&4
7958                 val="$define"
7959                 ;;
7960         *)      echo "As you already told me, signal handler returns int." >&4
7961                 val="$undef"
7962                 ;;
7963         esac
7964 fi
7965 set d_voidsig
7966 eval $setvar
7967 case "$d_voidsig" in
7968 "$define") signal_t="void";;
7969 *) signal_t="int";;
7970 esac
7971 $rm -f $$.tmp
7972
7973 : check for ability to cast large floats to 32-bit ints.
7974 echo " "
7975 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7976 if $test "$intsize" -ge 4; then
7977         xxx=int
7978 else
7979         xxx=long
7980 fi
7981 $cat >try.c <<EOCP
7982 #include <stdio.h>
7983 #include <sys/types.h>
7984 #include <signal.h>
7985 $signal_t blech(s) int s; { exit(3); }
7986 int main()
7987 {
7988         $xxx i32;
7989         double f, g;
7990         int result = 0;
7991         char str[16];
7992         signal(SIGFPE, blech);
7993
7994         /* Don't let compiler optimize the test away.  Store the number 
7995            in a writable string for gcc to pass to sscanf under HP/UX.
7996         */
7997         sprintf(str, "2147483647");
7998         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7999         g = 10 * f;
8000         i32  = ($xxx) g;
8001
8002         /* x86 processors will probably give 0x8000 0000, which is a
8003        sign change.  We don't want that.  We want to mimic SPARC
8004            behavior here, which is to preserve the sign and give
8005            back 0x7fff ffff.
8006         */
8007         if (i32 != ($xxx) f)
8008                 result |= 1;
8009         exit(result);
8010 }
8011 EOCP
8012 set try
8013 if eval $compile_ok; then
8014         ./try
8015         yyy=$?
8016 else
8017         echo "(I can't seem to compile the test program--assuming it can't)"
8018         yyy=1
8019 fi
8020 case "$yyy" in
8021 0)      val="$define"
8022         echo "Yup, it can."
8023         ;;
8024 *)      val="$undef"
8025         echo "Nope, it can't."
8026         ;;
8027 esac
8028 set d_casti32
8029 eval $setvar
8030 $rm -f try try.*
8031
8032 : check for ability to cast negative floats to unsigned
8033 echo " "
8034 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8035 $cat >try.c <<EOCP
8036 #include <stdio.h>
8037 #include <sys/types.h>
8038 #include <signal.h>
8039 $signal_t blech(s) int s; { exit(7); }
8040 $signal_t blech_in_list(s) int s; { exit(4); }
8041 unsigned long dummy_long(p) unsigned long p; { return p; }
8042 unsigned int dummy_int(p) unsigned int p; { return p; }
8043 unsigned short dummy_short(p) unsigned short p; { return p; }
8044 int main()
8045 {
8046         double f;
8047         unsigned long along;
8048         unsigned int aint;
8049         unsigned short ashort;
8050         int result = 0;
8051         char str[16];
8052         
8053         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8054            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8055            optimized the whole file away
8056         */
8057         /* Store the number in a writable string for gcc to pass to 
8058            sscanf under HP/UX.
8059         */
8060         sprintf(str, "-123");
8061         sscanf(str, "%lf", &f);  /* f = -123.; */
8062
8063         signal(SIGFPE, blech);
8064         along = (unsigned long)f;
8065         aint = (unsigned int)f;
8066         ashort = (unsigned short)f;
8067         if (along != (unsigned long)-123)
8068                 result |= 1;
8069         if (aint != (unsigned int)-123)
8070                 result |= 1;
8071         if (ashort != (unsigned short)-123)
8072                 result |= 1;
8073         sprintf(str, "1073741824.");
8074         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8075         f = f + f;
8076         along = 0;
8077         along = (unsigned long)f;
8078         if (along != 0x80000000)
8079                 result |= 2;
8080         f -= 1.;
8081         along = 0;
8082         along = (unsigned long)f;
8083         if (along != 0x7fffffff)
8084                 result |= 1;
8085         f += 2.;
8086         along = 0;
8087         along = (unsigned long)f;
8088         if (along != 0x80000001)
8089                 result |= 2;
8090         if (result)
8091                 exit(result);
8092         signal(SIGFPE, blech_in_list);
8093         sprintf(str, "123.");
8094         sscanf(str, "%lf", &f);  /* f = 123.; */
8095         along = dummy_long((unsigned long)f);
8096         aint = dummy_int((unsigned int)f);
8097         ashort = dummy_short((unsigned short)f);
8098         if (along != (unsigned long)123)
8099                 result |= 4;
8100         if (aint != (unsigned int)123)
8101                 result |= 4;
8102         if (ashort != (unsigned short)123)
8103                 result |= 4;
8104         exit(result);
8105
8106 }
8107 EOCP
8108 set try
8109 if eval $compile_ok; then
8110         ./try
8111         castflags=$?
8112 else
8113         echo "(I can't seem to compile the test program--assuming it can't)"
8114         castflags=7
8115 fi
8116 case "$castflags" in
8117 0)      val="$define"
8118         echo "Yup, it can."
8119         ;;
8120 *)      val="$undef"
8121         echo "Nope, it can't."
8122         ;;
8123 esac
8124 set d_castneg
8125 eval $setvar
8126 $rm -f try.*
8127
8128 : see if vprintf exists
8129 echo " "
8130 if set vprintf val -f d_vprintf; eval $csym; $val; then
8131         echo 'vprintf() found.' >&4
8132         val="$define"
8133         $cat >vprintf.c <<'EOF'
8134 #include <varargs.h>
8135
8136 int main() { xxx("foo"); }
8137
8138 xxx(va_alist)
8139 va_dcl
8140 {
8141         va_list args;
8142         char buf[10];
8143
8144         va_start(args);
8145         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8146 }
8147 EOF
8148         set vprintf
8149         if eval $compile && ./vprintf; then
8150                 echo "Your vsprintf() returns (int)." >&4
8151                 val2="$undef"
8152         else
8153                 echo "Your vsprintf() returns (char*)." >&4
8154                 val2="$define"
8155         fi
8156 else
8157         echo 'vprintf() NOT found.' >&4
8158                 val="$undef"
8159                 val2="$undef"
8160 fi
8161 set d_vprintf
8162 eval $setvar
8163 val=$val2
8164 set d_charvspr
8165 eval $setvar
8166
8167 : see if chown exists
8168 set chown d_chown
8169 eval $inlibc
8170
8171 : see if chroot exists
8172 set chroot d_chroot
8173 eval $inlibc
8174
8175 : see if chsize exists
8176 set chsize d_chsize
8177 eval $inlibc
8178
8179 : check for const keyword
8180 echo " "
8181 echo 'Checking to see if your C compiler knows about "const"...' >&4
8182 $cat >const.c <<'EOCP'
8183 typedef struct spug { int drokk; } spug;
8184 int main()
8185 {
8186         const char *foo;
8187         const spug y;
8188 }
8189 EOCP
8190 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8191         val="$define"
8192         echo "Yup, it does."
8193 else
8194         val="$undef"
8195         echo "Nope, it doesn't."
8196 fi
8197 set d_const
8198 eval $setvar
8199
8200 : see if crypt exists
8201 echo " "
8202 if set crypt val -f d_crypt; eval $csym; $val; then
8203         echo 'crypt() found.' >&4
8204         val="$define"
8205         cryptlib=''
8206 else
8207         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8208         if $test -z "$cryptlib"; then
8209                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8210         else
8211                 cryptlib=-lcrypt
8212         fi
8213         if $test -z "$cryptlib"; then
8214                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8215         else
8216                 cryptlib=-lcrypt
8217         fi
8218         if $test -z "$cryptlib"; then
8219                 cryptlib=`./loc libcrypt$_a "" $libpth`
8220         else
8221                 cryptlib=-lcrypt
8222         fi
8223         if $test -z "$cryptlib"; then
8224                 echo 'crypt() NOT found.' >&4
8225                 val="$undef"
8226         else
8227                 val="$define"
8228         fi
8229 fi
8230 set d_crypt
8231 eval $setvar
8232
8233 : get csh whereabouts
8234 case "$csh" in
8235 'csh') val="$undef" ;;
8236 *) val="$define" ;;
8237 esac
8238 set d_csh
8239 eval $setvar
8240 : Respect a hint or command line value for full_csh.
8241 case "$full_csh" in
8242 '') full_csh=$csh ;;
8243 esac
8244
8245 : see if cuserid exists
8246 set cuserid d_cuserid
8247 eval $inlibc
8248
8249 : see if this is a limits.h system
8250 set limits.h i_limits
8251 eval $inhdr
8252
8253 : see if this is a float.h system
8254 set float.h i_float
8255 eval $inhdr
8256
8257 : See if number of significant digits in a double precision number is known
8258 echo " "
8259 $cat >dbl_dig.c <<EOM
8260 #$i_limits I_LIMITS
8261 #$i_float I_FLOAT
8262 #ifdef I_LIMITS
8263 #include <limits.h>
8264 #endif
8265 #ifdef I_FLOAT
8266 #include <float.h>
8267 #endif
8268 #ifdef DBL_DIG
8269 printf("Contains DBL_DIG");
8270 #endif
8271 EOM
8272 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8273 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8274         echo "DBL_DIG found." >&4
8275         val="$define"
8276 else
8277         echo "DBL_DIG NOT found." >&4
8278         val="$undef"
8279 fi
8280 $rm -f dbl_dig.?
8281 set d_dbl_dig
8282 eval $setvar
8283
8284 : see if difftime exists
8285 set difftime d_difftime
8286 eval $inlibc
8287
8288 : see if this is a dirent system
8289 echo " "
8290 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8291         val="$define"
8292         echo "<dirent.h> found." >&4
8293 else
8294         val="$undef"
8295         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8296                 echo "<sys/dir.h> found." >&4
8297                 echo " "
8298         else
8299                 xinc=`./findhdr sys/ndir.h`
8300         fi
8301         echo "<dirent.h> NOT found." >&4
8302 fi
8303 set i_dirent
8304 eval $setvar
8305
8306 : Look for type of directory structure.
8307 echo " "
8308 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8309
8310 case "$direntrytype" in
8311 ''|' ')
8312         case "$i_dirent" in
8313         $define) guess1='struct dirent' ;;
8314         *) guess1='struct direct'  ;;
8315         esac
8316         ;;
8317 *)      guess1="$direntrytype"
8318         ;;
8319 esac
8320
8321 case "$guess1" in
8322 'struct dirent') guess2='struct direct' ;;
8323 *) guess2='struct dirent' ;;
8324 esac
8325                 
8326 if $contains "$guess1" try.c >/dev/null 2>&1; then
8327         direntrytype="$guess1"
8328         echo "Your directory entries are $direntrytype." >&4
8329 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8330         direntrytype="$guess2"
8331         echo "Your directory entries seem to be $direntrytype." >&4
8332 else
8333         echo "I don't recognize your system's directory entries." >&4
8334         rp="What type is used for directory entries on this system?"
8335         dflt="$guess1"
8336         . ./myread
8337         direntrytype="$ans"
8338 fi
8339 $rm -f try.c
8340
8341
8342 : see if the directory entry stores field length
8343 echo " "
8344 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8345 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8346         echo "Good, your directory entry keeps length information in d_namlen." >&4
8347         val="$define"
8348 else
8349         echo "Your directory entry does not know about the d_namlen field." >&4
8350         val="$undef"
8351 fi
8352 set d_dirnamlen
8353 eval $setvar
8354 $rm -f try.c
8355
8356 : see if dlerror exists
8357 xxx_runnm="$runnm"
8358 runnm=false
8359 set dlerror d_dlerror
8360 eval $inlibc
8361 runnm="$xxx_runnm"
8362
8363 : see if dlfcn is available
8364 set dlfcn.h i_dlfcn
8365 eval $inhdr
8366
8367 case "$usedl" in
8368 $define|y|true)
8369         $cat << EOM
8370
8371 On a few systems, the dynamically loaded modules that perl generates and uses
8372 will need a different extension than shared libs. The default will probably
8373 be appropriate.
8374
8375 EOM
8376         case "$dlext" in
8377         '')     dflt="$so" ;;
8378         *)      dflt="$dlext" ;;
8379         esac
8380         rp='What is the extension of dynamically loaded modules'
8381         . ./myread
8382         dlext="$ans"
8383         ;;
8384 *)
8385         dlext="none"
8386         ;;
8387 esac
8388
8389 : Check if dlsym need a leading underscore
8390 echo " "
8391 val="$undef"
8392
8393 case "$dlsrc" in
8394 dl_dlopen.xs)
8395         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8396         $cat >dyna.c <<'EOM'
8397 fred () { }
8398 EOM
8399
8400 $cat >fred.c<<EOM
8401
8402 #include <stdio.h>
8403 #$i_dlfcn I_DLFCN
8404 #ifdef I_DLFCN
8405 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8406 #else
8407 #include <sys/types.h>
8408 #include <nlist.h>
8409 #include <link.h>
8410 #endif
8411
8412 extern int fred() ;
8413
8414 int main()
8415 {
8416     void * handle ;
8417     void * symbol ;
8418 #ifndef RTLD_LAZY
8419     int mode = 1 ;
8420 #else
8421     int mode = RTLD_LAZY ;
8422 #endif
8423     handle = dlopen("./dyna.$dlext", mode) ;
8424     if (handle == NULL) {
8425         printf ("1\n") ;
8426         fflush (stdout) ;
8427         exit(0);
8428     }
8429     symbol = dlsym(handle, "fred") ;
8430     if (symbol == NULL) {
8431         /* try putting a leading underscore */
8432         symbol = dlsym(handle, "_fred") ;
8433         if (symbol == NULL) {
8434             printf ("2\n") ;
8435             fflush (stdout) ;
8436             exit(0);
8437         }
8438         printf ("3\n") ;
8439     }
8440     else
8441         printf ("4\n") ;
8442     fflush (stdout) ;
8443     exit(0);
8444 }
8445 EOM
8446         : Call the object file tmp-dyna.o in case dlext=o.
8447         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8448                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8449                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8450                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8451                 xxx=`./fred`
8452                 case $xxx in
8453                 1)      echo "Test program failed using dlopen." >&4
8454                         echo "Perhaps you should not use dynamic loading." >&4;;
8455                 2)      echo "Test program failed using dlsym." >&4
8456                         echo "Perhaps you should not use dynamic loading." >&4;;
8457                 3)      echo "dlsym needs a leading underscore" >&4
8458                         val="$define" ;;
8459                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8460                 esac
8461         else
8462                 echo "I can't compile and run the test program." >&4
8463                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8464         fi
8465         ;;
8466 esac
8467                 
8468 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8469
8470 set d_dlsymun
8471 eval $setvar
8472
8473 hasproto='varname=$1; func=$2; shift; shift;
8474 while $test $# -ge 2; do
8475         case "$1" in
8476         $define) echo "#include <$2>";;
8477         esac ;
8478     shift 2;
8479 done > try.c;
8480 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8481 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8482         echo "$func() prototype found.";
8483         val="$define";
8484 else
8485         echo "$func() prototype NOT found.";
8486         val="$undef";
8487 fi;
8488 set $varname;
8489 eval $setvar;
8490 $rm -f try.c tryout.c'
8491
8492 : see if prototype for drand48 is available
8493 echo " "
8494 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8495 eval $hasproto
8496
8497 : see if dup2 exists
8498 set dup2 d_dup2
8499 eval $inlibc
8500
8501 : see if eaccess exists
8502 set eaccess d_eaccess
8503 eval $inlibc
8504
8505 : see if endgrent exists
8506 set endgrent d_endgrent
8507 eval $inlibc
8508
8509 : see if endhostent exists
8510 set endhostent d_endhent
8511 eval $inlibc
8512
8513 : see if endnetent exists
8514 set endnetent d_endnent
8515 eval $inlibc
8516
8517 : see if endprotoent exists
8518 set endprotoent d_endpent
8519 eval $inlibc
8520
8521 : see if endpwent exists
8522 set endpwent d_endpwent
8523 eval $inlibc
8524
8525 : see if endservent exists
8526 set endservent d_endsent
8527 eval $inlibc
8528
8529 : Locate the flags for 'open()'
8530 echo " "
8531 $cat >open3.c <<'EOCP'
8532 #include <sys/types.h>
8533 #ifdef I_FCNTL
8534 #include <fcntl.h>
8535 #endif
8536 #ifdef I_SYS_FILE
8537 #include <sys/file.h>
8538 #endif
8539 int main() {
8540         if(O_RDONLY);
8541 #ifdef O_TRUNC
8542         exit(0);
8543 #else
8544         exit(1);
8545 #endif
8546 }
8547 EOCP
8548 : check sys/file.h first to get FREAD on Sun
8549 if $test `./findhdr sys/file.h` && \
8550                 set open3 -DI_SYS_FILE && eval $compile; then
8551         h_sysfile=true;
8552         echo "<sys/file.h> defines the O_* constants..." >&4
8553         if ./open3; then
8554                 echo "and you have the 3 argument form of open()." >&4
8555                 val="$define"
8556         else
8557                 echo "but not the 3 argument form of open().  Oh, well." >&4
8558                 val="$undef"
8559         fi
8560 elif $test `./findhdr fcntl.h` && \
8561                 set open3 -DI_FCNTL && eval $compile; then
8562         h_fcntl=true;
8563         echo "<fcntl.h> defines the O_* constants..." >&4
8564         if ./open3; then
8565                 echo "and you have the 3 argument form of open()." >&4
8566                 val="$define"
8567         else
8568                 echo "but not the 3 argument form of open().  Oh, well." >&4
8569                 val="$undef"
8570         fi
8571 else
8572         val="$undef"
8573         echo "I can't find the O_* constant definitions!  You got problems." >&4
8574 fi
8575 set d_open3
8576 eval $setvar
8577 $rm -f open3*
8578
8579 : see which of string.h or strings.h is needed
8580 echo " "
8581 strings=`./findhdr string.h`
8582 if $test "$strings" && $test -r "$strings"; then
8583         echo "Using <string.h> instead of <strings.h>." >&4
8584         val="$define"
8585 else
8586         val="$undef"
8587         strings=`./findhdr strings.h`
8588         if $test "$strings" && $test -r "$strings"; then
8589                 echo "Using <strings.h> instead of <string.h>." >&4
8590         else
8591                 echo "No string header found -- You'll surely have problems." >&4
8592         fi
8593 fi
8594 set i_string
8595 eval $setvar
8596 case "$i_string" in
8597 "$undef") strings=`./findhdr strings.h`;;
8598 *)        strings=`./findhdr string.h`;;
8599 esac
8600
8601 : check for non-blocking I/O stuff
8602 case "$h_sysfile" in
8603 true) echo "#include <sys/file.h>" > head.c;;
8604 *)
8605         case "$h_fcntl" in
8606         true) echo "#include <fcntl.h>" > head.c;;
8607         *) echo "#include <sys/fcntl.h>" > head.c;;
8608         esac
8609         ;;
8610 esac
8611 echo " "
8612 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8613 case "$o_nonblock" in
8614 '')
8615         $cat head.c > try.c
8616         $cat >>try.c <<'EOCP'
8617 #include <stdio.h>
8618 int main() {
8619 #ifdef O_NONBLOCK
8620         printf("O_NONBLOCK\n");
8621         exit(0);
8622 #endif
8623 #ifdef O_NDELAY
8624         printf("O_NDELAY\n");
8625         exit(0);
8626 #endif
8627 #ifdef FNDELAY
8628         printf("FNDELAY\n");
8629         exit(0);
8630 #endif
8631         exit(0);
8632 }
8633 EOCP
8634         set try
8635         if eval $compile_ok; then
8636                 o_nonblock=`./try`
8637                 case "$o_nonblock" in
8638                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8639                 *) echo "Seems like we can use $o_nonblock.";;
8640                 esac
8641         else
8642                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8643         fi
8644         ;;
8645 *) echo "Using $hint value $o_nonblock.";;
8646 esac
8647 $rm -f try try.* .out core
8648
8649 echo " "
8650 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8651 case "$eagain" in
8652 '')
8653         $cat head.c > try.c
8654         $cat >>try.c <<EOCP
8655 #include <errno.h>
8656 #include <sys/types.h>
8657 #include <signal.h>
8658 #include <stdio.h> 
8659 #define MY_O_NONBLOCK $o_nonblock
8660 #ifndef errno  /* XXX need better Configure test */
8661 extern int errno;
8662 #endif
8663 #$i_unistd I_UNISTD
8664 #ifdef I_UNISTD
8665 #include <unistd.h>
8666 #endif
8667 #$i_string I_STRING
8668 #ifdef I_STRING
8669 #include <string.h>
8670 #else
8671 #include <strings.h>
8672 #endif
8673 $signal_t blech(x) int x; { exit(3); }
8674 EOCP
8675         $cat >> try.c <<'EOCP'
8676 int main()
8677 {
8678         int pd[2];
8679         int pu[2];
8680         char buf[1];
8681         char string[100];
8682
8683         pipe(pd);       /* Down: child -> parent */
8684         pipe(pu);       /* Up: parent -> child */
8685         if (0 != fork()) {
8686                 int ret;
8687                 close(pd[1]);   /* Parent reads from pd[0] */
8688                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8689                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8690                         exit(1);
8691                 signal(SIGALRM, blech);
8692                 alarm(5);
8693                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8694                         exit(2);
8695                 sprintf(string, "%d\n", ret);
8696                 write(2, string, strlen(string));
8697                 alarm(0);
8698 #ifdef EAGAIN
8699                 if (errno == EAGAIN) {
8700                         printf("EAGAIN\n");
8701                         goto ok;
8702                 }
8703 #endif
8704 #ifdef EWOULDBLOCK
8705                 if (errno == EWOULDBLOCK)
8706                         printf("EWOULDBLOCK\n");
8707 #endif
8708         ok:
8709                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8710                 sleep(2);                               /* Give it time to close our pipe */
8711                 alarm(5);
8712                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8713                 alarm(0);
8714                 sprintf(string, "%d\n", ret);
8715                 write(3, string, strlen(string));
8716                 exit(0);
8717         }
8718
8719         close(pd[0]);                   /* We write to pd[1] */
8720         close(pu[1]);                   /* We read from pu[0] */
8721         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8722         close(pd[1]);                   /* Pipe pd is now fully closed! */
8723         exit(0);                                /* Bye bye, thank you for playing! */
8724 }
8725 EOCP
8726         set try
8727         if eval $compile_ok; then
8728                 echo "$startsh" >mtry
8729                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8730                 chmod +x mtry
8731                 ./mtry >/dev/null 2>&1
8732                 case $? in
8733                 0) eagain=`$cat try.out`;;
8734                 1) echo "Could not perform non-blocking setting!";;
8735                 2) echo "I did a successful read() for something that was not there!";;
8736                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8737                 *) echo "Something terribly wrong happened during testing.";;
8738                 esac
8739                 rd_nodata=`$cat try.ret`
8740                 echo "A read() system call with no data present returns $rd_nodata."
8741                 case "$rd_nodata" in
8742                 0|-1) ;;
8743                 *)
8744                         echo "(That's peculiar, fixing that to be -1.)"
8745                         rd_nodata=-1
8746                         ;;
8747                 esac
8748                 case "$eagain" in
8749                 '')
8750                         echo "Forcing errno EAGAIN on read() with no data available."
8751                         eagain=EAGAIN
8752                         ;;
8753                 *)
8754                         echo "Your read() sets errno to $eagain when no data is available."
8755                         ;;
8756                 esac
8757                 status=`$cat try.err`
8758                 case "$status" in
8759                 0) echo "And it correctly returns 0 to signal EOF.";;
8760                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8761                 *) echo "However, your read() returns '$status' on EOF??";;
8762                 esac
8763                 val="$define"
8764                 if test "$status" = "$rd_nodata"; then
8765                         echo "WARNING: you can't distinguish between EOF and no data!"
8766                         val="$undef"
8767                 fi
8768         else
8769                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8770                 eagain=EAGAIN
8771         fi
8772         set d_eofnblk
8773         eval $setvar
8774         ;;
8775 *)
8776         echo "Using $hint value $eagain."
8777         echo "Your read() returns $rd_nodata when no data is present."
8778         case "$d_eofnblk" in
8779         "$define") echo "And you can see EOF because read() returns 0.";;
8780         "$undef") echo "But you can't see EOF status from read() returned value.";;
8781         *)
8782                 echo "(Assuming you can't see EOF status from read anyway.)"
8783                 d_eofnblk=$undef
8784                 ;;
8785         esac
8786         ;;
8787 esac
8788 $rm -f try try.* .out core head.c mtry
8789
8790 : see if fchmod exists
8791 set fchmod d_fchmod
8792 eval $inlibc
8793
8794 : see if fchown exists
8795 set fchown d_fchown
8796 eval $inlibc
8797
8798 : see if this is an fcntl system
8799 set fcntl d_fcntl
8800 eval $inlibc
8801
8802 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8803 while $test $# -ge 2; do
8804         case "$1" in
8805         $define) echo "#include <$2>";;
8806         esac ;
8807     shift 2;
8808 done > try.c;
8809 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8810 set try;
8811 if eval $compile; then
8812         val="$define";
8813 else
8814         val="$undef";
8815 fi;
8816 set $varname;
8817 eval $setvar;
8818 $rm -f try.c try.o'
8819
8820 socketlib=''
8821 sockethdr=''
8822 : see whether socket exists
8823 echo " "
8824 $echo $n "Hmm... $c" >&4
8825 if set socket val -f d_socket; eval $csym; $val; then
8826         echo "Looks like you have Berkeley networking support." >&4
8827         d_socket="$define"
8828         if set setsockopt val -f; eval $csym; $val; then
8829                 d_oldsock="$undef"
8830         else
8831                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8832                 d_oldsock="$define"
8833         fi
8834 else
8835         if $contains socklib libc.list >/dev/null 2>&1; then
8836                 echo "Looks like you have Berkeley networking support." >&4
8837                 d_socket="$define"
8838                 : we will have to assume that it supports the 4.2 BSD interface
8839                 d_oldsock="$undef"
8840         else
8841                 echo "You don't have Berkeley networking in libc$_a..." >&4
8842                 if test "X$d_socket" = "X$define"; then
8843                    echo "...but you seem to believe that you have sockets." >&4
8844                 else
8845                         for net in net socket
8846                         do
8847                                 if test -f /usr/lib/lib$net$_a; then
8848                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8849                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8850                                         if $contains socket libc.list >/dev/null 2>&1; then
8851                                                 d_socket="$define"
8852                                                 socketlib="-l$net"
8853                                                 case "$net" in
8854                                                 net)
8855                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8856                                                         sockethdr="-I/usr/netinclude"
8857                                                         ;;
8858                                                 esac
8859                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8860                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8861                                                         d_oldsock="$undef"
8862                                                 else
8863                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8864                                                         d_oldsock="$define"
8865                                                 fi
8866                                                 break
8867                                         fi
8868                                 fi
8869                         done
8870                         if test "X$d_socket" != "X$define"; then
8871                            echo "or anywhere else I see." >&4
8872                            d_socket="$undef"
8873                            d_oldsock="$undef"
8874                         fi
8875                 fi
8876         fi
8877 fi
8878
8879 : see if socketpair exists
8880 set socketpair d_sockpair
8881 eval $inlibc
8882
8883
8884 echo " "
8885 echo "Checking the availability of certain socket constants..." >& 4
8886 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8887         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8888         $cat >try.c <<EOF
8889 #include <sys/types.h>
8890 #include <sys/socket.h>
8891 int main() {
8892     int i = $ENUM;
8893 }
8894 EOF
8895         val="$undef"
8896         set try; if eval $compile; then
8897                 val="$define"
8898         fi
8899         set d_${enum}; eval $setvar
8900         $rm -f try.c try
8901 done
8902
8903 : see if sys/select.h has to be included
8904 set sys/select.h i_sysselct
8905 eval $inhdr
8906
8907 : see if we should include time.h, sys/time.h, or both
8908 echo " "
8909 if test "X$timeincl" = X; then
8910         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8911         $echo $n "I'm now running the test program...$c"
8912         $cat >try.c <<'EOCP'
8913 #include <sys/types.h>
8914 #ifdef I_TIME
8915 #include <time.h>
8916 #endif
8917 #ifdef I_SYSTIME
8918 #ifdef SYSTIMEKERNEL
8919 #define KERNEL
8920 #endif
8921 #include <sys/time.h>
8922 #endif
8923 #ifdef I_SYSSELECT
8924 #include <sys/select.h>
8925 #endif
8926 int main()
8927 {
8928         struct tm foo;
8929 #ifdef S_TIMEVAL
8930         struct timeval bar;
8931 #endif
8932 #ifdef S_TIMEZONE
8933         struct timezone tzp;
8934 #endif
8935         if (foo.tm_sec == foo.tm_sec)
8936                 exit(0);
8937 #ifdef S_TIMEVAL
8938         if (bar.tv_sec == bar.tv_sec)
8939                 exit(0);
8940 #endif
8941         exit(1);
8942 }
8943 EOCP
8944         flags=''
8945         for s_timezone in '-DS_TIMEZONE' ''; do
8946         sysselect=''
8947         for s_timeval in '-DS_TIMEVAL' ''; do
8948         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8949         for i_time in '' '-DI_TIME'; do
8950         for i_systime in '-DI_SYSTIME' ''; do
8951                 case "$flags" in
8952                 '') $echo $n ".$c"
8953                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8954                         if eval $compile; then
8955                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8956                                 shift
8957                                 flags="$*"
8958                                 echo " "
8959                                 $echo $n "Succeeded with $flags$c"
8960                         fi
8961                         ;;
8962                 esac
8963         done
8964         done
8965         done
8966         done
8967         done
8968         timeincl=''
8969         echo " "
8970         case "$flags" in
8971         *SYSTIMEKERNEL*) i_systimek="$define"
8972                 timeincl=`./findhdr sys/time.h`
8973                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8974         *) i_systimek="$undef";;
8975         esac
8976         case "$flags" in
8977         *I_TIME*) i_time="$define"
8978                 timeincl=`./findhdr time.h`" $timeincl"
8979                 echo "We'll include <time.h>." >&4;;
8980         *) i_time="$undef";;
8981         esac
8982         case "$flags" in
8983         *I_SYSTIME*) i_systime="$define"
8984                 timeincl=`./findhdr sys/time.h`" $timeincl"
8985                 echo "We'll include <sys/time.h>." >&4;;
8986         *) i_systime="$undef";;
8987         esac
8988         $rm -f try.c try
8989 fi
8990
8991 : check for fd_set items
8992 $cat <<EOM
8993
8994 Checking to see how well your C compiler handles fd_set and friends ...
8995 EOM
8996 $cat >fd_set.c <<EOCP
8997 #$i_systime I_SYS_TIME
8998 #$i_sysselct I_SYS_SELECT
8999 #$d_socket HAS_SOCKET
9000 #include <sys/types.h>
9001 #ifdef HAS_SOCKET
9002 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9003 #endif
9004 #ifdef I_SYS_TIME
9005 #include <sys/time.h>
9006 #endif
9007 #ifdef I_SYS_SELECT
9008 #include <sys/select.h>
9009 #endif
9010 int main() {
9011         fd_set fds;
9012
9013 #ifdef TRYBITS
9014         if(fds.fds_bits);
9015 #endif
9016
9017 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9018         exit(0);
9019 #else
9020         exit(1);
9021 #endif
9022 }
9023 EOCP
9024 set fd_set -DTRYBITS
9025 if eval $compile; then
9026         d_fds_bits="$define"
9027         d_fd_set="$define"
9028         echo "Well, your system knows about the normal fd_set typedef..." >&4
9029         if ./fd_set; then
9030                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9031                 d_fd_macros="$define"
9032         else
9033                 $cat >&4 <<'EOM'
9034 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9035 EOM
9036                 d_fd_macros="$undef"
9037         fi
9038 else
9039         $cat <<'EOM'
9040 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9041 EOM
9042         set fd_set
9043         if eval $compile; then
9044                 d_fds_bits="$undef"
9045                 d_fd_set="$define"
9046                 echo "Well, your system has some sort of fd_set available..." >&4
9047                 if ./fd_set; then
9048                         echo "and you have the normal fd_set macros." >&4
9049                         d_fd_macros="$define"
9050                 else
9051                         $cat <<'EOM'
9052 but not the normal fd_set macros!  Gross!  More work for me...
9053 EOM
9054                         d_fd_macros="$undef"
9055                 fi
9056         else
9057         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9058                 d_fd_set="$undef"
9059                 d_fds_bits="$undef"
9060                 d_fd_macros="$undef"
9061         fi
9062 fi
9063 $rm -f fd_set*
9064
9065 : see if fgetpos exists
9066 set fgetpos d_fgetpos
9067 eval $inlibc
9068
9069 : see if flock exists
9070 set flock d_flock
9071 eval $inlibc
9072
9073 : see if fork exists
9074 set fork d_fork
9075 eval $inlibc
9076
9077 : see if pathconf exists
9078 set pathconf d_pathconf
9079 eval $inlibc
9080
9081 : see if fpathconf exists
9082 set fpathconf d_fpathconf
9083 eval $inlibc
9084
9085
9086 : check for fpos64_t
9087 echo " "
9088 echo "Checking to see if you have fpos64_t..." >&4
9089 $cat >try.c <<EOCP
9090 #include <stdio.h>
9091 int main() { fpos64_t x = 7; }
9092 EOCP
9093 set try
9094 if eval $compile; then
9095         val="$define"
9096         echo "You have fpos64_t."
9097 else
9098         val="$undef"
9099         echo "You do not have fpos64_t."
9100         case "$fpossize" in
9101         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9102         esac
9103 fi
9104 $rm -f try.* try
9105 set d_fpos64_t
9106 eval $setvar
9107
9108 : see if frexpl exists
9109 set frexpl d_frexpl
9110 eval $inlibc
9111
9112 hasstruct='varname=$1; struct=$2; shift; shift;
9113 while $test $# -ge 2; do
9114         case "$1" in
9115         $define) echo "#include <$2>";;
9116         esac ;
9117     shift 2;
9118 done > try.c;
9119 echo "int main () { struct $struct foo; }" >> try.c;
9120 set try;
9121 if eval $compile; then
9122         val="$define";
9123 else
9124         val="$undef";
9125 fi;
9126 set $varname;
9127 eval $setvar;
9128 $rm -f try.c try.o'
9129
9130 : see if this is a sys/param system
9131 set sys/param.h i_sysparam
9132 eval $inhdr
9133
9134 : see if this is a sys/mount.h system
9135 set sys/mount.h i_sysmount
9136 eval $inhdr
9137
9138 : see if sys/types.h has to be included
9139 set sys/types.h i_systypes
9140 eval $inhdr
9141
9142
9143 echo " "
9144 echo "Checking to see if your system supports struct fs_data..." >&4
9145 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9146 eval $hasstruct
9147 case "$d_fs_data_s" in
9148 "$define")      echo "Yes, it does."   ;;
9149 *)              echo "No, it doesn't." ;;
9150 esac
9151
9152 : see if fseeko exists
9153 set fseeko d_fseeko
9154 eval $inlibc
9155 case "$longsize" in
9156 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9157 esac
9158
9159 : see if fsetpos exists
9160 set fsetpos d_fsetpos
9161 eval $inlibc
9162
9163
9164 : see if fstatfs exists
9165 set fstatfs d_fstatfs
9166 eval $inlibc
9167
9168
9169 : see if statvfs exists
9170 set statvfs d_statvfs
9171 eval $inlibc
9172
9173 : see if fstatvfs exists
9174 set fstatvfs d_fstatvfs
9175 eval $inlibc
9176
9177
9178 : see if ftello exists
9179 set ftello d_ftello
9180 eval $inlibc
9181 case "$longsize" in
9182 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9183 esac
9184
9185 : see if getcwd exists
9186 set getcwd d_getcwd
9187 eval $inlibc
9188
9189 : see if getespwnam exists
9190 set getespwnam d_getespwnam
9191 eval $inlibc
9192
9193 : see if getespwnam exists
9194 set getespwnam d_getespwnam
9195 eval $inlibc
9196
9197
9198 : see if getfsstat exists
9199 set getfsstat d_getfsstat
9200 eval $inlibc
9201
9202 : see if getgrent exists
9203 set getgrent d_getgrent
9204 eval $inlibc
9205
9206 : see if gethostbyaddr exists
9207 set gethostbyaddr d_gethbyaddr
9208 eval $inlibc
9209
9210 : see if gethostbyname exists
9211 set gethostbyname d_gethbyname
9212 eval $inlibc
9213
9214 : see if gethostent exists
9215 set gethostent d_gethent
9216 eval $inlibc
9217
9218 : see how we will look up host name
9219 echo " "
9220 call=''
9221 if set gethostname val -f d_gethname; eval $csym; $val; then
9222         echo 'gethostname() found.' >&4
9223         d_gethname="$define"
9224         call=gethostname
9225 fi
9226 if set uname val -f d_uname; eval $csym; $val; then
9227         if ./xenix; then
9228                 $cat <<'EOM'
9229 uname() was found, but you're running xenix, and older versions of xenix
9230 have a broken uname(). If you don't really know whether your xenix is old
9231 enough to have a broken system call, use the default answer.
9232
9233 EOM
9234                 dflt=y
9235                 case "$d_uname" in
9236                 "$define") dflt=n;;
9237                 esac
9238                 rp='Is your uname() broken?'
9239                 . ./myread
9240                 case "$ans" in
9241                 n*) d_uname="$define"; call=uname;;
9242                 esac
9243         else
9244                 echo 'uname() found.' >&4
9245                 d_uname="$define"
9246                 case "$call" in
9247                 '') call=uname ;;
9248                 esac
9249         fi
9250 fi
9251 case "$d_gethname" in
9252 '') d_gethname="$undef";;
9253 esac
9254 case "$d_uname" in
9255 '') d_uname="$undef";;
9256 esac
9257 case "$d_uname$d_gethname" in
9258 *define*)
9259         dflt=n
9260         cat <<EOM
9261  
9262 Every now and then someone has a $call() that lies about the hostname
9263 but can't be fixed for political or economic reasons.  If you wish, I can
9264 pretend $call() isn't there and maybe compute hostname at run-time
9265 thanks to the '$phostname' command.
9266
9267 EOM
9268         rp="Shall I ignore $call() from now on?"
9269         . ./myread
9270         case "$ans" in
9271         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9272         esac;;
9273 esac
9274 case "$phostname" in
9275 '') aphostname='';;
9276 *) case "$aphostname" in
9277         /*) ;;
9278         *) set X $phostname
9279                 shift
9280                 file=$1
9281                 shift
9282                 file=`./loc $file $file $pth`
9283                 aphostname=`echo $file $*`
9284                 ;;
9285         esac
9286         ;;
9287 esac
9288 case "$d_uname$d_gethname" in
9289 *define*) ;;
9290 *)
9291         case "$phostname" in
9292         '')
9293                 echo "There will be no way for $package to get your hostname." >&4;;
9294         *)
9295         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9296                 ;;
9297         esac;;
9298 esac
9299 case "$d_phostname" in
9300 '') d_phostname="$undef";;
9301 esac
9302
9303 : see if this is a netdb.h system
9304 set netdb.h i_netdb
9305 eval $inhdr
9306
9307 : see if prototypes for various gethostxxx netdb.h functions are available
9308 echo " "
9309 set d_gethostprotos gethostent $i_netdb netdb.h
9310 eval $hasproto
9311
9312 : see if getlogin exists
9313 set getlogin d_getlogin
9314 eval $inlibc
9315
9316 : see if getmnt exists
9317 set getmnt d_getmnt
9318 eval $inlibc
9319
9320 : see if getmntent exists
9321 set getmntent d_getmntent
9322 eval $inlibc
9323
9324 : see if getnetbyaddr exists
9325 set getnetbyaddr d_getnbyaddr
9326 eval $inlibc
9327
9328 : see if getnetbyname exists
9329 set getnetbyname d_getnbyname
9330 eval $inlibc
9331
9332 : see if getnetent exists
9333 set getnetent d_getnent
9334 eval $inlibc
9335
9336 : see if prototypes for various getnetxxx netdb.h functions are available
9337 echo " "
9338 set d_getnetprotos getnetent $i_netdb netdb.h
9339 eval $hasproto
9340
9341
9342 : see if getprotobyname exists
9343 set getprotobyname d_getpbyname
9344 eval $inlibc
9345
9346 : see if getprotobynumber exists
9347 set getprotobynumber d_getpbynumber
9348 eval $inlibc
9349
9350 : see if getprotoent exists
9351 set getprotoent d_getpent
9352 eval $inlibc
9353
9354 : see if getpgid exists
9355 set getpgid d_getpgid
9356 eval $inlibc
9357
9358 : see if getpgrp2 exists
9359 set getpgrp2 d_getpgrp2
9360 eval $inlibc
9361
9362 : see if getppid exists
9363 set getppid d_getppid
9364 eval $inlibc
9365
9366 : see if getpriority exists
9367 set getpriority d_getprior
9368 eval $inlibc
9369
9370 : see if prototypes for various getprotoxxx netdb.h functions are available
9371 echo " "
9372 set d_getprotoprotos getprotoent $i_netdb netdb.h
9373 eval $hasproto
9374
9375 : see if getprpwnam exists
9376 set getprpwnam d_getprpwnam
9377 eval $inlibc
9378
9379 : see if getprpwnam exists
9380 set getprpwnam d_getprpwnam
9381 eval $inlibc
9382
9383 : see if getpwent exists
9384 set getpwent d_getpwent
9385 eval $inlibc
9386
9387
9388 : see if getservbyname exists
9389 set getservbyname d_getsbyname
9390 eval $inlibc
9391
9392 : see if getservbyport exists
9393 set getservbyport d_getsbyport
9394 eval $inlibc
9395
9396 : see if getservent exists
9397 set getservent d_getsent
9398 eval $inlibc
9399
9400 : see if prototypes for various getservxxx netdb.h functions are available
9401 echo " "
9402 set d_getservprotos getservent $i_netdb netdb.h
9403 eval $hasproto
9404
9405 : see if getspnam exists
9406 set getspnam d_getspnam
9407 eval $inlibc
9408
9409 : see if gettimeofday or ftime exists
9410 set gettimeofday d_gettimeod
9411 eval $inlibc
9412 case "$d_gettimeod" in
9413 "$undef")
9414         set ftime d_ftime 
9415         eval $inlibc
9416         ;;
9417 *)
9418         val="$undef"; set d_ftime; eval $setvar
9419         ;;
9420 esac
9421 case "$d_gettimeod$d_ftime" in
9422 "$undef$undef")
9423         echo " "
9424         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9425         ;;
9426 esac
9427
9428 : see if this is an grp system
9429 set grp.h i_grp
9430 eval $inhdr
9431
9432 case "$i_grp" in
9433 $define)
9434         xxx=`./findhdr grp.h`
9435         $cppstdin $cppflags $cppminus < $xxx >$$.h
9436
9437         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9438                 val="$define"
9439         else
9440                 val="$undef"
9441         fi
9442         set d_grpasswd
9443         eval $setvar
9444
9445         $rm -f $$.h
9446         ;;
9447 *)
9448         val="$undef";
9449         set d_grpasswd; eval $setvar
9450         ;;
9451 esac
9452
9453 : see if hasmntopt exists
9454 set hasmntopt d_hasmntopt
9455 eval $inlibc
9456
9457 : see if this is a netinet/in.h or sys/in.h system
9458 set netinet/in.h i_niin sys/in.h i_sysin
9459 eval $inhdr
9460
9461 : see if arpa/inet.h has to be included
9462 set arpa/inet.h i_arpainet
9463 eval $inhdr
9464
9465 : see if htonl --and friends-- exists
9466 val=''
9467 set htonl val
9468 eval $inlibc
9469
9470 : Maybe they are macros.
9471 case "$val" in
9472 $undef)
9473         $cat >htonl.c <<EOM
9474 #include <stdio.h>
9475 #include <sys/types.h>
9476 #$i_niin I_NETINET_IN
9477 #$i_sysin I_SYS_IN
9478 #$i_arpainet I_ARPA_INET
9479 #ifdef I_NETINET_IN
9480 #include <netinet/in.h>
9481 #endif
9482 #ifdef I_SYS_IN
9483 #include <sys/in.h>
9484 #endif
9485 #ifdef I_ARPA_INET
9486 #include <arpa/inet.h>
9487 #endif
9488 #ifdef htonl
9489 printf("Defined as a macro.");
9490 #endif
9491 EOM
9492         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9493         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9494                 val="$define"
9495                 echo "But it seems to be defined as a macro." >&4
9496         fi
9497         $rm -f htonl.?
9498         ;;
9499 esac
9500 set d_htonl
9501 eval $setvar
9502
9503 : see if iconv exists
9504 set iconv d_iconv
9505 eval $inlibc
9506
9507 : index or strchr
9508 echo " "
9509 if set index val -f; eval $csym; $val; then
9510         if set strchr val -f d_strchr; eval $csym; $val; then
9511                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9512                         val="$define"
9513                         vali="$undef"
9514                         echo "strchr() found." >&4
9515                 else
9516                         val="$undef"
9517                         vali="$define"
9518                         echo "index() found." >&4
9519                 fi
9520         else
9521                 val="$undef"
9522                 vali="$define"
9523                 echo "index() found." >&4
9524         fi
9525 else
9526         if set strchr val -f d_strchr; eval $csym; $val; then
9527                 val="$define"
9528                 vali="$undef"
9529                 echo "strchr() found." >&4
9530         else
9531                 echo "No index() or strchr() found!" >&4
9532                 val="$undef"
9533                 vali="$undef"
9534         fi
9535 fi
9536 set d_strchr; eval $setvar
9537 val="$vali"
9538 set d_index; eval $setvar
9539
9540 : check whether inet_aton exists
9541 set inet_aton d_inetaton
9542 eval $inlibc
9543
9544 : see if inttypes.h is available
9545 : we want a real compile instead of Inhdr because some systems
9546 : have an inttypes.h which includes non-existent headers
9547 echo " "
9548 $cat >try.c <<EOCP
9549 #include <inttypes.h>
9550 int main() {
9551         static int32_t foo32 = 0x12345678;
9552 }
9553 EOCP
9554 set try
9555 if eval $compile; then
9556         echo "<inttypes.h> found." >&4
9557         val="$define"
9558 else
9559         echo "<inttypes.h> NOT found." >&4
9560         val="$undef"
9561 fi
9562 $rm -f try.c try
9563 set i_inttypes
9564 eval $setvar
9565
9566 : check for int64_t
9567 echo " "
9568 echo "Checking to see if you have int64_t..." >&4
9569 $cat >try.c <<EOCP
9570 #include <sys/types.h>
9571 #$i_inttypes I_INTTYPES
9572 #ifdef I_INTTYPES
9573 #include <inttypes.h>
9574 #endif
9575 int main() { int64_t x = 7; }
9576 EOCP
9577 set try
9578 if eval $compile; then
9579         val="$define"
9580         echo "You have int64_t."
9581 else
9582         val="$undef"
9583         echo "You do not have int64_t."
9584 fi
9585 $rm -f try try.*
9586 set d_int64_t
9587 eval $setvar
9588
9589 : Look for isascii
9590 echo " "
9591 $cat >isascii.c <<'EOCP'
9592 #include <stdio.h>
9593 #include <ctype.h>
9594 int main() {
9595         int c = 'A';
9596         if (isascii(c))
9597                 exit(0);
9598         else
9599                 exit(1);
9600 }
9601 EOCP
9602 set isascii
9603 if eval $compile; then
9604         echo "isascii() found." >&4
9605         val="$define"
9606 else
9607         echo "isascii() NOT found." >&4
9608         val="$undef"
9609 fi
9610 set d_isascii
9611 eval $setvar
9612 $rm -f isascii*
9613
9614 : see if isnan exists
9615 set isnan d_isnan
9616 eval $inlibc
9617
9618 : see if isnanl exists
9619 set isnanl d_isnanl
9620 eval $inlibc
9621
9622 : see if killpg exists
9623 set killpg d_killpg
9624 eval $inlibc
9625
9626 : see if lchown exists
9627 echo " "
9628 $cat > try.c <<'EOCP'
9629 /* System header to define __stub macros and hopefully few prototypes,
9630     which can conflict with char lchown(); below.  */
9631 #include <assert.h>
9632 /* Override any gcc2 internal prototype to avoid an error.  */
9633 /* We use char because int might match the return type of a gcc2
9634    builtin and then its argument prototype would still apply.  */
9635 char lchown();
9636 int main() {
9637     /*  The GNU C library defines this for functions which it implements
9638         to always fail with ENOSYS.  Some functions are actually named
9639         something starting with __ and the normal name is an alias.  */
9640 #if defined (__stub_lchown) || defined (__stub___lchown)
9641 choke me
9642 #else
9643 lchown();
9644 #endif
9645 ; return 0; }
9646 EOCP
9647 set try
9648 if eval $compile; then
9649     $echo "lchown() found." >&4
9650     val="$define"
9651 else
9652     $echo "lchown() NOT found." >&4
9653     val="$undef"
9654 fi
9655 set d_lchown
9656 eval $setvar
9657
9658 : See if number of significant digits in a double precision number is known
9659 echo " "
9660 $cat >ldbl_dig.c <<EOM
9661 #$i_limits I_LIMITS
9662 #$i_float I_FLOAT
9663 #ifdef I_LIMITS
9664 #include <limits.h>
9665 #endif
9666 #ifdef I_FLOAT
9667 #include <float.h>
9668 #endif
9669 #ifdef LDBL_DIG
9670 printf("Contains LDBL_DIG");
9671 #endif
9672 EOM
9673 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9674 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9675         echo "LDBL_DIG found." >&4
9676         val="$define"
9677 else
9678         echo "LDBL_DIG NOT found." >&4
9679         val="$undef"
9680 fi
9681 $rm -f ldbl_dig.?
9682 set d_ldbl_dig
9683 eval $setvar
9684
9685 : see if link exists
9686 set link d_link
9687 eval $inlibc
9688
9689 : see if localeconv exists
9690 set localeconv d_locconv
9691 eval $inlibc
9692
9693 : see if lockf exists
9694 set lockf d_lockf
9695 eval $inlibc
9696
9697 : check for long long
9698 echo " "
9699 echo "Checking to see if you have long long..." >&4
9700 echo 'int main() { long long x = 7; return 0; }' > try.c
9701 set try
9702 if eval $compile; then
9703         val="$define"
9704         echo "You have have long long."
9705 else
9706         val="$undef"
9707         echo "You do not have long long."
9708 fi
9709 $rm try.*
9710 set d_longlong
9711 eval $setvar
9712
9713 : check for length of long long
9714 case "${d_longlong}${longlongsize}" in
9715 $define)
9716         echo " "
9717         echo "Checking to see how big your long longs are..." >&4
9718         $cat >try.c <<'EOCP'
9719 #include <stdio.h>
9720 int main()
9721 {
9722     printf("%d\n", (int)sizeof(long long));
9723     return(0);
9724 }
9725 EOCP
9726         set try
9727         if eval $compile_ok; then
9728                 longlongsize=`./try$exe_ext`
9729                 echo "Your long longs are $longlongsize bytes long."
9730         else
9731                 dflt='8'
9732                 echo " "
9733                 echo "(I can't seem to compile the test program.  Guessing...)"
9734                 rp="What is the size of a long long (in bytes)?"
9735                 . ./myread
9736                 longlongsize="$ans"
9737         fi
9738         if $test "X$longsize" = "X$longlongsize"; then
9739                 echo "(That isn't any different from an ordinary long.)"
9740         fi      
9741         ;;
9742 esac
9743 $rm -f try.* try
9744
9745 : see if prototype for lseek is available
9746 echo " "
9747 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9748 eval $hasproto
9749
9750 : see if lstat exists
9751 set lstat d_lstat
9752 eval $inlibc
9753
9754 : see if madvise exists
9755 set madvise d_madvise
9756 eval $inlibc
9757
9758 : see if mblen exists
9759 set mblen d_mblen
9760 eval $inlibc
9761
9762 : see if mbstowcs exists
9763 set mbstowcs d_mbstowcs
9764 eval $inlibc
9765
9766 : see if mbtowc exists
9767 set mbtowc d_mbtowc
9768 eval $inlibc
9769
9770 : see if memchr exists
9771 set memchr d_memchr
9772 eval $inlibc
9773
9774 : see if memcmp exists
9775 set memcmp d_memcmp
9776 eval $inlibc
9777
9778 : see if memcpy exists
9779 set memcpy d_memcpy
9780 eval $inlibc
9781
9782 : see if memmove exists
9783 set memmove d_memmove
9784 eval $inlibc
9785
9786 : see if memset exists
9787 set memset d_memset
9788 eval $inlibc
9789
9790 : see if mkdir exists
9791 set mkdir d_mkdir
9792 eval $inlibc
9793
9794 : see if mkdtemp exists
9795 set mkdtemp d_mkdtemp
9796 eval $inlibc
9797
9798 : see if mkfifo exists
9799 set mkfifo d_mkfifo
9800 eval $inlibc
9801
9802 : see if mkstemp exists
9803 set mkstemp d_mkstemp
9804 eval $inlibc
9805
9806 : see if mkstemps exists
9807 set mkstemps d_mkstemps
9808 eval $inlibc
9809
9810 : see if mktime exists
9811 set mktime d_mktime
9812 eval $inlibc
9813
9814 : see if this is a sys/mman.h system
9815 set sys/mman.h i_sysmman
9816 eval $inhdr
9817
9818 : see if mmap exists
9819 set mmap d_mmap
9820 eval $inlibc
9821 : see what shmat returns
9822 : default to something harmless
9823 mmaptype='void *'
9824 case "$i_sysmman$d_mmap" in
9825 "$define$define")
9826         $cat >mmap.c <<'END'
9827 #include <sys/mman.h>
9828 void *mmap();
9829 END
9830         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9831                 mmaptype='void *'
9832         else
9833                 mmaptype='caddr_t'
9834         fi
9835         echo "and it returns ($mmaptype)." >&4
9836         ;;
9837 esac
9838
9839
9840
9841 : see if modfl exists
9842 set modfl d_modfl
9843 eval $inlibc
9844
9845 : see if mprotect exists
9846 set mprotect d_mprotect
9847 eval $inlibc
9848
9849 : see if msgctl exists
9850 set msgctl d_msgctl
9851 eval $inlibc
9852
9853 : see if msgget exists
9854 set msgget d_msgget
9855 eval $inlibc
9856
9857 : see if msgsnd exists
9858 set msgsnd d_msgsnd
9859 eval $inlibc
9860
9861 : see if msgrcv exists
9862 set msgrcv d_msgrcv
9863 eval $inlibc
9864
9865 : see how much of the 'msg*(2)' library is present.
9866 h_msg=true
9867 echo " "
9868 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9869 *"$undef"*) h_msg=false;;
9870 esac
9871 case "$osname" in
9872 freebsd)
9873     case "`ipcs 2>&1`" in
9874     "SVID messages"*"not configured"*)
9875         echo "Your $osname does not have the msg*(2) configured." >&4
9876         h_msg=false
9877         val="$undef"
9878         set msgctl d_msgctl
9879         eval $setvar
9880         set msgget d_msgget
9881         eval $setvar
9882         set msgsnd d_msgsnd
9883         eval $setvar
9884         set msgrcv d_msgrcv
9885         eval $setvar
9886         ;;
9887     esac
9888     ;;
9889 esac
9890 : we could also check for sys/ipc.h ...
9891 if $h_msg && $test `./findhdr sys/msg.h`; then
9892         echo "You have the full msg*(2) library." >&4
9893         val="$define"
9894 else
9895         echo "You don't have the full msg*(2) library." >&4
9896         val="$undef"
9897 fi
9898 set d_msg
9899 eval $setvar
9900
9901 : see if msync exists
9902 set msync d_msync
9903 eval $inlibc
9904
9905 : see if munmap exists
9906 set munmap d_munmap
9907 eval $inlibc
9908
9909 : see if nice exists
9910 set nice d_nice
9911 eval $inlibc
9912
9913
9914 echo " "
9915 echo "Checking which 64-bit integer type we could use..." >&4
9916
9917 case "$intsize" in
9918 8) val=int
9919    set quadtype
9920    eval $setvar
9921    val='"unsigned int"'
9922    set uquadtype
9923    eval $setvar
9924    quadkind=1
9925    ;;
9926 *) case "$longsize" in
9927    8) val=long
9928       set quadtype
9929       eval $setvar
9930       val='"unsigned long"'
9931       set uquadtype
9932       eval $setvar
9933       quadkind=2
9934       ;;
9935    *) case "$d_longlong:$longlongsize" in
9936       define:8)
9937         val='"long long"'
9938         set quadtype
9939         eval $setvar
9940         val='"unsigned long long"'
9941         set uquadtype
9942         eval $setvar
9943         quadkind=3
9944         ;;
9945       *) case "$d_int64_t" in
9946          define)
9947            val=int64_t
9948            set quadtype
9949            eval $setvar
9950            val=uint64_t
9951            set uquadtype
9952            eval $setvar
9953            quadkind=4
9954            ;;
9955          esac
9956          ;;
9957       esac
9958       ;;
9959    esac
9960    ;;
9961 esac
9962
9963 case "$quadtype" in
9964 '')     echo "Alas, no 64-bit integer types in sight." >&4
9965         d_quad="$undef"
9966         ;;
9967 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9968             verb="will"
9969         else
9970             verb="could"
9971         fi
9972         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9973         d_quad="$define"
9974         ;;
9975 esac
9976
9977 : check for length of character
9978 echo " "
9979 case "$charsize" in
9980 '')
9981         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9982         $cat >try.c <<'EOCP'
9983 #include <stdio.h>
9984 int main()
9985 {
9986     printf("%d\n", (int)sizeof(char));
9987     exit(0);
9988 }
9989 EOCP
9990         set try
9991         if eval $compile_ok; then
9992                 dflt=`./try`
9993         else
9994                 dflt='1'
9995                 echo "(I can't seem to compile the test program.  Guessing...)"
9996         fi
9997         ;;
9998 *)
9999         dflt="$charsize"
10000         ;;
10001 esac
10002 rp="What is the size of a character (in bytes)?"
10003 . ./myread
10004 charsize="$ans"
10005 $rm -f try.c try
10006
10007
10008 echo " "
10009 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10010
10011 case "$use64bitint:$d_quad:$quadtype" in
10012 define:define:?*)
10013         ivtype="$quadtype"
10014         uvtype="$uquadtype"
10015         ivsize=8
10016         uvsize=8
10017         ;;
10018 *)      ivtype="long"
10019         uvtype="unsigned long"
10020         ivsize=$longsize
10021         uvsize=$longsize
10022         ;;
10023 esac
10024
10025 case "$uselongdouble:$d_longdbl" in
10026 define:define)
10027         nvtype="long double"
10028         nvsize=$longdblsize
10029         ;;
10030 *)      nvtype=double
10031         nvsize=$doublesize
10032         ;;
10033 esac
10034
10035 $echo "(IV will be "$ivtype", $ivsize bytes)"
10036 $echo "(UV will be "$uvtype", $uvsize bytes)"
10037 $echo "(NV will be "$nvtype", $nvsize bytes)"
10038
10039 $cat >try.c <<EOCP
10040 #$i_inttypes I_INTTYPES
10041 #ifdef I_INTTYPES
10042 #include <inttypes.h>
10043 #endif
10044 #include <stdio.h>
10045 int main() {
10046 #ifdef INT8
10047    int8_t i =  INT8_MAX;
10048   uint8_t u = UINT8_MAX;
10049   printf("int8_t\n");
10050 #endif
10051 #ifdef INT16
10052    int16_t i =  INT16_MAX;
10053   uint16_t i = UINT16_MAX;
10054   printf("int16_t\n");
10055 #endif
10056 #ifdef INT32
10057    int32_t i =  INT32_MAX;
10058   uint32_t u = UINT32_MAX;
10059   printf("int32_t\n");
10060 #endif
10061 }
10062 EOCP
10063
10064 case "$i8type" in
10065 '')     case "$charsize" in
10066         1)      i8type=char
10067                 u8type="unsigned char"
10068                 i8size=$charsize
10069                 u8size=$charsize
10070                 ;;
10071         esac
10072         ;;
10073 esac
10074 case "$i8type" in
10075 '')     set try -DINT8
10076         if eval $compile; then
10077                 case "`./try$exe_ext`" in
10078                 int8_t) i8type=int8_t
10079                         u8type=uint8_t
10080                         i8size=1
10081                         u8size=1
10082                         ;;
10083                 esac
10084         fi
10085         ;;
10086 esac
10087 case "$i8type" in
10088 '')     if $test $charsize -ge 1; then
10089                 i8type=char
10090                 u8type="unsigned char"
10091                 i8size=$charsize
10092                 u8size=$charsize
10093         fi
10094         ;;
10095 esac
10096
10097 case "$i16type" in
10098 '')     case "$shortsize" in
10099         2)      i16type=short
10100                 u16type="unsigned short"
10101                 i16size=$shortsize
10102                 u16size=$shortsize
10103                 ;;
10104         esac
10105         ;;
10106 esac
10107 case "$i16type" in
10108 '')     set try -DINT16
10109         if eval $compile; then
10110                 case "`./try$exe_ext`" in
10111                 int16_t)
10112                         i16type=int16_t
10113                         u16type=uint16_t
10114                         i16size=2
10115                         u16size=2
10116                         ;;
10117                 esac
10118         fi
10119         ;;
10120 esac
10121 case "$i16type" in
10122 '')     if $test $shortsize -ge 2; then
10123                 i16type=short
10124                 u16type="unsigned short"
10125                 i16size=$shortsize
10126                 u16size=$shortsize
10127         fi
10128         ;;
10129 esac
10130
10131 case "$i32type" in
10132 '')     case "$longsize" in
10133         4)      i32type=long
10134                 u32type="unsigned long"
10135                 i32size=$longsize
10136                 u32size=$longsize
10137                 ;;
10138         *)      case "$intsize" in
10139                 4)      i32type=int
10140                         u32type="unsigned int"
10141                         i32size=$intsize
10142                         u32size=$intsize
10143                         ;;
10144                 esac
10145                 ;;
10146         esac
10147         ;;
10148 esac
10149 case "$i32type" in
10150 '')     set try -DINT32
10151         if eval $compile; then
10152                 case "`./try$exe_ext`" in
10153                 int32_t)
10154                         i32type=int32_t
10155                         u32type=uint32_t
10156                         i32size=4
10157                         u32size=4
10158                         ;;
10159                 esac
10160         fi
10161         ;;
10162 esac
10163 case "$i32type" in
10164 '')     if $test $intsize -ge 4; then
10165                 i32type=int
10166                 u32type="unsigned int"
10167                 i32size=$intsize
10168                 u32size=$intsize
10169         fi
10170         ;;
10171 esac
10172
10173 case "$i64type" in
10174 '')     case "$d_quad:$quadtype" in
10175         define:?*)
10176                 i64type="$quadtype"
10177                 u64type="$uquadtype"
10178                 i64size=8
10179                 u64size=8
10180                 ;;
10181         esac
10182         ;;
10183 esac
10184
10185 $echo "Checking whether your NVs can preserve your UVs..." >&4
10186 $cat <<EOP >try.c
10187 #include <stdio.h>
10188 int main() {
10189     $uvtype k = ($uvtype)~0, l;
10190     $nvtype d;
10191     l = k;
10192     d = ($nvtype)l;
10193     l = ($uvtype)d;
10194     if (l == k)
10195        printf("preserve\n");
10196     exit(0);
10197 }
10198 EOP
10199 set try
10200 if eval $compile; then
10201         case "`./try$exe_ext`" in
10202         preserve) d_nv_preserves_uv="$define" ;;
10203         esac
10204 fi      
10205 case "$d_nv_preserves_uv" in
10206 $define) $echo "Yes, they can."  2>&1 ;;
10207 *)       $echo "No, they can't." 2>&1
10208          d_nv_preserves_uv="$undef"
10209          ;;
10210 esac
10211
10212 $rm -f try.* try
10213
10214 case "$d_nv_preserves_uv" in
10215 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10216 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10217         $cat <<EOP >try.c
10218 #include <stdio.h>
10219 int main() {
10220     $uvtype u = 0;
10221     int     n = 8 * $uvsize;
10222     int     i;
10223     for (i = 0; i < n; i++) {
10224       u = u << 1 | ($uvtype)1;
10225       if (($uvtype)($nvtype)u != u)
10226         break;
10227     }
10228     printf("%d\n", i);
10229     exit(0);
10230 }
10231 EOP
10232         set try
10233         if eval $compile; then
10234                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10235         fi
10236         case "$d_nv_preserves_uv_bits" in
10237         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10238         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10239                 d_nv_preserves_uv_bits="$undef"
10240                 ;;
10241         esac
10242         $rm -f try.* try
10243         ;;
10244 esac
10245
10246
10247
10248 : check for off64_t
10249 echo " "
10250 echo "Checking to see if you have off64_t..." >&4
10251 $cat >try.c <<EOCP
10252 #include <sys/types.h>
10253 #include <unistd.h>
10254 int main() { off64_t x = 7; }
10255 EOCP
10256 set try
10257 if eval $compile; then
10258         val="$define"
10259         echo "You have off64_t."
10260 else
10261         val="$undef"
10262         echo "You do not have off64_t."
10263         case "$lseeksize" in
10264         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10265         esac
10266 fi
10267 $rm -f try.* try
10268 set d_off64_t
10269 eval $setvar
10270
10271 : see if POSIX threads are available
10272 set pthread.h i_pthread
10273 eval $inhdr
10274
10275
10276
10277
10278 : how to create joinable pthreads
10279 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10280         echo " "
10281         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10282         $cat >try.c <<'EOCP'
10283 #include <pthread.h>
10284 int main() {
10285     int detachstate = JOINABLE;
10286 }
10287 EOCP
10288         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10289         if eval $compile; then
10290                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10291                 val="$undef" # Yes, undef.
10292                 set d_old_pthread_create_joinable
10293                 eval $setvar
10294                 val=""
10295                 set old_pthread_create_joinable
10296                 eval $setvar
10297         else
10298                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10299                 if eval $compile; then
10300                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10301                         val="$define"
10302                         set d_old_pthread_create_joinable
10303                         eval $setvar
10304                         val=PTHREAD_CREATE_UNDETACHED
10305                         set old_pthread_create_joinable
10306                         eval $setvar
10307                 else            
10308                         set try -DJOINABLE=__UNDETACHED
10309                         if eval $compile; then
10310                                 echo "You seem to use __UNDETACHED." >&4
10311                                 val="$define"
10312                                 set d_old_pthread_create_joinable
10313                                 eval $setvar
10314                                 val=__UNDETACHED
10315                                 set old_pthread_create_joinable
10316                                 eval $setvar
10317                         else
10318                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10319                                 val="$define"
10320                                 set d_old_pthread_create_joinable
10321                                 eval $setvar
10322                                 val=0
10323                                 set old_pthread_create_joinable
10324                                 eval $setvar
10325                         fi
10326                 fi
10327         fi
10328         $rm -f try try.*
10329 else
10330     d_old_pthread_create_joinable="$undef"
10331     old_pthread_create_joinable=""
10332 fi
10333
10334 : see if pause exists
10335 set pause d_pause
10336 eval $inlibc
10337
10338 : see if pipe exists
10339 set pipe d_pipe
10340 eval $inlibc
10341
10342 : see if poll exists
10343 set poll d_poll
10344 eval $inlibc
10345
10346
10347 : see whether the various POSIXish _yields exist
10348 $cat >try.c <<EOP
10349 #include <pthread.h>
10350 #include <stdio.h>
10351 int main() {
10352 #ifdef SCHED_YIELD
10353         sched_yield();
10354 #else
10355 #ifdef PTHREAD_YIELD
10356         pthread_yield();
10357 #else
10358 #ifdef PTHREAD_YIELD_NULL
10359         pthread_yield(NULL);
10360 #endif
10361 #endif
10362 #endif
10363 }
10364 EOP
10365 : see if sched_yield exists
10366 set try -DSCHED_YIELD
10367 if eval $compile; then
10368     val="$define"
10369     sched_yield='sched_yield()'
10370 else
10371     val="$undef"
10372 fi
10373 case "$usethreads" in
10374 $define)
10375         case "$val" in
10376         $define) echo 'sched_yield() found.' >&4        ;;
10377         *)       echo 'sched_yield() NOT found.' >&4    ;;
10378         esac
10379 esac
10380 set d_sched_yield
10381 eval $setvar
10382
10383 : see if pthread_yield exists
10384 set try -DPTHREAD_YIELD
10385 if eval $compile; then
10386     val="$define"
10387     case "$sched_yield" in
10388     '') sched_yield='pthread_yield()' ;;
10389     esac
10390 else
10391     set try -DPTHREAD_YIELD_NULL
10392     if eval $compile; then
10393         val="$define"
10394         case "$sched_yield" in
10395         '') sched_yield='pthread_yield(NULL)' ;;
10396         esac
10397     else
10398         val="$undef"
10399     fi
10400 fi
10401 case "$usethreads" in
10402 $define)
10403         case "$val" in
10404         $define) echo 'pthread_yield() found.' >&4      ;;
10405         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10406         esac
10407         ;;
10408 esac
10409 set d_pthread_yield
10410 eval $setvar
10411
10412 case "$sched_yield" in
10413 '') sched_yield=undef ;;
10414 esac
10415
10416 $rm -f try try.*
10417
10418 : see if this is a pwd.h system
10419 set pwd.h i_pwd
10420 eval $inhdr
10421
10422 case "$i_pwd" in
10423 $define)
10424         xxx=`./findhdr pwd.h`
10425         $cppstdin $cppflags $cppminus < $xxx >$$.h
10426
10427         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10428                 val="$define"
10429         else
10430                 val="$undef"
10431         fi
10432         set d_pwquota
10433         eval $setvar
10434
10435         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10436                 val="$define"
10437         else
10438                 val="$undef"
10439         fi
10440         set d_pwage
10441         eval $setvar
10442
10443         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10444                 val="$define"
10445         else
10446                 val="$undef"
10447         fi
10448         set d_pwchange
10449         eval $setvar
10450
10451         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10452                 val="$define"
10453         else
10454                 val="$undef"
10455         fi
10456         set d_pwclass
10457         eval $setvar
10458
10459         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10460                 val="$define"
10461         else
10462                 val="$undef"
10463         fi
10464         set d_pwexpire
10465         eval $setvar
10466
10467         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10468                 val="$define"
10469         else
10470                 val="$undef"
10471         fi
10472         set d_pwcomment
10473         eval $setvar
10474
10475         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10476                 val="$define"
10477         else
10478                 val="$undef"
10479         fi
10480         set d_pwgecos
10481         eval $setvar
10482
10483         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10484                 val="$define"
10485         else
10486                 val="$undef"
10487         fi
10488         set d_pwpasswd
10489         eval $setvar
10490
10491         $rm -f $$.h
10492         ;;
10493 *)
10494         val="$undef"; 
10495         set d_pwquota; eval $setvar
10496         set d_pwage; eval $setvar
10497         set d_pwchange; eval $setvar
10498         set d_pwclass; eval $setvar
10499         set d_pwexpire; eval $setvar
10500         set d_pwcomment; eval $setvar
10501         set d_pwgecos; eval $setvar
10502         set d_pwpasswd; eval $setvar
10503         ;;
10504 esac
10505
10506 : see if readdir and friends exist
10507 set readdir d_readdir
10508 eval $inlibc
10509 set seekdir d_seekdir
10510 eval $inlibc
10511 set telldir d_telldir
10512 eval $inlibc
10513 set rewinddir d_rewinddir
10514 eval $inlibc
10515
10516 : see if readlink exists
10517 set readlink d_readlink
10518 eval $inlibc
10519
10520 : see if rename exists
10521 set rename d_rename
10522 eval $inlibc
10523
10524 : see if rmdir exists
10525 set rmdir d_rmdir
10526 eval $inlibc
10527
10528 : see if memory.h is available.
10529 val=''
10530 set memory.h val
10531 eval $inhdr
10532
10533 : See if it conflicts with string.h
10534 case "$val" in
10535 $define)
10536         case "$strings" in
10537         '') ;;
10538         *)
10539                 $cppstdin $cppflags $cppminus < $strings > mem.h
10540                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10541                         echo " "
10542                         echo "We won't be including <memory.h>."
10543                         val="$undef"
10544                 fi
10545                 $rm -f mem.h
10546                 ;;
10547         esac
10548 esac
10549 set i_memory
10550 eval $setvar
10551
10552 : can bcopy handle overlapping blocks?
10553 val="$undef"
10554 case "$d_bcopy" in
10555 "$define")
10556         echo " "
10557         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10558         $cat >try.c <<EOCP
10559 #$i_memory I_MEMORY
10560 #$i_stdlib I_STDLIB
10561 #$i_string I_STRING
10562 #$i_unistd I_UNISTD
10563 EOCP
10564         $cat >>try.c <<'EOCP'
10565 #include <stdio.h>
10566 #ifdef I_MEMORY
10567 #  include <memory.h>
10568 #endif
10569 #ifdef I_STDLIB
10570 #  include <stdlib.h>
10571 #endif
10572 #ifdef I_STRING
10573 #  include <string.h>
10574 #else
10575 #  include <strings.h>
10576 #endif
10577 #ifdef I_UNISTD
10578 #  include <unistd.h>  /* Needed for NetBSD */
10579 #endif
10580 int main()
10581 {
10582 char buf[128], abc[128];
10583 char *b;
10584 int len;
10585 int off;
10586 int align;
10587
10588 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10589
10590 for (align = 7; align >= 0; align--) {
10591         for (len = 36; len; len--) {
10592                 b = buf+align;
10593                 bcopy(abc, b, len);
10594                 for (off = 1; off <= len; off++) {
10595                         bcopy(b, b+off, len);
10596                         bcopy(b+off, b, len);
10597                         if (bcmp(b, abc, len))
10598                                 exit(1);
10599                 }
10600         }
10601 }
10602 exit(0);
10603 }
10604 EOCP
10605         set try
10606         if eval $compile_ok; then
10607                 if ./try 2>/dev/null; then
10608                         echo "Yes, it can."
10609                         val="$define"
10610                 else
10611                         echo "It can't, sorry."
10612                         case "$d_memmove" in
10613                         "$define") echo "But that's Ok since you have memmove()." ;;
10614                         esac
10615                 fi
10616         else
10617                 echo "(I can't compile the test program, so we'll assume not...)"
10618                 case "$d_memmove" in
10619                 "$define") echo "But that's Ok since you have memmove()." ;;
10620                 esac
10621         fi
10622         ;;
10623 esac
10624 $rm -f try.* try core
10625 set d_safebcpy
10626 eval $setvar
10627
10628 : can memcpy handle overlapping blocks?
10629 val="$undef"
10630 case "$d_memcpy" in
10631 "$define")
10632         echo " "
10633         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10634         $cat >try.c <<EOCP
10635 #$i_memory I_MEMORY
10636 #$i_stdlib I_STDLIB
10637 #$i_string I_STRING
10638 #$i_unistd I_UNISTD
10639 EOCP
10640         $cat >>try.c <<'EOCP'
10641 #include <stdio.h>
10642 #ifdef I_MEMORY
10643 #  include <memory.h>
10644 #endif
10645 #ifdef I_STDLIB
10646 #  include <stdlib.h>
10647 #endif
10648 #ifdef I_STRING
10649 #  include <string.h>
10650 #else
10651 #  include <strings.h>
10652 #endif
10653 #ifdef I_UNISTD
10654 #  include <unistd.h>  /* Needed for NetBSD */
10655 #endif
10656 int main()
10657 {
10658 char buf[128], abc[128];
10659 char *b;
10660 int len;
10661 int off;
10662 int align;
10663
10664 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10665    try to store the string in read-only memory. */
10666 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10667
10668 for (align = 7; align >= 0; align--) {
10669         for (len = 36; len; len--) {
10670                 b = buf+align;
10671                 memcpy(b, abc, len);
10672                 for (off = 1; off <= len; off++) {
10673                         memcpy(b+off, b, len);
10674                         memcpy(b, b+off, len);
10675                         if (memcmp(b, abc, len))
10676                                 exit(1);
10677                 }
10678         }
10679 }
10680 exit(0);
10681 }
10682 EOCP
10683         set try
10684         if eval $compile_ok; then
10685                 if ./try 2>/dev/null; then
10686                         echo "Yes, it can."
10687                         val="$define"
10688                 else
10689                         echo "It can't, sorry."
10690                         case "$d_memmove" in
10691                         "$define") echo "But that's Ok since you have memmove()." ;;
10692                         esac
10693                 fi
10694         else
10695                 echo "(I can't compile the test program, so we'll assume not...)"
10696                 case "$d_memmove" in
10697                 "$define") echo "But that's Ok since you have memmove()." ;;
10698                 esac
10699         fi
10700         ;;
10701 esac
10702 $rm -f try.* try core
10703 set d_safemcpy
10704 eval $setvar
10705
10706 : can memcmp be trusted to compare relative magnitude?
10707 val="$undef"
10708 case "$d_memcmp" in
10709 "$define")
10710         echo " "
10711         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10712         $cat >try.c <<EOCP
10713 #$i_memory I_MEMORY
10714 #$i_stdlib I_STDLIB
10715 #$i_string I_STRING
10716 #$i_unistd I_UNISTD
10717 EOCP
10718         $cat >>try.c <<'EOCP'
10719 #include <stdio.h>
10720 #ifdef I_MEMORY
10721 #  include <memory.h>
10722 #endif
10723 #ifdef I_STDLIB
10724 #  include <stdlib.h>
10725 #endif
10726 #ifdef I_STRING
10727 #  include <string.h>
10728 #else
10729 #  include <strings.h>
10730 #endif
10731 #ifdef I_UNISTD
10732 #  include <unistd.h>  /* Needed for NetBSD */
10733 #endif
10734 int main()
10735 {
10736 char a = -1;
10737 char b = 0;
10738 if ((a < b) && memcmp(&a, &b, 1) < 0)
10739         exit(1);
10740 exit(0);
10741 }
10742 EOCP
10743         set try
10744         if eval $compile_ok; then
10745                 if ./try 2>/dev/null; then
10746                         echo "Yes, it can."
10747                         val="$define"
10748                 else
10749                         echo "No, it can't (it uses signed chars)."
10750                 fi
10751         else
10752                 echo "(I can't compile the test program, so we'll assume not...)"
10753         fi
10754         ;;
10755 esac
10756 $rm -f try.* try core
10757 set d_sanemcmp
10758 eval $setvar
10759
10760 : see if select exists
10761 set select d_select
10762 eval $inlibc
10763
10764 : see if semctl exists
10765 set semctl d_semctl
10766 eval $inlibc
10767
10768 : see if semget exists
10769 set semget d_semget
10770 eval $inlibc
10771
10772 : see if semop exists
10773 set semop d_semop
10774 eval $inlibc
10775
10776 : see how much of the 'sem*(2)' library is present.
10777 h_sem=true
10778 echo " "
10779 case "$d_semctl$d_semget$d_semop" in
10780 *"$undef"*) h_sem=false;;
10781 esac
10782 case "$osname" in
10783 freebsd)
10784     case "`ipcs 2>&1`" in
10785     "SVID messages"*"not configured"*)
10786         echo "Your $osname does not have the sem*(2) configured." >&4
10787         h_sem=false
10788         val="$undef"
10789         set semctl d_semctl
10790         eval $setvar
10791         set semget d_semget
10792         eval $setvar
10793         set semop d_semop
10794         eval $setvar
10795         ;;
10796     esac
10797     ;;
10798 esac
10799 : we could also check for sys/ipc.h ...
10800 if $h_sem && $test `./findhdr sys/sem.h`; then
10801         echo "You have the full sem*(2) library." >&4
10802         val="$define"
10803 else
10804         echo "You don't have the full sem*(2) library." >&4
10805         val="$undef"
10806 fi
10807 set d_sem
10808 eval $setvar
10809
10810 : see whether sys/sem.h defines union semun
10811 echo " "
10812 $cat > try.c <<'END'
10813 #include <sys/types.h>
10814 #include <sys/ipc.h>
10815 #include <sys/sem.h>
10816 int main () { union semun semun; semun.buf = 0; }
10817 END
10818 set try
10819 if eval $compile; then
10820     echo "You have union semun in <sys/sem.h>." >&4
10821     val="$define"
10822 else
10823     echo "You do not have union semun in <sys/sem.h>." >&4
10824     val="$undef"
10825 fi
10826 $rm -f try try.c try.h
10827 set d_union_semun
10828 eval $setvar
10829
10830 : see how to do semctl IPC_STAT
10831 case "$d_sem" in
10832 $define)
10833     : see whether semctl IPC_STAT can use union semun
10834     echo " "
10835     $cat > try.h <<END
10836 #ifndef S_IRUSR
10837 #   ifdef S_IREAD
10838 #       define S_IRUSR S_IREAD
10839 #       define S_IWUSR S_IWRITE
10840 #       define S_IXUSR S_IEXEC
10841 #   else
10842 #       define S_IRUSR 0400
10843 #       define S_IWUSR 0200
10844 #       define S_IXUSR 0100
10845 #   endif
10846 #   define S_IRGRP (S_IRUSR>>3)
10847 #   define S_IWGRP (S_IWUSR>>3)
10848 #   define S_IXGRP (S_IXUSR>>3)
10849 #   define S_IROTH (S_IRUSR>>6)
10850 #   define S_IWOTH (S_IWUSR>>6)
10851 #   define S_IXOTH (S_IXUSR>>6)
10852 #endif
10853 #ifndef S_IRWXU
10854 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10855 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10856 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10857 #endif
10858 END
10859
10860     $cat > try.c <<END
10861 #include <sys/types.h>
10862 #include <sys/ipc.h>
10863 #include <sys/sem.h>
10864 #include <sys/stat.h>
10865 #include <stdio.h>
10866 #include <errno.h>
10867 #include "try.h"
10868 #ifndef errno
10869 extern int errno;
10870 #endif
10871 #$d_union_semun HAS_UNION_SEMUN
10872 int main() {
10873     union semun
10874 #ifndef HAS_UNION_SEMUN
10875     {
10876         int val;
10877         struct semid_ds *buf;
10878         unsigned short *array;
10879     }
10880 #endif
10881     arg;
10882     int sem, st;
10883
10884 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10885     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10886     if (sem > -1) {
10887         struct semid_ds argbuf;
10888         arg.buf = &argbuf;
10889 #       ifdef IPC_STAT
10890         st = semctl(sem, 0, IPC_STAT, arg);
10891         if (st == 0)
10892             printf("semun\n");
10893         else
10894 #       endif /* IPC_STAT */
10895             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10896 #       ifdef IPC_RMID
10897         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10898 #       endif /* IPC_RMID */
10899             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10900     } else
10901 #endif /* IPC_PRIVATE && ... */
10902         printf("semget failed: errno = %d\n", errno);
10903   return 0;
10904 }
10905 END
10906     val="$undef"
10907     set try
10908     if eval $compile; then
10909         xxx=`./try`
10910         case "$xxx" in
10911         semun) val="$define" ;;
10912         esac
10913     fi
10914     $rm -f try try.c
10915     set d_semctl_semun
10916     eval $setvar
10917     case "$d_semctl_semun" in
10918     $define)
10919         echo "You can use union semun for semctl IPC_STAT." >&4
10920         also='also'
10921         ;;
10922     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10923         also=''
10924         ;;
10925     esac
10926
10927     : see whether semctl IPC_STAT can use struct semid_ds pointer
10928     $cat > try.c <<'END'
10929 #include <sys/types.h>
10930 #include <sys/ipc.h>
10931 #include <sys/sem.h>
10932 #include <sys/stat.h>
10933 #include "try.h"
10934 #include <stdio.h>
10935 #include <errno.h>
10936 #ifndef errno
10937 extern int errno;
10938 #endif
10939 int main() {
10940     struct semid_ds arg;
10941     int sem, st;
10942
10943 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10944     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10945     if (sem > -1) {
10946 #       ifdef IPC_STAT
10947         st = semctl(sem, 0, IPC_STAT, &arg);
10948         if (st == 0)
10949             printf("semid_ds\n");
10950         else
10951 #       endif /* IPC_STAT */
10952             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10953 #       ifdef IPC_RMID
10954         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10955 #       endif /* IPC_RMID */
10956             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10957     } else
10958 #endif /* IPC_PRIVATE && ... */
10959         printf("semget failed: errno = %d\n", errno);
10960
10961     return 0;
10962 }
10963 END
10964     val="$undef"
10965     set try
10966     if eval $compile; then
10967         xxx=`./try`
10968         case "$xxx" in
10969         semid_ds) val="$define" ;;
10970         esac
10971     fi
10972     $rm -f try try.c
10973     set d_semctl_semid_ds
10974     eval $setvar
10975     case "$d_semctl_semid_ds" in
10976     $define)
10977         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10978         ;;
10979     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10980         ;;
10981     esac
10982     $rm -f try.h
10983     ;;
10984 *)  val="$undef"
10985
10986     # We do not have the full sem*(2) library, so assume we can not
10987     # use either.
10988
10989     set d_semctl_semun
10990     eval $setvar
10991
10992     set d_semctl_semid_ds
10993     eval $setvar
10994     ;;
10995 esac
10996
10997 : see if setegid exists
10998 set setegid d_setegid
10999 eval $inlibc
11000
11001 : see if seteuid exists
11002 set seteuid d_seteuid
11003 eval $inlibc
11004
11005 : see if setgrent exists
11006 set setgrent d_setgrent
11007 eval $inlibc
11008
11009 : see if sethostent exists
11010 set sethostent d_sethent
11011 eval $inlibc
11012
11013 : see if setlinebuf exists
11014 set setlinebuf d_setlinebuf
11015 eval $inlibc
11016
11017 : see if setlocale exists
11018 set setlocale d_setlocale
11019 eval $inlibc
11020
11021 : see if setnetent exists
11022 set setnetent d_setnent
11023 eval $inlibc
11024
11025 : see if setprotoent exists
11026 set setprotoent d_setpent
11027 eval $inlibc
11028
11029 : see if setpgid exists
11030 set setpgid d_setpgid
11031 eval $inlibc
11032
11033 : see if setpgrp2 exists
11034 set setpgrp2 d_setpgrp2
11035 eval $inlibc
11036
11037 : see if setpriority exists
11038 set setpriority d_setprior
11039 eval $inlibc
11040
11041 : see if setpwent exists
11042 set setpwent d_setpwent
11043 eval $inlibc
11044
11045 : see if setregid exists
11046 set setregid d_setregid
11047 eval $inlibc
11048 set setresgid d_setresgid
11049 eval $inlibc
11050
11051 : see if setreuid exists
11052 set setreuid d_setreuid
11053 eval $inlibc
11054 set setresuid d_setresuid
11055 eval $inlibc
11056
11057 : see if setrgid exists
11058 set setrgid d_setrgid
11059 eval $inlibc
11060
11061 : see if setruid exists
11062 set setruid d_setruid
11063 eval $inlibc
11064
11065 : see if setservent exists
11066 set setservent d_setsent
11067 eval $inlibc
11068
11069 : see if setsid exists
11070 set setsid d_setsid
11071 eval $inlibc
11072
11073 : see if setvbuf exists
11074 set setvbuf d_setvbuf
11075 eval $inlibc
11076
11077 : see if sfio.h is available
11078 set sfio.h i_sfio
11079 eval $inhdr
11080
11081
11082 : see if sfio library is available
11083 case "$i_sfio" in
11084 $define)
11085         val=''
11086         set sfreserve val
11087         eval $inlibc
11088         ;;
11089 *)
11090         val="$undef"
11091         ;;
11092 esac
11093 : Ok, but do we want to use it.
11094 case "$val" in
11095 $define)
11096         case "$usesfio" in
11097         true|$define|[yY]*) dflt='y';;
11098         *) dflt='n';;
11099         esac
11100         echo "$package can use the sfio library, but it is experimental."
11101         rp="You seem to have sfio available, do you want to try using it?"
11102         . ./myread
11103         case "$ans" in
11104         y|Y) ;;
11105         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11106                 val="$undef"
11107                 : Remove sfio from list of libraries to use
11108                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11109                 shift
11110                 libs="$*"
11111                 echo "libs = $libs" >&4
11112                 ;;
11113         esac
11114         ;;
11115 *)      case "$usesfio" in
11116         true|$define|[yY]*)
11117                 echo "Sorry, cannot find sfio on this machine" >&4
11118                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11119                 ;;
11120         esac
11121         ;;
11122 esac
11123 set d_sfio
11124 eval $setvar
11125 case "$d_sfio" in
11126 $define) usesfio='true';;
11127 *) usesfio='false';;
11128 esac
11129
11130 : see if shmctl exists
11131 set shmctl d_shmctl
11132 eval $inlibc
11133
11134 : see if shmget exists
11135 set shmget d_shmget
11136 eval $inlibc
11137
11138 : see if shmat exists
11139 set shmat d_shmat
11140 eval $inlibc
11141 : see what shmat returns
11142 case "$d_shmat" in
11143 "$define")
11144         $cat >shmat.c <<'END'
11145 #include <sys/shm.h>
11146 void *shmat();
11147 END
11148         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11149                 shmattype='void *'
11150         else
11151                 shmattype='char *'
11152         fi
11153         echo "and it returns ($shmattype)." >&4
11154         : see if a prototype for shmat is available
11155         xxx=`./findhdr sys/shm.h`
11156         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11157         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11158                 val="$define"
11159         else
11160                 val="$undef"
11161         fi
11162         $rm -f shmat.[co]
11163         ;;
11164 *)
11165         val="$undef"
11166         ;;
11167 esac
11168 set d_shmatprototype
11169 eval $setvar
11170
11171 : see if shmdt exists
11172 set shmdt d_shmdt
11173 eval $inlibc
11174
11175 : see how much of the 'shm*(2)' library is present.
11176 h_shm=true
11177 echo " "
11178 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11179 *"$undef"*) h_shm=false;;
11180 esac
11181 case "$osname" in
11182 freebsd)
11183     case "`ipcs 2>&1`" in
11184     "SVID shared memory"*"not configured"*)
11185         echo "Your $osname does not have the shm*(2) configured." >&4
11186         h_shm=false
11187         val="$undef"
11188         set shmctl d_shmctl
11189         evat $setvar
11190         set shmget d_shmget
11191         evat $setvar
11192         set shmat d_shmat
11193         evat $setvar
11194         set shmdt d_shmdt
11195         evat $setvar
11196         ;;
11197     esac
11198     ;;
11199 esac
11200 : we could also check for sys/ipc.h ...
11201 if $h_shm && $test `./findhdr sys/shm.h`; then
11202         echo "You have the full shm*(2) library." >&4
11203         val="$define"
11204 else
11205         echo "You don't have the full shm*(2) library." >&4
11206         val="$undef"
11207 fi
11208 set d_shm
11209 eval $setvar
11210
11211 echo " "
11212 : see if we have sigaction
11213 if set sigaction val -f d_sigaction; eval $csym; $val; then
11214         echo 'sigaction() found.' >&4
11215         $cat > try.c <<'EOP'
11216 #include <stdio.h>
11217 #include <sys/types.h>
11218 #include <signal.h>
11219 int main()
11220 {
11221     struct sigaction act, oact;
11222     act.sa_flags = 0;
11223     oact.sa_handler = 0;
11224     /* so that act and oact are used */
11225     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11226 }
11227 EOP
11228         set try
11229         if eval $compile_ok; then
11230                 val="$define"
11231         else
11232                 echo "But you don't seem to have a useable struct sigaction." >&4
11233                 val="$undef"
11234         fi
11235 else
11236         echo 'sigaction NOT found.' >&4
11237         val="$undef"
11238 fi
11239 set d_sigaction; eval $setvar
11240 $rm -f try try$_o try.c
11241
11242 : see if sigsetjmp exists
11243 echo " "
11244 case "$d_sigsetjmp" in
11245 '')
11246         $cat >try.c <<'EOP'
11247 #include <setjmp.h>
11248 sigjmp_buf env;
11249 int set = 1;
11250 int main()
11251 {
11252         if (sigsetjmp(env,1))
11253                 exit(set);
11254         set = 0;
11255         siglongjmp(env, 1);
11256         exit(1);
11257 }
11258 EOP
11259         set try
11260         if eval $compile; then
11261                 if ./try >/dev/null 2>&1; then
11262                         echo "POSIX sigsetjmp found." >&4
11263                         val="$define"
11264                 else
11265                         $cat >&4 <<EOM
11266 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11267 I'll ignore them.
11268 EOM
11269                         val="$undef"
11270                 fi
11271         else
11272                 echo "sigsetjmp not found." >&4
11273                 val="$undef"
11274         fi
11275         ;;
11276 *) val="$d_sigsetjmp"
11277         case "$d_sigsetjmp" in
11278         $define) echo "POSIX sigsetjmp found." >&4;;
11279         $undef) echo "sigsetjmp not found." >&4;;
11280         esac
11281         ;;
11282 esac
11283 set d_sigsetjmp
11284 eval $setvar
11285 $rm -f try.c try
11286
11287 : see if sys/stat.h is available
11288 set sys/stat.h i_sysstat
11289 eval $inhdr
11290
11291
11292 : see if stat knows about block sizes
11293 echo " "
11294 echo "Checking to see if your struct stat has st_blocks field..." >&4
11295 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11296 eval $hasfield
11297
11298
11299 : see if this is a sys/vfs.h system
11300 set sys/vfs.h i_sysvfs
11301 eval $inhdr
11302
11303
11304 : see if this is a sys/statfs.h system
11305 set sys/statfs.h i_sysstatfs
11306 eval $inhdr
11307
11308
11309 echo " "
11310 echo "Checking to see if your system supports struct statfs..." >&4
11311 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
11312 eval $hasstruct
11313 case "$d_statfs_s" in
11314 "$define")      echo "Yes, it does."   ;;
11315 *)              echo "No, it doesn't." ;;
11316 esac
11317
11318
11319
11320 : see if struct statfs knows about f_flags
11321 case "$d_statfs_s" in
11322 define) 
11323         echo " "
11324         echo "Checking to see if your struct statfs has f_flags field..." >&4
11325         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
11326         eval $hasfield
11327         ;;
11328 *)      val="$undef"
11329         set d_statfs_f_flags
11330         eval $setvar
11331         ;;
11332 esac
11333 case "$d_statfs_f_flags" in
11334 "$define")      echo "Yes, it does."   ;;
11335 *)              echo "No, it doesn't." ;;
11336 esac
11337
11338 : see if _ptr and _cnt from stdio act std
11339 echo " "
11340 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11341         echo "(Looks like you have stdio.h from Linux.)"
11342         case "$stdio_ptr" in
11343         '') stdio_ptr='((fp)->_IO_read_ptr)'
11344                 ptr_lval=$define
11345                 ;;
11346         *)      ptr_lval=$d_stdio_ptr_lval;;
11347         esac
11348         case "$stdio_cnt" in
11349         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11350                 cnt_lval=$undef
11351                 ;;
11352         *)      cnt_lval=$d_stdio_cnt_lval;;
11353         esac
11354         case "$stdio_base" in
11355         '') stdio_base='((fp)->_IO_read_base)';;
11356         esac
11357         case "$stdio_bufsiz" in
11358         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11359         esac
11360 else
11361         case "$stdio_ptr" in
11362         '') stdio_ptr='((fp)->_ptr)'
11363                 ptr_lval=$define
11364                 ;;
11365         *)      ptr_lval=$d_stdio_ptr_lval;;
11366         esac
11367         case "$stdio_cnt" in
11368         '') stdio_cnt='((fp)->_cnt)'
11369                 cnt_lval=$define
11370                 ;;
11371         *)      cnt_lval=$d_stdio_cnt_lval;;
11372         esac
11373         case "$stdio_base" in
11374         '') stdio_base='((fp)->_base)';;
11375         esac
11376         case "$stdio_bufsiz" in
11377         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11378         esac
11379 fi
11380 : test whether _ptr and _cnt really work
11381 echo "Checking how std your stdio is..." >&4
11382 $cat >try.c <<EOP
11383 #include <stdio.h>
11384 #define FILE_ptr(fp)    $stdio_ptr
11385 #define FILE_cnt(fp)    $stdio_cnt
11386 int main() {
11387         FILE *fp = fopen("try.c", "r");
11388         char c = getc(fp);
11389         if (
11390                 18 <= FILE_cnt(fp) &&
11391                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11392         )
11393                 exit(0);
11394         exit(1);
11395 }
11396 EOP
11397 val="$undef"
11398 set try
11399 if eval $compile; then
11400         if ./try; then
11401                 echo "Your stdio acts pretty std."
11402                 val="$define"
11403         else
11404                 echo "Your stdio isn't very std."
11405         fi
11406 else
11407         echo "Your stdio doesn't appear very std."
11408 fi
11409 $rm -f try.c try
11410 set d_stdstdio
11411 eval $setvar
11412
11413 : Can _ptr be used as an lvalue?
11414 case "$d_stdstdio$ptr_lval" in
11415 $define$define) val=$define ;;
11416 *) val=$undef ;;
11417 esac
11418 set d_stdio_ptr_lval
11419 eval $setvar
11420
11421 : Can _cnt be used as an lvalue?
11422 case "$d_stdstdio$cnt_lval" in
11423 $define$define) val=$define ;;
11424 *) val=$undef ;;
11425 esac
11426 set d_stdio_cnt_lval
11427 eval $setvar
11428
11429 : see if _base is also standard
11430 val="$undef"
11431 case "$d_stdstdio" in
11432 $define)
11433         $cat >try.c <<EOP
11434 #include <stdio.h>
11435 #define FILE_base(fp)   $stdio_base
11436 #define FILE_bufsiz(fp) $stdio_bufsiz
11437 int main() {
11438         FILE *fp = fopen("try.c", "r");
11439         char c = getc(fp);
11440         if (
11441                 19 <= FILE_bufsiz(fp) &&
11442                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11443         )
11444                 exit(0);
11445         exit(1);
11446 }
11447 EOP
11448         set try
11449         if eval $compile; then
11450                 if ./try; then
11451                         echo "And its _base field acts std."
11452                         val="$define"
11453                 else
11454                         echo "But its _base field isn't std."
11455                 fi
11456         else
11457                 echo "However, it seems to be lacking the _base field."
11458         fi
11459         $rm -f try.c try
11460         ;;
11461 esac
11462 set d_stdiobase
11463 eval $setvar
11464
11465 $cat >&4 <<EOM
11466 Checking how to access stdio streams by file descriptor number...
11467 EOM
11468 case "$stdio_stream_array" in
11469 '')     $cat >try.c <<EOCP
11470 #include <stdio.h>
11471 int main() {
11472   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11473     printf("yes\n");
11474 }
11475 EOCP
11476         for s in _iob __iob __sF
11477         do
11478                 set try -DSTDIO_STREAM_ARRAY=$s
11479                 if eval $compile; then
11480                         case "`./try$exe_ext`" in
11481                         yes)    stdio_stream_array=$s; break ;;
11482                         esac
11483                 fi
11484         done
11485         $rm -f try.* try$exe_ext
11486 esac
11487 case "$stdio_stream_array" in
11488 '')     $cat >&4 <<EOM
11489 I can't figure out how to access stdio streams by file descriptor number.
11490 EOM
11491         d_stdio_stream_array="$undef"
11492         ;;
11493 *)      $cat >&4 <<EOM
11494 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11495 EOM
11496         d_stdio_stream_array="$define"
11497         ;;
11498 esac
11499
11500 : see if strcoll exists
11501 set strcoll d_strcoll
11502 eval $inlibc
11503
11504 : check for structure copying
11505 echo " "
11506 echo "Checking to see if your C compiler can copy structs..." >&4
11507 $cat >try.c <<'EOCP'
11508 int main()
11509 {
11510         struct blurfl {
11511                 int dyick;
11512         } foo, bar;
11513
11514         foo = bar;
11515 }
11516 EOCP
11517 if $cc -c try.c >/dev/null 2>&1 ; then
11518         val="$define"
11519         echo "Yup, it can."
11520 else
11521         val="$undef"
11522         echo "Nope, it can't."
11523 fi
11524 set d_strctcpy
11525 eval $setvar
11526 $rm -f try.*
11527
11528 : see if strerror and/or sys_errlist[] exist
11529 echo " "
11530 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11531     if set strerror val -f d_strerror; eval $csym; $val; then
11532                 echo 'strerror() found.' >&4
11533                 d_strerror="$define"
11534                 d_strerrm='strerror(e)'
11535                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11536                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11537                         d_syserrlst="$define"
11538                 else
11539                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11540                         d_syserrlst="$undef"
11541                 fi
11542     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11543                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11544                 echo 'strerror() found in string header.' >&4
11545                 d_strerror="$define"
11546                 d_strerrm='strerror(e)'
11547                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11548                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11549                                 d_syserrlst="$define"
11550                 else
11551                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11552                         d_syserrlst="$undef"
11553                 fi
11554     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11555                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11556                 d_strerror="$undef"
11557                 d_syserrlst="$define"
11558                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11559     else
11560                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11561                 d_strerror="$undef"
11562                 d_syserrlst="$undef"
11563                 d_strerrm='"unknown"'
11564     fi
11565 fi
11566
11567 : see if strtod exists
11568 set strtod d_strtod
11569 eval $inlibc
11570
11571 : see if strtol exists
11572 set strtol d_strtol
11573 eval $inlibc
11574
11575 : see if strtold exists
11576 set strtold d_strtold
11577 eval $inlibc
11578
11579 : see if strtoll exists
11580 set strtoll d_strtoll
11581 eval $inlibc
11582
11583 case "$d_longlong-$d_strtoll" in
11584 "$define-$define")
11585         $cat <<EOM
11586 Checking whether your strtoll() works okay...
11587 EOM
11588         $cat >try.c <<'EOCP'
11589 #include <errno.h>
11590 #ifdef __hpux
11591 #define strtoll __strtoll
11592 #endif
11593 #include <stdio.h>
11594 extern long long int strtoll(char *s, char **, int); 
11595 static int bad = 0;
11596 int check(char *s, long long ell, int een) {
11597         long long gll;
11598         errno = 0;
11599         gll = strtoll(s, 0, 10);
11600         if (!((gll == ell) && (errno == een)))
11601                 bad++;
11602 }
11603 int main() {
11604         check(" 1",                                      1LL, 0);
11605         check(" 0",                                      0LL, 0);
11606         check("-1",                                     -1LL, 0);
11607         check("-9223372036854775808", -9223372036854775808LL, 0);
11608         check("-9223372036854775808", -9223372036854775808LL, 0);
11609         check(" 9223372036854775807",  9223372036854775807LL, 0);
11610         check("-9223372036854775808", -9223372036854775808LL, 0);
11611         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11612         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11613         if (!bad)
11614                 printf("ok\n");
11615 }
11616 EOCP
11617         set try
11618         if eval $compile; then
11619                 case "`./try`" in
11620                 ok) echo "Your strtoll() seems to be working okay." ;;
11621                 *) cat <<EOM >&4
11622 Your strtoll() doesn't seem to be working okay.
11623 EOM
11624                    d_strtoll="$undef"
11625                    ;;
11626                 esac
11627         fi
11628         ;;
11629 esac
11630
11631 : see if strtoul exists
11632 set strtoul d_strtoul
11633 eval $inlibc
11634
11635 : see if strtoull exists
11636 set strtoull d_strtoull
11637 eval $inlibc
11638
11639 case "$d_longlong-$d_strtoull" in
11640 "$define-$define")
11641         $cat <<EOM
11642 Checking whether your strtoull() works okay...
11643 EOM
11644         $cat >try.c <<'EOCP'
11645 #include <errno.h>
11646 #ifdef __hpux
11647 #define strtoull __strtoull
11648 #endif
11649 #include <stdio.h>
11650 extern unsigned long long int strtoull(char *s, char **, int); 
11651 static int bad = 0;
11652 int check(char *s, long long eull, int een) {
11653         long long gull;
11654         errno = 0;
11655         gull = strtoull(s, 0, 10);
11656         if (!((gull == eull) && (errno == een)))
11657                 bad++;
11658 }
11659 int main() {
11660         check(" 1",                                       1LL, 0);
11661         check(" 0",                                       0LL, 0);
11662         check("18446744073709551615", 18446744073709551615ULL, 0);
11663         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11664         if (!bad)
11665                 printf("ok\n");
11666 }
11667 EOCP
11668         set try
11669         if eval $compile; then
11670                 case "`./try`" in
11671                 ok) echo "Your strtoull() seems to be working okay." ;;
11672                 *) cat <<EOM >&4
11673 Your strtoull() doesn't seem to be working okay.
11674 EOM
11675                    d_strtoull="$undef"
11676                    ;;
11677                 esac
11678         fi
11679         ;;
11680 esac
11681
11682 : see if strtouq exists
11683 set strtouq d_strtouq
11684 eval $inlibc
11685
11686 : see if strxfrm exists
11687 set strxfrm d_strxfrm
11688 eval $inlibc
11689
11690 : see if symlink exists
11691 set symlink d_symlink
11692 eval $inlibc
11693
11694 : see if syscall exists
11695 set syscall d_syscall
11696 eval $inlibc
11697
11698 : see if sysconf exists
11699 set sysconf d_sysconf
11700 eval $inlibc
11701
11702 : see if system exists
11703 set system d_system
11704 eval $inlibc
11705
11706 : see if tcgetpgrp exists
11707 set tcgetpgrp d_tcgetpgrp
11708 eval $inlibc
11709
11710 : see if tcsetpgrp exists
11711 set tcsetpgrp d_tcsetpgrp
11712 eval $inlibc
11713
11714 : see if prototype for telldir is available
11715 echo " "
11716 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11717 eval $hasproto
11718
11719 : see if this is a sys/times.h system
11720 set sys/times.h i_systimes
11721 eval $inhdr
11722
11723 : see if times exists
11724 echo " "
11725 if set times val -f d_times; eval $csym; $val; then
11726         echo 'times() found.' >&4
11727         d_times="$define"
11728         inc=''
11729         case "$i_systimes" in
11730         "$define") inc='sys/times.h';;
11731         esac
11732         rp="What is the type returned by times() on this system?"
11733         set clock_t clocktype long stdio.h sys/types.h $inc
11734         eval $typedef_ask
11735 else
11736         echo 'times() NOT found, hope that will do.' >&4
11737         d_times="$undef"
11738         clocktype='int'
11739 fi
11740
11741 : see if truncate exists
11742 set truncate d_truncate
11743 eval $inlibc
11744
11745 : see if tzname[] exists
11746 echo " "
11747 if set tzname val -a d_tzname; eval $csym; $val; then
11748         val="$define"
11749         echo 'tzname[] found.' >&4
11750 else
11751         val="$undef"
11752         echo 'tzname[] NOT found.' >&4
11753 fi
11754 set d_tzname
11755 eval $setvar
11756
11757 : see if umask exists
11758 set umask d_umask
11759 eval $inlibc
11760
11761 : see if ustat exists
11762 set ustat d_ustat
11763 eval $inlibc
11764
11765 : backward compatibility for d_hvfork
11766 if test X$d_hvfork != X; then
11767         d_vfork="$d_hvfork"
11768         d_hvfork=''
11769 fi
11770 : see if there is a vfork
11771 val=''
11772 set vfork val
11773 eval $inlibc
11774
11775 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11776 : perl on Solaris 2.x, and probably elsewhere.
11777 case "$val" in
11778 $define)
11779         echo " "
11780         case "$usevfork" in
11781         false) dflt='n';;
11782         *) dflt='y';;
11783         esac
11784         cat <<'EOM'
11785  
11786 Perl can only use a vfork() that doesn't suffer from strict
11787 restrictions on calling functions or modifying global data in
11788 the child.  For example, glibc-2.1 contains such a vfork()
11789 that is unsuitable.  If your system provides a proper fork()
11790 call, chances are that you do NOT want perl to use vfork().
11791
11792 EOM
11793         rp="Do you still want to use vfork()?"
11794         . ./myread
11795         case "$ans" in
11796         y|Y) ;;
11797         *)
11798                 echo "Ok, we won't use vfork()."
11799                 val="$undef"
11800                 ;;
11801         esac
11802         ;;
11803 esac
11804 set d_vfork
11805 eval $setvar
11806 case "$d_vfork" in
11807 $define) usevfork='true';;
11808 *) usevfork='false';;
11809 esac
11810
11811 : see if this is an sysdir system
11812 set sys/dir.h i_sysdir
11813 eval $inhdr
11814
11815 : see if this is an sysndir system
11816 set sys/ndir.h i_sysndir
11817 eval $inhdr
11818
11819 : see if closedir exists
11820 set closedir d_closedir
11821 eval $inlibc
11822
11823 case "$d_closedir" in
11824 "$define")
11825         echo " "
11826         echo "Checking whether closedir() returns a status..." >&4
11827         cat > closedir.c <<EOM
11828 #$i_dirent I_DIRENT             /**/
11829 #$i_sysdir I_SYS_DIR            /**/
11830 #$i_sysndir I_SYS_NDIR          /**/
11831 #$i_systypes I_SYS_TYPES        /**/
11832
11833 #if defined(I_SYS_TYPES)
11834 #include <sys/types.h>
11835 #endif
11836 #if defined(I_DIRENT)
11837 #include <dirent.h>
11838 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11839 #include <sys/dir.h>
11840 #endif
11841 #else
11842 #ifdef I_SYS_NDIR
11843 #include <sys/ndir.h>
11844 #else
11845 #ifdef I_SYS_DIR
11846 #ifdef hp9000s500
11847 #include <ndir.h>       /* may be wrong in the future */
11848 #else
11849 #include <sys/dir.h>
11850 #endif
11851 #endif
11852 #endif
11853 #endif 
11854 int main() { return closedir(opendir(".")); }
11855 EOM
11856         set closedir
11857         if eval $compile_ok; then
11858                 if ./closedir > /dev/null 2>&1 ; then
11859                         echo "Yes, it does."
11860                         val="$undef"
11861                 else
11862                         echo "No, it doesn't."
11863                         val="$define"
11864                 fi
11865         else
11866                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11867                 val="$define"
11868         fi
11869         ;;
11870 *)
11871         val="$undef";
11872         ;;
11873 esac
11874 set d_void_closedir
11875 eval $setvar
11876 $rm -f closedir*
11877 : check for volatile keyword
11878 echo " "
11879 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11880 $cat >try.c <<'EOCP'
11881 int main()
11882 {
11883         typedef struct _goo_struct goo_struct;
11884         goo_struct * volatile goo = ((goo_struct *)0);
11885         struct _goo_struct {
11886                 long long_int;
11887                 int reg_int;
11888                 char char_var;
11889         };
11890         typedef unsigned short foo_t;
11891         char *volatile foo;
11892         volatile int bar;
11893         volatile foo_t blech;
11894         foo = foo;
11895 }
11896 EOCP
11897 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11898         val="$define"
11899         echo "Yup, it does."
11900 else
11901         val="$undef"
11902         echo "Nope, it doesn't."
11903 fi
11904 set d_volatile
11905 eval $setvar
11906 $rm -f try.*
11907
11908 : see if there is a wait4
11909 set wait4 d_wait4
11910 eval $inlibc
11911
11912 : see if waitpid exists
11913 set waitpid d_waitpid
11914 eval $inlibc
11915
11916 : see if wcstombs exists
11917 set wcstombs d_wcstombs
11918 eval $inlibc
11919
11920 : see if wctomb exists
11921 set wctomb d_wctomb
11922 eval $inlibc
11923
11924 : preserve RCS keywords in files with variable substitution, grrr
11925 Date='$Date'
11926 Id='$Id'
11927 Log='$Log'
11928 RCSfile='$RCSfile'
11929 Revision='$Revision'
11930
11931 case "$crosscompile" in
11932 ''|[nN]*) crosscompile="$undef" ;;
11933 esac
11934
11935 case "$osname" in
11936 next|rhapsody|darwin) multiarch="$define" ;;
11937 esac
11938 case "$multiarch" in
11939 ''|[nN]*) multiarch="$undef" ;;
11940 esac
11941
11942 : check for alignment requirements
11943 echo " "
11944 case "$crosscompile$multiarch" in
11945 *$define*)
11946         $cat <<EOM
11947 You seem to be either cross-compiling or doing a multiarchitecture build,
11948 skipping the memory alignment check.
11949
11950 EOM
11951         case "$alignbytes" in
11952         '') alignbytes=8 ;;
11953         esac
11954         ;;
11955 *)
11956         case "$alignbytes" in
11957         '') echo "Checking alignment constraints..." >&4
11958                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11959                         $cat >try.c <<'EOCP'
11960 typedef long double NV;
11961 EOCP
11962                 else
11963                         $cat >try.c <<'EOCP'
11964 typedef double NV;
11965 EOCP
11966                 fi
11967                 $cat >>try.c <<'EOCP'
11968 #include <stdio.h>
11969 struct foobar {
11970         char foo;
11971         NV bar;
11972 } try_algn;
11973 int main()
11974 {
11975     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11976     return(0);
11977 }
11978 EOCP
11979                 set try
11980                 if eval $compile_ok; then
11981                         dflt=`./try`
11982                 else
11983                         dflt='8'
11984                         echo "(I can't seem to compile the test program...)"
11985                 fi
11986                 ;;
11987         *) dflt="$alignbytes"
11988                 ;;
11989         esac
11990         rp="Doubles must be aligned on a how-many-byte boundary?"
11991         . ./myread
11992         alignbytes="$ans"
11993         $rm -f try.c try
11994         ;;
11995 esac
11996
11997
11998 : set the base revision
11999 baserev=5.0
12000
12001 : check for ordering of bytes in a long
12002 echo " "
12003 case "$crosscompile$multiarch" in
12004 *$define*)
12005         $cat <<EOM
12006 You seem to be either cross-compiling or doing a multiarchitecture build,
12007 skipping the byteorder check.
12008
12009 EOM
12010         byteorder='0xffff'
12011         ;;
12012 *)
12013         case "$byteorder" in
12014         '')
12015                 $cat <<'EOM'
12016 In the following, larger digits indicate more significance.  A big-endian
12017 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12018 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12019 machines may have weird orders like 3412.  A Cray will report 87654321,
12020 an Alpha will report 12345678. If the test program works the default is
12021 probably right.
12022 I'm now running the test program...
12023 EOM
12024                 $cat >try.c <<'EOCP'
12025 #include <stdio.h>
12026 int main()
12027 {
12028         int i;
12029         union {
12030                 unsigned long l;
12031                 char c[sizeof(long)];
12032         } u;
12033
12034         if (sizeof(long) > 4)
12035                 u.l = (0x08070605L << 32) | 0x04030201L;
12036         else
12037                 u.l = 0x04030201L;
12038         for (i = 0; i < sizeof(long); i++)
12039                 printf("%c", u.c[i]+'0');
12040         printf("\n");
12041         exit(0);
12042 }
12043 EOCP
12044                 xxx_prompt=y
12045                 set try
12046                 if eval $compile && ./try > /dev/null; then
12047                         dflt=`./try`
12048                         case "$dflt" in
12049                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12050                                 echo "(The test program ran ok.)"
12051                                 echo "byteorder=$dflt"
12052                                 xxx_prompt=n
12053                         ;;
12054                         ????|????????) echo "(The test program ran ok.)" ;;
12055                         *) echo "(The test program didn't run right for some reason.)" ;;
12056                         esac
12057                 else
12058                         dflt='4321'
12059                         cat <<'EOM'
12060 (I can't seem to compile the test program.  Guessing big-endian...)
12061 EOM
12062                 fi
12063                 case "$xxx_prompt" in
12064                 y)
12065                         rp="What is the order of bytes in a long?"
12066                         . ./myread
12067                         byteorder="$ans"
12068                         ;;
12069                 *)      byteorder=$dflt
12070                         ;;
12071                 esac
12072                 ;;
12073         esac
12074         $rm -f try.c try
12075         ;;
12076 esac
12077
12078
12079 : how do we catenate cpp tokens here?
12080 echo " "
12081 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12082 $cat >cpp_stuff.c <<'EOCP'
12083 #define RCAT(a,b)a/**/b
12084 #define ACAT(a,b)a ## b
12085 RCAT(Rei,ser)
12086 ACAT(Cir,cus)
12087 EOCP
12088 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12089 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12090         echo "Oh!  Smells like ANSI's been here." >&4
12091         echo "We can catify or stringify, separately or together!"
12092         cpp_stuff=42
12093 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12094         echo "Ah, yes!  The good old days!" >&4
12095         echo "However, in the good old days we don't know how to stringify and"
12096         echo "catify at the same time."
12097         cpp_stuff=1
12098 else
12099         $cat >&4 <<EOM
12100 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12101 to have to edit the values of CAT[2-5] in config.h...
12102 EOM
12103         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12104 fi
12105 $rm -f cpp_stuff.*
12106
12107 : see if this is a db.h system
12108 set db.h i_db
12109 eval $inhdr
12110
12111 case "$i_db" in
12112 $define)
12113         : Check db version.
12114         echo " "
12115         echo "Checking Berkeley DB version ..." >&4
12116         $cat >try.c <<EOCP
12117 #$d_const HASCONST
12118 #ifndef HASCONST
12119 #define const
12120 #endif
12121 #include <sys/types.h>
12122 #include <stdio.h>
12123 #include <db.h>
12124 int main()
12125 {
12126 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12127     int Major, Minor, Patch ;
12128     unsigned long Version ;
12129     (void)db_version(&Major, &Minor, &Patch) ;
12130     printf("You have Berkeley DB Version 2 or greater\n");
12131
12132     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12133                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12134     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12135                 Major, Minor, Patch) ;
12136
12137     /* check that db.h & libdb are compatible */
12138     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12139         printf("db.h and libdb are incompatible\n") ;
12140         exit(3);        
12141     }
12142
12143     printf("db.h and libdb are compatible\n") ;
12144
12145     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12146                 + DB_VERSION_PATCH ;
12147
12148     /* needs to be >= 2.3.4 */
12149     if (Version < 2003004) {
12150     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12151         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12152         exit(2);        
12153     }
12154
12155     exit(0);
12156 #else
12157 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12158     printf("You have Berkeley DB Version 1\n");
12159     exit(0);    /* DB version < 2: the coast is clear. */
12160 #else
12161     exit(1);    /* <db.h> not Berkeley DB? */
12162 #endif
12163 #endif
12164 }
12165 EOCP
12166         set try
12167         if eval $compile_ok && ./try; then
12168                 echo 'Looks OK.' >&4
12169         else
12170                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12171                 i_db=$undef
12172                 case " $libs " in
12173                 *"-ldb "*)
12174                         : Remove db from list of libraries to use
12175                         echo "Removing unusable -ldb from library list" >&4
12176                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12177                         shift
12178                         libs="$*"
12179                         echo "libs = $libs" >&4
12180                         ;;
12181                 esac
12182         fi
12183         $rm -f try.*
12184         ;;
12185 esac
12186
12187 case "$i_db" in
12188 define)
12189         : Check the return type needed for hash 
12190         echo " "
12191         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12192         $cat >try.c <<EOCP
12193 #$d_const HASCONST
12194 #ifndef HASCONST
12195 #define const
12196 #endif
12197 #include <sys/types.h>
12198 #include <db.h>
12199
12200 #ifndef DB_VERSION_MAJOR
12201 u_int32_t hash_cb (ptr, size)
12202 const void *ptr;
12203 size_t size;
12204 {
12205 }
12206 HASHINFO info;
12207 int main()
12208 {
12209         info.hash = hash_cb;
12210 }
12211 #endif
12212 EOCP
12213         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12214                 if $contains warning try.out >>/dev/null 2>&1 ; then
12215                         db_hashtype='int'
12216                 else
12217                         db_hashtype='u_int32_t'
12218                 fi
12219         else
12220                 : XXX Maybe we should just give up here.
12221                 db_hashtype=u_int32_t
12222                 $cat try.out >&4
12223                 echo "Help:  I can't seem to compile the db test program." >&4
12224                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12225         fi
12226         $rm -f try.*
12227         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12228         ;;
12229 *)      db_hashtype=u_int32_t
12230         ;;
12231 esac
12232 case "$i_db" in
12233 define)
12234         : Check the return type needed for prefix 
12235         echo " "
12236         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12237         cat >try.c <<EOCP
12238 #$d_const HASCONST
12239 #ifndef HASCONST
12240 #define const
12241 #endif
12242 #include <sys/types.h>
12243 #include <db.h>
12244
12245 #ifndef DB_VERSION_MAJOR
12246 size_t prefix_cb (key1, key2)
12247 const DBT *key1;
12248 const DBT *key2;
12249 {
12250 }
12251 BTREEINFO info;
12252 int main()
12253 {
12254         info.prefix = prefix_cb;
12255 }
12256 #endif
12257 EOCP
12258         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12259                 if $contains warning try.out >>/dev/null 2>&1 ; then
12260                         db_prefixtype='int'
12261                 else
12262                         db_prefixtype='size_t'
12263                 fi
12264         else
12265                 db_prefixtype='size_t'
12266                 : XXX Maybe we should just give up here.
12267                 $cat try.out >&4
12268                 echo "Help:  I can't seem to compile the db test program." >&4
12269                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12270         fi
12271         $rm -f try.*
12272         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12273         ;;
12274 *)      db_prefixtype='size_t'
12275         ;;
12276 esac
12277
12278 : check for void type
12279 echo " "
12280 echo "Checking to see how well your C compiler groks the void type..." >&4
12281 case "$voidflags" in
12282 '')
12283         $cat >try.c <<'EOCP'
12284 #if TRY & 1
12285 void sub() {
12286 #else
12287 sub() {
12288 #endif
12289         extern void moo();      /* function returning void */
12290         void (*goo)();          /* ptr to func returning void */
12291 #if TRY & 8
12292         void *hue;              /* generic ptr */
12293 #endif
12294 #if TRY & 2
12295         void (*foo[10])();
12296 #endif
12297
12298 #if TRY & 4
12299         if(goo == moo) {
12300                 exit(0);
12301         }
12302 #endif
12303         exit(0);
12304 }
12305 int main() { sub(); }
12306 EOCP
12307         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12308                 voidflags=$defvoidused
12309         echo "Good.  It appears to support void to the level $package wants.">&4
12310                 if $contains warning .out >/dev/null 2>&1; then
12311                         echo "However, you might get some warnings that look like this:"
12312                         $cat .out
12313                 fi
12314         else
12315 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12316                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12317                         echo "It supports 1..."
12318                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12319                                 echo "It also supports 2..."
12320                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12321                                         voidflags=7
12322                                         echo "And it supports 4 but not 8 definitely."
12323                                 else
12324                                         echo "It doesn't support 4..."
12325                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12326                                                 voidflags=11
12327                                                 echo "But it supports 8."
12328                                         else
12329                                                 voidflags=3
12330                                                 echo "Neither does it support 8."
12331                                         fi
12332                                 fi
12333                         else
12334                                 echo "It does not support 2..."
12335                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12336                                         voidflags=13
12337                                         echo "But it supports 4 and 8."
12338                                 else
12339                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12340                                                 voidflags=5
12341                                                 echo "And it supports 4 but has not heard about 8."
12342                                         else
12343                                                 echo "However it supports 8 but not 4."
12344                                         fi
12345                                 fi
12346                         fi
12347                 else
12348                         echo "There is no support at all for void."
12349                         voidflags=0
12350                 fi
12351         fi
12352 esac
12353 case "$voidflags" in
12354 "$defvoidused") ;;
12355 *)      $cat >&4 <<'EOM'
12356   Support flag bits are:
12357     1: basic void declarations.
12358     2: arrays of pointers to functions returning void.
12359     4: operations between pointers to and addresses of void functions.
12360     8: generic void pointers.
12361 EOM
12362         dflt="$voidflags";
12363         rp="Your void support flags add up to what?"
12364         . ./myread
12365         voidflags="$ans"
12366         ;;
12367 esac
12368 $rm -f try.* .out
12369
12370
12371 : How can we generate normalized random numbers ?
12372 echo " "
12373 echo "Looking for a random number function..." >&4
12374 case "$randfunc" in
12375 '')
12376         if set drand48 val -f; eval $csym; $val; then
12377                 dflt="drand48"
12378                 echo "Good, found drand48()." >&4
12379         elif set random val -f; eval $csym; $val; then
12380                 dflt="random"
12381                 echo "OK, found random()." >&4
12382         else
12383                 dflt="rand"
12384                 echo "Yick, looks like I have to use rand()." >&4
12385         fi
12386         echo " "
12387         ;;
12388 *)
12389         dflt="$randfunc"
12390         ;;
12391 esac
12392 cont=true
12393
12394 case "$ccflags" in
12395 *-Dmy_rand=*|*-Dmy_srand=*)
12396         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12397         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12398         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12399         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12400         ;;
12401 esac
12402
12403 while $test "$cont"; do
12404         rp="Use which function to generate random numbers?"
12405         . ./myread
12406         if $test "$ans" = "$dflt"; then
12407                 : null
12408         else
12409                 randbits=''
12410         fi
12411         randfunc="$ans"
12412         if set $ans val -f; eval $csym; $val; then
12413                 cont=''
12414         else
12415                 dflt=y
12416                 rp="I cannot find function $ans. Use that name anyway?"
12417                 . ./myread
12418                 dflt=rand
12419                 case "$ans" in
12420                         [yY]*) cont='';;
12421                 esac
12422         fi
12423         case "$cont" in
12424         '')
12425                 case "$randfunc" in
12426                 drand48)
12427                         drand01="drand48()"
12428                         seedfunc="srand48"
12429                         randbits=48
12430                         randseedtype=long
12431                         ;;
12432                 rand|random)
12433                         case "$randbits" in
12434                         '')
12435 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12436                                 $cat >try.c <<EOCP
12437 #$i_unistd I_UNISTD
12438 #$i_stdlib I_STDLIB
12439 #include <stdio.h>
12440 #ifdef I_UNISTD
12441 #  include <unistd.h>
12442 #endif
12443 #ifdef I_STDLIB
12444 #  include <stdlib.h>
12445 #endif
12446 int main()
12447 {
12448         register int i;
12449         register unsigned long tmp;
12450         register unsigned long max = 0L;
12451
12452         for (i = 1000; i; i--) {
12453                 tmp = (unsigned long) $randfunc();
12454                 if (tmp > max) max = tmp;
12455         }
12456         for (i = 0; max; i++)
12457                 max /= 2;
12458         printf("%d\n",i);
12459 }
12460 EOCP
12461                                 set try
12462                                 if eval $compile_ok; then
12463                                         dflt=`try`
12464                                 else
12465                                         dflt='?'
12466                                         echo "(I can't seem to compile the test program...)"
12467                                 fi
12468                                 ;;
12469                         *)
12470                                 dflt="$randbits"
12471                                 ;;
12472                         esac
12473                         rp="How many bits does your $randfunc() function produce?"
12474                         . ./myread
12475                         randbits="$ans"
12476                         $rm -f try.c try
12477                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12478                         seedfunc="s$randfunc"
12479                         randseedtype=unsigned
12480                         ;;
12481                 *)
12482                         dflt="31"
12483                         rp="How many bits does your $randfunc() function produce?"
12484                         . ./myread
12485                         randbits="$ans"
12486                         seedfunc="s$randfunc"
12487                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12488                         if set $seedfunc val -f; eval $csym; $val; then
12489                                 echo "(Using $seedfunc() to seed random generator)"
12490                         else
12491                                 echo "(Warning: no $seedfunc() to seed random generator)"
12492                                 seedfunc=rand
12493                         fi
12494                         randseedtype=unsigned
12495                         ;;
12496                 esac
12497                 ;;
12498         esac
12499 done
12500
12501 echo " "
12502 echo "Determining whether or not we are on an EBCDIC system..." >&4
12503 $cat >tebcdic.c <<'EOM'
12504 int main()
12505 {
12506   if ('M'==0xd4) return 0;
12507   return 1;
12508 }
12509 EOM
12510
12511 val=$undef
12512 set tebcdic
12513 if eval $compile_ok; then
12514         if ./tebcdic; then
12515                 echo "You have EBCDIC." >&4
12516                 val="$define"
12517         else
12518                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12519         fi
12520 else
12521         echo "I'm unable to compile the test program." >&4
12522         echo "I'll assume ASCII or some ISO Latin." >&4
12523 fi
12524 $rm -f tebcdic.c tebcdic
12525 set ebcdic
12526 eval $setvar
12527
12528 echo " "
12529 $cat >&4 <<EOM
12530 Checking how to flush all pending stdio output...
12531 EOM
12532 # I only know how to find the first 32 possibly open files on SunOS.
12533 # See also hints/sunos_4_1.sh and util.c  --AD
12534 case "$osname" in
12535 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12536 esac
12537 $cat >>try.c <<EOCP
12538 #include <stdio.h>
12539 #$i_unistd I_UNISTD
12540 #ifdef I_UNISTD
12541 # include <unistd.h>
12542 #endif
12543 #$d_sysconf HAS_SYSCONF
12544 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12545 #ifdef HAS_STDIO_STREAM_ARRAY
12546 # define STDIO_STREAM_ARRAY $stdio_stream_array
12547 #endif
12548 int main() {
12549   FILE* p = fopen("try.out", "w");
12550 #ifdef TRY_FPUTC
12551   fputc('x', p);
12552 #else
12553 # ifdef TRY_FPRINTF
12554   fprintf(p, "x");
12555 # endif
12556 #endif
12557 #ifdef TRY_FFLUSH_NULL
12558   fflush(NULL);
12559 #endif
12560 #ifdef TRY_FFLUSH_ALL
12561   {
12562     long open_max = -1;
12563 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12564     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12565 # else
12566 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12567     open_max = sysconf(_SC_OPEN_MAX);
12568 #  else
12569 #   ifdef FOPEN_MAX
12570     open_max = FOPEN_MAX;
12571 #   else
12572 #    ifdef OPEN_MAX
12573     open_max = OPEN_MAX;
12574 #    else
12575 #     ifdef _NFILE
12576     open_max = _NFILE;
12577 #     endif
12578 #    endif
12579 #   endif
12580 #  endif
12581 # endif 
12582 # ifdef HAS_STDIO_STREAM_ARRAY
12583     if (open_max > 0) {
12584       long i;
12585       for (i = 0; i < open_max; i++)
12586             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12587                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12588                 STDIO_STREAM_ARRAY[i]._flag)
12589                 fflush(&STDIO_STREAM_ARRAY[i]);
12590     }   
12591   }
12592 # endif
12593 #endif
12594   _exit(42);
12595 }
12596 EOCP
12597 : first we have to find out how _not_ to flush
12598 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12599     output=''
12600     set try -DTRY_FPUTC
12601     if eval $compile; then
12602             $rm -f try.out
12603             ./try$exe_ext 2>/dev/null
12604             if $test ! -s try.out -a "X$?" = X42; then
12605                 output=-DTRY_FPUTC
12606             fi
12607     fi
12608     case "$output" in
12609     '')
12610             set try -DTRY_FPRINTF
12611             $rm -f try.out
12612             if eval $compile; then
12613                     $rm -f try.out
12614                     ./try$exe_ext 2>/dev/null
12615                     if $test ! -s try.out -a "X$?" = X42; then
12616                         output=-DTRY_FPRINTF
12617                     fi
12618             fi
12619         ;;
12620     esac
12621 fi
12622 : check for fflush NULL behaviour
12623 case "$fflushNULL" in
12624 '')     set try -DTRY_FFLUSH_NULL $output
12625         if eval $compile; then
12626                 $rm -f try.out
12627                 ./try$exe_ext 2>/dev/null
12628                 code="$?"
12629                 if $test -s try.out -a "X$code" = X42; then
12630                         fflushNULL="`$cat try.out`"
12631                 else
12632                         if $test "X$code" != X42; then
12633                                 $cat >&4 <<EOM
12634 (If this test failed, don't worry, we'll try another method shortly.)
12635 EOM
12636                         fi
12637                 fi
12638         fi
12639         $rm -f core try.core core.try.*
12640         case "$fflushNULL" in
12641         x)      $cat >&4 <<EOM
12642 Your fflush(NULL) works okay for output streams.
12643 Let's see if it clobbers input pipes...
12644 EOM
12645 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12646 # bug that improperly flushes the input end of pipes.  So we avoid the
12647 # autoflush on fork/system/exec support for now. :-(
12648 $cat >tryp.c <<EOCP
12649 #include <stdio.h>
12650 int
12651 main(int argc, char **argv)
12652 {
12653     char buf[1024];
12654     int i;
12655     char *bp = buf;
12656     while (1) {
12657         while ((i = getc(stdin)) != -1
12658                && (*bp++ = i) != '\n'
12659                && bp < &buf[1024])
12660         /* DO NOTHING */ ;
12661         *bp = '\0';
12662         fprintf(stdout, "%s", buf);
12663         fflush(NULL);
12664         if (i == -1)
12665             return 0;
12666         bp = buf;
12667     }
12668 }
12669 EOCP
12670                 fflushNULL="$define"
12671                 set tryp
12672                 if eval $compile; then
12673                     $rm -f tryp.out
12674                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12675                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12676                        $cat >&4 <<EOM
12677 fflush(NULL) seems to behave okay with input streams.
12678 EOM
12679                         fflushNULL="$define"
12680                     else
12681                         $cat >&4 <<EOM
12682 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12683 EOM
12684                         fflushNULL="$undef"
12685                     fi
12686                 fi
12687                 $rm -f core tryp.c tryp.core core.tryp.*
12688                 ;;
12689         '')     $cat >&4 <<EOM
12690 Your fflush(NULL) isn't working (contrary to ANSI C).
12691 EOM
12692                 fflushNULL="$undef"
12693                 ;;
12694         *)      $cat >&4 <<EOM
12695 Cannot figure out whether your fflush(NULL) works or not.
12696 I'm assuming it doesn't (contrary to ANSI C).
12697 EOM
12698                 fflushNULL="$undef"
12699                 ;;
12700         esac
12701         ;;
12702 $define|true|[yY]*)
12703         fflushNULL="$define"
12704         ;;
12705 *)
12706         fflushNULL="$undef"
12707         ;;
12708 esac
12709 : check explicit looping only if NULL did not work, and if the pipe
12710 : bug does not show up on an explicit flush too
12711 case "$fflushNULL" in
12712 "$undef")
12713         $cat >tryp.c <<EOCP
12714 #include <stdio.h>
12715 int
12716 main(int argc, char **argv)
12717 {
12718     char buf[1024];
12719     int i;
12720     char *bp = buf;
12721     while (1) {
12722         while ((i = getc(stdin)) != -1
12723                && (*bp++ = i) != '\n'
12724                && bp < &buf[1024])
12725         /* DO NOTHING */ ;
12726         *bp = '\0';
12727         fprintf(stdout, "%s", buf);
12728         fflush(stdin);
12729         if (i == -1)
12730             return 0;
12731         bp = buf;
12732     }
12733 }
12734 EOCP
12735         set tryp
12736         if eval $compile; then
12737             $rm -f tryp.out
12738             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12739             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12740                $cat >&4 <<EOM
12741 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12742 EOM
12743                 : now check for fflushall behaviour
12744                 case "$fflushall" in
12745                 '')     set try -DTRY_FFLUSH_ALL $output
12746                         if eval $compile; then
12747                                 $cat >&4 <<EOM
12748 (Now testing the other method--but note that this also may fail.)
12749 EOM
12750                                 $rm -f try.out
12751                                 ./try$exe_ext 2>/dev/null
12752                                 if $test -s try.out -a "X$?" = X42; then
12753                                         fflushall="`$cat try.out`"
12754                                 fi
12755                         fi
12756                         $rm -f core try.core core.try.*
12757                         case "$fflushall" in
12758                         x)      $cat >&4 <<EOM
12759 Whew. Flushing explicitly all the stdio streams works.
12760 EOM
12761                                 fflushall="$define"
12762                                 ;;
12763                         '')     $cat >&4 <<EOM
12764 Sigh. Flushing explicitly all the stdio streams doesn't work.
12765 EOM
12766                                 fflushall="$undef"
12767                                 ;;
12768                         *)      $cat >&4 <<EOM
12769 Cannot figure out whether flushing stdio streams explicitly works or not.
12770 I'm assuming it doesn't.
12771 EOM
12772                                 fflushall="$undef"
12773                                 ;;
12774                         esac
12775                         ;;
12776                 "$define"|true|[yY]*)
12777                         fflushall="$define"
12778                         ;;
12779                 *)
12780                         fflushall="$undef"
12781                         ;;
12782                 esac
12783             else
12784                 $cat >&4 <<EOM
12785 All is futile.  Even fflush(stdin) clobbers input pipes!
12786 EOM
12787                 fflushall="$undef"
12788             fi
12789         else
12790             fflushall="$undef"
12791         fi
12792         $rm -f core tryp.c tryp.core core.tryp.*
12793         ;;
12794 *)      fflushall="$undef"
12795         ;;
12796 esac
12797
12798 case "$fflushNULL$fflushall" in
12799 undefundef)
12800         $cat <<EOM
12801 OK, I give up.  I cannot figure out how to flush pending stdio output.
12802 We won't be flushing handles at all before fork/exec/popen.
12803 EOM
12804         ;;
12805 esac
12806 $rm -f try.* try$exe_ext
12807
12808 : Store the full pathname to the ar program for use in the C program
12809 : Respect a hint or command line value for full_ar.
12810 case "$full_ar" in
12811 '') full_ar=$ar ;;
12812 esac
12813
12814 : Store the full pathname to the sed program for use in the C program
12815 full_sed=$sed
12816
12817 : see what type gids are declared as in the kernel
12818 echo " "
12819 echo "Looking for the type for group ids returned by getgid()."
12820 set gid_t gidtype xxx stdio.h sys/types.h
12821 eval $typedef
12822 case "$gidtype" in
12823 xxx)
12824         xxx=`./findhdr sys/user.h`
12825         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12826         case $1 in
12827         unsigned) dflt="$1 $2" ;;
12828         *) dflt="$1" ;;
12829         esac
12830         ;;
12831 *) dflt="$gidtype";;
12832 esac
12833 case "$gidtype" in
12834 gid_t) echo "gid_t found." ;;
12835 *)      rp="What is the type for group ids returned by getgid()?"
12836         . ./myread
12837         gidtype="$ans"
12838         ;;
12839 esac
12840
12841 echo " "
12842 case "$gidtype" in
12843 *_t) zzz="$gidtype"     ;;
12844 *)   zzz="gid"          ;;
12845 esac
12846 echo "Checking the size of $zzz..." >&4 
12847 cat > try.c <<EOCP
12848 #include <sys/types.h>
12849 #include <stdio.h>
12850 int main() {
12851     printf("%d\n", (int)sizeof($gidtype));
12852     exit(0);
12853 }
12854 EOCP
12855 set try
12856 if eval $compile_ok; then
12857         yyy=`./try`
12858         case "$yyy" in
12859         '')     gidsize=4
12860                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12861                 ;;
12862         *)      gidsize=$yyy
12863                 echo "Your $zzz is $gidsize bytes long."
12864                 ;;
12865         esac
12866 else
12867         gidsize=4
12868         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12869 fi
12870
12871
12872 echo " "
12873 case "$gidtype" in
12874 *_t) zzz="$gidtype"     ;;
12875 *)   zzz="gid"          ;;
12876 esac
12877 echo "Checking the sign of $zzz..." >&4 
12878 cat > try.c <<EOCP
12879 #include <sys/types.h>
12880 #include <stdio.h>
12881 int main() {
12882         $gidtype foo = -1;
12883         if (foo < 0)
12884                 printf("-1\n");
12885         else
12886                 printf("1\n");
12887 }
12888 EOCP
12889 set try
12890 if eval $compile; then
12891         yyy=`./try`
12892         case "$yyy" in
12893         '')     gidsign=1
12894                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12895                 ;;
12896         *)      gidsign=$yyy
12897                 case "$gidsign" in
12898                  1) echo "Your $zzz is unsigned." ;;
12899                 -1) echo "Your $zzz is signed."   ;;
12900                 esac
12901                 ;;
12902         esac
12903 else
12904         gidsign=1
12905         echo "(I can't compile the test program--guessing unsigned.)" >&4
12906 fi
12907
12908
12909 echo " "
12910
12911 if $test X"$quadtype" != X; then
12912
12913 echo "Checking how to print 64-bit integers..." >&4
12914
12915 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12916         $cat >try.c <<'EOCP'
12917 #include <sys/types.h>
12918 #include <stdio.h>
12919 int main() {
12920   int q = 12345678901;
12921   printf("%ld\n", q);
12922 }
12923 EOCP
12924         set try
12925         if eval $compile; then
12926                 yyy=`./try$exe_ext`
12927                 case "$yyy" in
12928                 12345678901)
12929                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12930                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12931                         echo "We will use %d."
12932                         ;;
12933                 esac
12934         fi
12935 fi
12936
12937 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12938         $cat >try.c <<'EOCP'
12939 #include <sys/types.h>
12940 #include <stdio.h>
12941 int main() {
12942   long q = 12345678901;
12943   printf("%ld\n", q);
12944 }
12945 EOCP
12946         set try
12947         if eval $compile; then
12948                 yyy=`./try$exe_ext`
12949                 case "$yyy" in
12950                 12345678901)
12951                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12952                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12953                         echo "We will use %ld."
12954                         ;;
12955                 esac
12956         fi
12957 fi
12958
12959 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12960         $cat >try.c <<'EOCP'
12961 #include <sys/types.h>
12962 #include <inttypes.h>
12963 #include <stdio.h>
12964 int main() {
12965   int64_t q = 12345678901;
12966   printf("%" PRId64 "\n", q);
12967 }
12968 EOCP
12969         set try
12970         if eval $compile; then
12971                 yyy=`./try$exe_ext`
12972                 case "$yyy" in
12973                 12345678901)
12974                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12975                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12976                         echo "We will use the C9X style."
12977                         ;;
12978                 esac
12979         fi
12980 fi
12981
12982 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12983         $cat >try.c <<'EOCP'
12984 #include <sys/types.h>
12985 #include <stdio.h>
12986 int main() {
12987   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12988   printf("%lld\n", q);
12989 }
12990 EOCP
12991         set try
12992         if eval $compile; then
12993                 yyy=`./try$exe_ext`
12994                 case "$yyy" in
12995                 12345678901)
12996                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12997                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12998                         echo "We will use the %lld style."
12999                         ;;
13000                 esac
13001         fi
13002 fi
13003
13004 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13005         $cat >try.c <<EOCP
13006 #include <sys/types.h>
13007 #include <stdio.h>
13008 int main() {
13009   $quadtype q = 12345678901;
13010   printf("%Ld\n", q);
13011 }
13012 EOCP
13013         set try
13014         if eval $compile; then
13015                 yyy=`./try$exe_ext`
13016                 case "$yyy" in
13017                 12345678901)
13018                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13019                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13020                         echo "We will use %Ld."
13021                         ;;
13022                 esac
13023         fi
13024 fi
13025
13026 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13027         $cat >try.c <<EOCP
13028 #include <sys/types.h>
13029 #include <stdio.h>
13030 int main() {
13031   $quadtype q = 12345678901;
13032   printf("%qd\n", q);
13033 }
13034 EOCP
13035         set try
13036         if eval $compile; then
13037                 yyy=`./try$exe_ext`
13038                 case "$yyy" in
13039                 12345678901)
13040                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13041                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13042                         echo "We will use %qd."
13043                         ;;
13044                 esac
13045         fi
13046 fi
13047
13048 if $test X"$sPRId64" = X; then
13049         echo "Cannot figure out how to print 64-bit integers." >&4
13050 fi
13051
13052 $rm -f try try.*
13053
13054 fi
13055
13056 case "$sPRId64" in
13057 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13058         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13059         ;;
13060 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13061         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13062         ;;
13063 esac
13064
13065
13066 echo " "
13067 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13068
13069 if $test X"$ivsize" = X8; then
13070         ivdformat="$sPRId64"
13071         uvuformat="$sPRIu64"
13072         uvoformat="$sPRIo64"
13073         uvxformat="$sPRIx64"
13074 else
13075         if $test X"$ivsize" = X"$longsize"; then
13076                 ivdformat='"ld"'
13077                 uvuformat='"lu"'
13078                 uvoformat='"lo"'
13079                 uvxformat='"lx"'
13080         else
13081                 if $test X"$ivsize" = X"$intsize"; then
13082                         ivdformat='"d"'
13083                         uvuformat='"u"'
13084                         uvoformat='"o"'
13085                         uvxformat='"x"'
13086                 else
13087                         : far out
13088                         if $test X"$ivsize" = X"$shortsize"; then
13089                                 ivdformat='"hd"'
13090                                 uvuformat='"hu"'
13091                                 uvoformat='"ho"'
13092                                 uvxformat='"hx"'
13093                         fi
13094                 fi
13095         fi
13096 fi
13097
13098 case "$ivdformat" in
13099 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13100     exit 1
13101     ;;
13102 esac
13103
13104
13105 echo " "
13106 $echo "Checking the format string to be used for gids..." >&4
13107
13108 case "$gidsign" in
13109 -1)     if $test X"$gidsize" = X"$ivsize"; then
13110                 gidformat="$ivdformat"
13111         else
13112                 if $test X"$gidsize" = X"$longsize"; then
13113                         gidformat='"ld"'
13114                 else
13115                         if $test X"$gidsize" = X"$intsize"; then
13116                                 gidformat='"d"'
13117                         else
13118                                 if $test X"$gidsize" = X"$shortsize"; then
13119                                         gidformat='"hd"'
13120                                 fi
13121                         fi
13122                 fi
13123         fi
13124         ;;
13125 *)      if $test X"$gidsize" = X"$uvsize"; then
13126                 gidformat="$uvuformat"
13127         else
13128                 if $test X"$gidsize" = X"$longsize"; then
13129                         gidformat='"lu"'
13130                 else
13131                         if $test X"$gidsize" = X"$intsize"; then
13132                                 gidformat='"u"'
13133                         else
13134                                 if $test X"$gidsize" = X"$shortsize"; then
13135                                         gidformat='"hu"'
13136                                 fi
13137                         fi
13138                 fi
13139         fi
13140         ;;
13141 esac
13142
13143 : see if getgroups exists
13144 set getgroups d_getgrps
13145 eval $inlibc
13146
13147 : see if setgroups exists
13148 set setgroups d_setgrps
13149 eval $inlibc
13150
13151
13152 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13153 echo " "
13154 case "$d_getgrps$d_setgrps" in
13155 *define*)
13156         case "$groupstype" in
13157         '') dflt="$gidtype" ;;
13158         *)  dflt="$groupstype" ;;
13159         esac
13160         $cat <<EOM
13161 What type of pointer is the second argument to getgroups() and setgroups()?
13162 Usually this is the same as group ids, $gidtype, but not always.
13163
13164 EOM
13165         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13166         . ./myread
13167         groupstype="$ans"
13168         ;;
13169 *)  groupstype="$gidtype";;
13170 esac
13171
13172 echo " "
13173 echo "Checking if your $make program sets \$(MAKE)..." >&4
13174 case "$make_set_make" in
13175 '')
13176         $sed 's/^X //' > testmake.mak << 'EOF'
13177 Xall:
13178 X       @echo 'maketemp="$(MAKE)"'
13179 EOF
13180         case "`$make -f testmake.mak 2>/dev/null`" in
13181         *maketemp=*) make_set_make='#' ;;
13182         *)      make_set_make="MAKE=$make" ;;
13183         esac
13184         $rm -f testmake.mak
13185         ;;
13186 esac
13187 case "$make_set_make" in
13188 '#') echo "Yup, it does.";;
13189 *) echo "Nope, it doesn't.";;
13190 esac
13191
13192 : see what type is used for mode_t
13193 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13194 set mode_t modetype int stdio.h sys/types.h
13195 eval $typedef_ask
13196
13197 : define a fucntion to check prototypes
13198 $cat > protochk <<EOSH
13199 $startsh
13200 cc="$cc"
13201 optimize="$optimize"
13202 ccflags="$ccflags"
13203 prototype="$prototype"
13204 define="$define"
13205 rm=$rm
13206 EOSH
13207
13208 $cat >> protochk <<'EOSH'
13209
13210 $rm -f try.c
13211 foo="$1"
13212 shift
13213 while test $# -ge 2; do
13214         case "$1" in
13215                 $define) echo "#include <$2>" >> try.c ;;
13216                 literal) echo "$2" >> try.c ;;
13217         esac
13218     shift 2
13219 done
13220 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13221 cat >> try.c <<'EOCP'
13222 #ifdef CAN_PROTOTYPE
13223 #define _(args) args
13224 #else
13225 #define _(args) ()
13226 #endif
13227 EOCP
13228 echo "$foo" >> try.c
13229 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13230 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13231 status=$?
13232 $rm -f try.[co]
13233 exit $status
13234 EOSH
13235 chmod +x protochk
13236 $eunicefix protochk
13237
13238 : see what type is used for size_t
13239 rp="What is the type used for the length parameter for string functions?"
13240 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13241 eval $typedef_ask
13242
13243 : check for type of arguments to gethostbyaddr. 
13244 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13245         case "$d_gethbyaddr" in
13246         $define)
13247                 $cat <<EOM
13248
13249 Checking to see what type of arguments are accepted by gethostbyaddr().
13250 EOM
13251                 hdrs="$define sys/types.h
13252                         $d_socket sys/socket.h 
13253                         $i_niin netinet/in.h 
13254                         $i_netdb netdb.h
13255                         $i_unistd unistd.h"
13256                 : The first arg can 'char *' or 'void *'
13257                 : The second arg is some of integral type
13258                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13259                         for yyy in size_t long int; do
13260                                 case "$netdb_host_type" in
13261                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13262                                         if ./protochk "$try" $hdrs; then
13263                                                 echo "Your system accepts $xxx for the first arg."
13264                                                 echo "...and $yyy for the second arg."
13265                                                 netdb_host_type="$xxx"
13266                                                 netdb_hlen_type="$yyy"
13267                                         fi
13268                                         ;;
13269                                 esac
13270                         done
13271                 done
13272                 : In case none of those worked, prompt the user.
13273                 case "$netdb_host_type" in
13274                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13275                         dflt='char *'
13276                         . ./myread
13277                         netdb_host_type=$ans
13278                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13279                         dflt="$sizetype"
13280                         . ./myread
13281                         netdb_hlen_type=$ans
13282                         ;;
13283                 esac
13284                 ;;
13285         *)      : no gethostbyaddr, so pick harmless defaults
13286                 netdb_host_type='char *'
13287                 netdb_hlen_type="$sizetype"
13288                 ;;
13289         esac
13290         # Remove the "const" if needed. -- but then we'll have a 
13291         # prototype clash!
13292         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13293 fi
13294
13295 : check for type of argument to gethostbyname. 
13296 if test "X$netdb_name_type" = X ; then
13297         case "$d_gethbyname" in
13298         $define)
13299                 $cat <<EOM
13300
13301 Checking to see what type of argument is accepted by gethostbyname().
13302 EOM
13303                 hdrs="$define sys/types.h
13304                         $d_socket sys/socket.h 
13305                         $i_niin netinet/in.h 
13306                         $i_netdb netdb.h
13307                         $i_unistd unistd.h"
13308                 for xxx in "const char *" "char *"; do
13309                         case "$netdb_name_type" in
13310                         '')     try="extern struct hostent *gethostbyname($xxx);"
13311                                 if ./protochk "$try" $hdrs; then
13312                                         echo "Your system accepts $xxx."
13313                                         netdb_name_type="$xxx"
13314                                 fi
13315                                 ;;
13316                         esac
13317                 done
13318                 : In case none of those worked, prompt the user.
13319                 case "$netdb_name_type" in
13320                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13321                         dflt='char *'
13322                         . ./myread
13323                         netdb_name_type=$ans
13324                         ;;
13325                 esac
13326                 ;;
13327         *)      : no gethostbyname, so pick harmless default
13328                 netdb_name_type='char *'
13329                 ;;
13330         esac
13331 fi
13332
13333 : check for type of 1st argument to getnetbyaddr. 
13334 if test "X$netdb_net_type" = X ; then
13335         case "$d_getnbyaddr" in
13336         $define)
13337                 $cat <<EOM
13338
13339 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13340 EOM
13341                 hdrs="$define sys/types.h
13342                         $d_socket sys/socket.h 
13343                         $i_niin netinet/in.h 
13344                         $i_netdb netdb.h
13345                         $i_unistd unistd.h"
13346                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13347                         case "$netdb_net_type" in
13348                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13349                                 if ./protochk "$try" $hdrs; then
13350                                         echo "Your system accepts $xxx."
13351                                         netdb_net_type="$xxx"
13352                                 fi
13353                                 ;;
13354                         esac
13355                 done
13356                 : In case none of those worked, prompt the user.
13357                 case "$netdb_net_type" in
13358                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13359                         dflt='long'
13360                         . ./myread
13361                         netdb_net_type=$ans
13362                         ;;
13363                 esac
13364                 ;;
13365         *)      : no getnetbyaddr, so pick harmless default
13366                 netdb_net_type='long'
13367                 ;;
13368         esac
13369 fi
13370 : locate the preferred pager for this system
13371 case "$pager" in
13372 '')
13373         dflt=''
13374         case "$pg" in
13375         /*) dflt=$pg;;
13376         esac
13377         case "$more" in
13378         /*) dflt=$more;;
13379         esac
13380         case "$less" in
13381         /*) dflt=$less;;
13382         esac
13383         case "$dflt" in
13384         '') dflt=/usr/ucb/more;;
13385         esac
13386         ;;
13387 *) dflt="$pager";;
13388 esac
13389 echo " "
13390 fn=f/
13391 rp='What pager is used on your system?'
13392 . ./getfile
13393 pager="$ans"
13394
13395 : see what type pids are declared as in the kernel
13396 rp="What is the type of process ids on this system?"
13397 set pid_t pidtype int stdio.h sys/types.h
13398 eval $typedef_ask
13399
13400 : Find earliest binary compatible site_perl subdirectory perl can use.
13401 case "$bincompat5005" in
13402 "$define") xs_apiversion='5.005' ;;
13403 *) xs_apiversion=$version ;;   # The current site_perl version.
13404 esac
13405 : Find earliest pure perl site_perl subdirectory perl can use.
13406 : The versioned directories started at 5.005.
13407 pm_apiversion='5.005'
13408
13409 : check for length of pointer
13410 echo " "
13411 case "$ptrsize" in
13412 '')
13413         echo "Checking to see how big your pointers are..." >&4
13414         if test "$voidflags" -gt 7; then
13415                 echo '#define VOID_PTR char *' > try.c
13416         else
13417                 echo '#define VOID_PTR void *' > try.c
13418         fi
13419         $cat >>try.c <<'EOCP'
13420 #include <stdio.h>
13421 int main()
13422 {
13423     printf("%d\n", (int)sizeof(VOID_PTR));
13424     exit(0);
13425 }
13426 EOCP
13427         set try
13428         if eval $compile_ok; then
13429                 ptrsize=`./try`
13430                 echo "Your pointers are $ptrsize bytes long."
13431         else
13432                 dflt='4'
13433                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13434                 rp="What is the size of a pointer (in bytes)?"
13435                 . ./myread
13436                 ptrsize="$ans"
13437         fi
13438         ;;
13439 esac
13440 $rm -f try.c try
13441
13442 : see if ar generates random libraries by itself
13443 echo " "
13444 echo "Checking how to generate random libraries on your machine..." >&4
13445 echo 'int bar1() { return bar2(); }' > bar1.c
13446 echo 'int bar2() { return 2; }' > bar2.c
13447 $cat > foo.c <<'EOP'
13448 int main() { printf("%d\n", bar1()); exit(0); }
13449 EOP
13450 $cc $ccflags -c bar1.c >/dev/null 2>&1
13451 $cc $ccflags -c bar2.c >/dev/null 2>&1
13452 $cc $ccflags -c foo.c >/dev/null 2>&1
13453 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13454 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13455         ./foobar >/dev/null 2>&1; then
13456         echo "$ar appears to generate random libraries itself."
13457         orderlib=false
13458         ranlib=":"
13459 elif $ar ts bar$_a >/dev/null 2>&1 &&
13460         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13461         ./foobar >/dev/null 2>&1; then
13462                 echo "a table of contents needs to be added with '$ar ts'."
13463                 orderlib=false
13464                 ranlib="$ar ts"
13465 else
13466         case "$ranlib" in
13467         :) ranlib='';;
13468         '')
13469                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13470                 $test -f $ranlib || ranlib=''
13471                 ;;
13472         esac
13473         if $test -n "$ranlib"; then
13474                 echo "your system has '$ranlib'; we'll use that."
13475                 orderlib=false
13476         else
13477                 echo "your system doesn't seem to support random libraries"
13478                 echo "so we'll use lorder and tsort to order the libraries."
13479                 orderlib=true
13480                 ranlib=":"
13481         fi
13482 fi
13483 $rm -f foo* bar* 
13484
13485 : check for type of arguments to select. 
13486 case "$selecttype" in
13487 '') case "$d_select" in
13488         $define)
13489                 echo " "
13490                 $cat <<EOM
13491 Checking to see what type of arguments are accepted by select().
13492 EOM
13493                 hdrs="$define sys/types.h
13494                         $i_systime sys/time.h 
13495                         $i_sysselct sys/select.h
13496                         $d_socket sys/socket.h"
13497                 : The first arg can be int, unsigned, or size_t
13498                 : The last arg may or may not be 'const'
13499                 val=''
13500                 : void pointer has been seen but using that
13501                 : breaks the selectminbits test
13502                 for xxx in 'fd_set *' 'int *'; do
13503                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13504                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13505                                         case "$val" in
13506                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13507                                                 if ./protochk "$try" $hdrs; then
13508                                                         echo "Your system accepts $xxx."
13509                                                         val="$xxx"
13510                                                 fi
13511                                                 ;;
13512                                         esac
13513                                 done
13514                         done
13515                 done
13516                 case "$val" in
13517                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13518                         case "$d_fd_set" in
13519                                 $define) dflt="fd_set *" ;;
13520                                 *)              dflt="int *" ;;
13521                         esac
13522                         . ./myread
13523                         val=$ans
13524                         ;;
13525                 esac
13526                 selecttype="$val"
13527                 ;;
13528         *)      : no select, so pick a harmless default
13529                 selecttype='int *'
13530                 ;;
13531         esac
13532         ;;
13533 esac
13534
13535 : check for the select 'width'
13536 case "$selectminbits" in
13537 '') case "$d_select" in
13538         $define)
13539                 $cat <<EOM
13540
13541 Checking to see on how many bits at a time your select() operates...
13542 EOM
13543                 $cat >try.c <<EOCP
13544 #include <sys/types.h>
13545 #$i_time I_TIME
13546 #$i_systime I_SYS_TIME
13547 #$i_systimek I_SYS_TIME_KERNEL
13548 #ifdef I_TIME
13549 #   include <time.h>
13550 #endif
13551 #ifdef I_SYS_TIME
13552 #   ifdef I_SYS_TIME_KERNEL
13553 #       define KERNEL
13554 #   endif
13555 #   include <sys/time.h>
13556 #   ifdef I_SYS_TIME_KERNEL
13557 #       undef KERNEL
13558 #   endif
13559 #endif
13560 #$i_sysselct I_SYS_SELECT
13561 #ifdef I_SYS_SELECT
13562 #include <sys/select.h>
13563 #endif
13564 #$d_socket HAS_SOCKET
13565 #ifdef HAS_SOCKET
13566 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13567 #endif
13568 #include <stdio.h>
13569 $selecttype b;
13570 #define S sizeof(*(b))
13571 #define MINBITS 64
13572 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13573 #define NBITS  (NBYTES * 8)
13574 int main() {
13575     char s[NBYTES];
13576     struct timeval t;
13577     int i;
13578     FILE* fp;
13579     int fd;
13580
13581     fclose(stdin);
13582     fp = fopen("try.c", "r");
13583     if (fp == 0)
13584       exit(1);
13585     fd = fileno(fp);
13586     if (fd < 0)
13587       exit(2);
13588     b = ($selecttype)s;
13589     for (i = 0; i < NBITS; i++)
13590         FD_SET(i, b);
13591     t.tv_sec  = 0;
13592     t.tv_usec = 0;
13593     select(fd + 1, b, 0, 0, &t);
13594     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13595     printf("%d\n", i + 1);
13596     return 0;
13597 }
13598 EOCP
13599                 set try
13600                 if eval $compile_ok; then
13601                         selectminbits=`./try`
13602                         case "$selectminbits" in
13603                         '')     cat >&4 <<EOM
13604 Cannot figure out on how many bits at a time your select() operates.
13605 I'll play safe and guess it is 32 bits.
13606 EOM
13607                                 selectminbits=32
13608                                 bits="32 bits"
13609                                 ;;
13610                         1)      bits="1 bit" ;;
13611                         *)      bits="$selectminbits bits" ;;
13612                         esac
13613                         echo "Your select() operates on $bits at a time." >&4
13614                 else
13615                         rp='What is the minimum number of bits your select() operates on?'
13616                         case "$byteorder" in
13617                         1234|12345678)  dflt=32 ;;
13618                         *)              dflt=1  ;;
13619                         esac
13620                         . ./myread
13621                         val=$ans
13622                         selectminbits="$val"
13623                 fi
13624                 $rm -f try.* try
13625                 ;;
13626         *)      : no select, so pick a harmless default
13627                 selectminbits='32'
13628                 ;;
13629         esac
13630         ;;
13631 esac
13632
13633 : Trace out the files included by signal.h, then look for SIGxxx names.
13634 : Remove SIGARRAYSIZE used by HPUX.
13635 : Remove SIGSTKSIZE used by Linux.
13636 : Remove SIGSTKSZ used by Posix.
13637 : Remove SIGTYP void lines used by OS2.
13638 : Some cpps, like os390, dont give the file name anywhere
13639 if [ "X$fieldn" = X ]; then
13640         : Just make some guesses.  We check them later.
13641         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13642 else
13643         xxx=`echo '#include <signal.h>' |
13644         $cppstdin $cppminus $cppflags 2>/dev/null |
13645         $grep '^[       ]*#.*include' | 
13646         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13647 fi
13648 : Check this list of files to be sure we have parsed the cpp output ok.
13649 : This will also avoid potentially non-existent files, such 
13650 : as ../foo/bar.h
13651 xxxfiles=''
13652 for xx in $xxx /dev/null ; do
13653         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13654 done
13655 : If we have found no files, at least try signal.h
13656 case "$xxxfiles" in
13657 '')     xxxfiles=`./findhdr signal.h` ;;
13658 esac
13659 xxx=`awk '
13660 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13661         print substr($2, 4, 20)
13662 }
13663 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13664         print substr($3, 4, 20)
13665 }' $xxxfiles`
13666 : Append some common names just in case the awk scan failed.
13667 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13668 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13669 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13670 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13671 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13672
13673 : generate a few handy files for later
13674 $cat > signal.c <<'EOCP'
13675 #include <sys/types.h>
13676 #include <signal.h>
13677 #include <stdio.h>
13678 int main() {
13679
13680 /* Strange style to avoid deeply-nested #if/#else/#endif */
13681 #ifndef NSIG
13682 #  ifdef _NSIG
13683 #    define NSIG (_NSIG)
13684 #  endif
13685 #endif
13686
13687 #ifndef NSIG
13688 #  ifdef SIGMAX
13689 #    define NSIG (SIGMAX+1)
13690 #  endif
13691 #endif
13692
13693 #ifndef NSIG
13694 #  ifdef SIG_MAX
13695 #    define NSIG (SIG_MAX+1)
13696 #  endif
13697 #endif
13698
13699 #ifndef NSIG
13700 #  ifdef MAXSIG
13701 #    define NSIG (MAXSIG+1)
13702 #  endif
13703 #endif
13704
13705 #ifndef NSIG
13706 #  ifdef MAX_SIG
13707 #    define NSIG (MAX_SIG+1)
13708 #  endif
13709 #endif
13710
13711 #ifndef NSIG
13712 #  ifdef SIGARRAYSIZE
13713 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13714 #  endif
13715 #endif
13716
13717 #ifndef NSIG
13718 #  ifdef _sys_nsig
13719 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13720 #  endif
13721 #endif
13722
13723 /* Default to some arbitrary number that's big enough to get most
13724    of the common signals.
13725 */
13726 #ifndef NSIG
13727 #    define NSIG 50
13728 #endif
13729
13730 printf("NSIG %d\n", NSIG);
13731
13732 #ifndef JUST_NSIG
13733
13734 EOCP
13735
13736 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13737 {
13738         printf "#ifdef SIG"; printf $1; printf "\n"
13739         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13740         printf $1; printf ");\n"
13741         printf "#endif\n"
13742 }
13743 END {
13744         printf "#endif /* JUST_NSIG */\n";
13745         printf "exit(0);\n}\n";
13746 }
13747 ' >>signal.c
13748 $cat >signal.awk <<'EOP'
13749 BEGIN { ndups = 0 }
13750 $1 ~ /^NSIG$/ { nsig = $2 }
13751 ($1 !~ /^NSIG$/) && (NF == 2) {
13752     if ($2 > maxsig) { maxsig = $2 }
13753     if (sig_name[$2]) {
13754         dup_name[ndups] = $1
13755         dup_num[ndups] = $2
13756         ndups++ 
13757     }
13758     else {
13759         sig_name[$2] = $1
13760         sig_num[$2] = $2
13761     }
13762 }
13763 END { 
13764     if (nsig == 0) {
13765         nsig = maxsig + 1
13766     }
13767     printf("NSIG %d\n", nsig);
13768     for (n = 1; n < nsig; n++) {
13769         if (sig_name[n]) {
13770             printf("%s %d\n", sig_name[n], sig_num[n])
13771         }
13772         else {
13773             printf("NUM%d %d\n", n, n) 
13774         }
13775     }
13776     for (n = 0; n < ndups; n++) {
13777         printf("%s %d\n", dup_name[n], dup_num[n])
13778     }
13779 }
13780 EOP
13781 $cat >signal_cmd <<EOS
13782 $startsh
13783 if $test -s signal.lst; then
13784     echo "Using your existing signal.lst file"
13785         exit 0
13786 fi
13787 xxx="$xxx"
13788 EOS
13789 $cat >>signal_cmd <<'EOS'
13790
13791 set signal
13792 if eval $compile_ok; then
13793         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13794 else
13795         echo "(I can't seem be able to compile the whole test program)" >&4
13796         echo "(I'll try it in little pieces.)" >&4
13797         set signal -DJUST_NSIG
13798         if eval $compile_ok; then
13799                 ./signal$_exe > signal.nsg
13800                 $cat signal.nsg
13801         else
13802                 echo "I can't seem to figure out how many signals you have." >&4
13803                 echo "Guessing 50." >&4
13804                 echo 'NSIG 50' > signal.nsg
13805         fi
13806         : Now look at all the signal names, one at a time.
13807         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13808                 $cat > signal.c <<EOCP
13809 #include <sys/types.h>
13810 #include <signal.h>
13811 #include <stdio.h>
13812 int main() {
13813 printf("$xx %d\n", SIG${xx});
13814 return 0;
13815 }
13816 EOCP
13817                 set signal
13818                 if eval $compile; then
13819                         echo "SIG${xx} found."
13820                         ./signal$_exe  >> signal.ls1
13821                 else
13822                         echo "SIG${xx} NOT found."
13823                 fi
13824         done
13825         if $test -s signal.ls1; then
13826                 $cat signal.nsg signal.ls1 |
13827                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13828         fi
13829
13830 fi
13831 if $test -s signal.lst; then
13832         :
13833 else
13834         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13835         echo 'kill -l' >signal
13836         set X `csh -f <signal`
13837         $rm -f signal
13838         shift
13839         case $# in
13840         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13841         esac
13842         echo $@ | $tr ' ' $trnl | \
13843             $awk '{ printf "%s %d\n", $1, ++s; }
13844                   END { printf "NSIG %d\n", ++s }' >signal.lst
13845 fi
13846 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13847 EOS
13848 chmod a+x signal_cmd
13849 $eunicefix signal_cmd
13850
13851 : generate list of signal names
13852 echo " "
13853 case "$sig_name_init" in
13854 '') doinit=yes ;;
13855 *)  case "$sig_num_init" in
13856     ''|*,*) doinit=yes ;;
13857     esac ;;
13858 esac
13859 case "$doinit" in
13860 yes)
13861         echo "Generating a list of signal names and numbers..." >&4
13862         . ./signal_cmd
13863         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13864         sig_name=`$awk 'BEGIN { printf "ZERO " }
13865                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13866         sig_num=`$awk  'BEGIN { printf "0 " }
13867                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13868         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13869                              !/^NSIG/   { printf "\"%s\", ", $1 }
13870                              END        { printf "0\n" }' signal.lst`
13871         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13872                              !/^NSIG/   { printf "%d, ", $2}
13873                              END        { printf "0\n"}' signal.lst`
13874         ;;
13875 esac
13876 echo "The following $sig_count signals are available:"
13877 echo " "
13878 echo $sig_name | $awk \
13879 'BEGIN { linelen = 0 }
13880 {
13881         for (i = 1; i <= NF; i++) {
13882                 name = "SIG" $i " "
13883                 linelen = linelen + length(name)
13884                 if (linelen > 70) {
13885                         printf "\n"
13886                         linelen = length(name)
13887                 }
13888                 printf "%s", name
13889         }
13890         printf "\n"
13891 }'
13892 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13893
13894 echo " "
13895 case "$sizetype" in
13896 *_t) zzz="$sizetype"    ;;
13897 *)   zzz="filesize"     ;;
13898 esac
13899 echo "Checking the size of $zzz..." >&4 
13900 cat > try.c <<EOCP
13901 #include <sys/types.h>
13902 #include <stdio.h>
13903 int main() {
13904     printf("%d\n", (int)sizeof($sizetype));
13905     exit(0);
13906 }
13907 EOCP
13908 set try
13909 if eval $compile_ok; then
13910         yyy=`./try`
13911         case "$yyy" in
13912         '')     sizesize=4
13913                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13914                 ;;
13915         *)      sizesize=$yyy
13916                 echo "Your $zzz size is $sizesize bytes."
13917                 ;;
13918         esac
13919 else
13920         sizesize=4
13921         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13922 fi
13923
13924
13925 : check for socklen_t
13926 echo " "
13927 echo "Checking to see if you have socklen_t..." >&4
13928 $cat >try.c <<EOCP
13929 #include <sys/types.h>
13930 #$d_socket HAS_SOCKET
13931 #ifdef HAS_SOCKET
13932 #include <sys/socket.h>
13933 #endif
13934 int main() { socklen_t x = 16; }
13935 EOCP
13936 set try
13937 if eval $compile; then
13938         val="$define"
13939         echo "You have socklen_t."
13940 else
13941         val="$undef"
13942         echo "You do not have socklen_t."
13943         case "$sizetype" in
13944         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13945         esac
13946 fi
13947 $rm -f try try.*
13948 set d_socklen_t
13949 eval $setvar
13950
13951 : check for type of the size argument to socket calls
13952 case "$d_socket" in
13953 "$define")
13954         $cat <<EOM
13955
13956 Checking to see what type is the last argument of accept().
13957 EOM
13958         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13959         yyy=''
13960         case "$d_socklen_t" in
13961         "$define") yyy="$yyy socklen_t"
13962         esac
13963         yyy="$yyy $sizetype int long unsigned"
13964         for xxx in $yyy; do
13965                 case "$socksizetype" in
13966                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13967                         if ./protochk "$try" $hdrs; then
13968                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13969                                 socksizetype="$xxx"
13970                         fi
13971                         ;;
13972                 esac
13973         done
13974 : In case none of those worked, prompt the user.
13975         case "$socksizetype" in
13976         '')     rp='What is the type for socket address structure sizes?'
13977                 dflt='int'
13978                 . ./myread
13979                 socksizetype=$ans
13980                 ;;
13981         esac
13982         ;;
13983 *)      : no sockets, so pick relatively harmless default
13984         socksizetype='int'
13985         ;;
13986 esac
13987
13988 : see what type is used for signed size_t
13989 set ssize_t ssizetype int stdio.h sys/types.h
13990 eval $typedef
13991 dflt="$ssizetype"
13992 $cat > ssize.c <<EOM
13993 #include <stdio.h>
13994 #include <sys/types.h>
13995 #define Size_t $sizetype
13996 #define SSize_t $dflt
13997 int main()
13998 {
13999         if (sizeof(Size_t) == sizeof(SSize_t))
14000                 printf("$dflt\n");
14001         else if (sizeof(Size_t) == sizeof(int))
14002                 printf("int\n");
14003         else 
14004                 printf("long\n");
14005         exit(0);
14006 }
14007 EOM
14008 echo " "
14009 set ssize
14010 if eval $compile_ok && ./ssize > /dev/null; then
14011         ssizetype=`./ssize`
14012         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14013 else
14014         $cat >&4 <<EOM
14015 Help! I can't compile and run the ssize_t test program: please enlighten me!
14016 (This is probably a misconfiguration in your system or libraries, and
14017 you really ought to fix it.  Still, I'll try anyway.)
14018
14019 I need a type that is the same size as $sizetype, but is guaranteed to
14020 be signed.  Common values are ssize_t, int and long.
14021
14022 EOM
14023         rp="What signed type is the same size as $sizetype?"
14024         . ./myread
14025         ssizetype="$ans"
14026 fi
14027 $rm -f ssize ssize.*
14028
14029 : see what type of char stdio uses.
14030 echo " "
14031 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14032         echo "Your stdio uses unsigned chars." >&4
14033         stdchar="unsigned char"
14034 else
14035         echo "Your stdio uses signed chars." >&4
14036         stdchar="char"
14037 fi
14038
14039 : see if time exists
14040 echo " "
14041 if test "X$d_time" = X -o X"$timetype" = X; then
14042     if set time val -f d_time; eval $csym; $val; then
14043                 echo 'time() found.' >&4
14044                 val="$define"
14045                 rp="What is the type returned by time() on this system?"
14046                 set time_t timetype long stdio.h sys/types.h
14047                 eval $typedef_ask
14048     else
14049                 echo 'time() not found, hope that will do.' >&4
14050                 val="$undef"
14051                 timetype='int';
14052     fi
14053     set d_time
14054     eval $setvar
14055 fi
14056
14057 : see what type uids are declared as in the kernel
14058 echo " "
14059 echo "Looking for the type for user ids returned by getuid()."
14060 set uid_t uidtype xxx stdio.h sys/types.h
14061 eval $typedef
14062 case "$uidtype" in
14063 xxx)
14064         xxx=`./findhdr sys/user.h`
14065         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14066         case $1 in
14067         unsigned) dflt="$1 $2" ;;
14068         *) dflt="$1" ;;
14069         esac
14070         ;;
14071 *) dflt="$uidtype";;
14072 esac
14073 case "$uidtype" in
14074 uid_t)  echo "uid_t found." ;;
14075 *)      rp="What is the type for user ids returned by getuid()?"
14076         . ./myread
14077         uidtype="$ans"
14078         ;;
14079 esac
14080
14081 echo " "
14082 case "$uidtype" in
14083 *_t) zzz="$uidtype"     ;;
14084 *)   zzz="uid"          ;;
14085 esac
14086 echo "Checking the size of $zzz..." >&4 
14087 cat > try.c <<EOCP
14088 #include <sys/types.h>
14089 #include <stdio.h>
14090 int main() {
14091     printf("%d\n", (int)sizeof($uidtype));
14092     exit(0);
14093 }
14094 EOCP
14095 set try
14096 if eval $compile_ok; then
14097         yyy=`./try`
14098         case "$yyy" in
14099         '')     uidsize=4
14100                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14101                 ;;
14102         *)      uidsize=$yyy
14103                 echo "Your $zzz is $uidsize bytes long."
14104                 ;;
14105         esac
14106 else
14107         uidsize=4
14108         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14109 fi
14110
14111 echo " "
14112 case "$uidtype" in
14113 *_t) zzz="$uidtype"     ;;
14114 *)   zzz="uid"          ;;
14115 esac
14116 echo "Checking the sign of $zzz..." >&4
14117 cat > try.c <<EOCP
14118 #include <sys/types.h>
14119 #include <stdio.h>
14120 int main() {
14121         $uidtype foo = -1;
14122         if (foo < 0)
14123                 printf("-1\n");
14124         else
14125                 printf("1\n");
14126 }
14127 EOCP
14128 set try
14129 if eval $compile; then
14130         yyy=`./try`
14131         case "$yyy" in
14132         '')     uidsign=1
14133                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14134                 ;;
14135         *)      uidsign=$yyy
14136                 case "$uidsign" in
14137                  1) echo "Your $zzz is unsigned." ;;
14138                 -1) echo "Your $zzz is signed."   ;;
14139                 esac
14140                 ;;
14141         esac
14142 else
14143         uidsign=1
14144         echo "(I can't compile the test program--guessing unsigned.)" >&4
14145 fi
14146
14147
14148
14149 echo " "
14150 $echo "Checking the format string to be used for uids..." >&4
14151
14152 case "$uidsign" in
14153 -1)     if $test X"$uidsize" = X"$ivsize"; then
14154                 uidformat="$ivdformat"
14155         else
14156                 if $test X"$uidsize" = X"$longsize"; then
14157                         uidformat='"ld"'
14158                 else
14159                         if $test X"$uidsize" = X"$intsize"; then
14160                                 uidformat='"d"'
14161                         else
14162                                 if $test X"$uidsize" = X"$shortsize"; then
14163                                         uidformat='"hd"'
14164                                 fi
14165                         fi
14166                 fi
14167         fi
14168         ;;
14169 *)      if $test X"$uidsize" = X"$uvsize"; then
14170                 uidformat="$uvuformat"
14171         else
14172                 if $test X"$uidsize" = X"$longsize"; then
14173                         uidformat='"lu"'
14174                 else
14175                         if $test X"$uidsize" = X"$intsize"; then
14176                                 uidformat='"u"'
14177                         else
14178                                 if $test X"$uidsize" = X"$shortsize"; then
14179                                         uidformat='"hu"'
14180                                 fi
14181                         fi
14182                 fi
14183         fi
14184         ;;
14185 esac
14186
14187 : see if dbm.h is available
14188 : see if dbmclose exists
14189 set dbmclose d_dbmclose
14190 eval $inlibc
14191
14192 case "$d_dbmclose" in
14193 $define)
14194         set dbm.h i_dbm
14195         eval $inhdr
14196         case "$i_dbm" in
14197         $define)
14198                 val="$undef"
14199                 set i_rpcsvcdbm
14200                 eval $setvar
14201                 ;;
14202         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14203                 eval $inhdr
14204                 ;;
14205         esac
14206         ;;
14207 *)      echo "We won't be including <dbm.h>"
14208         val="$undef"
14209         set i_dbm
14210         eval $setvar
14211         val="$undef"
14212         set i_rpcsvcdbm
14213         eval $setvar
14214         ;;
14215 esac
14216
14217 : see if this is a sys/file.h system
14218 val=''
14219 set sys/file.h val
14220 eval $inhdr
14221
14222 : do we need to include sys/file.h ?
14223 case "$val" in
14224 "$define")
14225         echo " "
14226         if $h_sysfile; then
14227                 val="$define"
14228                 echo "We'll be including <sys/file.h>." >&4
14229         else
14230                 val="$undef"
14231                 echo "We won't be including <sys/file.h>." >&4
14232         fi
14233         ;;
14234 *)
14235         h_sysfile=false
14236         ;;
14237 esac
14238 set i_sysfile
14239 eval $setvar
14240
14241 : see if fcntl.h is there
14242 val=''
14243 set fcntl.h val
14244 eval $inhdr
14245
14246 : see if we can include fcntl.h
14247 case "$val" in
14248 "$define")
14249         echo " "
14250         if $h_fcntl; then
14251                 val="$define"
14252                 echo "We'll be including <fcntl.h>." >&4
14253         else
14254                 val="$undef"
14255                 if $h_sysfile; then
14256         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14257                 else
14258                         echo "We won't be including <fcntl.h>." >&4
14259                 fi
14260         fi
14261         ;;
14262 *)
14263         h_fcntl=false
14264         val="$undef"
14265         ;;
14266 esac
14267 set i_fcntl
14268 eval $setvar
14269
14270 : see if this is a iconv.h system
14271 set iconv.h i_iconv
14272 eval $inhdr
14273
14274 : see if this is a ieeefp.h system
14275 set ieeefp.h i_ieeefp
14276 eval $inhdr
14277
14278 : see if locale.h is available
14279 set locale.h i_locale
14280 eval $inhdr
14281
14282 : see if mach cthreads are available
14283 if test "X$usethreads" = "X$define"; then
14284         set mach/cthreads.h i_machcthr
14285         eval $inhdr
14286 else
14287         i_machcthr="$undef"
14288 fi
14289
14290
14291
14292 : see if this is a math.h system
14293 set math.h i_math
14294 eval $inhdr
14295
14296 : see if this is a mntent.h system
14297 set mntent.h i_mntent
14298 eval $inhdr
14299
14300 : see if ndbm.h is available
14301 set ndbm.h t_ndbm
14302 eval $inhdr
14303 case "$t_ndbm" in
14304 $define)
14305         : see if dbm_open exists
14306         set dbm_open d_dbm_open
14307         eval $inlibc
14308         case "$d_dbm_open" in
14309         $undef)
14310                 t_ndbm="$undef"
14311                 echo "We won't be including <ndbm.h>"
14312                 ;;
14313         esac
14314         ;;
14315 esac
14316 val="$t_ndbm"
14317 set i_ndbm
14318 eval $setvar
14319
14320 : see if net/errno.h is available
14321 val=''
14322 set net/errno.h val
14323 eval $inhdr
14324
14325 : Unfortunately, it causes problems on some systems.  Arrgh.
14326 case "$val" in
14327 $define)
14328         cat > try.c <<'EOM'
14329 #include <stdio.h>
14330 #include <errno.h>
14331 #include <net/errno.h>
14332 int func()
14333 {
14334         return ENOTSOCK;
14335 }
14336 EOM
14337         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14338                 echo "We'll be including <net/errno.h>." >&4
14339         else
14340                 echo "We won't be including <net/errno.h>." >&4
14341                 val="$undef"
14342         fi
14343         $rm -f try.* try
14344         ;;
14345 esac
14346 set i_neterrno
14347 eval $setvar
14348
14349 : see if netinet/tcp.h is available
14350 set netinet/tcp.h i_netinettcp
14351 eval $inhdr
14352
14353 : see if this is a poll.h system
14354 set poll.h i_poll
14355 eval $inhdr
14356
14357 : see if this is a prot.h system
14358 set prot.h i_prot
14359 eval $inhdr
14360
14361 : see if this is a prot.h system
14362 set prot.h i_prot
14363 eval $inhdr
14364
14365 echo " "
14366 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14367 $cat <<'EOSH' > Cppsym.know
14368 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14369 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14370 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14371 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14372 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14373 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14374 bull c cadmus clipper CMU COFF COMPILER_VERSION
14375 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14376 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14377 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14378 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14379 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14380 H3050R H3050RX hbullx20 hcx host_mips
14381 hp200 hp300 hp700 HP700 hp800 hp9000
14382 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14383 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14384 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14385 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14386 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14387 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14388 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14389 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14390 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14391 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14392 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14393 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14394 MATH_HAS_NO_SIDE_EFFECTS
14395 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14396 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14397 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14398 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14399 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14400 NetBSD news1500 news1700 news1800 news1900 news3700
14401 news700 news800 news900 NeXT NLS ns16000 ns32000
14402 ns32016 ns32332 ns32k nsc32000
14403 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14404 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14405 pc532 pdp11 PGC PIC plexus PORTAR posix
14406 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14407 POSIX_C_SOURCE POSIX_SOURCE POWER
14408 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14409 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14410 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14411 sony sony_news sonyrisc sparc sparclite spectrum
14412 stardent stdc STDC_EXT stratos sun sun3 sun386
14413 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14414 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14415 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14416 sysV68 sysV88 Tek4132 Tek4300 titan
14417 tower tower32 tower32_200 tower32_600 tower32_700
14418 tower32_800 tower32_850 tss
14419 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14420 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14421 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14422 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14423 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14424 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14425 z8000
14426 EOSH
14427 # Maybe put other stuff here too.
14428 cat <<EOSH >>Cppsym.know
14429 $osname
14430 EOSH
14431 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14432 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14433 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14434 $rm -f Cppsym.a Cppsym.b
14435 cat <<EOSH > Cppsym
14436 $startsh
14437 if $test \$# -gt 0; then
14438     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14439     if $test -s Cppsym.got; then
14440         $rm -f Cppsym.got
14441         exit 0
14442     fi
14443     $rm -f Cppsym.got
14444     exit 1
14445 else
14446     $tr " " "$trnl" | ./Cppsym.try
14447     exit 0
14448 fi
14449 EOSH
14450 chmod +x Cppsym
14451 $eunicefix Cppsym
14452 cat <<EOSH > Cppsym.try
14453 $startsh
14454 cat <<'EOCP' > try.c
14455 #include <stdio.h>
14456 int main() {
14457 EOCP
14458 $awk \\
14459 EOSH
14460 cat <<'EOSH' >> Cppsym.try
14461 'length($1) > 0 {
14462     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
14463     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
14464     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
14465     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
14466 }'       >> try.c
14467 echo '}' >> try.c
14468 EOSH
14469 cat <<EOSH >> Cppsym.try
14470 ccflags="$ccflags"
14471 case "$osname-$gccversion" in
14472 irix-) ccflags="\$ccflags -woff 1178" ;;
14473 esac
14474 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14475 EOSH
14476 chmod +x Cppsym.try
14477 $eunicefix Cppsym.try
14478 ./Cppsym < Cppsym.know > Cppsym.true
14479 : now check the C compiler for additional symbols
14480 postprocess_cc_v=''
14481 case "$osname" in
14482 aix) postprocess_cc_v="|$tr , ' '" ;;
14483 esac
14484 $cat >ccsym <<EOS
14485 $startsh
14486 $cat >tmp.c <<EOF
14487 extern int foo;
14488 EOF
14489 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14490 do
14491         case "\$i" in
14492         -D*) echo "\$i" | $sed 's/^-D//';;
14493         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14494         esac
14495 done
14496 $rm -f try.c
14497 EOS
14498 postprocess_cc_v=''
14499 chmod +x ccsym
14500 $eunicefix ccsym
14501 ./ccsym > ccsym1.raw
14502 if $test -s ccsym1.raw; then
14503        $sort ccsym1.raw | $uniq >ccsym.raw
14504 else
14505        mv ccsym1.raw ccsym.raw
14506 fi
14507
14508 $awk '/\=/ { print $0; next }
14509         { print $0"=1" }' ccsym.raw >ccsym.list
14510 $awk '/\=/ { print $0; next }
14511         { print $0"=1" }' Cppsym.true >ccsym.true
14512 $comm -13 ccsym.true ccsym.list >ccsym.own
14513 $comm -12 ccsym.true ccsym.list >ccsym.com
14514 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14515 also=''
14516 if $test -z ccsym.raw; then
14517         echo "Your C compiler doesn't seem to define any symbols!" >&4
14518         echo " "
14519         echo "However, your C preprocessor defines the following symbols:"
14520         $cat Cppsym.true
14521         ccsymbols=''
14522         cppsymbols=`$cat Cppsym.true`
14523         cppsymbols=`echo $cppsymbols`
14524         cppccsymbols="$cppsymbols"
14525 else
14526         if $test -s ccsym.com; then
14527                 echo "Your C compiler and pre-processor define these symbols:"
14528                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14529                 also='also '
14530                 symbols='ones'
14531                 cppccsymbols=`$cat ccsym.com`
14532                 cppccsymbols=`echo $cppccsymbols`
14533                 $test "$silent" || sleep 1
14534         fi
14535         if $test -s ccsym.cpp; then
14536                 $test "$also" && echo " "
14537                 echo "Your C pre-processor ${also}defines the following symbols:"
14538                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14539                 also='further '
14540                 cppsymbols=`$cat ccsym.cpp`
14541                 cppsymbols=`echo $cppsymbols`
14542                 $test "$silent" || sleep 1
14543         fi
14544         if $test -s ccsym.own; then
14545                 $test "$also" && echo " "
14546                 echo "Your C compiler ${also}defines the following cpp symbols:"
14547                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14548                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14549                 ccsymbols=`$cat ccsym.own`
14550                 ccsymbols=`echo $ccsymbols`
14551                 $test "$silent" || sleep 1
14552         fi
14553 fi
14554 $rm -f ccsym*
14555
14556 : see if this is a termio system
14557 val="$undef"
14558 val2="$undef"
14559 val3="$undef"
14560 if $test `./findhdr termios.h`; then
14561         set tcsetattr i_termios
14562         eval $inlibc
14563         val3="$i_termios"
14564 fi
14565 echo " "
14566 case "$val3" in
14567 "$define") echo "You have POSIX termios.h... good!" >&4;;
14568 *) if ./Cppsym pyr; then
14569                 case "`/bin/universe`" in
14570                 ucb) if $test `./findhdr sgtty.h`; then
14571                                 val2="$define"
14572                                 echo "<sgtty.h> found." >&4
14573                         else
14574                                 echo "System is pyramid with BSD universe."
14575                                 echo "<sgtty.h> not found--you could have problems." >&4
14576                         fi;;
14577                 *) if $test `./findhdr termio.h`; then
14578                                 val="$define"
14579                                 echo "<termio.h> found." >&4
14580                         else
14581                                 echo "System is pyramid with USG universe."
14582                                 echo "<termio.h> not found--you could have problems." >&4
14583                         fi;;
14584                 esac
14585         elif ./usg; then
14586                 if $test `./findhdr termio.h`; then
14587                         echo "<termio.h> found." >&4
14588                         val="$define"
14589                 elif $test `./findhdr sgtty.h`; then
14590                         echo "<sgtty.h> found." >&4
14591                         val2="$define"
14592                 else
14593 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14594                 fi
14595         else
14596                 if $test `./findhdr sgtty.h`; then
14597                         echo "<sgtty.h> found." >&4
14598                         val2="$define"
14599                 elif $test `./findhdr termio.h`; then
14600                         echo "<termio.h> found." >&4
14601                         val="$define"
14602                 else
14603 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14604                 fi
14605         fi;;
14606 esac
14607 set i_termio; eval $setvar
14608 val=$val2; set i_sgtty; eval $setvar
14609 val=$val3; set i_termios; eval $setvar
14610
14611 : see if this is a shadow.h system
14612 set shadow.h i_shadow
14613 eval $inhdr
14614
14615 : see if this is a socks.h system
14616 set socks.h i_socks
14617 eval $inhdr
14618
14619 : see if stdarg is available
14620 echo " "
14621 if $test `./findhdr stdarg.h`; then
14622         echo "<stdarg.h> found." >&4
14623         valstd="$define"
14624 else
14625         echo "<stdarg.h> NOT found." >&4
14626         valstd="$undef"
14627 fi
14628
14629 : see if varags is available
14630 echo " "
14631 if $test `./findhdr varargs.h`; then
14632         echo "<varargs.h> found." >&4
14633 else
14634         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14635 fi
14636
14637 : set up the varargs testing programs
14638 $cat > varargs.c <<EOP
14639 #ifdef I_STDARG
14640 #include <stdarg.h>
14641 #endif
14642 #ifdef I_VARARGS
14643 #include <varargs.h>
14644 #endif
14645
14646 #ifdef I_STDARG
14647 int f(char *p, ...)
14648 #else
14649 int f(va_alist)
14650 va_dcl
14651 #endif
14652 {
14653         va_list ap;
14654 #ifndef I_STDARG
14655         char *p;
14656 #endif
14657 #ifdef I_STDARG
14658         va_start(ap,p);
14659 #else
14660         va_start(ap);
14661         p = va_arg(ap, char *);
14662 #endif
14663         va_end(ap);
14664 }
14665 EOP
14666 $cat > varargs <<EOP
14667 $startsh
14668 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14669         echo "true"
14670 else
14671         echo "false"
14672 fi
14673 $rm -f varargs$_o
14674 EOP
14675 chmod +x varargs
14676
14677 : now check which varargs header should be included
14678 echo " "
14679 i_varhdr=''
14680 case "$valstd" in
14681 "$define")
14682         if `./varargs I_STDARG`; then
14683                 val='stdarg.h'
14684         elif `./varargs I_VARARGS`; then
14685                 val='varargs.h'
14686         fi
14687         ;;
14688 *)
14689         if `./varargs I_VARARGS`; then
14690                 val='varargs.h'
14691         fi
14692         ;;
14693 esac
14694 case "$val" in
14695 '')
14696 echo "I could not find the definition for va_dcl... You have problems..." >&4
14697         val="$undef"; set i_stdarg; eval $setvar
14698         val="$undef"; set i_varargs; eval $setvar
14699         ;;
14700 *) 
14701         set i_varhdr
14702         eval $setvar
14703         case "$i_varhdr" in
14704         stdarg.h)
14705                 val="$define"; set i_stdarg; eval $setvar
14706                 val="$undef"; set i_varargs; eval $setvar
14707                 ;;
14708         varargs.h)
14709                 val="$undef"; set i_stdarg; eval $setvar
14710                 val="$define"; set i_varargs; eval $setvar
14711                 ;;
14712         esac
14713         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14714 esac
14715 $rm -f varargs*
14716
14717 : see if stddef is available
14718 set stddef.h i_stddef
14719 eval $inhdr
14720
14721 : see if this is a sunmath.h system
14722 set sunmath.h i_sunmath
14723 eval $inhdr
14724
14725 : see if sys/access.h is available
14726 set sys/access.h i_sysaccess
14727 eval $inhdr
14728
14729 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14730 set sys/filio.h i_sysfilio
14731 eval $inhdr
14732 echo " "
14733 if $test `./findhdr sys/ioctl.h`; then
14734         val="$define"
14735         echo '<sys/ioctl.h> found.' >&4
14736 else
14737         val="$undef"
14738         if $test $i_sysfilio = "$define"; then
14739             echo '<sys/ioctl.h> NOT found.' >&4
14740         else
14741                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14742                 $test $i_termio = "$define" && xxx="termio.h"
14743                 $test $i_termios = "$define" && xxx="termios.h"
14744 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14745         fi
14746 fi
14747 set i_sysioctl
14748 eval $setvar
14749
14750
14751 : see if this is a syslog.h system
14752 set syslog.h i_syslog
14753 eval $inhdr
14754
14755
14756 : see if this is a sys/mode.h system
14757 set sys/mode.h i_sysmode
14758 eval $inhdr
14759
14760 : see if sys/resource.h has to be included
14761 set sys/resource.h i_sysresrc
14762 eval $inhdr
14763
14764 : see if sys/security.h is available
14765 set sys/security.h i_syssecrt
14766 eval $inhdr
14767
14768 : see if this is a sys/statvfs.h system
14769 set sys/statvfs.h i_sysstatvfs
14770 eval $inhdr
14771
14772 : see if this is a sys/uio.h system
14773 set sys/uio.h i_sysuio
14774 eval $inhdr
14775
14776 : see if this is a sys/un.h system
14777 set sys/un.h i_sysun
14778 eval $inhdr
14779
14780
14781 : see if this is a sys/utsname.h system
14782 set sys/utsname.h i_sysutsname
14783 eval $inhdr
14784
14785 : see if this is a syswait system
14786 set sys/wait.h i_syswait
14787 eval $inhdr
14788
14789 : see if this is a ustat.h system
14790 set ustat.h i_ustat
14791 eval $inhdr
14792
14793 : see if this is an utime system
14794 set utime.h i_utime
14795 eval $inhdr
14796
14797 : see if this is a values.h system
14798 set values.h i_values
14799 eval $inhdr
14800
14801 : see if this is a vfork system
14802 case "$d_vfork" in
14803 "$define")
14804         set vfork.h i_vfork
14805         eval $inhdr
14806         ;;
14807 *)
14808         i_vfork="$undef"
14809         ;;
14810 esac
14811
14812 : see if gdbm.h is available
14813 set gdbm.h t_gdbm
14814 eval $inhdr
14815 case "$t_gdbm" in
14816 $define)
14817         : see if gdbm_open exists
14818         set gdbm_open d_gdbm_open
14819         eval $inlibc
14820         case "$d_gdbm_open" in
14821         $undef)
14822                 t_gdbm="$undef"
14823                 echo "We won't be including <gdbm.h>"
14824                 ;;
14825         esac
14826         ;;
14827 esac
14828 val="$t_gdbm"
14829 set i_gdbm
14830 eval $setvar
14831
14832 echo " "
14833 echo "Looking for extensions..." >&4
14834 : If we are using the old config.sh, known_extensions may contain
14835 : old or inaccurate or duplicate values.
14836 known_extensions=''
14837 nonxs_extensions=''
14838 : We do not use find because it might not be available.
14839 : We do not just use MANIFEST because the user may have dropped
14840 : some additional extensions into the source tree and expect them
14841 : to be built.
14842
14843 : Function to recursively find available extensions, ignoring DynaLoader
14844 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14845 find_extensions='
14846     for xxx in *; do
14847        case "$xxx" in
14848            DynaLoader|dynaload) ;;
14849            *)
14850            if $test -f $xxx/$xxx.xs; then
14851                known_extensions="$known_extensions $1$xxx";
14852            elif $test -f $xxx/Makefile.PL; then
14853                nonxs_extensions="$nonxs_extensions $1$xxx";
14854            else
14855                if $test -d $xxx -a $# -lt 10; then
14856                    set $1$xxx/ $*;
14857                    cd $xxx;
14858                    eval $find_extensions;
14859                    cd ..;
14860                    shift;
14861                fi;
14862            fi
14863            ;;
14864        esac;
14865     done'
14866 tdir=`pwd`
14867 cd $rsrc/ext
14868 set X
14869 shift
14870 eval $find_extensions
14871 set X $nonxs_extensions
14872 shift
14873 nonxs_extensions="$*"
14874 set X $known_extensions
14875 shift
14876 known_extensions="$*"
14877 cd $tdir
14878
14879 : Now see which are supported on this system.
14880 avail_ext=''
14881 for xxx in $known_extensions ; do
14882         case "$xxx" in
14883         DB_File|db_file)
14884                 case "$i_db" in
14885                 $define) avail_ext="$avail_ext $xxx" ;;
14886                 esac
14887                 ;;
14888         GDBM_File|gdbm_fil)
14889                 case "$i_gdbm" in 
14890                 $define) avail_ext="$avail_ext $xxx" ;;
14891                 esac
14892                 ;;
14893         NDBM_File|ndbm_fil)
14894                 case "$i_ndbm" in
14895                 $define)
14896                     case "$osname-$use64bitint" in
14897                     hpux-define)
14898                         case "$libs" in
14899                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14900                         esac
14901                         ;;
14902                     *) avail_ext="$avail_ext $xxx" ;;
14903                     esac
14904                     ;;
14905                 esac
14906                 ;;
14907         ODBM_File|odbm_fil) 
14908                 case "${i_dbm}${i_rpcsvcdbm}" in
14909                 *"${define}"*)
14910                     case "$osname-$use64bitint" in
14911                     hpux-define)
14912                         case "$libs" in
14913                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14914                         esac
14915                         ;;
14916                     *) avail_ext="$avail_ext $xxx" ;;
14917                     esac
14918                     ;;
14919                 esac
14920                 ;;
14921         POSIX|posix)
14922                 case "$useposix" in
14923                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14924                 esac
14925                 ;;
14926         Opcode|opcode)
14927                 case "$useopcode" in
14928                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14929                 esac
14930                 ;;
14931         Socket|socket)
14932                 case "$d_socket" in 
14933                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14934                 esac
14935                 ;;
14936         Thread|thread)
14937                 case "$usethreads" in 
14938                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14939                 esac
14940                 ;;
14941         IPC/SysV|ipc/sysv)
14942                 : XXX Do we need a useipcsysv variable here
14943                 case "${d_msg}${d_sem}${d_shm}" in 
14944                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14945                 esac
14946                 ;;
14947         *)      avail_ext="$avail_ext $xxx"
14948                 ;;
14949         esac
14950 done
14951
14952 set X $avail_ext
14953 shift
14954 avail_ext="$*"
14955
14956 : Now see which nonxs extensions are supported on this system.
14957 : For now assume all are.
14958 nonxs_ext=''
14959 for xxx in $nonxs_extensions ; do
14960         case "$xxx" in
14961         *)      nonxs_ext="$nonxs_ext $xxx"
14962                 ;;
14963         esac
14964 done
14965
14966 set X $nonxs_ext
14967 shift
14968 nonxs_ext="$*"
14969
14970 case $usedl in
14971 $define)
14972         $cat <<EOM
14973 A number of extensions are supplied with $package.  You may choose to
14974 compile these extensions for dynamic loading (the default), compile
14975 them into the $package executable (static loading), or not include
14976 them at all.  Answer "none" to include no extensions.
14977 Note that DynaLoader is always built and need not be mentioned here.
14978
14979 EOM
14980         case "$dynamic_ext" in
14981         '') dflt="$avail_ext" ;;
14982         *)      dflt="$dynamic_ext"
14983                 # Perhaps we are reusing an old out-of-date config.sh.
14984                 case "$hint" in
14985                 previous)
14986                         if test X"$dynamic_ext" != X"$avail_ext"; then
14987                                 $cat <<EOM
14988 NOTICE:  Your previous config.sh list may be incorrect. 
14989 The extensions now available to you are 
14990         ${avail_ext}
14991 but the default list from your previous config.sh is
14992         ${dynamic_ext} 
14993
14994 EOM
14995                         fi
14996                         ;;
14997                 esac
14998                 ;;
14999         esac
15000         case "$dflt" in
15001         '')     dflt=none;;
15002         esac
15003         rp="What extensions do you wish to load dynamically?"
15004         . ./myread
15005         case "$ans" in
15006         none) dynamic_ext=' ' ;;
15007         *) dynamic_ext="$ans" ;;
15008         esac
15009
15010         case "$static_ext" in
15011         '')
15012                 : Exclude those already listed in dynamic linking
15013                 dflt=''
15014                 for xxx in $avail_ext; do
15015                         case " $dynamic_ext " in
15016                         *" $xxx "*) ;;
15017                         *) dflt="$dflt $xxx" ;;
15018                         esac
15019                 done
15020                 set X $dflt
15021                 shift
15022                 dflt="$*"
15023                 ;;
15024         *)  dflt="$static_ext" 
15025                 ;;
15026         esac
15027
15028         case "$dflt" in
15029         '')     dflt=none;;
15030         esac
15031         rp="What extensions do you wish to load statically?"
15032         . ./myread
15033         case "$ans" in
15034         none) static_ext=' ' ;;
15035         *) static_ext="$ans" ;;
15036         esac
15037         ;;
15038 *)
15039         $cat <<EOM
15040 A number of extensions are supplied with $package.  Answer "none" 
15041 to include no extensions. 
15042 Note that DynaLoader is always built and need not be mentioned here.
15043
15044 EOM
15045         case "$static_ext" in
15046         '') dflt="$avail_ext" ;;
15047         *)      dflt="$static_ext"
15048                 # Perhaps we are reusing an old out-of-date config.sh.
15049                 case "$hint" in
15050                 previous)
15051                         if test X"$static_ext" != X"$avail_ext"; then
15052                                 $cat <<EOM
15053 NOTICE:  Your previous config.sh list may be incorrect. 
15054 The extensions now available to you are 
15055         ${avail_ext}
15056 but the default list from your previous config.sh is
15057         ${static_ext} 
15058
15059 EOM
15060                         fi
15061                         ;;
15062                 esac
15063                 ;;
15064         esac
15065         : Exclude those that are not xs extensions
15066         case "$dflt" in
15067         '')     dflt=none;;
15068         esac
15069         rp="What extensions do you wish to include?"
15070         . ./myread
15071         case "$ans" in
15072         none) static_ext=' ' ;;
15073         *) static_ext="$ans" ;;
15074         esac
15075         ;;
15076 esac
15077
15078 set X $dynamic_ext $static_ext $nonxs_ext
15079 shift
15080 extensions="$*"
15081
15082 : Remove build directory name from cppstdin so it can be used from
15083 : either the present location or the final installed location.
15084 echo " "
15085 : Get out of the UU directory to get correct path name.
15086 cd ..
15087 case "$cppstdin" in
15088 `pwd`/cppstdin)
15089         echo "Stripping down cppstdin path name"
15090         cppstdin=cppstdin
15091         ;;
15092 esac
15093 cd UU
15094
15095 : end of configuration questions
15096 echo " "
15097 echo "End of configuration questions."
15098 echo " "
15099
15100 : back to where it started
15101 if test -d ../UU; then
15102         cd ..
15103 fi
15104
15105 : configuration may be patched via a 'config.over' file
15106 if $test -f config.over; then
15107         echo " "
15108         dflt=y
15109         rp='I see a config.over file.  Do you wish to load it?'
15110         . UU/myread
15111         case "$ans" in
15112         n*) echo "OK, I'll ignore it.";;
15113         *)      . ./config.over
15114                 echo "Configuration override changes have been loaded."
15115                 ;;
15116         esac
15117 fi
15118
15119 : in case they want portability, strip down executable paths
15120 case "$d_portable" in
15121 "$define")
15122         echo " "
15123         echo "Stripping down executable paths..." >&4
15124         for file in $loclist $trylist; do
15125                 eval temp=\$$file
15126                 eval $file=`basename $temp`
15127         done
15128         ;;
15129 esac
15130
15131 : create config.sh file
15132 echo " "
15133 echo "Creating config.sh..." >&4
15134 $spitshell <<EOT >config.sh
15135 $startsh
15136 #
15137 # This file was produced by running the Configure script. It holds all the
15138 # definitions figured out by Configure. Should you modify one of these values,
15139 # do not forget to propagate your changes by running "Configure -der". You may
15140 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15141 #
15142
15143 # Package name      : $package
15144 # Source directory  : $src
15145 # Configuration time: $cf_time
15146 # Configured by     : $cf_by
15147 # Target system     : $myuname
15148
15149 Author='$Author'
15150 Date='$Date'
15151 Header='$Header'
15152 Id='$Id'
15153 Locker='$Locker'
15154 Log='$Log'
15155 Mcc='$Mcc'
15156 RCSfile='$RCSfile'
15157 Revision='$Revision'
15158 Source='$Source'
15159 State='$State'
15160 _a='$_a'
15161 _exe='$_exe'
15162 _o='$_o'
15163 afs='$afs'
15164 alignbytes='$alignbytes'
15165 ansi2knr='$ansi2knr'
15166 aphostname='$aphostname'
15167 api_revision='$api_revision'
15168 api_subversion='$api_subversion'
15169 api_version='$api_version'
15170 api_versionstring='$api_versionstring'
15171 ar='$ar'
15172 archlib='$archlib'
15173 archlibexp='$archlibexp'
15174 archname64='$archname64'
15175 archname='$archname'
15176 archobjs='$archobjs'
15177 awk='$awk'
15178 baserev='$baserev'
15179 bash='$bash'
15180 bin='$bin'
15181 bincompat5005='$bincompat5005'
15182 binexp='$binexp'
15183 bison='$bison'
15184 byacc='$byacc'
15185 byteorder='$byteorder'
15186 c='$c'
15187 castflags='$castflags'
15188 cat='$cat'
15189 cc='$cc'
15190 cccdlflags='$cccdlflags'
15191 ccdlflags='$ccdlflags'
15192 ccflags='$ccflags'
15193 ccsymbols='$ccsymbols'
15194 cf_by='$cf_by'
15195 cf_email='$cf_email'
15196 cf_time='$cf_time'
15197 charsize='$charsize'
15198 chgrp='$chgrp'
15199 chmod='$chmod'
15200 chown='$chown'
15201 clocktype='$clocktype'
15202 comm='$comm'
15203 compress='$compress'
15204 contains='$contains'
15205 cp='$cp'
15206 cpio='$cpio'
15207 cpp='$cpp'
15208 cpp_stuff='$cpp_stuff'
15209 cppccsymbols='$cppccsymbols'
15210 cppflags='$cppflags'
15211 cpplast='$cpplast'
15212 cppminus='$cppminus'
15213 cpprun='$cpprun'
15214 cppstdin='$cppstdin'
15215 cppsymbols='$cppsymbols'
15216 crosscompile='$crosscompile'
15217 cryptlib='$cryptlib'
15218 csh='$csh'
15219 d_Gconvert='$d_Gconvert'
15220 d_PRIEldbl='$d_PRIEldbl'
15221 d_PRIFldbl='$d_PRIFldbl'
15222 d_PRIGldbl='$d_PRIGldbl'
15223 d_PRIX64='$d_PRIX64'
15224 d_PRId64='$d_PRId64'
15225 d_PRIeldbl='$d_PRIeldbl'
15226 d_PRIfldbl='$d_PRIfldbl'
15227 d_PRIgldbl='$d_PRIgldbl'
15228 d_PRIi64='$d_PRIi64'
15229 d_PRIo64='$d_PRIo64'
15230 d_PRIu64='$d_PRIu64'
15231 d_PRIx64='$d_PRIx64'
15232 d_access='$d_access'
15233 d_accessx='$d_accessx'
15234 d_alarm='$d_alarm'
15235 d_archlib='$d_archlib'
15236 d_atolf='$d_atolf'
15237 d_atoll='$d_atoll'
15238 d_attribut='$d_attribut'
15239 d_bcmp='$d_bcmp'
15240 d_bcopy='$d_bcopy'
15241 d_bincompat5005='$d_bincompat5005'
15242 d_bsd='$d_bsd'
15243 d_bsdgetpgrp='$d_bsdgetpgrp'
15244 d_bsdsetpgrp='$d_bsdsetpgrp'
15245 d_bzero='$d_bzero'
15246 d_casti32='$d_casti32'
15247 d_castneg='$d_castneg'
15248 d_charvspr='$d_charvspr'
15249 d_chown='$d_chown'
15250 d_chroot='$d_chroot'
15251 d_chsize='$d_chsize'
15252 d_closedir='$d_closedir'
15253 d_const='$d_const'
15254 d_crypt='$d_crypt'
15255 d_csh='$d_csh'
15256 d_cuserid='$d_cuserid'
15257 d_dbl_dig='$d_dbl_dig'
15258 d_difftime='$d_difftime'
15259 d_dirnamlen='$d_dirnamlen'
15260 d_dlerror='$d_dlerror'
15261 d_dlopen='$d_dlopen'
15262 d_dlsymun='$d_dlsymun'
15263 d_dosuid='$d_dosuid'
15264 d_drand48proto='$d_drand48proto'
15265 d_dup2='$d_dup2'
15266 d_eaccess='$d_eaccess'
15267 d_endgrent='$d_endgrent'
15268 d_endhent='$d_endhent'
15269 d_endnent='$d_endnent'
15270 d_endpent='$d_endpent'
15271 d_endpwent='$d_endpwent'
15272 d_endsent='$d_endsent'
15273 d_eofnblk='$d_eofnblk'
15274 d_eunice='$d_eunice'
15275 d_fchmod='$d_fchmod'
15276 d_fchown='$d_fchown'
15277 d_fcntl='$d_fcntl'
15278 d_fd_macros='$d_fd_macros'
15279 d_fd_set='$d_fd_set'
15280 d_fds_bits='$d_fds_bits'
15281 d_fgetpos='$d_fgetpos'
15282 d_flexfnam='$d_flexfnam'
15283 d_flock='$d_flock'
15284 d_fork='$d_fork'
15285 d_fpathconf='$d_fpathconf'
15286 d_fpos64_t='$d_fpos64_t'
15287 d_frexpl='$d_frexpl'
15288 d_fs_data_s='$d_fs_data_s'
15289 d_fseeko='$d_fseeko'
15290 d_fsetpos='$d_fsetpos'
15291 d_fstatfs='$d_fstatfs'
15292 d_fstatvfs='$d_fstatvfs'
15293 d_ftello='$d_ftello'
15294 d_ftime='$d_ftime'
15295 d_getcwd='$d_getcwd'
15296 d_getespwnam='$d_getespwnam'
15297 d_getfsstat='$d_getfsstat'
15298 d_getgrent='$d_getgrent'
15299 d_getgrps='$d_getgrps'
15300 d_gethbyaddr='$d_gethbyaddr'
15301 d_gethbyname='$d_gethbyname'
15302 d_gethent='$d_gethent'
15303 d_gethname='$d_gethname'
15304 d_gethostprotos='$d_gethostprotos'
15305 d_getlogin='$d_getlogin'
15306 d_getmnt='$d_getmnt'
15307 d_getmntent='$d_getmntent'
15308 d_getnbyaddr='$d_getnbyaddr'
15309 d_getnbyname='$d_getnbyname'
15310 d_getnent='$d_getnent'
15311 d_getnetprotos='$d_getnetprotos'
15312 d_getpbyname='$d_getpbyname'
15313 d_getpbynumber='$d_getpbynumber'
15314 d_getpent='$d_getpent'
15315 d_getpgid='$d_getpgid'
15316 d_getpgrp2='$d_getpgrp2'
15317 d_getpgrp='$d_getpgrp'
15318 d_getppid='$d_getppid'
15319 d_getprior='$d_getprior'
15320 d_getprotoprotos='$d_getprotoprotos'
15321 d_getprpwnam='$d_getprpwnam'
15322 d_getpwent='$d_getpwent'
15323 d_getsbyname='$d_getsbyname'
15324 d_getsbyport='$d_getsbyport'
15325 d_getsent='$d_getsent'
15326 d_getservprotos='$d_getservprotos'
15327 d_getspnam='$d_getspnam'
15328 d_gettimeod='$d_gettimeod'
15329 d_gnulibc='$d_gnulibc'
15330 d_grpasswd='$d_grpasswd'
15331 d_hasmntopt='$d_hasmntopt'
15332 d_htonl='$d_htonl'
15333 d_iconv='$d_iconv'
15334 d_index='$d_index'
15335 d_inetaton='$d_inetaton'
15336 d_int64_t='$d_int64_t'
15337 d_isascii='$d_isascii'
15338 d_isnan='$d_isnan'
15339 d_isnanl='$d_isnanl'
15340 d_killpg='$d_killpg'
15341 d_lchown='$d_lchown'
15342 d_ldbl_dig='$d_ldbl_dig'
15343 d_link='$d_link'
15344 d_locconv='$d_locconv'
15345 d_lockf='$d_lockf'
15346 d_longdbl='$d_longdbl'
15347 d_longlong='$d_longlong'
15348 d_lseekproto='$d_lseekproto'
15349 d_lstat='$d_lstat'
15350 d_madvise='$d_madvise'
15351 d_mblen='$d_mblen'
15352 d_mbstowcs='$d_mbstowcs'
15353 d_mbtowc='$d_mbtowc'
15354 d_memchr='$d_memchr'
15355 d_memcmp='$d_memcmp'
15356 d_memcpy='$d_memcpy'
15357 d_memmove='$d_memmove'
15358 d_memset='$d_memset'
15359 d_mkdir='$d_mkdir'
15360 d_mkdtemp='$d_mkdtemp'
15361 d_mkfifo='$d_mkfifo'
15362 d_mkstemp='$d_mkstemp'
15363 d_mkstemps='$d_mkstemps'
15364 d_mktime='$d_mktime'
15365 d_mmap='$d_mmap'
15366 d_modfl='$d_modfl'
15367 d_mprotect='$d_mprotect'
15368 d_msg='$d_msg'
15369 d_msg_ctrunc='$d_msg_ctrunc'
15370 d_msg_dontroute='$d_msg_dontroute'
15371 d_msg_oob='$d_msg_oob'
15372 d_msg_peek='$d_msg_peek'
15373 d_msg_proxy='$d_msg_proxy'
15374 d_msgctl='$d_msgctl'
15375 d_msgget='$d_msgget'
15376 d_msgrcv='$d_msgrcv'
15377 d_msgsnd='$d_msgsnd'
15378 d_msync='$d_msync'
15379 d_munmap='$d_munmap'
15380 d_mymalloc='$d_mymalloc'
15381 d_nice='$d_nice'
15382 d_nv_preserves_uv='$d_nv_preserves_uv'
15383 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15384 d_off64_t='$d_off64_t'
15385 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15386 d_oldpthreads='$d_oldpthreads'
15387 d_oldsock='$d_oldsock'
15388 d_open3='$d_open3'
15389 d_pathconf='$d_pathconf'
15390 d_pause='$d_pause'
15391 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15392 d_phostname='$d_phostname'
15393 d_pipe='$d_pipe'
15394 d_poll='$d_poll'
15395 d_portable='$d_portable'
15396 d_pthread_yield='$d_pthread_yield'
15397 d_pwage='$d_pwage'
15398 d_pwchange='$d_pwchange'
15399 d_pwclass='$d_pwclass'
15400 d_pwcomment='$d_pwcomment'
15401 d_pwexpire='$d_pwexpire'
15402 d_pwgecos='$d_pwgecos'
15403 d_pwpasswd='$d_pwpasswd'
15404 d_pwquota='$d_pwquota'
15405 d_qgcvt='$d_qgcvt'
15406 d_quad='$d_quad'
15407 d_readdir='$d_readdir'
15408 d_readlink='$d_readlink'
15409 d_rename='$d_rename'
15410 d_rewinddir='$d_rewinddir'
15411 d_rmdir='$d_rmdir'
15412 d_safebcpy='$d_safebcpy'
15413 d_safemcpy='$d_safemcpy'
15414 d_sanemcmp='$d_sanemcmp'
15415 d_sched_yield='$d_sched_yield'
15416 d_scm_rights='$d_scm_rights'
15417 d_seekdir='$d_seekdir'
15418 d_select='$d_select'
15419 d_sem='$d_sem'
15420 d_semctl='$d_semctl'
15421 d_semctl_semid_ds='$d_semctl_semid_ds'
15422 d_semctl_semun='$d_semctl_semun'
15423 d_semget='$d_semget'
15424 d_semop='$d_semop'
15425 d_setegid='$d_setegid'
15426 d_seteuid='$d_seteuid'
15427 d_setgrent='$d_setgrent'
15428 d_setgrps='$d_setgrps'
15429 d_sethent='$d_sethent'
15430 d_setlinebuf='$d_setlinebuf'
15431 d_setlocale='$d_setlocale'
15432 d_setnent='$d_setnent'
15433 d_setpent='$d_setpent'
15434 d_setpgid='$d_setpgid'
15435 d_setpgrp2='$d_setpgrp2'
15436 d_setpgrp='$d_setpgrp'
15437 d_setprior='$d_setprior'
15438 d_setpwent='$d_setpwent'
15439 d_setregid='$d_setregid'
15440 d_setresgid='$d_setresgid'
15441 d_setresuid='$d_setresuid'
15442 d_setreuid='$d_setreuid'
15443 d_setrgid='$d_setrgid'
15444 d_setruid='$d_setruid'
15445 d_setsent='$d_setsent'
15446 d_setsid='$d_setsid'
15447 d_setvbuf='$d_setvbuf'
15448 d_sfio='$d_sfio'
15449 d_shm='$d_shm'
15450 d_shmat='$d_shmat'
15451 d_shmatprototype='$d_shmatprototype'
15452 d_shmctl='$d_shmctl'
15453 d_shmdt='$d_shmdt'
15454 d_shmget='$d_shmget'
15455 d_sigaction='$d_sigaction'
15456 d_sigsetjmp='$d_sigsetjmp'
15457 d_socket='$d_socket'
15458 d_socklen_t='$d_socklen_t'
15459 d_sockpair='$d_sockpair'
15460 d_sqrtl='$d_sqrtl'
15461 d_statblks='$d_statblks'
15462 d_statfs_f_flags='$d_statfs_f_flags'
15463 d_statfs_s='$d_statfs_s'
15464 d_statvfs='$d_statvfs'
15465 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15466 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15467 d_stdio_stream_array='$d_stdio_stream_array'
15468 d_stdiobase='$d_stdiobase'
15469 d_stdstdio='$d_stdstdio'
15470 d_strchr='$d_strchr'
15471 d_strcoll='$d_strcoll'
15472 d_strctcpy='$d_strctcpy'
15473 d_strerrm='$d_strerrm'
15474 d_strerror='$d_strerror'
15475 d_strtod='$d_strtod'
15476 d_strtol='$d_strtol'
15477 d_strtold='$d_strtold'
15478 d_strtoll='$d_strtoll'
15479 d_strtoul='$d_strtoul'
15480 d_strtoull='$d_strtoull'
15481 d_strtouq='$d_strtouq'
15482 d_strxfrm='$d_strxfrm'
15483 d_suidsafe='$d_suidsafe'
15484 d_symlink='$d_symlink'
15485 d_syscall='$d_syscall'
15486 d_sysconf='$d_sysconf'
15487 d_sysernlst='$d_sysernlst'
15488 d_syserrlst='$d_syserrlst'
15489 d_system='$d_system'
15490 d_tcgetpgrp='$d_tcgetpgrp'
15491 d_tcsetpgrp='$d_tcsetpgrp'
15492 d_telldir='$d_telldir'
15493 d_telldirproto='$d_telldirproto'
15494 d_time='$d_time'
15495 d_times='$d_times'
15496 d_truncate='$d_truncate'
15497 d_tzname='$d_tzname'
15498 d_umask='$d_umask'
15499 d_uname='$d_uname'
15500 d_union_semun='$d_union_semun'
15501 d_ustat='$d_ustat'
15502 d_vendorarch='$d_vendorarch'
15503 d_vendorbin='$d_vendorbin'
15504 d_vendorlib='$d_vendorlib'
15505 d_vfork='$d_vfork'
15506 d_void_closedir='$d_void_closedir'
15507 d_voidsig='$d_voidsig'
15508 d_voidtty='$d_voidtty'
15509 d_volatile='$d_volatile'
15510 d_vprintf='$d_vprintf'
15511 d_wait4='$d_wait4'
15512 d_waitpid='$d_waitpid'
15513 d_wcstombs='$d_wcstombs'
15514 d_wctomb='$d_wctomb'
15515 d_xenix='$d_xenix'
15516 date='$date'
15517 db_hashtype='$db_hashtype'
15518 db_prefixtype='$db_prefixtype'
15519 defvoidused='$defvoidused'
15520 direntrytype='$direntrytype'
15521 dlext='$dlext'
15522 dlsrc='$dlsrc'
15523 doublesize='$doublesize'
15524 drand01='$drand01'
15525 dynamic_ext='$dynamic_ext'
15526 eagain='$eagain'
15527 ebcdic='$ebcdic'
15528 echo='$echo'
15529 egrep='$egrep'
15530 emacs='$emacs'
15531 eunicefix='$eunicefix'
15532 exe_ext='$exe_ext'
15533 expr='$expr'
15534 extensions='$extensions'
15535 fflushNULL='$fflushNULL'
15536 fflushall='$fflushall'
15537 find='$find'
15538 firstmakefile='$firstmakefile'
15539 flex='$flex'
15540 fpossize='$fpossize'
15541 fpostype='$fpostype'
15542 freetype='$freetype'
15543 full_ar='$full_ar'
15544 full_csh='$full_csh'
15545 full_sed='$full_sed'
15546 gccversion='$gccversion'
15547 gidformat='$gidformat'
15548 gidsign='$gidsign'
15549 gidsize='$gidsize'
15550 gidtype='$gidtype'
15551 glibpth='$glibpth'
15552 grep='$grep'
15553 groupcat='$groupcat'
15554 groupstype='$groupstype'
15555 gzip='$gzip'
15556 h_fcntl='$h_fcntl'
15557 h_sysfile='$h_sysfile'
15558 hint='$hint'
15559 hostcat='$hostcat'
15560 huge='$huge'
15561 i16size='$i16size'
15562 i16type='$i16type'
15563 i32size='$i32size'
15564 i32type='$i32type'
15565 i64size='$i64size'
15566 i64type='$i64type'
15567 i8size='$i8size'
15568 i8type='$i8type'
15569 i_arpainet='$i_arpainet'
15570 i_bsdioctl='$i_bsdioctl'
15571 i_db='$i_db'
15572 i_dbm='$i_dbm'
15573 i_dirent='$i_dirent'
15574 i_dld='$i_dld'
15575 i_dlfcn='$i_dlfcn'
15576 i_fcntl='$i_fcntl'
15577 i_float='$i_float'
15578 i_gdbm='$i_gdbm'
15579 i_grp='$i_grp'
15580 i_iconv='$i_iconv'
15581 i_ieeefp='$i_ieeefp'
15582 i_inttypes='$i_inttypes'
15583 i_limits='$i_limits'
15584 i_locale='$i_locale'
15585 i_machcthr='$i_machcthr'
15586 i_malloc='$i_malloc'
15587 i_math='$i_math'
15588 i_memory='$i_memory'
15589 i_mntent='$i_mntent'
15590 i_ndbm='$i_ndbm'
15591 i_netdb='$i_netdb'
15592 i_neterrno='$i_neterrno'
15593 i_netinettcp='$i_netinettcp'
15594 i_niin='$i_niin'
15595 i_poll='$i_poll'
15596 i_prot='$i_prot'
15597 i_pthread='$i_pthread'
15598 i_pwd='$i_pwd'
15599 i_rpcsvcdbm='$i_rpcsvcdbm'
15600 i_sfio='$i_sfio'
15601 i_sgtty='$i_sgtty'
15602 i_shadow='$i_shadow'
15603 i_socks='$i_socks'
15604 i_stdarg='$i_stdarg'
15605 i_stddef='$i_stddef'
15606 i_stdlib='$i_stdlib'
15607 i_string='$i_string'
15608 i_sunmath='$i_sunmath'
15609 i_sysaccess='$i_sysaccess'
15610 i_sysdir='$i_sysdir'
15611 i_sysfile='$i_sysfile'
15612 i_sysfilio='$i_sysfilio'
15613 i_sysin='$i_sysin'
15614 i_sysioctl='$i_sysioctl'
15615 i_syslog='$i_syslog'
15616 i_sysmman='$i_sysmman'
15617 i_sysmode='$i_sysmode'
15618 i_sysmount='$i_sysmount'
15619 i_sysndir='$i_sysndir'
15620 i_sysparam='$i_sysparam'
15621 i_sysresrc='$i_sysresrc'
15622 i_syssecrt='$i_syssecrt'
15623 i_sysselct='$i_sysselct'
15624 i_syssockio='$i_syssockio'
15625 i_sysstat='$i_sysstat'
15626 i_sysstatfs='$i_sysstatfs'
15627 i_sysstatvfs='$i_sysstatvfs'
15628 i_systime='$i_systime'
15629 i_systimek='$i_systimek'
15630 i_systimes='$i_systimes'
15631 i_systypes='$i_systypes'
15632 i_sysuio='$i_sysuio'
15633 i_sysun='$i_sysun'
15634 i_sysutsname='$i_sysutsname'
15635 i_sysvfs='$i_sysvfs'
15636 i_syswait='$i_syswait'
15637 i_termio='$i_termio'
15638 i_termios='$i_termios'
15639 i_time='$i_time'
15640 i_unistd='$i_unistd'
15641 i_ustat='$i_ustat'
15642 i_utime='$i_utime'
15643 i_values='$i_values'
15644 i_varargs='$i_varargs'
15645 i_varhdr='$i_varhdr'
15646 i_vfork='$i_vfork'
15647 ignore_versioned_solibs='$ignore_versioned_solibs'
15648 inc_version_list='$inc_version_list'
15649 inc_version_list_init='$inc_version_list_init'
15650 incpath='$incpath'
15651 inews='$inews'
15652 installarchlib='$installarchlib'
15653 installbin='$installbin'
15654 installman1dir='$installman1dir'
15655 installman3dir='$installman3dir'
15656 installprefix='$installprefix'
15657 installprefixexp='$installprefixexp'
15658 installprivlib='$installprivlib'
15659 installscript='$installscript'
15660 installsitearch='$installsitearch'
15661 installsitebin='$installsitebin'
15662 installsitelib='$installsitelib'
15663 installstyle='$installstyle'
15664 installusrbinperl='$installusrbinperl'
15665 installvendorarch='$installvendorarch'
15666 installvendorbin='$installvendorbin'
15667 installvendorlib='$installvendorlib'
15668 intsize='$intsize'
15669 ivdformat='$ivdformat'
15670 ivsize='$ivsize'
15671 ivtype='$ivtype'
15672 known_extensions='$known_extensions'
15673 ksh='$ksh'
15674 large='$large'
15675 ld='$ld'
15676 lddlflags='$lddlflags'
15677 ldflags='$ldflags'
15678 ldlibpthname='$ldlibpthname'
15679 less='$less'
15680 lib_ext='$lib_ext'
15681 libc='$libc'
15682 libperl='$libperl'
15683 libpth='$libpth'
15684 libs='$libs'
15685 libsdirs='$libsdirs'
15686 libsfiles='$libsfiles'
15687 libsfound='$libsfound'
15688 libspath='$libspath'
15689 libswanted='$libswanted'
15690 line='$line'
15691 lint='$lint'
15692 lkflags='$lkflags'
15693 ln='$ln'
15694 lns='$lns'
15695 locincpth='$locincpth'
15696 loclibpth='$loclibpth'
15697 longdblsize='$longdblsize'
15698 longlongsize='$longlongsize'
15699 longsize='$longsize'
15700 lp='$lp'
15701 lpr='$lpr'
15702 ls='$ls'
15703 lseeksize='$lseeksize'
15704 lseektype='$lseektype'
15705 mail='$mail'
15706 mailx='$mailx'
15707 make='$make'
15708 make_set_make='$make_set_make'
15709 mallocobj='$mallocobj'
15710 mallocsrc='$mallocsrc'
15711 malloctype='$malloctype'
15712 man1dir='$man1dir'
15713 man1direxp='$man1direxp'
15714 man1ext='$man1ext'
15715 man3dir='$man3dir'
15716 man3direxp='$man3direxp'
15717 man3ext='$man3ext'
15718 medium='$medium'
15719 mips_type='$mips_type'
15720 mkdir='$mkdir'
15721 mmaptype='$mmaptype'
15722 models='$models'
15723 modetype='$modetype'
15724 more='$more'
15725 multiarch='$multiarch'
15726 mv='$mv'
15727 myarchname='$myarchname'
15728 mydomain='$mydomain'
15729 myhostname='$myhostname'
15730 myuname='$myuname'
15731 n='$n'
15732 netdb_hlen_type='$netdb_hlen_type'
15733 netdb_host_type='$netdb_host_type'
15734 netdb_name_type='$netdb_name_type'
15735 netdb_net_type='$netdb_net_type'
15736 nm='$nm'
15737 nm_opt='$nm_opt'
15738 nm_so_opt='$nm_so_opt'
15739 nonxs_ext='$nonxs_ext'
15740 nroff='$nroff'
15741 nvsize='$nvsize'
15742 nvtype='$nvtype'
15743 o_nonblock='$o_nonblock'
15744 obj_ext='$obj_ext'
15745 old_pthread_create_joinable='$old_pthread_create_joinable'
15746 optimize='$optimize'
15747 orderlib='$orderlib'
15748 osname='$osname'
15749 osvers='$osvers'
15750 otherlibdirs='$otherlibdirs'
15751 package='$package'
15752 pager='$pager'
15753 passcat='$passcat'
15754 patchlevel='$patchlevel'
15755 path_sep='$path_sep'
15756 perl5='$perl5'
15757 perl='$perl'
15758 perladmin='$perladmin'
15759 perlpath='$perlpath'
15760 pg='$pg'
15761 phostname='$phostname'
15762 pidtype='$pidtype'
15763 plibpth='$plibpth'
15764 pm_apiversion='$pm_apiversion'
15765 pmake='$pmake'
15766 pr='$pr'
15767 prefix='$prefix'
15768 prefixexp='$prefixexp'
15769 privlib='$privlib'
15770 privlibexp='$privlibexp'
15771 prototype='$prototype'
15772 ptrsize='$ptrsize'
15773 quadkind='$quadkind'
15774 quadtype='$quadtype'
15775 randbits='$randbits'
15776 randfunc='$randfunc'
15777 randseedtype='$randseedtype'
15778 ranlib='$ranlib'
15779 rd_nodata='$rd_nodata'
15780 revision='$revision'
15781 rm='$rm'
15782 rmail='$rmail'
15783 runnm='$runnm'
15784 sPRIEldbl='$sPRIEldbl'
15785 sPRIFldbl='$sPRIFldbl'
15786 sPRIGldbl='$sPRIGldbl'
15787 sPRIX64='$sPRIX64'
15788 sPRId64='$sPRId64'
15789 sPRIeldbl='$sPRIeldbl'
15790 sPRIfldbl='$sPRIfldbl'
15791 sPRIgldbl='$sPRIgldbl'
15792 sPRIi64='$sPRIi64'
15793 sPRIo64='$sPRIo64'
15794 sPRIu64='$sPRIu64'
15795 sPRIx64='$sPRIx64'
15796 sched_yield='$sched_yield'
15797 scriptdir='$scriptdir'
15798 scriptdirexp='$scriptdirexp'
15799 sed='$sed'
15800 seedfunc='$seedfunc'
15801 selectminbits='$selectminbits'
15802 selecttype='$selecttype'
15803 sendmail='$sendmail'
15804 sh='$sh'
15805 shar='$shar'
15806 sharpbang='$sharpbang'
15807 shmattype='$shmattype'
15808 shortsize='$shortsize'
15809 shrpenv='$shrpenv'
15810 shsharp='$shsharp'
15811 sig_count='$sig_count'
15812 sig_name='$sig_name'
15813 sig_name_init='$sig_name_init'
15814 sig_num='$sig_num'
15815 sig_num_init='$sig_num_init'
15816 signal_t='$signal_t'
15817 sitearch='$sitearch'
15818 sitearchexp='$sitearchexp'
15819 sitebin='$sitebin'
15820 sitebinexp='$sitebinexp'
15821 sitelib='$sitelib'
15822 sitelib_stem='$sitelib_stem'
15823 sitelibexp='$sitelibexp'
15824 siteprefix='$siteprefix'
15825 siteprefixexp='$siteprefixexp'
15826 sizesize='$sizesize'
15827 sizetype='$sizetype'
15828 sleep='$sleep'
15829 smail='$smail'
15830 small='$small'
15831 so='$so'
15832 sockethdr='$sockethdr'
15833 socketlib='$socketlib'
15834 socksizetype='$socksizetype'
15835 sort='$sort'
15836 spackage='$spackage'
15837 spitshell='$spitshell'
15838 split='$split'
15839 src='$src'
15840 ssizetype='$ssizetype'
15841 startperl='$startperl'
15842 startsh='$startsh'
15843 static_ext='$static_ext'
15844 stdchar='$stdchar'
15845 stdio_base='$stdio_base'
15846 stdio_bufsiz='$stdio_bufsiz'
15847 stdio_cnt='$stdio_cnt'
15848 stdio_filbuf='$stdio_filbuf'
15849 stdio_ptr='$stdio_ptr'
15850 stdio_stream_array='$stdio_stream_array'
15851 strings='$strings'
15852 submit='$submit'
15853 subversion='$subversion'
15854 sysman='$sysman'
15855 tail='$tail'
15856 tar='$tar'
15857 tbl='$tbl'
15858 tee='$tee'
15859 test='$test'
15860 timeincl='$timeincl'
15861 timetype='$timetype'
15862 touch='$touch'
15863 tr='$tr'
15864 trnl='$trnl'
15865 troff='$troff'
15866 u16size='$u16size'
15867 u16type='$u16type'
15868 u32size='$u32size'
15869 u32type='$u32type'
15870 u64size='$u64size'
15871 u64type='$u64type'
15872 u8size='$u8size'
15873 u8type='$u8type'
15874 uidformat='$uidformat'
15875 uidsign='$uidsign'
15876 uidsize='$uidsize'
15877 uidtype='$uidtype'
15878 uname='$uname'
15879 uniq='$uniq'
15880 uquadtype='$uquadtype'
15881 use5005threads='$use5005threads'
15882 use64bitall='$use64bitall'
15883 use64bitint='$use64bitint'
15884 usedl='$usedl'
15885 useithreads='$useithreads'
15886 uselargefiles='$uselargefiles'
15887 uselongdouble='$uselongdouble'
15888 usemorebits='$usemorebits'
15889 usemultiplicity='$usemultiplicity'
15890 usemymalloc='$usemymalloc'
15891 usenm='$usenm'
15892 useopcode='$useopcode'
15893 useperlio='$useperlio'
15894 useposix='$useposix'
15895 usesfio='$usesfio'
15896 useshrplib='$useshrplib'
15897 usesocks='$usesocks'
15898 usethreads='$usethreads'
15899 usevendorprefix='$usevendorprefix'
15900 usevfork='$usevfork'
15901 usrinc='$usrinc'
15902 uuname='$uuname'
15903 uvoformat='$uvoformat'
15904 uvsize='$uvsize'
15905 uvtype='$uvtype'
15906 uvuformat='$uvuformat'
15907 uvxformat='$uvxformat'
15908 vendorarch='$vendorarch'
15909 vendorarchexp='$vendorarchexp'
15910 vendorbin='$vendorbin'
15911 vendorbinexp='$vendorbinexp'
15912 vendorlib='$vendorlib'
15913 vendorlib_stem='$vendorlib_stem'
15914 vendorlibexp='$vendorlibexp'
15915 vendorprefix='$vendorprefix'
15916 vendorprefixexp='$vendorprefixexp'
15917 version='$version'
15918 vi='$vi'
15919 voidflags='$voidflags'
15920 xlibpth='$xlibpth'
15921 xs_apiversion='$xs_apiversion'
15922 zcat='$zcat'
15923 zip='$zip'
15924 EOT
15925
15926 : Add in command line options if available
15927 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15928
15929 : add special variables
15930 $test -f $src/patchlevel.h && \
15931 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15932 echo "CONFIGDOTSH=true" >>config.sh
15933
15934 : propagate old symbols
15935 if $test -f UU/config.sh; then
15936         <UU/config.sh sort | uniq >UU/oldconfig.sh
15937         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15938         sort | uniq -u >UU/oldsyms
15939         set X `cat UU/oldsyms`
15940         shift
15941         case $# in
15942         0) ;;
15943         *)
15944                 cat <<EOM
15945 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15946 EOM
15947                 echo "# Variables propagated from previous config.sh file." >>config.sh
15948                 for sym in `cat UU/oldsyms`; do
15949                         echo "    Propagating $hint variable "'$'"$sym..."
15950                         eval 'tmp="$'"${sym}"'"'
15951                         echo "$tmp" | \
15952                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15953                 done
15954                 ;;
15955         esac
15956 fi
15957
15958 : Finish up by extracting the .SH files
15959 case "$alldone" in
15960 exit)
15961         $rm -rf UU
15962         echo "Done."
15963         exit 0
15964         ;;
15965 cont)
15966         ;;
15967 '')
15968         dflt=''
15969         nostick=true
15970         $cat <<EOM
15971
15972 If you'd like to make any changes to the config.sh file before I begin
15973 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15974
15975 EOM
15976         rp="Press return or use a shell escape to edit config.sh:"
15977         . UU/myread
15978         nostick=''
15979         case "$ans" in
15980         '') ;;
15981         *) : in case they cannot read
15982                 sh 1>&4 -c "$ans";;
15983         esac
15984         ;;
15985 esac
15986
15987 : if this fails, just run all the .SH files by hand
15988 . ./config.sh
15989
15990 echo " "
15991 exec 1>&4
15992 . ./UU/extract
15993
15994 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15995         dflt=y
15996         case "$silent" in
15997         true) ;;
15998         *)
15999                 $cat <<EOM
16000
16001 Now you need to generate make dependencies by running "$make depend".
16002 You might prefer to run it in background: "$make depend > makedepend.out &"
16003 It can take a while, so you might not want to run it right now.
16004
16005 EOM
16006                 ;;
16007         esac
16008         rp="Run $make depend now?"
16009         . UU/myread
16010         case "$ans" in
16011         y*)
16012                 $make depend && echo "Now you must run a $make."
16013                 ;;
16014         *)
16015                 echo "You must run '$make depend' then '$make'."
16016                 ;;
16017         esac
16018 elif test -f [Mm]akefile; then
16019         echo " "
16020         echo "Now you must run a $make."
16021 else
16022         echo "Done."
16023 fi
16024
16025 if $test -f Policy.sh; then
16026     $cat <<EOM
16027
16028 If you compile $package on a different machine or from a different object
16029 directory, copy the Policy.sh file from this object directory to the
16030 new one before you run Configure -- this will help you with most of
16031 the policy defaults.
16032
16033 EOM
16034 fi
16035 if $test -f config.msg; then
16036     echo "Hmm.  I also noted the following information while running:"
16037     echo " "
16038     $cat config.msg >&4
16039     $rm -f config.msg
16040 fi
16041 $rm -f kit*isdone ark*isdone
16042 $rm -rf UU
16043
16044 : End of Configure
16045