Rename testsyml to issymlink.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Dec 21 18:12:08 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigsetjmp=''
523 d_msg_ctrunc=''
524 d_msg_dontroute=''
525 d_msg_oob=''
526 d_msg_peek=''
527 d_msg_proxy=''
528 d_oldsock=''
529 d_scm_rights=''
530 d_socket=''
531 d_sockpair=''
532 sockethdr=''
533 socketlib=''
534 d_socklen_t=''
535 d_socks5_init=''
536 d_sqrtl=''
537 d_statblks=''
538 d_statfs_f_flags=''
539 d_statfs_s=''
540 d_fstatvfs=''
541 d_statvfs=''
542 d_stdio_cnt_lval=''
543 d_stdio_ptr_lval=''
544 d_stdio_ptr_lval_nochange_cnt=''
545 d_stdio_ptr_lval_sets_cnt=''
546 d_stdiobase=''
547 d_stdstdio=''
548 stdio_base=''
549 stdio_bufsiz=''
550 stdio_cnt=''
551 stdio_filbuf=''
552 stdio_ptr=''
553 d_index=''
554 d_strchr=''
555 d_strcoll=''
556 d_strctcpy=''
557 d_strerrm=''
558 d_strerror=''
559 d_sysernlst=''
560 d_syserrlst=''
561 d_strtod=''
562 d_strtol=''
563 d_strtold=''
564 d_strtoll=''
565 d_strtoq=''
566 d_strtoul=''
567 d_strtoull=''
568 d_strtouq=''
569 d_strxfrm=''
570 d_symlink=''
571 d_syscall=''
572 d_sysconf=''
573 d_system=''
574 d_tcgetpgrp=''
575 d_tcsetpgrp=''
576 d_telldirproto=''
577 d_time=''
578 timetype=''
579 clocktype=''
580 d_times=''
581 d_truncate=''
582 d_tzname=''
583 d_umask=''
584 d_semctl_semid_ds=''
585 d_semctl_semun=''
586 d_union_semun=''
587 d_ustat=''
588 d_vfork=''
589 usevfork=''
590 d_voidsig=''
591 signal_t=''
592 d_volatile=''
593 d_charvspr=''
594 d_vprintf=''
595 d_wait4=''
596 d_waitpid=''
597 d_wcstombs=''
598 d_wctomb=''
599 dlext=''
600 cccdlflags=''
601 ccdlflags=''
602 dlsrc=''
603 ld=''
604 lddlflags=''
605 usedl=''
606 doublesize=''
607 ebcdic=''
608 fflushNULL=''
609 fflushall=''
610 fpossize=''
611 fpostype=''
612 gccosandvers=''
613 gccversion=''
614 gidformat=''
615 gidsign=''
616 gidsize=''
617 gidtype=''
618 groupstype=''
619 h_fcntl=''
620 h_sysfile=''
621 i_arpainet=''
622 db_hashtype=''
623 db_prefixtype=''
624 i_db=''
625 i_dbm=''
626 i_rpcsvcdbm=''
627 d_dirnamlen=''
628 direntrytype=''
629 i_dirent=''
630 i_dld=''
631 i_dlfcn=''
632 i_fcntl=''
633 i_float=''
634 i_gdbm=''
635 d_grpasswd=''
636 i_grp=''
637 i_iconv=''
638 i_ieeefp=''
639 i_inttypes=''
640 i_libutil=''
641 i_limits=''
642 i_locale=''
643 i_machcthr=''
644 i_malloc=''
645 i_math=''
646 i_memory=''
647 i_mntent=''
648 i_ndbm=''
649 i_netdb=''
650 i_neterrno=''
651 i_netinettcp=''
652 i_niin=''
653 i_sysin=''
654 i_poll=''
655 i_prot=''
656 i_pthread=''
657 d_pwage=''
658 d_pwchange=''
659 d_pwclass=''
660 d_pwcomment=''
661 d_pwexpire=''
662 d_pwgecos=''
663 d_pwpasswd=''
664 d_pwquota=''
665 i_pwd=''
666 i_sfio=''
667 i_shadow=''
668 i_socks=''
669 i_stddef=''
670 i_stdlib=''
671 i_string=''
672 strings=''
673 i_sunmath=''
674 i_sysaccess=''
675 i_sysdir=''
676 i_sysfile=''
677 d_voidtty=''
678 i_bsdioctl=''
679 i_sysfilio=''
680 i_sysioctl=''
681 i_syssockio=''
682 i_syslog=''
683 i_sysmman=''
684 i_sysmode=''
685 i_sysmount=''
686 i_sysndir=''
687 i_sysparam=''
688 i_sysresrc=''
689 i_syssecrt=''
690 i_sysselct=''
691 i_sysstat=''
692 i_sysstatfs=''
693 i_sysstatvfs=''
694 i_systimes=''
695 i_systypes=''
696 i_sysuio=''
697 i_sysun=''
698 i_sysutsname=''
699 i_sysvfs=''
700 i_syswait=''
701 i_sgtty=''
702 i_termio=''
703 i_termios=''
704 i_systime=''
705 i_systimek=''
706 i_time=''
707 timeincl=''
708 i_unistd=''
709 i_ustat=''
710 i_utime=''
711 i_values=''
712 i_stdarg=''
713 i_varargs=''
714 i_varhdr=''
715 i_vfork=''
716 inc_version_list=''
717 inc_version_list_init=''
718 installprefix=''
719 installprefixexp=''
720 installstyle=''
721 installusrbinperl=''
722 intsize=''
723 longsize=''
724 shortsize=''
725 issymlink=''
726 libc=''
727 ldlibpthname=''
728 libperl=''
729 shrpenv=''
730 useshrplib=''
731 glibpth=''
732 libpth=''
733 loclibpth=''
734 plibpth=''
735 xlibpth=''
736 ignore_versioned_solibs=''
737 libs=''
738 libsdirs=''
739 libsfiles=''
740 libsfound=''
741 libspath=''
742 lns=''
743 d_PRIEUldbl=''
744 d_PRIFUldbl=''
745 d_PRIGUldbl=''
746 d_PRIeldbl=''
747 d_PRIfldbl=''
748 d_PRIgldbl=''
749 d_SCNfldbl=''
750 sPRIEUldbl=''
751 sPRIFUldbl=''
752 sPRIGUldbl=''
753 sPRIeldbl=''
754 sPRIfldbl=''
755 sPRIgldbl=''
756 sSCNfldbl=''
757 lseeksize=''
758 lseektype=''
759 make_set_make=''
760 d_mymalloc=''
761 freetype=''
762 mallocobj=''
763 mallocsrc=''
764 malloctype=''
765 usemymalloc=''
766 installman1dir=''
767 man1dir=''
768 man1direxp=''
769 man1ext=''
770 installman3dir=''
771 man3dir=''
772 man3direxp=''
773 man3ext=''
774 modetype=''
775 multiarch=''
776 mydomain=''
777 myhostname=''
778 phostname=''
779 c=''
780 n=''
781 d_eofnblk=''
782 eagain=''
783 o_nonblock=''
784 rd_nodata=''
785 need_va_copy=''
786 netdb_hlen_type=''
787 netdb_host_type=''
788 netdb_name_type=''
789 netdb_net_type=''
790 groupcat=''
791 hostcat=''
792 passcat=''
793 orderlib=''
794 ranlib=''
795 d_perl_otherlibdirs=''
796 otherlibdirs=''
797 package=''
798 spackage=''
799 pager=''
800 api_revision=''
801 api_subversion=''
802 api_version=''
803 api_versionstring=''
804 patchlevel=''
805 revision=''
806 subversion=''
807 version=''
808 perl5=''
809 perladmin=''
810 perlpath=''
811 d_nv_preserves_uv=''
812 d_nv_preserves_uv_bits=''
813 i16size=''
814 i16type=''
815 i32size=''
816 i32type=''
817 i64size=''
818 i64type=''
819 i8size=''
820 i8type=''
821 ivsize=''
822 ivtype=''
823 nvsize=''
824 nvtype=''
825 u16size=''
826 u16type=''
827 u32size=''
828 u32type=''
829 u64size=''
830 u64type=''
831 u8size=''
832 u8type=''
833 uvsize=''
834 uvtype=''
835 ivdformat=''
836 nvEUformat=''
837 nvFUformat=''
838 nvGUformat=''
839 nveformat=''
840 nvfformat=''
841 nvgformat=''
842 uvXUformat=''
843 uvoformat=''
844 uvuformat=''
845 uvxformat=''
846 pidtype=''
847 prefix=''
848 prefixexp=''
849 installprivlib=''
850 privlib=''
851 privlibexp=''
852 prototype=''
853 ptrsize=''
854 d_PRIXU64=''
855 d_PRId64=''
856 d_PRIi64=''
857 d_PRIo64=''
858 d_PRIu64=''
859 d_PRIx64=''
860 sPRIXU64=''
861 sPRId64=''
862 sPRIi64=''
863 sPRIo64=''
864 sPRIu64=''
865 sPRIx64=''
866 d_quad=''
867 quadkind=''
868 quadtype=''
869 uquadtype=''
870 drand01=''
871 randbits=''
872 randfunc=''
873 randseedtype=''
874 seedfunc=''
875 installscript=''
876 scriptdir=''
877 scriptdirexp=''
878 selectminbits=''
879 selecttype=''
880 sh=''
881 sig_count=''
882 sig_name=''
883 sig_name_init=''
884 sig_num=''
885 sig_num_init=''
886 installsitearch=''
887 sitearch=''
888 sitearchexp=''
889 installsitebin=''
890 sitebin=''
891 sitebinexp=''
892 installsitelib=''
893 sitelib=''
894 sitelib_stem=''
895 sitelibexp=''
896 siteprefix=''
897 siteprefixexp=''
898 sizesize=''
899 sizetype=''
900 so=''
901 socksizetype=''
902 sharpbang=''
903 shsharp=''
904 spitshell=''
905 src=''
906 ssizetype=''
907 startperl=''
908 startsh=''
909 stdchar=''
910 d_stdio_stream_array=''
911 stdio_stream_array=''
912 sysman=''
913 trnl=''
914 uidformat=''
915 uidsign=''
916 uidsize=''
917 uidtype=''
918 archname64=''
919 use64bitall=''
920 use64bitint=''
921 ccflags_uselargefiles=''
922 ldflags_uselargefiles=''
923 libswanted_uselargefiles=''
924 uselargefiles=''
925 uselongdouble=''
926 usemorebits=''
927 usemultiplicity=''
928 nm_opt=''
929 nm_so_opt=''
930 runnm=''
931 usenm=''
932 useperlio=''
933 usesocks=''
934 d_oldpthreads=''
935 use5005threads=''
936 useithreads=''
937 usethreads=''
938 incpath=''
939 mips_type=''
940 usrinc=''
941 d_vendorarch=''
942 installvendorarch=''
943 vendorarch=''
944 vendorarchexp=''
945 d_vendorbin=''
946 installvendorbin=''
947 vendorbin=''
948 vendorbinexp=''
949 d_vendorlib=''
950 installvendorlib=''
951 vendorlib=''
952 vendorlib_stem=''
953 vendorlibexp=''
954 usevendorprefix=''
955 vendorprefix=''
956 vendorprefixexp=''
957 versiononly=''
958 defvoidused=''
959 voidflags=''
960 pm_apiversion=''
961 xs_apiversion=''
962 CONFIG=''
963
964 define='define'
965 undef='undef'
966 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
967 rmlist=''
968
969 : We must find out about Eunice early
970 eunicefix=':'
971 if test -f /etc/unixtovms; then
972         eunicefix=/etc/unixtovms
973 fi
974 if test -f /etc/unixtovms.exe; then
975         eunicefix=/etc/unixtovms.exe
976 fi
977
978 i_whoami=''
979 ccname=''
980 ccversion=''
981 perllibs=''
982 : set useposix=false in your hint file to disable the POSIX extension.
983 useposix=true
984 : set useopcode=false in your hint file to disable the Opcode extension.
985 useopcode=true
986 : Trailing extension.  Override this in a hint file, if needed.
987 _exe=''
988 : Extra object files, if any, needed on this platform.
989 archobjs=''
990 archname=''
991 : Possible local include directories to search.
992 : Set locincpth to "" in a hint file to defeat local include searches.
993 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
994 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
995 :
996 : no include file wanted by default
997 inclwanted=''
998
999 groupstype=''
1000 : change the next line if compiling for Xenix/286 on Xenix/386
1001 xlibpth='/usr/lib/386 /lib/386'
1002 : Possible local library directories to search.
1003 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1004 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1005
1006 : general looking path for locating libraries
1007 glibpth="/lib /usr/lib $xlibpth"
1008 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1009 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1010 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1011
1012 : Private path used by Configure to find libraries.  Its value
1013 : is prepended to libpth. This variable takes care of special
1014 : machines, like the mips.  Usually, it should be empty.
1015 plibpth=''
1016
1017 : default library list
1018 libswanted=''
1019 : some systems want to use only the non-versioned libso:s
1020 ignore_versioned_solibs=''
1021 archname64=''
1022 ccflags_uselargefiles=''
1023 ldflags_uselargefiles=''
1024 libswanted_uselargefiles=''
1025 : set usemultiplicity on the Configure command line to enable multiplicity.
1026 : set usesocks on the Configure command line to enable socks.
1027 : set usethreads on the Configure command line to enable threads.
1028 : full support for void wanted by default
1029 defvoidused=15
1030
1031 : List of libraries we want.
1032 : If anyone needs -lnet, put it in a hint file.
1033 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1034 libswanted="$libswanted dld ld sun m c cposix posix"
1035 libswanted="$libswanted ndir dir crypt sec"
1036 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1037 : We probably want to search /usr/shlib before most other libraries.
1038 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1039 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1040 glibpth="/usr/shlib $glibpth"
1041 : Do not use vfork unless overridden by a hint file.
1042 usevfork=false
1043
1044 : Find the basic shell for Bourne shell scripts
1045 case "$sh" in
1046 '')
1047         case "$SYSTYPE" in
1048         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1049         *) xxx='/bin/sh';;
1050         esac
1051         if test -f "$xxx"; then
1052                 sh="$xxx"
1053         else
1054                 : Build up a list and do a single loop so we can 'break' out.
1055                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1056                 for xxx in sh bash ksh pdksh ash; do
1057                         for p in $pth; do
1058                                 try="$try ${p}/${xxx}"
1059                         done
1060                 done
1061                 for xxx in $try; do
1062                         if test -f "$xxx"; then
1063                                 sh="$xxx";
1064                                 break
1065                         elif test -f "$xxx.exe"; then
1066                                 sh="$xxx";
1067                                 break
1068                         fi
1069                 done
1070         fi
1071         ;;
1072 esac
1073
1074 case "$sh" in
1075 '')     cat <<EOM >&2
1076 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1077
1078 Usually it's in /bin/sh.  How did you even get this far?
1079 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1080 we'll try to straighten this all out.
1081 EOM
1082         exit 1
1083         ;;
1084 esac
1085
1086 : see if sh knows # comments
1087 if `$sh -c '#' >/dev/null 2>&1`; then
1088         shsharp=true
1089         spitshell=cat
1090         xcat=/bin/cat
1091         test -f $xcat || xcat=/usr/bin/cat
1092         echo "#!$xcat" >try
1093         $eunicefix try
1094         chmod +x try
1095         ./try > today
1096         if test -s today; then
1097                 sharpbang='#!'
1098         else
1099                 echo "#! $xcat" > try
1100                 $eunicefix try
1101                 chmod +x try
1102                 ./try > today
1103                 if test -s today; then
1104                         sharpbang='#! '
1105                 else
1106                         sharpbang=': use '
1107                 fi
1108         fi
1109 else
1110         echo " "
1111         echo "Your $sh doesn't grok # comments--I will strip them later on."
1112         shsharp=false
1113         cd ..
1114         echo "exec grep -v '^[  ]*#'" >spitshell
1115         chmod +x spitshell
1116         $eunicefix spitshell
1117         spitshell=`pwd`/spitshell
1118         cd UU
1119         echo "I presume that if # doesn't work, #! won't work either!"
1120         sharpbang=': use '
1121 fi
1122 rm -f try today
1123
1124 : figure out how to guarantee sh startup
1125 case "$startsh" in
1126 '') startsh=${sharpbang}${sh} ;;
1127 *)
1128 esac
1129 cat >try <<EOSS
1130 $startsh
1131 set abc
1132 test "$?abc" != 1
1133 EOSS
1134
1135 chmod +x try
1136 $eunicefix try
1137 if ./try; then
1138         : echo "Yup, it does."
1139 else
1140         echo "Hmm... '$startsh' does not guarantee sh startup..."
1141         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1142 fi
1143 rm -f try
1144
1145
1146 : Save command line options in file UU/cmdline.opt for later use in
1147 : generating config.sh.
1148 cat > cmdline.opt <<EOSH
1149 # Configure command line arguments.
1150 config_arg0='$0'
1151 config_args='$*'
1152 config_argc=$#
1153 EOSH
1154 argn=1
1155 for arg in "$@"; do
1156         cat >>cmdline.opt <<EOSH
1157 config_arg$argn='$arg'
1158 EOSH
1159         argn=`expr $argn + 1`
1160 done
1161
1162 : produce awk script to parse command line options
1163 cat >options.awk <<'EOF'
1164 BEGIN {
1165         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1166
1167         len = length(optstr);
1168         for (i = 1; i <= len; i++) {
1169                 c = substr(optstr, i, 1);
1170                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1171                 if (a == ":") {
1172                         arg[c] = 1;
1173                         i++;
1174                 }
1175                 opt[c] = 1;
1176         }
1177 }
1178 {
1179         expect = 0;
1180         str = $0;
1181         if (substr(str, 1, 1) != "-") {
1182                 printf("'%s'\n", str);
1183                 next;
1184         }
1185         len = length($0);
1186         for (i = 2; i <= len; i++) {
1187                 c = substr(str, i, 1);
1188                 if (!opt[c]) {
1189                         printf("-%s\n", substr(str, i));
1190                         next;
1191                 }
1192                 printf("-%s\n", c);
1193                 if (arg[c]) {
1194                         if (i < len)
1195                                 printf("'%s'\n", substr(str, i + 1));
1196                         else
1197                                 expect = 1;
1198                         next;
1199                 }
1200         }
1201 }
1202 END {
1203         if (expect)
1204                 print "?";
1205 }
1206 EOF
1207
1208 : process the command line options
1209 set X `for arg in "$@"; do echo "X$arg"; done |
1210         sed -e s/X// | awk -f options.awk`
1211 eval "set $*"
1212 shift
1213 rm -f options.awk
1214
1215 : set up default values
1216 fastread=''
1217 reuseval=false
1218 config_sh=''
1219 alldone=''
1220 error=''
1221 silent=''
1222 extractsh=''
1223 override=''
1224 knowitall=''
1225 rm -f optdef.sh posthint.sh
1226 cat >optdef.sh <<EOS
1227 $startsh
1228 EOS
1229
1230
1231 : option parsing
1232 while test $# -gt 0; do
1233         case "$1" in
1234         -d) shift; fastread=yes;;
1235         -e) shift; alldone=cont;;
1236         -f)
1237                 shift
1238                 cd ..
1239                 if test -r "$1"; then
1240                         config_sh="$1"
1241                 else
1242                         echo "$me: cannot read config file $1." >&2
1243                         error=true
1244                 fi
1245                 cd UU
1246                 shift;;
1247         -h) shift; error=true;;
1248         -r) shift; reuseval=true;;
1249         -s) shift; silent=true; realsilent=true;;
1250         -E) shift; alldone=exit;;
1251         -K) shift; knowitall=true;;
1252         -O) shift; override=true;;
1253         -S) shift; silent=true; extractsh=true;;
1254         -D)
1255                 shift
1256                 case "$1" in
1257                 *=)
1258                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1259                         echo "$me: ignoring -D $1" >&2
1260                         ;;
1261                 *=*) echo "$1" | \
1262                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1263                 *) echo "$1='define'" >> optdef.sh;;
1264                 esac
1265                 shift
1266                 ;;
1267         -U)
1268                 shift
1269                 case "$1" in
1270                 *=) echo "$1" >> optdef.sh;;
1271                 *=*)
1272                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1273                         echo "$me: ignoring -U $1" >&2
1274                         ;;
1275                 *) echo "$1='undef'" >> optdef.sh;;
1276                 esac
1277                 shift
1278                 ;;
1279         -A)
1280             shift
1281             xxx=''
1282             yyy="$1"
1283             zzz=''
1284             uuu=undef
1285             case "$yyy" in
1286             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1287                  case "$zzz" in
1288                  *:*) zzz='' ;;
1289                  *)   xxx=append
1290                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1291                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1292                  esac
1293                  ;;
1294             esac
1295             case "$xxx" in
1296             '')  case "$yyy" in
1297                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1298                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1299                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1300                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1301                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1302                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1303                  esac
1304                  ;;       
1305             esac
1306             case "$xxx" in
1307             append)
1308                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1309             clear)
1310                 echo "$yyy=''"                  >> posthint.sh ;;
1311             define)
1312                 case "$zzz" in
1313                 '') zzz=define ;;
1314                 esac
1315                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1316             eval)
1317                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1318             prepend)
1319                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1320             undef)
1321                 case "$zzz" in
1322                 '') zzz="$uuu" ;;
1323                 esac
1324                 echo "$yyy=$zzz"                >> posthint.sh ;;
1325             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1326             esac
1327             shift
1328             ;;
1329         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1330             exit 0;;
1331         --) break;;
1332         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1333         *) break;;
1334         esac
1335 done
1336
1337 case "$error" in
1338 true)
1339         cat >&2 <<EOM
1340 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1341                  [-U symbol] [-U symbol=] [-A command:symbol...]
1342   -d : use defaults for all answers.
1343   -e : go on without questioning past the production of config.sh.
1344   -f : specify an alternate default configuration file.
1345   -h : print this help message and exit (with an error status).
1346   -r : reuse C symbols value if possible (skips costly nm extraction).
1347   -s : silent mode, only echoes questions and essential information.
1348   -D : define symbol to have some value:
1349          -D symbol         symbol gets the value 'define'
1350          -D symbol=value   symbol gets the value 'value'
1351   -E : stop at the end of questions, after having produced config.sh.
1352   -K : do not use unless you know what you are doing.
1353   -O : let -D and -U override definitions from loaded configuration file.
1354   -S : perform variable substitutions on all .SH files (can mix with -f)
1355   -U : undefine symbol:
1356          -U symbol    symbol gets the value 'undef'
1357          -U symbol=   symbol gets completely empty
1358   -A : manipulate symbol after the platform specific hints have been applied:
1359          -A symbol=value                append " "value to symbol
1360          -A append:symbol=value         append value to symbol
1361          -A define:symbol=value         define symbol to have value
1362          -A clear:symbol                define symbol to be ''
1363          -A define:symbol               define symbol to be 'define'
1364          -A eval:symbol=value           define symbol to be eval of value
1365          -A prepend:symbol=value        prepend value to symbol
1366          -A undef:symbol                define symbol to be 'undef'
1367          -A undef:symbol=               define symbol to be ''
1368   -V : print version number and exit (with a zero status).
1369 EOM
1370         exit 1
1371         ;;
1372 esac
1373
1374 : Sanity checks
1375 case "$fastread$alldone" in
1376 yescont|yesexit) ;;
1377 *)
1378         case "$extractsh" in
1379         true) ;;
1380         *)
1381                 if test ! -t 0; then
1382                         echo "Say 'sh Configure', not 'sh <Configure'"
1383                         exit 1
1384                 fi
1385                 ;;
1386         esac
1387         ;;
1388 esac
1389
1390 exec 4>&1
1391 case "$silent" in
1392 true) exec 1>/dev/null;;
1393 esac
1394
1395 : run the defines and the undefines, if any, but leave the file out there...
1396 touch optdef.sh
1397 . ./optdef.sh
1398 : create the posthint manipulation script and leave the file out there...
1399 touch posthint.sh
1400
1401 : set package name
1402 package=perl5
1403 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1404 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1405 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1406 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1407 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1408 esac
1409
1410 : Some greps do not return status, grrr.
1411 echo "grimblepritz" >grimble
1412 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1413         contains=contains
1414 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1415         contains=grep
1416 else
1417         contains=contains
1418 fi
1419 rm -f grimble
1420 : the following should work in any shell
1421 case "$contains" in
1422 contains*)
1423         echo " "
1424         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1425         cat >contains <<'EOSS'
1426 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1427 EOSS
1428 chmod +x contains
1429 esac
1430
1431 : Find the path to the source tree
1432 case "$src" in
1433 '') case "$0" in
1434     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1435          case "$src" in
1436          /*)    ;;
1437          *)     src=`cd ../$src && pwd` ;;
1438          esac
1439          ;;
1440     *)   src='.';;
1441     esac;;
1442 esac
1443 case "$src" in
1444 '')     src=/
1445         rsrc=/
1446         ;;
1447 /*) rsrc="$src";;
1448 *) rsrc="../$src";;
1449 esac
1450 if test -f $rsrc/Configure && \
1451         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1452 then
1453    : found it, so we are ok.
1454 else
1455         rsrc=''
1456         for src in . .. ../.. ../../.. ../../../..; do
1457                 if test -f ../$src/Configure && \
1458                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1459                 then
1460                         rsrc=../$src
1461                         break
1462                 fi
1463         done
1464 fi
1465 case "$rsrc" in
1466 '')
1467         cat <<EOM >&4
1468
1469 Sorry, I can't seem to locate the source dir for $package.  Please start
1470 Configure with an explicit path -- i.e. /some/path/Configure.
1471
1472 EOM
1473         exit 1
1474         ;;
1475 ../.)   rsrc='..';;
1476 *)
1477         echo " "
1478         echo "Sources for $package found in \"$src\"." >&4
1479         ;;
1480 esac
1481
1482 : script used to extract .SH files with variable substitutions
1483 cat >extract <<'EOS'
1484 CONFIGDOTSH=true
1485 echo "Doing variable substitutions on .SH files..."
1486 if test -f $src/MANIFEST; then
1487         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1488 else
1489         echo "(Looking for .SH files under the source directory.)"
1490         set x `(cd $src; find . -name "*.SH" -print)`
1491 fi
1492 shift
1493 case $# in
1494 0) set x `(cd $src; echo *.SH)`; shift;;
1495 esac
1496 if test ! -f $src/$1; then
1497         shift
1498 fi
1499 mkdir_p='
1500 name=$1;
1501 create="";
1502 while test $name; do
1503         if test ! -d "$name"; then
1504                 create="$name $create";
1505                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1506                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1507         else
1508                 name="";
1509         fi;
1510 done;
1511 for file in $create; do
1512         mkdir $file;
1513 done
1514 '
1515 for file in $*; do
1516         case "$src" in
1517         ".")
1518                 case "$file" in
1519                 */*)
1520                         dir=`expr X$file : 'X\(.*\)/'`
1521                         file=`expr X$file : 'X.*/\(.*\)'`
1522                         (cd $dir && . ./$file)
1523                         ;;
1524                 *)
1525                         . ./$file
1526                         ;;
1527                 esac
1528                 ;;
1529         *)
1530                 case "$file" in
1531                 */*)
1532                         dir=`expr X$file : 'X\(.*\)/'`
1533                         file=`expr X$file : 'X.*/\(.*\)'`
1534                         (set x $dir; shift; eval $mkdir_p)
1535                         sh <$src/$dir/$file
1536                         ;;
1537                 *)
1538                         sh <$src/$file
1539                         ;;
1540                 esac
1541                 ;;
1542         esac
1543 done
1544 if test -f $src/config_h.SH; then
1545         if test ! -f config.h; then
1546         : oops, they left it out of MANIFEST, probably, so do it anyway.
1547         . $src/config_h.SH
1548         fi
1549 fi
1550 EOS
1551
1552 : extract files and exit if asked to do so
1553 case "$extractsh" in
1554 true)
1555         case "$realsilent" in
1556         true) ;;
1557         *) exec 1>&4;;
1558         esac
1559         case "$config_sh" in
1560         '') config_sh='config.sh';;
1561         esac
1562         echo " "
1563         echo "Fetching answers from $config_sh..."
1564         cd ..
1565         . $config_sh
1566         test "$override" && . ./optdef.sh
1567         echo " "
1568         . UU/extract
1569         rm -rf UU
1570         echo "Done."
1571         exit 0
1572         ;;
1573 esac
1574
1575 : Eunice requires " " instead of "", can you believe it
1576 echo " "
1577 : Here we go...
1578 echo "Beginning of configuration questions for $package."
1579
1580 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1581
1582 : first determine how to suppress newline on echo command
1583 echo " "
1584 echo "Checking echo to see how to suppress newlines..."
1585 (echo "hi there\c" ; echo " ") >.echotmp
1586 if $contains c .echotmp >/dev/null 2>&1 ; then
1587         echo "...using -n."
1588         n='-n'
1589         c=''
1590 else
1591         cat <<'EOM'
1592 ...using \c
1593 EOM
1594         n=''
1595         c='\c'
1596 fi
1597 echo $n "The star should be here-->$c"
1598 echo '*'
1599 rm -f .echotmp
1600
1601 : Now test for existence of everything in MANIFEST
1602 echo " "
1603 if test -f $rsrc/MANIFEST; then
1604         echo "First let's make sure your kit is complete.  Checking..." >&4
1605         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1606         rm -f missing
1607         tmppwd=`pwd`
1608         for filelist in x??; do
1609                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1610         done
1611         if test -s missing; then
1612                 cat missing >&4
1613                 cat >&4 <<'EOM'
1614
1615 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1616
1617 You have the option of continuing the configuration process, despite the
1618 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1619 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1620 and contact the author (perlbug@perl.org).
1621
1622 EOM
1623                 echo $n "Continue? [n] $c" >&4
1624                 read ans
1625                 case "$ans" in
1626                 y*)
1627                         echo "Continuing..." >&4
1628                         rm -f missing
1629                         ;;
1630                 *)
1631                         echo "ABORTING..." >&4
1632                         kill $$
1633                         ;;
1634                 esac
1635         else
1636                 echo "Looks good..."
1637         fi
1638 else
1639         echo "There is no MANIFEST file.  I hope your kit is complete !"
1640 fi
1641 rm -f missing x??
1642
1643 echo " "
1644 : Find the appropriate value for a newline for tr
1645 if test -n "$DJGPP"; then
1646        trnl='\012'
1647 fi
1648 if test X"$trnl" = X; then
1649         case "`echo foo|tr '\n' x 2>/dev/null`" in
1650         foox) trnl='\n' ;;
1651         esac
1652 fi
1653 if test X"$trnl" = X; then
1654         case "`echo foo|tr '\012' x 2>/dev/null`" in
1655         foox) trnl='\012' ;;
1656         esac
1657 fi
1658 if test X"$trnl" = X; then
1659         cat <<EOM >&2
1660
1661 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1662
1663 EOM
1664         exit 1
1665 fi
1666
1667 : compute the number of columns on the terminal for proper question formatting
1668 case "$COLUMNS" in
1669 '') COLUMNS='80';;
1670 esac
1671
1672 : set up the echo used in my read
1673 myecho="case \"\$xxxm\" in
1674 '') echo $n \"\$rp $c\" >&4;;
1675 *) case \"\$rp\" in
1676         '') echo $n \"[\$xxxm] $c\";;
1677         *)
1678                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1679                         echo \"\$rp\" >&4
1680                         echo $n \"[\$xxxm] $c\" >&4
1681                 else
1682                         echo $n \"\$rp [\$xxxm] $c\" >&4
1683                 fi
1684                 ;;
1685         esac;;
1686 esac"
1687
1688 : now set up to do reads with possible shell escape and default assignment
1689 cat <<EOSC >myread
1690 $startsh
1691 xxxm=\$dflt
1692 $myecho
1693 ans='!'
1694 case "\$fastread" in
1695 yes) case "\$dflt" in
1696         '') ;;
1697         *) ans='';
1698                 case "\$silent-\$rp" in
1699                 true-) ;;
1700                 *) echo " " >&4;;
1701                 esac;;
1702         esac;;
1703 *) case "\$silent" in
1704         true) case "\$rp" in
1705                 '') ans='';;
1706                 esac;;
1707         esac;;
1708 esac
1709 while expr "X\$ans" : "X!" >/dev/null; do
1710         read answ
1711         set x \$xxxm
1712         shift
1713         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1714         case  "\$answ" in
1715         "!")
1716                 sh 1>&4
1717                 echo " "
1718                 $myecho
1719                 ;;
1720         !*)
1721                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1722                 shift
1723                 sh 1>&4 -c "\$*"
1724                 echo " "
1725                 $myecho
1726                 ;;
1727         "\$ans")
1728                 case "\$ans" in
1729                 \\&*)
1730                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1731                         shift
1732                         case "\$1" in
1733                         -d)
1734                                 fastread=yes
1735                                 echo "(OK, I'll run with -d after this question.)" >&4
1736                                 ;;
1737                         -*)
1738                                 echo "*** Sorry, \$1 not supported yet." >&4
1739                                 ;;
1740                         esac
1741                         $myecho
1742                         ans=!
1743                         ;;
1744                 esac;;
1745         *)
1746                 case "\$aok" in
1747                 y)
1748                         echo "*** Substitution done -- please confirm."
1749                         xxxm="\$ans"
1750                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1751                         xxxm="\$ans"
1752                         ans=!
1753                         ;;
1754                 *)
1755                         echo "*** Error -- try again."
1756                         ans=!
1757                         ;;
1758                 esac
1759                 $myecho
1760                 ;;
1761         esac
1762         case "\$ans\$xxxm\$nostick" in
1763         '')
1764                 ans=!
1765                 $myecho
1766                 ;;
1767         esac
1768 done
1769 case "\$ans" in
1770 '') ans="\$xxxm";;
1771 esac
1772 EOSC
1773
1774 : create .config dir to save info across Configure sessions
1775 test -d ../.config || mkdir ../.config
1776 cat >../.config/README <<EOF
1777 This directory created by Configure to save information that should
1778 persist across sessions for $package.
1779
1780 You may safely delete it if you wish.
1781 EOF
1782
1783 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1784 case "$usedevel" in
1785 $define|true|[yY]*) ;;
1786 *) case "$xversion" in
1787    *[13579])
1788         cat >&4 <<EOH
1789 *** WHOA THERE!!! ***
1790
1791     This is an UNSTABLE DEVELOPMENT release.
1792     The version of this $package distribution is $xversion, that is, odd,
1793     (as opposed to even) and that signifies a development release.
1794     If you want a maintenance release, you want an even-numbered version.
1795
1796     Do ***NOT*** install this into production use.
1797     Data corruption and crashes are possible.
1798
1799     It is most seriously suggested that you do not continue any further
1800     unless you want to help in developing and debugging Perl.
1801
1802 EOH
1803         rp='Do you really want to continue?'
1804         dflt='n'
1805         . ./myread
1806         case "$ans" in
1807         [yY]) echo >&4 "Okay, continuing." ;;
1808         *) echo >&4 "Okay, bye."
1809            exit 1
1810            ;;
1811         esac
1812         ;;
1813     esac
1814     ;;
1815 esac
1816
1817 : general instructions
1818 needman=true
1819 firsttime=true
1820 user=`(logname) 2>/dev/null`
1821 case "$user" in
1822 '') user=`whoami 2>&1`;;
1823 esac
1824 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1825         firsttime=false
1826         echo " "
1827         rp='Would you like to see the instructions?'
1828         dflt=n
1829         . ./myread
1830         case "$ans" in
1831         [yY]*) ;;
1832         *) needman=false;;
1833         esac
1834 fi
1835 if $needman; then
1836         cat <<EOH
1837
1838 This installation shell script will examine your system and ask you questions
1839 to determine how the perl5 package should be installed. If you get
1840 stuck on a question, you may use a ! shell escape to start a subshell or
1841 execute a command.  Many of the questions will have default answers in square
1842 brackets; typing carriage return will give you the default.
1843
1844 On some of the questions which ask for file or directory names you are allowed
1845 to use the ~name construct to specify the login directory belonging to "name",
1846 even if you don't have a shell which knows about that.  Questions where this is
1847 allowed will be marked "(~name ok)".
1848
1849 EOH
1850         rp=''
1851         dflt='Type carriage return to continue'
1852         . ./myread
1853         cat <<'EOH'
1854
1855 The prompter used in this script allows you to use shell variables and
1856 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1857 in the default answer, as if the default line was a set of arguments given to a
1858 script shell.  This means you may also use $* to repeat the whole default line,
1859 so you do not have to re-type everything to add something to the default.
1860
1861 Everytime there is a substitution, you will have to confirm.  If there is an
1862 error (e.g. an unmatched backtick), the default answer will remain unchanged
1863 and you will be prompted again.
1864
1865 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1866 the questions and use the computed defaults (or the previous answers if there
1867 was already a config.sh file). Type 'Configure -h' for a list of options.
1868 You may also start interactively and then answer '& -d' at any prompt to turn
1869 on the non-interactive behaviour for the remainder of the execution.
1870
1871 EOH
1872         . ./myread
1873         cat <<EOH
1874
1875 Much effort has been expended to ensure that this shell script will run on any
1876 Unix system.  If despite that it blows up on yours, your best bet is to edit
1877 Configure and run it again.  If you can't run Configure for some reason,
1878 you'll have to generate a config.sh file by hand.  Whatever problems you
1879 have, let me (perlbug@perl.org) know how I blew it.
1880
1881 This installation script affects things in two ways:
1882
1883 1) it may do direct variable substitutions on some of the files included
1884    in this kit.
1885 2) it builds a config.h file for inclusion in C programs.  You may edit
1886    any of these files as the need arises after running this script.
1887
1888 If you make a mistake on a question, there is no easy way to back up to it
1889 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1890 files.  Configure will offer to let you do this before it runs the SH files.
1891
1892 EOH
1893         dflt='Type carriage return to continue'
1894         . ./myread
1895         case "$firsttime" in
1896         true) echo $user >>../.config/instruct;;
1897         esac
1898 fi
1899
1900 : find out where common programs are
1901 echo " "
1902 echo "Locating common programs..." >&4
1903 cat <<EOSC >loc
1904 $startsh
1905 case \$# in
1906 0) exit 1;;
1907 esac
1908 thing=\$1
1909 shift
1910 dflt=\$1
1911 shift
1912 for dir in \$*; do
1913         case "\$thing" in
1914         .)
1915         if test -d \$dir/\$thing; then
1916                 echo \$dir
1917                 exit 0
1918         fi
1919         ;;
1920         *)
1921         for thisthing in \$dir/\$thing; do
1922                 : just loop through to pick last item
1923         done
1924         if test -f \$thisthing; then
1925                 echo \$thisthing
1926                 exit 0
1927         elif test -f \$dir/\$thing.exe; then
1928                 if test -n "$DJGPP"; then
1929                         echo \$dir/\$thing.exe
1930                 else
1931                         : on Eunice apparently
1932                         echo \$dir/\$thing
1933                 fi
1934                 exit 0
1935         fi
1936         ;;
1937         esac
1938 done
1939 echo \$dflt
1940 exit 1
1941 EOSC
1942 chmod +x loc
1943 $eunicefix loc
1944 loclist="
1945 awk
1946 cat
1947 comm
1948 cp
1949 echo
1950 expr
1951 grep
1952 ls
1953 make
1954 mkdir
1955 rm
1956 sed
1957 sort
1958 touch
1959 tr
1960 uniq
1961 "
1962 trylist="
1963 Mcc
1964 ar
1965 byacc
1966 cpp
1967 csh
1968 date
1969 egrep
1970 gzip
1971 less
1972 ln
1973 more
1974 nm
1975 nroff
1976 pg
1977 test
1978 uname
1979 zip
1980 "
1981 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1982 pth="$pth /lib /usr/lib"
1983 for file in $loclist; do
1984         eval xxx=\$$file
1985         case "$xxx" in
1986         /*|?:[\\/]*)
1987                 if test -f "$xxx"; then
1988                         : ok
1989                 else
1990                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1991                         xxx=`./loc $file $file $pth`
1992                 fi
1993                 ;;
1994         '') xxx=`./loc $file $file $pth`;;
1995         *) xxx=`./loc $xxx $xxx $pth`;;
1996         esac
1997         eval $file=$xxx
1998         eval _$file=$xxx
1999         case "$xxx" in
2000         /*)
2001                 echo $file is in $xxx.
2002                 ;;
2003         ?:[\\/]*)
2004                 echo $file is in $xxx.
2005                 ;;
2006         *)
2007                 echo "I don't know where '$file' is, and my life depends on it." >&4
2008                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2009                 exit 1
2010                 ;;
2011         esac
2012 done
2013 echo " "
2014 echo "Don't worry if any of the following aren't found..."
2015 say=offhand
2016 for file in $trylist; do
2017         eval xxx=\$$file
2018         case "$xxx" in
2019         /*|?:[\\/]*)
2020                 if test -f "$xxx"; then
2021                         : ok
2022                 else
2023                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2024                         xxx=`./loc $file $file $pth`
2025                 fi
2026                 ;;
2027         '') xxx=`./loc $file $file $pth`;;
2028         *) xxx=`./loc $xxx $xxx $pth`;;
2029         esac
2030         eval $file=$xxx
2031         eval _$file=$xxx
2032         case "$xxx" in
2033         /*)
2034                 echo $file is in $xxx.
2035                 ;;
2036         ?:[\\/]*)
2037                 echo $file is in $xxx.
2038                 ;;
2039         *)
2040                 echo "I don't see $file out there, $say."
2041                 say=either
2042                 ;;
2043         esac
2044 done
2045 case "$egrep" in
2046 egrep)
2047         echo "Substituting grep for egrep."
2048         egrep=$grep
2049         ;;
2050 esac
2051 case "$ln" in
2052 ln)
2053         echo "Substituting cp for ln."
2054         ln=$cp
2055         ;;
2056 esac
2057 case "$test" in
2058 test)
2059         echo "Hopefully test is built into your sh."
2060         ;;
2061 *)
2062         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2063                 echo "Using the test built into your sh."
2064                 test=test
2065                 _test=test
2066         fi
2067         ;;
2068 esac
2069 case "$echo" in
2070 echo)
2071         echo "Hopefully echo is built into your sh."
2072         ;;
2073 '') ;;
2074 *)
2075         echo " "
2076 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2077         $echo $n "hi there$c" >foo1
2078         echo $n "hi there$c" >foo2
2079         if cmp foo1 foo2 >/dev/null 2>&1; then
2080                 echo "They are compatible.  In fact, they may be identical."
2081         else
2082                 case "$n" in
2083                 '-n') n='' c='\c';;
2084                 *) n='-n' c='';;
2085                 esac
2086                 cat <<FOO
2087 They are not compatible!  You are probably running ksh on a non-USG system.
2088 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2089 have echo built in and we may have to run some Bourne shell scripts.  That
2090 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2091
2092 FOO
2093                 $echo $n "The star should be here-->$c"
2094                 $echo "*"
2095         fi
2096         $rm -f foo1 foo2
2097         ;;
2098 esac
2099
2100 cat <<EOS >checkcc
2101 $startsh
2102 EOS
2103 cat <<'EOSC' >>checkcc
2104 case "$cc" in
2105 '') ;;
2106 *)  $rm -f try try.*
2107     $cat >try.c <<EOM
2108 int main(int argc, char *argv[]) {
2109   return 0;
2110 }
2111 EOM
2112     if $cc -o try $ccflags try.c; then
2113        :
2114     else
2115         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2116         despair=yes
2117         trygcc=yes
2118         case "$cc" in
2119         *gcc*) trygcc=no ;;
2120         esac
2121         case "`$cc -v -c try.c 2>&1`" in
2122         *gcc*) trygcc=no ;;
2123         esac
2124         if $test X"$trygcc" = Xyes; then
2125             if gcc -o try -c try.c; then
2126                 echo " "
2127                 echo "You seem to have a working gcc, though." >&4
2128                 rp="Would you like to use it?"
2129                 dflt=y
2130                 if $test -f myread; then
2131                     . ./myread
2132                 else
2133                     if $test -f UU/myread; then
2134                         . ./UU/myread
2135                     else
2136                         echo "Cannot find myread, sorry.  Aborting." >&2
2137                         exit 1
2138                     fi
2139                 fi  
2140                 case "$ans" in
2141                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2142                 esac
2143             fi
2144         fi
2145         if $test X"$despair" = Xyes; then
2146             $cat >&4 <<EOM
2147 You need to find a working C compiler.
2148 Either (purchase and) install the C compiler supplied by your OS vendor,
2149 or for a free C compiler try http://gcc.gnu.org/
2150 I cannot continue any further, aborting.
2151 EOM
2152             exit 1
2153         fi
2154     fi
2155     $rm -f try try.*
2156     ;;
2157 esac
2158 EOSC
2159
2160 : determine whether symbolic links are supported
2161 echo " "
2162 $touch blurfl
2163 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2164         echo "Symbolic links are supported." >&4
2165         lns="$ln -s"
2166 else
2167         echo "Symbolic links are NOT supported." >&4
2168         lns="$ln"
2169 fi
2170 $rm -f blurfl sym
2171
2172 : determine whether symbolic links are supported
2173 echo " "
2174 case "$lns" in
2175 *"ln -s")
2176         echo "Checking how to test for symbolic links..." >&4
2177         $lns blurfl sym
2178         if $test "X$issymlink" = X; then
2179                 if $test -h sym 2>/dev/null; then
2180                         issymlink=-h
2181                 fi
2182         fi
2183         if $test "X$issymlink" = X; then
2184                 if $test -L sym 2>/dev/null; then
2185                         issymlink=-L
2186                 fi
2187         fi
2188         if $test "X$issymlink" != X; then
2189                 echo "You can test for symbolic links with $issymlink." >&4
2190         else
2191                 echo "I do not know how you can test for symbolic links." >&4
2192         fi
2193         $rm -f blurfl sym
2194         ;;
2195 *)      echo "No symbolic links, so not testing for their testing..." >&4
2196         ;;
2197 esac
2198 echo " "
2199
2200
2201 case "$mksymlinks" in
2202 $define|true|[yY]*)
2203         case "$src" in
2204         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2205                 exit 1
2206                 ;;
2207         *)      case "$lns:$issymlink" in
2208                 *"ln -s:-"?)
2209                         echo "Creating the symbolic links..." >&4
2210                         echo "(First creating the subdirectories...)" >&4
2211                         cd ..
2212                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2213                                 read directory
2214                                 test -z "$directory" && break
2215                                 mkdir -p $directory
2216                         done
2217                         # Sanity check 1.
2218                         if test ! -d t/base; then
2219                                 echo "Failed to create the subdirectories.  Aborting." >&4
2220                                 exit 1
2221                         fi
2222                         echo "(Then creating the symlinks...)" >&4
2223                         awk '{print $1}' $src/MANIFEST | while true; do
2224                                 read filename
2225                                 test -z "$filename" && break
2226                                 if test -f $filename; then
2227                                         if test $issymlink $filename; then
2228                                                 rm -f $filename
2229                                         fi
2230                                 fi
2231                                 if test -f $filename; then
2232                                         echo "$filename already exists, not symlinking."
2233                                 else
2234                                         ln -s $src/$filename $filename
2235                                 fi
2236                         done
2237                         # Sanity check 2.
2238                         if test ! -f t/base/commonsense.t; then
2239                                 echo "Failed to create the symlinks.  Aborting." >&4
2240                                 exit 1
2241                         fi
2242                         cd UU
2243                         ;;
2244                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2245                         ;;
2246                 esac
2247                 ;;
2248         esac
2249         ;;
2250 esac
2251
2252 : see whether [:lower:] and [:upper:] are supported character classes
2253 echo " "
2254 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2255 ABYZ)
2256         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2257         up='[:upper:]'
2258         low='[:lower:]'
2259         ;;
2260 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2261         # (0xc9 and 0xd1), therefore that is a nice testing point.
2262         if test "X$up" = X -o "X$low" = X; then
2263             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2264             ij) up='[A-Z]'
2265                 low='[a-z]'
2266                 ;;
2267             esac
2268         fi
2269         if test "X$up" = X -o "X$low" = X; then
2270             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2271             ij) up='A-Z'
2272                 low='a-z'
2273                 ;;
2274             esac
2275         fi
2276         if test "X$up" = X -o "X$low" = X; then
2277             case "`echo IJ | od -x 2>/dev/null`" in
2278             *C9D1*|*c9d1*)
2279                 echo "Hey, this might be EBCDIC." >&4
2280                 if test "X$up" = X -o "X$low" = X; then
2281                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2282                     ij) up='[A-IJ-RS-Z]'
2283                         low='[a-ij-rs-z]'
2284                         ;;
2285                     esac
2286                 fi
2287                 if test "X$up" = X -o "X$low" = X; then
2288                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2289                     ij) up='A-IJ-RS-Z'
2290                         low='a-ij-rs-z'
2291                         ;;
2292                     esac
2293                 fi
2294                 ;;
2295             esac
2296         fi
2297 esac
2298 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2299 ij)
2300     echo "Using $up and $low to convert case." >&4
2301     ;;
2302 *)
2303     echo "I don't know how to translate letters from upper to lower case." >&4
2304     echo "Your tr is not acting any way I know of." >&4
2305     exit 1
2306     ;;
2307 esac
2308 : set up the translation script tr, must be called with ./tr of course
2309 cat >tr <<EOSC
2310 $startsh
2311 case "\$1\$2" in
2312 '[A-Z][a-z]') exec $tr '$up' '$low';;
2313 '[a-z][A-Z]') exec $tr '$low' '$up';;
2314 esac
2315 exec $tr "\$@"
2316 EOSC
2317 chmod +x tr
2318 $eunicefix tr
2319
2320 : Try to determine whether config.sh was made on this system
2321 case "$config_sh" in
2322 '')
2323 myuname=`$uname -a 2>/dev/null`
2324 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2325 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2326 # because the A-Z/a-z are not consecutive.
2327 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2328         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2329 newmyuname="$myuname"
2330 dflt=n
2331 case "$knowitall" in
2332 '')
2333         if test -f ../config.sh; then
2334                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2335                         eval "`grep myuname= ../config.sh`"
2336                 fi
2337                 if test "X$myuname" = "X$newmyuname"; then
2338                         dflt=y
2339                 fi
2340         fi
2341         ;;
2342 *) dflt=y;;
2343 esac
2344
2345 : Get old answers from old config file if Configure was run on the
2346 : same system, otherwise use the hints.
2347 hint=default
2348 cd ..
2349 if test -f config.sh; then
2350         echo " "
2351         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2352         . UU/myread
2353         case "$ans" in
2354         n*|N*) echo "OK, I'll ignore it."
2355                 mv config.sh config.sh.old
2356                 myuname="$newmyuname"
2357                 ;;
2358         *)  echo "Fetching default answers from your old config.sh file..." >&4
2359                 tmp_n="$n"
2360                 tmp_c="$c"
2361                 tmp_sh="$sh"
2362                 . ./config.sh
2363                 cp config.sh UU
2364                 n="$tmp_n"
2365                 c="$tmp_c"
2366                 : Older versions did not always set $sh.  Catch re-use of such
2367                 : an old config.sh.
2368                 case "$sh" in
2369                 '') sh="$tmp_sh" ;;
2370                 esac
2371                 hint=previous
2372                 ;;
2373         esac
2374 fi
2375 . ./UU/checkcc
2376 if test ! -f config.sh; then
2377         $cat <<EOM
2378
2379 First time through, eh?  I have some defaults handy for some systems
2380 that need some extra help getting the Configure answers right:
2381
2382 EOM
2383         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2384         dflt=''
2385         : Half the following guesses are probably wrong... If you have better
2386         : tests or hints, please send them to perlbug@perl.org
2387         : The metaconfig authors would also appreciate a copy...
2388         $test -f /irix && osname=irix
2389         $test -f /xenix && osname=sco_xenix
2390         $test -f /dynix && osname=dynix
2391         $test -f /dnix && osname=dnix
2392         $test -f /lynx.os && osname=lynxos
2393         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2394         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2395         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2396         $test -f /bin/mips && /bin/mips && osname=mips
2397         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2398                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2399         $test -d /usr/apollo/bin && osname=apollo
2400         $test -f /etc/saf/_sactab && osname=svr4
2401         $test -d /usr/include/minix && osname=minix
2402         if $test -d /MachTen -o -d /MachTen_Folder; then
2403                 osname=machten
2404                 if $test -x /sbin/version; then
2405                         osvers=`/sbin/version | $awk '{print $2}' |
2406                         $sed -e 's/[A-Za-z]$//'`
2407                 elif $test -x /usr/etc/version; then
2408                         osvers=`/usr/etc/version | $awk '{print $2}' |
2409                         $sed -e 's/[A-Za-z]$//'`
2410                 else
2411                         osvers="$2.$3"
2412                 fi
2413         fi
2414
2415         $test -f /sys/posix.dll &&
2416                 $test -f /usr/bin/what &&
2417                 set X `/usr/bin/what /sys/posix.dll` &&
2418                 $test "$3" = UWIN &&
2419                 osname=uwin &&
2420                 osvers="$5"
2421
2422         if $test -f $uname; then
2423                 set X $myuname
2424                 shift
2425
2426                 case "$5" in
2427                 fps*) osname=fps ;;
2428                 mips*)
2429                         case "$4" in
2430                         umips) osname=umips ;;
2431                         *) osname=mips ;;
2432                         esac;;
2433                 [23]100) osname=mips ;;
2434                 next*) osname=next ;;
2435                 i386*)
2436                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2437                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2438                                 osname='sco'
2439                                 osvers=$tmp
2440                         elif $test -f /etc/kconfig; then
2441                                 osname=isc
2442                                 if test "$lns" = "$ln -s"; then
2443                                         osvers=4
2444                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2445                                         osvers=3
2446                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2447                                         osvers=2
2448                                 fi
2449                         fi
2450                         tmp=''
2451                         ;;
2452                 pc*)
2453                         if test -n "$DJGPP"; then
2454                                 osname=dos
2455                                 osvers=djgpp
2456                         fi
2457                         ;;
2458                 esac
2459
2460                 case "$1" in
2461                 aix) osname=aix
2462                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2463                         case "$tmp" in
2464                         'not found') osvers="$4"."$3" ;;
2465                         '<3240'|'<>3240') osvers=3.2.0 ;;
2466                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2467                         '=3250'|'>3250') osvers=3.2.5 ;;
2468                         *) osvers=$tmp;;
2469                         esac
2470                         ;;
2471                 bsd386) osname=bsd386
2472                         osvers=`$uname -r`
2473                         ;;
2474                 cygwin*) osname=cygwin
2475                         osvers="$3"
2476                         ;;
2477                 *dc.osx) osname=dcosx
2478                         osvers="$3"
2479                         ;;
2480                 dnix) osname=dnix
2481                         osvers="$3"
2482                         ;;
2483                 domainos) osname=apollo
2484                         osvers="$3"
2485                         ;;
2486                 dgux) osname=dgux 
2487                         osvers="$3"
2488                         ;;
2489                 dynixptx*) osname=dynixptx
2490                         osvers=`echo "$4"|sed 's/^v//'`
2491                         ;;
2492                 freebsd) osname=freebsd 
2493                         osvers="$3" ;;
2494                 genix) osname=genix ;;
2495                 hp*) osname=hpux 
2496                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2497                         ;;
2498                 irix*) osname=irix
2499                         case "$3" in
2500                         4*) osvers=4 ;;
2501                         5*) osvers=5 ;;
2502                         *)      osvers="$3" ;;
2503                         esac
2504                         ;;
2505                 linux) osname=linux
2506                         case "$3" in
2507                         *)      osvers="$3" ;;
2508                         esac
2509                         ;;
2510                 MiNT) osname=mint
2511                         ;;
2512                 netbsd*) osname=netbsd
2513                         osvers="$3"
2514                         ;;
2515                 news-os) osvers="$3"
2516                         case "$3" in
2517                         4*) osname=newsos4 ;;
2518                         *) osname=newsos ;;
2519                         esac
2520                         ;;
2521                 next*) osname=next ;;
2522                 nonstop-ux) osname=nonstopux ;;
2523                 POSIX-BC | posix-bc ) osname=posix-bc
2524                         osvers="$3"
2525                         ;;
2526                 powerux | power_ux | powermax_os | powermaxos | \
2527                 powerunix | power_unix) osname=powerux
2528                         osvers="$3"
2529                         ;;
2530                 qnx) osname=qnx
2531                         osvers="$4"
2532                         ;;
2533                 solaris) osname=solaris
2534                         case "$3" in
2535                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2536                         *)      osvers="$3" ;;
2537                         esac
2538                         ;;
2539                 sunos) osname=sunos
2540                         case "$3" in
2541                         5*) osname=solaris
2542                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2543                         *)      osvers="$3" ;;
2544                         esac
2545                         ;;
2546                 titanos) osname=titanos
2547                         case "$3" in
2548                         1*) osvers=1 ;;
2549                         2*) osvers=2 ;;
2550                         3*) osvers=3 ;;
2551                         4*) osvers=4 ;;
2552                         *)      osvers="$3" ;;
2553                         esac
2554                         ;;
2555                 ultrix) osname=ultrix
2556                         osvers="$3"
2557                         ;;
2558                 osf1|mls+)      case "$5" in
2559                                 alpha)
2560                                         osname=dec_osf
2561                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2562                                         case "$osvers" in
2563                                         [1-9].[0-9]*) ;;
2564                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2565                                         esac
2566                                         ;;
2567                         hp*)    osname=hp_osf1  ;;
2568                         mips)   osname=mips_osf1 ;;
2569                         esac
2570                         ;;
2571                 unixware) osname=svr5
2572                         osvers="$4"
2573                         ;;
2574                 uts) osname=uts
2575                         osvers="$3"
2576                         ;;
2577                 $2) case "$osname" in
2578                         *isc*) ;;
2579                         *freebsd*) ;;
2580                         svr*)
2581                                 : svr4.x or possibly later
2582                                 case "svr$3" in 
2583                                 ${osname}*)
2584                                         osname=svr$3
2585                                         osvers=$4
2586                                         ;;
2587                                 esac
2588                                 case "$osname" in
2589                                 svr4.0)
2590                                         : Check for ESIX
2591                                         if test -f /stand/boot ; then
2592                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2593                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2594                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2595                                                         if test -n "$isesix"; then
2596                                                                 osname=esix4
2597                                                         fi
2598                                                 fi
2599                                         fi
2600                                         ;;
2601                                 esac
2602                                 ;;
2603                         *)      if test -f /etc/systemid; then
2604                                         osname=sco
2605                                         set `echo $3 | $sed 's/\./ /g'` $4
2606                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2607                                                 osvers=$1.$2.$3
2608                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2609                                                 osvers=$1.$2
2610                                         elif $test -f $src/hints/sco_$1.sh; then
2611                                                 osvers=$1
2612                                         fi
2613                                 else
2614                                         case "$osname" in
2615                                         '') : Still unknown.  Probably a generic Sys V.
2616                                                 osname="sysv"
2617                                                 osvers="$3"
2618                                                 ;;
2619                                         esac
2620                                 fi
2621                                 ;;
2622                         esac
2623                         ;;
2624                 *)      case "$osname" in
2625                         '') : Still unknown.  Probably a generic BSD.
2626                                 osname="$1"
2627                                 osvers="$3"
2628                                 ;;
2629                         esac
2630                         ;;
2631                 esac
2632         else
2633                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2634                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2635                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2636                                 osname=news_os
2637                         fi
2638                         $rm -f UU/kernel.what
2639                 elif test -d c:/.; then
2640                         set X $myuname
2641                         osname=os2
2642                         osvers="$5"
2643                 fi
2644         fi
2645         
2646         : Now look for a hint file osname_osvers, unless one has been
2647         : specified already.
2648         case "$hintfile" in
2649         ''|' ')
2650                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2651                 : Also try without trailing minor version numbers.
2652                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2653                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2654                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2655                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2656                 case "$file" in
2657                 '') dflt=none ;;
2658                 *)  case "$osvers" in
2659                         '') dflt=$file
2660                                 ;;
2661                         *)  if $test -f $src/hints/$file.sh ; then
2662                                         dflt=$file
2663                                 elif $test -f $src/hints/$xfile.sh ; then
2664                                         dflt=$xfile
2665                                 elif $test -f $src/hints/$xxfile.sh ; then
2666                                         dflt=$xxfile
2667                                 elif $test -f $src/hints/$xxxfile.sh ; then
2668                                         dflt=$xxxfile
2669                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2670                                         dflt=$xxxxfile
2671                                 elif $test -f "$src/hints/${osname}.sh" ; then
2672                                         dflt="${osname}"
2673                                 else
2674                                         dflt=none
2675                                 fi
2676                                 ;;
2677                         esac
2678                         ;;
2679                 esac
2680                 if $test -f Policy.sh ; then
2681                         case "$dflt" in
2682                         *Policy*) ;;
2683                         none) dflt="Policy" ;;
2684                         *) dflt="Policy $dflt" ;;
2685                         esac
2686                 fi
2687                 ;;
2688         *)
2689                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2690                 ;;
2691         esac
2692
2693         if $test -f Policy.sh ; then
2694                 $cat <<EOM
2695
2696 There's also a Policy hint file available, which should make the
2697 site-specific (policy) questions easier to answer.
2698 EOM
2699
2700         fi
2701
2702         $cat <<EOM
2703
2704 You may give one or more space-separated answers, or "none" if appropriate.
2705 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2706 is a good thing.  DO NOT give a wrong version or a wrong OS.
2707
2708 EOM
2709
2710         rp="Which of these apply, if any?"
2711         . UU/myread
2712         tans=$ans
2713         for file in $tans; do
2714                 if $test X$file = XPolicy -a -f Policy.sh; then
2715                         . Policy.sh
2716                         $cat Policy.sh >> UU/config.sh
2717                 elif $test -f $src/hints/$file.sh; then
2718                         . $src/hints/$file.sh
2719                         $cat $src/hints/$file.sh >> UU/config.sh
2720                 elif $test X$tans = X -o X$tans = Xnone ; then
2721                         : nothing
2722                 else
2723                         : Give one chance to correct a possible typo.
2724                         echo "$file.sh does not exist"
2725                         dflt=$file
2726                         rp="hint to use instead?"
2727                         . UU/myread
2728                         for file in $ans; do
2729                                 if $test -f "$src/hints/$file.sh"; then
2730                                         . $src/hints/$file.sh
2731                                         $cat $src/hints/$file.sh >> UU/config.sh
2732                                 elif $test X$ans = X -o X$ans = Xnone ; then
2733                                         : nothing
2734                                 else
2735                                         echo "$file.sh does not exist -- ignored."
2736                                 fi
2737                         done
2738                 fi
2739         done
2740
2741         hint=recommended
2742         : Remember our hint file for later.
2743         if $test -f "$src/hints/$file.sh" ; then
2744                 hintfile="$file"
2745         else
2746                 hintfile=''
2747         fi
2748 fi
2749 cd UU
2750 ;;
2751 *)
2752         echo " "
2753         echo "Fetching default answers from $config_sh..." >&4
2754         tmp_n="$n"
2755         tmp_c="$c"
2756         cd ..
2757         cp $config_sh config.sh 2>/dev/null
2758         chmod +w config.sh
2759         . ./config.sh
2760         cd UU
2761         cp ../config.sh .
2762         n="$tmp_n"
2763         c="$tmp_c"
2764         hint=previous
2765         ;;
2766 esac
2767 test "$override" && . ./optdef.sh
2768
2769 : Restore computed paths
2770 for file in $loclist $trylist; do
2771         eval $file="\$_$file"
2772 done
2773
2774 cat << EOM
2775
2776 Configure uses the operating system name and version to set some defaults.
2777 The default value is probably right if the name rings a bell. Otherwise,
2778 since spelling matters for me, either accept the default or answer "none"
2779 to leave it blank.
2780
2781 EOM
2782 case "$osname" in
2783         ''|' ')
2784                 case "$hintfile" in
2785                 ''|' '|none) dflt=none ;;
2786                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2787                 esac
2788                 ;;
2789         *) dflt="$osname" ;;
2790 esac
2791 rp="Operating system name?"
2792 . ./myread
2793 case "$ans" in
2794 none)  osname='' ;;
2795 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2796 esac
2797 echo " "
2798 case "$osvers" in
2799         ''|' ')
2800                 case "$hintfile" in
2801                 ''|' '|none) dflt=none ;;
2802                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2803                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2804                         case "$dflt" in
2805                         ''|' ') dflt=none ;;
2806                         esac
2807                         ;;
2808                 esac
2809                 ;;
2810         *) dflt="$osvers" ;;
2811 esac
2812 rp="Operating system version?"
2813 . ./myread
2814 case "$ans" in
2815 none)  osvers='' ;;
2816 *) osvers="$ans" ;;
2817 esac
2818
2819
2820 . ./posthint.sh
2821
2822 : who configured the system
2823 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2824 cf_by=`(logname) 2>/dev/null`
2825 case "$cf_by" in
2826 "")
2827         cf_by=`(whoami) 2>/dev/null`
2828         case "$cf_by" in
2829         "") cf_by=unknown ;;
2830         esac ;;
2831 esac
2832
2833 : set up the script used to warn in case of inconsistency
2834 cat <<EOS >whoa
2835 $startsh
2836 EOS
2837 cat <<'EOSC' >>whoa
2838 dflt=y
2839 echo " "
2840 echo "*** WHOA THERE!!! ***" >&4
2841 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2842 rp="    Keep the $hint value?"
2843 . ./myread
2844 case "$ans" in
2845 y) td=$was; tu=$was;;
2846 esac
2847 EOSC
2848
2849 : function used to set $1 to $val
2850 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2851 case "$val$was" in
2852 $define$undef) . ./whoa; eval "$var=\$td";;
2853 $undef$define) . ./whoa; eval "$var=\$tu";;
2854 *) eval "$var=$val";;
2855 esac'
2856
2857 case "$usethreads" in
2858 $define|true|[yY]*)     dflt='y';;
2859 *) dflt='n';;
2860 esac
2861 cat <<EOM
2862
2863 Perl can be built to take advantage of threads on some systems.
2864 To do so, Configure can be run with -Dusethreads.
2865
2866 Note that threading is a highly experimental feature, and
2867 some known race conditions still remain.  If you choose to try
2868 it, be very sure to not actually deploy it for production
2869 purposes.  README.threads has more details, and is required
2870 reading if you enable threads.
2871
2872 If this doesn't make any sense to you, just accept the default '$dflt'.
2873 EOM
2874 rp='Build a threading Perl?'
2875 . ./myread
2876 case "$ans" in
2877 y|Y)    val="$define" ;;
2878 *)      val="$undef" ;;
2879 esac
2880 set usethreads
2881 eval $setvar
2882
2883 case "$usethreads" in
2884 $define)
2885         $cat <<EOM
2886
2887 As of 5.5.640, Perl has two different internal threading implementations,
2888 the 5.005 version (5005threads) and an interpreter-based version
2889 (ithreads) that has one interpreter per thread.  Both are very 
2890 experimental.  This arrangement exists to help developers work out
2891 which one is better.
2892
2893 If you're a casual user, you probably don't want interpreter-threads
2894 at this time.  There doesn't yet exist a way to create threads from
2895 within Perl in this model, i.e., "use Thread;" will NOT work.
2896 EOM
2897         : Default to ithreads unless overridden on command line or with
2898         : old config.sh
2899         dflt='y'
2900         case "$use5005threads" in
2901                 $define|true|[yY]*) dflt='n';;
2902         esac
2903         case "$useithreads" in
2904                 $undef|false|[nN]*) dflt='n';;
2905         esac
2906         rp='Use interpreter-based ithreads?'
2907         . ./myread
2908         case "$ans" in
2909         y|Y)    val="$define" ;;
2910         *)      val="$undef" ;;
2911         esac
2912         set useithreads
2913         eval $setvar
2914         : Now set use5005threads to the opposite value.
2915         case "$useithreads" in
2916         $define) val="$undef" ;;
2917         *) val="$define" ;;
2918         esac
2919         set use5005threads
2920         eval $setvar
2921         ;;
2922 *)
2923         useithreads="$undef"
2924         use5005threads="$undef"
2925         ;;
2926 esac
2927
2928 case "$d_oldpthreads" in
2929 '')     : Configure tests would be welcome here.  For now, assume undef.
2930         val="$undef" ;;
2931 *)      val="$d_oldpthreads" ;;
2932 esac
2933 set d_oldpthreads
2934 eval $setvar
2935
2936
2937 case "$usethreads" in
2938 "$define"|true|[yY]*)
2939 : Look for a hint-file generated 'call-back-unit'.  If the
2940 : user has specified that a threading perl is to be built,
2941 : we may need to set or change some other defaults.
2942         if $test -f usethreads.cbu; then
2943                 echo "Your platform has some specific hints for threaded builds, using them..."
2944                 . ./usethreads.cbu
2945         else
2946                 $cat <<EOM
2947 (Your platform doesn't have any specific hints for threaded builds.
2948  Assuming POSIX threads, then.)
2949 EOM
2950         fi
2951         ;;
2952 esac
2953
2954 cat <<EOM
2955
2956 Perl can be built so that multiple Perl interpreters can coexist
2957 within the same Perl executable.
2958 EOM
2959
2960 case "$useithreads" in
2961 $define)
2962         cat <<EOM
2963 This multiple interpreter support is required for interpreter-based threads.
2964 EOM
2965         val="$define"
2966         ;;
2967 *)      case "$usemultiplicity" in
2968         $define|true|[yY]*)     dflt='y';;
2969         *) dflt='n';;
2970         esac
2971         echo " "
2972         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2973         rp='Build Perl for multiplicity?'
2974         . ./myread
2975         case "$ans" in
2976         y|Y)    val="$define" ;;
2977         *)      val="$undef" ;;
2978         esac
2979         ;;
2980 esac
2981 set usemultiplicity
2982 eval $setvar
2983
2984 : make some quick guesses about what we are up against
2985 echo " "
2986 $echo $n "Hmm...  $c"
2987 echo exit 1 >bsd
2988 echo exit 1 >usg
2989 echo exit 1 >v7
2990 echo exit 1 >osf1
2991 echo exit 1 >eunice
2992 echo exit 1 >xenix
2993 echo exit 1 >venix
2994 echo exit 1 >os2
2995 d_bsd="$undef"
2996 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2997 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2998 then
2999         echo "Looks kind of like an OSF/1 system, but we'll see..."
3000         echo exit 0 >osf1
3001 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3002         xxx=`./loc addbib blurfl $pth`
3003         if $test -f $xxx; then
3004         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3005                 echo exit 0 >bsd
3006                 echo exit 0 >usg
3007         else
3008                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3009                         echo "Looks kind of like an extended USG system, but we'll see..."
3010                 else
3011                         echo "Looks kind of like a USG system, but we'll see..."
3012                 fi
3013                 echo exit 0 >usg
3014         fi
3015 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3016         echo "Looks kind of like a BSD system, but we'll see..."
3017         d_bsd="$define"
3018         echo exit 0 >bsd
3019 else
3020         echo "Looks kind of like a Version 7 system, but we'll see..."
3021         echo exit 0 >v7
3022 fi
3023 case "$eunicefix" in
3024 *unixtovms*)
3025         $cat <<'EOI'
3026 There is, however, a strange, musty smell in the air that reminds me of
3027 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3028 EOI
3029         echo exit 0 >eunice
3030         d_eunice="$define"
3031 : it so happens the Eunice I know will not run shell scripts in Unix format
3032         ;;
3033 *)
3034         echo " "
3035         echo "Congratulations.  You aren't running Eunice."
3036         d_eunice="$undef"
3037         ;;
3038 esac
3039 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3040 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3041 : semicolon as a patch separator
3042 case "$p_" in
3043 :) ;;
3044 *)
3045         $cat <<'EOI'
3046 I have the feeling something is not exactly right, however...don't tell me...
3047 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3048 (Or you may be running DOS with DJGPP.)
3049 EOI
3050         echo exit 0 >os2
3051         ;;
3052 esac
3053 if test -f /xenix; then
3054         echo "Actually, this looks more like a XENIX system..."
3055         echo exit 0 >xenix
3056         d_xenix="$define"
3057 else
3058         echo " "
3059         echo "It's not Xenix..."
3060         d_xenix="$undef"
3061 fi
3062 chmod +x xenix
3063 $eunicefix xenix
3064 if test -f /venix; then
3065         echo "Actually, this looks more like a VENIX system..."
3066         echo exit 0 >venix
3067 else
3068         echo " "
3069         if ./xenix; then
3070                 : null
3071         else
3072                 echo "Nor is it Venix..."
3073         fi
3074 fi
3075 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3076 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3077 $rm -f foo
3078
3079 case "$cc" in
3080 '') dflt=cc;;
3081 *) dflt="$cc";;
3082 esac
3083 rp="Use which C compiler?"
3084 . ./myread
3085 cc="$ans"
3086 : Look for a hint-file generated 'call-back-unit'.  Now that the
3087 : user has specified the compiler, we may need to set or change some
3088 : other defaults.
3089 if $test -f cc.cbu; then
3090     . ./cc.cbu
3091 fi
3092 . ./checkcc
3093
3094 echo " "
3095 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3096 $cat >gccvers.c <<EOM
3097 #include <stdio.h>
3098 int main() {
3099 #ifdef __GNUC__
3100 #ifdef __VERSION__
3101         printf("%s\n", __VERSION__);
3102 #else
3103         printf("%s\n", "1");
3104 #endif
3105 #endif
3106         exit(0);
3107 }
3108 EOM
3109 if $cc -o gccvers $ldflags gccvers.c; then
3110         gccversion=`./gccvers`
3111         case "$gccversion" in
3112         '') echo "You are not using GNU cc." ;;
3113         *)  echo "You are using GNU cc $gccversion."
3114             ccname=gcc  
3115             ;;
3116         esac
3117 else
3118         echo " "
3119         echo "*** WHOA THERE!!! ***" >&4
3120         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3121         case "$knowitall" in
3122         '')
3123         echo "    You'd better start hunting for one and let me know about it." >&4
3124                 exit 1
3125                 ;;
3126         esac
3127 fi
3128 $rm -f gccvers*
3129 case "$gccversion" in
3130 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3131 esac
3132 case "$gccversion" in
3133 '') gccosandvers='' ;;
3134 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3135    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3136    gccshortvers=''
3137    case "$gccosandvers" in
3138    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3139    $osname$osvers) ;; # looking good
3140    $osname*) cat <<EOM >&4
3141
3142 *** WHOA THERE!!! ***
3143
3144     Your gcc has not been compiled for the exact release of
3145     your operating system ($gccosandvers versus $osname$osvers).
3146
3147     In general it is a good idea to keep gcc synchronized with
3148     the operating system because otherwise serious problems
3149     may ensue when trying to compile software, like Perl.
3150
3151     I'm trying to be optimistic here, though, and will continue.
3152     If later during the configuration and build icky compilation
3153     problems appear (headerfile conflicts being the most common
3154     manifestation), I suggest reinstalling the gcc to match
3155     your operating system release.
3156
3157 EOM
3158       ;;
3159    *) gccosandvers='' ;; # failed to parse, better be silent
3160    esac
3161    ;;
3162 esac
3163 case "$ccname" in
3164 '') ccname="$cc" ;;
3165 esac
3166
3167 : see how we invoke the C preprocessor
3168 echo " "
3169 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3170 cat <<'EOT' >testcpp.c
3171 #define ABC abc
3172 #define XYZ xyz
3173 ABC.XYZ
3174 EOT
3175 cd ..
3176 if test ! -f cppstdin; then
3177         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3178                 # AIX cc -E doesn't show the absolute headerfile
3179                 # locations but we'll cheat by using the -M flag.
3180                 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
3181         else
3182                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3183         fi
3184 else
3185         echo "Keeping your $hint cppstdin wrapper."
3186 fi
3187 chmod 755 cppstdin
3188 wrapper=`pwd`/cppstdin
3189 ok='false'
3190 cd UU
3191
3192 if $test "X$cppstdin" != "X" && \
3193         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3194         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3195 then
3196         echo "You used to use $cppstdin $cppminus so we'll use that again."
3197         case "$cpprun" in
3198         '') echo "But let's see if we can live without a wrapper..." ;;
3199         *)
3200                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3201                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3202                 then
3203                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3204                         ok='true'
3205                 else
3206                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3207                 fi
3208                 ;;
3209         esac
3210 else
3211         case "$cppstdin" in
3212         '') ;;
3213         *)
3214                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3215                 ;;
3216         esac
3217 fi
3218
3219 if $ok; then
3220         : nothing
3221 elif echo '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"' -E -" will work...'; \
3228         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3229         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3230         echo "Yup, it does."
3231         x_cpp="$cc -E"
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 "Yipee, that works!"
3237         x_cpp="$cc -P"
3238         x_minus='';
3239 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3240         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3241         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3242         echo "At long last!"
3243         x_cpp="$cc -P"
3244         x_minus='-';
3245 elif echo 'No such luck, 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 "It works!"
3249         x_cpp="$cpp"
3250         x_minus='';
3251 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3252         $cpp - <testcpp.c >testcpp.out 2>&1; \
3253         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3254         echo "Hooray, it works!  I was beginning to wonder."
3255         x_cpp="$cpp"
3256         x_minus='-';
3257 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3258         $wrapper <testcpp.c >testcpp.out 2>&1; \
3259         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3260         x_cpp="$wrapper"
3261         x_minus=''
3262         echo "Eureka!"
3263 else
3264         dflt=''
3265         rp="No dice.  I can't find a C preprocessor.  Name one:"
3266         . ./myread
3267         x_cpp="$ans"
3268         x_minus=''
3269         $x_cpp <testcpp.c >testcpp.out 2>&1
3270         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3271                 echo "OK, that will do." >&4
3272         else
3273 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3274                 exit 1
3275         fi
3276 fi
3277
3278 case "$ok" in
3279 false)
3280         cppstdin="$x_cpp"
3281         cppminus="$x_minus"
3282         cpprun="$x_cpp"
3283         cpplast="$x_minus"
3284         set X $x_cpp
3285         shift
3286         case "$1" in
3287         "$cpp")
3288                 echo "Perhaps can we force $cc -E using a wrapper..."
3289                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3290                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3291                 then
3292                         echo "Yup, we can."
3293                         cppstdin="$wrapper"
3294                         cppminus='';
3295                 else
3296                         echo "Nope, we'll have to live without it..."
3297                 fi
3298                 ;;
3299         esac
3300         case "$cpprun" in
3301         "$wrapper")
3302                 cpprun=''
3303                 cpplast=''
3304                 ;;
3305         esac
3306         ;;
3307 esac
3308
3309 case "$cppstdin" in
3310 "$wrapper"|'cppstdin') ;;
3311 *) $rm -f $wrapper;;
3312 esac
3313 $rm -f testcpp.c testcpp.out
3314
3315 : decide how portable to be.  Allow command line overrides.
3316 case "$d_portable" in
3317 "$undef") ;;
3318 *)      d_portable="$define" ;;
3319 esac
3320
3321 : set up shell script to do ~ expansion
3322 cat >filexp <<EOSS
3323 $startsh
3324 : expand filename
3325 case "\$1" in
3326  ~/*|~)
3327         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3328         ;;
3329  ~*)
3330         if $test -f /bin/csh; then
3331                 /bin/csh -f -c "glob \$1"
3332                 failed=\$?
3333                 echo ""
3334                 exit \$failed
3335         else
3336                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3337                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3338                 if $test ! -d "\$dir"; then
3339                         me=\`basename \$0\`
3340                         echo "\$me: can't locate home directory for: \$name" >&2
3341                         exit 1
3342                 fi
3343                 case "\$1" in
3344                 */*)
3345                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3346                         ;;
3347                 *)
3348                         echo \$dir
3349                         ;;
3350                 esac
3351         fi
3352         ;;
3353 *)
3354         echo \$1
3355         ;;
3356 esac
3357 EOSS
3358 chmod +x filexp
3359 $eunicefix filexp
3360
3361 : now set up to get a file name
3362 cat <<EOS >getfile
3363 $startsh
3364 EOS
3365 cat <<'EOSC' >>getfile
3366 tilde=''
3367 fullpath=''
3368 already=''
3369 skip=''
3370 none_ok=''
3371 exp_file=''
3372 nopath_ok=''
3373 orig_rp="$rp"
3374 orig_dflt="$dflt"
3375 case "$gfpth" in
3376 '') gfpth='.' ;;
3377 esac
3378
3379 case "$fn" in
3380 *\(*)
3381         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3382         fn=`echo $fn | sed 's/(.*)//'`
3383         ;;
3384 esac
3385
3386 case "$fn" in
3387 *:*)
3388         loc_file=`expr $fn : '.*:\(.*\)'`
3389         fn=`expr $fn : '\(.*\):.*'`
3390         ;;
3391 esac
3392
3393 case "$fn" in
3394 *~*) tilde=true;;
3395 esac
3396 case "$fn" in
3397 */*) fullpath=true;;
3398 esac
3399 case "$fn" in
3400 *+*) skip=true;;
3401 esac
3402 case "$fn" in
3403 *n*) none_ok=true;;
3404 esac
3405 case "$fn" in
3406 *e*) exp_file=true;;
3407 esac
3408 case "$fn" in
3409 *p*) nopath_ok=true;;
3410 esac
3411
3412 case "$fn" in
3413 *f*) type='File';;
3414 *d*) type='Directory';;
3415 *l*) type='Locate';;
3416 esac
3417
3418 what="$type"
3419 case "$what" in
3420 Locate) what='File';;
3421 esac
3422
3423 case "$exp_file" in
3424 '')
3425         case "$d_portable" in
3426         "$define") ;;
3427         *) exp_file=true;;
3428         esac
3429         ;;
3430 esac
3431
3432 cd ..
3433 while test "$type"; do
3434         redo=''
3435         rp="$orig_rp"
3436         dflt="$orig_dflt"
3437         case "$tilde" in
3438         true) rp="$rp (~name ok)";;
3439         esac
3440         . UU/myread
3441         if test -f UU/getfile.ok && \
3442                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3443         then
3444                 value="$ans"
3445                 ansexp="$ans"
3446                 break
3447         fi
3448         case "$ans" in
3449         none)
3450                 value=''
3451                 ansexp=''
3452                 case "$none_ok" in
3453                 true) type='';;
3454                 esac
3455                 ;;
3456         *)
3457                 case "$tilde" in
3458                 '') value="$ans"
3459                         ansexp="$ans";;
3460                 *)
3461                         value=`UU/filexp $ans`
3462                         case $? in
3463                         0)
3464                                 if test "$ans" != "$value"; then
3465                                         echo "(That expands to $value on this system.)"
3466                                 fi
3467                                 ;;
3468                         *) value="$ans";;
3469                         esac
3470                         ansexp="$value"
3471                         case "$exp_file" in
3472                         '') value="$ans";;
3473                         esac
3474                         ;;
3475                 esac
3476                 case "$fullpath" in
3477                 true)
3478                         case "$ansexp" in
3479                         /*) value="$ansexp" ;;
3480                         [a-zA-Z]:/*) value="$ansexp" ;;
3481                         *)
3482                                 redo=true
3483                                 case "$already" in
3484                                 true)
3485                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3486                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3487                                         ;;
3488                                 *)
3489                                 echo "Please give a full path name, starting with slash." >&4
3490                                         case "$tilde" in
3491                                         true)
3492                                 echo "Note that using ~name is ok provided it expands well." >&4
3493                                                 already=true
3494                                                 ;;
3495                                         esac
3496                                 esac
3497                                 ;;
3498                         esac
3499                         ;;
3500                 esac
3501                 case "$redo" in
3502                 '')
3503                         case "$type" in
3504                         File)
3505                                 for fp in $gfpth; do
3506                                         if test "X$fp" = X.; then
3507                                             pf="$ansexp"
3508                                         else    
3509                                             pf="$fp/$ansexp"
3510                                         fi
3511                                         if test -f "$pf"; then
3512                                                 type=''
3513                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3514                                         then
3515                                                 echo "($value is not a plain file, but that's ok.)"
3516                                                 type=''
3517                                         fi
3518                                         if test X"$type" = X; then
3519                                             value="$pf"
3520                                             break
3521                                         fi
3522                                 done
3523                                 ;;
3524                         Directory)
3525                                 for fp in $gfpth; do
3526                                         if test "X$fp" = X.; then
3527                                             dir="$ans"
3528                                             direxp="$ansexp"
3529                                         else    
3530                                             dir="$fp/$ansexp"
3531                                             direxp="$fp/$ansexp"
3532                                         fi
3533                                         if test -d "$direxp"; then
3534                                                 type=''
3535                                                 value="$dir"
3536                                                 break
3537                                         fi
3538                                 done
3539                                 ;;
3540                         Locate)
3541                                 if test -d "$ansexp"; then
3542                                         echo "(Looking for $loc_file in directory $value.)"
3543                                         value="$value/$loc_file"
3544                                         ansexp="$ansexp/$loc_file"
3545                                 fi
3546                                 if test -f "$ansexp"; then
3547                                         type=''
3548                                 fi
3549                                 case "$nopath_ok" in
3550                                 true)   case "$value" in
3551                                         */*) ;;
3552                                         *)      echo "Assuming $value will be in people's path."
3553                                                 type=''
3554                                                 ;;
3555                                         esac
3556                                         ;;
3557                                 esac
3558                                 ;;
3559                         esac
3560
3561                         case "$skip" in
3562                         true) type='';
3563                         esac
3564
3565                         case "$type" in
3566                         '') ;;
3567                         *)
3568                                 if test "$fastread" = yes; then
3569                                         dflt=y
3570                                 else
3571                                         dflt=n
3572                                 fi
3573                                 rp="$what $value doesn't exist.  Use that name anyway?"
3574                                 . UU/myread
3575                                 dflt=''
3576                                 case "$ans" in
3577                                 y*) type='';;
3578                                 *) echo " ";;
3579                                 esac
3580                                 ;;
3581                         esac
3582                         ;;
3583                 esac
3584                 ;;
3585         esac
3586 done
3587 cd UU
3588 ans="$value"
3589 rp="$orig_rp"
3590 dflt="$orig_dflt"
3591 rm -f getfile.ok
3592 test "X$gfpthkeep" != Xy && gfpth=""
3593 EOSC
3594
3595 : What should the include directory be ?
3596 echo " "
3597 $echo $n "Hmm...  $c"
3598 dflt='/usr/include'
3599 incpath=''
3600 mips_type=''
3601 if $test -f /bin/mips && /bin/mips; then
3602         echo "Looks like a MIPS system..."
3603         $cat >usr.c <<'EOCP'
3604 #ifdef SYSTYPE_BSD43
3605 /bsd43
3606 #endif
3607 EOCP
3608         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3609                 dflt='/bsd43/usr/include'
3610                 incpath='/bsd43'
3611                 mips_type='BSD 4.3'
3612         else
3613                 mips_type='System V'
3614         fi
3615         $rm -f usr.c usr.out
3616         echo "and you're compiling with the $mips_type compiler and libraries."
3617         xxx_prompt=y
3618         echo "exit 0" >mips
3619 else
3620         echo "Doesn't look like a MIPS system."
3621         xxx_prompt=n
3622         echo "exit 1" >mips
3623 fi
3624 chmod +x mips
3625 $eunicefix mips
3626 case "$usrinc" in
3627 '') ;;
3628 *) dflt="$usrinc";;
3629 esac
3630 case "$xxx_prompt" in
3631 y)      fn=d/
3632         echo " "
3633         rp='Where are the include files you want to use?'
3634         . ./getfile
3635         usrinc="$ans"
3636         ;;
3637 *)      usrinc="$dflt"
3638         ;;
3639 esac
3640
3641 : Set private lib path
3642 case "$plibpth" in
3643 '') if ./mips; then
3644                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3645         fi;;
3646 esac
3647 case "$libpth" in
3648 ' ') dlist='';;
3649 '') dlist="$loclibpth $plibpth $glibpth";;
3650 *) dlist="$libpth";;
3651 esac
3652
3653 : Now check and see which directories actually exist, avoiding duplicates
3654 libpth=''
3655 for xxx in $dlist
3656 do
3657     if $test -d $xxx; then
3658                 case " $libpth " in
3659                 *" $xxx "*) ;;
3660                 *) libpth="$libpth $xxx";;
3661                 esac
3662     fi
3663 done
3664 $cat <<'EOM'
3665
3666 Some systems have incompatible or broken versions of libraries.  Among
3667 the directories listed in the question below, please remove any you
3668 know not to be holding relevant libraries, and add any that are needed.
3669 Say "none" for none.
3670
3671 EOM
3672 case "$libpth" in
3673 '') dflt='none';;
3674 *)
3675         set X $libpth
3676         shift
3677         dflt=${1+"$@"}
3678         ;;
3679 esac
3680 rp="Directories to use for library searches?"
3681 . ./myread
3682 case "$ans" in
3683 none) libpth=' ';;
3684 *) libpth="$ans";;
3685 esac
3686
3687 : compute shared library extension
3688 case "$so" in
3689 '')
3690         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3691                 dflt='sl'
3692         else
3693                 dflt='so'
3694         fi
3695         ;;
3696 *) dflt="$so";;
3697 esac
3698 $cat <<EOM
3699
3700 On some systems, shared libraries may be available.  Answer 'none' if
3701 you want to suppress searching of shared libraries for the remainder
3702 of this configuration.
3703
3704 EOM
3705 rp='What is the file extension used for shared libraries?'
3706 . ./myread
3707 so="$ans"
3708
3709 : Define several unixisms.
3710 : Hints files or command line option can be used to override them.
3711 : The convoluted testing is in case hints files set either the old
3712 : or the new name.
3713 case "$_exe" in
3714 '')     case "$exe_ext" in
3715     '') ;;
3716         *)      _exe="$exe_ext" ;;
3717         esac
3718         ;;
3719 esac
3720 case "$_a" in
3721 '')     case "$lib_ext" in
3722     '') _a='.a';;
3723         *)      _a="$lib_ext" ;;
3724         esac
3725         ;;
3726 esac
3727 case "$_o" in
3728 '') case "$obj_ext" in
3729         '')     _o='.o';;
3730         *)      _o="$obj_ext";;
3731         esac
3732         ;;
3733 esac
3734 case "$p_" in
3735 '') case "$path_sep" in
3736         '')     p_=':';;
3737         *)      p_="$path_sep";;
3738         esac
3739         ;;
3740 esac
3741 exe_ext=$_exe
3742 lib_ext=$_a
3743 obj_ext=$_o
3744 path_sep=$p_
3745
3746 : Which makefile gets called first.  This is used by make depend.
3747 case "$firstmakefile" in
3748 '') firstmakefile='makefile';;
3749 esac
3750
3751 case "$usesocks" in
3752 $define|true|[yY]*)     dflt='y';;
3753 *) dflt='n';;
3754 esac
3755 cat <<EOM
3756
3757 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3758 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3759 to use the PerlIO abstraction layer, this will be implicitly selected.
3760
3761 If this doesn't make any sense to you, just accept the default '$dflt'.
3762 EOM
3763 rp='Build Perl for SOCKS?'
3764 . ./myread
3765 case "$ans" in
3766 y|Y)    val="$define" ;;     
3767 *)      val="$undef" ;;
3768 esac
3769 set usesocks
3770 eval $setvar
3771
3772 case "$usesocks" in
3773 $define|true|[yY]*) useperlio="$define";;
3774 esac
3775
3776 : Looking for optional libraries
3777 echo " "
3778 echo "Checking for optional libraries..." >&4
3779 case "$libs" in
3780 ' '|'') dflt='';;
3781 *) dflt="$libs";;
3782 esac
3783 case "$libswanted" in
3784 '') libswanted='c_s';;
3785 esac
3786 case "$usesocks" in
3787 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3788 esac
3789 libsfound=''
3790 libsfiles=''
3791 libsdirs=''
3792 libspath=''
3793 for thisdir in $libpth $xlibpth; do
3794   test -d $thisdir && libspath="$libspath $thisdir"
3795 done
3796 for thislib in $libswanted; do
3797         for thisdir in $libspath; do
3798             xxx=''
3799             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3800                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3801                 $test -f "$xxx" && eval $libscheck
3802                 $test -f "$xxx" && libstyle=shared
3803             fi
3804             if test ! -f "$xxx"; then
3805                 xxx=$thisdir/lib$thislib.$so
3806                 $test -f "$xxx" && eval $libscheck
3807                 $test -f "$xxx" && libstyle=shared
3808             fi  
3809             if test ! -f "$xxx"; then
3810                 xxx=$thisdir/lib$thislib$_a
3811                 $test -f "$xxx" && eval $libscheck
3812                 $test -f "$xxx" && libstyle=static
3813             fi
3814             if test ! -f "$xxx"; then
3815                 xxx=$thisdir/$thislib$_a
3816                 $test -f "$xxx" && eval $libscheck
3817                 $test -f "$xxx" && libstyle=static
3818             fi
3819             if test ! -f "$xxx"; then
3820                 xxx=$thisdir/lib${thislib}_s$_a
3821                 $test -f "$xxx" && eval $libscheck
3822                 $test -f "$xxx" && libstyle=static
3823                 $test -f "$xxx" && thislib=${thislib}_s
3824             fi
3825             if test ! -f "$xxx"; then
3826                 xxx=$thisdir/Slib$thislib$_a
3827                 $test -f "$xxx" && eval $libscheck
3828                 $test -f "$xxx" && libstyle=static
3829             fi
3830             if $test -f "$xxx"; then
3831                 case "$libstyle" in
3832                 shared) echo "Found -l$thislib (shared)." ;;
3833                 static) echo "Found -l$thislib." ;;
3834                 *)      echo "Found -l$thislib ($libstyle)." ;;
3835                 esac
3836                 case " $dflt " in
3837                 *"-l$thislib "*);;
3838                 *) dflt="$dflt -l$thislib"
3839                    libsfound="$libsfound $xxx"
3840                    yyy=`basename $xxx`
3841                    libsfiles="$libsfiles $yyy"
3842                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3843                    case " $libsdirs " in
3844                    *" $yyy "*) ;;
3845                    *) libsdirs="$libsdirs $yyy" ;;
3846                    esac
3847                    ;;
3848                 esac
3849                 break
3850             fi  
3851         done
3852         if $test ! -f "$xxx"; then
3853             echo "No -l$thislib."
3854         fi
3855 done
3856 set X $dflt
3857 shift
3858 dflt="$*"
3859 case "$libs" in
3860 '') dflt="$dflt";;
3861 *) dflt="$libs";;
3862 esac
3863 case "$dflt" in
3864 ' '|'') dflt='none';;
3865 esac
3866
3867 $cat <<EOM
3868
3869 In order to compile $package on your machine, a number of libraries
3870 are usually needed.  Include any other special libraries here as well.
3871 Say "none" for none.  The default list is almost always right.
3872 EOM
3873
3874 echo " "
3875 rp="What libraries to use?"
3876 . ./myread
3877 case "$ans" in
3878 none) libs=' ';;
3879 *) libs="$ans";;
3880 esac
3881
3882 : determine optimization, if desired, or use for debug flag also
3883 case "$optimize" in
3884 ' '|$undef) dflt='none';;
3885 '') dflt='-O';;
3886 *) dflt="$optimize";;
3887 esac
3888 $cat <<EOH
3889
3890 By default, $package compiles with the -O flag to use the optimizer.
3891 Alternately, you might want to use the symbolic debugger, which uses
3892 the -g flag (on traditional Unix systems).  Either flag can be
3893 specified here.  To use neither flag, specify the word "none".
3894
3895 EOH
3896 rp="What optimizer/debugger flag should be used?"
3897 . ./myread
3898 optimize="$ans"
3899 case "$optimize" in
3900 'none') optimize=" ";;
3901 esac
3902
3903 dflt=''
3904 : We will not override a previous value, but we might want to
3905 : augment a hint file
3906 case "$hint" in
3907 default|recommended)
3908         case "$gccversion" in
3909         1*) dflt='-fpcc-struct-return' ;;
3910         esac
3911         case "$optimize" in
3912         *-g*) dflt="$dflt -DDEBUGGING";;
3913         esac
3914         case "$gccversion" in
3915         2*) if test -d /etc/conf/kconfig.d &&
3916                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3917                 then
3918                         dflt="$dflt -posix"
3919                 fi
3920                 ;;
3921         esac
3922         case "$gccversion" in
3923         1*) ;;
3924         2.[0-8]*) ;;
3925         ?*)     echo " "
3926                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3927                 echo 'int main(void) { return 0; }' > gcctest.c
3928                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3929                         echo "Yes, it does." 2>&1
3930                         case "$ccflags" in
3931                         *strict-aliasing*) 
3932                                 echo "Leaving current flags $ccflags alone." 2>&1
3933                                 ;;
3934                         *) dflt="$dflt -fno-strict-aliasing" ;;
3935                         esac
3936                 else
3937                         echo "Nope, it doesn't, but that's ok." 2>&1
3938                 fi
3939                 ;;
3940         esac
3941         ;;
3942 esac
3943
3944 case "$mips_type" in
3945 *BSD*|'') inclwanted="$locincpth $usrinc";;
3946 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3947 esac
3948 for thisincl in $inclwanted; do
3949         if $test -d $thisincl; then
3950                 if $test x$thisincl != x$usrinc; then
3951                         case "$dflt" in
3952                         *" -I$thisincl "*);;
3953                         *) dflt="$dflt -I$thisincl ";;
3954                         esac
3955                 fi
3956         fi
3957 done
3958
3959 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3960         xxx=true;
3961 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3962         xxx=true;
3963 else
3964         xxx=false;
3965 fi;
3966 if $xxx; then
3967         case "$dflt" in
3968         *$2*);;
3969         *) dflt="$dflt -D$2";;
3970         esac;
3971 fi'
3972
3973 set signal.h LANGUAGE_C; eval $inctest
3974
3975 case "$usesocks" in
3976 $define)
3977         ccflags="$ccflags -DSOCKS"
3978         ;;
3979 esac
3980
3981 case "$hint" in
3982 default|recommended) dflt="$ccflags $dflt" ;;
3983 *) dflt="$ccflags";;
3984 esac
3985
3986 case "$dflt" in
3987 ''|' ') dflt=none;;
3988 esac
3989
3990 $cat <<EOH
3991
3992 Your C compiler may want other flags.  For this question you should include
3993 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3994 but you should NOT include libraries or ld flags like -lwhatever.  If you
3995 want $package to honor its debug switch, you should include -DDEBUGGING here.
3996 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3997
3998 To use no flags, specify the word "none".
3999
4000 EOH
4001 set X $dflt
4002 shift
4003 dflt=${1+"$@"}
4004 rp="Any additional cc flags?"
4005 . ./myread
4006 case "$ans" in
4007 none) ccflags='';;
4008 *) ccflags="$ans";;
4009 esac
4010
4011 : the following weeds options from ccflags that are of no interest to cpp
4012 cppflags="$ccflags"
4013 case "$gccversion" in
4014 1*) cppflags="$cppflags -D__GNUC__"
4015 esac
4016 case "$mips_type" in
4017 '');;
4018 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4019 esac
4020 case "$cppflags" in
4021 '');;
4022 *)
4023         echo " "
4024         echo "Let me guess what the preprocessor flags are..." >&4
4025         set X $cppflags
4026         shift
4027         cppflags=''
4028         $cat >cpp.c <<'EOM'
4029 #define BLURFL foo
4030
4031 BLURFL xx LFRULB
4032 EOM
4033         previous=''
4034         for flag in $*
4035         do
4036                 case "$flag" in
4037                 -*) ftry="$flag";;
4038                 *) ftry="$previous $flag";;
4039                 esac
4040                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4041                         >cpp1.out 2>/dev/null && \
4042                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4043                         >cpp2.out 2>/dev/null && \
4044                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4045                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4046                 then
4047                         cppflags="$cppflags $ftry"
4048                         previous=''
4049                 else
4050                         previous="$flag"
4051                 fi
4052         done
4053         set X $cppflags
4054         shift
4055         cppflags=${1+"$@"}
4056         case "$cppflags" in
4057         *-*)  echo "They appear to be: $cppflags";;
4058         esac
4059         $rm -f cpp.c cpp?.out
4060         ;;
4061 esac
4062
4063 : flags used in final linking phase
4064 case "$ldflags" in
4065 '') if ./venix; then
4066                 dflt='-i -z'
4067         else
4068                 dflt=''
4069         fi
4070         case "$ccflags" in
4071         *-posix*) dflt="$dflt -posix" ;;
4072         esac
4073         ;;
4074 *) dflt="$ldflags";;
4075 esac
4076
4077 : Try to guess additional flags to pick up local libraries.
4078 for thislibdir in $libpth; do
4079         case " $loclibpth " in
4080         *" $thislibdir "*)
4081                 case "$dflt " in 
4082                 *"-L$thislibdir "*) ;;
4083                 *)  dflt="$dflt -L$thislibdir" ;;
4084                 esac
4085                 ;;
4086         esac
4087 done
4088
4089 case "$dflt" in
4090 '') dflt='none' ;;
4091 esac
4092
4093 $cat <<EOH
4094
4095 Your C linker may need flags.  For this question you should
4096 include -L/whatever and any other flags used by the C linker, but you
4097 should NOT include libraries like -lwhatever.
4098
4099 Make sure you include the appropriate -L/path flags if your C linker
4100 does not normally search all of the directories you specified above,
4101 namely
4102         $libpth
4103 To use no flags, specify the word "none".
4104
4105 EOH
4106
4107 rp="Any additional ld flags (NOT including libraries)?"
4108 . ./myread
4109 case "$ans" in
4110 none) ldflags='';;
4111 *) ldflags="$ans";;
4112 esac
4113 rmlist="$rmlist pdp11"
4114
4115 : coherency check
4116 echo " "
4117 echo "Checking your choice of C compiler and flags for coherency..." >&4
4118 $cat > try.c <<'EOF'
4119 #include <stdio.h>
4120 int main() { printf("Ok\n"); exit(0); }
4121 EOF
4122 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4123 shift
4124 $cat >try.msg <<'EOM'
4125 I've tried to compile and run the following simple program:
4126
4127 EOM
4128 $cat try.c >> try.msg
4129
4130 $cat >> try.msg <<EOM
4131
4132 I used the command:
4133
4134         $*
4135         ./try
4136
4137 and I got the following output:
4138
4139 EOM
4140 dflt=y
4141 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4142         if sh -c './try' >>try.msg 2>&1; then
4143                 xxx=`./try`
4144                 case "$xxx" in
4145                 "Ok") dflt=n ;;
4146                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4147                         case " $libs " in
4148                         *" -lsfio "*)
4149                                 cat >> try.msg <<'EOQS'
4150 If $libs contains -lsfio, and sfio is mis-configured, then it
4151 sometimes (apparently) runs and exits with a 0 status, but with no
4152 output!  It may have to do with sfio's use of _exit vs. exit.
4153
4154 EOQS
4155                                 rp="You have a big problem.  Shall I abort Configure"
4156                                 dflt=y
4157                                 ;;
4158                         esac
4159                         ;;
4160                 esac
4161         else
4162                 echo "The program compiled OK, but exited with status $?." >>try.msg
4163                 rp="You have a problem.  Shall I abort Configure"
4164                 dflt=y
4165         fi
4166 else
4167         echo "I can't compile the test program." >>try.msg
4168         rp="You have a BIG problem.  Shall I abort Configure"
4169         dflt=y
4170 fi
4171 case "$dflt" in
4172 y)
4173         $cat try.msg >&4
4174         case "$knowitall" in
4175         '')
4176                 echo "(The supplied flags or libraries might be incorrect.)"
4177                 ;;
4178         *) dflt=n;;
4179         esac
4180         echo " "
4181         . ./myread
4182         case "$ans" in
4183         n*|N*) ;;
4184         *)      echo "Ok.  Stopping Configure." >&4
4185                 exit 1
4186                 ;;
4187         esac
4188         ;;
4189 n) echo "OK, that should do.";;
4190 esac
4191 $rm -f try try.* core
4192
4193 : define an is-a-typedef? function
4194 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4195 case "$inclist" in
4196 "") inclist="sys/types.h";;
4197 esac;
4198 eval "varval=\$$var";
4199 case "$varval" in
4200 "")
4201         $rm -f temp.c;
4202         for inc in $inclist; do
4203                 echo "#include <$inc>" >>temp.c;
4204         done;
4205         echo "#ifdef $type" >> temp.c;
4206         echo "printf(\"We have $type\");" >> temp.c;
4207         echo "#endif" >> temp.c;
4208         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4209         if $contains $type temp.E >/dev/null 2>&1; then
4210                 eval "$var=\$type";
4211         else
4212                 eval "$var=\$def";
4213         fi;
4214         $rm -f temp.?;;
4215 *) eval "$var=\$varval";;
4216 esac'
4217
4218 : define an is-a-typedef? function that prompts if the type is not available.
4219 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4220 case "$inclist" in
4221 "") inclist="sys/types.h";;
4222 esac;
4223 eval "varval=\$$var";
4224 case "$varval" in
4225 "")
4226         $rm -f temp.c;
4227         for inc in $inclist; do
4228                 echo "#include <$inc>" >>temp.c;
4229         done;
4230         echo "#ifdef $type" >> temp.c;
4231         echo "printf(\"We have $type\");" >> temp.c;
4232         echo "#endif" >> temp.c;
4233         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4234         echo " " ;
4235         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4236         if $contains $type temp.E >/dev/null 2>&1; then
4237                 echo "$type found." >&4;
4238                 eval "$var=\$type";
4239         else
4240                 echo "$type NOT found." >&4;
4241                 dflt="$def";
4242                 . ./myread ;
4243                 eval "$var=\$ans";
4244         fi;
4245         $rm -f temp.?;;
4246 *) eval "$var=\$varval";;
4247 esac'
4248
4249 : define a shorthand compile call
4250 compile='
4251 mc_file=$1;
4252 shift;
4253 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4254 : define a shorthand compile call for compilations that should be ok.
4255 compile_ok='
4256 mc_file=$1;
4257 shift;
4258 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4259
4260 : check for lengths of integral types
4261 echo " "
4262 case "$intsize" in
4263 '')
4264         echo "Checking to see how big your integers are..." >&4
4265         $cat >intsize.c <<'EOCP'
4266 #include <stdio.h>
4267 int main()
4268 {
4269         printf("intsize=%d;\n", (int)sizeof(int));
4270         printf("longsize=%d;\n", (int)sizeof(long));
4271         printf("shortsize=%d;\n", (int)sizeof(short));
4272         exit(0);
4273 }
4274 EOCP
4275         set intsize
4276         if eval $compile_ok && ./intsize > /dev/null; then
4277                 eval `./intsize`
4278                 echo "Your integers are $intsize bytes long."
4279                 echo "Your long integers are $longsize bytes long."
4280                 echo "Your short integers are $shortsize bytes long."
4281         else
4282                 $cat >&4 <<EOM
4283 !
4284 Help! I can't compile and run the intsize test program: please enlighten me!
4285 (This is probably a misconfiguration in your system or libraries, and
4286 you really ought to fix it.  Still, I'll try anyway.)
4287 !
4288 EOM
4289                 dflt=4
4290                 rp="What is the size of an integer (in bytes)?"
4291                 . ./myread
4292                 intsize="$ans"
4293                 dflt=$intsize
4294                 rp="What is the size of a long integer (in bytes)?"
4295                 . ./myread
4296                 longsize="$ans"
4297                 dflt=2
4298                 rp="What is the size of a short integer (in bytes)?"
4299                 . ./myread
4300                 shortsize="$ans"
4301         fi
4302         ;;
4303 esac
4304 $rm -f intsize intsize.*
4305
4306 : see what type lseek is declared as in the kernel
4307 rp="What is the type used for lseek's offset on this system?"
4308 set off_t lseektype long stdio.h sys/types.h
4309 eval $typedef_ask
4310
4311 echo " "
4312 echo "Checking to see how big your file offsets are..." >&4
4313 $cat >try.c <<EOCP
4314 #include <sys/types.h>
4315 #include <stdio.h>
4316 int main()
4317 {
4318     printf("%d\n", (int)sizeof($lseektype));
4319     return(0); 
4320 }
4321 EOCP
4322 set try
4323 if eval $compile_ok; then
4324         lseeksize=`./try`
4325         echo "Your file offsets are $lseeksize bytes long."
4326 else
4327         dflt=$longsize
4328         echo " "
4329         echo "(I can't seem to compile the test program.  Guessing...)"
4330         rp="What is the size of your file offsets (in bytes)?"
4331         . ./myread
4332         lseeksize="$ans"
4333 fi
4334 $rm -f try.c try
4335
4336 : see what type file positions are declared as in the library
4337 rp="What is the type for file position used by fsetpos()?"
4338 set fpos_t fpostype long stdio.h sys/types.h
4339 eval $typedef_ask
4340
4341 echo " "
4342 case "$fpostype" in
4343 *_t) zzz="$fpostype"    ;;
4344 *)   zzz="fpos_t"       ;;
4345 esac
4346 echo "Checking the size of $zzz..." >&4 
4347 cat > try.c <<EOCP
4348 #include <sys/types.h>
4349 #include <stdio.h>
4350 int main() {
4351     printf("%d\n", (int)sizeof($fpostype));
4352     exit(0);
4353 }
4354 EOCP
4355 set try
4356 if eval $compile_ok; then
4357         yyy=`./try`
4358         case "$yyy" in
4359         '')     fpossize=4
4360                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4361                 ;;
4362         *)      fpossize=$yyy
4363                 echo "Your $zzz is $fpossize bytes long."
4364                 ;;
4365         esac
4366 else
4367         dflt="$longsize"
4368         echo " " >&4
4369         echo "(I can't compile the test program.  Guessing...)" >&4
4370         rp="What is the size of your file positions (in bytes)?"
4371         . ./myread
4372         fpossize="$ans"
4373 fi
4374
4375
4376
4377 # Backward compatibility (uselfs is deprecated).
4378 case "$uselfs" in
4379 "$define"|true|[yY]*)
4380         cat <<EOM >&4
4381
4382 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4383 EOM
4384         uselargefiles="$define"
4385         ;;
4386 esac                          
4387
4388 case "$lseeksize:$fpossize" in
4389 8:8) cat <<EOM
4390
4391 You can have files larger than 2 gigabytes.
4392 EOM
4393    val="$define" ;;
4394 *)    case "$uselargefiles" in
4395    "$undef"|false|[nN]*) dflt='n' ;;
4396    *)   dflt='y' ;;
4397    esac
4398    cat <<EOM
4399
4400 Perl can be built to understand large files (files larger than 2 gigabytes)
4401 on some systems.  To do so, Configure can be run with -Duselargefiles.
4402
4403 If this doesn't make any sense to you, just accept the default '$dflt'.
4404 EOM
4405    rp='Try to understand large files, if available?'
4406    . ./myread
4407    case "$ans" in
4408    y|Y)         val="$define" ;;
4409    *)           val="$undef"  ;;
4410    esac
4411    ;;
4412 esac
4413 set uselargefiles
4414 eval $setvar
4415 case "$uselargefiles" in
4416 "$define")
4417 : Look for a hint-file generated 'call-back-unit'.  If the
4418 : user has specified that a large files perl is to be built,
4419 : we may need to set or change some other defaults.
4420         if $test -f uselargefiles.cbu; then
4421                 echo "Your platform has some specific hints for large file builds, using them..."
4422                 . ./uselargefiles.cbu
4423                 echo " "
4424                 echo "Rechecking to see how big your file offsets are..." >&4
4425                 $cat >try.c <<EOCP
4426 #include <sys/types.h>
4427 #include <stdio.h>
4428 int main()
4429 {
4430     printf("%d\n", (int)sizeof($lseektype));
4431     return(0); 
4432 }
4433 EOCP
4434                 set try
4435                 if eval $compile_ok; then
4436                         lseeksize=`./try`
4437                         $echo "Your file offsets are now $lseeksize bytes long."
4438                 else
4439                         dflt="$lseeksize"
4440                         echo " "
4441                         echo "(I can't seem to compile the test program.  Guessing...)"
4442                         rp="What is the size of your file offsets (in bytes)?"
4443                         . ./myread
4444                         lseeksize="$ans"
4445                 fi
4446                 case "$fpostype" in
4447                 *_t) zzz="$fpostype"    ;;
4448                 *)   zzz="fpos_t"       ;;
4449                 esac
4450                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4451                 $cat > try.c <<EOCP
4452 #include <sys/types.h>
4453 #include <stdio.h>
4454 int main() {
4455     printf("%d\n", (int)sizeof($fpostype));
4456     exit(0);
4457 }
4458 EOCP
4459                 set try
4460                 if eval $compile_ok; then
4461                         yyy=`./try`
4462                         dflt="$lseeksize"
4463                         case "$yyy" in
4464                         '')     echo " "
4465                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4466                                 ;;
4467                         *)      fpossize=$yyy
4468                                 echo " $fpossize bytes." >&4
4469                                 ;;
4470                         esac
4471                 else
4472                         dflt="$fpossize"
4473                         echo " "
4474                         echo "(I can't compile the test program.  Guessing...)" >&4
4475                         rp="What is the size of your file positions (in bytes)?"
4476                         . ./myread
4477                         fpossize="$ans"
4478                 fi
4479                 $rm -f try.c try
4480         fi
4481         ;;
4482 esac
4483
4484
4485 case "$usemorebits" in
4486 "$define"|true|[yY]*)
4487         use64bitint="$define"
4488         uselongdouble="$define"
4489         usemorebits="$define"
4490         ;;
4491 *)      usemorebits="$undef"
4492         ;;
4493 esac
4494
4495
4496 case "$uselonglong" in
4497 "$define"|true|[yY]*)
4498         cat <<EOM >&4
4499
4500 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4501 EOM
4502         use64bitint="$define"
4503         ;;
4504 esac                          
4505 case "$use64bits" in
4506 "$define"|true|[yY]*)
4507         cat <<EOM >&4
4508
4509 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4510 EOM
4511         use64bitint="$define"
4512         ;;
4513 esac                          
4514 case "$use64bitints" in
4515 "$define"|true|[yY]*)
4516         cat <<EOM >&4
4517
4518 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4519 EOM
4520         use64bitint="$define"
4521         ;;
4522 esac                          
4523 case "$use64bitsint" in
4524 "$define"|true|[yY]*)
4525         cat <<EOM >&4
4526
4527 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4528 EOM
4529         use64bitint="$define"
4530         ;;
4531 esac                          
4532 case "$uselonglongs" in
4533 "$define"|true|[yY]*)
4534         cat <<EOM >&4
4535
4536 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4537 EOM
4538         use64bitint="$define"
4539         ;;
4540 esac                          
4541 case "$use64bitsall" in
4542 "$define"|true|[yY]*)
4543         cat <<EOM >&4
4544
4545 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4546 EOM
4547         use64bitall="$define"
4548         ;;
4549 esac                          
4550
4551 case "$ccflags" in
4552 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4553 esac
4554 case "$use64bitall" in
4555 "$define"|true|[yY]*) use64bitint="$define" ;;
4556 esac
4557
4558 case "$longsize" in
4559 8) cat <<EOM
4560
4561 You have natively 64-bit long integers.
4562 EOM
4563    val="$define"
4564    ;;
4565 *) case "$use64bitint" in
4566    "$define"|true|[yY]*) dflt='y';;
4567    *) dflt='n';;
4568    esac
4569    cat <<EOM
4570
4571 Perl can be built to take advantage of 64-bit integer types
4572 on some systems.  To do so, Configure can be run with -Duse64bitint.
4573 Choosing this option will most probably introduce binary incompatibilities.
4574
4575 If this doesn't make any sense to you, just accept the default '$dflt'.
4576 EOM
4577    rp='Try to use 64-bit integers, if available?'
4578    . ./myread
4579    case "$ans" in
4580    [yY]*) val="$define" ;;
4581    *)     val="$undef"  ;;
4582    esac
4583    ;;
4584 esac
4585 set use64bitint
4586 eval $setvar
4587
4588 case "$use64bitall" in
4589 "$define"|true|[yY]*) dflt='y' ;;
4590 *) case "$longsize" in
4591    8) dflt='y' ;;
4592    *) dflt='n' ;;
4593    esac
4594    ;;
4595 esac    
4596 cat <<EOM
4597
4598 You may also choose to try maximal 64-bitness.  It means using as much
4599 64-bitness as possible on the platform.  This in turn means even more
4600 binary incompatibilities.  On the other hand, your platform may not
4601 have any more 64-bitness available than what you already have chosen.
4602
4603 If this doesn't make any sense to you, just accept the default '$dflt'.
4604 EOM
4605 rp='Try to use maximal 64-bit support, if available?'
4606 . ./myread
4607 case "$ans" in
4608 [yY]*) val="$define" ;;
4609 *)     val="$undef"  ;;
4610 esac
4611 set use64bitall
4612 eval $setvar
4613 case "$use64bitall" in
4614 "$define")
4615         case "$use64bitint" in
4616         "$undef")
4617                 cat <<EOM
4618
4619 Since you have chosen a maximally 64-bit build, I'm also turning on
4620 the use of 64-bit integers.
4621 EOM
4622                 use64bitint="$define" ;;
4623         esac
4624         ;;
4625 esac
4626
4627 case "$use64bitint" in
4628 "$define"|true|[yY]*)
4629 : Look for a hint-file generated 'call-back-unit'.  If the
4630 : user has specified that a 64-bit perl is to be built,
4631 : we may need to set or change some other defaults.
4632         if $test -f use64bitint.cbu; then
4633                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4634                 . ./use64bitint.cbu
4635         fi
4636         case "$longsize" in
4637         4) case "$archname64" in
4638            '') archname64=64int ;;
4639            esac
4640            ;;
4641         esac
4642         ;;
4643 esac
4644
4645 case "$use64bitall" in
4646 "$define"|true|[yY]*)
4647 : Look for a hint-file generated 'call-back-unit'.  If the
4648 : user has specified that a maximally 64-bit perl is to be built,
4649 : we may need to set or change some other defaults.
4650         if $test -f use64bitall.cbu; then
4651                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4652                 . ./use64bitall.cbu
4653         fi
4654         case "$longsize" in
4655         4) case "$archname64" in
4656            ''|64int) archname64=64all ;;
4657            esac
4658            ;;
4659         esac
4660         ;;
4661 esac
4662
4663 echo " "
4664 echo "Checking for GNU C Library..." >&4
4665 cat >gnulibc.c <<EOM
4666 #include <stdio.h>
4667 int main()
4668 {
4669 #ifdef __GLIBC__
4670     exit(0);
4671 #else
4672     exit(1);
4673 #endif
4674 }
4675 EOM
4676 set gnulibc
4677 if eval $compile_ok && ./gnulibc; then
4678         val="$define"
4679         echo "You are using the GNU C Library"
4680 else
4681         val="$undef"
4682         echo "You are not using the GNU C Library"
4683 fi
4684 $rm -f gnulibc*
4685 set d_gnulibc
4686 eval $setvar
4687
4688 : see if nm is to be used to determine whether a symbol is defined or not
4689 case "$usenm" in
4690 '')
4691         dflt=''
4692         case "$d_gnulibc" in
4693         "$define")
4694                 echo " "
4695                 echo "nm probably won't work on the GNU C Library." >&4
4696                 dflt=n
4697                 ;;
4698         esac
4699         case "$dflt" in
4700         '') 
4701                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4702                         echo " "
4703                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4704                         echo "'nm' won't be sufficient on this sytem." >&4
4705                         dflt=n
4706                 fi
4707                 ;;
4708         esac
4709         case "$dflt" in
4710         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4711                 if $test $dflt -gt 20; then
4712                         dflt=y
4713                 else
4714                         dflt=n
4715                 fi
4716                 ;;
4717         esac
4718         ;;
4719 *)
4720         case "$usenm" in
4721         true|$define) dflt=y;;
4722         *) dflt=n;;
4723         esac
4724         ;;
4725 esac
4726 $cat <<EOM
4727
4728 I can use $nm to extract the symbols from your C libraries. This
4729 is a time consuming task which may generate huge output on the disk (up
4730 to 3 megabytes) but that should make the symbols extraction faster. The
4731 alternative is to skip the 'nm' extraction part and to compile a small
4732 test program instead to determine whether each symbol is present. If
4733 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4734 this may be the best solution.
4735
4736 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4737
4738 EOM
4739 rp="Shall I use $nm to extract C symbols from the libraries?"
4740 . ./myread
4741 case "$ans" in
4742 [Nn]*) usenm=false;;
4743 *) usenm=true;;
4744 esac
4745
4746 runnm=$usenm
4747 case "$reuseval" in
4748 true) runnm=false;;
4749 esac
4750
4751 : nm options which may be necessary
4752 case "$nm_opt" in
4753 '') if $test -f /mach_boot; then
4754                 nm_opt=''       # Mach
4755         elif $test -d /usr/ccs/lib; then
4756                 nm_opt='-p'     # Solaris (and SunOS?)
4757         elif $test -f /dgux; then
4758                 nm_opt='-p'     # DG-UX
4759         elif $test -f /lib64/rld; then
4760                 nm_opt='-p'     # 64-bit Irix
4761         else
4762                 nm_opt=''
4763         fi;;
4764 esac
4765
4766 : nm options which may be necessary for shared libraries but illegal
4767 : for archive libraries.  Thank you, Linux.
4768 case "$nm_so_opt" in
4769 '')     case "$myuname" in
4770         *linux*)
4771                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4772                         nm_so_opt='--dynamic'
4773                 fi
4774                 ;;
4775         esac
4776         ;;
4777 esac
4778
4779 case "$runnm" in
4780 true)
4781 : get list of predefined functions in a handy place
4782 echo " "
4783 case "$libc" in
4784 '') libc=unknown
4785         case "$libs" in
4786         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4787         esac
4788         ;;
4789 esac
4790 libnames='';
4791 case "$libs" in
4792 '') ;;
4793 *)  for thislib in $libs; do
4794         case "$thislib" in
4795         -lc|-lc_s)
4796                 : Handle C library specially below.
4797                 ;;
4798         -l*)
4799                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4800                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4801                         :
4802                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4803                         :
4804                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4805                         :
4806                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4807                         :
4808                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4809                         :
4810                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4811                         :
4812                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4813                         :
4814                 else
4815                         try=''
4816                 fi
4817                 libnames="$libnames $try"
4818                 ;;
4819         *) libnames="$libnames $thislib" ;;
4820         esac
4821         done
4822         ;;
4823 esac
4824 xxx=normal
4825 case "$libc" in
4826 unknown)
4827         set /lib/libc.$so
4828         for xxx in $libpth; do
4829                 $test -r $1 || set $xxx/libc.$so
4830                 : The messy sed command sorts on library version numbers.
4831                 $test -r $1 || \
4832                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4833                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4834                                 h
4835                                 s/[0-9][0-9]*/0000&/g
4836                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4837                                 G
4838                                 s/\n/ /' | \
4839                          $sort | $sed -e 's/^.* //'`
4840                 eval set \$$#
4841         done
4842         $test -r $1 || set /usr/ccs/lib/libc.$so
4843         $test -r $1 || set /lib/libsys_s$_a
4844         ;;
4845 *)
4846         set blurfl
4847         ;;
4848 esac
4849 if $test -r "$1"; then
4850         echo "Your (shared) C library seems to be in $1."
4851         libc="$1"
4852 elif $test -r /lib/libc && $test -r /lib/clib; then
4853         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4854         xxx=apollo
4855         libc='/lib/clib /lib/libc'
4856         if $test -r /lib/syslib; then
4857                 echo "(Your math library is in /lib/syslib.)"
4858                 libc="$libc /lib/syslib"
4859         fi
4860 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4861         echo "Your C library seems to be in $libc, as you said before."
4862 elif $test -r $incpath/usr/lib/libc$_a; then
4863         libc=$incpath/usr/lib/libc$_a;
4864         echo "Your C library seems to be in $libc.  That's fine."
4865 elif $test -r /lib/libc$_a; then
4866         libc=/lib/libc$_a;
4867         echo "Your C library seems to be in $libc.  You're normal."
4868 else
4869         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4870                 :
4871         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4872                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4873         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4874                 :
4875         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4876                 :
4877         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4878                 :
4879         else
4880                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4881         fi
4882         if $test -r "$tans"; then
4883                 echo "Your C library seems to be in $tans, of all places."
4884                 libc=$tans
4885         else
4886                 libc='blurfl'
4887         fi
4888 fi
4889 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4890         dflt="$libc"
4891         cat <<EOM
4892
4893 If the guess above is wrong (which it might be if you're using a strange
4894 compiler, or your machine supports multiple models), you can override it here.
4895
4896 EOM
4897 else
4898         dflt=''
4899         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4900         cat >&4 <<EOM
4901 I can't seem to find your C library.  I've looked in the following places:
4902
4903 EOM
4904         $sed 's/^/      /' libpath
4905         cat <<EOM
4906
4907 None of these seems to contain your C library. I need to get its name...
4908
4909 EOM
4910 fi
4911 fn=f
4912 rp='Where is your C library?'
4913 . ./getfile
4914 libc="$ans"
4915
4916 echo " "
4917 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4918 set X `cat libnames`
4919 shift
4920 xxx=files
4921 case $# in 1) xxx=file; esac
4922 echo "Extracting names from the following $xxx for later perusal:" >&4
4923 echo " "
4924 $sed 's/^/      /' libnames >&4
4925 echo " "
4926 $echo $n "This may take a while...$c" >&4
4927
4928 for file in $*; do
4929         case $file in
4930         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4931         *) $nm $nm_opt $file 2>/dev/null;;
4932         esac
4933 done >libc.tmp
4934
4935 $echo $n ".$c"
4936 $grep fprintf libc.tmp > libc.ptf
4937 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4938 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4939 xxx='[ADTSIW]'
4940 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4941         eval $xscan;\
4942         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4943                 eval $xrun
4944 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4945         eval $xscan;\
4946         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4947                 eval $xrun
4948 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4949         eval $xscan;\
4950         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4951                 eval $xrun
4952 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4953         eval $xscan;\
4954         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4955                 eval $xrun
4956 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4957         eval $xscan;\
4958         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4959                 eval $xrun
4960 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4961         eval $xscan;\
4962         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4963                 eval $xrun
4964 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4965                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4966         eval $xscan;\
4967         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4968                 eval $xrun
4969 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4970         eval $xscan;\
4971         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4972                 eval $xrun
4973 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4974         eval $xscan;\
4975         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4976                 eval $xrun
4977 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4978         eval $xscan;\
4979         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4980                 eval $xrun
4981 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4982         eval $xscan;\
4983         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4984                 eval $xrun
4985 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4986         eval $xscan;\
4987         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4988                 eval $xrun
4989 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4990         eval $xscan;\
4991         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4992                 eval $xrun
4993 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4994         eval $xscan;\
4995         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4996                 eval $xrun
4997 else
4998         $nm -p $* 2>/dev/null >libc.tmp
4999         $grep fprintf libc.tmp > libc.ptf
5000         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5001                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5002         then
5003                 nm_opt='-p'
5004                 eval $xrun
5005         else
5006                 echo " "
5007                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5008                 com=''
5009                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5010                         for thisname in $libnames $libc; do
5011                                 $ar t $thisname >>libc.tmp
5012                         done
5013                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5014                         echo "Ok." >&4
5015                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5016                         # Repeat libc to extract forwarders to DLL entries too
5017                         for thisname in $libnames $libc; do
5018                                 $ar tv $thisname >>libc.tmp
5019                                 # Revision 50 of EMX has bug in $ar.
5020                                 # it will not extract forwarders to DLL entries
5021                                 # Use emximp which will extract exactly them.
5022                                 emximp -o tmp.imp $thisname \
5023                                     2>/dev/null && \
5024                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5025                                     < tmp.imp >>libc.tmp
5026                                 $rm tmp.imp
5027                         done
5028                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5029                         echo "Ok." >&4
5030                 else
5031                         echo "$ar didn't seem to work right." >&4
5032                         echo "Maybe this is a Cray...trying bld instead..." >&4
5033                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5034                         then
5035                                 for thisname in $libnames; do
5036                                         bld t $libnames | \
5037                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5038                                         $ar t $thisname >>libc.tmp
5039                                 done
5040                                 echo "Ok." >&4
5041                         else
5042                                 echo "That didn't work either.  Giving up." >&4
5043                                 exit 1
5044                         fi
5045                 fi
5046         fi
5047 fi
5048 nm_extract="$com"
5049 if $test -f /lib/syscalls.exp; then
5050         echo " "
5051         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5052         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5053 fi
5054 ;;
5055 esac
5056 $rm -f libnames libpath
5057
5058 : is a C symbol defined?
5059 csym='tlook=$1;
5060 case "$3" in
5061 -v) tf=libc.tmp; tc=""; tdc="";;
5062 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5063 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5064 esac;
5065 tx=yes;
5066 case "$reuseval-$4" in
5067 true-) ;;
5068 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5069 esac;
5070 case "$tx" in
5071 yes)
5072         case "$runnm" in
5073         true)
5074                 if $contains $tlook $tf >/dev/null 2>&1;
5075                 then tval=true;
5076                 else tval=false;
5077                 fi;;
5078         *)
5079                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5080                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5081                 then tval=true;
5082                 else tval=false;
5083                 fi;
5084                 $rm -f t t.c;;
5085         esac;;
5086 *)
5087         case "$tval" in
5088         $define) tval=true;;
5089         *) tval=false;;
5090         esac;;
5091 esac;
5092 eval "$2=$tval"'
5093
5094 : define an is-in-libc? function
5095 inlibc='echo " "; td=$define; tu=$undef;
5096 sym=$1; var=$2; eval "was=\$$2";
5097 tx=yes;
5098 case "$reuseval$was" in
5099 true) ;;
5100 true*) tx=no;;
5101 esac;
5102 case "$tx" in
5103 yes)
5104         set $sym tres -f;
5105         eval $csym;
5106         case "$tres" in
5107         true)
5108                 echo "$sym() found." >&4;
5109                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5110         *)
5111                 echo "$sym() NOT found." >&4;
5112                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5113         esac;;
5114 *)
5115         case "$was" in
5116         $define) echo "$sym() found." >&4;;
5117         *) echo "$sym() NOT found." >&4;;
5118         esac;;
5119 esac'
5120
5121 : see if sqrtl exists
5122 set sqrtl d_sqrtl
5123 eval $inlibc
5124
5125 case "$ccflags" in
5126 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5127 esac
5128
5129 case "$uselongdouble" in
5130 $define|true|[yY]*)     dflt='y';;
5131 *) dflt='n';;
5132 esac
5133 cat <<EOM
5134
5135 Perl can be built to take advantage of long doubles which
5136 (if available) may give more accuracy and range for floating point numbers.
5137
5138 If this doesn't make any sense to you, just accept the default '$dflt'.
5139 EOM
5140 rp='Try to use long doubles if available?'
5141 . ./myread
5142 case "$ans" in
5143 y|Y)    val="$define"   ;;
5144 *)      val="$undef"    ;;
5145 esac
5146 set uselongdouble
5147 eval $setvar
5148
5149 case "$uselongdouble" in
5150 true|[yY]*) uselongdouble="$define" ;;
5151 esac
5152
5153 case "$uselongdouble" in
5154 $define)
5155 : Look for a hint-file generated 'call-back-unit'.  If the
5156 : user has specified that long doubles should be used,
5157 : we may need to set or change some other defaults.
5158         if $test -f uselongdouble.cbu; then
5159                 echo "Your platform has some specific hints for long doubles, using them..."
5160                 . ./uselongdouble.cbu
5161         else
5162                 $cat <<EOM
5163 (Your platform doesn't have any specific hints for long doubles.)
5164 EOM
5165         fi
5166         ;;
5167 esac
5168
5169 case "$uselongdouble:$d_sqrtl" in
5170 $define:$undef)
5171                 $cat <<EOM >&4
5172
5173 *** You requested the use of long doubles but you do not seem to have
5174 *** the mathematic functions for long doubles.  I'm disabling the use
5175 *** of long doubles.
5176
5177 EOM
5178         uselongdouble=$undef
5179         ;;
5180 esac
5181
5182 : check for length of double
5183 echo " "
5184 case "$doublesize" in
5185 '')
5186         echo "Checking to see how big your double precision numbers are..." >&4
5187         $cat >try.c <<'EOCP'
5188 #include <stdio.h>
5189 int main()
5190 {
5191     printf("%d\n", (int)sizeof(double));
5192     exit(0);
5193 }
5194 EOCP
5195         set try
5196         if eval $compile_ok; then
5197                 doublesize=`./try`
5198                 echo "Your double is $doublesize bytes long."
5199         else
5200                 dflt='8'
5201                 echo "(I can't seem to compile the test program.  Guessing...)"
5202                 rp="What is the size of a double precision number (in bytes)?"
5203                 . ./myread
5204                 doublesize="$ans"
5205         fi
5206         ;;
5207 esac
5208 $rm -f try.c try
5209
5210 : check for long doubles
5211 echo " "
5212 echo "Checking to see if you have long double..." >&4
5213 echo 'int main() { long double x = 7.0; }' > try.c
5214 set try
5215 if eval $compile; then
5216         val="$define"
5217         echo "You have long double."
5218 else
5219         val="$undef"
5220         echo "You do not have long double."
5221 fi
5222 $rm try.*
5223 set d_longdbl
5224 eval $setvar
5225
5226 : check for length of long double
5227 case "${d_longdbl}${longdblsize}" in
5228 $define)
5229         echo " "
5230         echo "Checking to see how big your long doubles are..." >&4
5231         $cat >try.c <<'EOCP'
5232 #include <stdio.h>
5233 int main()
5234 {
5235         printf("%d\n", sizeof(long double));
5236 }
5237 EOCP
5238         set try
5239         set try
5240         if eval $compile; then
5241                 longdblsize=`./try$exe_ext`
5242                 echo "Your long doubles are $longdblsize bytes long."
5243         else
5244                 dflt='8'
5245                 echo " "
5246                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5247                 rp="What is the size of a long double (in bytes)?"
5248                 . ./myread
5249                 longdblsize="$ans"
5250         fi
5251         if $test "X$doublesize" = "X$longdblsize"; then
5252                 echo "(That isn't any different from an ordinary double.)"
5253         fi      
5254         ;;
5255 esac
5256 $rm -f try.* try
5257
5258 : determine the architecture name
5259 echo " "
5260 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5261         tarch=`arch`"-$osname"
5262 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5263         if uname -m > tmparch 2>&1 ; then
5264                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5265                         -e 's/$/'"-$osname/" tmparch`
5266         else
5267                 tarch="$osname"
5268         fi
5269         $rm -f tmparch
5270 else
5271         tarch="$osname"
5272 fi
5273 case "$myarchname" in
5274 ''|"$tarch") ;;
5275 *)
5276         echo "(Your architecture name used to be $myarchname.)"
5277         archname=''
5278         ;;
5279 esac
5280 myarchname="$tarch"
5281 case "$archname" in
5282 '') dflt="$tarch";;
5283 *) dflt="$archname";;
5284 esac
5285 rp='What is your architecture name'
5286 . ./myread
5287 archname="$ans"
5288 case "$usethreads" in
5289 $define)
5290         echo "Threads selected." >&4
5291         case "$archname" in
5292         *-thread*) echo "...and architecture name already has -thread." >&4
5293                 ;;
5294         *)      archname="$archname-thread"
5295                 echo "...setting architecture name to $archname." >&4
5296                 ;;
5297         esac
5298         ;;
5299 esac
5300 case "$usemultiplicity" in
5301 $define)
5302         echo "Multiplicity selected." >&4
5303         case "$archname" in
5304         *-multi*) echo "...and architecture name already has -multi." >&4
5305                 ;;
5306         *)      archname="$archname-multi"
5307                 echo "...setting architecture name to $archname." >&4
5308                 ;;
5309         esac
5310         ;;
5311 esac
5312 case "$use64bitint$use64bitall" in
5313 *"$define"*)
5314         case "$archname64" in
5315         '')
5316                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5317                 ;;
5318         *)
5319                 case "$use64bitint" in
5320                 "$define") echo "64 bit integers selected." >&4 ;;
5321                 esac
5322                 case "$use64bitall" in
5323                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5324                 esac
5325                 case "$archname" in
5326                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5327                         ;;
5328                 *)      archname="$archname-$archname64"
5329                         echo "...setting architecture name to $archname." >&4
5330                         ;;
5331                 esac
5332                 ;;
5333         esac
5334 esac
5335 case "$uselongdouble" in
5336 $define)
5337         echo "Long doubles selected." >&4
5338         case "$longdblsize" in
5339         $doublesize)
5340                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5341                 ;;
5342         *)
5343                 case "$archname" in
5344                 *-ld*) echo "...and architecture name already has -ld." >&4
5345                         ;;
5346                 *)      archname="$archname-ld"
5347                         echo "...setting architecture name to $archname." >&4
5348                         ;;
5349                 esac
5350                 ;;
5351         esac
5352         ;;
5353 esac
5354
5355 : determine root of directory hierarchy where package will be installed.
5356 case "$prefix" in
5357 '')
5358         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5359         ;;
5360 *)
5361         dflt="$prefix"
5362         ;;
5363 esac
5364 $cat <<EOM
5365
5366 By default, $package will be installed in $dflt/bin, manual pages
5367 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5368 installation directories. Typically this is something like /usr/local.
5369 If you wish to have binaries under /usr/bin but other parts of the
5370 installation under /usr/local, that's ok: you will be prompted
5371 separately for each of the installation directories, the prefix being
5372 only used to set the defaults.
5373
5374 EOM
5375 fn=d~
5376 rp='Installation prefix to use?'
5377 . ./getfile
5378 oldprefix=''
5379 case "$prefix" in
5380 '') ;;
5381 *)
5382         case "$ans" in
5383         "$prefix") ;;
5384         *) oldprefix="$prefix";;
5385         esac
5386         ;;
5387 esac
5388 prefix="$ans"
5389 prefixexp="$ansexp"
5390
5391 : is AFS running?
5392 echo " "
5393 case "$afs" in
5394 $define|true)   afs=true ;;
5395 $undef|false)   afs=false ;;
5396 *)      if test -d /afs; then
5397                 afs=true
5398         else
5399                 afs=false
5400         fi
5401         ;;
5402 esac
5403 if $afs; then
5404         echo "AFS may be running... I'll be extra cautious then..." >&4
5405 else
5406         echo "AFS does not seem to be running..." >&4
5407 fi
5408
5409 : determine installation prefix for where package is to be installed.
5410 if $afs; then 
5411 $cat <<EOM
5412
5413 Since you are running AFS, I need to distinguish the directory in which
5414 files will reside from the directory in which they are installed (and from
5415 which they are presumably copied to the former directory by occult means).
5416
5417 EOM
5418         case "$installprefix" in
5419         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5420         *) dflt="$installprefix";;
5421         esac
5422 else
5423 $cat <<EOM
5424
5425 In some special cases, particularly when building $package for distribution,
5426 it is convenient to distinguish between the directory in which files should 
5427 be installed from the directory ($prefix) in which they 
5428 will eventually reside.  For most users, these two directories are the same.
5429
5430 EOM
5431         case "$installprefix" in
5432         '') dflt=$prefix ;;
5433         *) dflt=$installprefix;;
5434         esac
5435 fi
5436 fn=d~
5437 rp='What installation prefix should I use for installing files?'
5438 . ./getfile
5439 installprefix="$ans"
5440 installprefixexp="$ansexp"
5441
5442 : set the prefixit variable, to compute a suitable default value
5443 prefixit='case "$3" in
5444 ""|none)
5445         case "$oldprefix" in
5446         "") eval "$1=\"\$$2\"";;
5447         *)
5448                 case "$3" in
5449                 "") eval "$1=";;
5450                 none)
5451                         eval "tp=\"\$$2\"";
5452                         case "$tp" in
5453                         ""|" ") eval "$1=\"\$$2\"";;
5454                         *) eval "$1=";;
5455                         esac;;
5456                 esac;;
5457         esac;;
5458 *)
5459         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5460         case "$tp" in
5461         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5462         /*-$oldprefix/*|\~*-$oldprefix/*)
5463                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5464         *) eval "$1=\"\$$2\"";;
5465         esac;;
5466 esac'
5467
5468
5469 : get the patchlevel
5470 echo " "
5471 echo "Getting the current patchlevel..." >&4
5472 if $test -r $rsrc/patchlevel.h;then
5473         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5474         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5475         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5476         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5477         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5478         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5479 else
5480         revision=0
5481         patchlevel=0
5482         subversion=0
5483         api_revision=0
5484         api_version=0
5485         api_subversion=0
5486 fi
5487 $echo "(You have $package version $patchlevel subversion $subversion.)"
5488 case "$osname" in
5489 dos|vms)
5490         : XXX Should be a Configure test for double-dots in filenames.
5491         version=`echo $revision $patchlevel $subversion | \
5492                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5493         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5494                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5495         ;;
5496 *)
5497         version=`echo $revision $patchlevel $subversion | \
5498                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5499         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5500                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5501         ;;
5502 esac
5503 : Special case the 5.005_xx maintenance series, which used 5.005
5504 : without any subversion label as a subdirectory in $sitelib
5505 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5506         api_versionstring='5.005'
5507 fi
5508
5509 : determine installation style
5510 : For now, try to deduce it from prefix unless it is already set.
5511 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5512 case "$installstyle" in
5513 '')     case "$prefix" in
5514                 *perl*) dflt='lib';;
5515                 *) dflt='lib/perl5' ;;
5516         esac
5517         ;;
5518 *)      dflt="$installstyle" ;;
5519 esac
5520 : Probably not worth prompting for this since we prompt for all
5521 : the directories individually, and the prompt would be too long and
5522 : confusing anyway.
5523 installstyle=$dflt
5524
5525 : determine where private library files go
5526 : Usual default is /usr/local/lib/perl5/$version.
5527 : Also allow things like /opt/perl/lib/$version, since 
5528 : /opt/perl/lib/perl5... would be redundant.
5529 : The default "style" setting is made in installstyle.U
5530 case "$installstyle" in
5531 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5532 *)       set dflt privlib lib/$version ;;
5533 esac
5534 eval $prefixit
5535 $cat <<EOM
5536
5537 There are some auxiliary files for $package that need to be put into a
5538 private library directory that is accessible by everyone.
5539
5540 EOM
5541 fn=d~+
5542 rp='Pathname where the private library files will reside?'
5543 . ./getfile
5544 privlib="$ans"
5545 privlibexp="$ansexp"
5546 : Change installation prefix, if necessary.
5547 if $test X"$prefix" != X"$installprefix"; then
5548         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5549 else
5550         installprivlib="$privlibexp"
5551 fi
5552
5553 : set the prefixup variable, to restore leading tilda escape
5554 prefixup='case "$prefixexp" in
5555 "$prefix") ;;
5556 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5557 esac'
5558
5559 : determine where public architecture dependent libraries go
5560 set archlib archlib
5561 eval $prefixit
5562 : privlib default is /usr/local/lib/$package/$version
5563 : archlib default is /usr/local/lib/$package/$version/$archname
5564 : privlib may have an optional trailing /share.
5565 tdflt=`echo $privlib | $sed 's,/share$,,'`
5566 tdflt=$tdflt/$archname
5567 case "$archlib" in
5568 '')     dflt=$tdflt
5569         ;;
5570 *)      dflt="$archlib"
5571     ;;
5572 esac
5573 $cat <<EOM
5574
5575 $spackage contains architecture-dependent library files.  If you are
5576 sharing libraries in a heterogeneous environment, you might store
5577 these files in a separate location.  Otherwise, you can just include
5578 them with the rest of the public library files.
5579
5580 EOM
5581 fn=d+~
5582 rp='Where do you want to put the public architecture-dependent libraries?'
5583 . ./getfile
5584 archlib="$ans"
5585 archlibexp="$ansexp"
5586 if $test X"$archlib" = X"$privlib"; then
5587         d_archlib="$undef"
5588 else
5589         d_archlib="$define"
5590 fi
5591 : Change installation prefix, if necessary.
5592 if $test X"$prefix" != X"$installprefix"; then
5593         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5594 else
5595         installarchlib="$archlibexp"
5596 fi
5597
5598
5599 : Binary compatibility with 5.005 is not possible for builds
5600 : with advanced features
5601 case "$usethreads$usemultiplicity" in
5602 *define*)
5603         bincompat5005="$undef"
5604         d_bincompat5005="$undef"
5605         ;;
5606 *)      $cat <<EOM
5607
5608 This version of Perl can be compiled for binary compatibility with 5.005.
5609 If you decide to do so, you will be able to continue using most of the
5610 extensions that were compiled for Perl 5.005.
5611
5612 EOM
5613         case "$bincompat5005$d_bincompat5005" in
5614         *"$undef"*) dflt=n ;;
5615         *) dflt=y ;;
5616         esac
5617         rp='Binary compatibility with Perl 5.005?'
5618         . ./myread
5619         case "$ans" in
5620         y*) val="$define" ;;
5621         *)  val="$undef" ;;
5622         esac
5623         set d_bincompat5005
5624         eval $setvar
5625         case "$d_bincompat5005" in
5626         "$define")
5627                 bincompat5005="$define"
5628                 ;;
5629         *)      bincompat5005="$undef"
5630                 d_bincompat5005="$undef"
5631                 ;;
5632         esac
5633         ;;
5634 esac
5635
5636
5637 : see if setuid scripts can be secure
5638 $cat <<EOM
5639
5640 Some kernels have a bug that prevents setuid #! scripts from being
5641 secure.  Some sites have disabled setuid #! scripts because of this.
5642
5643 First let's decide if your kernel supports secure setuid #! scripts.
5644 (If setuid #! scripts would be secure but have been disabled anyway,
5645 don't say that they are secure if asked.)
5646
5647 EOM
5648
5649 val="$undef"
5650 if $test -d /dev/fd; then
5651         echo "#!$ls" >reflect
5652         chmod +x,u+s reflect
5653         ./reflect >flect 2>&1
5654         if $contains "/dev/fd" flect >/dev/null; then
5655                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5656                 val="$define"
5657         else
5658                 $cat <<EOM
5659 If you are not sure if they are secure, I can check but I'll need a
5660 username and password different from the one you are using right now.
5661 If you don't have such a username or don't want me to test, simply
5662 enter 'none'.
5663
5664 EOM
5665                 rp='Other username to test security of setuid scripts with?'
5666                 dflt='none'
5667                 . ./myread
5668                 case "$ans" in
5669                 n|none)
5670                         case "$d_suidsafe" in
5671                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5672                                 dflt=n;;
5673                         "$undef")
5674                                 echo "Well, the $hint value is *not* secure." >&4
5675                                 dflt=n;;
5676                         *)      echo "Well, the $hint value *is* secure." >&4
5677                                 dflt=y;;
5678                         esac
5679                         ;;
5680                 *)
5681                         $rm -f reflect flect
5682                         echo "#!$ls" >reflect
5683                         chmod +x,u+s reflect
5684                         echo >flect
5685                         chmod a+w flect
5686                         echo '"su" will (probably) prompt you for '"$ans's password."
5687                         su $ans -c './reflect >flect'
5688                         if $contains "/dev/fd" flect >/dev/null; then
5689                                 echo "Okay, it looks like setuid scripts are secure." >&4
5690                                 dflt=y
5691                         else
5692                                 echo "I don't think setuid scripts are secure." >&4
5693                                 dflt=n
5694                         fi
5695                         ;;
5696                 esac
5697                 rp='Does your kernel have *secure* setuid scripts?'
5698                 . ./myread
5699                 case "$ans" in
5700                 [yY]*)  val="$define";;
5701                 *)      val="$undef";;
5702                 esac
5703         fi
5704 else
5705         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5706         echo "(That's for file descriptors, not floppy disks.)"
5707         val="$undef"
5708 fi
5709 set d_suidsafe
5710 eval $setvar
5711
5712 $rm -f reflect flect
5713
5714 : now see if they want to do setuid emulation
5715 echo " "
5716 val="$undef"
5717 case "$d_suidsafe" in
5718 "$define")
5719         val="$undef"
5720         echo "No need to emulate SUID scripts since they are secure here." >& 4
5721         ;;
5722 *)
5723         $cat <<EOM
5724 Some systems have disabled setuid scripts, especially systems where
5725 setuid scripts cannot be secure.  On systems where setuid scripts have
5726 been disabled, the setuid/setgid bits on scripts are currently
5727 useless.  It is possible for $package to detect those bits and emulate
5728 setuid/setgid in a secure fashion.  This emulation will only work if
5729 setuid scripts have been disabled in your kernel.
5730
5731 EOM
5732         case "$d_dosuid" in
5733         "$define") dflt=y ;;
5734         *) dflt=n ;;
5735         esac
5736         rp="Do you want to do setuid/setgid emulation?"
5737         . ./myread
5738         case "$ans" in
5739         [yY]*)  val="$define";;
5740         *)      val="$undef";;
5741         esac
5742         ;;
5743 esac
5744 set d_dosuid
5745 eval $setvar
5746
5747 : determine filename position in cpp output
5748 echo " "
5749 echo "Computing filename position in cpp output for #include directives..." >&4
5750 echo '#include <stdio.h>' > foo.c
5751 $cat >fieldn <<EOF
5752 $startsh
5753 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5754 $grep '^[       ]*#.*stdio\.h' | \
5755 while read cline; do
5756         pos=1
5757         set \$cline
5758         while $test \$# -gt 0; do
5759                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5760                         echo "\$pos"
5761                         exit 0
5762                 fi
5763                 shift
5764                 pos=\`expr \$pos + 1\`
5765         done
5766 done
5767 EOF
5768 chmod +x fieldn
5769 fieldn=`./fieldn`
5770 $rm -f foo.c fieldn
5771 case $fieldn in
5772 '') pos='???';;
5773 1) pos=first;;
5774 2) pos=second;;
5775 3) pos=third;;
5776 *) pos="${fieldn}th";;
5777 esac
5778 echo "Your cpp writes the filename in the $pos field of the line."
5779
5780 : locate header file
5781 $cat >findhdr <<EOF
5782 $startsh
5783 wanted=\$1
5784 name=''
5785 for usrincdir in $usrinc
5786 do
5787         if test -f \$usrincdir/\$wanted; then
5788                 echo "\$usrincdir/\$wanted"
5789                 exit 0
5790         fi
5791 done
5792 awkprg='{ print \$$fieldn }'
5793 echo "#include <\$wanted>" > foo\$\$.c
5794 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5795 $grep "^[       ]*#.*\$wanted" | \
5796 while read cline; do
5797         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5798         case "\$name" in
5799         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5800         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5801         *) exit 2;;
5802         esac;
5803 done;
5804 #
5805 # status = 0: grep returned 0 lines, case statement not executed
5806 # status = 1: headerfile found
5807 # status = 2: while loop executed, no headerfile found
5808 #
5809 status=\$?
5810 $rm -f foo\$\$.c;
5811 if test \$status -eq 1; then
5812         exit 0;
5813 fi
5814 exit 1
5815 EOF
5816 chmod +x findhdr
5817
5818 : define an alternate in-header-list? function
5819 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5820 cont=true; xxf="echo \"<\$1> found.\" >&4";
5821 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5822 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5823 esac;
5824 case $# in 4) instead=instead;; *) instead="at last";; esac;
5825 while $test "$cont"; do
5826         xxx=`./findhdr $1`
5827         var=$2; eval "was=\$$2";
5828         if $test "$xxx" && $test -r "$xxx";
5829         then eval $xxf;
5830         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5831                 cont="";
5832         else eval $xxnf;
5833         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5834         set $yyy; shift; shift; yyy=$@;
5835         case $# in 0) cont="";;
5836         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5837                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5838         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5839                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5840         esac;
5841 done;
5842 while $test "$yyy";
5843 do set $yyy; var=$2; eval "was=\$$2";
5844         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5845         set $yyy; shift; shift; yyy=$@;
5846 done'
5847
5848 : see if this is a malloc.h system
5849 set malloc.h i_malloc
5850 eval $inhdr
5851
5852 : see if stdlib is available
5853 set stdlib.h i_stdlib
5854 eval $inhdr
5855
5856 : determine which malloc to compile in
5857 echo " "
5858 case "$usemymalloc" in
5859 ''|[yY]*|true|$define)  dflt='y' ;;
5860 *)      dflt='n' ;;
5861 esac
5862 rp="Do you wish to attempt to use the malloc that comes with $package?"
5863 . ./myread
5864 usemymalloc="$ans"
5865 case "$ans" in
5866 y*|true)
5867         usemymalloc='y'
5868         mallocsrc='malloc.c'
5869         mallocobj="malloc$_o"
5870         d_mymalloc="$define"
5871         case "$libs" in
5872         *-lmalloc*)
5873                 : Remove malloc from list of libraries to use
5874                 echo "Removing unneeded -lmalloc from library list" >&4
5875                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5876                 shift
5877                 libs="$*"
5878                 echo "libs = $libs" >&4
5879                 ;;
5880         esac
5881         ;;
5882 *)
5883         usemymalloc='n'
5884         mallocsrc=''
5885         mallocobj=''
5886         d_mymalloc="$undef"
5887         ;;
5888 esac
5889
5890 : compute the return types of malloc and free
5891 echo " "
5892 $cat >malloc.c <<END
5893 #$i_malloc I_MALLOC
5894 #$i_stdlib I_STDLIB
5895 #include <stdio.h>
5896 #include <sys/types.h>
5897 #ifdef I_MALLOC
5898 #include <malloc.h>
5899 #endif
5900 #ifdef I_STDLIB
5901 #include <stdlib.h>
5902 #endif
5903 #ifdef TRY_MALLOC
5904 void *malloc();
5905 #endif
5906 #ifdef TRY_FREE
5907 void free();
5908 #endif
5909 END
5910 case "$malloctype" in
5911 '')
5912         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5913                 malloctype='void *'
5914         else
5915                 malloctype='char *'
5916         fi
5917         ;;
5918 esac
5919 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5920
5921 case "$freetype" in
5922 '')
5923         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5924                 freetype='void'
5925         else
5926                 freetype='int'
5927         fi
5928         ;;
5929 esac
5930 echo "Your system uses $freetype free(), it would seem." >&4
5931 $rm -f malloc.[co]
5932 $cat <<EOM
5933
5934 After $package is installed, you may wish to install various
5935 add-on modules and utilities.  Typically, these add-ons will
5936 be installed under $prefix with the rest
5937 of this package.  However, you may wish to install such add-ons
5938 elsewhere under a different prefix.
5939
5940 If you do not wish to put everything under a single prefix, that's
5941 ok.  You will be prompted for the individual locations; this siteprefix
5942 is only used to suggest the defaults.
5943
5944 The default should be fine for most people.
5945
5946 EOM
5947 fn=d~+
5948 rp='Installation prefix to use for add-on modules and utilities?'
5949 : XXX Here might be another good place for an installstyle setting.
5950 case "$siteprefix" in
5951 '') dflt=$prefix ;;
5952 *)  dflt=$siteprefix ;;
5953 esac
5954 . ./getfile
5955 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5956 oldsiteprefix=''
5957 case "$siteprefix" in
5958 '') ;;
5959 *)      case "$ans" in
5960         "$prefix") ;;
5961         *) oldsiteprefix="$prefix";;
5962         esac
5963         ;;
5964 esac
5965 siteprefix="$ans"
5966 siteprefixexp="$ansexp"
5967
5968 : determine where site specific libraries go.
5969 : Usual default is /usr/local/lib/perl5/site_perl/$version
5970 : The default "style" setting is made in installstyle.U
5971 : XXX No longer works with Prefixit stuff.
5972 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5973 case "$sitelib" in
5974 '') case "$installstyle" in
5975         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5976         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5977         esac
5978         ;;
5979 *)      dflt="$sitelib"
5980         ;;
5981 esac
5982 $cat <<EOM
5983
5984 The installation process will create a directory for
5985 site-specific extensions and modules.  Most users find it convenient
5986 to place all site-specific files in this directory rather than in the
5987 main distribution directory.
5988
5989 EOM
5990 fn=d~+
5991 rp='Pathname for the site-specific library files?'
5992 . ./getfile
5993 sitelib="$ans"
5994 sitelibexp="$ansexp"
5995 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5996 : Change installation prefix, if necessary.
5997 if $test X"$prefix" != X"$installprefix"; then
5998         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5999 else
6000         installsitelib="$sitelibexp"
6001 fi
6002
6003 : determine where site specific architecture-dependent libraries go.
6004 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6005 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6006 : sitelib may have an optional trailing /share.
6007 case "$sitearch" in
6008 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6009         dflt="$dflt/$archname"
6010         ;;
6011 *)      dflt="$sitearch"
6012         ;;
6013 esac
6014 set sitearch sitearch none
6015 eval $prefixit
6016 $cat <<EOM
6017
6018 The installation process will also create a directory for
6019 architecture-dependent site-specific extensions and modules.
6020
6021 EOM
6022 fn=d~+
6023 rp='Pathname for the site-specific architecture-dependent library files?'
6024 . ./getfile
6025 sitearch="$ans"
6026 sitearchexp="$ansexp"
6027 : Change installation prefix, if necessary.
6028 if $test X"$prefix" != X"$installprefix"; then
6029         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6030 else
6031         installsitearch="$sitearchexp"
6032 fi
6033
6034 $cat <<EOM
6035
6036 The installation process will also create a directory for
6037 vendor-supplied add-ons.  Vendors who supply perl with their system
6038 may find it convenient to place all vendor-supplied files in this
6039 directory rather than in the main distribution directory.  This will
6040 ease upgrades between binary-compatible maintenance versions of perl.
6041
6042 Of course you may also use these directories in whatever way you see
6043 fit.  For example, you might use them to access modules shared over a
6044 company-wide network.
6045
6046 The default answer should be fine for most people.
6047 This causes further questions about vendor add-ons to be skipped
6048 and no vendor-specific directories will be configured for perl.
6049
6050 EOM
6051 rp='Do you want to configure vendor-specific add-on directories?'
6052 case "$usevendorprefix" in
6053 define|true|[yY]*) dflt=y ;;
6054 *)      : User may have set vendorprefix directly on Configure command line.
6055         case "$vendorprefix" in
6056         ''|' ') dflt=n ;;
6057         *)      dflt=y ;;
6058         esac
6059         ;;
6060 esac
6061 . ./myread
6062 case "$ans" in
6063 [yY]*)  fn=d~+
6064         rp='Installation prefix to use for vendor-supplied add-ons?'
6065         case "$vendorprefix" in
6066         '') dflt='' ;;
6067         *)  dflt=$vendorprefix ;;
6068         esac
6069         . ./getfile
6070         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6071         oldvendorprefix=''
6072         case "$vendorprefix" in
6073         '') ;;
6074         *)      case "$ans" in
6075                 "$prefix") ;;
6076                 *) oldvendorprefix="$prefix";;
6077                 esac
6078                 ;;
6079         esac
6080         usevendorprefix="$define"
6081         vendorprefix="$ans"
6082         vendorprefixexp="$ansexp"
6083         ;;
6084 *)      usevendorprefix="$undef"
6085         vendorprefix=''
6086         vendorprefixexp=''
6087         ;;
6088 esac
6089
6090 case "$vendorprefix" in
6091 '')     d_vendorlib="$undef"
6092         vendorlib=''
6093         vendorlibexp=''
6094         ;;
6095 *)      d_vendorlib="$define"
6096         : determine where vendor-supplied modules go.
6097         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6098         case "$vendorlib" in
6099         '')
6100                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6101                 case "$installstyle" in
6102                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6103                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6104                 esac
6105                 ;;
6106         *)      dflt="$vendorlib"
6107                 ;;
6108         esac
6109         fn=d~+
6110         rp='Pathname for the vendor-supplied library files?'
6111         . ./getfile
6112         vendorlib="$ans"
6113         vendorlibexp="$ansexp"
6114         ;;
6115 esac
6116 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6117 : Change installation prefix, if necessary.
6118 if $test X"$prefix" != X"$installprefix"; then
6119         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6120 else
6121         installvendorlib="$vendorlibexp"
6122 fi
6123
6124 case "$vendorprefix" in
6125 '')     d_vendorarch="$undef"
6126         vendorarch=''
6127         vendorarchexp=''
6128         ;;
6129 *)      d_vendorarch="$define"
6130         : determine where vendor-supplied architecture-dependent libraries go.
6131         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6132         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6133         : vendorlib may have an optional trailing /share.
6134         case "$vendorarch" in
6135         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6136                 dflt="$dflt/$archname"
6137                 ;;
6138         *)      dflt="$vendorarch" ;;
6139         esac
6140         fn=d~+
6141         rp='Pathname for vendor-supplied architecture-dependent files?'
6142         . ./getfile
6143         vendorarch="$ans"
6144         vendorarchexp="$ansexp"
6145         ;;
6146 esac
6147 : Change installation prefix, if necessary.
6148 if $test X"$prefix" != X"$installprefix"; then
6149         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6150 else
6151         installvendorarch="$vendorarchexp"
6152 fi
6153
6154 : Final catch-all directories to search
6155 $cat <<EOM
6156
6157 Lastly, you can have perl look in other directories for extensions and
6158 modules in addition to those already specified.
6159 These directories will be searched after 
6160         $sitearch 
6161         $sitelib 
6162 EOM
6163 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6164 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6165 echo ' '
6166 case "$otherlibdirs" in
6167 ''|' ') dflt='none' ;;
6168 *)      dflt="$otherlibdirs" ;;
6169 esac
6170 $cat <<EOM
6171 Enter a colon-separated set of extra paths to include in perl's @INC
6172 search path, or enter 'none' for no extra paths.
6173
6174 EOM
6175
6176 rp='Colon-separated list of additional directories for perl to search?'
6177 . ./myread
6178 case "$ans" in
6179 ' '|''|none)    otherlibdirs=' ' ;;     
6180 *)      otherlibdirs="$ans" ;;
6181 esac
6182 case "$otherlibdirs" in
6183 ' ') val=$undef ;;
6184 *)      val=$define ;;
6185 esac
6186 set d_perl_otherlibdirs
6187 eval $setvar
6188
6189 : Cruising for prototypes
6190 echo " "
6191 echo "Checking out function prototypes..." >&4
6192 $cat >prototype.c <<'EOCP'
6193 int main(int argc, char *argv[]) {
6194         exit(0);}
6195 EOCP
6196 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6197         echo "Your C compiler appears to support function prototypes."
6198         val="$define"
6199 else
6200         echo "Your C compiler doesn't seem to understand function prototypes."
6201         val="$undef"
6202 fi
6203 set prototype
6204 eval $setvar
6205 $rm -f prototype*
6206
6207 case "$prototype" in
6208 "$define") ;;
6209 *)      ansi2knr='ansi2knr'
6210         echo " "
6211         cat <<EOM >&4
6212
6213 $me:  FATAL ERROR:
6214 This version of $package can only be compiled by a compiler that 
6215 understands function prototypes.  Unfortunately, your C compiler 
6216         $cc $ccflags
6217 doesn't seem to understand them.  Sorry about that.
6218
6219 If GNU cc is available for your system, perhaps you could try that instead.  
6220
6221 Eventually, we hope to support building Perl with pre-ANSI compilers.
6222 If you would like to help in that effort, please contact <perlbug@perl.org>.
6223
6224 Aborting Configure now.
6225 EOM
6226         exit 2
6227         ;;
6228 esac
6229
6230 : determine where public executables go
6231 echo " "
6232 set dflt bin bin
6233 eval $prefixit
6234 fn=d~
6235 rp='Pathname where the public executables will reside?'
6236 . ./getfile
6237 if $test "X$ansexp" != "X$binexp"; then
6238         installbin=''
6239 fi
6240 bin="$ans"
6241 binexp="$ansexp"
6242 : Change installation prefix, if necessary.
6243 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6244 if $test X"$prefix" != X"$installprefix"; then
6245         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6246 else
6247         installbin="$binexp"
6248 fi
6249
6250 : Find perl5.005 or later.
6251 echo "Looking for a previously installed perl5.005 or later... "
6252 case "$perl5" in
6253 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6254                 : Check if this perl is recent and can load a simple module
6255                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6256                         perl5=$tdir/perl
6257                         break;
6258                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6259                         perl5=$tdir/perl
6260                         break;
6261                 fi
6262         done
6263         ;;
6264 *)      perl5="$perl5"
6265         ;;
6266 esac
6267 case "$perl5" in
6268 '')     echo "None found.  That's ok.";;
6269 *)      echo "Using $perl5." ;;
6270 esac
6271
6272 : Determine list of previous versions to include in @INC
6273 $cat > getverlist <<EOPL
6274 #!$perl5 -w
6275 use File::Basename;
6276 \$api_versionstring = "$api_versionstring";
6277 \$version = "$version";
6278 \$stem = "$sitelib_stem";
6279 \$archname = "$archname";
6280 EOPL
6281         $cat >> getverlist <<'EOPL'
6282 # Can't have leading @ because metaconfig interprets it as a command!
6283 ;@inc_version_list=();
6284 # XXX Redo to do opendir/readdir? 
6285 if (-d $stem) {
6286     chdir($stem);
6287     ;@candidates = glob("5.*");
6288 }
6289 else {
6290     ;@candidates = ();
6291 }
6292
6293 # XXX ToDo:  These comparisons must be reworked when two-digit
6294 # subversions come along, so that 5.7.10 compares as greater than
6295 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6296 # widespread that we can use the built-in version vectors rather
6297 # than reinventing them here.  For 5.6.0, however, we must
6298 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6299 foreach $d (@candidates) {
6300     if ($d lt $version) {
6301         if ($d ge $api_versionstring) {
6302             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6303         }
6304         elsif ($d ge "5.005") {
6305             unshift(@inc_version_list, grep { -d } $d);
6306         }
6307     }
6308     else {
6309         # Skip newer version.  I.e. don't look in
6310         # 5.7.0 if we're installing 5.6.1.
6311     }
6312 }
6313
6314 if (@inc_version_list) {
6315     print join(' ', @inc_version_list);
6316 }
6317 else {
6318     # Blank space to preserve value for next Configure run.
6319     print " ";
6320 }
6321 EOPL
6322 chmod +x getverlist
6323 case "$inc_version_list" in
6324 '')     if test -x "$perl5"; then
6325                 dflt=`$perl5 getverlist`
6326         else
6327                 dflt='none'
6328         fi
6329         ;;
6330 $undef) dflt='none' ;;
6331 *)  dflt="$inc_version_list" ;;
6332 esac
6333 case "$dflt" in
6334 ''|' ') dflt=none ;;
6335 esac
6336 case "$dflt" in
6337 5.005) case "$bincompat5005" in
6338        $define|true|[yY]*) ;;
6339        *) dflt=none ;;
6340        esac
6341        ;;
6342 esac
6343 $cat <<'EOM'
6344
6345 In order to ease the process of upgrading, this version of perl 
6346 can be configured to use modules built and installed with earlier 
6347 versions of perl that were installed under $prefix.  Specify here
6348 the list of earlier versions that this version of perl should check.
6349 If Configure detected no earlier versions of perl installed under
6350 $prefix, then the list will be empty.  Answer 'none' to tell perl
6351 to not search earlier versions.
6352
6353 The default should almost always be sensible, so if you're not sure,
6354 just accept the default.
6355 EOM
6356
6357 rp='List of earlier versions to include in @INC?'
6358 . ./myread
6359 case "$ans" in
6360 [Nn]one|''|' ') inc_version_list=' ' ;;
6361 *) inc_version_list="$ans" ;;
6362 esac
6363 case "$inc_version_list" in
6364 ''|' ') 
6365         inc_version_list_init='0';;
6366 *)      inc_version_list_init=`echo $inc_version_list |
6367                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6368         ;;
6369 esac
6370 $rm -f getverlist
6371
6372 : determine whether to install perl also as /usr/bin/perl
6373
6374 echo " "
6375 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6376         $cat <<EOM
6377 Many scripts expect perl to be installed as /usr/bin/perl.
6378 I can install the perl you are about to compile also as /usr/bin/perl
6379 (in addition to $installbin/perl).
6380 EOM
6381         case "$installusrbinperl" in
6382         "$undef"|[nN]*) dflt='n';;
6383         *)              dflt='y';;
6384         esac
6385         rp="Do you want to install perl as /usr/bin/perl?"
6386         . ./myread
6387         case "$ans" in
6388         [yY]*)  val="$define";;
6389         *)      val="$undef" ;;
6390         esac
6391 else
6392         val="$undef"
6393 fi
6394 set installusrbinperl
6395 eval $setvar
6396
6397 : see if dld is available
6398 set dld.h i_dld
6399 eval $inhdr
6400
6401 : see if dlopen exists
6402 xxx_runnm="$runnm"
6403 runnm=false
6404 set dlopen d_dlopen
6405 eval $inlibc
6406 runnm="$xxx_runnm"
6407
6408 : determine which dynamic loading, if any, to compile in
6409 echo " "
6410 dldir="ext/DynaLoader"
6411 case "$usedl" in
6412 $define|y|true)
6413         dflt='y'
6414         usedl="$define"
6415         ;;
6416 $undef|n|false)
6417         dflt='n'
6418         usedl="$undef"
6419         ;;
6420 *) 
6421         dflt='n'
6422         case "$d_dlopen" in
6423             $define) dflt='y' ;;
6424         esac
6425         case "$i_dld" in
6426             $define) dflt='y' ;;
6427         esac
6428         : Does a dl_xxx.xs file exist for this operating system
6429         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6430         ;;
6431 esac
6432 rp="Do you wish to use dynamic loading?"
6433 . ./myread
6434 usedl="$ans"
6435 case "$ans" in
6436 y*) usedl="$define"
6437         case "$dlsrc" in
6438         '')
6439                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6440                         dflt="$dldir/dl_${osname}.xs"
6441                 elif $test "$d_dlopen" = "$define" ; then
6442                         dflt="$dldir/dl_dlopen.xs"
6443                 elif $test "$i_dld" = "$define" ; then
6444                         dflt="$dldir/dl_dld.xs"
6445                 else
6446                         dflt=''
6447                 fi
6448                 ;;
6449         *)      dflt="$dldir/$dlsrc"
6450                 ;;
6451         esac
6452     echo "The following dynamic loading files are available:"
6453         : Can not go over to $dldir because getfile has path hard-coded in.
6454         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6455         rp="Source file to use for dynamic loading"
6456         fn="fne"
6457         gfpth="$src"
6458         . ./getfile
6459         usedl="$define"
6460         : emulate basename
6461         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6462
6463         $cat << EOM
6464
6465 Some systems may require passing special flags to $cc -c to
6466 compile modules that will be used to create a shared library.
6467 To use no flags, say "none".
6468
6469 EOM
6470     case "$cccdlflags" in
6471     '') case "$gccversion" in
6472                 '') case "$osname" in
6473                         hpux)   dflt='+z' ;;
6474                         next)   dflt='none' ;;
6475                         irix*)  dflt='-KPIC' ;;
6476                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6477                         sunos)  dflt='-pic' ;;
6478                         *)      dflt='none' ;;
6479                     esac
6480                         ;;
6481                 *)  case "$osname" in
6482                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6483                         *)      dflt='-fpic' ;;
6484                     esac ;;
6485             esac ;;
6486         ' ') dflt='none' ;;
6487     *)  dflt="$cccdlflags" ;;
6488     esac
6489     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6490     . ./myread
6491     case "$ans" in
6492     none) cccdlflags=' ' ;;
6493     *) cccdlflags="$ans" ;;
6494     esac
6495
6496     cat << EOM
6497
6498 Some systems use ld to create libraries that can be dynamically loaded,
6499 while other systems (such as those using ELF) use $cc.
6500
6501 EOM
6502         case "$ld" in
6503         '')     $cat >try.c <<'EOM'
6504 /* Test for whether ELF binaries are produced */
6505 #include <fcntl.h>
6506 #include <stdlib.h>
6507 int main() {
6508         char b[4];
6509         int i = open("a.out",O_RDONLY);
6510         if(i == -1) 
6511                 exit(1); /* fail */
6512         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6513                 exit(0); /* succeed (yes, it's ELF) */
6514         else
6515                 exit(1); /* fail */
6516 }
6517 EOM
6518                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6519                         cat <<EOM
6520 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6521 EOM
6522                         dflt="$cc"
6523                 else
6524                         echo "I'll use ld to build dynamic libraries."
6525                         dflt='ld'
6526                 fi
6527                 rm -f try.c a.out
6528                 ;;
6529         *)      dflt="$ld"
6530                 ;;
6531         esac
6532
6533     rp="What command should be used to create dynamic libraries?"
6534     . ./myread
6535         ld="$ans"
6536
6537     cat << EOM
6538
6539 Some systems may require passing special flags to $ld to create a
6540 library that can be dynamically loaded.  If your ld flags include
6541 -L/other/path options to locate libraries outside your loader's normal
6542 search path, you may need to specify those -L options here as well.  To
6543 use no flags, say "none".
6544
6545 EOM
6546     case "$lddlflags" in
6547     '') case "$osname" in
6548                         beos) dflt='-nostart' ;;
6549                         hpux) dflt='-b';
6550                               case "$gccversion" in
6551                               '') dflt="$dflt +vnocompatwarnings" ;;
6552                               esac
6553                               ;;        
6554                         linux|irix*)    dflt='-shared' ;;
6555                         next)  dflt='none' ;;
6556                         solaris) dflt='-G' ;;
6557                         sunos) dflt='-assert nodefinitions' ;;
6558                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6559                 *)     dflt='none' ;;
6560                         esac
6561                         ;;
6562     *) dflt="$lddlflags" ;;
6563     esac
6564
6565         : Try to guess additional flags to pick up local libraries.
6566         : Be careful not to append to a plain 'none'
6567         case "$dflt" in
6568         none) dflt='' ;;
6569         esac
6570         for thisflag in $ldflags; do
6571                 case "$thisflag" in
6572                 -L*|-R*)
6573                         case " $dflt " in
6574                         *" $thisflag "*) ;;
6575                         *) dflt="$dflt $thisflag" ;;
6576                         esac
6577                         ;;
6578                 esac
6579         done
6580
6581         case "$dflt" in
6582         ''|' ') dflt='none' ;;
6583         esac
6584
6585     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6586     . ./myread
6587     case "$ans" in
6588     none) lddlflags=' ' ;;
6589     *) lddlflags="$ans" ;;
6590     esac
6591
6592         cat <<EOM
6593
6594 Some systems may require passing special flags to $cc to indicate that
6595 the resulting executable will use dynamic linking.  To use no flags,
6596 say "none".
6597
6598 EOM
6599     case "$ccdlflags" in
6600     '') case "$osname" in
6601                 hpux)   dflt='-Wl,-E' ;;
6602                 linux)  dflt='-rdynamic' ;;
6603                 next)   dflt='none' ;;
6604                 sunos)  dflt='none' ;;
6605                 *)      dflt='none' ;;
6606             esac ;;
6607     ' ')  dflt='none' ;;
6608     *)  dflt="$ccdlflags" ;;
6609     esac
6610     rp="Any special flags to pass to $cc to use dynamic linking?"
6611     . ./myread
6612     case "$ans" in
6613     none) ccdlflags=' ' ;;
6614     *) ccdlflags="$ans" ;;
6615     esac
6616     ;;
6617 *)  usedl="$undef"
6618         ld='ld'
6619     dlsrc='dl_none.xs'
6620     lddlflags=''
6621     ccdlflags=''
6622     ;;
6623 esac
6624
6625 also=''
6626 case "$usedl" in
6627 $undef)
6628         # No dynamic loading being used, so don't bother even to prompt.
6629         useshrplib='false'
6630         ;;
6631 *)      case "$useshrplib" in
6632         '')     case "$osname" in
6633                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6634                         dflt=y
6635                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6636                         ;;
6637                 next*)
6638                         case "$osvers" in
6639                         4*)     dflt=y
6640                                 also='Building a shared libperl is needed for MAB support.'
6641                                 ;;
6642                         *)      dflt=n
6643                                 ;;
6644                         esac
6645                         ;;
6646                 *)      dflt=n
6647                         ;;
6648                 esac
6649                 ;;
6650         $define|true|[Yy]*)
6651                 dflt=y
6652                 ;;
6653         *)      dflt=n
6654                 ;;
6655         esac
6656         $cat << EOM
6657
6658 The perl executable is normally obtained by linking perlmain.c with
6659 libperl${_a}, any static extensions (usually just DynaLoader), and
6660 any other libraries needed on this system (such as -lm, etc.).  Since
6661 your system supports dynamic loading, it is probably possible to build
6662 a shared libperl.$so.  If you will have more than one executable linked
6663 to libperl.$so, this will significantly reduce the size of each
6664 executable, but it may have a noticeable affect on performance.  The
6665 default is probably sensible for your system.
6666 $also
6667
6668 EOM
6669         rp="Build a shared libperl.$so (y/n)"
6670         . ./myread
6671         case "$ans" in
6672         true|$define|[Yy]*)
6673                 useshrplib='true'  ;;
6674         *)      useshrplib='false' ;;
6675         esac
6676         ;;
6677 esac
6678
6679 case "$useshrplib" in
6680 true)
6681         case "$libperl" in
6682         '')
6683                 # Figure out a good name for libperl.so.  Since it gets stored in
6684                 # a version-specific architecture-dependent library, the version
6685                 # number isn't really that important, except for making cc/ld happy.
6686                 #
6687                 # A name such as libperl.so.3.1
6688                 majmin="libperl.$so.$patchlevel.$subversion"
6689                 # A name such as libperl.so.301
6690                 majonly=`echo $patchlevel $subversion |
6691                         $awk '{printf "%d%02d", $1, $2}'`
6692                 majonly=libperl.$so.$majonly
6693                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6694                 # rely on figuring it out from the naming of libc.
6695                 case "${osname}${osvers}" in
6696                 next4*)
6697                         dflt=libperl.5.$so
6698                         # XXX How handle the --version stuff for MAB?
6699                         ;;
6700                 linux*)  # ld won't link with a bare -lperl otherwise.
6701                         dflt=libperl.$so
6702                         ;;
6703                 cygwin*) # include version
6704                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6705                         ;;
6706                 *)      # Try to guess based on whether libc has major.minor.
6707                         case "$libc" in
6708                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6709                         *libc.$so.[0-9]*) dflt=$majonly ;;
6710                         *)      dflt=libperl.$so ;;
6711                         esac
6712                         ;;
6713                 esac
6714                 ;;
6715         *)      dflt=$libperl
6716                 ;;
6717         esac
6718         cat << EOM
6719
6720 I need to select a good name for the shared libperl.  If your system uses
6721 library names with major and minor numbers, then you might want something
6722 like $majmin.  Alternatively, if your system uses a single version
6723 number for shared libraries, then you might want to use $majonly.
6724 Or, your system might be quite happy with a simple libperl.$so.
6725
6726 Since the shared libperl will get installed into a version-specific
6727 architecture-dependent directory, the version number of the shared perl
6728 library probably isn't important, so the default should be o.k.
6729
6730 EOM
6731         rp='What name do you want to give to the shared libperl?'
6732         . ./myread
6733         libperl=$ans
6734         echo "Ok, I'll use $libperl"
6735         ;;
6736 *)
6737         libperl="libperl${_a}"
6738         ;;
6739 esac
6740
6741 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6742 case "$shrpdir" in
6743 '') ;;
6744 *)      $cat >&4 <<EOM
6745 WARNING:  Use of the shrpdir variable for the installation location of
6746 the shared $libperl is not supported.  It was never documented and
6747 will not work in this version.  Let me (perlbug@perl.org)
6748 know of any problems this may cause.
6749
6750 EOM
6751         case "$shrpdir" in
6752         "$archlibexp/CORE")
6753                 $cat >&4 <<EOM
6754 But your current setting of $shrpdir is
6755 the default anyway, so it's harmless.
6756 EOM
6757                 ;;
6758         *)
6759                 $cat >&4 <<EOM
6760 Further, your current attempted setting of $shrpdir
6761 conflicts with the value of $archlibexp/CORE
6762 that installperl will use.
6763 EOM
6764                 ;;
6765         esac
6766         ;;
6767 esac
6768
6769 # How will the perl executable find the installed shared $libperl?
6770 # Add $xxx to ccdlflags.
6771 # If we can't figure out a command-line option, use $shrpenv to
6772 # set env LD_RUN_PATH.  The main perl makefile uses this.
6773 shrpdir=$archlibexp/CORE
6774 xxx=''
6775 tmp_shrpenv=''
6776 if "$useshrplib"; then
6777     case "$osname" in 
6778         aix)
6779                 # We'll set it in Makefile.SH...
6780                 ;;
6781         solaris|netbsd)
6782                 xxx="-R $shrpdir"
6783                 ;;
6784         freebsd)
6785                 xxx="-Wl,-R$shrpdir"
6786                 ;;
6787         linux|irix*|dec_osf)
6788                 xxx="-Wl,-rpath,$shrpdir"
6789                 ;;
6790         next)
6791                 # next doesn't like the default...
6792                 ;;
6793         beos)
6794                 # beos doesn't like the default, either.
6795                 ;;
6796         hpux*)
6797                 # hpux doesn't like the default, either.
6798                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6799                 ;;
6800         *)
6801                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6802                 ;;
6803         esac
6804         case "$xxx" in
6805         '') ;;
6806         *)      
6807                 # Only add $xxx if it isn't already in ccdlflags.
6808                 case " $ccdlflags " in
6809                 *" $xxx "*)     ;;
6810                 *)      ccdlflags="$ccdlflags $xxx"
6811                         cat <<EOM >&4
6812
6813 Adding $xxx to the flags
6814 passed to $ld so that the perl executable will find the 
6815 installed shared $libperl.
6816
6817 EOM
6818                         ;;
6819                 esac
6820                 ;;
6821         esac
6822 fi
6823 # Fix ccdlflags in AIX for building external extensions.
6824 # (For building Perl itself bare -bE:perl.exp is needed,
6825 #  Makefile.SH takes care of this.)
6826 case "$osname" in
6827 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6828 esac
6829 # Respect a hint or command-line value.
6830 case "$shrpenv" in
6831 '') shrpenv="$tmp_shrpenv" ;;
6832 esac
6833 case "$ldlibpthname" in
6834 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6835 none)   ldlibpthname='' ;;
6836 esac
6837
6838 : determine where manual pages are on this system
6839 echo " "
6840 case "$sysman" in
6841 '') 
6842         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6843         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6844         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6845         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6846         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6847         sysman=`./loc . /usr/man/man1 $syspath`
6848         ;;
6849 esac
6850 if $test -d "$sysman"; then
6851         echo "System manual is in $sysman." >&4
6852 else
6853         echo "Could not find manual pages in source form." >&4
6854 fi
6855
6856 : determine where manual pages go
6857 set man1dir man1dir none
6858 eval $prefixit
6859 $cat <<EOM
6860
6861 $spackage has manual pages available in source form.
6862 EOM
6863 case "$nroff" in
6864 nroff)
6865         echo "However, you don't have nroff, so they're probably useless to you."
6866         case "$man1dir" in
6867         '') man1dir="none";;
6868         esac;;
6869 esac
6870 echo "If you don't want the manual sources installed, answer 'none'."
6871 case "$man1dir" in
6872 ' ') dflt=none
6873         ;;
6874 '')
6875         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6876         lookpath="$lookpath $prefixexp/man/p_man/man1"
6877         lookpath="$lookpath $prefixexp/man/u_man/man1"
6878         lookpath="$lookpath $prefixexp/man/man.1"
6879         case "$sysman" in
6880         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6881         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6882         esac
6883         set dflt
6884         eval $prefixup
6885         ;;
6886 *)  dflt="$man1dir"
6887         ;;
6888 esac
6889 echo " "
6890 fn=dn+~
6891 rp="Where do the main $spackage manual pages (source) go?"
6892 . ./getfile
6893 if $test "X$man1direxp" != "X$ansexp"; then
6894         installman1dir=''
6895 fi
6896 man1dir="$ans"
6897 man1direxp="$ansexp"
6898 case "$man1dir" in
6899 '')     man1dir=' '
6900         installman1dir='';;
6901 esac
6902
6903 : Change installation prefix, if necessary.
6904 if $test X"$prefix" != X"$installprefix"; then
6905         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6906 else
6907         installman1dir="$man1direxp"
6908 fi
6909
6910 : What suffix to use on installed man pages
6911
6912 case "$man1dir" in
6913 ' ')
6914         man1ext='0'
6915         ;;
6916 *)
6917         rp="What suffix should be used for the main $spackage man pages?"
6918         case "$man1ext" in
6919         '')     case "$man1dir" in
6920                 *1)  dflt=1 ;;
6921                 *1p) dflt=1p ;;
6922                 *1pm) dflt=1pm ;;
6923                 *l) dflt=l;;
6924                 *n) dflt=n;;
6925                 *o) dflt=o;;
6926                 *p) dflt=p;;
6927                 *C) dflt=C;;
6928                 *L) dflt=L;;
6929                 *L1) dflt=L1;;
6930                 *) dflt=1;;
6931                 esac
6932                 ;;
6933         *)      dflt="$man1ext";;
6934         esac
6935         . ./myread
6936         man1ext="$ans"
6937         ;;
6938 esac
6939
6940 : see if we can have long filenames
6941 echo " "
6942 first=123456789abcdef
6943 $rm -f $first
6944 if (echo hi >$first) 2>/dev/null; then
6945         if $test -f 123456789abcde; then
6946                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6947                 val="$undef"
6948         else
6949                 echo 'You can have filenames longer than 14 characters.'>&4
6950                 val="$define"
6951         fi
6952 else
6953         $cat <<'EOM'
6954 You can't have filenames longer than 14 chars.
6955 You can't even think about them!
6956 EOM
6957         val="$undef"
6958 fi 
6959 set d_flexfnam
6960 eval $setvar
6961 $rm -rf 123456789abcde*
6962
6963 : determine where library module manual pages go
6964 set man3dir man3dir none
6965 eval $prefixit
6966 $cat <<EOM
6967
6968 $spackage has manual pages for many of the library modules.
6969 EOM
6970
6971 case "$nroff" in
6972 nroff)
6973         $cat <<'EOM'
6974 However, you don't have nroff, so they're probably useless to you.
6975 EOM
6976         case "$man3dir" in
6977         '') man3dir="none";;
6978         esac;;
6979 esac
6980
6981 case "$d_flexfnam" in
6982 undef)
6983         $cat <<'EOM'
6984 However, your system can't handle the long file names like File::Basename.3. 
6985 EOM
6986         case "$man3dir" in
6987         '') man3dir="none";;
6988         esac;;
6989 esac
6990
6991 echo "If you don't want the manual sources installed, answer 'none'."
6992 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6993 case "$man3dir" in
6994 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6995         if $test -d "$privlib/man/man3"; then
6996                 cat <<EOM >&4
6997
6998 WARNING:  Previous versions of perl installed man3 pages into
6999 $privlib/man/man3.  This version will suggest a 
7000 new default of $dflt.  
7001 EOM
7002                 tdflt=$dflt
7003                 dflt='n'
7004                 rp='Do you wish to preserve the old behavior?(y/n)'
7005                 . ./myread
7006                 case "$ans" in
7007                 y*) dflt="$privlib/man/man3" ;;
7008                 *)  dflt=$tdflt ;;
7009                 esac
7010     fi
7011         ;;
7012 *)      dflt="$man3dir" ;;
7013 esac
7014 case "$dflt" in
7015 ' ') dflt=none ;;
7016 esac
7017 echo " "
7018 fn=dn+~
7019 rp="Where do the $package library man pages (source) go?"
7020 . ./getfile
7021 man3dir="$ans"
7022 man3direxp="$ansexp"
7023 case "$man3dir" in
7024 '')     man3dir=' '
7025         installman3dir='';;
7026 esac
7027
7028 : Change installation prefix, if necessary.
7029 if $test X"$prefix" != X"$installprefix"; then
7030         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7031 else
7032         installman3dir="$man3direxp"
7033 fi
7034
7035 : What suffix to use on installed man pages
7036 case "$man3dir" in
7037 ' ')
7038         man3ext='0'
7039         ;;
7040 *)
7041         rp="What suffix should be used for the $package library man pages?"
7042         case "$man3ext" in
7043         '')     case "$man3dir" in
7044                 *3)  dflt=3 ;;
7045                 *3p) dflt=3p ;;
7046                 *3pm) dflt=3pm ;;
7047                 *l) dflt=l;;
7048                 *n) dflt=n;;
7049                 *o) dflt=o;;
7050                 *p) dflt=p;;
7051                 *C) dflt=C;;
7052                 *L) dflt=L;;
7053                 *L3) dflt=L3;;
7054                 *) dflt=3;;
7055                 esac
7056                 ;;
7057         *)      dflt="$man3ext";;
7058         esac
7059         . ./myread
7060         man3ext="$ans"
7061         ;;
7062 esac
7063
7064 : see if we have to deal with yellow pages, now NIS.
7065 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7066         if $test -f /usr/etc/nibindd; then
7067                 echo " "
7068                 echo "I'm fairly confident you're on a NeXT."
7069                 echo " "
7070                 rp='Do you get the hosts file via NetInfo?'
7071                 dflt=y
7072                 case "$hostcat" in
7073                 nidump*) ;;
7074                 '') ;;
7075                 *) dflt=n;;
7076                 esac
7077                 . ./myread
7078                 case "$ans" in
7079                 y*) hostcat='nidump hosts .';;
7080                 *)      case "$hostcat" in
7081                         nidump*) hostcat='';;
7082                         esac
7083                         ;;
7084                 esac
7085         fi
7086         case "$hostcat" in
7087         nidump*) ;;
7088         *)
7089                 case "$hostcat" in
7090                 *ypcat*) dflt=y;;
7091                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7092                                 dflt=y
7093                         else
7094                                 dflt=n
7095                         fi;;
7096                 *) dflt=n;;
7097                 esac
7098                 echo " "
7099                 rp='Are you getting the hosts file via yellow pages?'
7100                 . ./myread
7101                 case "$ans" in
7102                 y*) hostcat='ypcat hosts';;
7103                 *) hostcat='cat /etc/hosts';;
7104                 esac
7105                 ;;
7106         esac
7107 fi
7108 case "$hostcat" in
7109 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7110 esac
7111 case "$groupcat" in
7112 '') test -f /etc/group && groupcat='cat /etc/group';;
7113 esac
7114 case "$passcat" in
7115 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7116 esac
7117
7118 : now get the host name
7119 echo " "
7120 echo "Figuring out host name..." >&4
7121 case "$myhostname" in
7122 '') cont=true
7123         echo 'Maybe "hostname" will work...'
7124         if tans=`sh -c hostname 2>&1` ; then
7125                 myhostname=$tans
7126                 phostname=hostname
7127                 cont=''
7128         fi
7129         ;;
7130 *) cont='';;
7131 esac
7132 if $test "$cont"; then
7133         if ./xenix; then
7134                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7135                 if tans=`cat /etc/systemid 2>&1` ; then
7136                         myhostname=$tans
7137                         phostname='cat /etc/systemid'
7138                         echo "Whadyaknow.  Xenix always was a bit strange..."
7139                         cont=''
7140                 fi
7141         elif $test -r /etc/systemid; then
7142                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7143         fi
7144 fi
7145 if $test "$cont"; then
7146         echo 'No, maybe "uuname -l" will work...'
7147         if tans=`sh -c 'uuname -l' 2>&1` ; then
7148                 myhostname=$tans
7149                 phostname='uuname -l'
7150         else
7151                 echo 'Strange.  Maybe "uname -n" will work...'
7152                 if tans=`sh -c 'uname -n' 2>&1` ; then
7153                         myhostname=$tans
7154                         phostname='uname -n'
7155                 else
7156                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7157                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7158                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7159                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7160                         else
7161                                 case "$myhostname" in
7162                                 '') echo "Does this machine have an identity crisis or something?"
7163                                         phostname='';;
7164                                 *)
7165                                         echo "Well, you said $myhostname before..."
7166                                         phostname='echo $myhostname';;
7167                                 esac
7168                         fi
7169                 fi
7170         fi
7171 fi
7172 : you do not want to know about this
7173 set $myhostname
7174 myhostname=$1
7175
7176 : verify guess
7177 if $test "$myhostname" ; then
7178         dflt=y
7179         rp='Your host name appears to be "'$myhostname'".'" Right?"
7180         . ./myread
7181         case "$ans" in
7182         y*) ;;
7183         *) myhostname='';;
7184         esac
7185 fi
7186
7187 : bad guess or no guess
7188 while $test "X$myhostname" = X ; do
7189         dflt=''
7190         rp="Please type the (one word) name of your host:"
7191         . ./myread
7192         myhostname="$ans"
7193 done
7194
7195 : translate upper to lower if necessary
7196 case "$myhostname" in
7197 *[A-Z]*)
7198         echo "(Normalizing case in your host name)"
7199         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7200         ;;
7201 esac
7202
7203 case "$myhostname" in
7204 *.*)
7205         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7206         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7207         echo "(Trimming domain name from host name--host name is now $myhostname)"
7208         ;;
7209 *) case "$mydomain" in
7210         '')
7211                 {
7212                         test "X$hostcat" = "Xypcat hosts" &&
7213                         ypmatch "$myhostname" hosts 2>/dev/null |\
7214                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7215                         $test -s hosts
7216                 } || {
7217                         test "X$hostcat" != "X" &&
7218                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7219                                         /[       ]$myhostname[  . ]/p" > hosts
7220                 }
7221                 tmp_re="[       . ]"
7222                 if $test -f hosts; then
7223                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7224                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7225                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7226                                 hosts | $sort | $uniq | \
7227                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7228                         case `$echo X$dflt` in
7229                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7230                                 dflt=.
7231                                 ;;
7232                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7233                                 ;;
7234                         esac
7235                 else
7236                         echo "(I cannot locate a hosts database anywhere)"
7237                         dflt=.
7238                 fi
7239                 case "$dflt" in
7240                 .)
7241                         tans=`./loc resolv.conf X /etc /usr/etc`
7242                         if $test -f "$tans"; then
7243                                 echo "(Attempting domain name extraction from $tans)"
7244                                 dflt=.`$sed -n -e 's/   / /g' \
7245                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7246                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7247                                 case "$dflt" in
7248                                 .) dflt=.`$sed -n -e 's/        / /g' \
7249                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7250                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7251                                         ;;
7252                                 esac
7253                         fi
7254                         ;;
7255                 esac
7256                 case "$dflt" in
7257                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7258                         dflt=.`sh -c domainname 2>/dev/null`
7259                         case "$dflt" in
7260                         '') dflt='.';;
7261                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7262                         esac
7263                         ;;
7264                 esac
7265                 case "$dflt" in
7266                 .) echo "(Lost all hope -- silly guess then)"
7267                         dflt='.uucp'
7268                         ;;
7269                 esac
7270                 $rm -f hosts
7271                 ;;
7272         *) dflt="$mydomain";;
7273         esac;;
7274 esac
7275 echo " "
7276 rp="What is your domain name?"
7277 . ./myread
7278 tans="$ans"
7279 case "$ans" in
7280 '') ;;
7281 .*) ;;
7282 *) tans=".$tans";;
7283 esac
7284 mydomain="$tans"
7285
7286 : translate upper to lower if necessary
7287 case "$mydomain" in
7288 *[A-Z]*)
7289         echo "(Normalizing case in your domain name)"
7290         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7291         ;;
7292 esac
7293
7294 : a little sanity check here
7295 case "$phostname" in
7296 '') ;;
7297 *)
7298         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7299         $myhostname$mydomain|$myhostname) ;;
7300         *)
7301                 case "$phostname" in
7302                 sed*)
7303                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7304                         ;;
7305                 *)
7306                         echo "(That doesn't agree with your $phostname command, by the way.)"
7307                         ;;
7308                 esac
7309         ;;
7310         esac
7311         ;;
7312 esac
7313
7314 $cat <<EOM
7315
7316 I need to get your e-mail address in Internet format if possible, i.e.
7317 something like user@host.domain. Please answer accurately since I have
7318 no easy means to double check it. The default value provided below
7319 is most probably close to reality but may not be valid from outside
7320 your organization...
7321
7322 EOM
7323 cont=x
7324 while test "$cont"; do
7325         case "$cf_email" in
7326         '') dflt="$cf_by@$myhostname$mydomain";;
7327         *) dflt="$cf_email";;
7328         esac
7329         rp='What is your e-mail address?'
7330         . ./myread
7331         cf_email="$ans"
7332         case "$cf_email" in
7333         *@*.*) cont='' ;;
7334         *)
7335                 rp='Address does not look like an Internet one.  Use it anyway?'
7336                 case "$fastread" in
7337                 yes) dflt=y ;;
7338                 *) dflt=n ;;
7339                 esac
7340                 . ./myread
7341                 case "$ans" in
7342                 y*) cont='' ;;
7343                 *) echo " " ;;
7344                 esac
7345                 ;;
7346         esac
7347 done
7348
7349 $cat <<EOM
7350
7351 If you or somebody else will be maintaining perl at your site, please
7352 fill in the correct e-mail address here so that they may be contacted
7353 if necessary. Currently, the "perlbug" program included with perl
7354 will send mail to this address in addition to perlbug@perl.org. You may
7355 enter "none" for no administrator.
7356
7357 EOM
7358 case "$perladmin" in
7359 '') dflt="$cf_email";;
7360 *) dflt="$perladmin";;
7361 esac
7362 rp='Perl administrator e-mail address'
7363 . ./myread
7364 perladmin="$ans"
7365
7366 : determine whether to only install version-specific parts.
7367 echo " "
7368 $cat <<EOM
7369 Do you want to install only the version-specific parts of the perl
7370 distribution?  Usually you do *not* want to do this.
7371 EOM
7372 case "$versiononly" in
7373 "$define"|[Yy]*|true) dflt='y' ;;
7374 *) dflt='n';
7375 esac
7376 rp="Do you want to install only the version-specific parts of perl?"
7377 . ./myread
7378 case "$ans" in
7379 [yY]*)  val="$define";;
7380 *)      val="$undef" ;;
7381 esac
7382 set versiononly
7383 eval $setvar
7384
7385 : figure out how to guarantee perl startup
7386 case "$startperl" in
7387 '')
7388         case "$sharpbang" in
7389         *!)
7390                 $cat <<EOH
7391
7392 I can use the #! construct to start perl on your system. This will
7393 make startup of perl scripts faster, but may cause problems if you
7394 want to share those scripts and perl is not in a standard place
7395 ($binexp/perl) on all your platforms. The alternative is to force
7396 a shell by starting the script with a single ':' character.
7397
7398 EOH
7399                 case "$versiononly" in
7400                 "$define")      dflt="$binexp/perl$version";;  
7401                 *)              dflt="$binexp/perl";;
7402                 esac
7403                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7404                 . ./myread
7405                 case "$ans" in
7406                 none)   startperl=": # use perl";;
7407                 *)      startperl="#!$ans"
7408                         if $test 30 -lt `echo "$ans" | wc -c`; then
7409                                 $cat >&4 <<EOM
7410
7411 WARNING:  Some systems limit the #! command to 32 characters.
7412 If you experience difficulty running Perl scripts with #!, try
7413 installing Perl in a directory with a shorter pathname.
7414
7415 EOM
7416                         fi ;;
7417                 esac
7418                 ;;
7419         *) startperl=": # use perl"
7420                 ;;
7421         esac
7422         ;;
7423 esac
7424 echo "I'll use $startperl to start perl scripts."
7425
7426 : figure best path for perl in scripts
7427 case "$perlpath" in
7428 '')
7429         perlpath="$binexp/perl"
7430         case "$startperl" in
7431         *!*) ;;
7432         *)
7433                 $cat <<EOH
7434
7435 I will use the "eval 'exec'" idiom to start Perl on your system.
7436 I can use the full path of your Perl binary for this purpose, but
7437 doing so may cause problems if you want to share those scripts and
7438 Perl is not always in a standard place ($binexp/perl).
7439
7440 EOH
7441                 dflt="$binexp/perl"
7442                 rp="What path shall I use in \"eval 'exec'\"?"
7443                 . ./myread
7444                 perlpath="$ans"
7445                 ;;
7446         esac
7447         ;;
7448 esac
7449 case "$startperl" in
7450 *!*)    ;;
7451 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7452 esac
7453
7454 : determine where public executable scripts go
7455 set scriptdir scriptdir
7456 eval $prefixit
7457 case "$scriptdir" in
7458 '')
7459         dflt="$bin"
7460         : guess some guesses
7461         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7462         $test -d /usr/share/bin     && dflt=/usr/share/bin
7463         $test -d /usr/local/script  && dflt=/usr/local/script
7464         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7465         $test -d $prefixexp/script  && dflt=$prefixexp/script
7466         set dflt
7467         eval $prefixup
7468         ;;
7469 *)  dflt="$scriptdir"
7470         ;;
7471 esac
7472 $cat <<EOM
7473  
7474 Some installations have a separate directory just for executable scripts so
7475 that they can mount it across multiple architectures but keep the scripts in
7476 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7477 Or you might just lump your scripts in with all your other executables.
7478  
7479 EOM
7480 fn=d~
7481 rp='Where do you keep publicly executable scripts?'
7482 . ./getfile
7483 if $test "X$ansexp" != "X$scriptdirexp"; then
7484         installscript=''
7485 fi
7486 scriptdir="$ans"
7487 scriptdirexp="$ansexp"
7488 : Change installation prefix, if necessary.
7489 if $test X"$prefix" != X"$installprefix"; then
7490         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7491 else
7492         installscript="$scriptdirexp"
7493 fi
7494
7495 : determine where add-on public executables go
7496 case "$sitebin" in
7497 '')     dflt=$siteprefix/bin ;;
7498 *)      dflt=$sitebin ;;
7499 esac
7500 fn=d~
7501 rp='Pathname where the add-on public executables should be installed?'
7502 . ./getfile
7503 sitebin="$ans"
7504 sitebinexp="$ansexp"
7505 : Change installation prefix, if necessary.
7506 if $test X"$prefix" != X"$installprefix"; then
7507         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7508 else
7509         installsitebin="$sitebinexp"
7510 fi
7511
7512 case "$useperlio" in
7513 $define|true|[yY]*)     dflt='y';;
7514 *) dflt='n';;
7515 esac
7516 cat <<EOM
7517
7518 Previous version of $package used the standard IO mechanisms as
7519 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7520 alternate IO mechanisms via the PerlIO abstraction layer, but the
7521 stdio mechanism is still the default.  This abstraction layer can
7522 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7523 Using PerlIO with sfio may cause problems with some extension modules.
7524
7525 If this doesn't make any sense to you, just accept the default '$dflt'.
7526 EOM
7527 rp='Use the experimental PerlIO abstraction layer?'
7528 . ./myread
7529 case "$ans" in
7530 y|Y) 
7531         val="$define"
7532         ;;     
7533 *)      
7534         echo "Ok, doing things the stdio way."
7535         val="$undef"
7536         ;;
7537 esac
7538 set useperlio
7539 eval $setvar 
7540
7541 case "$usesocks" in
7542 $define|true|[yY]*)
7543         case "$useperlio" in
7544         $define|true|[yY]*) ;;
7545         *)      cat >&4 <<EOM
7546
7547 You are using the SOCKS proxy protocol library which means that you
7548 should also use the PerlIO layer.  You may be headed for trouble.
7549
7550 EOM
7551                 ;;
7552         esac
7553         ;;
7554 esac
7555
7556         
7557 case "$vendorprefix" in
7558 '')     d_vendorbin="$undef"
7559         vendorbin=''
7560         vendorbinexp=''
7561         ;;
7562 *)      d_vendorbin="$define"
7563         : determine where vendor-supplied executables go.
7564         case "$vendorbin" in
7565         '') dflt=$vendorprefix/bin ;;
7566         *)      dflt="$vendorbin" ;;
7567         esac
7568         fn=d~+
7569         rp='Pathname for the vendor-supplied executables directory?'
7570         . ./getfile
7571         vendorbin="$ans"
7572         vendorbinexp="$ansexp"
7573         ;;
7574 esac
7575 : Change installation prefix, if necessary.
7576 if $test X"$prefix" != X"$installprefix"; then
7577         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7578 else
7579         installvendorbin="$vendorbinexp"
7580 fi
7581
7582 : see if qgcvt exists
7583 set qgcvt d_qgcvt
7584 eval $inlibc
7585
7586 echo " "
7587
7588 if $test X"$d_longdbl" = X"$define"; then
7589
7590 echo "Checking how to print long doubles..." >&4
7591
7592 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7593         $cat >try.c <<'EOCP'
7594 #include <sys/types.h>
7595 #include <stdio.h>
7596 int main() {
7597   double d = 123.456;
7598   printf("%.3f\n", d);
7599 }
7600 EOCP
7601         set try
7602         if eval $compile; then
7603                 yyy=`./try$exe_ext`
7604                 case "$yyy" in
7605                 123.456)
7606                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7607                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7608                         echo "We will use %f."
7609                         ;;
7610                 esac
7611         fi
7612 fi
7613
7614 if $test X"$sPRIfldbl" = X; then
7615         $cat >try.c <<'EOCP'
7616 #include <sys/types.h>
7617 #include <stdio.h>
7618 int main() {
7619   long double d = 123.456;
7620   printf("%.3llf\n", d);
7621 }
7622 EOCP
7623         set try
7624         if eval $compile; then
7625                 yyy=`./try$exe_ext`
7626                 case "$yyy" in
7627                 123.456)
7628                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7629                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7630                         echo "We will use %llf."
7631                         ;;
7632                 esac
7633         fi
7634 fi
7635
7636 if $test X"$sPRIfldbl" = X; then
7637         $cat >try.c <<'EOCP'
7638 #include <sys/types.h>
7639 #include <stdio.h>
7640 int main() {
7641   long double d = 123.456;
7642   printf("%.3Lf\n", d);
7643 }
7644 EOCP
7645         set try
7646         if eval $compile; then
7647                 yyy=`./try$exe_ext`
7648                 case "$yyy" in
7649                 123.456)
7650                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7651                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7652                         echo "We will use %Lf."
7653                         ;;
7654                 esac
7655         fi
7656 fi
7657
7658 if $test X"$sPRIfldbl" = X; then
7659         $cat >try.c <<'EOCP'
7660 #include <sys/types.h>
7661 #include <stdio.h>
7662 int main() {
7663   long double d = 123.456;
7664   printf("%.3lf\n", d);
7665 }
7666 EOCP
7667         set try
7668         if eval $compile; then
7669                 yyy=`./try$exe_ext`
7670                 case "$yyy" in
7671                 123.456)
7672                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7673                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7674                         echo "We will use %lf."
7675                         ;;
7676                 esac
7677         fi
7678 fi
7679
7680 if $test X"$sPRIfldbl" = X; then
7681         echo "Cannot figure out how to print long doubles." >&4
7682 else
7683         sSCNfldbl=$sPRIfldbl    # expect consistency
7684 fi
7685
7686 $rm -f try try.*
7687
7688 fi # d_longdbl
7689
7690 case "$sPRIfldbl" in
7691 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7692         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7693         d_SCNfldbl="$undef";
7694         ;;
7695 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7696         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7697         d_SCNfldbl="$define";
7698         ;;
7699 esac
7700
7701 : Check how to convert floats to strings.
7702 echo " "
7703 echo "Checking for an efficient way to convert floats to strings."
7704 echo " " > try.c
7705 case "$uselongdouble" in
7706 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7707 esac
7708 case "$d_longdbl" in
7709 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7710 esac
7711 case "$d_PRIgldbl" in
7712 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7713 esac
7714 $cat >>try.c <<EOP
7715 #ifdef TRY_gconvert
7716 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7717 char *myname = "gconvert";
7718 #endif
7719 #ifdef TRY_gcvt
7720 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7721 char *myname = "gcvt";
7722 #endif
7723 #ifdef TRY_qgcvt
7724 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7725 char *myname = "qgcvt";
7726 #define DOUBLETYPE long double
7727 #endif
7728 #ifdef TRY_sprintf
7729 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7730 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7731 #else
7732 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7733 #endif
7734 char *myname = "sprintf";
7735 #endif
7736
7737 #ifndef DOUBLETYPE
7738 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7739 #define DOUBLETYPE long double
7740 #else
7741 #define DOUBLETYPE double
7742 #endif
7743 #endif
7744
7745 #include <stdio.h>
7746
7747 #define I_STDLIB $i_stdlib
7748 #ifdef I_STDLIB
7749 #include <stdlib.h>
7750 #endif
7751
7752 int
7753 checkit(expect, got)
7754 char *expect;
7755 char *got;
7756 {
7757     if (strcmp(expect, got)) {
7758                 printf("%s oddity:  Expected %s, got %s\n",
7759                         myname, expect, got);
7760                 exit(1);
7761         }
7762 }
7763
7764 int main()
7765
7766         char buf[64]; 
7767         buf[63] = '\0';
7768
7769         /* This must be 1st test on (which?) platform */
7770         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7771         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7772         checkit("0.1", buf);
7773
7774         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7775         checkit("1", buf);
7776
7777         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7778         checkit("1.1", buf);
7779
7780         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7781         checkit("1.01", buf);
7782
7783         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7784         checkit("1.001", buf);
7785
7786         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7787         checkit("1.0001", buf);
7788
7789         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7790         checkit("1.00001", buf);
7791
7792         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7793         checkit("1.000001", buf);
7794
7795         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7796         checkit("0", buf);
7797
7798         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7799         checkit("-1", buf);
7800
7801         /* Some Linux gcvt's give 1.e+5 here. */
7802         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7803         checkit("100000", buf);
7804         
7805         /* Some Linux gcvt's give -1.e+5 here. */
7806         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7807         checkit("-100000", buf);
7808
7809         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7810         checkit("123.456", buf);
7811
7812         exit(0);
7813 }
7814 EOP
7815 case "$d_Gconvert" in
7816 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7817 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7818 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7819 *) xxx_list='gconvert gcvt sprintf' ;;
7820 esac
7821
7822 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7823 "$define$define$define")
7824     # for long doubles prefer first qgcvt, then sprintf
7825     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7826     xxx_list="sprintf $xxx_list"
7827     case "$d_qgcvt" in
7828     "$define") xxx_list="qgcvt $xxx_list" ;;
7829     esac
7830     ;;
7831 esac
7832
7833 for xxx_convert in $xxx_list; do
7834         echo "Trying $xxx_convert..."
7835         $rm -f try try$_o
7836         set try -DTRY_$xxx_convert
7837         if eval $compile; then
7838                 echo "$xxx_convert() found." >&4
7839                 if ./try; then
7840                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7841                         break;
7842                 else
7843                         echo "...But $xxx_convert didn't work as I expected."
7844                 fi
7845         else
7846                 echo "$xxx_convert NOT found." >&4
7847         fi
7848 done
7849         
7850 case "$xxx_convert" in
7851 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7852 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7853 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7854 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7855    "$define$define$define")
7856       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7857    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7858    esac
7859    ;;  
7860 esac
7861
7862 : see if _fwalk exists
7863 set fwalk d__fwalk
7864 eval $inlibc
7865
7866 : Initialize h_fcntl
7867 h_fcntl=false
7868
7869 : Initialize h_sysfile
7870 h_sysfile=false
7871
7872 : access call always available on UNIX
7873 set access d_access
7874 eval $inlibc
7875
7876 : locate the flags for 'access()'
7877 case "$d_access" in
7878 "$define")
7879         echo " "
7880         $cat >access.c <<'EOCP'
7881 #include <sys/types.h>
7882 #ifdef I_FCNTL
7883 #include <fcntl.h>
7884 #endif
7885 #ifdef I_SYS_FILE
7886 #include <sys/file.h>
7887 #endif
7888 #ifdef I_UNISTD
7889 #include <unistd.h>
7890 #endif
7891 int main() {
7892         exit(R_OK);
7893 }
7894 EOCP
7895         : check sys/file.h first, no particular reason here
7896         if $test `./findhdr sys/file.h` && \
7897                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7898                 h_sysfile=true;
7899                 echo "<sys/file.h> defines the *_OK access constants." >&4
7900         elif $test `./findhdr fcntl.h` && \
7901                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7902                 h_fcntl=true;
7903                 echo "<fcntl.h> defines the *_OK access constants." >&4
7904         elif $test `./findhdr unistd.h` && \
7905                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7906                 echo "<unistd.h> defines the *_OK access constants." >&4
7907         else
7908                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7909         fi
7910         ;;
7911 esac
7912 $rm -f access*
7913
7914 : see if accessx exists
7915 set accessx d_accessx
7916 eval $inlibc
7917
7918 : see if alarm exists
7919 set alarm d_alarm
7920 eval $inlibc
7921
7922 : see if atolf exists
7923 set atolf d_atolf
7924 eval $inlibc
7925
7926 : see if atoll exists
7927 set atoll d_atoll
7928 eval $inlibc
7929
7930 : Look for GNU-cc style attribute checking
7931 echo " "
7932 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7933 $cat >attrib.c <<'EOCP'
7934 #include <stdio.h>
7935 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7936 EOCP
7937 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7938         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7939                 echo "Your C compiler doesn't fully support __attribute__."
7940                 val="$undef"
7941         else
7942                 echo "Your C compiler supports __attribute__."
7943                 val="$define"
7944         fi
7945 else
7946         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7947         val="$undef"
7948 fi
7949 set d_attribut
7950 eval $setvar
7951 $rm -f attrib*
7952
7953 : see if bcmp exists
7954 set bcmp d_bcmp
7955 eval $inlibc
7956
7957 : see if bcopy exists
7958 set bcopy d_bcopy
7959 eval $inlibc
7960
7961 : see if this is a unistd.h system
7962 set unistd.h i_unistd
7963 eval $inhdr
7964
7965 : see if getpgrp exists
7966 set getpgrp d_getpgrp
7967 eval $inlibc
7968
7969 case "$d_getpgrp" in
7970 "$define")
7971         echo " "
7972         echo "Checking to see which flavor of getpgrp is in use..."
7973         $cat >set.c <<EOP
7974 #$i_unistd I_UNISTD
7975 #include <sys/types.h>
7976 #ifdef I_UNISTD
7977 #  include <unistd.h>
7978 #endif
7979 int main()
7980 {
7981         if (getuid() == 0) {
7982                 printf("(I see you are running Configure as super-user...)\n");
7983                 setuid(1);
7984         }
7985 #ifdef TRY_BSD_PGRP
7986         if (getpgrp(1) == 0)
7987                 exit(0);
7988 #else
7989         if (getpgrp() > 0)
7990                 exit(0);
7991 #endif
7992         exit(1);
7993 }
7994 EOP
7995         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7996                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7997                 val="$define"
7998         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7999                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8000                 val="$undef"
8001         else
8002                 echo "I can't seem to compile and run the test program."
8003                 if ./usg; then
8004                         xxx="a USG one, i.e. you use getpgrp()."
8005                 else
8006                         # SVR4 systems can appear rather BSD-ish.
8007                         case "$i_unistd" in
8008                         $undef)
8009                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8010                                 val="$define"
8011                                 ;;
8012                         $define)
8013                                 xxx="probably a USG one, i.e. you use getpgrp()."
8014                                 val="$undef"
8015                                 ;;
8016                         esac
8017                 fi
8018                 echo "Assuming your getpgrp is $xxx" >&4
8019         fi
8020         ;;
8021 *) val="$undef";;
8022 esac
8023 set d_bsdgetpgrp
8024 eval $setvar
8025 $rm -f set set.c
8026
8027 : see if setpgrp exists
8028 set setpgrp d_setpgrp
8029 eval $inlibc
8030
8031 case "$d_setpgrp" in
8032 "$define")
8033         echo " "
8034         echo "Checking to see which flavor of setpgrp is in use..."
8035         $cat >set.c <<EOP
8036 #$i_unistd I_UNISTD
8037 #include <sys/types.h>
8038 #ifdef I_UNISTD
8039 #  include <unistd.h>
8040 #endif
8041 int main()
8042 {
8043         if (getuid() == 0) {
8044                 printf("(I see you are running Configure as super-user...)\n");
8045                 setuid(1);
8046         }
8047 #ifdef TRY_BSD_PGRP
8048         if (-1 == setpgrp(1, 1))
8049                 exit(0);
8050 #else
8051         if (setpgrp() != -1)
8052                 exit(0);
8053 #endif
8054         exit(1);
8055 }
8056 EOP
8057         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8058                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8059                 val="$define"
8060         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8061                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8062                 val="$undef"
8063         else
8064                 echo "(I can't seem to compile and run the test program.)"
8065                 if ./usg; then
8066                         xxx="a USG one, i.e. you use setpgrp()."
8067                 else
8068                         # SVR4 systems can appear rather BSD-ish.
8069                         case "$i_unistd" in
8070                         $undef)
8071                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8072                                 val="$define"
8073                                 ;;
8074                         $define)
8075                                 xxx="probably a USG one, i.e. you use setpgrp()."
8076                                 val="$undef"
8077                                 ;;
8078                         esac
8079                 fi
8080                 echo "Assuming your setpgrp is $xxx" >&4
8081         fi
8082         ;;
8083 *) val="$undef";;
8084 esac
8085 set d_bsdsetpgrp
8086 eval $setvar
8087 $rm -f set set.c
8088 : see if bzero exists
8089 set bzero d_bzero
8090 eval $inlibc
8091
8092 : see if signal is declared as pointer to function returning int or void
8093 echo " "
8094 xxx=`./findhdr signal.h`
8095 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8096 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8097         echo "You have int (*signal())() instead of void." >&4
8098         val="$undef"
8099 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8100         echo "You have void (*signal())()." >&4
8101         val="$define"
8102 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8103         echo "You have int (*signal())() instead of void." >&4
8104         val="$undef"
8105 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8106         echo "You have void (*signal())()." >&4
8107         val="$define"
8108 else
8109         case "$d_voidsig" in
8110         '')
8111         echo "I can't determine whether signal handler returns void or int..." >&4
8112                 dflt=void
8113                 rp="What type does your signal handler return?"
8114                 . ./myread
8115                 case "$ans" in
8116                 v*) val="$define";;
8117                 *) val="$undef";;
8118                 esac;;
8119         "$define")
8120                 echo "As you already told me, signal handler returns void." >&4
8121                 val="$define"
8122                 ;;
8123         *)      echo "As you already told me, signal handler returns int." >&4
8124                 val="$undef"
8125                 ;;
8126         esac
8127 fi
8128 set d_voidsig
8129 eval $setvar
8130 case "$d_voidsig" in
8131 "$define") signal_t="void";;
8132 *) signal_t="int";;
8133 esac
8134 $rm -f $$.tmp
8135
8136 : check for ability to cast large floats to 32-bit ints.
8137 echo " "
8138 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8139 if $test "$intsize" -ge 4; then
8140         xxx=int
8141 else
8142         xxx=long
8143 fi
8144 $cat >try.c <<EOCP
8145 #include <stdio.h>
8146 #include <sys/types.h>
8147 #include <signal.h>
8148 $signal_t blech(s) int s; { exit(3); }
8149 int main()
8150 {
8151         $xxx i32;
8152         double f, g;
8153         int result = 0;
8154         char str[16];
8155         signal(SIGFPE, blech);
8156
8157         /* Don't let compiler optimize the test away.  Store the number 
8158            in a writable string for gcc to pass to sscanf under HP/UX.
8159         */
8160         sprintf(str, "2147483647");
8161         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8162         g = 10 * f;
8163         i32  = ($xxx) g;
8164
8165         /* x86 processors will probably give 0x8000 0000, which is a
8166        sign change.  We don't want that.  We want to mimic SPARC
8167            behavior here, which is to preserve the sign and give
8168            back 0x7fff ffff.
8169         */
8170         if (i32 != ($xxx) f)
8171                 result |= 1;
8172         exit(result);
8173 }
8174 EOCP
8175 set try
8176 if eval $compile_ok; then
8177         ./try
8178         yyy=$?
8179 else
8180         echo "(I can't seem to compile the test program--assuming it can't)"
8181         yyy=1
8182 fi
8183 case "$yyy" in
8184 0)      val="$define"
8185         echo "Yup, it can."
8186         ;;
8187 *)      val="$undef"
8188         echo "Nope, it can't."
8189         ;;
8190 esac
8191 set d_casti32
8192 eval $setvar
8193 $rm -f try try.*
8194
8195 : check for ability to cast negative floats to unsigned
8196 echo " "
8197 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8198 $cat >try.c <<EOCP
8199 #include <stdio.h>
8200 #include <sys/types.h>
8201 #include <signal.h>
8202 $signal_t blech(s) int s; { exit(7); }
8203 $signal_t blech_in_list(s) int s; { exit(4); }
8204 unsigned long dummy_long(p) unsigned long p; { return p; }
8205 unsigned int dummy_int(p) unsigned int p; { return p; }
8206 unsigned short dummy_short(p) unsigned short p; { return p; }
8207 int main()
8208 {
8209         double f;
8210         unsigned long along;
8211         unsigned int aint;
8212         unsigned short ashort;
8213         int result = 0;
8214         char str[16];
8215         
8216         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8217            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8218            optimized the whole file away
8219         */
8220         /* Store the number in a writable string for gcc to pass to 
8221            sscanf under HP/UX.
8222         */
8223         sprintf(str, "-123");
8224         sscanf(str, "%lf", &f);  /* f = -123.; */
8225
8226         signal(SIGFPE, blech);
8227         along = (unsigned long)f;
8228         aint = (unsigned int)f;
8229         ashort = (unsigned short)f;
8230         if (along != (unsigned long)-123)
8231                 result |= 1;
8232         if (aint != (unsigned int)-123)
8233                 result |= 1;
8234         if (ashort != (unsigned short)-123)
8235                 result |= 1;
8236         sprintf(str, "1073741824.");
8237         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8238         f = f + f;
8239         along = 0;
8240         along = (unsigned long)f;
8241         if (along != 0x80000000)
8242                 result |= 2;
8243         f -= 1.;
8244         along = 0;
8245         along = (unsigned long)f;
8246         if (along != 0x7fffffff)
8247                 result |= 1;
8248         f += 2.;
8249         along = 0;
8250         along = (unsigned long)f;
8251         if (along != 0x80000001)
8252                 result |= 2;
8253         if (result)
8254                 exit(result);
8255         signal(SIGFPE, blech_in_list);
8256         sprintf(str, "123.");
8257         sscanf(str, "%lf", &f);  /* f = 123.; */
8258         along = dummy_long((unsigned long)f);
8259         aint = dummy_int((unsigned int)f);
8260         ashort = dummy_short((unsigned short)f);
8261         if (along != (unsigned long)123)
8262                 result |= 4;
8263         if (aint != (unsigned int)123)
8264                 result |= 4;
8265         if (ashort != (unsigned short)123)
8266                 result |= 4;
8267         exit(result);
8268
8269 }
8270 EOCP
8271 set try
8272 if eval $compile_ok; then
8273         ./try
8274         castflags=$?
8275 else
8276         echo "(I can't seem to compile the test program--assuming it can't)"
8277         castflags=7
8278 fi
8279 case "$castflags" in
8280 0)      val="$define"
8281         echo "Yup, it can."
8282         ;;
8283 *)      val="$undef"
8284         echo "Nope, it can't."
8285         ;;
8286 esac
8287 set d_castneg
8288 eval $setvar
8289 $rm -f try.*
8290
8291 : see if vprintf exists
8292 echo " "
8293 if set vprintf val -f d_vprintf; eval $csym; $val; then
8294         echo 'vprintf() found.' >&4
8295         val="$define"
8296         $cat >vprintf.c <<'EOF'
8297 #include <varargs.h>
8298
8299 int main() { xxx("foo"); }
8300
8301 xxx(va_alist)
8302 va_dcl
8303 {
8304         va_list args;
8305         char buf[10];
8306
8307         va_start(args);
8308         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8309 }
8310 EOF
8311         set vprintf
8312         if eval $compile && ./vprintf; then
8313                 echo "Your vsprintf() returns (int)." >&4
8314                 val2="$undef"
8315         else
8316                 echo "Your vsprintf() returns (char*)." >&4
8317                 val2="$define"
8318         fi
8319 else
8320         echo 'vprintf() NOT found.' >&4
8321                 val="$undef"
8322                 val2="$undef"
8323 fi
8324 set d_vprintf
8325 eval $setvar
8326 val=$val2
8327 set d_charvspr
8328 eval $setvar
8329
8330 : see if chown exists
8331 set chown d_chown
8332 eval $inlibc
8333
8334 : see if chroot exists
8335 set chroot d_chroot
8336 eval $inlibc
8337
8338 : see if chsize exists
8339 set chsize d_chsize
8340 eval $inlibc
8341
8342 : check for const keyword
8343 echo " "
8344 echo 'Checking to see if your C compiler knows about "const"...' >&4
8345 $cat >const.c <<'EOCP'
8346 typedef struct spug { int drokk; } spug;
8347 int main()
8348 {
8349         const char *foo;
8350         const spug y;
8351 }
8352 EOCP
8353 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8354         val="$define"
8355         echo "Yup, it does."
8356 else
8357         val="$undef"
8358         echo "Nope, it doesn't."
8359 fi
8360 set d_const
8361 eval $setvar
8362
8363 : see if crypt exists
8364 echo " "
8365 if set crypt val -f d_crypt; eval $csym; $val; then
8366         echo 'crypt() found.' >&4
8367         val="$define"
8368         cryptlib=''
8369 else
8370         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8371         if $test -z "$cryptlib"; then
8372                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8373         else
8374                 cryptlib=-lcrypt
8375         fi
8376         if $test -z "$cryptlib"; then
8377                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8378         else
8379                 cryptlib=-lcrypt
8380         fi
8381         if $test -z "$cryptlib"; then
8382                 cryptlib=`./loc libcrypt$_a "" $libpth`
8383         else
8384                 cryptlib=-lcrypt
8385         fi
8386         if $test -z "$cryptlib"; then
8387                 echo 'crypt() NOT found.' >&4
8388                 val="$undef"
8389         else
8390                 val="$define"
8391         fi
8392 fi
8393 set d_crypt
8394 eval $setvar
8395
8396 : get csh whereabouts
8397 case "$csh" in
8398 'csh') val="$undef" ;;
8399 *) val="$define" ;;
8400 esac
8401 set d_csh
8402 eval $setvar
8403 : Respect a hint or command line value for full_csh.
8404 case "$full_csh" in
8405 '') full_csh=$csh ;;
8406 esac
8407
8408 : see if cuserid exists
8409 set cuserid d_cuserid
8410 eval $inlibc
8411
8412 : see if this is a limits.h system
8413 set limits.h i_limits
8414 eval $inhdr
8415
8416 : see if this is a float.h system
8417 set float.h i_float
8418 eval $inhdr
8419
8420 : See if number of significant digits in a double precision number is known
8421 echo " "
8422 $cat >dbl_dig.c <<EOM
8423 #$i_limits I_LIMITS
8424 #$i_float I_FLOAT
8425 #ifdef I_LIMITS
8426 #include <limits.h>
8427 #endif
8428 #ifdef I_FLOAT
8429 #include <float.h>
8430 #endif
8431 #ifdef DBL_DIG
8432 printf("Contains DBL_DIG");
8433 #endif
8434 EOM
8435 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8436 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8437         echo "DBL_DIG found." >&4
8438         val="$define"
8439 else
8440         echo "DBL_DIG NOT found." >&4
8441         val="$undef"
8442 fi
8443 $rm -f dbl_dig.?
8444 set d_dbl_dig
8445 eval $setvar
8446
8447 : see if difftime exists
8448 set difftime d_difftime
8449 eval $inlibc
8450
8451 : see if this is a dirent system
8452 echo " "
8453 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8454         val="$define"
8455         echo "<dirent.h> found." >&4
8456 else
8457         val="$undef"
8458         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8459                 echo "<sys/dir.h> found." >&4
8460                 echo " "
8461         else
8462                 xinc=`./findhdr sys/ndir.h`
8463         fi
8464         echo "<dirent.h> NOT found." >&4
8465 fi
8466 set i_dirent
8467 eval $setvar
8468
8469 : Look for type of directory structure.
8470 echo " "
8471 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8472
8473 case "$direntrytype" in
8474 ''|' ')
8475         case "$i_dirent" in
8476         $define) guess1='struct dirent' ;;
8477         *) guess1='struct direct'  ;;
8478         esac
8479         ;;
8480 *)      guess1="$direntrytype"
8481         ;;
8482 esac
8483
8484 case "$guess1" in
8485 'struct dirent') guess2='struct direct' ;;
8486 *) guess2='struct dirent' ;;
8487 esac
8488                 
8489 if $contains "$guess1" try.c >/dev/null 2>&1; then
8490         direntrytype="$guess1"
8491         echo "Your directory entries are $direntrytype." >&4
8492 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8493         direntrytype="$guess2"
8494         echo "Your directory entries seem to be $direntrytype." >&4
8495 else
8496         echo "I don't recognize your system's directory entries." >&4
8497         rp="What type is used for directory entries on this system?"
8498         dflt="$guess1"
8499         . ./myread
8500         direntrytype="$ans"
8501 fi
8502 $rm -f try.c
8503
8504
8505 : see if the directory entry stores field length
8506 echo " "
8507 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8508 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8509         echo "Good, your directory entry keeps length information in d_namlen." >&4
8510         val="$define"
8511 else
8512         echo "Your directory entry does not know about the d_namlen field." >&4
8513         val="$undef"
8514 fi
8515 set d_dirnamlen
8516 eval $setvar
8517 $rm -f try.c
8518
8519 : see if dlerror exists
8520 xxx_runnm="$runnm"
8521 runnm=false
8522 set dlerror d_dlerror
8523 eval $inlibc
8524 runnm="$xxx_runnm"
8525
8526 : see if dlfcn is available
8527 set dlfcn.h i_dlfcn
8528 eval $inhdr
8529
8530 case "$usedl" in
8531 $define|y|true)
8532         $cat << EOM
8533
8534 On a few systems, the dynamically loaded modules that perl generates and uses
8535 will need a different extension than shared libs. The default will probably
8536 be appropriate.
8537
8538 EOM
8539         case "$dlext" in
8540         '')     dflt="$so" ;;
8541         *)      dflt="$dlext" ;;
8542         esac
8543         rp='What is the extension of dynamically loaded modules'
8544         . ./myread
8545         dlext="$ans"
8546         ;;
8547 *)
8548         dlext="none"
8549         ;;
8550 esac
8551
8552 : Check if dlsym need a leading underscore
8553 echo " "
8554 val="$undef"
8555
8556 case "$dlsrc" in
8557 dl_dlopen.xs)
8558         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8559         $cat >dyna.c <<'EOM'
8560 fred () { }
8561 EOM
8562
8563 $cat >fred.c<<EOM
8564
8565 #include <stdio.h>
8566 #$i_dlfcn I_DLFCN
8567 #ifdef I_DLFCN
8568 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8569 #else
8570 #include <sys/types.h>
8571 #include <nlist.h>
8572 #include <link.h>
8573 #endif
8574
8575 extern int fred() ;
8576
8577 int main()
8578 {
8579     void * handle ;
8580     void * symbol ;
8581 #ifndef RTLD_LAZY
8582     int mode = 1 ;
8583 #else
8584     int mode = RTLD_LAZY ;
8585 #endif
8586     handle = dlopen("./dyna.$dlext", mode) ;
8587     if (handle == NULL) {
8588         printf ("1\n") ;
8589         fflush (stdout) ;
8590         exit(0);
8591     }
8592     symbol = dlsym(handle, "fred") ;
8593     if (symbol == NULL) {
8594         /* try putting a leading underscore */
8595         symbol = dlsym(handle, "_fred") ;
8596         if (symbol == NULL) {
8597             printf ("2\n") ;
8598             fflush (stdout) ;
8599             exit(0);
8600         }
8601         printf ("3\n") ;
8602     }
8603     else
8604         printf ("4\n") ;
8605     fflush (stdout) ;
8606     exit(0);
8607 }
8608 EOM
8609         : Call the object file tmp-dyna.o in case dlext=o.
8610         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8611                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8612                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8613                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8614                 xxx=`./fred`
8615                 case $xxx in
8616                 1)      echo "Test program failed using dlopen." >&4
8617                         echo "Perhaps you should not use dynamic loading." >&4;;
8618                 2)      echo "Test program failed using dlsym." >&4
8619                         echo "Perhaps you should not use dynamic loading." >&4;;
8620                 3)      echo "dlsym needs a leading underscore" >&4
8621                         val="$define" ;;
8622                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8623                 esac
8624         else
8625                 echo "I can't compile and run the test program." >&4
8626                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8627         fi
8628         ;;
8629 esac
8630                 
8631 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8632
8633 set d_dlsymun
8634 eval $setvar
8635
8636 hasproto='varname=$1; func=$2; shift; shift;
8637 while $test $# -ge 2; do
8638         case "$1" in
8639         $define) echo "#include <$2>";;
8640         esac ;
8641     shift 2;
8642 done > try.c;
8643 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8644 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8645         echo "$func() prototype found.";
8646         val="$define";
8647 else
8648         echo "$func() prototype NOT found.";
8649         val="$undef";
8650 fi;
8651 set $varname;
8652 eval $setvar;
8653 $rm -f try.c tryout.c'
8654
8655 : see if prototype for drand48 is available
8656 echo " "
8657 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8658 eval $hasproto
8659
8660 : see if dup2 exists
8661 set dup2 d_dup2
8662 eval $inlibc
8663
8664 : see if eaccess exists
8665 set eaccess d_eaccess
8666 eval $inlibc
8667
8668 : see if endgrent exists
8669 set endgrent d_endgrent
8670 eval $inlibc
8671
8672 : see if endhostent exists
8673 set endhostent d_endhent
8674 eval $inlibc
8675
8676 : see if endnetent exists
8677 set endnetent d_endnent
8678 eval $inlibc
8679
8680 : see if endprotoent exists
8681 set endprotoent d_endpent
8682 eval $inlibc
8683
8684 : see if endpwent exists
8685 set endpwent d_endpwent
8686 eval $inlibc
8687
8688 : see if endservent exists
8689 set endservent d_endsent
8690 eval $inlibc
8691
8692 : Locate the flags for 'open()'
8693 echo " "
8694 $cat >open3.c <<'EOCP'
8695 #include <sys/types.h>
8696 #ifdef I_FCNTL
8697 #include <fcntl.h>
8698 #endif
8699 #ifdef I_SYS_FILE
8700 #include <sys/file.h>
8701 #endif
8702 int main() {
8703         if(O_RDONLY);
8704 #ifdef O_TRUNC
8705         exit(0);
8706 #else
8707         exit(1);
8708 #endif
8709 }
8710 EOCP
8711 : check sys/file.h first to get FREAD on Sun
8712 if $test `./findhdr sys/file.h` && \
8713                 set open3 -DI_SYS_FILE && eval $compile; then
8714         h_sysfile=true;
8715         echo "<sys/file.h> defines the O_* constants..." >&4
8716         if ./open3; then
8717                 echo "and you have the 3 argument form of open()." >&4
8718                 val="$define"
8719         else
8720                 echo "but not the 3 argument form of open().  Oh, well." >&4
8721                 val="$undef"
8722         fi
8723 elif $test `./findhdr fcntl.h` && \
8724                 set open3 -DI_FCNTL && eval $compile; then
8725         h_fcntl=true;
8726         echo "<fcntl.h> defines the O_* constants..." >&4
8727         if ./open3; then
8728                 echo "and you have the 3 argument form of open()." >&4
8729                 val="$define"
8730         else
8731                 echo "but not the 3 argument form of open().  Oh, well." >&4
8732                 val="$undef"
8733         fi
8734 else
8735         val="$undef"
8736         echo "I can't find the O_* constant definitions!  You got problems." >&4
8737 fi
8738 set d_open3
8739 eval $setvar
8740 $rm -f open3*
8741
8742 : see which of string.h or strings.h is needed
8743 echo " "
8744 strings=`./findhdr string.h`
8745 if $test "$strings" && $test -r "$strings"; then
8746         echo "Using <string.h> instead of <strings.h>." >&4
8747         val="$define"
8748 else
8749         val="$undef"
8750         strings=`./findhdr strings.h`
8751         if $test "$strings" && $test -r "$strings"; then
8752                 echo "Using <strings.h> instead of <string.h>." >&4
8753         else
8754                 echo "No string header found -- You'll surely have problems." >&4
8755         fi
8756 fi
8757 set i_string
8758 eval $setvar
8759 case "$i_string" in
8760 "$undef") strings=`./findhdr strings.h`;;
8761 *)        strings=`./findhdr string.h`;;
8762 esac
8763
8764 : check for non-blocking I/O stuff
8765 case "$h_sysfile" in
8766 true) echo "#include <sys/file.h>" > head.c;;
8767 *)
8768         case "$h_fcntl" in
8769         true) echo "#include <fcntl.h>" > head.c;;
8770         *) echo "#include <sys/fcntl.h>" > head.c;;
8771         esac
8772         ;;
8773 esac
8774 echo " "
8775 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8776 case "$o_nonblock" in
8777 '')
8778         $cat head.c > try.c
8779         $cat >>try.c <<'EOCP'
8780 #include <stdio.h>
8781 int main() {
8782 #ifdef O_NONBLOCK
8783         printf("O_NONBLOCK\n");
8784         exit(0);
8785 #endif
8786 #ifdef O_NDELAY
8787         printf("O_NDELAY\n");
8788         exit(0);
8789 #endif
8790 #ifdef FNDELAY
8791         printf("FNDELAY\n");
8792         exit(0);
8793 #endif
8794         exit(0);
8795 }
8796 EOCP
8797         set try
8798         if eval $compile_ok; then
8799                 o_nonblock=`./try`
8800                 case "$o_nonblock" in
8801                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8802                 *) echo "Seems like we can use $o_nonblock.";;
8803                 esac
8804         else
8805                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8806         fi
8807         ;;
8808 *) echo "Using $hint value $o_nonblock.";;
8809 esac
8810 $rm -f try try.* .out core
8811
8812 echo " "
8813 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8814 case "$eagain" in
8815 '')
8816         $cat head.c > try.c
8817         $cat >>try.c <<EOCP
8818 #include <errno.h>
8819 #include <sys/types.h>
8820 #include <signal.h>
8821 #include <stdio.h> 
8822 #define MY_O_NONBLOCK $o_nonblock
8823 #ifndef errno  /* XXX need better Configure test */
8824 extern int errno;
8825 #endif
8826 #$i_unistd I_UNISTD
8827 #ifdef I_UNISTD
8828 #include <unistd.h>
8829 #endif
8830 #$i_string I_STRING
8831 #ifdef I_STRING
8832 #include <string.h>
8833 #else
8834 #include <strings.h>
8835 #endif
8836 $signal_t blech(x) int x; { exit(3); }
8837 EOCP
8838         $cat >> try.c <<'EOCP'
8839 int main()
8840 {
8841         int pd[2];
8842         int pu[2];
8843         char buf[1];
8844         char string[100];
8845
8846         pipe(pd);       /* Down: child -> parent */
8847         pipe(pu);       /* Up: parent -> child */
8848         if (0 != fork()) {
8849                 int ret;
8850                 close(pd[1]);   /* Parent reads from pd[0] */
8851                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8852                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8853                         exit(1);
8854                 signal(SIGALRM, blech);
8855                 alarm(5);
8856                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8857                         exit(2);
8858                 sprintf(string, "%d\n", ret);
8859                 write(2, string, strlen(string));
8860                 alarm(0);
8861 #ifdef EAGAIN
8862                 if (errno == EAGAIN) {
8863                         printf("EAGAIN\n");
8864                         goto ok;
8865                 }
8866 #endif
8867 #ifdef EWOULDBLOCK
8868                 if (errno == EWOULDBLOCK)
8869                         printf("EWOULDBLOCK\n");
8870 #endif
8871         ok:
8872                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8873                 sleep(2);                               /* Give it time to close our pipe */
8874                 alarm(5);
8875                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8876                 alarm(0);
8877                 sprintf(string, "%d\n", ret);
8878                 write(3, string, strlen(string));
8879                 exit(0);
8880         }
8881
8882         close(pd[0]);                   /* We write to pd[1] */
8883         close(pu[1]);                   /* We read from pu[0] */
8884         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8885         close(pd[1]);                   /* Pipe pd is now fully closed! */
8886         exit(0);                                /* Bye bye, thank you for playing! */
8887 }
8888 EOCP
8889         set try
8890         if eval $compile_ok; then
8891                 echo "$startsh" >mtry
8892                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8893                 chmod +x mtry
8894                 ./mtry >/dev/null 2>&1
8895                 case $? in
8896                 0) eagain=`$cat try.out`;;
8897                 1) echo "Could not perform non-blocking setting!";;
8898                 2) echo "I did a successful read() for something that was not there!";;
8899                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8900                 *) echo "Something terribly wrong happened during testing.";;
8901                 esac
8902                 rd_nodata=`$cat try.ret`
8903                 echo "A read() system call with no data present returns $rd_nodata."
8904                 case "$rd_nodata" in
8905                 0|-1) ;;
8906                 *)
8907                         echo "(That's peculiar, fixing that to be -1.)"
8908                         rd_nodata=-1
8909                         ;;
8910                 esac
8911                 case "$eagain" in
8912                 '')
8913                         echo "Forcing errno EAGAIN on read() with no data available."
8914                         eagain=EAGAIN
8915                         ;;
8916                 *)
8917                         echo "Your read() sets errno to $eagain when no data is available."
8918                         ;;
8919                 esac
8920                 status=`$cat try.err`
8921                 case "$status" in
8922                 0) echo "And it correctly returns 0 to signal EOF.";;
8923                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8924                 *) echo "However, your read() returns '$status' on EOF??";;
8925                 esac
8926                 val="$define"
8927                 if test "$status" = "$rd_nodata"; then
8928                         echo "WARNING: you can't distinguish between EOF and no data!"
8929                         val="$undef"
8930                 fi
8931         else
8932                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8933                 eagain=EAGAIN
8934         fi
8935         set d_eofnblk
8936         eval $setvar
8937         ;;
8938 *)
8939         echo "Using $hint value $eagain."
8940         echo "Your read() returns $rd_nodata when no data is present."
8941         case "$d_eofnblk" in
8942         "$define") echo "And you can see EOF because read() returns 0.";;
8943         "$undef") echo "But you can't see EOF status from read() returned value.";;
8944         *)
8945                 echo "(Assuming you can't see EOF status from read anyway.)"
8946                 d_eofnblk=$undef
8947                 ;;
8948         esac
8949         ;;
8950 esac
8951 $rm -f try try.* .out core head.c mtry
8952
8953 : see if fchmod exists
8954 set fchmod d_fchmod
8955 eval $inlibc
8956
8957 : see if fchown exists
8958 set fchown d_fchown
8959 eval $inlibc
8960
8961 : see if this is an fcntl system
8962 set fcntl d_fcntl
8963 eval $inlibc
8964
8965 echo " "
8966 : See if fcntl-based locking works.
8967 $cat >try.c <<'EOCP'
8968 #include <stdlib.h>
8969 #include <unistd.h>
8970 #include <fcntl.h>
8971 int main() {
8972 #if defined(F_SETLK) && defined(F_SETLKW)
8973      struct flock flock;
8974      int retval, fd;
8975      fd = open("try.c", O_RDONLY);
8976      flock.l_type = F_RDLCK;
8977      flock.l_whence = SEEK_SET;
8978      flock.l_start = flock.l_len = 0;
8979      retval = fcntl(fd, F_SETLK, &flock);
8980      close(fd);
8981      (retval < 0 ? exit(2) : exit(0));
8982 #else
8983      exit(2);
8984 #endif
8985 }
8986 EOCP
8987 echo "Checking if fcntl-based file locking works... "
8988 case "$d_fcntl" in
8989 "$define")
8990         set try
8991         if eval $compile_ok; then
8992                 if ./try; then
8993                         echo "Yes, it seems to work."
8994                         val="$define"
8995                 else
8996                         echo "Nope, it didn't work."
8997                         val="$undef"
8998                 fi
8999         else
9000                 echo "I'm unable to compile the test program, so I'll assume not."
9001                 val="$undef"
9002         fi
9003         ;;
9004 *) val="$undef";
9005         echo "Nope, since you don't even have fcntl()."
9006         ;;
9007 esac
9008 set d_fcntl_can_lock
9009 eval $setvar
9010 $rm -f try*
9011
9012
9013 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9014 while $test $# -ge 2; do
9015         case "$1" in
9016         $define) echo "#include <$2>";;
9017         esac ;
9018     shift 2;
9019 done > try.c;
9020 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9021 set try;
9022 if eval $compile; then
9023         val="$define";
9024 else
9025         val="$undef";
9026 fi;
9027 set $varname;
9028 eval $setvar;
9029 $rm -f try.c try.o'
9030
9031 socketlib=''
9032 sockethdr=''
9033 : see whether socket exists
9034 echo " "
9035 $echo $n "Hmm... $c" >&4
9036 if set socket val -f d_socket; eval $csym; $val; then
9037         echo "Looks like you have Berkeley networking support." >&4
9038         d_socket="$define"
9039         if set setsockopt val -f; eval $csym; $val; then
9040                 d_oldsock="$undef"
9041         else
9042                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9043                 d_oldsock="$define"
9044         fi
9045 else
9046         if $contains socklib libc.list >/dev/null 2>&1; then
9047                 echo "Looks like you have Berkeley networking support." >&4
9048                 d_socket="$define"
9049                 : we will have to assume that it supports the 4.2 BSD interface
9050                 d_oldsock="$undef"
9051         else
9052                 echo "You don't have Berkeley networking in libc$_a..." >&4
9053                 if test "X$d_socket" = "X$define"; then
9054                    echo "...but you seem to believe that you have sockets." >&4
9055                 else
9056                         for net in net socket
9057                         do
9058                                 if test -f /usr/lib/lib$net$_a; then
9059                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9060                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9061                                         if $contains socket libc.list >/dev/null 2>&1; then
9062                                                 d_socket="$define"
9063                                                 socketlib="-l$net"
9064                                                 case "$net" in
9065                                                 net)
9066                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9067                                                         sockethdr="-I/usr/netinclude"
9068                                                         ;;
9069                                                 esac
9070                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9071                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9072                                                         d_oldsock="$undef"
9073                                                 else
9074                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9075                                                         d_oldsock="$define"
9076                                                 fi
9077                                                 break
9078                                         fi
9079                                 fi
9080                         done
9081                         if test "X$d_socket" != "X$define"; then
9082                            echo "or anywhere else I see." >&4
9083                            d_socket="$undef"
9084                            d_oldsock="$undef"
9085                         fi
9086                 fi
9087         fi
9088 fi
9089
9090 : see if socketpair exists
9091 set socketpair d_sockpair
9092 eval $inlibc
9093
9094
9095 echo " "
9096 echo "Checking the availability of certain socket constants..." >& 4
9097 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9098         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9099         $cat >try.c <<EOF
9100 #include <sys/types.h>
9101 #include <sys/socket.h>
9102 int main() {
9103     int i = $ENUM;
9104 }
9105 EOF
9106         val="$undef"
9107         set try; if eval $compile; then
9108                 val="$define"
9109         fi
9110         set d_${enum}; eval $setvar
9111         $rm -f try.c try
9112 done
9113
9114 : see if sys/select.h has to be included
9115 set sys/select.h i_sysselct
9116 eval $inhdr
9117
9118 : see if we should include time.h, sys/time.h, or both
9119 echo " "
9120 if test "X$timeincl" = X; then
9121         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9122         $echo $n "I'm now running the test program...$c"
9123         $cat >try.c <<'EOCP'
9124 #include <sys/types.h>
9125 #ifdef I_TIME
9126 #include <time.h>
9127 #endif
9128 #ifdef I_SYSTIME
9129 #ifdef SYSTIMEKERNEL
9130 #define KERNEL
9131 #endif
9132 #include <sys/time.h>
9133 #endif
9134 #ifdef I_SYSSELECT
9135 #include <sys/select.h>
9136 #endif
9137 int main()
9138 {
9139         struct tm foo;
9140 #ifdef S_TIMEVAL
9141         struct timeval bar;
9142 #endif
9143 #ifdef S_TIMEZONE
9144         struct timezone tzp;
9145 #endif
9146         if (foo.tm_sec == foo.tm_sec)
9147                 exit(0);
9148 #ifdef S_TIMEVAL
9149         if (bar.tv_sec == bar.tv_sec)
9150                 exit(0);
9151 #endif
9152         exit(1);
9153 }
9154 EOCP
9155         flags=''
9156         for s_timezone in '-DS_TIMEZONE' ''; do
9157         sysselect=''
9158         for s_timeval in '-DS_TIMEVAL' ''; do
9159         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9160         for i_time in '' '-DI_TIME'; do
9161         for i_systime in '-DI_SYSTIME' ''; do
9162                 case "$flags" in
9163                 '') $echo $n ".$c"
9164                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9165                         if eval $compile; then
9166                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9167                                 shift
9168                                 flags="$*"
9169                                 echo " "
9170                                 $echo $n "Succeeded with $flags$c"
9171                         fi
9172                         ;;
9173                 esac
9174         done
9175         done
9176         done
9177         done
9178         done
9179         timeincl=''
9180         echo " "
9181         case "$flags" in
9182         *SYSTIMEKERNEL*) i_systimek="$define"
9183                 timeincl=`./findhdr sys/time.h`
9184                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9185         *) i_systimek="$undef";;
9186         esac
9187         case "$flags" in
9188         *I_TIME*) i_time="$define"
9189                 timeincl=`./findhdr time.h`" $timeincl"
9190                 echo "We'll include <time.h>." >&4;;
9191         *) i_time="$undef";;
9192         esac
9193         case "$flags" in
9194         *I_SYSTIME*) i_systime="$define"
9195                 timeincl=`./findhdr sys/time.h`" $timeincl"
9196                 echo "We'll include <sys/time.h>." >&4;;
9197         *) i_systime="$undef";;
9198         esac
9199         $rm -f try.c try
9200 fi
9201
9202 : check for fd_set items
9203 $cat <<EOM
9204
9205 Checking to see how well your C compiler handles fd_set and friends ...
9206 EOM
9207 $cat >fd_set.c <<EOCP
9208 #$i_systime I_SYS_TIME
9209 #$i_sysselct I_SYS_SELECT
9210 #$d_socket HAS_SOCKET
9211 #include <sys/types.h>
9212 #ifdef HAS_SOCKET
9213 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9214 #endif
9215 #ifdef I_SYS_TIME
9216 #include <sys/time.h>
9217 #endif
9218 #ifdef I_SYS_SELECT
9219 #include <sys/select.h>
9220 #endif
9221 int main() {
9222         fd_set fds;
9223
9224 #ifdef TRYBITS
9225         if(fds.fds_bits);
9226 #endif
9227
9228 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9229         exit(0);
9230 #else
9231         exit(1);
9232 #endif
9233 }
9234 EOCP
9235 set fd_set -DTRYBITS
9236 if eval $compile; then
9237         d_fds_bits="$define"
9238         d_fd_set="$define"
9239         echo "Well, your system knows about the normal fd_set typedef..." >&4
9240         if ./fd_set; then
9241                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9242                 d_fd_macros="$define"
9243         else
9244                 $cat >&4 <<'EOM'
9245 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9246 EOM
9247                 d_fd_macros="$undef"
9248         fi
9249 else
9250         $cat <<'EOM'
9251 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9252 EOM
9253         set fd_set
9254         if eval $compile; then
9255                 d_fds_bits="$undef"
9256                 d_fd_set="$define"
9257                 echo "Well, your system has some sort of fd_set available..." >&4
9258                 if ./fd_set; then
9259                         echo "and you have the normal fd_set macros." >&4
9260                         d_fd_macros="$define"
9261                 else
9262                         $cat <<'EOM'
9263 but not the normal fd_set macros!  Gross!  More work for me...
9264 EOM
9265                         d_fd_macros="$undef"
9266                 fi
9267         else
9268         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9269                 d_fd_set="$undef"
9270                 d_fds_bits="$undef"
9271                 d_fd_macros="$undef"
9272         fi
9273 fi
9274 $rm -f fd_set*
9275
9276 : see if fgetpos exists
9277 set fgetpos d_fgetpos
9278 eval $inlibc
9279
9280 : see if flock exists
9281 set flock d_flock
9282 eval $inlibc
9283
9284 : see if fork exists
9285 set fork d_fork
9286 eval $inlibc
9287
9288 : see if pathconf exists
9289 set pathconf d_pathconf
9290 eval $inlibc
9291
9292 : see if fpathconf exists
9293 set fpathconf d_fpathconf
9294 eval $inlibc
9295
9296
9297 : check for fpos64_t
9298 echo " "
9299 echo "Checking to see if you have fpos64_t..." >&4
9300 $cat >try.c <<EOCP
9301 #include <stdio.h>
9302 int main() { fpos64_t x = 7; }
9303 EOCP
9304 set try
9305 if eval $compile; then
9306         val="$define"
9307         echo "You have fpos64_t."
9308 else
9309         val="$undef"
9310         echo "You do not have fpos64_t."
9311         case "$fpossize" in
9312         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9313         esac
9314 fi
9315 $rm -f try.* try
9316 set d_fpos64_t
9317 eval $setvar
9318
9319 : see if frexpl exists
9320 set frexpl d_frexpl
9321 eval $inlibc
9322
9323 hasstruct='varname=$1; struct=$2; shift; shift;
9324 while $test $# -ge 2; do
9325         case "$1" in
9326         $define) echo "#include <$2>";;
9327         esac ;
9328     shift 2;
9329 done > try.c;
9330 echo "int main () { struct $struct foo; }" >> try.c;
9331 set try;
9332 if eval $compile; then
9333         val="$define";
9334 else
9335         val="$undef";
9336 fi;
9337 set $varname;
9338 eval $setvar;
9339 $rm -f try.c try.o'
9340
9341 : see if this is a sys/param system
9342 set sys/param.h i_sysparam
9343 eval $inhdr
9344
9345 : see if this is a sys/mount.h system
9346 set sys/mount.h i_sysmount
9347 eval $inhdr
9348
9349 : see if sys/types.h has to be included
9350 set sys/types.h i_systypes
9351 eval $inhdr
9352
9353
9354 echo " "
9355 echo "Checking to see if your system supports struct fs_data..." >&4
9356 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9357 eval $hasstruct
9358 case "$d_fs_data_s" in
9359 "$define")      echo "Yes, it does."   ;;
9360 *)              echo "No, it doesn't." ;;
9361 esac
9362
9363 : see if fseeko exists
9364 set fseeko d_fseeko
9365 eval $inlibc
9366 case "$longsize" in
9367 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9368 esac
9369
9370 : see if fsetpos exists
9371 set fsetpos d_fsetpos
9372 eval $inlibc
9373
9374
9375 : see if fstatfs exists
9376 set fstatfs d_fstatfs
9377 eval $inlibc
9378
9379
9380 : see if statvfs exists
9381 set statvfs d_statvfs
9382 eval $inlibc
9383
9384 : see if fstatvfs exists
9385 set fstatvfs d_fstatvfs
9386 eval $inlibc
9387
9388
9389 : see if fsync exists
9390 set fsync d_fsync
9391 eval $inlibc
9392
9393 : see if ftello exists
9394 set ftello d_ftello
9395 eval $inlibc
9396 case "$longsize" in
9397 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9398 esac
9399
9400 : see if getcwd exists
9401 set getcwd d_getcwd
9402 eval $inlibc
9403
9404 : see if getespwnam exists
9405 set getespwnam d_getespwnam
9406 eval $inlibc
9407
9408
9409 : see if getfsstat exists
9410 set getfsstat d_getfsstat
9411 eval $inlibc
9412
9413 : see if getgrent exists
9414 set getgrent d_getgrent
9415 eval $inlibc
9416
9417 : see if gethostbyaddr exists
9418 set gethostbyaddr d_gethbyaddr
9419 eval $inlibc
9420
9421 : see if gethostbyname exists
9422 set gethostbyname d_gethbyname
9423 eval $inlibc
9424
9425 : see if gethostent exists
9426 set gethostent d_gethent
9427 eval $inlibc
9428
9429 : see how we will look up host name
9430 echo " "
9431 call=''
9432 if set gethostname val -f d_gethname; eval $csym; $val; then
9433         echo 'gethostname() found.' >&4
9434         d_gethname="$define"
9435         call=gethostname
9436 fi
9437 if set uname val -f d_uname; eval $csym; $val; then
9438         if ./xenix; then
9439                 $cat <<'EOM'
9440 uname() was found, but you're running xenix, and older versions of xenix
9441 have a broken uname(). If you don't really know whether your xenix is old
9442 enough to have a broken system call, use the default answer.
9443
9444 EOM
9445                 dflt=y
9446                 case "$d_uname" in
9447                 "$define") dflt=n;;
9448                 esac
9449                 rp='Is your uname() broken?'
9450                 . ./myread
9451                 case "$ans" in
9452                 n*) d_uname="$define"; call=uname;;
9453                 esac
9454         else
9455                 echo 'uname() found.' >&4
9456                 d_uname="$define"
9457                 case "$call" in
9458                 '') call=uname ;;
9459                 esac
9460         fi
9461 fi
9462 case "$d_gethname" in
9463 '') d_gethname="$undef";;
9464 esac
9465 case "$d_uname" in
9466 '') d_uname="$undef";;
9467 esac
9468 case "$d_uname$d_gethname" in
9469 *define*)
9470         dflt=n
9471         cat <<EOM
9472  
9473 Every now and then someone has a $call() that lies about the hostname
9474 but can't be fixed for political or economic reasons.  If you wish, I can
9475 pretend $call() isn't there and maybe compute hostname at run-time
9476 thanks to the '$phostname' command.
9477
9478 EOM
9479         rp="Shall I ignore $call() from now on?"
9480         . ./myread
9481         case "$ans" in
9482         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9483         esac;;
9484 esac
9485 case "$phostname" in
9486 '') aphostname='';;
9487 *) case "$aphostname" in
9488         /*) ;;
9489         *) set X $phostname
9490                 shift
9491                 file=$1
9492                 shift
9493                 file=`./loc $file $file $pth`
9494                 aphostname=`echo $file $*`
9495                 ;;
9496         esac
9497         ;;
9498 esac
9499 case "$d_uname$d_gethname" in
9500 *define*) ;;
9501 *)
9502         case "$phostname" in
9503         '')
9504                 echo "There will be no way for $package to get your hostname." >&4;;
9505         *)
9506         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9507                 ;;
9508         esac;;
9509 esac
9510 case "$d_phostname" in
9511 '') d_phostname="$undef";;
9512 esac
9513
9514 : see if this is a netdb.h system
9515 set netdb.h i_netdb
9516 eval $inhdr
9517
9518 : see if prototypes for various gethostxxx netdb.h functions are available
9519 echo " "
9520 set d_gethostprotos gethostent $i_netdb netdb.h
9521 eval $hasproto
9522
9523 : see if getlogin exists
9524 set getlogin d_getlogin
9525 eval $inlibc
9526
9527 : see if getmnt exists
9528 set getmnt d_getmnt
9529 eval $inlibc
9530
9531 : see if getmntent exists
9532 set getmntent d_getmntent
9533 eval $inlibc
9534
9535 : see if getnetbyaddr exists
9536 set getnetbyaddr d_getnbyaddr
9537 eval $inlibc
9538
9539 : see if getnetbyname exists
9540 set getnetbyname d_getnbyname
9541 eval $inlibc
9542
9543 : see if getnetent exists
9544 set getnetent d_getnent
9545 eval $inlibc
9546
9547 : see if prototypes for various getnetxxx netdb.h functions are available
9548 echo " "
9549 set d_getnetprotos getnetent $i_netdb netdb.h
9550 eval $hasproto
9551
9552 : see if getpagesize exists
9553 set getpagesize d_getpagsz
9554 eval $inlibc
9555
9556
9557 : see if getprotobyname exists
9558 set getprotobyname d_getpbyname
9559 eval $inlibc
9560
9561 : see if getprotobynumber exists
9562 set getprotobynumber d_getpbynumber
9563 eval $inlibc
9564
9565 : see if getprotoent exists
9566 set getprotoent d_getpent
9567 eval $inlibc
9568
9569 : see if getpgid exists
9570 set getpgid d_getpgid
9571 eval $inlibc
9572
9573 : see if getpgrp2 exists
9574 set getpgrp2 d_getpgrp2
9575 eval $inlibc
9576
9577 : see if getppid exists
9578 set getppid d_getppid
9579 eval $inlibc
9580
9581 : see if getpriority exists
9582 set getpriority d_getprior
9583 eval $inlibc
9584
9585 : see if prototypes for various getprotoxxx netdb.h functions are available
9586 echo " "
9587 set d_getprotoprotos getprotoent $i_netdb netdb.h
9588 eval $hasproto
9589
9590 : see if getprpwnam exists
9591 set getprpwnam d_getprpwnam
9592 eval $inlibc
9593
9594 : see if getpwent exists
9595 set getpwent d_getpwent
9596 eval $inlibc
9597
9598
9599 : see if getservbyname exists
9600 set getservbyname d_getsbyname
9601 eval $inlibc
9602
9603 : see if getservbyport exists
9604 set getservbyport d_getsbyport
9605 eval $inlibc
9606
9607 : see if getservent exists
9608 set getservent d_getsent
9609 eval $inlibc
9610
9611 : see if prototypes for various getservxxx netdb.h functions are available
9612 echo " "
9613 set d_getservprotos getservent $i_netdb netdb.h
9614 eval $hasproto
9615
9616 : see if getspnam exists
9617 set getspnam d_getspnam
9618 eval $inlibc
9619
9620 : see if gettimeofday or ftime exists
9621 set gettimeofday d_gettimeod
9622 eval $inlibc
9623 case "$d_gettimeod" in
9624 "$undef")
9625         set ftime d_ftime 
9626         eval $inlibc
9627         ;;
9628 *)
9629         val="$undef"; set d_ftime; eval $setvar
9630         ;;
9631 esac
9632 case "$d_gettimeod$d_ftime" in
9633 "$undef$undef")
9634         echo " "
9635         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9636         ;;
9637 esac
9638
9639 : see if this is an grp system
9640 set grp.h i_grp
9641 eval $inhdr
9642
9643 case "$i_grp" in
9644 $define)
9645         xxx=`./findhdr grp.h`
9646         $cppstdin $cppflags $cppminus < $xxx >$$.h
9647
9648         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9649                 val="$define"
9650         else
9651                 val="$undef"
9652         fi
9653         set d_grpasswd
9654         eval $setvar
9655
9656         $rm -f $$.h
9657         ;;
9658 *)
9659         val="$undef";
9660         set d_grpasswd; eval $setvar
9661         ;;
9662 esac
9663
9664 : see if hasmntopt exists
9665 set hasmntopt d_hasmntopt
9666 eval $inlibc
9667
9668 : see if this is a netinet/in.h or sys/in.h system
9669 set netinet/in.h i_niin sys/in.h i_sysin
9670 eval $inhdr
9671
9672 : see if arpa/inet.h has to be included
9673 set arpa/inet.h i_arpainet
9674 eval $inhdr
9675
9676 : see if htonl --and friends-- exists
9677 val=''
9678 set htonl val
9679 eval $inlibc
9680
9681 : Maybe they are macros.
9682 case "$val" in
9683 $undef)
9684         $cat >htonl.c <<EOM
9685 #include <stdio.h>
9686 #include <sys/types.h>
9687 #$i_niin I_NETINET_IN
9688 #$i_sysin I_SYS_IN
9689 #$i_arpainet I_ARPA_INET
9690 #ifdef I_NETINET_IN
9691 #include <netinet/in.h>
9692 #endif
9693 #ifdef I_SYS_IN
9694 #include <sys/in.h>
9695 #endif
9696 #ifdef I_ARPA_INET
9697 #include <arpa/inet.h>
9698 #endif
9699 #ifdef htonl
9700 printf("Defined as a macro.");
9701 #endif
9702 EOM
9703         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9704         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9705                 val="$define"
9706                 echo "But it seems to be defined as a macro." >&4
9707         fi
9708         $rm -f htonl.?
9709         ;;
9710 esac
9711 set d_htonl
9712 eval $setvar
9713
9714 : see if iconv exists
9715 set iconv d_iconv
9716 eval $inlibc
9717
9718 : index or strchr
9719 echo " "
9720 if set index val -f; eval $csym; $val; then
9721         if set strchr val -f d_strchr; eval $csym; $val; then
9722                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9723                         val="$define"
9724                         vali="$undef"
9725                         echo "strchr() found." >&4
9726                 else
9727                         val="$undef"
9728                         vali="$define"
9729                         echo "index() found." >&4
9730                 fi
9731         else
9732                 val="$undef"
9733                 vali="$define"
9734                 echo "index() found." >&4
9735         fi
9736 else
9737         if set strchr val -f d_strchr; eval $csym; $val; then
9738                 val="$define"
9739                 vali="$undef"
9740                 echo "strchr() found." >&4
9741         else
9742                 echo "No index() or strchr() found!" >&4
9743                 val="$undef"
9744                 vali="$undef"
9745         fi
9746 fi
9747 set d_strchr; eval $setvar
9748 val="$vali"
9749 set d_index; eval $setvar
9750
9751 : check whether inet_aton exists
9752 set inet_aton d_inetaton
9753 eval $inlibc
9754
9755 : see if inttypes.h is available
9756 : we want a real compile instead of Inhdr because some systems
9757 : have an inttypes.h which includes non-existent headers
9758 echo " "
9759 $cat >try.c <<EOCP
9760 #include <inttypes.h>
9761 int main() {
9762         static int32_t foo32 = 0x12345678;
9763 }
9764 EOCP
9765 set try
9766 if eval $compile; then
9767         echo "<inttypes.h> found." >&4
9768         val="$define"
9769 else
9770         echo "<inttypes.h> NOT found." >&4
9771         val="$undef"
9772 fi
9773 $rm -f try.c try
9774 set i_inttypes
9775 eval $setvar
9776
9777 : check for int64_t
9778 echo " "
9779 echo "Checking to see if you have int64_t..." >&4
9780 $cat >try.c <<EOCP
9781 #include <sys/types.h>
9782 #$i_inttypes I_INTTYPES
9783 #ifdef I_INTTYPES
9784 #include <inttypes.h>
9785 #endif
9786 int main() { int64_t x = 7; }
9787 EOCP
9788 set try
9789 if eval $compile; then
9790         val="$define"
9791         echo "You have int64_t."
9792 else
9793         val="$undef"
9794         echo "You do not have int64_t."
9795 fi
9796 $rm -f try try.*
9797 set d_int64_t
9798 eval $setvar
9799
9800 : Look for isascii
9801 echo " "
9802 $cat >isascii.c <<'EOCP'
9803 #include <stdio.h>
9804 #include <ctype.h>
9805 int main() {
9806         int c = 'A';
9807         if (isascii(c))
9808                 exit(0);
9809         else
9810                 exit(1);
9811 }
9812 EOCP
9813 set isascii
9814 if eval $compile; then
9815         echo "isascii() found." >&4
9816         val="$define"
9817 else
9818         echo "isascii() NOT found." >&4
9819         val="$undef"
9820 fi
9821 set d_isascii
9822 eval $setvar
9823 $rm -f isascii*
9824
9825 : see if isnan exists
9826 set isnan d_isnan
9827 eval $inlibc
9828
9829 : see if isnanl exists
9830 set isnanl d_isnanl
9831 eval $inlibc
9832
9833 : see if killpg exists
9834 set killpg d_killpg
9835 eval $inlibc
9836
9837 : see if lchown exists
9838 echo " "
9839 $cat > try.c <<'EOCP'
9840 /* System header to define __stub macros and hopefully few prototypes,
9841     which can conflict with char lchown(); below.  */
9842 #include <assert.h>
9843 /* Override any gcc2 internal prototype to avoid an error.  */
9844 /* We use char because int might match the return type of a gcc2
9845    builtin and then its argument prototype would still apply.  */
9846 char lchown();
9847 int main() {
9848     /*  The GNU C library defines this for functions which it implements
9849         to always fail with ENOSYS.  Some functions are actually named
9850         something starting with __ and the normal name is an alias.  */
9851 #if defined (__stub_lchown) || defined (__stub___lchown)
9852 choke me
9853 #else
9854 lchown();
9855 #endif
9856 ; return 0; }
9857 EOCP
9858 set try
9859 if eval $compile; then
9860     $echo "lchown() found." >&4
9861     val="$define"
9862 else
9863     $echo "lchown() NOT found." >&4
9864     val="$undef"
9865 fi
9866 set d_lchown
9867 eval $setvar
9868
9869 : See if number of significant digits in a double precision number is known
9870 echo " "
9871 $cat >ldbl_dig.c <<EOM
9872 #$i_limits I_LIMITS
9873 #$i_float I_FLOAT
9874 #ifdef I_LIMITS
9875 #include <limits.h>
9876 #endif
9877 #ifdef I_FLOAT
9878 #include <float.h>
9879 #endif
9880 #ifdef LDBL_DIG
9881 printf("Contains LDBL_DIG");
9882 #endif
9883 EOM
9884 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9885 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9886         echo "LDBL_DIG found." >&4
9887         val="$define"
9888 else
9889         echo "LDBL_DIG NOT found." >&4
9890         val="$undef"
9891 fi
9892 $rm -f ldbl_dig.?
9893 set d_ldbl_dig
9894 eval $setvar
9895
9896 : see if link exists
9897 set link d_link
9898 eval $inlibc
9899
9900 : see if localeconv exists
9901 set localeconv d_locconv
9902 eval $inlibc
9903
9904 : see if lockf exists
9905 set lockf d_lockf
9906 eval $inlibc
9907
9908 : check for long long
9909 echo " "
9910 echo "Checking to see if you have long long..." >&4
9911 echo 'int main() { long long x = 7; return 0; }' > try.c
9912 set try
9913 if eval $compile; then
9914         val="$define"
9915         echo "You have long long."
9916 else
9917         val="$undef"
9918         echo "You do not have long long."
9919 fi
9920 $rm try.*
9921 set d_longlong
9922 eval $setvar
9923
9924 : check for length of long long
9925 case "${d_longlong}${longlongsize}" in
9926 $define)
9927         echo " "
9928         echo "Checking to see how big your long longs are..." >&4
9929         $cat >try.c <<'EOCP'
9930 #include <stdio.h>
9931 int main()
9932 {
9933     printf("%d\n", (int)sizeof(long long));
9934     return(0);
9935 }
9936 EOCP
9937         set try
9938         if eval $compile_ok; then
9939                 longlongsize=`./try$exe_ext`
9940                 echo "Your long longs are $longlongsize bytes long."
9941         else
9942                 dflt='8'
9943                 echo " "
9944                 echo "(I can't seem to compile the test program.  Guessing...)"
9945                 rp="What is the size of a long long (in bytes)?"
9946                 . ./myread
9947                 longlongsize="$ans"
9948         fi
9949         if $test "X$longsize" = "X$longlongsize"; then
9950                 echo "(That isn't any different from an ordinary long.)"
9951         fi      
9952         ;;
9953 esac
9954 $rm -f try.* try
9955
9956 : see if prototype for lseek is available
9957 echo " "
9958 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9959 eval $hasproto
9960
9961 : see if lstat exists
9962 set lstat d_lstat
9963 eval $inlibc
9964
9965 : see if madvise exists
9966 set madvise d_madvise
9967 eval $inlibc
9968
9969 : see if mblen exists
9970 set mblen d_mblen
9971 eval $inlibc
9972
9973 : see if mbstowcs exists
9974 set mbstowcs d_mbstowcs
9975 eval $inlibc
9976
9977 : see if mbtowc exists
9978 set mbtowc d_mbtowc
9979 eval $inlibc
9980
9981 : see if memchr exists
9982 set memchr d_memchr
9983 eval $inlibc
9984
9985 : see if memcmp exists
9986 set memcmp d_memcmp
9987 eval $inlibc
9988
9989 : see if memcpy exists
9990 set memcpy d_memcpy
9991 eval $inlibc
9992
9993 : see if memmove exists
9994 set memmove d_memmove
9995 eval $inlibc
9996
9997 : see if memset exists
9998 set memset d_memset
9999 eval $inlibc
10000
10001 : see if mkdir exists
10002 set mkdir d_mkdir
10003 eval $inlibc
10004
10005 : see if mkdtemp exists
10006 set mkdtemp d_mkdtemp
10007 eval $inlibc
10008
10009 : see if mkfifo exists
10010 set mkfifo d_mkfifo
10011 eval $inlibc
10012
10013 : see if mkstemp exists
10014 set mkstemp d_mkstemp
10015 eval $inlibc
10016
10017 : see if mkstemps exists
10018 set mkstemps d_mkstemps
10019 eval $inlibc
10020
10021 : see if mktime exists
10022 set mktime d_mktime
10023 eval $inlibc
10024
10025 : see if this is a sys/mman.h system
10026 set sys/mman.h i_sysmman
10027 eval $inhdr
10028
10029 : see if mmap exists
10030 set mmap d_mmap
10031 eval $inlibc
10032 : see what shmat returns
10033 : default to something harmless
10034 mmaptype='void *'
10035 case "$i_sysmman$d_mmap" in
10036 "$define$define")
10037         $cat >mmap.c <<'END'
10038 #include <sys/mman.h>
10039 void *mmap();
10040 END
10041         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10042                 mmaptype='void *'
10043         else
10044                 mmaptype='caddr_t'
10045         fi
10046         echo "and it returns ($mmaptype)." >&4
10047         ;;
10048 esac
10049
10050
10051
10052 : see if modfl exists
10053 set modfl d_modfl
10054 eval $inlibc
10055
10056 : see if mprotect exists
10057 set mprotect d_mprotect
10058 eval $inlibc
10059
10060 : see if msgctl exists
10061 set msgctl d_msgctl
10062 eval $inlibc
10063
10064 : see if msgget exists
10065 set msgget d_msgget
10066 eval $inlibc
10067
10068 : see if msgsnd exists
10069 set msgsnd d_msgsnd
10070 eval $inlibc
10071
10072 : see if msgrcv exists
10073 set msgrcv d_msgrcv
10074 eval $inlibc
10075
10076 : see how much of the 'msg*(2)' library is present.
10077 h_msg=true
10078 echo " "
10079 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10080 *"$undef"*) h_msg=false;;
10081 esac
10082 case "$osname" in
10083 freebsd)
10084     case "`ipcs 2>&1`" in
10085     "SVID messages"*"not configured"*)
10086         echo "Your $osname does not have the msg*(2) configured." >&4
10087         h_msg=false
10088         val="$undef"
10089         set msgctl d_msgctl
10090         eval $setvar
10091         set msgget d_msgget
10092         eval $setvar
10093         set msgsnd d_msgsnd
10094         eval $setvar
10095         set msgrcv d_msgrcv
10096         eval $setvar
10097         ;;
10098     esac
10099     ;;
10100 esac
10101 : we could also check for sys/ipc.h ...
10102 if $h_msg && $test `./findhdr sys/msg.h`; then
10103         echo "You have the full msg*(2) library." >&4
10104         val="$define"
10105 else
10106         echo "You don't have the full msg*(2) library." >&4
10107         val="$undef"
10108 fi
10109 set d_msg
10110 eval $setvar
10111
10112 : see if msync exists
10113 set msync d_msync
10114 eval $inlibc
10115
10116 : see if munmap exists
10117 set munmap d_munmap
10118 eval $inlibc
10119
10120 : see if nice exists
10121 set nice d_nice
10122 eval $inlibc
10123
10124
10125 echo " "
10126 echo "Checking which 64-bit integer type we could use..." >&4
10127
10128 case "$intsize" in
10129 8) val=int
10130    set quadtype
10131    eval $setvar
10132    val='"unsigned int"'
10133    set uquadtype
10134    eval $setvar
10135    quadkind=1
10136    ;;
10137 *) case "$longsize" in
10138    8) val=long
10139       set quadtype
10140       eval $setvar
10141       val='"unsigned long"'
10142       set uquadtype
10143       eval $setvar
10144       quadkind=2
10145       ;;
10146    *) case "$d_longlong:$longlongsize" in
10147       define:8)
10148         val='"long long"'
10149         set quadtype
10150         eval $setvar
10151         val='"unsigned long long"'
10152         set uquadtype
10153         eval $setvar
10154         quadkind=3
10155         ;;
10156       *) case "$d_int64_t" in
10157          define)
10158            val=int64_t
10159            set quadtype
10160            eval $setvar
10161            val=uint64_t
10162            set uquadtype
10163            eval $setvar
10164            quadkind=4
10165            ;;
10166          esac
10167          ;;
10168       esac
10169       ;;
10170    esac
10171    ;;
10172 esac
10173
10174 case "$quadtype" in
10175 '')     echo "Alas, no 64-bit integer types in sight." >&4
10176         d_quad="$undef"
10177         ;;
10178 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10179             verb="will"
10180         else
10181             verb="could"
10182         fi
10183         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10184         d_quad="$define"
10185         ;;
10186 esac
10187
10188 : check for length of character
10189 echo " "
10190 case "$charsize" in
10191 '')
10192         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10193         $cat >try.c <<'EOCP'
10194 #include <stdio.h>
10195 int main()
10196 {
10197     printf("%d\n", (int)sizeof(char));
10198     exit(0);
10199 }
10200 EOCP
10201         set try
10202         if eval $compile_ok; then
10203                 dflt=`./try`
10204         else
10205                 dflt='1'
10206                 echo "(I can't seem to compile the test program.  Guessing...)"
10207         fi
10208         ;;
10209 *)
10210         dflt="$charsize"
10211         ;;
10212 esac
10213 rp="What is the size of a character (in bytes)?"
10214 . ./myread
10215 charsize="$ans"
10216 $rm -f try.c try
10217
10218 : check for volatile keyword
10219 echo " "
10220 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10221 $cat >try.c <<'EOCP'
10222 int main()
10223 {
10224         typedef struct _goo_struct goo_struct;
10225         goo_struct * volatile goo = ((goo_struct *)0);
10226         struct _goo_struct {
10227                 long long_int;
10228                 int reg_int;
10229                 char char_var;
10230         };
10231         typedef unsigned short foo_t;
10232         char *volatile foo;
10233         volatile int bar;
10234         volatile foo_t blech;
10235         foo = foo;
10236 }
10237 EOCP
10238 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10239         val="$define"
10240         echo "Yup, it does."
10241 else
10242         val="$undef"
10243         echo "Nope, it doesn't."
10244 fi
10245 set d_volatile
10246 eval $setvar
10247 $rm -f try.*
10248
10249
10250 echo " "
10251 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10252
10253 case "$use64bitint:$d_quad:$quadtype" in
10254 define:define:?*)
10255         ivtype="$quadtype"
10256         uvtype="$uquadtype"
10257         ivsize=8
10258         uvsize=8
10259         ;;
10260 *)      ivtype="long"
10261         uvtype="unsigned long"
10262         ivsize=$longsize
10263         uvsize=$longsize
10264         ;;
10265 esac
10266
10267 case "$uselongdouble:$d_longdbl" in
10268 define:define)
10269         nvtype="long double"
10270         nvsize=$longdblsize
10271         ;;
10272 *)      nvtype=double
10273         nvsize=$doublesize
10274         ;;
10275 esac
10276
10277 $echo "(IV will be "$ivtype", $ivsize bytes)"
10278 $echo "(UV will be "$uvtype", $uvsize bytes)"
10279 $echo "(NV will be "$nvtype", $nvsize bytes)"
10280
10281 $cat >try.c <<EOCP
10282 #$i_inttypes I_INTTYPES
10283 #ifdef I_INTTYPES
10284 #include <inttypes.h>
10285 #endif
10286 #include <stdio.h>
10287 int main() {
10288 #ifdef INT8
10289    int8_t i =  INT8_MAX;
10290   uint8_t u = UINT8_MAX;
10291   printf("int8_t\n");
10292 #endif
10293 #ifdef INT16
10294    int16_t i =  INT16_MAX;
10295   uint16_t i = UINT16_MAX;
10296   printf("int16_t\n");
10297 #endif
10298 #ifdef INT32
10299    int32_t i =  INT32_MAX;
10300   uint32_t u = UINT32_MAX;
10301   printf("int32_t\n");
10302 #endif
10303 }
10304 EOCP
10305
10306 case "$i8type" in
10307 '')     case "$charsize" in
10308         1)      i8type=char
10309                 u8type="unsigned char"
10310                 i8size=$charsize
10311                 u8size=$charsize
10312                 ;;
10313         esac
10314         ;;
10315 esac
10316 case "$i8type" in
10317 '')     set try -DINT8
10318         if eval $compile; then
10319                 case "`./try$exe_ext`" in
10320                 int8_t) i8type=int8_t
10321                         u8type=uint8_t
10322                         i8size=1
10323                         u8size=1
10324                         ;;
10325                 esac
10326         fi
10327         ;;
10328 esac
10329 case "$i8type" in
10330 '')     if $test $charsize -ge 1; then
10331                 i8type=char
10332                 u8type="unsigned char"
10333                 i8size=$charsize
10334                 u8size=$charsize
10335         fi
10336         ;;
10337 esac
10338
10339 case "$i16type" in
10340 '')     case "$shortsize" in
10341         2)      i16type=short
10342                 u16type="unsigned short"
10343                 i16size=$shortsize
10344                 u16size=$shortsize
10345                 ;;
10346         esac
10347         ;;
10348 esac
10349 case "$i16type" in
10350 '')     set try -DINT16
10351         if eval $compile; then
10352                 case "`./try$exe_ext`" in
10353                 int16_t)
10354                         i16type=int16_t
10355                         u16type=uint16_t
10356                         i16size=2
10357                         u16size=2
10358                         ;;
10359                 esac
10360         fi
10361         ;;
10362 esac
10363 case "$i16type" in
10364 '')     if $test $shortsize -ge 2; then
10365                 i16type=short
10366                 u16type="unsigned short"
10367                 i16size=$shortsize
10368                 u16size=$shortsize
10369         fi
10370         ;;
10371 esac
10372
10373 case "$i32type" in
10374 '')     case "$longsize" in
10375         4)      i32type=long
10376                 u32type="unsigned long"
10377                 i32size=$longsize
10378                 u32size=$longsize
10379                 ;;
10380         *)      case "$intsize" in
10381                 4)      i32type=int
10382                         u32type="unsigned int"
10383                         i32size=$intsize
10384                         u32size=$intsize
10385                         ;;
10386                 esac
10387                 ;;
10388         esac
10389         ;;
10390 esac
10391 case "$i32type" in
10392 '')     set try -DINT32
10393         if eval $compile; then
10394                 case "`./try$exe_ext`" in
10395                 int32_t)
10396                         i32type=int32_t
10397                         u32type=uint32_t
10398                         i32size=4
10399                         u32size=4
10400                         ;;
10401                 esac
10402         fi
10403         ;;
10404 esac
10405 case "$i32type" in
10406 '')     if $test $intsize -ge 4; then
10407                 i32type=int
10408                 u32type="unsigned int"
10409                 i32size=$intsize
10410                 u32size=$intsize
10411         fi
10412         ;;
10413 esac
10414
10415 case "$i64type" in
10416 '')     case "$d_quad:$quadtype" in
10417         define:?*)
10418                 i64type="$quadtype"
10419                 u64type="$uquadtype"
10420                 i64size=8
10421                 u64size=8
10422                 ;;
10423         esac
10424         ;;
10425 esac
10426
10427 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10428 : volatile so that the compiler has to store it out to memory.
10429 if test X"$d_volatile" = X"$define"; then
10430         volatile=volatile
10431 fi
10432 $cat <<EOP >try.c
10433 #include <stdio.h>
10434 #include <sys/types.h>
10435 #include <signal.h>
10436 #ifdef SIGFPE
10437 $volatile int bletched = 0;
10438 $signal_t blech(s) int s; { bletched = 1; }
10439 #endif
10440 int main() {
10441     $uvtype u = 0;
10442     $nvtype d;
10443     int     n = 8 * $uvsize;
10444     int     i;
10445 #ifdef SIGFPE
10446     signal(SIGFPE, blech);
10447 #endif
10448
10449     for (i = 0; i < n; i++) {
10450       u = u << 1 | ($uvtype)1;
10451       d = ($nvtype)u;
10452       if (($uvtype)d != u)
10453         break;
10454       if (d <= 0)
10455         break;
10456       d = ($nvtype)(u - 1);
10457       if (($uvtype)d != (u - 1))
10458         break;
10459 #ifdef SIGFPE
10460       if (bletched) {
10461         break;
10462 #endif
10463       } 
10464     }
10465     printf("%d\n", ((i == n) ? -n : i));
10466     exit(0);
10467 }
10468 EOP
10469 set try
10470
10471 d_nv_preserves_uv="$undef"
10472 if eval $compile; then
10473         d_nv_preserves_uv_bits="`./try$exe_ext`"
10474 fi
10475 case "$d_nv_preserves_uv_bits" in
10476 \-[1-9]*)       
10477         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10478         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10479         d_nv_preserves_uv="$define"
10480         ;;
10481 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10482         d_nv_preserves_uv="$undef" ;;
10483 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10484         d_nv_preserves_uv_bits="$undef" ;;
10485 esac
10486
10487 $rm -f try.* try
10488
10489
10490 : check for off64_t
10491 echo " "
10492 echo "Checking to see if you have off64_t..." >&4
10493 $cat >try.c <<EOCP
10494 #include <sys/types.h>
10495 #include <unistd.h>
10496 int main() { off64_t x = 7; }
10497 EOCP
10498 set try
10499 if eval $compile; then
10500         val="$define"
10501         echo "You have off64_t."
10502 else
10503         val="$undef"
10504         echo "You do not have off64_t."
10505         case "$lseeksize" in
10506         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10507         esac
10508 fi
10509 $rm -f try.* try
10510 set d_off64_t
10511 eval $setvar
10512
10513 : see if POSIX threads are available
10514 set pthread.h i_pthread
10515 eval $inhdr
10516
10517
10518
10519
10520 : how to create joinable pthreads
10521 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10522         echo " "
10523         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10524         $cat >try.c <<'EOCP'
10525 #include <pthread.h>
10526 int main() {
10527     int detachstate = JOINABLE;
10528 }
10529 EOCP
10530         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10531         if eval $compile; then
10532                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10533                 val="$undef" # Yes, undef.
10534                 set d_old_pthread_create_joinable
10535                 eval $setvar
10536                 val=""
10537                 set old_pthread_create_joinable
10538                 eval $setvar
10539         else
10540                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10541                 if eval $compile; then
10542                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10543                         val="$define"
10544                         set d_old_pthread_create_joinable
10545                         eval $setvar
10546                         val=PTHREAD_CREATE_UNDETACHED
10547                         set old_pthread_create_joinable
10548                         eval $setvar
10549                 else            
10550                         set try -DJOINABLE=__UNDETACHED
10551                         if eval $compile; then
10552                                 echo "You seem to use __UNDETACHED." >&4
10553                                 val="$define"
10554                                 set d_old_pthread_create_joinable
10555                                 eval $setvar
10556                                 val=__UNDETACHED
10557                                 set old_pthread_create_joinable
10558                                 eval $setvar
10559                         else
10560                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10561                                 val="$define"
10562                                 set d_old_pthread_create_joinable
10563                                 eval $setvar
10564                                 val=0
10565                                 set old_pthread_create_joinable
10566                                 eval $setvar
10567                         fi
10568                 fi
10569         fi
10570         $rm -f try try.*
10571 else
10572     d_old_pthread_create_joinable="$undef"
10573     old_pthread_create_joinable=""
10574 fi
10575
10576 : see if pause exists
10577 set pause d_pause
10578 eval $inlibc
10579
10580 : see if pipe exists
10581 set pipe d_pipe
10582 eval $inlibc
10583
10584 : see if poll exists
10585 set poll d_poll
10586 eval $inlibc
10587
10588
10589 : see whether the various POSIXish _yields exist
10590 $cat >try.c <<EOP
10591 #include <pthread.h>
10592 #include <stdio.h>
10593 int main() {
10594 #ifdef SCHED_YIELD
10595         sched_yield();
10596 #else
10597 #ifdef PTHREAD_YIELD
10598         pthread_yield();
10599 #else
10600 #ifdef PTHREAD_YIELD_NULL
10601         pthread_yield(NULL);
10602 #endif
10603 #endif
10604 #endif
10605 }
10606 EOP
10607 : see if sched_yield exists
10608 set try -DSCHED_YIELD
10609 if eval $compile; then
10610     val="$define"
10611     sched_yield='sched_yield()'
10612 else
10613     val="$undef"
10614 fi
10615 case "$usethreads" in
10616 $define)
10617         case "$val" in
10618         $define) echo 'sched_yield() found.' >&4        ;;
10619         *)       echo 'sched_yield() NOT found.' >&4    ;;
10620         esac
10621 esac
10622 set d_sched_yield
10623 eval $setvar
10624
10625 : see if pthread_yield exists
10626 set try -DPTHREAD_YIELD
10627 if eval $compile; then
10628     val="$define"
10629     case "$sched_yield" in
10630     '') sched_yield='pthread_yield()' ;;
10631     esac
10632 else
10633     set try -DPTHREAD_YIELD_NULL
10634     if eval $compile; then
10635         val="$define"
10636         case "$sched_yield" in
10637         '') sched_yield='pthread_yield(NULL)' ;;
10638         esac
10639     else
10640         val="$undef"
10641     fi
10642 fi
10643 case "$usethreads" in
10644 $define)
10645         case "$val" in
10646         $define) echo 'pthread_yield() found.' >&4      ;;
10647         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10648         esac
10649         ;;
10650 esac
10651 set d_pthread_yield
10652 eval $setvar
10653
10654 case "$sched_yield" in
10655 '') sched_yield=undef ;;
10656 esac
10657
10658 $rm -f try try.*
10659
10660 : see if this is a pwd.h system
10661 set pwd.h i_pwd
10662 eval $inhdr
10663
10664 case "$i_pwd" in
10665 $define)
10666         xxx=`./findhdr pwd.h`
10667         $cppstdin $cppflags $cppminus < $xxx >$$.h
10668
10669         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10670                 val="$define"
10671         else
10672                 val="$undef"
10673         fi
10674         set d_pwquota
10675         eval $setvar
10676
10677         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10678                 val="$define"
10679         else
10680                 val="$undef"
10681         fi
10682         set d_pwage
10683         eval $setvar
10684
10685         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10686                 val="$define"
10687         else
10688                 val="$undef"
10689         fi
10690         set d_pwchange
10691         eval $setvar
10692
10693         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10694                 val="$define"
10695         else
10696                 val="$undef"
10697         fi
10698         set d_pwclass
10699         eval $setvar
10700
10701         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10702                 val="$define"
10703         else
10704                 val="$undef"
10705         fi
10706         set d_pwexpire
10707         eval $setvar
10708
10709         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10710                 val="$define"
10711         else
10712                 val="$undef"
10713         fi
10714         set d_pwcomment
10715         eval $setvar
10716
10717         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10718                 val="$define"
10719         else
10720                 val="$undef"
10721         fi
10722         set d_pwgecos
10723         eval $setvar
10724
10725         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10726                 val="$define"
10727         else
10728                 val="$undef"
10729         fi
10730         set d_pwpasswd
10731         eval $setvar
10732
10733         $rm -f $$.h
10734         ;;
10735 *)
10736         val="$undef"; 
10737         set d_pwquota; eval $setvar
10738         set d_pwage; eval $setvar
10739         set d_pwchange; eval $setvar
10740         set d_pwclass; eval $setvar
10741         set d_pwexpire; eval $setvar
10742         set d_pwcomment; eval $setvar
10743         set d_pwgecos; eval $setvar
10744         set d_pwpasswd; eval $setvar
10745         ;;
10746 esac
10747
10748 : see if readdir and friends exist
10749 set readdir d_readdir
10750 eval $inlibc
10751 set seekdir d_seekdir
10752 eval $inlibc
10753 set telldir d_telldir
10754 eval $inlibc
10755 set rewinddir d_rewinddir
10756 eval $inlibc
10757
10758 : see if readlink exists
10759 set readlink d_readlink
10760 eval $inlibc
10761
10762 : see if rename exists
10763 set rename d_rename
10764 eval $inlibc
10765
10766 : see if rmdir exists
10767 set rmdir d_rmdir
10768 eval $inlibc
10769
10770 : see if memory.h is available.
10771 val=''
10772 set memory.h val
10773 eval $inhdr
10774
10775 : See if it conflicts with string.h
10776 case "$val" in
10777 $define)
10778         case "$strings" in
10779         '') ;;
10780         *)
10781                 $cppstdin $cppflags $cppminus < $strings > mem.h
10782                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10783                         echo " "
10784                         echo "We won't be including <memory.h>."
10785                         val="$undef"
10786                 fi
10787                 $rm -f mem.h
10788                 ;;
10789         esac
10790 esac
10791 set i_memory
10792 eval $setvar
10793
10794 : can bcopy handle overlapping blocks?
10795 val="$undef"
10796 case "$d_bcopy" in
10797 "$define")
10798         echo " "
10799         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10800         $cat >try.c <<EOCP
10801 #$i_memory I_MEMORY
10802 #$i_stdlib I_STDLIB
10803 #$i_string I_STRING
10804 #$i_unistd I_UNISTD
10805 EOCP
10806         $cat >>try.c <<'EOCP'
10807 #include <stdio.h>
10808 #ifdef I_MEMORY
10809 #  include <memory.h>
10810 #endif
10811 #ifdef I_STDLIB
10812 #  include <stdlib.h>
10813 #endif
10814 #ifdef I_STRING
10815 #  include <string.h>
10816 #else
10817 #  include <strings.h>
10818 #endif
10819 #ifdef I_UNISTD
10820 #  include <unistd.h>  /* Needed for NetBSD */
10821 #endif
10822 int main()
10823 {
10824 char buf[128], abc[128];
10825 char *b;
10826 int len;
10827 int off;
10828 int align;
10829
10830 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10831
10832 for (align = 7; align >= 0; align--) {
10833         for (len = 36; len; len--) {
10834                 b = buf+align;
10835                 bcopy(abc, b, len);
10836                 for (off = 1; off <= len; off++) {
10837                         bcopy(b, b+off, len);
10838                         bcopy(b+off, b, len);
10839                         if (bcmp(b, abc, len))
10840                                 exit(1);
10841                 }
10842         }
10843 }
10844 exit(0);
10845 }
10846 EOCP
10847         set try
10848         if eval $compile_ok; then
10849                 if ./try 2>/dev/null; then
10850                         echo "Yes, it can."
10851                         val="$define"
10852                 else
10853                         echo "It can't, sorry."
10854                         case "$d_memmove" in
10855                         "$define") echo "But that's Ok since you have memmove()." ;;
10856                         esac
10857                 fi
10858         else
10859                 echo "(I can't compile the test program, so we'll assume not...)"
10860                 case "$d_memmove" in
10861                 "$define") echo "But that's Ok since you have memmove()." ;;
10862                 esac
10863         fi
10864         ;;
10865 esac
10866 $rm -f try.* try core
10867 set d_safebcpy
10868 eval $setvar
10869
10870 : can memcpy handle overlapping blocks?
10871 val="$undef"
10872 case "$d_memcpy" in
10873 "$define")
10874         echo " "
10875         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10876         $cat >try.c <<EOCP
10877 #$i_memory I_MEMORY
10878 #$i_stdlib I_STDLIB
10879 #$i_string I_STRING
10880 #$i_unistd I_UNISTD
10881 EOCP
10882         $cat >>try.c <<'EOCP'
10883 #include <stdio.h>
10884 #ifdef I_MEMORY
10885 #  include <memory.h>
10886 #endif
10887 #ifdef I_STDLIB
10888 #  include <stdlib.h>
10889 #endif
10890 #ifdef I_STRING
10891 #  include <string.h>
10892 #else
10893 #  include <strings.h>
10894 #endif
10895 #ifdef I_UNISTD
10896 #  include <unistd.h>  /* Needed for NetBSD */
10897 #endif
10898 int main()
10899 {
10900 char buf[128], abc[128];
10901 char *b;
10902 int len;
10903 int off;
10904 int align;
10905
10906 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10907    try to store the string in read-only memory. */
10908 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10909
10910 for (align = 7; align >= 0; align--) {
10911         for (len = 36; len; len--) {
10912                 b = buf+align;
10913                 memcpy(b, abc, len);
10914                 for (off = 1; off <= len; off++) {
10915                         memcpy(b+off, b, len);
10916                         memcpy(b, b+off, len);
10917                         if (memcmp(b, abc, len))
10918                                 exit(1);
10919                 }
10920         }
10921 }
10922 exit(0);
10923 }
10924 EOCP
10925         set try
10926         if eval $compile_ok; then
10927                 if ./try 2>/dev/null; then
10928                         echo "Yes, it can."
10929                         val="$define"
10930                 else
10931                         echo "It can't, sorry."
10932                         case "$d_memmove" in
10933                         "$define") echo "But that's Ok since you have memmove()." ;;
10934                         esac
10935                 fi
10936         else
10937                 echo "(I can't compile the test program, so we'll assume not...)"
10938                 case "$d_memmove" in
10939                 "$define") echo "But that's Ok since you have memmove()." ;;
10940                 esac
10941         fi
10942         ;;
10943 esac
10944 $rm -f try.* try core
10945 set d_safemcpy
10946 eval $setvar
10947
10948 : can memcmp be trusted to compare relative magnitude?
10949 val="$undef"
10950 case "$d_memcmp" in
10951 "$define")
10952         echo " "
10953         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10954         $cat >try.c <<EOCP
10955 #$i_memory I_MEMORY
10956 #$i_stdlib I_STDLIB
10957 #$i_string I_STRING
10958 #$i_unistd I_UNISTD
10959 EOCP
10960         $cat >>try.c <<'EOCP'
10961 #include <stdio.h>
10962 #ifdef I_MEMORY
10963 #  include <memory.h>
10964 #endif
10965 #ifdef I_STDLIB
10966 #  include <stdlib.h>
10967 #endif
10968 #ifdef I_STRING
10969 #  include <string.h>
10970 #else
10971 #  include <strings.h>
10972 #endif
10973 #ifdef I_UNISTD
10974 #  include <unistd.h>  /* Needed for NetBSD */
10975 #endif
10976 int main()
10977 {
10978 char a = -1;
10979 char b = 0;
10980 if ((a < b) && memcmp(&a, &b, 1) < 0)
10981         exit(1);
10982 exit(0);
10983 }
10984 EOCP
10985         set try
10986         if eval $compile_ok; then
10987                 if ./try 2>/dev/null; then
10988                         echo "Yes, it can."
10989                         val="$define"
10990                 else
10991                         echo "No, it can't (it uses signed chars)."
10992                 fi
10993         else
10994                 echo "(I can't compile the test program, so we'll assume not...)"
10995         fi
10996         ;;
10997 esac
10998 $rm -f try.* try core
10999 set d_sanemcmp
11000 eval $setvar
11001
11002 : see if prototype for sbrk is available
11003 echo " "
11004 set d_sbrkproto sbrk $i_unistd unistd.h
11005 eval $hasproto
11006
11007 : see if select exists
11008 set select d_select
11009 eval $inlibc
11010
11011 : see if semctl exists
11012 set semctl d_semctl
11013 eval $inlibc
11014
11015 : see if semget exists
11016 set semget d_semget
11017 eval $inlibc
11018
11019 : see if semop exists
11020 set semop d_semop
11021 eval $inlibc
11022
11023 : see how much of the 'sem*(2)' library is present.
11024 h_sem=true
11025 echo " "
11026 case "$d_semctl$d_semget$d_semop" in
11027 *"$undef"*) h_sem=false;;
11028 esac
11029 case "$osname" in
11030 freebsd)
11031     case "`ipcs 2>&1`" in
11032     "SVID messages"*"not configured"*)
11033         echo "Your $osname does not have the sem*(2) configured." >&4
11034         h_sem=false
11035         val="$undef"
11036         set semctl d_semctl
11037         eval $setvar
11038         set semget d_semget
11039         eval $setvar
11040         set semop d_semop
11041         eval $setvar
11042         ;;
11043     esac
11044     ;;
11045 esac
11046 : we could also check for sys/ipc.h ...
11047 if $h_sem && $test `./findhdr sys/sem.h`; then
11048         echo "You have the full sem*(2) library." >&4
11049         val="$define"
11050 else
11051         echo "You don't have the full sem*(2) library." >&4
11052         val="$undef"
11053 fi
11054 set d_sem
11055 eval $setvar
11056
11057 : see whether sys/sem.h defines union semun
11058 echo " "
11059 $cat > try.c <<'END'
11060 #include <sys/types.h>
11061 #include <sys/ipc.h>
11062 #include <sys/sem.h>
11063 int main () { union semun semun; semun.buf = 0; }
11064 END
11065 set try
11066 if eval $compile; then
11067     echo "You have union semun in <sys/sem.h>." >&4
11068     val="$define"
11069 else
11070     echo "You do not have union semun in <sys/sem.h>." >&4
11071     val="$undef"
11072 fi
11073 $rm -f try try.c try.h
11074 set d_union_semun
11075 eval $setvar
11076
11077 : see how to do semctl IPC_STAT
11078 case "$d_sem" in
11079 $define)
11080     : see whether semctl IPC_STAT can use union semun
11081     echo " "
11082     $cat > try.h <<END
11083 #ifndef S_IRUSR
11084 #   ifdef S_IREAD
11085 #       define S_IRUSR S_IREAD
11086 #       define S_IWUSR S_IWRITE
11087 #       define S_IXUSR S_IEXEC
11088 #   else
11089 #       define S_IRUSR 0400
11090 #       define S_IWUSR 0200
11091 #       define S_IXUSR 0100
11092 #   endif
11093 #   define S_IRGRP (S_IRUSR>>3)
11094 #   define S_IWGRP (S_IWUSR>>3)
11095 #   define S_IXGRP (S_IXUSR>>3)
11096 #   define S_IROTH (S_IRUSR>>6)
11097 #   define S_IWOTH (S_IWUSR>>6)
11098 #   define S_IXOTH (S_IXUSR>>6)
11099 #endif
11100 #ifndef S_IRWXU
11101 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11102 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11103 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11104 #endif
11105 END
11106
11107     $cat > try.c <<END
11108 #include <sys/types.h>
11109 #include <sys/ipc.h>
11110 #include <sys/sem.h>
11111 #include <sys/stat.h>
11112 #include <stdio.h>
11113 #include <errno.h>
11114 #include "try.h"
11115 #ifndef errno
11116 extern int errno;
11117 #endif
11118 #$d_union_semun HAS_UNION_SEMUN
11119 int main() {
11120     union semun
11121 #ifndef HAS_UNION_SEMUN
11122     {
11123         int val;
11124         struct semid_ds *buf;
11125         unsigned short *array;
11126     }
11127 #endif
11128     arg;
11129     int sem, st;
11130
11131 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11132     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11133     if (sem > -1) {
11134         struct semid_ds argbuf;
11135         arg.buf = &argbuf;
11136 #       ifdef IPC_STAT
11137         st = semctl(sem, 0, IPC_STAT, arg);
11138         if (st == 0)
11139             printf("semun\n");
11140         else
11141 #       endif /* IPC_STAT */
11142             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11143 #       ifdef IPC_RMID
11144         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11145 #       endif /* IPC_RMID */
11146             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11147     } else
11148 #endif /* IPC_PRIVATE && ... */
11149         printf("semget failed: errno = %d\n", errno);
11150   return 0;
11151 }
11152 END
11153     val="$undef"
11154     set try
11155     if eval $compile; then
11156         xxx=`./try`
11157         case "$xxx" in
11158         semun) val="$define" ;;
11159         esac
11160     fi
11161     $rm -f try try.c
11162     set d_semctl_semun
11163     eval $setvar
11164     case "$d_semctl_semun" in
11165     $define)
11166         echo "You can use union semun for semctl IPC_STAT." >&4
11167         also='also'
11168         ;;
11169     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11170         also=''
11171         ;;
11172     esac
11173
11174     : see whether semctl IPC_STAT can use struct semid_ds pointer
11175     $cat > try.c <<'END'
11176 #include <sys/types.h>
11177 #include <sys/ipc.h>
11178 #include <sys/sem.h>
11179 #include <sys/stat.h>
11180 #include "try.h"
11181 #include <stdio.h>
11182 #include <errno.h>
11183 #ifndef errno
11184 extern int errno;
11185 #endif
11186 int main() {
11187     struct semid_ds arg;
11188     int sem, st;
11189
11190 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11191     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11192     if (sem > -1) {
11193 #       ifdef IPC_STAT
11194         st = semctl(sem, 0, IPC_STAT, &arg);
11195         if (st == 0)
11196             printf("semid_ds\n");
11197         else
11198 #       endif /* IPC_STAT */
11199             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11200 #       ifdef IPC_RMID
11201         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11202 #       endif /* IPC_RMID */
11203             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11204     } else
11205 #endif /* IPC_PRIVATE && ... */
11206         printf("semget failed: errno = %d\n", errno);
11207
11208     return 0;
11209 }
11210 END
11211     val="$undef"
11212     set try
11213     if eval $compile; then
11214         xxx=`./try`
11215         case "$xxx" in
11216         semid_ds) val="$define" ;;
11217         esac
11218     fi
11219     $rm -f try try.c
11220     set d_semctl_semid_ds
11221     eval $setvar
11222     case "$d_semctl_semid_ds" in
11223     $define)
11224         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11225         ;;
11226     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11227         ;;
11228     esac
11229     $rm -f try.h
11230     ;;
11231 *)  val="$undef"
11232
11233     # We do not have the full sem*(2) library, so assume we can not
11234     # use either.
11235
11236     set d_semctl_semun
11237     eval $setvar
11238
11239     set d_semctl_semid_ds
11240     eval $setvar
11241     ;;
11242 esac
11243
11244 : see if setegid exists
11245 set setegid d_setegid
11246 eval $inlibc
11247
11248 : see if seteuid exists
11249 set seteuid d_seteuid
11250 eval $inlibc
11251
11252 : see if setgrent exists
11253 set setgrent d_setgrent
11254 eval $inlibc
11255
11256 : see if sethostent exists
11257 set sethostent d_sethent
11258 eval $inlibc
11259
11260 : see if setlinebuf exists
11261 set setlinebuf d_setlinebuf
11262 eval $inlibc
11263
11264 : see if setlocale exists
11265 set setlocale d_setlocale
11266 eval $inlibc
11267
11268 : see if setnetent exists
11269 set setnetent d_setnent
11270 eval $inlibc
11271
11272 : see if setprotoent exists
11273 set setprotoent d_setpent
11274 eval $inlibc
11275
11276 : see if setpgid exists
11277 set setpgid d_setpgid
11278 eval $inlibc
11279
11280 : see if setpgrp2 exists
11281 set setpgrp2 d_setpgrp2
11282 eval $inlibc
11283
11284 : see if setpriority exists
11285 set setpriority d_setprior
11286 eval $inlibc
11287
11288 : see if setproctitle exists
11289 set setproctitle d_setproctitle
11290 eval $inlibc
11291
11292 : see if setpwent exists
11293 set setpwent d_setpwent
11294 eval $inlibc
11295
11296 : see if setregid exists
11297 set setregid d_setregid
11298 eval $inlibc
11299 set setresgid d_setresgid
11300 eval $inlibc
11301
11302 : see if setreuid exists
11303 set setreuid d_setreuid
11304 eval $inlibc
11305 set setresuid d_setresuid
11306 eval $inlibc
11307
11308 : see if setrgid exists
11309 set setrgid d_setrgid
11310 eval $inlibc
11311
11312 : see if setruid exists
11313 set setruid d_setruid
11314 eval $inlibc
11315
11316 : see if setservent exists
11317 set setservent d_setsent
11318 eval $inlibc
11319
11320 : see if setsid exists
11321 set setsid d_setsid
11322 eval $inlibc
11323
11324 : see if setvbuf exists
11325 set setvbuf d_setvbuf
11326 eval $inlibc
11327
11328 : see if sfio.h is available
11329 set sfio.h i_sfio
11330 eval $inhdr
11331
11332
11333 : see if sfio library is available
11334 case "$i_sfio" in
11335 $define)
11336         val=''
11337         set sfreserve val
11338         eval $inlibc
11339         ;;
11340 *)
11341         val="$undef"
11342         ;;
11343 esac
11344 : Ok, but do we want to use it.
11345 case "$val" in
11346 $define)
11347         case "$usesfio" in
11348         true|$define|[yY]*) dflt='y';;
11349         *) dflt='n';;
11350         esac
11351         echo "$package can use the sfio library, but it is experimental."
11352         case "$useperlio" in
11353         "$undef")
11354             echo "For sfio also the PerlIO abstraction layer is needed."
11355             echo "Earlier you said you wouldn't want that."
11356             ;;
11357         esac
11358         rp="You seem to have sfio available, do you want to try using it?"
11359         . ./myread
11360         case "$ans" in
11361         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11362                 useperlio="$define"
11363                 val="$define"
11364                 ;;
11365         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11366                 val="$undef"
11367                 : Remove sfio from list of libraries to use
11368                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11369                 shift
11370                 libs="$*"
11371                 echo "libs = $libs" >&4
11372                 ;;
11373         esac
11374         ;;
11375 *)      case "$usesfio" in
11376         true|$define|[yY]*)
11377                 echo "Sorry, cannot find sfio on this machine." >&4
11378                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11379                 val="$undef"
11380                 ;;
11381         esac
11382         ;;
11383 esac
11384 set d_sfio
11385 eval $setvar
11386 case "$d_sfio" in
11387 $define) usesfio='true';;
11388 *) usesfio='false';;
11389 esac
11390
11391 : see if shmctl exists
11392 set shmctl d_shmctl
11393 eval $inlibc
11394
11395 : see if shmget exists
11396 set shmget d_shmget
11397 eval $inlibc
11398
11399 : see if shmat exists
11400 set shmat d_shmat
11401 eval $inlibc
11402 : see what shmat returns
11403 case "$d_shmat" in
11404 "$define")
11405         $cat >shmat.c <<'END'
11406 #include <sys/shm.h>
11407 void *shmat();
11408 END
11409         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11410                 shmattype='void *'
11411         else
11412                 shmattype='char *'
11413         fi
11414         echo "and it returns ($shmattype)." >&4
11415         : see if a prototype for shmat is available
11416         xxx=`./findhdr sys/shm.h`
11417         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11418         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11419                 val="$define"
11420         else
11421                 val="$undef"
11422         fi
11423         $rm -f shmat.[co]
11424         ;;
11425 *)
11426         val="$undef"
11427         ;;
11428 esac
11429 set d_shmatprototype
11430 eval $setvar
11431
11432 : see if shmdt exists
11433 set shmdt d_shmdt
11434 eval $inlibc
11435
11436 : see how much of the 'shm*(2)' library is present.
11437 h_shm=true
11438 echo " "
11439 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11440 *"$undef"*) h_shm=false;;
11441 esac
11442 case "$osname" in
11443 freebsd)
11444     case "`ipcs 2>&1`" in
11445     "SVID shared memory"*"not configured"*)
11446         echo "Your $osname does not have the shm*(2) configured." >&4
11447         h_shm=false
11448         val="$undef"
11449         set shmctl d_shmctl
11450         evat $setvar
11451         set shmget d_shmget
11452         evat $setvar
11453         set shmat d_shmat
11454         evat $setvar
11455         set shmdt d_shmdt
11456         evat $setvar
11457         ;;
11458     esac
11459     ;;
11460 esac
11461 : we could also check for sys/ipc.h ...
11462 if $h_shm && $test `./findhdr sys/shm.h`; then
11463         echo "You have the full shm*(2) library." >&4
11464         val="$define"
11465 else
11466         echo "You don't have the full shm*(2) library." >&4
11467         val="$undef"
11468 fi
11469 set d_shm
11470 eval $setvar
11471
11472 echo " "
11473 : see if we have sigaction
11474 if set sigaction val -f d_sigaction; eval $csym; $val; then
11475         echo 'sigaction() found.' >&4
11476         $cat > try.c <<'EOP'
11477 #include <stdio.h>
11478 #include <sys/types.h>
11479 #include <signal.h>
11480 int main()
11481 {
11482     struct sigaction act, oact;
11483     act.sa_flags = 0;
11484     oact.sa_handler = 0;
11485     /* so that act and oact are used */
11486     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11487 }
11488 EOP
11489         set try
11490         if eval $compile_ok; then
11491                 val="$define"
11492         else
11493                 echo "But you don't seem to have a useable struct sigaction." >&4
11494                 val="$undef"
11495         fi
11496 else
11497         echo 'sigaction NOT found.' >&4
11498         val="$undef"
11499 fi
11500 set d_sigaction; eval $setvar
11501 $rm -f try try$_o try.c
11502
11503 : see if sigsetjmp exists
11504 echo " "
11505 case "$d_sigsetjmp" in
11506 '')
11507         $cat >try.c <<'EOP'
11508 #include <setjmp.h>
11509 sigjmp_buf env;
11510 int set = 1;
11511 int main()
11512 {
11513         if (sigsetjmp(env,1))
11514                 exit(set);
11515         set = 0;
11516         siglongjmp(env, 1);
11517         exit(1);
11518 }
11519 EOP
11520         set try
11521         if eval $compile; then
11522                 if ./try >/dev/null 2>&1; then
11523                         echo "POSIX sigsetjmp found." >&4
11524                         val="$define"
11525                 else
11526                         $cat >&4 <<EOM
11527 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11528 I'll ignore them.
11529 EOM
11530                         val="$undef"
11531                 fi
11532         else
11533                 echo "sigsetjmp not found." >&4
11534                 val="$undef"
11535         fi
11536         ;;
11537 *) val="$d_sigsetjmp"
11538         case "$d_sigsetjmp" in
11539         $define) echo "POSIX sigsetjmp found." >&4;;
11540         $undef) echo "sigsetjmp not found." >&4;;
11541         esac
11542         ;;
11543 esac
11544 set d_sigsetjmp
11545 eval $setvar
11546 $rm -f try.c try
11547
11548 : see if socks5_init exists
11549 set socks5_init d_socks5_init
11550 eval $inlibc
11551
11552 : see if sys/stat.h is available
11553 set sys/stat.h i_sysstat
11554 eval $inhdr
11555
11556
11557 : see if stat knows about block sizes
11558 echo " "
11559 echo "Checking to see if your struct stat has st_blocks field..." >&4
11560 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11561 eval $hasfield
11562
11563
11564 : see if this is a sys/vfs.h system
11565 set sys/vfs.h i_sysvfs
11566 eval $inhdr
11567
11568
11569 : see if this is a sys/statfs.h system
11570 set sys/statfs.h i_sysstatfs
11571 eval $inhdr
11572
11573
11574 echo " "
11575 echo "Checking to see if your system supports struct statfs..." >&4
11576 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
11577 eval $hasstruct
11578 case "$d_statfs_s" in
11579 "$define")      echo "Yes, it does."   ;;
11580 *)              echo "No, it doesn't." ;;
11581 esac
11582
11583
11584
11585 : see if struct statfs knows about f_flags
11586 case "$d_statfs_s" in
11587 define) 
11588         echo " "
11589         echo "Checking to see if your struct statfs has f_flags field..." >&4
11590         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
11591         eval $hasfield
11592         ;;
11593 *)      val="$undef"
11594         set d_statfs_f_flags
11595         eval $setvar
11596         ;;
11597 esac
11598 case "$d_statfs_f_flags" in
11599 "$define")      echo "Yes, it does."   ;;
11600 *)              echo "No, it doesn't." ;;
11601 esac
11602
11603 : see if _ptr and _cnt from stdio act std
11604 echo " "
11605
11606 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11607         echo "(Looks like you have stdio.h from BSD.)"
11608         case "$stdio_ptr" in
11609         '') stdio_ptr='((fp)->_p)'
11610                 ptr_lval=$define
11611                 ;;
11612         *)      ptr_lval=$d_stdio_ptr_lval;;
11613         esac
11614         case "$stdio_cnt" in
11615         '') stdio_cnt='((fp)->_r)'
11616                 cnt_lval=$define
11617                 ;;
11618         *)      cnt_lval=$d_stdio_cnt_lval;;
11619         esac
11620         case "$stdio_base" in
11621         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11622         esac
11623         case "$stdio_bufsiz" in
11624         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11625         esac
11626 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11627         echo "(Looks like you have stdio.h from Linux.)"
11628         case "$stdio_ptr" in
11629         '') stdio_ptr='((fp)->_IO_read_ptr)'
11630                 ptr_lval=$define
11631                 ;;
11632         *)      ptr_lval=$d_stdio_ptr_lval;;
11633         esac
11634         case "$stdio_cnt" in
11635         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11636                 cnt_lval=$undef
11637                 ;;
11638         *)      cnt_lval=$d_stdio_cnt_lval;;
11639         esac
11640         case "$stdio_base" in
11641         '') stdio_base='((fp)->_IO_read_base)';;
11642         esac
11643         case "$stdio_bufsiz" in
11644         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11645         esac
11646 else
11647         case "$stdio_ptr" in
11648         '') stdio_ptr='((fp)->_ptr)'
11649                 ptr_lval=$define
11650                 ;;
11651         *)      ptr_lval=$d_stdio_ptr_lval;;
11652         esac
11653         case "$stdio_cnt" in
11654         '') stdio_cnt='((fp)->_cnt)'
11655                 cnt_lval=$define
11656                 ;;
11657         *)      cnt_lval=$d_stdio_cnt_lval;;
11658         esac
11659         case "$stdio_base" in
11660         '') stdio_base='((fp)->_base)';;
11661         esac
11662         case "$stdio_bufsiz" in
11663         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11664         esac
11665 fi
11666
11667 : test whether _ptr and _cnt really work
11668 echo "Checking how std your stdio is..." >&4
11669 $cat >try.c <<EOP
11670 #include <stdio.h>
11671 #define FILE_ptr(fp)    $stdio_ptr
11672 #define FILE_cnt(fp)    $stdio_cnt
11673 int main() {
11674         FILE *fp = fopen("try.c", "r");
11675         char c = getc(fp);
11676         if (
11677                 18 <= FILE_cnt(fp) &&
11678                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11679         )
11680                 exit(0);
11681         exit(1);
11682 }
11683 EOP
11684 val="$undef"
11685 set try
11686 if eval $compile; then
11687         if ./try; then
11688                 echo "Your stdio acts pretty std."
11689                 val="$define"
11690         else
11691                 echo "Your stdio isn't very std."
11692         fi
11693 else
11694         echo "Your stdio doesn't appear very std."
11695 fi
11696 $rm -f try.c try
11697 set d_stdstdio
11698 eval $setvar
11699
11700 : Can _ptr be used as an lvalue?
11701 case "$d_stdstdio$ptr_lval" in
11702 $define$define) val=$define ;;
11703 *) val=$undef ;;
11704 esac
11705 set d_stdio_ptr_lval
11706 eval $setvar
11707
11708 : Can _cnt be used as an lvalue?
11709 case "$d_stdstdio$cnt_lval" in
11710 $define$define) val=$define ;;
11711 *) val=$undef ;;
11712 esac
11713 set d_stdio_cnt_lval
11714 eval $setvar
11715
11716
11717 : test whether setting _ptr sets _cnt as a side effect
11718 d_stdio_ptr_lval_sets_cnt="$undef"
11719 d_stdio_ptr_lval_nochange_cnt="$undef"
11720 case "$d_stdio_ptr_lval$d_stdstdio" in
11721 $define$define)
11722         echo "Checking to see what happens if we set the stdio ptr..." >&4
11723 $cat >try.c <<EOP
11724 #include <stdio.h>
11725 /* Can we scream? */
11726 /* Eat dust sed :-) */
11727 /* In the buffer space, no one can hear you scream. */
11728 #define FILE_ptr(fp)    $stdio_ptr
11729 #define FILE_cnt(fp)    $stdio_cnt
11730 #include <sys/types.h>
11731 int main() {
11732         FILE *fp = fopen("try.c", "r");
11733         int c;
11734         char *ptr;
11735         size_t cnt;
11736         if (!fp) {
11737             puts("Fail even to read");
11738             exit(1);
11739         }
11740         c = getc(fp); /* Read away the first # */
11741         if (c == EOF) {
11742             puts("Fail even to read");
11743             exit(1);
11744         }
11745         if (!(
11746                 18 <= FILE_cnt(fp) &&
11747                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11748         )) {
11749                 puts("Fail even to read");
11750                 exit (1);
11751         }
11752         ptr = (char*) FILE_ptr(fp);
11753         cnt = (size_t)FILE_cnt(fp);
11754
11755         FILE_ptr(fp) += 42;
11756
11757         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11758                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11759                 exit (1);
11760         }
11761         if (FILE_cnt(fp) <= 20) {
11762                 printf ("Fail (<20 chars to test)");
11763                 exit (1);
11764         }
11765         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11766                 puts("Fail compare");
11767                 exit (1);
11768         }
11769         if (cnt == FILE_cnt(fp)) {
11770                 puts("Pass_unchanged");
11771                 exit (0);
11772         }       
11773         if (FILE_cnt(fp) == (cnt - 42)) {
11774                 puts("Pass_changed");
11775                 exit (0);
11776         }
11777         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11778         return 1;
11779
11780 }
11781 EOP
11782         set try
11783         if eval $compile; then
11784                 case `./try$exe_ext` in
11785                 Pass_changed)
11786                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11787                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11788                 Pass_unchanged)
11789                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11790                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11791                 Fail*)
11792                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11793                 *)
11794                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11795         esac
11796         else
11797                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11798         fi
11799         $rm -f try.c try
11800         ;;
11801 esac
11802
11803 : see if _base is also standard
11804 val="$undef"
11805 case "$d_stdstdio" in
11806 $define)
11807         $cat >try.c <<EOP
11808 #include <stdio.h>
11809 #define FILE_base(fp)   $stdio_base
11810 #define FILE_bufsiz(fp) $stdio_bufsiz
11811 int main() {
11812         FILE *fp = fopen("try.c", "r");
11813         char c = getc(fp);
11814         if (
11815                 19 <= FILE_bufsiz(fp) &&
11816                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11817         )
11818                 exit(0);
11819         exit(1);
11820 }
11821 EOP
11822         set try
11823         if eval $compile; then
11824                 if ./try; then
11825                         echo "And its _base field acts std."
11826                         val="$define"
11827                 else
11828                         echo "But its _base field isn't std."
11829                 fi
11830         else
11831                 echo "However, it seems to be lacking the _base field."
11832         fi
11833         $rm -f try.c try
11834         ;;
11835 esac
11836 set d_stdiobase
11837 eval $setvar
11838
11839 $cat >&4 <<EOM
11840 Checking how to access stdio streams by file descriptor number...
11841 EOM
11842 case "$stdio_stream_array" in
11843 '')     $cat >try.c <<EOCP
11844 #include <stdio.h>
11845 int main() {
11846   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11847     printf("yes\n");
11848 }
11849 EOCP
11850         for s in _iob __iob __sF
11851         do
11852                 set try -DSTDIO_STREAM_ARRAY=$s
11853                 if eval $compile; then
11854                         case "`./try$exe_ext`" in
11855                         yes)    stdio_stream_array=$s; break ;;
11856                         esac
11857                 fi
11858         done
11859         $rm -f try.* try$exe_ext
11860 esac
11861 case "$stdio_stream_array" in
11862 '')     $cat >&4 <<EOM
11863 I can't figure out how to access stdio streams by file descriptor number.
11864 EOM
11865         d_stdio_stream_array="$undef"
11866         ;;
11867 *)      $cat >&4 <<EOM
11868 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11869 EOM
11870         d_stdio_stream_array="$define"
11871         ;;
11872 esac
11873
11874 : see if strcoll exists
11875 set strcoll d_strcoll
11876 eval $inlibc
11877
11878 : check for structure copying
11879 echo " "
11880 echo "Checking to see if your C compiler can copy structs..." >&4
11881 $cat >try.c <<'EOCP'
11882 int main()
11883 {
11884         struct blurfl {
11885                 int dyick;
11886         } foo, bar;
11887
11888         foo = bar;
11889 }
11890 EOCP
11891 if $cc -c try.c >/dev/null 2>&1 ; then
11892         val="$define"
11893         echo "Yup, it can."
11894 else
11895         val="$undef"
11896         echo "Nope, it can't."
11897 fi
11898 set d_strctcpy
11899 eval $setvar
11900 $rm -f try.*
11901
11902 : see if strerror and/or sys_errlist[] exist
11903 echo " "
11904 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11905     if set strerror val -f d_strerror; eval $csym; $val; then
11906                 echo 'strerror() found.' >&4
11907                 d_strerror="$define"
11908                 d_strerrm='strerror(e)'
11909                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11910                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11911                         d_syserrlst="$define"
11912                 else
11913                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11914                         d_syserrlst="$undef"
11915                 fi
11916     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11917                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11918                 echo 'strerror() found in string header.' >&4
11919                 d_strerror="$define"
11920                 d_strerrm='strerror(e)'
11921                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11922                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11923                                 d_syserrlst="$define"
11924                 else
11925                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11926                         d_syserrlst="$undef"
11927                 fi
11928     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11929                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11930                 d_strerror="$undef"
11931                 d_syserrlst="$define"
11932                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11933     else
11934                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11935                 d_strerror="$undef"
11936                 d_syserrlst="$undef"
11937                 d_strerrm='"unknown"'
11938     fi
11939 fi
11940
11941 : see if strtod exists
11942 set strtod d_strtod
11943 eval $inlibc
11944
11945 : see if strtol exists
11946 set strtol d_strtol
11947 eval $inlibc
11948
11949 : see if strtold exists
11950 set strtold d_strtold
11951 eval $inlibc
11952
11953 : see if strtoll exists
11954 set strtoll d_strtoll
11955 eval $inlibc
11956
11957 case "$d_longlong-$d_strtoll" in
11958 "$define-$define")
11959         $cat <<EOM
11960 Checking whether your strtoll() works okay...
11961 EOM
11962         $cat >try.c <<'EOCP'
11963 #include <errno.h>
11964 #ifdef __hpux
11965 #define strtoll __strtoll
11966 #endif
11967 #ifdef __EMX__
11968 #define strtoll _strtoll
11969 #endif
11970 #include <stdio.h>
11971 extern long long int strtoll(char *s, char **, int); 
11972 static int bad = 0;
11973 int check(char *s, long long ell, int een) {
11974         long long gll;
11975         errno = 0;
11976         gll = strtoll(s, 0, 10);
11977         if (!((gll == ell) && (errno == een)))
11978                 bad++;
11979 }
11980 int main() {
11981         check(" 1",                                      1LL, 0);
11982         check(" 0",                                      0LL, 0);
11983         check("-1",                                     -1LL, 0);
11984         check("-9223372036854775808", -9223372036854775808LL, 0);
11985         check("-9223372036854775808", -9223372036854775808LL, 0);
11986         check(" 9223372036854775807",  9223372036854775807LL, 0);
11987         check("-9223372036854775808", -9223372036854775808LL, 0);
11988         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11989         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11990         if (!bad)
11991                 printf("ok\n");
11992 }
11993 EOCP
11994         set try
11995         if eval $compile; then
11996                 yyy=`./try`
11997                 case "$yyy" in
11998                 ok) echo "Your strtoll() seems to be working okay." ;;
11999                 *) cat <<EOM >&4
12000 Your strtoll() doesn't seem to be working okay.
12001 EOM
12002                    d_strtoll="$undef"
12003                    ;;
12004                 esac
12005         else
12006                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12007                 d_strtoll="$undef"
12008         fi
12009         ;;
12010 esac
12011
12012 : see if strtoq exists
12013 set strtoq d_strtoq
12014 eval $inlibc
12015
12016 : see if strtoul exists
12017 set strtoul d_strtoul
12018 eval $inlibc
12019
12020 case "$d_strtoul" in
12021 "$define")
12022         $cat <<EOM
12023 Checking whether your strtoul() works okay...
12024 EOM
12025         $cat >try.c <<'EOCP'
12026 #include <errno.h>
12027 #include <stdio.h>
12028 extern unsigned long int strtoul(char *s, char **, int); 
12029 static int bad = 0;
12030 void check(char *s, unsigned long eul, int een) {
12031         unsigned long gul;
12032         errno = 0;
12033         gul = strtoul(s, 0, 10);
12034         if (!((gul == eul) && (errno == een)))
12035                 bad++;
12036 }
12037 int main() {
12038         check(" 1", 1L, 0);
12039         check(" 0", 0L, 0);
12040 EOCP
12041         case "$longsize" in
12042         8)
12043             $cat >>try.c <<'EOCP'
12044         check("18446744073709551615", 18446744073709551615UL, 0);
12045         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12046 #if 0 /* strtoul() for /^-/ strings is undefined. */
12047         check("-1", 18446744073709551615UL, 0);
12048         check("-18446744073709551614", 2, 0);
12049         check("-18446744073709551615", 1, 0);
12050         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12051         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12052 #endif
12053 EOCP
12054                 ;;
12055         4)
12056                     $cat >>try.c <<'EOCP'
12057         check("4294967295", 4294967295UL, 0);
12058         check("4294967296", 4294967295UL, ERANGE);
12059 #if 0 /* strtoul() for /^-/ strings is undefined. */
12060         check("-1", 4294967295UL, 0);
12061         check("-4294967294", 2, 0);
12062         check("-4294967295", 1, 0);
12063         check("-4294967296", 4294967295UL, ERANGE);
12064         check("-4294967297", 4294967295UL, ERANGE);
12065 #endif
12066 EOCP
12067                 ;;
12068         *)
12069 : Should we write these tests to be more portable by sprintf-ing
12070 : ~0 and then manipulating that char string as input for strtol?
12071                 ;;
12072         esac
12073         $cat >>try.c <<'EOCP'
12074         if (!bad)
12075                 printf("ok\n");
12076         return 0;
12077 }
12078 EOCP
12079         set try
12080         if eval $compile; then
12081                 case "`./try`" in
12082                 ok) echo "Your strtoul() seems to be working okay." ;;
12083                 *) cat <<EOM >&4
12084 Your strtoul() doesn't seem to be working okay.
12085 EOM
12086                    d_strtoul="$undef"
12087                    ;;
12088                 esac
12089         fi
12090         ;;
12091 esac
12092
12093 : see if strtoull exists
12094 set strtoull d_strtoull
12095 eval $inlibc
12096
12097 case "$d_longlong-$d_strtoull" in
12098 "$define-$define")
12099         $cat <<EOM
12100 Checking whether your strtoull() works okay...
12101 EOM
12102         $cat >try.c <<'EOCP'
12103 #include <errno.h>
12104 #ifdef __hpux
12105 #define strtoull __strtoull
12106 #endif
12107 #include <stdio.h>
12108 extern unsigned long long int strtoull(char *s, char **, int); 
12109 static int bad = 0;
12110 int check(char *s, long long eull, int een) {
12111         long long gull;
12112         errno = 0;
12113         gull = strtoull(s, 0, 10);
12114         if (!((gull == eull) && (errno == een)))
12115                 bad++;
12116 }
12117 int main() {
12118         check(" 1",                                        1LL, 0);
12119         check(" 0",                                        0LL, 0);
12120         check("18446744073709551615",  18446744073709551615ULL, 0);
12121         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12122 #if 0 /* strtoull() for /^-/ strings is undefined. */
12123         check("-1",                    18446744073709551615ULL, 0);
12124         check("-18446744073709551614",                     2LL, 0);
12125         check("-18446744073709551615",                     1LL, 0);
12126         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12127         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12128 #endif
12129         if (!bad)
12130                 printf("ok\n");
12131 }
12132 EOCP
12133         set try
12134         if eval $compile; then
12135                 case "`./try`" in
12136                 ok) echo "Your strtoull() seems to be working okay." ;;
12137                 *) cat <<EOM >&4
12138 Your strtoull() doesn't seem to be working okay.
12139 EOM
12140                    d_strtoull="$undef"
12141                    ;;
12142                 esac
12143         fi
12144         ;;
12145 esac
12146
12147 : see if strtouq exists
12148 set strtouq d_strtouq
12149 eval $inlibc
12150
12151 case "$d_strtouq" in
12152 "$define")
12153         $cat <<EOM
12154 Checking whether your strtouq() works okay...
12155 EOM
12156         $cat >try.c <<'EOCP'
12157 #include <errno.h>
12158 #include <stdio.h>
12159 extern unsigned long long int strtouq(char *s, char **, int); 
12160 static int bad = 0;
12161 void check(char *s, unsigned long long eull, int een) {
12162         unsigned long long gull;
12163         errno = 0;
12164         gull = strtouq(s, 0, 10);
12165         if (!((gull == eull) && (errno == een)))
12166                 bad++;
12167 }
12168 int main() {
12169         check(" 1",                                        1LL, 0);
12170         check(" 0",                                        0LL, 0);
12171         check("18446744073709551615",  18446744073709551615ULL, 0);
12172         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12173 #if 0 /* strtouq() for /^-/ strings is undefined. */
12174         check("-1",                    18446744073709551615ULL, 0);
12175         check("-18446744073709551614",                     2LL, 0);
12176         check("-18446744073709551615",                     1LL, 0);
12177         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12178         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12179 #endif
12180         if (!bad)
12181                 printf("ok\n");
12182         return 0;
12183 }
12184 EOCP
12185         set try
12186         if eval $compile; then
12187                 case "`./try`" in
12188                 ok) echo "Your strtouq() seems to be working okay." ;;
12189                 *) cat <<EOM >&4
12190 Your strtouq() doesn't seem to be working okay.
12191 EOM
12192                    d_strtouq="$undef"
12193                    ;;
12194                 esac
12195         fi
12196         ;;
12197 esac
12198
12199 : see if strxfrm exists
12200 set strxfrm d_strxfrm
12201 eval $inlibc
12202
12203 : see if symlink exists
12204 set symlink d_symlink
12205 eval $inlibc
12206
12207 : see if syscall exists
12208 set syscall d_syscall
12209 eval $inlibc
12210
12211 : see if sysconf exists
12212 set sysconf d_sysconf
12213 eval $inlibc
12214
12215 : see if system exists
12216 set system d_system
12217 eval $inlibc
12218
12219 : see if tcgetpgrp exists
12220 set tcgetpgrp d_tcgetpgrp
12221 eval $inlibc
12222
12223 : see if tcsetpgrp exists
12224 set tcsetpgrp d_tcsetpgrp
12225 eval $inlibc
12226
12227 : see if prototype for telldir is available
12228 echo " "
12229 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12230 eval $hasproto
12231
12232 : see if this is a sys/times.h system
12233 set sys/times.h i_systimes
12234 eval $inhdr
12235
12236 : see if times exists
12237 echo " "
12238 if set times val -f d_times; eval $csym; $val; then
12239         echo 'times() found.' >&4
12240         d_times="$define"
12241         inc=''
12242         case "$i_systimes" in
12243         "$define") inc='sys/times.h';;
12244         esac
12245         rp="What is the type returned by times() on this system?"
12246         set clock_t clocktype long stdio.h sys/types.h $inc
12247         eval $typedef_ask
12248 else
12249         echo 'times() NOT found, hope that will do.' >&4
12250         d_times="$undef"
12251         clocktype='int'
12252 fi
12253
12254 : see if truncate exists
12255 set truncate d_truncate
12256 eval $inlibc
12257
12258 : see if tzname[] exists
12259 echo " "
12260 if set tzname val -a d_tzname; eval $csym; $val; then
12261         val="$define"
12262         echo 'tzname[] found.' >&4
12263 else
12264         val="$undef"
12265         echo 'tzname[] NOT found.' >&4
12266 fi
12267 set d_tzname
12268 eval $setvar
12269
12270 : see if umask exists
12271 set umask d_umask
12272 eval $inlibc
12273
12274 : see if ustat exists
12275 set ustat d_ustat
12276 eval $inlibc
12277
12278 : backward compatibility for d_hvfork
12279 if test X$d_hvfork != X; then
12280         d_vfork="$d_hvfork"
12281         d_hvfork=''
12282 fi
12283 : see if there is a vfork
12284 val=''
12285 set vfork val
12286 eval $inlibc
12287
12288 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12289 : perl on Solaris 2.x, and probably elsewhere.
12290 case "$val" in
12291 $define)
12292         echo " "
12293         case "$usevfork" in
12294         false) dflt='n';;
12295         *) dflt='y';;
12296         esac
12297         cat <<'EOM'
12298  
12299 Perl can only use a vfork() that doesn't suffer from strict
12300 restrictions on calling functions or modifying global data in
12301 the child.  For example, glibc-2.1 contains such a vfork()
12302 that is unsuitable.  If your system provides a proper fork()
12303 call, chances are that you do NOT want perl to use vfork().
12304
12305 EOM
12306         rp="Do you still want to use vfork()?"
12307         . ./myread
12308         case "$ans" in
12309         y|Y) ;;
12310         *)
12311                 echo "Ok, we won't use vfork()."
12312                 val="$undef"
12313                 ;;
12314         esac
12315         ;;
12316 esac
12317 set d_vfork
12318 eval $setvar
12319 case "$d_vfork" in
12320 $define) usevfork='true';;
12321 *) usevfork='false';;
12322 esac
12323
12324 : see if this is an sysdir system
12325 set sys/dir.h i_sysdir
12326 eval $inhdr
12327
12328 : see if this is an sysndir system
12329 set sys/ndir.h i_sysndir
12330 eval $inhdr
12331
12332 : see if closedir exists
12333 set closedir d_closedir
12334 eval $inlibc
12335
12336 case "$d_closedir" in
12337 "$define")
12338         echo " "
12339         echo "Checking whether closedir() returns a status..." >&4
12340         cat > closedir.c <<EOM
12341 #$i_dirent I_DIRENT             /**/
12342 #$i_sysdir I_SYS_DIR            /**/
12343 #$i_sysndir I_SYS_NDIR          /**/
12344 #$i_systypes I_SYS_TYPES        /**/
12345
12346 #if defined(I_SYS_TYPES)
12347 #include <sys/types.h>
12348 #endif
12349 #if defined(I_DIRENT)
12350 #include <dirent.h>
12351 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12352 #include <sys/dir.h>
12353 #endif
12354 #else
12355 #ifdef I_SYS_NDIR
12356 #include <sys/ndir.h>
12357 #else
12358 #ifdef I_SYS_DIR
12359 #ifdef hp9000s500
12360 #include <ndir.h>       /* may be wrong in the future */
12361 #else
12362 #include <sys/dir.h>
12363 #endif
12364 #endif
12365 #endif
12366 #endif 
12367 int main() { return closedir(opendir(".")); }
12368 EOM
12369         set closedir
12370         if eval $compile_ok; then
12371                 if ./closedir > /dev/null 2>&1 ; then
12372                         echo "Yes, it does."
12373                         val="$undef"
12374                 else
12375                         echo "No, it doesn't."
12376                         val="$define"
12377                 fi
12378         else
12379                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12380                 val="$define"
12381         fi
12382         ;;
12383 *)
12384         val="$undef";
12385         ;;
12386 esac
12387 set d_void_closedir
12388 eval $setvar
12389 $rm -f closedir*
12390 : see if there is a wait4
12391 set wait4 d_wait4
12392 eval $inlibc
12393
12394 : see if waitpid exists
12395 set waitpid d_waitpid
12396 eval $inlibc
12397
12398 : see if wcstombs exists
12399 set wcstombs d_wcstombs
12400 eval $inlibc
12401
12402 : see if wctomb exists
12403 set wctomb d_wctomb
12404 eval $inlibc
12405
12406 : preserve RCS keywords in files with variable substitution, grrr
12407 Date='$Date'
12408 Id='$Id'
12409 Log='$Log'
12410 RCSfile='$RCSfile'
12411 Revision='$Revision'
12412
12413 case "$crosscompile" in
12414 ''|[nN]*) crosscompile="$undef" ;;
12415 esac
12416
12417 case "$osname" in
12418 next|rhapsody|darwin) multiarch="$define" ;;
12419 esac
12420 case "$multiarch" in
12421 ''|[nN]*) multiarch="$undef" ;;
12422 esac
12423
12424 : check for alignment requirements
12425 echo " "
12426 case "$crosscompile$multiarch" in
12427 *$define*)
12428         $cat <<EOM
12429 You seem to be either cross-compiling or doing a multiarchitecture build,
12430 skipping the memory alignment check.
12431
12432 EOM
12433         case "$alignbytes" in
12434         '') alignbytes=8 ;;
12435         esac
12436         ;;
12437 *)
12438         case "$alignbytes" in
12439         '') echo "Checking alignment constraints..." >&4
12440                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12441                         $cat >try.c <<'EOCP'
12442 typedef long double NV;
12443 EOCP
12444                 else
12445                         $cat >try.c <<'EOCP'
12446 typedef double NV;
12447 EOCP
12448                 fi
12449                 $cat >>try.c <<'EOCP'
12450 #include <stdio.h>
12451 struct foobar {
12452         char foo;
12453         NV bar;
12454 } try_algn;
12455 int main()
12456 {
12457     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12458     return(0);
12459 }
12460 EOCP
12461                 set try
12462                 if eval $compile_ok; then
12463                         dflt=`./try`
12464                 else
12465                         dflt='8'
12466                         echo "(I can't seem to compile the test program...)"
12467                 fi
12468                 ;;
12469         *) dflt="$alignbytes"
12470                 ;;
12471         esac
12472         rp="Doubles must be aligned on a how-many-byte boundary?"
12473         . ./myread
12474         alignbytes="$ans"
12475         $rm -f try.c try
12476         ;;
12477 esac
12478
12479
12480 : set the base revision
12481 baserev=5.0
12482
12483 : check for ordering of bytes in a long
12484 echo " "
12485 case "$crosscompile$multiarch" in
12486 *$define*)
12487         $cat <<EOM
12488 You seem to be either cross-compiling or doing a multiarchitecture build,
12489 skipping the byteorder check.
12490
12491 EOM
12492         byteorder='0xffff'
12493         ;;
12494 *)
12495         case "$byteorder" in
12496         '')
12497                 $cat <<'EOM'
12498 In the following, larger digits indicate more significance.  A big-endian
12499 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12500 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12501 machines may have weird orders like 3412.  A Cray will report 87654321,
12502 an Alpha will report 12345678. If the test program works the default is
12503 probably right.
12504 I'm now running the test program...
12505 EOM
12506                 $cat >try.c <<'EOCP'
12507 #include <stdio.h>
12508 int main()
12509 {
12510         int i;
12511         union {
12512                 unsigned long l;
12513                 char c[sizeof(long)];
12514         } u;
12515
12516         if (sizeof(long) > 4)
12517                 u.l = (0x08070605L << 32) | 0x04030201L;
12518         else
12519                 u.l = 0x04030201L;
12520         for (i = 0; i < sizeof(long); i++)
12521                 printf("%c", u.c[i]+'0');
12522         printf("\n");
12523         exit(0);
12524 }
12525 EOCP
12526                 xxx_prompt=y
12527                 set try
12528                 if eval $compile && ./try > /dev/null; then
12529                         dflt=`./try`
12530                         case "$dflt" in
12531                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12532                                 echo "(The test program ran ok.)"
12533                                 echo "byteorder=$dflt"
12534                                 xxx_prompt=n
12535                         ;;
12536                         ????|????????) echo "(The test program ran ok.)" ;;
12537                         *) echo "(The test program didn't run right for some reason.)" ;;
12538                         esac
12539                 else
12540                         dflt='4321'
12541                         cat <<'EOM'
12542 (I can't seem to compile the test program.  Guessing big-endian...)
12543 EOM
12544                 fi
12545                 case "$xxx_prompt" in
12546                 y)
12547                         rp="What is the order of bytes in a long?"
12548                         . ./myread
12549                         byteorder="$ans"
12550                         ;;
12551                 *)      byteorder=$dflt
12552                         ;;
12553                 esac
12554                 ;;
12555         esac
12556         $rm -f try.c try
12557         ;;
12558 esac
12559
12560
12561 : how do we catenate cpp tokens here?
12562 echo " "
12563 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12564 $cat >cpp_stuff.c <<'EOCP'
12565 #define RCAT(a,b)a/**/b
12566 #define ACAT(a,b)a ## b
12567 RCAT(Rei,ser)
12568 ACAT(Cir,cus)
12569 EOCP
12570 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12571 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12572         echo "Oh!  Smells like ANSI's been here." >&4
12573         echo "We can catify or stringify, separately or together!"
12574         cpp_stuff=42
12575 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12576         echo "Ah, yes!  The good old days!" >&4
12577         echo "However, in the good old days we don't know how to stringify and"
12578         echo "catify at the same time."
12579         cpp_stuff=1
12580 else
12581         $cat >&4 <<EOM
12582 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12583 to have to edit the values of CAT[2-5] in config.h...
12584 EOM
12585         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12586 fi
12587 $rm -f cpp_stuff.*
12588
12589 : see if this is a db.h system
12590 set db.h i_db
12591 eval $inhdr
12592
12593 case "$i_db" in
12594 $define)
12595         : Check db version.
12596         echo " "
12597         echo "Checking Berkeley DB version ..." >&4
12598         $cat >try.c <<EOCP
12599 #$d_const HASCONST
12600 #ifndef HASCONST
12601 #define const
12602 #endif
12603 #include <sys/types.h>
12604 #include <stdio.h>
12605 #include <db.h>
12606 int main()
12607 {
12608 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12609     int Major, Minor, Patch ;
12610     unsigned long Version ;
12611     (void)db_version(&Major, &Minor, &Patch) ;
12612     printf("You have Berkeley DB Version 2 or greater\n");
12613
12614     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12615                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12616     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12617                 Major, Minor, Patch) ;
12618
12619     /* check that db.h & libdb are compatible */
12620     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12621         printf("db.h and libdb are incompatible\n") ;
12622         exit(3);        
12623     }
12624
12625     printf("db.h and libdb are compatible\n") ;
12626
12627     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12628                 + DB_VERSION_PATCH ;
12629
12630     /* needs to be >= 2.3.4 */
12631     if (Version < 2003004) {
12632     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12633         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12634         exit(2);        
12635     }
12636
12637     exit(0);
12638 #else
12639 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12640     printf("You have Berkeley DB Version 1\n");
12641     exit(0);    /* DB version < 2: the coast is clear. */
12642 #else
12643     exit(1);    /* <db.h> not Berkeley DB? */
12644 #endif
12645 #endif
12646 }
12647 EOCP
12648         set try
12649         if eval $compile_ok && ./try; then
12650                 echo 'Looks OK.' >&4
12651         else
12652                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12653                 i_db=$undef
12654                 case " $libs " in
12655                 *"-ldb "*)
12656                         : Remove db from list of libraries to use
12657                         echo "Removing unusable -ldb from library list" >&4
12658                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12659                         shift
12660                         libs="$*"
12661                         echo "libs = $libs" >&4
12662                         ;;
12663                 esac
12664         fi
12665         $rm -f try.*
12666         ;;
12667 esac
12668
12669 case "$i_db" in
12670 define)
12671         : Check the return type needed for hash 
12672         echo " "
12673         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12674         $cat >try.c <<EOCP
12675 #$d_const HASCONST
12676 #ifndef HASCONST
12677 #define const
12678 #endif
12679 #include <sys/types.h>
12680 #include <db.h>
12681
12682 #ifndef DB_VERSION_MAJOR
12683 u_int32_t hash_cb (ptr, size)
12684 const void *ptr;
12685 size_t size;
12686 {
12687 }
12688 HASHINFO info;
12689 int main()
12690 {
12691         info.hash = hash_cb;
12692 }
12693 #endif
12694 EOCP
12695         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12696                 if $contains warning try.out >>/dev/null 2>&1 ; then
12697                         db_hashtype='int'
12698                 else
12699                         db_hashtype='u_int32_t'
12700                 fi
12701         else
12702                 : XXX Maybe we should just give up here.
12703                 db_hashtype=u_int32_t
12704                 $cat try.out >&4
12705                 echo "Help:  I can't seem to compile the db test program." >&4
12706                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12707         fi
12708         $rm -f try.*
12709         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12710         ;;
12711 *)      db_hashtype=u_int32_t
12712         ;;
12713 esac
12714 case "$i_db" in
12715 define)
12716         : Check the return type needed for prefix 
12717         echo " "
12718         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12719         cat >try.c <<EOCP
12720 #$d_const HASCONST
12721 #ifndef HASCONST
12722 #define const
12723 #endif
12724 #include <sys/types.h>
12725 #include <db.h>
12726
12727 #ifndef DB_VERSION_MAJOR
12728 size_t prefix_cb (key1, key2)
12729 const DBT *key1;
12730 const DBT *key2;
12731 {
12732 }
12733 BTREEINFO info;
12734 int main()
12735 {
12736         info.prefix = prefix_cb;
12737 }
12738 #endif
12739 EOCP
12740         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12741                 if $contains warning try.out >>/dev/null 2>&1 ; then
12742                         db_prefixtype='int'
12743                 else
12744                         db_prefixtype='size_t'
12745                 fi
12746         else
12747                 db_prefixtype='size_t'
12748                 : XXX Maybe we should just give up here.
12749                 $cat try.out >&4
12750                 echo "Help:  I can't seem to compile the db test program." >&4
12751                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12752         fi
12753         $rm -f try.*
12754         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12755         ;;
12756 *)      db_prefixtype='size_t'
12757         ;;
12758 esac
12759
12760 : check for void type
12761 echo " "
12762 echo "Checking to see how well your C compiler groks the void type..." >&4
12763 case "$voidflags" in
12764 '')
12765         $cat >try.c <<'EOCP'
12766 #if TRY & 1
12767 void sub() {
12768 #else
12769 sub() {
12770 #endif
12771         extern void moo();      /* function returning void */
12772         void (*goo)();          /* ptr to func returning void */
12773 #if TRY & 8
12774         void *hue;              /* generic ptr */
12775 #endif
12776 #if TRY & 2
12777         void (*foo[10])();
12778 #endif
12779
12780 #if TRY & 4
12781         if(goo == moo) {
12782                 exit(0);
12783         }
12784 #endif
12785         exit(0);
12786 }
12787 int main() { sub(); }
12788 EOCP
12789         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12790                 voidflags=$defvoidused
12791         echo "Good.  It appears to support void to the level $package wants.">&4
12792                 if $contains warning .out >/dev/null 2>&1; then
12793                         echo "However, you might get some warnings that look like this:"
12794                         $cat .out
12795                 fi
12796         else
12797 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12798                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12799                         echo "It supports 1..."
12800                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12801                                 echo "It also supports 2..."
12802                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12803                                         voidflags=7
12804                                         echo "And it supports 4 but not 8 definitely."
12805                                 else
12806                                         echo "It doesn't support 4..."
12807                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12808                                                 voidflags=11
12809                                                 echo "But it supports 8."
12810                                         else
12811                                                 voidflags=3
12812                                                 echo "Neither does it support 8."
12813                                         fi
12814                                 fi
12815                         else
12816                                 echo "It does not support 2..."
12817                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12818                                         voidflags=13
12819                                         echo "But it supports 4 and 8."
12820                                 else
12821                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12822                                                 voidflags=5
12823                                                 echo "And it supports 4 but has not heard about 8."
12824                                         else
12825                                                 echo "However it supports 8 but not 4."
12826                                         fi
12827                                 fi
12828                         fi
12829                 else
12830                         echo "There is no support at all for void."
12831                         voidflags=0
12832                 fi
12833         fi
12834 esac
12835 case "$voidflags" in
12836 "$defvoidused") ;;
12837 *)      $cat >&4 <<'EOM'
12838   Support flag bits are:
12839     1: basic void declarations.
12840     2: arrays of pointers to functions returning void.
12841     4: operations between pointers to and addresses of void functions.
12842     8: generic void pointers.
12843 EOM
12844         dflt="$voidflags";
12845         rp="Your void support flags add up to what?"
12846         . ./myread
12847         voidflags="$ans"
12848         ;;
12849 esac
12850 $rm -f try.* .out
12851
12852
12853 : How can we generate normalized random numbers ?
12854 echo " "
12855 echo "Looking for a random number function..." >&4
12856 case "$randfunc" in
12857 '')
12858         if set drand48 val -f; eval $csym; $val; then
12859                 dflt="drand48"
12860                 echo "Good, found drand48()." >&4
12861         elif set random val -f; eval $csym; $val; then
12862                 dflt="random"
12863                 echo "OK, found random()." >&4
12864         else
12865                 dflt="rand"
12866                 echo "Yick, looks like I have to use rand()." >&4
12867         fi
12868         echo " "
12869         ;;
12870 *)
12871         dflt="$randfunc"
12872         ;;
12873 esac
12874 cont=true
12875
12876 case "$ccflags" in
12877 *-Dmy_rand=*|*-Dmy_srand=*)
12878         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12879         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12880         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12881         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12882         ;;
12883 esac
12884
12885 while $test "$cont"; do
12886         rp="Use which function to generate random numbers?"
12887         . ./myread
12888         if $test "$ans" = "$dflt"; then
12889                 : null
12890         else
12891                 randbits=''
12892         fi
12893         randfunc="$ans"
12894         if set $ans val -f; eval $csym; $val; then
12895                 cont=''
12896         else
12897                 dflt=y
12898                 rp="I cannot find function $ans. Use that name anyway?"
12899                 . ./myread
12900                 dflt=rand
12901                 case "$ans" in
12902                         [yY]*) cont='';;
12903                 esac
12904         fi
12905         case "$cont" in
12906         '')
12907                 case "$randfunc" in
12908                 drand48)
12909                         drand01="drand48()"
12910                         seedfunc="srand48"
12911                         randbits=48
12912                         randseedtype=long
12913                         ;;
12914                 rand|random)
12915                         case "$randbits" in
12916                         '')
12917 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12918                                 $cat >try.c <<EOCP
12919 #$i_unistd I_UNISTD
12920 #$i_stdlib I_STDLIB
12921 #include <stdio.h>
12922 #ifdef I_UNISTD
12923 #  include <unistd.h>
12924 #endif
12925 #ifdef I_STDLIB
12926 #  include <stdlib.h>
12927 #endif
12928 int main()
12929 {
12930         register int i;
12931         register unsigned long tmp;
12932         register unsigned long max = 0L;
12933
12934         for (i = 1000; i; i--) {
12935                 tmp = (unsigned long) $randfunc();
12936                 if (tmp > max) max = tmp;
12937         }
12938         for (i = 0; max; i++)
12939                 max /= 2;
12940         printf("%d\n",i);
12941 }
12942 EOCP
12943                                 set try
12944                                 if eval $compile_ok; then
12945                                         dflt=`try`
12946                                 else
12947                                         dflt='?'
12948                                         echo "(I can't seem to compile the test program...)"
12949                                 fi
12950                                 ;;
12951                         *)
12952                                 dflt="$randbits"
12953                                 ;;
12954                         esac
12955                         rp="How many bits does your $randfunc() function produce?"
12956                         . ./myread
12957                         randbits="$ans"
12958                         $rm -f try.c try
12959                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12960                         seedfunc="s$randfunc"
12961                         randseedtype=unsigned
12962                         ;;
12963                 *)
12964                         dflt="31"
12965                         rp="How many bits does your $randfunc() function produce?"
12966                         . ./myread
12967                         randbits="$ans"
12968                         seedfunc="s$randfunc"
12969                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12970                         if set $seedfunc val -f; eval $csym; $val; then
12971                                 echo "(Using $seedfunc() to seed random generator)"
12972                         else
12973                                 echo "(Warning: no $seedfunc() to seed random generator)"
12974                                 seedfunc=rand
12975                         fi
12976                         randseedtype=unsigned
12977                         ;;
12978                 esac
12979                 ;;
12980         esac
12981 done
12982
12983 echo " "
12984 echo "Determining whether or not we are on an EBCDIC system..." >&4
12985 $cat >tebcdic.c <<'EOM'
12986 int main()
12987 {
12988   if ('M'==0xd4) return 0;
12989   return 1;
12990 }
12991 EOM
12992
12993 val=$undef
12994 set tebcdic
12995 if eval $compile_ok; then
12996         if ./tebcdic; then
12997                 echo "You seem to speak EBCDIC." >&4
12998                 val="$define"
12999         else
13000                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13001         fi
13002 else
13003         echo "I'm unable to compile the test program." >&4
13004         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13005 fi
13006 $rm -f tebcdic.c tebcdic
13007 set ebcdic
13008 eval $setvar
13009
13010 echo " "
13011 $cat >&4 <<EOM
13012 Checking how to flush all pending stdio output...
13013 EOM
13014 # I only know how to find the first 32 possibly open files on SunOS.
13015 # See also hints/sunos_4_1.sh and util.c  --AD
13016 case "$osname" in
13017 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13018 esac
13019 $cat >>try.c <<EOCP
13020 #include <stdio.h>
13021 #$i_unistd I_UNISTD
13022 #ifdef I_UNISTD
13023 # include <unistd.h>
13024 #endif
13025 #$d_sysconf HAS_SYSCONF
13026 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13027 #ifdef HAS_STDIO_STREAM_ARRAY
13028 # define STDIO_STREAM_ARRAY $stdio_stream_array
13029 #endif
13030 int main() {
13031   FILE* p = fopen("try.out", "w");
13032 #ifdef TRY_FPUTC
13033   fputc('x', p);
13034 #else
13035 # ifdef TRY_FPRINTF
13036   fprintf(p, "x");
13037 # endif
13038 #endif
13039 #ifdef TRY_FFLUSH_NULL
13040   fflush(NULL);
13041 #endif
13042 #ifdef TRY_FFLUSH_ALL
13043   {
13044     long open_max = -1;
13045 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13046     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13047 # else
13048 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13049     open_max = sysconf(_SC_OPEN_MAX);
13050 #  else
13051 #   ifdef FOPEN_MAX
13052     open_max = FOPEN_MAX;
13053 #   else
13054 #    ifdef OPEN_MAX
13055     open_max = OPEN_MAX;
13056 #    else
13057 #     ifdef _NFILE
13058     open_max = _NFILE;
13059 #     endif
13060 #    endif
13061 #   endif
13062 #  endif
13063 # endif 
13064 # ifdef HAS_STDIO_STREAM_ARRAY
13065     if (open_max > 0) {
13066       long i;
13067       for (i = 0; i < open_max; i++)
13068             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13069                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13070                 STDIO_STREAM_ARRAY[i]._flag)
13071                 fflush(&STDIO_STREAM_ARRAY[i]);
13072     }   
13073   }
13074 # endif
13075 #endif
13076   _exit(42);
13077 }
13078 EOCP
13079 : first we have to find out how _not_ to flush
13080 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13081     output=''
13082     set try -DTRY_FPUTC
13083     if eval $compile; then
13084             $rm -f try.out
13085             ./try$exe_ext 2>/dev/null
13086             if $test ! -s try.out -a "X$?" = X42; then
13087                 output=-DTRY_FPUTC
13088             fi
13089     fi
13090     case "$output" in
13091     '')
13092             set try -DTRY_FPRINTF
13093             $rm -f try.out
13094             if eval $compile; then
13095                     $rm -f try.out
13096                     ./try$exe_ext 2>/dev/null
13097                     if $test ! -s try.out -a "X$?" = X42; then
13098                         output=-DTRY_FPRINTF
13099                     fi
13100             fi
13101         ;;
13102     esac
13103 fi
13104 : check for fflush NULL behaviour
13105 case "$fflushNULL" in
13106 '')     set try -DTRY_FFLUSH_NULL $output
13107         if eval $compile; then
13108                 $rm -f try.out
13109                 ./try$exe_ext 2>/dev/null
13110                 code="$?"
13111                 if $test -s try.out -a "X$code" = X42; then
13112                         fflushNULL="`$cat try.out`"
13113                 else
13114                         if $test "X$code" != X42; then
13115                                 $cat >&4 <<EOM
13116 (If this test failed, don't worry, we'll try another method shortly.)
13117 EOM
13118                         fi
13119                 fi
13120         fi
13121         $rm -f core try.core core.try.*
13122         case "$fflushNULL" in
13123         x)      $cat >&4 <<EOM
13124 Your fflush(NULL) works okay for output streams.
13125 Let's see if it clobbers input pipes...
13126 EOM
13127 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13128 # bug that improperly flushes the input end of pipes.  So we avoid the
13129 # autoflush on fork/system/exec support for now. :-(
13130 $cat >tryp.c <<EOCP
13131 #include <stdio.h>
13132 int
13133 main(int argc, char **argv)
13134 {
13135     char buf[1024];
13136     int i;
13137     char *bp = buf;
13138     while (1) {
13139         while ((i = getc(stdin)) != -1
13140                && (*bp++ = i) != '\n'
13141                && bp < &buf[1024])
13142         /* DO NOTHING */ ;
13143         *bp = '\0';
13144         fprintf(stdout, "%s", buf);
13145         fflush(NULL);
13146         if (i == -1)
13147             return 0;
13148         bp = buf;
13149     }
13150 }
13151 EOCP
13152                 fflushNULL="$define"
13153                 set tryp
13154                 if eval $compile; then
13155                     $rm -f tryp.out
13156                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13157                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13158                        $cat >&4 <<EOM
13159 fflush(NULL) seems to behave okay with input streams.
13160 EOM
13161                         fflushNULL="$define"
13162                     else
13163                         $cat >&4 <<EOM
13164 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13165 EOM
13166                         fflushNULL="$undef"
13167                     fi
13168                 fi
13169                 $rm -f core tryp.c tryp.core core.tryp.*
13170                 ;;
13171         '')     $cat >&4 <<EOM
13172 Your fflush(NULL) isn't working (contrary to ANSI C).
13173 EOM
13174                 fflushNULL="$undef"
13175                 ;;
13176         *)      $cat >&4 <<EOM
13177 Cannot figure out whether your fflush(NULL) works or not.
13178 I'm assuming it doesn't (contrary to ANSI C).
13179 EOM
13180                 fflushNULL="$undef"
13181                 ;;
13182         esac
13183         ;;
13184 $define|true|[yY]*)
13185         fflushNULL="$define"
13186         ;;
13187 *)
13188         fflushNULL="$undef"
13189         ;;
13190 esac
13191 : check explicit looping only if NULL did not work, and if the pipe
13192 : bug does not show up on an explicit flush too
13193 case "$fflushNULL" in
13194 "$undef")
13195         $cat >tryp.c <<EOCP
13196 #include <stdio.h>
13197 int
13198 main(int argc, char **argv)
13199 {
13200     char buf[1024];
13201     int i;
13202     char *bp = buf;
13203     while (1) {
13204         while ((i = getc(stdin)) != -1
13205                && (*bp++ = i) != '\n'
13206                && bp < &buf[1024])
13207         /* DO NOTHING */ ;
13208         *bp = '\0';
13209         fprintf(stdout, "%s", buf);
13210         fflush(stdin);
13211         if (i == -1)
13212             return 0;
13213         bp = buf;
13214     }
13215 }
13216 EOCP
13217         set tryp
13218         if eval $compile; then
13219             $rm -f tryp.out
13220             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13221             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13222                $cat >&4 <<EOM
13223 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13224 EOM
13225                 : now check for fflushall behaviour
13226                 case "$fflushall" in
13227                 '')     set try -DTRY_FFLUSH_ALL $output
13228                         if eval $compile; then
13229                                 $cat >&4 <<EOM
13230 (Now testing the other method--but note that this also may fail.)
13231 EOM
13232                                 $rm -f try.out
13233                                 ./try$exe_ext 2>/dev/null
13234                                 if $test -s try.out -a "X$?" = X42; then
13235                                         fflushall="`$cat try.out`"
13236                                 fi
13237                         fi
13238                         $rm -f core try.core core.try.*
13239                         case "$fflushall" in
13240                         x)      $cat >&4 <<EOM
13241 Whew. Flushing explicitly all the stdio streams works.
13242 EOM
13243                                 fflushall="$define"
13244                                 ;;
13245                         '')     $cat >&4 <<EOM
13246 Sigh. Flushing explicitly all the stdio streams doesn't work.
13247 EOM
13248                                 fflushall="$undef"
13249                                 ;;
13250                         *)      $cat >&4 <<EOM
13251 Cannot figure out whether flushing stdio streams explicitly works or not.
13252 I'm assuming it doesn't.
13253 EOM
13254                                 fflushall="$undef"
13255                                 ;;
13256                         esac
13257                         ;;
13258                 "$define"|true|[yY]*)
13259                         fflushall="$define"
13260                         ;;
13261                 *)
13262                         fflushall="$undef"
13263                         ;;
13264                 esac
13265             else
13266                 $cat >&4 <<EOM
13267 All is futile.  Even fflush(stdin) clobbers input pipes!
13268 EOM
13269                 fflushall="$undef"
13270             fi
13271         else
13272             fflushall="$undef"
13273         fi
13274         $rm -f core tryp.c tryp.core core.tryp.*
13275         ;;
13276 *)      fflushall="$undef"
13277         ;;
13278 esac
13279
13280 case "$fflushNULL$fflushall" in
13281 undefundef)
13282         $cat <<EOM
13283 OK, I give up.  I cannot figure out how to flush pending stdio output.
13284 We won't be flushing handles at all before fork/exec/popen.
13285 EOM
13286         ;;
13287 esac
13288 $rm -f try.* try$exe_ext
13289
13290 : Store the full pathname to the ar program for use in the C program
13291 : Respect a hint or command line value for full_ar.
13292 case "$full_ar" in
13293 '') full_ar=$ar ;;
13294 esac
13295
13296 : Store the full pathname to the sed program for use in the C program
13297 full_sed=$sed
13298
13299 : see what type gids are declared as in the kernel
13300 echo " "
13301 echo "Looking for the type for group ids returned by getgid()."
13302 set gid_t gidtype xxx stdio.h sys/types.h
13303 eval $typedef
13304 case "$gidtype" in
13305 xxx)
13306         xxx=`./findhdr sys/user.h`
13307         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13308         case $1 in
13309         unsigned) dflt="$1 $2" ;;
13310         *) dflt="$1" ;;
13311         esac
13312         ;;
13313 *) dflt="$gidtype";;
13314 esac
13315 case "$gidtype" in
13316 gid_t) echo "gid_t found." ;;
13317 *)      rp="What is the type for group ids returned by getgid()?"
13318         . ./myread
13319         gidtype="$ans"
13320         ;;
13321 esac
13322
13323 echo " "
13324 case "$gidtype" in
13325 *_t) zzz="$gidtype"     ;;
13326 *)   zzz="gid"          ;;
13327 esac
13328 echo "Checking the size of $zzz..." >&4 
13329 cat > try.c <<EOCP
13330 #include <sys/types.h>
13331 #include <stdio.h>
13332 int main() {
13333     printf("%d\n", (int)sizeof($gidtype));
13334     exit(0);
13335 }
13336 EOCP
13337 set try
13338 if eval $compile_ok; then
13339         yyy=`./try`
13340         case "$yyy" in
13341         '')     gidsize=4
13342                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13343                 ;;
13344         *)      gidsize=$yyy
13345                 echo "Your $zzz is $gidsize bytes long."
13346                 ;;
13347         esac
13348 else
13349         gidsize=4
13350         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13351 fi
13352
13353
13354 echo " "
13355 case "$gidtype" in
13356 *_t) zzz="$gidtype"     ;;
13357 *)   zzz="gid"          ;;
13358 esac
13359 echo "Checking the sign of $zzz..." >&4 
13360 cat > try.c <<EOCP
13361 #include <sys/types.h>
13362 #include <stdio.h>
13363 int main() {
13364         $gidtype foo = -1;
13365         if (foo < 0)
13366                 printf("-1\n");
13367         else
13368                 printf("1\n");
13369 }
13370 EOCP
13371 set try
13372 if eval $compile; then
13373         yyy=`./try`
13374         case "$yyy" in
13375         '')     gidsign=1
13376                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13377                 ;;
13378         *)      gidsign=$yyy
13379                 case "$gidsign" in
13380                  1) echo "Your $zzz is unsigned." ;;
13381                 -1) echo "Your $zzz is signed."   ;;
13382                 esac
13383                 ;;
13384         esac
13385 else
13386         gidsign=1
13387         echo "(I can't compile the test program--guessing unsigned.)" >&4
13388 fi
13389
13390
13391 echo " "
13392
13393 if $test X"$quadtype" != X; then
13394
13395 echo "Checking how to print 64-bit integers..." >&4
13396
13397 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13398         $cat >try.c <<'EOCP'
13399 #include <sys/types.h>
13400 #include <stdio.h>
13401 int main() {
13402   int q = 12345678901;
13403   printf("%ld\n", q);
13404 }
13405 EOCP
13406         set try
13407         if eval $compile; then
13408                 yyy=`./try$exe_ext`
13409                 case "$yyy" in
13410                 12345678901)
13411                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13412                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13413                         echo "We will use %d."
13414                         ;;
13415                 esac
13416         fi
13417 fi
13418
13419 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13420         $cat >try.c <<'EOCP'
13421 #include <sys/types.h>
13422 #include <stdio.h>
13423 int main() {
13424   long q = 12345678901;
13425   printf("%ld\n", q);
13426 }
13427 EOCP
13428         set try
13429         if eval $compile; then
13430                 yyy=`./try$exe_ext`
13431                 case "$yyy" in
13432                 12345678901)
13433                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13434                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13435                         echo "We will use %ld."
13436                         ;;
13437                 esac
13438         fi
13439 fi
13440
13441 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13442         $cat >try.c <<'EOCP'
13443 #include <sys/types.h>
13444 #include <inttypes.h>
13445 #include <stdio.h>
13446 int main() {
13447   int64_t q = 12345678901;
13448   printf("%" PRId64 "\n", q);
13449 }
13450 EOCP
13451         set try
13452         if eval $compile; then
13453                 yyy=`./try$exe_ext`
13454                 case "$yyy" in
13455                 12345678901)
13456                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13457                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13458                         echo "We will use the C9X style."
13459                         ;;
13460                 esac
13461         fi
13462 fi
13463
13464 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13465         $cat >try.c <<'EOCP'
13466 #include <sys/types.h>
13467 #include <stdio.h>
13468 int main() {
13469   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13470   printf("%lld\n", q);
13471 }
13472 EOCP
13473         set try
13474         if eval $compile; then
13475                 yyy=`./try$exe_ext`
13476                 case "$yyy" in
13477                 12345678901)
13478                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13479                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13480                         echo "We will use the %lld style."
13481                         ;;
13482                 esac
13483         fi
13484 fi
13485
13486 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13487         $cat >try.c <<EOCP
13488 #include <sys/types.h>
13489 #include <stdio.h>
13490 int main() {
13491   $quadtype q = 12345678901;
13492   printf("%Ld\n", q);
13493 }
13494 EOCP
13495         set try
13496         if eval $compile; then
13497                 yyy=`./try$exe_ext`
13498                 case "$yyy" in
13499                 12345678901)
13500                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13501                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13502                         echo "We will use %Ld."
13503                         ;;
13504                 esac
13505         fi
13506 fi
13507
13508 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13509         $cat >try.c <<EOCP
13510 #include <sys/types.h>
13511 #include <stdio.h>
13512 int main() {
13513   $quadtype q = 12345678901;
13514   printf("%qd\n", q);
13515 }
13516 EOCP
13517         set try
13518         if eval $compile; then
13519                 yyy=`./try$exe_ext`
13520                 case "$yyy" in
13521                 12345678901)
13522                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13523                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13524                         echo "We will use %qd."
13525                         ;;
13526                 esac
13527         fi
13528 fi
13529
13530 if $test X"$sPRId64" = X; then
13531         echo "Cannot figure out how to print 64-bit integers." >&4
13532 fi
13533
13534 $rm -f try try.*
13535
13536 fi
13537
13538 case "$sPRId64" in
13539 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13540         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13541         ;;
13542 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13543         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13544         ;;
13545 esac
13546
13547
13548 echo " "
13549 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13550
13551 if $test X"$ivsize" = X8; then
13552         ivdformat="$sPRId64"
13553         uvuformat="$sPRIu64"
13554         uvoformat="$sPRIo64"
13555         uvxformat="$sPRIx64"
13556         uvXUformat="$sPRIXU64"
13557 else
13558         if $test X"$ivsize" = X"$longsize"; then
13559                 ivdformat='"ld"'
13560                 uvuformat='"lu"'
13561                 uvoformat='"lo"'
13562                 uvxformat='"lx"'
13563                 uvXUformat='"lX"'
13564         else
13565                 if $test X"$ivsize" = X"$intsize"; then
13566                         ivdformat='"d"'
13567                         uvuformat='"u"'
13568                         uvoformat='"o"'
13569                         uvxformat='"x"'
13570                         uvXUformat='"X"'
13571                 else
13572                         : far out
13573                         if $test X"$ivsize" = X"$shortsize"; then
13574                                 ivdformat='"hd"'
13575                                 uvuformat='"hu"'
13576                                 uvoformat='"ho"'
13577                                 uvxformat='"hx"'
13578                                 uvXUformat='"hX"'
13579                         fi
13580                 fi
13581         fi
13582 fi
13583
13584 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13585         nveformat="$sPRIeldbl"
13586         nvfformat="$sPRIfldbl"
13587         nvgformat="$sPRIgldbl"
13588         nvEUformat="$sPRIEUldbl"
13589         nvFUformat="$sPRIFUldbl"
13590         nvGUformat="$sPRIGUldbl"
13591 else
13592         nveformat='"e"'
13593         nvfformat='"f"'
13594         nvgformat='"g"'
13595         nvEUformat='"E"'
13596         nvFUformat='"F"'
13597         nvGUformat='"G"'
13598 fi
13599
13600 case "$ivdformat" in
13601 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13602     exit 1
13603     ;;
13604 esac
13605
13606
13607 echo " "
13608 $echo "Checking the format string to be used for gids..." >&4
13609
13610 case "$gidsign" in
13611 -1)     if $test X"$gidsize" = X"$ivsize"; then
13612                 gidformat="$ivdformat"
13613         else
13614                 if $test X"$gidsize" = X"$longsize"; then
13615                         gidformat='"ld"'
13616                 else
13617                         if $test X"$gidsize" = X"$intsize"; then
13618                                 gidformat='"d"'
13619                         else
13620                                 if $test X"$gidsize" = X"$shortsize"; then
13621                                         gidformat='"hd"'
13622                                 fi
13623                         fi
13624                 fi
13625         fi
13626         ;;
13627 *)      if $test X"$gidsize" = X"$uvsize"; then
13628                 gidformat="$uvuformat"
13629         else
13630                 if $test X"$gidsize" = X"$longsize"; then
13631                         gidformat='"lu"'
13632                 else
13633                         if $test X"$gidsize" = X"$intsize"; then
13634                                 gidformat='"u"'
13635                         else
13636                                 if $test X"$gidsize" = X"$shortsize"; then
13637                                         gidformat='"hu"'
13638                                 fi
13639                         fi
13640                 fi
13641         fi
13642         ;;
13643 esac
13644
13645 : see if getgroups exists
13646 set getgroups d_getgrps
13647 eval $inlibc
13648
13649 : see if setgroups exists
13650 set setgroups d_setgrps
13651 eval $inlibc
13652
13653
13654 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13655 echo " "
13656 case "$d_getgrps$d_setgrps" in
13657 *define*)
13658         case "$groupstype" in
13659         '') dflt="$gidtype" ;;
13660         *)  dflt="$groupstype" ;;
13661         esac
13662         $cat <<EOM
13663 What type of pointer is the second argument to getgroups() and setgroups()?
13664 Usually this is the same as group ids, $gidtype, but not always.
13665
13666 EOM
13667         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13668         . ./myread
13669         groupstype="$ans"
13670         ;;
13671 *)  groupstype="$gidtype";;
13672 esac
13673
13674 echo " "
13675 echo "Checking if your $make program sets \$(MAKE)..." >&4
13676 case "$make_set_make" in
13677 '')
13678         $sed 's/^X //' > testmake.mak << 'EOF'
13679 Xall:
13680 X       @echo 'maketemp="$(MAKE)"'
13681 EOF
13682         case "`$make -f testmake.mak 2>/dev/null`" in
13683         *maketemp=*) make_set_make='#' ;;
13684         *)      make_set_make="MAKE=$make" ;;
13685         esac
13686         $rm -f testmake.mak
13687         ;;
13688 esac
13689 case "$make_set_make" in
13690 '#') echo "Yup, it does.";;
13691 *) echo "Nope, it doesn't.";;
13692 esac
13693
13694 : see what type is used for mode_t
13695 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13696 set mode_t modetype int stdio.h sys/types.h
13697 eval $typedef_ask
13698
13699 : see if stdarg is available
13700 echo " "
13701 if $test `./findhdr stdarg.h`; then
13702         echo "<stdarg.h> found." >&4
13703         valstd="$define"
13704 else
13705         echo "<stdarg.h> NOT found." >&4
13706         valstd="$undef"
13707 fi
13708
13709 : see if varags is available
13710 echo " "
13711 if $test `./findhdr varargs.h`; then
13712         echo "<varargs.h> found." >&4
13713 else
13714         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13715 fi
13716
13717 : set up the varargs testing programs
13718 $cat > varargs.c <<EOP
13719 #ifdef I_STDARG
13720 #include <stdarg.h>
13721 #endif
13722 #ifdef I_VARARGS
13723 #include <varargs.h>
13724 #endif
13725
13726 #ifdef I_STDARG
13727 int f(char *p, ...)
13728 #else
13729 int f(va_alist)
13730 va_dcl
13731 #endif
13732 {
13733         va_list ap;
13734 #ifndef I_STDARG
13735         char *p;
13736 #endif
13737 #ifdef I_STDARG
13738         va_start(ap,p);
13739 #else
13740         va_start(ap);
13741         p = va_arg(ap, char *);
13742 #endif
13743         va_end(ap);
13744 }
13745 EOP
13746 $cat > varargs <<EOP
13747 $startsh
13748 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13749         echo "true"
13750 else
13751         echo "false"
13752 fi
13753 $rm -f varargs$_o
13754 EOP
13755 chmod +x varargs
13756
13757 : now check which varargs header should be included
13758 echo " "
13759 i_varhdr=''
13760 case "$valstd" in
13761 "$define")
13762         if `./varargs I_STDARG`; then
13763                 val='stdarg.h'
13764         elif `./varargs I_VARARGS`; then
13765                 val='varargs.h'
13766         fi
13767         ;;
13768 *)
13769         if `./varargs I_VARARGS`; then
13770                 val='varargs.h'
13771         fi
13772         ;;
13773 esac
13774 case "$val" in
13775 '')
13776 echo "I could not find the definition for va_dcl... You have problems..." >&4
13777         val="$undef"; set i_stdarg; eval $setvar
13778         val="$undef"; set i_varargs; eval $setvar
13779         ;;
13780 *) 
13781         set i_varhdr
13782         eval $setvar
13783         case "$i_varhdr" in
13784         stdarg.h)
13785                 val="$define"; set i_stdarg; eval $setvar
13786                 val="$undef"; set i_varargs; eval $setvar
13787                 ;;
13788         varargs.h)
13789                 val="$undef"; set i_stdarg; eval $setvar
13790                 val="$define"; set i_varargs; eval $setvar
13791                 ;;
13792         esac
13793         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13794 esac
13795 $rm -f varargs*
13796
13797 : see if we need va_copy
13798 echo " "
13799 case "$i_stdarg" in
13800 "$define")
13801         $cat >try.c <<EOCP
13802 #include <stdarg.h>
13803 #include <stdio.h>
13804 #$i_stdlib I_STDLIB
13805 #ifdef I_STDLIB
13806 #include <stdlib.h>
13807 #endif
13808 #include <signal.h>
13809
13810 int
13811 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13812 {
13813   return vfprintf(f, fmt, *valp);
13814 }
13815  
13816 int    
13817 myvfprintf(FILE *f, const  char *fmt, va_list val)
13818 {
13819   return ivfprintf(f, fmt, &val);
13820 }
13821       
13822 int
13823 myprintf(char *fmt, ...) 
13824 {
13825   va_list val;
13826   va_start(val, fmt);
13827   return myvfprintf(stdout, fmt, val); 
13828 }         
13829
13830 int
13831 main(int ac, char **av)
13832 {
13833   signal(SIGSEGV, exit);
13834
13835   myprintf("%s%cs all right, then\n", "that", '\'');                            
13836   exit(0);      
13837 }
13838 EOCP
13839         set try
13840         if eval $compile && ./try 2>&1 >/dev/null; then
13841                 case "`./try`" in
13842                 "that's all right, then")
13843                         okay=yes
13844                         ;;
13845                 esac
13846         fi
13847         case "$okay" in
13848         yes)    echo "It seems that you don't need va_copy()." >&4
13849                 need_va_copy="$undef"
13850                 ;;
13851         *)      echo "It seems that va_copy() or similar will be needed." >&4
13852                 need_va_copy="$define"
13853                 ;;
13854         esac
13855         $rm -f try.* core core.* *.core *.core.*
13856         ;;
13857 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13858         ;;
13859 esac
13860
13861 : define a fucntion to check prototypes
13862 $cat > protochk <<EOSH
13863 $startsh
13864 cc="$cc"
13865 optimize="$optimize"
13866 ccflags="$ccflags"
13867 prototype="$prototype"
13868 define="$define"
13869 rm=$rm
13870 EOSH
13871
13872 $cat >> protochk <<'EOSH'
13873
13874 $rm -f try.c
13875 foo="$1"
13876 shift
13877 while test $# -ge 2; do
13878         case "$1" in
13879                 $define) echo "#include <$2>" >> try.c ;;
13880                 literal) echo "$2" >> try.c ;;
13881         esac
13882     shift 2
13883 done
13884 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13885 cat >> try.c <<'EOCP'
13886 #ifdef CAN_PROTOTYPE
13887 #define _(args) args
13888 #else
13889 #define _(args) ()
13890 #endif
13891 EOCP
13892 echo "$foo" >> try.c
13893 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13894 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13895 status=$?
13896 $rm -f try.[co]
13897 exit $status
13898 EOSH
13899 chmod +x protochk
13900 $eunicefix protochk
13901
13902 : see what type is used for size_t
13903 rp="What is the type used for the length parameter for string functions?"
13904 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13905 eval $typedef_ask
13906
13907 : check for type of arguments to gethostbyaddr. 
13908 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13909         case "$d_gethbyaddr" in
13910         $define)
13911                 $cat <<EOM
13912
13913 Checking to see what type of arguments are accepted by gethostbyaddr().
13914 EOM
13915                 hdrs="$define sys/types.h
13916                         $d_socket sys/socket.h 
13917                         $i_niin netinet/in.h 
13918                         $i_netdb netdb.h
13919                         $i_unistd unistd.h"
13920                 : The first arg can 'char *' or 'void *'
13921                 : The second arg is some of integral type
13922                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13923                         for yyy in size_t long int; do
13924                                 case "$netdb_host_type" in
13925                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13926                                         if ./protochk "$try" $hdrs; then
13927                                                 echo "Your system accepts $xxx for the first arg."
13928                                                 echo "...and $yyy for the second arg."
13929                                                 netdb_host_type="$xxx"
13930                                                 netdb_hlen_type="$yyy"
13931                                         fi
13932                                         ;;
13933                                 esac
13934                         done
13935                 done
13936                 : In case none of those worked, prompt the user.
13937                 case "$netdb_host_type" in
13938                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13939                         dflt='char *'
13940                         . ./myread
13941                         netdb_host_type=$ans
13942                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13943                         dflt="$sizetype"
13944                         . ./myread
13945                         netdb_hlen_type=$ans
13946                         ;;
13947                 esac
13948                 ;;
13949         *)      : no gethostbyaddr, so pick harmless defaults
13950                 netdb_host_type='char *'
13951                 netdb_hlen_type="$sizetype"
13952                 ;;
13953         esac
13954         # Remove the "const" if needed. -- but then we'll have a 
13955         # prototype clash!
13956         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13957 fi
13958
13959 : check for type of argument to gethostbyname. 
13960 if test "X$netdb_name_type" = X ; then
13961         case "$d_gethbyname" in
13962         $define)
13963                 $cat <<EOM
13964
13965 Checking to see what type of argument is accepted by gethostbyname().
13966 EOM
13967                 hdrs="$define sys/types.h
13968                         $d_socket sys/socket.h 
13969                         $i_niin netinet/in.h 
13970                         $i_netdb netdb.h
13971                         $i_unistd unistd.h"
13972                 for xxx in "const char *" "char *"; do
13973                         case "$netdb_name_type" in
13974                         '')     try="extern struct hostent *gethostbyname($xxx);"
13975                                 if ./protochk "$try" $hdrs; then
13976                                         echo "Your system accepts $xxx."
13977                                         netdb_name_type="$xxx"
13978                                 fi
13979                                 ;;
13980                         esac
13981                 done
13982                 : In case none of those worked, prompt the user.
13983                 case "$netdb_name_type" in
13984                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13985                         dflt='char *'
13986                         . ./myread
13987                         netdb_name_type=$ans
13988                         ;;
13989                 esac
13990                 ;;
13991         *)      : no gethostbyname, so pick harmless default
13992                 netdb_name_type='char *'
13993                 ;;
13994         esac
13995 fi
13996
13997 : check for type of 1st argument to getnetbyaddr. 
13998 if test "X$netdb_net_type" = X ; then
13999         case "$d_getnbyaddr" in
14000         $define)
14001                 $cat <<EOM
14002
14003 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14004 EOM
14005                 hdrs="$define sys/types.h
14006                         $d_socket sys/socket.h 
14007                         $i_niin netinet/in.h 
14008                         $i_netdb netdb.h
14009                         $i_unistd unistd.h"
14010                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14011                         case "$netdb_net_type" in
14012                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14013                                 if ./protochk "$try" $hdrs; then
14014                                         echo "Your system accepts $xxx."
14015                                         netdb_net_type="$xxx"
14016                                 fi
14017                                 ;;
14018                         esac
14019                 done
14020                 : In case none of those worked, prompt the user.
14021                 case "$netdb_net_type" in
14022                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14023                         dflt='long'
14024                         . ./myread
14025                         netdb_net_type=$ans
14026                         ;;
14027                 esac
14028                 ;;
14029         *)      : no getnetbyaddr, so pick harmless default
14030                 netdb_net_type='long'
14031                 ;;
14032         esac
14033 fi
14034 : locate the preferred pager for this system
14035 case "$pager" in
14036 '')
14037         dflt=''
14038         case "$pg" in
14039         /*) dflt=$pg;;
14040         [a-zA-Z]:/*) dflt=$pg;;
14041         esac
14042         case "$more" in
14043         /*) dflt=$more;;
14044         [a-zA-Z]:/*) dflt=$more;;
14045         esac
14046         case "$less" in
14047         /*) dflt=$less;;
14048         [a-zA-Z]:/*) dflt=$less;;
14049         esac
14050         case "$dflt" in
14051         '') dflt=/usr/ucb/more;;
14052         esac
14053         ;;
14054 *) dflt="$pager";;
14055 esac
14056 echo " "
14057 fn=f/
14058 rp='What pager is used on your system?'
14059 . ./getfile
14060 pager="$ans"
14061
14062 : see what type pids are declared as in the kernel
14063 rp="What is the type of process ids on this system?"
14064 set pid_t pidtype int stdio.h sys/types.h
14065 eval $typedef_ask
14066
14067 : Find earliest binary compatible site_perl subdirectory perl can use.
14068 case "$bincompat5005" in
14069 "$define") xs_apiversion='5.005' ;;
14070 *) xs_apiversion=$version ;;   # The current site_perl version.
14071 esac
14072 : Find earliest pure perl site_perl subdirectory perl can use.
14073 : The versioned directories started at 5.005.
14074 pm_apiversion='5.005'
14075
14076 : check for length of pointer
14077 echo " "
14078 case "$ptrsize" in
14079 '')
14080         echo "Checking to see how big your pointers are..." >&4
14081         if test "$voidflags" -gt 7; then
14082                 echo '#define VOID_PTR char *' > try.c
14083         else
14084                 echo '#define VOID_PTR void *' > try.c
14085         fi
14086         $cat >>try.c <<'EOCP'
14087 #include <stdio.h>
14088 int main()
14089 {
14090     printf("%d\n", (int)sizeof(VOID_PTR));
14091     exit(0);
14092 }
14093 EOCP
14094         set try
14095         if eval $compile_ok; then
14096                 ptrsize=`./try`
14097                 echo "Your pointers are $ptrsize bytes long."
14098         else
14099                 dflt='4'
14100                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14101                 rp="What is the size of a pointer (in bytes)?"
14102                 . ./myread
14103                 ptrsize="$ans"
14104         fi
14105         ;;
14106 esac
14107 $rm -f try.c try
14108
14109 : see if ar generates random libraries by itself
14110 echo " "
14111 echo "Checking how to generate random libraries on your machine..." >&4
14112 echo 'int bar1() { return bar2(); }' > bar1.c
14113 echo 'int bar2() { return 2; }' > bar2.c
14114 $cat > foo.c <<'EOP'
14115 int main() { printf("%d\n", bar1()); exit(0); }
14116 EOP
14117 $cc $ccflags -c bar1.c >/dev/null 2>&1
14118 $cc $ccflags -c bar2.c >/dev/null 2>&1
14119 $cc $ccflags -c foo.c >/dev/null 2>&1
14120 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14121 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14122         ./foobar >/dev/null 2>&1; then
14123         echo "$ar appears to generate random libraries itself."
14124         orderlib=false
14125         ranlib=":"
14126 elif $ar ts bar$_a >/dev/null 2>&1 &&
14127         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14128         ./foobar >/dev/null 2>&1; then
14129                 echo "a table of contents needs to be added with '$ar ts'."
14130                 orderlib=false
14131                 ranlib="$ar ts"
14132 else
14133         case "$ranlib" in
14134         :) ranlib='';;
14135         '')
14136                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14137                 $test -f $ranlib || ranlib=''
14138                 ;;
14139         esac
14140         if $test -n "$ranlib"; then
14141                 echo "your system has '$ranlib'; we'll use that."
14142                 orderlib=false
14143         else
14144                 echo "your system doesn't seem to support random libraries"
14145                 echo "so we'll use lorder and tsort to order the libraries."
14146                 orderlib=true
14147                 ranlib=":"
14148         fi
14149 fi
14150 $rm -f foo* bar* 
14151
14152 : check for type of arguments to select. 
14153 case "$selecttype" in
14154 '') case "$d_select" in
14155         $define)
14156                 echo " "
14157                 $cat <<EOM
14158 Checking to see what type of arguments are accepted by select().
14159 EOM
14160                 hdrs="$define sys/types.h
14161                         $i_systime sys/time.h 
14162                         $i_sysselct sys/select.h
14163                         $d_socket sys/socket.h"
14164                 : The first arg can be int, unsigned, or size_t
14165                 : The last arg may or may not be 'const'
14166                 val=''
14167                 : void pointer has been seen but using that
14168                 : breaks the selectminbits test
14169                 for xxx in 'fd_set *' 'int *'; do
14170                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14171                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14172                                         case "$val" in
14173                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14174                                                 if ./protochk "$try" $hdrs; then
14175                                                         echo "Your system accepts $xxx."
14176                                                         val="$xxx"
14177                                                 fi
14178                                                 ;;
14179                                         esac
14180                                 done
14181                         done
14182                 done
14183                 case "$val" in
14184                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14185                         case "$d_fd_set" in
14186                                 $define) dflt="fd_set *" ;;
14187                                 *)              dflt="int *" ;;
14188                         esac
14189                         . ./myread
14190                         val=$ans
14191                         ;;
14192                 esac
14193                 selecttype="$val"
14194                 ;;
14195         *)      : no select, so pick a harmless default
14196                 selecttype='int *'
14197                 ;;
14198         esac
14199         ;;
14200 esac
14201
14202 : check for the select 'width'
14203 case "$selectminbits" in
14204 '') case "$d_select" in
14205         $define)
14206                 $cat <<EOM
14207
14208 Checking to see on how many bits at a time your select() operates...
14209 EOM
14210                 $cat >try.c <<EOCP
14211 #include <sys/types.h>
14212 #$i_time I_TIME
14213 #$i_systime I_SYS_TIME
14214 #$i_systimek I_SYS_TIME_KERNEL
14215 #ifdef I_TIME
14216 #   include <time.h>
14217 #endif
14218 #ifdef I_SYS_TIME
14219 #   ifdef I_SYS_TIME_KERNEL
14220 #       define KERNEL
14221 #   endif
14222 #   include <sys/time.h>
14223 #   ifdef I_SYS_TIME_KERNEL
14224 #       undef KERNEL
14225 #   endif
14226 #endif
14227 #$i_sysselct I_SYS_SELECT
14228 #ifdef I_SYS_SELECT
14229 #include <sys/select.h>
14230 #endif
14231 #$d_socket HAS_SOCKET
14232 #ifdef HAS_SOCKET
14233 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14234 #endif
14235 #include <stdio.h>
14236 $selecttype b;
14237 #define S sizeof(*(b))
14238 #define MINBITS 64
14239 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14240 #define NBITS  (NBYTES * 8)
14241 int main() {
14242     char s[NBYTES];
14243     struct timeval t;
14244     int i;
14245     FILE* fp;
14246     int fd;
14247
14248     fclose(stdin);
14249     fp = fopen("try.c", "r");
14250     if (fp == 0)
14251       exit(1);
14252     fd = fileno(fp);
14253     if (fd < 0)
14254       exit(2);
14255     b = ($selecttype)s;
14256     for (i = 0; i < NBITS; i++)
14257         FD_SET(i, b);
14258     t.tv_sec  = 0;
14259     t.tv_usec = 0;
14260     select(fd + 1, b, 0, 0, &t);
14261     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14262     printf("%d\n", i + 1);
14263     return 0;
14264 }
14265 EOCP
14266                 set try
14267                 if eval $compile_ok; then
14268                         selectminbits=`./try`
14269                         case "$selectminbits" in
14270                         '')     cat >&4 <<EOM
14271 Cannot figure out on how many bits at a time your select() operates.
14272 I'll play safe and guess it is 32 bits.
14273 EOM
14274                                 selectminbits=32
14275                                 bits="32 bits"
14276                                 ;;
14277                         1)      bits="1 bit" ;;
14278                         *)      bits="$selectminbits bits" ;;
14279                         esac
14280                         echo "Your select() operates on $bits at a time." >&4
14281                 else
14282                         rp='What is the minimum number of bits your select() operates on?'
14283                         case "$byteorder" in
14284                         1234|12345678)  dflt=32 ;;
14285                         *)              dflt=1  ;;
14286                         esac
14287                         . ./myread
14288                         val=$ans
14289                         selectminbits="$val"
14290                 fi
14291                 $rm -f try.* try
14292                 ;;
14293         *)      : no select, so pick a harmless default
14294                 selectminbits='32'
14295                 ;;
14296         esac
14297         ;;
14298 esac
14299
14300 : Trace out the files included by signal.h, then look for SIGxxx names.
14301 : Remove SIGARRAYSIZE used by HPUX.
14302 : Remove SIGSTKSIZE used by Linux.
14303 : Remove SIGSTKSZ used by Posix.
14304 : Remove SIGTYP void lines used by OS2.
14305 : Some cpps, like os390, dont give the file name anywhere
14306 if [ "X$fieldn" = X ]; then
14307         : Just make some guesses.  We check them later.
14308         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14309 else
14310         xxx=`echo '#include <signal.h>' |
14311         $cppstdin $cppminus $cppflags 2>/dev/null |
14312         $grep '^[       ]*#.*include' | 
14313         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14314 fi
14315 : Check this list of files to be sure we have parsed the cpp output ok.
14316 : This will also avoid potentially non-existent files, such 
14317 : as ../foo/bar.h
14318 xxxfiles=''
14319 for xx in $xxx /dev/null ; do
14320         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14321 done
14322 : If we have found no files, at least try signal.h
14323 case "$xxxfiles" in
14324 '')     xxxfiles=`./findhdr signal.h` ;;
14325 esac
14326 xxx=`awk '
14327 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14328         print substr($2, 4, 20)
14329 }
14330 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14331         print substr($3, 4, 20)
14332 }' $xxxfiles`
14333 : Append some common names just in case the awk scan failed.
14334 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14335 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14336 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14337 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14338 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14339
14340 : generate a few handy files for later
14341 $cat > signal.c <<'EOCP'
14342 #include <sys/types.h>
14343 #include <signal.h>
14344 #include <stdio.h>
14345 int main() {
14346
14347 /* Strange style to avoid deeply-nested #if/#else/#endif */
14348 #ifndef NSIG
14349 #  ifdef _NSIG
14350 #    define NSIG (_NSIG)
14351 #  endif
14352 #endif
14353
14354 #ifndef NSIG
14355 #  ifdef SIGMAX
14356 #    define NSIG (SIGMAX+1)
14357 #  endif
14358 #endif
14359
14360 #ifndef NSIG
14361 #  ifdef SIG_MAX
14362 #    define NSIG (SIG_MAX+1)
14363 #  endif
14364 #endif
14365
14366 #ifndef NSIG
14367 #  ifdef MAXSIG
14368 #    define NSIG (MAXSIG+1)
14369 #  endif
14370 #endif
14371
14372 #ifndef NSIG
14373 #  ifdef MAX_SIG
14374 #    define NSIG (MAX_SIG+1)
14375 #  endif
14376 #endif
14377
14378 #ifndef NSIG
14379 #  ifdef SIGARRAYSIZE
14380 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14381 #  endif
14382 #endif
14383
14384 #ifndef NSIG
14385 #  ifdef _sys_nsig
14386 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14387 #  endif
14388 #endif
14389
14390 /* Default to some arbitrary number that's big enough to get most
14391    of the common signals.
14392 */
14393 #ifndef NSIG
14394 #    define NSIG 50
14395 #endif
14396
14397 printf("NSIG %d\n", NSIG);
14398
14399 #ifndef JUST_NSIG
14400
14401 EOCP
14402
14403 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14404 {
14405         printf "#ifdef SIG"; printf $1; printf "\n"
14406         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14407         printf $1; printf ");\n"
14408         printf "#endif\n"
14409 }
14410 END {
14411         printf "#endif /* JUST_NSIG */\n";
14412         printf "exit(0);\n}\n";
14413 }
14414 ' >>signal.c
14415 $cat >signal.awk <<'EOP'
14416 BEGIN { ndups = 0 }
14417 $1 ~ /^NSIG$/ { nsig = $2 }
14418 ($1 !~ /^NSIG$/) && (NF == 2) {
14419     if ($2 > maxsig) { maxsig = $2 }
14420     if (sig_name[$2]) {
14421         dup_name[ndups] = $1
14422         dup_num[ndups] = $2
14423         ndups++ 
14424     }
14425     else {
14426         sig_name[$2] = $1
14427         sig_num[$2] = $2
14428     }
14429 }
14430 END { 
14431     if (nsig == 0) {
14432         nsig = maxsig + 1
14433     }
14434     printf("NSIG %d\n", nsig);
14435     for (n = 1; n < nsig; n++) {
14436         if (sig_name[n]) {
14437             printf("%s %d\n", sig_name[n], sig_num[n])
14438         }
14439         else {
14440             printf("NUM%d %d\n", n, n) 
14441         }
14442     }
14443     for (n = 0; n < ndups; n++) {
14444         printf("%s %d\n", dup_name[n], dup_num[n])
14445     }
14446 }
14447 EOP
14448 $cat >signal_cmd <<EOS
14449 $startsh
14450 if $test -s signal.lst; then
14451     echo "Using your existing signal.lst file"
14452         exit 0
14453 fi
14454 xxx="$xxx"
14455 EOS
14456 $cat >>signal_cmd <<'EOS'
14457
14458 set signal
14459 if eval $compile_ok; then
14460         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14461 else
14462         echo "(I can't seem be able to compile the whole test program)" >&4
14463         echo "(I'll try it in little pieces.)" >&4
14464         set signal -DJUST_NSIG
14465         if eval $compile_ok; then
14466                 ./signal$_exe > signal.nsg
14467                 $cat signal.nsg
14468         else
14469                 echo "I can't seem to figure out how many signals you have." >&4
14470                 echo "Guessing 50." >&4
14471                 echo 'NSIG 50' > signal.nsg
14472         fi
14473         : Now look at all the signal names, one at a time.
14474         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14475                 $cat > signal.c <<EOCP
14476 #include <sys/types.h>
14477 #include <signal.h>
14478 #include <stdio.h>
14479 int main() {
14480 printf("$xx %d\n", SIG${xx});
14481 return 0;
14482 }
14483 EOCP
14484                 set signal
14485                 if eval $compile; then
14486                         echo "SIG${xx} found."
14487                         ./signal$_exe  >> signal.ls1
14488                 else
14489                         echo "SIG${xx} NOT found."
14490                 fi
14491         done
14492         if $test -s signal.ls1; then
14493                 $cat signal.nsg signal.ls1 |
14494                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14495         fi
14496
14497 fi
14498 if $test -s signal.lst; then
14499         :
14500 else
14501         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14502         echo 'kill -l' >signal
14503         set X `csh -f <signal`
14504         $rm -f signal
14505         shift
14506         case $# in
14507         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14508         esac
14509         echo $@ | $tr ' ' $trnl | \
14510             $awk '{ printf "%s %d\n", $1, ++s; }
14511                   END { printf "NSIG %d\n", ++s }' >signal.lst
14512 fi
14513 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14514 EOS
14515 chmod a+x signal_cmd
14516 $eunicefix signal_cmd
14517
14518 : generate list of signal names
14519 echo " "
14520 case "$sig_name_init" in
14521 '') doinit=yes ;;
14522 *)  case "$sig_num_init" in
14523     ''|*,*) doinit=yes ;;
14524     esac ;;
14525 esac
14526 case "$doinit" in
14527 yes)
14528         echo "Generating a list of signal names and numbers..." >&4
14529         . ./signal_cmd
14530         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14531         sig_name=`$awk 'BEGIN { printf "ZERO " }
14532                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14533         sig_num=`$awk  'BEGIN { printf "0 " }
14534                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14535         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14536                              !/^NSIG/   { printf "\"%s\", ", $1 }
14537                              END        { printf "0\n" }' signal.lst`
14538         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14539                              !/^NSIG/   { printf "%d, ", $2}
14540                              END        { printf "0\n"}' signal.lst`
14541         ;;
14542 esac
14543 echo "The following $sig_count signals are available:"
14544 echo " "
14545 echo $sig_name | $awk \
14546 'BEGIN { linelen = 0 }
14547 {
14548         for (i = 1; i <= NF; i++) {
14549                 name = "SIG" $i " "
14550                 linelen = linelen + length(name)
14551                 if (linelen > 70) {
14552                         printf "\n"
14553                         linelen = length(name)
14554                 }
14555                 printf "%s", name
14556         }
14557         printf "\n"
14558 }'
14559 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14560
14561 echo " "
14562 case "$sizetype" in
14563 *_t) zzz="$sizetype"    ;;
14564 *)   zzz="filesize"     ;;
14565 esac
14566 echo "Checking the size of $zzz..." >&4 
14567 cat > try.c <<EOCP
14568 #include <sys/types.h>
14569 #include <stdio.h>
14570 int main() {
14571     printf("%d\n", (int)sizeof($sizetype));
14572     exit(0);
14573 }
14574 EOCP
14575 set try
14576 if eval $compile_ok; then
14577         yyy=`./try`
14578         case "$yyy" in
14579         '')     sizesize=4
14580                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14581                 ;;
14582         *)      sizesize=$yyy
14583                 echo "Your $zzz size is $sizesize bytes."
14584                 ;;
14585         esac
14586 else
14587         sizesize=4
14588         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14589 fi
14590
14591
14592 : check for socklen_t
14593 echo " "
14594 echo "Checking to see if you have socklen_t..." >&4
14595 $cat >try.c <<EOCP
14596 #include <sys/types.h>
14597 #$d_socket HAS_SOCKET
14598 #ifdef HAS_SOCKET
14599 #include <sys/socket.h>
14600 #endif
14601 int main() { socklen_t x = 16; }
14602 EOCP
14603 set try
14604 if eval $compile; then
14605         val="$define"
14606         echo "You have socklen_t."
14607 else
14608         val="$undef"
14609         echo "You do not have socklen_t."
14610         case "$sizetype" in
14611         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14612         esac
14613 fi
14614 $rm -f try try.*
14615 set d_socklen_t
14616 eval $setvar
14617
14618 : see if this is a socks.h system
14619 set socks.h i_socks
14620 eval $inhdr
14621
14622 : check for type of the size argument to socket calls
14623 case "$d_socket" in
14624 "$define")
14625         $cat <<EOM
14626
14627 Checking to see what type is the last argument of accept().
14628 EOM
14629         yyy=''
14630         case "$d_socklen_t" in
14631         "$define") yyy="$yyy socklen_t"
14632         esac
14633         yyy="$yyy $sizetype int long unsigned"
14634         for xxx in $yyy; do
14635                 case "$socksizetype" in
14636                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14637                         case "$usesocks" in
14638                         "$define")
14639                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14640                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14641                                         socksizetype="$xxx"
14642                                 fi
14643                                 ;;
14644                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14645                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14646                                         socksizetype="$xxx"
14647                                 fi
14648                                 ;;
14649                         esac
14650                         ;;
14651                 esac
14652         done
14653 : In case none of those worked, prompt the user.
14654         case "$socksizetype" in
14655         '')     rp='What is the type for socket address structure sizes?'
14656                 dflt='int'
14657                 . ./myread
14658                 socksizetype=$ans
14659                 ;;
14660         esac
14661         ;;
14662 *)      : no sockets, so pick relatively harmless default
14663         socksizetype='int'
14664         ;;
14665 esac
14666
14667 : see what type is used for signed size_t
14668 set ssize_t ssizetype int stdio.h sys/types.h
14669 eval $typedef
14670 dflt="$ssizetype"
14671 $cat > ssize.c <<EOM
14672 #include <stdio.h>
14673 #include <sys/types.h>
14674 #define Size_t $sizetype
14675 #define SSize_t $dflt
14676 int main()
14677 {
14678         if (sizeof(Size_t) == sizeof(SSize_t))
14679                 printf("$dflt\n");
14680         else if (sizeof(Size_t) == sizeof(int))
14681                 printf("int\n");
14682         else 
14683                 printf("long\n");
14684         exit(0);
14685 }
14686 EOM
14687 echo " "
14688 set ssize
14689 if eval $compile_ok && ./ssize > /dev/null; then
14690         ssizetype=`./ssize`
14691         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14692 else
14693         $cat >&4 <<EOM
14694 Help! I can't compile and run the ssize_t test program: please enlighten me!
14695 (This is probably a misconfiguration in your system or libraries, and
14696 you really ought to fix it.  Still, I'll try anyway.)
14697
14698 I need a type that is the same size as $sizetype, but is guaranteed to
14699 be signed.  Common values are ssize_t, int and long.
14700
14701 EOM
14702         rp="What signed type is the same size as $sizetype?"
14703         . ./myread
14704         ssizetype="$ans"
14705 fi
14706 $rm -f ssize ssize.*
14707
14708 : see what type of char stdio uses.
14709 echo " "
14710 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14711 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14712         echo "Your stdio uses unsigned chars." >&4
14713         stdchar="unsigned char"
14714 else
14715         echo "Your stdio uses signed chars." >&4
14716         stdchar="char"
14717 fi
14718 $rm -f stdioh
14719
14720
14721
14722 : see if time exists
14723 echo " "
14724 if test "X$d_time" = X -o X"$timetype" = X; then
14725     if set time val -f d_time; eval $csym; $val; then
14726                 echo 'time() found.' >&4
14727                 val="$define"
14728                 rp="What is the type returned by time() on this system?"
14729                 set time_t timetype long stdio.h sys/types.h
14730                 eval $typedef_ask
14731     else
14732                 echo 'time() not found, hope that will do.' >&4
14733                 val="$undef"
14734                 timetype='int';
14735     fi
14736     set d_time
14737     eval $setvar
14738 fi
14739
14740 : see what type uids are declared as in the kernel
14741 echo " "
14742 echo "Looking for the type for user ids returned by getuid()."
14743 set uid_t uidtype xxx stdio.h sys/types.h
14744 eval $typedef
14745 case "$uidtype" in
14746 xxx)
14747         xxx=`./findhdr sys/user.h`
14748         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14749         case $1 in
14750         unsigned) dflt="$1 $2" ;;
14751         *) dflt="$1" ;;
14752         esac
14753         ;;
14754 *) dflt="$uidtype";;
14755 esac
14756 case "$uidtype" in
14757 uid_t)  echo "uid_t found." ;;
14758 *)      rp="What is the type for user ids returned by getuid()?"
14759         . ./myread
14760         uidtype="$ans"
14761         ;;
14762 esac
14763
14764 echo " "
14765 case "$uidtype" in
14766 *_t) zzz="$uidtype"     ;;
14767 *)   zzz="uid"          ;;
14768 esac
14769 echo "Checking the size of $zzz..." >&4 
14770 cat > try.c <<EOCP
14771 #include <sys/types.h>
14772 #include <stdio.h>
14773 int main() {
14774     printf("%d\n", (int)sizeof($uidtype));
14775     exit(0);
14776 }
14777 EOCP
14778 set try
14779 if eval $compile_ok; then
14780         yyy=`./try`
14781         case "$yyy" in
14782         '')     uidsize=4
14783                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14784                 ;;
14785         *)      uidsize=$yyy
14786                 echo "Your $zzz is $uidsize bytes long."
14787                 ;;
14788         esac
14789 else
14790         uidsize=4
14791         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14792 fi
14793
14794 echo " "
14795 case "$uidtype" in
14796 *_t) zzz="$uidtype"     ;;
14797 *)   zzz="uid"          ;;
14798 esac
14799 echo "Checking the sign of $zzz..." >&4
14800 cat > try.c <<EOCP
14801 #include <sys/types.h>
14802 #include <stdio.h>
14803 int main() {
14804         $uidtype foo = -1;
14805         if (foo < 0)
14806                 printf("-1\n");
14807         else
14808                 printf("1\n");
14809 }
14810 EOCP
14811 set try
14812 if eval $compile; then
14813         yyy=`./try`
14814         case "$yyy" in
14815         '')     uidsign=1
14816                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14817                 ;;
14818         *)      uidsign=$yyy
14819                 case "$uidsign" in
14820                  1) echo "Your $zzz is unsigned." ;;
14821                 -1) echo "Your $zzz is signed."   ;;
14822                 esac
14823                 ;;
14824         esac
14825 else
14826         uidsign=1
14827         echo "(I can't compile the test program--guessing unsigned.)" >&4
14828 fi
14829
14830
14831
14832 echo " "
14833 $echo "Checking the format string to be used for uids..." >&4
14834
14835 case "$uidsign" in
14836 -1)     if $test X"$uidsize" = X"$ivsize"; then
14837                 uidformat="$ivdformat"
14838         else
14839                 if $test X"$uidsize" = X"$longsize"; then
14840                         uidformat='"ld"'
14841                 else
14842                         if $test X"$uidsize" = X"$intsize"; then
14843                                 uidformat='"d"'
14844                         else
14845                                 if $test X"$uidsize" = X"$shortsize"; then
14846                                         uidformat='"hd"'
14847                                 fi
14848                         fi
14849                 fi
14850         fi
14851         ;;
14852 *)      if $test X"$uidsize" = X"$uvsize"; then
14853                 uidformat="$uvuformat"
14854         else
14855                 if $test X"$uidsize" = X"$longsize"; then
14856                         uidformat='"lu"'
14857                 else
14858                         if $test X"$uidsize" = X"$intsize"; then
14859                                 uidformat='"u"'
14860                         else
14861                                 if $test X"$uidsize" = X"$shortsize"; then
14862                                         uidformat='"hu"'
14863                                 fi
14864                         fi
14865                 fi
14866         fi
14867         ;;
14868 esac
14869
14870 : see if dbm.h is available
14871 : see if dbmclose exists
14872 set dbmclose d_dbmclose
14873 eval $inlibc
14874
14875 case "$d_dbmclose" in
14876 $define)
14877         set dbm.h i_dbm
14878         eval $inhdr
14879         case "$i_dbm" in
14880         $define)
14881                 val="$undef"
14882                 set i_rpcsvcdbm
14883                 eval $setvar
14884                 ;;
14885         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14886                 eval $inhdr
14887                 ;;
14888         esac
14889         ;;
14890 *)      echo "We won't be including <dbm.h>"
14891         val="$undef"
14892         set i_dbm
14893         eval $setvar
14894         val="$undef"
14895         set i_rpcsvcdbm
14896         eval $setvar
14897         ;;
14898 esac
14899
14900 : see if this is a sys/file.h system
14901 val=''
14902 set sys/file.h val
14903 eval $inhdr
14904
14905 : do we need to include sys/file.h ?
14906 case "$val" in
14907 "$define")
14908         echo " "
14909         if $h_sysfile; then
14910                 val="$define"
14911                 echo "We'll be including <sys/file.h>." >&4
14912         else
14913                 val="$undef"
14914                 echo "We won't be including <sys/file.h>." >&4
14915         fi
14916         ;;
14917 *)
14918         h_sysfile=false
14919         ;;
14920 esac
14921 set i_sysfile
14922 eval $setvar
14923
14924 : see if fcntl.h is there
14925 val=''
14926 set fcntl.h val
14927 eval $inhdr
14928
14929 : see if we can include fcntl.h
14930 case "$val" in
14931 "$define")
14932         echo " "
14933         if $h_fcntl; then
14934                 val="$define"
14935                 echo "We'll be including <fcntl.h>." >&4
14936         else
14937                 val="$undef"
14938                 if $h_sysfile; then
14939         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14940                 else
14941                         echo "We won't be including <fcntl.h>." >&4
14942                 fi
14943         fi
14944         ;;
14945 *)
14946         h_fcntl=false
14947         val="$undef"
14948         ;;
14949 esac
14950 set i_fcntl
14951 eval $setvar
14952
14953 : see if this is a iconv.h system
14954 set iconv.h i_iconv
14955 eval $inhdr
14956
14957 : see if this is a ieeefp.h system
14958 set ieeefp.h i_ieeefp
14959 eval $inhdr
14960
14961 : see if this is a libutil.h system
14962 set libutil.h i_libutil
14963 eval $inhdr
14964
14965 : see if locale.h is available
14966 set locale.h i_locale
14967 eval $inhdr
14968
14969 : see if mach cthreads are available
14970 if test "X$usethreads" = "X$define"; then
14971         set mach/cthreads.h i_machcthr
14972         eval $inhdr
14973 else
14974         i_machcthr="$undef"
14975 fi
14976
14977
14978
14979 : see if this is a math.h system
14980 set math.h i_math
14981 eval $inhdr
14982
14983 : see if this is a mntent.h system
14984 set mntent.h i_mntent
14985 eval $inhdr
14986
14987 : see if ndbm.h is available
14988 set ndbm.h t_ndbm
14989 eval $inhdr
14990 case "$t_ndbm" in
14991 $define)
14992         : see if dbm_open exists
14993         set dbm_open d_dbm_open
14994         eval $inlibc
14995         case "$d_dbm_open" in
14996         $undef)
14997                 t_ndbm="$undef"
14998                 echo "We won't be including <ndbm.h>"
14999                 ;;
15000         esac
15001         ;;
15002 esac
15003 val="$t_ndbm"
15004 set i_ndbm
15005 eval $setvar
15006
15007 : see if net/errno.h is available
15008 val=''
15009 set net/errno.h val
15010 eval $inhdr
15011
15012 : Unfortunately, it causes problems on some systems.  Arrgh.
15013 case "$val" in
15014 $define)
15015         cat > try.c <<'EOM'
15016 #include <stdio.h>
15017 #include <errno.h>
15018 #include <net/errno.h>
15019 int func()
15020 {
15021         return ENOTSOCK;
15022 }
15023 EOM
15024         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15025                 echo "We'll be including <net/errno.h>." >&4
15026         else
15027                 echo "We won't be including <net/errno.h>." >&4
15028                 val="$undef"
15029         fi
15030         $rm -f try.* try
15031         ;;
15032 esac
15033 set i_neterrno
15034 eval $setvar
15035
15036 : see if netinet/tcp.h is available
15037 set netinet/tcp.h i_netinettcp
15038 eval $inhdr
15039
15040 : see if this is a poll.h system
15041 set poll.h i_poll
15042 eval $inhdr
15043
15044 : see if this is a prot.h system
15045 set prot.h i_prot
15046 eval $inhdr
15047
15048 echo " "
15049 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15050 $cat <<'EOSH' > Cppsym.know
15051 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15052 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15053 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15054 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15055 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15056 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15057 bull c cadmus clipper CMU COFF COMPILER_VERSION
15058 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15059 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15060 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15061 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15062 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15063 H3050R H3050RX hbullx20 hcx host_mips
15064 hp200 hp300 hp700 HP700 hp800 hp9000
15065 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15066 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15067 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15068 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15069 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15070 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15071 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15072 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15073 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15074 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15075 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15076 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15077 MATH_HAS_NO_SIDE_EFFECTS
15078 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15079 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15080 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15081 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15082 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15083 NetBSD news1500 news1700 news1800 news1900 news3700
15084 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15085 ns32016 ns32332 ns32k nsc32000
15086 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15087 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15088 pc532 pdp11 PGC PIC plexus PORTAR posix
15089 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15090 POSIX_C_SOURCE POSIX_SOURCE POWER
15091 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15092 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15093 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15094 sony sony_news sonyrisc sparc sparclite spectrum
15095 stardent stdc STDC_EXT stratos sun sun3 sun386
15096 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15097 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15098 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15099 sysV68 sysV88 Tek4132 Tek4300 titan
15100 tower tower32 tower32_200 tower32_600 tower32_700
15101 tower32_800 tower32_850 tss
15102 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15103 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15104 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15105 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15106 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15107 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15108 z8000
15109 EOSH
15110 # Maybe put other stuff here too.
15111 cat <<EOSH >>Cppsym.know
15112 $osname
15113 EOSH
15114 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15115 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15116 $cat Cppsym.know > Cppsym.c
15117 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15118 $rm -f Cppsym.a Cppsym.b Cppsym.c
15119 cat <<EOSH > Cppsym
15120 $startsh
15121 if $test \$# -gt 0; then
15122     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15123     if $test -s Cppsym.got; then
15124         $rm -f Cppsym.got
15125         exit 0
15126     fi
15127     $rm -f Cppsym.got
15128     exit 1
15129 else
15130     $tr " " "$trnl" | ./Cppsym.try
15131     exit 0
15132 fi
15133 EOSH
15134 chmod +x Cppsym
15135 $eunicefix Cppsym
15136 cat <<EOSH > Cppsym.try
15137 $startsh
15138 cat <<'EOCP' > try.c
15139 #include <stdio.h>
15140 int main() {
15141 EOCP
15142 $awk \\
15143 EOSH
15144 cat <<'EOSH' >> Cppsym.try
15145 'length($1) > 0 {
15146     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
15147     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
15148     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
15149     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
15150 }'       >> try.c
15151 echo '}' >> try.c
15152 EOSH
15153 cat <<EOSH >> Cppsym.try
15154 ccflags="$ccflags"
15155 case "$osname-$gccversion" in
15156 irix-) ccflags="\$ccflags -woff 1178" ;;
15157 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15158 esac
15159 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15160 EOSH
15161 chmod +x Cppsym.try
15162 $eunicefix Cppsym.try
15163 ./Cppsym < Cppsym.know > Cppsym.true
15164 : now check the C compiler for additional symbols
15165 postprocess_cc_v=''
15166 case "$osname" in
15167 aix) postprocess_cc_v="|$tr , ' '" ;;
15168 esac
15169 $cat >ccsym <<EOS
15170 $startsh
15171 $cat >tmp.c <<EOF
15172 extern int foo;
15173 EOF
15174 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15175 do
15176         case "\$i" in
15177         -D*) echo "\$i" | $sed 's/^-D//';;
15178         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15179         esac
15180 done
15181 $rm -f try.c
15182 EOS
15183 postprocess_cc_v=''
15184 chmod +x ccsym
15185 $eunicefix ccsym
15186 ./ccsym > ccsym1.raw
15187 if $test -s ccsym1.raw; then
15188        $sort ccsym1.raw | $uniq >ccsym.raw
15189 else
15190        mv ccsym1.raw ccsym.raw
15191 fi
15192
15193 $awk '/\=/ { print $0; next }
15194         { print $0"=1" }' ccsym.raw >ccsym.list
15195 $awk '/\=/ { print $0; next }
15196         { print $0"=1" }' Cppsym.true >ccsym.true
15197 $comm -13 ccsym.true ccsym.list >ccsym.own
15198 $comm -12 ccsym.true ccsym.list >ccsym.com
15199 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15200 also=''
15201 if $test -z ccsym.raw; then
15202         echo "Your C compiler doesn't seem to define any symbols!" >&4
15203         echo " "
15204         echo "However, your C preprocessor defines the following symbols:"
15205         $cat Cppsym.true
15206         ccsymbols=''
15207         cppsymbols=`$cat Cppsym.true`
15208         cppsymbols=`echo $cppsymbols`
15209         cppccsymbols="$cppsymbols"
15210 else
15211         if $test -s ccsym.com; then
15212                 echo "Your C compiler and pre-processor define these symbols:"
15213                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15214                 also='also '
15215                 symbols='ones'
15216                 cppccsymbols=`$cat ccsym.com`
15217                 cppccsymbols=`echo $cppccsymbols`
15218                 $test "$silent" || sleep 1
15219         fi
15220         if $test -s ccsym.cpp; then
15221                 $test "$also" && echo " "
15222                 echo "Your C pre-processor ${also}defines the following symbols:"
15223                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15224                 also='further '
15225                 cppsymbols=`$cat ccsym.cpp`
15226                 cppsymbols=`echo $cppsymbols`
15227                 $test "$silent" || sleep 1
15228         fi
15229         if $test -s ccsym.own; then
15230                 $test "$also" && echo " "
15231                 echo "Your C compiler ${also}defines the following cpp symbols:"
15232                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15233                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15234                 ccsymbols=`$cat ccsym.own`
15235                 ccsymbols=`echo $ccsymbols`
15236                 $test "$silent" || sleep 1
15237         fi
15238 fi
15239 $rm -f ccsym* Cppsym.*
15240
15241 : see if this is a termio system
15242 val="$undef"
15243 val2="$undef"
15244 val3="$undef"
15245 if $test `./findhdr termios.h`; then
15246         set tcsetattr i_termios
15247         eval $inlibc
15248         val3="$i_termios"
15249 fi
15250 echo " "
15251 case "$val3" in
15252 "$define") echo "You have POSIX termios.h... good!" >&4;;
15253 *) if ./Cppsym pyr; then
15254                 case "`/bin/universe`" in
15255                 ucb) if $test `./findhdr sgtty.h`; then
15256                                 val2="$define"
15257                                 echo "<sgtty.h> found." >&4
15258                         else
15259                                 echo "System is pyramid with BSD universe."
15260                                 echo "<sgtty.h> not found--you could have problems." >&4
15261                         fi;;
15262                 *) if $test `./findhdr termio.h`; then
15263                                 val="$define"
15264                                 echo "<termio.h> found." >&4
15265                         else
15266                                 echo "System is pyramid with USG universe."
15267                                 echo "<termio.h> not found--you could have problems." >&4
15268                         fi;;
15269                 esac
15270         elif ./usg; then
15271                 if $test `./findhdr termio.h`; then
15272                         echo "<termio.h> found." >&4
15273                         val="$define"
15274                 elif $test `./findhdr sgtty.h`; then
15275                         echo "<sgtty.h> found." >&4
15276                         val2="$define"
15277                 else
15278 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15279                 fi
15280         else
15281                 if $test `./findhdr sgtty.h`; then
15282                         echo "<sgtty.h> found." >&4
15283                         val2="$define"
15284                 elif $test `./findhdr termio.h`; then
15285                         echo "<termio.h> found." >&4
15286                         val="$define"
15287                 else
15288 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15289                 fi
15290         fi;;
15291 esac
15292 set i_termio; eval $setvar
15293 val=$val2; set i_sgtty; eval $setvar
15294 val=$val3; set i_termios; eval $setvar
15295
15296 : see if this is a shadow.h system
15297 set shadow.h i_shadow
15298 eval $inhdr
15299
15300 : see if stddef is available
15301 set stddef.h i_stddef
15302 eval $inhdr
15303
15304 : see if this is a sunmath.h system
15305 set sunmath.h i_sunmath
15306 eval $inhdr
15307
15308 : see if sys/access.h is available
15309 set sys/access.h i_sysaccess
15310 eval $inhdr
15311
15312 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15313 set sys/filio.h i_sysfilio
15314 eval $inhdr
15315 echo " "
15316 if $test `./findhdr sys/ioctl.h`; then
15317         val="$define"
15318         echo '<sys/ioctl.h> found.' >&4
15319 else
15320         val="$undef"
15321         if $test $i_sysfilio = "$define"; then
15322             echo '<sys/ioctl.h> NOT found.' >&4
15323         else
15324                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15325                 $test $i_termio = "$define" && xxx="termio.h"
15326                 $test $i_termios = "$define" && xxx="termios.h"
15327 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15328         fi
15329 fi
15330 set i_sysioctl
15331 eval $setvar
15332
15333
15334 : see if this is a syslog.h system
15335 set syslog.h i_syslog
15336 eval $inhdr
15337
15338
15339 : see if this is a sys/mode.h system
15340 set sys/mode.h i_sysmode
15341 eval $inhdr
15342
15343 : see if sys/resource.h has to be included
15344 set sys/resource.h i_sysresrc
15345 eval $inhdr
15346
15347 : see if sys/security.h is available
15348 set sys/security.h i_syssecrt
15349 eval $inhdr
15350
15351 : see if this is a sys/statvfs.h system
15352 set sys/statvfs.h i_sysstatvfs
15353 eval $inhdr
15354
15355 : see if this is a sys/uio.h system
15356 set sys/uio.h i_sysuio
15357 eval $inhdr
15358
15359 : see if this is a sys/un.h system
15360 set sys/un.h i_sysun
15361 eval $inhdr
15362
15363
15364 : see if this is a sys/utsname.h system
15365 set sys/utsname.h i_sysutsname
15366 eval $inhdr
15367
15368 : see if this is a syswait system
15369 set sys/wait.h i_syswait
15370 eval $inhdr
15371
15372 : see if this is a ustat.h system
15373 set ustat.h i_ustat
15374 eval $inhdr
15375
15376 : see if this is an utime system
15377 set utime.h i_utime
15378 eval $inhdr
15379
15380 : see if this is a values.h system
15381 set values.h i_values
15382 eval $inhdr
15383
15384 : see if this is a vfork system
15385 case "$d_vfork" in
15386 "$define")
15387         set vfork.h i_vfork
15388         eval $inhdr
15389         ;;
15390 *)
15391         i_vfork="$undef"
15392         ;;
15393 esac
15394
15395 : see if gdbm.h is available
15396 set gdbm.h t_gdbm
15397 eval $inhdr
15398 case "$t_gdbm" in
15399 $define)
15400         : see if gdbm_open exists
15401         set gdbm_open d_gdbm_open
15402         eval $inlibc
15403         case "$d_gdbm_open" in
15404         $undef)
15405                 t_gdbm="$undef"
15406                 echo "We won't be including <gdbm.h>"
15407                 ;;
15408         esac
15409         ;;
15410 esac
15411 val="$t_gdbm"
15412 set i_gdbm
15413 eval $setvar
15414
15415 echo " "
15416 echo "Looking for extensions..." >&4
15417 : If we are using the old config.sh, known_extensions may contain
15418 : old or inaccurate or duplicate values.
15419 known_extensions=''
15420 nonxs_extensions=''
15421 : We do not use find because it might not be available.
15422 : We do not just use MANIFEST because the user may have dropped
15423 : some additional extensions into the source tree and expect them
15424 : to be built.
15425
15426 : Function to recursively find available extensions, ignoring DynaLoader
15427 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15428 find_extensions='
15429     for xxx in *; do
15430        case "$xxx" in
15431            DynaLoader|dynaload) ;;
15432            *)
15433            if $test -f $xxx/$xxx.xs; then
15434                known_extensions="$known_extensions $1$xxx";
15435            elif $test -f $xxx/Makefile.PL; then
15436                nonxs_extensions="$nonxs_extensions $1$xxx";
15437            else
15438                if $test -d $xxx -a $# -lt 10; then
15439                    set $1$xxx/ $*;
15440                    cd $xxx;
15441                    eval $find_extensions;
15442                    cd ..;
15443                    shift;
15444                fi;
15445            fi
15446            ;;
15447        esac;
15448     done'
15449 tdir=`pwd`
15450 cd $rsrc/ext
15451 set X
15452 shift
15453 eval $find_extensions
15454 set X $nonxs_extensions
15455 shift
15456 nonxs_extensions="$*"
15457 set X $known_extensions
15458 shift
15459 known_extensions="$*"
15460 cd $tdir
15461
15462 : Now see which are supported on this system.
15463 avail_ext=''
15464 for xxx in $known_extensions ; do
15465         case "$xxx" in
15466         DB_File|db_file)
15467                 case "$i_db" in
15468                 $define) avail_ext="$avail_ext $xxx" ;;
15469                 esac
15470                 ;;
15471         GDBM_File|gdbm_fil)
15472                 case "$i_gdbm" in 
15473                 $define) avail_ext="$avail_ext $xxx" ;;
15474                 esac
15475                 ;;
15476         NDBM_File|ndbm_fil)
15477                 case "$i_ndbm" in
15478                 $define)
15479                     case "$osname-$use64bitint" in
15480                     hpux-define)
15481                         case "$libs" in
15482                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15483                         esac
15484                         ;;
15485                     *) avail_ext="$avail_ext $xxx" ;;
15486                     esac
15487                     ;;
15488                 esac
15489                 ;;
15490         ODBM_File|odbm_fil) 
15491                 case "${i_dbm}${i_rpcsvcdbm}" in
15492                 *"${define}"*)
15493                     case "$osname-$use64bitint" in
15494                     hpux-define)
15495                         case "$libs" in
15496                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15497                         esac
15498                         ;;
15499                     *) avail_ext="$avail_ext $xxx" ;;
15500                     esac
15501                     ;;
15502                 esac
15503                 ;;
15504         POSIX|posix)
15505                 case "$useposix" in
15506                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15507                 esac
15508                 ;;
15509         Opcode|opcode)
15510                 case "$useopcode" in
15511                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15512                 esac
15513                 ;;
15514         Socket|socket)
15515                 case "$d_socket" in 
15516                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15517                 esac
15518                 ;;
15519         Sys/Syslog|sys/syslog)
15520                 : XXX syslog requires socket
15521                 case "$d_socket" in 
15522                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15523                 esac
15524                 ;;
15525         Thread|thread)
15526                 case "$usethreads" in 
15527                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15528                 esac
15529                 ;;
15530         IPC/SysV|ipc/sysv)
15531                 : XXX Do we need a useipcsysv variable here
15532                 case "${d_msg}${d_sem}${d_shm}" in 
15533                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15534                 esac
15535                 ;;
15536         *)      avail_ext="$avail_ext $xxx"
15537                 ;;
15538         esac
15539 done
15540
15541 set X $avail_ext
15542 shift
15543 avail_ext="$*"
15544
15545 : Now see which nonxs extensions are supported on this system.
15546 : For now assume all are.
15547 nonxs_ext=''
15548 for xxx in $nonxs_extensions ; do
15549         case "$xxx" in
15550         *)      nonxs_ext="$nonxs_ext $xxx"
15551                 ;;
15552         esac
15553 done
15554
15555 set X $nonxs_ext
15556 shift
15557 nonxs_ext="$*"
15558
15559 case $usedl in
15560 $define)
15561         $cat <<EOM
15562 A number of extensions are supplied with $package.  You may choose to
15563 compile these extensions for dynamic loading (the default), compile
15564 them into the $package executable (static loading), or not include
15565 them at all.  Answer "none" to include no extensions.
15566 Note that DynaLoader is always built and need not be mentioned here.
15567
15568 EOM
15569         case "$dynamic_ext" in
15570         '') dflt="$avail_ext" ;;
15571         *)      dflt="$dynamic_ext"
15572                 # Perhaps we are reusing an old out-of-date config.sh.
15573                 case "$hint" in
15574                 previous)
15575                         if test X"$dynamic_ext" != X"$avail_ext"; then
15576                                 $cat <<EOM
15577 NOTICE:  Your previous config.sh list may be incorrect. 
15578 The extensions now available to you are 
15579         ${avail_ext}
15580 but the default list from your previous config.sh is
15581         ${dynamic_ext} 
15582
15583 EOM
15584                         fi
15585                         ;;
15586                 esac
15587                 ;;
15588         esac
15589         case "$dflt" in
15590         '')     dflt=none;;
15591         esac
15592         rp="What extensions do you wish to load dynamically?"
15593         . ./myread
15594         case "$ans" in
15595         none) dynamic_ext=' ' ;;
15596         *) dynamic_ext="$ans" ;;
15597         esac
15598
15599         case "$static_ext" in
15600         '')
15601                 : Exclude those already listed in dynamic linking
15602                 dflt=''
15603                 for xxx in $avail_ext; do
15604                         case " $dynamic_ext " in
15605                         *" $xxx "*) ;;
15606                         *) dflt="$dflt $xxx" ;;
15607                         esac
15608                 done
15609                 set X $dflt
15610                 shift
15611                 dflt="$*"
15612                 ;;
15613         *)  dflt="$static_ext" 
15614                 ;;
15615         esac
15616
15617         case "$dflt" in
15618         '')     dflt=none;;
15619         esac
15620         rp="What extensions do you wish to load statically?"
15621         . ./myread
15622         case "$ans" in
15623         none) static_ext=' ' ;;
15624         *) static_ext="$ans" ;;
15625         esac
15626         ;;
15627 *)
15628         $cat <<EOM
15629 A number of extensions are supplied with $package.  Answer "none" 
15630 to include no extensions. 
15631 Note that DynaLoader is always built and need not be mentioned here.
15632
15633 EOM
15634         case "$static_ext" in
15635         '') dflt="$avail_ext" ;;
15636         *)      dflt="$static_ext"
15637                 # Perhaps we are reusing an old out-of-date config.sh.
15638                 case "$hint" in
15639                 previous)
15640                         if test X"$static_ext" != X"$avail_ext"; then
15641                                 $cat <<EOM
15642 NOTICE:  Your previous config.sh list may be incorrect. 
15643 The extensions now available to you are 
15644         ${avail_ext}
15645 but the default list from your previous config.sh is
15646         ${static_ext} 
15647
15648 EOM
15649                         fi
15650                         ;;
15651                 esac
15652                 ;;
15653         esac
15654         : Exclude those that are not xs extensions
15655         case "$dflt" in
15656         '')     dflt=none;;
15657         esac
15658         rp="What extensions do you wish to include?"
15659         . ./myread
15660         case "$ans" in
15661         none) static_ext=' ' ;;
15662         *) static_ext="$ans" ;;
15663         esac
15664         ;;
15665 esac
15666
15667 set X $dynamic_ext $static_ext $nonxs_ext
15668 shift
15669 extensions="$*"
15670
15671 : Remove libraries needed only for extensions
15672 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15673 : The exception is SunOS 4.x, which needs them.
15674 case "${osname}X${osvers}" in
15675 sunos*X4*)
15676     perllibs="$libs"
15677     ;;
15678 *) case "$usedl" in
15679     $define|true|[yY]*)
15680             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15681             shift
15682             perllibs="$*"
15683             ;;
15684     *)  perllibs="$libs"
15685             ;;
15686     esac
15687     ;;
15688 esac
15689
15690 : Remove build directory name from cppstdin so it can be used from
15691 : either the present location or the final installed location.
15692 echo " "
15693 : Get out of the UU directory to get correct path name.
15694 cd ..
15695 case "$cppstdin" in
15696 `pwd`/cppstdin)
15697         echo "Stripping down cppstdin path name"
15698         cppstdin=cppstdin
15699         ;;
15700 esac
15701 cd UU
15702
15703 : end of configuration questions
15704 echo " "
15705 echo "End of configuration questions."
15706 echo " "
15707
15708 : back to where it started
15709 if test -d ../UU; then
15710         cd ..
15711 fi
15712
15713 : configuration may be patched via a 'config.over' file
15714 if $test -f config.over; then
15715         echo " "
15716         dflt=y
15717         rp='I see a config.over file.  Do you wish to load it?'
15718         . UU/myread
15719         case "$ans" in
15720         n*) echo "OK, I'll ignore it.";;
15721         *)      . ./config.over
15722                 echo "Configuration override changes have been loaded."
15723                 ;;
15724         esac
15725 fi
15726
15727 : in case they want portability, strip down executable paths
15728 case "$d_portable" in
15729 "$define")
15730         echo " "
15731         echo "Stripping down executable paths..." >&4
15732         for file in $loclist $trylist; do
15733                 eval temp=\$$file
15734                 eval $file=`basename $temp`
15735         done
15736         ;;
15737 esac
15738
15739 : create config.sh file
15740 echo " "
15741 echo "Creating config.sh..." >&4
15742 $spitshell <<EOT >config.sh
15743 $startsh
15744 #
15745 # This file was produced by running the Configure script. It holds all the
15746 # definitions figured out by Configure. Should you modify one of these values,
15747 # do not forget to propagate your changes by running "Configure -der". You may
15748 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15749 #
15750
15751 # Package name      : $package
15752 # Source directory  : $src
15753 # Configuration time: $cf_time
15754 # Configured by     : $cf_by
15755 # Target system     : $myuname
15756
15757 Author='$Author'
15758 Date='$Date'
15759 Header='$Header'
15760 Id='$Id'
15761 Locker='$Locker'
15762 Log='$Log'
15763 Mcc='$Mcc'
15764 RCSfile='$RCSfile'
15765 Revision='$Revision'
15766 Source='$Source'
15767 State='$State'
15768 _a='$_a'
15769 _exe='$_exe'
15770 _o='$_o'
15771 afs='$afs'
15772 alignbytes='$alignbytes'
15773 ansi2knr='$ansi2knr'
15774 aphostname='$aphostname'
15775 api_revision='$api_revision'
15776 api_subversion='$api_subversion'
15777 api_version='$api_version'
15778 api_versionstring='$api_versionstring'
15779 ar='$ar'
15780 archlib='$archlib'
15781 archlibexp='$archlibexp'
15782 archname64='$archname64'
15783 archname='$archname'
15784 archobjs='$archobjs'
15785 awk='$awk'
15786 baserev='$baserev'
15787 bash='$bash'
15788 bin='$bin'
15789 bincompat5005='$bincompat5005'
15790 binexp='$binexp'
15791 bison='$bison'
15792 byacc='$byacc'
15793 byteorder='$byteorder'
15794 c='$c'
15795 castflags='$castflags'
15796 cat='$cat'
15797 cc='$cc'
15798 cccdlflags='$cccdlflags'
15799 ccdlflags='$ccdlflags'
15800 ccflags='$ccflags'
15801 ccflags_uselargefiles='$ccflags_uselargefiles'
15802 ccname='$ccname'
15803 ccsymbols='$ccsymbols'
15804 ccversion='$ccversion'
15805 cf_by='$cf_by'
15806 cf_email='$cf_email'
15807 cf_time='$cf_time'
15808 charsize='$charsize'
15809 chgrp='$chgrp'
15810 chmod='$chmod'
15811 chown='$chown'
15812 clocktype='$clocktype'
15813 comm='$comm'
15814 compress='$compress'
15815 contains='$contains'
15816 cp='$cp'
15817 cpio='$cpio'
15818 cpp='$cpp'
15819 cpp_stuff='$cpp_stuff'
15820 cppccsymbols='$cppccsymbols'
15821 cppflags='$cppflags'
15822 cpplast='$cpplast'
15823 cppminus='$cppminus'
15824 cpprun='$cpprun'
15825 cppstdin='$cppstdin'
15826 cppsymbols='$cppsymbols'
15827 crosscompile='$crosscompile'
15828 cryptlib='$cryptlib'
15829 csh='$csh'
15830 d_Gconvert='$d_Gconvert'
15831 d_PRIEUldbl='$d_PRIEUldbl'
15832 d_PRIFUldbl='$d_PRIFUldbl'
15833 d_PRIGUldbl='$d_PRIGUldbl'
15834 d_PRIXU64='$d_PRIXU64'
15835 d_PRId64='$d_PRId64'
15836 d_PRIeldbl='$d_PRIeldbl'
15837 d_PRIfldbl='$d_PRIfldbl'
15838 d_PRIgldbl='$d_PRIgldbl'
15839 d_PRIi64='$d_PRIi64'
15840 d_PRIo64='$d_PRIo64'
15841 d_PRIu64='$d_PRIu64'
15842 d_PRIx64='$d_PRIx64'
15843 d_SCNfldbl='$d_SCNfldbl'
15844 d__fwalk='$d__fwalk'
15845 d_access='$d_access'
15846 d_accessx='$d_accessx'
15847 d_alarm='$d_alarm'
15848 d_archlib='$d_archlib'
15849 d_atolf='$d_atolf'
15850 d_atoll='$d_atoll'
15851 d_attribut='$d_attribut'
15852 d_bcmp='$d_bcmp'
15853 d_bcopy='$d_bcopy'
15854 d_bincompat5005='$d_bincompat5005'
15855 d_bsd='$d_bsd'
15856 d_bsdgetpgrp='$d_bsdgetpgrp'
15857 d_bsdsetpgrp='$d_bsdsetpgrp'
15858 d_bzero='$d_bzero'
15859 d_casti32='$d_casti32'
15860 d_castneg='$d_castneg'
15861 d_charvspr='$d_charvspr'
15862 d_chown='$d_chown'
15863 d_chroot='$d_chroot'
15864 d_chsize='$d_chsize'
15865 d_closedir='$d_closedir'
15866 d_const='$d_const'
15867 d_crypt='$d_crypt'
15868 d_csh='$d_csh'
15869 d_cuserid='$d_cuserid'
15870 d_dbl_dig='$d_dbl_dig'
15871 d_difftime='$d_difftime'
15872 d_dirnamlen='$d_dirnamlen'
15873 d_dlerror='$d_dlerror'
15874 d_dlopen='$d_dlopen'
15875 d_dlsymun='$d_dlsymun'
15876 d_dosuid='$d_dosuid'
15877 d_drand48proto='$d_drand48proto'
15878 d_dup2='$d_dup2'
15879 d_eaccess='$d_eaccess'
15880 d_endgrent='$d_endgrent'
15881 d_endhent='$d_endhent'
15882 d_endnent='$d_endnent'
15883 d_endpent='$d_endpent'
15884 d_endpwent='$d_endpwent'
15885 d_endsent='$d_endsent'
15886 d_eofnblk='$d_eofnblk'
15887 d_eunice='$d_eunice'
15888 d_fchmod='$d_fchmod'
15889 d_fchown='$d_fchown'
15890 d_fcntl='$d_fcntl'
15891 d_fcntl_can_lock='$d_fcntl_can_lock'
15892 d_fd_macros='$d_fd_macros'
15893 d_fd_set='$d_fd_set'
15894 d_fds_bits='$d_fds_bits'
15895 d_fgetpos='$d_fgetpos'
15896 d_flexfnam='$d_flexfnam'
15897 d_flock='$d_flock'
15898 d_fork='$d_fork'
15899 d_fpathconf='$d_fpathconf'
15900 d_fpos64_t='$d_fpos64_t'
15901 d_frexpl='$d_frexpl'
15902 d_fs_data_s='$d_fs_data_s'
15903 d_fseeko='$d_fseeko'
15904 d_fsetpos='$d_fsetpos'
15905 d_fstatfs='$d_fstatfs'
15906 d_fstatvfs='$d_fstatvfs'
15907 d_fsync='$d_fsync'
15908 d_ftello='$d_ftello'
15909 d_ftime='$d_ftime'
15910 d_getcwd='$d_getcwd'
15911 d_getespwnam='$d_getespwnam'
15912 d_getfsstat='$d_getfsstat'
15913 d_getgrent='$d_getgrent'
15914 d_getgrps='$d_getgrps'
15915 d_gethbyaddr='$d_gethbyaddr'
15916 d_gethbyname='$d_gethbyname'
15917 d_gethent='$d_gethent'
15918 d_gethname='$d_gethname'
15919 d_gethostprotos='$d_gethostprotos'
15920 d_getlogin='$d_getlogin'
15921 d_getmnt='$d_getmnt'
15922 d_getmntent='$d_getmntent'
15923 d_getnbyaddr='$d_getnbyaddr'
15924 d_getnbyname='$d_getnbyname'
15925 d_getnent='$d_getnent'
15926 d_getnetprotos='$d_getnetprotos'
15927 d_getpagsz='$d_getpagsz'
15928 d_getpbyname='$d_getpbyname'
15929 d_getpbynumber='$d_getpbynumber'
15930 d_getpent='$d_getpent'
15931 d_getpgid='$d_getpgid'
15932 d_getpgrp2='$d_getpgrp2'
15933 d_getpgrp='$d_getpgrp'
15934 d_getppid='$d_getppid'
15935 d_getprior='$d_getprior'
15936 d_getprotoprotos='$d_getprotoprotos'
15937 d_getprpwnam='$d_getprpwnam'
15938 d_getpwent='$d_getpwent'
15939 d_getsbyname='$d_getsbyname'
15940 d_getsbyport='$d_getsbyport'
15941 d_getsent='$d_getsent'
15942 d_getservprotos='$d_getservprotos'
15943 d_getspnam='$d_getspnam'
15944 d_gettimeod='$d_gettimeod'
15945 d_gnulibc='$d_gnulibc'
15946 d_grpasswd='$d_grpasswd'
15947 d_hasmntopt='$d_hasmntopt'
15948 d_htonl='$d_htonl'
15949 d_iconv='$d_iconv'
15950 d_index='$d_index'
15951 d_inetaton='$d_inetaton'
15952 d_int64_t='$d_int64_t'
15953 d_isascii='$d_isascii'
15954 d_isnan='$d_isnan'
15955 d_isnanl='$d_isnanl'
15956 d_killpg='$d_killpg'
15957 d_lchown='$d_lchown'
15958 d_ldbl_dig='$d_ldbl_dig'
15959 d_link='$d_link'
15960 d_locconv='$d_locconv'
15961 d_lockf='$d_lockf'
15962 d_longdbl='$d_longdbl'
15963 d_longlong='$d_longlong'
15964 d_lseekproto='$d_lseekproto'
15965 d_lstat='$d_lstat'
15966 d_madvise='$d_madvise'
15967 d_mblen='$d_mblen'
15968 d_mbstowcs='$d_mbstowcs'
15969 d_mbtowc='$d_mbtowc'
15970 d_memchr='$d_memchr'
15971 d_memcmp='$d_memcmp'
15972 d_memcpy='$d_memcpy'
15973 d_memmove='$d_memmove'
15974 d_memset='$d_memset'
15975 d_mkdir='$d_mkdir'
15976 d_mkdtemp='$d_mkdtemp'
15977 d_mkfifo='$d_mkfifo'
15978 d_mkstemp='$d_mkstemp'
15979 d_mkstemps='$d_mkstemps'
15980 d_mktime='$d_mktime'
15981 d_mmap='$d_mmap'
15982 d_modfl='$d_modfl'
15983 d_mprotect='$d_mprotect'
15984 d_msg='$d_msg'
15985 d_msg_ctrunc='$d_msg_ctrunc'
15986 d_msg_dontroute='$d_msg_dontroute'
15987 d_msg_oob='$d_msg_oob'
15988 d_msg_peek='$d_msg_peek'
15989 d_msg_proxy='$d_msg_proxy'
15990 d_msgctl='$d_msgctl'
15991 d_msgget='$d_msgget'
15992 d_msgrcv='$d_msgrcv'
15993 d_msgsnd='$d_msgsnd'
15994 d_msync='$d_msync'
15995 d_munmap='$d_munmap'
15996 d_mymalloc='$d_mymalloc'
15997 d_nice='$d_nice'
15998 d_nv_preserves_uv='$d_nv_preserves_uv'
15999 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16000 d_off64_t='$d_off64_t'
16001 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16002 d_oldpthreads='$d_oldpthreads'
16003 d_oldsock='$d_oldsock'
16004 d_open3='$d_open3'
16005 d_pathconf='$d_pathconf'
16006 d_pause='$d_pause'
16007 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16008 d_phostname='$d_phostname'
16009 d_pipe='$d_pipe'
16010 d_poll='$d_poll'
16011 d_portable='$d_portable'
16012 d_pthread_yield='$d_pthread_yield'
16013 d_pwage='$d_pwage'
16014 d_pwchange='$d_pwchange'
16015 d_pwclass='$d_pwclass'
16016 d_pwcomment='$d_pwcomment'
16017 d_pwexpire='$d_pwexpire'
16018 d_pwgecos='$d_pwgecos'
16019 d_pwpasswd='$d_pwpasswd'
16020 d_pwquota='$d_pwquota'
16021 d_qgcvt='$d_qgcvt'
16022 d_quad='$d_quad'
16023 d_readdir='$d_readdir'
16024 d_readlink='$d_readlink'
16025 d_rename='$d_rename'
16026 d_rewinddir='$d_rewinddir'
16027 d_rmdir='$d_rmdir'
16028 d_safebcpy='$d_safebcpy'
16029 d_safemcpy='$d_safemcpy'
16030 d_sanemcmp='$d_sanemcmp'
16031 d_sbrkproto='$d_sbrkproto'
16032 d_sched_yield='$d_sched_yield'
16033 d_scm_rights='$d_scm_rights'
16034 d_seekdir='$d_seekdir'
16035 d_select='$d_select'
16036 d_sem='$d_sem'
16037 d_semctl='$d_semctl'
16038 d_semctl_semid_ds='$d_semctl_semid_ds'
16039 d_semctl_semun='$d_semctl_semun'
16040 d_semget='$d_semget'
16041 d_semop='$d_semop'
16042 d_setegid='$d_setegid'
16043 d_seteuid='$d_seteuid'
16044 d_setgrent='$d_setgrent'
16045 d_setgrps='$d_setgrps'
16046 d_sethent='$d_sethent'
16047 d_setlinebuf='$d_setlinebuf'
16048 d_setlocale='$d_setlocale'
16049 d_setnent='$d_setnent'
16050 d_setpent='$d_setpent'
16051 d_setpgid='$d_setpgid'
16052 d_setpgrp2='$d_setpgrp2'
16053 d_setpgrp='$d_setpgrp'
16054 d_setprior='$d_setprior'
16055 d_setproctitle='$d_setproctitle'
16056 d_setpwent='$d_setpwent'
16057 d_setregid='$d_setregid'
16058 d_setresgid='$d_setresgid'
16059 d_setresuid='$d_setresuid'
16060 d_setreuid='$d_setreuid'
16061 d_setrgid='$d_setrgid'
16062 d_setruid='$d_setruid'
16063 d_setsent='$d_setsent'
16064 d_setsid='$d_setsid'
16065 d_setvbuf='$d_setvbuf'
16066 d_sfio='$d_sfio'
16067 d_shm='$d_shm'
16068 d_shmat='$d_shmat'
16069 d_shmatprototype='$d_shmatprototype'
16070 d_shmctl='$d_shmctl'
16071 d_shmdt='$d_shmdt'
16072 d_shmget='$d_shmget'
16073 d_sigaction='$d_sigaction'
16074 d_sigsetjmp='$d_sigsetjmp'
16075 d_socket='$d_socket'
16076 d_socklen_t='$d_socklen_t'
16077 d_sockpair='$d_sockpair'
16078 d_socks5_init='$d_socks5_init'
16079 d_sqrtl='$d_sqrtl'
16080 d_statblks='$d_statblks'
16081 d_statfs_f_flags='$d_statfs_f_flags'
16082 d_statfs_s='$d_statfs_s'
16083 d_statvfs='$d_statvfs'
16084 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16085 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16086 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16087 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16088 d_stdio_stream_array='$d_stdio_stream_array'
16089 d_stdiobase='$d_stdiobase'
16090 d_stdstdio='$d_stdstdio'
16091 d_strchr='$d_strchr'
16092 d_strcoll='$d_strcoll'
16093 d_strctcpy='$d_strctcpy'
16094 d_strerrm='$d_strerrm'
16095 d_strerror='$d_strerror'
16096 d_strtod='$d_strtod'
16097 d_strtol='$d_strtol'
16098 d_strtold='$d_strtold'
16099 d_strtoll='$d_strtoll'
16100 d_strtoq='$d_strtoq'
16101 d_strtoul='$d_strtoul'
16102 d_strtoull='$d_strtoull'
16103 d_strtouq='$d_strtouq'
16104 d_strxfrm='$d_strxfrm'
16105 d_suidsafe='$d_suidsafe'
16106 d_symlink='$d_symlink'
16107 d_syscall='$d_syscall'
16108 d_sysconf='$d_sysconf'
16109 d_sysernlst='$d_sysernlst'
16110 d_syserrlst='$d_syserrlst'
16111 d_system='$d_system'
16112 d_tcgetpgrp='$d_tcgetpgrp'
16113 d_tcsetpgrp='$d_tcsetpgrp'
16114 d_telldir='$d_telldir'
16115 d_telldirproto='$d_telldirproto'
16116 d_time='$d_time'
16117 d_times='$d_times'
16118 d_truncate='$d_truncate'
16119 d_tzname='$d_tzname'
16120 d_umask='$d_umask'
16121 d_uname='$d_uname'
16122 d_union_semun='$d_union_semun'
16123 d_ustat='$d_ustat'
16124 d_vendorarch='$d_vendorarch'
16125 d_vendorbin='$d_vendorbin'
16126 d_vendorlib='$d_vendorlib'
16127 d_vfork='$d_vfork'
16128 d_void_closedir='$d_void_closedir'
16129 d_voidsig='$d_voidsig'
16130 d_voidtty='$d_voidtty'
16131 d_volatile='$d_volatile'
16132 d_vprintf='$d_vprintf'
16133 d_wait4='$d_wait4'
16134 d_waitpid='$d_waitpid'
16135 d_wcstombs='$d_wcstombs'
16136 d_wctomb='$d_wctomb'
16137 d_xenix='$d_xenix'
16138 date='$date'
16139 db_hashtype='$db_hashtype'
16140 db_prefixtype='$db_prefixtype'
16141 defvoidused='$defvoidused'
16142 direntrytype='$direntrytype'
16143 dlext='$dlext'
16144 dlsrc='$dlsrc'
16145 doublesize='$doublesize'
16146 drand01='$drand01'
16147 dynamic_ext='$dynamic_ext'
16148 eagain='$eagain'
16149 ebcdic='$ebcdic'
16150 echo='$echo'
16151 egrep='$egrep'
16152 emacs='$emacs'
16153 eunicefix='$eunicefix'
16154 exe_ext='$exe_ext'
16155 expr='$expr'
16156 extensions='$extensions'
16157 fflushNULL='$fflushNULL'
16158 fflushall='$fflushall'
16159 find='$find'
16160 firstmakefile='$firstmakefile'
16161 flex='$flex'
16162 fpossize='$fpossize'
16163 fpostype='$fpostype'
16164 freetype='$freetype'
16165 full_ar='$full_ar'
16166 full_csh='$full_csh'
16167 full_sed='$full_sed'
16168 gccosandvers='$gccosandvers'
16169 gccversion='$gccversion'
16170 gidformat='$gidformat'
16171 gidsign='$gidsign'
16172 gidsize='$gidsize'
16173 gidtype='$gidtype'
16174 glibpth='$glibpth'
16175 grep='$grep'
16176 groupcat='$groupcat'
16177 groupstype='$groupstype'
16178 gzip='$gzip'
16179 h_fcntl='$h_fcntl'
16180 h_sysfile='$h_sysfile'
16181 hint='$hint'
16182 hostcat='$hostcat'
16183 i16size='$i16size'
16184 i16type='$i16type'
16185 i32size='$i32size'
16186 i32type='$i32type'
16187 i64size='$i64size'
16188 i64type='$i64type'
16189 i8size='$i8size'
16190 i8type='$i8type'
16191 i_arpainet='$i_arpainet'
16192 i_bsdioctl='$i_bsdioctl'
16193 i_db='$i_db'
16194 i_dbm='$i_dbm'
16195 i_dirent='$i_dirent'
16196 i_dld='$i_dld'
16197 i_dlfcn='$i_dlfcn'
16198 i_fcntl='$i_fcntl'
16199 i_float='$i_float'
16200 i_gdbm='$i_gdbm'
16201 i_grp='$i_grp'
16202 i_iconv='$i_iconv'
16203 i_ieeefp='$i_ieeefp'
16204 i_inttypes='$i_inttypes'
16205 i_libutil='$i_libutil'
16206 i_limits='$i_limits'
16207 i_locale='$i_locale'
16208 i_machcthr='$i_machcthr'
16209 i_malloc='$i_malloc'
16210 i_math='$i_math'
16211 i_memory='$i_memory'
16212 i_mntent='$i_mntent'
16213 i_ndbm='$i_ndbm'
16214 i_netdb='$i_netdb'
16215 i_neterrno='$i_neterrno'
16216 i_netinettcp='$i_netinettcp'
16217 i_niin='$i_niin'
16218 i_poll='$i_poll'
16219 i_prot='$i_prot'
16220 i_pthread='$i_pthread'
16221 i_pwd='$i_pwd'
16222 i_rpcsvcdbm='$i_rpcsvcdbm'
16223 i_sfio='$i_sfio'
16224 i_sgtty='$i_sgtty'
16225 i_shadow='$i_shadow'
16226 i_socks='$i_socks'
16227 i_stdarg='$i_stdarg'
16228 i_stddef='$i_stddef'
16229 i_stdlib='$i_stdlib'
16230 i_string='$i_string'
16231 i_sunmath='$i_sunmath'
16232 i_sysaccess='$i_sysaccess'
16233 i_sysdir='$i_sysdir'
16234 i_sysfile='$i_sysfile'
16235 i_sysfilio='$i_sysfilio'
16236 i_sysin='$i_sysin'
16237 i_sysioctl='$i_sysioctl'
16238 i_syslog='$i_syslog'
16239 i_sysmman='$i_sysmman'
16240 i_sysmode='$i_sysmode'
16241 i_sysmount='$i_sysmount'
16242 i_sysndir='$i_sysndir'
16243 i_sysparam='$i_sysparam'
16244 i_sysresrc='$i_sysresrc'
16245 i_syssecrt='$i_syssecrt'
16246 i_sysselct='$i_sysselct'
16247 i_syssockio='$i_syssockio'
16248 i_sysstat='$i_sysstat'
16249 i_sysstatfs='$i_sysstatfs'
16250 i_sysstatvfs='$i_sysstatvfs'
16251 i_systime='$i_systime'
16252 i_systimek='$i_systimek'
16253 i_systimes='$i_systimes'
16254 i_systypes='$i_systypes'
16255 i_sysuio='$i_sysuio'
16256 i_sysun='$i_sysun'
16257 i_sysutsname='$i_sysutsname'
16258 i_sysvfs='$i_sysvfs'
16259 i_syswait='$i_syswait'
16260 i_termio='$i_termio'
16261 i_termios='$i_termios'
16262 i_time='$i_time'
16263 i_unistd='$i_unistd'
16264 i_ustat='$i_ustat'
16265 i_utime='$i_utime'
16266 i_values='$i_values'
16267 i_varargs='$i_varargs'
16268 i_varhdr='$i_varhdr'
16269 i_vfork='$i_vfork'
16270 ignore_versioned_solibs='$ignore_versioned_solibs'
16271 inc_version_list='$inc_version_list'
16272 inc_version_list_init='$inc_version_list_init'
16273 incpath='$incpath'
16274 inews='$inews'
16275 installarchlib='$installarchlib'
16276 installbin='$installbin'
16277 installman1dir='$installman1dir'
16278 installman3dir='$installman3dir'
16279 installprefix='$installprefix'
16280 installprefixexp='$installprefixexp'
16281 installprivlib='$installprivlib'
16282 installscript='$installscript'
16283 installsitearch='$installsitearch'
16284 installsitebin='$installsitebin'
16285 installsitelib='$installsitelib'
16286 installstyle='$installstyle'
16287 installusrbinperl='$installusrbinperl'
16288 installvendorarch='$installvendorarch'
16289 installvendorbin='$installvendorbin'
16290 installvendorlib='$installvendorlib'
16291 intsize='$intsize'
16292 issymlink='$issymlink'
16293 ivdformat='$ivdformat'
16294 ivsize='$ivsize'
16295 ivtype='$ivtype'
16296 known_extensions='$known_extensions'
16297 ksh='$ksh'
16298 ld='$ld'
16299 lddlflags='$lddlflags'
16300 ldflags='$ldflags'
16301 ldflags_uselargefiles='$ldflags_uselargefiles'
16302 ldlibpthname='$ldlibpthname'
16303 less='$less'
16304 lib_ext='$lib_ext'
16305 libc='$libc'
16306 libperl='$libperl'
16307 libpth='$libpth'
16308 libs='$libs'
16309 libsdirs='$libsdirs'
16310 libsfiles='$libsfiles'
16311 libsfound='$libsfound'
16312 libspath='$libspath'
16313 libswanted='$libswanted'
16314 libswanted_uselargefiles='$libswanted_uselargefiles'
16315 line='$line'
16316 lint='$lint'
16317 lkflags='$lkflags'
16318 ln='$ln'
16319 lns='$lns'
16320 locincpth='$locincpth'
16321 loclibpth='$loclibpth'
16322 longdblsize='$longdblsize'
16323 longlongsize='$longlongsize'
16324 longsize='$longsize'
16325 lp='$lp'
16326 lpr='$lpr'
16327 ls='$ls'
16328 lseeksize='$lseeksize'
16329 lseektype='$lseektype'
16330 mail='$mail'
16331 mailx='$mailx'
16332 make='$make'
16333 make_set_make='$make_set_make'
16334 mallocobj='$mallocobj'
16335 mallocsrc='$mallocsrc'
16336 malloctype='$malloctype'
16337 man1dir='$man1dir'
16338 man1direxp='$man1direxp'
16339 man1ext='$man1ext'
16340 man3dir='$man3dir'
16341 man3direxp='$man3direxp'
16342 man3ext='$man3ext'
16343 mips_type='$mips_type'
16344 mkdir='$mkdir'
16345 mmaptype='$mmaptype'
16346 modetype='$modetype'
16347 more='$more'
16348 multiarch='$multiarch'
16349 mv='$mv'
16350 myarchname='$myarchname'
16351 mydomain='$mydomain'
16352 myhostname='$myhostname'
16353 myuname='$myuname'
16354 n='$n'
16355 need_va_copy='$need_va_copy'
16356 netdb_hlen_type='$netdb_hlen_type'
16357 netdb_host_type='$netdb_host_type'
16358 netdb_name_type='$netdb_name_type'
16359 netdb_net_type='$netdb_net_type'
16360 nm='$nm'
16361 nm_opt='$nm_opt'
16362 nm_so_opt='$nm_so_opt'
16363 nonxs_ext='$nonxs_ext'
16364 nroff='$nroff'
16365 nvEUformat='$nvEUformat'
16366 nvFUformat='$nvFUformat'
16367 nvGUformat='$nvGUformat'
16368 nveformat='$nveformat'
16369 nvfformat='$nvfformat'
16370 nvgformat='$nvgformat'
16371 nvsize='$nvsize'
16372 nvtype='$nvtype'
16373 o_nonblock='$o_nonblock'
16374 obj_ext='$obj_ext'
16375 old_pthread_create_joinable='$old_pthread_create_joinable'
16376 optimize='$optimize'
16377 orderlib='$orderlib'
16378 osname='$osname'
16379 osvers='$osvers'
16380 otherlibdirs='$otherlibdirs'
16381 package='$package'
16382 pager='$pager'
16383 passcat='$passcat'
16384 patchlevel='$patchlevel'
16385 path_sep='$path_sep'
16386 perl5='$perl5'
16387 perl='$perl'
16388 perladmin='$perladmin'
16389 perllibs='$perllibs'
16390 perlpath='$perlpath'
16391 pg='$pg'
16392 phostname='$phostname'
16393 pidtype='$pidtype'
16394 plibpth='$plibpth'
16395 pm_apiversion='$pm_apiversion'
16396 pmake='$pmake'
16397 pr='$pr'
16398 prefix='$prefix'
16399 prefixexp='$prefixexp'
16400 privlib='$privlib'
16401 privlibexp='$privlibexp'
16402 prototype='$prototype'
16403 ptrsize='$ptrsize'
16404 quadkind='$quadkind'
16405 quadtype='$quadtype'
16406 randbits='$randbits'
16407 randfunc='$randfunc'
16408 randseedtype='$randseedtype'
16409 ranlib='$ranlib'
16410 rd_nodata='$rd_nodata'
16411 revision='$revision'
16412 rm='$rm'
16413 rmail='$rmail'
16414 runnm='$runnm'
16415 sPRIEUldbl='$sPRIEUldbl'
16416 sPRIFUldbl='$sPRIFUldbl'
16417 sPRIGUldbl='$sPRIGUldbl'
16418 sPRIXU64='$sPRIXU64'
16419 sPRId64='$sPRId64'
16420 sPRIeldbl='$sPRIeldbl'
16421 sPRIfldbl='$sPRIfldbl'
16422 sPRIgldbl='$sPRIgldbl'
16423 sPRIi64='$sPRIi64'
16424 sPRIo64='$sPRIo64'
16425 sPRIu64='$sPRIu64'
16426 sPRIx64='$sPRIx64'
16427 sSCNfldbl='$sSCNfldbl'
16428 sched_yield='$sched_yield'
16429 scriptdir='$scriptdir'
16430 scriptdirexp='$scriptdirexp'
16431 sed='$sed'
16432 seedfunc='$seedfunc'
16433 selectminbits='$selectminbits'
16434 selecttype='$selecttype'
16435 sendmail='$sendmail'
16436 sh='$sh'
16437 shar='$shar'
16438 sharpbang='$sharpbang'
16439 shmattype='$shmattype'
16440 shortsize='$shortsize'
16441 shrpenv='$shrpenv'
16442 shsharp='$shsharp'
16443 sig_count='$sig_count'
16444 sig_name='$sig_name'
16445 sig_name_init='$sig_name_init'
16446 sig_num='$sig_num'
16447 sig_num_init='$sig_num_init'
16448 signal_t='$signal_t'
16449 sitearch='$sitearch'
16450 sitearchexp='$sitearchexp'
16451 sitebin='$sitebin'
16452 sitebinexp='$sitebinexp'
16453 sitelib='$sitelib'
16454 sitelib_stem='$sitelib_stem'
16455 sitelibexp='$sitelibexp'
16456 siteprefix='$siteprefix'
16457 siteprefixexp='$siteprefixexp'
16458 sizesize='$sizesize'
16459 sizetype='$sizetype'
16460 sleep='$sleep'
16461 smail='$smail'
16462 so='$so'
16463 sockethdr='$sockethdr'
16464 socketlib='$socketlib'
16465 socksizetype='$socksizetype'
16466 sort='$sort'
16467 spackage='$spackage'
16468 spitshell='$spitshell'
16469 src='$src'
16470 ssizetype='$ssizetype'
16471 startperl='$startperl'
16472 startsh='$startsh'
16473 static_ext='$static_ext'
16474 stdchar='$stdchar'
16475 stdio_base='$stdio_base'
16476 stdio_bufsiz='$stdio_bufsiz'
16477 stdio_cnt='$stdio_cnt'
16478 stdio_filbuf='$stdio_filbuf'
16479 stdio_ptr='$stdio_ptr'
16480 stdio_stream_array='$stdio_stream_array'
16481 strings='$strings'
16482 submit='$submit'
16483 subversion='$subversion'
16484 sysman='$sysman'
16485 tail='$tail'
16486 tar='$tar'
16487 tbl='$tbl'
16488 tee='$tee'
16489 test='$test'
16490 timeincl='$timeincl'
16491 timetype='$timetype'
16492 touch='$touch'
16493 tr='$tr'
16494 trnl='$trnl'
16495 troff='$troff'
16496 u16size='$u16size'
16497 u16type='$u16type'
16498 u32size='$u32size'
16499 u32type='$u32type'
16500 u64size='$u64size'
16501 u64type='$u64type'
16502 u8size='$u8size'
16503 u8type='$u8type'
16504 uidformat='$uidformat'
16505 uidsign='$uidsign'
16506 uidsize='$uidsize'
16507 uidtype='$uidtype'
16508 uname='$uname'
16509 uniq='$uniq'
16510 uquadtype='$uquadtype'
16511 use5005threads='$use5005threads'
16512 use64bitall='$use64bitall'
16513 use64bitint='$use64bitint'
16514 usedl='$usedl'
16515 useithreads='$useithreads'
16516 uselargefiles='$uselargefiles'
16517 uselongdouble='$uselongdouble'
16518 usemorebits='$usemorebits'
16519 usemultiplicity='$usemultiplicity'
16520 usemymalloc='$usemymalloc'
16521 usenm='$usenm'
16522 useopcode='$useopcode'
16523 useperlio='$useperlio'
16524 useposix='$useposix'
16525 usesfio='$usesfio'
16526 useshrplib='$useshrplib'
16527 usesocks='$usesocks'
16528 usethreads='$usethreads'
16529 usevendorprefix='$usevendorprefix'
16530 usevfork='$usevfork'
16531 usrinc='$usrinc'
16532 uuname='$uuname'
16533 uvXUformat='$uvXUformat'
16534 uvoformat='$uvoformat'
16535 uvsize='$uvsize'
16536 uvtype='$uvtype'
16537 uvuformat='$uvuformat'
16538 uvxformat='$uvxformat'
16539 vendorarch='$vendorarch'
16540 vendorarchexp='$vendorarchexp'
16541 vendorbin='$vendorbin'
16542 vendorbinexp='$vendorbinexp'
16543 vendorlib='$vendorlib'
16544 vendorlib_stem='$vendorlib_stem'
16545 vendorlibexp='$vendorlibexp'
16546 vendorprefix='$vendorprefix'
16547 vendorprefixexp='$vendorprefixexp'
16548 version='$version'
16549 versiononly='$versiononly'
16550 vi='$vi'
16551 voidflags='$voidflags'
16552 xlibpth='$xlibpth'
16553 xs_apiversion='$xs_apiversion'
16554 zcat='$zcat'
16555 zip='$zip'
16556 EOT
16557
16558 : Add in command line options if available
16559 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16560
16561 : add special variables
16562 $test -f $src/patchlevel.h && \
16563 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16564 echo "CONFIGDOTSH=true" >>config.sh
16565
16566 : propagate old symbols
16567 if $test -f UU/config.sh; then
16568         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16569         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16570         $sort | $uniq -u >UU/oldsyms
16571         set X `cat UU/oldsyms`
16572         shift
16573         case $# in
16574         0) ;;
16575         *)
16576                 cat <<EOM
16577 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16578 EOM
16579                 echo "# Variables propagated from previous config.sh file." >>config.sh
16580                 for sym in `cat UU/oldsyms`; do
16581                         echo "    Propagating $hint variable "'$'"$sym..."
16582                         eval 'tmp="$'"${sym}"'"'
16583                         echo "$tmp" | \
16584                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16585                 done
16586                 ;;
16587         esac
16588 fi
16589
16590 : Finish up by extracting the .SH files
16591 case "$alldone" in
16592 exit)
16593         $rm -rf UU
16594         echo "Done."
16595         exit 0
16596         ;;
16597 cont)
16598         ;;
16599 '')
16600         dflt=''
16601         nostick=true
16602         $cat <<EOM
16603
16604 If you'd like to make any changes to the config.sh file before I begin
16605 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16606
16607 EOM
16608         rp="Press return or use a shell escape to edit config.sh:"
16609         . UU/myread
16610         nostick=''
16611         case "$ans" in
16612         '') ;;
16613         *) : in case they cannot read
16614                 sh 1>&4 -c "$ans";;
16615         esac
16616         ;;
16617 esac
16618
16619 : if this fails, just run all the .SH files by hand
16620 . ./config.sh
16621
16622 echo " "
16623 exec 1>&4
16624 . ./UU/extract
16625
16626 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16627         dflt=y
16628         case "$silent" in
16629         true) ;;
16630         *)
16631                 $cat <<EOM
16632
16633 Now you need to generate make dependencies by running "$make depend".
16634 You might prefer to run it in background: "$make depend > makedepend.out &"
16635 It can take a while, so you might not want to run it right now.
16636
16637 EOM
16638                 ;;
16639         esac
16640         rp="Run $make depend now?"
16641         . UU/myread
16642         case "$ans" in
16643         y*)
16644                 $make depend && echo "Now you must run '$make'."
16645                 ;;
16646         *)
16647                 echo "You must run '$make depend' then '$make'."
16648                 ;;
16649         esac
16650 elif test -f [Mm]akefile; then
16651         echo " "
16652         echo "Now you must run a $make."
16653 else
16654         echo "Done."
16655 fi
16656
16657 if $test -f Policy.sh; then
16658     $cat <<EOM
16659
16660 If you compile $package on a different machine or from a different object
16661 directory, copy the Policy.sh file from this object directory to the
16662 new one before you run Configure -- this will help you with most of
16663 the policy defaults.
16664
16665 EOM
16666 fi
16667 if $test -f config.msg; then
16668     echo "Hmm.  I also noted the following information while running:"
16669     echo " "
16670     $cat config.msg >&4
16671     $rm -f config.msg
16672 fi
16673 $rm -f kit*isdone ark*isdone
16674 $rm -rf UU
16675
16676 : End of Configure
16677