023b2d9b8bda17602f6452b0511511cf1f445957
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jun 27 04:45:48 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 ccflags=''
292 cppflags=''
293 ldflags=''
294 lkflags=''
295 locincpth=''
296 optimize=''
297 cf_email=''
298 cf_by=''
299 cf_time=''
300 charsize=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_fchmod=''
346 d_fchown=''
347 d_fcntl=''
348 d_fd_macros=''
349 d_fd_set=''
350 d_fds_bits=''
351 d_fgetpos=''
352 d_flexfnam=''
353 d_flock=''
354 d_fork=''
355 d_fpos64_t=''
356 d_frexpl=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getcwd=''
366 d_getespwnam=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getprpwnam=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_isnan=''
410 d_isnanl=''
411 d_killpg=''
412 d_lchown=''
413 d_ldbl_dig=''
414 d_link=''
415 d_locconv=''
416 d_lockf=''
417 d_longdbl=''
418 longdblsize=''
419 d_longlong=''
420 longlongsize=''
421 d_lseekproto=''
422 d_lstat=''
423 d_madvise=''
424 d_mblen=''
425 d_mbstowcs=''
426 d_mbtowc=''
427 d_memchr=''
428 d_memcmp=''
429 d_memcpy=''
430 d_memmove=''
431 d_memset=''
432 d_mkdir=''
433 d_mkdtemp=''
434 d_mkfifo=''
435 d_mkstemp=''
436 d_mkstemps=''
437 d_mktime=''
438 d_mmap=''
439 mmaptype=''
440 d_modfl=''
441 d_mprotect=''
442 d_msg=''
443 d_msgctl=''
444 d_msgget=''
445 d_msgrcv=''
446 d_msgsnd=''
447 d_msync=''
448 d_munmap=''
449 d_nice=''
450 d_off64_t=''
451 d_open3=''
452 d_fpathconf=''
453 d_pathconf=''
454 d_pause=''
455 d_pipe=''
456 d_poll=''
457 d_portable=''
458 d_old_pthread_create_joinable=''
459 old_pthread_create_joinable=''
460 d_pthread_yield=''
461 d_sched_yield=''
462 sched_yield=''
463 d_qgcvt=''
464 d_readdir=''
465 d_rewinddir=''
466 d_seekdir=''
467 d_telldir=''
468 d_readlink=''
469 d_rename=''
470 d_rmdir=''
471 d_safebcpy=''
472 d_safemcpy=''
473 d_sanemcmp=''
474 d_select=''
475 d_sem=''
476 d_semctl=''
477 d_semget=''
478 d_semop=''
479 d_setegid=''
480 d_seteuid=''
481 d_setgrent=''
482 d_setgrps=''
483 d_sethent=''
484 d_setlinebuf=''
485 d_setlocale=''
486 d_setnent=''
487 d_setpent=''
488 d_setpgid=''
489 d_setpgrp2=''
490 d_bsdsetpgrp=''
491 d_setpgrp=''
492 d_setprior=''
493 d_setpwent=''
494 d_setregid=''
495 d_setresgid=''
496 d_setresuid=''
497 d_setreuid=''
498 d_setrgid=''
499 d_setruid=''
500 d_setsent=''
501 d_setsid=''
502 d_setvbuf=''
503 d_sfio=''
504 usesfio=''
505 d_shm=''
506 d_shmat=''
507 d_shmatprototype=''
508 shmattype=''
509 d_shmctl=''
510 d_shmdt=''
511 d_shmget=''
512 d_sigaction=''
513 d_sigsetjmp=''
514 d_msg_ctrunc=''
515 d_msg_dontroute=''
516 d_msg_oob=''
517 d_msg_peek=''
518 d_msg_proxy=''
519 d_oldsock=''
520 d_scm_rights=''
521 d_socket=''
522 d_sockpair=''
523 sockethdr=''
524 socketlib=''
525 d_socklen_t=''
526 d_sqrtl=''
527 d_statblks=''
528 d_statfs_f_flags=''
529 d_statfs_s=''
530 d_fstatvfs=''
531 d_statvfs=''
532 d_stdio_cnt_lval=''
533 d_stdio_ptr_lval=''
534 d_stdiobase=''
535 d_stdstdio=''
536 stdio_base=''
537 stdio_bufsiz=''
538 stdio_cnt=''
539 stdio_filbuf=''
540 stdio_ptr=''
541 d_index=''
542 d_strchr=''
543 d_strcoll=''
544 d_strctcpy=''
545 d_strerrm=''
546 d_strerror=''
547 d_sysernlst=''
548 d_syserrlst=''
549 d_strtod=''
550 d_strtol=''
551 d_strtold=''
552 d_strtoll=''
553 d_strtoul=''
554 d_strtoull=''
555 d_strtouq=''
556 d_strxfrm=''
557 d_symlink=''
558 d_syscall=''
559 d_sysconf=''
560 d_system=''
561 d_tcgetpgrp=''
562 d_tcsetpgrp=''
563 d_telldirproto=''
564 d_time=''
565 timetype=''
566 clocktype=''
567 d_times=''
568 d_truncate=''
569 d_tzname=''
570 d_umask=''
571 d_semctl_semid_ds=''
572 d_semctl_semun=''
573 d_union_semun=''
574 d_ustat=''
575 d_vfork=''
576 usevfork=''
577 d_voidsig=''
578 signal_t=''
579 d_volatile=''
580 d_charvspr=''
581 d_vprintf=''
582 d_wait4=''
583 d_waitpid=''
584 d_wcstombs=''
585 d_wctomb=''
586 dlext=''
587 cccdlflags=''
588 ccdlflags=''
589 dlsrc=''
590 ld=''
591 lddlflags=''
592 usedl=''
593 doublesize=''
594 ebcdic=''
595 fflushNULL=''
596 fflushall=''
597 fpossize=''
598 fpostype=''
599 gccversion=''
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         case "$cc" in
2802         '') modelcc="$cc" ;;
2803         *) modelcc="cc" ;;
2804         esac
2805         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2806         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2807                 dflt='unsplit split'
2808         else
2809                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2810                 case "$tans" in
2811                 X) dflt='none';;
2812                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2813                                 dflt='small'
2814                         else
2815                                 dflt=''
2816                         fi
2817                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2818                                 dflt="$dflt medium"
2819                         fi
2820                         if $test -d /lib/large || $test -d /usr/lib/large; then
2821                                 dflt="$dflt large"
2822                         fi
2823                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2824                                 dflt="$dflt huge"
2825                         fi
2826                 esac
2827         fi;;
2828 *) dflt="$models";;
2829 esac
2830 $cat <<EOM
2831  
2832 Some systems have different model sizes.  On most systems they are called
2833 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2834 split.  If your system doesn't support different memory models, say "none".
2835 If you wish to force everything to one memory model, say "none" here and
2836 put the appropriate flags later when it asks you for other cc and ld flags.
2837 Venix systems may wish to put "none" and let the compiler figure things out.
2838 (In the following question multiple model names should be space separated.)
2839
2840 The default for most systems is "none".
2841
2842 EOM
2843 rp="Which memory models are supported?"
2844 . ./myread
2845 models="$ans"
2846
2847 case "$models" in
2848 none)
2849         small=''
2850         medium=''
2851         large=''
2852         huge=''
2853         unsplit=''
2854         split=''
2855         ;;
2856 *split)
2857         case "$split" in
2858         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2859                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2860                         dflt='-i'
2861                 else
2862                         dflt='none'
2863                 fi;;
2864         *) dflt="$split";;
2865         esac
2866         rp="What flag indicates separate I and D space?"
2867         . ./myread
2868         tans="$ans"
2869         case "$tans" in
2870         none) tans='';;
2871         esac
2872         split="$tans"
2873         unsplit='';;
2874 *large*|*small*|*medium*|*huge*)
2875         case "$models" in
2876         *large*)
2877                 case "$large" in
2878                 '') dflt='-Ml';;
2879                 *) dflt="$large";;
2880                 esac
2881         rp="What flag indicates large model?"
2882         . ./myread
2883         tans="$ans"
2884         case "$tans" in
2885         none) tans='';
2886         esac
2887         large="$tans";;
2888         *) large='';;
2889         esac
2890         case "$models" in
2891         *huge*) case "$huge" in
2892                 '') dflt='-Mh';;
2893                 *) dflt="$huge";;
2894                 esac
2895                 rp="What flag indicates huge model?"
2896                 . ./myread
2897                 tans="$ans"
2898                 case "$tans" in
2899                 none) tans='';
2900                 esac
2901                 huge="$tans";;
2902         *) huge="$large";;
2903         esac
2904         case "$models" in
2905         *medium*) case "$medium" in
2906                 '') dflt='-Mm';;
2907                 *) dflt="$medium";;
2908                 esac
2909                 rp="What flag indicates medium model?"
2910                 . ./myread
2911                 tans="$ans"
2912                 case "$tans" in
2913                 none) tans='';
2914                 esac
2915                 medium="$tans";;
2916         *) medium="$large";;
2917         esac
2918         case "$models" in
2919         *small*) case "$small" in
2920                 '') dflt='none';;
2921                 *) dflt="$small";;
2922                 esac
2923                 rp="What flag indicates small model?"
2924                 . ./myread
2925                 tans="$ans"
2926                 case "$tans" in
2927                 none) tans='';
2928                 esac
2929                 small="$tans";;
2930         *) small='';;
2931         esac
2932         ;;
2933 *)
2934         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2935         ;;
2936 esac
2937 $rm -f pdp11.* pdp11
2938
2939 : make some quick guesses about what we are up against
2940 echo " "
2941 $echo $n "Hmm...  $c"
2942 echo exit 1 >bsd
2943 echo exit 1 >usg
2944 echo exit 1 >v7
2945 echo exit 1 >osf1
2946 echo exit 1 >eunice
2947 echo exit 1 >xenix
2948 echo exit 1 >venix
2949 echo exit 1 >os2
2950 d_bsd="$undef"
2951 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2952 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2953 then
2954         echo "Looks kind of like an OSF/1 system, but we'll see..."
2955         echo exit 0 >osf1
2956 elif test `echo abc | tr a-z A-Z` = Abc ; then
2957         xxx=`./loc addbib blurfl $pth`
2958         if $test -f $xxx; then
2959         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2960                 echo exit 0 >bsd
2961                 echo exit 0 >usg
2962         else
2963                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2964                         echo "Looks kind of like an extended USG system, but we'll see..."
2965                 else
2966                         echo "Looks kind of like a USG system, but we'll see..."
2967                 fi
2968                 echo exit 0 >usg
2969         fi
2970 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2971         echo "Looks kind of like a BSD system, but we'll see..."
2972         d_bsd="$define"
2973         echo exit 0 >bsd
2974 else
2975         echo "Looks kind of like a Version 7 system, but we'll see..."
2976         echo exit 0 >v7
2977 fi
2978 case "$eunicefix" in
2979 *unixtovms*)
2980         $cat <<'EOI'
2981 There is, however, a strange, musty smell in the air that reminds me of
2982 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2983 EOI
2984         echo exit 0 >eunice
2985         d_eunice="$define"
2986 : it so happens the Eunice I know will not run shell scripts in Unix format
2987         ;;
2988 *)
2989         echo " "
2990         echo "Congratulations.  You aren't running Eunice."
2991         d_eunice="$undef"
2992         ;;
2993 esac
2994 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2995 case "$p_" in
2996 :) ;;
2997 *)
2998         $cat <<'EOI'
2999 I have the feeling something is not exactly right, however...don't tell me...
3000 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3001 EOI
3002         echo exit 0 >os2
3003         ;;
3004 esac
3005 if test -f /xenix; then
3006         echo "Actually, this looks more like a XENIX system..."
3007         echo exit 0 >xenix
3008         d_xenix="$define"
3009 else
3010         echo " "
3011         echo "It's not Xenix..."
3012         d_xenix="$undef"
3013 fi
3014 chmod +x xenix
3015 $eunicefix xenix
3016 if test -f /venix; then
3017         echo "Actually, this looks more like a VENIX system..."
3018         echo exit 0 >venix
3019 else
3020         echo " "
3021         if ./xenix; then
3022                 : null
3023         else
3024                 echo "Nor is it Venix..."
3025         fi
3026 fi
3027 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3028 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3029 $rm -f foo
3030
3031 : see if we need a special compiler
3032 echo " "
3033 if ./usg; then
3034         case "$cc" in
3035         '') case "$Mcc" in
3036                 /*) dflt='Mcc';;
3037                 *) case "$large" in
3038                         -M*) dflt='cc';;
3039                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3040                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3041                                                 dflt='cc'
3042                                         else
3043                                                 dflt='cc -M'
3044                                         fi
3045                                 else
3046                                         dflt='cc'
3047                                 fi;;
3048                         esac;;
3049                 esac;;
3050         *)  dflt="$cc";;
3051         esac
3052         case "$dflt" in
3053         *M*)    $cat <<'EOM'
3054 On some older systems the default C compiler will not resolve multiple global
3055 references that happen to have the same name.  On some such systems the "Mcc"
3056 command may be used to force these to be resolved.  On other systems a "cc -M"
3057 command is required.  (Note that the -M flag on other systems indicates a
3058 memory model to use!) If you have the Gnu C compiler, you might wish to use
3059 that instead.
3060
3061 EOM
3062         ;;
3063         esac
3064         rp="Use which C compiler?"
3065         . ./myread
3066         cc="$ans"
3067 else
3068         case "$cc" in
3069         '') dflt=cc;;
3070         *) dflt="$cc";;
3071         esac
3072         rp="Use which C compiler?"
3073         . ./myread
3074         cc="$ans"
3075 fi
3076 : Look for a hint-file generated 'call-back-unit'.  Now that the
3077 : user has specified the compiler, we may need to set or change some
3078 : other defaults.
3079 if $test -f cc.cbu; then
3080     . ./cc.cbu
3081 fi
3082 : Quick sanity check, we will do a fuller one later when we know
3083 : the various flags and libs
3084 $rm -f try try.*
3085 $cat >try.c <<EOM
3086 int main(int argc, char *argv[]) {
3087   return 0;
3088 }
3089 EOM
3090 if $cc -o try try.c; then
3091    :
3092 else
3093    echo "Uh-oh, the C compiler "$cc" doesn't seem to be working..." >&4
3094    despair=yes
3095    trygcc=yes
3096    case "$cc" in
3097    *gcc) trygcc=no ;;
3098    esac
3099    case "`$cc -v 2>&1`" in
3100    *gcc*) trygcc=no ;;
3101    esac
3102    if $test X"$trygcc" = Xyes; then
3103       if gcc -o try try.c; then
3104         echo " "
3105         echo "You seem to have a working gcc, though."
3106         rp="Do you want to use it?"
3107         dflt=y
3108         . ./myread
3109         case "$ans" in
3110         [yY]*) cc=gcc; despair=no ;;
3111         esac
3112       fi
3113    fi
3114    if $test X"$despair" = Xyes; then
3115       echo "You need to find a working C compiler." >&4
3116       echo "I cannot continue any further, aborting." >&4
3117       exit 1
3118    fi
3119 fi
3120 $rm -f try try.*
3121
3122
3123 echo " "
3124 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3125 $cat >gccvers.c <<EOM
3126 #include <stdio.h>
3127 int main() {
3128 #ifdef __GNUC__
3129 #ifdef __VERSION__
3130         printf("%s\n", __VERSION__);
3131 #else
3132         printf("%s\n", "1");
3133 #endif
3134 #endif
3135         exit(0);
3136 }
3137 EOM
3138 if $cc $ldflags -o gccvers gccvers.c; then
3139         gccversion=`./gccvers`
3140         case "$gccversion" in
3141         '') echo "You are not using GNU cc." ;;
3142         *)  echo "You are using GNU cc $gccversion."
3143             ;;
3144         esac
3145 else
3146         echo " "
3147         echo "*** WHOA THERE!!! ***" >&4
3148         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3149         case "$knowitall" in
3150         '')
3151         echo "    You'd better start hunting for one and let me know about it." >&4
3152                 exit 1
3153                 ;;
3154         esac
3155 fi
3156 $rm -f gccvers*
3157 case "$gccversion" in
3158 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3159 esac
3160
3161 : see how we invoke the C preprocessor
3162 echo " "
3163 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3164 cat <<'EOT' >testcpp.c
3165 #define ABC abc
3166 #define XYZ xyz
3167 ABC.XYZ
3168 EOT
3169 cd ..
3170 if test ! -f cppstdin; then
3171         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3172                 # AIX cc -E doesn't show the absolute headerfile
3173                 # locations but we'll cheat by using the -M flag.
3174                 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
3175         else
3176                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3177         fi
3178 else
3179         echo "Keeping your $hint cppstdin wrapper."
3180 fi
3181 chmod 755 cppstdin
3182 wrapper=`pwd`/cppstdin
3183 ok='false'
3184 cd UU
3185
3186 if $test "X$cppstdin" != "X" && \
3187         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3188         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3189 then
3190         echo "You used to use $cppstdin $cppminus so we'll use that again."
3191         case "$cpprun" in
3192         '') echo "But let's see if we can live without a wrapper..." ;;
3193         *)
3194                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3195                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3196                 then
3197                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3198                         ok='true'
3199                 else
3200                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3201                 fi
3202                 ;;
3203         esac
3204 else
3205         case "$cppstdin" in
3206         '') ;;
3207         *)
3208                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3209                 ;;
3210         esac
3211 fi
3212
3213 if $ok; then
3214         : nothing
3215 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3216         $cc -E <testcpp.c >testcpp.out 2>&1; \
3217         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3218         echo "Yup, it does."
3219         x_cpp="$cc -E"
3220         x_minus='';
3221 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3222         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3223         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3224         echo "Yup, it does."
3225         x_cpp="$cc -E"
3226         x_minus='-';
3227 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3228         $cc -P <testcpp.c >testcpp.out 2>&1; \
3229         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3230         echo "Yipee, that works!"
3231         x_cpp="$cc -P"
3232         x_minus='';
3233 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3234         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3235         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3236         echo "At long last!"
3237         x_cpp="$cc -P"
3238         x_minus='-';
3239 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3240         $cpp <testcpp.c >testcpp.out 2>&1; \
3241         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3242         echo "It works!"
3243         x_cpp="$cpp"
3244         x_minus='';
3245 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3246         $cpp - <testcpp.c >testcpp.out 2>&1; \
3247         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3248         echo "Hooray, it works!  I was beginning to wonder."
3249         x_cpp="$cpp"
3250         x_minus='-';
3251 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3252         $wrapper <testcpp.c >testcpp.out 2>&1; \
3253         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3254         x_cpp="$wrapper"
3255         x_minus=''
3256         echo "Eureka!"
3257 else
3258         dflt=''
3259         rp="No dice.  I can't find a C preprocessor.  Name one:"
3260         . ./myread
3261         x_cpp="$ans"
3262         x_minus=''
3263         $x_cpp <testcpp.c >testcpp.out 2>&1
3264         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3265                 echo "OK, that will do." >&4
3266         else
3267 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3268                 exit 1
3269         fi
3270 fi
3271
3272 case "$ok" in
3273 false)
3274         cppstdin="$x_cpp"
3275         cppminus="$x_minus"
3276         cpprun="$x_cpp"
3277         cpplast="$x_minus"
3278         set X $x_cpp
3279         shift
3280         case "$1" in
3281         "$cpp")
3282                 echo "Perhaps can we force $cc -E using a wrapper..."
3283                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3284                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3285                 then
3286                         echo "Yup, we can."
3287                         cppstdin="$wrapper"
3288                         cppminus='';
3289                 else
3290                         echo "Nope, we'll have to live without it..."
3291                 fi
3292                 ;;
3293         esac
3294         case "$cpprun" in
3295         "$wrapper")
3296                 cpprun=''
3297                 cpplast=''
3298                 ;;
3299         esac
3300         ;;
3301 esac
3302
3303 case "$cppstdin" in
3304 "$wrapper"|'cppstdin') ;;
3305 *) $rm -f $wrapper;;
3306 esac
3307 $rm -f testcpp.c testcpp.out
3308
3309 : decide how portable to be.  Allow command line overrides.
3310 case "$d_portable" in
3311 "$undef") ;;
3312 *)      d_portable="$define" ;;
3313 esac
3314
3315 : set up shell script to do ~ expansion
3316 cat >filexp <<EOSS
3317 $startsh
3318 : expand filename
3319 case "\$1" in
3320  ~/*|~)
3321         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3322         ;;
3323  ~*)
3324         if $test -f /bin/csh; then
3325                 /bin/csh -f -c "glob \$1"
3326                 failed=\$?
3327                 echo ""
3328                 exit \$failed
3329         else
3330                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3331                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3332                 if $test ! -d "\$dir"; then
3333                         me=\`basename \$0\`
3334                         echo "\$me: can't locate home directory for: \$name" >&2
3335                         exit 1
3336                 fi
3337                 case "\$1" in
3338                 */*)
3339                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3340                         ;;
3341                 *)
3342                         echo \$dir
3343                         ;;
3344                 esac
3345         fi
3346         ;;
3347 *)
3348         echo \$1
3349         ;;
3350 esac
3351 EOSS
3352 chmod +x filexp
3353 $eunicefix filexp
3354
3355 : now set up to get a file name
3356 cat <<EOS >getfile
3357 $startsh
3358 EOS
3359 cat <<'EOSC' >>getfile
3360 tilde=''
3361 fullpath=''
3362 already=''
3363 skip=''
3364 none_ok=''
3365 exp_file=''
3366 nopath_ok=''
3367 orig_rp="$rp"
3368 orig_dflt="$dflt"
3369 case "$gfpth" in
3370 '') gfpth='.' ;;
3371 esac
3372
3373 case "$fn" in
3374 *\(*)
3375         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3376         fn=`echo $fn | sed 's/(.*)//'`
3377         ;;
3378 esac
3379
3380 case "$fn" in
3381 *:*)
3382         loc_file=`expr $fn : '.*:\(.*\)'`
3383         fn=`expr $fn : '\(.*\):.*'`
3384         ;;
3385 esac
3386
3387 case "$fn" in
3388 *~*) tilde=true;;
3389 esac
3390 case "$fn" in
3391 */*) fullpath=true;;
3392 esac
3393 case "$fn" in
3394 *+*) skip=true;;
3395 esac
3396 case "$fn" in
3397 *n*) none_ok=true;;
3398 esac
3399 case "$fn" in
3400 *e*) exp_file=true;;
3401 esac
3402 case "$fn" in
3403 *p*) nopath_ok=true;;
3404 esac
3405
3406 case "$fn" in
3407 *f*) type='File';;
3408 *d*) type='Directory';;
3409 *l*) type='Locate';;
3410 esac
3411
3412 what="$type"
3413 case "$what" in
3414 Locate) what='File';;
3415 esac
3416
3417 case "$exp_file" in
3418 '')
3419         case "$d_portable" in
3420         "$define") ;;
3421         *) exp_file=true;;
3422         esac
3423         ;;
3424 esac
3425
3426 cd ..
3427 while test "$type"; do
3428         redo=''
3429         rp="$orig_rp"
3430         dflt="$orig_dflt"
3431         case "$tilde" in
3432         true) rp="$rp (~name ok)";;
3433         esac
3434         . UU/myread
3435         if test -f UU/getfile.ok && \
3436                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3437         then
3438                 value="$ans"
3439                 ansexp="$ans"
3440                 break
3441         fi
3442         case "$ans" in
3443         none)
3444                 value=''
3445                 ansexp=''
3446                 case "$none_ok" in
3447                 true) type='';;
3448                 esac
3449                 ;;
3450         *)
3451                 case "$tilde" in
3452                 '') value="$ans"
3453                         ansexp="$ans";;
3454                 *)
3455                         value=`UU/filexp $ans`
3456                         case $? in
3457                         0)
3458                                 if test "$ans" != "$value"; then
3459                                         echo "(That expands to $value on this system.)"
3460                                 fi
3461                                 ;;
3462                         *) value="$ans";;
3463                         esac
3464                         ansexp="$value"
3465                         case "$exp_file" in
3466                         '') value="$ans";;
3467                         esac
3468                         ;;
3469                 esac
3470                 case "$fullpath" in
3471                 true)
3472                         case "$ansexp" in
3473                         /*) value="$ansexp" ;;
3474                         [a-zA-Z]:/*) value="$ansexp" ;;
3475                         *)
3476                                 redo=true
3477                                 case "$already" in
3478                                 true)
3479                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3480                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3481                                         ;;
3482                                 *)
3483                                 echo "Please give a full path name, starting with slash." >&4
3484                                         case "$tilde" in
3485                                         true)
3486                                 echo "Note that using ~name is ok provided it expands well." >&4
3487                                                 already=true
3488                                                 ;;
3489                                         esac
3490                                 esac
3491                                 ;;
3492                         esac
3493                         ;;
3494                 esac
3495                 case "$redo" in
3496                 '')
3497                         case "$type" in
3498                         File)
3499                                 for fp in $gfpth; do
3500                                         if test "X$fp" = X.; then
3501                                             pf="$ansexp"
3502                                         else    
3503                                             pf="$fp/$ansexp"
3504                                         fi
3505                                         if test -f "$pf"; then
3506                                                 type=''
3507                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3508                                         then
3509                                                 echo "($value is not a plain file, but that's ok.)"
3510                                                 type=''
3511                                         fi
3512                                         if test X"$type" = X; then
3513                                             value="$pf"
3514                                             break
3515                                         fi
3516                                 done
3517                                 ;;
3518                         Directory)
3519                                 for fp in $gfpth; do
3520                                         if test "X$fp" = X.; then
3521                                             dir="$ans"
3522                                             direxp="$ansexp"
3523                                         else    
3524                                             dir="$fp/$ansexp"
3525                                             direxp="$fp/$ansexp"
3526                                         fi
3527                                         if test -d "$direxp"; then
3528                                                 type=''
3529                                                 value="$dir"
3530                                                 break
3531                                         fi
3532                                 done
3533                                 ;;
3534                         Locate)
3535                                 if test -d "$ansexp"; then
3536                                         echo "(Looking for $loc_file in directory $value.)"
3537                                         value="$value/$loc_file"
3538                                         ansexp="$ansexp/$loc_file"
3539                                 fi
3540                                 if test -f "$ansexp"; then
3541                                         type=''
3542                                 fi
3543                                 case "$nopath_ok" in
3544                                 true)   case "$value" in
3545                                         */*) ;;
3546                                         *)      echo "Assuming $value will be in people's path."
3547                                                 type=''
3548                                                 ;;
3549                                         esac
3550                                         ;;
3551                                 esac
3552                                 ;;
3553                         esac
3554
3555                         case "$skip" in
3556                         true) type='';
3557                         esac
3558
3559                         case "$type" in
3560                         '') ;;
3561                         *)
3562                                 if test "$fastread" = yes; then
3563                                         dflt=y
3564                                 else
3565                                         dflt=n
3566                                 fi
3567                                 rp="$what $value doesn't exist.  Use that name anyway?"
3568                                 . UU/myread
3569                                 dflt=''
3570                                 case "$ans" in
3571                                 y*) type='';;
3572                                 *) echo " ";;
3573                                 esac
3574                                 ;;
3575                         esac
3576                         ;;
3577                 esac
3578                 ;;
3579         esac
3580 done
3581 cd UU
3582 ans="$value"
3583 rp="$orig_rp"
3584 dflt="$orig_dflt"
3585 rm -f getfile.ok
3586 test "X$gfpthkeep" != Xy && gfpth=""
3587 EOSC
3588
3589 : What should the include directory be ?
3590 echo " "
3591 $echo $n "Hmm...  $c"
3592 dflt='/usr/include'
3593 incpath=''
3594 mips_type=''
3595 if $test -f /bin/mips && /bin/mips; then
3596         echo "Looks like a MIPS system..."
3597         $cat >usr.c <<'EOCP'
3598 #ifdef SYSTYPE_BSD43
3599 /bsd43
3600 #endif
3601 EOCP
3602         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3603                 dflt='/bsd43/usr/include'
3604                 incpath='/bsd43'
3605                 mips_type='BSD 4.3'
3606         else
3607                 mips_type='System V'
3608         fi
3609         $rm -f usr.c usr.out
3610         echo "and you're compiling with the $mips_type compiler and libraries."
3611         xxx_prompt=y
3612         echo "exit 0" >mips
3613 else
3614         echo "Doesn't look like a MIPS system."
3615         xxx_prompt=n
3616         echo "exit 1" >mips
3617 fi
3618 chmod +x mips
3619 $eunicefix mips
3620 case "$usrinc" in
3621 '') ;;
3622 *) dflt="$usrinc";;
3623 esac
3624 case "$xxx_prompt" in
3625 y)      fn=d/
3626         echo " "
3627         rp='Where are the include files you want to use?'
3628         . ./getfile
3629         usrinc="$ans"
3630         ;;
3631 *)      usrinc="$dflt"
3632         ;;
3633 esac
3634
3635 : Set private lib path
3636 case "$plibpth" in
3637 '') if ./mips; then
3638                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3639         fi;;
3640 esac
3641 case "$libpth" in
3642 ' ') dlist='';;
3643 '') dlist="$loclibpth $plibpth $glibpth";;
3644 *) dlist="$libpth";;
3645 esac
3646
3647 : Now check and see which directories actually exist, avoiding duplicates
3648 libpth=''
3649 for xxx in $dlist
3650 do
3651     if $test -d $xxx; then
3652                 case " $libpth " in
3653                 *" $xxx "*) ;;
3654                 *) libpth="$libpth $xxx";;
3655                 esac
3656     fi
3657 done
3658 $cat <<'EOM'
3659
3660 Some systems have incompatible or broken versions of libraries.  Among
3661 the directories listed in the question below, please remove any you
3662 know not to be holding relevant libraries, and add any that are needed.
3663 Say "none" for none.
3664
3665 EOM
3666 case "$libpth" in
3667 '') dflt='none';;
3668 *)
3669         set X $libpth
3670         shift
3671         dflt=${1+"$@"}
3672         ;;
3673 esac
3674 rp="Directories to use for library searches?"
3675 . ./myread
3676 case "$ans" in
3677 none) libpth=' ';;
3678 *) libpth="$ans";;
3679 esac
3680
3681 : compute shared library extension
3682 case "$so" in
3683 '')
3684         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3685                 dflt='sl'
3686         else
3687                 dflt='so'
3688         fi
3689         ;;
3690 *) dflt="$so";;
3691 esac
3692 $cat <<EOM
3693
3694 On some systems, shared libraries may be available.  Answer 'none' if
3695 you want to suppress searching of shared libraries for the remainder
3696 of this configuration.
3697
3698 EOM
3699 rp='What is the file extension used for shared libraries?'
3700 . ./myread
3701 so="$ans"
3702
3703 : Define several unixisms.
3704 : Hints files or command line option can be used to override them.
3705 : The convoluted testing is in case hints files set either the old
3706 : or the new name.
3707 case "$_exe" in
3708 '')     case "$exe_ext" in
3709     '') ;;
3710         *)      _exe="$exe_ext" ;;
3711         esac
3712         ;;
3713 esac
3714 case "$_a" in
3715 '')     case "$lib_ext" in
3716     '') _a='.a';;
3717         *)      _a="$lib_ext" ;;
3718         esac
3719         ;;
3720 esac
3721 case "$_o" in
3722 '') case "$obj_ext" in
3723         '')     _o='.o';;
3724         *)      _o="$obj_ext";;
3725         esac
3726         ;;
3727 esac
3728 case "$p_" in
3729 '') case "$path_sep" in
3730         '')     p_=':';;
3731         *)      p_="$path_sep";;
3732         esac
3733         ;;
3734 esac
3735 exe_ext=$_exe
3736 lib_ext=$_a
3737 obj_ext=$_o
3738 path_sep=$p_
3739
3740 : Which makefile gets called first.  This is used by make depend.
3741 case "$firstmakefile" in
3742 '') firstmakefile='makefile';;
3743 esac
3744
3745 case "$usesocks" in
3746 $define|true|[yY]*)     dflt='y';;
3747 *) dflt='n';;
3748 esac
3749 cat <<EOM
3750
3751 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3752 Configure must be run with -Dusesocks.
3753
3754 If this doesn't make any sense to you, just accept the default '$dflt'.
3755 EOM
3756 rp='Build Perl for SOCKS?'
3757 . ./myread
3758 case "$ans" in
3759 y|Y)    val="$define" ;;     
3760 *)      val="$undef" ;;
3761 esac
3762 set usesocks
3763 eval $setvar
3764
3765 : Looking for optional libraries
3766 echo " "
3767 echo "Checking for optional libraries..." >&4
3768 case "$libs" in
3769 ' '|'') dflt='';;
3770 *) dflt="$libs";;
3771 esac
3772 case "$libswanted" in
3773 '') libswanted='c_s';;
3774 esac
3775 case "$usesocks" in
3776 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3777 esac
3778 libsfound=''
3779 libsfiles=''
3780 libsdirs=''
3781 libspath=''
3782 for thisdir in $libpth $xlibpth; do
3783   test -d $thisdir && libspath="$libspath $thisdir"
3784 done
3785 for thislib in $libswanted; do
3786         for thisdir in $libspath; do
3787             xxx=''
3788             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3789                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3790                 $test -f "$xxx" && eval $libscheck
3791                 $test -f "$xxx" && libstyle=shared
3792             fi
3793             if test ! -f "$xxx"; then
3794                 xxx=$thisdir/lib$thislib.$so
3795                 $test -f "$xxx" && eval $libscheck
3796                 $test -f "$xxx" && libstyle=shared
3797             fi  
3798             if test ! -f "$xxx"; then
3799                 xxx=$thisdir/lib$thislib$_a
3800                 $test -f "$xxx" && eval $libscheck
3801                 $test -f "$xxx" && libstyle=static
3802             fi
3803             if test ! -f "$xxx"; then
3804                 xxx=$thisdir/$thislib$_a
3805                 $test -f "$xxx" && eval $libscheck
3806                 $test -f "$xxx" && libstyle=static
3807             fi
3808             if test ! -f "$xxx"; then
3809                 xxx=$thisdir/lib${thislib}_s$_a
3810                 $test -f "$xxx" && eval $libscheck
3811                 $test -f "$xxx" && libstyle=static
3812                 $test -f "$xxx" && thislib=${thislib}_s
3813             fi
3814             if test ! -f "$xxx"; then
3815                 xxx=$thisdir/Slib$thislib$_a
3816                 $test -f "$xxx" && eval $libscheck
3817                 $test -f "$xxx" && libstyle=static
3818             fi
3819             if $test -f "$xxx"; then
3820                 case "$libstyle" in
3821                 shared) echo "Found -l$thislib (shared)." ;;
3822                 static) echo "Found -l$thislib." ;;
3823                 *)      echo "Found -l$thislib ($libstyle)." ;;
3824                 esac
3825                 case " $dflt " in
3826                 *"-l$thislib "*);;
3827                 *) dflt="$dflt -l$thislib"
3828                    libsfound="$libsfound $xxx"
3829                    yyy=`basename $xxx`
3830                    libsfiles="$libsfiles $yyy"
3831                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3832                    case " $libsdirs " in
3833                    *" $yyy "*) ;;
3834                    *) libsdirs="$libsdirs $yyy" ;;
3835                    esac
3836                    ;;
3837                 esac
3838                 break
3839             fi  
3840         done
3841         if $test ! -f "$xxx"; then
3842             echo "No -l$thislib."
3843         fi
3844 done
3845 set X $dflt
3846 shift
3847 dflt="$*"
3848 case "$libs" in
3849 '') dflt="$dflt";;
3850 *) dflt="$libs";;
3851 esac
3852 case "$dflt" in
3853 ' '|'') dflt='none';;
3854 esac
3855
3856 $cat <<EOM
3857
3858 In order to compile $package on your machine, a number of libraries
3859 are usually needed.  Include any other special libraries here as well.
3860 Say "none" for none.  The default list is almost always right.
3861 EOM
3862
3863 echo " "
3864 rp="What libraries to use?"
3865 . ./myread
3866 case "$ans" in
3867 none) libs=' ';;
3868 *) libs="$ans";;
3869 esac
3870
3871 : determine optimization, if desired, or use for debug flag also
3872 case "$optimize" in
3873 ' '|$undef) dflt='none';;
3874 '') dflt='-O';;
3875 *) dflt="$optimize";;
3876 esac
3877 $cat <<EOH
3878
3879 By default, $package compiles with the -O flag to use the optimizer.
3880 Alternately, you might want to use the symbolic debugger, which uses
3881 the -g flag (on traditional Unix systems).  Either flag can be
3882 specified here.  To use neither flag, specify the word "none".
3883
3884 EOH
3885 rp="What optimizer/debugger flag should be used?"
3886 . ./myread
3887 optimize="$ans"
3888 case "$optimize" in
3889 'none') optimize=" ";;
3890 esac
3891
3892 dflt=''
3893 : We will not override a previous value, but we might want to
3894 : augment a hint file
3895 case "$hint" in
3896 default|recommended)
3897         case "$gccversion" in
3898         1*) dflt='-fpcc-struct-return' ;;
3899         esac
3900         case "$optimize" in
3901         *-g*) dflt="$dflt -DDEBUGGING";;
3902         esac
3903         case "$gccversion" in
3904         2*) if test -d /etc/conf/kconfig.d &&
3905                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3906                 then
3907                         dflt="$dflt -posix"
3908                 fi
3909                 ;;
3910         esac
3911         case "$gccversion" in
3912         1*) ;;
3913         2.[0-8]*) ;;
3914         ?*)     echo " "
3915                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3916                 echo 'int main(void) { return 0; }' > gcctest.c
3917                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3918                         echo "Yes, it does." 2>&1
3919                         case "$ccflags" in
3920                         *strict-aliasing*) 
3921                                 echo "Leaving current flags $ccflags alone." 2>&1
3922                                 ;;
3923                         *) dflt="$dflt -fno-strict-aliasing" ;;
3924                         esac
3925                 else
3926                         echo "Nope, it doesn't, but that's ok." 2>&1
3927                 fi
3928                 ;;
3929         esac
3930         ;;
3931 esac
3932
3933 case "$mips_type" in
3934 *BSD*|'') inclwanted="$locincpth $usrinc";;
3935 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3936 esac
3937 for thisincl in $inclwanted; do
3938         if $test -d $thisincl; then
3939                 if $test x$thisincl != x$usrinc; then
3940                         case "$dflt" in
3941                         *$thisincl*);;
3942                         *) dflt="$dflt -I$thisincl";;
3943                         esac
3944                 fi
3945         fi
3946 done
3947
3948 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3949         xxx=true;
3950 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3951         xxx=true;
3952 else
3953         xxx=false;
3954 fi;
3955 if $xxx; then
3956         case "$dflt" in
3957         *$2*);;
3958         *) dflt="$dflt -D$2";;
3959         esac;
3960 fi'
3961
3962 set signal.h LANGUAGE_C; eval $inctest
3963
3964 case "$usesocks" in
3965 $define)
3966         ccflags="$ccflags -DSOCKS"
3967         ;;
3968 esac
3969
3970 case "$hint" in
3971 default|recommended) dflt="$ccflags $dflt" ;;
3972 *) dflt="$ccflags";;
3973 esac
3974
3975 case "$dflt" in
3976 ''|' ') dflt=none;;
3977 esac
3978 $cat <<EOH
3979
3980 Your C compiler may want other flags.  For this question you should include
3981 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3982 but you should NOT include libraries or ld flags like -lwhatever.  If you
3983 want $package to honor its debug switch, you should include -DDEBUGGING here.
3984 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3985
3986 To use no flags, specify the word "none".
3987
3988 EOH
3989 set X $dflt
3990 shift
3991 dflt=${1+"$@"}
3992 rp="Any additional cc flags?"
3993 . ./myread
3994 case "$ans" in
3995 none) ccflags='';;
3996 *) ccflags="$ans";;
3997 esac
3998
3999 : the following weeds options from ccflags that are of no interest to cpp
4000 cppflags="$ccflags"
4001 case "$gccversion" in
4002 1*) cppflags="$cppflags -D__GNUC__"
4003 esac
4004 case "$mips_type" in
4005 '');;
4006 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4007 esac
4008 case "$cppflags" in
4009 '');;
4010 *)
4011         echo " "
4012         echo "Let me guess what the preprocessor flags are..." >&4
4013         set X $cppflags
4014         shift
4015         cppflags=''
4016         $cat >cpp.c <<'EOM'
4017 #define BLURFL foo
4018
4019 BLURFL xx LFRULB
4020 EOM
4021         previous=''
4022         for flag in $*
4023         do
4024                 case "$flag" in
4025                 -*) ftry="$flag";;
4026                 *) ftry="$previous $flag";;
4027                 esac
4028                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4029                         >cpp1.out 2>/dev/null && \
4030                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4031                         >cpp2.out 2>/dev/null && \
4032                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4033                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4034                 then
4035                         cppflags="$cppflags $ftry"
4036                         previous=''
4037                 else
4038                         previous="$flag"
4039                 fi
4040         done
4041         set X $cppflags
4042         shift
4043         cppflags=${1+"$@"}
4044         case "$cppflags" in
4045         *-*)  echo "They appear to be: $cppflags";;
4046         esac
4047         $rm -f cpp.c cpp?.out
4048         ;;
4049 esac
4050
4051 : flags used in final linking phase
4052 case "$ldflags" in
4053 '') if ./venix; then
4054                 dflt='-i -z'
4055         else
4056                 dflt=''
4057         fi
4058         case "$ccflags" in
4059         *-posix*) dflt="$dflt -posix" ;;
4060         esac
4061         ;;
4062 *) dflt="$ldflags";;
4063 esac
4064
4065 : Try to guess additional flags to pick up local libraries.
4066 for thislibdir in $libpth; do
4067         case " $loclibpth " in
4068         *" $thislibdir "*)
4069                 case "$dflt " in 
4070                 *"-L$thislibdir "*) ;;
4071                 *)  dflt="$dflt -L$thislibdir" ;;
4072                 esac
4073                 ;;
4074         esac
4075 done
4076
4077 case "$dflt" in
4078 '') dflt='none' ;;
4079 esac
4080
4081 $cat <<EOH
4082
4083 Your C linker may need flags.  For this question you should
4084 include -L/whatever and any other flags used by the C linker, but you
4085 should NOT include libraries like -lwhatever.
4086
4087 Make sure you include the appropriate -L/path flags if your C linker
4088 does not normally search all of the directories you specified above,
4089 namely
4090         $libpth
4091 To use no flags, specify the word "none".
4092
4093 EOH
4094
4095 rp="Any additional ld flags (NOT including libraries)?"
4096 . ./myread
4097 case "$ans" in
4098 none) ldflags='';;
4099 *) ldflags="$ans";;
4100 esac
4101 rmlist="$rmlist pdp11"
4102
4103 : coherency check
4104 echo " "
4105 echo "Checking your choice of C compiler and flags for coherency..." >&4
4106 $cat > try.c <<'EOF'
4107 #include <stdio.h>
4108 int main() { printf("Ok\n"); exit(0); }
4109 EOF
4110 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4111 shift
4112 $cat >try.msg <<'EOM'
4113 I've tried to compile and run the following simple program:
4114
4115 EOM
4116 $cat try.c >> try.msg
4117
4118 $cat >> try.msg <<EOM
4119
4120 I used the command:
4121
4122         $*
4123         ./try
4124
4125 and I got the following output:
4126
4127 EOM
4128 dflt=y
4129 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4130         if sh -c './try' >>try.msg 2>&1; then
4131                 xxx=`./try`
4132                 case "$xxx" in
4133                 "Ok") dflt=n ;;
4134                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4135                         case " $libs " in
4136                         *" -lsfio "*)
4137                                 cat >> try.msg <<'EOQS'
4138 If $libs contains -lsfio, and sfio is mis-configured, then it
4139 sometimes (apparently) runs and exits with a 0 status, but with no
4140 output!  It may have to do with sfio's use of _exit vs. exit.
4141
4142 EOQS
4143                                 rp="You have a big problem.  Shall I abort Configure"
4144                                 dflt=y
4145                                 ;;
4146                         esac
4147                         ;;
4148                 esac
4149         else
4150                 echo "The program compiled OK, but exited with status $?." >>try.msg
4151                 rp="You have a problem.  Shall I abort Configure"
4152                 dflt=y
4153         fi
4154 else
4155         echo "I can't compile the test program." >>try.msg
4156         rp="You have a BIG problem.  Shall I abort Configure"
4157         dflt=y
4158 fi
4159 case "$dflt" in
4160 y)
4161         $cat try.msg >&4
4162         case "$knowitall" in
4163         '')
4164                 echo "(The supplied flags or libraries might be incorrect.)"
4165                 ;;
4166         *) dflt=n;;
4167         esac
4168         echo " "
4169         . ./myread
4170         case "$ans" in
4171         n*|N*) ;;
4172         *)      echo "Ok.  Stopping Configure." >&4
4173                 exit 1
4174                 ;;
4175         esac
4176         ;;
4177 n) echo "OK, that should do.";;
4178 esac
4179 $rm -f try try.* core
4180
4181 : define an is-a-typedef? function
4182 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4183 case "$inclist" in
4184 "") inclist="sys/types.h";;
4185 esac;
4186 eval "varval=\$$var";
4187 case "$varval" in
4188 "")
4189         $rm -f temp.c;
4190         for inc in $inclist; do
4191                 echo "#include <$inc>" >>temp.c;
4192         done;
4193         echo "#ifdef $type" >> temp.c;
4194         echo "printf(\"We have $type\");" >> temp.c;
4195         echo "#endif" >> temp.c;
4196         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4197         if $contains $type temp.E >/dev/null 2>&1; then
4198                 eval "$var=\$type";
4199         else
4200                 eval "$var=\$def";
4201         fi;
4202         $rm -f temp.?;;
4203 *) eval "$var=\$varval";;
4204 esac'
4205
4206 : define an is-a-typedef? function that prompts if the type is not available.
4207 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4208 case "$inclist" in
4209 "") inclist="sys/types.h";;
4210 esac;
4211 eval "varval=\$$var";
4212 case "$varval" in
4213 "")
4214         $rm -f temp.c;
4215         for inc in $inclist; do
4216                 echo "#include <$inc>" >>temp.c;
4217         done;
4218         echo "#ifdef $type" >> temp.c;
4219         echo "printf(\"We have $type\");" >> temp.c;
4220         echo "#endif" >> temp.c;
4221         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4222         echo " " ;
4223         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4224         if $contains $type temp.E >/dev/null 2>&1; then
4225                 echo "$type found." >&4;
4226                 eval "$var=\$type";
4227         else
4228                 echo "$type NOT found." >&4;
4229                 dflt="$def";
4230                 . ./myread ;
4231                 eval "$var=\$ans";
4232         fi;
4233         $rm -f temp.?;;
4234 *) eval "$var=\$varval";;
4235 esac'
4236
4237 : define a shorthand compile call
4238 compile='
4239 mc_file=$1;
4240 shift;
4241 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4242 : define a shorthand compile call for compilations that should be ok.
4243 compile_ok='
4244 mc_file=$1;
4245 shift;
4246 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4247
4248 : check for lengths of integral types
4249 echo " "
4250 case "$intsize" in
4251 '')
4252         echo "Checking to see how big your integers are..." >&4
4253         $cat >intsize.c <<'EOCP'
4254 #include <stdio.h>
4255 int main()
4256 {
4257         printf("intsize=%d;\n", (int)sizeof(int));
4258         printf("longsize=%d;\n", (int)sizeof(long));
4259         printf("shortsize=%d;\n", (int)sizeof(short));
4260         exit(0);
4261 }
4262 EOCP
4263         set intsize
4264         if eval $compile_ok && ./intsize > /dev/null; then
4265                 eval `./intsize`
4266                 echo "Your integers are $intsize bytes long."
4267                 echo "Your long integers are $longsize bytes long."
4268                 echo "Your short integers are $shortsize bytes long."
4269         else
4270                 $cat >&4 <<EOM
4271 !
4272 Help! I can't compile and run the intsize test program: please enlighten me!
4273 (This is probably a misconfiguration in your system or libraries, and
4274 you really ought to fix it.  Still, I'll try anyway.)
4275 !
4276 EOM
4277                 dflt=4
4278                 rp="What is the size of an integer (in bytes)?"
4279                 . ./myread
4280                 intsize="$ans"
4281                 dflt=$intsize
4282                 rp="What is the size of a long integer (in bytes)?"
4283                 . ./myread
4284                 longsize="$ans"
4285                 dflt=2
4286                 rp="What is the size of a short integer (in bytes)?"
4287                 . ./myread
4288                 shortsize="$ans"
4289         fi
4290         ;;
4291 esac
4292 $rm -f intsize intsize.*
4293
4294 : see what type lseek is declared as in the kernel
4295 rp="What is the type used for lseek's offset on this system?"
4296 set off_t lseektype long stdio.h sys/types.h
4297 eval $typedef_ask
4298
4299 echo " "
4300 echo "Checking to see how big your file offsets are..." >&4
4301 $cat >try.c <<EOCP
4302 #include <sys/types.h>
4303 #include <stdio.h>
4304 int main()
4305 {
4306     printf("%d\n", (int)sizeof($lseektype));
4307     return(0); 
4308 }
4309 EOCP
4310 set try
4311 if eval $compile_ok; then
4312         lseeksize=`./try`
4313         echo "Your file offsets are $lseeksize bytes long."
4314 else
4315         dflt=$longsize
4316         echo " "
4317         echo "(I can't seem to compile the test program.  Guessing...)"
4318         rp="What is the size of your file offsets (in bytes)?"
4319         . ./myread
4320         lseeksize="$ans"
4321 fi
4322 $rm -f try.c try
4323
4324 : see what type file positions are declared as in the library
4325 rp="What is the type for file position used by fsetpos()?"
4326 set fpos_t fpostype long stdio.h sys/types.h
4327 eval $typedef_ask
4328
4329 echo " "
4330 case "$fpostype" in
4331 *_t) zzz="$fpostype"    ;;
4332 *)   zzz="fpos_t"       ;;
4333 esac
4334 echo "Checking the size of $zzz..." >&4 
4335 cat > try.c <<EOCP
4336 #include <sys/types.h>
4337 #include <stdio.h>
4338 int main() {
4339     printf("%d\n", (int)sizeof($fpostype));
4340     exit(0);
4341 }
4342 EOCP
4343 set try
4344 if eval $compile_ok; then
4345         yyy=`./try`
4346         case "$yyy" in
4347         '')     fpossize=4
4348                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4349                 ;;
4350         *)      fpossize=$yyy
4351                 echo "Your $zzz is $fpossize bytes long."
4352                 ;;
4353         esac
4354 else
4355         dflt="$longsize"
4356         echo " " >&4
4357         echo "(I can't compile the test program.  Guessing...)" >&4
4358         rp="What is the size of your file positions (in bytes)?"
4359         . ./myread
4360         fpossize="$ans"
4361 fi
4362
4363
4364
4365 # Backward compatibility (uselfs is deprecated).
4366 case "$uselfs" in
4367 "$define"|true|[yY]*)
4368         cat <<EOM >&4
4369
4370 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4371 EOM
4372         uselargefiles="$define"
4373         ;;
4374 esac                          
4375
4376 case "$lseeksize:$fpossize" in
4377 8:8) cat <<EOM
4378
4379 You can have files larger than 2 gigabytes.
4380 EOM
4381    val="$define" ;;
4382 *)    case "$uselargefiles" in
4383    "$undef"|false|[nN]*) dflt='n' ;;
4384    *)   dflt='y' ;;
4385    esac
4386    cat <<EOM
4387
4388 Perl can be built to understand large files (files larger than 2 gigabytes)
4389 on some systems.  To do so, Configure can be run with -Duselargefiles.
4390
4391 If this doesn't make any sense to you, just accept the default '$dflt'.
4392 EOM
4393    rp='Try to understand large files, if available?'
4394    . ./myread
4395    case "$ans" in
4396    y|Y)         val="$define" ;;
4397    *)           val="$undef"  ;;
4398    esac
4399    ;;
4400 esac
4401 set uselargefiles
4402 eval $setvar
4403 case "$uselargefiles" in
4404 "$define")
4405 : Look for a hint-file generated 'call-back-unit'.  If the
4406 : user has specified that a large files perl is to be built,
4407 : we may need to set or change some other defaults.
4408         if $test -f uselargefiles.cbu; then
4409                 echo "Your platform has some specific hints for large file builds, using them..."
4410                 . ./uselargefiles.cbu
4411                 echo " "
4412                 echo "Rechecking to see how big your file offsets are..." >&4
4413                 $cat >try.c <<EOCP
4414 #include <sys/types.h>
4415 #include <stdio.h>
4416 int main()
4417 {
4418     printf("%d\n", (int)sizeof($lseektype));
4419     return(0); 
4420 }
4421 EOCP
4422                 set try
4423                 if eval $compile_ok; then
4424                         lseeksize=`./try`
4425                         $echo "Your file offsets are now $lseeksize bytes long."
4426                 else
4427                         dflt="$lseeksize"
4428                         echo " "
4429                         echo "(I can't seem to compile the test program.  Guessing...)"
4430                         rp="What is the size of your file offsets (in bytes)?"
4431                         . ./myread
4432                         lseeksize="$ans"
4433                 fi
4434                 case "$fpostype" in
4435                 *_t) zzz="$fpostype"    ;;
4436                 *)   zzz="fpos_t"       ;;
4437                 esac
4438                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4439                 $cat > try.c <<EOCP
4440 #include <sys/types.h>
4441 #include <stdio.h>
4442 int main() {
4443     printf("%d\n", (int)sizeof($fpostype));
4444     exit(0);
4445 }
4446 EOCP
4447                 set try
4448                 if eval $compile_ok; then
4449                         yyy=`./try`
4450                         dflt="$lseeksize"
4451                         case "$yyy" in
4452                         '')     echo " "
4453                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4454                                 ;;
4455                         *)      fpossize=$yyy
4456                                 echo " $fpossize bytes." >&4
4457                                 ;;
4458                         esac
4459                 else
4460                         dflt="$fpossize"
4461                         echo " "
4462                         echo "(I can't compile the test program.  Guessing...)" >&4
4463                         rp="What is the size of your file positions (in bytes)?"
4464                         . ./myread
4465                         fpossize="$ans"
4466                 fi
4467                 $rm -f try.c try
4468         fi
4469         ;;
4470 esac
4471
4472
4473 case "$usemorebits" in
4474 "$define"|true|[yY]*)
4475         use64bitint="$define"
4476         uselongdouble="$define"
4477         usemorebits="$define"
4478         ;;
4479 *)      usemorebits="$undef"
4480         ;;
4481 esac
4482
4483
4484 case "$uselonglong" in
4485 "$define"|true|[yY]*)
4486         cat <<EOM >&4
4487
4488 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4489 EOM
4490         use64bitint="$define"
4491         ;;
4492 esac                          
4493 case "$use64bits" in
4494 "$define"|true|[yY]*)
4495         cat <<EOM >&4
4496
4497 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4498 EOM
4499         use64bitint="$define"
4500         ;;
4501 esac                          
4502 case "$use64bitints" in
4503 "$define"|true|[yY]*)
4504         cat <<EOM >&4
4505
4506 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4507 EOM
4508         use64bitint="$define"
4509         ;;
4510 esac                          
4511 case "$use64bitsint" in
4512 "$define"|true|[yY]*)
4513         cat <<EOM >&4
4514
4515 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4516 EOM
4517         use64bitint="$define"
4518         ;;
4519 esac                          
4520 case "$uselonglongs" in
4521 "$define"|true|[yY]*)
4522         cat <<EOM >&4
4523
4524 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4525 EOM
4526         use64bitint="$define"
4527         ;;
4528 esac                          
4529 case "$use64bitsall" in
4530 "$define"|true|[yY]*)
4531         cat <<EOM >&4
4532
4533 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4534 EOM
4535         use64bitall="$define"
4536         ;;
4537 esac                          
4538
4539 case "$ccflags" in
4540 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4541 esac
4542 case "$use64bitall" in
4543 "$define"|true|[yY]*) use64bitint="$define" ;;
4544 esac
4545
4546 case "$longsize" in
4547 8) cat <<EOM
4548
4549 You have natively 64-bit long integers.
4550 EOM
4551    val="$define"
4552    ;;
4553 *) case "$use64bitint" in
4554    "$define"|true|[yY]*) dflt='y';;
4555    *) dflt='n';;
4556    esac
4557    cat <<EOM
4558
4559 Perl can be built to take advantage of 64-bit integer types
4560 on some systems.  To do so, Configure can be run with -Duse64bitint.
4561 Choosing this option will most probably introduce binary incompatibilities.
4562
4563 If this doesn't make any sense to you, just accept the default '$dflt'.
4564 EOM
4565    rp='Try to use 64-bit integers, if available?'
4566    . ./myread
4567    case "$ans" in
4568    [yY]*) val="$define" ;;
4569    *)     val="$undef"  ;;
4570    esac
4571    ;;
4572 esac
4573 set use64bitint
4574 eval $setvar
4575
4576 case "$use64bitall" in
4577 "$define"|true|[yY]*) dflt='y' ;;
4578 *) case "$longsize" in
4579    8) dflt='y' ;;
4580    *) dflt='n' ;;
4581    esac
4582    ;;
4583 esac    
4584 cat <<EOM
4585
4586 You may also choose to try maximal 64-bitness.  It means using as much
4587 64-bitness as possible on the platform.  This in turn means even more
4588 binary incompatibilities.  On the other hand, your platform may not
4589 have any more 64-bitness available than what you already have chosen.
4590
4591 If this doesn't make any sense to you, just accept the default '$dflt'.
4592 EOM
4593 rp='Try to use maximal 64-bit support, if available?'
4594 . ./myread
4595 case "$ans" in
4596 [yY]*) val="$define" ;;
4597 *)     val="$undef"  ;;
4598 esac
4599 set use64bitall
4600 eval $setvar
4601 case "$use64bitall" in
4602 "$define")
4603         case "$use64bitint" in
4604         "$undef")
4605                 cat <<EOM
4606
4607 Since you have chosen a maximally 64-bit build, I'm also turning on
4608 the use of 64-bit integers.
4609 EOM
4610                 use64bitint="$define" ;;
4611         esac
4612         ;;
4613 esac
4614
4615 case "$use64bitint" in
4616 "$define"|true|[yY]*)
4617 : Look for a hint-file generated 'call-back-unit'.  If the
4618 : user has specified that a 64-bit perl is to be built,
4619 : we may need to set or change some other defaults.
4620         if $test -f use64bitint.cbu; then
4621                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4622                 . ./use64bitint.cbu
4623         fi
4624         case "$longsize" in
4625         4) case "$archname64" in
4626            '') archname64=64int ;;
4627            esac
4628            ;;
4629         esac
4630         ;;
4631 esac
4632
4633 case "$use64bitall" in
4634 "$define"|true|[yY]*)
4635 : Look for a hint-file generated 'call-back-unit'.  If the
4636 : user has specified that a maximally 64-bit perl is to be built,
4637 : we may need to set or change some other defaults.
4638         if $test -f use64bitall.cbu; then
4639                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4640                 . ./use64bitall.cbu
4641         fi
4642         case "$longsize" in
4643         4) case "$archname64" in
4644            ''|64int) archname64=64all ;;
4645            esac
4646            ;;
4647         esac
4648         ;;
4649 esac
4650
4651 : determine the architecture name
4652 echo " "
4653 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4654         tarch=`arch`"-$osname"
4655 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4656         if uname -m > tmparch 2>&1 ; then
4657                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4658                         -e 's/$/'"-$osname/" tmparch`
4659         else
4660                 tarch="$osname"
4661         fi
4662         $rm -f tmparch
4663 else
4664         tarch="$osname"
4665 fi
4666 case "$myarchname" in
4667 ''|"$tarch") ;;
4668 *)
4669         echo "(Your architecture name used to be $myarchname.)"
4670         archname=''
4671         ;;
4672 esac
4673 myarchname="$tarch"
4674 case "$archname" in
4675 '') dflt="$tarch";;
4676 *) dflt="$archname";;
4677 esac
4678 rp='What is your architecture name'
4679 . ./myread
4680 archname="$ans"
4681 case "$usethreads" in
4682 $define)
4683         echo "Threads selected." >&4
4684         case "$archname" in
4685         *-thread*) echo "...and architecture name already has -thread." >&4
4686                 ;;
4687         *)      archname="$archname-thread"
4688                 echo "...setting architecture name to $archname." >&4
4689                 ;;
4690         esac
4691         ;;
4692 esac
4693 case "$usemultiplicity" in
4694 $define)
4695         echo "Multiplicity selected." >&4
4696         case "$archname" in
4697         *-multi*) echo "...and architecture name already has -multi." >&4
4698                 ;;
4699         *)      archname="$archname-multi"
4700                 echo "...setting architecture name to $archname." >&4
4701                 ;;
4702         esac
4703         ;;
4704 esac
4705 case "$use64bitint" in
4706 $define)
4707         case "$archname64" in
4708         '')
4709                 ;;
4710         *)
4711                 case "$archname" in
4712                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4713                         ;;
4714                 *)      archname="$archname-$archname64"
4715                         echo "...setting architecture name to $archname." >&4
4716                         ;;
4717                 esac
4718                 ;;
4719         esac
4720 esac
4721
4722 : determine root of directory hierarchy where package will be installed.
4723 case "$prefix" in
4724 '')
4725         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4726         ;;
4727 *)
4728         dflt="$prefix"
4729         ;;
4730 esac
4731 $cat <<EOM
4732
4733 By default, $package will be installed in $dflt/bin, manual pages
4734 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4735 installation directories. Typically this is something like /usr/local.
4736 If you wish to have binaries under /usr/bin but other parts of the
4737 installation under /usr/local, that's ok: you will be prompted
4738 separately for each of the installation directories, the prefix being
4739 only used to set the defaults.
4740
4741 EOM
4742 fn=d~
4743 rp='Installation prefix to use?'
4744 . ./getfile
4745 oldprefix=''
4746 case "$prefix" in
4747 '') ;;
4748 *)
4749         case "$ans" in
4750         "$prefix") ;;
4751         *) oldprefix="$prefix";;
4752         esac
4753         ;;
4754 esac
4755 prefix="$ans"
4756 prefixexp="$ansexp"
4757
4758 : is AFS running?
4759 echo " "
4760 case "$afs" in
4761 $define|true)   afs=true ;;
4762 $undef|false)   afs=false ;;
4763 *)      if test -d /afs; then
4764                 afs=true
4765         else
4766                 afs=false
4767         fi
4768         ;;
4769 esac
4770 if $afs; then
4771         echo "AFS may be running... I'll be extra cautious then..." >&4
4772 else
4773         echo "AFS does not seem to be running..." >&4
4774 fi
4775
4776 : determine installation prefix for where package is to be installed.
4777 if $afs; then 
4778 $cat <<EOM
4779
4780 Since you are running AFS, I need to distinguish the directory in which
4781 files will reside from the directory in which they are installed (and from
4782 which they are presumably copied to the former directory by occult means).
4783
4784 EOM
4785         case "$installprefix" in
4786         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4787         *) dflt="$installprefix";;
4788         esac
4789 else
4790 $cat <<EOM
4791
4792 In some special cases, particularly when building $package for distribution,
4793 it is convenient to distinguish between the directory in which files should 
4794 be installed from the directory ($prefix) in which they 
4795 will eventually reside.  For most users, these two directories are the same.
4796
4797 EOM
4798         case "$installprefix" in
4799         '') dflt=$prefix ;;
4800         *) dflt=$installprefix;;
4801         esac
4802 fi
4803 fn=d~
4804 rp='What installation prefix should I use for installing files?'
4805 . ./getfile
4806 installprefix="$ans"
4807 installprefixexp="$ansexp"
4808
4809 : set the prefixit variable, to compute a suitable default value
4810 prefixit='case "$3" in
4811 ""|none)
4812         case "$oldprefix" in
4813         "") eval "$1=\"\$$2\"";;
4814         *)
4815                 case "$3" in
4816                 "") eval "$1=";;
4817                 none)
4818                         eval "tp=\"\$$2\"";
4819                         case "$tp" in
4820                         ""|" ") eval "$1=\"\$$2\"";;
4821                         *) eval "$1=";;
4822                         esac;;
4823                 esac;;
4824         esac;;
4825 *)
4826         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4827         case "$tp" in
4828         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4829         /*-$oldprefix/*|\~*-$oldprefix/*)
4830                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4831         *) eval "$1=\"\$$2\"";;
4832         esac;;
4833 esac'
4834
4835
4836 : get the patchlevel
4837 echo " "
4838 echo "Getting the current patchlevel..." >&4
4839 if $test -r $rsrc/patchlevel.h;then
4840         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4841         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4842         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4843         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4844         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4845         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4846 else
4847         revision=0
4848         patchlevel=0
4849         subversion=0
4850         api_revision=0
4851         api_version=0
4852         api_subversion=0
4853 fi
4854 $echo $n "(You have $package revision $revision" $c
4855 $echo $n " patchlevel $patchlevel" $c
4856 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4857 echo ".)"
4858 case "$osname" in
4859 dos|vms)
4860         : XXX Should be a Configure test for double-dots in filenames.
4861         version=`echo $revision $patchlevel $subversion | \
4862                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4863         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4864                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4865         ;;
4866 *)
4867         version=`echo $revision $patchlevel $subversion | \
4868                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4869         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4870                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4871         ;;
4872 esac
4873 : Special case the 5.005_xx maintenance series, which used 5.005
4874 : without any subversion label as a subdirectory in $sitelib
4875 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4876         api_versionstring='5.005'
4877 fi
4878
4879 : determine installation style
4880 : For now, try to deduce it from prefix unless it is already set.
4881 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4882 case "$installstyle" in
4883 '')     case "$prefix" in
4884                 *perl*) dflt='lib';;
4885                 *) dflt='lib/perl5' ;;
4886         esac
4887         ;;
4888 *)      dflt="$installstyle" ;;
4889 esac
4890 : Probably not worth prompting for this since we prompt for all
4891 : the directories individually, and the prompt would be too long and
4892 : confusing anyway.
4893 installstyle=$dflt
4894
4895 : determine where private library files go
4896 : Usual default is /usr/local/lib/perl5/$version.
4897 : Also allow things like /opt/perl/lib/$version, since 
4898 : /opt/perl/lib/perl5... would be redundant.
4899 : The default "style" setting is made in installstyle.U
4900 case "$installstyle" in
4901 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4902 *)       set dflt privlib lib/$version ;;
4903 esac
4904 eval $prefixit
4905 $cat <<EOM
4906
4907 There are some auxiliary files for $package that need to be put into a
4908 private library directory that is accessible by everyone.
4909
4910 EOM
4911 fn=d~+
4912 rp='Pathname where the private library files will reside?'
4913 . ./getfile
4914 privlib="$ans"
4915 privlibexp="$ansexp"
4916 : Change installation prefix, if necessary.
4917 if $test X"$prefix" != X"$installprefix"; then
4918         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4919 else
4920         installprivlib="$privlibexp"
4921 fi
4922
4923 : set the prefixup variable, to restore leading tilda escape
4924 prefixup='case "$prefixexp" in
4925 "$prefix") ;;
4926 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4927 esac'
4928
4929 : determine where public architecture dependent libraries go
4930 set archlib archlib
4931 eval $prefixit
4932 : privlib default is /usr/local/lib/$package/$version
4933 : archlib default is /usr/local/lib/$package/$version/$archname
4934 : privlib may have an optional trailing /share.
4935 tdflt=`echo $privlib | $sed 's,/share$,,'`
4936 tdflt=$tdflt/$archname
4937 case "$archlib" in
4938 '')     dflt=$tdflt
4939         ;;
4940 *)      dflt="$archlib"
4941     ;;
4942 esac
4943 $cat <<EOM
4944
4945 $spackage contains architecture-dependent library files.  If you are
4946 sharing libraries in a heterogeneous environment, you might store
4947 these files in a separate location.  Otherwise, you can just include
4948 them with the rest of the public library files.
4949
4950 EOM
4951 fn=d+~
4952 rp='Where do you want to put the public architecture-dependent libraries?'
4953 . ./getfile
4954 archlib="$ans"
4955 archlibexp="$ansexp"
4956 if $test X"$archlib" = X"$privlib"; then
4957         d_archlib="$undef"
4958 else
4959         d_archlib="$define"
4960 fi
4961 : Change installation prefix, if necessary.
4962 if $test X"$prefix" != X"$installprefix"; then
4963         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4964 else
4965         installarchlib="$archlibexp"
4966 fi
4967
4968
4969 : Binary compatibility with 5.005 is not possible for builds
4970 : with advanced features
4971 case "$usethreads$usemultiplicity" in
4972 *define*)
4973         bincompat5005="$undef"
4974         d_bincompat5005="$undef"
4975         ;;
4976 *)      $cat <<EOM
4977
4978 This version of Perl can be compiled for binary compatibility with 5.005.
4979 If you decide to do so, you will be able to continue using most of the
4980 extensions that were compiled for Perl 5.005.
4981
4982 EOM
4983         case "$bincompat5005$d_bincompat5005" in
4984         *"$undef"*) dflt=n ;;
4985         *) dflt=y ;;
4986         esac
4987         rp='Binary compatibility with Perl 5.005?'
4988         . ./myread
4989         case "$ans" in
4990         y*) val="$define" ;;
4991         *)  val="$undef" ;;
4992         esac
4993         set d_bincompat5005
4994         eval $setvar
4995         case "$d_bincompat5005" in
4996         "$define")
4997                 bincompat5005="$define"
4998                 ;;
4999         *)      bincompat5005="$undef"
5000                 d_bincompat5005="$undef"
5001                 ;;
5002         esac
5003         ;;
5004 esac
5005
5006
5007 : see if setuid scripts can be secure
5008 $cat <<EOM
5009
5010 Some kernels have a bug that prevents setuid #! scripts from being
5011 secure.  Some sites have disabled setuid #! scripts because of this.
5012
5013 First let's decide if your kernel supports secure setuid #! scripts.
5014 (If setuid #! scripts would be secure but have been disabled anyway,
5015 don't say that they are secure if asked.)
5016
5017 EOM
5018
5019 val="$undef"
5020 if $test -d /dev/fd; then
5021         echo "#!$ls" >reflect
5022         chmod +x,u+s reflect
5023         ./reflect >flect 2>&1
5024         if $contains "/dev/fd" flect >/dev/null; then
5025                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5026                 val="$define"
5027         else
5028                 $cat <<EOM
5029 If you are not sure if they are secure, I can check but I'll need a
5030 username and password different from the one you are using right now.
5031 If you don't have such a username or don't want me to test, simply
5032 enter 'none'.
5033
5034 EOM
5035                 rp='Other username to test security of setuid scripts with?'
5036                 dflt='none'
5037                 . ./myread
5038                 case "$ans" in
5039                 n|none)
5040                         case "$d_suidsafe" in
5041                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5042                                 dflt=n;;
5043                         "$undef")
5044                                 echo "Well, the $hint value is *not* secure." >&4
5045                                 dflt=n;;
5046                         *)      echo "Well, the $hint value *is* secure." >&4
5047                                 dflt=y;;
5048                         esac
5049                         ;;
5050                 *)
5051                         $rm -f reflect flect
5052                         echo "#!$ls" >reflect
5053                         chmod +x,u+s reflect
5054                         echo >flect
5055                         chmod a+w flect
5056                         echo '"su" will (probably) prompt you for '"$ans's password."
5057                         su $ans -c './reflect >flect'
5058                         if $contains "/dev/fd" flect >/dev/null; then
5059                                 echo "Okay, it looks like setuid scripts are secure." >&4
5060                                 dflt=y
5061                         else
5062                                 echo "I don't think setuid scripts are secure." >&4
5063                                 dflt=n
5064                         fi
5065                         ;;
5066                 esac
5067                 rp='Does your kernel have *secure* setuid scripts?'
5068                 . ./myread
5069                 case "$ans" in
5070                 [yY]*)  val="$define";;
5071                 *)      val="$undef";;
5072                 esac
5073         fi
5074 else
5075         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5076         echo "(That's for file descriptors, not floppy disks.)"
5077         val="$undef"
5078 fi
5079 set d_suidsafe
5080 eval $setvar
5081
5082 $rm -f reflect flect
5083
5084 : now see if they want to do setuid emulation
5085 echo " "
5086 val="$undef"
5087 case "$d_suidsafe" in
5088 "$define")
5089         val="$undef"
5090         echo "No need to emulate SUID scripts since they are secure here." >& 4
5091         ;;
5092 *)
5093         $cat <<EOM
5094 Some systems have disabled setuid scripts, especially systems where
5095 setuid scripts cannot be secure.  On systems where setuid scripts have
5096 been disabled, the setuid/setgid bits on scripts are currently
5097 useless.  It is possible for $package to detect those bits and emulate
5098 setuid/setgid in a secure fashion.  This emulation will only work if
5099 setuid scripts have been disabled in your kernel.
5100
5101 EOM
5102         case "$d_dosuid" in
5103         "$define") dflt=y ;;
5104         *) dflt=n ;;
5105         esac
5106         rp="Do you want to do setuid/setgid emulation?"
5107         . ./myread
5108         case "$ans" in
5109         [yY]*)  val="$define";;
5110         *)      val="$undef";;
5111         esac
5112         ;;
5113 esac
5114 set d_dosuid
5115 eval $setvar
5116
5117 : determine filename position in cpp output
5118 echo " "
5119 echo "Computing filename position in cpp output for #include directives..." >&4
5120 echo '#include <stdio.h>' > foo.c
5121 $cat >fieldn <<EOF
5122 $startsh
5123 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5124 $grep '^[       ]*#.*stdio\.h' | \
5125 while read cline; do
5126         pos=1
5127         set \$cline
5128         while $test \$# -gt 0; do
5129                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5130                         echo "\$pos"
5131                         exit 0
5132                 fi
5133                 shift
5134                 pos=\`expr \$pos + 1\`
5135         done
5136 done
5137 EOF
5138 chmod +x fieldn
5139 fieldn=`./fieldn`
5140 $rm -f foo.c fieldn
5141 case $fieldn in
5142 '') pos='???';;
5143 1) pos=first;;
5144 2) pos=second;;
5145 3) pos=third;;
5146 *) pos="${fieldn}th";;
5147 esac
5148 echo "Your cpp writes the filename in the $pos field of the line."
5149
5150 : locate header file
5151 $cat >findhdr <<EOF
5152 $startsh
5153 wanted=\$1
5154 name=''
5155 for usrincdir in $usrinc
5156 do
5157         if test -f \$usrincdir/\$wanted; then
5158                 echo "\$usrincdir/\$wanted"
5159                 exit 0
5160         fi
5161 done
5162 awkprg='{ print \$$fieldn }'
5163 echo "#include <\$wanted>" > foo\$\$.c
5164 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5165 $grep "^[       ]*#.*\$wanted" | \
5166 while read cline; do
5167         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5168         case "\$name" in
5169         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5170         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5171         *) exit 2;;
5172         esac;
5173 done;
5174 #
5175 # status = 0: grep returned 0 lines, case statement not executed
5176 # status = 1: headerfile found
5177 # status = 2: while loop executed, no headerfile found
5178 #
5179 status=\$?
5180 $rm -f foo\$\$.c;
5181 if test \$status -eq 1; then
5182         exit 0;
5183 fi
5184 exit 1
5185 EOF
5186 chmod +x findhdr
5187
5188 : define an alternate in-header-list? function
5189 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5190 cont=true; xxf="echo \"<\$1> found.\" >&4";
5191 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5192 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5193 esac;
5194 case $# in 4) instead=instead;; *) instead="at last";; esac;
5195 while $test "$cont"; do
5196         xxx=`./findhdr $1`
5197         var=$2; eval "was=\$$2";
5198         if $test "$xxx" && $test -r "$xxx";
5199         then eval $xxf;
5200         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5201                 cont="";
5202         else eval $xxnf;
5203         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5204         set $yyy; shift; shift; yyy=$@;
5205         case $# in 0) cont="";;
5206         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5207                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5208         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5209                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5210         esac;
5211 done;
5212 while $test "$yyy";
5213 do set $yyy; var=$2; eval "was=\$$2";
5214         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5215         set $yyy; shift; shift; yyy=$@;
5216 done'
5217
5218 : see if this is a malloc.h system
5219 set malloc.h i_malloc
5220 eval $inhdr
5221
5222 : see if stdlib is available
5223 set stdlib.h i_stdlib
5224 eval $inhdr
5225
5226 : determine which malloc to compile in
5227 echo " "
5228 case "$usemymalloc" in
5229 ''|[yY]*|true|$define)  dflt='y' ;;
5230 *)      dflt='n' ;;
5231 esac
5232 rp="Do you wish to attempt to use the malloc that comes with $package?"
5233 . ./myread
5234 usemymalloc="$ans"
5235 case "$ans" in
5236 y*|true)
5237         usemymalloc='y'
5238         mallocsrc='malloc.c'
5239         mallocobj="malloc$_o"
5240         d_mymalloc="$define"
5241         case "$libs" in
5242         *-lmalloc*)
5243                 : Remove malloc from list of libraries to use
5244                 echo "Removing unneeded -lmalloc from library list" >&4
5245                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5246                 shift
5247                 libs="$*"
5248                 echo "libs = $libs" >&4
5249                 ;;
5250         esac
5251         ;;
5252 *)
5253         usemymalloc='n'
5254         mallocsrc=''
5255         mallocobj=''
5256         d_mymalloc="$undef"
5257         ;;
5258 esac
5259
5260 : compute the return types of malloc and free
5261 echo " "
5262 $cat >malloc.c <<END
5263 #$i_malloc I_MALLOC
5264 #$i_stdlib I_STDLIB
5265 #include <stdio.h>
5266 #include <sys/types.h>
5267 #ifdef I_MALLOC
5268 #include <malloc.h>
5269 #endif
5270 #ifdef I_STDLIB
5271 #include <stdlib.h>
5272 #endif
5273 #ifdef TRY_MALLOC
5274 void *malloc();
5275 #endif
5276 #ifdef TRY_FREE
5277 void free();
5278 #endif
5279 END
5280 case "$malloctype" in
5281 '')
5282         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5283                 malloctype='void *'
5284         else
5285                 malloctype='char *'
5286         fi
5287         ;;
5288 esac
5289 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5290
5291 case "$freetype" in
5292 '')
5293         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5294                 freetype='void'
5295         else
5296                 freetype='int'
5297         fi
5298         ;;
5299 esac
5300 echo "Your system uses $freetype free(), it would seem." >&4
5301 $rm -f malloc.[co]
5302 $cat <<EOM
5303
5304 After $package is installed, you may wish to install various
5305 add-on modules and utilities.  Typically, these add-ons will
5306 be installed under $prefix with the rest
5307 of this package.  However, you may wish to install such add-ons
5308 elsewhere under a different prefix.
5309
5310 If you do not wish to put everything under a single prefix, that's
5311 ok.  You will be prompted for the individual locations; this siteprefix
5312 is only used to suggest the defaults.
5313
5314 The default should be fine for most people.
5315
5316 EOM
5317 fn=d~+
5318 rp='Installation prefix to use for add-on modules and utilities?'
5319 : XXX Here might be another good place for an installstyle setting.
5320 case "$siteprefix" in
5321 '') dflt=$prefix ;;
5322 *)  dflt=$siteprefix ;;
5323 esac
5324 . ./getfile
5325 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5326 oldsiteprefix=''
5327 case "$siteprefix" in
5328 '') ;;
5329 *)      case "$ans" in
5330         "$prefix") ;;
5331         *) oldsiteprefix="$prefix";;
5332         esac
5333         ;;
5334 esac
5335 siteprefix="$ans"
5336 siteprefixexp="$ansexp"
5337
5338 : determine where site specific libraries go.
5339 : Usual default is /usr/local/lib/perl5/site_perl/$version
5340 : The default "style" setting is made in installstyle.U
5341 : XXX No longer works with Prefixit stuff.
5342 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5343 case "$sitelib" in
5344 '') case "$installstyle" in
5345         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5346         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5347         esac
5348         ;;
5349 *)      dflt="$sitelib"
5350         ;;
5351 esac
5352 $cat <<EOM
5353
5354 The installation process will create a directory for
5355 site-specific extensions and modules.  Most users find it convenient
5356 to place all site-specific files in this directory rather than in the
5357 main distribution directory.
5358
5359 EOM
5360 fn=d~+
5361 rp='Pathname for the site-specific library files?'
5362 . ./getfile
5363 sitelib="$ans"
5364 sitelibexp="$ansexp"
5365 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5366 : Change installation prefix, if necessary.
5367 if $test X"$prefix" != X"$installprefix"; then
5368         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5369 else
5370         installsitelib="$sitelibexp"
5371 fi
5372
5373 : determine where site specific architecture-dependent libraries go.
5374 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5375 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5376 : sitelib may have an optional trailing /share.
5377 case "$sitearch" in
5378 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5379         dflt="$dflt/$archname"
5380         ;;
5381 *)      dflt="$sitearch"
5382         ;;
5383 esac
5384 set sitearch sitearch none
5385 eval $prefixit
5386 $cat <<EOM
5387
5388 The installation process will also create a directory for
5389 architecture-dependent site-specific extensions and modules.
5390
5391 EOM
5392 fn=d~+
5393 rp='Pathname for the site-specific architecture-dependent library files?'
5394 . ./getfile
5395 sitearch="$ans"
5396 sitearchexp="$ansexp"
5397 : Change installation prefix, if necessary.
5398 if $test X"$prefix" != X"$installprefix"; then
5399         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5400 else
5401         installsitearch="$sitearchexp"
5402 fi
5403
5404 $cat <<EOM
5405
5406 The installation process will also create a directory for
5407 vendor-supplied add-ons.  Vendors who supply perl with their system
5408 may find it convenient to place all vendor-supplied files in this
5409 directory rather than in the main distribution directory.  This will
5410 ease upgrades between binary-compatible maintenance versions of perl.
5411
5412 Of course you may also use these directories in whatever way you see
5413 fit.  For example, you might use them to access modules shared over a
5414 company-wide network.
5415
5416 The default answer should be fine for most people.
5417 This causes further questions about vendor add-ons to be skipped
5418 and no vendor-specific directories will be configured for perl.
5419
5420 EOM
5421 rp='Do you want to configure vendor-specific add-on directories?'
5422 case "$usevendorprefix" in
5423 define|true|[yY]*) dflt=y ;;
5424 *)      : User may have set vendorprefix directly on Configure command line.
5425         case "$vendorprefix" in
5426         ''|' ') dflt=n ;;
5427         *)      dflt=y ;;
5428         esac
5429         ;;
5430 esac
5431 . ./myread
5432 case "$ans" in
5433 [yY]*)  fn=d~+
5434         rp='Installation prefix to use for vendor-supplied add-ons?'
5435         case "$vendorprefix" in
5436         '') dflt='' ;;
5437         *)  dflt=$vendorprefix ;;
5438         esac
5439         . ./getfile
5440         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5441         oldvendorprefix=''
5442         case "$vendorprefix" in
5443         '') ;;
5444         *)      case "$ans" in
5445                 "$prefix") ;;
5446                 *) oldvendorprefix="$prefix";;
5447                 esac
5448                 ;;
5449         esac
5450         usevendorprefix="$define"
5451         vendorprefix="$ans"
5452         vendorprefixexp="$ansexp"
5453         ;;
5454 *)      usevendorprefix="$undef"
5455         vendorprefix=''
5456         vendorprefixexp=''
5457         ;;
5458 esac
5459
5460 case "$vendorprefix" in
5461 '')     d_vendorlib="$undef"
5462         vendorlib=''
5463         vendorlibexp=''
5464         ;;
5465 *)      d_vendorlib="$define"
5466         : determine where vendor-supplied modules go.
5467         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5468         case "$vendorlib" in
5469         '')
5470                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5471                 case "$installstyle" in
5472                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5473                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5474                 esac
5475                 ;;
5476         *)      dflt="$vendorlib"
5477                 ;;
5478         esac
5479         fn=d~+
5480         rp='Pathname for the vendor-supplied library files?'
5481         . ./getfile
5482         vendorlib="$ans"
5483         vendorlibexp="$ansexp"
5484         ;;
5485 esac
5486 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5487 : Change installation prefix, if necessary.
5488 if $test X"$prefix" != X"$installprefix"; then
5489         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5490 else
5491         installvendorlib="$vendorlibexp"
5492 fi
5493
5494 case "$vendorprefix" in
5495 '')     d_vendorarch="$undef"
5496         vendorarch=''
5497         vendorarchexp=''
5498         ;;
5499 *)      d_vendorarch="$define"
5500         : determine where vendor-supplied architecture-dependent libraries go.
5501         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5502         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5503         : vendorlib may have an optional trailing /share.
5504         case "$vendorarch" in
5505         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5506                 dflt="$dflt/$archname"
5507                 ;;
5508         *)      dflt="$vendorarch" ;;
5509         esac
5510         fn=d~+
5511         rp='Pathname for vendor-supplied architecture-dependent files?'
5512         . ./getfile
5513         vendorarch="$ans"
5514         vendorarchexp="$ansexp"
5515         ;;
5516 esac
5517 : Change installation prefix, if necessary.
5518 if $test X"$prefix" != X"$installprefix"; then
5519         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5520 else
5521         installvendorarch="$vendorarchexp"
5522 fi
5523
5524 : Final catch-all directories to search
5525 $cat <<EOM
5526
5527 Lastly, you can have perl look in other directories for extensions and
5528 modules in addition to those already specified.
5529 These directories will be searched after 
5530         $sitearch 
5531         $sitelib 
5532 EOM
5533 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5534 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5535 echo ' '
5536 case "$otherlibdirs" in
5537 ''|' ') dflt='none' ;;
5538 *)      dflt="$otherlibdirs" ;;
5539 esac
5540 $cat <<EOM
5541 Enter a colon-separated set of extra paths to include in perl's @INC
5542 search path, or enter 'none' for no extra paths.
5543
5544 EOM
5545
5546 rp='Colon-separated list of additional directories for perl to search?'
5547 . ./myread
5548 case "$ans" in
5549 ' '|''|none)    otherlibdirs=' ' ;;     
5550 *)      otherlibdirs="$ans" ;;
5551 esac
5552 case "$otherlibdirs" in
5553 ' ') val=$undef ;;
5554 *)      val=$define ;;
5555 esac
5556 set d_perl_otherlibdirs
5557 eval $setvar
5558
5559 : Cruising for prototypes
5560 echo " "
5561 echo "Checking out function prototypes..." >&4
5562 $cat >prototype.c <<'EOCP'
5563 int main(int argc, char *argv[]) {
5564         exit(0);}
5565 EOCP
5566 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5567         echo "Your C compiler appears to support function prototypes."
5568         val="$define"
5569 else
5570         echo "Your C compiler doesn't seem to understand function prototypes."
5571         val="$undef"
5572 fi
5573 set prototype
5574 eval $setvar
5575 $rm -f prototype*
5576
5577 case "$prototype" in
5578 "$define") ;;
5579 *)      ansi2knr='ansi2knr'
5580         echo " "
5581         cat <<EOM >&4
5582
5583 $me:  FATAL ERROR:
5584 This version of $package can only be compiled by a compiler that 
5585 understands function prototypes.  Unfortunately, your C compiler 
5586         $cc $ccflags
5587 doesn't seem to understand them.  Sorry about that.
5588
5589 If GNU cc is available for your system, perhaps you could try that instead.  
5590
5591 Eventually, we hope to support building Perl with pre-ANSI compilers.
5592 If you would like to help in that effort, please contact <perlbug@perl.org>.
5593
5594 Aborting Configure now.
5595 EOM
5596         exit 2
5597         ;;
5598 esac
5599
5600 : determine where public executables go
5601 echo " "
5602 set dflt bin bin
5603 eval $prefixit
5604 fn=d~
5605 rp='Pathname where the public executables will reside?'
5606 . ./getfile
5607 if $test "X$ansexp" != "X$binexp"; then
5608         installbin=''
5609 fi
5610 bin="$ans"
5611 binexp="$ansexp"
5612 : Change installation prefix, if necessary.
5613 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5614 if $test X"$prefix" != X"$installprefix"; then
5615         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5616 else
5617         installbin="$binexp"
5618 fi
5619
5620 : Find perl5.005 or later.
5621 echo "Looking for a previously installed perl5.005 or later... "
5622 case "$perl5" in
5623 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5624                 : Check if this perl is recent and can load a simple module
5625                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5626                         perl5=$tdir/perl
5627                         break;
5628                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5629                         perl5=$tdir/perl
5630                         break;
5631                 fi
5632         done
5633         ;;
5634 *)      perl5="$perl5"
5635         ;;
5636 esac
5637 case "$perl5" in
5638 '')     echo "None found.  That's ok.";;
5639 *)      echo "Using $perl5." ;;
5640 esac
5641
5642 : Determine list of previous versions to include in @INC
5643 $cat > getverlist <<EOPL
5644 #!$perl5 -w
5645 use File::Basename;
5646 \$api_versionstring = "$api_versionstring";
5647 \$version = "$version";
5648 \$stem = "$sitelib_stem";
5649 \$archname = "$archname";
5650 EOPL
5651         $cat >> getverlist <<'EOPL'
5652 # Can't have leading @ because metaconfig interprets it as a command!
5653 ;@inc_version_list=();
5654 # XXX Redo to do opendir/readdir? 
5655 if (-d $stem) {
5656     chdir($stem);
5657     ;@candidates = glob("5.*");
5658 }
5659 else {
5660     ;@candidates = ();
5661 }
5662
5663 # XXX ToDo:  These comparisons must be reworked when two-digit
5664 # subversions come along, so that 5.7.10 compares as greater than
5665 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5666 # widespread that we can use the built-in version vectors rather
5667 # than reinventing them here.  For 5.6.0, however, we must
5668 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5669 foreach $d (@candidates) {
5670     if ($d lt $version) {
5671         if ($d ge $api_versionstring) {
5672             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5673         }
5674         elsif ($d ge "5.005") {
5675             unshift(@inc_version_list, grep { -d } $d);
5676         }
5677     }
5678     else {
5679         # Skip newer version.  I.e. don't look in
5680         # 5.7.0 if we're installing 5.6.1.
5681     }
5682 }
5683
5684 if (@inc_version_list) {
5685     print join(' ', @inc_version_list);
5686 }
5687 else {
5688     # Blank space to preserve value for next Configure run.
5689     print " ";
5690 }
5691 EOPL
5692 chmod +x getverlist
5693 case "$inc_version_list" in
5694 '')     if test -x "$perl5"; then
5695                 dflt=`$perl5 getverlist`
5696         else
5697                 dflt='none'
5698         fi
5699         ;;
5700 $undef) dflt='none' ;;
5701 *)  dflt="$inc_version_list" ;;
5702 esac
5703 case "$dflt" in
5704 ''|' ') dflt=none ;;
5705 esac
5706 $cat <<'EOM'
5707
5708 In order to ease the process of upgrading, this version of perl 
5709 can be configured to use modules built and installed with earlier 
5710 versions of perl that were installed under $prefix.  Specify here
5711 the list of earlier versions that this version of perl should check.
5712 If Configure detected no earlier versions of perl installed under
5713 $prefix, then the list will be empty.  Answer 'none' to tell perl
5714 to not search earlier versions.
5715
5716 The default should almost always be sensible, so if you're not sure,
5717 just accept the default.
5718 EOM
5719
5720 rp='List of earlier versions to include in @INC?'
5721 . ./myread
5722 case "$ans" in
5723 [Nn]one|''|' ') inc_version_list=' ' ;;
5724 *) inc_version_list="$ans" ;;
5725 esac
5726 case "$inc_version_list" in
5727 ''|' ') 
5728         inc_version_list_init='0';;
5729 *)      inc_version_list_init=`echo $inc_version_list |
5730                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5731         ;;
5732 esac
5733 $rm -f getverlist
5734
5735 : determine whether to install perl also as /usr/bin/perl
5736
5737 echo " "
5738 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5739         $cat <<EOM
5740 Many scripts expect perl to be installed as /usr/bin/perl.
5741 I can install the perl you are about to compile also as /usr/bin/perl
5742 (in addition to $installbin/perl).
5743 EOM
5744         case "$installusrbinperl" in
5745         "$undef"|[nN]*) dflt='n';;
5746         *)              dflt='y';;
5747         esac
5748         rp="Do you want to install perl as /usr/bin/perl?"
5749         . ./myread
5750         case "$ans" in
5751         [yY]*)  val="$define";;
5752         *)      val="$undef" ;;
5753         esac
5754 else
5755         val="$undef"
5756 fi
5757 set installusrbinperl
5758 eval $setvar
5759
5760 echo " "
5761 echo "Checking for GNU C Library..." >&4
5762 cat >gnulibc.c <<EOM
5763 #include <stdio.h>
5764 int main()
5765 {
5766 #ifdef __GLIBC__
5767     exit(0);
5768 #else
5769     exit(1);
5770 #endif
5771 }
5772 EOM
5773 set gnulibc
5774 if eval $compile_ok && ./gnulibc; then
5775         val="$define"
5776         echo "You are using the GNU C Library"
5777 else
5778         val="$undef"
5779         echo "You are not using the GNU C Library"
5780 fi
5781 $rm -f gnulibc*
5782 set d_gnulibc
5783 eval $setvar
5784
5785 : see if nm is to be used to determine whether a symbol is defined or not
5786 case "$usenm" in
5787 '')
5788         dflt=''
5789         case "$d_gnulibc" in
5790         "$define")
5791                 echo " "
5792                 echo "nm probably won't work on the GNU C Library." >&4
5793                 dflt=n
5794                 ;;
5795         esac
5796         case "$dflt" in
5797         '') 
5798                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5799                         echo " "
5800                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5801                         echo "'nm' won't be sufficient on this sytem." >&4
5802                         dflt=n
5803                 fi
5804                 ;;
5805         esac
5806         case "$dflt" in
5807         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5808                 if $test $dflt -gt 20; then
5809                         dflt=y
5810                 else
5811                         dflt=n
5812                 fi
5813                 ;;
5814         esac
5815         ;;
5816 *)
5817         case "$usenm" in
5818         true|$define) dflt=y;;
5819         *) dflt=n;;
5820         esac
5821         ;;
5822 esac
5823 $cat <<EOM
5824
5825 I can use $nm to extract the symbols from your C libraries. This
5826 is a time consuming task which may generate huge output on the disk (up
5827 to 3 megabytes) but that should make the symbols extraction faster. The
5828 alternative is to skip the 'nm' extraction part and to compile a small
5829 test program instead to determine whether each symbol is present. If
5830 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5831 this may be the best solution.
5832
5833 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5834
5835 EOM
5836 rp="Shall I use $nm to extract C symbols from the libraries?"
5837 . ./myread
5838 case "$ans" in
5839 [Nn]*) usenm=false;;
5840 *) usenm=true;;
5841 esac
5842
5843 runnm=$usenm
5844 case "$reuseval" in
5845 true) runnm=false;;
5846 esac
5847
5848 : nm options which may be necessary
5849 case "$nm_opt" in
5850 '') if $test -f /mach_boot; then
5851                 nm_opt=''       # Mach
5852         elif $test -d /usr/ccs/lib; then
5853                 nm_opt='-p'     # Solaris (and SunOS?)
5854         elif $test -f /dgux; then
5855                 nm_opt='-p'     # DG-UX
5856         elif $test -f /lib64/rld; then
5857                 nm_opt='-p'     # 64-bit Irix
5858         else
5859                 nm_opt=''
5860         fi;;
5861 esac
5862
5863 : nm options which may be necessary for shared libraries but illegal
5864 : for archive libraries.  Thank you, Linux.
5865 case "$nm_so_opt" in
5866 '')     case "$myuname" in
5867         *linux*)
5868                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5869                         nm_so_opt='--dynamic'
5870                 fi
5871                 ;;
5872         esac
5873         ;;
5874 esac
5875
5876 case "$runnm" in
5877 true)
5878 : get list of predefined functions in a handy place
5879 echo " "
5880 case "$libc" in
5881 '') libc=unknown
5882         case "$libs" in
5883         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5884         esac
5885         ;;
5886 esac
5887 libnames='';
5888 case "$libs" in
5889 '') ;;
5890 *)  for thislib in $libs; do
5891         case "$thislib" in
5892         -lc|-lc_s)
5893                 : Handle C library specially below.
5894                 ;;
5895         -l*)
5896                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5897                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5898                         :
5899                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5900                         :
5901                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5902                         :
5903                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5904                         :
5905                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5906                         :
5907                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5908                         :
5909                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5910                         :
5911                 else
5912                         try=''
5913                 fi
5914                 libnames="$libnames $try"
5915                 ;;
5916         *) libnames="$libnames $thislib" ;;
5917         esac
5918         done
5919         ;;
5920 esac
5921 xxx=normal
5922 case "$libc" in
5923 unknown)
5924         set /lib/libc.$so
5925         for xxx in $libpth; do
5926                 $test -r $1 || set $xxx/libc.$so
5927                 : The messy sed command sorts on library version numbers.
5928                 $test -r $1 || \
5929                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5930                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5931                                 h
5932                                 s/[0-9][0-9]*/0000&/g
5933                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5934                                 G
5935                                 s/\n/ /' | \
5936                          sort | $sed -e 's/^.* //'`
5937                 eval set \$$#
5938         done
5939         $test -r $1 || set /usr/ccs/lib/libc.$so
5940         $test -r $1 || set /lib/libsys_s$_a
5941         ;;
5942 *)
5943         set blurfl
5944         ;;
5945 esac
5946 if $test -r "$1"; then
5947         echo "Your (shared) C library seems to be in $1."
5948         libc="$1"
5949 elif $test -r /lib/libc && $test -r /lib/clib; then
5950         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5951         xxx=apollo
5952         libc='/lib/clib /lib/libc'
5953         if $test -r /lib/syslib; then
5954                 echo "(Your math library is in /lib/syslib.)"
5955                 libc="$libc /lib/syslib"
5956         fi
5957 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5958         echo "Your C library seems to be in $libc, as you said before."
5959 elif $test -r $incpath/usr/lib/libc$_a; then
5960         libc=$incpath/usr/lib/libc$_a;
5961         echo "Your C library seems to be in $libc.  That's fine."
5962 elif $test -r /lib/libc$_a; then
5963         libc=/lib/libc$_a;
5964         echo "Your C library seems to be in $libc.  You're normal."
5965 else
5966         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5967                 :
5968         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5969                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5970         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5971                 :
5972         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5973                 :
5974         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5975                 :
5976         else
5977                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5978         fi
5979         if $test -r "$tans"; then
5980                 echo "Your C library seems to be in $tans, of all places."
5981                 libc=$tans
5982         else
5983                 libc='blurfl'
5984         fi
5985 fi
5986 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5987         dflt="$libc"
5988         cat <<EOM
5989
5990 If the guess above is wrong (which it might be if you're using a strange
5991 compiler, or your machine supports multiple models), you can override it here.
5992
5993 EOM
5994 else
5995         dflt=''
5996         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5997         cat >&4 <<EOM
5998 I can't seem to find your C library.  I've looked in the following places:
5999
6000 EOM
6001         $sed 's/^/      /' libpath
6002         cat <<EOM
6003
6004 None of these seems to contain your C library. I need to get its name...
6005
6006 EOM
6007 fi
6008 fn=f
6009 rp='Where is your C library?'
6010 . ./getfile
6011 libc="$ans"
6012
6013 echo " "
6014 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6015 set X `cat libnames`
6016 shift
6017 xxx=files
6018 case $# in 1) xxx=file; esac
6019 echo "Extracting names from the following $xxx for later perusal:" >&4
6020 echo " "
6021 $sed 's/^/      /' libnames >&4
6022 echo " "
6023 $echo $n "This may take a while...$c" >&4
6024
6025 for file in $*; do
6026         case $file in
6027         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6028         *) $nm $nm_opt $file 2>/dev/null;;
6029         esac
6030 done >libc.tmp
6031
6032 $echo $n ".$c"
6033 $grep fprintf libc.tmp > libc.ptf
6034 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6035 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6036 xxx='[ADTSIW]'
6037 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6038         eval $xscan;\
6039         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6040                 eval $xrun
6041 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6042         eval $xscan;\
6043         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6044                 eval $xrun
6045 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6046         eval $xscan;\
6047         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6048                 eval $xrun
6049 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6050         eval $xscan;\
6051         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6052                 eval $xrun
6053 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6054         eval $xscan;\
6055         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6056                 eval $xrun
6057 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6058         eval $xscan;\
6059         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6060                 eval $xrun
6061 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6062                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6063         eval $xscan;\
6064         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6065                 eval $xrun
6066 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6067         eval $xscan;\
6068         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6069                 eval $xrun
6070 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6071         eval $xscan;\
6072         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6073                 eval $xrun
6074 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6075         eval $xscan;\
6076         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6077                 eval $xrun
6078 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6079         eval $xscan;\
6080         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6081                 eval $xrun
6082 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6083         eval $xscan;\
6084         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6085                 eval $xrun
6086 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6087         eval $xscan;\
6088         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6089                 eval $xrun
6090 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6091         eval $xscan;\
6092         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6093                 eval $xrun
6094 else
6095         $nm -p $* 2>/dev/null >libc.tmp
6096         $grep fprintf libc.tmp > libc.ptf
6097         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6098                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6099         then
6100                 nm_opt='-p'
6101                 eval $xrun
6102         else
6103                 echo " "
6104                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6105                 com=''
6106                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6107                         for thisname in $libnames $libc; do
6108                                 $ar t $thisname >>libc.tmp
6109                         done
6110                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6111                         echo "Ok." >&4
6112                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6113                         # Repeat libc to extract forwarders to DLL entries too
6114                         for thisname in $libnames $libc; do
6115                                 $ar tv $thisname >>libc.tmp
6116                                 # Revision 50 of EMX has bug in $ar.
6117                                 # it will not extract forwarders to DLL entries
6118                                 # Use emximp which will extract exactly them.
6119                                 emximp -o tmp.imp $thisname \
6120                                     2>/dev/null && \
6121                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6122                                     < tmp.imp >>libc.tmp
6123                                 $rm tmp.imp
6124                         done
6125                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6126                         echo "Ok." >&4
6127                 else
6128                         echo "$ar didn't seem to work right." >&4
6129                         echo "Maybe this is a Cray...trying bld instead..." >&4
6130                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6131                         then
6132                                 for thisname in $libnames; do
6133                                         bld t $libnames | \
6134                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6135                                         $ar t $thisname >>libc.tmp
6136                                 done
6137                                 echo "Ok." >&4
6138                         else
6139                                 echo "That didn't work either.  Giving up." >&4
6140                                 exit 1
6141                         fi
6142                 fi
6143         fi
6144 fi
6145 nm_extract="$com"
6146 if $test -f /lib/syscalls.exp; then
6147         echo " "
6148         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6149         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6150 fi
6151 ;;
6152 esac
6153 $rm -f libnames libpath
6154
6155 : see if dld is available
6156 set dld.h i_dld
6157 eval $inhdr
6158
6159 : is a C symbol defined?
6160 csym='tlook=$1;
6161 case "$3" in
6162 -v) tf=libc.tmp; tc=""; tdc="";;
6163 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6164 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6165 esac;
6166 tx=yes;
6167 case "$reuseval-$4" in
6168 true-) ;;
6169 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6170 esac;
6171 case "$tx" in
6172 yes)
6173         case "$runnm" in
6174         true)
6175                 if $contains $tlook $tf >/dev/null 2>&1;
6176                 then tval=true;
6177                 else tval=false;
6178                 fi;;
6179         *)
6180                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6181                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6182                 then tval=true;
6183                 else tval=false;
6184                 fi;
6185                 $rm -f t t.c;;
6186         esac;;
6187 *)
6188         case "$tval" in
6189         $define) tval=true;;
6190         *) tval=false;;
6191         esac;;
6192 esac;
6193 eval "$2=$tval"'
6194
6195 : define an is-in-libc? function
6196 inlibc='echo " "; td=$define; tu=$undef;
6197 sym=$1; var=$2; eval "was=\$$2";
6198 tx=yes;
6199 case "$reuseval$was" in
6200 true) ;;
6201 true*) tx=no;;
6202 esac;
6203 case "$tx" in
6204 yes)
6205         set $sym tres -f;
6206         eval $csym;
6207         case "$tres" in
6208         true)
6209                 echo "$sym() found." >&4;
6210                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6211         *)
6212                 echo "$sym() NOT found." >&4;
6213                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6214         esac;;
6215 *)
6216         case "$was" in
6217         $define) echo "$sym() found." >&4;;
6218         *) echo "$sym() NOT found." >&4;;
6219         esac;;
6220 esac'
6221
6222 : see if dlopen exists
6223 xxx_runnm="$runnm"
6224 runnm=false
6225 set dlopen d_dlopen
6226 eval $inlibc
6227 runnm="$xxx_runnm"
6228
6229 : determine which dynamic loading, if any, to compile in
6230 echo " "
6231 dldir="ext/DynaLoader"
6232 case "$usedl" in
6233 $define|y|true)
6234         dflt='y'
6235         usedl="$define"
6236         ;;
6237 $undef|n|false)
6238         dflt='n'
6239         usedl="$undef"
6240         ;;
6241 *) 
6242         dflt='n'
6243         case "$d_dlopen" in
6244             $define) dflt='y' ;;
6245         esac
6246         case "$i_dld" in
6247             $define) dflt='y' ;;
6248         esac
6249         : Does a dl_xxx.xs file exist for this operating system
6250         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6251         ;;
6252 esac
6253 rp="Do you wish to use dynamic loading?"
6254 . ./myread
6255 usedl="$ans"
6256 case "$ans" in
6257 y*) usedl="$define"
6258         case "$dlsrc" in
6259         '')
6260                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6261                         dflt="$dldir/dl_${osname}.xs"
6262                 elif $test "$d_dlopen" = "$define" ; then
6263                         dflt="$dldir/dl_dlopen.xs"
6264                 elif $test "$i_dld" = "$define" ; then
6265                         dflt="$dldir/dl_dld.xs"
6266                 else
6267                         dflt=''
6268                 fi
6269                 ;;
6270         *)      dflt="$dldir/$dlsrc"
6271                 ;;
6272         esac
6273     echo "The following dynamic loading files are available:"
6274         : Can not go over to $dldir because getfile has path hard-coded in.
6275         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6276         rp="Source file to use for dynamic loading"
6277         fn="fne"
6278         gfpth="$src"
6279         . ./getfile
6280         usedl="$define"
6281         : emulate basename
6282         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6283
6284         $cat << EOM
6285
6286 Some systems may require passing special flags to $cc -c to
6287 compile modules that will be used to create a shared library.
6288 To use no flags, say "none".
6289
6290 EOM
6291     case "$cccdlflags" in
6292     '') case "$gccversion" in
6293                 '') case "$osname" in
6294                         hpux)   dflt='+z' ;;
6295                         next)   dflt='none' ;;
6296                         irix*)  dflt='-KPIC' ;;
6297                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6298                         sunos)  dflt='-pic' ;;
6299                         *)      dflt='none' ;;
6300                     esac
6301                         ;;
6302                 *)  case "$osname" in
6303                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6304                         *)      dflt='-fpic' ;;
6305                     esac ;;
6306             esac ;;
6307         ' ') dflt='none' ;;
6308     *)  dflt="$cccdlflags" ;;
6309     esac
6310     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6311     . ./myread
6312     case "$ans" in
6313     none) cccdlflags=' ' ;;
6314     *) cccdlflags="$ans" ;;
6315     esac
6316
6317     cat << EOM
6318
6319 Some systems use ld to create libraries that can be dynamically loaded,
6320 while other systems (such as those using ELF) use $cc.
6321
6322 EOM
6323         case "$ld" in
6324         '')     $cat >try.c <<'EOM'
6325 /* Test for whether ELF binaries are produced */
6326 #include <fcntl.h>
6327 #include <stdlib.h>
6328 int main() {
6329         char b[4];
6330         int i = open("a.out",O_RDONLY);
6331         if(i == -1) 
6332                 exit(1); /* fail */
6333         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6334                 exit(0); /* succeed (yes, it's ELF) */
6335         else
6336                 exit(1); /* fail */
6337 }
6338 EOM
6339                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6340                         cat <<EOM
6341 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6342 EOM
6343                         dflt="$cc"
6344                 else
6345                         echo "I'll use ld to build dynamic libraries."
6346                         dflt='ld'
6347                 fi
6348                 rm -f try.c a.out
6349                 ;;
6350         *)      dflt="$ld"
6351                 ;;
6352         esac
6353
6354     rp="What command should be used to create dynamic libraries?"
6355     . ./myread
6356         ld="$ans"
6357
6358     cat << EOM
6359
6360 Some systems may require passing special flags to $ld to create a
6361 library that can be dynamically loaded.  If your ld flags include
6362 -L/other/path options to locate libraries outside your loader's normal
6363 search path, you may need to specify those -L options here as well.  To
6364 use no flags, say "none".
6365
6366 EOM
6367     case "$lddlflags" in
6368     '') case "$osname" in
6369                         beos) dflt='-nostart' ;;
6370                         hpux) dflt='-b';
6371                               case "$gccversion" in
6372                               '') dflt="$dflt +vnocompatwarnings" ;;
6373                               esac
6374                               ;;        
6375                         linux|irix*)    dflt='-shared' ;;
6376                         next)  dflt='none' ;;
6377                         solaris) dflt='-G' ;;
6378                         sunos) dflt='-assert nodefinitions' ;;
6379                         svr4*|esix*) dflt="-G $ldflags" ;;
6380                 *)     dflt='none' ;;
6381                         esac
6382                         ;;
6383     *) dflt="$lddlflags" ;;
6384     esac
6385
6386         : Try to guess additional flags to pick up local libraries.
6387         : Be careful not to append to a plain 'none'
6388         case "$dflt" in
6389         none) dflt='' ;;
6390         esac
6391         for thisflag in $ldflags; do
6392                 case "$thisflag" in
6393                 -L*)
6394                         case " $dflt " in
6395                         *" $thisflag "*) ;;
6396                         *) dflt="$dflt $thisflag" ;;
6397                         esac
6398                         ;;
6399                 esac
6400         done
6401
6402         case "$dflt" in
6403         ''|' ') dflt='none' ;;
6404         esac
6405
6406     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6407     . ./myread
6408     case "$ans" in
6409     none) lddlflags=' ' ;;
6410     *) lddlflags="$ans" ;;
6411     esac
6412
6413         cat <<EOM
6414
6415 Some systems may require passing special flags to $cc to indicate that
6416 the resulting executable will use dynamic linking.  To use no flags,
6417 say "none".
6418
6419 EOM
6420     case "$ccdlflags" in
6421     '') case "$osname" in
6422                 hpux)   dflt='-Wl,-E' ;;
6423                 linux)  dflt='-rdynamic' ;;
6424                 next)   dflt='none' ;;
6425                 sunos)  dflt='none' ;;
6426                 *)      dflt='none' ;;
6427             esac ;;
6428     ' ')  dflt='none' ;;
6429     *)  dflt="$ccdlflags" ;;
6430     esac
6431     rp="Any special flags to pass to $cc to use dynamic linking?"
6432     . ./myread
6433     case "$ans" in
6434     none) ccdlflags=' ' ;;
6435     *) ccdlflags="$ans" ;;
6436     esac
6437     ;;
6438 *)  usedl="$undef"
6439         ld='ld'
6440     dlsrc='dl_none.xs'
6441     lddlflags=''
6442     ccdlflags=''
6443     ;;
6444 esac
6445
6446 also=''
6447 case "$usedl" in
6448 $undef)
6449         # No dynamic loading being used, so don't bother even to prompt.
6450         useshrplib='false'
6451         ;;
6452 *)      case "$useshrplib" in
6453         '')     case "$osname" in
6454                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6455                         dflt=y
6456                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6457                         ;;
6458                 next*)
6459                         case "$osvers" in
6460                         4*)     dflt=y
6461                                 also='Building a shared libperl is needed for MAB support.'
6462                                 ;;
6463                         *)      dflt=n
6464                                 ;;
6465                         esac
6466                         ;;
6467                 *)      dflt=n
6468                         ;;
6469                 esac
6470                 ;;
6471         $define|true|[Yy]*)
6472                 dflt=y
6473                 ;;
6474         *)      dflt=n
6475                 ;;
6476         esac
6477         $cat << EOM
6478
6479 The perl executable is normally obtained by linking perlmain.c with
6480 libperl${_a}, any static extensions (usually just DynaLoader), and
6481 any other libraries needed on this system (such as -lm, etc.).  Since
6482 your system supports dynamic loading, it is probably possible to build
6483 a shared libperl.$so.  If you will have more than one executable linked
6484 to libperl.$so, this will significantly reduce the size of each
6485 executable, but it may have a noticeable affect on performance.  The
6486 default is probably sensible for your system.
6487 $also
6488
6489 EOM
6490         rp="Build a shared libperl.$so (y/n)"
6491         . ./myread
6492         case "$ans" in
6493         true|$define|[Yy]*)
6494                 useshrplib='true'  ;;
6495         *)      useshrplib='false' ;;
6496         esac
6497         ;;
6498 esac
6499
6500 case "$useshrplib" in
6501 true)
6502         case "$libperl" in
6503         '')
6504                 # Figure out a good name for libperl.so.  Since it gets stored in
6505                 # a version-specific architecture-dependent library, the version
6506                 # number isn't really that important, except for making cc/ld happy.
6507                 #
6508                 # A name such as libperl.so.3.1
6509                 majmin="libperl.$so.$patchlevel.$subversion"
6510                 # A name such as libperl.so.301
6511                 majonly=`echo $patchlevel $subversion |
6512                         $awk '{printf "%d%02d", $1, $2}'`
6513                 majonly=libperl.$so.$majonly
6514                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6515                 # rely on figuring it out from the naming of libc.
6516                 case "${osname}${osvers}" in
6517                 next4*)
6518                         dflt=libperl.5.$so
6519                         # XXX How handle the --version stuff for MAB?
6520                         ;;
6521                 linux*)  # ld won't link with a bare -lperl otherwise.
6522                         dflt=libperl.$so
6523                         ;;
6524                 cygwin*) # include version
6525                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6526                         ;;
6527                 *)      # Try to guess based on whether libc has major.minor.
6528                         case "$libc" in
6529                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6530                         *libc.$so.[0-9]*) dflt=$majonly ;;
6531                         *)      dflt=libperl.$so ;;
6532                         esac
6533                         ;;
6534                 esac
6535                 ;;
6536         *)      dflt=$libperl
6537                 ;;
6538         esac
6539         cat << EOM
6540
6541 I need to select a good name for the shared libperl.  If your system uses
6542 library names with major and minor numbers, then you might want something
6543 like $majmin.  Alternatively, if your system uses a single version
6544 number for shared libraries, then you might want to use $majonly.
6545 Or, your system might be quite happy with a simple libperl.$so.
6546
6547 Since the shared libperl will get installed into a version-specific
6548 architecture-dependent directory, the version number of the shared perl
6549 library probably isn't important, so the default should be o.k.
6550
6551 EOM
6552         rp='What name do you want to give to the shared libperl?'
6553         . ./myread
6554         libperl=$ans
6555         echo "Ok, I'll use $libperl"
6556         ;;
6557 *)
6558         libperl="libperl${_a}"
6559         ;;
6560 esac
6561
6562 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6563 case "$shrpdir" in
6564 '') ;;
6565 *)      $cat >&4 <<EOM
6566 WARNING:  Use of the shrpdir variable for the installation location of
6567 the shared $libperl is not supported.  It was never documented and
6568 will not work in this version.  Let me (perlbug@perl.com)
6569 know of any problems this may cause.
6570
6571 EOM
6572         case "$shrpdir" in
6573         "$archlibexp/CORE")
6574                 $cat >&4 <<EOM
6575 But your current setting of $shrpdir is
6576 the default anyway, so it's harmless.
6577 EOM
6578                 ;;
6579         *)
6580                 $cat >&4 <<EOM
6581 Further, your current attempted setting of $shrpdir
6582 conflicts with the value of $archlibexp/CORE
6583 that installperl will use.
6584 EOM
6585                 ;;
6586         esac
6587         ;;
6588 esac
6589
6590 # How will the perl executable find the installed shared $libperl?
6591 # Add $xxx to ccdlflags.
6592 # If we can't figure out a command-line option, use $shrpenv to
6593 # set env LD_RUN_PATH.  The main perl makefile uses this.
6594 shrpdir=$archlibexp/CORE
6595 xxx=''
6596 tmp_shrpenv=''
6597 if "$useshrplib"; then
6598     case "$osname" in 
6599         aix)
6600                 # We'll set it in Makefile.SH...
6601                 ;;
6602         solaris|netbsd)
6603                 xxx="-R $shrpdir"
6604                 ;;
6605         freebsd)
6606                 xxx="-Wl,-R$shrpdir"
6607                 ;;
6608         linux|irix*|dec_osf)
6609                 xxx="-Wl,-rpath,$shrpdir"
6610                 ;;
6611         next)
6612                 # next doesn't like the default...
6613                 ;;
6614         beos)
6615                 # beos doesn't like the default, either.
6616                 ;;
6617         hpux*)
6618                 # hpux doesn't like the default, either.
6619                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6620                 ;;
6621         *)
6622                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6623                 ;;
6624         esac
6625         case "$xxx" in
6626         '') ;;
6627         *)      
6628                 # Only add $xxx if it isn't already in ccdlflags.
6629                 case " $ccdlflags " in
6630                 *" $xxx "*)     ;;
6631                 *)      ccdlflags="$ccdlflags $xxx"
6632                         cat <<EOM >&4
6633
6634 Adding $xxx to the flags
6635 passed to $ld so that the perl executable will find the 
6636 installed shared $libperl.
6637
6638 EOM
6639                         ;;
6640                 esac
6641                 ;;
6642         esac
6643 fi
6644 # Fix ccdlflags in AIX for building external extensions.
6645 # (For building Perl itself bare -bE:perl.exp is needed,
6646 #  Makefile.SH takes care of this.)
6647 case "$osname" in
6648 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6649 esac
6650 # Respect a hint or command-line value.
6651 case "$shrpenv" in
6652 '') shrpenv="$tmp_shrpenv" ;;
6653 esac
6654 case "$ldlibpthname" in
6655 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6656 none)   ldlibpthname='' ;;
6657 esac
6658
6659 : determine where manual pages go
6660 set man1dir man1dir none
6661 eval $prefixit
6662 $cat <<EOM
6663
6664 $spackage has manual pages available in source form.
6665 EOM
6666 case "$nroff" in
6667 nroff)
6668         echo "However, you don't have nroff, so they're probably useless to you."
6669         case "$man1dir" in
6670         '') man1dir="none";;
6671         esac;;
6672 esac
6673 echo "If you don't want the manual sources installed, answer 'none'."
6674 case "$man1dir" in
6675 ' ') dflt=none
6676         ;;
6677 '')
6678         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6679         lookpath="$lookpath $prefixexp/man/p_man/man1"
6680         lookpath="$lookpath $prefixexp/man/u_man/man1"
6681         lookpath="$lookpath $prefixexp/man/man.1"
6682         case "$sysman" in
6683         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6684         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6685         esac
6686         set dflt
6687         eval $prefixup
6688         ;;
6689 *)  dflt="$man1dir"
6690         ;;
6691 esac
6692 echo " "
6693 fn=dn+~
6694 rp="Where do the main $spackage manual pages (source) go?"
6695 . ./getfile
6696 if $test "X$man1direxp" != "X$ansexp"; then
6697         installman1dir=''
6698 fi
6699 man1dir="$ans"
6700 man1direxp="$ansexp"
6701 case "$man1dir" in
6702 '')     man1dir=' '
6703         installman1dir='';;
6704 esac
6705
6706 : Change installation prefix, if necessary.
6707 if $test X"$prefix" != X"$installprefix"; then
6708         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6709 else
6710         installman1dir="$man1direxp"
6711 fi
6712
6713 : What suffix to use on installed man pages
6714
6715 case "$man1dir" in
6716 ' ')
6717         man1ext='0'
6718         ;;
6719 *)
6720         rp="What suffix should be used for the main $spackage man pages?"
6721         case "$man1ext" in
6722         '')     case "$man1dir" in
6723                 *1)  dflt=1 ;;
6724                 *1p) dflt=1p ;;
6725                 *1pm) dflt=1pm ;;
6726                 *l) dflt=l;;
6727                 *n) dflt=n;;
6728                 *o) dflt=o;;
6729                 *p) dflt=p;;
6730                 *C) dflt=C;;
6731                 *L) dflt=L;;
6732                 *L1) dflt=L1;;
6733                 *) dflt=1;;
6734                 esac
6735                 ;;
6736         *)      dflt="$man1ext";;
6737         esac
6738         . ./myread
6739         man1ext="$ans"
6740         ;;
6741 esac
6742
6743 : see if we can have long filenames
6744 echo " "
6745 first=123456789abcdef
6746 $rm -f $first
6747 if (echo hi >$first) 2>/dev/null; then
6748         if $test -f 123456789abcde; then
6749                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6750                 val="$undef"
6751         else
6752                 echo 'You can have filenames longer than 14 characters.'>&4
6753                 val="$define"
6754         fi
6755 else
6756         $cat <<'EOM'
6757 You can't have filenames longer than 14 chars.
6758 You can't even think about them!
6759 EOM
6760         val="$undef"
6761 fi 
6762 set d_flexfnam
6763 eval $setvar
6764 $rm -rf 123456789abcde*
6765
6766 : determine where library module manual pages go
6767 set man3dir man3dir none
6768 eval $prefixit
6769 $cat <<EOM
6770
6771 $spackage has manual pages for many of the library modules.
6772 EOM
6773
6774 case "$nroff" in
6775 nroff)
6776         $cat <<'EOM'
6777 However, you don't have nroff, so they're probably useless to you.
6778 EOM
6779         case "$man3dir" in
6780         '') man3dir="none";;
6781         esac;;
6782 esac
6783
6784 case "$d_flexfnam" in
6785 undef)
6786         $cat <<'EOM'
6787 However, your system can't handle the long file names like File::Basename.3. 
6788 EOM
6789         case "$man3dir" in
6790         '') man3dir="none";;
6791         esac;;
6792 esac
6793
6794 echo "If you don't want the manual sources installed, answer 'none'."
6795 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6796 case "$man3dir" in
6797 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6798         if $test -d "$privlib/man/man3"; then
6799                 cat <<EOM >&4
6800
6801 WARNING:  Previous versions of perl installed man3 pages into
6802 $privlib/man/man3.  This version will suggest a 
6803 new default of $dflt.  
6804 EOM
6805                 tdflt=$dflt
6806                 dflt='n'
6807                 rp='Do you wish to preserve the old behavior?(y/n)'
6808                 . ./myread
6809                 case "$ans" in
6810                 y*) dflt="$privlib/man/man3" ;;
6811                 *)  dflt=$tdflt ;;
6812                 esac
6813     fi
6814         ;;
6815 *)      dflt="$man3dir" ;;
6816 esac
6817 case "$dflt" in
6818 ' ') dflt=none ;;
6819 esac
6820 echo " "
6821 fn=dn+~
6822 rp="Where do the $package library man pages (source) go?"
6823 . ./getfile
6824 man3dir="$ans"
6825 man3direxp="$ansexp"
6826 case "$man3dir" in
6827 '')     man3dir=' '
6828         installman3dir='';;
6829 esac
6830
6831 : Change installation prefix, if necessary.
6832 if $test X"$prefix" != X"$installprefix"; then
6833         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6834 else
6835         installman3dir="$man3direxp"
6836 fi
6837
6838 : What suffix to use on installed man pages
6839 case "$man3dir" in
6840 ' ')
6841         man3ext='0'
6842         ;;
6843 *)
6844         rp="What suffix should be used for the $package library man pages?"
6845         case "$man3ext" in
6846         '')     case "$man3dir" in
6847                 *3)  dflt=3 ;;
6848                 *3p) dflt=3p ;;
6849                 *3pm) dflt=3pm ;;
6850                 *l) dflt=l;;
6851                 *n) dflt=n;;
6852                 *o) dflt=o;;
6853                 *p) dflt=p;;
6854                 *C) dflt=C;;
6855                 *L) dflt=L;;
6856                 *L3) dflt=L3;;
6857                 *) dflt=3;;
6858                 esac
6859                 ;;
6860         *)      dflt="$man3ext";;
6861         esac
6862         . ./myread
6863         man3ext="$ans"
6864         ;;
6865 esac
6866
6867 : see if we have to deal with yellow pages, now NIS.
6868 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6869         if $test -f /usr/etc/nibindd; then
6870                 echo " "
6871                 echo "I'm fairly confident you're on a NeXT."
6872                 echo " "
6873                 rp='Do you get the hosts file via NetInfo?'
6874                 dflt=y
6875                 case "$hostcat" in
6876                 nidump*) ;;
6877                 '') ;;
6878                 *) dflt=n;;
6879                 esac
6880                 . ./myread
6881                 case "$ans" in
6882                 y*) hostcat='nidump hosts .';;
6883                 *)      case "$hostcat" in
6884                         nidump*) hostcat='';;
6885                         esac
6886                         ;;
6887                 esac
6888         fi
6889         case "$hostcat" in
6890         nidump*) ;;
6891         *)
6892                 case "$hostcat" in
6893                 *ypcat*) dflt=y;;
6894                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6895                                 dflt=y
6896                         else
6897                                 dflt=n
6898                         fi;;
6899                 *) dflt=n;;
6900                 esac
6901                 echo " "
6902                 rp='Are you getting the hosts file via yellow pages?'
6903                 . ./myread
6904                 case "$ans" in
6905                 y*) hostcat='ypcat hosts';;
6906                 *) hostcat='cat /etc/hosts';;
6907                 esac
6908                 ;;
6909         esac
6910 fi
6911 case "$hostcat" in
6912 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6913 esac
6914 case "$groupcat" in
6915 '') test -f /etc/group && groupcat='cat /etc/group';;
6916 esac
6917 case "$passcat" in
6918 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6919 esac
6920
6921 : now get the host name
6922 echo " "
6923 echo "Figuring out host name..." >&4
6924 case "$myhostname" in
6925 '') cont=true
6926         echo 'Maybe "hostname" will work...'
6927         if tans=`sh -c hostname 2>&1` ; then
6928                 myhostname=$tans
6929                 phostname=hostname
6930                 cont=''
6931         fi
6932         ;;
6933 *) cont='';;
6934 esac
6935 if $test "$cont"; then
6936         if ./xenix; then
6937                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6938                 if tans=`cat /etc/systemid 2>&1` ; then
6939                         myhostname=$tans
6940                         phostname='cat /etc/systemid'
6941                         echo "Whadyaknow.  Xenix always was a bit strange..."
6942                         cont=''
6943                 fi
6944         elif $test -r /etc/systemid; then
6945                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6946         fi
6947 fi
6948 if $test "$cont"; then
6949         echo 'No, maybe "uuname -l" will work...'
6950         if tans=`sh -c 'uuname -l' 2>&1` ; then
6951                 myhostname=$tans
6952                 phostname='uuname -l'
6953         else
6954                 echo 'Strange.  Maybe "uname -n" will work...'
6955                 if tans=`sh -c 'uname -n' 2>&1` ; then
6956                         myhostname=$tans
6957                         phostname='uname -n'
6958                 else
6959                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6960                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6961                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6962                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6963                         else
6964                                 case "$myhostname" in
6965                                 '') echo "Does this machine have an identity crisis or something?"
6966                                         phostname='';;
6967                                 *)
6968                                         echo "Well, you said $myhostname before..."
6969                                         phostname='echo $myhostname';;
6970                                 esac
6971                         fi
6972                 fi
6973         fi
6974 fi
6975 : you do not want to know about this
6976 set $myhostname
6977 myhostname=$1
6978
6979 : verify guess
6980 if $test "$myhostname" ; then
6981         dflt=y
6982         rp='Your host name appears to be "'$myhostname'".'" Right?"
6983         . ./myread
6984         case "$ans" in
6985         y*) ;;
6986         *) myhostname='';;
6987         esac
6988 fi
6989
6990 : bad guess or no guess
6991 while $test "X$myhostname" = X ; do
6992         dflt=''
6993         rp="Please type the (one word) name of your host:"
6994         . ./myread
6995         myhostname="$ans"
6996 done
6997
6998 : translate upper to lower if necessary
6999 case "$myhostname" in
7000 *[A-Z]*)
7001         echo "(Normalizing case in your host name)"
7002         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7003         ;;
7004 esac
7005
7006 case "$myhostname" in
7007 *.*)
7008         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7009         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7010         echo "(Trimming domain name from host name--host name is now $myhostname)"
7011         ;;
7012 *) case "$mydomain" in
7013         '')
7014                 {
7015                         test "X$hostcat" = "Xypcat hosts" &&
7016                         ypmatch "$myhostname" hosts 2>/dev/null |\
7017                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7018                         $test -s hosts
7019                 } || {
7020                         test "X$hostcat" != "X" &&
7021                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7022                                         /[       ]$myhostname[  . ]/p" > hosts
7023                 }
7024                 tmp_re="[       . ]"
7025                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7026                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7027                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7028                         hosts | $sort | $uniq | \
7029                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7030                 case `$echo X$dflt` in
7031                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7032                         dflt=.
7033                         ;;
7034                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7035                         ;;
7036                 esac
7037                 case "$dflt" in
7038                 .)
7039                         tans=`./loc resolv.conf X /etc /usr/etc`
7040                         if $test -f "$tans"; then
7041                                 echo "(Attempting domain name extraction from $tans)"
7042                                 dflt=.`$sed -n -e 's/   / /g' \
7043                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7044                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7045                                 case "$dflt" in
7046                                 .) dflt=.`$sed -n -e 's/        / /g' \
7047                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7048                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7049                                         ;;
7050                                 esac
7051                         fi
7052                         ;;
7053                 esac
7054                 case "$dflt" in
7055                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7056                         dflt=.`sh -c domainname 2>/dev/null`
7057                         case "$dflt" in
7058                         '') dflt='.';;
7059                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7060                         esac
7061                         ;;
7062                 esac
7063                 case "$dflt" in
7064                 .) echo "(Lost all hope -- silly guess then)"
7065                         dflt='.uucp'
7066                         ;;
7067                 esac
7068                 $rm -f hosts
7069                 ;;
7070         *) dflt="$mydomain";;
7071         esac;;
7072 esac
7073 echo " "
7074 rp="What is your domain name?"
7075 . ./myread
7076 tans="$ans"
7077 case "$ans" in
7078 '') ;;
7079 .*) ;;
7080 *) tans=".$tans";;
7081 esac
7082 mydomain="$tans"
7083
7084 : translate upper to lower if necessary
7085 case "$mydomain" in
7086 *[A-Z]*)
7087         echo "(Normalizing case in your domain name)"
7088         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7089         ;;
7090 esac
7091
7092 : a little sanity check here
7093 case "$phostname" in
7094 '') ;;
7095 *)
7096         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7097         $myhostname$mydomain|$myhostname) ;;
7098         *)
7099                 case "$phostname" in
7100                 sed*)
7101                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7102                         ;;
7103                 *)
7104                         echo "(That doesn't agree with your $phostname command, by the way.)"
7105                         ;;
7106                 esac
7107         ;;
7108         esac
7109         ;;
7110 esac
7111
7112 $cat <<EOM
7113
7114 I need to get your e-mail address in Internet format if possible, i.e.
7115 something like user@host.domain. Please answer accurately since I have
7116 no easy means to double check it. The default value provided below
7117 is most probably close to reality but may not be valid from outside
7118 your organization...
7119
7120 EOM
7121 cont=x
7122 while test "$cont"; do
7123         case "$cf_email" in
7124         '') dflt="$cf_by@$myhostname$mydomain";;
7125         *) dflt="$cf_email";;
7126         esac
7127         rp='What is your e-mail address?'
7128         . ./myread
7129         cf_email="$ans"
7130         case "$cf_email" in
7131         *@*.*) cont='' ;;
7132         *)
7133                 rp='Address does not look like an Internet one.  Use it anyway?'
7134                 case "$fastread" in
7135                 yes) dflt=y ;;
7136                 *) dflt=n ;;
7137                 esac
7138                 . ./myread
7139                 case "$ans" in
7140                 y*) cont='' ;;
7141                 *) echo " " ;;
7142                 esac
7143                 ;;
7144         esac
7145 done
7146
7147 $cat <<EOM
7148
7149 If you or somebody else will be maintaining perl at your site, please
7150 fill in the correct e-mail address here so that they may be contacted
7151 if necessary. Currently, the "perlbug" program included with perl
7152 will send mail to this address in addition to perlbug@perl.com. You may
7153 enter "none" for no administrator.
7154
7155 EOM
7156 case "$perladmin" in
7157 '') dflt="$cf_email";;
7158 *) dflt="$perladmin";;
7159 esac
7160 rp='Perl administrator e-mail address'
7161 . ./myread
7162 perladmin="$ans"
7163
7164 : figure out how to guarantee perl startup
7165 case "$startperl" in
7166 '')
7167         case "$sharpbang" in
7168         *!)
7169                 $cat <<EOH
7170
7171 I can use the #! construct to start perl on your system. This will
7172 make startup of perl scripts faster, but may cause problems if you
7173 want to share those scripts and perl is not in a standard place
7174 ($binexp/perl) on all your platforms. The alternative is to force
7175 a shell by starting the script with a single ':' character.
7176
7177 EOH
7178                 dflt="$binexp/perl"
7179                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7180                 . ./myread
7181                 case "$ans" in
7182                 none)   startperl=": # use perl";;
7183                 *)      startperl="#!$ans"
7184                         if $test 30 -lt `echo "$ans" | wc -c`; then
7185                                 $cat >&4 <<EOM
7186
7187 WARNING:  Some systems limit the #! command to 32 characters.
7188 If you experience difficulty running Perl scripts with #!, try
7189 installing Perl in a directory with a shorter pathname.
7190
7191 EOM
7192                         fi ;;
7193                 esac
7194                 ;;
7195         *) startperl=": # use perl"
7196                 ;;
7197         esac
7198         ;;
7199 esac
7200 echo "I'll use $startperl to start perl scripts."
7201
7202 : figure best path for perl in scripts
7203 case "$perlpath" in
7204 '')
7205         perlpath="$binexp/perl"
7206         case "$startperl" in
7207         *!*) ;;
7208         *)
7209                 $cat <<EOH
7210
7211 I will use the "eval 'exec'" idiom to start Perl on your system.
7212 I can use the full path of your Perl binary for this purpose, but
7213 doing so may cause problems if you want to share those scripts and
7214 Perl is not always in a standard place ($binexp/perl).
7215
7216 EOH
7217                 dflt="$binexp/perl"
7218                 rp="What path shall I use in \"eval 'exec'\"?"
7219                 . ./myread
7220                 perlpath="$ans"
7221                 ;;
7222         esac
7223         ;;
7224 esac
7225 case "$startperl" in
7226 *!*)    ;;
7227 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7228 esac
7229
7230 : determine where public executable scripts go
7231 set scriptdir scriptdir
7232 eval $prefixit
7233 case "$scriptdir" in
7234 '')
7235         dflt="$bin"
7236         : guess some guesses
7237         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7238         $test -d /usr/share/bin     && dflt=/usr/share/bin
7239         $test -d /usr/local/script  && dflt=/usr/local/script
7240         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7241         $test -d $prefixexp/script  && dflt=$prefixexp/script
7242         set dflt
7243         eval $prefixup
7244         ;;
7245 *)  dflt="$scriptdir"
7246         ;;
7247 esac
7248 $cat <<EOM
7249  
7250 Some installations have a separate directory just for executable scripts so
7251 that they can mount it across multiple architectures but keep the scripts in
7252 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7253 Or you might just lump your scripts in with all your other executables.
7254  
7255 EOM
7256 fn=d~
7257 rp='Where do you keep publicly executable scripts?'
7258 . ./getfile
7259 if $test "X$ansexp" != "X$scriptdirexp"; then
7260         installscript=''
7261 fi
7262 scriptdir="$ans"
7263 scriptdirexp="$ansexp"
7264 : Change installation prefix, if necessary.
7265 if $test X"$prefix" != X"$installprefix"; then
7266         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7267 else
7268         installscript="$scriptdirexp"
7269 fi
7270
7271 : determine where add-on public executables go
7272 case "$sitebin" in
7273 '')     dflt=$siteprefix/bin ;;
7274 *)      dflt=$sitebin ;;
7275 esac
7276 fn=d~
7277 rp='Pathname where the add-on public executables should be installed?'
7278 . ./getfile
7279 sitebin="$ans"
7280 sitebinexp="$ansexp"
7281 : Change installation prefix, if necessary.
7282 if $test X"$prefix" != X"$installprefix"; then
7283         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7284 else
7285         installsitebin="$sitebinexp"
7286 fi
7287
7288 : see if sqrtl exists
7289 set sqrtl d_sqrtl
7290 eval $inlibc
7291
7292 case "$ccflags" in
7293 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7294 esac
7295
7296 case "$uselongdouble" in
7297 $define|true|[yY]*)     dflt='y';;
7298 *) dflt='n';;
7299 esac
7300 cat <<EOM
7301
7302 Perl can be built to take advantage of long doubles which
7303 (if available) may give more accuracy and range for floating point numbers.
7304
7305 If this doesn't make any sense to you, just accept the default '$dflt'.
7306 EOM
7307 rp='Try to use long doubles if available?'
7308 . ./myread
7309 case "$ans" in
7310 y|Y)    val="$define"   ;;
7311 *)      val="$undef"    ;;
7312 esac
7313 set uselongdouble
7314 eval $setvar
7315
7316 case "$uselongdouble" in
7317 true|[yY]*) uselongdouble="$define" ;;
7318 esac
7319
7320 case "$uselongdouble" in
7321 $define)
7322 : Look for a hint-file generated 'call-back-unit'.  If the
7323 : user has specified that long doubles should be used,
7324 : we may need to set or change some other defaults.
7325         if $test -f uselongdouble.cbu; then
7326                 echo "Your platform has some specific hints for long doubles, using them..."
7327                 . ./uselongdouble.cbu
7328         else
7329                 $cat <<EOM
7330 (Your platform doesn't have any specific hints for long doubles.)
7331 EOM
7332         fi
7333         ;;
7334 esac
7335
7336 case "$uselongdouble:$d_sqrtl" in
7337 $define:$undef)
7338                 $cat <<EOM >&4
7339
7340 *** You requested the use of long doubles but you do not seem to have
7341 *** the mathematic functions for long doubles.  I'm disabling the use
7342 *** of long doubles.
7343
7344 EOM
7345         uselongdouble=$undef
7346         ;;
7347 esac
7348
7349 case "$useperlio" in
7350 $define|true|[yY]*)     dflt='y';;
7351 *) dflt='n';;
7352 esac
7353 cat <<EOM
7354
7355 Previous version of $package used the standard IO mechanisms as defined
7356 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7357 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7358 the default.  This abstraction layer can use AT&T's sfio (if you already
7359 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7360 problems with some extension modules.  Using PerlIO with stdio is safe,
7361 but it is slower than plain stdio and therefore is not the default.
7362
7363 If this doesn't make any sense to you, just accept the default '$dflt'.
7364 EOM
7365 rp='Use the experimental PerlIO abstraction layer?'
7366 . ./myread
7367 case "$ans" in
7368 y|Y) 
7369         val="$define"
7370         ;;     
7371 *)      
7372         echo "Ok, doing things the stdio way"
7373         val="$undef"
7374         ;;
7375 esac
7376 set useperlio
7377 eval $setvar 
7378
7379 case "$vendorprefix" in
7380 '')     d_vendorbin="$undef"
7381         vendorbin=''
7382         vendorbinexp=''
7383         ;;
7384 *)      d_vendorbin="$define"
7385         : determine where vendor-supplied executables go.
7386         case "$vendorbin" in
7387         '') dflt=$vendorprefix/bin ;;
7388         *)      dflt="$vendorbin" ;;
7389         esac
7390         fn=d~+
7391         rp='Pathname for the vendor-supplied executables directory?'
7392         . ./getfile
7393         vendorbin="$ans"
7394         vendorbinexp="$ansexp"
7395         ;;
7396 esac
7397 : Change installation prefix, if necessary.
7398 if $test X"$prefix" != X"$installprefix"; then
7399         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7400 else
7401         installvendorbin="$vendorbinexp"
7402 fi
7403
7404 : see if qgcvt exists
7405 set qgcvt d_qgcvt
7406 eval $inlibc
7407
7408 : check for length of double
7409 echo " "
7410 case "$doublesize" in
7411 '')
7412         echo "Checking to see how big your double precision numbers are..." >&4
7413         $cat >try.c <<'EOCP'
7414 #include <stdio.h>
7415 int main()
7416 {
7417     printf("%d\n", (int)sizeof(double));
7418     exit(0);
7419 }
7420 EOCP
7421         set try
7422         if eval $compile_ok; then
7423                 doublesize=`./try`
7424                 echo "Your double is $doublesize bytes long."
7425         else
7426                 dflt='8'
7427                 echo "(I can't seem to compile the test program.  Guessing...)"
7428                 rp="What is the size of a double precision number (in bytes)?"
7429                 . ./myread
7430                 doublesize="$ans"
7431         fi
7432         ;;
7433 esac
7434 $rm -f try.c try
7435
7436 : check for long doubles
7437 echo " "
7438 echo "Checking to see if you have long double..." >&4
7439 echo 'int main() { long double x = 7.0; }' > try.c
7440 set try
7441 if eval $compile; then
7442         val="$define"
7443         echo "You have long double."
7444 else
7445         val="$undef"
7446         echo "You do not have long double."
7447 fi
7448 $rm try.*
7449 set d_longdbl
7450 eval $setvar
7451
7452 : check for length of long double
7453 case "${d_longdbl}${longdblsize}" in
7454 $define)
7455         echo " "
7456         echo "Checking to see how big your long doubles are..." >&4
7457         $cat >try.c <<'EOCP'
7458 #include <stdio.h>
7459 int main()
7460 {
7461         printf("%d\n", sizeof(long double));
7462 }
7463 EOCP
7464         set try
7465         set try
7466         if eval $compile; then
7467                 longdblsize=`./try$exe_ext`
7468                 echo "Your long doubles are $longdblsize bytes long."
7469         else
7470                 dflt='8'
7471                 echo " "
7472                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7473                 rp="What is the size of a long double (in bytes)?"
7474                 . ./myread
7475                 longdblsize="$ans"
7476         fi
7477         if $test "X$doublesize" = "X$longdblsize"; then
7478                 echo "(That isn't any different from an ordinary double.)"
7479         fi      
7480         ;;
7481 esac
7482 $rm -f try.* try
7483
7484 echo " "
7485
7486 if $test X"$d_longdbl" = X"$define"; then
7487
7488 echo "Checking how to print long doubles..." >&4
7489
7490 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7491         $cat >try.c <<'EOCP'
7492 #include <sys/types.h>
7493 #include <stdio.h>
7494 int main() {
7495   double d = 123.456;
7496   printf("%.3f\n", d);
7497 }
7498 EOCP
7499         set try
7500         if eval $compile; then
7501                 yyy=`./try$exe_ext`
7502                 case "$yyy" in
7503                 123.456)
7504                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7505                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7506                         echo "We will use %f."
7507                         ;;
7508                 esac
7509         fi
7510 fi
7511
7512 if $test X"$sPRIfldbl" = X; then
7513         $cat >try.c <<'EOCP'
7514 #include <sys/types.h>
7515 #include <stdio.h>
7516 int main() {
7517   long double d = 123.456;
7518   printf("%.3llf\n", d);
7519 }
7520 EOCP
7521         set try
7522         if eval $compile; then
7523                 yyy=`./try$exe_ext`
7524                 case "$yyy" in
7525                 123.456)
7526                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7527                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7528                         echo "We will use %llf."
7529                         ;;
7530                 esac
7531         fi
7532 fi
7533
7534 if $test X"$sPRIfldbl" = X; then
7535         $cat >try.c <<'EOCP'
7536 #include <sys/types.h>
7537 #include <stdio.h>
7538 int main() {
7539   long double d = 123.456;
7540   printf("%.3Lf\n", d);
7541 }
7542 EOCP
7543         set try
7544         if eval $compile; then
7545                 yyy=`./try$exe_ext`
7546                 case "$yyy" in
7547                 123.456)
7548                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7549                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7550                         echo "We will use %Lf."
7551                         ;;
7552                 esac
7553         fi
7554 fi
7555
7556 if $test X"$sPRIfldbl" = X; then
7557         $cat >try.c <<'EOCP'
7558 #include <sys/types.h>
7559 #include <stdio.h>
7560 int main() {
7561   long double d = 123.456;
7562   printf("%.3lf\n", d);
7563 }
7564 EOCP
7565         set try
7566         if eval $compile; then
7567                 yyy=`./try$exe_ext`
7568                 case "$yyy" in
7569                 123.456)
7570                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7571                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7572                         echo "We will use %lf."
7573                         ;;
7574                 esac
7575         fi
7576 fi
7577
7578 if $test X"$sPRIfldbl" = X; then
7579         echo "Cannot figure out how to print long doubles." >&4
7580 fi
7581
7582 $rm -f try try.*
7583
7584 fi # d_longdbl
7585
7586 case "$sPRIfldbl" in
7587 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7588         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7589         ;;
7590 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7591         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7592         ;;
7593 esac
7594
7595 : Check how to convert floats to strings.
7596 if test "X$d_Gconvert" = X; then
7597         echo " "
7598         echo "Checking for an efficient way to convert floats to strings."
7599         echo " " > try.c
7600         case "$uselongdouble" in
7601         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7602         esac
7603         case "$d_longdbl" in
7604         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7605         esac
7606         case "$d_PRIgldbl" in
7607         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7608         esac
7609         $cat >>try.c <<EOP
7610 #ifdef TRY_gconvert
7611 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7612 char *myname = "gconvert";
7613 #endif
7614 #ifdef TRY_gcvt
7615 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7616 char *myname = "gcvt";
7617 #endif
7618 #ifdef TRY_qgcvt
7619 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7620 char *myname = "qgcvt";
7621 #define DOUBLETYPE long double
7622 #endif
7623 #ifdef TRY_sprintf
7624 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7625 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7626 #else
7627 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7628 #endif
7629 char *myname = "sprintf";
7630 #endif
7631
7632 #ifndef DOUBLETYPE
7633 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7634 #define DOUBLETYPE long double
7635 #else
7636 #define DOUBLETYPE double
7637 #endif
7638 #endif
7639
7640 #include <stdio.h>
7641
7642 #define I_STDLIB $i_stdlib
7643 #ifdef I_STDLIB
7644 #include <stdlib.h>
7645 #endif
7646
7647 int
7648 checkit(expect, got)
7649 char *expect;
7650 char *got;
7651 {
7652     if (strcmp(expect, got)) {
7653                 printf("%s oddity:  Expected %s, got %s\n",
7654                         myname, expect, got);
7655                 exit(1);
7656         }
7657 }
7658
7659 int main()
7660
7661         char buf[64]; 
7662         buf[63] = '\0';
7663
7664         /* This must be 1st test on (which?) platform */
7665         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7666         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7667         checkit("0.1", buf);
7668
7669         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7670         checkit("1", buf);
7671
7672         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7673         checkit("1.1", buf);
7674
7675         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7676         checkit("1.01", buf);
7677
7678         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7679         checkit("1.001", buf);
7680
7681         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7682         checkit("1.0001", buf);
7683
7684         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7685         checkit("1.00001", buf);
7686
7687         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7688         checkit("1.000001", buf);
7689
7690         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7691         checkit("0", buf);
7692
7693         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7694         checkit("-1", buf);
7695
7696         /* Some Linux gcvt's give 1.e+5 here. */
7697         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7698         checkit("100000", buf);
7699         
7700         /* Some Linux gcvt's give -1.e+5 here. */
7701         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7702         checkit("-100000", buf);
7703
7704         exit(0);
7705 }
7706 EOP
7707         case "$d_Gconvert" in
7708         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7709         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7710         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7711         *) xxx_list='gconvert gcvt sprintf' ;;
7712         esac
7713
7714         case "$d_longdbl$uselongdouble$d_qgcvt" in
7715         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7716         esac
7717
7718         for xxx_convert in $xxx_list; do
7719                 echo "Trying $xxx_convert..."
7720                 $rm -f try try$_o
7721                 set try -DTRY_$xxx_convert
7722                 if eval $compile; then
7723                         echo "$xxx_convert() found." >&4
7724                         if ./try; then
7725                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7726                                 break;
7727                         else
7728                                 echo "...But $xxx_convert didn't work as I expected."
7729                         fi
7730                 else
7731                         echo "$xxx_convert NOT found." >&4
7732                 fi
7733         done
7734                 
7735         case "$xxx_convert" in
7736         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7737         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7738         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7739         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7740            "$define$define$define")
7741               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7742            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7743            esac
7744            ;;  
7745         esac
7746 fi
7747
7748 : Initialize h_fcntl
7749 h_fcntl=false
7750
7751 : Initialize h_sysfile
7752 h_sysfile=false
7753
7754 : access call always available on UNIX
7755 set access d_access
7756 eval $inlibc
7757
7758 : locate the flags for 'access()'
7759 case "$d_access" in
7760 "$define")
7761         echo " "
7762         $cat >access.c <<'EOCP'
7763 #include <sys/types.h>
7764 #ifdef I_FCNTL
7765 #include <fcntl.h>
7766 #endif
7767 #ifdef I_SYS_FILE
7768 #include <sys/file.h>
7769 #endif
7770 #ifdef I_UNISTD
7771 #include <unistd.h>
7772 #endif
7773 int main() {
7774         exit(R_OK);
7775 }
7776 EOCP
7777         : check sys/file.h first, no particular reason here
7778         if $test `./findhdr sys/file.h` && \
7779                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7780                 h_sysfile=true;
7781                 echo "<sys/file.h> defines the *_OK access constants." >&4
7782         elif $test `./findhdr fcntl.h` && \
7783                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7784                 h_fcntl=true;
7785                 echo "<fcntl.h> defines the *_OK access constants." >&4
7786         elif $test `./findhdr unistd.h` && \
7787                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7788                 echo "<unistd.h> defines the *_OK access constants." >&4
7789         else
7790                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7791         fi
7792         ;;
7793 esac
7794 $rm -f access*
7795
7796 : see if accessx exists
7797 set accessx d_accessx
7798 eval $inlibc
7799
7800 : see if alarm exists
7801 set alarm d_alarm
7802 eval $inlibc
7803
7804 : see if atolf exists
7805 set atolf d_atolf
7806 eval $inlibc
7807
7808 : see if atoll exists
7809 set atoll d_atoll
7810 eval $inlibc
7811
7812 : Look for GNU-cc style attribute checking
7813 echo " "
7814 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7815 $cat >attrib.c <<'EOCP'
7816 #include <stdio.h>
7817 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7818 EOCP
7819 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7820         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7821                 echo "Your C compiler doesn't fully support __attribute__."
7822                 val="$undef"
7823         else
7824                 echo "Your C compiler supports __attribute__."
7825                 val="$define"
7826         fi
7827 else
7828         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7829         val="$undef"
7830 fi
7831 set d_attribut
7832 eval $setvar
7833 $rm -f attrib*
7834
7835 : see if bcmp exists
7836 set bcmp d_bcmp
7837 eval $inlibc
7838
7839 : see if bcopy exists
7840 set bcopy d_bcopy
7841 eval $inlibc
7842
7843 : see if this is a unistd.h system
7844 set unistd.h i_unistd
7845 eval $inhdr
7846
7847 : see if getpgrp exists
7848 set getpgrp d_getpgrp
7849 eval $inlibc
7850
7851 case "$d_getpgrp" in
7852 "$define")
7853         echo " "
7854         echo "Checking to see which flavor of getpgrp is in use..."
7855         $cat >set.c <<EOP
7856 #$i_unistd I_UNISTD
7857 #include <sys/types.h>
7858 #ifdef I_UNISTD
7859 #  include <unistd.h>
7860 #endif
7861 int main()
7862 {
7863         if (getuid() == 0) {
7864                 printf("(I see you are running Configure as super-user...)\n");
7865                 setuid(1);
7866         }
7867 #ifdef TRY_BSD_PGRP
7868         if (getpgrp(1) == 0)
7869                 exit(0);
7870 #else
7871         if (getpgrp() > 0)
7872                 exit(0);
7873 #endif
7874         exit(1);
7875 }
7876 EOP
7877         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7878                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7879                 val="$define"
7880         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7881                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7882                 val="$undef"
7883         else
7884                 echo "I can't seem to compile and run the test program."
7885                 if ./usg; then
7886                         xxx="a USG one, i.e. you use getpgrp()."
7887                 else
7888                         # SVR4 systems can appear rather BSD-ish.
7889                         case "$i_unistd" in
7890                         $undef)
7891                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7892                                 val="$define"
7893                                 ;;
7894                         $define)
7895                                 xxx="probably a USG one, i.e. you use getpgrp()."
7896                                 val="$undef"
7897                                 ;;
7898                         esac
7899                 fi
7900                 echo "Assuming your getpgrp is $xxx" >&4
7901         fi
7902         ;;
7903 *) val="$undef";;
7904 esac
7905 set d_bsdgetpgrp
7906 eval $setvar
7907 $rm -f set set.c
7908
7909 : see if setpgrp exists
7910 set setpgrp d_setpgrp
7911 eval $inlibc
7912
7913 case "$d_setpgrp" in
7914 "$define")
7915         echo " "
7916         echo "Checking to see which flavor of setpgrp is in use..."
7917         $cat >set.c <<EOP
7918 #$i_unistd I_UNISTD
7919 #include <sys/types.h>
7920 #ifdef I_UNISTD
7921 #  include <unistd.h>
7922 #endif
7923 int main()
7924 {
7925         if (getuid() == 0) {
7926                 printf("(I see you are running Configure as super-user...)\n");
7927                 setuid(1);
7928         }
7929 #ifdef TRY_BSD_PGRP
7930         if (-1 == setpgrp(1, 1))
7931                 exit(0);
7932 #else
7933         if (setpgrp() != -1)
7934                 exit(0);
7935 #endif
7936         exit(1);
7937 }
7938 EOP
7939         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7940                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7941                 val="$define"
7942         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7943                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7944                 val="$undef"
7945         else
7946                 echo "(I can't seem to compile and run the test program.)"
7947                 if ./usg; then
7948                         xxx="a USG one, i.e. you use setpgrp()."
7949                 else
7950                         # SVR4 systems can appear rather BSD-ish.
7951                         case "$i_unistd" in
7952                         $undef)
7953                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7954                                 val="$define"
7955                                 ;;
7956                         $define)
7957                                 xxx="probably a USG one, i.e. you use setpgrp()."
7958                                 val="$undef"
7959                                 ;;
7960                         esac
7961                 fi
7962                 echo "Assuming your setpgrp is $xxx" >&4
7963         fi
7964         ;;
7965 *) val="$undef";;
7966 esac
7967 set d_bsdsetpgrp
7968 eval $setvar
7969 $rm -f set set.c
7970 : see if bzero exists
7971 set bzero d_bzero
7972 eval $inlibc
7973
7974 : see if signal is declared as pointer to function returning int or void
7975 echo " "
7976 xxx=`./findhdr signal.h`
7977 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7978 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7979         echo "You have int (*signal())() instead of void." >&4
7980         val="$undef"
7981 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7982         echo "You have void (*signal())()." >&4
7983         val="$define"
7984 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7985         echo "You have int (*signal())() instead of void." >&4
7986         val="$undef"
7987 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7988         echo "You have void (*signal())()." >&4
7989         val="$define"
7990 else
7991         case "$d_voidsig" in
7992         '')
7993         echo "I can't determine whether signal handler returns void or int..." >&4
7994                 dflt=void
7995                 rp="What type does your signal handler return?"
7996                 . ./myread
7997                 case "$ans" in
7998                 v*) val="$define";;
7999                 *) val="$undef";;
8000                 esac;;
8001         "$define")
8002                 echo "As you already told me, signal handler returns void." >&4
8003                 val="$define"
8004                 ;;
8005         *)      echo "As you already told me, signal handler returns int." >&4
8006                 val="$undef"
8007                 ;;
8008         esac
8009 fi
8010 set d_voidsig
8011 eval $setvar
8012 case "$d_voidsig" in
8013 "$define") signal_t="void";;
8014 *) signal_t="int";;
8015 esac
8016 $rm -f $$.tmp
8017
8018 : check for ability to cast large floats to 32-bit ints.
8019 echo " "
8020 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8021 if $test "$intsize" -ge 4; then
8022         xxx=int
8023 else
8024         xxx=long
8025 fi
8026 $cat >try.c <<EOCP
8027 #include <stdio.h>
8028 #include <sys/types.h>
8029 #include <signal.h>
8030 $signal_t blech(s) int s; { exit(3); }
8031 int main()
8032 {
8033         $xxx i32;
8034         double f, g;
8035         int result = 0;
8036         char str[16];
8037         signal(SIGFPE, blech);
8038
8039         /* Don't let compiler optimize the test away.  Store the number 
8040            in a writable string for gcc to pass to sscanf under HP/UX.
8041         */
8042         sprintf(str, "2147483647");
8043         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8044         g = 10 * f;
8045         i32  = ($xxx) g;
8046
8047         /* x86 processors will probably give 0x8000 0000, which is a
8048        sign change.  We don't want that.  We want to mimic SPARC
8049            behavior here, which is to preserve the sign and give
8050            back 0x7fff ffff.
8051         */
8052         if (i32 != ($xxx) f)
8053                 result |= 1;
8054         exit(result);
8055 }
8056 EOCP
8057 set try
8058 if eval $compile_ok; then
8059         ./try
8060         yyy=$?
8061 else
8062         echo "(I can't seem to compile the test program--assuming it can't)"
8063         yyy=1
8064 fi
8065 case "$yyy" in
8066 0)      val="$define"
8067         echo "Yup, it can."
8068         ;;
8069 *)      val="$undef"
8070         echo "Nope, it can't."
8071         ;;
8072 esac
8073 set d_casti32
8074 eval $setvar
8075 $rm -f try try.*
8076
8077 : check for ability to cast negative floats to unsigned
8078 echo " "
8079 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8080 $cat >try.c <<EOCP
8081 #include <stdio.h>
8082 #include <sys/types.h>
8083 #include <signal.h>
8084 $signal_t blech(s) int s; { exit(7); }
8085 $signal_t blech_in_list(s) int s; { exit(4); }
8086 unsigned long dummy_long(p) unsigned long p; { return p; }
8087 unsigned int dummy_int(p) unsigned int p; { return p; }
8088 unsigned short dummy_short(p) unsigned short p; { return p; }
8089 int main()
8090 {
8091         double f;
8092         unsigned long along;
8093         unsigned int aint;
8094         unsigned short ashort;
8095         int result = 0;
8096         char str[16];
8097         
8098         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8099            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8100            optimized the whole file away
8101         */
8102         /* Store the number in a writable string for gcc to pass to 
8103            sscanf under HP/UX.
8104         */
8105         sprintf(str, "-123");
8106         sscanf(str, "%lf", &f);  /* f = -123.; */
8107
8108         signal(SIGFPE, blech);
8109         along = (unsigned long)f;
8110         aint = (unsigned int)f;
8111         ashort = (unsigned short)f;
8112         if (along != (unsigned long)-123)
8113                 result |= 1;
8114         if (aint != (unsigned int)-123)
8115                 result |= 1;
8116         if (ashort != (unsigned short)-123)
8117                 result |= 1;
8118         sprintf(str, "1073741824.");
8119         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8120         f = f + f;
8121         along = 0;
8122         along = (unsigned long)f;
8123         if (along != 0x80000000)
8124                 result |= 2;
8125         f -= 1.;
8126         along = 0;
8127         along = (unsigned long)f;
8128         if (along != 0x7fffffff)
8129                 result |= 1;
8130         f += 2.;
8131         along = 0;
8132         along = (unsigned long)f;
8133         if (along != 0x80000001)
8134                 result |= 2;
8135         if (result)
8136                 exit(result);
8137         signal(SIGFPE, blech_in_list);
8138         sprintf(str, "123.");
8139         sscanf(str, "%lf", &f);  /* f = 123.; */
8140         along = dummy_long((unsigned long)f);
8141         aint = dummy_int((unsigned int)f);
8142         ashort = dummy_short((unsigned short)f);
8143         if (along != (unsigned long)123)
8144                 result |= 4;
8145         if (aint != (unsigned int)123)
8146                 result |= 4;
8147         if (ashort != (unsigned short)123)
8148                 result |= 4;
8149         exit(result);
8150
8151 }
8152 EOCP
8153 set try
8154 if eval $compile_ok; then
8155         ./try
8156         castflags=$?
8157 else
8158         echo "(I can't seem to compile the test program--assuming it can't)"
8159         castflags=7
8160 fi
8161 case "$castflags" in
8162 0)      val="$define"
8163         echo "Yup, it can."
8164         ;;
8165 *)      val="$undef"
8166         echo "Nope, it can't."
8167         ;;
8168 esac
8169 set d_castneg
8170 eval $setvar
8171 $rm -f try.*
8172
8173 : see if vprintf exists
8174 echo " "
8175 if set vprintf val -f d_vprintf; eval $csym; $val; then
8176         echo 'vprintf() found.' >&4
8177         val="$define"
8178         $cat >vprintf.c <<'EOF'
8179 #include <varargs.h>
8180
8181 int main() { xxx("foo"); }
8182
8183 xxx(va_alist)
8184 va_dcl
8185 {
8186         va_list args;
8187         char buf[10];
8188
8189         va_start(args);
8190         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8191 }
8192 EOF
8193         set vprintf
8194         if eval $compile && ./vprintf; then
8195                 echo "Your vsprintf() returns (int)." >&4
8196                 val2="$undef"
8197         else
8198                 echo "Your vsprintf() returns (char*)." >&4
8199                 val2="$define"
8200         fi
8201 else
8202         echo 'vprintf() NOT found.' >&4
8203                 val="$undef"
8204                 val2="$undef"
8205 fi
8206 set d_vprintf
8207 eval $setvar
8208 val=$val2
8209 set d_charvspr
8210 eval $setvar
8211
8212 : see if chown exists
8213 set chown d_chown
8214 eval $inlibc
8215
8216 : see if chroot exists
8217 set chroot d_chroot
8218 eval $inlibc
8219
8220 : see if chsize exists
8221 set chsize d_chsize
8222 eval $inlibc
8223
8224 : check for const keyword
8225 echo " "
8226 echo 'Checking to see if your C compiler knows about "const"...' >&4
8227 $cat >const.c <<'EOCP'
8228 typedef struct spug { int drokk; } spug;
8229 int main()
8230 {
8231         const char *foo;
8232         const spug y;
8233 }
8234 EOCP
8235 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8236         val="$define"
8237         echo "Yup, it does."
8238 else
8239         val="$undef"
8240         echo "Nope, it doesn't."
8241 fi
8242 set d_const
8243 eval $setvar
8244
8245 : see if crypt exists
8246 echo " "
8247 if set crypt val -f d_crypt; eval $csym; $val; then
8248         echo 'crypt() found.' >&4
8249         val="$define"
8250         cryptlib=''
8251 else
8252         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8253         if $test -z "$cryptlib"; then
8254                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8255         else
8256                 cryptlib=-lcrypt
8257         fi
8258         if $test -z "$cryptlib"; then
8259                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8260         else
8261                 cryptlib=-lcrypt
8262         fi
8263         if $test -z "$cryptlib"; then
8264                 cryptlib=`./loc libcrypt$_a "" $libpth`
8265         else
8266                 cryptlib=-lcrypt
8267         fi
8268         if $test -z "$cryptlib"; then
8269                 echo 'crypt() NOT found.' >&4
8270                 val="$undef"
8271         else
8272                 val="$define"
8273         fi
8274 fi
8275 set d_crypt
8276 eval $setvar
8277
8278 : get csh whereabouts
8279 case "$csh" in
8280 'csh') val="$undef" ;;
8281 *) val="$define" ;;
8282 esac
8283 set d_csh
8284 eval $setvar
8285 : Respect a hint or command line value for full_csh.
8286 case "$full_csh" in
8287 '') full_csh=$csh ;;
8288 esac
8289
8290 : see if cuserid exists
8291 set cuserid d_cuserid
8292 eval $inlibc
8293
8294 : see if this is a limits.h system
8295 set limits.h i_limits
8296 eval $inhdr
8297
8298 : see if this is a float.h system
8299 set float.h i_float
8300 eval $inhdr
8301
8302 : See if number of significant digits in a double precision number is known
8303 echo " "
8304 $cat >dbl_dig.c <<EOM
8305 #$i_limits I_LIMITS
8306 #$i_float I_FLOAT
8307 #ifdef I_LIMITS
8308 #include <limits.h>
8309 #endif
8310 #ifdef I_FLOAT
8311 #include <float.h>
8312 #endif
8313 #ifdef DBL_DIG
8314 printf("Contains DBL_DIG");
8315 #endif
8316 EOM
8317 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8318 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8319         echo "DBL_DIG found." >&4
8320         val="$define"
8321 else
8322         echo "DBL_DIG NOT found." >&4
8323         val="$undef"
8324 fi
8325 $rm -f dbl_dig.?
8326 set d_dbl_dig
8327 eval $setvar
8328
8329 : see if difftime exists
8330 set difftime d_difftime
8331 eval $inlibc
8332
8333 : see if this is a dirent system
8334 echo " "
8335 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8336         val="$define"
8337         echo "<dirent.h> found." >&4
8338 else
8339         val="$undef"
8340         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8341                 echo "<sys/dir.h> found." >&4
8342                 echo " "
8343         else
8344                 xinc=`./findhdr sys/ndir.h`
8345         fi
8346         echo "<dirent.h> NOT found." >&4
8347 fi
8348 set i_dirent
8349 eval $setvar
8350
8351 : Look for type of directory structure.
8352 echo " "
8353 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8354
8355 case "$direntrytype" in
8356 ''|' ')
8357         case "$i_dirent" in
8358         $define) guess1='struct dirent' ;;
8359         *) guess1='struct direct'  ;;
8360         esac
8361         ;;
8362 *)      guess1="$direntrytype"
8363         ;;
8364 esac
8365
8366 case "$guess1" in
8367 'struct dirent') guess2='struct direct' ;;
8368 *) guess2='struct dirent' ;;
8369 esac
8370                 
8371 if $contains "$guess1" try.c >/dev/null 2>&1; then
8372         direntrytype="$guess1"
8373         echo "Your directory entries are $direntrytype." >&4
8374 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8375         direntrytype="$guess2"
8376         echo "Your directory entries seem to be $direntrytype." >&4
8377 else
8378         echo "I don't recognize your system's directory entries." >&4
8379         rp="What type is used for directory entries on this system?"
8380         dflt="$guess1"
8381         . ./myread
8382         direntrytype="$ans"
8383 fi
8384 $rm -f try.c
8385
8386
8387 : see if the directory entry stores field length
8388 echo " "
8389 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8390 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8391         echo "Good, your directory entry keeps length information in d_namlen." >&4
8392         val="$define"
8393 else
8394         echo "Your directory entry does not know about the d_namlen field." >&4
8395         val="$undef"
8396 fi
8397 set d_dirnamlen
8398 eval $setvar
8399 $rm -f try.c
8400
8401 : see if dlerror exists
8402 xxx_runnm="$runnm"
8403 runnm=false
8404 set dlerror d_dlerror
8405 eval $inlibc
8406 runnm="$xxx_runnm"
8407
8408 : see if dlfcn is available
8409 set dlfcn.h i_dlfcn
8410 eval $inhdr
8411
8412 case "$usedl" in
8413 $define|y|true)
8414         $cat << EOM
8415
8416 On a few systems, the dynamically loaded modules that perl generates and uses
8417 will need a different extension than shared libs. The default will probably
8418 be appropriate.
8419
8420 EOM
8421         case "$dlext" in
8422         '')     dflt="$so" ;;
8423         *)      dflt="$dlext" ;;
8424         esac
8425         rp='What is the extension of dynamically loaded modules'
8426         . ./myread
8427         dlext="$ans"
8428         ;;
8429 *)
8430         dlext="none"
8431         ;;
8432 esac
8433
8434 : Check if dlsym need a leading underscore
8435 echo " "
8436 val="$undef"
8437
8438 case "$dlsrc" in
8439 dl_dlopen.xs)
8440         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8441         $cat >dyna.c <<'EOM'
8442 fred () { }
8443 EOM
8444
8445 $cat >fred.c<<EOM
8446
8447 #include <stdio.h>
8448 #$i_dlfcn I_DLFCN
8449 #ifdef I_DLFCN
8450 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8451 #else
8452 #include <sys/types.h>
8453 #include <nlist.h>
8454 #include <link.h>
8455 #endif
8456
8457 extern int fred() ;
8458
8459 int main()
8460 {
8461     void * handle ;
8462     void * symbol ;
8463 #ifndef RTLD_LAZY
8464     int mode = 1 ;
8465 #else
8466     int mode = RTLD_LAZY ;
8467 #endif
8468     handle = dlopen("./dyna.$dlext", mode) ;
8469     if (handle == NULL) {
8470         printf ("1\n") ;
8471         fflush (stdout) ;
8472         exit(0);
8473     }
8474     symbol = dlsym(handle, "fred") ;
8475     if (symbol == NULL) {
8476         /* try putting a leading underscore */
8477         symbol = dlsym(handle, "_fred") ;
8478         if (symbol == NULL) {
8479             printf ("2\n") ;
8480             fflush (stdout) ;
8481             exit(0);
8482         }
8483         printf ("3\n") ;
8484     }
8485     else
8486         printf ("4\n") ;
8487     fflush (stdout) ;
8488     exit(0);
8489 }
8490 EOM
8491         : Call the object file tmp-dyna.o in case dlext=o.
8492         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8493                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8494                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8495                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8496                 xxx=`./fred`
8497                 case $xxx in
8498                 1)      echo "Test program failed using dlopen." >&4
8499                         echo "Perhaps you should not use dynamic loading." >&4;;
8500                 2)      echo "Test program failed using dlsym." >&4
8501                         echo "Perhaps you should not use dynamic loading." >&4;;
8502                 3)      echo "dlsym needs a leading underscore" >&4
8503                         val="$define" ;;
8504                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8505                 esac
8506         else
8507                 echo "I can't compile and run the test program." >&4
8508                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8509         fi
8510         ;;
8511 esac
8512                 
8513 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8514
8515 set d_dlsymun
8516 eval $setvar
8517
8518 hasproto='varname=$1; func=$2; shift; shift;
8519 while $test $# -ge 2; do
8520         case "$1" in
8521         $define) echo "#include <$2>";;
8522         esac ;
8523     shift 2;
8524 done > try.c;
8525 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8526 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8527         echo "$func() prototype found.";
8528         val="$define";
8529 else
8530         echo "$func() prototype NOT found.";
8531         val="$undef";
8532 fi;
8533 set $varname;
8534 eval $setvar;
8535 $rm -f try.c tryout.c'
8536
8537 : see if prototype for drand48 is available
8538 echo " "
8539 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8540 eval $hasproto
8541
8542 : see if dup2 exists
8543 set dup2 d_dup2
8544 eval $inlibc
8545
8546 : see if eaccess exists
8547 set eaccess d_eaccess
8548 eval $inlibc
8549
8550 : see if endgrent exists
8551 set endgrent d_endgrent
8552 eval $inlibc
8553
8554 : see if endhostent exists
8555 set endhostent d_endhent
8556 eval $inlibc
8557
8558 : see if endnetent exists
8559 set endnetent d_endnent
8560 eval $inlibc
8561
8562 : see if endprotoent exists
8563 set endprotoent d_endpent
8564 eval $inlibc
8565
8566 : see if endpwent exists
8567 set endpwent d_endpwent
8568 eval $inlibc
8569
8570 : see if endservent exists
8571 set endservent d_endsent
8572 eval $inlibc
8573
8574 : Locate the flags for 'open()'
8575 echo " "
8576 $cat >open3.c <<'EOCP'
8577 #include <sys/types.h>
8578 #ifdef I_FCNTL
8579 #include <fcntl.h>
8580 #endif
8581 #ifdef I_SYS_FILE
8582 #include <sys/file.h>
8583 #endif
8584 int main() {
8585         if(O_RDONLY);
8586 #ifdef O_TRUNC
8587         exit(0);
8588 #else
8589         exit(1);
8590 #endif
8591 }
8592 EOCP
8593 : check sys/file.h first to get FREAD on Sun
8594 if $test `./findhdr sys/file.h` && \
8595                 set open3 -DI_SYS_FILE && eval $compile; then
8596         h_sysfile=true;
8597         echo "<sys/file.h> defines the O_* constants..." >&4
8598         if ./open3; then
8599                 echo "and you have the 3 argument form of open()." >&4
8600                 val="$define"
8601         else
8602                 echo "but not the 3 argument form of open().  Oh, well." >&4
8603                 val="$undef"
8604         fi
8605 elif $test `./findhdr fcntl.h` && \
8606                 set open3 -DI_FCNTL && eval $compile; then
8607         h_fcntl=true;
8608         echo "<fcntl.h> defines the O_* constants..." >&4
8609         if ./open3; then
8610                 echo "and you have the 3 argument form of open()." >&4
8611                 val="$define"
8612         else
8613                 echo "but not the 3 argument form of open().  Oh, well." >&4
8614                 val="$undef"
8615         fi
8616 else
8617         val="$undef"
8618         echo "I can't find the O_* constant definitions!  You got problems." >&4
8619 fi
8620 set d_open3
8621 eval $setvar
8622 $rm -f open3*
8623
8624 : see which of string.h or strings.h is needed
8625 echo " "
8626 strings=`./findhdr string.h`
8627 if $test "$strings" && $test -r "$strings"; then
8628         echo "Using <string.h> instead of <strings.h>." >&4
8629         val="$define"
8630 else
8631         val="$undef"
8632         strings=`./findhdr strings.h`
8633         if $test "$strings" && $test -r "$strings"; then
8634                 echo "Using <strings.h> instead of <string.h>." >&4
8635         else
8636                 echo "No string header found -- You'll surely have problems." >&4
8637         fi
8638 fi
8639 set i_string
8640 eval $setvar
8641 case "$i_string" in
8642 "$undef") strings=`./findhdr strings.h`;;
8643 *)        strings=`./findhdr string.h`;;
8644 esac
8645
8646 : check for non-blocking I/O stuff
8647 case "$h_sysfile" in
8648 true) echo "#include <sys/file.h>" > head.c;;
8649 *)
8650         case "$h_fcntl" in
8651         true) echo "#include <fcntl.h>" > head.c;;
8652         *) echo "#include <sys/fcntl.h>" > head.c;;
8653         esac
8654         ;;
8655 esac
8656 echo " "
8657 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8658 case "$o_nonblock" in
8659 '')
8660         $cat head.c > try.c
8661         $cat >>try.c <<'EOCP'
8662 #include <stdio.h>
8663 int main() {
8664 #ifdef O_NONBLOCK
8665         printf("O_NONBLOCK\n");
8666         exit(0);
8667 #endif
8668 #ifdef O_NDELAY
8669         printf("O_NDELAY\n");
8670         exit(0);
8671 #endif
8672 #ifdef FNDELAY
8673         printf("FNDELAY\n");
8674         exit(0);
8675 #endif
8676         exit(0);
8677 }
8678 EOCP
8679         set try
8680         if eval $compile_ok; then
8681                 o_nonblock=`./try`
8682                 case "$o_nonblock" in
8683                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8684                 *) echo "Seems like we can use $o_nonblock.";;
8685                 esac
8686         else
8687                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8688         fi
8689         ;;
8690 *) echo "Using $hint value $o_nonblock.";;
8691 esac
8692 $rm -f try try.* .out core
8693
8694 echo " "
8695 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8696 case "$eagain" in
8697 '')
8698         $cat head.c > try.c
8699         $cat >>try.c <<EOCP
8700 #include <errno.h>
8701 #include <sys/types.h>
8702 #include <signal.h>
8703 #include <stdio.h> 
8704 #define MY_O_NONBLOCK $o_nonblock
8705 #ifndef errno  /* XXX need better Configure test */
8706 extern int errno;
8707 #endif
8708 #$i_unistd I_UNISTD
8709 #ifdef I_UNISTD
8710 #include <unistd.h>
8711 #endif
8712 #$i_string I_STRING
8713 #ifdef I_STRING
8714 #include <string.h>
8715 #else
8716 #include <strings.h>
8717 #endif
8718 $signal_t blech(x) int x; { exit(3); }
8719 EOCP
8720         $cat >> try.c <<'EOCP'
8721 int main()
8722 {
8723         int pd[2];
8724         int pu[2];
8725         char buf[1];
8726         char string[100];
8727
8728         pipe(pd);       /* Down: child -> parent */
8729         pipe(pu);       /* Up: parent -> child */
8730         if (0 != fork()) {
8731                 int ret;
8732                 close(pd[1]);   /* Parent reads from pd[0] */
8733                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8734                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8735                         exit(1);
8736                 signal(SIGALRM, blech);
8737                 alarm(5);
8738                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8739                         exit(2);
8740                 sprintf(string, "%d\n", ret);
8741                 write(2, string, strlen(string));
8742                 alarm(0);
8743 #ifdef EAGAIN
8744                 if (errno == EAGAIN) {
8745                         printf("EAGAIN\n");
8746                         goto ok;
8747                 }
8748 #endif
8749 #ifdef EWOULDBLOCK
8750                 if (errno == EWOULDBLOCK)
8751                         printf("EWOULDBLOCK\n");
8752 #endif
8753         ok:
8754                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8755                 sleep(2);                               /* Give it time to close our pipe */
8756                 alarm(5);
8757                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8758                 alarm(0);
8759                 sprintf(string, "%d\n", ret);
8760                 write(3, string, strlen(string));
8761                 exit(0);
8762         }
8763
8764         close(pd[0]);                   /* We write to pd[1] */
8765         close(pu[1]);                   /* We read from pu[0] */
8766         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8767         close(pd[1]);                   /* Pipe pd is now fully closed! */
8768         exit(0);                                /* Bye bye, thank you for playing! */
8769 }
8770 EOCP
8771         set try
8772         if eval $compile_ok; then
8773                 echo "$startsh" >mtry
8774                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8775                 chmod +x mtry
8776                 ./mtry >/dev/null 2>&1
8777                 case $? in
8778                 0) eagain=`$cat try.out`;;
8779                 1) echo "Could not perform non-blocking setting!";;
8780                 2) echo "I did a successful read() for something that was not there!";;
8781                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8782                 *) echo "Something terribly wrong happened during testing.";;
8783                 esac
8784                 rd_nodata=`$cat try.ret`
8785                 echo "A read() system call with no data present returns $rd_nodata."
8786                 case "$rd_nodata" in
8787                 0|-1) ;;
8788                 *)
8789                         echo "(That's peculiar, fixing that to be -1.)"
8790                         rd_nodata=-1
8791                         ;;
8792                 esac
8793                 case "$eagain" in
8794                 '')
8795                         echo "Forcing errno EAGAIN on read() with no data available."
8796                         eagain=EAGAIN
8797                         ;;
8798                 *)
8799                         echo "Your read() sets errno to $eagain when no data is available."
8800                         ;;
8801                 esac
8802                 status=`$cat try.err`
8803                 case "$status" in
8804                 0) echo "And it correctly returns 0 to signal EOF.";;
8805                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8806                 *) echo "However, your read() returns '$status' on EOF??";;
8807                 esac
8808                 val="$define"
8809                 if test "$status" = "$rd_nodata"; then
8810                         echo "WARNING: you can't distinguish between EOF and no data!"
8811                         val="$undef"
8812                 fi
8813         else
8814                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8815                 eagain=EAGAIN
8816         fi
8817         set d_eofnblk
8818         eval $setvar
8819         ;;
8820 *)
8821         echo "Using $hint value $eagain."
8822         echo "Your read() returns $rd_nodata when no data is present."
8823         case "$d_eofnblk" in
8824         "$define") echo "And you can see EOF because read() returns 0.";;
8825         "$undef") echo "But you can't see EOF status from read() returned value.";;
8826         *)
8827                 echo "(Assuming you can't see EOF status from read anyway.)"
8828                 d_eofnblk=$undef
8829                 ;;
8830         esac
8831         ;;
8832 esac
8833 $rm -f try try.* .out core head.c mtry
8834
8835 : see if fchmod exists
8836 set fchmod d_fchmod
8837 eval $inlibc
8838
8839 : see if fchown exists
8840 set fchown d_fchown
8841 eval $inlibc
8842
8843 : see if this is an fcntl system
8844 set fcntl d_fcntl
8845 eval $inlibc
8846
8847 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8848 while $test $# -ge 2; do
8849         case "$1" in
8850         $define) echo "#include <$2>";;
8851         esac ;
8852     shift 2;
8853 done > try.c;
8854 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8855 set try;
8856 if eval $compile; then
8857         val="$define";
8858 else
8859         val="$undef";
8860 fi;
8861 set $varname;
8862 eval $setvar;
8863 $rm -f try.c try.o'
8864
8865 socketlib=''
8866 sockethdr=''
8867 : see whether socket exists
8868 echo " "
8869 $echo $n "Hmm... $c" >&4
8870 if set socket val -f d_socket; eval $csym; $val; then
8871         echo "Looks like you have Berkeley networking support." >&4
8872         d_socket="$define"
8873         if set setsockopt val -f; eval $csym; $val; then
8874                 d_oldsock="$undef"
8875         else
8876                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8877                 d_oldsock="$define"
8878         fi
8879 else
8880         if $contains socklib libc.list >/dev/null 2>&1; then
8881                 echo "Looks like you have Berkeley networking support." >&4
8882                 d_socket="$define"
8883                 : we will have to assume that it supports the 4.2 BSD interface
8884                 d_oldsock="$undef"
8885         else
8886                 echo "You don't have Berkeley networking in libc$_a..." >&4
8887                 if test "X$d_socket" = "X$define"; then
8888                    echo "...but you seem to believe that you have sockets." >&4
8889                 else
8890                         for net in net socket
8891                         do
8892                                 if test -f /usr/lib/lib$net$_a; then
8893                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8894                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8895                                         if $contains socket libc.list >/dev/null 2>&1; then
8896                                                 d_socket="$define"
8897                                                 socketlib="-l$net"
8898                                                 case "$net" in
8899                                                 net)
8900                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8901                                                         sockethdr="-I/usr/netinclude"
8902                                                         ;;
8903                                                 esac
8904                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8905                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8906                                                         d_oldsock="$undef"
8907                                                 else
8908                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8909                                                         d_oldsock="$define"
8910                                                 fi
8911                                                 break
8912                                         fi
8913                                 fi
8914                         done
8915                         if test "X$d_socket" != "X$define"; then
8916                            echo "or anywhere else I see." >&4
8917                            d_socket="$undef"
8918                            d_oldsock="$undef"
8919                         fi
8920                 fi
8921         fi
8922 fi
8923
8924 : see if socketpair exists
8925 set socketpair d_sockpair
8926 eval $inlibc
8927
8928
8929 echo " "
8930 echo "Checking the availability of certain socket constants..." >& 4
8931 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8932         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8933         $cat >try.c <<EOF
8934 #include <sys/types.h>
8935 #include <sys/socket.h>
8936 int main() {
8937     int i = $ENUM;
8938 }
8939 EOF
8940         val="$undef"
8941         set try; if eval $compile; then
8942                 val="$define"
8943         fi
8944         set d_${enum}; eval $setvar
8945         $rm -f try.c try
8946 done
8947
8948 : see if sys/select.h has to be included
8949 set sys/select.h i_sysselct
8950 eval $inhdr
8951
8952 : see if we should include time.h, sys/time.h, or both
8953 echo " "
8954 if test "X$timeincl" = X; then
8955         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8956         $echo $n "I'm now running the test program...$c"
8957         $cat >try.c <<'EOCP'
8958 #include <sys/types.h>
8959 #ifdef I_TIME
8960 #include <time.h>
8961 #endif
8962 #ifdef I_SYSTIME
8963 #ifdef SYSTIMEKERNEL
8964 #define KERNEL
8965 #endif
8966 #include <sys/time.h>
8967 #endif
8968 #ifdef I_SYSSELECT
8969 #include <sys/select.h>
8970 #endif
8971 int main()
8972 {
8973         struct tm foo;
8974 #ifdef S_TIMEVAL
8975         struct timeval bar;
8976 #endif
8977 #ifdef S_TIMEZONE
8978         struct timezone tzp;
8979 #endif
8980         if (foo.tm_sec == foo.tm_sec)
8981                 exit(0);
8982 #ifdef S_TIMEVAL
8983         if (bar.tv_sec == bar.tv_sec)
8984                 exit(0);
8985 #endif
8986         exit(1);
8987 }
8988 EOCP
8989         flags=''
8990         for s_timezone in '-DS_TIMEZONE' ''; do
8991         sysselect=''
8992         for s_timeval in '-DS_TIMEVAL' ''; do
8993         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8994         for i_time in '' '-DI_TIME'; do
8995         for i_systime in '-DI_SYSTIME' ''; do
8996                 case "$flags" in
8997                 '') $echo $n ".$c"
8998                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8999                         if eval $compile; then
9000                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9001                                 shift
9002                                 flags="$*"
9003                                 echo " "
9004                                 $echo $n "Succeeded with $flags$c"
9005                         fi
9006                         ;;
9007                 esac
9008         done
9009         done
9010         done
9011         done
9012         done
9013         timeincl=''
9014         echo " "
9015         case "$flags" in
9016         *SYSTIMEKERNEL*) i_systimek="$define"
9017                 timeincl=`./findhdr sys/time.h`
9018                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9019         *) i_systimek="$undef";;
9020         esac
9021         case "$flags" in
9022         *I_TIME*) i_time="$define"
9023                 timeincl=`./findhdr time.h`" $timeincl"
9024                 echo "We'll include <time.h>." >&4;;
9025         *) i_time="$undef";;
9026         esac
9027         case "$flags" in
9028         *I_SYSTIME*) i_systime="$define"
9029                 timeincl=`./findhdr sys/time.h`" $timeincl"
9030                 echo "We'll include <sys/time.h>." >&4;;
9031         *) i_systime="$undef";;
9032         esac
9033         $rm -f try.c try
9034 fi
9035
9036 : check for fd_set items
9037 $cat <<EOM
9038
9039 Checking to see how well your C compiler handles fd_set and friends ...
9040 EOM
9041 $cat >fd_set.c <<EOCP
9042 #$i_systime I_SYS_TIME
9043 #$i_sysselct I_SYS_SELECT
9044 #$d_socket HAS_SOCKET
9045 #include <sys/types.h>
9046 #ifdef HAS_SOCKET
9047 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9048 #endif
9049 #ifdef I_SYS_TIME
9050 #include <sys/time.h>
9051 #endif
9052 #ifdef I_SYS_SELECT
9053 #include <sys/select.h>
9054 #endif
9055 int main() {
9056         fd_set fds;
9057
9058 #ifdef TRYBITS
9059         if(fds.fds_bits);
9060 #endif
9061
9062 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9063         exit(0);
9064 #else
9065         exit(1);
9066 #endif
9067 }
9068 EOCP
9069 set fd_set -DTRYBITS
9070 if eval $compile; then
9071         d_fds_bits="$define"
9072         d_fd_set="$define"
9073         echo "Well, your system knows about the normal fd_set typedef..." >&4
9074         if ./fd_set; then
9075                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9076                 d_fd_macros="$define"
9077         else
9078                 $cat >&4 <<'EOM'
9079 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9080 EOM
9081                 d_fd_macros="$undef"
9082         fi
9083 else
9084         $cat <<'EOM'
9085 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9086 EOM
9087         set fd_set
9088         if eval $compile; then
9089                 d_fds_bits="$undef"
9090                 d_fd_set="$define"
9091                 echo "Well, your system has some sort of fd_set available..." >&4
9092                 if ./fd_set; then
9093                         echo "and you have the normal fd_set macros." >&4
9094                         d_fd_macros="$define"
9095                 else
9096                         $cat <<'EOM'
9097 but not the normal fd_set macros!  Gross!  More work for me...
9098 EOM
9099                         d_fd_macros="$undef"
9100                 fi
9101         else
9102         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9103                 d_fd_set="$undef"
9104                 d_fds_bits="$undef"
9105                 d_fd_macros="$undef"
9106         fi
9107 fi
9108 $rm -f fd_set*
9109
9110 : see if fgetpos exists
9111 set fgetpos d_fgetpos
9112 eval $inlibc
9113
9114 : see if flock exists
9115 set flock d_flock
9116 eval $inlibc
9117
9118 : see if fork exists
9119 set fork d_fork
9120 eval $inlibc
9121
9122 : see if pathconf exists
9123 set pathconf d_pathconf
9124 eval $inlibc
9125
9126 : see if fpathconf exists
9127 set fpathconf d_fpathconf
9128 eval $inlibc
9129
9130
9131 : check for fpos64_t
9132 echo " "
9133 echo "Checking to see if you have fpos64_t..." >&4
9134 $cat >try.c <<EOCP
9135 #include <stdio.h>
9136 int main() { fpos64_t x = 7; }
9137 EOCP
9138 set try
9139 if eval $compile; then
9140         val="$define"
9141         echo "You have fpos64_t."
9142 else
9143         val="$undef"
9144         echo "You do not have fpos64_t."
9145         case "$fpossize" in
9146         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9147         esac
9148 fi
9149 $rm -f try.* try
9150 set d_fpos64_t
9151 eval $setvar
9152
9153 : see if frexpl exists
9154 set frexpl d_frexpl
9155 eval $inlibc
9156
9157 hasstruct='varname=$1; struct=$2; shift; shift;
9158 while $test $# -ge 2; do
9159         case "$1" in
9160         $define) echo "#include <$2>";;
9161         esac ;
9162     shift 2;
9163 done > try.c;
9164 echo "int main () { struct $struct foo; }" >> try.c;
9165 set try;
9166 if eval $compile; then
9167         val="$define";
9168 else
9169         val="$undef";
9170 fi;
9171 set $varname;
9172 eval $setvar;
9173 $rm -f try.c try.o'
9174
9175 : see if this is a sys/param system
9176 set sys/param.h i_sysparam
9177 eval $inhdr
9178
9179 : see if this is a sys/mount.h system
9180 set sys/mount.h i_sysmount
9181 eval $inhdr
9182
9183 : see if sys/types.h has to be included
9184 set sys/types.h i_systypes
9185 eval $inhdr
9186
9187
9188 echo " "
9189 echo "Checking to see if your system supports struct fs_data..." >&4
9190 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9191 eval $hasstruct
9192 case "$d_fs_data_s" in
9193 "$define")      echo "Yes, it does."   ;;
9194 *)              echo "No, it doesn't." ;;
9195 esac
9196
9197 : see if fseeko exists
9198 set fseeko d_fseeko
9199 eval $inlibc
9200 case "$longsize" in
9201 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9202 esac
9203
9204 : see if fsetpos exists
9205 set fsetpos d_fsetpos
9206 eval $inlibc
9207
9208
9209 : see if fstatfs exists
9210 set fstatfs d_fstatfs
9211 eval $inlibc
9212
9213
9214 : see if statvfs exists
9215 set statvfs d_statvfs
9216 eval $inlibc
9217
9218 : see if fstatvfs exists
9219 set fstatvfs d_fstatvfs
9220 eval $inlibc
9221
9222
9223 : see if ftello exists
9224 set ftello d_ftello
9225 eval $inlibc
9226 case "$longsize" in
9227 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9228 esac
9229
9230 : see if getcwd exists
9231 set getcwd d_getcwd
9232 eval $inlibc
9233
9234 : see if getespwnam exists
9235 set getespwnam d_getespwnam
9236 eval $inlibc
9237
9238
9239 : see if getfsstat exists
9240 set getfsstat d_getfsstat
9241 eval $inlibc
9242
9243 : see if getgrent exists
9244 set getgrent d_getgrent
9245 eval $inlibc
9246
9247 : see if gethostbyaddr exists
9248 set gethostbyaddr d_gethbyaddr
9249 eval $inlibc
9250
9251 : see if gethostbyname exists
9252 set gethostbyname d_gethbyname
9253 eval $inlibc
9254
9255 : see if gethostent exists
9256 set gethostent d_gethent
9257 eval $inlibc
9258
9259 : see how we will look up host name
9260 echo " "
9261 call=''
9262 if set gethostname val -f d_gethname; eval $csym; $val; then
9263         echo 'gethostname() found.' >&4
9264         d_gethname="$define"
9265         call=gethostname
9266 fi
9267 if set uname val -f d_uname; eval $csym; $val; then
9268         if ./xenix; then
9269                 $cat <<'EOM'
9270 uname() was found, but you're running xenix, and older versions of xenix
9271 have a broken uname(). If you don't really know whether your xenix is old
9272 enough to have a broken system call, use the default answer.
9273
9274 EOM
9275                 dflt=y
9276                 case "$d_uname" in
9277                 "$define") dflt=n;;
9278                 esac
9279                 rp='Is your uname() broken?'
9280                 . ./myread
9281                 case "$ans" in
9282                 n*) d_uname="$define"; call=uname;;
9283                 esac
9284         else
9285                 echo 'uname() found.' >&4
9286                 d_uname="$define"
9287                 case "$call" in
9288                 '') call=uname ;;
9289                 esac
9290         fi
9291 fi
9292 case "$d_gethname" in
9293 '') d_gethname="$undef";;
9294 esac
9295 case "$d_uname" in
9296 '') d_uname="$undef";;
9297 esac
9298 case "$d_uname$d_gethname" in
9299 *define*)
9300         dflt=n
9301         cat <<EOM
9302  
9303 Every now and then someone has a $call() that lies about the hostname
9304 but can't be fixed for political or economic reasons.  If you wish, I can
9305 pretend $call() isn't there and maybe compute hostname at run-time
9306 thanks to the '$phostname' command.
9307
9308 EOM
9309         rp="Shall I ignore $call() from now on?"
9310         . ./myread
9311         case "$ans" in
9312         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9313         esac;;
9314 esac
9315 case "$phostname" in
9316 '') aphostname='';;
9317 *) case "$aphostname" in
9318         /*) ;;
9319         *) set X $phostname
9320                 shift
9321                 file=$1
9322                 shift
9323                 file=`./loc $file $file $pth`
9324                 aphostname=`echo $file $*`
9325                 ;;
9326         esac
9327         ;;
9328 esac
9329 case "$d_uname$d_gethname" in
9330 *define*) ;;
9331 *)
9332         case "$phostname" in
9333         '')
9334                 echo "There will be no way for $package to get your hostname." >&4;;
9335         *)
9336         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9337                 ;;
9338         esac;;
9339 esac
9340 case "$d_phostname" in
9341 '') d_phostname="$undef";;
9342 esac
9343
9344 : see if this is a netdb.h system
9345 set netdb.h i_netdb
9346 eval $inhdr
9347
9348 : see if prototypes for various gethostxxx netdb.h functions are available
9349 echo " "
9350 set d_gethostprotos gethostent $i_netdb netdb.h
9351 eval $hasproto
9352
9353 : see if getlogin exists
9354 set getlogin d_getlogin
9355 eval $inlibc
9356
9357 : see if getmnt exists
9358 set getmnt d_getmnt
9359 eval $inlibc
9360
9361 : see if getmntent exists
9362 set getmntent d_getmntent
9363 eval $inlibc
9364
9365 : see if getnetbyaddr exists
9366 set getnetbyaddr d_getnbyaddr
9367 eval $inlibc
9368
9369 : see if getnetbyname exists
9370 set getnetbyname d_getnbyname
9371 eval $inlibc
9372
9373 : see if getnetent exists
9374 set getnetent d_getnent
9375 eval $inlibc
9376
9377 : see if prototypes for various getnetxxx netdb.h functions are available
9378 echo " "
9379 set d_getnetprotos getnetent $i_netdb netdb.h
9380 eval $hasproto
9381
9382
9383 : see if getprotobyname exists
9384 set getprotobyname d_getpbyname
9385 eval $inlibc
9386
9387 : see if getprotobynumber exists
9388 set getprotobynumber d_getpbynumber
9389 eval $inlibc
9390
9391 : see if getprotoent exists
9392 set getprotoent d_getpent
9393 eval $inlibc
9394
9395 : see if getpgid exists
9396 set getpgid d_getpgid
9397 eval $inlibc
9398
9399 : see if getpgrp2 exists
9400 set getpgrp2 d_getpgrp2
9401 eval $inlibc
9402
9403 : see if getppid exists
9404 set getppid d_getppid
9405 eval $inlibc
9406
9407 : see if getpriority exists
9408 set getpriority d_getprior
9409 eval $inlibc
9410
9411 : see if prototypes for various getprotoxxx netdb.h functions are available
9412 echo " "
9413 set d_getprotoprotos getprotoent $i_netdb netdb.h
9414 eval $hasproto
9415
9416 : see if getprpwnam exists
9417 set getprpwnam d_getprpwnam
9418 eval $inlibc
9419
9420 : see if getpwent exists
9421 set getpwent d_getpwent
9422 eval $inlibc
9423
9424
9425 : see if getservbyname exists
9426 set getservbyname d_getsbyname
9427 eval $inlibc
9428
9429 : see if getservbyport exists
9430 set getservbyport d_getsbyport
9431 eval $inlibc
9432
9433 : see if getservent exists
9434 set getservent d_getsent
9435 eval $inlibc
9436
9437 : see if prototypes for various getservxxx netdb.h functions are available
9438 echo " "
9439 set d_getservprotos getservent $i_netdb netdb.h
9440 eval $hasproto
9441
9442 : see if getspnam exists
9443 set getspnam d_getspnam
9444 eval $inlibc
9445
9446 : see if gettimeofday or ftime exists
9447 set gettimeofday d_gettimeod
9448 eval $inlibc
9449 case "$d_gettimeod" in
9450 "$undef")
9451         set ftime d_ftime 
9452         eval $inlibc
9453         ;;
9454 *)
9455         val="$undef"; set d_ftime; eval $setvar
9456         ;;
9457 esac
9458 case "$d_gettimeod$d_ftime" in
9459 "$undef$undef")
9460         echo " "
9461         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9462         ;;
9463 esac
9464
9465 : see if this is an grp system
9466 set grp.h i_grp
9467 eval $inhdr
9468
9469 case "$i_grp" in
9470 $define)
9471         xxx=`./findhdr grp.h`
9472         $cppstdin $cppflags $cppminus < $xxx >$$.h
9473
9474         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9475                 val="$define"
9476         else
9477                 val="$undef"
9478         fi
9479         set d_grpasswd
9480         eval $setvar
9481
9482         $rm -f $$.h
9483         ;;
9484 *)
9485         val="$undef";
9486         set d_grpasswd; eval $setvar
9487         ;;
9488 esac
9489
9490 : see if hasmntopt exists
9491 set hasmntopt d_hasmntopt
9492 eval $inlibc
9493
9494 : see if this is a netinet/in.h or sys/in.h system
9495 set netinet/in.h i_niin sys/in.h i_sysin
9496 eval $inhdr
9497
9498 : see if arpa/inet.h has to be included
9499 set arpa/inet.h i_arpainet
9500 eval $inhdr
9501
9502 : see if htonl --and friends-- exists
9503 val=''
9504 set htonl val
9505 eval $inlibc
9506
9507 : Maybe they are macros.
9508 case "$val" in
9509 $undef)
9510         $cat >htonl.c <<EOM
9511 #include <stdio.h>
9512 #include <sys/types.h>
9513 #$i_niin I_NETINET_IN
9514 #$i_sysin I_SYS_IN
9515 #$i_arpainet I_ARPA_INET
9516 #ifdef I_NETINET_IN
9517 #include <netinet/in.h>
9518 #endif
9519 #ifdef I_SYS_IN
9520 #include <sys/in.h>
9521 #endif
9522 #ifdef I_ARPA_INET
9523 #include <arpa/inet.h>
9524 #endif
9525 #ifdef htonl
9526 printf("Defined as a macro.");
9527 #endif
9528 EOM
9529         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9530         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9531                 val="$define"
9532                 echo "But it seems to be defined as a macro." >&4
9533         fi
9534         $rm -f htonl.?
9535         ;;
9536 esac
9537 set d_htonl
9538 eval $setvar
9539
9540 : see if iconv exists
9541 set iconv d_iconv
9542 eval $inlibc
9543
9544 : index or strchr
9545 echo " "
9546 if set index val -f; eval $csym; $val; then
9547         if set strchr val -f d_strchr; eval $csym; $val; then
9548                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9549                         val="$define"
9550                         vali="$undef"
9551                         echo "strchr() found." >&4
9552                 else
9553                         val="$undef"
9554                         vali="$define"
9555                         echo "index() found." >&4
9556                 fi
9557         else
9558                 val="$undef"
9559                 vali="$define"
9560                 echo "index() found." >&4
9561         fi
9562 else
9563         if set strchr val -f d_strchr; eval $csym; $val; then
9564                 val="$define"
9565                 vali="$undef"
9566                 echo "strchr() found." >&4
9567         else
9568                 echo "No index() or strchr() found!" >&4
9569                 val="$undef"
9570                 vali="$undef"
9571         fi
9572 fi
9573 set d_strchr; eval $setvar
9574 val="$vali"
9575 set d_index; eval $setvar
9576
9577 : check whether inet_aton exists
9578 set inet_aton d_inetaton
9579 eval $inlibc
9580
9581 : see if inttypes.h is available
9582 : we want a real compile instead of Inhdr because some systems
9583 : have an inttypes.h which includes non-existent headers
9584 echo " "
9585 $cat >try.c <<EOCP
9586 #include <inttypes.h>
9587 int main() {
9588         static int32_t foo32 = 0x12345678;
9589 }
9590 EOCP
9591 set try
9592 if eval $compile; then
9593         echo "<inttypes.h> found." >&4
9594         val="$define"
9595 else
9596         echo "<inttypes.h> NOT found." >&4
9597         val="$undef"
9598 fi
9599 $rm -f try.c try
9600 set i_inttypes
9601 eval $setvar
9602
9603 : check for int64_t
9604 echo " "
9605 echo "Checking to see if you have int64_t..." >&4
9606 $cat >try.c <<EOCP
9607 #include <sys/types.h>
9608 #$i_inttypes I_INTTYPES
9609 #ifdef I_INTTYPES
9610 #include <inttypes.h>
9611 #endif
9612 int main() { int64_t x = 7; }
9613 EOCP
9614 set try
9615 if eval $compile; then
9616         val="$define"
9617         echo "You have int64_t."
9618 else
9619         val="$undef"
9620         echo "You do not have int64_t."
9621 fi
9622 $rm -f try try.*
9623 set d_int64_t
9624 eval $setvar
9625
9626 : Look for isascii
9627 echo " "
9628 $cat >isascii.c <<'EOCP'
9629 #include <stdio.h>
9630 #include <ctype.h>
9631 int main() {
9632         int c = 'A';
9633         if (isascii(c))
9634                 exit(0);
9635         else
9636                 exit(1);
9637 }
9638 EOCP
9639 set isascii
9640 if eval $compile; then
9641         echo "isascii() found." >&4
9642         val="$define"
9643 else
9644         echo "isascii() NOT found." >&4
9645         val="$undef"
9646 fi
9647 set d_isascii
9648 eval $setvar
9649 $rm -f isascii*
9650
9651 : see if isnan exists
9652 set isnan d_isnan
9653 eval $inlibc
9654
9655 : see if isnanl exists
9656 set isnanl d_isnanl
9657 eval $inlibc
9658
9659 : see if killpg exists
9660 set killpg d_killpg
9661 eval $inlibc
9662
9663 : see if lchown exists
9664 echo " "
9665 $cat > try.c <<'EOCP'
9666 /* System header to define __stub macros and hopefully few prototypes,
9667     which can conflict with char lchown(); below.  */
9668 #include <assert.h>
9669 /* Override any gcc2 internal prototype to avoid an error.  */
9670 /* We use char because int might match the return type of a gcc2
9671    builtin and then its argument prototype would still apply.  */
9672 char lchown();
9673 int main() {
9674     /*  The GNU C library defines this for functions which it implements
9675         to always fail with ENOSYS.  Some functions are actually named
9676         something starting with __ and the normal name is an alias.  */
9677 #if defined (__stub_lchown) || defined (__stub___lchown)
9678 choke me
9679 #else
9680 lchown();
9681 #endif
9682 ; return 0; }
9683 EOCP
9684 set try
9685 if eval $compile; then
9686     $echo "lchown() found." >&4
9687     val="$define"
9688 else
9689     $echo "lchown() NOT found." >&4
9690     val="$undef"
9691 fi
9692 set d_lchown
9693 eval $setvar
9694
9695 : See if number of significant digits in a double precision number is known
9696 echo " "
9697 $cat >ldbl_dig.c <<EOM
9698 #$i_limits I_LIMITS
9699 #$i_float I_FLOAT
9700 #ifdef I_LIMITS
9701 #include <limits.h>
9702 #endif
9703 #ifdef I_FLOAT
9704 #include <float.h>
9705 #endif
9706 #ifdef LDBL_DIG
9707 printf("Contains LDBL_DIG");
9708 #endif
9709 EOM
9710 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9711 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9712         echo "LDBL_DIG found." >&4
9713         val="$define"
9714 else
9715         echo "LDBL_DIG NOT found." >&4
9716         val="$undef"
9717 fi
9718 $rm -f ldbl_dig.?
9719 set d_ldbl_dig
9720 eval $setvar
9721
9722 : see if link exists
9723 set link d_link
9724 eval $inlibc
9725
9726 : see if localeconv exists
9727 set localeconv d_locconv
9728 eval $inlibc
9729
9730 : see if lockf exists
9731 set lockf d_lockf
9732 eval $inlibc
9733
9734 : check for long long
9735 echo " "
9736 echo "Checking to see if you have long long..." >&4
9737 echo 'int main() { long long x = 7; return 0; }' > try.c
9738 set try
9739 if eval $compile; then
9740         val="$define"
9741         echo "You have have long long."
9742 else
9743         val="$undef"
9744         echo "You do not have long long."
9745 fi
9746 $rm try.*
9747 set d_longlong
9748 eval $setvar
9749
9750 : check for length of long long
9751 case "${d_longlong}${longlongsize}" in
9752 $define)
9753         echo " "
9754         echo "Checking to see how big your long longs are..." >&4
9755         $cat >try.c <<'EOCP'
9756 #include <stdio.h>
9757 int main()
9758 {
9759     printf("%d\n", (int)sizeof(long long));
9760     return(0);
9761 }
9762 EOCP
9763         set try
9764         if eval $compile_ok; then
9765                 longlongsize=`./try$exe_ext`
9766                 echo "Your long longs are $longlongsize bytes long."
9767         else
9768                 dflt='8'
9769                 echo " "
9770                 echo "(I can't seem to compile the test program.  Guessing...)"
9771                 rp="What is the size of a long long (in bytes)?"
9772                 . ./myread
9773                 longlongsize="$ans"
9774         fi
9775         if $test "X$longsize" = "X$longlongsize"; then
9776                 echo "(That isn't any different from an ordinary long.)"
9777         fi      
9778         ;;
9779 esac
9780 $rm -f try.* try
9781
9782 : see if prototype for lseek is available
9783 echo " "
9784 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9785 eval $hasproto
9786
9787 : see if lstat exists
9788 set lstat d_lstat
9789 eval $inlibc
9790
9791 : see if madvise exists
9792 set madvise d_madvise
9793 eval $inlibc
9794
9795 : see if mblen exists
9796 set mblen d_mblen
9797 eval $inlibc
9798
9799 : see if mbstowcs exists
9800 set mbstowcs d_mbstowcs
9801 eval $inlibc
9802
9803 : see if mbtowc exists
9804 set mbtowc d_mbtowc
9805 eval $inlibc
9806
9807 : see if memchr exists
9808 set memchr d_memchr
9809 eval $inlibc
9810
9811 : see if memcmp exists
9812 set memcmp d_memcmp
9813 eval $inlibc
9814
9815 : see if memcpy exists
9816 set memcpy d_memcpy
9817 eval $inlibc
9818
9819 : see if memmove exists
9820 set memmove d_memmove
9821 eval $inlibc
9822
9823 : see if memset exists
9824 set memset d_memset
9825 eval $inlibc
9826
9827 : see if mkdir exists
9828 set mkdir d_mkdir
9829 eval $inlibc
9830
9831 : see if mkdtemp exists
9832 set mkdtemp d_mkdtemp
9833 eval $inlibc
9834
9835 : see if mkfifo exists
9836 set mkfifo d_mkfifo
9837 eval $inlibc
9838
9839 : see if mkstemp exists
9840 set mkstemp d_mkstemp
9841 eval $inlibc
9842
9843 : see if mkstemps exists
9844 set mkstemps d_mkstemps
9845 eval $inlibc
9846
9847 : see if mktime exists
9848 set mktime d_mktime
9849 eval $inlibc
9850
9851 : see if this is a sys/mman.h system
9852 set sys/mman.h i_sysmman
9853 eval $inhdr
9854
9855 : see if mmap exists
9856 set mmap d_mmap
9857 eval $inlibc
9858 : see what shmat returns
9859 : default to something harmless
9860 mmaptype='void *'
9861 case "$i_sysmman$d_mmap" in
9862 "$define$define")
9863         $cat >mmap.c <<'END'
9864 #include <sys/mman.h>
9865 void *mmap();
9866 END
9867         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9868                 mmaptype='void *'
9869         else
9870                 mmaptype='caddr_t'
9871         fi
9872         echo "and it returns ($mmaptype)." >&4
9873         ;;
9874 esac
9875
9876
9877
9878 : see if modfl exists
9879 set modfl d_modfl
9880 eval $inlibc
9881
9882 : see if mprotect exists
9883 set mprotect d_mprotect
9884 eval $inlibc
9885
9886 : see if msgctl exists
9887 set msgctl d_msgctl
9888 eval $inlibc
9889
9890 : see if msgget exists
9891 set msgget d_msgget
9892 eval $inlibc
9893
9894 : see if msgsnd exists
9895 set msgsnd d_msgsnd
9896 eval $inlibc
9897
9898 : see if msgrcv exists
9899 set msgrcv d_msgrcv
9900 eval $inlibc
9901
9902 : see how much of the 'msg*(2)' library is present.
9903 h_msg=true
9904 echo " "
9905 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9906 *"$undef"*) h_msg=false;;
9907 esac
9908 case "$osname" in
9909 freebsd)
9910     case "`ipcs 2>&1`" in
9911     "SVID messages"*"not configured"*)
9912         echo "Your $osname does not have the msg*(2) configured." >&4
9913         h_msg=false
9914         val="$undef"
9915         set msgctl d_msgctl
9916         eval $setvar
9917         set msgget d_msgget
9918         eval $setvar
9919         set msgsnd d_msgsnd
9920         eval $setvar
9921         set msgrcv d_msgrcv
9922         eval $setvar
9923         ;;
9924     esac
9925     ;;
9926 esac
9927 : we could also check for sys/ipc.h ...
9928 if $h_msg && $test `./findhdr sys/msg.h`; then
9929         echo "You have the full msg*(2) library." >&4
9930         val="$define"
9931 else
9932         echo "You don't have the full msg*(2) library." >&4
9933         val="$undef"
9934 fi
9935 set d_msg
9936 eval $setvar
9937
9938 : see if msync exists
9939 set msync d_msync
9940 eval $inlibc
9941
9942 : see if munmap exists
9943 set munmap d_munmap
9944 eval $inlibc
9945
9946 : see if nice exists
9947 set nice d_nice
9948 eval $inlibc
9949
9950
9951 echo " "
9952 echo "Checking which 64-bit integer type we could use..." >&4
9953
9954 case "$intsize" in
9955 8) val=int
9956    set quadtype
9957    eval $setvar
9958    val='"unsigned int"'
9959    set uquadtype
9960    eval $setvar
9961    quadkind=1
9962    ;;
9963 *) case "$longsize" in
9964    8) val=long
9965       set quadtype
9966       eval $setvar
9967       val='"unsigned long"'
9968       set uquadtype
9969       eval $setvar
9970       quadkind=2
9971       ;;
9972    *) case "$d_longlong:$longlongsize" in
9973       define:8)
9974         val='"long long"'
9975         set quadtype
9976         eval $setvar
9977         val='"unsigned long long"'
9978         set uquadtype
9979         eval $setvar
9980         quadkind=3
9981         ;;
9982       *) case "$d_int64_t" in
9983          define)
9984            val=int64_t
9985            set quadtype
9986            eval $setvar
9987            val=uint64_t
9988            set uquadtype
9989            eval $setvar
9990            quadkind=4
9991            ;;
9992          esac
9993          ;;
9994       esac
9995       ;;
9996    esac
9997    ;;
9998 esac
9999
10000 case "$quadtype" in
10001 '')     echo "Alas, no 64-bit integer types in sight." >&4
10002         d_quad="$undef"
10003         ;;
10004 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10005             verb="will"
10006         else
10007             verb="could"
10008         fi
10009         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10010         d_quad="$define"
10011         ;;
10012 esac
10013
10014 : check for length of character
10015 echo " "
10016 case "$charsize" in
10017 '')
10018         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10019         $cat >try.c <<'EOCP'
10020 #include <stdio.h>
10021 int main()
10022 {
10023     printf("%d\n", (int)sizeof(char));
10024     exit(0);
10025 }
10026 EOCP
10027         set try
10028         if eval $compile_ok; then
10029                 dflt=`./try`
10030         else
10031                 dflt='1'
10032                 echo "(I can't seem to compile the test program.  Guessing...)"
10033         fi
10034         ;;
10035 *)
10036         dflt="$charsize"
10037         ;;
10038 esac
10039 rp="What is the size of a character (in bytes)?"
10040 . ./myread
10041 charsize="$ans"
10042 $rm -f try.c try
10043
10044
10045 echo " "
10046 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10047
10048 case "$use64bitint:$d_quad:$quadtype" in
10049 define:define:?*)
10050         ivtype="$quadtype"
10051         uvtype="$uquadtype"
10052         ivsize=8
10053         uvsize=8
10054         ;;
10055 *)      ivtype="long"
10056         uvtype="unsigned long"
10057         ivsize=$longsize
10058         uvsize=$longsize
10059         ;;
10060 esac
10061
10062 case "$uselongdouble:$d_longdbl" in
10063 define:define)
10064         nvtype="long double"
10065         nvsize=$longdblsize
10066         ;;
10067 *)      nvtype=double
10068         nvsize=$doublesize
10069         ;;
10070 esac
10071
10072 $echo "(IV will be "$ivtype", $ivsize bytes)"
10073 $echo "(UV will be "$uvtype", $uvsize bytes)"
10074 $echo "(NV will be "$nvtype", $nvsize bytes)"
10075
10076 $cat >try.c <<EOCP
10077 #$i_inttypes I_INTTYPES
10078 #ifdef I_INTTYPES
10079 #include <inttypes.h>
10080 #endif
10081 #include <stdio.h>
10082 int main() {
10083 #ifdef INT8
10084    int8_t i =  INT8_MAX;
10085   uint8_t u = UINT8_MAX;
10086   printf("int8_t\n");
10087 #endif
10088 #ifdef INT16
10089    int16_t i =  INT16_MAX;
10090   uint16_t i = UINT16_MAX;
10091   printf("int16_t\n");
10092 #endif
10093 #ifdef INT32
10094    int32_t i =  INT32_MAX;
10095   uint32_t u = UINT32_MAX;
10096   printf("int32_t\n");
10097 #endif
10098 }
10099 EOCP
10100
10101 case "$i8type" in
10102 '')     case "$charsize" in
10103         1)      i8type=char
10104                 u8type="unsigned char"
10105                 i8size=$charsize
10106                 u8size=$charsize
10107                 ;;
10108         esac
10109         ;;
10110 esac
10111 case "$i8type" in
10112 '')     set try -DINT8
10113         if eval $compile; then
10114                 case "`./try$exe_ext`" in
10115                 int8_t) i8type=int8_t
10116                         u8type=uint8_t
10117                         i8size=1
10118                         u8size=1
10119                         ;;
10120                 esac
10121         fi
10122         ;;
10123 esac
10124 case "$i8type" in
10125 '')     if $test $charsize -ge 1; then
10126                 i8type=char
10127                 u8type="unsigned char"
10128                 i8size=$charsize
10129                 u8size=$charsize
10130         fi
10131         ;;
10132 esac
10133
10134 case "$i16type" in
10135 '')     case "$shortsize" in
10136         2)      i16type=short
10137                 u16type="unsigned short"
10138                 i16size=$shortsize
10139                 u16size=$shortsize
10140                 ;;
10141         esac
10142         ;;
10143 esac
10144 case "$i16type" in
10145 '')     set try -DINT16
10146         if eval $compile; then
10147                 case "`./try$exe_ext`" in
10148                 int16_t)
10149                         i16type=int16_t
10150                         u16type=uint16_t
10151                         i16size=2
10152                         u16size=2
10153                         ;;
10154                 esac
10155         fi
10156         ;;
10157 esac
10158 case "$i16type" in
10159 '')     if $test $shortsize -ge 2; then
10160                 i16type=short
10161                 u16type="unsigned short"
10162                 i16size=$shortsize
10163                 u16size=$shortsize
10164         fi
10165         ;;
10166 esac
10167
10168 case "$i32type" in
10169 '')     case "$longsize" in
10170         4)      i32type=long
10171                 u32type="unsigned long"
10172                 i32size=$longsize
10173                 u32size=$longsize
10174                 ;;
10175         *)      case "$intsize" in
10176                 4)      i32type=int
10177                         u32type="unsigned int"
10178                         i32size=$intsize
10179                         u32size=$intsize
10180                         ;;
10181                 esac
10182                 ;;
10183         esac
10184         ;;
10185 esac
10186 case "$i32type" in
10187 '')     set try -DINT32
10188         if eval $compile; then
10189                 case "`./try$exe_ext`" in
10190                 int32_t)
10191                         i32type=int32_t
10192                         u32type=uint32_t
10193                         i32size=4
10194                         u32size=4
10195                         ;;
10196                 esac
10197         fi
10198         ;;
10199 esac
10200 case "$i32type" in
10201 '')     if $test $intsize -ge 4; then
10202                 i32type=int
10203                 u32type="unsigned int"
10204                 i32size=$intsize
10205                 u32size=$intsize
10206         fi
10207         ;;
10208 esac
10209
10210 case "$i64type" in
10211 '')     case "$d_quad:$quadtype" in
10212         define:?*)
10213                 i64type="$quadtype"
10214                 u64type="$uquadtype"
10215                 i64size=8
10216                 u64size=8
10217                 ;;
10218         esac
10219         ;;
10220 esac
10221
10222 $echo "Checking whether your NVs can preserve your UVs..." >&4
10223 $cat <<EOP >try.c
10224 #include <stdio.h>
10225 int main() {
10226     $uvtype k = ($uvtype)~0, l;
10227     $nvtype d;
10228     l = k;
10229     d = ($nvtype)l;
10230     l = ($uvtype)d;
10231     if (l == k)
10232        printf("preserve\n");
10233     exit(0);
10234 }
10235 EOP
10236 set try
10237 if eval $compile; then
10238         case "`./try$exe_ext`" in
10239         preserve) d_nv_preserves_uv="$define" ;;
10240         esac
10241 fi      
10242 case "$d_nv_preserves_uv" in
10243 $define) $echo "Yes, they can."  2>&1 ;;
10244 *)       $echo "No, they can't." 2>&1
10245          d_nv_preserves_uv="$undef"
10246          ;;
10247 esac
10248
10249 $rm -f try.* try
10250
10251 case "$d_nv_preserves_uv" in
10252 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10253 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10254         $cat <<EOP >try.c
10255 #include <stdio.h>
10256 int main() {
10257     $uvtype u = 0;
10258     int     n = 8 * $uvsize;
10259     int     i;
10260     for (i = 0; i < n; i++) {
10261       u = u << 1 | ($uvtype)1;
10262       if (($uvtype)($nvtype)u != u)
10263         break;
10264     }
10265     printf("%d\n", i);
10266     exit(0);
10267 }
10268 EOP
10269         set try
10270         if eval $compile; then
10271                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10272         fi
10273         case "$d_nv_preserves_uv_bits" in
10274         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10275         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10276                 d_nv_preserves_uv_bits="$undef"
10277                 ;;
10278         esac
10279         $rm -f try.* try
10280         ;;
10281 esac
10282
10283
10284
10285 : check for off64_t
10286 echo " "
10287 echo "Checking to see if you have off64_t..." >&4
10288 $cat >try.c <<EOCP
10289 #include <sys/types.h>
10290 #include <unistd.h>
10291 int main() { off64_t x = 7; }
10292 EOCP
10293 set try
10294 if eval $compile; then
10295         val="$define"
10296         echo "You have off64_t."
10297 else
10298         val="$undef"
10299         echo "You do not have off64_t."
10300         case "$lseeksize" in
10301         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10302         esac
10303 fi
10304 $rm -f try.* try
10305 set d_off64_t
10306 eval $setvar
10307
10308 : see if POSIX threads are available
10309 set pthread.h i_pthread
10310 eval $inhdr
10311
10312
10313
10314
10315 : how to create joinable pthreads
10316 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10317         echo " "
10318         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10319         $cat >try.c <<'EOCP'
10320 #include <pthread.h>
10321 int main() {
10322     int detachstate = JOINABLE;
10323 }
10324 EOCP
10325         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10326         if eval $compile; then
10327                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10328                 val="$undef" # Yes, undef.
10329                 set d_old_pthread_create_joinable
10330                 eval $setvar
10331                 val=""
10332                 set old_pthread_create_joinable
10333                 eval $setvar
10334         else
10335                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10336                 if eval $compile; then
10337                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10338                         val="$define"
10339                         set d_old_pthread_create_joinable
10340                         eval $setvar
10341                         val=PTHREAD_CREATE_UNDETACHED
10342                         set old_pthread_create_joinable
10343                         eval $setvar
10344                 else            
10345                         set try -DJOINABLE=__UNDETACHED
10346                         if eval $compile; then
10347                                 echo "You seem to use __UNDETACHED." >&4
10348                                 val="$define"
10349                                 set d_old_pthread_create_joinable
10350                                 eval $setvar
10351                                 val=__UNDETACHED
10352                                 set old_pthread_create_joinable
10353                                 eval $setvar
10354                         else
10355                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10356                                 val="$define"
10357                                 set d_old_pthread_create_joinable
10358                                 eval $setvar
10359                                 val=0
10360                                 set old_pthread_create_joinable
10361                                 eval $setvar
10362                         fi
10363                 fi
10364         fi
10365         $rm -f try try.*
10366 else
10367     d_old_pthread_create_joinable="$undef"
10368     old_pthread_create_joinable=""
10369 fi
10370
10371 : see if pause exists
10372 set pause d_pause
10373 eval $inlibc
10374
10375 : see if pipe exists
10376 set pipe d_pipe
10377 eval $inlibc
10378
10379 : see if poll exists
10380 set poll d_poll
10381 eval $inlibc
10382
10383
10384 : see whether the various POSIXish _yields exist
10385 $cat >try.c <<EOP
10386 #include <pthread.h>
10387 #include <stdio.h>
10388 int main() {
10389 #ifdef SCHED_YIELD
10390         sched_yield();
10391 #else
10392 #ifdef PTHREAD_YIELD
10393         pthread_yield();
10394 #else
10395 #ifdef PTHREAD_YIELD_NULL
10396         pthread_yield(NULL);
10397 #endif
10398 #endif
10399 #endif
10400 }
10401 EOP
10402 : see if sched_yield exists
10403 set try -DSCHED_YIELD
10404 if eval $compile; then
10405     val="$define"
10406     sched_yield='sched_yield()'
10407 else
10408     val="$undef"
10409 fi
10410 case "$usethreads" in
10411 $define)
10412         case "$val" in
10413         $define) echo 'sched_yield() found.' >&4        ;;
10414         *)       echo 'sched_yield() NOT found.' >&4    ;;
10415         esac
10416 esac
10417 set d_sched_yield
10418 eval $setvar
10419
10420 : see if pthread_yield exists
10421 set try -DPTHREAD_YIELD
10422 if eval $compile; then
10423     val="$define"
10424     case "$sched_yield" in
10425     '') sched_yield='pthread_yield()' ;;
10426     esac
10427 else
10428     set try -DPTHREAD_YIELD_NULL
10429     if eval $compile; then
10430         val="$define"
10431         case "$sched_yield" in
10432         '') sched_yield='pthread_yield(NULL)' ;;
10433         esac
10434     else
10435         val="$undef"
10436     fi
10437 fi
10438 case "$usethreads" in
10439 $define)
10440         case "$val" in
10441         $define) echo 'pthread_yield() found.' >&4      ;;
10442         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10443         esac
10444         ;;
10445 esac
10446 set d_pthread_yield
10447 eval $setvar
10448
10449 case "$sched_yield" in
10450 '') sched_yield=undef ;;
10451 esac
10452
10453 $rm -f try try.*
10454
10455 : see if this is a pwd.h system
10456 set pwd.h i_pwd
10457 eval $inhdr
10458
10459 case "$i_pwd" in
10460 $define)
10461         xxx=`./findhdr pwd.h`
10462         $cppstdin $cppflags $cppminus < $xxx >$$.h
10463
10464         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10465                 val="$define"
10466         else
10467                 val="$undef"
10468         fi
10469         set d_pwquota
10470         eval $setvar
10471
10472         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10473                 val="$define"
10474         else
10475                 val="$undef"
10476         fi
10477         set d_pwage
10478         eval $setvar
10479
10480         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10481                 val="$define"
10482         else
10483                 val="$undef"
10484         fi
10485         set d_pwchange
10486         eval $setvar
10487
10488         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10489                 val="$define"
10490         else
10491                 val="$undef"
10492         fi
10493         set d_pwclass
10494         eval $setvar
10495
10496         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10497                 val="$define"
10498         else
10499                 val="$undef"
10500         fi
10501         set d_pwexpire
10502         eval $setvar
10503
10504         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10505                 val="$define"
10506         else
10507                 val="$undef"
10508         fi
10509         set d_pwcomment
10510         eval $setvar
10511
10512         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10513                 val="$define"
10514         else
10515                 val="$undef"
10516         fi
10517         set d_pwgecos
10518         eval $setvar
10519
10520         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10521                 val="$define"
10522         else
10523                 val="$undef"
10524         fi
10525         set d_pwpasswd
10526         eval $setvar
10527
10528         $rm -f $$.h
10529         ;;
10530 *)
10531         val="$undef"; 
10532         set d_pwquota; eval $setvar
10533         set d_pwage; eval $setvar
10534         set d_pwchange; eval $setvar
10535         set d_pwclass; eval $setvar
10536         set d_pwexpire; eval $setvar
10537         set d_pwcomment; eval $setvar
10538         set d_pwgecos; eval $setvar
10539         set d_pwpasswd; eval $setvar
10540         ;;
10541 esac
10542
10543 : see if readdir and friends exist
10544 set readdir d_readdir
10545 eval $inlibc
10546 set seekdir d_seekdir
10547 eval $inlibc
10548 set telldir d_telldir
10549 eval $inlibc
10550 set rewinddir d_rewinddir
10551 eval $inlibc
10552
10553 : see if readlink exists
10554 set readlink d_readlink
10555 eval $inlibc
10556
10557 : see if rename exists
10558 set rename d_rename
10559 eval $inlibc
10560
10561 : see if rmdir exists
10562 set rmdir d_rmdir
10563 eval $inlibc
10564
10565 : see if memory.h is available.
10566 val=''
10567 set memory.h val
10568 eval $inhdr
10569
10570 : See if it conflicts with string.h
10571 case "$val" in
10572 $define)
10573         case "$strings" in
10574         '') ;;
10575         *)
10576                 $cppstdin $cppflags $cppminus < $strings > mem.h
10577                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10578                         echo " "
10579                         echo "We won't be including <memory.h>."
10580                         val="$undef"
10581                 fi
10582                 $rm -f mem.h
10583                 ;;
10584         esac
10585 esac
10586 set i_memory
10587 eval $setvar
10588
10589 : can bcopy handle overlapping blocks?
10590 val="$undef"
10591 case "$d_bcopy" in
10592 "$define")
10593         echo " "
10594         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10595         $cat >try.c <<EOCP
10596 #$i_memory I_MEMORY
10597 #$i_stdlib I_STDLIB
10598 #$i_string I_STRING
10599 #$i_unistd I_UNISTD
10600 EOCP
10601         $cat >>try.c <<'EOCP'
10602 #include <stdio.h>
10603 #ifdef I_MEMORY
10604 #  include <memory.h>
10605 #endif
10606 #ifdef I_STDLIB
10607 #  include <stdlib.h>
10608 #endif
10609 #ifdef I_STRING
10610 #  include <string.h>
10611 #else
10612 #  include <strings.h>
10613 #endif
10614 #ifdef I_UNISTD
10615 #  include <unistd.h>  /* Needed for NetBSD */
10616 #endif
10617 int main()
10618 {
10619 char buf[128], abc[128];
10620 char *b;
10621 int len;
10622 int off;
10623 int align;
10624
10625 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10626
10627 for (align = 7; align >= 0; align--) {
10628         for (len = 36; len; len--) {
10629                 b = buf+align;
10630                 bcopy(abc, b, len);
10631                 for (off = 1; off <= len; off++) {
10632                         bcopy(b, b+off, len);
10633                         bcopy(b+off, b, len);
10634                         if (bcmp(b, abc, len))
10635                                 exit(1);
10636                 }
10637         }
10638 }
10639 exit(0);
10640 }
10641 EOCP
10642         set try
10643         if eval $compile_ok; then
10644                 if ./try 2>/dev/null; then
10645                         echo "Yes, it can."
10646                         val="$define"
10647                 else
10648                         echo "It can't, sorry."
10649                         case "$d_memmove" in
10650                         "$define") echo "But that's Ok since you have memmove()." ;;
10651                         esac
10652                 fi
10653         else
10654                 echo "(I can't compile the test program, so we'll assume not...)"
10655                 case "$d_memmove" in
10656                 "$define") echo "But that's Ok since you have memmove()." ;;
10657                 esac
10658         fi
10659         ;;
10660 esac
10661 $rm -f try.* try core
10662 set d_safebcpy
10663 eval $setvar
10664
10665 : can memcpy handle overlapping blocks?
10666 val="$undef"
10667 case "$d_memcpy" in
10668 "$define")
10669         echo " "
10670         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10671         $cat >try.c <<EOCP
10672 #$i_memory I_MEMORY
10673 #$i_stdlib I_STDLIB
10674 #$i_string I_STRING
10675 #$i_unistd I_UNISTD
10676 EOCP
10677         $cat >>try.c <<'EOCP'
10678 #include <stdio.h>
10679 #ifdef I_MEMORY
10680 #  include <memory.h>
10681 #endif
10682 #ifdef I_STDLIB
10683 #  include <stdlib.h>
10684 #endif
10685 #ifdef I_STRING
10686 #  include <string.h>
10687 #else
10688 #  include <strings.h>
10689 #endif
10690 #ifdef I_UNISTD
10691 #  include <unistd.h>  /* Needed for NetBSD */
10692 #endif
10693 int main()
10694 {
10695 char buf[128], abc[128];
10696 char *b;
10697 int len;
10698 int off;
10699 int align;
10700
10701 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10702    try to store the string in read-only memory. */
10703 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10704
10705 for (align = 7; align >= 0; align--) {
10706         for (len = 36; len; len--) {
10707                 b = buf+align;
10708                 memcpy(b, abc, len);
10709                 for (off = 1; off <= len; off++) {
10710                         memcpy(b+off, b, len);
10711                         memcpy(b, b+off, len);
10712                         if (memcmp(b, abc, len))
10713                                 exit(1);
10714                 }
10715         }
10716 }
10717 exit(0);
10718 }
10719 EOCP
10720         set try
10721         if eval $compile_ok; then
10722                 if ./try 2>/dev/null; then
10723                         echo "Yes, it can."
10724                         val="$define"
10725                 else
10726                         echo "It can't, sorry."
10727                         case "$d_memmove" in
10728                         "$define") echo "But that's Ok since you have memmove()." ;;
10729                         esac
10730                 fi
10731         else
10732                 echo "(I can't compile the test program, so we'll assume not...)"
10733                 case "$d_memmove" in
10734                 "$define") echo "But that's Ok since you have memmove()." ;;
10735                 esac
10736         fi
10737         ;;
10738 esac
10739 $rm -f try.* try core
10740 set d_safemcpy
10741 eval $setvar
10742
10743 : can memcmp be trusted to compare relative magnitude?
10744 val="$undef"
10745 case "$d_memcmp" in
10746 "$define")
10747         echo " "
10748         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10749         $cat >try.c <<EOCP
10750 #$i_memory I_MEMORY
10751 #$i_stdlib I_STDLIB
10752 #$i_string I_STRING
10753 #$i_unistd I_UNISTD
10754 EOCP
10755         $cat >>try.c <<'EOCP'
10756 #include <stdio.h>
10757 #ifdef I_MEMORY
10758 #  include <memory.h>
10759 #endif
10760 #ifdef I_STDLIB
10761 #  include <stdlib.h>
10762 #endif
10763 #ifdef I_STRING
10764 #  include <string.h>
10765 #else
10766 #  include <strings.h>
10767 #endif
10768 #ifdef I_UNISTD
10769 #  include <unistd.h>  /* Needed for NetBSD */
10770 #endif
10771 int main()
10772 {
10773 char a = -1;
10774 char b = 0;
10775 if ((a < b) && memcmp(&a, &b, 1) < 0)
10776         exit(1);
10777 exit(0);
10778 }
10779 EOCP
10780         set try
10781         if eval $compile_ok; then
10782                 if ./try 2>/dev/null; then
10783                         echo "Yes, it can."
10784                         val="$define"
10785                 else
10786                         echo "No, it can't (it uses signed chars)."
10787                 fi
10788         else
10789                 echo "(I can't compile the test program, so we'll assume not...)"
10790         fi
10791         ;;
10792 esac
10793 $rm -f try.* try core
10794 set d_sanemcmp
10795 eval $setvar
10796
10797 : see if select exists
10798 set select d_select
10799 eval $inlibc
10800
10801 : see if semctl exists
10802 set semctl d_semctl
10803 eval $inlibc
10804
10805 : see if semget exists
10806 set semget d_semget
10807 eval $inlibc
10808
10809 : see if semop exists
10810 set semop d_semop
10811 eval $inlibc
10812
10813 : see how much of the 'sem*(2)' library is present.
10814 h_sem=true
10815 echo " "
10816 case "$d_semctl$d_semget$d_semop" in
10817 *"$undef"*) h_sem=false;;
10818 esac
10819 case "$osname" in
10820 freebsd)
10821     case "`ipcs 2>&1`" in
10822     "SVID messages"*"not configured"*)
10823         echo "Your $osname does not have the sem*(2) configured." >&4
10824         h_sem=false
10825         val="$undef"
10826         set semctl d_semctl
10827         eval $setvar
10828         set semget d_semget
10829         eval $setvar
10830         set semop d_semop
10831         eval $setvar
10832         ;;
10833     esac
10834     ;;
10835 esac
10836 : we could also check for sys/ipc.h ...
10837 if $h_sem && $test `./findhdr sys/sem.h`; then
10838         echo "You have the full sem*(2) library." >&4
10839         val="$define"
10840 else
10841         echo "You don't have the full sem*(2) library." >&4
10842         val="$undef"
10843 fi
10844 set d_sem
10845 eval $setvar
10846
10847 : see whether sys/sem.h defines union semun
10848 echo " "
10849 $cat > try.c <<'END'
10850 #include <sys/types.h>
10851 #include <sys/ipc.h>
10852 #include <sys/sem.h>
10853 int main () { union semun semun; semun.buf = 0; }
10854 END
10855 set try
10856 if eval $compile; then
10857     echo "You have union semun in <sys/sem.h>." >&4
10858     val="$define"
10859 else
10860     echo "You do not have union semun in <sys/sem.h>." >&4
10861     val="$undef"
10862 fi
10863 $rm -f try try.c try.h
10864 set d_union_semun
10865 eval $setvar
10866
10867 : see how to do semctl IPC_STAT
10868 case "$d_sem" in
10869 $define)
10870     : see whether semctl IPC_STAT can use union semun
10871     echo " "
10872     $cat > try.h <<END
10873 #ifndef S_IRUSR
10874 #   ifdef S_IREAD
10875 #       define S_IRUSR S_IREAD
10876 #       define S_IWUSR S_IWRITE
10877 #       define S_IXUSR S_IEXEC
10878 #   else
10879 #       define S_IRUSR 0400
10880 #       define S_IWUSR 0200
10881 #       define S_IXUSR 0100
10882 #   endif
10883 #   define S_IRGRP (S_IRUSR>>3)
10884 #   define S_IWGRP (S_IWUSR>>3)
10885 #   define S_IXGRP (S_IXUSR>>3)
10886 #   define S_IROTH (S_IRUSR>>6)
10887 #   define S_IWOTH (S_IWUSR>>6)
10888 #   define S_IXOTH (S_IXUSR>>6)
10889 #endif
10890 #ifndef S_IRWXU
10891 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10892 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10893 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10894 #endif
10895 END
10896
10897     $cat > try.c <<END
10898 #include <sys/types.h>
10899 #include <sys/ipc.h>
10900 #include <sys/sem.h>
10901 #include <sys/stat.h>
10902 #include <stdio.h>
10903 #include <errno.h>
10904 #include "try.h"
10905 #ifndef errno
10906 extern int errno;
10907 #endif
10908 #$d_union_semun HAS_UNION_SEMUN
10909 int main() {
10910     union semun
10911 #ifndef HAS_UNION_SEMUN
10912     {
10913         int val;
10914         struct semid_ds *buf;
10915         unsigned short *array;
10916     }
10917 #endif
10918     arg;
10919     int sem, st;
10920
10921 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10922     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10923     if (sem > -1) {
10924         struct semid_ds argbuf;
10925         arg.buf = &argbuf;
10926 #       ifdef IPC_STAT
10927         st = semctl(sem, 0, IPC_STAT, arg);
10928         if (st == 0)
10929             printf("semun\n");
10930         else
10931 #       endif /* IPC_STAT */
10932             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10933 #       ifdef IPC_RMID
10934         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10935 #       endif /* IPC_RMID */
10936             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10937     } else
10938 #endif /* IPC_PRIVATE && ... */
10939         printf("semget failed: errno = %d\n", errno);
10940   return 0;
10941 }
10942 END
10943     val="$undef"
10944     set try
10945     if eval $compile; then
10946         xxx=`./try`
10947         case "$xxx" in
10948         semun) val="$define" ;;
10949         esac
10950     fi
10951     $rm -f try try.c
10952     set d_semctl_semun
10953     eval $setvar
10954     case "$d_semctl_semun" in
10955     $define)
10956         echo "You can use union semun for semctl IPC_STAT." >&4
10957         also='also'
10958         ;;
10959     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10960         also=''
10961         ;;
10962     esac
10963
10964     : see whether semctl IPC_STAT can use struct semid_ds pointer
10965     $cat > try.c <<'END'
10966 #include <sys/types.h>
10967 #include <sys/ipc.h>
10968 #include <sys/sem.h>
10969 #include <sys/stat.h>
10970 #include "try.h"
10971 #include <stdio.h>
10972 #include <errno.h>
10973 #ifndef errno
10974 extern int errno;
10975 #endif
10976 int main() {
10977     struct semid_ds arg;
10978     int sem, st;
10979
10980 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10981     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10982     if (sem > -1) {
10983 #       ifdef IPC_STAT
10984         st = semctl(sem, 0, IPC_STAT, &arg);
10985         if (st == 0)
10986             printf("semid_ds\n");
10987         else
10988 #       endif /* IPC_STAT */
10989             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10990 #       ifdef IPC_RMID
10991         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10992 #       endif /* IPC_RMID */
10993             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10994     } else
10995 #endif /* IPC_PRIVATE && ... */
10996         printf("semget failed: errno = %d\n", errno);
10997
10998     return 0;
10999 }
11000 END
11001     val="$undef"
11002     set try
11003     if eval $compile; then
11004         xxx=`./try`
11005         case "$xxx" in
11006         semid_ds) val="$define" ;;
11007         esac
11008     fi
11009     $rm -f try try.c
11010     set d_semctl_semid_ds
11011     eval $setvar
11012     case "$d_semctl_semid_ds" in
11013     $define)
11014         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11015         ;;
11016     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11017         ;;
11018     esac
11019     $rm -f try.h
11020     ;;
11021 *)  val="$undef"
11022
11023     # We do not have the full sem*(2) library, so assume we can not
11024     # use either.
11025
11026     set d_semctl_semun
11027     eval $setvar
11028
11029     set d_semctl_semid_ds
11030     eval $setvar
11031     ;;
11032 esac
11033
11034 : see if setegid exists
11035 set setegid d_setegid
11036 eval $inlibc
11037
11038 : see if seteuid exists
11039 set seteuid d_seteuid
11040 eval $inlibc
11041
11042 : see if setgrent exists
11043 set setgrent d_setgrent
11044 eval $inlibc
11045
11046 : see if sethostent exists
11047 set sethostent d_sethent
11048 eval $inlibc
11049
11050 : see if setlinebuf exists
11051 set setlinebuf d_setlinebuf
11052 eval $inlibc
11053
11054 : see if setlocale exists
11055 set setlocale d_setlocale
11056 eval $inlibc
11057
11058 : see if setnetent exists
11059 set setnetent d_setnent
11060 eval $inlibc
11061
11062 : see if setprotoent exists
11063 set setprotoent d_setpent
11064 eval $inlibc
11065
11066 : see if setpgid exists
11067 set setpgid d_setpgid
11068 eval $inlibc
11069
11070 : see if setpgrp2 exists
11071 set setpgrp2 d_setpgrp2
11072 eval $inlibc
11073
11074 : see if setpriority exists
11075 set setpriority d_setprior
11076 eval $inlibc
11077
11078 : see if setpwent exists
11079 set setpwent d_setpwent
11080 eval $inlibc
11081
11082 : see if setregid exists
11083 set setregid d_setregid
11084 eval $inlibc
11085 set setresgid d_setresgid
11086 eval $inlibc
11087
11088 : see if setreuid exists
11089 set setreuid d_setreuid
11090 eval $inlibc
11091 set setresuid d_setresuid
11092 eval $inlibc
11093
11094 : see if setrgid exists
11095 set setrgid d_setrgid
11096 eval $inlibc
11097
11098 : see if setruid exists
11099 set setruid d_setruid
11100 eval $inlibc
11101
11102 : see if setservent exists
11103 set setservent d_setsent
11104 eval $inlibc
11105
11106 : see if setsid exists
11107 set setsid d_setsid
11108 eval $inlibc
11109
11110 : see if setvbuf exists
11111 set setvbuf d_setvbuf
11112 eval $inlibc
11113
11114 : see if sfio.h is available
11115 set sfio.h i_sfio
11116 eval $inhdr
11117
11118
11119 : see if sfio library is available
11120 case "$i_sfio" in
11121 $define)
11122         val=''
11123         set sfreserve val
11124         eval $inlibc
11125         ;;
11126 *)
11127         val="$undef"
11128         ;;
11129 esac
11130 : Ok, but do we want to use it.
11131 case "$val" in
11132 $define)
11133         case "$usesfio" in
11134         true|$define|[yY]*) dflt='y';;
11135         *) dflt='n';;
11136         esac
11137         echo "$package can use the sfio library, but it is experimental."
11138         rp="You seem to have sfio available, do you want to try using it?"
11139         . ./myread
11140         case "$ans" in
11141         y|Y) ;;
11142         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11143                 val="$undef"
11144                 : Remove sfio from list of libraries to use
11145                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11146                 shift
11147                 libs="$*"
11148                 echo "libs = $libs" >&4
11149                 ;;
11150         esac
11151         ;;
11152 *)      case "$usesfio" in
11153         true|$define|[yY]*)
11154                 echo "Sorry, cannot find sfio on this machine" >&4
11155                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11156                 ;;
11157         esac
11158         ;;
11159 esac
11160 set d_sfio
11161 eval $setvar
11162 case "$d_sfio" in
11163 $define) usesfio='true';;
11164 *) usesfio='false';;
11165 esac
11166
11167 : see if shmctl exists
11168 set shmctl d_shmctl
11169 eval $inlibc
11170
11171 : see if shmget exists
11172 set shmget d_shmget
11173 eval $inlibc
11174
11175 : see if shmat exists
11176 set shmat d_shmat
11177 eval $inlibc
11178 : see what shmat returns
11179 case "$d_shmat" in
11180 "$define")
11181         $cat >shmat.c <<'END'
11182 #include <sys/shm.h>
11183 void *shmat();
11184 END
11185         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11186                 shmattype='void *'
11187         else
11188                 shmattype='char *'
11189         fi
11190         echo "and it returns ($shmattype)." >&4
11191         : see if a prototype for shmat is available
11192         xxx=`./findhdr sys/shm.h`
11193         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11194         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11195                 val="$define"
11196         else
11197                 val="$undef"
11198         fi
11199         $rm -f shmat.[co]
11200         ;;
11201 *)
11202         val="$undef"
11203         ;;
11204 esac
11205 set d_shmatprototype
11206 eval $setvar
11207
11208 : see if shmdt exists
11209 set shmdt d_shmdt
11210 eval $inlibc
11211
11212 : see how much of the 'shm*(2)' library is present.
11213 h_shm=true
11214 echo " "
11215 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11216 *"$undef"*) h_shm=false;;
11217 esac
11218 case "$osname" in
11219 freebsd)
11220     case "`ipcs 2>&1`" in
11221     "SVID shared memory"*"not configured"*)
11222         echo "Your $osname does not have the shm*(2) configured." >&4
11223         h_shm=false
11224         val="$undef"
11225         set shmctl d_shmctl
11226         evat $setvar
11227         set shmget d_shmget
11228         evat $setvar
11229         set shmat d_shmat
11230         evat $setvar
11231         set shmdt d_shmdt
11232         evat $setvar
11233         ;;
11234     esac
11235     ;;
11236 esac
11237 : we could also check for sys/ipc.h ...
11238 if $h_shm && $test `./findhdr sys/shm.h`; then
11239         echo "You have the full shm*(2) library." >&4
11240         val="$define"
11241 else
11242         echo "You don't have the full shm*(2) library." >&4
11243         val="$undef"
11244 fi
11245 set d_shm
11246 eval $setvar
11247
11248 echo " "
11249 : see if we have sigaction
11250 if set sigaction val -f d_sigaction; eval $csym; $val; then
11251         echo 'sigaction() found.' >&4
11252         $cat > try.c <<'EOP'
11253 #include <stdio.h>
11254 #include <sys/types.h>
11255 #include <signal.h>
11256 int main()
11257 {
11258     struct sigaction act, oact;
11259     act.sa_flags = 0;
11260     oact.sa_handler = 0;
11261     /* so that act and oact are used */
11262     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11263 }
11264 EOP
11265         set try
11266         if eval $compile_ok; then
11267                 val="$define"
11268         else
11269                 echo "But you don't seem to have a useable struct sigaction." >&4
11270                 val="$undef"
11271         fi
11272 else
11273         echo 'sigaction NOT found.' >&4
11274         val="$undef"
11275 fi
11276 set d_sigaction; eval $setvar
11277 $rm -f try try$_o try.c
11278
11279 : see if sigsetjmp exists
11280 echo " "
11281 case "$d_sigsetjmp" in
11282 '')
11283         $cat >try.c <<'EOP'
11284 #include <setjmp.h>
11285 sigjmp_buf env;
11286 int set = 1;
11287 int main()
11288 {
11289         if (sigsetjmp(env,1))
11290                 exit(set);
11291         set = 0;
11292         siglongjmp(env, 1);
11293         exit(1);
11294 }
11295 EOP
11296         set try
11297         if eval $compile; then
11298                 if ./try >/dev/null 2>&1; then
11299                         echo "POSIX sigsetjmp found." >&4
11300                         val="$define"
11301                 else
11302                         $cat >&4 <<EOM
11303 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11304 I'll ignore them.
11305 EOM
11306                         val="$undef"
11307                 fi
11308         else
11309                 echo "sigsetjmp not found." >&4
11310                 val="$undef"
11311         fi
11312         ;;
11313 *) val="$d_sigsetjmp"
11314         case "$d_sigsetjmp" in
11315         $define) echo "POSIX sigsetjmp found." >&4;;
11316         $undef) echo "sigsetjmp not found." >&4;;
11317         esac
11318         ;;
11319 esac
11320 set d_sigsetjmp
11321 eval $setvar
11322 $rm -f try.c try
11323
11324 : see if sys/stat.h is available
11325 set sys/stat.h i_sysstat
11326 eval $inhdr
11327
11328
11329 : see if stat knows about block sizes
11330 echo " "
11331 echo "Checking to see if your struct stat has st_blocks field..." >&4
11332 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11333 eval $hasfield
11334
11335
11336 : see if this is a sys/vfs.h system
11337 set sys/vfs.h i_sysvfs
11338 eval $inhdr
11339
11340
11341 : see if this is a sys/statfs.h system
11342 set sys/statfs.h i_sysstatfs
11343 eval $inhdr
11344
11345
11346 echo " "
11347 echo "Checking to see if your system supports struct statfs..." >&4
11348 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
11349 eval $hasstruct
11350 case "$d_statfs_s" in
11351 "$define")      echo "Yes, it does."   ;;
11352 *)              echo "No, it doesn't." ;;
11353 esac
11354
11355
11356
11357 : see if struct statfs knows about f_flags
11358 case "$d_statfs_s" in
11359 define) 
11360         echo " "
11361         echo "Checking to see if your struct statfs has f_flags field..." >&4
11362         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
11363         eval $hasfield
11364         ;;
11365 *)      val="$undef"
11366         set d_statfs_f_flags
11367         eval $setvar
11368         ;;
11369 esac
11370 case "$d_statfs_f_flags" in
11371 "$define")      echo "Yes, it does."   ;;
11372 *)              echo "No, it doesn't." ;;
11373 esac
11374
11375 : see if _ptr and _cnt from stdio act std
11376 echo " "
11377 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11378         echo "(Looks like you have stdio.h from Linux.)"
11379         case "$stdio_ptr" in
11380         '') stdio_ptr='((fp)->_IO_read_ptr)'
11381                 ptr_lval=$define
11382                 ;;
11383         *)      ptr_lval=$d_stdio_ptr_lval;;
11384         esac
11385         case "$stdio_cnt" in
11386         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11387                 cnt_lval=$undef
11388                 ;;
11389         *)      cnt_lval=$d_stdio_cnt_lval;;
11390         esac
11391         case "$stdio_base" in
11392         '') stdio_base='((fp)->_IO_read_base)';;
11393         esac
11394         case "$stdio_bufsiz" in
11395         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11396         esac
11397 else
11398         case "$stdio_ptr" in
11399         '') stdio_ptr='((fp)->_ptr)'
11400                 ptr_lval=$define
11401                 ;;
11402         *)      ptr_lval=$d_stdio_ptr_lval;;
11403         esac
11404         case "$stdio_cnt" in
11405         '') stdio_cnt='((fp)->_cnt)'
11406                 cnt_lval=$define
11407                 ;;
11408         *)      cnt_lval=$d_stdio_cnt_lval;;
11409         esac
11410         case "$stdio_base" in
11411         '') stdio_base='((fp)->_base)';;
11412         esac
11413         case "$stdio_bufsiz" in
11414         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11415         esac
11416 fi
11417 : test whether _ptr and _cnt really work
11418 echo "Checking how std your stdio is..." >&4
11419 $cat >try.c <<EOP
11420 #include <stdio.h>
11421 #define FILE_ptr(fp)    $stdio_ptr
11422 #define FILE_cnt(fp)    $stdio_cnt
11423 int main() {
11424         FILE *fp = fopen("try.c", "r");
11425         char c = getc(fp);
11426         if (
11427                 18 <= FILE_cnt(fp) &&
11428                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11429         )
11430                 exit(0);
11431         exit(1);
11432 }
11433 EOP
11434 val="$undef"
11435 set try
11436 if eval $compile; then
11437         if ./try; then
11438                 echo "Your stdio acts pretty std."
11439                 val="$define"
11440         else
11441                 echo "Your stdio isn't very std."
11442         fi
11443 else
11444         echo "Your stdio doesn't appear very std."
11445 fi
11446 $rm -f try.c try
11447 set d_stdstdio
11448 eval $setvar
11449
11450 : Can _ptr be used as an lvalue?
11451 case "$d_stdstdio$ptr_lval" in
11452 $define$define) val=$define ;;
11453 *) val=$undef ;;
11454 esac
11455 set d_stdio_ptr_lval
11456 eval $setvar
11457
11458 : Can _cnt be used as an lvalue?
11459 case "$d_stdstdio$cnt_lval" in
11460 $define$define) val=$define ;;
11461 *) val=$undef ;;
11462 esac
11463 set d_stdio_cnt_lval
11464 eval $setvar
11465
11466 : see if _base is also standard
11467 val="$undef"
11468 case "$d_stdstdio" in
11469 $define)
11470         $cat >try.c <<EOP
11471 #include <stdio.h>
11472 #define FILE_base(fp)   $stdio_base
11473 #define FILE_bufsiz(fp) $stdio_bufsiz
11474 int main() {
11475         FILE *fp = fopen("try.c", "r");
11476         char c = getc(fp);
11477         if (
11478                 19 <= FILE_bufsiz(fp) &&
11479                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11480         )
11481                 exit(0);
11482         exit(1);
11483 }
11484 EOP
11485         set try
11486         if eval $compile; then
11487                 if ./try; then
11488                         echo "And its _base field acts std."
11489                         val="$define"
11490                 else
11491                         echo "But its _base field isn't std."
11492                 fi
11493         else
11494                 echo "However, it seems to be lacking the _base field."
11495         fi
11496         $rm -f try.c try
11497         ;;
11498 esac
11499 set d_stdiobase
11500 eval $setvar
11501
11502 $cat >&4 <<EOM
11503 Checking how to access stdio streams by file descriptor number...
11504 EOM
11505 case "$stdio_stream_array" in
11506 '')     $cat >try.c <<EOCP
11507 #include <stdio.h>
11508 int main() {
11509   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11510     printf("yes\n");
11511 }
11512 EOCP
11513         for s in _iob __iob __sF
11514         do
11515                 set try -DSTDIO_STREAM_ARRAY=$s
11516                 if eval $compile; then
11517                         case "`./try$exe_ext`" in
11518                         yes)    stdio_stream_array=$s; break ;;
11519                         esac
11520                 fi
11521         done
11522         $rm -f try.* try$exe_ext
11523 esac
11524 case "$stdio_stream_array" in
11525 '')     $cat >&4 <<EOM
11526 I can't figure out how to access stdio streams by file descriptor number.
11527 EOM
11528         d_stdio_stream_array="$undef"
11529         ;;
11530 *)      $cat >&4 <<EOM
11531 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11532 EOM
11533         d_stdio_stream_array="$define"
11534         ;;
11535 esac
11536
11537 : see if strcoll exists
11538 set strcoll d_strcoll
11539 eval $inlibc
11540
11541 : check for structure copying
11542 echo " "
11543 echo "Checking to see if your C compiler can copy structs..." >&4
11544 $cat >try.c <<'EOCP'
11545 int main()
11546 {
11547         struct blurfl {
11548                 int dyick;
11549         } foo, bar;
11550
11551         foo = bar;
11552 }
11553 EOCP
11554 if $cc -c try.c >/dev/null 2>&1 ; then
11555         val="$define"
11556         echo "Yup, it can."
11557 else
11558         val="$undef"
11559         echo "Nope, it can't."
11560 fi
11561 set d_strctcpy
11562 eval $setvar
11563 $rm -f try.*
11564
11565 : see if strerror and/or sys_errlist[] exist
11566 echo " "
11567 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11568     if set strerror val -f d_strerror; eval $csym; $val; then
11569                 echo 'strerror() found.' >&4
11570                 d_strerror="$define"
11571                 d_strerrm='strerror(e)'
11572                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11573                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11574                         d_syserrlst="$define"
11575                 else
11576                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11577                         d_syserrlst="$undef"
11578                 fi
11579     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11580                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11581                 echo 'strerror() found in string header.' >&4
11582                 d_strerror="$define"
11583                 d_strerrm='strerror(e)'
11584                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11585                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11586                                 d_syserrlst="$define"
11587                 else
11588                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11589                         d_syserrlst="$undef"
11590                 fi
11591     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11592                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11593                 d_strerror="$undef"
11594                 d_syserrlst="$define"
11595                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11596     else
11597                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11598                 d_strerror="$undef"
11599                 d_syserrlst="$undef"
11600                 d_strerrm='"unknown"'
11601     fi
11602 fi
11603
11604 : see if strtod exists
11605 set strtod d_strtod
11606 eval $inlibc
11607
11608 : see if strtol exists
11609 set strtol d_strtol
11610 eval $inlibc
11611
11612 : see if strtold exists
11613 set strtold d_strtold
11614 eval $inlibc
11615
11616 : see if strtoll exists
11617 set strtoll d_strtoll
11618 eval $inlibc
11619
11620 case "$d_longlong-$d_strtoll" in
11621 "$define-$define")
11622         $cat <<EOM
11623 Checking whether your strtoll() works okay...
11624 EOM
11625         $cat >try.c <<'EOCP'
11626 #include <errno.h>
11627 #ifdef __hpux
11628 #define strtoll __strtoll
11629 #endif
11630 #include <stdio.h>
11631 extern long long int strtoll(char *s, char **, int); 
11632 static int bad = 0;
11633 int check(char *s, long long ell, int een) {
11634         long long gll;
11635         errno = 0;
11636         gll = strtoll(s, 0, 10);
11637         if (!((gll == ell) && (errno == een)))
11638                 bad++;
11639 }
11640 int main() {
11641         check(" 1",                                      1LL, 0);
11642         check(" 0",                                      0LL, 0);
11643         check("-1",                                     -1LL, 0);
11644         check("-9223372036854775808", -9223372036854775808LL, 0);
11645         check("-9223372036854775808", -9223372036854775808LL, 0);
11646         check(" 9223372036854775807",  9223372036854775807LL, 0);
11647         check("-9223372036854775808", -9223372036854775808LL, 0);
11648         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11649         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11650         if (!bad)
11651                 printf("ok\n");
11652 }
11653 EOCP
11654         set try
11655         if eval $compile; then
11656                 case "`./try`" in
11657                 ok) echo "Your strtoll() seems to be working okay." ;;
11658                 *) cat <<EOM >&4
11659 Your strtoll() doesn't seem to be working okay.
11660 EOM
11661                    d_strtoll="$undef"
11662                    ;;
11663                 esac
11664         fi
11665         ;;
11666 esac
11667
11668 : see if strtoul exists
11669 set strtoul d_strtoul
11670 eval $inlibc
11671
11672 : see if strtoull exists
11673 set strtoull d_strtoull
11674 eval $inlibc
11675
11676 case "$d_longlong-$d_strtoull" in
11677 "$define-$define")
11678         $cat <<EOM
11679 Checking whether your strtoull() works okay...
11680 EOM
11681         $cat >try.c <<'EOCP'
11682 #include <errno.h>
11683 #ifdef __hpux
11684 #define strtoull __strtoull
11685 #endif
11686 #include <stdio.h>
11687 extern unsigned long long int strtoull(char *s, char **, int); 
11688 static int bad = 0;
11689 int check(char *s, long long eull, int een) {
11690         long long gull;
11691         errno = 0;
11692         gull = strtoull(s, 0, 10);
11693         if (!((gull == eull) && (errno == een)))
11694                 bad++;
11695 }
11696 int main() {
11697         check(" 1",                                       1LL, 0);
11698         check(" 0",                                       0LL, 0);
11699         check("18446744073709551615", 18446744073709551615ULL, 0);
11700         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11701         if (!bad)
11702                 printf("ok\n");
11703 }
11704 EOCP
11705         set try
11706         if eval $compile; then
11707                 case "`./try`" in
11708                 ok) echo "Your strtoull() seems to be working okay." ;;
11709                 *) cat <<EOM >&4
11710 Your strtoull() doesn't seem to be working okay.
11711 EOM
11712                    d_strtoull="$undef"
11713                    ;;
11714                 esac
11715         fi
11716         ;;
11717 esac
11718
11719 : see if strtouq exists
11720 set strtouq d_strtouq
11721 eval $inlibc
11722
11723 : see if strxfrm exists
11724 set strxfrm d_strxfrm
11725 eval $inlibc
11726
11727 : see if symlink exists
11728 set symlink d_symlink
11729 eval $inlibc
11730
11731 : see if syscall exists
11732 set syscall d_syscall
11733 eval $inlibc
11734
11735 : see if sysconf exists
11736 set sysconf d_sysconf
11737 eval $inlibc
11738
11739 : see if system exists
11740 set system d_system
11741 eval $inlibc
11742
11743 : see if tcgetpgrp exists
11744 set tcgetpgrp d_tcgetpgrp
11745 eval $inlibc
11746
11747 : see if tcsetpgrp exists
11748 set tcsetpgrp d_tcsetpgrp
11749 eval $inlibc
11750
11751 : see if prototype for telldir is available
11752 echo " "
11753 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11754 eval $hasproto
11755
11756 : see if this is a sys/times.h system
11757 set sys/times.h i_systimes
11758 eval $inhdr
11759
11760 : see if times exists
11761 echo " "
11762 if set times val -f d_times; eval $csym; $val; then
11763         echo 'times() found.' >&4
11764         d_times="$define"
11765         inc=''
11766         case "$i_systimes" in
11767         "$define") inc='sys/times.h';;
11768         esac
11769         rp="What is the type returned by times() on this system?"
11770         set clock_t clocktype long stdio.h sys/types.h $inc
11771         eval $typedef_ask
11772 else
11773         echo 'times() NOT found, hope that will do.' >&4
11774         d_times="$undef"
11775         clocktype='int'
11776 fi
11777
11778 : see if truncate exists
11779 set truncate d_truncate
11780 eval $inlibc
11781
11782 : see if tzname[] exists
11783 echo " "
11784 if set tzname val -a d_tzname; eval $csym; $val; then
11785         val="$define"
11786         echo 'tzname[] found.' >&4
11787 else
11788         val="$undef"
11789         echo 'tzname[] NOT found.' >&4
11790 fi
11791 set d_tzname
11792 eval $setvar
11793
11794 : see if umask exists
11795 set umask d_umask
11796 eval $inlibc
11797
11798 : see if ustat exists
11799 set ustat d_ustat
11800 eval $inlibc
11801
11802 : backward compatibility for d_hvfork
11803 if test X$d_hvfork != X; then
11804         d_vfork="$d_hvfork"
11805         d_hvfork=''
11806 fi
11807 : see if there is a vfork
11808 val=''
11809 set vfork val
11810 eval $inlibc
11811
11812 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11813 : perl on Solaris 2.x, and probably elsewhere.
11814 case "$val" in
11815 $define)
11816         echo " "
11817         case "$usevfork" in
11818         false) dflt='n';;
11819         *) dflt='y';;
11820         esac
11821         cat <<'EOM'
11822  
11823 Perl can only use a vfork() that doesn't suffer from strict
11824 restrictions on calling functions or modifying global data in
11825 the child.  For example, glibc-2.1 contains such a vfork()
11826 that is unsuitable.  If your system provides a proper fork()
11827 call, chances are that you do NOT want perl to use vfork().
11828
11829 EOM
11830         rp="Do you still want to use vfork()?"
11831         . ./myread
11832         case "$ans" in
11833         y|Y) ;;
11834         *)
11835                 echo "Ok, we won't use vfork()."
11836                 val="$undef"
11837                 ;;
11838         esac
11839         ;;
11840 esac
11841 set d_vfork
11842 eval $setvar
11843 case "$d_vfork" in
11844 $define) usevfork='true';;
11845 *) usevfork='false';;
11846 esac
11847
11848 : see if this is an sysdir system
11849 set sys/dir.h i_sysdir
11850 eval $inhdr
11851
11852 : see if this is an sysndir system
11853 set sys/ndir.h i_sysndir
11854 eval $inhdr
11855
11856 : see if closedir exists
11857 set closedir d_closedir
11858 eval $inlibc
11859
11860 case "$d_closedir" in
11861 "$define")
11862         echo " "
11863         echo "Checking whether closedir() returns a status..." >&4
11864         cat > closedir.c <<EOM
11865 #$i_dirent I_DIRENT             /**/
11866 #$i_sysdir I_SYS_DIR            /**/
11867 #$i_sysndir I_SYS_NDIR          /**/
11868 #$i_systypes I_SYS_TYPES        /**/
11869
11870 #if defined(I_SYS_TYPES)
11871 #include <sys/types.h>
11872 #endif
11873 #if defined(I_DIRENT)
11874 #include <dirent.h>
11875 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11876 #include <sys/dir.h>
11877 #endif
11878 #else
11879 #ifdef I_SYS_NDIR
11880 #include <sys/ndir.h>
11881 #else
11882 #ifdef I_SYS_DIR
11883 #ifdef hp9000s500
11884 #include <ndir.h>       /* may be wrong in the future */
11885 #else
11886 #include <sys/dir.h>
11887 #endif
11888 #endif
11889 #endif
11890 #endif 
11891 int main() { return closedir(opendir(".")); }
11892 EOM
11893         set closedir
11894         if eval $compile_ok; then
11895                 if ./closedir > /dev/null 2>&1 ; then
11896                         echo "Yes, it does."
11897                         val="$undef"
11898                 else
11899                         echo "No, it doesn't."
11900                         val="$define"
11901                 fi
11902         else
11903                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11904                 val="$define"
11905         fi
11906         ;;
11907 *)
11908         val="$undef";
11909         ;;
11910 esac
11911 set d_void_closedir
11912 eval $setvar
11913 $rm -f closedir*
11914 : check for volatile keyword
11915 echo " "
11916 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11917 $cat >try.c <<'EOCP'
11918 int main()
11919 {
11920         typedef struct _goo_struct goo_struct;
11921         goo_struct * volatile goo = ((goo_struct *)0);
11922         struct _goo_struct {
11923                 long long_int;
11924                 int reg_int;
11925                 char char_var;
11926         };
11927         typedef unsigned short foo_t;
11928         char *volatile foo;
11929         volatile int bar;
11930         volatile foo_t blech;
11931         foo = foo;
11932 }
11933 EOCP
11934 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11935         val="$define"
11936         echo "Yup, it does."
11937 else
11938         val="$undef"
11939         echo "Nope, it doesn't."
11940 fi
11941 set d_volatile
11942 eval $setvar
11943 $rm -f try.*
11944
11945 : see if there is a wait4
11946 set wait4 d_wait4
11947 eval $inlibc
11948
11949 : see if waitpid exists
11950 set waitpid d_waitpid
11951 eval $inlibc
11952
11953 : see if wcstombs exists
11954 set wcstombs d_wcstombs
11955 eval $inlibc
11956
11957 : see if wctomb exists
11958 set wctomb d_wctomb
11959 eval $inlibc
11960
11961 : preserve RCS keywords in files with variable substitution, grrr
11962 Date='$Date'
11963 Id='$Id'
11964 Log='$Log'
11965 RCSfile='$RCSfile'
11966 Revision='$Revision'
11967
11968 case "$crosscompile" in
11969 ''|[nN]*) crosscompile="$undef" ;;
11970 esac
11971
11972 case "$osname" in
11973 next|rhapsody|darwin) multiarch="$define" ;;
11974 esac
11975 case "$multiarch" in
11976 ''|[nN]*) multiarch="$undef" ;;
11977 esac
11978
11979 : check for alignment requirements
11980 echo " "
11981 case "$crosscompile$multiarch" in
11982 *$define*)
11983         $cat <<EOM
11984 You seem to be either cross-compiling or doing a multiarchitecture build,
11985 skipping the memory alignment check.
11986
11987 EOM
11988         case "$alignbytes" in
11989         '') alignbytes=8 ;;
11990         esac
11991         ;;
11992 *)
11993         case "$alignbytes" in
11994         '') echo "Checking alignment constraints..." >&4
11995                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11996                         $cat >try.c <<'EOCP'
11997 typedef long double NV;
11998 EOCP
11999                 else
12000                         $cat >try.c <<'EOCP'
12001 typedef double NV;
12002 EOCP
12003                 fi
12004                 $cat >>try.c <<'EOCP'
12005 #include <stdio.h>
12006 struct foobar {
12007         char foo;
12008         NV bar;
12009 } try_algn;
12010 int main()
12011 {
12012     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12013     return(0);
12014 }
12015 EOCP
12016                 set try
12017                 if eval $compile_ok; then
12018                         dflt=`./try`
12019                 else
12020                         dflt='8'
12021                         echo "(I can't seem to compile the test program...)"
12022                 fi
12023                 ;;
12024         *) dflt="$alignbytes"
12025                 ;;
12026         esac
12027         rp="Doubles must be aligned on a how-many-byte boundary?"
12028         . ./myread
12029         alignbytes="$ans"
12030         $rm -f try.c try
12031         ;;
12032 esac
12033
12034
12035 : set the base revision
12036 baserev=5.0
12037
12038 : check for ordering of bytes in a long
12039 echo " "
12040 case "$crosscompile$multiarch" in
12041 *$define*)
12042         $cat <<EOM
12043 You seem to be either cross-compiling or doing a multiarchitecture build,
12044 skipping the byteorder check.
12045
12046 EOM
12047         byteorder='0xffff'
12048         ;;
12049 *)
12050         case "$byteorder" in
12051         '')
12052                 $cat <<'EOM'
12053 In the following, larger digits indicate more significance.  A big-endian
12054 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12055 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12056 machines may have weird orders like 3412.  A Cray will report 87654321,
12057 an Alpha will report 12345678. If the test program works the default is
12058 probably right.
12059 I'm now running the test program...
12060 EOM
12061                 $cat >try.c <<'EOCP'
12062 #include <stdio.h>
12063 int main()
12064 {
12065         int i;
12066         union {
12067                 unsigned long l;
12068                 char c[sizeof(long)];
12069         } u;
12070
12071         if (sizeof(long) > 4)
12072                 u.l = (0x08070605L << 32) | 0x04030201L;
12073         else
12074                 u.l = 0x04030201L;
12075         for (i = 0; i < sizeof(long); i++)
12076                 printf("%c", u.c[i]+'0');
12077         printf("\n");
12078         exit(0);
12079 }
12080 EOCP
12081                 xxx_prompt=y
12082                 set try
12083                 if eval $compile && ./try > /dev/null; then
12084                         dflt=`./try`
12085                         case "$dflt" in
12086                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12087                                 echo "(The test program ran ok.)"
12088                                 echo "byteorder=$dflt"
12089                                 xxx_prompt=n
12090                         ;;
12091                         ????|????????) echo "(The test program ran ok.)" ;;
12092                         *) echo "(The test program didn't run right for some reason.)" ;;
12093                         esac
12094                 else
12095                         dflt='4321'
12096                         cat <<'EOM'
12097 (I can't seem to compile the test program.  Guessing big-endian...)
12098 EOM
12099                 fi
12100                 case "$xxx_prompt" in
12101                 y)
12102                         rp="What is the order of bytes in a long?"
12103                         . ./myread
12104                         byteorder="$ans"
12105                         ;;
12106                 *)      byteorder=$dflt
12107                         ;;
12108                 esac
12109                 ;;
12110         esac
12111         $rm -f try.c try
12112         ;;
12113 esac
12114
12115
12116 : how do we catenate cpp tokens here?
12117 echo " "
12118 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12119 $cat >cpp_stuff.c <<'EOCP'
12120 #define RCAT(a,b)a/**/b
12121 #define ACAT(a,b)a ## b
12122 RCAT(Rei,ser)
12123 ACAT(Cir,cus)
12124 EOCP
12125 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12126 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12127         echo "Oh!  Smells like ANSI's been here." >&4
12128         echo "We can catify or stringify, separately or together!"
12129         cpp_stuff=42
12130 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12131         echo "Ah, yes!  The good old days!" >&4
12132         echo "However, in the good old days we don't know how to stringify and"
12133         echo "catify at the same time."
12134         cpp_stuff=1
12135 else
12136         $cat >&4 <<EOM
12137 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12138 to have to edit the values of CAT[2-5] in config.h...
12139 EOM
12140         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12141 fi
12142 $rm -f cpp_stuff.*
12143
12144 : see if this is a db.h system
12145 set db.h i_db
12146 eval $inhdr
12147
12148 case "$i_db" in
12149 $define)
12150         : Check db version.
12151         echo " "
12152         echo "Checking Berkeley DB version ..." >&4
12153         $cat >try.c <<EOCP
12154 #$d_const HASCONST
12155 #ifndef HASCONST
12156 #define const
12157 #endif
12158 #include <sys/types.h>
12159 #include <stdio.h>
12160 #include <db.h>
12161 int main()
12162 {
12163 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12164     int Major, Minor, Patch ;
12165     unsigned long Version ;
12166     (void)db_version(&Major, &Minor, &Patch) ;
12167     printf("You have Berkeley DB Version 2 or greater\n");
12168
12169     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12170                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12171     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12172                 Major, Minor, Patch) ;
12173
12174     /* check that db.h & libdb are compatible */
12175     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12176         printf("db.h and libdb are incompatible\n") ;
12177         exit(3);        
12178     }
12179
12180     printf("db.h and libdb are compatible\n") ;
12181
12182     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12183                 + DB_VERSION_PATCH ;
12184
12185     /* needs to be >= 2.3.4 */
12186     if (Version < 2003004) {
12187     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12188         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12189         exit(2);        
12190     }
12191
12192     exit(0);
12193 #else
12194 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12195     printf("You have Berkeley DB Version 1\n");
12196     exit(0);    /* DB version < 2: the coast is clear. */
12197 #else
12198     exit(1);    /* <db.h> not Berkeley DB? */
12199 #endif
12200 #endif
12201 }
12202 EOCP
12203         set try
12204         if eval $compile_ok && ./try; then
12205                 echo 'Looks OK.' >&4
12206         else
12207                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12208                 i_db=$undef
12209                 case " $libs " in
12210                 *"-ldb "*)
12211                         : Remove db from list of libraries to use
12212                         echo "Removing unusable -ldb from library list" >&4
12213                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12214                         shift
12215                         libs="$*"
12216                         echo "libs = $libs" >&4
12217                         ;;
12218                 esac
12219         fi
12220         $rm -f try.*
12221         ;;
12222 esac
12223
12224 case "$i_db" in
12225 define)
12226         : Check the return type needed for hash 
12227         echo " "
12228         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12229         $cat >try.c <<EOCP
12230 #$d_const HASCONST
12231 #ifndef HASCONST
12232 #define const
12233 #endif
12234 #include <sys/types.h>
12235 #include <db.h>
12236
12237 #ifndef DB_VERSION_MAJOR
12238 u_int32_t hash_cb (ptr, size)
12239 const void *ptr;
12240 size_t size;
12241 {
12242 }
12243 HASHINFO info;
12244 int main()
12245 {
12246         info.hash = hash_cb;
12247 }
12248 #endif
12249 EOCP
12250         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12251                 if $contains warning try.out >>/dev/null 2>&1 ; then
12252                         db_hashtype='int'
12253                 else
12254                         db_hashtype='u_int32_t'
12255                 fi
12256         else
12257                 : XXX Maybe we should just give up here.
12258                 db_hashtype=u_int32_t
12259                 $cat try.out >&4
12260                 echo "Help:  I can't seem to compile the db test program." >&4
12261                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12262         fi
12263         $rm -f try.*
12264         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12265         ;;
12266 *)      db_hashtype=u_int32_t
12267         ;;
12268 esac
12269 case "$i_db" in
12270 define)
12271         : Check the return type needed for prefix 
12272         echo " "
12273         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12274         cat >try.c <<EOCP
12275 #$d_const HASCONST
12276 #ifndef HASCONST
12277 #define const
12278 #endif
12279 #include <sys/types.h>
12280 #include <db.h>
12281
12282 #ifndef DB_VERSION_MAJOR
12283 size_t prefix_cb (key1, key2)
12284 const DBT *key1;
12285 const DBT *key2;
12286 {
12287 }
12288 BTREEINFO info;
12289 int main()
12290 {
12291         info.prefix = prefix_cb;
12292 }
12293 #endif
12294 EOCP
12295         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12296                 if $contains warning try.out >>/dev/null 2>&1 ; then
12297                         db_prefixtype='int'
12298                 else
12299                         db_prefixtype='size_t'
12300                 fi
12301         else
12302                 db_prefixtype='size_t'
12303                 : XXX Maybe we should just give up here.
12304                 $cat try.out >&4
12305                 echo "Help:  I can't seem to compile the db test program." >&4
12306                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12307         fi
12308         $rm -f try.*
12309         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12310         ;;
12311 *)      db_prefixtype='size_t'
12312         ;;
12313 esac
12314
12315 : check for void type
12316 echo " "
12317 echo "Checking to see how well your C compiler groks the void type..." >&4
12318 case "$voidflags" in
12319 '')
12320         $cat >try.c <<'EOCP'
12321 #if TRY & 1
12322 void sub() {
12323 #else
12324 sub() {
12325 #endif
12326         extern void moo();      /* function returning void */
12327         void (*goo)();          /* ptr to func returning void */
12328 #if TRY & 8
12329         void *hue;              /* generic ptr */
12330 #endif
12331 #if TRY & 2
12332         void (*foo[10])();
12333 #endif
12334
12335 #if TRY & 4
12336         if(goo == moo) {
12337                 exit(0);
12338         }
12339 #endif
12340         exit(0);
12341 }
12342 int main() { sub(); }
12343 EOCP
12344         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12345                 voidflags=$defvoidused
12346         echo "Good.  It appears to support void to the level $package wants.">&4
12347                 if $contains warning .out >/dev/null 2>&1; then
12348                         echo "However, you might get some warnings that look like this:"
12349                         $cat .out
12350                 fi
12351         else
12352 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12353                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12354                         echo "It supports 1..."
12355                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12356                                 echo "It also supports 2..."
12357                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12358                                         voidflags=7
12359                                         echo "And it supports 4 but not 8 definitely."
12360                                 else
12361                                         echo "It doesn't support 4..."
12362                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12363                                                 voidflags=11
12364                                                 echo "But it supports 8."
12365                                         else
12366                                                 voidflags=3
12367                                                 echo "Neither does it support 8."
12368                                         fi
12369                                 fi
12370                         else
12371                                 echo "It does not support 2..."
12372                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12373                                         voidflags=13
12374                                         echo "But it supports 4 and 8."
12375                                 else
12376                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12377                                                 voidflags=5
12378                                                 echo "And it supports 4 but has not heard about 8."
12379                                         else
12380                                                 echo "However it supports 8 but not 4."
12381                                         fi
12382                                 fi
12383                         fi
12384                 else
12385                         echo "There is no support at all for void."
12386                         voidflags=0
12387                 fi
12388         fi
12389 esac
12390 case "$voidflags" in
12391 "$defvoidused") ;;
12392 *)      $cat >&4 <<'EOM'
12393   Support flag bits are:
12394     1: basic void declarations.
12395     2: arrays of pointers to functions returning void.
12396     4: operations between pointers to and addresses of void functions.
12397     8: generic void pointers.
12398 EOM
12399         dflt="$voidflags";
12400         rp="Your void support flags add up to what?"
12401         . ./myread
12402         voidflags="$ans"
12403         ;;
12404 esac
12405 $rm -f try.* .out
12406
12407
12408 : How can we generate normalized random numbers ?
12409 echo " "
12410 echo "Looking for a random number function..." >&4
12411 case "$randfunc" in
12412 '')
12413         if set drand48 val -f; eval $csym; $val; then
12414                 dflt="drand48"
12415                 echo "Good, found drand48()." >&4
12416         elif set random val -f; eval $csym; $val; then
12417                 dflt="random"
12418                 echo "OK, found random()." >&4
12419         else
12420                 dflt="rand"
12421                 echo "Yick, looks like I have to use rand()." >&4
12422         fi
12423         echo " "
12424         ;;
12425 *)
12426         dflt="$randfunc"
12427         ;;
12428 esac
12429 cont=true
12430
12431 case "$ccflags" in
12432 *-Dmy_rand=*|*-Dmy_srand=*)
12433         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12434         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12435         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12436         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12437         ;;
12438 esac
12439
12440 while $test "$cont"; do
12441         rp="Use which function to generate random numbers?"
12442         . ./myread
12443         if $test "$ans" = "$dflt"; then
12444                 : null
12445         else
12446                 randbits=''
12447         fi
12448         randfunc="$ans"
12449         if set $ans val -f; eval $csym; $val; then
12450                 cont=''
12451         else
12452                 dflt=y
12453                 rp="I cannot find function $ans. Use that name anyway?"
12454                 . ./myread
12455                 dflt=rand
12456                 case "$ans" in
12457                         [yY]*) cont='';;
12458                 esac
12459         fi
12460         case "$cont" in
12461         '')
12462                 case "$randfunc" in
12463                 drand48)
12464                         drand01="drand48()"
12465                         seedfunc="srand48"
12466                         randbits=48
12467                         randseedtype=long
12468                         ;;
12469                 rand|random)
12470                         case "$randbits" in
12471                         '')
12472 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12473                                 $cat >try.c <<EOCP
12474 #$i_unistd I_UNISTD
12475 #$i_stdlib I_STDLIB
12476 #include <stdio.h>
12477 #ifdef I_UNISTD
12478 #  include <unistd.h>
12479 #endif
12480 #ifdef I_STDLIB
12481 #  include <stdlib.h>
12482 #endif
12483 int main()
12484 {
12485         register int i;
12486         register unsigned long tmp;
12487         register unsigned long max = 0L;
12488
12489         for (i = 1000; i; i--) {
12490                 tmp = (unsigned long) $randfunc();
12491                 if (tmp > max) max = tmp;
12492         }
12493         for (i = 0; max; i++)
12494                 max /= 2;
12495         printf("%d\n",i);
12496 }
12497 EOCP
12498                                 set try
12499                                 if eval $compile_ok; then
12500                                         dflt=`try`
12501                                 else
12502                                         dflt='?'
12503                                         echo "(I can't seem to compile the test program...)"
12504                                 fi
12505                                 ;;
12506                         *)
12507                                 dflt="$randbits"
12508                                 ;;
12509                         esac
12510                         rp="How many bits does your $randfunc() function produce?"
12511                         . ./myread
12512                         randbits="$ans"
12513                         $rm -f try.c try
12514                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12515                         seedfunc="s$randfunc"
12516                         randseedtype=unsigned
12517                         ;;
12518                 *)
12519                         dflt="31"
12520                         rp="How many bits does your $randfunc() function produce?"
12521                         . ./myread
12522                         randbits="$ans"
12523                         seedfunc="s$randfunc"
12524                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12525                         if set $seedfunc val -f; eval $csym; $val; then
12526                                 echo "(Using $seedfunc() to seed random generator)"
12527                         else
12528                                 echo "(Warning: no $seedfunc() to seed random generator)"
12529                                 seedfunc=rand
12530                         fi
12531                         randseedtype=unsigned
12532                         ;;
12533                 esac
12534                 ;;
12535         esac
12536 done
12537
12538 echo " "
12539 echo "Determining whether or not we are on an EBCDIC system..." >&4
12540 $cat >tebcdic.c <<'EOM'
12541 int main()
12542 {
12543   if ('M'==0xd4) return 0;
12544   return 1;
12545 }
12546 EOM
12547
12548 val=$undef
12549 set tebcdic
12550 if eval $compile_ok; then
12551         if ./tebcdic; then
12552                 echo "You have EBCDIC." >&4
12553                 val="$define"
12554         else
12555                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12556         fi
12557 else
12558         echo "I'm unable to compile the test program." >&4
12559         echo "I'll assume ASCII or some ISO Latin." >&4
12560 fi
12561 $rm -f tebcdic.c tebcdic
12562 set ebcdic
12563 eval $setvar
12564
12565 echo " "
12566 $cat >&4 <<EOM
12567 Checking how to flush all pending stdio output...
12568 EOM
12569 # I only know how to find the first 32 possibly open files on SunOS.
12570 # See also hints/sunos_4_1.sh and util.c  --AD
12571 case "$osname" in
12572 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12573 esac
12574 $cat >>try.c <<EOCP
12575 #include <stdio.h>
12576 #$i_unistd I_UNISTD
12577 #ifdef I_UNISTD
12578 # include <unistd.h>
12579 #endif
12580 #$d_sysconf HAS_SYSCONF
12581 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12582 #ifdef HAS_STDIO_STREAM_ARRAY
12583 # define STDIO_STREAM_ARRAY $stdio_stream_array
12584 #endif
12585 int main() {
12586   FILE* p = fopen("try.out", "w");
12587 #ifdef TRY_FPUTC
12588   fputc('x', p);
12589 #else
12590 # ifdef TRY_FPRINTF
12591   fprintf(p, "x");
12592 # endif
12593 #endif
12594 #ifdef TRY_FFLUSH_NULL
12595   fflush(NULL);
12596 #endif
12597 #ifdef TRY_FFLUSH_ALL
12598   {
12599     long open_max = -1;
12600 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12601     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12602 # else
12603 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12604     open_max = sysconf(_SC_OPEN_MAX);
12605 #  else
12606 #   ifdef FOPEN_MAX
12607     open_max = FOPEN_MAX;
12608 #   else
12609 #    ifdef OPEN_MAX
12610     open_max = OPEN_MAX;
12611 #    else
12612 #     ifdef _NFILE
12613     open_max = _NFILE;
12614 #     endif
12615 #    endif
12616 #   endif
12617 #  endif
12618 # endif 
12619 # ifdef HAS_STDIO_STREAM_ARRAY
12620     if (open_max > 0) {
12621       long i;
12622       for (i = 0; i < open_max; i++)
12623             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12624                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12625                 STDIO_STREAM_ARRAY[i]._flag)
12626                 fflush(&STDIO_STREAM_ARRAY[i]);
12627     }   
12628   }
12629 # endif
12630 #endif
12631   _exit(42);
12632 }
12633 EOCP
12634 : first we have to find out how _not_ to flush
12635 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12636     output=''
12637     set try -DTRY_FPUTC
12638     if eval $compile; then
12639             $rm -f try.out
12640             ./try$exe_ext 2>/dev/null
12641             if $test ! -s try.out -a "X$?" = X42; then
12642                 output=-DTRY_FPUTC
12643             fi
12644     fi
12645     case "$output" in
12646     '')
12647             set try -DTRY_FPRINTF
12648             $rm -f try.out
12649             if eval $compile; then
12650                     $rm -f try.out
12651                     ./try$exe_ext 2>/dev/null
12652                     if $test ! -s try.out -a "X$?" = X42; then
12653                         output=-DTRY_FPRINTF
12654                     fi
12655             fi
12656         ;;
12657     esac
12658 fi
12659 : check for fflush NULL behaviour
12660 case "$fflushNULL" in
12661 '')     set try -DTRY_FFLUSH_NULL $output
12662         if eval $compile; then
12663                 $rm -f try.out
12664                 ./try$exe_ext 2>/dev/null
12665                 code="$?"
12666                 if $test -s try.out -a "X$code" = X42; then
12667                         fflushNULL="`$cat try.out`"
12668                 else
12669                         if $test "X$code" != X42; then
12670                                 $cat >&4 <<EOM
12671 (If this test failed, don't worry, we'll try another method shortly.)
12672 EOM
12673                         fi
12674                 fi
12675         fi
12676         $rm -f core try.core core.try.*
12677         case "$fflushNULL" in
12678         x)      $cat >&4 <<EOM
12679 Your fflush(NULL) works okay for output streams.
12680 Let's see if it clobbers input pipes...
12681 EOM
12682 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12683 # bug that improperly flushes the input end of pipes.  So we avoid the
12684 # autoflush on fork/system/exec support for now. :-(
12685 $cat >tryp.c <<EOCP
12686 #include <stdio.h>
12687 int
12688 main(int argc, char **argv)
12689 {
12690     char buf[1024];
12691     int i;
12692     char *bp = buf;
12693     while (1) {
12694         while ((i = getc(stdin)) != -1
12695                && (*bp++ = i) != '\n'
12696                && bp < &buf[1024])
12697         /* DO NOTHING */ ;
12698         *bp = '\0';
12699         fprintf(stdout, "%s", buf);
12700         fflush(NULL);
12701         if (i == -1)
12702             return 0;
12703         bp = buf;
12704     }
12705 }
12706 EOCP
12707                 fflushNULL="$define"
12708                 set tryp
12709                 if eval $compile; then
12710                     $rm -f tryp.out
12711                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12712                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12713                        $cat >&4 <<EOM
12714 fflush(NULL) seems to behave okay with input streams.
12715 EOM
12716                         fflushNULL="$define"
12717                     else
12718                         $cat >&4 <<EOM
12719 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12720 EOM
12721                         fflushNULL="$undef"
12722                     fi
12723                 fi
12724                 $rm -f core tryp.c tryp.core core.tryp.*
12725                 ;;
12726         '')     $cat >&4 <<EOM
12727 Your fflush(NULL) isn't working (contrary to ANSI C).
12728 EOM
12729                 fflushNULL="$undef"
12730                 ;;
12731         *)      $cat >&4 <<EOM
12732 Cannot figure out whether your fflush(NULL) works or not.
12733 I'm assuming it doesn't (contrary to ANSI C).
12734 EOM
12735                 fflushNULL="$undef"
12736                 ;;
12737         esac
12738         ;;
12739 $define|true|[yY]*)
12740         fflushNULL="$define"
12741         ;;
12742 *)
12743         fflushNULL="$undef"
12744         ;;
12745 esac
12746 : check explicit looping only if NULL did not work, and if the pipe
12747 : bug does not show up on an explicit flush too
12748 case "$fflushNULL" in
12749 "$undef")
12750         $cat >tryp.c <<EOCP
12751 #include <stdio.h>
12752 int
12753 main(int argc, char **argv)
12754 {
12755     char buf[1024];
12756     int i;
12757     char *bp = buf;
12758     while (1) {
12759         while ((i = getc(stdin)) != -1
12760                && (*bp++ = i) != '\n'
12761                && bp < &buf[1024])
12762         /* DO NOTHING */ ;
12763         *bp = '\0';
12764         fprintf(stdout, "%s", buf);
12765         fflush(stdin);
12766         if (i == -1)
12767             return 0;
12768         bp = buf;
12769     }
12770 }
12771 EOCP
12772         set tryp
12773         if eval $compile; then
12774             $rm -f tryp.out
12775             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12776             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12777                $cat >&4 <<EOM
12778 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12779 EOM
12780                 : now check for fflushall behaviour
12781                 case "$fflushall" in
12782                 '')     set try -DTRY_FFLUSH_ALL $output
12783                         if eval $compile; then
12784                                 $cat >&4 <<EOM
12785 (Now testing the other method--but note that this also may fail.)
12786 EOM
12787                                 $rm -f try.out
12788                                 ./try$exe_ext 2>/dev/null
12789                                 if $test -s try.out -a "X$?" = X42; then
12790                                         fflushall="`$cat try.out`"
12791                                 fi
12792                         fi
12793                         $rm -f core try.core core.try.*
12794                         case "$fflushall" in
12795                         x)      $cat >&4 <<EOM
12796 Whew. Flushing explicitly all the stdio streams works.
12797 EOM
12798                                 fflushall="$define"
12799                                 ;;
12800                         '')     $cat >&4 <<EOM
12801 Sigh. Flushing explicitly all the stdio streams doesn't work.
12802 EOM
12803                                 fflushall="$undef"
12804                                 ;;
12805                         *)      $cat >&4 <<EOM
12806 Cannot figure out whether flushing stdio streams explicitly works or not.
12807 I'm assuming it doesn't.
12808 EOM
12809                                 fflushall="$undef"
12810                                 ;;
12811                         esac
12812                         ;;
12813                 "$define"|true|[yY]*)
12814                         fflushall="$define"
12815                         ;;
12816                 *)
12817                         fflushall="$undef"
12818                         ;;
12819                 esac
12820             else
12821                 $cat >&4 <<EOM
12822 All is futile.  Even fflush(stdin) clobbers input pipes!
12823 EOM
12824                 fflushall="$undef"
12825             fi
12826         else
12827             fflushall="$undef"
12828         fi
12829         $rm -f core tryp.c tryp.core core.tryp.*
12830         ;;
12831 *)      fflushall="$undef"
12832         ;;
12833 esac
12834
12835 case "$fflushNULL$fflushall" in
12836 undefundef)
12837         $cat <<EOM
12838 OK, I give up.  I cannot figure out how to flush pending stdio output.
12839 We won't be flushing handles at all before fork/exec/popen.
12840 EOM
12841         ;;
12842 esac
12843 $rm -f try.* try$exe_ext
12844
12845 : Store the full pathname to the ar program for use in the C program
12846 : Respect a hint or command line value for full_ar.
12847 case "$full_ar" in
12848 '') full_ar=$ar ;;
12849 esac
12850
12851 : Store the full pathname to the sed program for use in the C program
12852 full_sed=$sed
12853
12854 : see what type gids are declared as in the kernel
12855 echo " "
12856 echo "Looking for the type for group ids returned by getgid()."
12857 set gid_t gidtype xxx stdio.h sys/types.h
12858 eval $typedef
12859 case "$gidtype" in
12860 xxx)
12861         xxx=`./findhdr sys/user.h`
12862         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12863         case $1 in
12864         unsigned) dflt="$1 $2" ;;
12865         *) dflt="$1" ;;
12866         esac
12867         ;;
12868 *) dflt="$gidtype";;
12869 esac
12870 case "$gidtype" in
12871 gid_t) echo "gid_t found." ;;
12872 *)      rp="What is the type for group ids returned by getgid()?"
12873         . ./myread
12874         gidtype="$ans"
12875         ;;
12876 esac
12877
12878 echo " "
12879 case "$gidtype" in
12880 *_t) zzz="$gidtype"     ;;
12881 *)   zzz="gid"          ;;
12882 esac
12883 echo "Checking the size of $zzz..." >&4 
12884 cat > try.c <<EOCP
12885 #include <sys/types.h>
12886 #include <stdio.h>
12887 int main() {
12888     printf("%d\n", (int)sizeof($gidtype));
12889     exit(0);
12890 }
12891 EOCP
12892 set try
12893 if eval $compile_ok; then
12894         yyy=`./try`
12895         case "$yyy" in
12896         '')     gidsize=4
12897                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12898                 ;;
12899         *)      gidsize=$yyy
12900                 echo "Your $zzz is $gidsize bytes long."
12901                 ;;
12902         esac
12903 else
12904         gidsize=4
12905         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12906 fi
12907
12908
12909 echo " "
12910 case "$gidtype" in
12911 *_t) zzz="$gidtype"     ;;
12912 *)   zzz="gid"          ;;
12913 esac
12914 echo "Checking the sign of $zzz..." >&4 
12915 cat > try.c <<EOCP
12916 #include <sys/types.h>
12917 #include <stdio.h>
12918 int main() {
12919         $gidtype foo = -1;
12920         if (foo < 0)
12921                 printf("-1\n");
12922         else
12923                 printf("1\n");
12924 }
12925 EOCP
12926 set try
12927 if eval $compile; then
12928         yyy=`./try`
12929         case "$yyy" in
12930         '')     gidsign=1
12931                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12932                 ;;
12933         *)      gidsign=$yyy
12934                 case "$gidsign" in
12935                  1) echo "Your $zzz is unsigned." ;;
12936                 -1) echo "Your $zzz is signed."   ;;
12937                 esac
12938                 ;;
12939         esac
12940 else
12941         gidsign=1
12942         echo "(I can't compile the test program--guessing unsigned.)" >&4
12943 fi
12944
12945
12946 echo " "
12947
12948 if $test X"$quadtype" != X; then
12949
12950 echo "Checking how to print 64-bit integers..." >&4
12951
12952 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12953         $cat >try.c <<'EOCP'
12954 #include <sys/types.h>
12955 #include <stdio.h>
12956 int main() {
12957   int q = 12345678901;
12958   printf("%ld\n", q);
12959 }
12960 EOCP
12961         set try
12962         if eval $compile; then
12963                 yyy=`./try$exe_ext`
12964                 case "$yyy" in
12965                 12345678901)
12966                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12967                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12968                         echo "We will use %d."
12969                         ;;
12970                 esac
12971         fi
12972 fi
12973
12974 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12975         $cat >try.c <<'EOCP'
12976 #include <sys/types.h>
12977 #include <stdio.h>
12978 int main() {
12979   long q = 12345678901;
12980   printf("%ld\n", q);
12981 }
12982 EOCP
12983         set try
12984         if eval $compile; then
12985                 yyy=`./try$exe_ext`
12986                 case "$yyy" in
12987                 12345678901)
12988                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12989                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12990                         echo "We will use %ld."
12991                         ;;
12992                 esac
12993         fi
12994 fi
12995
12996 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12997         $cat >try.c <<'EOCP'
12998 #include <sys/types.h>
12999 #include <inttypes.h>
13000 #include <stdio.h>
13001 int main() {
13002   int64_t q = 12345678901;
13003   printf("%" PRId64 "\n", q);
13004 }
13005 EOCP
13006         set try
13007         if eval $compile; then
13008                 yyy=`./try$exe_ext`
13009                 case "$yyy" in
13010                 12345678901)
13011                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13012                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13013                         echo "We will use the C9X style."
13014                         ;;
13015                 esac
13016         fi
13017 fi
13018
13019 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13020         $cat >try.c <<'EOCP'
13021 #include <sys/types.h>
13022 #include <stdio.h>
13023 int main() {
13024   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13025   printf("%lld\n", q);
13026 }
13027 EOCP
13028         set try
13029         if eval $compile; then
13030                 yyy=`./try$exe_ext`
13031                 case "$yyy" in
13032                 12345678901)
13033                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13034                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13035                         echo "We will use the %lld style."
13036                         ;;
13037                 esac
13038         fi
13039 fi
13040
13041 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13042         $cat >try.c <<EOCP
13043 #include <sys/types.h>
13044 #include <stdio.h>
13045 int main() {
13046   $quadtype q = 12345678901;
13047   printf("%Ld\n", q);
13048 }
13049 EOCP
13050         set try
13051         if eval $compile; then
13052                 yyy=`./try$exe_ext`
13053                 case "$yyy" in
13054                 12345678901)
13055                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13056                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13057                         echo "We will use %Ld."
13058                         ;;
13059                 esac
13060         fi
13061 fi
13062
13063 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13064         $cat >try.c <<EOCP
13065 #include <sys/types.h>
13066 #include <stdio.h>
13067 int main() {
13068   $quadtype q = 12345678901;
13069   printf("%qd\n", q);
13070 }
13071 EOCP
13072         set try
13073         if eval $compile; then
13074                 yyy=`./try$exe_ext`
13075                 case "$yyy" in
13076                 12345678901)
13077                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13078                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13079                         echo "We will use %qd."
13080                         ;;
13081                 esac
13082         fi
13083 fi
13084
13085 if $test X"$sPRId64" = X; then
13086         echo "Cannot figure out how to print 64-bit integers." >&4
13087 fi
13088
13089 $rm -f try try.*
13090
13091 fi
13092
13093 case "$sPRId64" in
13094 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13095         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13096         ;;
13097 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13098         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13099         ;;
13100 esac
13101
13102
13103 echo " "
13104 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13105
13106 if $test X"$ivsize" = X8; then
13107         ivdformat="$sPRId64"
13108         uvuformat="$sPRIu64"
13109         uvoformat="$sPRIo64"
13110         uvxformat="$sPRIx64"
13111 else
13112         if $test X"$ivsize" = X"$longsize"; then
13113                 ivdformat='"ld"'
13114                 uvuformat='"lu"'
13115                 uvoformat='"lo"'
13116                 uvxformat='"lx"'
13117         else
13118                 if $test X"$ivsize" = X"$intsize"; then
13119                         ivdformat='"d"'
13120                         uvuformat='"u"'
13121                         uvoformat='"o"'
13122                         uvxformat='"x"'
13123                 else
13124                         : far out
13125                         if $test X"$ivsize" = X"$shortsize"; then
13126                                 ivdformat='"hd"'
13127                                 uvuformat='"hu"'
13128                                 uvoformat='"ho"'
13129                                 uvxformat='"hx"'
13130                         fi
13131                 fi
13132         fi
13133 fi
13134
13135 case "$ivdformat" in
13136 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13137     exit 1
13138     ;;
13139 esac
13140
13141
13142 echo " "
13143 $echo "Checking the format string to be used for gids..." >&4
13144
13145 case "$gidsign" in
13146 -1)     if $test X"$gidsize" = X"$ivsize"; then
13147                 gidformat="$ivdformat"
13148         else
13149                 if $test X"$gidsize" = X"$longsize"; then
13150                         gidformat='"ld"'
13151                 else
13152                         if $test X"$gidsize" = X"$intsize"; then
13153                                 gidformat='"d"'
13154                         else
13155                                 if $test X"$gidsize" = X"$shortsize"; then
13156                                         gidformat='"hd"'
13157                                 fi
13158                         fi
13159                 fi
13160         fi
13161         ;;
13162 *)      if $test X"$gidsize" = X"$uvsize"; then
13163                 gidformat="$uvuformat"
13164         else
13165                 if $test X"$gidsize" = X"$longsize"; then
13166                         gidformat='"lu"'
13167                 else
13168                         if $test X"$gidsize" = X"$intsize"; then
13169                                 gidformat='"u"'
13170                         else
13171                                 if $test X"$gidsize" = X"$shortsize"; then
13172                                         gidformat='"hu"'
13173                                 fi
13174                         fi
13175                 fi
13176         fi
13177         ;;
13178 esac
13179
13180 : see if getgroups exists
13181 set getgroups d_getgrps
13182 eval $inlibc
13183
13184 : see if setgroups exists
13185 set setgroups d_setgrps
13186 eval $inlibc
13187
13188
13189 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13190 echo " "
13191 case "$d_getgrps$d_setgrps" in
13192 *define*)
13193         case "$groupstype" in
13194         '') dflt="$gidtype" ;;
13195         *)  dflt="$groupstype" ;;
13196         esac
13197         $cat <<EOM
13198 What type of pointer is the second argument to getgroups() and setgroups()?
13199 Usually this is the same as group ids, $gidtype, but not always.
13200
13201 EOM
13202         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13203         . ./myread
13204         groupstype="$ans"
13205         ;;
13206 *)  groupstype="$gidtype";;
13207 esac
13208
13209 echo " "
13210 echo "Checking if your $make program sets \$(MAKE)..." >&4
13211 case "$make_set_make" in
13212 '')
13213         $sed 's/^X //' > testmake.mak << 'EOF'
13214 Xall:
13215 X       @echo 'maketemp="$(MAKE)"'
13216 EOF
13217         case "`$make -f testmake.mak 2>/dev/null`" in
13218         *maketemp=*) make_set_make='#' ;;
13219         *)      make_set_make="MAKE=$make" ;;
13220         esac
13221         $rm -f testmake.mak
13222         ;;
13223 esac
13224 case "$make_set_make" in
13225 '#') echo "Yup, it does.";;
13226 *) echo "Nope, it doesn't.";;
13227 esac
13228
13229 : see what type is used for mode_t
13230 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13231 set mode_t modetype int stdio.h sys/types.h
13232 eval $typedef_ask
13233
13234 : define a fucntion to check prototypes
13235 $cat > protochk <<EOSH
13236 $startsh
13237 cc="$cc"
13238 optimize="$optimize"
13239 ccflags="$ccflags"
13240 prototype="$prototype"
13241 define="$define"
13242 rm=$rm
13243 EOSH
13244
13245 $cat >> protochk <<'EOSH'
13246
13247 $rm -f try.c
13248 foo="$1"
13249 shift
13250 while test $# -ge 2; do
13251         case "$1" in
13252                 $define) echo "#include <$2>" >> try.c ;;
13253                 literal) echo "$2" >> try.c ;;
13254         esac
13255     shift 2
13256 done
13257 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13258 cat >> try.c <<'EOCP'
13259 #ifdef CAN_PROTOTYPE
13260 #define _(args) args
13261 #else
13262 #define _(args) ()
13263 #endif
13264 EOCP
13265 echo "$foo" >> try.c
13266 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13267 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13268 status=$?
13269 $rm -f try.[co]
13270 exit $status
13271 EOSH
13272 chmod +x protochk
13273 $eunicefix protochk
13274
13275 : see what type is used for size_t
13276 rp="What is the type used for the length parameter for string functions?"
13277 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13278 eval $typedef_ask
13279
13280 : check for type of arguments to gethostbyaddr. 
13281 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13282         case "$d_gethbyaddr" in
13283         $define)
13284                 $cat <<EOM
13285
13286 Checking to see what type of arguments are accepted by gethostbyaddr().
13287 EOM
13288                 hdrs="$define sys/types.h
13289                         $d_socket sys/socket.h 
13290                         $i_niin netinet/in.h 
13291                         $i_netdb netdb.h
13292                         $i_unistd unistd.h"
13293                 : The first arg can 'char *' or 'void *'
13294                 : The second arg is some of integral type
13295                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13296                         for yyy in size_t long int; do
13297                                 case "$netdb_host_type" in
13298                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13299                                         if ./protochk "$try" $hdrs; then
13300                                                 echo "Your system accepts $xxx for the first arg."
13301                                                 echo "...and $yyy for the second arg."
13302                                                 netdb_host_type="$xxx"
13303                                                 netdb_hlen_type="$yyy"
13304                                         fi
13305                                         ;;
13306                                 esac
13307                         done
13308                 done
13309                 : In case none of those worked, prompt the user.
13310                 case "$netdb_host_type" in
13311                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13312                         dflt='char *'
13313                         . ./myread
13314                         netdb_host_type=$ans
13315                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13316                         dflt="$sizetype"
13317                         . ./myread
13318                         netdb_hlen_type=$ans
13319                         ;;
13320                 esac
13321                 ;;
13322         *)      : no gethostbyaddr, so pick harmless defaults
13323                 netdb_host_type='char *'
13324                 netdb_hlen_type="$sizetype"
13325                 ;;
13326         esac
13327         # Remove the "const" if needed. -- but then we'll have a 
13328         # prototype clash!
13329         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13330 fi
13331
13332 : check for type of argument to gethostbyname. 
13333 if test "X$netdb_name_type" = X ; then
13334         case "$d_gethbyname" in
13335         $define)
13336                 $cat <<EOM
13337
13338 Checking to see what type of argument is accepted by gethostbyname().
13339 EOM
13340                 hdrs="$define sys/types.h
13341                         $d_socket sys/socket.h 
13342                         $i_niin netinet/in.h 
13343                         $i_netdb netdb.h
13344                         $i_unistd unistd.h"
13345                 for xxx in "const char *" "char *"; do
13346                         case "$netdb_name_type" in
13347                         '')     try="extern struct hostent *gethostbyname($xxx);"
13348                                 if ./protochk "$try" $hdrs; then
13349                                         echo "Your system accepts $xxx."
13350                                         netdb_name_type="$xxx"
13351                                 fi
13352                                 ;;
13353                         esac
13354                 done
13355                 : In case none of those worked, prompt the user.
13356                 case "$netdb_name_type" in
13357                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13358                         dflt='char *'
13359                         . ./myread
13360                         netdb_name_type=$ans
13361                         ;;
13362                 esac
13363                 ;;
13364         *)      : no gethostbyname, so pick harmless default
13365                 netdb_name_type='char *'
13366                 ;;
13367         esac
13368 fi
13369
13370 : check for type of 1st argument to getnetbyaddr. 
13371 if test "X$netdb_net_type" = X ; then
13372         case "$d_getnbyaddr" in
13373         $define)
13374                 $cat <<EOM
13375
13376 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13377 EOM
13378                 hdrs="$define sys/types.h
13379                         $d_socket sys/socket.h 
13380                         $i_niin netinet/in.h 
13381                         $i_netdb netdb.h
13382                         $i_unistd unistd.h"
13383                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13384                         case "$netdb_net_type" in
13385                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13386                                 if ./protochk "$try" $hdrs; then
13387                                         echo "Your system accepts $xxx."
13388                                         netdb_net_type="$xxx"
13389                                 fi
13390                                 ;;
13391                         esac
13392                 done
13393                 : In case none of those worked, prompt the user.
13394                 case "$netdb_net_type" in
13395                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13396                         dflt='long'
13397                         . ./myread
13398                         netdb_net_type=$ans
13399                         ;;
13400                 esac
13401                 ;;
13402         *)      : no getnetbyaddr, so pick harmless default
13403                 netdb_net_type='long'
13404                 ;;
13405         esac
13406 fi
13407 : locate the preferred pager for this system
13408 case "$pager" in
13409 '')
13410         dflt=''
13411         case "$pg" in
13412         /*) dflt=$pg;;
13413         esac
13414         case "$more" in
13415         /*) dflt=$more;;
13416         esac
13417         case "$less" in
13418         /*) dflt=$less;;
13419         esac
13420         case "$dflt" in
13421         '') dflt=/usr/ucb/more;;
13422         esac
13423         ;;
13424 *) dflt="$pager";;
13425 esac
13426 echo " "
13427 fn=f/
13428 rp='What pager is used on your system?'
13429 . ./getfile
13430 pager="$ans"
13431
13432 : see what type pids are declared as in the kernel
13433 rp="What is the type of process ids on this system?"
13434 set pid_t pidtype int stdio.h sys/types.h
13435 eval $typedef_ask
13436
13437 : Find earliest binary compatible site_perl subdirectory perl can use.
13438 case "$bincompat5005" in
13439 "$define") xs_apiversion='5.005' ;;
13440 *) xs_apiversion=$version ;;   # The current site_perl version.
13441 esac
13442 : Find earliest pure perl site_perl subdirectory perl can use.
13443 : The versioned directories started at 5.005.
13444 pm_apiversion='5.005'
13445
13446 : check for length of pointer
13447 echo " "
13448 case "$ptrsize" in
13449 '')
13450         echo "Checking to see how big your pointers are..." >&4
13451         if test "$voidflags" -gt 7; then
13452                 echo '#define VOID_PTR char *' > try.c
13453         else
13454                 echo '#define VOID_PTR void *' > try.c
13455         fi
13456         $cat >>try.c <<'EOCP'
13457 #include <stdio.h>
13458 int main()
13459 {
13460     printf("%d\n", (int)sizeof(VOID_PTR));
13461     exit(0);
13462 }
13463 EOCP
13464         set try
13465         if eval $compile_ok; then
13466                 ptrsize=`./try`
13467                 echo "Your pointers are $ptrsize bytes long."
13468         else
13469                 dflt='4'
13470                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13471                 rp="What is the size of a pointer (in bytes)?"
13472                 . ./myread
13473                 ptrsize="$ans"
13474         fi
13475         ;;
13476 esac
13477 $rm -f try.c try
13478
13479 : see if ar generates random libraries by itself
13480 echo " "
13481 echo "Checking how to generate random libraries on your machine..." >&4
13482 echo 'int bar1() { return bar2(); }' > bar1.c
13483 echo 'int bar2() { return 2; }' > bar2.c
13484 $cat > foo.c <<'EOP'
13485 int main() { printf("%d\n", bar1()); exit(0); }
13486 EOP
13487 $cc $ccflags -c bar1.c >/dev/null 2>&1
13488 $cc $ccflags -c bar2.c >/dev/null 2>&1
13489 $cc $ccflags -c foo.c >/dev/null 2>&1
13490 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13491 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13492         ./foobar >/dev/null 2>&1; then
13493         echo "$ar appears to generate random libraries itself."
13494         orderlib=false
13495         ranlib=":"
13496 elif $ar ts bar$_a >/dev/null 2>&1 &&
13497         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13498         ./foobar >/dev/null 2>&1; then
13499                 echo "a table of contents needs to be added with '$ar ts'."
13500                 orderlib=false
13501                 ranlib="$ar ts"
13502 else
13503         case "$ranlib" in
13504         :) ranlib='';;
13505         '')
13506                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13507                 $test -f $ranlib || ranlib=''
13508                 ;;
13509         esac
13510         if $test -n "$ranlib"; then
13511                 echo "your system has '$ranlib'; we'll use that."
13512                 orderlib=false
13513         else
13514                 echo "your system doesn't seem to support random libraries"
13515                 echo "so we'll use lorder and tsort to order the libraries."
13516                 orderlib=true
13517                 ranlib=":"
13518         fi
13519 fi
13520 $rm -f foo* bar* 
13521
13522 : check for type of arguments to select. 
13523 case "$selecttype" in
13524 '') case "$d_select" in
13525         $define)
13526                 echo " "
13527                 $cat <<EOM
13528 Checking to see what type of arguments are accepted by select().
13529 EOM
13530                 hdrs="$define sys/types.h
13531                         $i_systime sys/time.h 
13532                         $i_sysselct sys/select.h
13533                         $d_socket sys/socket.h"
13534                 : The first arg can be int, unsigned, or size_t
13535                 : The last arg may or may not be 'const'
13536                 val=''
13537                 : void pointer has been seen but using that
13538                 : breaks the selectminbits test
13539                 for xxx in 'fd_set *' 'int *'; do
13540                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13541                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13542                                         case "$val" in
13543                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13544                                                 if ./protochk "$try" $hdrs; then
13545                                                         echo "Your system accepts $xxx."
13546                                                         val="$xxx"
13547                                                 fi
13548                                                 ;;
13549                                         esac
13550                                 done
13551                         done
13552                 done
13553                 case "$val" in
13554                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13555                         case "$d_fd_set" in
13556                                 $define) dflt="fd_set *" ;;
13557                                 *)              dflt="int *" ;;
13558                         esac
13559                         . ./myread
13560                         val=$ans
13561                         ;;
13562                 esac
13563                 selecttype="$val"
13564                 ;;
13565         *)      : no select, so pick a harmless default
13566                 selecttype='int *'
13567                 ;;
13568         esac
13569         ;;
13570 esac
13571
13572 : check for the select 'width'
13573 case "$selectminbits" in
13574 '') case "$d_select" in
13575         $define)
13576                 $cat <<EOM
13577
13578 Checking to see on how many bits at a time your select() operates...
13579 EOM
13580                 $cat >try.c <<EOCP
13581 #include <sys/types.h>
13582 #$i_time I_TIME
13583 #$i_systime I_SYS_TIME
13584 #$i_systimek I_SYS_TIME_KERNEL
13585 #ifdef I_TIME
13586 #   include <time.h>
13587 #endif
13588 #ifdef I_SYS_TIME
13589 #   ifdef I_SYS_TIME_KERNEL
13590 #       define KERNEL
13591 #   endif
13592 #   include <sys/time.h>
13593 #   ifdef I_SYS_TIME_KERNEL
13594 #       undef KERNEL
13595 #   endif
13596 #endif
13597 #$i_sysselct I_SYS_SELECT
13598 #ifdef I_SYS_SELECT
13599 #include <sys/select.h>
13600 #endif
13601 #$d_socket HAS_SOCKET
13602 #ifdef HAS_SOCKET
13603 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13604 #endif
13605 #include <stdio.h>
13606 $selecttype b;
13607 #define S sizeof(*(b))
13608 #define MINBITS 64
13609 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13610 #define NBITS  (NBYTES * 8)
13611 int main() {
13612     char s[NBYTES];
13613     struct timeval t;
13614     int i;
13615     FILE* fp;
13616     int fd;
13617
13618     fclose(stdin);
13619     fp = fopen("try.c", "r");
13620     if (fp == 0)
13621       exit(1);
13622     fd = fileno(fp);
13623     if (fd < 0)
13624       exit(2);
13625     b = ($selecttype)s;
13626     for (i = 0; i < NBITS; i++)
13627         FD_SET(i, b);
13628     t.tv_sec  = 0;
13629     t.tv_usec = 0;
13630     select(fd + 1, b, 0, 0, &t);
13631     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13632     printf("%d\n", i + 1);
13633     return 0;
13634 }
13635 EOCP
13636                 set try
13637                 if eval $compile_ok; then
13638                         selectminbits=`./try`
13639                         case "$selectminbits" in
13640                         '')     cat >&4 <<EOM
13641 Cannot figure out on how many bits at a time your select() operates.
13642 I'll play safe and guess it is 32 bits.
13643 EOM
13644                                 selectminbits=32
13645                                 bits="32 bits"
13646                                 ;;
13647                         1)      bits="1 bit" ;;
13648                         *)      bits="$selectminbits bits" ;;
13649                         esac
13650                         echo "Your select() operates on $bits at a time." >&4
13651                 else
13652                         rp='What is the minimum number of bits your select() operates on?'
13653                         case "$byteorder" in
13654                         1234|12345678)  dflt=32 ;;
13655                         *)              dflt=1  ;;
13656                         esac
13657                         . ./myread
13658                         val=$ans
13659                         selectminbits="$val"
13660                 fi
13661                 $rm -f try.* try
13662                 ;;
13663         *)      : no select, so pick a harmless default
13664                 selectminbits='32'
13665                 ;;
13666         esac
13667         ;;
13668 esac
13669
13670 : Trace out the files included by signal.h, then look for SIGxxx names.
13671 : Remove SIGARRAYSIZE used by HPUX.
13672 : Remove SIGSTKSIZE used by Linux.
13673 : Remove SIGSTKSZ used by Posix.
13674 : Remove SIGTYP void lines used by OS2.
13675 : Some cpps, like os390, dont give the file name anywhere
13676 if [ "X$fieldn" = X ]; then
13677         : Just make some guesses.  We check them later.
13678         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13679 else
13680         xxx=`echo '#include <signal.h>' |
13681         $cppstdin $cppminus $cppflags 2>/dev/null |
13682         $grep '^[       ]*#.*include' | 
13683         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13684 fi
13685 : Check this list of files to be sure we have parsed the cpp output ok.
13686 : This will also avoid potentially non-existent files, such 
13687 : as ../foo/bar.h
13688 xxxfiles=''
13689 for xx in $xxx /dev/null ; do
13690         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13691 done
13692 : If we have found no files, at least try signal.h
13693 case "$xxxfiles" in
13694 '')     xxxfiles=`./findhdr signal.h` ;;
13695 esac
13696 xxx=`awk '
13697 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13698         print substr($2, 4, 20)
13699 }
13700 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13701         print substr($3, 4, 20)
13702 }' $xxxfiles`
13703 : Append some common names just in case the awk scan failed.
13704 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13705 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13706 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13707 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13708 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13709
13710 : generate a few handy files for later
13711 $cat > signal.c <<'EOCP'
13712 #include <sys/types.h>
13713 #include <signal.h>
13714 #include <stdio.h>
13715 int main() {
13716
13717 /* Strange style to avoid deeply-nested #if/#else/#endif */
13718 #ifndef NSIG
13719 #  ifdef _NSIG
13720 #    define NSIG (_NSIG)
13721 #  endif
13722 #endif
13723
13724 #ifndef NSIG
13725 #  ifdef SIGMAX
13726 #    define NSIG (SIGMAX+1)
13727 #  endif
13728 #endif
13729
13730 #ifndef NSIG
13731 #  ifdef SIG_MAX
13732 #    define NSIG (SIG_MAX+1)
13733 #  endif
13734 #endif
13735
13736 #ifndef NSIG
13737 #  ifdef MAXSIG
13738 #    define NSIG (MAXSIG+1)
13739 #  endif
13740 #endif
13741
13742 #ifndef NSIG
13743 #  ifdef MAX_SIG
13744 #    define NSIG (MAX_SIG+1)
13745 #  endif
13746 #endif
13747
13748 #ifndef NSIG
13749 #  ifdef SIGARRAYSIZE
13750 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13751 #  endif
13752 #endif
13753
13754 #ifndef NSIG
13755 #  ifdef _sys_nsig
13756 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13757 #  endif
13758 #endif
13759
13760 /* Default to some arbitrary number that's big enough to get most
13761    of the common signals.
13762 */
13763 #ifndef NSIG
13764 #    define NSIG 50
13765 #endif
13766
13767 printf("NSIG %d\n", NSIG);
13768
13769 #ifndef JUST_NSIG
13770
13771 EOCP
13772
13773 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13774 {
13775         printf "#ifdef SIG"; printf $1; printf "\n"
13776         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13777         printf $1; printf ");\n"
13778         printf "#endif\n"
13779 }
13780 END {
13781         printf "#endif /* JUST_NSIG */\n";
13782         printf "exit(0);\n}\n";
13783 }
13784 ' >>signal.c
13785 $cat >signal.awk <<'EOP'
13786 BEGIN { ndups = 0 }
13787 $1 ~ /^NSIG$/ { nsig = $2 }
13788 ($1 !~ /^NSIG$/) && (NF == 2) {
13789     if ($2 > maxsig) { maxsig = $2 }
13790     if (sig_name[$2]) {
13791         dup_name[ndups] = $1
13792         dup_num[ndups] = $2
13793         ndups++ 
13794     }
13795     else {
13796         sig_name[$2] = $1
13797         sig_num[$2] = $2
13798     }
13799 }
13800 END { 
13801     if (nsig == 0) {
13802         nsig = maxsig + 1
13803     }
13804     printf("NSIG %d\n", nsig);
13805     for (n = 1; n < nsig; n++) {
13806         if (sig_name[n]) {
13807             printf("%s %d\n", sig_name[n], sig_num[n])
13808         }
13809         else {
13810             printf("NUM%d %d\n", n, n) 
13811         }
13812     }
13813     for (n = 0; n < ndups; n++) {
13814         printf("%s %d\n", dup_name[n], dup_num[n])
13815     }
13816 }
13817 EOP
13818 $cat >signal_cmd <<EOS
13819 $startsh
13820 if $test -s signal.lst; then
13821     echo "Using your existing signal.lst file"
13822         exit 0
13823 fi
13824 xxx="$xxx"
13825 EOS
13826 $cat >>signal_cmd <<'EOS'
13827
13828 set signal
13829 if eval $compile_ok; then
13830         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13831 else
13832         echo "(I can't seem be able to compile the whole test program)" >&4
13833         echo "(I'll try it in little pieces.)" >&4
13834         set signal -DJUST_NSIG
13835         if eval $compile_ok; then
13836                 ./signal$_exe > signal.nsg
13837                 $cat signal.nsg
13838         else
13839                 echo "I can't seem to figure out how many signals you have." >&4
13840                 echo "Guessing 50." >&4
13841                 echo 'NSIG 50' > signal.nsg
13842         fi
13843         : Now look at all the signal names, one at a time.
13844         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13845                 $cat > signal.c <<EOCP
13846 #include <sys/types.h>
13847 #include <signal.h>
13848 #include <stdio.h>
13849 int main() {
13850 printf("$xx %d\n", SIG${xx});
13851 return 0;
13852 }
13853 EOCP
13854                 set signal
13855                 if eval $compile; then
13856                         echo "SIG${xx} found."
13857                         ./signal$_exe  >> signal.ls1
13858                 else
13859                         echo "SIG${xx} NOT found."
13860                 fi
13861         done
13862         if $test -s signal.ls1; then
13863                 $cat signal.nsg signal.ls1 |
13864                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13865         fi
13866
13867 fi
13868 if $test -s signal.lst; then
13869         :
13870 else
13871         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13872         echo 'kill -l' >signal
13873         set X `csh -f <signal`
13874         $rm -f signal
13875         shift
13876         case $# in
13877         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13878         esac
13879         echo $@ | $tr ' ' $trnl | \
13880             $awk '{ printf "%s %d\n", $1, ++s; }
13881                   END { printf "NSIG %d\n", ++s }' >signal.lst
13882 fi
13883 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13884 EOS
13885 chmod a+x signal_cmd
13886 $eunicefix signal_cmd
13887
13888 : generate list of signal names
13889 echo " "
13890 case "$sig_name_init" in
13891 '') doinit=yes ;;
13892 *)  case "$sig_num_init" in
13893     ''|*,*) doinit=yes ;;
13894     esac ;;
13895 esac
13896 case "$doinit" in
13897 yes)
13898         echo "Generating a list of signal names and numbers..." >&4
13899         . ./signal_cmd
13900         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13901         sig_name=`$awk 'BEGIN { printf "ZERO " }
13902                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13903         sig_num=`$awk  'BEGIN { printf "0 " }
13904                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13905         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13906                              !/^NSIG/   { printf "\"%s\", ", $1 }
13907                              END        { printf "0\n" }' signal.lst`
13908         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13909                              !/^NSIG/   { printf "%d, ", $2}
13910                              END        { printf "0\n"}' signal.lst`
13911         ;;
13912 esac
13913 echo "The following $sig_count signals are available:"
13914 echo " "
13915 echo $sig_name | $awk \
13916 'BEGIN { linelen = 0 }
13917 {
13918         for (i = 1; i <= NF; i++) {
13919                 name = "SIG" $i " "
13920                 linelen = linelen + length(name)
13921                 if (linelen > 70) {
13922                         printf "\n"
13923                         linelen = length(name)
13924                 }
13925                 printf "%s", name
13926         }
13927         printf "\n"
13928 }'
13929 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13930
13931 echo " "
13932 case "$sizetype" in
13933 *_t) zzz="$sizetype"    ;;
13934 *)   zzz="filesize"     ;;
13935 esac
13936 echo "Checking the size of $zzz..." >&4 
13937 cat > try.c <<EOCP
13938 #include <sys/types.h>
13939 #include <stdio.h>
13940 int main() {
13941     printf("%d\n", (int)sizeof($sizetype));
13942     exit(0);
13943 }
13944 EOCP
13945 set try
13946 if eval $compile_ok; then
13947         yyy=`./try`
13948         case "$yyy" in
13949         '')     sizesize=4
13950                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13951                 ;;
13952         *)      sizesize=$yyy
13953                 echo "Your $zzz size is $sizesize bytes."
13954                 ;;
13955         esac
13956 else
13957         sizesize=4
13958         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13959 fi
13960
13961
13962 : check for socklen_t
13963 echo " "
13964 echo "Checking to see if you have socklen_t..." >&4
13965 $cat >try.c <<EOCP
13966 #include <sys/types.h>
13967 #$d_socket HAS_SOCKET
13968 #ifdef HAS_SOCKET
13969 #include <sys/socket.h>
13970 #endif
13971 int main() { socklen_t x = 16; }
13972 EOCP
13973 set try
13974 if eval $compile; then
13975         val="$define"
13976         echo "You have socklen_t."
13977 else
13978         val="$undef"
13979         echo "You do not have socklen_t."
13980         case "$sizetype" in
13981         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13982         esac
13983 fi
13984 $rm -f try try.*
13985 set d_socklen_t
13986 eval $setvar
13987
13988 : check for type of the size argument to socket calls
13989 case "$d_socket" in
13990 "$define")
13991         $cat <<EOM
13992
13993 Checking to see what type is the last argument of accept().
13994 EOM
13995         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13996         yyy=''
13997         case "$d_socklen_t" in
13998         "$define") yyy="$yyy socklen_t"
13999         esac
14000         yyy="$yyy $sizetype int long unsigned"
14001         for xxx in $yyy; do
14002                 case "$socksizetype" in
14003                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14004                         if ./protochk "$try" $hdrs; then
14005                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14006                                 socksizetype="$xxx"
14007                         fi
14008                         ;;
14009                 esac
14010         done
14011 : In case none of those worked, prompt the user.
14012         case "$socksizetype" in
14013         '')     rp='What is the type for socket address structure sizes?'
14014                 dflt='int'
14015                 . ./myread
14016                 socksizetype=$ans
14017                 ;;
14018         esac
14019         ;;
14020 *)      : no sockets, so pick relatively harmless default
14021         socksizetype='int'
14022         ;;
14023 esac
14024
14025 : see what type is used for signed size_t
14026 set ssize_t ssizetype int stdio.h sys/types.h
14027 eval $typedef
14028 dflt="$ssizetype"
14029 $cat > ssize.c <<EOM
14030 #include <stdio.h>
14031 #include <sys/types.h>
14032 #define Size_t $sizetype
14033 #define SSize_t $dflt
14034 int main()
14035 {
14036         if (sizeof(Size_t) == sizeof(SSize_t))
14037                 printf("$dflt\n");
14038         else if (sizeof(Size_t) == sizeof(int))
14039                 printf("int\n");
14040         else 
14041                 printf("long\n");
14042         exit(0);
14043 }
14044 EOM
14045 echo " "
14046 set ssize
14047 if eval $compile_ok && ./ssize > /dev/null; then
14048         ssizetype=`./ssize`
14049         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14050 else
14051         $cat >&4 <<EOM
14052 Help! I can't compile and run the ssize_t test program: please enlighten me!
14053 (This is probably a misconfiguration in your system or libraries, and
14054 you really ought to fix it.  Still, I'll try anyway.)
14055
14056 I need a type that is the same size as $sizetype, but is guaranteed to
14057 be signed.  Common values are ssize_t, int and long.
14058
14059 EOM
14060         rp="What signed type is the same size as $sizetype?"
14061         . ./myread
14062         ssizetype="$ans"
14063 fi
14064 $rm -f ssize ssize.*
14065
14066 : see what type of char stdio uses.
14067 echo " "
14068 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14069         echo "Your stdio uses unsigned chars." >&4
14070         stdchar="unsigned char"
14071 else
14072         echo "Your stdio uses signed chars." >&4
14073         stdchar="char"
14074 fi
14075
14076 : see if time exists
14077 echo " "
14078 if test "X$d_time" = X -o X"$timetype" = X; then
14079     if set time val -f d_time; eval $csym; $val; then
14080                 echo 'time() found.' >&4
14081                 val="$define"
14082                 rp="What is the type returned by time() on this system?"
14083                 set time_t timetype long stdio.h sys/types.h
14084                 eval $typedef_ask
14085     else
14086                 echo 'time() not found, hope that will do.' >&4
14087                 val="$undef"
14088                 timetype='int';
14089     fi
14090     set d_time
14091     eval $setvar
14092 fi
14093
14094 : see what type uids are declared as in the kernel
14095 echo " "
14096 echo "Looking for the type for user ids returned by getuid()."
14097 set uid_t uidtype xxx stdio.h sys/types.h
14098 eval $typedef
14099 case "$uidtype" in
14100 xxx)
14101         xxx=`./findhdr sys/user.h`
14102         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14103         case $1 in
14104         unsigned) dflt="$1 $2" ;;
14105         *) dflt="$1" ;;
14106         esac
14107         ;;
14108 *) dflt="$uidtype";;
14109 esac
14110 case "$uidtype" in
14111 uid_t)  echo "uid_t found." ;;
14112 *)      rp="What is the type for user ids returned by getuid()?"
14113         . ./myread
14114         uidtype="$ans"
14115         ;;
14116 esac
14117
14118 echo " "
14119 case "$uidtype" in
14120 *_t) zzz="$uidtype"     ;;
14121 *)   zzz="uid"          ;;
14122 esac
14123 echo "Checking the size of $zzz..." >&4 
14124 cat > try.c <<EOCP
14125 #include <sys/types.h>
14126 #include <stdio.h>
14127 int main() {
14128     printf("%d\n", (int)sizeof($uidtype));
14129     exit(0);
14130 }
14131 EOCP
14132 set try
14133 if eval $compile_ok; then
14134         yyy=`./try`
14135         case "$yyy" in
14136         '')     uidsize=4
14137                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14138                 ;;
14139         *)      uidsize=$yyy
14140                 echo "Your $zzz is $uidsize bytes long."
14141                 ;;
14142         esac
14143 else
14144         uidsize=4
14145         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14146 fi
14147
14148 echo " "
14149 case "$uidtype" in
14150 *_t) zzz="$uidtype"     ;;
14151 *)   zzz="uid"          ;;
14152 esac
14153 echo "Checking the sign of $zzz..." >&4
14154 cat > try.c <<EOCP
14155 #include <sys/types.h>
14156 #include <stdio.h>
14157 int main() {
14158         $uidtype foo = -1;
14159         if (foo < 0)
14160                 printf("-1\n");
14161         else
14162                 printf("1\n");
14163 }
14164 EOCP
14165 set try
14166 if eval $compile; then
14167         yyy=`./try`
14168         case "$yyy" in
14169         '')     uidsign=1
14170                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14171                 ;;
14172         *)      uidsign=$yyy
14173                 case "$uidsign" in
14174                  1) echo "Your $zzz is unsigned." ;;
14175                 -1) echo "Your $zzz is signed."   ;;
14176                 esac
14177                 ;;
14178         esac
14179 else
14180         uidsign=1
14181         echo "(I can't compile the test program--guessing unsigned.)" >&4
14182 fi
14183
14184
14185
14186 echo " "
14187 $echo "Checking the format string to be used for uids..." >&4
14188
14189 case "$uidsign" in
14190 -1)     if $test X"$uidsize" = X"$ivsize"; then
14191                 uidformat="$ivdformat"
14192         else
14193                 if $test X"$uidsize" = X"$longsize"; then
14194                         uidformat='"ld"'
14195                 else
14196                         if $test X"$uidsize" = X"$intsize"; then
14197                                 uidformat='"d"'
14198                         else
14199                                 if $test X"$uidsize" = X"$shortsize"; then
14200                                         uidformat='"hd"'
14201                                 fi
14202                         fi
14203                 fi
14204         fi
14205         ;;
14206 *)      if $test X"$uidsize" = X"$uvsize"; then
14207                 uidformat="$uvuformat"
14208         else
14209                 if $test X"$uidsize" = X"$longsize"; then
14210                         uidformat='"lu"'
14211                 else
14212                         if $test X"$uidsize" = X"$intsize"; then
14213                                 uidformat='"u"'
14214                         else
14215                                 if $test X"$uidsize" = X"$shortsize"; then
14216                                         uidformat='"hu"'
14217                                 fi
14218                         fi
14219                 fi
14220         fi
14221         ;;
14222 esac
14223
14224 : see if dbm.h is available
14225 : see if dbmclose exists
14226 set dbmclose d_dbmclose
14227 eval $inlibc
14228
14229 case "$d_dbmclose" in
14230 $define)
14231         set dbm.h i_dbm
14232         eval $inhdr
14233         case "$i_dbm" in
14234         $define)
14235                 val="$undef"
14236                 set i_rpcsvcdbm
14237                 eval $setvar
14238                 ;;
14239         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14240                 eval $inhdr
14241                 ;;
14242         esac
14243         ;;
14244 *)      echo "We won't be including <dbm.h>"
14245         val="$undef"
14246         set i_dbm
14247         eval $setvar
14248         val="$undef"
14249         set i_rpcsvcdbm
14250         eval $setvar
14251         ;;
14252 esac
14253
14254 : see if this is a sys/file.h system
14255 val=''
14256 set sys/file.h val
14257 eval $inhdr
14258
14259 : do we need to include sys/file.h ?
14260 case "$val" in
14261 "$define")
14262         echo " "
14263         if $h_sysfile; then
14264                 val="$define"
14265                 echo "We'll be including <sys/file.h>." >&4
14266         else
14267                 val="$undef"
14268                 echo "We won't be including <sys/file.h>." >&4
14269         fi
14270         ;;
14271 *)
14272         h_sysfile=false
14273         ;;
14274 esac
14275 set i_sysfile
14276 eval $setvar
14277
14278 : see if fcntl.h is there
14279 val=''
14280 set fcntl.h val
14281 eval $inhdr
14282
14283 : see if we can include fcntl.h
14284 case "$val" in
14285 "$define")
14286         echo " "
14287         if $h_fcntl; then
14288                 val="$define"
14289                 echo "We'll be including <fcntl.h>." >&4
14290         else
14291                 val="$undef"
14292                 if $h_sysfile; then
14293         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14294                 else
14295                         echo "We won't be including <fcntl.h>." >&4
14296                 fi
14297         fi
14298         ;;
14299 *)
14300         h_fcntl=false
14301         val="$undef"
14302         ;;
14303 esac
14304 set i_fcntl
14305 eval $setvar
14306
14307 : see if this is a iconv.h system
14308 set iconv.h i_iconv
14309 eval $inhdr
14310
14311 : see if this is a ieeefp.h system
14312 set ieeefp.h i_ieeefp
14313 eval $inhdr
14314
14315 : see if locale.h is available
14316 set locale.h i_locale
14317 eval $inhdr
14318
14319 : see if mach cthreads are available
14320 if test "X$usethreads" = "X$define"; then
14321         set mach/cthreads.h i_machcthr
14322         eval $inhdr
14323 else
14324         i_machcthr="$undef"
14325 fi
14326
14327
14328
14329 : see if this is a math.h system
14330 set math.h i_math
14331 eval $inhdr
14332
14333 : see if this is a mntent.h system
14334 set mntent.h i_mntent
14335 eval $inhdr
14336
14337 : see if ndbm.h is available
14338 set ndbm.h t_ndbm
14339 eval $inhdr
14340 case "$t_ndbm" in
14341 $define)
14342         : see if dbm_open exists
14343         set dbm_open d_dbm_open
14344         eval $inlibc
14345         case "$d_dbm_open" in
14346         $undef)
14347                 t_ndbm="$undef"
14348                 echo "We won't be including <ndbm.h>"
14349                 ;;
14350         esac
14351         ;;
14352 esac
14353 val="$t_ndbm"
14354 set i_ndbm
14355 eval $setvar
14356
14357 : see if net/errno.h is available
14358 val=''
14359 set net/errno.h val
14360 eval $inhdr
14361
14362 : Unfortunately, it causes problems on some systems.  Arrgh.
14363 case "$val" in
14364 $define)
14365         cat > try.c <<'EOM'
14366 #include <stdio.h>
14367 #include <errno.h>
14368 #include <net/errno.h>
14369 int func()
14370 {
14371         return ENOTSOCK;
14372 }
14373 EOM
14374         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14375                 echo "We'll be including <net/errno.h>." >&4
14376         else
14377                 echo "We won't be including <net/errno.h>." >&4
14378                 val="$undef"
14379         fi
14380         $rm -f try.* try
14381         ;;
14382 esac
14383 set i_neterrno
14384 eval $setvar
14385
14386 : see if netinet/tcp.h is available
14387 set netinet/tcp.h i_netinettcp
14388 eval $inhdr
14389
14390 : see if this is a poll.h system
14391 set poll.h i_poll
14392 eval $inhdr
14393
14394 : see if this is a prot.h system
14395 set prot.h i_prot
14396 eval $inhdr
14397
14398 echo " "
14399 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14400 $cat <<'EOSH' > Cppsym.know
14401 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14402 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14403 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14404 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14405 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14406 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14407 bull c cadmus clipper CMU COFF COMPILER_VERSION
14408 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14409 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14410 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14411 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14412 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14413 H3050R H3050RX hbullx20 hcx host_mips
14414 hp200 hp300 hp700 HP700 hp800 hp9000
14415 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14416 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14417 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14418 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14419 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14420 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14421 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14422 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14423 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14424 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14425 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14426 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14427 MATH_HAS_NO_SIDE_EFFECTS
14428 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14429 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14430 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14431 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14432 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14433 NetBSD news1500 news1700 news1800 news1900 news3700
14434 news700 news800 news900 NeXT NLS ns16000 ns32000
14435 ns32016 ns32332 ns32k nsc32000
14436 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14437 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14438 pc532 pdp11 PGC PIC plexus PORTAR posix
14439 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14440 POSIX_C_SOURCE POSIX_SOURCE POWER
14441 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14442 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14443 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14444 sony sony_news sonyrisc sparc sparclite spectrum
14445 stardent stdc STDC_EXT stratos sun sun3 sun386
14446 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14447 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14448 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14449 sysV68 sysV88 Tek4132 Tek4300 titan
14450 tower tower32 tower32_200 tower32_600 tower32_700
14451 tower32_800 tower32_850 tss
14452 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14453 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14454 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14455 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14456 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14457 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14458 z8000
14459 EOSH
14460 # Maybe put other stuff here too.
14461 cat <<EOSH >>Cppsym.know
14462 $osname
14463 EOSH
14464 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14465 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14466 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14467 $rm -f Cppsym.a Cppsym.b
14468 cat <<EOSH > Cppsym
14469 $startsh
14470 if $test \$# -gt 0; then
14471     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14472     if $test -s Cppsym.got; then
14473         $rm -f Cppsym.got
14474         exit 0
14475     fi
14476     $rm -f Cppsym.got
14477     exit 1
14478 else
14479     $tr " " "$trnl" | ./Cppsym.try
14480     exit 0
14481 fi
14482 EOSH
14483 chmod +x Cppsym
14484 $eunicefix Cppsym
14485 cat <<EOSH > Cppsym.try
14486 $startsh
14487 cat <<'EOCP' > try.c
14488 #include <stdio.h>
14489 int main() {
14490 EOCP
14491 $awk \\
14492 EOSH
14493 cat <<'EOSH' >> Cppsym.try
14494 'length($1) > 0 {
14495     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
14496     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
14497     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
14498     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
14499 }'       >> try.c
14500 echo '}' >> try.c
14501 EOSH
14502 cat <<EOSH >> Cppsym.try
14503 ccflags="$ccflags"
14504 case "$osname-$gccversion" in
14505 irix-) ccflags="\$ccflags -woff 1178" ;;
14506 esac
14507 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14508 EOSH
14509 chmod +x Cppsym.try
14510 $eunicefix Cppsym.try
14511 ./Cppsym < Cppsym.know > Cppsym.true
14512 : now check the C compiler for additional symbols
14513 postprocess_cc_v=''
14514 case "$osname" in
14515 aix) postprocess_cc_v="|$tr , ' '" ;;
14516 esac
14517 $cat >ccsym <<EOS
14518 $startsh
14519 $cat >tmp.c <<EOF
14520 extern int foo;
14521 EOF
14522 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14523 do
14524         case "\$i" in
14525         -D*) echo "\$i" | $sed 's/^-D//';;
14526         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14527         esac
14528 done
14529 $rm -f try.c
14530 EOS
14531 postprocess_cc_v=''
14532 chmod +x ccsym
14533 $eunicefix ccsym
14534 ./ccsym > ccsym1.raw
14535 if $test -s ccsym1.raw; then
14536        $sort ccsym1.raw | $uniq >ccsym.raw
14537 else
14538        mv ccsym1.raw ccsym.raw
14539 fi
14540
14541 $awk '/\=/ { print $0; next }
14542         { print $0"=1" }' ccsym.raw >ccsym.list
14543 $awk '/\=/ { print $0; next }
14544         { print $0"=1" }' Cppsym.true >ccsym.true
14545 $comm -13 ccsym.true ccsym.list >ccsym.own
14546 $comm -12 ccsym.true ccsym.list >ccsym.com
14547 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14548 also=''
14549 if $test -z ccsym.raw; then
14550         echo "Your C compiler doesn't seem to define any symbols!" >&4
14551         echo " "
14552         echo "However, your C preprocessor defines the following symbols:"
14553         $cat Cppsym.true
14554         ccsymbols=''
14555         cppsymbols=`$cat Cppsym.true`
14556         cppsymbols=`echo $cppsymbols`
14557         cppccsymbols="$cppsymbols"
14558 else
14559         if $test -s ccsym.com; then
14560                 echo "Your C compiler and pre-processor define these symbols:"
14561                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14562                 also='also '
14563                 symbols='ones'
14564                 cppccsymbols=`$cat ccsym.com`
14565                 cppccsymbols=`echo $cppccsymbols`
14566                 $test "$silent" || sleep 1
14567         fi
14568         if $test -s ccsym.cpp; then
14569                 $test "$also" && echo " "
14570                 echo "Your C pre-processor ${also}defines the following symbols:"
14571                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14572                 also='further '
14573                 cppsymbols=`$cat ccsym.cpp`
14574                 cppsymbols=`echo $cppsymbols`
14575                 $test "$silent" || sleep 1
14576         fi
14577         if $test -s ccsym.own; then
14578                 $test "$also" && echo " "
14579                 echo "Your C compiler ${also}defines the following cpp symbols:"
14580                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14581                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14582                 ccsymbols=`$cat ccsym.own`
14583                 ccsymbols=`echo $ccsymbols`
14584                 $test "$silent" || sleep 1
14585         fi
14586 fi
14587 $rm -f ccsym*
14588
14589 : see if this is a termio system
14590 val="$undef"
14591 val2="$undef"
14592 val3="$undef"
14593 if $test `./findhdr termios.h`; then
14594         set tcsetattr i_termios
14595         eval $inlibc
14596         val3="$i_termios"
14597 fi
14598 echo " "
14599 case "$val3" in
14600 "$define") echo "You have POSIX termios.h... good!" >&4;;
14601 *) if ./Cppsym pyr; then
14602                 case "`/bin/universe`" in
14603                 ucb) if $test `./findhdr sgtty.h`; then
14604                                 val2="$define"
14605                                 echo "<sgtty.h> found." >&4
14606                         else
14607                                 echo "System is pyramid with BSD universe."
14608                                 echo "<sgtty.h> not found--you could have problems." >&4
14609                         fi;;
14610                 *) if $test `./findhdr termio.h`; then
14611                                 val="$define"
14612                                 echo "<termio.h> found." >&4
14613                         else
14614                                 echo "System is pyramid with USG universe."
14615                                 echo "<termio.h> not found--you could have problems." >&4
14616                         fi;;
14617                 esac
14618         elif ./usg; then
14619                 if $test `./findhdr termio.h`; then
14620                         echo "<termio.h> found." >&4
14621                         val="$define"
14622                 elif $test `./findhdr sgtty.h`; then
14623                         echo "<sgtty.h> found." >&4
14624                         val2="$define"
14625                 else
14626 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14627                 fi
14628         else
14629                 if $test `./findhdr sgtty.h`; then
14630                         echo "<sgtty.h> found." >&4
14631                         val2="$define"
14632                 elif $test `./findhdr termio.h`; then
14633                         echo "<termio.h> found." >&4
14634                         val="$define"
14635                 else
14636 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14637                 fi
14638         fi;;
14639 esac
14640 set i_termio; eval $setvar
14641 val=$val2; set i_sgtty; eval $setvar
14642 val=$val3; set i_termios; eval $setvar
14643
14644 : see if this is a shadow.h system
14645 set shadow.h i_shadow
14646 eval $inhdr
14647
14648 : see if this is a socks.h system
14649 set socks.h i_socks
14650 eval $inhdr
14651
14652 : see if stdarg is available
14653 echo " "
14654 if $test `./findhdr stdarg.h`; then
14655         echo "<stdarg.h> found." >&4
14656         valstd="$define"
14657 else
14658         echo "<stdarg.h> NOT found." >&4
14659         valstd="$undef"
14660 fi
14661
14662 : see if varags is available
14663 echo " "
14664 if $test `./findhdr varargs.h`; then
14665         echo "<varargs.h> found." >&4
14666 else
14667         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14668 fi
14669
14670 : set up the varargs testing programs
14671 $cat > varargs.c <<EOP
14672 #ifdef I_STDARG
14673 #include <stdarg.h>
14674 #endif
14675 #ifdef I_VARARGS
14676 #include <varargs.h>
14677 #endif
14678
14679 #ifdef I_STDARG
14680 int f(char *p, ...)
14681 #else
14682 int f(va_alist)
14683 va_dcl
14684 #endif
14685 {
14686         va_list ap;
14687 #ifndef I_STDARG
14688         char *p;
14689 #endif
14690 #ifdef I_STDARG
14691         va_start(ap,p);
14692 #else
14693         va_start(ap);
14694         p = va_arg(ap, char *);
14695 #endif
14696         va_end(ap);
14697 }
14698 EOP
14699 $cat > varargs <<EOP
14700 $startsh
14701 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14702         echo "true"
14703 else
14704         echo "false"
14705 fi
14706 $rm -f varargs$_o
14707 EOP
14708 chmod +x varargs
14709
14710 : now check which varargs header should be included
14711 echo " "
14712 i_varhdr=''
14713 case "$valstd" in
14714 "$define")
14715         if `./varargs I_STDARG`; then
14716                 val='stdarg.h'
14717         elif `./varargs I_VARARGS`; then
14718                 val='varargs.h'
14719         fi
14720         ;;
14721 *)
14722         if `./varargs I_VARARGS`; then
14723                 val='varargs.h'
14724         fi
14725         ;;
14726 esac
14727 case "$val" in
14728 '')
14729 echo "I could not find the definition for va_dcl... You have problems..." >&4
14730         val="$undef"; set i_stdarg; eval $setvar
14731         val="$undef"; set i_varargs; eval $setvar
14732         ;;
14733 *) 
14734         set i_varhdr
14735         eval $setvar
14736         case "$i_varhdr" in
14737         stdarg.h)
14738                 val="$define"; set i_stdarg; eval $setvar
14739                 val="$undef"; set i_varargs; eval $setvar
14740                 ;;
14741         varargs.h)
14742                 val="$undef"; set i_stdarg; eval $setvar
14743                 val="$define"; set i_varargs; eval $setvar
14744                 ;;
14745         esac
14746         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14747 esac
14748 $rm -f varargs*
14749
14750 : see if stddef is available
14751 set stddef.h i_stddef
14752 eval $inhdr
14753
14754 : see if this is a sunmath.h system
14755 set sunmath.h i_sunmath
14756 eval $inhdr
14757
14758 : see if sys/access.h is available
14759 set sys/access.h i_sysaccess
14760 eval $inhdr
14761
14762 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14763 set sys/filio.h i_sysfilio
14764 eval $inhdr
14765 echo " "
14766 if $test `./findhdr sys/ioctl.h`; then
14767         val="$define"
14768         echo '<sys/ioctl.h> found.' >&4
14769 else
14770         val="$undef"
14771         if $test $i_sysfilio = "$define"; then
14772             echo '<sys/ioctl.h> NOT found.' >&4
14773         else
14774                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14775                 $test $i_termio = "$define" && xxx="termio.h"
14776                 $test $i_termios = "$define" && xxx="termios.h"
14777 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14778         fi
14779 fi
14780 set i_sysioctl
14781 eval $setvar
14782
14783
14784 : see if this is a syslog.h system
14785 set syslog.h i_syslog
14786 eval $inhdr
14787
14788
14789 : see if this is a sys/mode.h system
14790 set sys/mode.h i_sysmode
14791 eval $inhdr
14792
14793 : see if sys/resource.h has to be included
14794 set sys/resource.h i_sysresrc
14795 eval $inhdr
14796
14797 : see if sys/security.h is available
14798 set sys/security.h i_syssecrt
14799 eval $inhdr
14800
14801 : see if this is a sys/statvfs.h system
14802 set sys/statvfs.h i_sysstatvfs
14803 eval $inhdr
14804
14805 : see if this is a sys/uio.h system
14806 set sys/uio.h i_sysuio
14807 eval $inhdr
14808
14809 : see if this is a sys/un.h system
14810 set sys/un.h i_sysun
14811 eval $inhdr
14812
14813
14814 : see if this is a sys/utsname.h system
14815 set sys/utsname.h i_sysutsname
14816 eval $inhdr
14817
14818 : see if this is a syswait system
14819 set sys/wait.h i_syswait
14820 eval $inhdr
14821
14822 : see if this is a ustat.h system
14823 set ustat.h i_ustat
14824 eval $inhdr
14825
14826 : see if this is an utime system
14827 set utime.h i_utime
14828 eval $inhdr
14829
14830 : see if this is a values.h system
14831 set values.h i_values
14832 eval $inhdr
14833
14834 : see if this is a vfork system
14835 case "$d_vfork" in
14836 "$define")
14837         set vfork.h i_vfork
14838         eval $inhdr
14839         ;;
14840 *)
14841         i_vfork="$undef"
14842         ;;
14843 esac
14844
14845 : see if gdbm.h is available
14846 set gdbm.h t_gdbm
14847 eval $inhdr
14848 case "$t_gdbm" in
14849 $define)
14850         : see if gdbm_open exists
14851         set gdbm_open d_gdbm_open
14852         eval $inlibc
14853         case "$d_gdbm_open" in
14854         $undef)
14855                 t_gdbm="$undef"
14856                 echo "We won't be including <gdbm.h>"
14857                 ;;
14858         esac
14859         ;;
14860 esac
14861 val="$t_gdbm"
14862 set i_gdbm
14863 eval $setvar
14864
14865 echo " "
14866 echo "Looking for extensions..." >&4
14867 : If we are using the old config.sh, known_extensions may contain
14868 : old or inaccurate or duplicate values.
14869 known_extensions=''
14870 nonxs_extensions=''
14871 : We do not use find because it might not be available.
14872 : We do not just use MANIFEST because the user may have dropped
14873 : some additional extensions into the source tree and expect them
14874 : to be built.
14875
14876 : Function to recursively find available extensions, ignoring DynaLoader
14877 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14878 find_extensions='
14879     for xxx in *; do
14880        case "$xxx" in
14881            DynaLoader|dynaload) ;;
14882            *)
14883            if $test -f $xxx/$xxx.xs; then
14884                known_extensions="$known_extensions $1$xxx";
14885            elif $test -f $xxx/Makefile.PL; then
14886                nonxs_extensions="$nonxs_extensions $1$xxx";
14887            else
14888                if $test -d $xxx -a $# -lt 10; then
14889                    set $1$xxx/ $*;
14890                    cd $xxx;
14891                    eval $find_extensions;
14892                    cd ..;
14893                    shift;
14894                fi;
14895            fi
14896            ;;
14897        esac;
14898     done'
14899 tdir=`pwd`
14900 cd $rsrc/ext
14901 set X
14902 shift
14903 eval $find_extensions
14904 set X $nonxs_extensions
14905 shift
14906 nonxs_extensions="$*"
14907 set X $known_extensions
14908 shift
14909 known_extensions="$*"
14910 cd $tdir
14911
14912 : Now see which are supported on this system.
14913 avail_ext=''
14914 for xxx in $known_extensions ; do
14915         case "$xxx" in
14916         DB_File|db_file)
14917                 case "$i_db" in
14918                 $define) avail_ext="$avail_ext $xxx" ;;
14919                 esac
14920                 ;;
14921         GDBM_File|gdbm_fil)
14922                 case "$i_gdbm" in 
14923                 $define) avail_ext="$avail_ext $xxx" ;;
14924                 esac
14925                 ;;
14926         NDBM_File|ndbm_fil)
14927                 case "$i_ndbm" in
14928                 $define)
14929                     case "$osname-$use64bitint" in
14930                     hpux-define)
14931                         case "$libs" in
14932                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14933                         esac
14934                         ;;
14935                     *) avail_ext="$avail_ext $xxx" ;;
14936                     esac
14937                     ;;
14938                 esac
14939                 ;;
14940         ODBM_File|odbm_fil) 
14941                 case "${i_dbm}${i_rpcsvcdbm}" in
14942                 *"${define}"*)
14943                     case "$osname-$use64bitint" in
14944                     hpux-define)
14945                         case "$libs" in
14946                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14947                         esac
14948                         ;;
14949                     *) avail_ext="$avail_ext $xxx" ;;
14950                     esac
14951                     ;;
14952                 esac
14953                 ;;
14954         POSIX|posix)
14955                 case "$useposix" in
14956                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14957                 esac
14958                 ;;
14959         Opcode|opcode)
14960                 case "$useopcode" in
14961                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14962                 esac
14963                 ;;
14964         Socket|socket)
14965                 case "$d_socket" in 
14966                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14967                 esac
14968                 ;;
14969         Thread|thread)
14970                 case "$usethreads" in 
14971                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14972                 esac
14973                 ;;
14974         IPC/SysV|ipc/sysv)
14975                 : XXX Do we need a useipcsysv variable here
14976                 case "${d_msg}${d_sem}${d_shm}" in 
14977                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14978                 esac
14979                 ;;
14980         *)      avail_ext="$avail_ext $xxx"
14981                 ;;
14982         esac
14983 done
14984
14985 set X $avail_ext
14986 shift
14987 avail_ext="$*"
14988
14989 : Now see which nonxs extensions are supported on this system.
14990 : For now assume all are.
14991 nonxs_ext=''
14992 for xxx in $nonxs_extensions ; do
14993         case "$xxx" in
14994         *)      nonxs_ext="$nonxs_ext $xxx"
14995                 ;;
14996         esac
14997 done
14998
14999 set X $nonxs_ext
15000 shift
15001 nonxs_ext="$*"
15002
15003 case $usedl in
15004 $define)
15005         $cat <<EOM
15006 A number of extensions are supplied with $package.  You may choose to
15007 compile these extensions for dynamic loading (the default), compile
15008 them into the $package executable (static loading), or not include
15009 them at all.  Answer "none" to include no extensions.
15010 Note that DynaLoader is always built and need not be mentioned here.
15011
15012 EOM
15013         case "$dynamic_ext" in
15014         '') dflt="$avail_ext" ;;
15015         *)      dflt="$dynamic_ext"
15016                 # Perhaps we are reusing an old out-of-date config.sh.
15017                 case "$hint" in
15018                 previous)
15019                         if test X"$dynamic_ext" != X"$avail_ext"; then
15020                                 $cat <<EOM
15021 NOTICE:  Your previous config.sh list may be incorrect. 
15022 The extensions now available to you are 
15023         ${avail_ext}
15024 but the default list from your previous config.sh is
15025         ${dynamic_ext} 
15026
15027 EOM
15028                         fi
15029                         ;;
15030                 esac
15031                 ;;
15032         esac
15033         case "$dflt" in
15034         '')     dflt=none;;
15035         esac
15036         rp="What extensions do you wish to load dynamically?"
15037         . ./myread
15038         case "$ans" in
15039         none) dynamic_ext=' ' ;;
15040         *) dynamic_ext="$ans" ;;
15041         esac
15042
15043         case "$static_ext" in
15044         '')
15045                 : Exclude those already listed in dynamic linking
15046                 dflt=''
15047                 for xxx in $avail_ext; do
15048                         case " $dynamic_ext " in
15049                         *" $xxx "*) ;;
15050                         *) dflt="$dflt $xxx" ;;
15051                         esac
15052                 done
15053                 set X $dflt
15054                 shift
15055                 dflt="$*"
15056                 ;;
15057         *)  dflt="$static_ext" 
15058                 ;;
15059         esac
15060
15061         case "$dflt" in
15062         '')     dflt=none;;
15063         esac
15064         rp="What extensions do you wish to load statically?"
15065         . ./myread
15066         case "$ans" in
15067         none) static_ext=' ' ;;
15068         *) static_ext="$ans" ;;
15069         esac
15070         ;;
15071 *)
15072         $cat <<EOM
15073 A number of extensions are supplied with $package.  Answer "none" 
15074 to include no extensions. 
15075 Note that DynaLoader is always built and need not be mentioned here.
15076
15077 EOM
15078         case "$static_ext" in
15079         '') dflt="$avail_ext" ;;
15080         *)      dflt="$static_ext"
15081                 # Perhaps we are reusing an old out-of-date config.sh.
15082                 case "$hint" in
15083                 previous)
15084                         if test X"$static_ext" != X"$avail_ext"; then
15085                                 $cat <<EOM
15086 NOTICE:  Your previous config.sh list may be incorrect. 
15087 The extensions now available to you are 
15088         ${avail_ext}
15089 but the default list from your previous config.sh is
15090         ${static_ext} 
15091
15092 EOM
15093                         fi
15094                         ;;
15095                 esac
15096                 ;;
15097         esac
15098         : Exclude those that are not xs extensions
15099         case "$dflt" in
15100         '')     dflt=none;;
15101         esac
15102         rp="What extensions do you wish to include?"
15103         . ./myread
15104         case "$ans" in
15105         none) static_ext=' ' ;;
15106         *) static_ext="$ans" ;;
15107         esac
15108         ;;
15109 esac
15110
15111 set X $dynamic_ext $static_ext $nonxs_ext
15112 shift
15113 extensions="$*"
15114
15115 : Remove build directory name from cppstdin so it can be used from
15116 : either the present location or the final installed location.
15117 echo " "
15118 : Get out of the UU directory to get correct path name.
15119 cd ..
15120 case "$cppstdin" in
15121 `pwd`/cppstdin)
15122         echo "Stripping down cppstdin path name"
15123         cppstdin=cppstdin
15124         ;;
15125 esac
15126 cd UU
15127
15128 : end of configuration questions
15129 echo " "
15130 echo "End of configuration questions."
15131 echo " "
15132
15133 : back to where it started
15134 if test -d ../UU; then
15135         cd ..
15136 fi
15137
15138 : configuration may be patched via a 'config.over' file
15139 if $test -f config.over; then
15140         echo " "
15141         dflt=y
15142         rp='I see a config.over file.  Do you wish to load it?'
15143         . UU/myread
15144         case "$ans" in
15145         n*) echo "OK, I'll ignore it.";;
15146         *)      . ./config.over
15147                 echo "Configuration override changes have been loaded."
15148                 ;;
15149         esac
15150 fi
15151
15152 : in case they want portability, strip down executable paths
15153 case "$d_portable" in
15154 "$define")
15155         echo " "
15156         echo "Stripping down executable paths..." >&4
15157         for file in $loclist $trylist; do
15158                 eval temp=\$$file
15159                 eval $file=`basename $temp`
15160         done
15161         ;;
15162 esac
15163
15164 : create config.sh file
15165 echo " "
15166 echo "Creating config.sh..." >&4
15167 $spitshell <<EOT >config.sh
15168 $startsh
15169 #
15170 # This file was produced by running the Configure script. It holds all the
15171 # definitions figured out by Configure. Should you modify one of these values,
15172 # do not forget to propagate your changes by running "Configure -der". You may
15173 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15174 #
15175
15176 # Package name      : $package
15177 # Source directory  : $src
15178 # Configuration time: $cf_time
15179 # Configured by     : $cf_by
15180 # Target system     : $myuname
15181
15182 Author='$Author'
15183 Date='$Date'
15184 Header='$Header'
15185 Id='$Id'
15186 Locker='$Locker'
15187 Log='$Log'
15188 Mcc='$Mcc'
15189 RCSfile='$RCSfile'
15190 Revision='$Revision'
15191 Source='$Source'
15192 State='$State'
15193 _a='$_a'
15194 _exe='$_exe'
15195 _o='$_o'
15196 afs='$afs'
15197 alignbytes='$alignbytes'
15198 ansi2knr='$ansi2knr'
15199 aphostname='$aphostname'
15200 api_revision='$api_revision'
15201 api_subversion='$api_subversion'
15202 api_version='$api_version'
15203 api_versionstring='$api_versionstring'
15204 ar='$ar'
15205 archlib='$archlib'
15206 archlibexp='$archlibexp'
15207 archname64='$archname64'
15208 archname='$archname'
15209 archobjs='$archobjs'
15210 awk='$awk'
15211 baserev='$baserev'
15212 bash='$bash'
15213 bin='$bin'
15214 bincompat5005='$bincompat5005'
15215 binexp='$binexp'
15216 bison='$bison'
15217 byacc='$byacc'
15218 byteorder='$byteorder'
15219 c='$c'
15220 castflags='$castflags'
15221 cat='$cat'
15222 cc='$cc'
15223 cccdlflags='$cccdlflags'
15224 ccdlflags='$ccdlflags'
15225 ccflags='$ccflags'
15226 ccsymbols='$ccsymbols'
15227 cf_by='$cf_by'
15228 cf_email='$cf_email'
15229 cf_time='$cf_time'
15230 charsize='$charsize'
15231 chgrp='$chgrp'
15232 chmod='$chmod'
15233 chown='$chown'
15234 clocktype='$clocktype'
15235 comm='$comm'
15236 compress='$compress'
15237 contains='$contains'
15238 cp='$cp'
15239 cpio='$cpio'
15240 cpp='$cpp'
15241 cpp_stuff='$cpp_stuff'
15242 cppccsymbols='$cppccsymbols'
15243 cppflags='$cppflags'
15244 cpplast='$cpplast'
15245 cppminus='$cppminus'
15246 cpprun='$cpprun'
15247 cppstdin='$cppstdin'
15248 cppsymbols='$cppsymbols'
15249 crosscompile='$crosscompile'
15250 cryptlib='$cryptlib'
15251 csh='$csh'
15252 d_Gconvert='$d_Gconvert'
15253 d_PRIEldbl='$d_PRIEldbl'
15254 d_PRIFldbl='$d_PRIFldbl'
15255 d_PRIGldbl='$d_PRIGldbl'
15256 d_PRIX64='$d_PRIX64'
15257 d_PRId64='$d_PRId64'
15258 d_PRIeldbl='$d_PRIeldbl'
15259 d_PRIfldbl='$d_PRIfldbl'
15260 d_PRIgldbl='$d_PRIgldbl'
15261 d_PRIi64='$d_PRIi64'
15262 d_PRIo64='$d_PRIo64'
15263 d_PRIu64='$d_PRIu64'
15264 d_PRIx64='$d_PRIx64'
15265 d_access='$d_access'
15266 d_accessx='$d_accessx'
15267 d_alarm='$d_alarm'
15268 d_archlib='$d_archlib'
15269 d_atolf='$d_atolf'
15270 d_atoll='$d_atoll'
15271 d_attribut='$d_attribut'
15272 d_bcmp='$d_bcmp'
15273 d_bcopy='$d_bcopy'
15274 d_bincompat5005='$d_bincompat5005'
15275 d_bsd='$d_bsd'
15276 d_bsdgetpgrp='$d_bsdgetpgrp'
15277 d_bsdsetpgrp='$d_bsdsetpgrp'
15278 d_bzero='$d_bzero'
15279 d_casti32='$d_casti32'
15280 d_castneg='$d_castneg'
15281 d_charvspr='$d_charvspr'
15282 d_chown='$d_chown'
15283 d_chroot='$d_chroot'
15284 d_chsize='$d_chsize'
15285 d_closedir='$d_closedir'
15286 d_const='$d_const'
15287 d_crypt='$d_crypt'
15288 d_csh='$d_csh'
15289 d_cuserid='$d_cuserid'
15290 d_dbl_dig='$d_dbl_dig'
15291 d_difftime='$d_difftime'
15292 d_dirnamlen='$d_dirnamlen'
15293 d_dlerror='$d_dlerror'
15294 d_dlopen='$d_dlopen'
15295 d_dlsymun='$d_dlsymun'
15296 d_dosuid='$d_dosuid'
15297 d_drand48proto='$d_drand48proto'
15298 d_dup2='$d_dup2'
15299 d_eaccess='$d_eaccess'
15300 d_endgrent='$d_endgrent'
15301 d_endhent='$d_endhent'
15302 d_endnent='$d_endnent'
15303 d_endpent='$d_endpent'
15304 d_endpwent='$d_endpwent'
15305 d_endsent='$d_endsent'
15306 d_eofnblk='$d_eofnblk'
15307 d_eunice='$d_eunice'
15308 d_fchmod='$d_fchmod'
15309 d_fchown='$d_fchown'
15310 d_fcntl='$d_fcntl'
15311 d_fd_macros='$d_fd_macros'
15312 d_fd_set='$d_fd_set'
15313 d_fds_bits='$d_fds_bits'
15314 d_fgetpos='$d_fgetpos'
15315 d_flexfnam='$d_flexfnam'
15316 d_flock='$d_flock'
15317 d_fork='$d_fork'
15318 d_fpathconf='$d_fpathconf'
15319 d_fpos64_t='$d_fpos64_t'
15320 d_frexpl='$d_frexpl'
15321 d_fs_data_s='$d_fs_data_s'
15322 d_fseeko='$d_fseeko'
15323 d_fsetpos='$d_fsetpos'
15324 d_fstatfs='$d_fstatfs'
15325 d_fstatvfs='$d_fstatvfs'
15326 d_ftello='$d_ftello'
15327 d_ftime='$d_ftime'
15328 d_getcwd='$d_getcwd'
15329 d_getespwnam='$d_getespwnam'
15330 d_getfsstat='$d_getfsstat'
15331 d_getgrent='$d_getgrent'
15332 d_getgrps='$d_getgrps'
15333 d_gethbyaddr='$d_gethbyaddr'
15334 d_gethbyname='$d_gethbyname'
15335 d_gethent='$d_gethent'
15336 d_gethname='$d_gethname'
15337 d_gethostprotos='$d_gethostprotos'
15338 d_getlogin='$d_getlogin'
15339 d_getmnt='$d_getmnt'
15340 d_getmntent='$d_getmntent'
15341 d_getnbyaddr='$d_getnbyaddr'
15342 d_getnbyname='$d_getnbyname'
15343 d_getnent='$d_getnent'
15344 d_getnetprotos='$d_getnetprotos'
15345 d_getpbyname='$d_getpbyname'
15346 d_getpbynumber='$d_getpbynumber'
15347 d_getpent='$d_getpent'
15348 d_getpgid='$d_getpgid'
15349 d_getpgrp2='$d_getpgrp2'
15350 d_getpgrp='$d_getpgrp'
15351 d_getppid='$d_getppid'
15352 d_getprior='$d_getprior'
15353 d_getprotoprotos='$d_getprotoprotos'
15354 d_getprpwnam='$d_getprpwnam'
15355 d_getpwent='$d_getpwent'
15356 d_getsbyname='$d_getsbyname'
15357 d_getsbyport='$d_getsbyport'
15358 d_getsent='$d_getsent'
15359 d_getservprotos='$d_getservprotos'
15360 d_getspnam='$d_getspnam'
15361 d_gettimeod='$d_gettimeod'
15362 d_gnulibc='$d_gnulibc'
15363 d_grpasswd='$d_grpasswd'
15364 d_hasmntopt='$d_hasmntopt'
15365 d_htonl='$d_htonl'
15366 d_iconv='$d_iconv'
15367 d_index='$d_index'
15368 d_inetaton='$d_inetaton'
15369 d_int64_t='$d_int64_t'
15370 d_isascii='$d_isascii'
15371 d_isnan='$d_isnan'
15372 d_isnanl='$d_isnanl'
15373 d_killpg='$d_killpg'
15374 d_lchown='$d_lchown'
15375 d_ldbl_dig='$d_ldbl_dig'
15376 d_link='$d_link'
15377 d_locconv='$d_locconv'
15378 d_lockf='$d_lockf'
15379 d_longdbl='$d_longdbl'
15380 d_longlong='$d_longlong'
15381 d_lseekproto='$d_lseekproto'
15382 d_lstat='$d_lstat'
15383 d_madvise='$d_madvise'
15384 d_mblen='$d_mblen'
15385 d_mbstowcs='$d_mbstowcs'
15386 d_mbtowc='$d_mbtowc'
15387 d_memchr='$d_memchr'
15388 d_memcmp='$d_memcmp'
15389 d_memcpy='$d_memcpy'
15390 d_memmove='$d_memmove'
15391 d_memset='$d_memset'
15392 d_mkdir='$d_mkdir'
15393 d_mkdtemp='$d_mkdtemp'
15394 d_mkfifo='$d_mkfifo'
15395 d_mkstemp='$d_mkstemp'
15396 d_mkstemps='$d_mkstemps'
15397 d_mktime='$d_mktime'
15398 d_mmap='$d_mmap'
15399 d_modfl='$d_modfl'
15400 d_mprotect='$d_mprotect'
15401 d_msg='$d_msg'
15402 d_msg_ctrunc='$d_msg_ctrunc'
15403 d_msg_dontroute='$d_msg_dontroute'
15404 d_msg_oob='$d_msg_oob'
15405 d_msg_peek='$d_msg_peek'
15406 d_msg_proxy='$d_msg_proxy'
15407 d_msgctl='$d_msgctl'
15408 d_msgget='$d_msgget'
15409 d_msgrcv='$d_msgrcv'
15410 d_msgsnd='$d_msgsnd'
15411 d_msync='$d_msync'
15412 d_munmap='$d_munmap'
15413 d_mymalloc='$d_mymalloc'
15414 d_nice='$d_nice'
15415 d_nv_preserves_uv='$d_nv_preserves_uv'
15416 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15417 d_off64_t='$d_off64_t'
15418 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15419 d_oldpthreads='$d_oldpthreads'
15420 d_oldsock='$d_oldsock'
15421 d_open3='$d_open3'
15422 d_pathconf='$d_pathconf'
15423 d_pause='$d_pause'
15424 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15425 d_phostname='$d_phostname'
15426 d_pipe='$d_pipe'
15427 d_poll='$d_poll'
15428 d_portable='$d_portable'
15429 d_pthread_yield='$d_pthread_yield'
15430 d_pwage='$d_pwage'
15431 d_pwchange='$d_pwchange'
15432 d_pwclass='$d_pwclass'
15433 d_pwcomment='$d_pwcomment'
15434 d_pwexpire='$d_pwexpire'
15435 d_pwgecos='$d_pwgecos'
15436 d_pwpasswd='$d_pwpasswd'
15437 d_pwquota='$d_pwquota'
15438 d_qgcvt='$d_qgcvt'
15439 d_quad='$d_quad'
15440 d_readdir='$d_readdir'
15441 d_readlink='$d_readlink'
15442 d_rename='$d_rename'
15443 d_rewinddir='$d_rewinddir'
15444 d_rmdir='$d_rmdir'
15445 d_safebcpy='$d_safebcpy'
15446 d_safemcpy='$d_safemcpy'
15447 d_sanemcmp='$d_sanemcmp'
15448 d_sched_yield='$d_sched_yield'
15449 d_scm_rights='$d_scm_rights'
15450 d_seekdir='$d_seekdir'
15451 d_select='$d_select'
15452 d_sem='$d_sem'
15453 d_semctl='$d_semctl'
15454 d_semctl_semid_ds='$d_semctl_semid_ds'
15455 d_semctl_semun='$d_semctl_semun'
15456 d_semget='$d_semget'
15457 d_semop='$d_semop'
15458 d_setegid='$d_setegid'
15459 d_seteuid='$d_seteuid'
15460 d_setgrent='$d_setgrent'
15461 d_setgrps='$d_setgrps'
15462 d_sethent='$d_sethent'
15463 d_setlinebuf='$d_setlinebuf'
15464 d_setlocale='$d_setlocale'
15465 d_setnent='$d_setnent'
15466 d_setpent='$d_setpent'
15467 d_setpgid='$d_setpgid'
15468 d_setpgrp2='$d_setpgrp2'
15469 d_setpgrp='$d_setpgrp'
15470 d_setprior='$d_setprior'
15471 d_setpwent='$d_setpwent'
15472 d_setregid='$d_setregid'
15473 d_setresgid='$d_setresgid'
15474 d_setresuid='$d_setresuid'
15475 d_setreuid='$d_setreuid'
15476 d_setrgid='$d_setrgid'
15477 d_setruid='$d_setruid'
15478 d_setsent='$d_setsent'
15479 d_setsid='$d_setsid'
15480 d_setvbuf='$d_setvbuf'
15481 d_sfio='$d_sfio'
15482 d_shm='$d_shm'
15483 d_shmat='$d_shmat'
15484 d_shmatprototype='$d_shmatprototype'
15485 d_shmctl='$d_shmctl'
15486 d_shmdt='$d_shmdt'
15487 d_shmget='$d_shmget'
15488 d_sigaction='$d_sigaction'
15489 d_sigsetjmp='$d_sigsetjmp'
15490 d_socket='$d_socket'
15491 d_socklen_t='$d_socklen_t'
15492 d_sockpair='$d_sockpair'
15493 d_sqrtl='$d_sqrtl'
15494 d_statblks='$d_statblks'
15495 d_statfs_f_flags='$d_statfs_f_flags'
15496 d_statfs_s='$d_statfs_s'
15497 d_statvfs='$d_statvfs'
15498 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15499 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15500 d_stdio_stream_array='$d_stdio_stream_array'
15501 d_stdiobase='$d_stdiobase'
15502 d_stdstdio='$d_stdstdio'
15503 d_strchr='$d_strchr'
15504 d_strcoll='$d_strcoll'
15505 d_strctcpy='$d_strctcpy'
15506 d_strerrm='$d_strerrm'
15507 d_strerror='$d_strerror'
15508 d_strtod='$d_strtod'
15509 d_strtol='$d_strtol'
15510 d_strtold='$d_strtold'
15511 d_strtoll='$d_strtoll'
15512 d_strtoul='$d_strtoul'
15513 d_strtoull='$d_strtoull'
15514 d_strtouq='$d_strtouq'
15515 d_strxfrm='$d_strxfrm'
15516 d_suidsafe='$d_suidsafe'
15517 d_symlink='$d_symlink'
15518 d_syscall='$d_syscall'
15519 d_sysconf='$d_sysconf'
15520 d_sysernlst='$d_sysernlst'
15521 d_syserrlst='$d_syserrlst'
15522 d_system='$d_system'
15523 d_tcgetpgrp='$d_tcgetpgrp'
15524 d_tcsetpgrp='$d_tcsetpgrp'
15525 d_telldir='$d_telldir'
15526 d_telldirproto='$d_telldirproto'
15527 d_time='$d_time'
15528 d_times='$d_times'
15529 d_truncate='$d_truncate'
15530 d_tzname='$d_tzname'
15531 d_umask='$d_umask'
15532 d_uname='$d_uname'
15533 d_union_semun='$d_union_semun'
15534 d_ustat='$d_ustat'
15535 d_vendorarch='$d_vendorarch'
15536 d_vendorbin='$d_vendorbin'
15537 d_vendorlib='$d_vendorlib'
15538 d_vfork='$d_vfork'
15539 d_void_closedir='$d_void_closedir'
15540 d_voidsig='$d_voidsig'
15541 d_voidtty='$d_voidtty'
15542 d_volatile='$d_volatile'
15543 d_vprintf='$d_vprintf'
15544 d_wait4='$d_wait4'
15545 d_waitpid='$d_waitpid'
15546 d_wcstombs='$d_wcstombs'
15547 d_wctomb='$d_wctomb'
15548 d_xenix='$d_xenix'
15549 date='$date'
15550 db_hashtype='$db_hashtype'
15551 db_prefixtype='$db_prefixtype'
15552 defvoidused='$defvoidused'
15553 direntrytype='$direntrytype'
15554 dlext='$dlext'
15555 dlsrc='$dlsrc'
15556 doublesize='$doublesize'
15557 drand01='$drand01'
15558 dynamic_ext='$dynamic_ext'
15559 eagain='$eagain'
15560 ebcdic='$ebcdic'
15561 echo='$echo'
15562 egrep='$egrep'
15563 emacs='$emacs'
15564 eunicefix='$eunicefix'
15565 exe_ext='$exe_ext'
15566 expr='$expr'
15567 extensions='$extensions'
15568 fflushNULL='$fflushNULL'
15569 fflushall='$fflushall'
15570 find='$find'
15571 firstmakefile='$firstmakefile'
15572 flex='$flex'
15573 fpossize='$fpossize'
15574 fpostype='$fpostype'
15575 freetype='$freetype'
15576 full_ar='$full_ar'
15577 full_csh='$full_csh'
15578 full_sed='$full_sed'
15579 gccversion='$gccversion'
15580 gidformat='$gidformat'
15581 gidsign='$gidsign'
15582 gidsize='$gidsize'
15583 gidtype='$gidtype'
15584 glibpth='$glibpth'
15585 grep='$grep'
15586 groupcat='$groupcat'
15587 groupstype='$groupstype'
15588 gzip='$gzip'
15589 h_fcntl='$h_fcntl'
15590 h_sysfile='$h_sysfile'
15591 hint='$hint'
15592 hostcat='$hostcat'
15593 huge='$huge'
15594 i16size='$i16size'
15595 i16type='$i16type'
15596 i32size='$i32size'
15597 i32type='$i32type'
15598 i64size='$i64size'
15599 i64type='$i64type'
15600 i8size='$i8size'
15601 i8type='$i8type'
15602 i_arpainet='$i_arpainet'
15603 i_bsdioctl='$i_bsdioctl'
15604 i_db='$i_db'
15605 i_dbm='$i_dbm'
15606 i_dirent='$i_dirent'
15607 i_dld='$i_dld'
15608 i_dlfcn='$i_dlfcn'
15609 i_fcntl='$i_fcntl'
15610 i_float='$i_float'
15611 i_gdbm='$i_gdbm'
15612 i_grp='$i_grp'
15613 i_iconv='$i_iconv'
15614 i_ieeefp='$i_ieeefp'
15615 i_inttypes='$i_inttypes'
15616 i_limits='$i_limits'
15617 i_locale='$i_locale'
15618 i_machcthr='$i_machcthr'
15619 i_malloc='$i_malloc'
15620 i_math='$i_math'
15621 i_memory='$i_memory'
15622 i_mntent='$i_mntent'
15623 i_ndbm='$i_ndbm'
15624 i_netdb='$i_netdb'
15625 i_neterrno='$i_neterrno'
15626 i_netinettcp='$i_netinettcp'
15627 i_niin='$i_niin'
15628 i_poll='$i_poll'
15629 i_prot='$i_prot'
15630 i_pthread='$i_pthread'
15631 i_pwd='$i_pwd'
15632 i_rpcsvcdbm='$i_rpcsvcdbm'
15633 i_sfio='$i_sfio'
15634 i_sgtty='$i_sgtty'
15635 i_shadow='$i_shadow'
15636 i_socks='$i_socks'
15637 i_stdarg='$i_stdarg'
15638 i_stddef='$i_stddef'
15639 i_stdlib='$i_stdlib'
15640 i_string='$i_string'
15641 i_sunmath='$i_sunmath'
15642 i_sysaccess='$i_sysaccess'
15643 i_sysdir='$i_sysdir'
15644 i_sysfile='$i_sysfile'
15645 i_sysfilio='$i_sysfilio'
15646 i_sysin='$i_sysin'
15647 i_sysioctl='$i_sysioctl'
15648 i_syslog='$i_syslog'
15649 i_sysmman='$i_sysmman'
15650 i_sysmode='$i_sysmode'
15651 i_sysmount='$i_sysmount'
15652 i_sysndir='$i_sysndir'
15653 i_sysparam='$i_sysparam'
15654 i_sysresrc='$i_sysresrc'
15655 i_syssecrt='$i_syssecrt'
15656 i_sysselct='$i_sysselct'
15657 i_syssockio='$i_syssockio'
15658 i_sysstat='$i_sysstat'
15659 i_sysstatfs='$i_sysstatfs'
15660 i_sysstatvfs='$i_sysstatvfs'
15661 i_systime='$i_systime'
15662 i_systimek='$i_systimek'
15663 i_systimes='$i_systimes'
15664 i_systypes='$i_systypes'
15665 i_sysuio='$i_sysuio'
15666 i_sysun='$i_sysun'
15667 i_sysutsname='$i_sysutsname'
15668 i_sysvfs='$i_sysvfs'
15669 i_syswait='$i_syswait'
15670 i_termio='$i_termio'
15671 i_termios='$i_termios'
15672 i_time='$i_time'
15673 i_unistd='$i_unistd'
15674 i_ustat='$i_ustat'
15675 i_utime='$i_utime'
15676 i_values='$i_values'
15677 i_varargs='$i_varargs'
15678 i_varhdr='$i_varhdr'
15679 i_vfork='$i_vfork'
15680 ignore_versioned_solibs='$ignore_versioned_solibs'
15681 inc_version_list='$inc_version_list'
15682 inc_version_list_init='$inc_version_list_init'
15683 incpath='$incpath'
15684 inews='$inews'
15685 installarchlib='$installarchlib'
15686 installbin='$installbin'
15687 installman1dir='$installman1dir'
15688 installman3dir='$installman3dir'
15689 installprefix='$installprefix'
15690 installprefixexp='$installprefixexp'
15691 installprivlib='$installprivlib'
15692 installscript='$installscript'
15693 installsitearch='$installsitearch'
15694 installsitebin='$installsitebin'
15695 installsitelib='$installsitelib'
15696 installstyle='$installstyle'
15697 installusrbinperl='$installusrbinperl'
15698 installvendorarch='$installvendorarch'
15699 installvendorbin='$installvendorbin'
15700 installvendorlib='$installvendorlib'
15701 intsize='$intsize'
15702 ivdformat='$ivdformat'
15703 ivsize='$ivsize'
15704 ivtype='$ivtype'
15705 known_extensions='$known_extensions'
15706 ksh='$ksh'
15707 large='$large'
15708 ld='$ld'
15709 lddlflags='$lddlflags'
15710 ldflags='$ldflags'
15711 ldlibpthname='$ldlibpthname'
15712 less='$less'
15713 lib_ext='$lib_ext'
15714 libc='$libc'
15715 libperl='$libperl'
15716 libpth='$libpth'
15717 libs='$libs'
15718 libsdirs='$libsdirs'
15719 libsfiles='$libsfiles'
15720 libsfound='$libsfound'
15721 libspath='$libspath'
15722 libswanted='$libswanted'
15723 line='$line'
15724 lint='$lint'
15725 lkflags='$lkflags'
15726 ln='$ln'
15727 lns='$lns'
15728 locincpth='$locincpth'
15729 loclibpth='$loclibpth'
15730 longdblsize='$longdblsize'
15731 longlongsize='$longlongsize'
15732 longsize='$longsize'
15733 lp='$lp'
15734 lpr='$lpr'
15735 ls='$ls'
15736 lseeksize='$lseeksize'
15737 lseektype='$lseektype'
15738 mail='$mail'
15739 mailx='$mailx'
15740 make='$make'
15741 make_set_make='$make_set_make'
15742 mallocobj='$mallocobj'
15743 mallocsrc='$mallocsrc'
15744 malloctype='$malloctype'
15745 man1dir='$man1dir'
15746 man1direxp='$man1direxp'
15747 man1ext='$man1ext'
15748 man3dir='$man3dir'
15749 man3direxp='$man3direxp'
15750 man3ext='$man3ext'
15751 medium='$medium'
15752 mips_type='$mips_type'
15753 mkdir='$mkdir'
15754 mmaptype='$mmaptype'
15755 models='$models'
15756 modetype='$modetype'
15757 more='$more'
15758 multiarch='$multiarch'
15759 mv='$mv'
15760 myarchname='$myarchname'
15761 mydomain='$mydomain'
15762 myhostname='$myhostname'
15763 myuname='$myuname'
15764 n='$n'
15765 netdb_hlen_type='$netdb_hlen_type'
15766 netdb_host_type='$netdb_host_type'
15767 netdb_name_type='$netdb_name_type'
15768 netdb_net_type='$netdb_net_type'
15769 nm='$nm'
15770 nm_opt='$nm_opt'
15771 nm_so_opt='$nm_so_opt'
15772 nonxs_ext='$nonxs_ext'
15773 nroff='$nroff'
15774 nvsize='$nvsize'
15775 nvtype='$nvtype'
15776 o_nonblock='$o_nonblock'
15777 obj_ext='$obj_ext'
15778 old_pthread_create_joinable='$old_pthread_create_joinable'
15779 optimize='$optimize'
15780 orderlib='$orderlib'
15781 osname='$osname'
15782 osvers='$osvers'
15783 otherlibdirs='$otherlibdirs'
15784 package='$package'
15785 pager='$pager'
15786 passcat='$passcat'
15787 patchlevel='$patchlevel'
15788 path_sep='$path_sep'
15789 perl5='$perl5'
15790 perl='$perl'
15791 perladmin='$perladmin'
15792 perlpath='$perlpath'
15793 pg='$pg'
15794 phostname='$phostname'
15795 pidtype='$pidtype'
15796 plibpth='$plibpth'
15797 pm_apiversion='$pm_apiversion'
15798 pmake='$pmake'
15799 pr='$pr'
15800 prefix='$prefix'
15801 prefixexp='$prefixexp'
15802 privlib='$privlib'
15803 privlibexp='$privlibexp'
15804 prototype='$prototype'
15805 ptrsize='$ptrsize'
15806 quadkind='$quadkind'
15807 quadtype='$quadtype'
15808 randbits='$randbits'
15809 randfunc='$randfunc'
15810 randseedtype='$randseedtype'
15811 ranlib='$ranlib'
15812 rd_nodata='$rd_nodata'
15813 revision='$revision'
15814 rm='$rm'
15815 rmail='$rmail'
15816 runnm='$runnm'
15817 sPRIEldbl='$sPRIEldbl'
15818 sPRIFldbl='$sPRIFldbl'
15819 sPRIGldbl='$sPRIGldbl'
15820 sPRIX64='$sPRIX64'
15821 sPRId64='$sPRId64'
15822 sPRIeldbl='$sPRIeldbl'
15823 sPRIfldbl='$sPRIfldbl'
15824 sPRIgldbl='$sPRIgldbl'
15825 sPRIi64='$sPRIi64'
15826 sPRIo64='$sPRIo64'
15827 sPRIu64='$sPRIu64'
15828 sPRIx64='$sPRIx64'
15829 sched_yield='$sched_yield'
15830 scriptdir='$scriptdir'
15831 scriptdirexp='$scriptdirexp'
15832 sed='$sed'
15833 seedfunc='$seedfunc'
15834 selectminbits='$selectminbits'
15835 selecttype='$selecttype'
15836 sendmail='$sendmail'
15837 sh='$sh'
15838 shar='$shar'
15839 sharpbang='$sharpbang'
15840 shmattype='$shmattype'
15841 shortsize='$shortsize'
15842 shrpenv='$shrpenv'
15843 shsharp='$shsharp'
15844 sig_count='$sig_count'
15845 sig_name='$sig_name'
15846 sig_name_init='$sig_name_init'
15847 sig_num='$sig_num'
15848 sig_num_init='$sig_num_init'
15849 signal_t='$signal_t'
15850 sitearch='$sitearch'
15851 sitearchexp='$sitearchexp'
15852 sitebin='$sitebin'
15853 sitebinexp='$sitebinexp'
15854 sitelib='$sitelib'
15855 sitelib_stem='$sitelib_stem'
15856 sitelibexp='$sitelibexp'
15857 siteprefix='$siteprefix'
15858 siteprefixexp='$siteprefixexp'
15859 sizesize='$sizesize'
15860 sizetype='$sizetype'
15861 sleep='$sleep'
15862 smail='$smail'
15863 small='$small'
15864 so='$so'
15865 sockethdr='$sockethdr'
15866 socketlib='$socketlib'
15867 socksizetype='$socksizetype'
15868 sort='$sort'
15869 spackage='$spackage'
15870 spitshell='$spitshell'
15871 split='$split'
15872 src='$src'
15873 ssizetype='$ssizetype'
15874 startperl='$startperl'
15875 startsh='$startsh'
15876 static_ext='$static_ext'
15877 stdchar='$stdchar'
15878 stdio_base='$stdio_base'
15879 stdio_bufsiz='$stdio_bufsiz'
15880 stdio_cnt='$stdio_cnt'
15881 stdio_filbuf='$stdio_filbuf'
15882 stdio_ptr='$stdio_ptr'
15883 stdio_stream_array='$stdio_stream_array'
15884 strings='$strings'
15885 submit='$submit'
15886 subversion='$subversion'
15887 sysman='$sysman'
15888 tail='$tail'
15889 tar='$tar'
15890 tbl='$tbl'
15891 tee='$tee'
15892 test='$test'
15893 timeincl='$timeincl'
15894 timetype='$timetype'
15895 touch='$touch'
15896 tr='$tr'
15897 trnl='$trnl'
15898 troff='$troff'
15899 u16size='$u16size'
15900 u16type='$u16type'
15901 u32size='$u32size'
15902 u32type='$u32type'
15903 u64size='$u64size'
15904 u64type='$u64type'
15905 u8size='$u8size'
15906 u8type='$u8type'
15907 uidformat='$uidformat'
15908 uidsign='$uidsign'
15909 uidsize='$uidsize'
15910 uidtype='$uidtype'
15911 uname='$uname'
15912 uniq='$uniq'
15913 uquadtype='$uquadtype'
15914 use5005threads='$use5005threads'
15915 use64bitall='$use64bitall'
15916 use64bitint='$use64bitint'
15917 usedl='$usedl'
15918 useithreads='$useithreads'
15919 uselargefiles='$uselargefiles'
15920 uselongdouble='$uselongdouble'
15921 usemorebits='$usemorebits'
15922 usemultiplicity='$usemultiplicity'
15923 usemymalloc='$usemymalloc'
15924 usenm='$usenm'
15925 useopcode='$useopcode'
15926 useperlio='$useperlio'
15927 useposix='$useposix'
15928 usesfio='$usesfio'
15929 useshrplib='$useshrplib'
15930 usesocks='$usesocks'
15931 usethreads='$usethreads'
15932 usevendorprefix='$usevendorprefix'
15933 usevfork='$usevfork'
15934 usrinc='$usrinc'
15935 uuname='$uuname'
15936 uvoformat='$uvoformat'
15937 uvsize='$uvsize'
15938 uvtype='$uvtype'
15939 uvuformat='$uvuformat'
15940 uvxformat='$uvxformat'
15941 vendorarch='$vendorarch'
15942 vendorarchexp='$vendorarchexp'
15943 vendorbin='$vendorbin'
15944 vendorbinexp='$vendorbinexp'
15945 vendorlib='$vendorlib'
15946 vendorlib_stem='$vendorlib_stem'
15947 vendorlibexp='$vendorlibexp'
15948 vendorprefix='$vendorprefix'
15949 vendorprefixexp='$vendorprefixexp'
15950 version='$version'
15951 vi='$vi'
15952 voidflags='$voidflags'
15953 xlibpth='$xlibpth'
15954 xs_apiversion='$xs_apiversion'
15955 zcat='$zcat'
15956 zip='$zip'
15957 EOT
15958
15959 : Add in command line options if available
15960 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15961
15962 : add special variables
15963 $test -f $src/patchlevel.h && \
15964 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15965 echo "CONFIGDOTSH=true" >>config.sh
15966
15967 : propagate old symbols
15968 if $test -f UU/config.sh; then
15969         <UU/config.sh sort | uniq >UU/oldconfig.sh
15970         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15971         sort | uniq -u >UU/oldsyms
15972         set X `cat UU/oldsyms`
15973         shift
15974         case $# in
15975         0) ;;
15976         *)
15977                 cat <<EOM
15978 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15979 EOM
15980                 echo "# Variables propagated from previous config.sh file." >>config.sh
15981                 for sym in `cat UU/oldsyms`; do
15982                         echo "    Propagating $hint variable "'$'"$sym..."
15983                         eval 'tmp="$'"${sym}"'"'
15984                         echo "$tmp" | \
15985                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15986                 done
15987                 ;;
15988         esac
15989 fi
15990
15991 : Finish up by extracting the .SH files
15992 case "$alldone" in
15993 exit)
15994         $rm -rf UU
15995         echo "Done."
15996         exit 0
15997         ;;
15998 cont)
15999         ;;
16000 '')
16001         dflt=''
16002         nostick=true
16003         $cat <<EOM
16004
16005 If you'd like to make any changes to the config.sh file before I begin
16006 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16007
16008 EOM
16009         rp="Press return or use a shell escape to edit config.sh:"
16010         . UU/myread
16011         nostick=''
16012         case "$ans" in
16013         '') ;;
16014         *) : in case they cannot read
16015                 sh 1>&4 -c "$ans";;
16016         esac
16017         ;;
16018 esac
16019
16020 : if this fails, just run all the .SH files by hand
16021 . ./config.sh
16022
16023 echo " "
16024 exec 1>&4
16025 . ./UU/extract
16026
16027 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16028         dflt=y
16029         case "$silent" in
16030         true) ;;
16031         *)
16032                 $cat <<EOM
16033
16034 Now you need to generate make dependencies by running "$make depend".
16035 You might prefer to run it in background: "$make depend > makedepend.out &"
16036 It can take a while, so you might not want to run it right now.
16037
16038 EOM
16039                 ;;
16040         esac
16041         rp="Run $make depend now?"
16042         . UU/myread
16043         case "$ans" in
16044         y*)
16045                 $make depend && echo "Now you must run a $make."
16046                 ;;
16047         *)
16048                 echo "You must run '$make depend' then '$make'."
16049                 ;;
16050         esac
16051 elif test -f [Mm]akefile; then
16052         echo " "
16053         echo "Now you must run a $make."
16054 else
16055         echo "Done."
16056 fi
16057
16058 if $test -f Policy.sh; then
16059     $cat <<EOM
16060
16061 If you compile $package on a different machine or from a different object
16062 directory, copy the Policy.sh file from this object directory to the
16063 new one before you run Configure -- this will help you with most of
16064 the policy defaults.
16065
16066 EOM
16067 fi
16068 if $test -f config.msg; then
16069     echo "Hmm.  I also noted the following information while running:"
16070     echo " "
16071     $cat config.msg >&4
16072     $rm -f config.msg
16073 fi
16074 $rm -f kit*isdone ark*isdone
16075 $rm -rf UU
16076
16077 : End of Configure
16078