ea2b060ea55acbc07eb4d09604472bb2c256d00c
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sun Jan 14 06:37:36 EET 2001 [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_sigprocmask=''
523 d_sigsetjmp=''
524 d_msg_ctrunc=''
525 d_msg_dontroute=''
526 d_msg_oob=''
527 d_msg_peek=''
528 d_msg_proxy=''
529 d_oldsock=''
530 d_scm_rights=''
531 d_socket=''
532 d_sockpair=''
533 sockethdr=''
534 socketlib=''
535 d_socklen_t=''
536 d_socks5_init=''
537 d_sqrtl=''
538 d_statblks=''
539 d_statfs_f_flags=''
540 d_statfs_s=''
541 d_fstatvfs=''
542 d_statvfs=''
543 d_stdio_cnt_lval=''
544 d_stdio_ptr_lval=''
545 d_stdio_ptr_lval_nochange_cnt=''
546 d_stdio_ptr_lval_sets_cnt=''
547 d_stdiobase=''
548 d_stdstdio=''
549 stdio_base=''
550 stdio_bufsiz=''
551 stdio_cnt=''
552 stdio_filbuf=''
553 stdio_ptr=''
554 d_index=''
555 d_strchr=''
556 d_strcoll=''
557 d_strctcpy=''
558 d_strerrm=''
559 d_strerror=''
560 d_sysernlst=''
561 d_syserrlst=''
562 d_strtod=''
563 d_strtol=''
564 d_strtold=''
565 d_strtoll=''
566 d_strtoq=''
567 d_strtoul=''
568 d_strtoull=''
569 d_strtouq=''
570 d_strxfrm=''
571 d_symlink=''
572 d_syscall=''
573 d_sysconf=''
574 d_system=''
575 d_tcgetpgrp=''
576 d_tcsetpgrp=''
577 d_telldirproto=''
578 d_time=''
579 timetype=''
580 clocktype=''
581 d_times=''
582 d_truncate=''
583 d_tzname=''
584 d_umask=''
585 d_semctl_semid_ds=''
586 d_semctl_semun=''
587 d_union_semun=''
588 d_ustat=''
589 d_vfork=''
590 usevfork=''
591 d_voidsig=''
592 signal_t=''
593 d_volatile=''
594 d_charvspr=''
595 d_vprintf=''
596 d_wait4=''
597 d_waitpid=''
598 d_wcstombs=''
599 d_wctomb=''
600 dlext=''
601 cccdlflags=''
602 ccdlflags=''
603 dlsrc=''
604 ld=''
605 lddlflags=''
606 usedl=''
607 doublesize=''
608 ebcdic=''
609 fflushNULL=''
610 fflushall=''
611 fpossize=''
612 fpostype=''
613 gccosandvers=''
614 gccversion=''
615 gidformat=''
616 gidsign=''
617 gidsize=''
618 gidtype=''
619 groupstype=''
620 h_fcntl=''
621 h_sysfile=''
622 i_arpainet=''
623 db_hashtype=''
624 db_prefixtype=''
625 i_db=''
626 i_dbm=''
627 i_rpcsvcdbm=''
628 d_dirnamlen=''
629 direntrytype=''
630 i_dirent=''
631 i_dld=''
632 i_dlfcn=''
633 i_fcntl=''
634 i_features=''
635 i_float=''
636 i_gdbm=''
637 d_grpasswd=''
638 i_grp=''
639 i_iconv=''
640 i_ieeefp=''
641 i_inttypes=''
642 i_libutil=''
643 i_limits=''
644 i_locale=''
645 i_machcthr=''
646 i_malloc=''
647 i_math=''
648 i_memory=''
649 i_mntent=''
650 i_ndbm=''
651 i_netdb=''
652 i_neterrno=''
653 i_netinettcp=''
654 i_niin=''
655 i_sysin=''
656 i_poll=''
657 i_prot=''
658 i_pthread=''
659 d_pwage=''
660 d_pwchange=''
661 d_pwclass=''
662 d_pwcomment=''
663 d_pwexpire=''
664 d_pwgecos=''
665 d_pwpasswd=''
666 d_pwquota=''
667 i_pwd=''
668 i_sfio=''
669 i_shadow=''
670 i_socks=''
671 i_stddef=''
672 i_stdlib=''
673 i_string=''
674 strings=''
675 i_sunmath=''
676 i_sysaccess=''
677 i_sysdir=''
678 i_sysfile=''
679 d_voidtty=''
680 i_bsdioctl=''
681 i_sysfilio=''
682 i_sysioctl=''
683 i_syssockio=''
684 i_syslog=''
685 i_sysmman=''
686 i_sysmode=''
687 i_sysmount=''
688 i_sysndir=''
689 i_sysparam=''
690 i_sysresrc=''
691 i_syssecrt=''
692 i_sysselct=''
693 i_sysstat=''
694 i_sysstatfs=''
695 i_sysstatvfs=''
696 i_systimes=''
697 i_systypes=''
698 i_sysuio=''
699 i_sysun=''
700 i_sysutsname=''
701 i_sysvfs=''
702 i_syswait=''
703 i_sgtty=''
704 i_termio=''
705 i_termios=''
706 i_systime=''
707 i_systimek=''
708 i_time=''
709 timeincl=''
710 i_unistd=''
711 i_ustat=''
712 i_utime=''
713 i_values=''
714 i_stdarg=''
715 i_varargs=''
716 i_varhdr=''
717 i_vfork=''
718 inc_version_list=''
719 inc_version_list_init=''
720 installprefix=''
721 installprefixexp=''
722 installstyle=''
723 installusrbinperl=''
724 intsize=''
725 longsize=''
726 shortsize=''
727 issymlink=''
728 libc=''
729 ldlibpthname=''
730 libperl=''
731 shrpenv=''
732 useshrplib=''
733 glibpth=''
734 libpth=''
735 loclibpth=''
736 plibpth=''
737 xlibpth=''
738 ignore_versioned_solibs=''
739 libs=''
740 libsdirs=''
741 libsfiles=''
742 libsfound=''
743 libspath=''
744 lns=''
745 d_PRIEUldbl=''
746 d_PRIFUldbl=''
747 d_PRIGUldbl=''
748 d_PRIeldbl=''
749 d_PRIfldbl=''
750 d_PRIgldbl=''
751 d_SCNfldbl=''
752 sPRIEUldbl=''
753 sPRIFUldbl=''
754 sPRIGUldbl=''
755 sPRIeldbl=''
756 sPRIfldbl=''
757 sPRIgldbl=''
758 sSCNfldbl=''
759 lseeksize=''
760 lseektype=''
761 make_set_make=''
762 d_mymalloc=''
763 freetype=''
764 mallocobj=''
765 mallocsrc=''
766 malloctype=''
767 usemymalloc=''
768 installman1dir=''
769 man1dir=''
770 man1direxp=''
771 man1ext=''
772 installman3dir=''
773 man3dir=''
774 man3direxp=''
775 man3ext=''
776 modetype=''
777 multiarch=''
778 mydomain=''
779 myhostname=''
780 phostname=''
781 c=''
782 n=''
783 d_eofnblk=''
784 eagain=''
785 o_nonblock=''
786 rd_nodata=''
787 need_va_copy=''
788 netdb_hlen_type=''
789 netdb_host_type=''
790 netdb_name_type=''
791 netdb_net_type=''
792 groupcat=''
793 hostcat=''
794 passcat=''
795 orderlib=''
796 ranlib=''
797 d_perl_otherlibdirs=''
798 otherlibdirs=''
799 package=''
800 spackage=''
801 pager=''
802 api_revision=''
803 api_subversion=''
804 api_version=''
805 api_versionstring=''
806 patchlevel=''
807 revision=''
808 subversion=''
809 version=''
810 perl5=''
811 perladmin=''
812 perlpath=''
813 d_nv_preserves_uv=''
814 d_nv_preserves_uv_bits=''
815 i16size=''
816 i16type=''
817 i32size=''
818 i32type=''
819 i64size=''
820 i64type=''
821 i8size=''
822 i8type=''
823 ivsize=''
824 ivtype=''
825 nvsize=''
826 nvtype=''
827 u16size=''
828 u16type=''
829 u32size=''
830 u32type=''
831 u64size=''
832 u64type=''
833 u8size=''
834 u8type=''
835 uvsize=''
836 uvtype=''
837 ivdformat=''
838 nvEUformat=''
839 nvFUformat=''
840 nvGUformat=''
841 nveformat=''
842 nvfformat=''
843 nvgformat=''
844 uvXUformat=''
845 uvoformat=''
846 uvuformat=''
847 uvxformat=''
848 pidtype=''
849 prefix=''
850 prefixexp=''
851 installprivlib=''
852 privlib=''
853 privlibexp=''
854 prototype=''
855 ptrsize=''
856 d_PRIXU64=''
857 d_PRId64=''
858 d_PRIi64=''
859 d_PRIo64=''
860 d_PRIu64=''
861 d_PRIx64=''
862 sPRIXU64=''
863 sPRId64=''
864 sPRIi64=''
865 sPRIo64=''
866 sPRIu64=''
867 sPRIx64=''
868 d_quad=''
869 quadkind=''
870 quadtype=''
871 uquadtype=''
872 drand01=''
873 randbits=''
874 randfunc=''
875 randseedtype=''
876 seedfunc=''
877 installscript=''
878 scriptdir=''
879 scriptdirexp=''
880 selectminbits=''
881 selecttype=''
882 sh=''
883 sig_count=''
884 sig_name=''
885 sig_name_init=''
886 sig_num=''
887 sig_num_init=''
888 installsitearch=''
889 sitearch=''
890 sitearchexp=''
891 installsitebin=''
892 sitebin=''
893 sitebinexp=''
894 installsitelib=''
895 sitelib=''
896 sitelib_stem=''
897 sitelibexp=''
898 siteprefix=''
899 siteprefixexp=''
900 sizesize=''
901 sizetype=''
902 so=''
903 socksizetype=''
904 sharpbang=''
905 shsharp=''
906 spitshell=''
907 src=''
908 ssizetype=''
909 startperl=''
910 startsh=''
911 stdchar=''
912 d_stdio_stream_array=''
913 stdio_stream_array=''
914 sysman=''
915 trnl=''
916 uidformat=''
917 uidsign=''
918 uidsize=''
919 uidtype=''
920 archname64=''
921 use64bitall=''
922 use64bitint=''
923 ccflags_uselargefiles=''
924 ldflags_uselargefiles=''
925 libswanted_uselargefiles=''
926 uselargefiles=''
927 uselongdouble=''
928 usemorebits=''
929 usemultiplicity=''
930 nm_opt=''
931 nm_so_opt=''
932 runnm=''
933 usenm=''
934 useperlio=''
935 usesocks=''
936 d_oldpthreads=''
937 use5005threads=''
938 useithreads=''
939 usethreads=''
940 incpath=''
941 mips_type=''
942 usrinc=''
943 d_vendorarch=''
944 installvendorarch=''
945 vendorarch=''
946 vendorarchexp=''
947 d_vendorbin=''
948 installvendorbin=''
949 vendorbin=''
950 vendorbinexp=''
951 d_vendorlib=''
952 installvendorlib=''
953 vendorlib=''
954 vendorlib_stem=''
955 vendorlibexp=''
956 usevendorprefix=''
957 vendorprefix=''
958 vendorprefixexp=''
959 versiononly=''
960 defvoidused=''
961 voidflags=''
962 pm_apiversion=''
963 xs_apiversion=''
964 CONFIG=''
965
966 define='define'
967 undef='undef'
968 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
969 rmlist=''
970
971 : We must find out about Eunice early
972 eunicefix=':'
973 if test -f /etc/unixtovms; then
974         eunicefix=/etc/unixtovms
975 fi
976 if test -f /etc/unixtovms.exe; then
977         eunicefix=/etc/unixtovms.exe
978 fi
979
980 i_whoami=''
981 ccname=''
982 ccversion=''
983 perllibs=''
984 : set useposix=false in your hint file to disable the POSIX extension.
985 useposix=true
986 : set useopcode=false in your hint file to disable the Opcode extension.
987 useopcode=true
988 : Trailing extension.  Override this in a hint file, if needed.
989 _exe=''
990 : Extra object files, if any, needed on this platform.
991 archobjs=''
992 archname=''
993 : Possible local include directories to search.
994 : Set locincpth to "" in a hint file to defeat local include searches.
995 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
996 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
997 :
998 : no include file wanted by default
999 inclwanted=''
1000
1001 groupstype=''
1002 : change the next line if compiling for Xenix/286 on Xenix/386
1003 xlibpth='/usr/lib/386 /lib/386'
1004 : Possible local library directories to search.
1005 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1006 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1007
1008 : general looking path for locating libraries
1009 glibpth="/lib /usr/lib $xlibpth"
1010 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1011 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1012 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1013
1014 : Private path used by Configure to find libraries.  Its value
1015 : is prepended to libpth. This variable takes care of special
1016 : machines, like the mips.  Usually, it should be empty.
1017 plibpth=''
1018
1019 : default library list
1020 libswanted=''
1021 : some systems want to use only the non-versioned libso:s
1022 ignore_versioned_solibs=''
1023 archname64=''
1024 ccflags_uselargefiles=''
1025 ldflags_uselargefiles=''
1026 libswanted_uselargefiles=''
1027 : set usemultiplicity on the Configure command line to enable multiplicity.
1028 : set usesocks on the Configure command line to enable socks.
1029 : set usethreads on the Configure command line to enable threads.
1030 : full support for void wanted by default
1031 defvoidused=15
1032
1033 : List of libraries we want.
1034 : If anyone needs -lnet, put it in a hint file.
1035 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1036 libswanted="$libswanted dld ld sun m c cposix posix"
1037 libswanted="$libswanted ndir dir crypt sec"
1038 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1039 : We probably want to search /usr/shlib before most other libraries.
1040 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1041 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1042 glibpth="/usr/shlib $glibpth"
1043 : Do not use vfork unless overridden by a hint file.
1044 usevfork=false
1045
1046 : Find the basic shell for Bourne shell scripts
1047 case "$sh" in
1048 '')
1049         case "$SYSTYPE" in
1050         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1051         *) xxx='/bin/sh';;
1052         esac
1053         if test -f "$xxx"; then
1054                 sh="$xxx"
1055         else
1056                 : Build up a list and do a single loop so we can 'break' out.
1057                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1058                 for xxx in sh bash ksh pdksh ash; do
1059                         for p in $pth; do
1060                                 try="$try ${p}/${xxx}"
1061                         done
1062                 done
1063                 for xxx in $try; do
1064                         if test -f "$xxx"; then
1065                                 sh="$xxx";
1066                                 break
1067                         elif test -f "$xxx.exe"; then
1068                                 sh="$xxx";
1069                                 break
1070                         fi
1071                 done
1072         fi
1073         ;;
1074 esac
1075
1076 case "$sh" in
1077 '')     cat <<EOM >&2
1078 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1079
1080 Usually it's in /bin/sh.  How did you even get this far?
1081 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1082 we'll try to straighten this all out.
1083 EOM
1084         exit 1
1085         ;;
1086 esac
1087
1088 : see if sh knows # comments
1089 if `$sh -c '#' >/dev/null 2>&1`; then
1090         shsharp=true
1091         spitshell=cat
1092         xcat=/bin/cat
1093         test -f $xcat || xcat=/usr/bin/cat
1094         echo "#!$xcat" >try
1095         $eunicefix try
1096         chmod +x try
1097         ./try > today
1098         if test -s today; then
1099                 sharpbang='#!'
1100         else
1101                 echo "#! $xcat" > try
1102                 $eunicefix try
1103                 chmod +x try
1104                 ./try > today
1105                 if test -s today; then
1106                         sharpbang='#! '
1107                 else
1108                         sharpbang=': use '
1109                 fi
1110         fi
1111 else
1112         echo " "
1113         echo "Your $sh doesn't grok # comments--I will strip them later on."
1114         shsharp=false
1115         cd ..
1116         echo "exec grep -v '^[  ]*#'" >spitshell
1117         chmod +x spitshell
1118         $eunicefix spitshell
1119         spitshell=`pwd`/spitshell
1120         cd UU
1121         echo "I presume that if # doesn't work, #! won't work either!"
1122         sharpbang=': use '
1123 fi
1124 rm -f try today
1125
1126 : figure out how to guarantee sh startup
1127 case "$startsh" in
1128 '') startsh=${sharpbang}${sh} ;;
1129 *)
1130 esac
1131 cat >try <<EOSS
1132 $startsh
1133 set abc
1134 test "$?abc" != 1
1135 EOSS
1136
1137 chmod +x try
1138 $eunicefix try
1139 if ./try; then
1140         : echo "Yup, it does."
1141 else
1142         echo "Hmm... '$startsh' does not guarantee sh startup..."
1143         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1144 fi
1145 rm -f try
1146
1147
1148 : Save command line options in file UU/cmdline.opt for later use in
1149 : generating config.sh.
1150 cat > cmdline.opt <<EOSH
1151 # Configure command line arguments.
1152 config_arg0='$0'
1153 config_args='$*'
1154 config_argc=$#
1155 EOSH
1156 argn=1
1157 for arg in "$@"; do
1158         cat >>cmdline.opt <<EOSH
1159 config_arg$argn='$arg'
1160 EOSH
1161         argn=`expr $argn + 1`
1162 done
1163
1164 : produce awk script to parse command line options
1165 cat >options.awk <<'EOF'
1166 BEGIN {
1167         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1168
1169         len = length(optstr);
1170         for (i = 1; i <= len; i++) {
1171                 c = substr(optstr, i, 1);
1172                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1173                 if (a == ":") {
1174                         arg[c] = 1;
1175                         i++;
1176                 }
1177                 opt[c] = 1;
1178         }
1179 }
1180 {
1181         expect = 0;
1182         str = $0;
1183         if (substr(str, 1, 1) != "-") {
1184                 printf("'%s'\n", str);
1185                 next;
1186         }
1187         len = length($0);
1188         for (i = 2; i <= len; i++) {
1189                 c = substr(str, i, 1);
1190                 if (!opt[c]) {
1191                         printf("-%s\n", substr(str, i));
1192                         next;
1193                 }
1194                 printf("-%s\n", c);
1195                 if (arg[c]) {
1196                         if (i < len)
1197                                 printf("'%s'\n", substr(str, i + 1));
1198                         else
1199                                 expect = 1;
1200                         next;
1201                 }
1202         }
1203 }
1204 END {
1205         if (expect)
1206                 print "?";
1207 }
1208 EOF
1209
1210 : process the command line options
1211 set X `for arg in "$@"; do echo "X$arg"; done |
1212         sed -e s/X// | awk -f options.awk`
1213 eval "set $*"
1214 shift
1215 rm -f options.awk
1216
1217 : set up default values
1218 fastread=''
1219 reuseval=false
1220 config_sh=''
1221 alldone=''
1222 error=''
1223 silent=''
1224 extractsh=''
1225 override=''
1226 knowitall=''
1227 rm -f optdef.sh posthint.sh
1228 cat >optdef.sh <<EOS
1229 $startsh
1230 EOS
1231
1232
1233 : option parsing
1234 while test $# -gt 0; do
1235         case "$1" in
1236         -d) shift; fastread=yes;;
1237         -e) shift; alldone=cont;;
1238         -f)
1239                 shift
1240                 cd ..
1241                 if test -r "$1"; then
1242                         config_sh="$1"
1243                 else
1244                         echo "$me: cannot read config file $1." >&2
1245                         error=true
1246                 fi
1247                 cd UU
1248                 shift;;
1249         -h) shift; error=true;;
1250         -r) shift; reuseval=true;;
1251         -s) shift; silent=true; realsilent=true;;
1252         -E) shift; alldone=exit;;
1253         -K) shift; knowitall=true;;
1254         -O) shift; override=true;;
1255         -S) shift; silent=true; extractsh=true;;
1256         -D)
1257                 shift
1258                 case "$1" in
1259                 *=)
1260                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1261                         echo "$me: ignoring -D $1" >&2
1262                         ;;
1263                 *=*) echo "$1" | \
1264                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1265                 *) echo "$1='define'" >> optdef.sh;;
1266                 esac
1267                 shift
1268                 ;;
1269         -U)
1270                 shift
1271                 case "$1" in
1272                 *=) echo "$1" >> optdef.sh;;
1273                 *=*)
1274                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1275                         echo "$me: ignoring -U $1" >&2
1276                         ;;
1277                 *) echo "$1='undef'" >> optdef.sh;;
1278                 esac
1279                 shift
1280                 ;;
1281         -A)
1282             shift
1283             xxx=''
1284             yyy="$1"
1285             zzz=''
1286             uuu=undef
1287             case "$yyy" in
1288             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1289                  case "$zzz" in
1290                  *:*) zzz='' ;;
1291                  *)   xxx=append
1292                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1293                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1294                  esac
1295                  ;;
1296             esac
1297             case "$xxx" in
1298             '')  case "$yyy" in
1299                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1300                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1301                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1302                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1303                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1304                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1305                  esac
1306                  ;;       
1307             esac
1308             case "$xxx" in
1309             append)
1310                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1311             clear)
1312                 echo "$yyy=''"                  >> posthint.sh ;;
1313             define)
1314                 case "$zzz" in
1315                 '') zzz=define ;;
1316                 esac
1317                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1318             eval)
1319                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1320             prepend)
1321                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1322             undef)
1323                 case "$zzz" in
1324                 '') zzz="$uuu" ;;
1325                 esac
1326                 echo "$yyy=$zzz"                >> posthint.sh ;;
1327             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1328             esac
1329             shift
1330             ;;
1331         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1332             exit 0;;
1333         --) break;;
1334         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1335         *) break;;
1336         esac
1337 done
1338
1339 case "$error" in
1340 true)
1341         cat >&2 <<EOM
1342 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1343                  [-U symbol] [-U symbol=] [-A command:symbol...]
1344   -d : use defaults for all answers.
1345   -e : go on without questioning past the production of config.sh.
1346   -f : specify an alternate default configuration file.
1347   -h : print this help message and exit (with an error status).
1348   -r : reuse C symbols value if possible (skips costly nm extraction).
1349   -s : silent mode, only echoes questions and essential information.
1350   -D : define symbol to have some value:
1351          -D symbol         symbol gets the value 'define'
1352          -D symbol=value   symbol gets the value 'value'
1353   -E : stop at the end of questions, after having produced config.sh.
1354   -K : do not use unless you know what you are doing.
1355   -O : let -D and -U override definitions from loaded configuration file.
1356   -S : perform variable substitutions on all .SH files (can mix with -f)
1357   -U : undefine symbol:
1358          -U symbol    symbol gets the value 'undef'
1359          -U symbol=   symbol gets completely empty
1360   -A : manipulate symbol after the platform specific hints have been applied:
1361          -A symbol=value                append " "value to symbol
1362          -A append:symbol=value         append value to symbol
1363          -A define:symbol=value         define symbol to have value
1364          -A clear:symbol                define symbol to be ''
1365          -A define:symbol               define symbol to be 'define'
1366          -A eval:symbol=value           define symbol to be eval of value
1367          -A prepend:symbol=value        prepend value to symbol
1368          -A undef:symbol                define symbol to be 'undef'
1369          -A undef:symbol=               define symbol to be ''
1370   -V : print version number and exit (with a zero status).
1371 EOM
1372         exit 1
1373         ;;
1374 esac
1375
1376 : Sanity checks
1377 case "$fastread$alldone" in
1378 yescont|yesexit) ;;
1379 *)
1380         case "$extractsh" in
1381         true) ;;
1382         *)
1383                 if test ! -t 0; then
1384                         echo "Say 'sh Configure', not 'sh <Configure'"
1385                         exit 1
1386                 fi
1387                 ;;
1388         esac
1389         ;;
1390 esac
1391
1392 exec 4>&1
1393 case "$silent" in
1394 true) exec 1>/dev/null;;
1395 esac
1396
1397 : run the defines and the undefines, if any, but leave the file out there...
1398 touch optdef.sh
1399 . ./optdef.sh
1400 : create the posthint manipulation script and leave the file out there...
1401 touch posthint.sh
1402
1403 : set package name
1404 package=perl5
1405 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1406 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1407 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1408 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1409 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1410 esac
1411
1412 : Some greps do not return status, grrr.
1413 echo "grimblepritz" >grimble
1414 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1415         contains=contains
1416 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1417         contains=grep
1418 else
1419         contains=contains
1420 fi
1421 rm -f grimble
1422 : the following should work in any shell
1423 case "$contains" in
1424 contains*)
1425         echo " "
1426         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1427         cat >contains <<'EOSS'
1428 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1429 EOSS
1430 chmod +x contains
1431 esac
1432
1433 : Find the path to the source tree
1434 case "$src" in
1435 '') case "$0" in
1436     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1437          case "$src" in
1438          /*)    ;;
1439          .)     ;;
1440          *)     src=`cd ../$src && pwd` ;;
1441          esac
1442          ;;
1443     *)   src='.';;
1444     esac;;
1445 esac
1446 case "$src" in
1447 '')     src=/
1448         rsrc=/
1449         ;;
1450 /*) rsrc="$src";;
1451 *) rsrc="../$src";;
1452 esac
1453 if test -f $rsrc/Configure && \
1454         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1455 then
1456    : found it, so we are ok.
1457 else
1458         rsrc=''
1459         for src in . .. ../.. ../../.. ../../../..; do
1460                 if test -f ../$src/Configure && \
1461                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1462                 then
1463                         rsrc=../$src
1464                         break
1465                 fi
1466         done
1467 fi
1468 case "$rsrc" in
1469 '')
1470         cat <<EOM >&4
1471
1472 Sorry, I can't seem to locate the source dir for $package.  Please start
1473 Configure with an explicit path -- i.e. /some/path/Configure.
1474
1475 EOM
1476         exit 1
1477         ;;
1478 ../.)   rsrc='..';;
1479 *)
1480         echo " "
1481         echo "Sources for $package found in \"$src\"." >&4
1482         ;;
1483 esac
1484
1485 : script used to extract .SH files with variable substitutions
1486 cat >extract <<'EOS'
1487 CONFIGDOTSH=true
1488 echo "Doing variable substitutions on .SH files..."
1489 if test -f $src/MANIFEST; then
1490         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1491 else
1492         echo "(Looking for .SH files under the source directory.)"
1493         set x `(cd $src; find . -name "*.SH" -print)`
1494 fi
1495 shift
1496 case $# in
1497 0) set x `(cd $src; echo *.SH)`; shift;;
1498 esac
1499 if test ! -f $src/$1; then
1500         shift
1501 fi
1502 mkdir_p='
1503 name=$1;
1504 create="";
1505 while test $name; do
1506         if test ! -d "$name"; then
1507                 create="$name $create";
1508                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1509                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1510         else
1511                 name="";
1512         fi;
1513 done;
1514 for file in $create; do
1515         mkdir $file;
1516 done
1517 '
1518 for file in $*; do
1519         case "$src" in
1520         ".")
1521                 case "$file" in
1522                 */*)
1523                         dir=`expr X$file : 'X\(.*\)/'`
1524                         file=`expr X$file : 'X.*/\(.*\)'`
1525                         (cd $dir && . ./$file)
1526                         ;;
1527                 *)
1528                         . ./$file
1529                         ;;
1530                 esac
1531                 ;;
1532         *)
1533                 case "$file" in
1534                 */*)
1535                         dir=`expr X$file : 'X\(.*\)/'`
1536                         file=`expr X$file : 'X.*/\(.*\)'`
1537                         (set x $dir; shift; eval $mkdir_p)
1538                         sh <$src/$dir/$file
1539                         ;;
1540                 *)
1541                         sh <$src/$file
1542                         ;;
1543                 esac
1544                 ;;
1545         esac
1546 done
1547 if test -f $src/config_h.SH; then
1548         if test ! -f config.h; then
1549         : oops, they left it out of MANIFEST, probably, so do it anyway.
1550         . $src/config_h.SH
1551         fi
1552 fi
1553 EOS
1554
1555 : extract files and exit if asked to do so
1556 case "$extractsh" in
1557 true)
1558         case "$realsilent" in
1559         true) ;;
1560         *) exec 1>&4;;
1561         esac
1562         case "$config_sh" in
1563         '') config_sh='config.sh';;
1564         esac
1565         echo " "
1566         echo "Fetching answers from $config_sh..."
1567         cd ..
1568         . $config_sh
1569         test "$override" && . ./optdef.sh
1570         echo " "
1571         . UU/extract
1572         rm -rf UU
1573         echo "Done."
1574         exit 0
1575         ;;
1576 esac
1577
1578 : Eunice requires " " instead of "", can you believe it
1579 echo " "
1580 : Here we go...
1581 echo "Beginning of configuration questions for $package."
1582
1583 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1584
1585 : first determine how to suppress newline on echo command
1586 echo " "
1587 echo "Checking echo to see how to suppress newlines..."
1588 (echo "hi there\c" ; echo " ") >.echotmp
1589 if $contains c .echotmp >/dev/null 2>&1 ; then
1590         echo "...using -n."
1591         n='-n'
1592         c=''
1593 else
1594         cat <<'EOM'
1595 ...using \c
1596 EOM
1597         n=''
1598         c='\c'
1599 fi
1600 echo $n "The star should be here-->$c"
1601 echo '*'
1602 rm -f .echotmp
1603
1604 : Now test for existence of everything in MANIFEST
1605 echo " "
1606 if test -f $rsrc/MANIFEST; then
1607         echo "First let's make sure your kit is complete.  Checking..." >&4
1608         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1609         rm -f missing
1610         tmppwd=`pwd`
1611         for filelist in x??; do
1612                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1613         done
1614         if test -s missing; then
1615                 cat missing >&4
1616                 cat >&4 <<'EOM'
1617
1618 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1619
1620 You have the option of continuing the configuration process, despite the
1621 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1622 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1623 and contact the author (perlbug@perl.org).
1624
1625 EOM
1626                 echo $n "Continue? [n] $c" >&4
1627                 read ans
1628                 case "$ans" in
1629                 y*)
1630                         echo "Continuing..." >&4
1631                         rm -f missing
1632                         ;;
1633                 *)
1634                         echo "ABORTING..." >&4
1635                         kill $$
1636                         ;;
1637                 esac
1638         else
1639                 echo "Looks good..."
1640         fi
1641 else
1642         echo "There is no MANIFEST file.  I hope your kit is complete !"
1643 fi
1644 rm -f missing x??
1645
1646 echo " "
1647 : Find the appropriate value for a newline for tr
1648 if test -n "$DJGPP"; then
1649        trnl='\012'
1650 fi
1651 if test X"$trnl" = X; then
1652         case "`echo foo|tr '\n' x 2>/dev/null`" in
1653         foox) trnl='\n' ;;
1654         esac
1655 fi
1656 if test X"$trnl" = X; then
1657         case "`echo foo|tr '\012' x 2>/dev/null`" in
1658         foox) trnl='\012' ;;
1659         esac
1660 fi
1661 if test X"$trnl" = X; then
1662         cat <<EOM >&2
1663
1664 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1665
1666 EOM
1667         exit 1
1668 fi
1669
1670 : compute the number of columns on the terminal for proper question formatting
1671 case "$COLUMNS" in
1672 '') COLUMNS='80';;
1673 esac
1674
1675 : set up the echo used in my read
1676 myecho="case \"\$xxxm\" in
1677 '') echo $n \"\$rp $c\" >&4;;
1678 *) case \"\$rp\" in
1679         '') echo $n \"[\$xxxm] $c\";;
1680         *)
1681                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1682                         echo \"\$rp\" >&4
1683                         echo $n \"[\$xxxm] $c\" >&4
1684                 else
1685                         echo $n \"\$rp [\$xxxm] $c\" >&4
1686                 fi
1687                 ;;
1688         esac;;
1689 esac"
1690
1691 : now set up to do reads with possible shell escape and default assignment
1692 cat <<EOSC >myread
1693 $startsh
1694 xxxm=\$dflt
1695 $myecho
1696 ans='!'
1697 case "\$fastread" in
1698 yes) case "\$dflt" in
1699         '') ;;
1700         *) ans='';
1701                 case "\$silent-\$rp" in
1702                 true-) ;;
1703                 *) echo " " >&4;;
1704                 esac;;
1705         esac;;
1706 *) case "\$silent" in
1707         true) case "\$rp" in
1708                 '') ans='';;
1709                 esac;;
1710         esac;;
1711 esac
1712 while expr "X\$ans" : "X!" >/dev/null; do
1713         read answ
1714         set x \$xxxm
1715         shift
1716         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1717         case  "\$answ" in
1718         "!")
1719                 sh 1>&4
1720                 echo " "
1721                 $myecho
1722                 ;;
1723         !*)
1724                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1725                 shift
1726                 sh 1>&4 -c "\$*"
1727                 echo " "
1728                 $myecho
1729                 ;;
1730         "\$ans")
1731                 case "\$ans" in
1732                 \\&*)
1733                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1734                         shift
1735                         case "\$1" in
1736                         -d)
1737                                 fastread=yes
1738                                 echo "(OK, I'll run with -d after this question.)" >&4
1739                                 ;;
1740                         -*)
1741                                 echo "*** Sorry, \$1 not supported yet." >&4
1742                                 ;;
1743                         esac
1744                         $myecho
1745                         ans=!
1746                         ;;
1747                 esac;;
1748         *)
1749                 case "\$aok" in
1750                 y)
1751                         echo "*** Substitution done -- please confirm."
1752                         xxxm="\$ans"
1753                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1754                         xxxm="\$ans"
1755                         ans=!
1756                         ;;
1757                 *)
1758                         echo "*** Error -- try again."
1759                         ans=!
1760                         ;;
1761                 esac
1762                 $myecho
1763                 ;;
1764         esac
1765         case "\$ans\$xxxm\$nostick" in
1766         '')
1767                 ans=!
1768                 $myecho
1769                 ;;
1770         esac
1771 done
1772 case "\$ans" in
1773 '') ans="\$xxxm";;
1774 esac
1775 EOSC
1776
1777 : create .config dir to save info across Configure sessions
1778 test -d ../.config || mkdir ../.config
1779 cat >../.config/README <<EOF
1780 This directory created by Configure to save information that should
1781 persist across sessions for $package.
1782
1783 You may safely delete it if you wish.
1784 EOF
1785
1786 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1787 case "$usedevel" in
1788 $define|true|[yY]*) ;;
1789 *) case "$xversion" in
1790    *[13579])
1791         cat >&4 <<EOH
1792 *** WHOA THERE!!! ***
1793
1794     This is an UNSTABLE DEVELOPMENT release.
1795     The version of this $package distribution is $xversion, that is, odd,
1796     (as opposed to even) and that signifies a development release.
1797     If you want a maintenance release, you want an even-numbered version.
1798
1799     Do ***NOT*** install this into production use.
1800     Data corruption and crashes are possible.
1801
1802     It is most seriously suggested that you do not continue any further
1803     unless you want to help in developing and debugging Perl.
1804
1805 EOH
1806         rp='Do you really want to continue?'
1807         dflt='n'
1808         . ./myread
1809         case "$ans" in
1810         [yY]) echo >&4 "Okay, continuing." ;;
1811         *) echo >&4 "Okay, bye."
1812            exit 1
1813            ;;
1814         esac
1815         ;;
1816     esac
1817     ;;
1818 esac
1819
1820 : general instructions
1821 needman=true
1822 firsttime=true
1823 user=`(logname) 2>/dev/null`
1824 case "$user" in
1825 '') user=`whoami 2>&1`;;
1826 esac
1827 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1828         firsttime=false
1829         echo " "
1830         rp='Would you like to see the instructions?'
1831         dflt=n
1832         . ./myread
1833         case "$ans" in
1834         [yY]*) ;;
1835         *) needman=false;;
1836         esac
1837 fi
1838 if $needman; then
1839         cat <<EOH
1840
1841 This installation shell script will examine your system and ask you questions
1842 to determine how the perl5 package should be installed. If you get
1843 stuck on a question, you may use a ! shell escape to start a subshell or
1844 execute a command.  Many of the questions will have default answers in square
1845 brackets; typing carriage return will give you the default.
1846
1847 On some of the questions which ask for file or directory names you are allowed
1848 to use the ~name construct to specify the login directory belonging to "name",
1849 even if you don't have a shell which knows about that.  Questions where this is
1850 allowed will be marked "(~name ok)".
1851
1852 EOH
1853         rp=''
1854         dflt='Type carriage return to continue'
1855         . ./myread
1856         cat <<'EOH'
1857
1858 The prompter used in this script allows you to use shell variables and
1859 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1860 in the default answer, as if the default line was a set of arguments given to a
1861 script shell.  This means you may also use $* to repeat the whole default line,
1862 so you do not have to re-type everything to add something to the default.
1863
1864 Everytime there is a substitution, you will have to confirm.  If there is an
1865 error (e.g. an unmatched backtick), the default answer will remain unchanged
1866 and you will be prompted again.
1867
1868 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1869 the questions and use the computed defaults (or the previous answers if there
1870 was already a config.sh file). Type 'Configure -h' for a list of options.
1871 You may also start interactively and then answer '& -d' at any prompt to turn
1872 on the non-interactive behaviour for the remainder of the execution.
1873
1874 EOH
1875         . ./myread
1876         cat <<EOH
1877
1878 Much effort has been expended to ensure that this shell script will run on any
1879 Unix system.  If despite that it blows up on yours, your best bet is to edit
1880 Configure and run it again.  If you can't run Configure for some reason,
1881 you'll have to generate a config.sh file by hand.  Whatever problems you
1882 have, let me (perlbug@perl.org) know how I blew it.
1883
1884 This installation script affects things in two ways:
1885
1886 1) it may do direct variable substitutions on some of the files included
1887    in this kit.
1888 2) it builds a config.h file for inclusion in C programs.  You may edit
1889    any of these files as the need arises after running this script.
1890
1891 If you make a mistake on a question, there is no easy way to back up to it
1892 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1893 files.  Configure will offer to let you do this before it runs the SH files.
1894
1895 EOH
1896         dflt='Type carriage return to continue'
1897         . ./myread
1898         case "$firsttime" in
1899         true) echo $user >>../.config/instruct;;
1900         esac
1901 fi
1902
1903 : find out where common programs are
1904 echo " "
1905 echo "Locating common programs..." >&4
1906 cat <<EOSC >loc
1907 $startsh
1908 case \$# in
1909 0) exit 1;;
1910 esac
1911 thing=\$1
1912 shift
1913 dflt=\$1
1914 shift
1915 for dir in \$*; do
1916         case "\$thing" in
1917         .)
1918         if test -d \$dir/\$thing; then
1919                 echo \$dir
1920                 exit 0
1921         fi
1922         ;;
1923         *)
1924         for thisthing in \$dir/\$thing; do
1925                 : just loop through to pick last item
1926         done
1927         if test -f \$thisthing; then
1928                 echo \$thisthing
1929                 exit 0
1930         elif test -f \$dir/\$thing.exe; then
1931                 if test -n "$DJGPP"; then
1932                         echo \$dir/\$thing.exe
1933                 else
1934                         : on Eunice apparently
1935                         echo \$dir/\$thing
1936                 fi
1937                 exit 0
1938         fi
1939         ;;
1940         esac
1941 done
1942 echo \$dflt
1943 exit 1
1944 EOSC
1945 chmod +x loc
1946 $eunicefix loc
1947 loclist="
1948 awk
1949 cat
1950 comm
1951 cp
1952 echo
1953 expr
1954 grep
1955 ls
1956 make
1957 mkdir
1958 rm
1959 sed
1960 sort
1961 touch
1962 tr
1963 uniq
1964 "
1965 trylist="
1966 Mcc
1967 ar
1968 byacc
1969 cpp
1970 csh
1971 date
1972 egrep
1973 gzip
1974 less
1975 ln
1976 more
1977 nm
1978 nroff
1979 pg
1980 test
1981 uname
1982 zip
1983 "
1984 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1985 pth="$pth /lib /usr/lib"
1986 for file in $loclist; do
1987         eval xxx=\$$file
1988         case "$xxx" in
1989         /*|?:[\\/]*)
1990                 if test -f "$xxx"; then
1991                         : ok
1992                 else
1993                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1994                         xxx=`./loc $file $file $pth`
1995                 fi
1996                 ;;
1997         '') xxx=`./loc $file $file $pth`;;
1998         *) xxx=`./loc $xxx $xxx $pth`;;
1999         esac
2000         eval $file=$xxx
2001         eval _$file=$xxx
2002         case "$xxx" in
2003         /*)
2004                 echo $file is in $xxx.
2005                 ;;
2006         ?:[\\/]*)
2007                 echo $file is in $xxx.
2008                 ;;
2009         *)
2010                 echo "I don't know where '$file' is, and my life depends on it." >&4
2011                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2012                 exit 1
2013                 ;;
2014         esac
2015 done
2016 echo " "
2017 echo "Don't worry if any of the following aren't found..."
2018 say=offhand
2019 for file in $trylist; do
2020         eval xxx=\$$file
2021         case "$xxx" in
2022         /*|?:[\\/]*)
2023                 if test -f "$xxx"; then
2024                         : ok
2025                 else
2026                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2027                         xxx=`./loc $file $file $pth`
2028                 fi
2029                 ;;
2030         '') xxx=`./loc $file $file $pth`;;
2031         *) xxx=`./loc $xxx $xxx $pth`;;
2032         esac
2033         eval $file=$xxx
2034         eval _$file=$xxx
2035         case "$xxx" in
2036         /*)
2037                 echo $file is in $xxx.
2038                 ;;
2039         ?:[\\/]*)
2040                 echo $file is in $xxx.
2041                 ;;
2042         *)
2043                 echo "I don't see $file out there, $say."
2044                 say=either
2045                 ;;
2046         esac
2047 done
2048 case "$egrep" in
2049 egrep)
2050         echo "Substituting grep for egrep."
2051         egrep=$grep
2052         ;;
2053 esac
2054 case "$ln" in
2055 ln)
2056         echo "Substituting cp for ln."
2057         ln=$cp
2058         ;;
2059 esac
2060 case "$test" in
2061 test)
2062         echo "Hopefully test is built into your sh."
2063         ;;
2064 *)
2065         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2066                 echo "Using the test built into your sh."
2067                 echo "Using the test built into your sh."
2068                 test=test
2069                 _test=test
2070         fi
2071         ;;
2072 esac
2073 case "$echo" in
2074 echo)
2075         echo "Hopefully echo is built into your sh."
2076         ;;
2077 '') ;;
2078 *)
2079         echo " "
2080 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2081         $echo $n "hi there$c" >foo1
2082         echo $n "hi there$c" >foo2
2083         if cmp foo1 foo2 >/dev/null 2>&1; then
2084                 echo "They are compatible.  In fact, they may be identical."
2085         else
2086                 case "$n" in
2087                 '-n') n='' c='\c';;
2088                 *) n='-n' c='';;
2089                 esac
2090                 cat <<FOO
2091 They are not compatible!  You are probably running ksh on a non-USG system.
2092 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2093 have echo built in and we may have to run some Bourne shell scripts.  That
2094 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2095
2096 FOO
2097                 $echo $n "The star should be here-->$c"
2098                 $echo "*"
2099         fi
2100         $rm -f foo1 foo2
2101         ;;
2102 esac
2103
2104 cat <<EOS >checkcc
2105 $startsh
2106 EOS
2107 cat <<'EOSC' >>checkcc
2108 case "$cc" in
2109 '') ;;
2110 *)  $rm -f try try.*
2111     $cat >try.c <<EOM
2112 int main(int argc, char *argv[]) {
2113   return 0;
2114 }
2115 EOM
2116     if $cc -o try $ccflags try.c; then
2117        :
2118     else
2119         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2120         despair=yes
2121         trygcc=yes
2122         case "$cc" in
2123         *gcc*) trygcc=no ;;
2124         esac
2125         case "`$cc -v -c try.c 2>&1`" in
2126         *gcc*) trygcc=no ;;
2127         esac
2128         if $test X"$trygcc" = Xyes; then
2129             if gcc -o try -c try.c; then
2130                 echo " "
2131                 echo "You seem to have a working gcc, though." >&4
2132                 rp="Would you like to use it?"
2133                 dflt=y
2134                 if $test -f myread; then
2135                     . ./myread
2136                 else
2137                     if $test -f UU/myread; then
2138                         . ./UU/myread
2139                     else
2140                         echo "Cannot find myread, sorry.  Aborting." >&2
2141                         exit 1
2142                     fi
2143                 fi  
2144                 case "$ans" in
2145                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2146                 esac
2147             fi
2148         fi
2149         if $test X"$despair" = Xyes; then
2150             $cat >&4 <<EOM
2151 You need to find a working C compiler.
2152 Either (purchase and) install the C compiler supplied by your OS vendor,
2153 or for a free C compiler try http://gcc.gnu.org/
2154 I cannot continue any further, aborting.
2155 EOM
2156             exit 1
2157         fi
2158     fi
2159     $rm -f try try.*
2160     ;;
2161 esac
2162 EOSC
2163
2164 : determine whether symbolic links are supported
2165 echo " "
2166 $touch blurfl
2167 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2168         echo "Symbolic links are supported." >&4
2169         lns="$ln -s"
2170 else
2171         echo "Symbolic links are NOT supported." >&4
2172         lns="$ln"
2173 fi
2174 $rm -f blurfl sym
2175
2176 : determine whether symbolic links are supported
2177 echo " "
2178 case "$lns" in
2179 *"ln -s")
2180         echo "Checking how to test for symbolic links..." >&4
2181         $lns blurfl sym
2182         if $test "X$issymlink" = X; then
2183                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2184                 if test $? = 0; then
2185                         issymlink="test -h"
2186                 fi              
2187         fi
2188         if $test "X$issymlink" = X; then
2189                 if  $test -h >/dev/null 2>&1; then
2190                         issymlink="$test -h"
2191                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2192                 fi              
2193         fi
2194         if $test "X$issymlink" = X; then
2195                 if $test -L sym 2>/dev/null; then
2196                         issymlink="$test -L"
2197                 fi
2198         fi
2199         if $test "X$issymlink" != X; then
2200                 echo "You can test for symbolic links with '$issymlink'." >&4
2201         else
2202                 echo "I do not know how you can test for symbolic links." >&4
2203         fi
2204         $rm -f blurfl sym
2205         ;;
2206 *)      echo "No symbolic links, so not testing for their testing..." >&4
2207         ;;
2208 esac
2209 echo " "
2210
2211
2212 case "$mksymlinks" in
2213 $define|true|[yY]*)
2214         case "$src" in
2215         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2216                 exit 1
2217                 ;;
2218         *)      case "$lns:$issymlink" in
2219                 *"ln -s:"*"test -"?)
2220                         echo "Creating the symbolic links..." >&4
2221                         echo "(First creating the subdirectories...)" >&4
2222                         cd ..
2223                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2224                                 read directory
2225                                 test -z "$directory" && break
2226                                 mkdir -p $directory
2227                         done
2228                         # Sanity check 1.
2229                         if test ! -d t/base; then
2230                                 echo "Failed to create the subdirectories.  Aborting." >&4
2231                                 exit 1
2232                         fi
2233                         echo "(Then creating the symlinks...)" >&4
2234                         awk '{print $1}' $src/MANIFEST | while true; do
2235                                 read filename
2236                                 test -z "$filename" && break
2237                                 if test -f $filename; then
2238                                         if $issymlink $filename; then
2239                                                 rm -f $filename
2240                                         fi
2241                                 fi
2242                                 if test -f $filename; then
2243                                         echo "$filename already exists, not symlinking."
2244                                 else
2245                                         ln -s $src/$filename $filename
2246                                 fi
2247                         done
2248                         # Sanity check 2.
2249                         if test ! -f t/base/commonsense.t; then
2250                                 echo "Failed to create the symlinks.  Aborting." >&4
2251                                 exit 1
2252                         fi
2253                         cd UU
2254                         ;;
2255                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2256                         ;;
2257                 esac
2258                 ;;
2259         esac
2260         ;;
2261 esac
2262
2263 : see whether [:lower:] and [:upper:] are supported character classes
2264 echo " "
2265 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2266 ABYZ)
2267         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2268         up='[:upper:]'
2269         low='[:lower:]'
2270         ;;
2271 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2272         # (0xc9 and 0xd1), therefore that is a nice testing point.
2273         if test "X$up" = X -o "X$low" = X; then
2274             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2275             ij) up='[A-Z]'
2276                 low='[a-z]'
2277                 ;;
2278             esac
2279         fi
2280         if test "X$up" = X -o "X$low" = X; then
2281             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2282             ij) up='A-Z'
2283                 low='a-z'
2284                 ;;
2285             esac
2286         fi
2287         if test "X$up" = X -o "X$low" = X; then
2288             case "`echo IJ | od -x 2>/dev/null`" in
2289             *C9D1*|*c9d1*)
2290                 echo "Hey, this might be EBCDIC." >&4
2291                 if test "X$up" = X -o "X$low" = X; then
2292                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2293                     ij) up='[A-IJ-RS-Z]'
2294                         low='[a-ij-rs-z]'
2295                         ;;
2296                     esac
2297                 fi
2298                 if test "X$up" = X -o "X$low" = X; then
2299                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2300                     ij) up='A-IJ-RS-Z'
2301                         low='a-ij-rs-z'
2302                         ;;
2303                     esac
2304                 fi
2305                 ;;
2306             esac
2307         fi
2308 esac
2309 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2310 ij)
2311     echo "Using $up and $low to convert case." >&4
2312     ;;
2313 *)
2314     echo "I don't know how to translate letters from upper to lower case." >&4
2315     echo "Your tr is not acting any way I know of." >&4
2316     exit 1
2317     ;;
2318 esac
2319 : set up the translation script tr, must be called with ./tr of course
2320 cat >tr <<EOSC
2321 $startsh
2322 case "\$1\$2" in
2323 '[A-Z][a-z]') exec $tr '$up' '$low';;
2324 '[a-z][A-Z]') exec $tr '$low' '$up';;
2325 esac
2326 exec $tr "\$@"
2327 EOSC
2328 chmod +x tr
2329 $eunicefix tr
2330
2331 : Try to determine whether config.sh was made on this system
2332 case "$config_sh" in
2333 '')
2334 myuname=`$uname -a 2>/dev/null`
2335 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2336 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2337 # because the A-Z/a-z are not consecutive.
2338 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2339         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2340 newmyuname="$myuname"
2341 dflt=n
2342 case "$knowitall" in
2343 '')
2344         if test -f ../config.sh; then
2345                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2346                         eval "`grep myuname= ../config.sh`"
2347                 fi
2348                 if test "X$myuname" = "X$newmyuname"; then
2349                         dflt=y
2350                 fi
2351         fi
2352         ;;
2353 *) dflt=y;;
2354 esac
2355
2356 : Get old answers from old config file if Configure was run on the
2357 : same system, otherwise use the hints.
2358 hint=default
2359 cd ..
2360 if test -f config.sh; then
2361         echo " "
2362         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2363         . UU/myread
2364         case "$ans" in
2365         n*|N*) echo "OK, I'll ignore it."
2366                 mv config.sh config.sh.old
2367                 myuname="$newmyuname"
2368                 ;;
2369         *)  echo "Fetching default answers from your old config.sh file..." >&4
2370                 tmp_n="$n"
2371                 tmp_c="$c"
2372                 tmp_sh="$sh"
2373                 . ./config.sh
2374                 cp config.sh UU
2375                 n="$tmp_n"
2376                 c="$tmp_c"
2377                 : Older versions did not always set $sh.  Catch re-use of such
2378                 : an old config.sh.
2379                 case "$sh" in
2380                 '') sh="$tmp_sh" ;;
2381                 esac
2382                 hint=previous
2383                 ;;
2384         esac
2385 fi
2386 . ./UU/checkcc
2387 if test ! -f config.sh; then
2388         $cat <<EOM
2389
2390 First time through, eh?  I have some defaults handy for some systems
2391 that need some extra help getting the Configure answers right:
2392
2393 EOM
2394         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2395         dflt=''
2396         : Half the following guesses are probably wrong... If you have better
2397         : tests or hints, please send them to perlbug@perl.org
2398         : The metaconfig authors would also appreciate a copy...
2399         $test -f /irix && osname=irix
2400         $test -f /xenix && osname=sco_xenix
2401         $test -f /dynix && osname=dynix
2402         $test -f /dnix && osname=dnix
2403         $test -f /lynx.os && osname=lynxos
2404         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2405         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2406         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2407         $test -f /bin/mips && /bin/mips && osname=mips
2408         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2409                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2410         $test -d /usr/apollo/bin && osname=apollo
2411         $test -f /etc/saf/_sactab && osname=svr4
2412         $test -d /usr/include/minix && osname=minix
2413         if $test -d /MachTen -o -d /MachTen_Folder; then
2414                 osname=machten
2415                 if $test -x /sbin/version; then
2416                         osvers=`/sbin/version | $awk '{print $2}' |
2417                         $sed -e 's/[A-Za-z]$//'`
2418                 elif $test -x /usr/etc/version; then
2419                         osvers=`/usr/etc/version | $awk '{print $2}' |
2420                         $sed -e 's/[A-Za-z]$//'`
2421                 else
2422                         osvers="$2.$3"
2423                 fi
2424         fi
2425
2426         $test -f /sys/posix.dll &&
2427                 $test -f /usr/bin/what &&
2428                 set X `/usr/bin/what /sys/posix.dll` &&
2429                 $test "$3" = UWIN &&
2430                 osname=uwin &&
2431                 osvers="$5"
2432
2433         if $test -f $uname; then
2434                 set X $myuname
2435                 shift
2436
2437                 case "$5" in
2438                 fps*) osname=fps ;;
2439                 mips*)
2440                         case "$4" in
2441                         umips) osname=umips ;;
2442                         *) osname=mips ;;
2443                         esac;;
2444                 [23]100) osname=mips ;;
2445                 next*) osname=next ;;
2446                 i386*)
2447                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2448                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2449                                 osname='sco'
2450                                 osvers=$tmp
2451                         elif $test -f /etc/kconfig; then
2452                                 osname=isc
2453                                 if test "$lns" = "$ln -s"; then
2454                                         osvers=4
2455                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2456                                         osvers=3
2457                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2458                                         osvers=2
2459                                 fi
2460                         fi
2461                         tmp=''
2462                         ;;
2463                 pc*)
2464                         if test -n "$DJGPP"; then
2465                                 osname=dos
2466                                 osvers=djgpp
2467                         fi
2468                         ;;
2469                 esac
2470
2471                 case "$1" in
2472                 aix) osname=aix
2473                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2474                         case "$tmp" in
2475                         'not found') osvers="$4"."$3" ;;
2476                         '<3240'|'<>3240') osvers=3.2.0 ;;
2477                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2478                         '=3250'|'>3250') osvers=3.2.5 ;;
2479                         *) osvers=$tmp;;
2480                         esac
2481                         ;;
2482                 bsd386) osname=bsd386
2483                         osvers=`$uname -r`
2484                         ;;
2485                 cygwin*) osname=cygwin
2486                         osvers="$3"
2487                         ;;
2488                 *dc.osx) osname=dcosx
2489                         osvers="$3"
2490                         ;;
2491                 dnix) osname=dnix
2492                         osvers="$3"
2493                         ;;
2494                 domainos) osname=apollo
2495                         osvers="$3"
2496                         ;;
2497                 dgux) osname=dgux 
2498                         osvers="$3"
2499                         ;;
2500                 dynixptx*) osname=dynixptx
2501                         osvers=`echo "$4"|sed 's/^v//'`
2502                         ;;
2503                 freebsd) osname=freebsd 
2504                         osvers="$3" ;;
2505                 genix) osname=genix ;;
2506                 hp*) osname=hpux 
2507                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2508                         ;;
2509                 irix*) osname=irix
2510                         case "$3" in
2511                         4*) osvers=4 ;;
2512                         5*) osvers=5 ;;
2513                         *)      osvers="$3" ;;
2514                         esac
2515                         ;;
2516                 linux) osname=linux
2517                         case "$3" in
2518                         *)      osvers="$3" ;;
2519                         esac
2520                         ;;
2521                 MiNT) osname=mint
2522                         ;;
2523                 netbsd*) osname=netbsd
2524                         osvers="$3"
2525                         ;;
2526                 news-os) osvers="$3"
2527                         case "$3" in
2528                         4*) osname=newsos4 ;;
2529                         *) osname=newsos ;;
2530                         esac
2531                         ;;
2532                 next*) osname=next ;;
2533                 nonstop-ux) osname=nonstopux ;;
2534                 POSIX-BC | posix-bc ) osname=posix-bc
2535                         osvers="$3"
2536                         ;;
2537                 powerux | power_ux | powermax_os | powermaxos | \
2538                 powerunix | power_unix) osname=powerux
2539                         osvers="$3"
2540                         ;;
2541                 qnx) osname=qnx
2542                         osvers="$4"
2543                         ;;
2544                 solaris) osname=solaris
2545                         case "$3" in
2546                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2547                         *)      osvers="$3" ;;
2548                         esac
2549                         ;;
2550                 sunos) osname=sunos
2551                         case "$3" in
2552                         5*) osname=solaris
2553                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2554                         *)      osvers="$3" ;;
2555                         esac
2556                         ;;
2557                 titanos) osname=titanos
2558                         case "$3" in
2559                         1*) osvers=1 ;;
2560                         2*) osvers=2 ;;
2561                         3*) osvers=3 ;;
2562                         4*) osvers=4 ;;
2563                         *)      osvers="$3" ;;
2564                         esac
2565                         ;;
2566                 ultrix) osname=ultrix
2567                         osvers="$3"
2568                         ;;
2569                 osf1|mls+)      case "$5" in
2570                                 alpha)
2571                                         osname=dec_osf
2572                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2573                                         case "$osvers" in
2574                                         [1-9].[0-9]*) ;;
2575                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2576                                         esac
2577                                         ;;
2578                         hp*)    osname=hp_osf1  ;;
2579                         mips)   osname=mips_osf1 ;;
2580                         esac
2581                         ;;
2582                 unixware) osname=svr5
2583                         osvers="$4"
2584                         ;;
2585                 uts) osname=uts
2586                         osvers="$3"
2587                         ;;
2588                 $2) case "$osname" in
2589                         *isc*) ;;
2590                         *freebsd*) ;;
2591                         svr*)
2592                                 : svr4.x or possibly later
2593                                 case "svr$3" in 
2594                                 ${osname}*)
2595                                         osname=svr$3
2596                                         osvers=$4
2597                                         ;;
2598                                 esac
2599                                 case "$osname" in
2600                                 svr4.0)
2601                                         : Check for ESIX
2602                                         if test -f /stand/boot ; then
2603                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2604                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2605                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2606                                                         if test -n "$isesix"; then
2607                                                                 osname=esix4
2608                                                         fi
2609                                                 fi
2610                                         fi
2611                                         ;;
2612                                 esac
2613                                 ;;
2614                         *)      if test -f /etc/systemid; then
2615                                         osname=sco
2616                                         set `echo $3 | $sed 's/\./ /g'` $4
2617                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2618                                                 osvers=$1.$2.$3
2619                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2620                                                 osvers=$1.$2
2621                                         elif $test -f $src/hints/sco_$1.sh; then
2622                                                 osvers=$1
2623                                         fi
2624                                 else
2625                                         case "$osname" in
2626                                         '') : Still unknown.  Probably a generic Sys V.
2627                                                 osname="sysv"
2628                                                 osvers="$3"
2629                                                 ;;
2630                                         esac
2631                                 fi
2632                                 ;;
2633                         esac
2634                         ;;
2635                 *)      case "$osname" in
2636                         '') : Still unknown.  Probably a generic BSD.
2637                                 osname="$1"
2638                                 osvers="$3"
2639                                 ;;
2640                         esac
2641                         ;;
2642                 esac
2643         else
2644                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2645                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2646                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2647                                 osname=news_os
2648                         fi
2649                         $rm -f UU/kernel.what
2650                 elif test -d c:/.; then
2651                         set X $myuname
2652                         osname=os2
2653                         osvers="$5"
2654                 fi
2655         fi
2656         
2657         : Now look for a hint file osname_osvers, unless one has been
2658         : specified already.
2659         case "$hintfile" in
2660         ''|' ')
2661                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2662                 : Also try without trailing minor version numbers.
2663                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2664                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2665                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2666                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2667                 case "$file" in
2668                 '') dflt=none ;;
2669                 *)  case "$osvers" in
2670                         '') dflt=$file
2671                                 ;;
2672                         *)  if $test -f $src/hints/$file.sh ; then
2673                                         dflt=$file
2674                                 elif $test -f $src/hints/$xfile.sh ; then
2675                                         dflt=$xfile
2676                                 elif $test -f $src/hints/$xxfile.sh ; then
2677                                         dflt=$xxfile
2678                                 elif $test -f $src/hints/$xxxfile.sh ; then
2679                                         dflt=$xxxfile
2680                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2681                                         dflt=$xxxxfile
2682                                 elif $test -f "$src/hints/${osname}.sh" ; then
2683                                         dflt="${osname}"
2684                                 else
2685                                         dflt=none
2686                                 fi
2687                                 ;;
2688                         esac
2689                         ;;
2690                 esac
2691                 if $test -f Policy.sh ; then
2692                         case "$dflt" in
2693                         *Policy*) ;;
2694                         none) dflt="Policy" ;;
2695                         *) dflt="Policy $dflt" ;;
2696                         esac
2697                 fi
2698                 ;;
2699         *)
2700                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2701                 ;;
2702         esac
2703
2704         if $test -f Policy.sh ; then
2705                 $cat <<EOM
2706
2707 There's also a Policy hint file available, which should make the
2708 site-specific (policy) questions easier to answer.
2709 EOM
2710
2711         fi
2712
2713         $cat <<EOM
2714
2715 You may give one or more space-separated answers, or "none" if appropriate.
2716 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2717 is a good thing.  DO NOT give a wrong version or a wrong OS.
2718
2719 EOM
2720
2721         rp="Which of these apply, if any?"
2722         . UU/myread
2723         tans=$ans
2724         for file in $tans; do
2725                 if $test X$file = XPolicy -a -f Policy.sh; then
2726                         . Policy.sh
2727                         $cat Policy.sh >> UU/config.sh
2728                 elif $test -f $src/hints/$file.sh; then
2729                         . $src/hints/$file.sh
2730                         $cat $src/hints/$file.sh >> UU/config.sh
2731                 elif $test X$tans = X -o X$tans = Xnone ; then
2732                         : nothing
2733                 else
2734                         : Give one chance to correct a possible typo.
2735                         echo "$file.sh does not exist"
2736                         dflt=$file
2737                         rp="hint to use instead?"
2738                         . UU/myread
2739                         for file in $ans; do
2740                                 if $test -f "$src/hints/$file.sh"; then
2741                                         . $src/hints/$file.sh
2742                                         $cat $src/hints/$file.sh >> UU/config.sh
2743                                 elif $test X$ans = X -o X$ans = Xnone ; then
2744                                         : nothing
2745                                 else
2746                                         echo "$file.sh does not exist -- ignored."
2747                                 fi
2748                         done
2749                 fi
2750         done
2751
2752         hint=recommended
2753         : Remember our hint file for later.
2754         if $test -f "$src/hints/$file.sh" ; then
2755                 hintfile="$file"
2756         else
2757                 hintfile=''
2758         fi
2759 fi
2760 cd UU
2761 ;;
2762 *)
2763         echo " "
2764         echo "Fetching default answers from $config_sh..." >&4
2765         tmp_n="$n"
2766         tmp_c="$c"
2767         cd ..
2768         cp $config_sh config.sh 2>/dev/null
2769         chmod +w config.sh
2770         . ./config.sh
2771         cd UU
2772         cp ../config.sh .
2773         n="$tmp_n"
2774         c="$tmp_c"
2775         hint=previous
2776         ;;
2777 esac
2778 test "$override" && . ./optdef.sh
2779
2780 : Restore computed paths
2781 for file in $loclist $trylist; do
2782         eval $file="\$_$file"
2783 done
2784
2785 cat << EOM
2786
2787 Configure uses the operating system name and version to set some defaults.
2788 The default value is probably right if the name rings a bell. Otherwise,
2789 since spelling matters for me, either accept the default or answer "none"
2790 to leave it blank.
2791
2792 EOM
2793 case "$osname" in
2794         ''|' ')
2795                 case "$hintfile" in
2796                 ''|' '|none) dflt=none ;;
2797                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2798                 esac
2799                 ;;
2800         *) dflt="$osname" ;;
2801 esac
2802 rp="Operating system name?"
2803 . ./myread
2804 case "$ans" in
2805 none)  osname='' ;;
2806 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2807 esac
2808 echo " "
2809 case "$osvers" in
2810         ''|' ')
2811                 case "$hintfile" in
2812                 ''|' '|none) dflt=none ;;
2813                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2814                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2815                         case "$dflt" in
2816                         ''|' ') dflt=none ;;
2817                         esac
2818                         ;;
2819                 esac
2820                 ;;
2821         *) dflt="$osvers" ;;
2822 esac
2823 rp="Operating system version?"
2824 . ./myread
2825 case "$ans" in
2826 none)  osvers='' ;;
2827 *) osvers="$ans" ;;
2828 esac
2829
2830
2831 . ./posthint.sh
2832
2833 : who configured the system
2834 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2835 cf_by=`(logname) 2>/dev/null`
2836 case "$cf_by" in
2837 "")
2838         cf_by=`(whoami) 2>/dev/null`
2839         case "$cf_by" in
2840         "") cf_by=unknown ;;
2841         esac ;;
2842 esac
2843
2844 : set up the script used to warn in case of inconsistency
2845 cat <<EOS >whoa
2846 $startsh
2847 EOS
2848 cat <<'EOSC' >>whoa
2849 dflt=y
2850 echo " "
2851 echo "*** WHOA THERE!!! ***" >&4
2852 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2853 rp="    Keep the $hint value?"
2854 . ./myread
2855 case "$ans" in
2856 y) td=$was; tu=$was;;
2857 esac
2858 EOSC
2859
2860 : function used to set $1 to $val
2861 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2862 case "$val$was" in
2863 $define$undef) . ./whoa; eval "$var=\$td";;
2864 $undef$define) . ./whoa; eval "$var=\$tu";;
2865 *) eval "$var=$val";;
2866 esac'
2867
2868 case "$usethreads" in
2869 $define|true|[yY]*)     dflt='y';;
2870 *) dflt='n';;
2871 esac
2872 cat <<EOM
2873
2874 Perl can be built to take advantage of threads on some systems.
2875 To do so, Configure can be run with -Dusethreads.
2876
2877 Note that threading is a highly experimental feature, and
2878 some known race conditions still remain.  If you choose to try
2879 it, be very sure to not actually deploy it for production
2880 purposes.  README.threads has more details, and is required
2881 reading if you enable threads.
2882
2883 If this doesn't make any sense to you, just accept the default '$dflt'.
2884 EOM
2885 rp='Build a threading Perl?'
2886 . ./myread
2887 case "$ans" in
2888 y|Y)    val="$define" ;;
2889 *)      val="$undef" ;;
2890 esac
2891 set usethreads
2892 eval $setvar
2893
2894 case "$usethreads" in
2895 $define)
2896         $cat <<EOM
2897
2898 As of 5.5.640, Perl has two different internal threading implementations,
2899 the 5.005 version (5005threads) and an interpreter-based version
2900 (ithreads) that has one interpreter per thread.  Both are very 
2901 experimental.  This arrangement exists to help developers work out
2902 which one is better.
2903
2904 If you're a casual user, you probably don't want interpreter-threads
2905 at this time.  There doesn't yet exist a way to create threads from
2906 within Perl in this model, i.e., "use Thread;" will NOT work.
2907 EOM
2908         : Default to ithreads unless overridden on command line or with
2909         : old config.sh
2910         dflt='y'
2911         case "$use5005threads" in
2912                 $define|true|[yY]*) dflt='n';;
2913         esac
2914         case "$useithreads" in
2915                 $undef|false|[nN]*) dflt='n';;
2916         esac
2917         rp='Use interpreter-based ithreads?'
2918         . ./myread
2919         case "$ans" in
2920         y|Y)    val="$define" ;;
2921         *)      val="$undef" ;;
2922         esac
2923         set useithreads
2924         eval $setvar
2925         : Now set use5005threads to the opposite value.
2926         case "$useithreads" in
2927         $define) val="$undef" ;;
2928         *) val="$define" ;;
2929         esac
2930         set use5005threads
2931         eval $setvar
2932         ;;
2933 *)
2934         useithreads="$undef"
2935         use5005threads="$undef"
2936         ;;
2937 esac
2938
2939 case "$d_oldpthreads" in
2940 '')     : Configure tests would be welcome here.  For now, assume undef.
2941         val="$undef" ;;
2942 *)      val="$d_oldpthreads" ;;
2943 esac
2944 set d_oldpthreads
2945 eval $setvar
2946
2947
2948 case "$usethreads" in
2949 "$define"|true|[yY]*)
2950 : Look for a hint-file generated 'call-back-unit'.  If the
2951 : user has specified that a threading perl is to be built,
2952 : we may need to set or change some other defaults.
2953         if $test -f usethreads.cbu; then
2954                 echo "Your platform has some specific hints for threaded builds, using them..."
2955                 . ./usethreads.cbu
2956         else
2957                 $cat <<EOM
2958 (Your platform doesn't have any specific hints for threaded builds.
2959  Assuming POSIX threads, then.)
2960 EOM
2961         fi
2962         ;;
2963 esac
2964
2965 cat <<EOM
2966
2967 Perl can be built so that multiple Perl interpreters can coexist
2968 within the same Perl executable.
2969 EOM
2970
2971 case "$useithreads" in
2972 $define)
2973         cat <<EOM
2974 This multiple interpreter support is required for interpreter-based threads.
2975 EOM
2976         val="$define"
2977         ;;
2978 *)      case "$usemultiplicity" in
2979         $define|true|[yY]*)     dflt='y';;
2980         *) dflt='n';;
2981         esac
2982         echo " "
2983         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2984         rp='Build Perl for multiplicity?'
2985         . ./myread
2986         case "$ans" in
2987         y|Y)    val="$define" ;;
2988         *)      val="$undef" ;;
2989         esac
2990         ;;
2991 esac
2992 set usemultiplicity
2993 eval $setvar
2994
2995 : make some quick guesses about what we are up against
2996 echo " "
2997 $echo $n "Hmm...  $c"
2998 echo exit 1 >bsd
2999 echo exit 1 >usg
3000 echo exit 1 >v7
3001 echo exit 1 >osf1
3002 echo exit 1 >eunice
3003 echo exit 1 >xenix
3004 echo exit 1 >venix
3005 echo exit 1 >os2
3006 d_bsd="$undef"
3007 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3008 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3009 then
3010         echo "Looks kind of like an OSF/1 system, but we'll see..."
3011         echo exit 0 >osf1
3012 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3013         xxx=`./loc addbib blurfl $pth`
3014         if $test -f $xxx; then
3015         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3016                 echo exit 0 >bsd
3017                 echo exit 0 >usg
3018         else
3019                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3020                         echo "Looks kind of like an extended USG system, but we'll see..."
3021                 else
3022                         echo "Looks kind of like a USG system, but we'll see..."
3023                 fi
3024                 echo exit 0 >usg
3025         fi
3026 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3027         echo "Looks kind of like a BSD system, but we'll see..."
3028         d_bsd="$define"
3029         echo exit 0 >bsd
3030 else
3031         echo "Looks kind of like a Version 7 system, but we'll see..."
3032         echo exit 0 >v7
3033 fi
3034 case "$eunicefix" in
3035 *unixtovms*)
3036         $cat <<'EOI'
3037 There is, however, a strange, musty smell in the air that reminds me of
3038 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3039 EOI
3040         echo exit 0 >eunice
3041         d_eunice="$define"
3042 : it so happens the Eunice I know will not run shell scripts in Unix format
3043         ;;
3044 *)
3045         echo " "
3046         echo "Congratulations.  You aren't running Eunice."
3047         d_eunice="$undef"
3048         ;;
3049 esac
3050 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3051 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3052 : semicolon as a patch separator
3053 case "$p_" in
3054 :) ;;
3055 *)
3056         $cat <<'EOI'
3057 I have the feeling something is not exactly right, however...don't tell me...
3058 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3059 (Or you may be running DOS with DJGPP.)
3060 EOI
3061         echo exit 0 >os2
3062         ;;
3063 esac
3064 if test -f /xenix; then
3065         echo "Actually, this looks more like a XENIX system..."
3066         echo exit 0 >xenix
3067         d_xenix="$define"
3068 else
3069         echo " "
3070         echo "It's not Xenix..."
3071         d_xenix="$undef"
3072 fi
3073 chmod +x xenix
3074 $eunicefix xenix
3075 if test -f /venix; then
3076         echo "Actually, this looks more like a VENIX system..."
3077         echo exit 0 >venix
3078 else
3079         echo " "
3080         if ./xenix; then
3081                 : null
3082         else
3083                 echo "Nor is it Venix..."
3084         fi
3085 fi
3086 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3087 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3088 $rm -f foo
3089
3090 case "$cc" in
3091 '') dflt=cc;;
3092 *) dflt="$cc";;
3093 esac
3094 rp="Use which C compiler?"
3095 . ./myread
3096 cc="$ans"
3097 : Look for a hint-file generated 'call-back-unit'.  Now that the
3098 : user has specified the compiler, we may need to set or change some
3099 : other defaults.
3100 if $test -f cc.cbu; then
3101     . ./cc.cbu
3102 fi
3103 . ./checkcc
3104
3105 echo " "
3106 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3107 $cat >gccvers.c <<EOM
3108 #include <stdio.h>
3109 int main() {
3110 #ifdef __GNUC__
3111 #ifdef __VERSION__
3112         printf("%s\n", __VERSION__);
3113 #else
3114         printf("%s\n", "1");
3115 #endif
3116 #endif
3117         exit(0);
3118 }
3119 EOM
3120 if $cc -o gccvers $ldflags gccvers.c; then
3121         gccversion=`./gccvers`
3122         case "$gccversion" in
3123         '') echo "You are not using GNU cc." ;;
3124         *)  echo "You are using GNU cc $gccversion."
3125             ccname=gcc  
3126             ;;
3127         esac
3128 else
3129         echo " "
3130         echo "*** WHOA THERE!!! ***" >&4
3131         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3132         case "$knowitall" in
3133         '')
3134         echo "    You'd better start hunting for one and let me know about it." >&4
3135                 exit 1
3136                 ;;
3137         esac
3138 fi
3139 $rm -f gccvers*
3140 case "$gccversion" in
3141 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3142 esac
3143 case "$gccversion" in
3144 '') gccosandvers='' ;;
3145 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3146    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3147    gccshortvers=''
3148    case "$gccosandvers" in
3149    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3150    $osname$osvers) ;; # looking good
3151    $osname*) cat <<EOM >&4
3152
3153 *** WHOA THERE!!! ***
3154
3155     Your gcc has not been compiled for the exact release of
3156     your operating system ($gccosandvers versus $osname$osvers).
3157
3158     In general it is a good idea to keep gcc synchronized with
3159     the operating system because otherwise serious problems
3160     may ensue when trying to compile software, like Perl.
3161
3162     I'm trying to be optimistic here, though, and will continue.
3163     If later during the configuration and build icky compilation
3164     problems appear (headerfile conflicts being the most common
3165     manifestation), I suggest reinstalling the gcc to match
3166     your operating system release.
3167
3168 EOM
3169       ;;
3170    *) gccosandvers='' ;; # failed to parse, better be silent
3171    esac
3172    ;;
3173 esac
3174 case "$ccname" in
3175 '') ccname="$cc" ;;
3176 esac
3177
3178 : see how we invoke the C preprocessor
3179 echo " "
3180 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3181 cat <<'EOT' >testcpp.c
3182 #define ABC abc
3183 #define XYZ xyz
3184 ABC.XYZ
3185 EOT
3186 cd ..
3187 if test ! -f cppstdin; then
3188         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3189                 # AIX cc -E doesn't show the absolute headerfile
3190                 # locations but we'll cheat by using the -M flag.
3191                 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
3192         else
3193                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3194         fi
3195 else
3196         echo "Keeping your $hint cppstdin wrapper."
3197 fi
3198 chmod 755 cppstdin
3199 wrapper=`pwd`/cppstdin
3200 ok='false'
3201 cd UU
3202
3203 if $test "X$cppstdin" != "X" && \
3204         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3205         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3206 then
3207         echo "You used to use $cppstdin $cppminus so we'll use that again."
3208         case "$cpprun" in
3209         '') echo "But let's see if we can live without a wrapper..." ;;
3210         *)
3211                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3212                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3213                 then
3214                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3215                         ok='true'
3216                 else
3217                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3218                 fi
3219                 ;;
3220         esac
3221 else
3222         case "$cppstdin" in
3223         '') ;;
3224         *)
3225                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3226                 ;;
3227         esac
3228 fi
3229
3230 if $ok; then
3231         : nothing
3232 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3233         $cc -E <testcpp.c >testcpp.out 2>&1; \
3234         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3235         echo "Yup, it does."
3236         x_cpp="$cc -E"
3237         x_minus='';
3238 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3239         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3240         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3241         echo "Yup, it does."
3242         x_cpp="$cc -E"
3243         x_minus='-';
3244 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3245         $cc -P <testcpp.c >testcpp.out 2>&1; \
3246         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3247         echo "Yipee, that works!"
3248         x_cpp="$cc -P"
3249         x_minus='';
3250 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3251         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3252         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3253         echo "At long last!"
3254         x_cpp="$cc -P"
3255         x_minus='-';
3256 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3257         $cpp <testcpp.c >testcpp.out 2>&1; \
3258         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3259         echo "It works!"
3260         x_cpp="$cpp"
3261         x_minus='';
3262 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3263         $cpp - <testcpp.c >testcpp.out 2>&1; \
3264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3265         echo "Hooray, it works!  I was beginning to wonder."
3266         x_cpp="$cpp"
3267         x_minus='-';
3268 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3269         $wrapper <testcpp.c >testcpp.out 2>&1; \
3270         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3271         x_cpp="$wrapper"
3272         x_minus=''
3273         echo "Eureka!"
3274 else
3275         dflt=''
3276         rp="No dice.  I can't find a C preprocessor.  Name one:"
3277         . ./myread
3278         x_cpp="$ans"
3279         x_minus=''
3280         $x_cpp <testcpp.c >testcpp.out 2>&1
3281         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3282                 echo "OK, that will do." >&4
3283         else
3284 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3285                 exit 1
3286         fi
3287 fi
3288
3289 case "$ok" in
3290 false)
3291         cppstdin="$x_cpp"
3292         cppminus="$x_minus"
3293         cpprun="$x_cpp"
3294         cpplast="$x_minus"
3295         set X $x_cpp
3296         shift
3297         case "$1" in
3298         "$cpp")
3299                 echo "Perhaps can we force $cc -E using a wrapper..."
3300                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3301                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3302                 then
3303                         echo "Yup, we can."
3304                         cppstdin="$wrapper"
3305                         cppminus='';
3306                 else
3307                         echo "Nope, we'll have to live without it..."
3308                 fi
3309                 ;;
3310         esac
3311         case "$cpprun" in
3312         "$wrapper")
3313                 cpprun=''
3314                 cpplast=''
3315                 ;;
3316         esac
3317         ;;
3318 esac
3319
3320 case "$cppstdin" in
3321 "$wrapper"|'cppstdin') ;;
3322 *) $rm -f $wrapper;;
3323 esac
3324 $rm -f testcpp.c testcpp.out
3325
3326 : decide how portable to be.  Allow command line overrides.
3327 case "$d_portable" in
3328 "$undef") ;;
3329 *)      d_portable="$define" ;;
3330 esac
3331
3332 : set up shell script to do ~ expansion
3333 cat >filexp <<EOSS
3334 $startsh
3335 : expand filename
3336 case "\$1" in
3337  ~/*|~)
3338         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3339         ;;
3340  ~*)
3341         if $test -f /bin/csh; then
3342                 /bin/csh -f -c "glob \$1"
3343                 failed=\$?
3344                 echo ""
3345                 exit \$failed
3346         else
3347                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3348                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3349                 if $test ! -d "\$dir"; then
3350                         me=\`basename \$0\`
3351                         echo "\$me: can't locate home directory for: \$name" >&2
3352                         exit 1
3353                 fi
3354                 case "\$1" in
3355                 */*)
3356                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3357                         ;;
3358                 *)
3359                         echo \$dir
3360                         ;;
3361                 esac
3362         fi
3363         ;;
3364 *)
3365         echo \$1
3366         ;;
3367 esac
3368 EOSS
3369 chmod +x filexp
3370 $eunicefix filexp
3371
3372 : now set up to get a file name
3373 cat <<EOS >getfile
3374 $startsh
3375 EOS
3376 cat <<'EOSC' >>getfile
3377 tilde=''
3378 fullpath=''
3379 already=''
3380 skip=''
3381 none_ok=''
3382 exp_file=''
3383 nopath_ok=''
3384 orig_rp="$rp"
3385 orig_dflt="$dflt"
3386 case "$gfpth" in
3387 '') gfpth='.' ;;
3388 esac
3389
3390 case "$fn" in
3391 *\(*)
3392         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3393         fn=`echo $fn | sed 's/(.*)//'`
3394         ;;
3395 esac
3396
3397 case "$fn" in
3398 *:*)
3399         loc_file=`expr $fn : '.*:\(.*\)'`
3400         fn=`expr $fn : '\(.*\):.*'`
3401         ;;
3402 esac
3403
3404 case "$fn" in
3405 *~*) tilde=true;;
3406 esac
3407 case "$fn" in
3408 */*) fullpath=true;;
3409 esac
3410 case "$fn" in
3411 *+*) skip=true;;
3412 esac
3413 case "$fn" in
3414 *n*) none_ok=true;;
3415 esac
3416 case "$fn" in
3417 *e*) exp_file=true;;
3418 esac
3419 case "$fn" in
3420 *p*) nopath_ok=true;;
3421 esac
3422
3423 case "$fn" in
3424 *f*) type='File';;
3425 *d*) type='Directory';;
3426 *l*) type='Locate';;
3427 esac
3428
3429 what="$type"
3430 case "$what" in
3431 Locate) what='File';;
3432 esac
3433
3434 case "$exp_file" in
3435 '')
3436         case "$d_portable" in
3437         "$define") ;;
3438         *) exp_file=true;;
3439         esac
3440         ;;
3441 esac
3442
3443 cd ..
3444 while test "$type"; do
3445         redo=''
3446         rp="$orig_rp"
3447         dflt="$orig_dflt"
3448         case "$tilde" in
3449         true) rp="$rp (~name ok)";;
3450         esac
3451         . UU/myread
3452         if test -f UU/getfile.ok && \
3453                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3454         then
3455                 value="$ans"
3456                 ansexp="$ans"
3457                 break
3458         fi
3459         case "$ans" in
3460         none)
3461                 value=''
3462                 ansexp=''
3463                 case "$none_ok" in
3464                 true) type='';;
3465                 esac
3466                 ;;
3467         *)
3468                 case "$tilde" in
3469                 '') value="$ans"
3470                         ansexp="$ans";;
3471                 *)
3472                         value=`UU/filexp $ans`
3473                         case $? in
3474                         0)
3475                                 if test "$ans" != "$value"; then
3476                                         echo "(That expands to $value on this system.)"
3477                                 fi
3478                                 ;;
3479                         *) value="$ans";;
3480                         esac
3481                         ansexp="$value"
3482                         case "$exp_file" in
3483                         '') value="$ans";;
3484                         esac
3485                         ;;
3486                 esac
3487                 case "$fullpath" in
3488                 true)
3489                         case "$ansexp" in
3490                         /*) value="$ansexp" ;;
3491                         [a-zA-Z]:/*) value="$ansexp" ;;
3492                         *)
3493                                 redo=true
3494                                 case "$already" in
3495                                 true)
3496                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3497                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3498                                         ;;
3499                                 *)
3500                                 echo "Please give a full path name, starting with slash." >&4
3501                                         case "$tilde" in
3502                                         true)
3503                                 echo "Note that using ~name is ok provided it expands well." >&4
3504                                                 already=true
3505                                                 ;;
3506                                         esac
3507                                 esac
3508                                 ;;
3509                         esac
3510                         ;;
3511                 esac
3512                 case "$redo" in
3513                 '')
3514                         case "$type" in
3515                         File)
3516                                 for fp in $gfpth; do
3517                                         if test "X$fp" = X.; then
3518                                             pf="$ansexp"
3519                                         else    
3520                                             pf="$fp/$ansexp"
3521                                         fi
3522                                         if test -f "$pf"; then
3523                                                 type=''
3524                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3525                                         then
3526                                                 echo "($value is not a plain file, but that's ok.)"
3527                                                 type=''
3528                                         fi
3529                                         if test X"$type" = X; then
3530                                             value="$pf"
3531                                             break
3532                                         fi
3533                                 done
3534                                 ;;
3535                         Directory)
3536                                 for fp in $gfpth; do
3537                                         if test "X$fp" = X.; then
3538                                             dir="$ans"
3539                                             direxp="$ansexp"
3540                                         else    
3541                                             dir="$fp/$ansexp"
3542                                             direxp="$fp/$ansexp"
3543                                         fi
3544                                         if test -d "$direxp"; then
3545                                                 type=''
3546                                                 value="$dir"
3547                                                 break
3548                                         fi
3549                                 done
3550                                 ;;
3551                         Locate)
3552                                 if test -d "$ansexp"; then
3553                                         echo "(Looking for $loc_file in directory $value.)"
3554                                         value="$value/$loc_file"
3555                                         ansexp="$ansexp/$loc_file"
3556                                 fi
3557                                 if test -f "$ansexp"; then
3558                                         type=''
3559                                 fi
3560                                 case "$nopath_ok" in
3561                                 true)   case "$value" in
3562                                         */*) ;;
3563                                         *)      echo "Assuming $value will be in people's path."
3564                                                 type=''
3565                                                 ;;
3566                                         esac
3567                                         ;;
3568                                 esac
3569                                 ;;
3570                         esac
3571
3572                         case "$skip" in
3573                         true) type='';
3574                         esac
3575
3576                         case "$type" in
3577                         '') ;;
3578                         *)
3579                                 if test "$fastread" = yes; then
3580                                         dflt=y
3581                                 else
3582                                         dflt=n
3583                                 fi
3584                                 rp="$what $value doesn't exist.  Use that name anyway?"
3585                                 . UU/myread
3586                                 dflt=''
3587                                 case "$ans" in
3588                                 y*) type='';;
3589                                 *) echo " ";;
3590                                 esac
3591                                 ;;
3592                         esac
3593                         ;;
3594                 esac
3595                 ;;
3596         esac
3597 done
3598 cd UU
3599 ans="$value"
3600 rp="$orig_rp"
3601 dflt="$orig_dflt"
3602 rm -f getfile.ok
3603 test "X$gfpthkeep" != Xy && gfpth=""
3604 EOSC
3605
3606 : What should the include directory be ?
3607 echo " "
3608 $echo $n "Hmm...  $c"
3609 dflt='/usr/include'
3610 incpath=''
3611 mips_type=''
3612 if $test -f /bin/mips && /bin/mips; then
3613         echo "Looks like a MIPS system..."
3614         $cat >usr.c <<'EOCP'
3615 #ifdef SYSTYPE_BSD43
3616 /bsd43
3617 #endif
3618 EOCP
3619         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3620                 dflt='/bsd43/usr/include'
3621                 incpath='/bsd43'
3622                 mips_type='BSD 4.3'
3623         else
3624                 mips_type='System V'
3625         fi
3626         $rm -f usr.c usr.out
3627         echo "and you're compiling with the $mips_type compiler and libraries."
3628         xxx_prompt=y
3629         echo "exit 0" >mips
3630 else
3631         echo "Doesn't look like a MIPS system."
3632         xxx_prompt=n
3633         echo "exit 1" >mips
3634 fi
3635 chmod +x mips
3636 $eunicefix mips
3637 case "$usrinc" in
3638 '') ;;
3639 *) dflt="$usrinc";;
3640 esac
3641 case "$xxx_prompt" in
3642 y)      fn=d/
3643         echo " "
3644         rp='Where are the include files you want to use?'
3645         . ./getfile
3646         usrinc="$ans"
3647         ;;
3648 *)      usrinc="$dflt"
3649         ;;
3650 esac
3651
3652 : Set private lib path
3653 case "$plibpth" in
3654 '') if ./mips; then
3655                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3656         fi;;
3657 esac
3658 case "$libpth" in
3659 ' ') dlist='';;
3660 '') dlist="$loclibpth $plibpth $glibpth";;
3661 *) dlist="$libpth";;
3662 esac
3663
3664 : Now check and see which directories actually exist, avoiding duplicates
3665 libpth=''
3666 for xxx in $dlist
3667 do
3668     if $test -d $xxx; then
3669                 case " $libpth " in
3670                 *" $xxx "*) ;;
3671                 *) libpth="$libpth $xxx";;
3672                 esac
3673     fi
3674 done
3675 $cat <<'EOM'
3676
3677 Some systems have incompatible or broken versions of libraries.  Among
3678 the directories listed in the question below, please remove any you
3679 know not to be holding relevant libraries, and add any that are needed.
3680 Say "none" for none.
3681
3682 EOM
3683 case "$libpth" in
3684 '') dflt='none';;
3685 *)
3686         set X $libpth
3687         shift
3688         dflt=${1+"$@"}
3689         ;;
3690 esac
3691 rp="Directories to use for library searches?"
3692 . ./myread
3693 case "$ans" in
3694 none) libpth=' ';;
3695 *) libpth="$ans";;
3696 esac
3697
3698 : compute shared library extension
3699 case "$so" in
3700 '')
3701         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3702                 dflt='sl'
3703         else
3704                 dflt='so'
3705         fi
3706         ;;
3707 *) dflt="$so";;
3708 esac
3709 $cat <<EOM
3710
3711 On some systems, shared libraries may be available.  Answer 'none' if
3712 you want to suppress searching of shared libraries for the remainder
3713 of this configuration.
3714
3715 EOM
3716 rp='What is the file extension used for shared libraries?'
3717 . ./myread
3718 so="$ans"
3719
3720 : Define several unixisms.
3721 : Hints files or command line option can be used to override them.
3722 : The convoluted testing is in case hints files set either the old
3723 : or the new name.
3724 case "$_exe" in
3725 '')     case "$exe_ext" in
3726     '') ;;
3727         *)      _exe="$exe_ext" ;;
3728         esac
3729         ;;
3730 esac
3731 case "$_a" in
3732 '')     case "$lib_ext" in
3733     '') _a='.a';;
3734         *)      _a="$lib_ext" ;;
3735         esac
3736         ;;
3737 esac
3738 case "$_o" in
3739 '') case "$obj_ext" in
3740         '')     _o='.o';;
3741         *)      _o="$obj_ext";;
3742         esac
3743         ;;
3744 esac
3745 case "$p_" in
3746 '') case "$path_sep" in
3747         '')     p_=':';;
3748         *)      p_="$path_sep";;
3749         esac
3750         ;;
3751 esac
3752 exe_ext=$_exe
3753 lib_ext=$_a
3754 obj_ext=$_o
3755 path_sep=$p_
3756
3757 : Which makefile gets called first.  This is used by make depend.
3758 case "$firstmakefile" in
3759 '') firstmakefile='makefile';;
3760 esac
3761
3762 case "$usesocks" in
3763 $define|true|[yY]*)     dflt='y';;
3764 *) dflt='n';;
3765 esac
3766 cat <<EOM
3767
3768 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3769 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3770 to use the PerlIO abstraction layer, this will be implicitly selected.
3771
3772 If this doesn't make any sense to you, just accept the default '$dflt'.
3773 EOM
3774 rp='Build Perl for SOCKS?'
3775 . ./myread
3776 case "$ans" in
3777 y|Y)    val="$define" ;;     
3778 *)      val="$undef" ;;
3779 esac
3780 set usesocks
3781 eval $setvar
3782
3783 case "$usesocks" in
3784 $define|true|[yY]*) useperlio="$define";;
3785 esac
3786
3787 : Looking for optional libraries
3788 echo " "
3789 echo "Checking for optional libraries..." >&4
3790 case "$libs" in
3791 ' '|'') dflt='';;
3792 *) dflt="$libs";;
3793 esac
3794 case "$libswanted" in
3795 '') libswanted='c_s';;
3796 esac
3797 case "$usesocks" in
3798 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3799 esac
3800 libsfound=''
3801 libsfiles=''
3802 libsdirs=''
3803 libspath=''
3804 for thisdir in $libpth $xlibpth; do
3805   test -d $thisdir && libspath="$libspath $thisdir"
3806 done
3807 for thislib in $libswanted; do
3808         for thisdir in $libspath; do
3809             xxx=''
3810             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3811                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3812                 $test -f "$xxx" && eval $libscheck
3813                 $test -f "$xxx" && libstyle=shared
3814             fi
3815             if test ! -f "$xxx"; then
3816                 xxx=$thisdir/lib$thislib.$so
3817                 $test -f "$xxx" && eval $libscheck
3818                 $test -f "$xxx" && libstyle=shared
3819             fi  
3820             if test ! -f "$xxx"; then
3821                 xxx=$thisdir/lib$thislib$_a
3822                 $test -f "$xxx" && eval $libscheck
3823                 $test -f "$xxx" && libstyle=static
3824             fi
3825             if test ! -f "$xxx"; then
3826                 xxx=$thisdir/$thislib$_a
3827                 $test -f "$xxx" && eval $libscheck
3828                 $test -f "$xxx" && libstyle=static
3829             fi
3830             if test ! -f "$xxx"; then
3831                 xxx=$thisdir/lib${thislib}_s$_a
3832                 $test -f "$xxx" && eval $libscheck
3833                 $test -f "$xxx" && libstyle=static
3834                 $test -f "$xxx" && thislib=${thislib}_s
3835             fi
3836             if test ! -f "$xxx"; then
3837                 xxx=$thisdir/Slib$thislib$_a
3838                 $test -f "$xxx" && eval $libscheck
3839                 $test -f "$xxx" && libstyle=static
3840             fi
3841             if $test -f "$xxx"; then
3842                 case "$libstyle" in
3843                 shared) echo "Found -l$thislib (shared)." ;;
3844                 static) echo "Found -l$thislib." ;;
3845                 *)      echo "Found -l$thislib ($libstyle)." ;;
3846                 esac
3847                 case " $dflt " in
3848                 *"-l$thislib "*);;
3849                 *) dflt="$dflt -l$thislib"
3850                    libsfound="$libsfound $xxx"
3851                    yyy=`basename $xxx`
3852                    libsfiles="$libsfiles $yyy"
3853                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3854                    case " $libsdirs " in
3855                    *" $yyy "*) ;;
3856                    *) libsdirs="$libsdirs $yyy" ;;
3857                    esac
3858                    ;;
3859                 esac
3860                 break
3861             fi  
3862         done
3863         if $test ! -f "$xxx"; then
3864             echo "No -l$thislib."
3865         fi
3866 done
3867 set X $dflt
3868 shift
3869 dflt="$*"
3870 case "$libs" in
3871 '') dflt="$dflt";;
3872 *) dflt="$libs";;
3873 esac
3874 case "$dflt" in
3875 ' '|'') dflt='none';;
3876 esac
3877
3878 $cat <<EOM
3879
3880 In order to compile $package on your machine, a number of libraries
3881 are usually needed.  Include any other special libraries here as well.
3882 Say "none" for none.  The default list is almost always right.
3883 EOM
3884
3885 echo " "
3886 rp="What libraries to use?"
3887 . ./myread
3888 case "$ans" in
3889 none) libs=' ';;
3890 *) libs="$ans";;
3891 esac
3892
3893 : determine optimization, if desired, or use for debug flag also
3894 case "$optimize" in
3895 ' '|$undef) dflt='none';;
3896 '') dflt='-O';;
3897 *) dflt="$optimize";;
3898 esac
3899 $cat <<EOH
3900
3901 By default, $package compiles with the -O flag to use the optimizer.
3902 Alternately, you might want to use the symbolic debugger, which uses
3903 the -g flag (on traditional Unix systems).  Either flag can be
3904 specified here.  To use neither flag, specify the word "none".
3905
3906 EOH
3907 rp="What optimizer/debugger flag should be used?"
3908 . ./myread
3909 optimize="$ans"
3910 case "$optimize" in
3911 'none') optimize=" ";;
3912 esac
3913
3914 dflt=''
3915 : We will not override a previous value, but we might want to
3916 : augment a hint file
3917 case "$hint" in
3918 default|recommended)
3919         case "$gccversion" in
3920         1*) dflt='-fpcc-struct-return' ;;
3921         esac
3922         case "$optimize" in
3923         *-g*) dflt="$dflt -DDEBUGGING";;
3924         esac
3925         case "$gccversion" in
3926         2*) if test -d /etc/conf/kconfig.d &&
3927                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3928                 then
3929                         dflt="$dflt -posix"
3930                 fi
3931                 ;;
3932         esac
3933         case "$gccversion" in
3934         1*) ;;
3935         2.[0-8]*) ;;
3936         ?*)     echo " "
3937                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3938                 echo 'int main(void) { return 0; }' > gcctest.c
3939                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3940                         echo "Yes, it does." 2>&1
3941                         case "$ccflags" in
3942                         *strict-aliasing*) 
3943                                 echo "Leaving current flags $ccflags alone." 2>&1
3944                                 ;;
3945                         *) dflt="$dflt -fno-strict-aliasing" ;;
3946                         esac
3947                 else
3948                         echo "Nope, it doesn't, but that's ok." 2>&1
3949                 fi
3950                 ;;
3951         esac
3952         ;;
3953 esac
3954
3955 case "$mips_type" in
3956 *BSD*|'') inclwanted="$locincpth $usrinc";;
3957 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3958 esac
3959 for thisincl in $inclwanted; do
3960         if $test -d $thisincl; then
3961                 if $test x$thisincl != x$usrinc; then
3962                         case "$dflt" in
3963                         *" -I$thisincl "*);;
3964                         *) dflt="$dflt -I$thisincl ";;
3965                         esac
3966                 fi
3967         fi
3968 done
3969
3970 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3971         xxx=true;
3972 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3973         xxx=true;
3974 else
3975         xxx=false;
3976 fi;
3977 if $xxx; then
3978         case "$dflt" in
3979         *$2*);;
3980         *) dflt="$dflt -D$2";;
3981         esac;
3982 fi'
3983
3984 set signal.h LANGUAGE_C; eval $inctest
3985
3986 case "$usesocks" in
3987 $define)
3988         ccflags="$ccflags -DSOCKS"
3989         ;;
3990 esac
3991
3992 case "$hint" in
3993 default|recommended) dflt="$ccflags $dflt" ;;
3994 *) dflt="$ccflags";;
3995 esac
3996
3997 case "$dflt" in
3998 ''|' ') dflt=none;;
3999 esac
4000
4001 $cat <<EOH
4002
4003 Your C compiler may want other flags.  For this question you should include
4004 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4005 but you should NOT include libraries or ld flags like -lwhatever.  If you
4006 want $package to honor its debug switch, you should include -DDEBUGGING here.
4007 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4008
4009 To use no flags, specify the word "none".
4010
4011 EOH
4012 set X $dflt
4013 shift
4014 dflt=${1+"$@"}
4015 rp="Any additional cc flags?"
4016 . ./myread
4017 case "$ans" in
4018 none) ccflags='';;
4019 *) ccflags="$ans";;
4020 esac
4021
4022 : the following weeds options from ccflags that are of no interest to cpp
4023 cppflags="$ccflags"
4024 case "$gccversion" in
4025 1*) cppflags="$cppflags -D__GNUC__"
4026 esac
4027 case "$mips_type" in
4028 '');;
4029 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4030 esac
4031 case "$cppflags" in
4032 '');;
4033 *)
4034         echo " "
4035         echo "Let me guess what the preprocessor flags are..." >&4
4036         set X $cppflags
4037         shift
4038         cppflags=''
4039         $cat >cpp.c <<'EOM'
4040 #define BLURFL foo
4041
4042 BLURFL xx LFRULB
4043 EOM
4044         previous=''
4045         for flag in $*
4046         do
4047                 case "$flag" in
4048                 -*) ftry="$flag";;
4049                 *) ftry="$previous $flag";;
4050                 esac
4051                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4052                         >cpp1.out 2>/dev/null && \
4053                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4054                         >cpp2.out 2>/dev/null && \
4055                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4056                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4057                 then
4058                         cppflags="$cppflags $ftry"
4059                         previous=''
4060                 else
4061                         previous="$flag"
4062                 fi
4063         done
4064         set X $cppflags
4065         shift
4066         cppflags=${1+"$@"}
4067         case "$cppflags" in
4068         *-*)  echo "They appear to be: $cppflags";;
4069         esac
4070         $rm -f cpp.c cpp?.out
4071         ;;
4072 esac
4073
4074 : flags used in final linking phase
4075 case "$ldflags" in
4076 '') if ./venix; then
4077                 dflt='-i -z'
4078         else
4079                 dflt=''
4080         fi
4081         case "$ccflags" in
4082         *-posix*) dflt="$dflt -posix" ;;
4083         esac
4084         ;;
4085 *) dflt="$ldflags";;
4086 esac
4087
4088 : Try to guess additional flags to pick up local libraries.
4089 for thislibdir in $libpth; do
4090         case " $loclibpth " in
4091         *" $thislibdir "*)
4092                 case "$dflt " in 
4093                 *"-L$thislibdir "*) ;;
4094                 *)  dflt="$dflt -L$thislibdir" ;;
4095                 esac
4096                 ;;
4097         esac
4098 done
4099
4100 case "$dflt" in
4101 '') dflt='none' ;;
4102 esac
4103
4104 $cat <<EOH
4105
4106 Your C linker may need flags.  For this question you should
4107 include -L/whatever and any other flags used by the C linker, but you
4108 should NOT include libraries like -lwhatever.
4109
4110 Make sure you include the appropriate -L/path flags if your C linker
4111 does not normally search all of the directories you specified above,
4112 namely
4113         $libpth
4114 To use no flags, specify the word "none".
4115
4116 EOH
4117
4118 rp="Any additional ld flags (NOT including libraries)?"
4119 . ./myread
4120 case "$ans" in
4121 none) ldflags='';;
4122 *) ldflags="$ans";;
4123 esac
4124 rmlist="$rmlist pdp11"
4125
4126 : coherency check
4127 echo " "
4128 echo "Checking your choice of C compiler and flags for coherency..." >&4
4129 $cat > try.c <<'EOF'
4130 #include <stdio.h>
4131 int main() { printf("Ok\n"); exit(0); }
4132 EOF
4133 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4134 shift
4135 $cat >try.msg <<'EOM'
4136 I've tried to compile and run the following simple program:
4137
4138 EOM
4139 $cat try.c >> try.msg
4140
4141 $cat >> try.msg <<EOM
4142
4143 I used the command:
4144
4145         $*
4146         ./try
4147
4148 and I got the following output:
4149
4150 EOM
4151 dflt=y
4152 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4153         if $sh -c './try' >>try.msg 2>&1; then
4154                 xxx=`./try`
4155                 case "$xxx" in
4156                 "Ok") dflt=n ;;
4157                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4158                         case " $libs " in
4159                         *" -lsfio "*)
4160                                 cat >> try.msg <<'EOQS'
4161 If $libs contains -lsfio, and sfio is mis-configured, then it
4162 sometimes (apparently) runs and exits with a 0 status, but with no
4163 output!  It may have to do with sfio's use of _exit vs. exit.
4164
4165 EOQS
4166                                 rp="You have a big problem.  Shall I abort Configure"
4167                                 dflt=y
4168                                 ;;
4169                         esac
4170                         ;;
4171                 esac
4172         else
4173                 echo "The program compiled OK, but exited with status $?." >>try.msg
4174                 rp="You have a problem.  Shall I abort Configure"
4175                 dflt=y
4176         fi
4177 else
4178         echo "I can't compile the test program." >>try.msg
4179         rp="You have a BIG problem.  Shall I abort Configure"
4180         dflt=y
4181 fi
4182 case "$dflt" in
4183 y)
4184         $cat try.msg >&4
4185         case "$knowitall" in
4186         '')
4187                 echo "(The supplied flags or libraries might be incorrect.)"
4188                 ;;
4189         *) dflt=n;;
4190         esac
4191         echo " "
4192         . ./myread
4193         case "$ans" in
4194         n*|N*) ;;
4195         *)      echo "Ok.  Stopping Configure." >&4
4196                 exit 1
4197                 ;;
4198         esac
4199         ;;
4200 n) echo "OK, that should do.";;
4201 esac
4202 $rm -f try try.* core
4203
4204 : define an is-a-typedef? function
4205 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4206 case "$inclist" in
4207 "") inclist="sys/types.h";;
4208 esac;
4209 eval "varval=\$$var";
4210 case "$varval" in
4211 "")
4212         $rm -f temp.c;
4213         for inc in $inclist; do
4214                 echo "#include <$inc>" >>temp.c;
4215         done;
4216         echo "#ifdef $type" >> temp.c;
4217         echo "printf(\"We have $type\");" >> temp.c;
4218         echo "#endif" >> temp.c;
4219         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4220         if $contains $type temp.E >/dev/null 2>&1; then
4221                 eval "$var=\$type";
4222         else
4223                 eval "$var=\$def";
4224         fi;
4225         $rm -f temp.?;;
4226 *) eval "$var=\$varval";;
4227 esac'
4228
4229 : define an is-a-typedef? function that prompts if the type is not available.
4230 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4231 case "$inclist" in
4232 "") inclist="sys/types.h";;
4233 esac;
4234 eval "varval=\$$var";
4235 case "$varval" in
4236 "")
4237         $rm -f temp.c;
4238         for inc in $inclist; do
4239                 echo "#include <$inc>" >>temp.c;
4240         done;
4241         echo "#ifdef $type" >> temp.c;
4242         echo "printf(\"We have $type\");" >> temp.c;
4243         echo "#endif" >> temp.c;
4244         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4245         echo " " ;
4246         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4247         if $contains $type temp.E >/dev/null 2>&1; then
4248                 echo "$type found." >&4;
4249                 eval "$var=\$type";
4250         else
4251                 echo "$type NOT found." >&4;
4252                 dflt="$def";
4253                 . ./myread ;
4254                 eval "$var=\$ans";
4255         fi;
4256         $rm -f temp.?;;
4257 *) eval "$var=\$varval";;
4258 esac'
4259
4260 : define a shorthand compile call
4261 compile='
4262 mc_file=$1;
4263 shift;
4264 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4265 : define a shorthand compile call for compilations that should be ok.
4266 compile_ok='
4267 mc_file=$1;
4268 shift;
4269 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4270
4271 : check for lengths of integral types
4272 echo " "
4273 case "$intsize" in
4274 '')
4275         echo "Checking to see how big your integers are..." >&4
4276         $cat >intsize.c <<'EOCP'
4277 #include <stdio.h>
4278 int main()
4279 {
4280         printf("intsize=%d;\n", (int)sizeof(int));
4281         printf("longsize=%d;\n", (int)sizeof(long));
4282         printf("shortsize=%d;\n", (int)sizeof(short));
4283         exit(0);
4284 }
4285 EOCP
4286         set intsize
4287         if eval $compile_ok && ./intsize > /dev/null; then
4288                 eval `./intsize`
4289                 echo "Your integers are $intsize bytes long."
4290                 echo "Your long integers are $longsize bytes long."
4291                 echo "Your short integers are $shortsize bytes long."
4292         else
4293                 $cat >&4 <<EOM
4294 !
4295 Help! I can't compile and run the intsize test program: please enlighten me!
4296 (This is probably a misconfiguration in your system or libraries, and
4297 you really ought to fix it.  Still, I'll try anyway.)
4298 !
4299 EOM
4300                 dflt=4
4301                 rp="What is the size of an integer (in bytes)?"
4302                 . ./myread
4303                 intsize="$ans"
4304                 dflt=$intsize
4305                 rp="What is the size of a long integer (in bytes)?"
4306                 . ./myread
4307                 longsize="$ans"
4308                 dflt=2
4309                 rp="What is the size of a short integer (in bytes)?"
4310                 . ./myread
4311                 shortsize="$ans"
4312         fi
4313         ;;
4314 esac
4315 $rm -f intsize intsize.*
4316
4317 : see what type lseek is declared as in the kernel
4318 rp="What is the type used for lseek's offset on this system?"
4319 set off_t lseektype long stdio.h sys/types.h
4320 eval $typedef_ask
4321
4322 echo " "
4323 echo "Checking to see how big your file offsets are..." >&4
4324 $cat >try.c <<EOCP
4325 #include <sys/types.h>
4326 #include <stdio.h>
4327 int main()
4328 {
4329     printf("%d\n", (int)sizeof($lseektype));
4330     return(0); 
4331 }
4332 EOCP
4333 set try
4334 if eval $compile_ok; then
4335         lseeksize=`./try`
4336         echo "Your file offsets are $lseeksize bytes long."
4337 else
4338         dflt=$longsize
4339         echo " "
4340         echo "(I can't seem to compile the test program.  Guessing...)"
4341         rp="What is the size of your file offsets (in bytes)?"
4342         . ./myread
4343         lseeksize="$ans"
4344 fi
4345 $rm -f try.c try
4346
4347 : see what type file positions are declared as in the library
4348 rp="What is the type for file position used by fsetpos()?"
4349 set fpos_t fpostype long stdio.h sys/types.h
4350 eval $typedef_ask
4351
4352 echo " "
4353 case "$fpostype" in
4354 *_t) zzz="$fpostype"    ;;
4355 *)   zzz="fpos_t"       ;;
4356 esac
4357 echo "Checking the size of $zzz..." >&4 
4358 cat > try.c <<EOCP
4359 #include <sys/types.h>
4360 #include <stdio.h>
4361 int main() {
4362     printf("%d\n", (int)sizeof($fpostype));
4363     exit(0);
4364 }
4365 EOCP
4366 set try
4367 if eval $compile_ok; then
4368         yyy=`./try`
4369         case "$yyy" in
4370         '')     fpossize=4
4371                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4372                 ;;
4373         *)      fpossize=$yyy
4374                 echo "Your $zzz is $fpossize bytes long."
4375                 ;;
4376         esac
4377 else
4378         dflt="$longsize"
4379         echo " " >&4
4380         echo "(I can't compile the test program.  Guessing...)" >&4
4381         rp="What is the size of your file positions (in bytes)?"
4382         . ./myread
4383         fpossize="$ans"
4384 fi
4385
4386
4387
4388 # Backward compatibility (uselfs is deprecated).
4389 case "$uselfs" in
4390 "$define"|true|[yY]*)
4391         cat <<EOM >&4
4392
4393 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4394 EOM
4395         uselargefiles="$define"
4396         ;;
4397 esac                          
4398
4399 case "$lseeksize:$fpossize" in
4400 8:8) cat <<EOM
4401
4402 You can have files larger than 2 gigabytes.
4403 EOM
4404    val="$define" ;;
4405 *)    case "$uselargefiles" in
4406    "$undef"|false|[nN]*) dflt='n' ;;
4407    *)   dflt='y' ;;
4408    esac
4409    cat <<EOM
4410
4411 Perl can be built to understand large files (files larger than 2 gigabytes)
4412 on some systems.  To do so, Configure can be run with -Duselargefiles.
4413
4414 If this doesn't make any sense to you, just accept the default '$dflt'.
4415 EOM
4416    rp='Try to understand large files, if available?'
4417    . ./myread
4418    case "$ans" in
4419    y|Y)         val="$define" ;;
4420    *)           val="$undef"  ;;
4421    esac
4422    ;;
4423 esac
4424 set uselargefiles
4425 eval $setvar
4426 case "$uselargefiles" in
4427 "$define")
4428 : Look for a hint-file generated 'call-back-unit'.  If the
4429 : user has specified that a large files perl is to be built,
4430 : we may need to set or change some other defaults.
4431         if $test -f uselargefiles.cbu; then
4432                 echo "Your platform has some specific hints for large file builds, using them..."
4433                 . ./uselargefiles.cbu
4434                 echo " "
4435                 echo "Rechecking to see how big your file offsets are..." >&4
4436                 $cat >try.c <<EOCP
4437 #include <sys/types.h>
4438 #include <stdio.h>
4439 int main()
4440 {
4441     printf("%d\n", (int)sizeof($lseektype));
4442     return(0); 
4443 }
4444 EOCP
4445                 set try
4446                 if eval $compile_ok; then
4447                         lseeksize=`./try`
4448                         $echo "Your file offsets are now $lseeksize bytes long."
4449                 else
4450                         dflt="$lseeksize"
4451                         echo " "
4452                         echo "(I can't seem to compile the test program.  Guessing...)"
4453                         rp="What is the size of your file offsets (in bytes)?"
4454                         . ./myread
4455                         lseeksize="$ans"
4456                 fi
4457                 case "$fpostype" in
4458                 *_t) zzz="$fpostype"    ;;
4459                 *)   zzz="fpos_t"       ;;
4460                 esac
4461                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4462                 $cat > try.c <<EOCP
4463 #include <sys/types.h>
4464 #include <stdio.h>
4465 int main() {
4466     printf("%d\n", (int)sizeof($fpostype));
4467     exit(0);
4468 }
4469 EOCP
4470                 set try
4471                 if eval $compile_ok; then
4472                         yyy=`./try`
4473                         dflt="$lseeksize"
4474                         case "$yyy" in
4475                         '')     echo " "
4476                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4477                                 ;;
4478                         *)      fpossize=$yyy
4479                                 echo " $fpossize bytes." >&4
4480                                 ;;
4481                         esac
4482                 else
4483                         dflt="$fpossize"
4484                         echo " "
4485                         echo "(I can't compile the test program.  Guessing...)" >&4
4486                         rp="What is the size of your file positions (in bytes)?"
4487                         . ./myread
4488                         fpossize="$ans"
4489                 fi
4490                 $rm -f try.c try
4491         fi
4492         ;;
4493 esac
4494
4495
4496 case "$usemorebits" in
4497 "$define"|true|[yY]*)
4498         use64bitint="$define"
4499         uselongdouble="$define"
4500         usemorebits="$define"
4501         ;;
4502 *)      usemorebits="$undef"
4503         ;;
4504 esac
4505
4506
4507 case "$uselonglong" in
4508 "$define"|true|[yY]*)
4509         cat <<EOM >&4
4510
4511 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4512 EOM
4513         use64bitint="$define"
4514         ;;
4515 esac                          
4516 case "$use64bits" in
4517 "$define"|true|[yY]*)
4518         cat <<EOM >&4
4519
4520 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4521 EOM
4522         use64bitint="$define"
4523         ;;
4524 esac                          
4525 case "$use64bitints" in
4526 "$define"|true|[yY]*)
4527         cat <<EOM >&4
4528
4529 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4530 EOM
4531         use64bitint="$define"
4532         ;;
4533 esac                          
4534 case "$use64bitsint" in
4535 "$define"|true|[yY]*)
4536         cat <<EOM >&4
4537
4538 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4539 EOM
4540         use64bitint="$define"
4541         ;;
4542 esac                          
4543 case "$uselonglongs" in
4544 "$define"|true|[yY]*)
4545         cat <<EOM >&4
4546
4547 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4548 EOM
4549         use64bitint="$define"
4550         ;;
4551 esac                          
4552 case "$use64bitsall" in
4553 "$define"|true|[yY]*)
4554         cat <<EOM >&4
4555
4556 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4557 EOM
4558         use64bitall="$define"
4559         ;;
4560 esac                          
4561
4562 case "$ccflags" in
4563 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4564 esac
4565 case "$use64bitall" in
4566 "$define"|true|[yY]*) use64bitint="$define" ;;
4567 esac
4568
4569 case "$longsize" in
4570 8) cat <<EOM
4571
4572 You have natively 64-bit long integers.
4573 EOM
4574    val="$define"
4575    ;;
4576 *) case "$use64bitint" in
4577    "$define"|true|[yY]*) dflt='y';;
4578    *) dflt='n';;
4579    esac
4580    cat <<EOM
4581
4582 Perl can be built to take advantage of 64-bit integer types
4583 on some systems.  To do so, Configure can be run with -Duse64bitint.
4584 Choosing this option will most probably introduce binary incompatibilities.
4585
4586 If this doesn't make any sense to you, just accept the default '$dflt'.
4587 EOM
4588    rp='Try to use 64-bit integers, if available?'
4589    . ./myread
4590    case "$ans" in
4591    [yY]*) val="$define" ;;
4592    *)     val="$undef"  ;;
4593    esac
4594    ;;
4595 esac
4596 set use64bitint
4597 eval $setvar
4598
4599 case "$use64bitall" in
4600 "$define"|true|[yY]*) dflt='y' ;;
4601 *) case "$longsize" in
4602    8) dflt='y' ;;
4603    *) dflt='n' ;;
4604    esac
4605    ;;
4606 esac    
4607 cat <<EOM
4608
4609 You may also choose to try maximal 64-bitness.  It means using as much
4610 64-bitness as possible on the platform.  This in turn means even more
4611 binary incompatibilities.  On the other hand, your platform may not
4612 have any more 64-bitness available than what you already have chosen.
4613
4614 If this doesn't make any sense to you, just accept the default '$dflt'.
4615 EOM
4616 rp='Try to use maximal 64-bit support, if available?'
4617 . ./myread
4618 case "$ans" in
4619 [yY]*) val="$define" ;;
4620 *)     val="$undef"  ;;
4621 esac
4622 set use64bitall
4623 eval $setvar
4624 case "$use64bitall" in
4625 "$define")
4626         case "$use64bitint" in
4627         "$undef")
4628                 cat <<EOM
4629
4630 Since you have chosen a maximally 64-bit build, I'm also turning on
4631 the use of 64-bit integers.
4632 EOM
4633                 use64bitint="$define" ;;
4634         esac
4635         ;;
4636 esac
4637
4638 case "$use64bitint" in
4639 "$define"|true|[yY]*)
4640 : Look for a hint-file generated 'call-back-unit'.  If the
4641 : user has specified that a 64-bit perl is to be built,
4642 : we may need to set or change some other defaults.
4643         if $test -f use64bitint.cbu; then
4644                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4645                 . ./use64bitint.cbu
4646         fi
4647         case "$longsize" in
4648         4) case "$archname64" in
4649            '') archname64=64int ;;
4650            esac
4651            ;;
4652         esac
4653         ;;
4654 esac
4655
4656 case "$use64bitall" in
4657 "$define"|true|[yY]*)
4658 : Look for a hint-file generated 'call-back-unit'.  If the
4659 : user has specified that a maximally 64-bit perl is to be built,
4660 : we may need to set or change some other defaults.
4661         if $test -f use64bitall.cbu; then
4662                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4663                 . ./use64bitall.cbu
4664         fi
4665         case "$longsize" in
4666         4) case "$archname64" in
4667            ''|64int) archname64=64all ;;
4668            esac
4669            ;;
4670         esac
4671         ;;
4672 esac
4673
4674 echo " "
4675 echo "Checking for GNU C Library..." >&4
4676 cat >gnulibc.c <<EOM
4677 #include <stdio.h>
4678 int main()
4679 {
4680 #ifdef __GLIBC__
4681     exit(0);
4682 #else
4683     exit(1);
4684 #endif
4685 }
4686 EOM
4687 set gnulibc
4688 if eval $compile_ok && ./gnulibc; then
4689         val="$define"
4690         echo "You are using the GNU C Library"
4691 else
4692         val="$undef"
4693         echo "You are not using the GNU C Library"
4694 fi
4695 $rm -f gnulibc*
4696 set d_gnulibc
4697 eval $setvar
4698
4699 : see if nm is to be used to determine whether a symbol is defined or not
4700 case "$usenm" in
4701 '')
4702         dflt=''
4703         case "$d_gnulibc" in
4704         "$define")
4705                 echo " "
4706                 echo "nm probably won't work on the GNU C Library." >&4
4707                 dflt=n
4708                 ;;
4709         esac
4710         case "$dflt" in
4711         '') 
4712                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4713                         echo " "
4714                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4715                         echo "'nm' won't be sufficient on this sytem." >&4
4716                         dflt=n
4717                 fi
4718                 ;;
4719         esac
4720         case "$dflt" in
4721         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4722                 if $test $dflt -gt 20; then
4723                         dflt=y
4724                 else
4725                         dflt=n
4726                 fi
4727                 ;;
4728         esac
4729         ;;
4730 *)
4731         case "$usenm" in
4732         true|$define) dflt=y;;
4733         *) dflt=n;;
4734         esac
4735         ;;
4736 esac
4737 $cat <<EOM
4738
4739 I can use $nm to extract the symbols from your C libraries. This
4740 is a time consuming task which may generate huge output on the disk (up
4741 to 3 megabytes) but that should make the symbols extraction faster. The
4742 alternative is to skip the 'nm' extraction part and to compile a small
4743 test program instead to determine whether each symbol is present. If
4744 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4745 this may be the best solution.
4746
4747 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4748
4749 EOM
4750 rp="Shall I use $nm to extract C symbols from the libraries?"
4751 . ./myread
4752 case "$ans" in
4753 [Nn]*) usenm=false;;
4754 *) usenm=true;;
4755 esac
4756
4757 runnm=$usenm
4758 case "$reuseval" in
4759 true) runnm=false;;
4760 esac
4761
4762 : nm options which may be necessary
4763 case "$nm_opt" in
4764 '') if $test -f /mach_boot; then
4765                 nm_opt=''       # Mach
4766         elif $test -d /usr/ccs/lib; then
4767                 nm_opt='-p'     # Solaris (and SunOS?)
4768         elif $test -f /dgux; then
4769                 nm_opt='-p'     # DG-UX
4770         elif $test -f /lib64/rld; then
4771                 nm_opt='-p'     # 64-bit Irix
4772         else
4773                 nm_opt=''
4774         fi;;
4775 esac
4776
4777 : nm options which may be necessary for shared libraries but illegal
4778 : for archive libraries.  Thank you, Linux.
4779 case "$nm_so_opt" in
4780 '')     case "$myuname" in
4781         *linux*)
4782                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4783                         nm_so_opt='--dynamic'
4784                 fi
4785                 ;;
4786         esac
4787         ;;
4788 esac
4789
4790 case "$runnm" in
4791 true)
4792 : get list of predefined functions in a handy place
4793 echo " "
4794 case "$libc" in
4795 '') libc=unknown
4796         case "$libs" in
4797         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4798         esac
4799         ;;
4800 esac
4801 libnames='';
4802 case "$libs" in
4803 '') ;;
4804 *)  for thislib in $libs; do
4805         case "$thislib" in
4806         -lc|-lc_s)
4807                 : Handle C library specially below.
4808                 ;;
4809         -l*)
4810                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4811                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4812                         :
4813                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4814                         :
4815                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4816                         :
4817                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4818                         :
4819                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4820                         :
4821                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4822                         :
4823                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4824                         :
4825                 else
4826                         try=''
4827                 fi
4828                 libnames="$libnames $try"
4829                 ;;
4830         *) libnames="$libnames $thislib" ;;
4831         esac
4832         done
4833         ;;
4834 esac
4835 xxx=normal
4836 case "$libc" in
4837 unknown)
4838         set /lib/libc.$so
4839         for xxx in $libpth; do
4840                 $test -r $1 || set $xxx/libc.$so
4841                 : The messy sed command sorts on library version numbers.
4842                 $test -r $1 || \
4843                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4844                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4845                                 h
4846                                 s/[0-9][0-9]*/0000&/g
4847                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4848                                 G
4849                                 s/\n/ /' | \
4850                          $sort | $sed -e 's/^.* //'`
4851                 eval set \$$#
4852         done
4853         $test -r $1 || set /usr/ccs/lib/libc.$so
4854         $test -r $1 || set /lib/libsys_s$_a
4855         ;;
4856 *)
4857         set blurfl
4858         ;;
4859 esac
4860 if $test -r "$1"; then
4861         echo "Your (shared) C library seems to be in $1."
4862         libc="$1"
4863 elif $test -r /lib/libc && $test -r /lib/clib; then
4864         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4865         xxx=apollo
4866         libc='/lib/clib /lib/libc'
4867         if $test -r /lib/syslib; then
4868                 echo "(Your math library is in /lib/syslib.)"
4869                 libc="$libc /lib/syslib"
4870         fi
4871 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4872         echo "Your C library seems to be in $libc, as you said before."
4873 elif $test -r $incpath/usr/lib/libc$_a; then
4874         libc=$incpath/usr/lib/libc$_a;
4875         echo "Your C library seems to be in $libc.  That's fine."
4876 elif $test -r /lib/libc$_a; then
4877         libc=/lib/libc$_a;
4878         echo "Your C library seems to be in $libc.  You're normal."
4879 else
4880         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4881                 :
4882         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4883                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4884         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4885                 :
4886         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4887                 :
4888         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4889                 :
4890         else
4891                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4892         fi
4893         if $test -r "$tans"; then
4894                 echo "Your C library seems to be in $tans, of all places."
4895                 libc=$tans
4896         else
4897                 libc='blurfl'
4898         fi
4899 fi
4900 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4901         dflt="$libc"
4902         cat <<EOM
4903
4904 If the guess above is wrong (which it might be if you're using a strange
4905 compiler, or your machine supports multiple models), you can override it here.
4906
4907 EOM
4908 else
4909         dflt=''
4910         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4911         cat >&4 <<EOM
4912 I can't seem to find your C library.  I've looked in the following places:
4913
4914 EOM
4915         $sed 's/^/      /' libpath
4916         cat <<EOM
4917
4918 None of these seems to contain your C library. I need to get its name...
4919
4920 EOM
4921 fi
4922 fn=f
4923 rp='Where is your C library?'
4924 . ./getfile
4925 libc="$ans"
4926
4927 echo " "
4928 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4929 set X `cat libnames`
4930 shift
4931 xxx=files
4932 case $# in 1) xxx=file; esac
4933 echo "Extracting names from the following $xxx for later perusal:" >&4
4934 echo " "
4935 $sed 's/^/      /' libnames >&4
4936 echo " "
4937 $echo $n "This may take a while...$c" >&4
4938
4939 for file in $*; do
4940         case $file in
4941         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4942         *) $nm $nm_opt $file 2>/dev/null;;
4943         esac
4944 done >libc.tmp
4945
4946 $echo $n ".$c"
4947 $grep fprintf libc.tmp > libc.ptf
4948 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4949 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4950 xxx='[ADTSIW]'
4951 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4952         eval $xscan;\
4953         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4954                 eval $xrun
4955 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4956         eval $xscan;\
4957         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4958                 eval $xrun
4959 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4960         eval $xscan;\
4961         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4962                 eval $xrun
4963 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4964         eval $xscan;\
4965         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4966                 eval $xrun
4967 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4968         eval $xscan;\
4969         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4970                 eval $xrun
4971 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4972         eval $xscan;\
4973         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4974                 eval $xrun
4975 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4976                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4977         eval $xscan;\
4978         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4979                 eval $xrun
4980 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4981         eval $xscan;\
4982         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4983                 eval $xrun
4984 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4985         eval $xscan;\
4986         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4987                 eval $xrun
4988 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4989         eval $xscan;\
4990         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4991                 eval $xrun
4992 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4993         eval $xscan;\
4994         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4995                 eval $xrun
4996 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4997         eval $xscan;\
4998         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4999                 eval $xrun
5000 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5001         eval $xscan;\
5002         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5003                 eval $xrun
5004 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5005         eval $xscan;\
5006         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5007                 eval $xrun
5008 else
5009         $nm -p $* 2>/dev/null >libc.tmp
5010         $grep fprintf libc.tmp > libc.ptf
5011         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5012                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5013         then
5014                 nm_opt='-p'
5015                 eval $xrun
5016         else
5017                 echo " "
5018                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5019                 com=''
5020                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5021                         for thisname in $libnames $libc; do
5022                                 $ar t $thisname >>libc.tmp
5023                         done
5024                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5025                         echo "Ok." >&4
5026                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5027                         # Repeat libc to extract forwarders to DLL entries too
5028                         for thisname in $libnames $libc; do
5029                                 $ar tv $thisname >>libc.tmp
5030                                 # Revision 50 of EMX has bug in $ar.
5031                                 # it will not extract forwarders to DLL entries
5032                                 # Use emximp which will extract exactly them.
5033                                 emximp -o tmp.imp $thisname \
5034                                     2>/dev/null && \
5035                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5036                                     < tmp.imp >>libc.tmp
5037                                 $rm tmp.imp
5038                         done
5039                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5040                         echo "Ok." >&4
5041                 else
5042                         echo "$ar didn't seem to work right." >&4
5043                         echo "Maybe this is a Cray...trying bld instead..." >&4
5044                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5045                         then
5046                                 for thisname in $libnames; do
5047                                         bld t $libnames | \
5048                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5049                                         $ar t $thisname >>libc.tmp
5050                                 done
5051                                 echo "Ok." >&4
5052                         else
5053                                 echo "That didn't work either.  Giving up." >&4
5054                                 exit 1
5055                         fi
5056                 fi
5057         fi
5058 fi
5059 nm_extract="$com"
5060 if $test -f /lib/syscalls.exp; then
5061         echo " "
5062         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5063         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5064 fi
5065 ;;
5066 esac
5067 $rm -f libnames libpath
5068
5069 : is a C symbol defined?
5070 csym='tlook=$1;
5071 case "$3" in
5072 -v) tf=libc.tmp; tc=""; tdc="";;
5073 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5074 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5075 esac;
5076 tx=yes;
5077 case "$reuseval-$4" in
5078 true-) ;;
5079 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5080 esac;
5081 case "$tx" in
5082 yes)
5083         case "$runnm" in
5084         true)
5085                 if $contains $tlook $tf >/dev/null 2>&1;
5086                 then tval=true;
5087                 else tval=false;
5088                 fi;;
5089         *)
5090                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5091                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5092                 then tval=true;
5093                 else tval=false;
5094                 fi;
5095                 $rm -f t t.c;;
5096         esac;;
5097 *)
5098         case "$tval" in
5099         $define) tval=true;;
5100         *) tval=false;;
5101         esac;;
5102 esac;
5103 eval "$2=$tval"'
5104
5105 : define an is-in-libc? function
5106 inlibc='echo " "; td=$define; tu=$undef;
5107 sym=$1; var=$2; eval "was=\$$2";
5108 tx=yes;
5109 case "$reuseval$was" in
5110 true) ;;
5111 true*) tx=no;;
5112 esac;
5113 case "$tx" in
5114 yes)
5115         set $sym tres -f;
5116         eval $csym;
5117         case "$tres" in
5118         true)
5119                 echo "$sym() found." >&4;
5120                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5121         *)
5122                 echo "$sym() NOT found." >&4;
5123                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5124         esac;;
5125 *)
5126         case "$was" in
5127         $define) echo "$sym() found." >&4;;
5128         *) echo "$sym() NOT found." >&4;;
5129         esac;;
5130 esac'
5131
5132 : see if sqrtl exists
5133 set sqrtl d_sqrtl
5134 eval $inlibc
5135
5136 case "$ccflags" in
5137 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5138 esac
5139
5140 case "$uselongdouble" in
5141 $define|true|[yY]*)     dflt='y';;
5142 *) dflt='n';;
5143 esac
5144 cat <<EOM
5145
5146 Perl can be built to take advantage of long doubles which
5147 (if available) may give more accuracy and range for floating point numbers.
5148
5149 If this doesn't make any sense to you, just accept the default '$dflt'.
5150 EOM
5151 rp='Try to use long doubles if available?'
5152 . ./myread
5153 case "$ans" in
5154 y|Y)    val="$define"   ;;
5155 *)      val="$undef"    ;;
5156 esac
5157 set uselongdouble
5158 eval $setvar
5159
5160 case "$uselongdouble" in
5161 true|[yY]*) uselongdouble="$define" ;;
5162 esac
5163
5164 case "$uselongdouble" in
5165 $define)
5166 : Look for a hint-file generated 'call-back-unit'.  If the
5167 : user has specified that long doubles should be used,
5168 : we may need to set or change some other defaults.
5169         if $test -f uselongdouble.cbu; then
5170                 echo "Your platform has some specific hints for long doubles, using them..."
5171                 . ./uselongdouble.cbu
5172         else
5173                 $cat <<EOM
5174 (Your platform doesn't have any specific hints for long doubles.)
5175 EOM
5176         fi
5177         ;;
5178 esac
5179
5180 case "$uselongdouble:$d_sqrtl" in
5181 $define:$undef)
5182                 $cat <<EOM >&4
5183
5184 *** You requested the use of long doubles but you do not seem to have
5185 *** the mathematic functions for long doubles.  I'm disabling the use
5186 *** of long doubles.
5187
5188 EOM
5189         uselongdouble=$undef
5190         ;;
5191 esac
5192
5193 : check for length of double
5194 echo " "
5195 case "$doublesize" in
5196 '')
5197         echo "Checking to see how big your double precision numbers are..." >&4
5198         $cat >try.c <<'EOCP'
5199 #include <stdio.h>
5200 int main()
5201 {
5202     printf("%d\n", (int)sizeof(double));
5203     exit(0);
5204 }
5205 EOCP
5206         set try
5207         if eval $compile_ok; then
5208                 doublesize=`./try`
5209                 echo "Your double is $doublesize bytes long."
5210         else
5211                 dflt='8'
5212                 echo "(I can't seem to compile the test program.  Guessing...)"
5213                 rp="What is the size of a double precision number (in bytes)?"
5214                 . ./myread
5215                 doublesize="$ans"
5216         fi
5217         ;;
5218 esac
5219 $rm -f try.c try
5220
5221 : check for long doubles
5222 echo " "
5223 echo "Checking to see if you have long double..." >&4
5224 echo 'int main() { long double x = 7.0; }' > try.c
5225 set try
5226 if eval $compile; then
5227         val="$define"
5228         echo "You have long double."
5229 else
5230         val="$undef"
5231         echo "You do not have long double."
5232 fi
5233 $rm try.*
5234 set d_longdbl
5235 eval $setvar
5236
5237 : check for length of long double
5238 case "${d_longdbl}${longdblsize}" in
5239 $define)
5240         echo " "
5241         echo "Checking to see how big your long doubles are..." >&4
5242         $cat >try.c <<'EOCP'
5243 #include <stdio.h>
5244 int main()
5245 {
5246         printf("%d\n", sizeof(long double));
5247 }
5248 EOCP
5249         set try
5250         set try
5251         if eval $compile; then
5252                 longdblsize=`./try$exe_ext`
5253                 echo "Your long doubles are $longdblsize bytes long."
5254         else
5255                 dflt='8'
5256                 echo " "
5257                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5258                 rp="What is the size of a long double (in bytes)?"
5259                 . ./myread
5260                 longdblsize="$ans"
5261         fi
5262         if $test "X$doublesize" = "X$longdblsize"; then
5263                 echo "(That isn't any different from an ordinary double.)"
5264         fi      
5265         ;;
5266 esac
5267 $rm -f try.* try
5268
5269 : determine the architecture name
5270 echo " "
5271 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5272         tarch=`arch`"-$osname"
5273 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5274         if uname -m > tmparch 2>&1 ; then
5275                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5276                         -e 's/$/'"-$osname/" tmparch`
5277         else
5278                 tarch="$osname"
5279         fi
5280         $rm -f tmparch
5281 else
5282         tarch="$osname"
5283 fi
5284 case "$myarchname" in
5285 ''|"$tarch") ;;
5286 *)
5287         echo "(Your architecture name used to be $myarchname.)"
5288         archname=''
5289         ;;
5290 esac
5291 myarchname="$tarch"
5292 case "$archname" in
5293 '') dflt="$tarch";;
5294 *) dflt="$archname";;
5295 esac
5296 rp='What is your architecture name'
5297 . ./myread
5298 archname="$ans"
5299 case "$usethreads" in
5300 $define)
5301         echo "Threads selected." >&4
5302         case "$archname" in
5303         *-thread*) echo "...and architecture name already has -thread." >&4
5304                 ;;
5305         *)      archname="$archname-thread"
5306                 echo "...setting architecture name to $archname." >&4
5307                 ;;
5308         esac
5309         ;;
5310 esac
5311 case "$usemultiplicity" in
5312 $define)
5313         echo "Multiplicity selected." >&4
5314         case "$archname" in
5315         *-multi*) echo "...and architecture name already has -multi." >&4
5316                 ;;
5317         *)      archname="$archname-multi"
5318                 echo "...setting architecture name to $archname." >&4
5319                 ;;
5320         esac
5321         ;;
5322 esac
5323 case "$use64bitint$use64bitall" in
5324 *"$define"*)
5325         case "$archname64" in
5326         '')
5327                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5328                 ;;
5329         *)
5330                 case "$use64bitint" in
5331                 "$define") echo "64 bit integers selected." >&4 ;;
5332                 esac
5333                 case "$use64bitall" in
5334                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5335                 esac
5336                 case "$archname" in
5337                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5338                         ;;
5339                 *)      archname="$archname-$archname64"
5340                         echo "...setting architecture name to $archname." >&4
5341                         ;;
5342                 esac
5343                 ;;
5344         esac
5345 esac
5346 case "$uselongdouble" in
5347 $define)
5348         echo "Long doubles selected." >&4
5349         case "$longdblsize" in
5350         $doublesize)
5351                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5352                 ;;
5353         *)
5354                 case "$archname" in
5355                 *-ld*) echo "...and architecture name already has -ld." >&4
5356                         ;;
5357                 *)      archname="$archname-ld"
5358                         echo "...setting architecture name to $archname." >&4
5359                         ;;
5360                 esac
5361                 ;;
5362         esac
5363         ;;
5364 esac
5365
5366 : determine root of directory hierarchy where package will be installed.
5367 case "$prefix" in
5368 '')
5369         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5370         ;;
5371 *)
5372         dflt="$prefix"
5373         ;;
5374 esac
5375 $cat <<EOM
5376
5377 By default, $package will be installed in $dflt/bin, manual pages
5378 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5379 installation directories. Typically this is something like /usr/local.
5380 If you wish to have binaries under /usr/bin but other parts of the
5381 installation under /usr/local, that's ok: you will be prompted
5382 separately for each of the installation directories, the prefix being
5383 only used to set the defaults.
5384
5385 EOM
5386 fn=d~
5387 rp='Installation prefix to use?'
5388 . ./getfile
5389 oldprefix=''
5390 case "$prefix" in
5391 '') ;;
5392 *)
5393         case "$ans" in
5394         "$prefix") ;;
5395         *) oldprefix="$prefix";;
5396         esac
5397         ;;
5398 esac
5399 prefix="$ans"
5400 prefixexp="$ansexp"
5401
5402 : is AFS running?
5403 echo " "
5404 case "$afs" in
5405 $define|true)   afs=true ;;
5406 $undef|false)   afs=false ;;
5407 *)      if test -d /afs; then
5408                 afs=true
5409         else
5410                 afs=false
5411         fi
5412         ;;
5413 esac
5414 if $afs; then
5415         echo "AFS may be running... I'll be extra cautious then..." >&4
5416 else
5417         echo "AFS does not seem to be running..." >&4
5418 fi
5419
5420 : determine installation prefix for where package is to be installed.
5421 if $afs; then 
5422 $cat <<EOM
5423
5424 Since you are running AFS, I need to distinguish the directory in which
5425 files will reside from the directory in which they are installed (and from
5426 which they are presumably copied to the former directory by occult means).
5427
5428 EOM
5429         case "$installprefix" in
5430         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5431         *) dflt="$installprefix";;
5432         esac
5433 else
5434 $cat <<EOM
5435
5436 In some special cases, particularly when building $package for distribution,
5437 it is convenient to distinguish between the directory in which files should 
5438 be installed from the directory ($prefix) in which they 
5439 will eventually reside.  For most users, these two directories are the same.
5440
5441 EOM
5442         case "$installprefix" in
5443         '') dflt=$prefix ;;
5444         *) dflt=$installprefix;;
5445         esac
5446 fi
5447 fn=d~
5448 rp='What installation prefix should I use for installing files?'
5449 . ./getfile
5450 installprefix="$ans"
5451 installprefixexp="$ansexp"
5452
5453 : set the prefixit variable, to compute a suitable default value
5454 prefixit='case "$3" in
5455 ""|none)
5456         case "$oldprefix" in
5457         "") eval "$1=\"\$$2\"";;
5458         *)
5459                 case "$3" in
5460                 "") eval "$1=";;
5461                 none)
5462                         eval "tp=\"\$$2\"";
5463                         case "$tp" in
5464                         ""|" ") eval "$1=\"\$$2\"";;
5465                         *) eval "$1=";;
5466                         esac;;
5467                 esac;;
5468         esac;;
5469 *)
5470         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5471         case "$tp" in
5472         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5473         /*-$oldprefix/*|\~*-$oldprefix/*)
5474                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5475         *) eval "$1=\"\$$2\"";;
5476         esac;;
5477 esac'
5478
5479
5480 : get the patchlevel
5481 echo " "
5482 echo "Getting the current patchlevel..." >&4
5483 if $test -r $rsrc/patchlevel.h;then
5484         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5485         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5486         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5487         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5488         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5489         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5490 else
5491         revision=0
5492         patchlevel=0
5493         subversion=0
5494         api_revision=0
5495         api_version=0
5496         api_subversion=0
5497 fi
5498 $echo "(You have $package version $patchlevel subversion $subversion.)"
5499 case "$osname" in
5500 dos|vms)
5501         : XXX Should be a Configure test for double-dots in filenames.
5502         version=`echo $revision $patchlevel $subversion | \
5503                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5504         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5505                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5506         ;;
5507 *)
5508         version=`echo $revision $patchlevel $subversion | \
5509                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5510         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5511                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5512         ;;
5513 esac
5514 : Special case the 5.005_xx maintenance series, which used 5.005
5515 : without any subversion label as a subdirectory in $sitelib
5516 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5517         api_versionstring='5.005'
5518 fi
5519
5520 : determine installation style
5521 : For now, try to deduce it from prefix unless it is already set.
5522 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5523 case "$installstyle" in
5524 '')     case "$prefix" in
5525                 *perl*) dflt='lib';;
5526                 *) dflt='lib/perl5' ;;
5527         esac
5528         ;;
5529 *)      dflt="$installstyle" ;;
5530 esac
5531 : Probably not worth prompting for this since we prompt for all
5532 : the directories individually, and the prompt would be too long and
5533 : confusing anyway.
5534 installstyle=$dflt
5535
5536 : determine where private library files go
5537 : Usual default is /usr/local/lib/perl5/$version.
5538 : Also allow things like /opt/perl/lib/$version, since 
5539 : /opt/perl/lib/perl5... would be redundant.
5540 : The default "style" setting is made in installstyle.U
5541 case "$installstyle" in
5542 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5543 *)       set dflt privlib lib/$version ;;
5544 esac
5545 eval $prefixit
5546 $cat <<EOM
5547
5548 There are some auxiliary files for $package that need to be put into a
5549 private library directory that is accessible by everyone.
5550
5551 EOM
5552 fn=d~+
5553 rp='Pathname where the private library files will reside?'
5554 . ./getfile
5555 privlib="$ans"
5556 privlibexp="$ansexp"
5557 : Change installation prefix, if necessary.
5558 if $test X"$prefix" != X"$installprefix"; then
5559         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5560 else
5561         installprivlib="$privlibexp"
5562 fi
5563
5564 : set the prefixup variable, to restore leading tilda escape
5565 prefixup='case "$prefixexp" in
5566 "$prefix") ;;
5567 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5568 esac'
5569
5570 : determine where public architecture dependent libraries go
5571 set archlib archlib
5572 eval $prefixit
5573 : privlib default is /usr/local/lib/$package/$version
5574 : archlib default is /usr/local/lib/$package/$version/$archname
5575 : privlib may have an optional trailing /share.
5576 tdflt=`echo $privlib | $sed 's,/share$,,'`
5577 tdflt=$tdflt/$archname
5578 case "$archlib" in
5579 '')     dflt=$tdflt
5580         ;;
5581 *)      dflt="$archlib"
5582     ;;
5583 esac
5584 $cat <<EOM
5585
5586 $spackage contains architecture-dependent library files.  If you are
5587 sharing libraries in a heterogeneous environment, you might store
5588 these files in a separate location.  Otherwise, you can just include
5589 them with the rest of the public library files.
5590
5591 EOM
5592 fn=d+~
5593 rp='Where do you want to put the public architecture-dependent libraries?'
5594 . ./getfile
5595 archlib="$ans"
5596 archlibexp="$ansexp"
5597 if $test X"$archlib" = X"$privlib"; then
5598         d_archlib="$undef"
5599 else
5600         d_archlib="$define"
5601 fi
5602 : Change installation prefix, if necessary.
5603 if $test X"$prefix" != X"$installprefix"; then
5604         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5605 else
5606         installarchlib="$archlibexp"
5607 fi
5608
5609
5610 : Binary compatibility with 5.005 is not possible for builds
5611 : with advanced features
5612 case "$usethreads$usemultiplicity" in
5613 *define*)
5614         bincompat5005="$undef"
5615         d_bincompat5005="$undef"
5616         ;;
5617 *)      $cat <<EOM
5618
5619 This version of Perl can be compiled for binary compatibility with 5.005.
5620 If you decide to do so, you will be able to continue using most of the
5621 extensions that were compiled for Perl 5.005.
5622
5623 EOM
5624         case "$bincompat5005$d_bincompat5005" in
5625         *"$undef"*) dflt=n ;;
5626         *) dflt=y ;;
5627         esac
5628         rp='Binary compatibility with Perl 5.005?'
5629         . ./myread
5630         case "$ans" in
5631         y*) val="$define" ;;
5632         *)  val="$undef" ;;
5633         esac
5634         set d_bincompat5005
5635         eval $setvar
5636         case "$d_bincompat5005" in
5637         "$define")
5638                 bincompat5005="$define"
5639                 ;;
5640         *)      bincompat5005="$undef"
5641                 d_bincompat5005="$undef"
5642                 ;;
5643         esac
5644         ;;
5645 esac
5646
5647
5648 : see if setuid scripts can be secure
5649 $cat <<EOM
5650
5651 Some kernels have a bug that prevents setuid #! scripts from being
5652 secure.  Some sites have disabled setuid #! scripts because of this.
5653
5654 First let's decide if your kernel supports secure setuid #! scripts.
5655 (If setuid #! scripts would be secure but have been disabled anyway,
5656 don't say that they are secure if asked.)
5657
5658 EOM
5659
5660 val="$undef"
5661 if $test -d /dev/fd; then
5662         echo "#!$ls" >reflect
5663         chmod +x,u+s reflect
5664         ./reflect >flect 2>&1
5665         if $contains "/dev/fd" flect >/dev/null; then
5666                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5667                 val="$define"
5668         else
5669                 $cat <<EOM
5670 If you are not sure if they are secure, I can check but I'll need a
5671 username and password different from the one you are using right now.
5672 If you don't have such a username or don't want me to test, simply
5673 enter 'none'.
5674
5675 EOM
5676                 rp='Other username to test security of setuid scripts with?'
5677                 dflt='none'
5678                 . ./myread
5679                 case "$ans" in
5680                 n|none)
5681                         case "$d_suidsafe" in
5682                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5683                                 dflt=n;;
5684                         "$undef")
5685                                 echo "Well, the $hint value is *not* secure." >&4
5686                                 dflt=n;;
5687                         *)      echo "Well, the $hint value *is* secure." >&4
5688                                 dflt=y;;
5689                         esac
5690                         ;;
5691                 *)
5692                         $rm -f reflect flect
5693                         echo "#!$ls" >reflect
5694                         chmod +x,u+s reflect
5695                         echo >flect
5696                         chmod a+w flect
5697                         echo '"su" will (probably) prompt you for '"$ans's password."
5698                         su $ans -c './reflect >flect'
5699                         if $contains "/dev/fd" flect >/dev/null; then
5700                                 echo "Okay, it looks like setuid scripts are secure." >&4
5701                                 dflt=y
5702                         else
5703                                 echo "I don't think setuid scripts are secure." >&4
5704                                 dflt=n
5705                         fi
5706                         ;;
5707                 esac
5708                 rp='Does your kernel have *secure* setuid scripts?'
5709                 . ./myread
5710                 case "$ans" in
5711                 [yY]*)  val="$define";;
5712                 *)      val="$undef";;
5713                 esac
5714         fi
5715 else
5716         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5717         echo "(That's for file descriptors, not floppy disks.)"
5718         val="$undef"
5719 fi
5720 set d_suidsafe
5721 eval $setvar
5722
5723 $rm -f reflect flect
5724
5725 : now see if they want to do setuid emulation
5726 echo " "
5727 val="$undef"
5728 case "$d_suidsafe" in
5729 "$define")
5730         val="$undef"
5731         echo "No need to emulate SUID scripts since they are secure here." >& 4
5732         ;;
5733 *)
5734         $cat <<EOM
5735 Some systems have disabled setuid scripts, especially systems where
5736 setuid scripts cannot be secure.  On systems where setuid scripts have
5737 been disabled, the setuid/setgid bits on scripts are currently
5738 useless.  It is possible for $package to detect those bits and emulate
5739 setuid/setgid in a secure fashion.  This emulation will only work if
5740 setuid scripts have been disabled in your kernel.
5741
5742 EOM
5743         case "$d_dosuid" in
5744         "$define") dflt=y ;;
5745         *) dflt=n ;;
5746         esac
5747         rp="Do you want to do setuid/setgid emulation?"
5748         . ./myread
5749         case "$ans" in
5750         [yY]*)  val="$define";;
5751         *)      val="$undef";;
5752         esac
5753         ;;
5754 esac
5755 set d_dosuid
5756 eval $setvar
5757
5758 : determine filename position in cpp output
5759 echo " "
5760 echo "Computing filename position in cpp output for #include directives..." >&4
5761 echo '#include <stdio.h>' > foo.c
5762 $cat >fieldn <<EOF
5763 $startsh
5764 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5765 $grep '^[       ]*#.*stdio\.h' | \
5766 while read cline; do
5767         pos=1
5768         set \$cline
5769         while $test \$# -gt 0; do
5770                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5771                         echo "\$pos"
5772                         exit 0
5773                 fi
5774                 shift
5775                 pos=\`expr \$pos + 1\`
5776         done
5777 done
5778 EOF
5779 chmod +x fieldn
5780 fieldn=`./fieldn`
5781 $rm -f foo.c fieldn
5782 case $fieldn in
5783 '') pos='???';;
5784 1) pos=first;;
5785 2) pos=second;;
5786 3) pos=third;;
5787 *) pos="${fieldn}th";;
5788 esac
5789 echo "Your cpp writes the filename in the $pos field of the line."
5790
5791 : locate header file
5792 $cat >findhdr <<EOF
5793 $startsh
5794 wanted=\$1
5795 name=''
5796 for usrincdir in $usrinc
5797 do
5798         if test -f \$usrincdir/\$wanted; then
5799                 echo "\$usrincdir/\$wanted"
5800                 exit 0
5801         fi
5802 done
5803 awkprg='{ print \$$fieldn }'
5804 echo "#include <\$wanted>" > foo\$\$.c
5805 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5806 $grep "^[       ]*#.*\$wanted" | \
5807 while read cline; do
5808         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5809         case "\$name" in
5810         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5811         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5812         *) exit 2;;
5813         esac;
5814 done;
5815 #
5816 # status = 0: grep returned 0 lines, case statement not executed
5817 # status = 1: headerfile found
5818 # status = 2: while loop executed, no headerfile found
5819 #
5820 status=\$?
5821 $rm -f foo\$\$.c;
5822 if test \$status -eq 1; then
5823         exit 0;
5824 fi
5825 exit 1
5826 EOF
5827 chmod +x findhdr
5828
5829 : define an alternate in-header-list? function
5830 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5831 cont=true; xxf="echo \"<\$1> found.\" >&4";
5832 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5833 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5834 esac;
5835 case $# in 4) instead=instead;; *) instead="at last";; esac;
5836 while $test "$cont"; do
5837         xxx=`./findhdr $1`
5838         var=$2; eval "was=\$$2";
5839         if $test "$xxx" && $test -r "$xxx";
5840         then eval $xxf;
5841         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5842                 cont="";
5843         else eval $xxnf;
5844         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5845         set $yyy; shift; shift; yyy=$@;
5846         case $# in 0) cont="";;
5847         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5848                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5849         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5850                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5851         esac;
5852 done;
5853 while $test "$yyy";
5854 do set $yyy; var=$2; eval "was=\$$2";
5855         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5856         set $yyy; shift; shift; yyy=$@;
5857 done'
5858
5859 : see if this is a malloc.h system
5860 set malloc.h i_malloc
5861 eval $inhdr
5862
5863 : see if stdlib is available
5864 set stdlib.h i_stdlib
5865 eval $inhdr
5866
5867 : determine which malloc to compile in
5868 echo " "
5869 case "$usemymalloc" in
5870 ''|[yY]*|true|$define)  dflt='y' ;;
5871 *)      dflt='n' ;;
5872 esac
5873 rp="Do you wish to attempt to use the malloc that comes with $package?"
5874 . ./myread
5875 usemymalloc="$ans"
5876 case "$ans" in
5877 y*|true)
5878         usemymalloc='y'
5879         mallocsrc='malloc.c'
5880         mallocobj="malloc$_o"
5881         d_mymalloc="$define"
5882         case "$libs" in
5883         *-lmalloc*)
5884                 : Remove malloc from list of libraries to use
5885                 echo "Removing unneeded -lmalloc from library list" >&4
5886                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5887                 shift
5888                 libs="$*"
5889                 echo "libs = $libs" >&4
5890                 ;;
5891         esac
5892         ;;
5893 *)
5894         usemymalloc='n'
5895         mallocsrc=''
5896         mallocobj=''
5897         d_mymalloc="$undef"
5898         ;;
5899 esac
5900
5901 : compute the return types of malloc and free
5902 echo " "
5903 $cat >malloc.c <<END
5904 #$i_malloc I_MALLOC
5905 #$i_stdlib I_STDLIB
5906 #include <stdio.h>
5907 #include <sys/types.h>
5908 #ifdef I_MALLOC
5909 #include <malloc.h>
5910 #endif
5911 #ifdef I_STDLIB
5912 #include <stdlib.h>
5913 #endif
5914 #ifdef TRY_MALLOC
5915 void *malloc();
5916 #endif
5917 #ifdef TRY_FREE
5918 void free();
5919 #endif
5920 END
5921 case "$malloctype" in
5922 '')
5923         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5924                 malloctype='void *'
5925         else
5926                 malloctype='char *'
5927         fi
5928         ;;
5929 esac
5930 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5931
5932 case "$freetype" in
5933 '')
5934         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5935                 freetype='void'
5936         else
5937                 freetype='int'
5938         fi
5939         ;;
5940 esac
5941 echo "Your system uses $freetype free(), it would seem." >&4
5942 $rm -f malloc.[co]
5943 $cat <<EOM
5944
5945 After $package is installed, you may wish to install various
5946 add-on modules and utilities.  Typically, these add-ons will
5947 be installed under $prefix with the rest
5948 of this package.  However, you may wish to install such add-ons
5949 elsewhere under a different prefix.
5950
5951 If you do not wish to put everything under a single prefix, that's
5952 ok.  You will be prompted for the individual locations; this siteprefix
5953 is only used to suggest the defaults.
5954
5955 The default should be fine for most people.
5956
5957 EOM
5958 fn=d~+
5959 rp='Installation prefix to use for add-on modules and utilities?'
5960 : XXX Here might be another good place for an installstyle setting.
5961 case "$siteprefix" in
5962 '') dflt=$prefix ;;
5963 *)  dflt=$siteprefix ;;
5964 esac
5965 . ./getfile
5966 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5967 oldsiteprefix=''
5968 case "$siteprefix" in
5969 '') ;;
5970 *)      case "$ans" in
5971         "$prefix") ;;
5972         *) oldsiteprefix="$prefix";;
5973         esac
5974         ;;
5975 esac
5976 siteprefix="$ans"
5977 siteprefixexp="$ansexp"
5978
5979 : determine where site specific libraries go.
5980 : Usual default is /usr/local/lib/perl5/site_perl/$version
5981 : The default "style" setting is made in installstyle.U
5982 : XXX No longer works with Prefixit stuff.
5983 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5984 case "$sitelib" in
5985 '') case "$installstyle" in
5986         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5987         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5988         esac
5989         ;;
5990 *)      dflt="$sitelib"
5991         ;;
5992 esac
5993 $cat <<EOM
5994
5995 The installation process will create a directory for
5996 site-specific extensions and modules.  Most users find it convenient
5997 to place all site-specific files in this directory rather than in the
5998 main distribution directory.
5999
6000 EOM
6001 fn=d~+
6002 rp='Pathname for the site-specific library files?'
6003 . ./getfile
6004 sitelib="$ans"
6005 sitelibexp="$ansexp"
6006 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6007 : Change installation prefix, if necessary.
6008 if $test X"$prefix" != X"$installprefix"; then
6009         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6010 else
6011         installsitelib="$sitelibexp"
6012 fi
6013
6014 : determine where site specific architecture-dependent libraries go.
6015 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6016 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6017 : sitelib may have an optional trailing /share.
6018 case "$sitearch" in
6019 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6020         dflt="$dflt/$archname"
6021         ;;
6022 *)      dflt="$sitearch"
6023         ;;
6024 esac
6025 set sitearch sitearch none
6026 eval $prefixit
6027 $cat <<EOM
6028
6029 The installation process will also create a directory for
6030 architecture-dependent site-specific extensions and modules.
6031
6032 EOM
6033 fn=d~+
6034 rp='Pathname for the site-specific architecture-dependent library files?'
6035 . ./getfile
6036 sitearch="$ans"
6037 sitearchexp="$ansexp"
6038 : Change installation prefix, if necessary.
6039 if $test X"$prefix" != X"$installprefix"; then
6040         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6041 else
6042         installsitearch="$sitearchexp"
6043 fi
6044
6045 $cat <<EOM
6046
6047 The installation process will also create a directory for
6048 vendor-supplied add-ons.  Vendors who supply perl with their system
6049 may find it convenient to place all vendor-supplied files in this
6050 directory rather than in the main distribution directory.  This will
6051 ease upgrades between binary-compatible maintenance versions of perl.
6052
6053 Of course you may also use these directories in whatever way you see
6054 fit.  For example, you might use them to access modules shared over a
6055 company-wide network.
6056
6057 The default answer should be fine for most people.
6058 This causes further questions about vendor add-ons to be skipped
6059 and no vendor-specific directories will be configured for perl.
6060
6061 EOM
6062 rp='Do you want to configure vendor-specific add-on directories?'
6063 case "$usevendorprefix" in
6064 define|true|[yY]*) dflt=y ;;
6065 *)      : User may have set vendorprefix directly on Configure command line.
6066         case "$vendorprefix" in
6067         ''|' ') dflt=n ;;
6068         *)      dflt=y ;;
6069         esac
6070         ;;
6071 esac
6072 . ./myread
6073 case "$ans" in
6074 [yY]*)  fn=d~+
6075         rp='Installation prefix to use for vendor-supplied add-ons?'
6076         case "$vendorprefix" in
6077         '') dflt='' ;;
6078         *)  dflt=$vendorprefix ;;
6079         esac
6080         . ./getfile
6081         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6082         oldvendorprefix=''
6083         case "$vendorprefix" in
6084         '') ;;
6085         *)      case "$ans" in
6086                 "$prefix") ;;
6087                 *) oldvendorprefix="$prefix";;
6088                 esac
6089                 ;;
6090         esac
6091         usevendorprefix="$define"
6092         vendorprefix="$ans"
6093         vendorprefixexp="$ansexp"
6094         ;;
6095 *)      usevendorprefix="$undef"
6096         vendorprefix=''
6097         vendorprefixexp=''
6098         ;;
6099 esac
6100
6101 case "$vendorprefix" in
6102 '')     d_vendorlib="$undef"
6103         vendorlib=''
6104         vendorlibexp=''
6105         ;;
6106 *)      d_vendorlib="$define"
6107         : determine where vendor-supplied modules go.
6108         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6109         case "$vendorlib" in
6110         '')
6111                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6112                 case "$installstyle" in
6113                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6114                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6115                 esac
6116                 ;;
6117         *)      dflt="$vendorlib"
6118                 ;;
6119         esac
6120         fn=d~+
6121         rp='Pathname for the vendor-supplied library files?'
6122         . ./getfile
6123         vendorlib="$ans"
6124         vendorlibexp="$ansexp"
6125         ;;
6126 esac
6127 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6128 : Change installation prefix, if necessary.
6129 if $test X"$prefix" != X"$installprefix"; then
6130         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6131 else
6132         installvendorlib="$vendorlibexp"
6133 fi
6134
6135 case "$vendorprefix" in
6136 '')     d_vendorarch="$undef"
6137         vendorarch=''
6138         vendorarchexp=''
6139         ;;
6140 *)      d_vendorarch="$define"
6141         : determine where vendor-supplied architecture-dependent libraries go.
6142         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6143         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6144         : vendorlib may have an optional trailing /share.
6145         case "$vendorarch" in
6146         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6147                 dflt="$dflt/$archname"
6148                 ;;
6149         *)      dflt="$vendorarch" ;;
6150         esac
6151         fn=d~+
6152         rp='Pathname for vendor-supplied architecture-dependent files?'
6153         . ./getfile
6154         vendorarch="$ans"
6155         vendorarchexp="$ansexp"
6156         ;;
6157 esac
6158 : Change installation prefix, if necessary.
6159 if $test X"$prefix" != X"$installprefix"; then
6160         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6161 else
6162         installvendorarch="$vendorarchexp"
6163 fi
6164
6165 : Final catch-all directories to search
6166 $cat <<EOM
6167
6168 Lastly, you can have perl look in other directories for extensions and
6169 modules in addition to those already specified.
6170 These directories will be searched after 
6171         $sitearch 
6172         $sitelib 
6173 EOM
6174 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6175 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6176 echo ' '
6177 case "$otherlibdirs" in
6178 ''|' ') dflt='none' ;;
6179 *)      dflt="$otherlibdirs" ;;
6180 esac
6181 $cat <<EOM
6182 Enter a colon-separated set of extra paths to include in perl's @INC
6183 search path, or enter 'none' for no extra paths.
6184
6185 EOM
6186
6187 rp='Colon-separated list of additional directories for perl to search?'
6188 . ./myread
6189 case "$ans" in
6190 ' '|''|none)    otherlibdirs=' ' ;;     
6191 *)      otherlibdirs="$ans" ;;
6192 esac
6193 case "$otherlibdirs" in
6194 ' ') val=$undef ;;
6195 *)      val=$define ;;
6196 esac
6197 set d_perl_otherlibdirs
6198 eval $setvar
6199
6200 : Cruising for prototypes
6201 echo " "
6202 echo "Checking out function prototypes..." >&4
6203 $cat >prototype.c <<'EOCP'
6204 int main(int argc, char *argv[]) {
6205         exit(0);}
6206 EOCP
6207 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6208         echo "Your C compiler appears to support function prototypes."
6209         val="$define"
6210 else
6211         echo "Your C compiler doesn't seem to understand function prototypes."
6212         val="$undef"
6213 fi
6214 set prototype
6215 eval $setvar
6216 $rm -f prototype*
6217
6218 case "$prototype" in
6219 "$define") ;;
6220 *)      ansi2knr='ansi2knr'
6221         echo " "
6222         cat <<EOM >&4
6223
6224 $me:  FATAL ERROR:
6225 This version of $package can only be compiled by a compiler that 
6226 understands function prototypes.  Unfortunately, your C compiler 
6227         $cc $ccflags
6228 doesn't seem to understand them.  Sorry about that.
6229
6230 If GNU cc is available for your system, perhaps you could try that instead.  
6231
6232 Eventually, we hope to support building Perl with pre-ANSI compilers.
6233 If you would like to help in that effort, please contact <perlbug@perl.org>.
6234
6235 Aborting Configure now.
6236 EOM
6237         exit 2
6238         ;;
6239 esac
6240
6241 : determine where public executables go
6242 echo " "
6243 set dflt bin bin
6244 eval $prefixit
6245 fn=d~
6246 rp='Pathname where the public executables will reside?'
6247 . ./getfile
6248 if $test "X$ansexp" != "X$binexp"; then
6249         installbin=''
6250 fi
6251 bin="$ans"
6252 binexp="$ansexp"
6253 : Change installation prefix, if necessary.
6254 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6255 if $test X"$prefix" != X"$installprefix"; then
6256         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6257 else
6258         installbin="$binexp"
6259 fi
6260
6261 : Find perl5.005 or later.
6262 echo "Looking for a previously installed perl5.005 or later... "
6263 case "$perl5" in
6264 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6265                 : Check if this perl is recent and can load a simple module
6266                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6267                         perl5=$tdir/perl
6268                         break;
6269                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6270                         perl5=$tdir/perl
6271                         break;
6272                 fi
6273         done
6274         ;;
6275 *)      perl5="$perl5"
6276         ;;
6277 esac
6278 case "$perl5" in
6279 '')     echo "None found.  That's ok.";;
6280 *)      echo "Using $perl5." ;;
6281 esac
6282
6283 : Determine list of previous versions to include in @INC
6284 $cat > getverlist <<EOPL
6285 #!$perl5 -w
6286 use File::Basename;
6287 \$api_versionstring = "$api_versionstring";
6288 \$version = "$version";
6289 \$stem = "$sitelib_stem";
6290 \$archname = "$archname";
6291 EOPL
6292         $cat >> getverlist <<'EOPL'
6293 # Can't have leading @ because metaconfig interprets it as a command!
6294 ;@inc_version_list=();
6295 # XXX Redo to do opendir/readdir? 
6296 if (-d $stem) {
6297     chdir($stem);
6298     ;@candidates = glob("5.*");
6299 }
6300 else {
6301     ;@candidates = ();
6302 }
6303
6304 # XXX ToDo:  These comparisons must be reworked when two-digit
6305 # subversions come along, so that 5.7.10 compares as greater than
6306 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6307 # widespread that we can use the built-in version vectors rather
6308 # than reinventing them here.  For 5.6.0, however, we must
6309 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6310 foreach $d (@candidates) {
6311     if ($d lt $version) {
6312         if ($d ge $api_versionstring) {
6313             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6314         }
6315         elsif ($d ge "5.005") {
6316             unshift(@inc_version_list, grep { -d } $d);
6317         }
6318     }
6319     else {
6320         # Skip newer version.  I.e. don't look in
6321         # 5.7.0 if we're installing 5.6.1.
6322     }
6323 }
6324
6325 if (@inc_version_list) {
6326     print join(' ', @inc_version_list);
6327 }
6328 else {
6329     # Blank space to preserve value for next Configure run.
6330     print " ";
6331 }
6332 EOPL
6333 chmod +x getverlist
6334 case "$inc_version_list" in
6335 '')     if test -x "$perl5"; then
6336                 dflt=`$perl5 getverlist`
6337         else
6338                 dflt='none'
6339         fi
6340         ;;
6341 $undef) dflt='none' ;;
6342 *)  dflt="$inc_version_list" ;;
6343 esac
6344 case "$dflt" in
6345 ''|' ') dflt=none ;;
6346 esac
6347 case "$dflt" in
6348 5.005) case "$bincompat5005" in
6349        $define|true|[yY]*) ;;
6350        *) dflt=none ;;
6351        esac
6352        ;;
6353 esac
6354 $cat <<'EOM'
6355
6356 In order to ease the process of upgrading, this version of perl 
6357 can be configured to use modules built and installed with earlier 
6358 versions of perl that were installed under $prefix.  Specify here
6359 the list of earlier versions that this version of perl should check.
6360 If Configure detected no earlier versions of perl installed under
6361 $prefix, then the list will be empty.  Answer 'none' to tell perl
6362 to not search earlier versions.
6363
6364 The default should almost always be sensible, so if you're not sure,
6365 just accept the default.
6366 EOM
6367
6368 rp='List of earlier versions to include in @INC?'
6369 . ./myread
6370 case "$ans" in
6371 [Nn]one|''|' ') inc_version_list=' ' ;;
6372 *) inc_version_list="$ans" ;;
6373 esac
6374 case "$inc_version_list" in
6375 ''|' ') 
6376         inc_version_list_init='0';;
6377 *)      inc_version_list_init=`echo $inc_version_list |
6378                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6379         ;;
6380 esac
6381 $rm -f getverlist
6382
6383 : determine whether to install perl also as /usr/bin/perl
6384
6385 echo " "
6386 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6387         $cat <<EOM
6388 Many scripts expect perl to be installed as /usr/bin/perl.
6389 I can install the perl you are about to compile also as /usr/bin/perl
6390 (in addition to $installbin/perl).
6391 EOM
6392         case "$installusrbinperl" in
6393         "$undef"|[nN]*) dflt='n';;
6394         *)              dflt='y';;
6395         esac
6396         rp="Do you want to install perl as /usr/bin/perl?"
6397         . ./myread
6398         case "$ans" in
6399         [yY]*)  val="$define";;
6400         *)      val="$undef" ;;
6401         esac
6402 else
6403         val="$undef"
6404 fi
6405 set installusrbinperl
6406 eval $setvar
6407
6408 : see if dld is available
6409 set dld.h i_dld
6410 eval $inhdr
6411
6412 : see if dlopen exists
6413 xxx_runnm="$runnm"
6414 runnm=false
6415 set dlopen d_dlopen
6416 eval $inlibc
6417 runnm="$xxx_runnm"
6418
6419 : determine which dynamic loading, if any, to compile in
6420 echo " "
6421 dldir="ext/DynaLoader"
6422 case "$usedl" in
6423 $define|y|true)
6424         dflt='y'
6425         usedl="$define"
6426         ;;
6427 $undef|n|false)
6428         dflt='n'
6429         usedl="$undef"
6430         ;;
6431 *) 
6432         dflt='n'
6433         case "$d_dlopen" in
6434             $define) dflt='y' ;;
6435         esac
6436         case "$i_dld" in
6437             $define) dflt='y' ;;
6438         esac
6439         : Does a dl_xxx.xs file exist for this operating system
6440         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6441         ;;
6442 esac
6443 rp="Do you wish to use dynamic loading?"
6444 . ./myread
6445 usedl="$ans"
6446 case "$ans" in
6447 y*) usedl="$define"
6448         case "$dlsrc" in
6449         '')
6450                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6451                         dflt="$dldir/dl_${osname}.xs"
6452                 elif $test "$d_dlopen" = "$define" ; then
6453                         dflt="$dldir/dl_dlopen.xs"
6454                 elif $test "$i_dld" = "$define" ; then
6455                         dflt="$dldir/dl_dld.xs"
6456                 else
6457                         dflt=''
6458                 fi
6459                 ;;
6460         *)      dflt="$dldir/$dlsrc"
6461                 ;;
6462         esac
6463     echo "The following dynamic loading files are available:"
6464         : Can not go over to $dldir because getfile has path hard-coded in.
6465         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6466         rp="Source file to use for dynamic loading"
6467         fn="fne"
6468         gfpth="$src"
6469         . ./getfile
6470         usedl="$define"
6471         : emulate basename
6472         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6473
6474         $cat << EOM
6475
6476 Some systems may require passing special flags to $cc -c to
6477 compile modules that will be used to create a shared library.
6478 To use no flags, say "none".
6479
6480 EOM
6481     case "$cccdlflags" in
6482     '') case "$gccversion" in
6483                 '') case "$osname" in
6484                         hpux)   dflt='+z' ;;
6485                         next)   dflt='none' ;;
6486                         irix*)  dflt='-KPIC' ;;
6487                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6488                         sunos)  dflt='-pic' ;;
6489                         *)      dflt='none' ;;
6490                     esac
6491                         ;;
6492                 *)  case "$osname" in
6493                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6494                         *)      dflt='-fpic' ;;
6495                     esac ;;
6496             esac ;;
6497         ' ') dflt='none' ;;
6498     *)  dflt="$cccdlflags" ;;
6499     esac
6500     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6501     . ./myread
6502     case "$ans" in
6503     none) cccdlflags=' ' ;;
6504     *) cccdlflags="$ans" ;;
6505     esac
6506
6507     cat << EOM
6508
6509 Some systems use ld to create libraries that can be dynamically loaded,
6510 while other systems (such as those using ELF) use $cc.
6511
6512 EOM
6513         case "$ld" in
6514         '')     $cat >try.c <<'EOM'
6515 /* Test for whether ELF binaries are produced */
6516 #include <fcntl.h>
6517 #include <stdlib.h>
6518 int main() {
6519         char b[4];
6520         int i = open("a.out",O_RDONLY);
6521         if(i == -1) 
6522                 exit(1); /* fail */
6523         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6524                 exit(0); /* succeed (yes, it's ELF) */
6525         else
6526                 exit(1); /* fail */
6527 }
6528 EOM
6529                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6530                         cat <<EOM
6531 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6532 EOM
6533                         dflt="$cc"
6534                 else
6535                         echo "I'll use ld to build dynamic libraries."
6536                         dflt='ld'
6537                 fi
6538                 rm -f try.c a.out
6539                 ;;
6540         *)      dflt="$ld"
6541                 ;;
6542         esac
6543
6544     rp="What command should be used to create dynamic libraries?"
6545     . ./myread
6546         ld="$ans"
6547
6548     cat << EOM
6549
6550 Some systems may require passing special flags to $ld to create a
6551 library that can be dynamically loaded.  If your ld flags include
6552 -L/other/path options to locate libraries outside your loader's normal
6553 search path, you may need to specify those -L options here as well.  To
6554 use no flags, say "none".
6555
6556 EOM
6557     case "$lddlflags" in
6558     '') case "$osname" in
6559                         beos) dflt='-nostart' ;;
6560                         hpux) dflt='-b';
6561                               case "$gccversion" in
6562                               '') dflt="$dflt +vnocompatwarnings" ;;
6563                               esac
6564                               ;;        
6565                         linux|irix*)    dflt='-shared' ;;
6566                         next)  dflt='none' ;;
6567                         solaris) dflt='-G' ;;
6568                         sunos) dflt='-assert nodefinitions' ;;
6569                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6570                 *)     dflt='none' ;;
6571                         esac
6572                         ;;
6573     *) dflt="$lddlflags" ;;
6574     esac
6575
6576         : Try to guess additional flags to pick up local libraries.
6577         : Be careful not to append to a plain 'none'
6578         case "$dflt" in
6579         none) dflt='' ;;
6580         esac
6581         for thisflag in $ldflags; do
6582                 case "$thisflag" in
6583                 -L*|-R*)
6584                         case " $dflt " in
6585                         *" $thisflag "*) ;;
6586                         *) dflt="$dflt $thisflag" ;;
6587                         esac
6588                         ;;
6589                 esac
6590         done
6591
6592         case "$dflt" in
6593         ''|' ') dflt='none' ;;
6594         esac
6595
6596     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6597     . ./myread
6598     case "$ans" in
6599     none) lddlflags=' ' ;;
6600     *) lddlflags="$ans" ;;
6601     esac
6602
6603         cat <<EOM
6604
6605 Some systems may require passing special flags to $cc to indicate that
6606 the resulting executable will use dynamic linking.  To use no flags,
6607 say "none".
6608
6609 EOM
6610     case "$ccdlflags" in
6611     '') case "$osname" in
6612                 hpux)   dflt='-Wl,-E' ;;
6613                 linux)  dflt='-rdynamic' ;;
6614                 next)   dflt='none' ;;
6615                 sunos)  dflt='none' ;;
6616                 *)      dflt='none' ;;
6617             esac ;;
6618     ' ')  dflt='none' ;;
6619     *)  dflt="$ccdlflags" ;;
6620     esac
6621     rp="Any special flags to pass to $cc to use dynamic linking?"
6622     . ./myread
6623     case "$ans" in
6624     none) ccdlflags=' ' ;;
6625     *) ccdlflags="$ans" ;;
6626     esac
6627     ;;
6628 *)  usedl="$undef"
6629         ld='ld'
6630     dlsrc='dl_none.xs'
6631     lddlflags=''
6632     ccdlflags=''
6633     ;;
6634 esac
6635
6636 also=''
6637 case "$usedl" in
6638 $undef)
6639         # No dynamic loading being used, so don't bother even to prompt.
6640         useshrplib='false'
6641         ;;
6642 *)      case "$useshrplib" in
6643         '')     case "$osname" in
6644                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6645                         dflt=y
6646                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6647                         ;;
6648                 next*)
6649                         case "$osvers" in
6650                         4*)     dflt=y
6651                                 also='Building a shared libperl is needed for MAB support.'
6652                                 ;;
6653                         *)      dflt=n
6654                                 ;;
6655                         esac
6656                         ;;
6657                 *)      dflt=n
6658                         ;;
6659                 esac
6660                 ;;
6661         $define|true|[Yy]*)
6662                 dflt=y
6663                 ;;
6664         *)      dflt=n
6665                 ;;
6666         esac
6667         $cat << EOM
6668
6669 The perl executable is normally obtained by linking perlmain.c with
6670 libperl${_a}, any static extensions (usually just DynaLoader), and
6671 any other libraries needed on this system (such as -lm, etc.).  Since
6672 your system supports dynamic loading, it is probably possible to build
6673 a shared libperl.$so.  If you will have more than one executable linked
6674 to libperl.$so, this will significantly reduce the size of each
6675 executable, but it may have a noticeable affect on performance.  The
6676 default is probably sensible for your system.
6677 $also
6678
6679 EOM
6680         rp="Build a shared libperl.$so (y/n)"
6681         . ./myread
6682         case "$ans" in
6683         true|$define|[Yy]*)
6684                 useshrplib='true'  ;;
6685         *)      useshrplib='false' ;;
6686         esac
6687         ;;
6688 esac
6689
6690 case "$useshrplib" in
6691 true)
6692         case "$libperl" in
6693         '')
6694                 # Figure out a good name for libperl.so.  Since it gets stored in
6695                 # a version-specific architecture-dependent library, the version
6696                 # number isn't really that important, except for making cc/ld happy.
6697                 #
6698                 # A name such as libperl.so.3.1
6699                 majmin="libperl.$so.$patchlevel.$subversion"
6700                 # A name such as libperl.so.301
6701                 majonly=`echo $patchlevel $subversion |
6702                         $awk '{printf "%d%02d", $1, $2}'`
6703                 majonly=libperl.$so.$majonly
6704                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6705                 # rely on figuring it out from the naming of libc.
6706                 case "${osname}${osvers}" in
6707                 next4*)
6708                         dflt=libperl.5.$so
6709                         # XXX How handle the --version stuff for MAB?
6710                         ;;
6711                 linux*)  # ld won't link with a bare -lperl otherwise.
6712                         dflt=libperl.$so
6713                         ;;
6714                 cygwin*) # include version
6715                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6716                         ;;
6717                 *)      # Try to guess based on whether libc has major.minor.
6718                         case "$libc" in
6719                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6720                         *libc.$so.[0-9]*) dflt=$majonly ;;
6721                         *)      dflt=libperl.$so ;;
6722                         esac
6723                         ;;
6724                 esac
6725                 ;;
6726         *)      dflt=$libperl
6727                 ;;
6728         esac
6729         cat << EOM
6730
6731 I need to select a good name for the shared libperl.  If your system uses
6732 library names with major and minor numbers, then you might want something
6733 like $majmin.  Alternatively, if your system uses a single version
6734 number for shared libraries, then you might want to use $majonly.
6735 Or, your system might be quite happy with a simple libperl.$so.
6736
6737 Since the shared libperl will get installed into a version-specific
6738 architecture-dependent directory, the version number of the shared perl
6739 library probably isn't important, so the default should be o.k.
6740
6741 EOM
6742         rp='What name do you want to give to the shared libperl?'
6743         . ./myread
6744         libperl=$ans
6745         echo "Ok, I'll use $libperl"
6746         ;;
6747 *)
6748         libperl="libperl${_a}"
6749         ;;
6750 esac
6751
6752 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6753 case "$shrpdir" in
6754 '') ;;
6755 *)      $cat >&4 <<EOM
6756 WARNING:  Use of the shrpdir variable for the installation location of
6757 the shared $libperl is not supported.  It was never documented and
6758 will not work in this version.  Let me (perlbug@perl.org)
6759 know of any problems this may cause.
6760
6761 EOM
6762         case "$shrpdir" in
6763         "$archlibexp/CORE")
6764                 $cat >&4 <<EOM
6765 But your current setting of $shrpdir is
6766 the default anyway, so it's harmless.
6767 EOM
6768                 ;;
6769         *)
6770                 $cat >&4 <<EOM
6771 Further, your current attempted setting of $shrpdir
6772 conflicts with the value of $archlibexp/CORE
6773 that installperl will use.
6774 EOM
6775                 ;;
6776         esac
6777         ;;
6778 esac
6779
6780 # How will the perl executable find the installed shared $libperl?
6781 # Add $xxx to ccdlflags.
6782 # If we can't figure out a command-line option, use $shrpenv to
6783 # set env LD_RUN_PATH.  The main perl makefile uses this.
6784 shrpdir=$archlibexp/CORE
6785 xxx=''
6786 tmp_shrpenv=''
6787 if "$useshrplib"; then
6788     case "$osname" in 
6789         aix)
6790                 # We'll set it in Makefile.SH...
6791                 ;;
6792         solaris|netbsd)
6793                 xxx="-R $shrpdir"
6794                 ;;
6795         freebsd)
6796                 xxx="-Wl,-R$shrpdir"
6797                 ;;
6798         linux|irix*|dec_osf)
6799                 xxx="-Wl,-rpath,$shrpdir"
6800                 ;;
6801         next)
6802                 # next doesn't like the default...
6803                 ;;
6804         beos)
6805                 # beos doesn't like the default, either.
6806                 ;;
6807         hpux*)
6808                 # hpux doesn't like the default, either.
6809                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6810                 ;;
6811         *)
6812                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6813                 ;;
6814         esac
6815         case "$xxx" in
6816         '') ;;
6817         *)      
6818                 # Only add $xxx if it isn't already in ccdlflags.
6819                 case " $ccdlflags " in
6820                 *" $xxx "*)     ;;
6821                 *)      ccdlflags="$ccdlflags $xxx"
6822                         cat <<EOM >&4
6823
6824 Adding $xxx to the flags
6825 passed to $ld so that the perl executable will find the 
6826 installed shared $libperl.
6827
6828 EOM
6829                         ;;
6830                 esac
6831                 ;;
6832         esac
6833 fi
6834 # Fix ccdlflags in AIX for building external extensions.
6835 # (For building Perl itself bare -bE:perl.exp is needed,
6836 #  Makefile.SH takes care of this.)
6837 case "$osname" in
6838 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6839 esac
6840 # Respect a hint or command-line value.
6841 case "$shrpenv" in
6842 '') shrpenv="$tmp_shrpenv" ;;
6843 esac
6844 case "$ldlibpthname" in
6845 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6846 none)   ldlibpthname='' ;;
6847 esac
6848
6849 : determine where manual pages are on this system
6850 echo " "
6851 case "$sysman" in
6852 '') 
6853         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6854         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6855         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6856         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6857         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6858         sysman=`./loc . /usr/man/man1 $syspath`
6859         ;;
6860 esac
6861 if $test -d "$sysman"; then
6862         echo "System manual is in $sysman." >&4
6863 else
6864         echo "Could not find manual pages in source form." >&4
6865 fi
6866
6867 : determine where manual pages go
6868 set man1dir man1dir none
6869 eval $prefixit
6870 $cat <<EOM
6871
6872 $spackage has manual pages available in source form.
6873 EOM
6874 case "$nroff" in
6875 nroff)
6876         echo "However, you don't have nroff, so they're probably useless to you."
6877         case "$man1dir" in
6878         '') man1dir="none";;
6879         esac;;
6880 esac
6881 echo "If you don't want the manual sources installed, answer 'none'."
6882 case "$man1dir" in
6883 ' ') dflt=none
6884         ;;
6885 '')
6886         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6887         lookpath="$lookpath $prefixexp/man/p_man/man1"
6888         lookpath="$lookpath $prefixexp/man/u_man/man1"
6889         lookpath="$lookpath $prefixexp/man/man.1"
6890         case "$sysman" in
6891         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6892         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6893         esac
6894         set dflt
6895         eval $prefixup
6896         ;;
6897 *)  dflt="$man1dir"
6898         ;;
6899 esac
6900 echo " "
6901 fn=dn+~
6902 rp="Where do the main $spackage manual pages (source) go?"
6903 . ./getfile
6904 if $test "X$man1direxp" != "X$ansexp"; then
6905         installman1dir=''
6906 fi
6907 man1dir="$ans"
6908 man1direxp="$ansexp"
6909 case "$man1dir" in
6910 '')     man1dir=' '
6911         installman1dir='';;
6912 esac
6913
6914 : Change installation prefix, if necessary.
6915 if $test X"$prefix" != X"$installprefix"; then
6916         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6917 else
6918         installman1dir="$man1direxp"
6919 fi
6920
6921 : What suffix to use on installed man pages
6922
6923 case "$man1dir" in
6924 ' ')
6925         man1ext='0'
6926         ;;
6927 *)
6928         rp="What suffix should be used for the main $spackage man pages?"
6929         case "$man1ext" in
6930         '')     case "$man1dir" in
6931                 *1)  dflt=1 ;;
6932                 *1p) dflt=1p ;;
6933                 *1pm) dflt=1pm ;;
6934                 *l) dflt=l;;
6935                 *n) dflt=n;;
6936                 *o) dflt=o;;
6937                 *p) dflt=p;;
6938                 *C) dflt=C;;
6939                 *L) dflt=L;;
6940                 *L1) dflt=L1;;
6941                 *) dflt=1;;
6942                 esac
6943                 ;;
6944         *)      dflt="$man1ext";;
6945         esac
6946         . ./myread
6947         man1ext="$ans"
6948         ;;
6949 esac
6950
6951 : see if we can have long filenames
6952 echo " "
6953 first=123456789abcdef
6954 $rm -f $first
6955 if (echo hi >$first) 2>/dev/null; then
6956         if $test -f 123456789abcde; then
6957                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6958                 val="$undef"
6959         else
6960                 echo 'You can have filenames longer than 14 characters.'>&4
6961                 val="$define"
6962         fi
6963 else
6964         $cat <<'EOM'
6965 You can't have filenames longer than 14 chars.
6966 You can't even think about them!
6967 EOM
6968         val="$undef"
6969 fi 
6970 set d_flexfnam
6971 eval $setvar
6972 $rm -rf 123456789abcde*
6973
6974 : determine where library module manual pages go
6975 set man3dir man3dir none
6976 eval $prefixit
6977 $cat <<EOM
6978
6979 $spackage has manual pages for many of the library modules.
6980 EOM
6981
6982 case "$nroff" in
6983 nroff)
6984         $cat <<'EOM'
6985 However, you don't have nroff, so they're probably useless to you.
6986 EOM
6987         case "$man3dir" in
6988         '') man3dir="none";;
6989         esac;;
6990 esac
6991
6992 case "$d_flexfnam" in
6993 undef)
6994         $cat <<'EOM'
6995 However, your system can't handle the long file names like File::Basename.3. 
6996 EOM
6997         case "$man3dir" in
6998         '') man3dir="none";;
6999         esac;;
7000 esac
7001
7002 echo "If you don't want the manual sources installed, answer 'none'."
7003 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7004 case "$man3dir" in
7005 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7006         if $test -d "$privlib/man/man3"; then
7007                 cat <<EOM >&4
7008
7009 WARNING:  Previous versions of perl installed man3 pages into
7010 $privlib/man/man3.  This version will suggest a 
7011 new default of $dflt.  
7012 EOM
7013                 tdflt=$dflt
7014                 dflt='n'
7015                 rp='Do you wish to preserve the old behavior?(y/n)'
7016                 . ./myread
7017                 case "$ans" in
7018                 y*) dflt="$privlib/man/man3" ;;
7019                 *)  dflt=$tdflt ;;
7020                 esac
7021     fi
7022         ;;
7023 *)      dflt="$man3dir" ;;
7024 esac
7025 case "$dflt" in
7026 ' ') dflt=none ;;
7027 esac
7028 echo " "
7029 fn=dn+~
7030 rp="Where do the $package library man pages (source) go?"
7031 . ./getfile
7032 man3dir="$ans"
7033 man3direxp="$ansexp"
7034 case "$man3dir" in
7035 '')     man3dir=' '
7036         installman3dir='';;
7037 esac
7038
7039 : Change installation prefix, if necessary.
7040 if $test X"$prefix" != X"$installprefix"; then
7041         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7042 else
7043         installman3dir="$man3direxp"
7044 fi
7045
7046 : What suffix to use on installed man pages
7047 case "$man3dir" in
7048 ' ')
7049         man3ext='0'
7050         ;;
7051 *)
7052         rp="What suffix should be used for the $package library man pages?"
7053         case "$man3ext" in
7054         '')     case "$man3dir" in
7055                 *3)  dflt=3 ;;
7056                 *3p) dflt=3p ;;
7057                 *3pm) dflt=3pm ;;
7058                 *l) dflt=l;;
7059                 *n) dflt=n;;
7060                 *o) dflt=o;;
7061                 *p) dflt=p;;
7062                 *C) dflt=C;;
7063                 *L) dflt=L;;
7064                 *L3) dflt=L3;;
7065                 *) dflt=3;;
7066                 esac
7067                 ;;
7068         *)      dflt="$man3ext";;
7069         esac
7070         . ./myread
7071         man3ext="$ans"
7072         ;;
7073 esac
7074
7075 : see if we have to deal with yellow pages, now NIS.
7076 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7077         if $test -f /usr/etc/nibindd; then
7078                 echo " "
7079                 echo "I'm fairly confident you're on a NeXT."
7080                 echo " "
7081                 rp='Do you get the hosts file via NetInfo?'
7082                 dflt=y
7083                 case "$hostcat" in
7084                 nidump*) ;;
7085                 '') ;;
7086                 *) dflt=n;;
7087                 esac
7088                 . ./myread
7089                 case "$ans" in
7090                 y*) hostcat='nidump hosts .';;
7091                 *)      case "$hostcat" in
7092                         nidump*) hostcat='';;
7093                         esac
7094                         ;;
7095                 esac
7096         fi
7097         case "$hostcat" in
7098         nidump*) ;;
7099         *)
7100                 case "$hostcat" in
7101                 *ypcat*) dflt=y;;
7102                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7103                                 dflt=y
7104                         else
7105                                 dflt=n
7106                         fi;;
7107                 *) dflt=n;;
7108                 esac
7109                 echo " "
7110                 rp='Are you getting the hosts file via yellow pages?'
7111                 . ./myread
7112                 case "$ans" in
7113                 y*) hostcat='ypcat hosts';;
7114                 *) hostcat='cat /etc/hosts';;
7115                 esac
7116                 ;;
7117         esac
7118 fi
7119 case "$hostcat" in
7120 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7121 esac
7122 case "$groupcat" in
7123 '') test -f /etc/group && groupcat='cat /etc/group';;
7124 esac
7125 case "$passcat" in
7126 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7127 esac
7128
7129 : now get the host name
7130 echo " "
7131 echo "Figuring out host name..." >&4
7132 case "$myhostname" in
7133 '') cont=true
7134         echo 'Maybe "hostname" will work...'
7135         if tans=`sh -c hostname 2>&1` ; then
7136                 myhostname=$tans
7137                 phostname=hostname
7138                 cont=''
7139         fi
7140         ;;
7141 *) cont='';;
7142 esac
7143 if $test "$cont"; then
7144         if ./xenix; then
7145                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7146                 if tans=`cat /etc/systemid 2>&1` ; then
7147                         myhostname=$tans
7148                         phostname='cat /etc/systemid'
7149                         echo "Whadyaknow.  Xenix always was a bit strange..."
7150                         cont=''
7151                 fi
7152         elif $test -r /etc/systemid; then
7153                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7154         fi
7155 fi
7156 if $test "$cont"; then
7157         echo 'No, maybe "uuname -l" will work...'
7158         if tans=`sh -c 'uuname -l' 2>&1` ; then
7159                 myhostname=$tans
7160                 phostname='uuname -l'
7161         else
7162                 echo 'Strange.  Maybe "uname -n" will work...'
7163                 if tans=`sh -c 'uname -n' 2>&1` ; then
7164                         myhostname=$tans
7165                         phostname='uname -n'
7166                 else
7167                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7168                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7169                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7170                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7171                         else
7172                                 case "$myhostname" in
7173                                 '') echo "Does this machine have an identity crisis or something?"
7174                                         phostname='';;
7175                                 *)
7176                                         echo "Well, you said $myhostname before..."
7177                                         phostname='echo $myhostname';;
7178                                 esac
7179                         fi
7180                 fi
7181         fi
7182 fi
7183 : you do not want to know about this
7184 set $myhostname
7185 myhostname=$1
7186
7187 : verify guess
7188 if $test "$myhostname" ; then
7189         dflt=y
7190         rp='Your host name appears to be "'$myhostname'".'" Right?"
7191         . ./myread
7192         case "$ans" in
7193         y*) ;;
7194         *) myhostname='';;
7195         esac
7196 fi
7197
7198 : bad guess or no guess
7199 while $test "X$myhostname" = X ; do
7200         dflt=''
7201         rp="Please type the (one word) name of your host:"
7202         . ./myread
7203         myhostname="$ans"
7204 done
7205
7206 : translate upper to lower if necessary
7207 case "$myhostname" in
7208 *[A-Z]*)
7209         echo "(Normalizing case in your host name)"
7210         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7211         ;;
7212 esac
7213
7214 case "$myhostname" in
7215 *.*)
7216         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7217         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7218         echo "(Trimming domain name from host name--host name is now $myhostname)"
7219         ;;
7220 *) case "$mydomain" in
7221         '')
7222                 {
7223                         test "X$hostcat" = "Xypcat hosts" &&
7224                         ypmatch "$myhostname" hosts 2>/dev/null |\
7225                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7226                         $test -s hosts
7227                 } || {
7228                         test "X$hostcat" != "X" &&
7229                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7230                                         /[       ]$myhostname[  . ]/p" > hosts
7231                 }
7232                 tmp_re="[       . ]"
7233                 if $test -f hosts; then
7234                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7235                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7236                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7237                                 hosts | $sort | $uniq | \
7238                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7239                         case `$echo X$dflt` in
7240                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7241                                 dflt=.
7242                                 ;;
7243                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7244                                 ;;
7245                         esac
7246                 else
7247                         echo "(I cannot locate a hosts database anywhere)"
7248                         dflt=.
7249                 fi
7250                 case "$dflt" in
7251                 .)
7252                         tans=`./loc resolv.conf X /etc /usr/etc`
7253                         if $test -f "$tans"; then
7254                                 echo "(Attempting domain name extraction from $tans)"
7255                                 dflt=.`$sed -n -e 's/   / /g' \
7256                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7257                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7258                                 case "$dflt" in
7259                                 .) dflt=.`$sed -n -e 's/        / /g' \
7260                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7261                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7262                                         ;;
7263                                 esac
7264                         fi
7265                         ;;
7266                 esac
7267                 case "$dflt" in
7268                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7269                         dflt=.`sh -c domainname 2>/dev/null`
7270                         case "$dflt" in
7271                         '') dflt='.';;
7272                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7273                         esac
7274                         ;;
7275                 esac
7276                 case "$dflt" in
7277                 .) echo "(Lost all hope -- silly guess then)"
7278                         dflt='.uucp'
7279                         ;;
7280                 esac
7281                 $rm -f hosts
7282                 ;;
7283         *) dflt="$mydomain";;
7284         esac;;
7285 esac
7286 echo " "
7287 rp="What is your domain name?"
7288 . ./myread
7289 tans="$ans"
7290 case "$ans" in
7291 '') ;;
7292 .*) ;;
7293 *) tans=".$tans";;
7294 esac
7295 mydomain="$tans"
7296
7297 : translate upper to lower if necessary
7298 case "$mydomain" in
7299 *[A-Z]*)
7300         echo "(Normalizing case in your domain name)"
7301         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7302         ;;
7303 esac
7304
7305 : a little sanity check here
7306 case "$phostname" in
7307 '') ;;
7308 *)
7309         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7310         $myhostname$mydomain|$myhostname) ;;
7311         *)
7312                 case "$phostname" in
7313                 sed*)
7314                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7315                         ;;
7316                 *)
7317                         echo "(That doesn't agree with your $phostname command, by the way.)"
7318                         ;;
7319                 esac
7320         ;;
7321         esac
7322         ;;
7323 esac
7324
7325 $cat <<EOM
7326
7327 I need to get your e-mail address in Internet format if possible, i.e.
7328 something like user@host.domain. Please answer accurately since I have
7329 no easy means to double check it. The default value provided below
7330 is most probably close to reality but may not be valid from outside
7331 your organization...
7332
7333 EOM
7334 cont=x
7335 while test "$cont"; do
7336         case "$cf_email" in
7337         '') dflt="$cf_by@$myhostname$mydomain";;
7338         *) dflt="$cf_email";;
7339         esac
7340         rp='What is your e-mail address?'
7341         . ./myread
7342         cf_email="$ans"
7343         case "$cf_email" in
7344         *@*.*) cont='' ;;
7345         *)
7346                 rp='Address does not look like an Internet one.  Use it anyway?'
7347                 case "$fastread" in
7348                 yes) dflt=y ;;
7349                 *) dflt=n ;;
7350                 esac
7351                 . ./myread
7352                 case "$ans" in
7353                 y*) cont='' ;;
7354                 *) echo " " ;;
7355                 esac
7356                 ;;
7357         esac
7358 done
7359
7360 $cat <<EOM
7361
7362 If you or somebody else will be maintaining perl at your site, please
7363 fill in the correct e-mail address here so that they may be contacted
7364 if necessary. Currently, the "perlbug" program included with perl
7365 will send mail to this address in addition to perlbug@perl.org. You may
7366 enter "none" for no administrator.
7367
7368 EOM
7369 case "$perladmin" in
7370 '') dflt="$cf_email";;
7371 *) dflt="$perladmin";;
7372 esac
7373 rp='Perl administrator e-mail address'
7374 . ./myread
7375 perladmin="$ans"
7376
7377 : determine whether to only install version-specific parts.
7378 echo " "
7379 $cat <<EOM
7380 Do you want to install only the version-specific parts of the perl
7381 distribution?  Usually you do *not* want to do this.
7382 EOM
7383 case "$versiononly" in
7384 "$define"|[Yy]*|true) dflt='y' ;;
7385 *) dflt='n';
7386 esac
7387 rp="Do you want to install only the version-specific parts of perl?"
7388 . ./myread
7389 case "$ans" in
7390 [yY]*)  val="$define";;
7391 *)      val="$undef" ;;
7392 esac
7393 set versiononly
7394 eval $setvar
7395
7396 : figure out how to guarantee perl startup
7397 case "$startperl" in
7398 '')
7399         case "$sharpbang" in
7400         *!)
7401                 $cat <<EOH
7402
7403 I can use the #! construct to start perl on your system. This will
7404 make startup of perl scripts faster, but may cause problems if you
7405 want to share those scripts and perl is not in a standard place
7406 ($binexp/perl) on all your platforms. The alternative is to force
7407 a shell by starting the script with a single ':' character.
7408
7409 EOH
7410                 case "$versiononly" in
7411                 "$define")      dflt="$binexp/perl$version";;  
7412                 *)              dflt="$binexp/perl";;
7413                 esac
7414                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7415                 . ./myread
7416                 case "$ans" in
7417                 none)   startperl=": # use perl";;
7418                 *)      startperl="#!$ans"
7419                         if $test 30 -lt `echo "$ans" | wc -c`; then
7420                                 $cat >&4 <<EOM
7421
7422 WARNING:  Some systems limit the #! command to 32 characters.
7423 If you experience difficulty running Perl scripts with #!, try
7424 installing Perl in a directory with a shorter pathname.
7425
7426 EOM
7427                         fi ;;
7428                 esac
7429                 ;;
7430         *) startperl=": # use perl"
7431                 ;;
7432         esac
7433         ;;
7434 esac
7435 echo "I'll use $startperl to start perl scripts."
7436
7437 : figure best path for perl in scripts
7438 case "$perlpath" in
7439 '')
7440         perlpath="$binexp/perl"
7441         case "$startperl" in
7442         *!*) ;;
7443         *)
7444                 $cat <<EOH
7445
7446 I will use the "eval 'exec'" idiom to start Perl on your system.
7447 I can use the full path of your Perl binary for this purpose, but
7448 doing so may cause problems if you want to share those scripts and
7449 Perl is not always in a standard place ($binexp/perl).
7450
7451 EOH
7452                 dflt="$binexp/perl"
7453                 rp="What path shall I use in \"eval 'exec'\"?"
7454                 . ./myread
7455                 perlpath="$ans"
7456                 ;;
7457         esac
7458         ;;
7459 esac
7460 case "$startperl" in
7461 *!*)    ;;
7462 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7463 esac
7464
7465 : determine where public executable scripts go
7466 set scriptdir scriptdir
7467 eval $prefixit
7468 case "$scriptdir" in
7469 '')
7470         dflt="$bin"
7471         : guess some guesses
7472         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7473         $test -d /usr/share/bin     && dflt=/usr/share/bin
7474         $test -d /usr/local/script  && dflt=/usr/local/script
7475         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7476         $test -d $prefixexp/script  && dflt=$prefixexp/script
7477         set dflt
7478         eval $prefixup
7479         ;;
7480 *)  dflt="$scriptdir"
7481         ;;
7482 esac
7483 $cat <<EOM
7484  
7485 Some installations have a separate directory just for executable scripts so
7486 that they can mount it across multiple architectures but keep the scripts in
7487 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7488 Or you might just lump your scripts in with all your other executables.
7489  
7490 EOM
7491 fn=d~
7492 rp='Where do you keep publicly executable scripts?'
7493 . ./getfile
7494 if $test "X$ansexp" != "X$scriptdirexp"; then
7495         installscript=''
7496 fi
7497 scriptdir="$ans"
7498 scriptdirexp="$ansexp"
7499 : Change installation prefix, if necessary.
7500 if $test X"$prefix" != X"$installprefix"; then
7501         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7502 else
7503         installscript="$scriptdirexp"
7504 fi
7505
7506 : determine where add-on public executables go
7507 case "$sitebin" in
7508 '')     dflt=$siteprefix/bin ;;
7509 *)      dflt=$sitebin ;;
7510 esac
7511 fn=d~
7512 rp='Pathname where the add-on public executables should be installed?'
7513 . ./getfile
7514 sitebin="$ans"
7515 sitebinexp="$ansexp"
7516 : Change installation prefix, if necessary.
7517 if $test X"$prefix" != X"$installprefix"; then
7518         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7519 else
7520         installsitebin="$sitebinexp"
7521 fi
7522
7523 case "$useperlio" in
7524 $define|true|[yY]*)     dflt='y';;
7525 *) dflt='n';;
7526 esac
7527 cat <<EOM
7528
7529 Previous version of $package used the standard IO mechanisms as
7530 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7531 alternate IO mechanisms via the PerlIO abstraction layer, but the
7532 stdio mechanism is still the default.  This abstraction layer can
7533 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7534 Using PerlIO with sfio may cause problems with some extension modules.
7535
7536 If this doesn't make any sense to you, just accept the default '$dflt'.
7537 EOM
7538 rp='Use the experimental PerlIO abstraction layer?'
7539 . ./myread
7540 case "$ans" in
7541 y|Y) 
7542         val="$define"
7543         ;;     
7544 *)      
7545         echo "Ok, doing things the stdio way."
7546         val="$undef"
7547         ;;
7548 esac
7549 set useperlio
7550 eval $setvar 
7551
7552 case "$usesocks" in
7553 $define|true|[yY]*)
7554         case "$useperlio" in
7555         $define|true|[yY]*) ;;
7556         *)      cat >&4 <<EOM
7557
7558 You are using the SOCKS proxy protocol library which means that you
7559 should also use the PerlIO layer.  You may be headed for trouble.
7560
7561 EOM
7562                 ;;
7563         esac
7564         ;;
7565 esac
7566
7567         
7568 case "$vendorprefix" in
7569 '')     d_vendorbin="$undef"
7570         vendorbin=''
7571         vendorbinexp=''
7572         ;;
7573 *)      d_vendorbin="$define"
7574         : determine where vendor-supplied executables go.
7575         case "$vendorbin" in
7576         '') dflt=$vendorprefix/bin ;;
7577         *)      dflt="$vendorbin" ;;
7578         esac
7579         fn=d~+
7580         rp='Pathname for the vendor-supplied executables directory?'
7581         . ./getfile
7582         vendorbin="$ans"
7583         vendorbinexp="$ansexp"
7584         ;;
7585 esac
7586 : Change installation prefix, if necessary.
7587 if $test X"$prefix" != X"$installprefix"; then
7588         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7589 else
7590         installvendorbin="$vendorbinexp"
7591 fi
7592
7593 : see if qgcvt exists
7594 set qgcvt d_qgcvt
7595 eval $inlibc
7596
7597 echo " "
7598
7599 if $test X"$d_longdbl" = X"$define"; then
7600
7601 echo "Checking how to print long doubles..." >&4
7602
7603 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7604         $cat >try.c <<'EOCP'
7605 #include <sys/types.h>
7606 #include <stdio.h>
7607 int main() {
7608   double d = 123.456;
7609   printf("%.3f\n", d);
7610 }
7611 EOCP
7612         set try
7613         if eval $compile; then
7614                 yyy=`./try$exe_ext`
7615                 case "$yyy" in
7616                 123.456)
7617                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7618                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7619                         echo "We will use %f."
7620                         ;;
7621                 esac
7622         fi
7623 fi
7624
7625 if $test X"$sPRIfldbl" = X; then
7626         $cat >try.c <<'EOCP'
7627 #include <sys/types.h>
7628 #include <stdio.h>
7629 int main() {
7630   long double d = 123.456;
7631   printf("%.3llf\n", d);
7632 }
7633 EOCP
7634         set try
7635         if eval $compile; then
7636                 yyy=`./try$exe_ext`
7637                 case "$yyy" in
7638                 123.456)
7639                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7640                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7641                         echo "We will use %llf."
7642                         ;;
7643                 esac
7644         fi
7645 fi
7646
7647 if $test X"$sPRIfldbl" = X; then
7648         $cat >try.c <<'EOCP'
7649 #include <sys/types.h>
7650 #include <stdio.h>
7651 int main() {
7652   long double d = 123.456;
7653   printf("%.3Lf\n", d);
7654 }
7655 EOCP
7656         set try
7657         if eval $compile; then
7658                 yyy=`./try$exe_ext`
7659                 case "$yyy" in
7660                 123.456)
7661                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7662                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7663                         echo "We will use %Lf."
7664                         ;;
7665                 esac
7666         fi
7667 fi
7668
7669 if $test X"$sPRIfldbl" = X; then
7670         $cat >try.c <<'EOCP'
7671 #include <sys/types.h>
7672 #include <stdio.h>
7673 int main() {
7674   long double d = 123.456;
7675   printf("%.3lf\n", d);
7676 }
7677 EOCP
7678         set try
7679         if eval $compile; then
7680                 yyy=`./try$exe_ext`
7681                 case "$yyy" in
7682                 123.456)
7683                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7684                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7685                         echo "We will use %lf."
7686                         ;;
7687                 esac
7688         fi
7689 fi
7690
7691 if $test X"$sPRIfldbl" = X; then
7692         echo "Cannot figure out how to print long doubles." >&4
7693 else
7694         sSCNfldbl=$sPRIfldbl    # expect consistency
7695 fi
7696
7697 $rm -f try try.*
7698
7699 fi # d_longdbl
7700
7701 case "$sPRIfldbl" in
7702 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7703         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7704         d_SCNfldbl="$undef";
7705         ;;
7706 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7707         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7708         d_SCNfldbl="$define";
7709         ;;
7710 esac
7711
7712 : Check how to convert floats to strings.
7713 echo " "
7714 echo "Checking for an efficient way to convert floats to strings."
7715 echo " " > try.c
7716 case "$uselongdouble" in
7717 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7718 esac
7719 case "$d_longdbl" in
7720 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7721 esac
7722 case "$d_PRIgldbl" in
7723 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7724 esac
7725 $cat >>try.c <<EOP
7726 #ifdef TRY_gconvert
7727 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7728 char *myname = "gconvert";
7729 #endif
7730 #ifdef TRY_gcvt
7731 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7732 char *myname = "gcvt";
7733 #endif
7734 #ifdef TRY_qgcvt
7735 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7736 char *myname = "qgcvt";
7737 #define DOUBLETYPE long double
7738 #endif
7739 #ifdef TRY_sprintf
7740 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7741 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7742 #else
7743 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7744 #endif
7745 char *myname = "sprintf";
7746 #endif
7747
7748 #ifndef DOUBLETYPE
7749 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7750 #define DOUBLETYPE long double
7751 #else
7752 #define DOUBLETYPE double
7753 #endif
7754 #endif
7755
7756 #include <stdio.h>
7757
7758 #define I_STDLIB $i_stdlib
7759 #ifdef I_STDLIB
7760 #include <stdlib.h>
7761 #endif
7762
7763 int
7764 checkit(expect, got)
7765 char *expect;
7766 char *got;
7767 {
7768     if (strcmp(expect, got)) {
7769                 printf("%s oddity:  Expected %s, got %s\n",
7770                         myname, expect, got);
7771                 exit(1);
7772         }
7773 }
7774
7775 int main()
7776
7777         char buf[64]; 
7778         buf[63] = '\0';
7779
7780         /* This must be 1st test on (which?) platform */
7781         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7782         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7783         checkit("0.1", buf);
7784
7785         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7786         checkit("1", buf);
7787
7788         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7789         checkit("1.1", buf);
7790
7791         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7792         checkit("1.01", buf);
7793
7794         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7795         checkit("1.001", buf);
7796
7797         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7798         checkit("1.0001", buf);
7799
7800         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7801         checkit("1.00001", buf);
7802
7803         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7804         checkit("1.000001", buf);
7805
7806         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7807         checkit("0", buf);
7808
7809         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7810         checkit("-1", buf);
7811
7812         /* Some Linux gcvt's give 1.e+5 here. */
7813         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7814         checkit("100000", buf);
7815         
7816         /* Some Linux gcvt's give -1.e+5 here. */
7817         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7818         checkit("-100000", buf);
7819
7820         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7821         checkit("123.456", buf);
7822
7823         exit(0);
7824 }
7825 EOP
7826 case "$d_Gconvert" in
7827 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7828 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7829 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7830 *) xxx_list='gconvert gcvt sprintf' ;;
7831 esac
7832
7833 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7834 "$define$define$define")
7835     # for long doubles prefer first qgcvt, then sprintf
7836     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7837     xxx_list="sprintf $xxx_list"
7838     case "$d_qgcvt" in
7839     "$define") xxx_list="qgcvt $xxx_list" ;;
7840     esac
7841     ;;
7842 esac
7843
7844 for xxx_convert in $xxx_list; do
7845         echo "Trying $xxx_convert..."
7846         $rm -f try try$_o
7847         set try -DTRY_$xxx_convert
7848         if eval $compile; then
7849                 echo "$xxx_convert() found." >&4
7850                 if ./try; then
7851                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7852                         break;
7853                 else
7854                         echo "...But $xxx_convert didn't work as I expected."
7855                 fi
7856         else
7857                 echo "$xxx_convert NOT found." >&4
7858         fi
7859 done
7860         
7861 case "$xxx_convert" in
7862 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7863 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7864 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7865 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7866    "$define$define$define")
7867       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7868    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7869    esac
7870    ;;  
7871 esac
7872
7873 : see if _fwalk exists
7874 set fwalk d__fwalk
7875 eval $inlibc
7876
7877 : Initialize h_fcntl
7878 h_fcntl=false
7879
7880 : Initialize h_sysfile
7881 h_sysfile=false
7882
7883 : access call always available on UNIX
7884 set access d_access
7885 eval $inlibc
7886
7887 : locate the flags for 'access()'
7888 case "$d_access" in
7889 "$define")
7890         echo " "
7891         $cat >access.c <<'EOCP'
7892 #include <sys/types.h>
7893 #ifdef I_FCNTL
7894 #include <fcntl.h>
7895 #endif
7896 #ifdef I_SYS_FILE
7897 #include <sys/file.h>
7898 #endif
7899 #ifdef I_UNISTD
7900 #include <unistd.h>
7901 #endif
7902 int main() {
7903         exit(R_OK);
7904 }
7905 EOCP
7906         : check sys/file.h first, no particular reason here
7907         if $test `./findhdr sys/file.h` && \
7908                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7909                 h_sysfile=true;
7910                 echo "<sys/file.h> defines the *_OK access constants." >&4
7911         elif $test `./findhdr fcntl.h` && \
7912                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7913                 h_fcntl=true;
7914                 echo "<fcntl.h> defines the *_OK access constants." >&4
7915         elif $test `./findhdr unistd.h` && \
7916                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7917                 echo "<unistd.h> defines the *_OK access constants." >&4
7918         else
7919                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7920         fi
7921         ;;
7922 esac
7923 $rm -f access*
7924
7925 : see if accessx exists
7926 set accessx d_accessx
7927 eval $inlibc
7928
7929 : see if alarm exists
7930 set alarm d_alarm
7931 eval $inlibc
7932
7933 : see if atolf exists
7934 set atolf d_atolf
7935 eval $inlibc
7936
7937 : see if atoll exists
7938 set atoll d_atoll
7939 eval $inlibc
7940
7941 : Look for GNU-cc style attribute checking
7942 echo " "
7943 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7944 $cat >attrib.c <<'EOCP'
7945 #include <stdio.h>
7946 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7947 EOCP
7948 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7949         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7950                 echo "Your C compiler doesn't fully support __attribute__."
7951                 val="$undef"
7952         else
7953                 echo "Your C compiler supports __attribute__."
7954                 val="$define"
7955         fi
7956 else
7957         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7958         val="$undef"
7959 fi
7960 set d_attribut
7961 eval $setvar
7962 $rm -f attrib*
7963
7964 : see if bcmp exists
7965 set bcmp d_bcmp
7966 eval $inlibc
7967
7968 : see if bcopy exists
7969 set bcopy d_bcopy
7970 eval $inlibc
7971
7972 : see if this is a unistd.h system
7973 set unistd.h i_unistd
7974 eval $inhdr
7975
7976 : see if getpgrp exists
7977 set getpgrp d_getpgrp
7978 eval $inlibc
7979
7980 case "$d_getpgrp" in
7981 "$define")
7982         echo " "
7983         echo "Checking to see which flavor of getpgrp is in use..."
7984         $cat >set.c <<EOP
7985 #$i_unistd I_UNISTD
7986 #include <sys/types.h>
7987 #ifdef I_UNISTD
7988 #  include <unistd.h>
7989 #endif
7990 int main()
7991 {
7992         if (getuid() == 0) {
7993                 printf("(I see you are running Configure as super-user...)\n");
7994                 setuid(1);
7995         }
7996 #ifdef TRY_BSD_PGRP
7997         if (getpgrp(1) == 0)
7998                 exit(0);
7999 #else
8000         if (getpgrp() > 0)
8001                 exit(0);
8002 #endif
8003         exit(1);
8004 }
8005 EOP
8006         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8007                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8008                 val="$define"
8009         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8010                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8011                 val="$undef"
8012         else
8013                 echo "I can't seem to compile and run the test program."
8014                 if ./usg; then
8015                         xxx="a USG one, i.e. you use getpgrp()."
8016                 else
8017                         # SVR4 systems can appear rather BSD-ish.
8018                         case "$i_unistd" in
8019                         $undef)
8020                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8021                                 val="$define"
8022                                 ;;
8023                         $define)
8024                                 xxx="probably a USG one, i.e. you use getpgrp()."
8025                                 val="$undef"
8026                                 ;;
8027                         esac
8028                 fi
8029                 echo "Assuming your getpgrp is $xxx" >&4
8030         fi
8031         ;;
8032 *) val="$undef";;
8033 esac
8034 set d_bsdgetpgrp
8035 eval $setvar
8036 $rm -f set set.c
8037
8038 : see if setpgrp exists
8039 set setpgrp d_setpgrp
8040 eval $inlibc
8041
8042 case "$d_setpgrp" in
8043 "$define")
8044         echo " "
8045         echo "Checking to see which flavor of setpgrp is in use..."
8046         $cat >set.c <<EOP
8047 #$i_unistd I_UNISTD
8048 #include <sys/types.h>
8049 #ifdef I_UNISTD
8050 #  include <unistd.h>
8051 #endif
8052 int main()
8053 {
8054         if (getuid() == 0) {
8055                 printf("(I see you are running Configure as super-user...)\n");
8056                 setuid(1);
8057         }
8058 #ifdef TRY_BSD_PGRP
8059         if (-1 == setpgrp(1, 1))
8060                 exit(0);
8061 #else
8062         if (setpgrp() != -1)
8063                 exit(0);
8064 #endif
8065         exit(1);
8066 }
8067 EOP
8068         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8069                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8070                 val="$define"
8071         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8072                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8073                 val="$undef"
8074         else
8075                 echo "(I can't seem to compile and run the test program.)"
8076                 if ./usg; then
8077                         xxx="a USG one, i.e. you use setpgrp()."
8078                 else
8079                         # SVR4 systems can appear rather BSD-ish.
8080                         case "$i_unistd" in
8081                         $undef)
8082                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8083                                 val="$define"
8084                                 ;;
8085                         $define)
8086                                 xxx="probably a USG one, i.e. you use setpgrp()."
8087                                 val="$undef"
8088                                 ;;
8089                         esac
8090                 fi
8091                 echo "Assuming your setpgrp is $xxx" >&4
8092         fi
8093         ;;
8094 *) val="$undef";;
8095 esac
8096 set d_bsdsetpgrp
8097 eval $setvar
8098 $rm -f set set.c
8099 : see if bzero exists
8100 set bzero d_bzero
8101 eval $inlibc
8102
8103 : see if signal is declared as pointer to function returning int or void
8104 echo " "
8105 xxx=`./findhdr signal.h`
8106 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8107 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8108         echo "You have int (*signal())() instead of void." >&4
8109         val="$undef"
8110 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8111         echo "You have void (*signal())()." >&4
8112         val="$define"
8113 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8114         echo "You have int (*signal())() instead of void." >&4
8115         val="$undef"
8116 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8117         echo "You have void (*signal())()." >&4
8118         val="$define"
8119 else
8120         case "$d_voidsig" in
8121         '')
8122         echo "I can't determine whether signal handler returns void or int..." >&4
8123                 dflt=void
8124                 rp="What type does your signal handler return?"
8125                 . ./myread
8126                 case "$ans" in
8127                 v*) val="$define";;
8128                 *) val="$undef";;
8129                 esac;;
8130         "$define")
8131                 echo "As you already told me, signal handler returns void." >&4
8132                 val="$define"
8133                 ;;
8134         *)      echo "As you already told me, signal handler returns int." >&4
8135                 val="$undef"
8136                 ;;
8137         esac
8138 fi
8139 set d_voidsig
8140 eval $setvar
8141 case "$d_voidsig" in
8142 "$define") signal_t="void";;
8143 *) signal_t="int";;
8144 esac
8145 $rm -f $$.tmp
8146
8147 : check for ability to cast large floats to 32-bit ints.
8148 echo " "
8149 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8150 if $test "$intsize" -ge 4; then
8151         xxx=int
8152 else
8153         xxx=long
8154 fi
8155 $cat >try.c <<EOCP
8156 #include <stdio.h>
8157 #include <sys/types.h>
8158 #include <signal.h>
8159 $signal_t blech(s) int s; { exit(3); }
8160 int main()
8161 {
8162         $xxx i32;
8163         double f, g;
8164         int result = 0;
8165         char str[16];
8166         signal(SIGFPE, blech);
8167
8168         /* Don't let compiler optimize the test away.  Store the number 
8169            in a writable string for gcc to pass to sscanf under HP/UX.
8170         */
8171         sprintf(str, "2147483647");
8172         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8173         g = 10 * f;
8174         i32  = ($xxx) g;
8175
8176         /* x86 processors will probably give 0x8000 0000, which is a
8177        sign change.  We don't want that.  We want to mimic SPARC
8178            behavior here, which is to preserve the sign and give
8179            back 0x7fff ffff.
8180         */
8181         if (i32 != ($xxx) f)
8182                 result |= 1;
8183         exit(result);
8184 }
8185 EOCP
8186 set try
8187 if eval $compile_ok; then
8188         ./try
8189         yyy=$?
8190 else
8191         echo "(I can't seem to compile the test program--assuming it can't)"
8192         yyy=1
8193 fi
8194 case "$yyy" in
8195 0)      val="$define"
8196         echo "Yup, it can."
8197         ;;
8198 *)      val="$undef"
8199         echo "Nope, it can't."
8200         ;;
8201 esac
8202 set d_casti32
8203 eval $setvar
8204 $rm -f try try.*
8205
8206 : check for ability to cast negative floats to unsigned
8207 echo " "
8208 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8209 $cat >try.c <<EOCP
8210 #include <stdio.h>
8211 #include <sys/types.h>
8212 #include <signal.h>
8213 $signal_t blech(s) int s; { exit(7); }
8214 $signal_t blech_in_list(s) int s; { exit(4); }
8215 unsigned long dummy_long(p) unsigned long p; { return p; }
8216 unsigned int dummy_int(p) unsigned int p; { return p; }
8217 unsigned short dummy_short(p) unsigned short p; { return p; }
8218 int main()
8219 {
8220         double f;
8221         unsigned long along;
8222         unsigned int aint;
8223         unsigned short ashort;
8224         int result = 0;
8225         char str[16];
8226         
8227         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8228            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8229            optimized the whole file away
8230         */
8231         /* Store the number in a writable string for gcc to pass to 
8232            sscanf under HP/UX.
8233         */
8234         sprintf(str, "-123");
8235         sscanf(str, "%lf", &f);  /* f = -123.; */
8236
8237         signal(SIGFPE, blech);
8238         along = (unsigned long)f;
8239         aint = (unsigned int)f;
8240         ashort = (unsigned short)f;
8241         if (along != (unsigned long)-123)
8242                 result |= 1;
8243         if (aint != (unsigned int)-123)
8244                 result |= 1;
8245         if (ashort != (unsigned short)-123)
8246                 result |= 1;
8247         sprintf(str, "1073741824.");
8248         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8249         f = f + f;
8250         along = 0;
8251         along = (unsigned long)f;
8252         if (along != 0x80000000)
8253                 result |= 2;
8254         f -= 1.;
8255         along = 0;
8256         along = (unsigned long)f;
8257         if (along != 0x7fffffff)
8258                 result |= 1;
8259         f += 2.;
8260         along = 0;
8261         along = (unsigned long)f;
8262         if (along != 0x80000001)
8263                 result |= 2;
8264         if (result)
8265                 exit(result);
8266         signal(SIGFPE, blech_in_list);
8267         sprintf(str, "123.");
8268         sscanf(str, "%lf", &f);  /* f = 123.; */
8269         along = dummy_long((unsigned long)f);
8270         aint = dummy_int((unsigned int)f);
8271         ashort = dummy_short((unsigned short)f);
8272         if (along != (unsigned long)123)
8273                 result |= 4;
8274         if (aint != (unsigned int)123)
8275                 result |= 4;
8276         if (ashort != (unsigned short)123)
8277                 result |= 4;
8278         exit(result);
8279
8280 }
8281 EOCP
8282 set try
8283 if eval $compile_ok; then
8284         ./try
8285         castflags=$?
8286 else
8287         echo "(I can't seem to compile the test program--assuming it can't)"
8288         castflags=7
8289 fi
8290 case "$castflags" in
8291 0)      val="$define"
8292         echo "Yup, it can."
8293         ;;
8294 *)      val="$undef"
8295         echo "Nope, it can't."
8296         ;;
8297 esac
8298 set d_castneg
8299 eval $setvar
8300 $rm -f try.*
8301
8302 : see if vprintf exists
8303 echo " "
8304 if set vprintf val -f d_vprintf; eval $csym; $val; then
8305         echo 'vprintf() found.' >&4
8306         val="$define"
8307         $cat >vprintf.c <<'EOF'
8308 #include <varargs.h>
8309
8310 int main() { xxx("foo"); }
8311
8312 xxx(va_alist)
8313 va_dcl
8314 {
8315         va_list args;
8316         char buf[10];
8317
8318         va_start(args);
8319         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8320 }
8321 EOF
8322         set vprintf
8323         if eval $compile && ./vprintf; then
8324                 echo "Your vsprintf() returns (int)." >&4
8325                 val2="$undef"
8326         else
8327                 echo "Your vsprintf() returns (char*)." >&4
8328                 val2="$define"
8329         fi
8330 else
8331         echo 'vprintf() NOT found.' >&4
8332                 val="$undef"
8333                 val2="$undef"
8334 fi
8335 set d_vprintf
8336 eval $setvar
8337 val=$val2
8338 set d_charvspr
8339 eval $setvar
8340
8341 : see if chown exists
8342 set chown d_chown
8343 eval $inlibc
8344
8345 : see if chroot exists
8346 set chroot d_chroot
8347 eval $inlibc
8348
8349 : see if chsize exists
8350 set chsize d_chsize
8351 eval $inlibc
8352
8353 : check for const keyword
8354 echo " "
8355 echo 'Checking to see if your C compiler knows about "const"...' >&4
8356 $cat >const.c <<'EOCP'
8357 typedef struct spug { int drokk; } spug;
8358 int main()
8359 {
8360         const char *foo;
8361         const spug y;
8362 }
8363 EOCP
8364 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8365         val="$define"
8366         echo "Yup, it does."
8367 else
8368         val="$undef"
8369         echo "Nope, it doesn't."
8370 fi
8371 set d_const
8372 eval $setvar
8373
8374 : see if crypt exists
8375 echo " "
8376 if set crypt val -f d_crypt; eval $csym; $val; then
8377         echo 'crypt() found.' >&4
8378         val="$define"
8379         cryptlib=''
8380 else
8381         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8382         if $test -z "$cryptlib"; then
8383                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8384         else
8385                 cryptlib=-lcrypt
8386         fi
8387         if $test -z "$cryptlib"; then
8388                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8389         else
8390                 cryptlib=-lcrypt
8391         fi
8392         if $test -z "$cryptlib"; then
8393                 cryptlib=`./loc libcrypt$_a "" $libpth`
8394         else
8395                 cryptlib=-lcrypt
8396         fi
8397         if $test -z "$cryptlib"; then
8398                 echo 'crypt() NOT found.' >&4
8399                 val="$undef"
8400         else
8401                 val="$define"
8402         fi
8403 fi
8404 set d_crypt
8405 eval $setvar
8406
8407 : get csh whereabouts
8408 case "$csh" in
8409 'csh') val="$undef" ;;
8410 *) val="$define" ;;
8411 esac
8412 set d_csh
8413 eval $setvar
8414 : Respect a hint or command line value for full_csh.
8415 case "$full_csh" in
8416 '') full_csh=$csh ;;
8417 esac
8418
8419 : see if cuserid exists
8420 set cuserid d_cuserid
8421 eval $inlibc
8422
8423 : see if this is a limits.h system
8424 set limits.h i_limits
8425 eval $inhdr
8426
8427 : see if this is a float.h system
8428 set float.h i_float
8429 eval $inhdr
8430
8431 : See if number of significant digits in a double precision number is known
8432 echo " "
8433 $cat >dbl_dig.c <<EOM
8434 #$i_limits I_LIMITS
8435 #$i_float I_FLOAT
8436 #ifdef I_LIMITS
8437 #include <limits.h>
8438 #endif
8439 #ifdef I_FLOAT
8440 #include <float.h>
8441 #endif
8442 #ifdef DBL_DIG
8443 printf("Contains DBL_DIG");
8444 #endif
8445 EOM
8446 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8447 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8448         echo "DBL_DIG found." >&4
8449         val="$define"
8450 else
8451         echo "DBL_DIG NOT found." >&4
8452         val="$undef"
8453 fi
8454 $rm -f dbl_dig.?
8455 set d_dbl_dig
8456 eval $setvar
8457
8458 : see if difftime exists
8459 set difftime d_difftime
8460 eval $inlibc
8461
8462 : see if this is a dirent system
8463 echo " "
8464 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8465         val="$define"
8466         echo "<dirent.h> found." >&4
8467 else
8468         val="$undef"
8469         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8470                 echo "<sys/dir.h> found." >&4
8471                 echo " "
8472         else
8473                 xinc=`./findhdr sys/ndir.h`
8474         fi
8475         echo "<dirent.h> NOT found." >&4
8476 fi
8477 set i_dirent
8478 eval $setvar
8479
8480 : Look for type of directory structure.
8481 echo " "
8482 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8483
8484 case "$direntrytype" in
8485 ''|' ')
8486         case "$i_dirent" in
8487         $define) guess1='struct dirent' ;;
8488         *) guess1='struct direct'  ;;
8489         esac
8490         ;;
8491 *)      guess1="$direntrytype"
8492         ;;
8493 esac
8494
8495 case "$guess1" in
8496 'struct dirent') guess2='struct direct' ;;
8497 *) guess2='struct dirent' ;;
8498 esac
8499                 
8500 if $contains "$guess1" try.c >/dev/null 2>&1; then
8501         direntrytype="$guess1"
8502         echo "Your directory entries are $direntrytype." >&4
8503 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8504         direntrytype="$guess2"
8505         echo "Your directory entries seem to be $direntrytype." >&4
8506 else
8507         echo "I don't recognize your system's directory entries." >&4
8508         rp="What type is used for directory entries on this system?"
8509         dflt="$guess1"
8510         . ./myread
8511         direntrytype="$ans"
8512 fi
8513 $rm -f try.c
8514
8515
8516 : see if the directory entry stores field length
8517 echo " "
8518 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8519 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8520         echo "Good, your directory entry keeps length information in d_namlen." >&4
8521         val="$define"
8522 else
8523         echo "Your directory entry does not know about the d_namlen field." >&4
8524         val="$undef"
8525 fi
8526 set d_dirnamlen
8527 eval $setvar
8528 $rm -f try.c
8529
8530 : see if dlerror exists
8531 xxx_runnm="$runnm"
8532 runnm=false
8533 set dlerror d_dlerror
8534 eval $inlibc
8535 runnm="$xxx_runnm"
8536
8537 : see if dlfcn is available
8538 set dlfcn.h i_dlfcn
8539 eval $inhdr
8540
8541 case "$usedl" in
8542 $define|y|true)
8543         $cat << EOM
8544
8545 On a few systems, the dynamically loaded modules that perl generates and uses
8546 will need a different extension than shared libs. The default will probably
8547 be appropriate.
8548
8549 EOM
8550         case "$dlext" in
8551         '')     dflt="$so" ;;
8552         *)      dflt="$dlext" ;;
8553         esac
8554         rp='What is the extension of dynamically loaded modules'
8555         . ./myread
8556         dlext="$ans"
8557         ;;
8558 *)
8559         dlext="none"
8560         ;;
8561 esac
8562
8563 : Check if dlsym need a leading underscore
8564 echo " "
8565 val="$undef"
8566
8567 case "$dlsrc" in
8568 dl_dlopen.xs)
8569         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8570         $cat >dyna.c <<'EOM'
8571 fred () { }
8572 EOM
8573
8574 $cat >fred.c<<EOM
8575
8576 #include <stdio.h>
8577 #$i_dlfcn I_DLFCN
8578 #ifdef I_DLFCN
8579 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8580 #else
8581 #include <sys/types.h>
8582 #include <nlist.h>
8583 #include <link.h>
8584 #endif
8585
8586 extern int fred() ;
8587
8588 int main()
8589 {
8590     void * handle ;
8591     void * symbol ;
8592 #ifndef RTLD_LAZY
8593     int mode = 1 ;
8594 #else
8595     int mode = RTLD_LAZY ;
8596 #endif
8597     handle = dlopen("./dyna.$dlext", mode) ;
8598     if (handle == NULL) {
8599         printf ("1\n") ;
8600         fflush (stdout) ;
8601         exit(0);
8602     }
8603     symbol = dlsym(handle, "fred") ;
8604     if (symbol == NULL) {
8605         /* try putting a leading underscore */
8606         symbol = dlsym(handle, "_fred") ;
8607         if (symbol == NULL) {
8608             printf ("2\n") ;
8609             fflush (stdout) ;
8610             exit(0);
8611         }
8612         printf ("3\n") ;
8613     }
8614     else
8615         printf ("4\n") ;
8616     fflush (stdout) ;
8617     exit(0);
8618 }
8619 EOM
8620         : Call the object file tmp-dyna.o in case dlext=o.
8621         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8622                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8623                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8624                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8625                 xxx=`./fred`
8626                 case $xxx in
8627                 1)      echo "Test program failed using dlopen." >&4
8628                         echo "Perhaps you should not use dynamic loading." >&4;;
8629                 2)      echo "Test program failed using dlsym." >&4
8630                         echo "Perhaps you should not use dynamic loading." >&4;;
8631                 3)      echo "dlsym needs a leading underscore" >&4
8632                         val="$define" ;;
8633                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8634                 esac
8635         else
8636                 echo "I can't compile and run the test program." >&4
8637                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8638         fi
8639         ;;
8640 esac
8641                 
8642 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8643
8644 set d_dlsymun
8645 eval $setvar
8646
8647 hasproto='varname=$1; func=$2; shift; shift;
8648 while $test $# -ge 2; do
8649         case "$1" in
8650         $define) echo "#include <$2>";;
8651         esac ;
8652     shift 2;
8653 done > try.c;
8654 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8655 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8656         echo "$func() prototype found.";
8657         val="$define";
8658 else
8659         echo "$func() prototype NOT found.";
8660         val="$undef";
8661 fi;
8662 set $varname;
8663 eval $setvar;
8664 $rm -f try.c tryout.c'
8665
8666 : see if prototype for drand48 is available
8667 echo " "
8668 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8669 eval $hasproto
8670
8671 : see if dup2 exists
8672 set dup2 d_dup2
8673 eval $inlibc
8674
8675 : see if eaccess exists
8676 set eaccess d_eaccess
8677 eval $inlibc
8678
8679 : see if endgrent exists
8680 set endgrent d_endgrent
8681 eval $inlibc
8682
8683 : see if endhostent exists
8684 set endhostent d_endhent
8685 eval $inlibc
8686
8687 : see if endnetent exists
8688 set endnetent d_endnent
8689 eval $inlibc
8690
8691 : see if endprotoent exists
8692 set endprotoent d_endpent
8693 eval $inlibc
8694
8695 : see if endpwent exists
8696 set endpwent d_endpwent
8697 eval $inlibc
8698
8699 : see if endservent exists
8700 set endservent d_endsent
8701 eval $inlibc
8702
8703 : Locate the flags for 'open()'
8704 echo " "
8705 $cat >open3.c <<'EOCP'
8706 #include <sys/types.h>
8707 #ifdef I_FCNTL
8708 #include <fcntl.h>
8709 #endif
8710 #ifdef I_SYS_FILE
8711 #include <sys/file.h>
8712 #endif
8713 int main() {
8714         if(O_RDONLY);
8715 #ifdef O_TRUNC
8716         exit(0);
8717 #else
8718         exit(1);
8719 #endif
8720 }
8721 EOCP
8722 : check sys/file.h first to get FREAD on Sun
8723 if $test `./findhdr sys/file.h` && \
8724                 set open3 -DI_SYS_FILE && eval $compile; then
8725         h_sysfile=true;
8726         echo "<sys/file.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 elif $test `./findhdr fcntl.h` && \
8735                 set open3 -DI_FCNTL && eval $compile; then
8736         h_fcntl=true;
8737         echo "<fcntl.h> defines the O_* constants..." >&4
8738         if ./open3; then
8739                 echo "and you have the 3 argument form of open()." >&4
8740                 val="$define"
8741         else
8742                 echo "but not the 3 argument form of open().  Oh, well." >&4
8743                 val="$undef"
8744         fi
8745 else
8746         val="$undef"
8747         echo "I can't find the O_* constant definitions!  You got problems." >&4
8748 fi
8749 set d_open3
8750 eval $setvar
8751 $rm -f open3*
8752
8753 : see which of string.h or strings.h is needed
8754 echo " "
8755 strings=`./findhdr string.h`
8756 if $test "$strings" && $test -r "$strings"; then
8757         echo "Using <string.h> instead of <strings.h>." >&4
8758         val="$define"
8759 else
8760         val="$undef"
8761         strings=`./findhdr strings.h`
8762         if $test "$strings" && $test -r "$strings"; then
8763                 echo "Using <strings.h> instead of <string.h>." >&4
8764         else
8765                 echo "No string header found -- You'll surely have problems." >&4
8766         fi
8767 fi
8768 set i_string
8769 eval $setvar
8770 case "$i_string" in
8771 "$undef") strings=`./findhdr strings.h`;;
8772 *)        strings=`./findhdr string.h`;;
8773 esac
8774
8775 : check for non-blocking I/O stuff
8776 case "$h_sysfile" in
8777 true) echo "#include <sys/file.h>" > head.c;;
8778 *)
8779         case "$h_fcntl" in
8780         true) echo "#include <fcntl.h>" > head.c;;
8781         *) echo "#include <sys/fcntl.h>" > head.c;;
8782         esac
8783         ;;
8784 esac
8785 echo " "
8786 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8787 case "$o_nonblock" in
8788 '')
8789         $cat head.c > try.c
8790         $cat >>try.c <<'EOCP'
8791 #include <stdio.h>
8792 int main() {
8793 #ifdef O_NONBLOCK
8794         printf("O_NONBLOCK\n");
8795         exit(0);
8796 #endif
8797 #ifdef O_NDELAY
8798         printf("O_NDELAY\n");
8799         exit(0);
8800 #endif
8801 #ifdef FNDELAY
8802         printf("FNDELAY\n");
8803         exit(0);
8804 #endif
8805         exit(0);
8806 }
8807 EOCP
8808         set try
8809         if eval $compile_ok; then
8810                 o_nonblock=`./try`
8811                 case "$o_nonblock" in
8812                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8813                 *) echo "Seems like we can use $o_nonblock.";;
8814                 esac
8815         else
8816                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8817         fi
8818         ;;
8819 *) echo "Using $hint value $o_nonblock.";;
8820 esac
8821 $rm -f try try.* .out core
8822
8823 echo " "
8824 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8825 case "$eagain" in
8826 '')
8827         $cat head.c > try.c
8828         $cat >>try.c <<EOCP
8829 #include <errno.h>
8830 #include <sys/types.h>
8831 #include <signal.h>
8832 #include <stdio.h> 
8833 #define MY_O_NONBLOCK $o_nonblock
8834 #ifndef errno  /* XXX need better Configure test */
8835 extern int errno;
8836 #endif
8837 #$i_unistd I_UNISTD
8838 #ifdef I_UNISTD
8839 #include <unistd.h>
8840 #endif
8841 #$i_string I_STRING
8842 #ifdef I_STRING
8843 #include <string.h>
8844 #else
8845 #include <strings.h>
8846 #endif
8847 $signal_t blech(x) int x; { exit(3); }
8848 EOCP
8849         $cat >> try.c <<'EOCP'
8850 int main()
8851 {
8852         int pd[2];
8853         int pu[2];
8854         char buf[1];
8855         char string[100];
8856
8857         pipe(pd);       /* Down: child -> parent */
8858         pipe(pu);       /* Up: parent -> child */
8859         if (0 != fork()) {
8860                 int ret;
8861                 close(pd[1]);   /* Parent reads from pd[0] */
8862                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8863                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8864                         exit(1);
8865                 signal(SIGALRM, blech);
8866                 alarm(5);
8867                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8868                         exit(2);
8869                 sprintf(string, "%d\n", ret);
8870                 write(2, string, strlen(string));
8871                 alarm(0);
8872 #ifdef EAGAIN
8873                 if (errno == EAGAIN) {
8874                         printf("EAGAIN\n");
8875                         goto ok;
8876                 }
8877 #endif
8878 #ifdef EWOULDBLOCK
8879                 if (errno == EWOULDBLOCK)
8880                         printf("EWOULDBLOCK\n");
8881 #endif
8882         ok:
8883                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8884                 sleep(2);                               /* Give it time to close our pipe */
8885                 alarm(5);
8886                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8887                 alarm(0);
8888                 sprintf(string, "%d\n", ret);
8889                 write(3, string, strlen(string));
8890                 exit(0);
8891         }
8892
8893         close(pd[0]);                   /* We write to pd[1] */
8894         close(pu[1]);                   /* We read from pu[0] */
8895         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8896         close(pd[1]);                   /* Pipe pd is now fully closed! */
8897         exit(0);                                /* Bye bye, thank you for playing! */
8898 }
8899 EOCP
8900         set try
8901         if eval $compile_ok; then
8902                 echo "$startsh" >mtry
8903                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8904                 chmod +x mtry
8905                 ./mtry >/dev/null 2>&1
8906                 case $? in
8907                 0) eagain=`$cat try.out`;;
8908                 1) echo "Could not perform non-blocking setting!";;
8909                 2) echo "I did a successful read() for something that was not there!";;
8910                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8911                 *) echo "Something terribly wrong happened during testing.";;
8912                 esac
8913                 rd_nodata=`$cat try.ret`
8914                 echo "A read() system call with no data present returns $rd_nodata."
8915                 case "$rd_nodata" in
8916                 0|-1) ;;
8917                 *)
8918                         echo "(That's peculiar, fixing that to be -1.)"
8919                         rd_nodata=-1
8920                         ;;
8921                 esac
8922                 case "$eagain" in
8923                 '')
8924                         echo "Forcing errno EAGAIN on read() with no data available."
8925                         eagain=EAGAIN
8926                         ;;
8927                 *)
8928                         echo "Your read() sets errno to $eagain when no data is available."
8929                         ;;
8930                 esac
8931                 status=`$cat try.err`
8932                 case "$status" in
8933                 0) echo "And it correctly returns 0 to signal EOF.";;
8934                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8935                 *) echo "However, your read() returns '$status' on EOF??";;
8936                 esac
8937                 val="$define"
8938                 if test "$status" = "$rd_nodata"; then
8939                         echo "WARNING: you can't distinguish between EOF and no data!"
8940                         val="$undef"
8941                 fi
8942         else
8943                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8944                 eagain=EAGAIN
8945         fi
8946         set d_eofnblk
8947         eval $setvar
8948         ;;
8949 *)
8950         echo "Using $hint value $eagain."
8951         echo "Your read() returns $rd_nodata when no data is present."
8952         case "$d_eofnblk" in
8953         "$define") echo "And you can see EOF because read() returns 0.";;
8954         "$undef") echo "But you can't see EOF status from read() returned value.";;
8955         *)
8956                 echo "(Assuming you can't see EOF status from read anyway.)"
8957                 d_eofnblk=$undef
8958                 ;;
8959         esac
8960         ;;
8961 esac
8962 $rm -f try try.* .out core head.c mtry
8963
8964 : see if fchmod exists
8965 set fchmod d_fchmod
8966 eval $inlibc
8967
8968 : see if fchown exists
8969 set fchown d_fchown
8970 eval $inlibc
8971
8972 : see if this is an fcntl system
8973 set fcntl d_fcntl
8974 eval $inlibc
8975
8976 echo " "
8977 : See if fcntl-based locking works.
8978 $cat >try.c <<'EOCP'
8979 #include <stdlib.h>
8980 #include <unistd.h>
8981 #include <fcntl.h>
8982 int main() {
8983 #if defined(F_SETLK) && defined(F_SETLKW)
8984      struct flock flock;
8985      int retval, fd;
8986      fd = open("try.c", O_RDONLY);
8987      flock.l_type = F_RDLCK;
8988      flock.l_whence = SEEK_SET;
8989      flock.l_start = flock.l_len = 0;
8990      retval = fcntl(fd, F_SETLK, &flock);
8991      close(fd);
8992      (retval < 0 ? exit(2) : exit(0));
8993 #else
8994      exit(2);
8995 #endif
8996 }
8997 EOCP
8998 echo "Checking if fcntl-based file locking works... "
8999 case "$d_fcntl" in
9000 "$define")
9001         set try
9002         if eval $compile_ok; then
9003                 if ./try; then
9004                         echo "Yes, it seems to work."
9005                         val="$define"
9006                 else
9007                         echo "Nope, it didn't work."
9008                         val="$undef"
9009                 fi
9010         else
9011                 echo "I'm unable to compile the test program, so I'll assume not."
9012                 val="$undef"
9013         fi
9014         ;;
9015 *) val="$undef";
9016         echo "Nope, since you don't even have fcntl()."
9017         ;;
9018 esac
9019 set d_fcntl_can_lock
9020 eval $setvar
9021 $rm -f try*
9022
9023
9024 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9025 while $test $# -ge 2; do
9026         case "$1" in
9027         $define) echo "#include <$2>";;
9028         esac ;
9029     shift 2;
9030 done > try.c;
9031 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9032 set try;
9033 if eval $compile; then
9034         val="$define";
9035 else
9036         val="$undef";
9037 fi;
9038 set $varname;
9039 eval $setvar;
9040 $rm -f try.c try.o'
9041
9042 socketlib=''
9043 sockethdr=''
9044 : see whether socket exists
9045 echo " "
9046 $echo $n "Hmm... $c" >&4
9047 if set socket val -f d_socket; eval $csym; $val; then
9048         echo "Looks like you have Berkeley networking support." >&4
9049         d_socket="$define"
9050         if set setsockopt val -f; eval $csym; $val; then
9051                 d_oldsock="$undef"
9052         else
9053                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9054                 d_oldsock="$define"
9055         fi
9056 else
9057         if $contains socklib libc.list >/dev/null 2>&1; then
9058                 echo "Looks like you have Berkeley networking support." >&4
9059                 d_socket="$define"
9060                 : we will have to assume that it supports the 4.2 BSD interface
9061                 d_oldsock="$undef"
9062         else
9063                 echo "You don't have Berkeley networking in libc$_a..." >&4
9064                 if test "X$d_socket" = "X$define"; then
9065                    echo "...but you seem to believe that you have sockets." >&4
9066                 else
9067                         for net in net socket
9068                         do
9069                                 if test -f /usr/lib/lib$net$_a; then
9070                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9071                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9072                                         if $contains socket libc.list >/dev/null 2>&1; then
9073                                                 d_socket="$define"
9074                                                 socketlib="-l$net"
9075                                                 case "$net" in
9076                                                 net)
9077                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9078                                                         sockethdr="-I/usr/netinclude"
9079                                                         ;;
9080                                                 esac
9081                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9082                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9083                                                         d_oldsock="$undef"
9084                                                 else
9085                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9086                                                         d_oldsock="$define"
9087                                                 fi
9088                                                 break
9089                                         fi
9090                                 fi
9091                         done
9092                         if test "X$d_socket" != "X$define"; then
9093                            echo "or anywhere else I see." >&4
9094                            d_socket="$undef"
9095                            d_oldsock="$undef"
9096                         fi
9097                 fi
9098         fi
9099 fi
9100
9101 : see if socketpair exists
9102 set socketpair d_sockpair
9103 eval $inlibc
9104
9105
9106 echo " "
9107 echo "Checking the availability of certain socket constants..." >& 4
9108 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9109         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9110         $cat >try.c <<EOF
9111 #include <sys/types.h>
9112 #include <sys/socket.h>
9113 int main() {
9114     int i = $ENUM;
9115 }
9116 EOF
9117         val="$undef"
9118         set try; if eval $compile; then
9119                 val="$define"
9120         fi
9121         set d_${enum}; eval $setvar
9122         $rm -f try.c try
9123 done
9124
9125 : see if sys/select.h has to be included
9126 set sys/select.h i_sysselct
9127 eval $inhdr
9128
9129 : see if we should include time.h, sys/time.h, or both
9130 echo " "
9131 if test "X$timeincl" = X; then
9132         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9133         $echo $n "I'm now running the test program...$c"
9134         $cat >try.c <<'EOCP'
9135 #include <sys/types.h>
9136 #ifdef I_TIME
9137 #include <time.h>
9138 #endif
9139 #ifdef I_SYSTIME
9140 #ifdef SYSTIMEKERNEL
9141 #define KERNEL
9142 #endif
9143 #include <sys/time.h>
9144 #endif
9145 #ifdef I_SYSSELECT
9146 #include <sys/select.h>
9147 #endif
9148 int main()
9149 {
9150         struct tm foo;
9151 #ifdef S_TIMEVAL
9152         struct timeval bar;
9153 #endif
9154 #ifdef S_TIMEZONE
9155         struct timezone tzp;
9156 #endif
9157         if (foo.tm_sec == foo.tm_sec)
9158                 exit(0);
9159 #ifdef S_TIMEVAL
9160         if (bar.tv_sec == bar.tv_sec)
9161                 exit(0);
9162 #endif
9163         exit(1);
9164 }
9165 EOCP
9166         flags=''
9167         for s_timezone in '-DS_TIMEZONE' ''; do
9168         sysselect=''
9169         for s_timeval in '-DS_TIMEVAL' ''; do
9170         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9171         for i_time in '' '-DI_TIME'; do
9172         for i_systime in '-DI_SYSTIME' ''; do
9173                 case "$flags" in
9174                 '') $echo $n ".$c"
9175                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9176                         if eval $compile; then
9177                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9178                                 shift
9179                                 flags="$*"
9180                                 echo " "
9181                                 $echo $n "Succeeded with $flags$c"
9182                         fi
9183                         ;;
9184                 esac
9185         done
9186         done
9187         done
9188         done
9189         done
9190         timeincl=''
9191         echo " "
9192         case "$flags" in
9193         *SYSTIMEKERNEL*) i_systimek="$define"
9194                 timeincl=`./findhdr sys/time.h`
9195                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9196         *) i_systimek="$undef";;
9197         esac
9198         case "$flags" in
9199         *I_TIME*) i_time="$define"
9200                 timeincl=`./findhdr time.h`" $timeincl"
9201                 echo "We'll include <time.h>." >&4;;
9202         *) i_time="$undef";;
9203         esac
9204         case "$flags" in
9205         *I_SYSTIME*) i_systime="$define"
9206                 timeincl=`./findhdr sys/time.h`" $timeincl"
9207                 echo "We'll include <sys/time.h>." >&4;;
9208         *) i_systime="$undef";;
9209         esac
9210         $rm -f try.c try
9211 fi
9212
9213 : check for fd_set items
9214 $cat <<EOM
9215
9216 Checking to see how well your C compiler handles fd_set and friends ...
9217 EOM
9218 $cat >fd_set.c <<EOCP
9219 #$i_systime I_SYS_TIME
9220 #$i_sysselct I_SYS_SELECT
9221 #$d_socket HAS_SOCKET
9222 #include <sys/types.h>
9223 #ifdef HAS_SOCKET
9224 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9225 #endif
9226 #ifdef I_SYS_TIME
9227 #include <sys/time.h>
9228 #endif
9229 #ifdef I_SYS_SELECT
9230 #include <sys/select.h>
9231 #endif
9232 int main() {
9233         fd_set fds;
9234
9235 #ifdef TRYBITS
9236         if(fds.fds_bits);
9237 #endif
9238
9239 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9240         exit(0);
9241 #else
9242         exit(1);
9243 #endif
9244 }
9245 EOCP
9246 set fd_set -DTRYBITS
9247 if eval $compile; then
9248         d_fds_bits="$define"
9249         d_fd_set="$define"
9250         echo "Well, your system knows about the normal fd_set typedef..." >&4
9251         if ./fd_set; then
9252                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9253                 d_fd_macros="$define"
9254         else
9255                 $cat >&4 <<'EOM'
9256 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9257 EOM
9258                 d_fd_macros="$undef"
9259         fi
9260 else
9261         $cat <<'EOM'
9262 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9263 EOM
9264         set fd_set
9265         if eval $compile; then
9266                 d_fds_bits="$undef"
9267                 d_fd_set="$define"
9268                 echo "Well, your system has some sort of fd_set available..." >&4
9269                 if ./fd_set; then
9270                         echo "and you have the normal fd_set macros." >&4
9271                         d_fd_macros="$define"
9272                 else
9273                         $cat <<'EOM'
9274 but not the normal fd_set macros!  Gross!  More work for me...
9275 EOM
9276                         d_fd_macros="$undef"
9277                 fi
9278         else
9279         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9280                 d_fd_set="$undef"
9281                 d_fds_bits="$undef"
9282                 d_fd_macros="$undef"
9283         fi
9284 fi
9285 $rm -f fd_set*
9286
9287 : see if fgetpos exists
9288 set fgetpos d_fgetpos
9289 eval $inlibc
9290
9291 : see if flock exists
9292 set flock d_flock
9293 eval $inlibc
9294
9295 : see if fork exists
9296 set fork d_fork
9297 eval $inlibc
9298
9299 : see if pathconf exists
9300 set pathconf d_pathconf
9301 eval $inlibc
9302
9303 : see if fpathconf exists
9304 set fpathconf d_fpathconf
9305 eval $inlibc
9306
9307 : see if this is a features.h system
9308 set features.h i_features
9309 eval $inhdr
9310
9311
9312 : check for fpos64_t
9313 echo " "
9314 echo "Checking to see if you have fpos64_t..." >&4
9315 $cat >try.c <<EOCP
9316 #$i_features I_FEATURES
9317 #ifdef I_FEATURES
9318 #include <features.h>
9319 #endif
9320 #include <stdio.h>
9321 int main() { fpos64_t x = 7; }
9322 EOCP
9323 set try
9324 if eval $compile; then
9325         val="$define"
9326         echo "You have fpos64_t."
9327 else
9328         val="$undef"
9329         echo "You do not have fpos64_t."
9330         case "$fpossize" in
9331         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9332         esac
9333 fi
9334 $rm -f try.* try
9335 set d_fpos64_t
9336 eval $setvar
9337
9338 : see if frexpl exists
9339 set frexpl d_frexpl
9340 eval $inlibc
9341
9342 hasstruct='varname=$1; struct=$2; shift; shift;
9343 while $test $# -ge 2; do
9344         case "$1" in
9345         $define) echo "#include <$2>";;
9346         esac ;
9347     shift 2;
9348 done > try.c;
9349 echo "int main () { struct $struct foo; }" >> try.c;
9350 set try;
9351 if eval $compile; then
9352         val="$define";
9353 else
9354         val="$undef";
9355 fi;
9356 set $varname;
9357 eval $setvar;
9358 $rm -f try.c try.o'
9359
9360 : see if this is a sys/param system
9361 set sys/param.h i_sysparam
9362 eval $inhdr
9363
9364 : see if this is a sys/mount.h system
9365 set sys/mount.h i_sysmount
9366 eval $inhdr
9367
9368 : see if sys/types.h has to be included
9369 set sys/types.h i_systypes
9370 eval $inhdr
9371
9372
9373 echo " "
9374 echo "Checking to see if your system supports struct fs_data..." >&4
9375 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9376 eval $hasstruct
9377 case "$d_fs_data_s" in
9378 "$define")      echo "Yes, it does."   ;;
9379 *)              echo "No, it doesn't." ;;
9380 esac
9381
9382 : see if fseeko exists
9383 set fseeko d_fseeko
9384 eval $inlibc
9385 case "$longsize" in
9386 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9387 esac
9388
9389 : see if fsetpos exists
9390 set fsetpos d_fsetpos
9391 eval $inlibc
9392
9393
9394 : see if fstatfs exists
9395 set fstatfs d_fstatfs
9396 eval $inlibc
9397
9398
9399 : see if statvfs exists
9400 set statvfs d_statvfs
9401 eval $inlibc
9402
9403 : see if fstatvfs exists
9404 set fstatvfs d_fstatvfs
9405 eval $inlibc
9406
9407
9408 : see if fsync exists
9409 set fsync d_fsync
9410 eval $inlibc
9411
9412 : see if ftello exists
9413 set ftello d_ftello
9414 eval $inlibc
9415 case "$longsize" in
9416 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9417 esac
9418
9419 : see if getcwd exists
9420 set getcwd d_getcwd
9421 eval $inlibc
9422
9423 : see if getespwnam exists
9424 set getespwnam d_getespwnam
9425 eval $inlibc
9426
9427
9428 : see if getfsstat exists
9429 set getfsstat d_getfsstat
9430 eval $inlibc
9431
9432 : see if getgrent exists
9433 set getgrent d_getgrent
9434 eval $inlibc
9435
9436 : see if gethostbyaddr exists
9437 set gethostbyaddr d_gethbyaddr
9438 eval $inlibc
9439
9440 : see if gethostbyname exists
9441 set gethostbyname d_gethbyname
9442 eval $inlibc
9443
9444 : see if gethostent exists
9445 set gethostent d_gethent
9446 eval $inlibc
9447
9448 : see how we will look up host name
9449 echo " "
9450 call=''
9451 if set gethostname val -f d_gethname; eval $csym; $val; then
9452         echo 'gethostname() found.' >&4
9453         d_gethname="$define"
9454         call=gethostname
9455 fi
9456 if set uname val -f d_uname; eval $csym; $val; then
9457         if ./xenix; then
9458                 $cat <<'EOM'
9459 uname() was found, but you're running xenix, and older versions of xenix
9460 have a broken uname(). If you don't really know whether your xenix is old
9461 enough to have a broken system call, use the default answer.
9462
9463 EOM
9464                 dflt=y
9465                 case "$d_uname" in
9466                 "$define") dflt=n;;
9467                 esac
9468                 rp='Is your uname() broken?'
9469                 . ./myread
9470                 case "$ans" in
9471                 n*) d_uname="$define"; call=uname;;
9472                 esac
9473         else
9474                 echo 'uname() found.' >&4
9475                 d_uname="$define"
9476                 case "$call" in
9477                 '') call=uname ;;
9478                 esac
9479         fi
9480 fi
9481 case "$d_gethname" in
9482 '') d_gethname="$undef";;
9483 esac
9484 case "$d_uname" in
9485 '') d_uname="$undef";;
9486 esac
9487 case "$d_uname$d_gethname" in
9488 *define*)
9489         dflt=n
9490         cat <<EOM
9491  
9492 Every now and then someone has a $call() that lies about the hostname
9493 but can't be fixed for political or economic reasons.  If you wish, I can
9494 pretend $call() isn't there and maybe compute hostname at run-time
9495 thanks to the '$phostname' command.
9496
9497 EOM
9498         rp="Shall I ignore $call() from now on?"
9499         . ./myread
9500         case "$ans" in
9501         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9502         esac;;
9503 esac
9504 case "$phostname" in
9505 '') aphostname='';;
9506 *) case "$aphostname" in
9507         /*) ;;
9508         *) set X $phostname
9509                 shift
9510                 file=$1
9511                 shift
9512                 file=`./loc $file $file $pth`
9513                 aphostname=`echo $file $*`
9514                 ;;
9515         esac
9516         ;;
9517 esac
9518 case "$d_uname$d_gethname" in
9519 *define*) ;;
9520 *)
9521         case "$phostname" in
9522         '')
9523                 echo "There will be no way for $package to get your hostname." >&4;;
9524         *)
9525         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9526                 ;;
9527         esac;;
9528 esac
9529 case "$d_phostname" in
9530 '') d_phostname="$undef";;
9531 esac
9532
9533 : see if this is a netdb.h system
9534 set netdb.h i_netdb
9535 eval $inhdr
9536
9537 : see if prototypes for various gethostxxx netdb.h functions are available
9538 echo " "
9539 set d_gethostprotos gethostent $i_netdb netdb.h
9540 eval $hasproto
9541
9542 : see if getlogin exists
9543 set getlogin d_getlogin
9544 eval $inlibc
9545
9546 : see if getmnt exists
9547 set getmnt d_getmnt
9548 eval $inlibc
9549
9550 : see if getmntent exists
9551 set getmntent d_getmntent
9552 eval $inlibc
9553
9554 : see if getnetbyaddr exists
9555 set getnetbyaddr d_getnbyaddr
9556 eval $inlibc
9557
9558 : see if getnetbyname exists
9559 set getnetbyname d_getnbyname
9560 eval $inlibc
9561
9562 : see if getnetent exists
9563 set getnetent d_getnent
9564 eval $inlibc
9565
9566 : see if prototypes for various getnetxxx netdb.h functions are available
9567 echo " "
9568 set d_getnetprotos getnetent $i_netdb netdb.h
9569 eval $hasproto
9570
9571 : see if getpagesize exists
9572 set getpagesize d_getpagsz
9573 eval $inlibc
9574
9575
9576 : see if getprotobyname exists
9577 set getprotobyname d_getpbyname
9578 eval $inlibc
9579
9580 : see if getprotobynumber exists
9581 set getprotobynumber d_getpbynumber
9582 eval $inlibc
9583
9584 : see if getprotoent exists
9585 set getprotoent d_getpent
9586 eval $inlibc
9587
9588 : see if getpgid exists
9589 set getpgid d_getpgid
9590 eval $inlibc
9591
9592 : see if getpgrp2 exists
9593 set getpgrp2 d_getpgrp2
9594 eval $inlibc
9595
9596 : see if getppid exists
9597 set getppid d_getppid
9598 eval $inlibc
9599
9600 : see if getpriority exists
9601 set getpriority d_getprior
9602 eval $inlibc
9603
9604 : see if prototypes for various getprotoxxx netdb.h functions are available
9605 echo " "
9606 set d_getprotoprotos getprotoent $i_netdb netdb.h
9607 eval $hasproto
9608
9609 : see if getprpwnam exists
9610 set getprpwnam d_getprpwnam
9611 eval $inlibc
9612
9613 : see if getpwent exists
9614 set getpwent d_getpwent
9615 eval $inlibc
9616
9617
9618 : see if getservbyname exists
9619 set getservbyname d_getsbyname
9620 eval $inlibc
9621
9622 : see if getservbyport exists
9623 set getservbyport d_getsbyport
9624 eval $inlibc
9625
9626 : see if getservent exists
9627 set getservent d_getsent
9628 eval $inlibc
9629
9630 : see if prototypes for various getservxxx netdb.h functions are available
9631 echo " "
9632 set d_getservprotos getservent $i_netdb netdb.h
9633 eval $hasproto
9634
9635 : see if getspnam exists
9636 set getspnam d_getspnam
9637 eval $inlibc
9638
9639 : see if gettimeofday or ftime exists
9640 set gettimeofday d_gettimeod
9641 eval $inlibc
9642 case "$d_gettimeod" in
9643 "$undef")
9644         set ftime d_ftime 
9645         eval $inlibc
9646         ;;
9647 *)
9648         val="$undef"; set d_ftime; eval $setvar
9649         ;;
9650 esac
9651 case "$d_gettimeod$d_ftime" in
9652 "$undef$undef")
9653         echo " "
9654         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9655         ;;
9656 esac
9657
9658 : see if this is an grp system
9659 set grp.h i_grp
9660 eval $inhdr
9661
9662 case "$i_grp" in
9663 $define)
9664         xxx=`./findhdr grp.h`
9665         $cppstdin $cppflags $cppminus < $xxx >$$.h
9666
9667         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9668                 val="$define"
9669         else
9670                 val="$undef"
9671         fi
9672         set d_grpasswd
9673         eval $setvar
9674
9675         $rm -f $$.h
9676         ;;
9677 *)
9678         val="$undef";
9679         set d_grpasswd; eval $setvar
9680         ;;
9681 esac
9682
9683 : see if hasmntopt exists
9684 set hasmntopt d_hasmntopt
9685 eval $inlibc
9686
9687 : see if this is a netinet/in.h or sys/in.h system
9688 set netinet/in.h i_niin sys/in.h i_sysin
9689 eval $inhdr
9690
9691 : see if arpa/inet.h has to be included
9692 set arpa/inet.h i_arpainet
9693 eval $inhdr
9694
9695 : see if htonl --and friends-- exists
9696 val=''
9697 set htonl val
9698 eval $inlibc
9699
9700 : Maybe they are macros.
9701 case "$val" in
9702 $undef)
9703         $cat >htonl.c <<EOM
9704 #include <stdio.h>
9705 #include <sys/types.h>
9706 #$i_niin I_NETINET_IN
9707 #$i_sysin I_SYS_IN
9708 #$i_arpainet I_ARPA_INET
9709 #ifdef I_NETINET_IN
9710 #include <netinet/in.h>
9711 #endif
9712 #ifdef I_SYS_IN
9713 #include <sys/in.h>
9714 #endif
9715 #ifdef I_ARPA_INET
9716 #include <arpa/inet.h>
9717 #endif
9718 #ifdef htonl
9719 printf("Defined as a macro.");
9720 #endif
9721 EOM
9722         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9723         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9724                 val="$define"
9725                 echo "But it seems to be defined as a macro." >&4
9726         fi
9727         $rm -f htonl.?
9728         ;;
9729 esac
9730 set d_htonl
9731 eval $setvar
9732
9733 : see if iconv exists
9734 set iconv d_iconv
9735 eval $inlibc
9736
9737 : index or strchr
9738 echo " "
9739 if set index val -f; eval $csym; $val; then
9740         if set strchr val -f d_strchr; eval $csym; $val; then
9741                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9742                         val="$define"
9743                         vali="$undef"
9744                         echo "strchr() found." >&4
9745                 else
9746                         val="$undef"
9747                         vali="$define"
9748                         echo "index() found." >&4
9749                 fi
9750         else
9751                 val="$undef"
9752                 vali="$define"
9753                 echo "index() found." >&4
9754         fi
9755 else
9756         if set strchr val -f d_strchr; eval $csym; $val; then
9757                 val="$define"
9758                 vali="$undef"
9759                 echo "strchr() found." >&4
9760         else
9761                 echo "No index() or strchr() found!" >&4
9762                 val="$undef"
9763                 vali="$undef"
9764         fi
9765 fi
9766 set d_strchr; eval $setvar
9767 val="$vali"
9768 set d_index; eval $setvar
9769
9770 : check whether inet_aton exists
9771 set inet_aton d_inetaton
9772 eval $inlibc
9773
9774 : see if inttypes.h is available
9775 : we want a real compile instead of Inhdr because some systems
9776 : have an inttypes.h which includes non-existent headers
9777 echo " "
9778 $cat >try.c <<EOCP
9779 #include <inttypes.h>
9780 int main() {
9781         static int32_t foo32 = 0x12345678;
9782 }
9783 EOCP
9784 set try
9785 if eval $compile; then
9786         echo "<inttypes.h> found." >&4
9787         val="$define"
9788 else
9789         echo "<inttypes.h> NOT found." >&4
9790         val="$undef"
9791 fi
9792 $rm -f try.c try
9793 set i_inttypes
9794 eval $setvar
9795
9796 : check for int64_t
9797 echo " "
9798 echo "Checking to see if you have int64_t..." >&4
9799 $cat >try.c <<EOCP
9800 #include <sys/types.h>
9801 #$i_inttypes I_INTTYPES
9802 #ifdef I_INTTYPES
9803 #include <inttypes.h>
9804 #endif
9805 int main() { int64_t x = 7; }
9806 EOCP
9807 set try
9808 if eval $compile; then
9809         val="$define"
9810         echo "You have int64_t."
9811 else
9812         val="$undef"
9813         echo "You do not have int64_t."
9814 fi
9815 $rm -f try try.*
9816 set d_int64_t
9817 eval $setvar
9818
9819 : Look for isascii
9820 echo " "
9821 $cat >isascii.c <<'EOCP'
9822 #include <stdio.h>
9823 #include <ctype.h>
9824 int main() {
9825         int c = 'A';
9826         if (isascii(c))
9827                 exit(0);
9828         else
9829                 exit(1);
9830 }
9831 EOCP
9832 set isascii
9833 if eval $compile; then
9834         echo "isascii() found." >&4
9835         val="$define"
9836 else
9837         echo "isascii() NOT found." >&4
9838         val="$undef"
9839 fi
9840 set d_isascii
9841 eval $setvar
9842 $rm -f isascii*
9843
9844 : see if isnan exists
9845 set isnan d_isnan
9846 eval $inlibc
9847
9848 : see if isnanl exists
9849 set isnanl d_isnanl
9850 eval $inlibc
9851
9852 : see if killpg exists
9853 set killpg d_killpg
9854 eval $inlibc
9855
9856 : see if lchown exists
9857 echo " "
9858 $cat > try.c <<'EOCP'
9859 /* System header to define __stub macros and hopefully few prototypes,
9860     which can conflict with char lchown(); below.  */
9861 #include <assert.h>
9862 /* Override any gcc2 internal prototype to avoid an error.  */
9863 /* We use char because int might match the return type of a gcc2
9864    builtin and then its argument prototype would still apply.  */
9865 char lchown();
9866 int main() {
9867     /*  The GNU C library defines this for functions which it implements
9868         to always fail with ENOSYS.  Some functions are actually named
9869         something starting with __ and the normal name is an alias.  */
9870 #if defined (__stub_lchown) || defined (__stub___lchown)
9871 choke me
9872 #else
9873 lchown();
9874 #endif
9875 ; return 0; }
9876 EOCP
9877 set try
9878 if eval $compile; then
9879     $echo "lchown() found." >&4
9880     val="$define"
9881 else
9882     $echo "lchown() NOT found." >&4
9883     val="$undef"
9884 fi
9885 set d_lchown
9886 eval $setvar
9887
9888 : See if number of significant digits in a double precision number is known
9889 echo " "
9890 $cat >ldbl_dig.c <<EOM
9891 #$i_limits I_LIMITS
9892 #$i_float I_FLOAT
9893 #ifdef I_LIMITS
9894 #include <limits.h>
9895 #endif
9896 #ifdef I_FLOAT
9897 #include <float.h>
9898 #endif
9899 #ifdef LDBL_DIG
9900 printf("Contains LDBL_DIG");
9901 #endif
9902 EOM
9903 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9904 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9905         echo "LDBL_DIG found." >&4
9906         val="$define"
9907 else
9908         echo "LDBL_DIG NOT found." >&4
9909         val="$undef"
9910 fi
9911 $rm -f ldbl_dig.?
9912 set d_ldbl_dig
9913 eval $setvar
9914
9915 : see if link exists
9916 set link d_link
9917 eval $inlibc
9918
9919 : see if localeconv exists
9920 set localeconv d_locconv
9921 eval $inlibc
9922
9923 : see if lockf exists
9924 set lockf d_lockf
9925 eval $inlibc
9926
9927 : check for long long
9928 echo " "
9929 echo "Checking to see if you have long long..." >&4
9930 echo 'int main() { long long x = 7; return 0; }' > try.c
9931 set try
9932 if eval $compile; then
9933         val="$define"
9934         echo "You have long long."
9935 else
9936         val="$undef"
9937         echo "You do not have long long."
9938 fi
9939 $rm try.*
9940 set d_longlong
9941 eval $setvar
9942
9943 : check for length of long long
9944 case "${d_longlong}${longlongsize}" in
9945 $define)
9946         echo " "
9947         echo "Checking to see how big your long longs are..." >&4
9948         $cat >try.c <<'EOCP'
9949 #include <stdio.h>
9950 int main()
9951 {
9952     printf("%d\n", (int)sizeof(long long));
9953     return(0);
9954 }
9955 EOCP
9956         set try
9957         if eval $compile_ok; then
9958                 longlongsize=`./try$exe_ext`
9959                 echo "Your long longs are $longlongsize bytes long."
9960         else
9961                 dflt='8'
9962                 echo " "
9963                 echo "(I can't seem to compile the test program.  Guessing...)"
9964                 rp="What is the size of a long long (in bytes)?"
9965                 . ./myread
9966                 longlongsize="$ans"
9967         fi
9968         if $test "X$longsize" = "X$longlongsize"; then
9969                 echo "(That isn't any different from an ordinary long.)"
9970         fi      
9971         ;;
9972 esac
9973 $rm -f try.* try
9974
9975 : see if prototype for lseek is available
9976 echo " "
9977 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9978 eval $hasproto
9979
9980 : see if lstat exists
9981 set lstat d_lstat
9982 eval $inlibc
9983
9984 : see if madvise exists
9985 set madvise d_madvise
9986 eval $inlibc
9987
9988 : see if mblen exists
9989 set mblen d_mblen
9990 eval $inlibc
9991
9992 : see if mbstowcs exists
9993 set mbstowcs d_mbstowcs
9994 eval $inlibc
9995
9996 : see if mbtowc exists
9997 set mbtowc d_mbtowc
9998 eval $inlibc
9999
10000 : see if memchr exists
10001 set memchr d_memchr
10002 eval $inlibc
10003
10004 : see if memcmp exists
10005 set memcmp d_memcmp
10006 eval $inlibc
10007
10008 : see if memcpy exists
10009 set memcpy d_memcpy
10010 eval $inlibc
10011
10012 : see if memmove exists
10013 set memmove d_memmove
10014 eval $inlibc
10015
10016 : see if memset exists
10017 set memset d_memset
10018 eval $inlibc
10019
10020 : see if mkdir exists
10021 set mkdir d_mkdir
10022 eval $inlibc
10023
10024 : see if mkdtemp exists
10025 set mkdtemp d_mkdtemp
10026 eval $inlibc
10027
10028 : see if mkfifo exists
10029 set mkfifo d_mkfifo
10030 eval $inlibc
10031
10032 : see if mkstemp exists
10033 set mkstemp d_mkstemp
10034 eval $inlibc
10035
10036 : see if mkstemps exists
10037 set mkstemps d_mkstemps
10038 eval $inlibc
10039
10040 : see if mktime exists
10041 set mktime d_mktime
10042 eval $inlibc
10043
10044 : see if this is a sys/mman.h system
10045 set sys/mman.h i_sysmman
10046 eval $inhdr
10047
10048 : see if mmap exists
10049 set mmap d_mmap
10050 eval $inlibc
10051 : see what shmat returns
10052 : default to something harmless
10053 mmaptype='void *'
10054 case "$i_sysmman$d_mmap" in
10055 "$define$define")
10056         $cat >mmap.c <<'END'
10057 #include <sys/mman.h>
10058 void *mmap();
10059 END
10060         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10061                 mmaptype='void *'
10062         else
10063                 mmaptype='caddr_t'
10064         fi
10065         echo "and it returns ($mmaptype)." >&4
10066         ;;
10067 esac
10068
10069
10070
10071 : see if modfl exists
10072 set modfl d_modfl
10073 eval $inlibc
10074
10075 : see if mprotect exists
10076 set mprotect d_mprotect
10077 eval $inlibc
10078
10079 : see if msgctl exists
10080 set msgctl d_msgctl
10081 eval $inlibc
10082
10083 : see if msgget exists
10084 set msgget d_msgget
10085 eval $inlibc
10086
10087 : see if msgsnd exists
10088 set msgsnd d_msgsnd
10089 eval $inlibc
10090
10091 : see if msgrcv exists
10092 set msgrcv d_msgrcv
10093 eval $inlibc
10094
10095 : see how much of the 'msg*(2)' library is present.
10096 h_msg=true
10097 echo " "
10098 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10099 *"$undef"*) h_msg=false;;
10100 esac
10101 case "$osname" in
10102 freebsd)
10103     case "`ipcs 2>&1`" in
10104     "SVID messages"*"not configured"*)
10105         echo "Your $osname does not have the msg*(2) configured." >&4
10106         h_msg=false
10107         val="$undef"
10108         set msgctl d_msgctl
10109         eval $setvar
10110         set msgget d_msgget
10111         eval $setvar
10112         set msgsnd d_msgsnd
10113         eval $setvar
10114         set msgrcv d_msgrcv
10115         eval $setvar
10116         ;;
10117     esac
10118     ;;
10119 esac
10120 : we could also check for sys/ipc.h ...
10121 if $h_msg && $test `./findhdr sys/msg.h`; then
10122         echo "You have the full msg*(2) library." >&4
10123         val="$define"
10124 else
10125         echo "You don't have the full msg*(2) library." >&4
10126         val="$undef"
10127 fi
10128 set d_msg
10129 eval $setvar
10130
10131 : see if msync exists
10132 set msync d_msync
10133 eval $inlibc
10134
10135 : see if munmap exists
10136 set munmap d_munmap
10137 eval $inlibc
10138
10139 : see if nice exists
10140 set nice d_nice
10141 eval $inlibc
10142
10143
10144 echo " "
10145 echo "Checking which 64-bit integer type we could use..." >&4
10146
10147 case "$intsize" in
10148 8) val=int
10149    set quadtype
10150    eval $setvar
10151    val='"unsigned int"'
10152    set uquadtype
10153    eval $setvar
10154    quadkind=1
10155    ;;
10156 *) case "$longsize" in
10157    8) val=long
10158       set quadtype
10159       eval $setvar
10160       val='"unsigned long"'
10161       set uquadtype
10162       eval $setvar
10163       quadkind=2
10164       ;;
10165    *) case "$d_longlong:$longlongsize" in
10166       define:8)
10167         val='"long long"'
10168         set quadtype
10169         eval $setvar
10170         val='"unsigned long long"'
10171         set uquadtype
10172         eval $setvar
10173         quadkind=3
10174         ;;
10175       *) case "$d_int64_t" in
10176          define)
10177            val=int64_t
10178            set quadtype
10179            eval $setvar
10180            val=uint64_t
10181            set uquadtype
10182            eval $setvar
10183            quadkind=4
10184            ;;
10185          esac
10186          ;;
10187       esac
10188       ;;
10189    esac
10190    ;;
10191 esac
10192
10193 case "$quadtype" in
10194 '')     echo "Alas, no 64-bit integer types in sight." >&4
10195         d_quad="$undef"
10196         ;;
10197 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10198             verb="will"
10199         else
10200             verb="could"
10201         fi
10202         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10203         d_quad="$define"
10204         ;;
10205 esac
10206
10207 : check for length of character
10208 echo " "
10209 case "$charsize" in
10210 '')
10211         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10212         $cat >try.c <<'EOCP'
10213 #include <stdio.h>
10214 int main()
10215 {
10216     printf("%d\n", (int)sizeof(char));
10217     exit(0);
10218 }
10219 EOCP
10220         set try
10221         if eval $compile_ok; then
10222                 dflt=`./try`
10223         else
10224                 dflt='1'
10225                 echo "(I can't seem to compile the test program.  Guessing...)"
10226         fi
10227         ;;
10228 *)
10229         dflt="$charsize"
10230         ;;
10231 esac
10232 rp="What is the size of a character (in bytes)?"
10233 . ./myread
10234 charsize="$ans"
10235 $rm -f try.c try
10236
10237 : check for volatile keyword
10238 echo " "
10239 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10240 $cat >try.c <<'EOCP'
10241 int main()
10242 {
10243         typedef struct _goo_struct goo_struct;
10244         goo_struct * volatile goo = ((goo_struct *)0);
10245         struct _goo_struct {
10246                 long long_int;
10247                 int reg_int;
10248                 char char_var;
10249         };
10250         typedef unsigned short foo_t;
10251         char *volatile foo;
10252         volatile int bar;
10253         volatile foo_t blech;
10254         foo = foo;
10255 }
10256 EOCP
10257 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10258         val="$define"
10259         echo "Yup, it does."
10260 else
10261         val="$undef"
10262         echo "Nope, it doesn't."
10263 fi
10264 set d_volatile
10265 eval $setvar
10266 $rm -f try.*
10267
10268
10269 echo " "
10270 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10271
10272 case "$use64bitint:$d_quad:$quadtype" in
10273 define:define:?*)
10274         ivtype="$quadtype"
10275         uvtype="$uquadtype"
10276         ivsize=8
10277         uvsize=8
10278         ;;
10279 *)      ivtype="long"
10280         uvtype="unsigned long"
10281         ivsize=$longsize
10282         uvsize=$longsize
10283         ;;
10284 esac
10285
10286 case "$uselongdouble:$d_longdbl" in
10287 define:define)
10288         nvtype="long double"
10289         nvsize=$longdblsize
10290         ;;
10291 *)      nvtype=double
10292         nvsize=$doublesize
10293         ;;
10294 esac
10295
10296 $echo "(IV will be "$ivtype", $ivsize bytes)"
10297 $echo "(UV will be "$uvtype", $uvsize bytes)"
10298 $echo "(NV will be "$nvtype", $nvsize bytes)"
10299
10300 $cat >try.c <<EOCP
10301 #$i_inttypes I_INTTYPES
10302 #ifdef I_INTTYPES
10303 #include <inttypes.h>
10304 #endif
10305 #include <stdio.h>
10306 int main() {
10307 #ifdef INT8
10308    int8_t i =  INT8_MAX;
10309   uint8_t u = UINT8_MAX;
10310   printf("int8_t\n");
10311 #endif
10312 #ifdef INT16
10313    int16_t i =  INT16_MAX;
10314   uint16_t i = UINT16_MAX;
10315   printf("int16_t\n");
10316 #endif
10317 #ifdef INT32
10318    int32_t i =  INT32_MAX;
10319   uint32_t u = UINT32_MAX;
10320   printf("int32_t\n");
10321 #endif
10322 }
10323 EOCP
10324
10325 case "$i8type" in
10326 '')     case "$charsize" in
10327         1)      i8type=char
10328                 u8type="unsigned char"
10329                 i8size=$charsize
10330                 u8size=$charsize
10331                 ;;
10332         esac
10333         ;;
10334 esac
10335 case "$i8type" in
10336 '')     set try -DINT8
10337         if eval $compile; then
10338                 case "`./try$exe_ext`" in
10339                 int8_t) i8type=int8_t
10340                         u8type=uint8_t
10341                         i8size=1
10342                         u8size=1
10343                         ;;
10344                 esac
10345         fi
10346         ;;
10347 esac
10348 case "$i8type" in
10349 '')     if $test $charsize -ge 1; then
10350                 i8type=char
10351                 u8type="unsigned char"
10352                 i8size=$charsize
10353                 u8size=$charsize
10354         fi
10355         ;;
10356 esac
10357
10358 case "$i16type" in
10359 '')     case "$shortsize" in
10360         2)      i16type=short
10361                 u16type="unsigned short"
10362                 i16size=$shortsize
10363                 u16size=$shortsize
10364                 ;;
10365         esac
10366         ;;
10367 esac
10368 case "$i16type" in
10369 '')     set try -DINT16
10370         if eval $compile; then
10371                 case "`./try$exe_ext`" in
10372                 int16_t)
10373                         i16type=int16_t
10374                         u16type=uint16_t
10375                         i16size=2
10376                         u16size=2
10377                         ;;
10378                 esac
10379         fi
10380         ;;
10381 esac
10382 case "$i16type" in
10383 '')     if $test $shortsize -ge 2; then
10384                 i16type=short
10385                 u16type="unsigned short"
10386                 i16size=$shortsize
10387                 u16size=$shortsize
10388         fi
10389         ;;
10390 esac
10391
10392 case "$i32type" in
10393 '')     case "$longsize" in
10394         4)      i32type=long
10395                 u32type="unsigned long"
10396                 i32size=$longsize
10397                 u32size=$longsize
10398                 ;;
10399         *)      case "$intsize" in
10400                 4)      i32type=int
10401                         u32type="unsigned int"
10402                         i32size=$intsize
10403                         u32size=$intsize
10404                         ;;
10405                 esac
10406                 ;;
10407         esac
10408         ;;
10409 esac
10410 case "$i32type" in
10411 '')     set try -DINT32
10412         if eval $compile; then
10413                 case "`./try$exe_ext`" in
10414                 int32_t)
10415                         i32type=int32_t
10416                         u32type=uint32_t
10417                         i32size=4
10418                         u32size=4
10419                         ;;
10420                 esac
10421         fi
10422         ;;
10423 esac
10424 case "$i32type" in
10425 '')     if $test $intsize -ge 4; then
10426                 i32type=int
10427                 u32type="unsigned int"
10428                 i32size=$intsize
10429                 u32size=$intsize
10430         fi
10431         ;;
10432 esac
10433
10434 case "$i64type" in
10435 '')     case "$d_quad:$quadtype" in
10436         define:?*)
10437                 i64type="$quadtype"
10438                 u64type="$uquadtype"
10439                 i64size=8
10440                 u64size=8
10441                 ;;
10442         esac
10443         ;;
10444 esac
10445
10446 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10447 : volatile so that the compiler has to store it out to memory.
10448 if test X"$d_volatile" = X"$define"; then
10449         volatile=volatile
10450 fi
10451 $cat <<EOP >try.c
10452 #include <stdio.h>
10453 #include <sys/types.h>
10454 #include <signal.h>
10455 #ifdef SIGFPE
10456 $volatile int bletched = 0;
10457 $signal_t blech(s) int s; { bletched = 1; }
10458 #endif
10459 int main() {
10460     $uvtype u = 0;
10461     $nvtype d;
10462     int     n = 8 * $uvsize;
10463     int     i;
10464 #ifdef SIGFPE
10465     signal(SIGFPE, blech);
10466 #endif
10467
10468     for (i = 0; i < n; i++) {
10469       u = u << 1 | ($uvtype)1;
10470       d = ($nvtype)u;
10471       if (($uvtype)d != u)
10472         break;
10473       if (d <= 0)
10474         break;
10475       d = ($nvtype)(u - 1);
10476       if (($uvtype)d != (u - 1))
10477         break;
10478 #ifdef SIGFPE
10479       if (bletched) {
10480         break;
10481 #endif
10482       } 
10483     }
10484     printf("%d\n", ((i == n) ? -n : i));
10485     exit(0);
10486 }
10487 EOP
10488 set try
10489
10490 d_nv_preserves_uv="$undef"
10491 if eval $compile; then
10492         d_nv_preserves_uv_bits="`./try$exe_ext`"
10493 fi
10494 case "$d_nv_preserves_uv_bits" in
10495 \-[1-9]*)       
10496         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10497         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10498         d_nv_preserves_uv="$define"
10499         ;;
10500 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10501         d_nv_preserves_uv="$undef" ;;
10502 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10503         d_nv_preserves_uv_bits="$undef" ;;
10504 esac
10505
10506 $rm -f try.* try
10507
10508
10509 : check for off64_t
10510 echo " "
10511 echo "Checking to see if you have off64_t..." >&4
10512 $cat >try.c <<EOCP
10513 #$i_features I_FEATURES
10514 #ifdef I_FEATURES
10515 #include <features.h>
10516 #endif
10517 #include <sys/types.h>
10518 #include <unistd.h>
10519 int main() { off64_t x = 7; }
10520 EOCP
10521 set try
10522 if eval $compile; then
10523         val="$define"
10524         echo "You have off64_t."
10525 else
10526         val="$undef"
10527         echo "You do not have off64_t."
10528         case "$lseeksize" in
10529         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10530         esac
10531 fi
10532 $rm -f try.* try
10533 set d_off64_t
10534 eval $setvar
10535
10536 : see if POSIX threads are available
10537 set pthread.h i_pthread
10538 eval $inhdr
10539
10540
10541
10542
10543 : how to create joinable pthreads
10544 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10545         echo " "
10546         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10547         $cat >try.c <<'EOCP'
10548 #include <pthread.h>
10549 int main() {
10550     int detachstate = JOINABLE;
10551 }
10552 EOCP
10553         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10554         if eval $compile; then
10555                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10556                 val="$undef" # Yes, undef.
10557                 set d_old_pthread_create_joinable
10558                 eval $setvar
10559                 val=""
10560                 set old_pthread_create_joinable
10561                 eval $setvar
10562         else
10563                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10564                 if eval $compile; then
10565                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10566                         val="$define"
10567                         set d_old_pthread_create_joinable
10568                         eval $setvar
10569                         val=PTHREAD_CREATE_UNDETACHED
10570                         set old_pthread_create_joinable
10571                         eval $setvar
10572                 else            
10573                         set try -DJOINABLE=__UNDETACHED
10574                         if eval $compile; then
10575                                 echo "You seem to use __UNDETACHED." >&4
10576                                 val="$define"
10577                                 set d_old_pthread_create_joinable
10578                                 eval $setvar
10579                                 val=__UNDETACHED
10580                                 set old_pthread_create_joinable
10581                                 eval $setvar
10582                         else
10583                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10584                                 val="$define"
10585                                 set d_old_pthread_create_joinable
10586                                 eval $setvar
10587                                 val=0
10588                                 set old_pthread_create_joinable
10589                                 eval $setvar
10590                         fi
10591                 fi
10592         fi
10593         $rm -f try try.*
10594 else
10595     d_old_pthread_create_joinable="$undef"
10596     old_pthread_create_joinable=""
10597 fi
10598
10599 : see if pause exists
10600 set pause d_pause
10601 eval $inlibc
10602
10603 : see if pipe exists
10604 set pipe d_pipe
10605 eval $inlibc
10606
10607 : see if poll exists
10608 set poll d_poll
10609 eval $inlibc
10610
10611
10612 : see whether the various POSIXish _yields exist
10613 $cat >try.c <<EOP
10614 #include <pthread.h>
10615 #include <stdio.h>
10616 int main() {
10617 #ifdef SCHED_YIELD
10618         sched_yield();
10619 #else
10620 #ifdef PTHREAD_YIELD
10621         pthread_yield();
10622 #else
10623 #ifdef PTHREAD_YIELD_NULL
10624         pthread_yield(NULL);
10625 #endif
10626 #endif
10627 #endif
10628 }
10629 EOP
10630 : see if sched_yield exists
10631 set try -DSCHED_YIELD
10632 if eval $compile; then
10633     val="$define"
10634     sched_yield='sched_yield()'
10635 else
10636     val="$undef"
10637 fi
10638 case "$usethreads" in
10639 $define)
10640         case "$val" in
10641         $define) echo 'sched_yield() found.' >&4        ;;
10642         *)       echo 'sched_yield() NOT found.' >&4    ;;
10643         esac
10644 esac
10645 set d_sched_yield
10646 eval $setvar
10647
10648 : see if pthread_yield exists
10649 set try -DPTHREAD_YIELD
10650 if eval $compile; then
10651     val="$define"
10652     case "$sched_yield" in
10653     '') sched_yield='pthread_yield()' ;;
10654     esac
10655 else
10656     set try -DPTHREAD_YIELD_NULL
10657     if eval $compile; then
10658         val="$define"
10659         case "$sched_yield" in
10660         '') sched_yield='pthread_yield(NULL)' ;;
10661         esac
10662     else
10663         val="$undef"
10664     fi
10665 fi
10666 case "$usethreads" in
10667 $define)
10668         case "$val" in
10669         $define) echo 'pthread_yield() found.' >&4      ;;
10670         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10671         esac
10672         ;;
10673 esac
10674 set d_pthread_yield
10675 eval $setvar
10676
10677 case "$sched_yield" in
10678 '') sched_yield=undef ;;
10679 esac
10680
10681 $rm -f try try.*
10682
10683 : see if this is a pwd.h system
10684 set pwd.h i_pwd
10685 eval $inhdr
10686
10687 case "$i_pwd" in
10688 $define)
10689         xxx=`./findhdr pwd.h`
10690         $cppstdin $cppflags $cppminus < $xxx >$$.h
10691
10692         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10693                 val="$define"
10694         else
10695                 val="$undef"
10696         fi
10697         set d_pwquota
10698         eval $setvar
10699
10700         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10701                 val="$define"
10702         else
10703                 val="$undef"
10704         fi
10705         set d_pwage
10706         eval $setvar
10707
10708         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10709                 val="$define"
10710         else
10711                 val="$undef"
10712         fi
10713         set d_pwchange
10714         eval $setvar
10715
10716         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10717                 val="$define"
10718         else
10719                 val="$undef"
10720         fi
10721         set d_pwclass
10722         eval $setvar
10723
10724         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10725                 val="$define"
10726         else
10727                 val="$undef"
10728         fi
10729         set d_pwexpire
10730         eval $setvar
10731
10732         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10733                 val="$define"
10734         else
10735                 val="$undef"
10736         fi
10737         set d_pwcomment
10738         eval $setvar
10739
10740         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10741                 val="$define"
10742         else
10743                 val="$undef"
10744         fi
10745         set d_pwgecos
10746         eval $setvar
10747
10748         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10749                 val="$define"
10750         else
10751                 val="$undef"
10752         fi
10753         set d_pwpasswd
10754         eval $setvar
10755
10756         $rm -f $$.h
10757         ;;
10758 *)
10759         val="$undef"; 
10760         set d_pwquota; eval $setvar
10761         set d_pwage; eval $setvar
10762         set d_pwchange; eval $setvar
10763         set d_pwclass; eval $setvar
10764         set d_pwexpire; eval $setvar
10765         set d_pwcomment; eval $setvar
10766         set d_pwgecos; eval $setvar
10767         set d_pwpasswd; eval $setvar
10768         ;;
10769 esac
10770
10771 : see if readdir and friends exist
10772 set readdir d_readdir
10773 eval $inlibc
10774 set seekdir d_seekdir
10775 eval $inlibc
10776 set telldir d_telldir
10777 eval $inlibc
10778 set rewinddir d_rewinddir
10779 eval $inlibc
10780
10781 : see if readlink exists
10782 set readlink d_readlink
10783 eval $inlibc
10784
10785 : see if rename exists
10786 set rename d_rename
10787 eval $inlibc
10788
10789 : see if rmdir exists
10790 set rmdir d_rmdir
10791 eval $inlibc
10792
10793 : see if memory.h is available.
10794 val=''
10795 set memory.h val
10796 eval $inhdr
10797
10798 : See if it conflicts with string.h
10799 case "$val" in
10800 $define)
10801         case "$strings" in
10802         '') ;;
10803         *)
10804                 $cppstdin $cppflags $cppminus < $strings > mem.h
10805                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10806                         echo " "
10807                         echo "We won't be including <memory.h>."
10808                         val="$undef"
10809                 fi
10810                 $rm -f mem.h
10811                 ;;
10812         esac
10813 esac
10814 set i_memory
10815 eval $setvar
10816
10817 : can bcopy handle overlapping blocks?
10818 val="$undef"
10819 case "$d_bcopy" in
10820 "$define")
10821         echo " "
10822         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10823         $cat >try.c <<EOCP
10824 #$i_memory I_MEMORY
10825 #$i_stdlib I_STDLIB
10826 #$i_string I_STRING
10827 #$i_unistd I_UNISTD
10828 EOCP
10829         $cat >>try.c <<'EOCP'
10830 #include <stdio.h>
10831 #ifdef I_MEMORY
10832 #  include <memory.h>
10833 #endif
10834 #ifdef I_STDLIB
10835 #  include <stdlib.h>
10836 #endif
10837 #ifdef I_STRING
10838 #  include <string.h>
10839 #else
10840 #  include <strings.h>
10841 #endif
10842 #ifdef I_UNISTD
10843 #  include <unistd.h>  /* Needed for NetBSD */
10844 #endif
10845 int main()
10846 {
10847 char buf[128], abc[128];
10848 char *b;
10849 int len;
10850 int off;
10851 int align;
10852
10853 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10854
10855 for (align = 7; align >= 0; align--) {
10856         for (len = 36; len; len--) {
10857                 b = buf+align;
10858                 bcopy(abc, b, len);
10859                 for (off = 1; off <= len; off++) {
10860                         bcopy(b, b+off, len);
10861                         bcopy(b+off, b, len);
10862                         if (bcmp(b, abc, len))
10863                                 exit(1);
10864                 }
10865         }
10866 }
10867 exit(0);
10868 }
10869 EOCP
10870         set try
10871         if eval $compile_ok; then
10872                 if ./try 2>/dev/null; then
10873                         echo "Yes, it can."
10874                         val="$define"
10875                 else
10876                         echo "It can't, sorry."
10877                         case "$d_memmove" in
10878                         "$define") echo "But that's Ok since you have memmove()." ;;
10879                         esac
10880                 fi
10881         else
10882                 echo "(I can't compile the test program, so we'll assume not...)"
10883                 case "$d_memmove" in
10884                 "$define") echo "But that's Ok since you have memmove()." ;;
10885                 esac
10886         fi
10887         ;;
10888 esac
10889 $rm -f try.* try core
10890 set d_safebcpy
10891 eval $setvar
10892
10893 : can memcpy handle overlapping blocks?
10894 val="$undef"
10895 case "$d_memcpy" in
10896 "$define")
10897         echo " "
10898         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10899         $cat >try.c <<EOCP
10900 #$i_memory I_MEMORY
10901 #$i_stdlib I_STDLIB
10902 #$i_string I_STRING
10903 #$i_unistd I_UNISTD
10904 EOCP
10905         $cat >>try.c <<'EOCP'
10906 #include <stdio.h>
10907 #ifdef I_MEMORY
10908 #  include <memory.h>
10909 #endif
10910 #ifdef I_STDLIB
10911 #  include <stdlib.h>
10912 #endif
10913 #ifdef I_STRING
10914 #  include <string.h>
10915 #else
10916 #  include <strings.h>
10917 #endif
10918 #ifdef I_UNISTD
10919 #  include <unistd.h>  /* Needed for NetBSD */
10920 #endif
10921 int main()
10922 {
10923 char buf[128], abc[128];
10924 char *b;
10925 int len;
10926 int off;
10927 int align;
10928
10929 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10930    try to store the string in read-only memory. */
10931 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10932
10933 for (align = 7; align >= 0; align--) {
10934         for (len = 36; len; len--) {
10935                 b = buf+align;
10936                 memcpy(b, abc, len);
10937                 for (off = 1; off <= len; off++) {
10938                         memcpy(b+off, b, len);
10939                         memcpy(b, b+off, len);
10940                         if (memcmp(b, abc, len))
10941                                 exit(1);
10942                 }
10943         }
10944 }
10945 exit(0);
10946 }
10947 EOCP
10948         set try
10949         if eval $compile_ok; then
10950                 if ./try 2>/dev/null; then
10951                         echo "Yes, it can."
10952                         val="$define"
10953                 else
10954                         echo "It can't, sorry."
10955                         case "$d_memmove" in
10956                         "$define") echo "But that's Ok since you have memmove()." ;;
10957                         esac
10958                 fi
10959         else
10960                 echo "(I can't compile the test program, so we'll assume not...)"
10961                 case "$d_memmove" in
10962                 "$define") echo "But that's Ok since you have memmove()." ;;
10963                 esac
10964         fi
10965         ;;
10966 esac
10967 $rm -f try.* try core
10968 set d_safemcpy
10969 eval $setvar
10970
10971 : can memcmp be trusted to compare relative magnitude?
10972 val="$undef"
10973 case "$d_memcmp" in
10974 "$define")
10975         echo " "
10976         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10977         $cat >try.c <<EOCP
10978 #$i_memory I_MEMORY
10979 #$i_stdlib I_STDLIB
10980 #$i_string I_STRING
10981 #$i_unistd I_UNISTD
10982 EOCP
10983         $cat >>try.c <<'EOCP'
10984 #include <stdio.h>
10985 #ifdef I_MEMORY
10986 #  include <memory.h>
10987 #endif
10988 #ifdef I_STDLIB
10989 #  include <stdlib.h>
10990 #endif
10991 #ifdef I_STRING
10992 #  include <string.h>
10993 #else
10994 #  include <strings.h>
10995 #endif
10996 #ifdef I_UNISTD
10997 #  include <unistd.h>  /* Needed for NetBSD */
10998 #endif
10999 int main()
11000 {
11001 char a = -1;
11002 char b = 0;
11003 if ((a < b) && memcmp(&a, &b, 1) < 0)
11004         exit(1);
11005 exit(0);
11006 }
11007 EOCP
11008         set try
11009         if eval $compile_ok; then
11010                 if ./try 2>/dev/null; then
11011                         echo "Yes, it can."
11012                         val="$define"
11013                 else
11014                         echo "No, it can't (it uses signed chars)."
11015                 fi
11016         else
11017                 echo "(I can't compile the test program, so we'll assume not...)"
11018         fi
11019         ;;
11020 esac
11021 $rm -f try.* try core
11022 set d_sanemcmp
11023 eval $setvar
11024
11025 : see if prototype for sbrk is available
11026 echo " "
11027 set d_sbrkproto sbrk $i_unistd unistd.h
11028 eval $hasproto
11029
11030 : see if select exists
11031 set select d_select
11032 eval $inlibc
11033
11034 : see if semctl exists
11035 set semctl d_semctl
11036 eval $inlibc
11037
11038 : see if semget exists
11039 set semget d_semget
11040 eval $inlibc
11041
11042 : see if semop exists
11043 set semop d_semop
11044 eval $inlibc
11045
11046 : see how much of the 'sem*(2)' library is present.
11047 h_sem=true
11048 echo " "
11049 case "$d_semctl$d_semget$d_semop" in
11050 *"$undef"*) h_sem=false;;
11051 esac
11052 case "$osname" in
11053 freebsd)
11054     case "`ipcs 2>&1`" in
11055     "SVID messages"*"not configured"*)
11056         echo "Your $osname does not have the sem*(2) configured." >&4
11057         h_sem=false
11058         val="$undef"
11059         set semctl d_semctl
11060         eval $setvar
11061         set semget d_semget
11062         eval $setvar
11063         set semop d_semop
11064         eval $setvar
11065         ;;
11066     esac
11067     ;;
11068 esac
11069 : we could also check for sys/ipc.h ...
11070 if $h_sem && $test `./findhdr sys/sem.h`; then
11071         echo "You have the full sem*(2) library." >&4
11072         val="$define"
11073 else
11074         echo "You don't have the full sem*(2) library." >&4
11075         val="$undef"
11076 fi
11077 set d_sem
11078 eval $setvar
11079
11080 : see whether sys/sem.h defines union semun
11081 echo " "
11082 $cat > try.c <<'END'
11083 #include <sys/types.h>
11084 #include <sys/ipc.h>
11085 #include <sys/sem.h>
11086 int main () { union semun semun; semun.buf = 0; }
11087 END
11088 set try
11089 if eval $compile; then
11090     echo "You have union semun in <sys/sem.h>." >&4
11091     val="$define"
11092 else
11093     echo "You do not have union semun in <sys/sem.h>." >&4
11094     val="$undef"
11095 fi
11096 $rm -f try try.c try.h
11097 set d_union_semun
11098 eval $setvar
11099
11100 : see how to do semctl IPC_STAT
11101 case "$d_sem" in
11102 $define)
11103     : see whether semctl IPC_STAT can use union semun
11104     echo " "
11105     $cat > try.h <<END
11106 #ifndef S_IRUSR
11107 #   ifdef S_IREAD
11108 #       define S_IRUSR S_IREAD
11109 #       define S_IWUSR S_IWRITE
11110 #       define S_IXUSR S_IEXEC
11111 #   else
11112 #       define S_IRUSR 0400
11113 #       define S_IWUSR 0200
11114 #       define S_IXUSR 0100
11115 #   endif
11116 #   define S_IRGRP (S_IRUSR>>3)
11117 #   define S_IWGRP (S_IWUSR>>3)
11118 #   define S_IXGRP (S_IXUSR>>3)
11119 #   define S_IROTH (S_IRUSR>>6)
11120 #   define S_IWOTH (S_IWUSR>>6)
11121 #   define S_IXOTH (S_IXUSR>>6)
11122 #endif
11123 #ifndef S_IRWXU
11124 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11125 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11126 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11127 #endif
11128 END
11129
11130     $cat > try.c <<END
11131 #include <sys/types.h>
11132 #include <sys/ipc.h>
11133 #include <sys/sem.h>
11134 #include <sys/stat.h>
11135 #include <stdio.h>
11136 #include <errno.h>
11137 #include "try.h"
11138 #ifndef errno
11139 extern int errno;
11140 #endif
11141 #$d_union_semun HAS_UNION_SEMUN
11142 int main() {
11143     union semun
11144 #ifndef HAS_UNION_SEMUN
11145     {
11146         int val;
11147         struct semid_ds *buf;
11148         unsigned short *array;
11149     }
11150 #endif
11151     arg;
11152     int sem, st;
11153
11154 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11155     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11156     if (sem > -1) {
11157         struct semid_ds argbuf;
11158         arg.buf = &argbuf;
11159 #       ifdef IPC_STAT
11160         st = semctl(sem, 0, IPC_STAT, arg);
11161         if (st == 0)
11162             printf("semun\n");
11163         else
11164 #       endif /* IPC_STAT */
11165             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11166 #       ifdef IPC_RMID
11167         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11168 #       endif /* IPC_RMID */
11169             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11170     } else
11171 #endif /* IPC_PRIVATE && ... */
11172         printf("semget failed: errno = %d\n", errno);
11173   return 0;
11174 }
11175 END
11176     val="$undef"
11177     set try
11178     if eval $compile; then
11179         xxx=`./try`
11180         case "$xxx" in
11181         semun) val="$define" ;;
11182         esac
11183     fi
11184     $rm -f try try.c
11185     set d_semctl_semun
11186     eval $setvar
11187     case "$d_semctl_semun" in
11188     $define)
11189         echo "You can use union semun for semctl IPC_STAT." >&4
11190         also='also'
11191         ;;
11192     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11193         also=''
11194         ;;
11195     esac
11196
11197     : see whether semctl IPC_STAT can use struct semid_ds pointer
11198     $cat > try.c <<'END'
11199 #include <sys/types.h>
11200 #include <sys/ipc.h>
11201 #include <sys/sem.h>
11202 #include <sys/stat.h>
11203 #include "try.h"
11204 #include <stdio.h>
11205 #include <errno.h>
11206 #ifndef errno
11207 extern int errno;
11208 #endif
11209 int main() {
11210     struct semid_ds arg;
11211     int sem, st;
11212
11213 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11214     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11215     if (sem > -1) {
11216 #       ifdef IPC_STAT
11217         st = semctl(sem, 0, IPC_STAT, &arg);
11218         if (st == 0)
11219             printf("semid_ds\n");
11220         else
11221 #       endif /* IPC_STAT */
11222             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11223 #       ifdef IPC_RMID
11224         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11225 #       endif /* IPC_RMID */
11226             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11227     } else
11228 #endif /* IPC_PRIVATE && ... */
11229         printf("semget failed: errno = %d\n", errno);
11230
11231     return 0;
11232 }
11233 END
11234     val="$undef"
11235     set try
11236     if eval $compile; then
11237         xxx=`./try`
11238         case "$xxx" in
11239         semid_ds) val="$define" ;;
11240         esac
11241     fi
11242     $rm -f try try.c
11243     set d_semctl_semid_ds
11244     eval $setvar
11245     case "$d_semctl_semid_ds" in
11246     $define)
11247         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11248         ;;
11249     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11250         ;;
11251     esac
11252     $rm -f try.h
11253     ;;
11254 *)  val="$undef"
11255
11256     # We do not have the full sem*(2) library, so assume we can not
11257     # use either.
11258
11259     set d_semctl_semun
11260     eval $setvar
11261
11262     set d_semctl_semid_ds
11263     eval $setvar
11264     ;;
11265 esac
11266
11267 : see if setegid exists
11268 set setegid d_setegid
11269 eval $inlibc
11270
11271 : see if seteuid exists
11272 set seteuid d_seteuid
11273 eval $inlibc
11274
11275 : see if setgrent exists
11276 set setgrent d_setgrent
11277 eval $inlibc
11278
11279 : see if sethostent exists
11280 set sethostent d_sethent
11281 eval $inlibc
11282
11283 : see if setlinebuf exists
11284 set setlinebuf d_setlinebuf
11285 eval $inlibc
11286
11287 : see if setlocale exists
11288 set setlocale d_setlocale
11289 eval $inlibc
11290
11291 : see if setnetent exists
11292 set setnetent d_setnent
11293 eval $inlibc
11294
11295 : see if setprotoent exists
11296 set setprotoent d_setpent
11297 eval $inlibc
11298
11299 : see if setpgid exists
11300 set setpgid d_setpgid
11301 eval $inlibc
11302
11303 : see if setpgrp2 exists
11304 set setpgrp2 d_setpgrp2
11305 eval $inlibc
11306
11307 : see if setpriority exists
11308 set setpriority d_setprior
11309 eval $inlibc
11310
11311 : see if setproctitle exists
11312 set setproctitle d_setproctitle
11313 eval $inlibc
11314
11315 : see if setpwent exists
11316 set setpwent d_setpwent
11317 eval $inlibc
11318
11319 : see if setregid exists
11320 set setregid d_setregid
11321 eval $inlibc
11322 set setresgid d_setresgid
11323 eval $inlibc
11324
11325 : see if setreuid exists
11326 set setreuid d_setreuid
11327 eval $inlibc
11328 set setresuid d_setresuid
11329 eval $inlibc
11330
11331 : see if setrgid exists
11332 set setrgid d_setrgid
11333 eval $inlibc
11334
11335 : see if setruid exists
11336 set setruid d_setruid
11337 eval $inlibc
11338
11339 : see if setservent exists
11340 set setservent d_setsent
11341 eval $inlibc
11342
11343 : see if setsid exists
11344 set setsid d_setsid
11345 eval $inlibc
11346
11347 : see if setvbuf exists
11348 set setvbuf d_setvbuf
11349 eval $inlibc
11350
11351 : see if sfio.h is available
11352 set sfio.h i_sfio
11353 eval $inhdr
11354
11355
11356 : see if sfio library is available
11357 case "$i_sfio" in
11358 $define)
11359         val=''
11360         set sfreserve val
11361         eval $inlibc
11362         ;;
11363 *)
11364         val="$undef"
11365         ;;
11366 esac
11367 : Ok, but do we want to use it.
11368 case "$val" in
11369 $define)
11370         case "$usesfio" in
11371         true|$define|[yY]*) dflt='y';;
11372         *) dflt='n';;
11373         esac
11374         echo "$package can use the sfio library, but it is experimental."
11375         case "$useperlio" in
11376         "$undef")
11377             echo "For sfio also the PerlIO abstraction layer is needed."
11378             echo "Earlier you said you wouldn't want that."
11379             ;;
11380         esac
11381         rp="You seem to have sfio available, do you want to try using it?"
11382         . ./myread
11383         case "$ans" in
11384         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11385                 useperlio="$define"
11386                 val="$define"
11387                 ;;
11388         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11389                 val="$undef"
11390                 : Remove sfio from list of libraries to use
11391                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11392                 shift
11393                 libs="$*"
11394                 echo "libs = $libs" >&4
11395                 ;;
11396         esac
11397         ;;
11398 *)      case "$usesfio" in
11399         true|$define|[yY]*)
11400                 echo "Sorry, cannot find sfio on this machine." >&4
11401                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11402                 val="$undef"
11403                 ;;
11404         esac
11405         ;;
11406 esac
11407 set d_sfio
11408 eval $setvar
11409 case "$d_sfio" in
11410 $define) usesfio='true';;
11411 *) usesfio='false';;
11412 esac
11413
11414 : see if shmctl exists
11415 set shmctl d_shmctl
11416 eval $inlibc
11417
11418 : see if shmget exists
11419 set shmget d_shmget
11420 eval $inlibc
11421
11422 : see if shmat exists
11423 set shmat d_shmat
11424 eval $inlibc
11425 : see what shmat returns
11426 case "$d_shmat" in
11427 "$define")
11428         $cat >shmat.c <<'END'
11429 #include <sys/shm.h>
11430 void *shmat();
11431 END
11432         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11433                 shmattype='void *'
11434         else
11435                 shmattype='char *'
11436         fi
11437         echo "and it returns ($shmattype)." >&4
11438         : see if a prototype for shmat is available
11439         xxx=`./findhdr sys/shm.h`
11440         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11441         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11442                 val="$define"
11443         else
11444                 val="$undef"
11445         fi
11446         $rm -f shmat.[co]
11447         ;;
11448 *)
11449         val="$undef"
11450         ;;
11451 esac
11452 set d_shmatprototype
11453 eval $setvar
11454
11455 : see if shmdt exists
11456 set shmdt d_shmdt
11457 eval $inlibc
11458
11459 : see how much of the 'shm*(2)' library is present.
11460 h_shm=true
11461 echo " "
11462 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11463 *"$undef"*) h_shm=false;;
11464 esac
11465 case "$osname" in
11466 freebsd)
11467     case "`ipcs 2>&1`" in
11468     "SVID shared memory"*"not configured"*)
11469         echo "Your $osname does not have the shm*(2) configured." >&4
11470         h_shm=false
11471         val="$undef"
11472         set shmctl d_shmctl
11473         evat $setvar
11474         set shmget d_shmget
11475         evat $setvar
11476         set shmat d_shmat
11477         evat $setvar
11478         set shmdt d_shmdt
11479         evat $setvar
11480         ;;
11481     esac
11482     ;;
11483 esac
11484 : we could also check for sys/ipc.h ...
11485 if $h_shm && $test `./findhdr sys/shm.h`; then
11486         echo "You have the full shm*(2) library." >&4
11487         val="$define"
11488 else
11489         echo "You don't have the full shm*(2) library." >&4
11490         val="$undef"
11491 fi
11492 set d_shm
11493 eval $setvar
11494
11495 echo " "
11496 : see if we have sigaction
11497 if set sigaction val -f d_sigaction; eval $csym; $val; then
11498         echo 'sigaction() found.' >&4
11499         $cat > try.c <<'EOP'
11500 #include <stdio.h>
11501 #include <sys/types.h>
11502 #include <signal.h>
11503 int main()
11504 {
11505     struct sigaction act, oact;
11506     act.sa_flags = 0;
11507     oact.sa_handler = 0;
11508     /* so that act and oact are used */
11509     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11510 }
11511 EOP
11512         set try
11513         if eval $compile_ok; then
11514                 val="$define"
11515         else
11516                 echo "But you don't seem to have a useable struct sigaction." >&4
11517                 val="$undef"
11518         fi
11519 else
11520         echo 'sigaction NOT found.' >&4
11521         val="$undef"
11522 fi
11523 set d_sigaction; eval $setvar
11524 $rm -f try try$_o try.c
11525
11526 : see if sigprocmask exists
11527 set sigprocmask d_sigprocmask
11528 eval $inlibc
11529
11530 : see if sigsetjmp exists
11531 echo " "
11532 case "$d_sigsetjmp" in
11533 '')
11534         $cat >try.c <<'EOP'
11535 #include <setjmp.h>
11536 sigjmp_buf env;
11537 int set = 1;
11538 int main()
11539 {
11540         if (sigsetjmp(env,1))
11541                 exit(set);
11542         set = 0;
11543         siglongjmp(env, 1);
11544         exit(1);
11545 }
11546 EOP
11547         set try
11548         if eval $compile; then
11549                 if ./try >/dev/null 2>&1; then
11550                         echo "POSIX sigsetjmp found." >&4
11551                         val="$define"
11552                 else
11553                         $cat >&4 <<EOM
11554 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11555 I'll ignore them.
11556 EOM
11557                         val="$undef"
11558                 fi
11559         else
11560                 echo "sigsetjmp not found." >&4
11561                 val="$undef"
11562         fi
11563         ;;
11564 *) val="$d_sigsetjmp"
11565         case "$d_sigsetjmp" in
11566         $define) echo "POSIX sigsetjmp found." >&4;;
11567         $undef) echo "sigsetjmp not found." >&4;;
11568         esac
11569         ;;
11570 esac
11571 set d_sigsetjmp
11572 eval $setvar
11573 $rm -f try.c try
11574
11575 : see if socks5_init exists
11576 set socks5_init d_socks5_init
11577 eval $inlibc
11578
11579 : see if sys/stat.h is available
11580 set sys/stat.h i_sysstat
11581 eval $inhdr
11582
11583
11584 : see if stat knows about block sizes
11585 echo " "
11586 echo "Checking to see if your struct stat has st_blocks field..." >&4
11587 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11588 eval $hasfield
11589
11590
11591 : see if this is a sys/vfs.h system
11592 set sys/vfs.h i_sysvfs
11593 eval $inhdr
11594
11595
11596 : see if this is a sys/statfs.h system
11597 set sys/statfs.h i_sysstatfs
11598 eval $inhdr
11599
11600
11601 echo " "
11602 echo "Checking to see if your system supports struct statfs..." >&4
11603 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
11604 eval $hasstruct
11605 case "$d_statfs_s" in
11606 "$define")      echo "Yes, it does."   ;;
11607 *)              echo "No, it doesn't." ;;
11608 esac
11609
11610
11611
11612 : see if struct statfs knows about f_flags
11613 case "$d_statfs_s" in
11614 define) 
11615         echo " "
11616         echo "Checking to see if your struct statfs has f_flags field..." >&4
11617         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
11618         eval $hasfield
11619         ;;
11620 *)      val="$undef"
11621         set d_statfs_f_flags
11622         eval $setvar
11623         ;;
11624 esac
11625 case "$d_statfs_f_flags" in
11626 "$define")      echo "Yes, it does."   ;;
11627 *)              echo "No, it doesn't." ;;
11628 esac
11629
11630 : see if _ptr and _cnt from stdio act std
11631 echo " "
11632
11633 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11634         echo "(Looks like you have stdio.h from BSD.)"
11635         case "$stdio_ptr" in
11636         '') stdio_ptr='((fp)->_p)'
11637                 ptr_lval=$define
11638                 ;;
11639         *)      ptr_lval=$d_stdio_ptr_lval;;
11640         esac
11641         case "$stdio_cnt" in
11642         '') stdio_cnt='((fp)->_r)'
11643                 cnt_lval=$define
11644                 ;;
11645         *)      cnt_lval=$d_stdio_cnt_lval;;
11646         esac
11647         case "$stdio_base" in
11648         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11649         esac
11650         case "$stdio_bufsiz" in
11651         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11652         esac
11653 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11654         echo "(Looks like you have stdio.h from Linux.)"
11655         case "$stdio_ptr" in
11656         '') stdio_ptr='((fp)->_IO_read_ptr)'
11657                 ptr_lval=$define
11658                 ;;
11659         *)      ptr_lval=$d_stdio_ptr_lval;;
11660         esac
11661         case "$stdio_cnt" in
11662         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11663                 cnt_lval=$undef
11664                 ;;
11665         *)      cnt_lval=$d_stdio_cnt_lval;;
11666         esac
11667         case "$stdio_base" in
11668         '') stdio_base='((fp)->_IO_read_base)';;
11669         esac
11670         case "$stdio_bufsiz" in
11671         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11672         esac
11673 else
11674         case "$stdio_ptr" in
11675         '') stdio_ptr='((fp)->_ptr)'
11676                 ptr_lval=$define
11677                 ;;
11678         *)      ptr_lval=$d_stdio_ptr_lval;;
11679         esac
11680         case "$stdio_cnt" in
11681         '') stdio_cnt='((fp)->_cnt)'
11682                 cnt_lval=$define
11683                 ;;
11684         *)      cnt_lval=$d_stdio_cnt_lval;;
11685         esac
11686         case "$stdio_base" in
11687         '') stdio_base='((fp)->_base)';;
11688         esac
11689         case "$stdio_bufsiz" in
11690         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11691         esac
11692 fi
11693
11694 : test whether _ptr and _cnt really work
11695 echo "Checking how std your stdio is..." >&4
11696 $cat >try.c <<EOP
11697 #include <stdio.h>
11698 #define FILE_ptr(fp)    $stdio_ptr
11699 #define FILE_cnt(fp)    $stdio_cnt
11700 int main() {
11701         FILE *fp = fopen("try.c", "r");
11702         char c = getc(fp);
11703         if (
11704                 18 <= FILE_cnt(fp) &&
11705                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11706         )
11707                 exit(0);
11708         exit(1);
11709 }
11710 EOP
11711 val="$undef"
11712 set try
11713 if eval $compile; then
11714         if ./try; then
11715                 echo "Your stdio acts pretty std."
11716                 val="$define"
11717         else
11718                 echo "Your stdio isn't very std."
11719         fi
11720 else
11721         echo "Your stdio doesn't appear very std."
11722 fi
11723 $rm -f try.c try
11724 set d_stdstdio
11725 eval $setvar
11726
11727 : Can _ptr be used as an lvalue?
11728 case "$d_stdstdio$ptr_lval" in
11729 $define$define) val=$define ;;
11730 *) val=$undef ;;
11731 esac
11732 set d_stdio_ptr_lval
11733 eval $setvar
11734
11735 : Can _cnt be used as an lvalue?
11736 case "$d_stdstdio$cnt_lval" in
11737 $define$define) val=$define ;;
11738 *) val=$undef ;;
11739 esac
11740 set d_stdio_cnt_lval
11741 eval $setvar
11742
11743
11744 : test whether setting _ptr sets _cnt as a side effect
11745 d_stdio_ptr_lval_sets_cnt="$undef"
11746 d_stdio_ptr_lval_nochange_cnt="$undef"
11747 case "$d_stdio_ptr_lval$d_stdstdio" in
11748 $define$define)
11749         echo "Checking to see what happens if we set the stdio ptr..." >&4
11750 $cat >try.c <<EOP
11751 #include <stdio.h>
11752 /* Can we scream? */
11753 /* Eat dust sed :-) */
11754 /* In the buffer space, no one can hear you scream. */
11755 #define FILE_ptr(fp)    $stdio_ptr
11756 #define FILE_cnt(fp)    $stdio_cnt
11757 #include <sys/types.h>
11758 int main() {
11759         FILE *fp = fopen("try.c", "r");
11760         int c;
11761         char *ptr;
11762         size_t cnt;
11763         if (!fp) {
11764             puts("Fail even to read");
11765             exit(1);
11766         }
11767         c = getc(fp); /* Read away the first # */
11768         if (c == EOF) {
11769             puts("Fail even to read");
11770             exit(1);
11771         }
11772         if (!(
11773                 18 <= FILE_cnt(fp) &&
11774                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11775         )) {
11776                 puts("Fail even to read");
11777                 exit (1);
11778         }
11779         ptr = (char*) FILE_ptr(fp);
11780         cnt = (size_t)FILE_cnt(fp);
11781
11782         FILE_ptr(fp) += 42;
11783
11784         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11785                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11786                 exit (1);
11787         }
11788         if (FILE_cnt(fp) <= 20) {
11789                 printf ("Fail (<20 chars to test)");
11790                 exit (1);
11791         }
11792         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11793                 puts("Fail compare");
11794                 exit (1);
11795         }
11796         if (cnt == FILE_cnt(fp)) {
11797                 puts("Pass_unchanged");
11798                 exit (0);
11799         }       
11800         if (FILE_cnt(fp) == (cnt - 42)) {
11801                 puts("Pass_changed");
11802                 exit (0);
11803         }
11804         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11805         return 1;
11806
11807 }
11808 EOP
11809         set try
11810         if eval $compile; then
11811                 case `./try$exe_ext` in
11812                 Pass_changed)
11813                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11814                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11815                 Pass_unchanged)
11816                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11817                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11818                 Fail*)
11819                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11820                 *)
11821                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11822         esac
11823         else
11824                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11825         fi
11826         $rm -f try.c try
11827         ;;
11828 esac
11829
11830 : see if _base is also standard
11831 val="$undef"
11832 case "$d_stdstdio" in
11833 $define)
11834         $cat >try.c <<EOP
11835 #include <stdio.h>
11836 #define FILE_base(fp)   $stdio_base
11837 #define FILE_bufsiz(fp) $stdio_bufsiz
11838 int main() {
11839         FILE *fp = fopen("try.c", "r");
11840         char c = getc(fp);
11841         if (
11842                 19 <= FILE_bufsiz(fp) &&
11843                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11844         )
11845                 exit(0);
11846         exit(1);
11847 }
11848 EOP
11849         set try
11850         if eval $compile; then
11851                 if ./try; then
11852                         echo "And its _base field acts std."
11853                         val="$define"
11854                 else
11855                         echo "But its _base field isn't std."
11856                 fi
11857         else
11858                 echo "However, it seems to be lacking the _base field."
11859         fi
11860         $rm -f try.c try
11861         ;;
11862 esac
11863 set d_stdiobase
11864 eval $setvar
11865
11866 $cat >&4 <<EOM
11867 Checking how to access stdio streams by file descriptor number...
11868 EOM
11869 case "$stdio_stream_array" in
11870 '')     $cat >try.c <<EOCP
11871 #include <stdio.h>
11872 int main() {
11873   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11874     printf("yes\n");
11875 }
11876 EOCP
11877         for s in _iob __iob __sF
11878         do
11879                 set try -DSTDIO_STREAM_ARRAY=$s
11880                 if eval $compile; then
11881                         case "`./try$exe_ext`" in
11882                         yes)    stdio_stream_array=$s; break ;;
11883                         esac
11884                 fi
11885         done
11886         $rm -f try.* try$exe_ext
11887 esac
11888 case "$stdio_stream_array" in
11889 '')     $cat >&4 <<EOM
11890 I can't figure out how to access stdio streams by file descriptor number.
11891 EOM
11892         d_stdio_stream_array="$undef"
11893         ;;
11894 *)      $cat >&4 <<EOM
11895 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11896 EOM
11897         d_stdio_stream_array="$define"
11898         ;;
11899 esac
11900
11901 : see if strcoll exists
11902 set strcoll d_strcoll
11903 eval $inlibc
11904
11905 : check for structure copying
11906 echo " "
11907 echo "Checking to see if your C compiler can copy structs..." >&4
11908 $cat >try.c <<'EOCP'
11909 int main()
11910 {
11911         struct blurfl {
11912                 int dyick;
11913         } foo, bar;
11914
11915         foo = bar;
11916 }
11917 EOCP
11918 if $cc -c try.c >/dev/null 2>&1 ; then
11919         val="$define"
11920         echo "Yup, it can."
11921 else
11922         val="$undef"
11923         echo "Nope, it can't."
11924 fi
11925 set d_strctcpy
11926 eval $setvar
11927 $rm -f try.*
11928
11929 : see if strerror and/or sys_errlist[] exist
11930 echo " "
11931 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11932     if set strerror val -f d_strerror; eval $csym; $val; then
11933                 echo 'strerror() found.' >&4
11934                 d_strerror="$define"
11935                 d_strerrm='strerror(e)'
11936                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11937                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11938                         d_syserrlst="$define"
11939                 else
11940                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11941                         d_syserrlst="$undef"
11942                 fi
11943     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11944                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11945                 echo 'strerror() found in string header.' >&4
11946                 d_strerror="$define"
11947                 d_strerrm='strerror(e)'
11948                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11949                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11950                                 d_syserrlst="$define"
11951                 else
11952                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11953                         d_syserrlst="$undef"
11954                 fi
11955     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11956                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11957                 d_strerror="$undef"
11958                 d_syserrlst="$define"
11959                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11960     else
11961                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11962                 d_strerror="$undef"
11963                 d_syserrlst="$undef"
11964                 d_strerrm='"unknown"'
11965     fi
11966 fi
11967
11968 : see if strtod exists
11969 set strtod d_strtod
11970 eval $inlibc
11971
11972 : see if strtol exists
11973 set strtol d_strtol
11974 eval $inlibc
11975
11976 : see if strtold exists
11977 set strtold d_strtold
11978 eval $inlibc
11979
11980 : see if strtoll exists
11981 set strtoll d_strtoll
11982 eval $inlibc
11983
11984 case "$d_longlong-$d_strtoll" in
11985 "$define-$define")
11986         $cat <<EOM
11987 Checking whether your strtoll() works okay...
11988 EOM
11989         $cat >try.c <<'EOCP'
11990 #include <errno.h>
11991 #ifdef __hpux
11992 #define strtoll __strtoll
11993 #endif
11994 #ifdef __EMX__
11995 #define strtoll _strtoll
11996 #endif
11997 #include <stdio.h>
11998 extern long long int strtoll(char *s, char **, int); 
11999 static int bad = 0;
12000 int check(char *s, long long ell, int een) {
12001         long long gll;
12002         errno = 0;
12003         gll = strtoll(s, 0, 10);
12004         if (!((gll == ell) && (errno == een)))
12005                 bad++;
12006 }
12007 int main() {
12008         check(" 1",                                      1LL, 0);
12009         check(" 0",                                      0LL, 0);
12010         check("-1",                                     -1LL, 0);
12011         check("-9223372036854775808", -9223372036854775808LL, 0);
12012         check("-9223372036854775808", -9223372036854775808LL, 0);
12013         check(" 9223372036854775807",  9223372036854775807LL, 0);
12014         check("-9223372036854775808", -9223372036854775808LL, 0);
12015         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12016         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12017         if (!bad)
12018                 printf("ok\n");
12019 }
12020 EOCP
12021         set try
12022         if eval $compile; then
12023                 yyy=`./try`
12024                 case "$yyy" in
12025                 ok) echo "Your strtoll() seems to be working okay." ;;
12026                 *) cat <<EOM >&4
12027 Your strtoll() doesn't seem to be working okay.
12028 EOM
12029                    d_strtoll="$undef"
12030                    ;;
12031                 esac
12032         else
12033                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12034                 d_strtoll="$undef"
12035         fi
12036         ;;
12037 esac
12038
12039 : see if strtoq exists
12040 set strtoq d_strtoq
12041 eval $inlibc
12042
12043 : see if strtoul exists
12044 set strtoul d_strtoul
12045 eval $inlibc
12046
12047 case "$d_strtoul" in
12048 "$define")
12049         $cat <<EOM
12050 Checking whether your strtoul() works okay...
12051 EOM
12052         $cat >try.c <<'EOCP'
12053 #include <errno.h>
12054 #include <stdio.h>
12055 extern unsigned long int strtoul(char *s, char **, int); 
12056 static int bad = 0;
12057 void check(char *s, unsigned long eul, int een) {
12058         unsigned long gul;
12059         errno = 0;
12060         gul = strtoul(s, 0, 10);
12061         if (!((gul == eul) && (errno == een)))
12062                 bad++;
12063 }
12064 int main() {
12065         check(" 1", 1L, 0);
12066         check(" 0", 0L, 0);
12067 EOCP
12068         case "$longsize" in
12069         8)
12070             $cat >>try.c <<'EOCP'
12071         check("18446744073709551615", 18446744073709551615UL, 0);
12072         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12073 #if 0 /* strtoul() for /^-/ strings is undefined. */
12074         check("-1", 18446744073709551615UL, 0);
12075         check("-18446744073709551614", 2, 0);
12076         check("-18446744073709551615", 1, 0);
12077         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12078         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12079 #endif
12080 EOCP
12081                 ;;
12082         4)
12083                     $cat >>try.c <<'EOCP'
12084         check("4294967295", 4294967295UL, 0);
12085         check("4294967296", 4294967295UL, ERANGE);
12086 #if 0 /* strtoul() for /^-/ strings is undefined. */
12087         check("-1", 4294967295UL, 0);
12088         check("-4294967294", 2, 0);
12089         check("-4294967295", 1, 0);
12090         check("-4294967296", 4294967295UL, ERANGE);
12091         check("-4294967297", 4294967295UL, ERANGE);
12092 #endif
12093 EOCP
12094                 ;;
12095         *)
12096 : Should we write these tests to be more portable by sprintf-ing
12097 : ~0 and then manipulating that char string as input for strtol?
12098                 ;;
12099         esac
12100         $cat >>try.c <<'EOCP'
12101         if (!bad)
12102                 printf("ok\n");
12103         return 0;
12104 }
12105 EOCP
12106         set try
12107         if eval $compile; then
12108                 case "`./try`" in
12109                 ok) echo "Your strtoul() seems to be working okay." ;;
12110                 *) cat <<EOM >&4
12111 Your strtoul() doesn't seem to be working okay.
12112 EOM
12113                    d_strtoul="$undef"
12114                    ;;
12115                 esac
12116         fi
12117         ;;
12118 esac
12119
12120 : see if strtoull exists
12121 set strtoull d_strtoull
12122 eval $inlibc
12123
12124 case "$d_longlong-$d_strtoull" in
12125 "$define-$define")
12126         $cat <<EOM
12127 Checking whether your strtoull() works okay...
12128 EOM
12129         $cat >try.c <<'EOCP'
12130 #include <errno.h>
12131 #ifdef __hpux
12132 #define strtoull __strtoull
12133 #endif
12134 #include <stdio.h>
12135 extern unsigned long long int strtoull(char *s, char **, int); 
12136 static int bad = 0;
12137 int check(char *s, long long eull, int een) {
12138         long long gull;
12139         errno = 0;
12140         gull = strtoull(s, 0, 10);
12141         if (!((gull == eull) && (errno == een)))
12142                 bad++;
12143 }
12144 int main() {
12145         check(" 1",                                        1LL, 0);
12146         check(" 0",                                        0LL, 0);
12147         check("18446744073709551615",  18446744073709551615ULL, 0);
12148         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12149 #if 0 /* strtoull() for /^-/ strings is undefined. */
12150         check("-1",                    18446744073709551615ULL, 0);
12151         check("-18446744073709551614",                     2LL, 0);
12152         check("-18446744073709551615",                     1LL, 0);
12153         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12154         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12155 #endif
12156         if (!bad)
12157                 printf("ok\n");
12158 }
12159 EOCP
12160         set try
12161         if eval $compile; then
12162                 case "`./try`" in
12163                 ok) echo "Your strtoull() seems to be working okay." ;;
12164                 *) cat <<EOM >&4
12165 Your strtoull() doesn't seem to be working okay.
12166 EOM
12167                    d_strtoull="$undef"
12168                    ;;
12169                 esac
12170         fi
12171         ;;
12172 esac
12173
12174 : see if strtouq exists
12175 set strtouq d_strtouq
12176 eval $inlibc
12177
12178 case "$d_strtouq" in
12179 "$define")
12180         $cat <<EOM
12181 Checking whether your strtouq() works okay...
12182 EOM
12183         $cat >try.c <<'EOCP'
12184 #include <errno.h>
12185 #include <stdio.h>
12186 extern unsigned long long int strtouq(char *s, char **, int); 
12187 static int bad = 0;
12188 void check(char *s, unsigned long long eull, int een) {
12189         unsigned long long gull;
12190         errno = 0;
12191         gull = strtouq(s, 0, 10);
12192         if (!((gull == eull) && (errno == een)))
12193                 bad++;
12194 }
12195 int main() {
12196         check(" 1",                                        1LL, 0);
12197         check(" 0",                                        0LL, 0);
12198         check("18446744073709551615",  18446744073709551615ULL, 0);
12199         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12200 #if 0 /* strtouq() for /^-/ strings is undefined. */
12201         check("-1",                    18446744073709551615ULL, 0);
12202         check("-18446744073709551614",                     2LL, 0);
12203         check("-18446744073709551615",                     1LL, 0);
12204         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12205         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12206 #endif
12207         if (!bad)
12208                 printf("ok\n");
12209         return 0;
12210 }
12211 EOCP
12212         set try
12213         if eval $compile; then
12214                 case "`./try`" in
12215                 ok) echo "Your strtouq() seems to be working okay." ;;
12216                 *) cat <<EOM >&4
12217 Your strtouq() doesn't seem to be working okay.
12218 EOM
12219                    d_strtouq="$undef"
12220                    ;;
12221                 esac
12222         fi
12223         ;;
12224 esac
12225
12226 : see if strxfrm exists
12227 set strxfrm d_strxfrm
12228 eval $inlibc
12229
12230 : see if symlink exists
12231 set symlink d_symlink
12232 eval $inlibc
12233
12234 : see if syscall exists
12235 set syscall d_syscall
12236 eval $inlibc
12237
12238 : see if sysconf exists
12239 set sysconf d_sysconf
12240 eval $inlibc
12241
12242 : see if system exists
12243 set system d_system
12244 eval $inlibc
12245
12246 : see if tcgetpgrp exists
12247 set tcgetpgrp d_tcgetpgrp
12248 eval $inlibc
12249
12250 : see if tcsetpgrp exists
12251 set tcsetpgrp d_tcsetpgrp
12252 eval $inlibc
12253
12254 : see if prototype for telldir is available
12255 echo " "
12256 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12257 eval $hasproto
12258
12259 : see if this is a sys/times.h system
12260 set sys/times.h i_systimes
12261 eval $inhdr
12262
12263 : see if times exists
12264 echo " "
12265 if set times val -f d_times; eval $csym; $val; then
12266         echo 'times() found.' >&4
12267         d_times="$define"
12268         inc=''
12269         case "$i_systimes" in
12270         "$define") inc='sys/times.h';;
12271         esac
12272         rp="What is the type returned by times() on this system?"
12273         set clock_t clocktype long stdio.h sys/types.h $inc
12274         eval $typedef_ask
12275 else
12276         echo 'times() NOT found, hope that will do.' >&4
12277         d_times="$undef"
12278         clocktype='int'
12279 fi
12280
12281 : see if truncate exists
12282 set truncate d_truncate
12283 eval $inlibc
12284
12285 : see if tzname[] exists
12286 echo " "
12287 if set tzname val -a d_tzname; eval $csym; $val; then
12288         val="$define"
12289         echo 'tzname[] found.' >&4
12290 else
12291         val="$undef"
12292         echo 'tzname[] NOT found.' >&4
12293 fi
12294 set d_tzname
12295 eval $setvar
12296
12297 : see if umask exists
12298 set umask d_umask
12299 eval $inlibc
12300
12301 : see if ustat exists
12302 set ustat d_ustat
12303 eval $inlibc
12304
12305 : backward compatibility for d_hvfork
12306 if test X$d_hvfork != X; then
12307         d_vfork="$d_hvfork"
12308         d_hvfork=''
12309 fi
12310 : see if there is a vfork
12311 val=''
12312 set vfork val
12313 eval $inlibc
12314
12315 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12316 : perl on Solaris 2.x, and probably elsewhere.
12317 case "$val" in
12318 $define)
12319         echo " "
12320         case "$usevfork" in
12321         false) dflt='n';;
12322         *) dflt='y';;
12323         esac
12324         cat <<'EOM'
12325  
12326 Perl can only use a vfork() that doesn't suffer from strict
12327 restrictions on calling functions or modifying global data in
12328 the child.  For example, glibc-2.1 contains such a vfork()
12329 that is unsuitable.  If your system provides a proper fork()
12330 call, chances are that you do NOT want perl to use vfork().
12331
12332 EOM
12333         rp="Do you still want to use vfork()?"
12334         . ./myread
12335         case "$ans" in
12336         y|Y) ;;
12337         *)
12338                 echo "Ok, we won't use vfork()."
12339                 val="$undef"
12340                 ;;
12341         esac
12342         ;;
12343 esac
12344 set d_vfork
12345 eval $setvar
12346 case "$d_vfork" in
12347 $define) usevfork='true';;
12348 *) usevfork='false';;
12349 esac
12350
12351 : see if this is an sysdir system
12352 set sys/dir.h i_sysdir
12353 eval $inhdr
12354
12355 : see if this is an sysndir system
12356 set sys/ndir.h i_sysndir
12357 eval $inhdr
12358
12359 : see if closedir exists
12360 set closedir d_closedir
12361 eval $inlibc
12362
12363 case "$d_closedir" in
12364 "$define")
12365         echo " "
12366         echo "Checking whether closedir() returns a status..." >&4
12367         cat > closedir.c <<EOM
12368 #$i_dirent I_DIRENT             /**/
12369 #$i_sysdir I_SYS_DIR            /**/
12370 #$i_sysndir I_SYS_NDIR          /**/
12371 #$i_systypes I_SYS_TYPES        /**/
12372
12373 #if defined(I_SYS_TYPES)
12374 #include <sys/types.h>
12375 #endif
12376 #if defined(I_DIRENT)
12377 #include <dirent.h>
12378 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12379 #include <sys/dir.h>
12380 #endif
12381 #else
12382 #ifdef I_SYS_NDIR
12383 #include <sys/ndir.h>
12384 #else
12385 #ifdef I_SYS_DIR
12386 #ifdef hp9000s500
12387 #include <ndir.h>       /* may be wrong in the future */
12388 #else
12389 #include <sys/dir.h>
12390 #endif
12391 #endif
12392 #endif
12393 #endif 
12394 int main() { return closedir(opendir(".")); }
12395 EOM
12396         set closedir
12397         if eval $compile_ok; then
12398                 if ./closedir > /dev/null 2>&1 ; then
12399                         echo "Yes, it does."
12400                         val="$undef"
12401                 else
12402                         echo "No, it doesn't."
12403                         val="$define"
12404                 fi
12405         else
12406                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12407                 val="$define"
12408         fi
12409         ;;
12410 *)
12411         val="$undef";
12412         ;;
12413 esac
12414 set d_void_closedir
12415 eval $setvar
12416 $rm -f closedir*
12417 : see if there is a wait4
12418 set wait4 d_wait4
12419 eval $inlibc
12420
12421 : see if waitpid exists
12422 set waitpid d_waitpid
12423 eval $inlibc
12424
12425 : see if wcstombs exists
12426 set wcstombs d_wcstombs
12427 eval $inlibc
12428
12429 : see if wctomb exists
12430 set wctomb d_wctomb
12431 eval $inlibc
12432
12433 : preserve RCS keywords in files with variable substitution, grrr
12434 Date='$Date'
12435 Id='$Id'
12436 Log='$Log'
12437 RCSfile='$RCSfile'
12438 Revision='$Revision'
12439
12440 case "$crosscompile" in
12441 ''|[nN]*) crosscompile="$undef" ;;
12442 esac
12443
12444 case "$osname" in
12445 next|rhapsody|darwin) multiarch="$define" ;;
12446 esac
12447 case "$multiarch" in
12448 ''|[nN]*) multiarch="$undef" ;;
12449 esac
12450
12451 : check for alignment requirements
12452 echo " "
12453 case "$crosscompile$multiarch" in
12454 *$define*)
12455         $cat <<EOM
12456 You seem to be either cross-compiling or doing a multiarchitecture build,
12457 skipping the memory alignment check.
12458
12459 EOM
12460         case "$alignbytes" in
12461         '') alignbytes=8 ;;
12462         esac
12463         ;;
12464 *)
12465         case "$alignbytes" in
12466         '') echo "Checking alignment constraints..." >&4
12467                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12468                         $cat >try.c <<'EOCP'
12469 typedef long double NV;
12470 EOCP
12471                 else
12472                         $cat >try.c <<'EOCP'
12473 typedef double NV;
12474 EOCP
12475                 fi
12476                 $cat >>try.c <<'EOCP'
12477 #include <stdio.h>
12478 struct foobar {
12479         char foo;
12480         NV bar;
12481 } try_algn;
12482 int main()
12483 {
12484     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12485     return(0);
12486 }
12487 EOCP
12488                 set try
12489                 if eval $compile_ok; then
12490                         dflt=`./try`
12491                 else
12492                         dflt='8'
12493                         echo "(I can't seem to compile the test program...)"
12494                 fi
12495                 ;;
12496         *) dflt="$alignbytes"
12497                 ;;
12498         esac
12499         rp="Doubles must be aligned on a how-many-byte boundary?"
12500         . ./myread
12501         alignbytes="$ans"
12502         $rm -f try.c try
12503         ;;
12504 esac
12505
12506
12507 : set the base revision
12508 baserev=5.0
12509
12510 : check for ordering of bytes in a long
12511 echo " "
12512 case "$crosscompile$multiarch" in
12513 *$define*)
12514         $cat <<EOM
12515 You seem to be either cross-compiling or doing a multiarchitecture build,
12516 skipping the byteorder check.
12517
12518 EOM
12519         byteorder='0xffff'
12520         ;;
12521 *)
12522         case "$byteorder" in
12523         '')
12524                 $cat <<'EOM'
12525 In the following, larger digits indicate more significance.  A big-endian
12526 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12527 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12528 machines may have weird orders like 3412.  A Cray will report 87654321,
12529 an Alpha will report 12345678. If the test program works the default is
12530 probably right.
12531 I'm now running the test program...
12532 EOM
12533                 $cat >try.c <<'EOCP'
12534 #include <stdio.h>
12535 int main()
12536 {
12537         int i;
12538         union {
12539                 unsigned long l;
12540                 char c[sizeof(long)];
12541         } u;
12542
12543         if (sizeof(long) > 4)
12544                 u.l = (0x08070605L << 32) | 0x04030201L;
12545         else
12546                 u.l = 0x04030201L;
12547         for (i = 0; i < sizeof(long); i++)
12548                 printf("%c", u.c[i]+'0');
12549         printf("\n");
12550         exit(0);
12551 }
12552 EOCP
12553                 xxx_prompt=y
12554                 set try
12555                 if eval $compile && ./try > /dev/null; then
12556                         dflt=`./try`
12557                         case "$dflt" in
12558                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12559                                 echo "(The test program ran ok.)"
12560                                 echo "byteorder=$dflt"
12561                                 xxx_prompt=n
12562                         ;;
12563                         ????|????????) echo "(The test program ran ok.)" ;;
12564                         *) echo "(The test program didn't run right for some reason.)" ;;
12565                         esac
12566                 else
12567                         dflt='4321'
12568                         cat <<'EOM'
12569 (I can't seem to compile the test program.  Guessing big-endian...)
12570 EOM
12571                 fi
12572                 case "$xxx_prompt" in
12573                 y)
12574                         rp="What is the order of bytes in a long?"
12575                         . ./myread
12576                         byteorder="$ans"
12577                         ;;
12578                 *)      byteorder=$dflt
12579                         ;;
12580                 esac
12581                 ;;
12582         esac
12583         $rm -f try.c try
12584         ;;
12585 esac
12586
12587
12588 : how do we catenate cpp tokens here?
12589 echo " "
12590 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12591 $cat >cpp_stuff.c <<'EOCP'
12592 #define RCAT(a,b)a/**/b
12593 #define ACAT(a,b)a ## b
12594 RCAT(Rei,ser)
12595 ACAT(Cir,cus)
12596 EOCP
12597 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12598 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12599         echo "Oh!  Smells like ANSI's been here." >&4
12600         echo "We can catify or stringify, separately or together!"
12601         cpp_stuff=42
12602 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12603         echo "Ah, yes!  The good old days!" >&4
12604         echo "However, in the good old days we don't know how to stringify and"
12605         echo "catify at the same time."
12606         cpp_stuff=1
12607 else
12608         $cat >&4 <<EOM
12609 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12610 to have to edit the values of CAT[2-5] in config.h...
12611 EOM
12612         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12613 fi
12614 $rm -f cpp_stuff.*
12615
12616 : see if this is a db.h system
12617 set db.h i_db
12618 eval $inhdr
12619
12620 case "$i_db" in
12621 $define)
12622         : Check db version.
12623         echo " "
12624         echo "Checking Berkeley DB version ..." >&4
12625         $cat >try.c <<EOCP
12626 #$d_const HASCONST
12627 #ifndef HASCONST
12628 #define const
12629 #endif
12630 #include <sys/types.h>
12631 #include <stdio.h>
12632 #include <db.h>
12633 int main()
12634 {
12635 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12636     int Major, Minor, Patch ;
12637     unsigned long Version ;
12638     (void)db_version(&Major, &Minor, &Patch) ;
12639     printf("You have Berkeley DB Version 2 or greater\n");
12640
12641     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12642                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12643     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12644                 Major, Minor, Patch) ;
12645
12646     /* check that db.h & libdb are compatible */
12647     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12648         printf("db.h and libdb are incompatible\n") ;
12649         exit(3);        
12650     }
12651
12652     printf("db.h and libdb are compatible\n") ;
12653
12654     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12655                 + DB_VERSION_PATCH ;
12656
12657     /* needs to be >= 2.3.4 */
12658     if (Version < 2003004) {
12659     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12660         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12661         exit(2);        
12662     }
12663
12664     exit(0);
12665 #else
12666 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12667     printf("You have Berkeley DB Version 1\n");
12668     exit(0);    /* DB version < 2: the coast is clear. */
12669 #else
12670     exit(1);    /* <db.h> not Berkeley DB? */
12671 #endif
12672 #endif
12673 }
12674 EOCP
12675         set try
12676         if eval $compile_ok && ./try; then
12677                 echo 'Looks OK.' >&4
12678         else
12679                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12680                 i_db=$undef
12681                 case " $libs " in
12682                 *"-ldb "*)
12683                         : Remove db from list of libraries to use
12684                         echo "Removing unusable -ldb from library list" >&4
12685                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12686                         shift
12687                         libs="$*"
12688                         echo "libs = $libs" >&4
12689                         ;;
12690                 esac
12691         fi
12692         $rm -f try.*
12693         ;;
12694 esac
12695
12696 case "$i_db" in
12697 define)
12698         : Check the return type needed for hash 
12699         echo " "
12700         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12701         $cat >try.c <<EOCP
12702 #$d_const HASCONST
12703 #ifndef HASCONST
12704 #define const
12705 #endif
12706 #include <sys/types.h>
12707 #include <db.h>
12708
12709 #ifndef DB_VERSION_MAJOR
12710 u_int32_t hash_cb (ptr, size)
12711 const void *ptr;
12712 size_t size;
12713 {
12714 }
12715 HASHINFO info;
12716 int main()
12717 {
12718         info.hash = hash_cb;
12719 }
12720 #endif
12721 EOCP
12722         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12723                 if $contains warning try.out >>/dev/null 2>&1 ; then
12724                         db_hashtype='int'
12725                 else
12726                         db_hashtype='u_int32_t'
12727                 fi
12728         else
12729                 : XXX Maybe we should just give up here.
12730                 db_hashtype=u_int32_t
12731                 $cat try.out >&4
12732                 echo "Help:  I can't seem to compile the db test program." >&4
12733                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12734         fi
12735         $rm -f try.*
12736         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12737         ;;
12738 *)      db_hashtype=u_int32_t
12739         ;;
12740 esac
12741 case "$i_db" in
12742 define)
12743         : Check the return type needed for prefix 
12744         echo " "
12745         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12746         cat >try.c <<EOCP
12747 #$d_const HASCONST
12748 #ifndef HASCONST
12749 #define const
12750 #endif
12751 #include <sys/types.h>
12752 #include <db.h>
12753
12754 #ifndef DB_VERSION_MAJOR
12755 size_t prefix_cb (key1, key2)
12756 const DBT *key1;
12757 const DBT *key2;
12758 {
12759 }
12760 BTREEINFO info;
12761 int main()
12762 {
12763         info.prefix = prefix_cb;
12764 }
12765 #endif
12766 EOCP
12767         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12768                 if $contains warning try.out >>/dev/null 2>&1 ; then
12769                         db_prefixtype='int'
12770                 else
12771                         db_prefixtype='size_t'
12772                 fi
12773         else
12774                 db_prefixtype='size_t'
12775                 : XXX Maybe we should just give up here.
12776                 $cat try.out >&4
12777                 echo "Help:  I can't seem to compile the db test program." >&4
12778                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12779         fi
12780         $rm -f try.*
12781         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12782         ;;
12783 *)      db_prefixtype='size_t'
12784         ;;
12785 esac
12786
12787 : check for void type
12788 echo " "
12789 echo "Checking to see how well your C compiler groks the void type..." >&4
12790 case "$voidflags" in
12791 '')
12792         $cat >try.c <<'EOCP'
12793 #if TRY & 1
12794 void sub() {
12795 #else
12796 sub() {
12797 #endif
12798         extern void moo();      /* function returning void */
12799         void (*goo)();          /* ptr to func returning void */
12800 #if TRY & 8
12801         void *hue;              /* generic ptr */
12802 #endif
12803 #if TRY & 2
12804         void (*foo[10])();
12805 #endif
12806
12807 #if TRY & 4
12808         if(goo == moo) {
12809                 exit(0);
12810         }
12811 #endif
12812         exit(0);
12813 }
12814 int main() { sub(); }
12815 EOCP
12816         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12817                 voidflags=$defvoidused
12818         echo "Good.  It appears to support void to the level $package wants.">&4
12819                 if $contains warning .out >/dev/null 2>&1; then
12820                         echo "However, you might get some warnings that look like this:"
12821                         $cat .out
12822                 fi
12823         else
12824 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12825                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12826                         echo "It supports 1..."
12827                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12828                                 echo "It also supports 2..."
12829                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12830                                         voidflags=7
12831                                         echo "And it supports 4 but not 8 definitely."
12832                                 else
12833                                         echo "It doesn't support 4..."
12834                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12835                                                 voidflags=11
12836                                                 echo "But it supports 8."
12837                                         else
12838                                                 voidflags=3
12839                                                 echo "Neither does it support 8."
12840                                         fi
12841                                 fi
12842                         else
12843                                 echo "It does not support 2..."
12844                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12845                                         voidflags=13
12846                                         echo "But it supports 4 and 8."
12847                                 else
12848                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12849                                                 voidflags=5
12850                                                 echo "And it supports 4 but has not heard about 8."
12851                                         else
12852                                                 echo "However it supports 8 but not 4."
12853                                         fi
12854                                 fi
12855                         fi
12856                 else
12857                         echo "There is no support at all for void."
12858                         voidflags=0
12859                 fi
12860         fi
12861 esac
12862 case "$voidflags" in
12863 "$defvoidused") ;;
12864 *)      $cat >&4 <<'EOM'
12865   Support flag bits are:
12866     1: basic void declarations.
12867     2: arrays of pointers to functions returning void.
12868     4: operations between pointers to and addresses of void functions.
12869     8: generic void pointers.
12870 EOM
12871         dflt="$voidflags";
12872         rp="Your void support flags add up to what?"
12873         . ./myread
12874         voidflags="$ans"
12875         ;;
12876 esac
12877 $rm -f try.* .out
12878
12879
12880 : How can we generate normalized random numbers ?
12881 echo " "
12882 echo "Looking for a random number function..." >&4
12883 case "$randfunc" in
12884 '')
12885         if set drand48 val -f; eval $csym; $val; then
12886                 dflt="drand48"
12887                 echo "Good, found drand48()." >&4
12888         elif set random val -f; eval $csym; $val; then
12889                 dflt="random"
12890                 echo "OK, found random()." >&4
12891         else
12892                 dflt="rand"
12893                 echo "Yick, looks like I have to use rand()." >&4
12894         fi
12895         echo " "
12896         ;;
12897 *)
12898         dflt="$randfunc"
12899         ;;
12900 esac
12901 cont=true
12902
12903 case "$ccflags" in
12904 *-Dmy_rand=*|*-Dmy_srand=*)
12905         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12906         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12907         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12908         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12909         ;;
12910 esac
12911
12912 while $test "$cont"; do
12913         rp="Use which function to generate random numbers?"
12914         . ./myread
12915         if $test "$ans" = "$dflt"; then
12916                 : null
12917         else
12918                 randbits=''
12919         fi
12920         randfunc="$ans"
12921         if set $ans val -f; eval $csym; $val; then
12922                 cont=''
12923         else
12924                 dflt=y
12925                 rp="I cannot find function $ans. Use that name anyway?"
12926                 . ./myread
12927                 dflt=rand
12928                 case "$ans" in
12929                         [yY]*) cont='';;
12930                 esac
12931         fi
12932         case "$cont" in
12933         '')
12934                 case "$randfunc" in
12935                 drand48)
12936                         drand01="drand48()"
12937                         seedfunc="srand48"
12938                         randbits=48
12939                         randseedtype=long
12940                         ;;
12941                 rand|random)
12942                         case "$randbits" in
12943                         '')
12944 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12945                                 $cat >try.c <<EOCP
12946 #$i_unistd I_UNISTD
12947 #$i_stdlib I_STDLIB
12948 #include <stdio.h>
12949 #ifdef I_UNISTD
12950 #  include <unistd.h>
12951 #endif
12952 #ifdef I_STDLIB
12953 #  include <stdlib.h>
12954 #endif
12955 int main()
12956 {
12957         register int i;
12958         register unsigned long tmp;
12959         register unsigned long max = 0L;
12960
12961         for (i = 1000; i; i--) {
12962                 tmp = (unsigned long) $randfunc();
12963                 if (tmp > max) max = tmp;
12964         }
12965         for (i = 0; max; i++)
12966                 max /= 2;
12967         printf("%d\n",i);
12968 }
12969 EOCP
12970                                 set try
12971                                 if eval $compile_ok; then
12972                                         dflt=`try`
12973                                 else
12974                                         dflt='?'
12975                                         echo "(I can't seem to compile the test program...)"
12976                                 fi
12977                                 ;;
12978                         *)
12979                                 dflt="$randbits"
12980                                 ;;
12981                         esac
12982                         rp="How many bits does your $randfunc() function produce?"
12983                         . ./myread
12984                         randbits="$ans"
12985                         $rm -f try.c try
12986                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12987                         seedfunc="s$randfunc"
12988                         randseedtype=unsigned
12989                         ;;
12990                 *)
12991                         dflt="31"
12992                         rp="How many bits does your $randfunc() function produce?"
12993                         . ./myread
12994                         randbits="$ans"
12995                         seedfunc="s$randfunc"
12996                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12997                         if set $seedfunc val -f; eval $csym; $val; then
12998                                 echo "(Using $seedfunc() to seed random generator)"
12999                         else
13000                                 echo "(Warning: no $seedfunc() to seed random generator)"
13001                                 seedfunc=rand
13002                         fi
13003                         randseedtype=unsigned
13004                         ;;
13005                 esac
13006                 ;;
13007         esac
13008 done
13009
13010 echo " "
13011 echo "Determining whether or not we are on an EBCDIC system..." >&4
13012 $cat >tebcdic.c <<'EOM'
13013 int main()
13014 {
13015   if ('M'==0xd4) return 0;
13016   return 1;
13017 }
13018 EOM
13019
13020 val=$undef
13021 set tebcdic
13022 if eval $compile_ok; then
13023         if ./tebcdic; then
13024                 echo "You seem to speak EBCDIC." >&4
13025                 val="$define"
13026         else
13027                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13028         fi
13029 else
13030         echo "I'm unable to compile the test program." >&4
13031         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13032 fi
13033 $rm -f tebcdic.c tebcdic
13034 set ebcdic
13035 eval $setvar
13036
13037 echo " "
13038 $cat >&4 <<EOM
13039 Checking how to flush all pending stdio output...
13040 EOM
13041 # I only know how to find the first 32 possibly open files on SunOS.
13042 # See also hints/sunos_4_1.sh and util.c  --AD
13043 case "$osname" in
13044 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13045 esac
13046 $cat >>try.c <<EOCP
13047 #include <stdio.h>
13048 #$i_unistd I_UNISTD
13049 #ifdef I_UNISTD
13050 # include <unistd.h>
13051 #endif
13052 #$d_sysconf HAS_SYSCONF
13053 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13054 #ifdef HAS_STDIO_STREAM_ARRAY
13055 # define STDIO_STREAM_ARRAY $stdio_stream_array
13056 #endif
13057 int main() {
13058   FILE* p = fopen("try.out", "w");
13059 #ifdef TRY_FPUTC
13060   fputc('x', p);
13061 #else
13062 # ifdef TRY_FPRINTF
13063   fprintf(p, "x");
13064 # endif
13065 #endif
13066 #ifdef TRY_FFLUSH_NULL
13067   fflush(NULL);
13068 #endif
13069 #ifdef TRY_FFLUSH_ALL
13070   {
13071     long open_max = -1;
13072 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13073     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13074 # else
13075 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13076     open_max = sysconf(_SC_OPEN_MAX);
13077 #  else
13078 #   ifdef FOPEN_MAX
13079     open_max = FOPEN_MAX;
13080 #   else
13081 #    ifdef OPEN_MAX
13082     open_max = OPEN_MAX;
13083 #    else
13084 #     ifdef _NFILE
13085     open_max = _NFILE;
13086 #     endif
13087 #    endif
13088 #   endif
13089 #  endif
13090 # endif 
13091 # ifdef HAS_STDIO_STREAM_ARRAY
13092     if (open_max > 0) {
13093       long i;
13094       for (i = 0; i < open_max; i++)
13095             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13096                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13097                 STDIO_STREAM_ARRAY[i]._flag)
13098                 fflush(&STDIO_STREAM_ARRAY[i]);
13099     }   
13100   }
13101 # endif
13102 #endif
13103   _exit(42);
13104 }
13105 EOCP
13106 : first we have to find out how _not_ to flush
13107 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13108     output=''
13109     set try -DTRY_FPUTC
13110     if eval $compile; then
13111             $rm -f try.out
13112             ./try$exe_ext 2>/dev/null
13113             if $test ! -s try.out -a "X$?" = X42; then
13114                 output=-DTRY_FPUTC
13115             fi
13116     fi
13117     case "$output" in
13118     '')
13119             set try -DTRY_FPRINTF
13120             $rm -f try.out
13121             if eval $compile; then
13122                     $rm -f try.out
13123                     ./try$exe_ext 2>/dev/null
13124                     if $test ! -s try.out -a "X$?" = X42; then
13125                         output=-DTRY_FPRINTF
13126                     fi
13127             fi
13128         ;;
13129     esac
13130 fi
13131 : check for fflush NULL behaviour
13132 case "$fflushNULL" in
13133 '')     set try -DTRY_FFLUSH_NULL $output
13134         if eval $compile; then
13135                 $rm -f try.out
13136                 ./try$exe_ext 2>/dev/null
13137                 code="$?"
13138                 if $test -s try.out -a "X$code" = X42; then
13139                         fflushNULL="`$cat try.out`"
13140                 else
13141                         if $test "X$code" != X42; then
13142                                 $cat >&4 <<EOM
13143 (If this test failed, don't worry, we'll try another method shortly.)
13144 EOM
13145                         fi
13146                 fi
13147         fi
13148         $rm -f core try.core core.try.*
13149         case "$fflushNULL" in
13150         x)      $cat >&4 <<EOM
13151 Your fflush(NULL) works okay for output streams.
13152 Let's see if it clobbers input pipes...
13153 EOM
13154 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13155 # bug that improperly flushes the input end of pipes.  So we avoid the
13156 # autoflush on fork/system/exec support for now. :-(
13157 $cat >tryp.c <<EOCP
13158 #include <stdio.h>
13159 int
13160 main(int argc, char **argv)
13161 {
13162     char buf[1024];
13163     int i;
13164     char *bp = buf;
13165     while (1) {
13166         while ((i = getc(stdin)) != -1
13167                && (*bp++ = i) != '\n'
13168                && bp < &buf[1024])
13169         /* DO NOTHING */ ;
13170         *bp = '\0';
13171         fprintf(stdout, "%s", buf);
13172         fflush(NULL);
13173         if (i == -1)
13174             return 0;
13175         bp = buf;
13176     }
13177 }
13178 EOCP
13179                 fflushNULL="$define"
13180                 set tryp
13181                 if eval $compile; then
13182                     $rm -f tryp.out
13183                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13184                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13185                        $cat >&4 <<EOM
13186 fflush(NULL) seems to behave okay with input streams.
13187 EOM
13188                         fflushNULL="$define"
13189                     else
13190                         $cat >&4 <<EOM
13191 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13192 EOM
13193                         fflushNULL="$undef"
13194                     fi
13195                 fi
13196                 $rm -f core tryp.c tryp.core core.tryp.*
13197                 ;;
13198         '')     $cat >&4 <<EOM
13199 Your fflush(NULL) isn't working (contrary to ANSI C).
13200 EOM
13201                 fflushNULL="$undef"
13202                 ;;
13203         *)      $cat >&4 <<EOM
13204 Cannot figure out whether your fflush(NULL) works or not.
13205 I'm assuming it doesn't (contrary to ANSI C).
13206 EOM
13207                 fflushNULL="$undef"
13208                 ;;
13209         esac
13210         ;;
13211 $define|true|[yY]*)
13212         fflushNULL="$define"
13213         ;;
13214 *)
13215         fflushNULL="$undef"
13216         ;;
13217 esac
13218 : check explicit looping only if NULL did not work, and if the pipe
13219 : bug does not show up on an explicit flush too
13220 case "$fflushNULL" in
13221 "$undef")
13222         $cat >tryp.c <<EOCP
13223 #include <stdio.h>
13224 int
13225 main(int argc, char **argv)
13226 {
13227     char buf[1024];
13228     int i;
13229     char *bp = buf;
13230     while (1) {
13231         while ((i = getc(stdin)) != -1
13232                && (*bp++ = i) != '\n'
13233                && bp < &buf[1024])
13234         /* DO NOTHING */ ;
13235         *bp = '\0';
13236         fprintf(stdout, "%s", buf);
13237         fflush(stdin);
13238         if (i == -1)
13239             return 0;
13240         bp = buf;
13241     }
13242 }
13243 EOCP
13244         set tryp
13245         if eval $compile; then
13246             $rm -f tryp.out
13247             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13248             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13249                $cat >&4 <<EOM
13250 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13251 EOM
13252                 : now check for fflushall behaviour
13253                 case "$fflushall" in
13254                 '')     set try -DTRY_FFLUSH_ALL $output
13255                         if eval $compile; then
13256                                 $cat >&4 <<EOM
13257 (Now testing the other method--but note that this also may fail.)
13258 EOM
13259                                 $rm -f try.out
13260                                 ./try$exe_ext 2>/dev/null
13261                                 if $test -s try.out -a "X$?" = X42; then
13262                                         fflushall="`$cat try.out`"
13263                                 fi
13264                         fi
13265                         $rm -f core try.core core.try.*
13266                         case "$fflushall" in
13267                         x)      $cat >&4 <<EOM
13268 Whew. Flushing explicitly all the stdio streams works.
13269 EOM
13270                                 fflushall="$define"
13271                                 ;;
13272                         '')     $cat >&4 <<EOM
13273 Sigh. Flushing explicitly all the stdio streams doesn't work.
13274 EOM
13275                                 fflushall="$undef"
13276                                 ;;
13277                         *)      $cat >&4 <<EOM
13278 Cannot figure out whether flushing stdio streams explicitly works or not.
13279 I'm assuming it doesn't.
13280 EOM
13281                                 fflushall="$undef"
13282                                 ;;
13283                         esac
13284                         ;;
13285                 "$define"|true|[yY]*)
13286                         fflushall="$define"
13287                         ;;
13288                 *)
13289                         fflushall="$undef"
13290                         ;;
13291                 esac
13292             else
13293                 $cat >&4 <<EOM
13294 All is futile.  Even fflush(stdin) clobbers input pipes!
13295 EOM
13296                 fflushall="$undef"
13297             fi
13298         else
13299             fflushall="$undef"
13300         fi
13301         $rm -f core tryp.c tryp.core core.tryp.*
13302         ;;
13303 *)      fflushall="$undef"
13304         ;;
13305 esac
13306
13307 case "$fflushNULL$fflushall" in
13308 undefundef)
13309         $cat <<EOM
13310 OK, I give up.  I cannot figure out how to flush pending stdio output.
13311 We won't be flushing handles at all before fork/exec/popen.
13312 EOM
13313         ;;
13314 esac
13315 $rm -f try.* try$exe_ext
13316
13317 : Store the full pathname to the ar program for use in the C program
13318 : Respect a hint or command line value for full_ar.
13319 case "$full_ar" in
13320 '') full_ar=$ar ;;
13321 esac
13322
13323 : Store the full pathname to the sed program for use in the C program
13324 full_sed=$sed
13325
13326 : see what type gids are declared as in the kernel
13327 echo " "
13328 echo "Looking for the type for group ids returned by getgid()."
13329 set gid_t gidtype xxx stdio.h sys/types.h
13330 eval $typedef
13331 case "$gidtype" in
13332 xxx)
13333         xxx=`./findhdr sys/user.h`
13334         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13335         case $1 in
13336         unsigned) dflt="$1 $2" ;;
13337         *) dflt="$1" ;;
13338         esac
13339         ;;
13340 *) dflt="$gidtype";;
13341 esac
13342 case "$gidtype" in
13343 gid_t) echo "gid_t found." ;;
13344 *)      rp="What is the type for group ids returned by getgid()?"
13345         . ./myread
13346         gidtype="$ans"
13347         ;;
13348 esac
13349
13350 echo " "
13351 case "$gidtype" in
13352 *_t) zzz="$gidtype"     ;;
13353 *)   zzz="gid"          ;;
13354 esac
13355 echo "Checking the size of $zzz..." >&4 
13356 cat > try.c <<EOCP
13357 #include <sys/types.h>
13358 #include <stdio.h>
13359 int main() {
13360     printf("%d\n", (int)sizeof($gidtype));
13361     exit(0);
13362 }
13363 EOCP
13364 set try
13365 if eval $compile_ok; then
13366         yyy=`./try`
13367         case "$yyy" in
13368         '')     gidsize=4
13369                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13370                 ;;
13371         *)      gidsize=$yyy
13372                 echo "Your $zzz is $gidsize bytes long."
13373                 ;;
13374         esac
13375 else
13376         gidsize=4
13377         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13378 fi
13379
13380
13381 echo " "
13382 case "$gidtype" in
13383 *_t) zzz="$gidtype"     ;;
13384 *)   zzz="gid"          ;;
13385 esac
13386 echo "Checking the sign of $zzz..." >&4 
13387 cat > try.c <<EOCP
13388 #include <sys/types.h>
13389 #include <stdio.h>
13390 int main() {
13391         $gidtype foo = -1;
13392         if (foo < 0)
13393                 printf("-1\n");
13394         else
13395                 printf("1\n");
13396 }
13397 EOCP
13398 set try
13399 if eval $compile; then
13400         yyy=`./try`
13401         case "$yyy" in
13402         '')     gidsign=1
13403                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13404                 ;;
13405         *)      gidsign=$yyy
13406                 case "$gidsign" in
13407                  1) echo "Your $zzz is unsigned." ;;
13408                 -1) echo "Your $zzz is signed."   ;;
13409                 esac
13410                 ;;
13411         esac
13412 else
13413         gidsign=1
13414         echo "(I can't compile the test program--guessing unsigned.)" >&4
13415 fi
13416
13417
13418 echo " "
13419
13420 if $test X"$quadtype" != X; then
13421
13422 echo "Checking how to print 64-bit integers..." >&4
13423
13424 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13425         $cat >try.c <<'EOCP'
13426 #include <sys/types.h>
13427 #include <stdio.h>
13428 int main() {
13429   int q = 12345678901;
13430   printf("%ld\n", q);
13431 }
13432 EOCP
13433         set try
13434         if eval $compile; then
13435                 yyy=`./try$exe_ext`
13436                 case "$yyy" in
13437                 12345678901)
13438                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13439                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13440                         echo "We will use %d."
13441                         ;;
13442                 esac
13443         fi
13444 fi
13445
13446 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13447         $cat >try.c <<'EOCP'
13448 #include <sys/types.h>
13449 #include <stdio.h>
13450 int main() {
13451   long q = 12345678901;
13452   printf("%ld\n", q);
13453 }
13454 EOCP
13455         set try
13456         if eval $compile; then
13457                 yyy=`./try$exe_ext`
13458                 case "$yyy" in
13459                 12345678901)
13460                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13461                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13462                         echo "We will use %ld."
13463                         ;;
13464                 esac
13465         fi
13466 fi
13467
13468 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13469         $cat >try.c <<'EOCP'
13470 #include <sys/types.h>
13471 #include <inttypes.h>
13472 #include <stdio.h>
13473 int main() {
13474   int64_t q = 12345678901;
13475   printf("%" PRId64 "\n", q);
13476 }
13477 EOCP
13478         set try
13479         if eval $compile; then
13480                 yyy=`./try$exe_ext`
13481                 case "$yyy" in
13482                 12345678901)
13483                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13484                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13485                         echo "We will use the C9X style."
13486                         ;;
13487                 esac
13488         fi
13489 fi
13490
13491 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13492         $cat >try.c <<'EOCP'
13493 #include <sys/types.h>
13494 #include <stdio.h>
13495 int main() {
13496   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13497   printf("%lld\n", q);
13498 }
13499 EOCP
13500         set try
13501         if eval $compile; then
13502                 yyy=`./try$exe_ext`
13503                 case "$yyy" in
13504                 12345678901)
13505                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13506                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13507                         echo "We will use the %lld style."
13508                         ;;
13509                 esac
13510         fi
13511 fi
13512
13513 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13514         $cat >try.c <<EOCP
13515 #include <sys/types.h>
13516 #include <stdio.h>
13517 int main() {
13518   $quadtype q = 12345678901;
13519   printf("%Ld\n", q);
13520 }
13521 EOCP
13522         set try
13523         if eval $compile; then
13524                 yyy=`./try$exe_ext`
13525                 case "$yyy" in
13526                 12345678901)
13527                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13528                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13529                         echo "We will use %Ld."
13530                         ;;
13531                 esac
13532         fi
13533 fi
13534
13535 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13536         $cat >try.c <<EOCP
13537 #include <sys/types.h>
13538 #include <stdio.h>
13539 int main() {
13540   $quadtype q = 12345678901;
13541   printf("%qd\n", q);
13542 }
13543 EOCP
13544         set try
13545         if eval $compile; then
13546                 yyy=`./try$exe_ext`
13547                 case "$yyy" in
13548                 12345678901)
13549                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13550                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13551                         echo "We will use %qd."
13552                         ;;
13553                 esac
13554         fi
13555 fi
13556
13557 if $test X"$sPRId64" = X; then
13558         echo "Cannot figure out how to print 64-bit integers." >&4
13559 fi
13560
13561 $rm -f try try.*
13562
13563 fi
13564
13565 case "$sPRId64" in
13566 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13567         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13568         ;;
13569 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13570         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13571         ;;
13572 esac
13573
13574
13575 echo " "
13576 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13577
13578 if $test X"$ivsize" = X8; then
13579         ivdformat="$sPRId64"
13580         uvuformat="$sPRIu64"
13581         uvoformat="$sPRIo64"
13582         uvxformat="$sPRIx64"
13583         uvXUformat="$sPRIXU64"
13584 else
13585         if $test X"$ivsize" = X"$longsize"; then
13586                 ivdformat='"ld"'
13587                 uvuformat='"lu"'
13588                 uvoformat='"lo"'
13589                 uvxformat='"lx"'
13590                 uvXUformat='"lX"'
13591         else
13592                 if $test X"$ivsize" = X"$intsize"; then
13593                         ivdformat='"d"'
13594                         uvuformat='"u"'
13595                         uvoformat='"o"'
13596                         uvxformat='"x"'
13597                         uvXUformat='"X"'
13598                 else
13599                         : far out
13600                         if $test X"$ivsize" = X"$shortsize"; then
13601                                 ivdformat='"hd"'
13602                                 uvuformat='"hu"'
13603                                 uvoformat='"ho"'
13604                                 uvxformat='"hx"'
13605                                 uvXUformat='"hX"'
13606                         fi
13607                 fi
13608         fi
13609 fi
13610
13611 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13612         nveformat="$sPRIeldbl"
13613         nvfformat="$sPRIfldbl"
13614         nvgformat="$sPRIgldbl"
13615         nvEUformat="$sPRIEUldbl"
13616         nvFUformat="$sPRIFUldbl"
13617         nvGUformat="$sPRIGUldbl"
13618 else
13619         nveformat='"e"'
13620         nvfformat='"f"'
13621         nvgformat='"g"'
13622         nvEUformat='"E"'
13623         nvFUformat='"F"'
13624         nvGUformat='"G"'
13625 fi
13626
13627 case "$ivdformat" in
13628 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13629     exit 1
13630     ;;
13631 esac
13632
13633
13634 echo " "
13635 $echo "Checking the format string to be used for gids..." >&4
13636
13637 case "$gidsign" in
13638 -1)     if $test X"$gidsize" = X"$ivsize"; then
13639                 gidformat="$ivdformat"
13640         else
13641                 if $test X"$gidsize" = X"$longsize"; then
13642                         gidformat='"ld"'
13643                 else
13644                         if $test X"$gidsize" = X"$intsize"; then
13645                                 gidformat='"d"'
13646                         else
13647                                 if $test X"$gidsize" = X"$shortsize"; then
13648                                         gidformat='"hd"'
13649                                 fi
13650                         fi
13651                 fi
13652         fi
13653         ;;
13654 *)      if $test X"$gidsize" = X"$uvsize"; then
13655                 gidformat="$uvuformat"
13656         else
13657                 if $test X"$gidsize" = X"$longsize"; then
13658                         gidformat='"lu"'
13659                 else
13660                         if $test X"$gidsize" = X"$intsize"; then
13661                                 gidformat='"u"'
13662                         else
13663                                 if $test X"$gidsize" = X"$shortsize"; then
13664                                         gidformat='"hu"'
13665                                 fi
13666                         fi
13667                 fi
13668         fi
13669         ;;
13670 esac
13671
13672 : see if getgroups exists
13673 set getgroups d_getgrps
13674 eval $inlibc
13675
13676 : see if setgroups exists
13677 set setgroups d_setgrps
13678 eval $inlibc
13679
13680
13681 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13682 echo " "
13683 case "$d_getgrps$d_setgrps" in
13684 *define*)
13685         case "$groupstype" in
13686         '') dflt="$gidtype" ;;
13687         *)  dflt="$groupstype" ;;
13688         esac
13689         $cat <<EOM
13690 What type of pointer is the second argument to getgroups() and setgroups()?
13691 Usually this is the same as group ids, $gidtype, but not always.
13692
13693 EOM
13694         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13695         . ./myread
13696         groupstype="$ans"
13697         ;;
13698 *)  groupstype="$gidtype";;
13699 esac
13700
13701 echo " "
13702 echo "Checking if your $make program sets \$(MAKE)..." >&4
13703 case "$make_set_make" in
13704 '')
13705         $sed 's/^X //' > testmake.mak << 'EOF'
13706 Xall:
13707 X       @echo 'maketemp="$(MAKE)"'
13708 EOF
13709         case "`$make -f testmake.mak 2>/dev/null`" in
13710         *maketemp=*) make_set_make='#' ;;
13711         *)      make_set_make="MAKE=$make" ;;
13712         esac
13713         $rm -f testmake.mak
13714         ;;
13715 esac
13716 case "$make_set_make" in
13717 '#') echo "Yup, it does.";;
13718 *) echo "Nope, it doesn't.";;
13719 esac
13720
13721 : see what type is used for mode_t
13722 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13723 set mode_t modetype int stdio.h sys/types.h
13724 eval $typedef_ask
13725
13726 : see if stdarg is available
13727 echo " "
13728 if $test `./findhdr stdarg.h`; then
13729         echo "<stdarg.h> found." >&4
13730         valstd="$define"
13731 else
13732         echo "<stdarg.h> NOT found." >&4
13733         valstd="$undef"
13734 fi
13735
13736 : see if varags is available
13737 echo " "
13738 if $test `./findhdr varargs.h`; then
13739         echo "<varargs.h> found." >&4
13740 else
13741         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13742 fi
13743
13744 : set up the varargs testing programs
13745 $cat > varargs.c <<EOP
13746 #ifdef I_STDARG
13747 #include <stdarg.h>
13748 #endif
13749 #ifdef I_VARARGS
13750 #include <varargs.h>
13751 #endif
13752
13753 #ifdef I_STDARG
13754 int f(char *p, ...)
13755 #else
13756 int f(va_alist)
13757 va_dcl
13758 #endif
13759 {
13760         va_list ap;
13761 #ifndef I_STDARG
13762         char *p;
13763 #endif
13764 #ifdef I_STDARG
13765         va_start(ap,p);
13766 #else
13767         va_start(ap);
13768         p = va_arg(ap, char *);
13769 #endif
13770         va_end(ap);
13771 }
13772 EOP
13773 $cat > varargs <<EOP
13774 $startsh
13775 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13776         echo "true"
13777 else
13778         echo "false"
13779 fi
13780 $rm -f varargs$_o
13781 EOP
13782 chmod +x varargs
13783
13784 : now check which varargs header should be included
13785 echo " "
13786 i_varhdr=''
13787 case "$valstd" in
13788 "$define")
13789         if `./varargs I_STDARG`; then
13790                 val='stdarg.h'
13791         elif `./varargs I_VARARGS`; then
13792                 val='varargs.h'
13793         fi
13794         ;;
13795 *)
13796         if `./varargs I_VARARGS`; then
13797                 val='varargs.h'
13798         fi
13799         ;;
13800 esac
13801 case "$val" in
13802 '')
13803 echo "I could not find the definition for va_dcl... You have problems..." >&4
13804         val="$undef"; set i_stdarg; eval $setvar
13805         val="$undef"; set i_varargs; eval $setvar
13806         ;;
13807 *) 
13808         set i_varhdr
13809         eval $setvar
13810         case "$i_varhdr" in
13811         stdarg.h)
13812                 val="$define"; set i_stdarg; eval $setvar
13813                 val="$undef"; set i_varargs; eval $setvar
13814                 ;;
13815         varargs.h)
13816                 val="$undef"; set i_stdarg; eval $setvar
13817                 val="$define"; set i_varargs; eval $setvar
13818                 ;;
13819         esac
13820         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13821 esac
13822 $rm -f varargs*
13823
13824 : see if we need va_copy
13825 echo " "
13826 case "$i_stdarg" in
13827 "$define")
13828         $cat >try.c <<EOCP
13829 #include <stdarg.h>
13830 #include <stdio.h>
13831 #$i_stdlib I_STDLIB
13832 #ifdef I_STDLIB
13833 #include <stdlib.h>
13834 #endif
13835 #include <signal.h>
13836
13837 int
13838 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13839 {
13840   return vfprintf(f, fmt, *valp);
13841 }
13842  
13843 int    
13844 myvfprintf(FILE *f, const  char *fmt, va_list val)
13845 {
13846   return ivfprintf(f, fmt, &val);
13847 }
13848       
13849 int
13850 myprintf(char *fmt, ...) 
13851 {
13852   va_list val;
13853   va_start(val, fmt);
13854   return myvfprintf(stdout, fmt, val); 
13855 }         
13856
13857 int
13858 main(int ac, char **av)
13859 {
13860   signal(SIGSEGV, exit);
13861
13862   myprintf("%s%cs all right, then\n", "that", '\'');                            
13863   exit(0);      
13864 }
13865 EOCP
13866         set try
13867         if eval $compile && ./try 2>&1 >/dev/null; then
13868                 case "`./try`" in
13869                 "that's all right, then")
13870                         okay=yes
13871                         ;;
13872                 esac
13873         fi
13874         case "$okay" in
13875         yes)    echo "It seems that you don't need va_copy()." >&4
13876                 need_va_copy="$undef"
13877                 ;;
13878         *)      echo "It seems that va_copy() or similar will be needed." >&4
13879                 need_va_copy="$define"
13880                 ;;
13881         esac
13882         $rm -f try.* core core.* *.core *.core.*
13883         ;;
13884 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13885         ;;
13886 esac
13887
13888 : define a fucntion to check prototypes
13889 $cat > protochk <<EOSH
13890 $startsh
13891 cc="$cc"
13892 optimize="$optimize"
13893 ccflags="$ccflags"
13894 prototype="$prototype"
13895 define="$define"
13896 rm=$rm
13897 EOSH
13898
13899 $cat >> protochk <<'EOSH'
13900
13901 $rm -f try.c
13902 foo="$1"
13903 shift
13904 while test $# -ge 2; do
13905         case "$1" in
13906                 $define) echo "#include <$2>" >> try.c ;;
13907                 literal) echo "$2" >> try.c ;;
13908         esac
13909     shift 2
13910 done
13911 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13912 cat >> try.c <<'EOCP'
13913 #ifdef CAN_PROTOTYPE
13914 #define _(args) args
13915 #else
13916 #define _(args) ()
13917 #endif
13918 EOCP
13919 echo "$foo" >> try.c
13920 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13921 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13922 status=$?
13923 $rm -f try.[co]
13924 exit $status
13925 EOSH
13926 chmod +x protochk
13927 $eunicefix protochk
13928
13929 : see what type is used for size_t
13930 rp="What is the type used for the length parameter for string functions?"
13931 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13932 eval $typedef_ask
13933
13934 : check for type of arguments to gethostbyaddr. 
13935 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13936         case "$d_gethbyaddr" in
13937         $define)
13938                 $cat <<EOM
13939
13940 Checking to see what type of arguments are accepted by gethostbyaddr().
13941 EOM
13942                 hdrs="$define sys/types.h
13943                         $d_socket sys/socket.h 
13944                         $i_niin netinet/in.h 
13945                         $i_netdb netdb.h
13946                         $i_unistd unistd.h"
13947                 : The first arg can 'char *' or 'void *'
13948                 : The second arg is some of integral type
13949                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13950                         for yyy in size_t long int; do
13951                                 case "$netdb_host_type" in
13952                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13953                                         if ./protochk "$try" $hdrs; then
13954                                                 echo "Your system accepts $xxx for the first arg."
13955                                                 echo "...and $yyy for the second arg."
13956                                                 netdb_host_type="$xxx"
13957                                                 netdb_hlen_type="$yyy"
13958                                         fi
13959                                         ;;
13960                                 esac
13961                         done
13962                 done
13963                 : In case none of those worked, prompt the user.
13964                 case "$netdb_host_type" in
13965                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13966                         dflt='char *'
13967                         . ./myread
13968                         netdb_host_type=$ans
13969                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13970                         dflt="$sizetype"
13971                         . ./myread
13972                         netdb_hlen_type=$ans
13973                         ;;
13974                 esac
13975                 ;;
13976         *)      : no gethostbyaddr, so pick harmless defaults
13977                 netdb_host_type='char *'
13978                 netdb_hlen_type="$sizetype"
13979                 ;;
13980         esac
13981         # Remove the "const" if needed. -- but then we'll have a 
13982         # prototype clash!
13983         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13984 fi
13985
13986 : check for type of argument to gethostbyname. 
13987 if test "X$netdb_name_type" = X ; then
13988         case "$d_gethbyname" in
13989         $define)
13990                 $cat <<EOM
13991
13992 Checking to see what type of argument is accepted by gethostbyname().
13993 EOM
13994                 hdrs="$define sys/types.h
13995                         $d_socket sys/socket.h 
13996                         $i_niin netinet/in.h 
13997                         $i_netdb netdb.h
13998                         $i_unistd unistd.h"
13999                 for xxx in "const char *" "char *"; do
14000                         case "$netdb_name_type" in
14001                         '')     try="extern struct hostent *gethostbyname($xxx);"
14002                                 if ./protochk "$try" $hdrs; then
14003                                         echo "Your system accepts $xxx."
14004                                         netdb_name_type="$xxx"
14005                                 fi
14006                                 ;;
14007                         esac
14008                 done
14009                 : In case none of those worked, prompt the user.
14010                 case "$netdb_name_type" in
14011                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14012                         dflt='char *'
14013                         . ./myread
14014                         netdb_name_type=$ans
14015                         ;;
14016                 esac
14017                 ;;
14018         *)      : no gethostbyname, so pick harmless default
14019                 netdb_name_type='char *'
14020                 ;;
14021         esac
14022 fi
14023
14024 : check for type of 1st argument to getnetbyaddr. 
14025 if test "X$netdb_net_type" = X ; then
14026         case "$d_getnbyaddr" in
14027         $define)
14028                 $cat <<EOM
14029
14030 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14031 EOM
14032                 hdrs="$define sys/types.h
14033                         $d_socket sys/socket.h 
14034                         $i_niin netinet/in.h 
14035                         $i_netdb netdb.h
14036                         $i_unistd unistd.h"
14037                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14038                         case "$netdb_net_type" in
14039                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14040                                 if ./protochk "$try" $hdrs; then
14041                                         echo "Your system accepts $xxx."
14042                                         netdb_net_type="$xxx"
14043                                 fi
14044                                 ;;
14045                         esac
14046                 done
14047                 : In case none of those worked, prompt the user.
14048                 case "$netdb_net_type" in
14049                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14050                         dflt='long'
14051                         . ./myread
14052                         netdb_net_type=$ans
14053                         ;;
14054                 esac
14055                 ;;
14056         *)      : no getnetbyaddr, so pick harmless default
14057                 netdb_net_type='long'
14058                 ;;
14059         esac
14060 fi
14061 : locate the preferred pager for this system
14062 case "$pager" in
14063 '')
14064         dflt=''
14065         case "$pg" in
14066         /*) dflt=$pg;;
14067         [a-zA-Z]:/*) dflt=$pg;;
14068         esac
14069         case "$more" in
14070         /*) dflt=$more;;
14071         [a-zA-Z]:/*) dflt=$more;;
14072         esac
14073         case "$less" in
14074         /*) dflt=$less;;
14075         [a-zA-Z]:/*) dflt=$less;;
14076         esac
14077         case "$dflt" in
14078         '') dflt=/usr/ucb/more;;
14079         esac
14080         ;;
14081 *) dflt="$pager";;
14082 esac
14083 echo " "
14084 fn=f/
14085 rp='What pager is used on your system?'
14086 . ./getfile
14087 pager="$ans"
14088
14089 : see what type pids are declared as in the kernel
14090 rp="What is the type of process ids on this system?"
14091 set pid_t pidtype int stdio.h sys/types.h
14092 eval $typedef_ask
14093
14094 : Find earliest binary compatible site_perl subdirectory perl can use.
14095 case "$bincompat5005" in
14096 "$define") xs_apiversion='5.005' ;;
14097 *) xs_apiversion=$version ;;   # The current site_perl version.
14098 esac
14099 : Find earliest pure perl site_perl subdirectory perl can use.
14100 : The versioned directories started at 5.005.
14101 pm_apiversion='5.005'
14102
14103 : check for length of pointer
14104 echo " "
14105 case "$ptrsize" in
14106 '')
14107         echo "Checking to see how big your pointers are..." >&4
14108         if test "$voidflags" -gt 7; then
14109                 echo '#define VOID_PTR char *' > try.c
14110         else
14111                 echo '#define VOID_PTR void *' > try.c
14112         fi
14113         $cat >>try.c <<'EOCP'
14114 #include <stdio.h>
14115 int main()
14116 {
14117     printf("%d\n", (int)sizeof(VOID_PTR));
14118     exit(0);
14119 }
14120 EOCP
14121         set try
14122         if eval $compile_ok; then
14123                 ptrsize=`./try`
14124                 echo "Your pointers are $ptrsize bytes long."
14125         else
14126                 dflt='4'
14127                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14128                 rp="What is the size of a pointer (in bytes)?"
14129                 . ./myread
14130                 ptrsize="$ans"
14131         fi
14132         ;;
14133 esac
14134 $rm -f try.c try
14135
14136 : see if ar generates random libraries by itself
14137 echo " "
14138 echo "Checking how to generate random libraries on your machine..." >&4
14139 echo 'int bar1() { return bar2(); }' > bar1.c
14140 echo 'int bar2() { return 2; }' > bar2.c
14141 $cat > foo.c <<'EOP'
14142 int main() { printf("%d\n", bar1()); exit(0); }
14143 EOP
14144 $cc $ccflags -c bar1.c >/dev/null 2>&1
14145 $cc $ccflags -c bar2.c >/dev/null 2>&1
14146 $cc $ccflags -c foo.c >/dev/null 2>&1
14147 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14148 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14149         ./foobar >/dev/null 2>&1; then
14150         echo "$ar appears to generate random libraries itself."
14151         orderlib=false
14152         ranlib=":"
14153 elif $ar ts bar$_a >/dev/null 2>&1 &&
14154         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14155         ./foobar >/dev/null 2>&1; then
14156                 echo "a table of contents needs to be added with '$ar ts'."
14157                 orderlib=false
14158                 ranlib="$ar ts"
14159 else
14160         case "$ranlib" in
14161         :) ranlib='';;
14162         '')
14163                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14164                 $test -f $ranlib || ranlib=''
14165                 ;;
14166         esac
14167         if $test -n "$ranlib"; then
14168                 echo "your system has '$ranlib'; we'll use that."
14169                 orderlib=false
14170         else
14171                 echo "your system doesn't seem to support random libraries"
14172                 echo "so we'll use lorder and tsort to order the libraries."
14173                 orderlib=true
14174                 ranlib=":"
14175         fi
14176 fi
14177 $rm -f foo* bar* 
14178
14179 : check for type of arguments to select. 
14180 case "$selecttype" in
14181 '') case "$d_select" in
14182         $define)
14183                 echo " "
14184                 $cat <<EOM
14185 Checking to see what type of arguments are accepted by select().
14186 EOM
14187                 hdrs="$define sys/types.h
14188                         $i_systime sys/time.h 
14189                         $i_sysselct sys/select.h
14190                         $d_socket sys/socket.h"
14191                 : The first arg can be int, unsigned, or size_t
14192                 : The last arg may or may not be 'const'
14193                 val=''
14194                 : void pointer has been seen but using that
14195                 : breaks the selectminbits test
14196                 for xxx in 'fd_set *' 'int *'; do
14197                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14198                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14199                                         case "$val" in
14200                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14201                                                 if ./protochk "$try" $hdrs; then
14202                                                         echo "Your system accepts $xxx."
14203                                                         val="$xxx"
14204                                                 fi
14205                                                 ;;
14206                                         esac
14207                                 done
14208                         done
14209                 done
14210                 case "$val" in
14211                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14212                         case "$d_fd_set" in
14213                                 $define) dflt="fd_set *" ;;
14214                                 *)              dflt="int *" ;;
14215                         esac
14216                         . ./myread
14217                         val=$ans
14218                         ;;
14219                 esac
14220                 selecttype="$val"
14221                 ;;
14222         *)      : no select, so pick a harmless default
14223                 selecttype='int *'
14224                 ;;
14225         esac
14226         ;;
14227 esac
14228
14229 : check for the select 'width'
14230 case "$selectminbits" in
14231 '') case "$d_select" in
14232         $define)
14233                 $cat <<EOM
14234
14235 Checking to see on how many bits at a time your select() operates...
14236 EOM
14237                 $cat >try.c <<EOCP
14238 #include <sys/types.h>
14239 #$i_time I_TIME
14240 #$i_systime I_SYS_TIME
14241 #$i_systimek I_SYS_TIME_KERNEL
14242 #ifdef I_TIME
14243 #   include <time.h>
14244 #endif
14245 #ifdef I_SYS_TIME
14246 #   ifdef I_SYS_TIME_KERNEL
14247 #       define KERNEL
14248 #   endif
14249 #   include <sys/time.h>
14250 #   ifdef I_SYS_TIME_KERNEL
14251 #       undef KERNEL
14252 #   endif
14253 #endif
14254 #$i_sysselct I_SYS_SELECT
14255 #ifdef I_SYS_SELECT
14256 #include <sys/select.h>
14257 #endif
14258 #$d_socket HAS_SOCKET
14259 #ifdef HAS_SOCKET
14260 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14261 #endif
14262 #include <stdio.h>
14263 $selecttype b;
14264 #define S sizeof(*(b))
14265 #define MINBITS 64
14266 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14267 #define NBITS  (NBYTES * 8)
14268 int main() {
14269     char s[NBYTES];
14270     struct timeval t;
14271     int i;
14272     FILE* fp;
14273     int fd;
14274
14275     fclose(stdin);
14276     fp = fopen("try.c", "r");
14277     if (fp == 0)
14278       exit(1);
14279     fd = fileno(fp);
14280     if (fd < 0)
14281       exit(2);
14282     b = ($selecttype)s;
14283     for (i = 0; i < NBITS; i++)
14284         FD_SET(i, b);
14285     t.tv_sec  = 0;
14286     t.tv_usec = 0;
14287     select(fd + 1, b, 0, 0, &t);
14288     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14289     printf("%d\n", i + 1);
14290     return 0;
14291 }
14292 EOCP
14293                 set try
14294                 if eval $compile_ok; then
14295                         selectminbits=`./try`
14296                         case "$selectminbits" in
14297                         '')     cat >&4 <<EOM
14298 Cannot figure out on how many bits at a time your select() operates.
14299 I'll play safe and guess it is 32 bits.
14300 EOM
14301                                 selectminbits=32
14302                                 bits="32 bits"
14303                                 ;;
14304                         1)      bits="1 bit" ;;
14305                         *)      bits="$selectminbits bits" ;;
14306                         esac
14307                         echo "Your select() operates on $bits at a time." >&4
14308                 else
14309                         rp='What is the minimum number of bits your select() operates on?'
14310                         case "$byteorder" in
14311                         1234|12345678)  dflt=32 ;;
14312                         *)              dflt=1  ;;
14313                         esac
14314                         . ./myread
14315                         val=$ans
14316                         selectminbits="$val"
14317                 fi
14318                 $rm -f try.* try
14319                 ;;
14320         *)      : no select, so pick a harmless default
14321                 selectminbits='32'
14322                 ;;
14323         esac
14324         ;;
14325 esac
14326
14327 : Trace out the files included by signal.h, then look for SIGxxx names.
14328 : Remove SIGARRAYSIZE used by HPUX.
14329 : Remove SIGSTKSIZE used by Linux.
14330 : Remove SIGSTKSZ used by Posix.
14331 : Remove SIGTYP void lines used by OS2.
14332 : Some cpps, like os390, dont give the file name anywhere
14333 if [ "X$fieldn" = X ]; then
14334         : Just make some guesses.  We check them later.
14335         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14336 else
14337         xxx=`echo '#include <signal.h>' |
14338         $cppstdin $cppminus $cppflags 2>/dev/null |
14339         $grep '^[       ]*#.*include' | 
14340         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14341 fi
14342 : Check this list of files to be sure we have parsed the cpp output ok.
14343 : This will also avoid potentially non-existent files, such 
14344 : as ../foo/bar.h
14345 xxxfiles=''
14346 for xx in $xxx /dev/null ; do
14347         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14348 done
14349 : If we have found no files, at least try signal.h
14350 case "$xxxfiles" in
14351 '')     xxxfiles=`./findhdr signal.h` ;;
14352 esac
14353 xxx=`awk '
14354 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14355         print substr($2, 4, 20)
14356 }
14357 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14358         print substr($3, 4, 20)
14359 }' $xxxfiles`
14360 : Append some common names just in case the awk scan failed.
14361 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14362 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14363 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14364 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14365 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14366
14367 : generate a few handy files for later
14368 $cat > signal.c <<'EOCP'
14369 #include <sys/types.h>
14370 #include <signal.h>
14371 #include <stdio.h>
14372 int main() {
14373
14374 /* Strange style to avoid deeply-nested #if/#else/#endif */
14375 #ifndef NSIG
14376 #  ifdef _NSIG
14377 #    define NSIG (_NSIG)
14378 #  endif
14379 #endif
14380
14381 #ifndef NSIG
14382 #  ifdef SIGMAX
14383 #    define NSIG (SIGMAX+1)
14384 #  endif
14385 #endif
14386
14387 #ifndef NSIG
14388 #  ifdef SIG_MAX
14389 #    define NSIG (SIG_MAX+1)
14390 #  endif
14391 #endif
14392
14393 #ifndef NSIG
14394 #  ifdef MAXSIG
14395 #    define NSIG (MAXSIG+1)
14396 #  endif
14397 #endif
14398
14399 #ifndef NSIG
14400 #  ifdef MAX_SIG
14401 #    define NSIG (MAX_SIG+1)
14402 #  endif
14403 #endif
14404
14405 #ifndef NSIG
14406 #  ifdef SIGARRAYSIZE
14407 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14408 #  endif
14409 #endif
14410
14411 #ifndef NSIG
14412 #  ifdef _sys_nsig
14413 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14414 #  endif
14415 #endif
14416
14417 /* Default to some arbitrary number that's big enough to get most
14418    of the common signals.
14419 */
14420 #ifndef NSIG
14421 #    define NSIG 50
14422 #endif
14423
14424 printf("NSIG %d\n", NSIG);
14425
14426 #ifndef JUST_NSIG
14427
14428 EOCP
14429
14430 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14431 {
14432         printf "#ifdef SIG"; printf $1; printf "\n"
14433         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14434         printf $1; printf ");\n"
14435         printf "#endif\n"
14436 }
14437 END {
14438         printf "#endif /* JUST_NSIG */\n";
14439         printf "exit(0);\n}\n";
14440 }
14441 ' >>signal.c
14442 $cat >signal.awk <<'EOP'
14443 BEGIN { ndups = 0 }
14444 $1 ~ /^NSIG$/ { nsig = $2 }
14445 ($1 !~ /^NSIG$/) && (NF == 2) {
14446     if ($2 > maxsig) { maxsig = $2 }
14447     if (sig_name[$2]) {
14448         dup_name[ndups] = $1
14449         dup_num[ndups] = $2
14450         ndups++ 
14451     }
14452     else {
14453         sig_name[$2] = $1
14454         sig_num[$2] = $2
14455     }
14456 }
14457 END { 
14458     if (nsig == 0) {
14459         nsig = maxsig + 1
14460     }
14461     printf("NSIG %d\n", nsig);
14462     for (n = 1; n < nsig; n++) {
14463         if (sig_name[n]) {
14464             printf("%s %d\n", sig_name[n], sig_num[n])
14465         }
14466         else {
14467             printf("NUM%d %d\n", n, n) 
14468         }
14469     }
14470     for (n = 0; n < ndups; n++) {
14471         printf("%s %d\n", dup_name[n], dup_num[n])
14472     }
14473 }
14474 EOP
14475 $cat >signal_cmd <<EOS
14476 $startsh
14477 if $test -s signal.lst; then
14478     echo "Using your existing signal.lst file"
14479         exit 0
14480 fi
14481 xxx="$xxx"
14482 EOS
14483 $cat >>signal_cmd <<'EOS'
14484
14485 set signal
14486 if eval $compile_ok; then
14487         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14488 else
14489         echo "(I can't seem be able to compile the whole test program)" >&4
14490         echo "(I'll try it in little pieces.)" >&4
14491         set signal -DJUST_NSIG
14492         if eval $compile_ok; then
14493                 ./signal$_exe > signal.nsg
14494                 $cat signal.nsg
14495         else
14496                 echo "I can't seem to figure out how many signals you have." >&4
14497                 echo "Guessing 50." >&4
14498                 echo 'NSIG 50' > signal.nsg
14499         fi
14500         : Now look at all the signal names, one at a time.
14501         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14502                 $cat > signal.c <<EOCP
14503 #include <sys/types.h>
14504 #include <signal.h>
14505 #include <stdio.h>
14506 int main() {
14507 printf("$xx %d\n", SIG${xx});
14508 return 0;
14509 }
14510 EOCP
14511                 set signal
14512                 if eval $compile; then
14513                         echo "SIG${xx} found."
14514                         ./signal$_exe  >> signal.ls1
14515                 else
14516                         echo "SIG${xx} NOT found."
14517                 fi
14518         done
14519         if $test -s signal.ls1; then
14520                 $cat signal.nsg signal.ls1 |
14521                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14522         fi
14523
14524 fi
14525 if $test -s signal.lst; then
14526         :
14527 else
14528         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14529         echo 'kill -l' >signal
14530         set X `csh -f <signal`
14531         $rm -f signal
14532         shift
14533         case $# in
14534         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14535         esac
14536         echo $@ | $tr ' ' $trnl | \
14537             $awk '{ printf "%s %d\n", $1, ++s; }
14538                   END { printf "NSIG %d\n", ++s }' >signal.lst
14539 fi
14540 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14541 EOS
14542 chmod a+x signal_cmd
14543 $eunicefix signal_cmd
14544
14545 : generate list of signal names
14546 echo " "
14547 case "$sig_name_init" in
14548 '') doinit=yes ;;
14549 *)  case "$sig_num_init" in
14550     ''|*,*) doinit=yes ;;
14551     esac ;;
14552 esac
14553 case "$doinit" in
14554 yes)
14555         echo "Generating a list of signal names and numbers..." >&4
14556         . ./signal_cmd
14557         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14558         sig_name=`$awk 'BEGIN { printf "ZERO " }
14559                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14560         sig_num=`$awk  'BEGIN { printf "0 " }
14561                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14562         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14563                              !/^NSIG/   { printf "\"%s\", ", $1 }
14564                              END        { printf "0\n" }' signal.lst`
14565         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14566                              !/^NSIG/   { printf "%d, ", $2}
14567                              END        { printf "0\n"}' signal.lst`
14568         ;;
14569 esac
14570 echo "The following $sig_count signals are available:"
14571 echo " "
14572 echo $sig_name | $awk \
14573 'BEGIN { linelen = 0 }
14574 {
14575         for (i = 1; i <= NF; i++) {
14576                 name = "SIG" $i " "
14577                 linelen = linelen + length(name)
14578                 if (linelen > 70) {
14579                         printf "\n"
14580                         linelen = length(name)
14581                 }
14582                 printf "%s", name
14583         }
14584         printf "\n"
14585 }'
14586 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14587
14588 echo " "
14589 case "$sizetype" in
14590 *_t) zzz="$sizetype"    ;;
14591 *)   zzz="filesize"     ;;
14592 esac
14593 echo "Checking the size of $zzz..." >&4 
14594 cat > try.c <<EOCP
14595 #include <sys/types.h>
14596 #include <stdio.h>
14597 int main() {
14598     printf("%d\n", (int)sizeof($sizetype));
14599     exit(0);
14600 }
14601 EOCP
14602 set try
14603 if eval $compile_ok; then
14604         yyy=`./try`
14605         case "$yyy" in
14606         '')     sizesize=4
14607                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14608                 ;;
14609         *)      sizesize=$yyy
14610                 echo "Your $zzz size is $sizesize bytes."
14611                 ;;
14612         esac
14613 else
14614         sizesize=4
14615         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14616 fi
14617
14618
14619 : check for socklen_t
14620 echo " "
14621 echo "Checking to see if you have socklen_t..." >&4
14622 $cat >try.c <<EOCP
14623 #include <sys/types.h>
14624 #$d_socket HAS_SOCKET
14625 #ifdef HAS_SOCKET
14626 #include <sys/socket.h>
14627 #endif
14628 int main() { socklen_t x = 16; }
14629 EOCP
14630 set try
14631 if eval $compile; then
14632         val="$define"
14633         echo "You have socklen_t."
14634 else
14635         val="$undef"
14636         echo "You do not have socklen_t."
14637         case "$sizetype" in
14638         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14639         esac
14640 fi
14641 $rm -f try try.*
14642 set d_socklen_t
14643 eval $setvar
14644
14645 : see if this is a socks.h system
14646 set socks.h i_socks
14647 eval $inhdr
14648
14649 : check for type of the size argument to socket calls
14650 case "$d_socket" in
14651 "$define")
14652         $cat <<EOM
14653
14654 Checking to see what type is the last argument of accept().
14655 EOM
14656         yyy=''
14657         case "$d_socklen_t" in
14658         "$define") yyy="$yyy socklen_t"
14659         esac
14660         yyy="$yyy $sizetype int long unsigned"
14661         for xxx in $yyy; do
14662                 case "$socksizetype" in
14663                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14664                         case "$usesocks" in
14665                         "$define")
14666                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14667                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14668                                         socksizetype="$xxx"
14669                                 fi
14670                                 ;;
14671                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14672                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14673                                         socksizetype="$xxx"
14674                                 fi
14675                                 ;;
14676                         esac
14677                         ;;
14678                 esac
14679         done
14680 : In case none of those worked, prompt the user.
14681         case "$socksizetype" in
14682         '')     rp='What is the type for socket address structure sizes?'
14683                 dflt='int'
14684                 . ./myread
14685                 socksizetype=$ans
14686                 ;;
14687         esac
14688         ;;
14689 *)      : no sockets, so pick relatively harmless default
14690         socksizetype='int'
14691         ;;
14692 esac
14693
14694 : see what type is used for signed size_t
14695 set ssize_t ssizetype int stdio.h sys/types.h
14696 eval $typedef
14697 dflt="$ssizetype"
14698 $cat > ssize.c <<EOM
14699 #include <stdio.h>
14700 #include <sys/types.h>
14701 #define Size_t $sizetype
14702 #define SSize_t $dflt
14703 int main()
14704 {
14705         if (sizeof(Size_t) == sizeof(SSize_t))
14706                 printf("$dflt\n");
14707         else if (sizeof(Size_t) == sizeof(int))
14708                 printf("int\n");
14709         else 
14710                 printf("long\n");
14711         exit(0);
14712 }
14713 EOM
14714 echo " "
14715 set ssize
14716 if eval $compile_ok && ./ssize > /dev/null; then
14717         ssizetype=`./ssize`
14718         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14719 else
14720         $cat >&4 <<EOM
14721 Help! I can't compile and run the ssize_t test program: please enlighten me!
14722 (This is probably a misconfiguration in your system or libraries, and
14723 you really ought to fix it.  Still, I'll try anyway.)
14724
14725 I need a type that is the same size as $sizetype, but is guaranteed to
14726 be signed.  Common values are ssize_t, int and long.
14727
14728 EOM
14729         rp="What signed type is the same size as $sizetype?"
14730         . ./myread
14731         ssizetype="$ans"
14732 fi
14733 $rm -f ssize ssize.*
14734
14735 : see what type of char stdio uses.
14736 echo " "
14737 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14738 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14739         echo "Your stdio uses unsigned chars." >&4
14740         stdchar="unsigned char"
14741 else
14742         echo "Your stdio uses signed chars." >&4
14743         stdchar="char"
14744 fi
14745 $rm -f stdioh
14746
14747
14748
14749 : see if time exists
14750 echo " "
14751 if test "X$d_time" = X -o X"$timetype" = X; then
14752     if set time val -f d_time; eval $csym; $val; then
14753                 echo 'time() found.' >&4
14754                 val="$define"
14755                 rp="What is the type returned by time() on this system?"
14756                 set time_t timetype long stdio.h sys/types.h
14757                 eval $typedef_ask
14758     else
14759                 echo 'time() not found, hope that will do.' >&4
14760                 val="$undef"
14761                 timetype='int';
14762     fi
14763     set d_time
14764     eval $setvar
14765 fi
14766
14767 : see what type uids are declared as in the kernel
14768 echo " "
14769 echo "Looking for the type for user ids returned by getuid()."
14770 set uid_t uidtype xxx stdio.h sys/types.h
14771 eval $typedef
14772 case "$uidtype" in
14773 xxx)
14774         xxx=`./findhdr sys/user.h`
14775         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14776         case $1 in
14777         unsigned) dflt="$1 $2" ;;
14778         *) dflt="$1" ;;
14779         esac
14780         ;;
14781 *) dflt="$uidtype";;
14782 esac
14783 case "$uidtype" in
14784 uid_t)  echo "uid_t found." ;;
14785 *)      rp="What is the type for user ids returned by getuid()?"
14786         . ./myread
14787         uidtype="$ans"
14788         ;;
14789 esac
14790
14791 echo " "
14792 case "$uidtype" in
14793 *_t) zzz="$uidtype"     ;;
14794 *)   zzz="uid"          ;;
14795 esac
14796 echo "Checking the size of $zzz..." >&4 
14797 cat > try.c <<EOCP
14798 #include <sys/types.h>
14799 #include <stdio.h>
14800 int main() {
14801     printf("%d\n", (int)sizeof($uidtype));
14802     exit(0);
14803 }
14804 EOCP
14805 set try
14806 if eval $compile_ok; then
14807         yyy=`./try`
14808         case "$yyy" in
14809         '')     uidsize=4
14810                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14811                 ;;
14812         *)      uidsize=$yyy
14813                 echo "Your $zzz is $uidsize bytes long."
14814                 ;;
14815         esac
14816 else
14817         uidsize=4
14818         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14819 fi
14820
14821 echo " "
14822 case "$uidtype" in
14823 *_t) zzz="$uidtype"     ;;
14824 *)   zzz="uid"          ;;
14825 esac
14826 echo "Checking the sign of $zzz..." >&4
14827 cat > try.c <<EOCP
14828 #include <sys/types.h>
14829 #include <stdio.h>
14830 int main() {
14831         $uidtype foo = -1;
14832         if (foo < 0)
14833                 printf("-1\n");
14834         else
14835                 printf("1\n");
14836 }
14837 EOCP
14838 set try
14839 if eval $compile; then
14840         yyy=`./try`
14841         case "$yyy" in
14842         '')     uidsign=1
14843                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14844                 ;;
14845         *)      uidsign=$yyy
14846                 case "$uidsign" in
14847                  1) echo "Your $zzz is unsigned." ;;
14848                 -1) echo "Your $zzz is signed."   ;;
14849                 esac
14850                 ;;
14851         esac
14852 else
14853         uidsign=1
14854         echo "(I can't compile the test program--guessing unsigned.)" >&4
14855 fi
14856
14857
14858
14859 echo " "
14860 $echo "Checking the format string to be used for uids..." >&4
14861
14862 case "$uidsign" in
14863 -1)     if $test X"$uidsize" = X"$ivsize"; then
14864                 uidformat="$ivdformat"
14865         else
14866                 if $test X"$uidsize" = X"$longsize"; then
14867                         uidformat='"ld"'
14868                 else
14869                         if $test X"$uidsize" = X"$intsize"; then
14870                                 uidformat='"d"'
14871                         else
14872                                 if $test X"$uidsize" = X"$shortsize"; then
14873                                         uidformat='"hd"'
14874                                 fi
14875                         fi
14876                 fi
14877         fi
14878         ;;
14879 *)      if $test X"$uidsize" = X"$uvsize"; then
14880                 uidformat="$uvuformat"
14881         else
14882                 if $test X"$uidsize" = X"$longsize"; then
14883                         uidformat='"lu"'
14884                 else
14885                         if $test X"$uidsize" = X"$intsize"; then
14886                                 uidformat='"u"'
14887                         else
14888                                 if $test X"$uidsize" = X"$shortsize"; then
14889                                         uidformat='"hu"'
14890                                 fi
14891                         fi
14892                 fi
14893         fi
14894         ;;
14895 esac
14896
14897 : see if dbm.h is available
14898 : see if dbmclose exists
14899 set dbmclose d_dbmclose
14900 eval $inlibc
14901
14902 case "$d_dbmclose" in
14903 $define)
14904         set dbm.h i_dbm
14905         eval $inhdr
14906         case "$i_dbm" in
14907         $define)
14908                 val="$undef"
14909                 set i_rpcsvcdbm
14910                 eval $setvar
14911                 ;;
14912         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14913                 eval $inhdr
14914                 ;;
14915         esac
14916         ;;
14917 *)      echo "We won't be including <dbm.h>"
14918         val="$undef"
14919         set i_dbm
14920         eval $setvar
14921         val="$undef"
14922         set i_rpcsvcdbm
14923         eval $setvar
14924         ;;
14925 esac
14926
14927 : see if this is a sys/file.h system
14928 val=''
14929 set sys/file.h val
14930 eval $inhdr
14931
14932 : do we need to include sys/file.h ?
14933 case "$val" in
14934 "$define")
14935         echo " "
14936         if $h_sysfile; then
14937                 val="$define"
14938                 echo "We'll be including <sys/file.h>." >&4
14939         else
14940                 val="$undef"
14941                 echo "We won't be including <sys/file.h>." >&4
14942         fi
14943         ;;
14944 *)
14945         h_sysfile=false
14946         ;;
14947 esac
14948 set i_sysfile
14949 eval $setvar
14950
14951 : see if fcntl.h is there
14952 val=''
14953 set fcntl.h val
14954 eval $inhdr
14955
14956 : see if we can include fcntl.h
14957 case "$val" in
14958 "$define")
14959         echo " "
14960         if $h_fcntl; then
14961                 val="$define"
14962                 echo "We'll be including <fcntl.h>." >&4
14963         else
14964                 val="$undef"
14965                 if $h_sysfile; then
14966         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14967                 else
14968                         echo "We won't be including <fcntl.h>." >&4
14969                 fi
14970         fi
14971         ;;
14972 *)
14973         h_fcntl=false
14974         val="$undef"
14975         ;;
14976 esac
14977 set i_fcntl
14978 eval $setvar
14979
14980 : see if this is a iconv.h system
14981 set iconv.h i_iconv
14982 eval $inhdr
14983
14984 : see if this is a ieeefp.h system
14985 set ieeefp.h i_ieeefp
14986 eval $inhdr
14987
14988 : see if this is a libutil.h system
14989 set libutil.h i_libutil
14990 eval $inhdr
14991
14992 : see if locale.h is available
14993 set locale.h i_locale
14994 eval $inhdr
14995
14996 : see if mach cthreads are available
14997 if test "X$usethreads" = "X$define"; then
14998         set mach/cthreads.h i_machcthr
14999         eval $inhdr
15000 else
15001         i_machcthr="$undef"
15002 fi
15003
15004
15005
15006 : see if this is a math.h system
15007 set math.h i_math
15008 eval $inhdr
15009
15010 : see if this is a mntent.h system
15011 set mntent.h i_mntent
15012 eval $inhdr
15013
15014 : see if ndbm.h is available
15015 set ndbm.h t_ndbm
15016 eval $inhdr
15017 case "$t_ndbm" in
15018 $define)
15019         : see if dbm_open exists
15020         set dbm_open d_dbm_open
15021         eval $inlibc
15022         case "$d_dbm_open" in
15023         $undef)
15024                 t_ndbm="$undef"
15025                 echo "We won't be including <ndbm.h>"
15026                 ;;
15027         esac
15028         ;;
15029 esac
15030 val="$t_ndbm"
15031 set i_ndbm
15032 eval $setvar
15033
15034 : see if net/errno.h is available
15035 val=''
15036 set net/errno.h val
15037 eval $inhdr
15038
15039 : Unfortunately, it causes problems on some systems.  Arrgh.
15040 case "$val" in
15041 $define)
15042         cat > try.c <<'EOM'
15043 #include <stdio.h>
15044 #include <errno.h>
15045 #include <net/errno.h>
15046 int func()
15047 {
15048         return ENOTSOCK;
15049 }
15050 EOM
15051         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15052                 echo "We'll be including <net/errno.h>." >&4
15053         else
15054                 echo "We won't be including <net/errno.h>." >&4
15055                 val="$undef"
15056         fi
15057         $rm -f try.* try
15058         ;;
15059 esac
15060 set i_neterrno
15061 eval $setvar
15062
15063 : see if netinet/tcp.h is available
15064 set netinet/tcp.h i_netinettcp
15065 eval $inhdr
15066
15067 : see if this is a poll.h system
15068 set poll.h i_poll
15069 eval $inhdr
15070
15071 : see if this is a prot.h system
15072 set prot.h i_prot
15073 eval $inhdr
15074
15075 echo " "
15076 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15077 $cat <<'EOSH' > Cppsym.know
15078 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15079 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15080 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15081 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15082 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15083 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15084 bull c cadmus clipper CMU COFF COMPILER_VERSION
15085 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15086 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15087 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15088 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15089 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15090 H3050R H3050RX hbullx20 hcx host_mips
15091 hp200 hp300 hp700 HP700 hp800 hp9000
15092 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15093 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15094 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15095 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15096 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15097 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15098 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15099 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15100 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15101 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15102 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15103 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15104 MATH_HAS_NO_SIDE_EFFECTS
15105 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15106 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15107 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15108 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15109 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15110 NetBSD news1500 news1700 news1800 news1900 news3700
15111 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15112 ns32016 ns32332 ns32k nsc32000
15113 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15114 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15115 pc532 pdp11 PGC PIC plexus PORTAR posix
15116 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15117 POSIX_C_SOURCE POSIX_SOURCE POWER
15118 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15119 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15120 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15121 sony sony_news sonyrisc sparc sparclite spectrum
15122 stardent stdc STDC_EXT stratos sun sun3 sun386
15123 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15124 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15125 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15126 sysV68 sysV88 Tek4132 Tek4300 titan
15127 tower tower32 tower32_200 tower32_600 tower32_700
15128 tower32_800 tower32_850 tss
15129 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15130 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15131 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15132 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15133 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15134 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15135 z8000
15136 EOSH
15137 # Maybe put other stuff here too.
15138 cat <<EOSH >>Cppsym.know
15139 $osname
15140 EOSH
15141 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15142 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15143 $cat Cppsym.know > Cppsym.c
15144 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15145 $rm -f Cppsym.a Cppsym.b Cppsym.c
15146 cat <<EOSH > Cppsym
15147 $startsh
15148 if $test \$# -gt 0; then
15149     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15150     if $test -s Cppsym.got; then
15151         $rm -f Cppsym.got
15152         exit 0
15153     fi
15154     $rm -f Cppsym.got
15155     exit 1
15156 else
15157     $tr " " "$trnl" | ./Cppsym.try
15158     exit 0
15159 fi
15160 EOSH
15161 chmod +x Cppsym
15162 $eunicefix Cppsym
15163 cat <<EOSH > Cppsym.try
15164 $startsh
15165 cat <<'EOCP' > try.c
15166 #include <stdio.h>
15167 int main() {
15168 EOCP
15169 $awk \\
15170 EOSH
15171 cat <<'EOSH' >> Cppsym.try
15172 'length($1) > 0 {
15173     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
15174     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
15175     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
15176     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
15177 }'       >> try.c
15178 echo '}' >> try.c
15179 EOSH
15180 cat <<EOSH >> Cppsym.try
15181 ccflags="$ccflags"
15182 case "$osname-$gccversion" in
15183 irix-) ccflags="\$ccflags -woff 1178" ;;
15184 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15185 esac
15186 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15187 EOSH
15188 chmod +x Cppsym.try
15189 $eunicefix Cppsym.try
15190 ./Cppsym < Cppsym.know > Cppsym.true
15191 : now check the C compiler for additional symbols
15192 postprocess_cc_v=''
15193 case "$osname" in
15194 aix) postprocess_cc_v="|$tr , ' '" ;;
15195 esac
15196 $cat >ccsym <<EOS
15197 $startsh
15198 $cat >tmp.c <<EOF
15199 extern int foo;
15200 EOF
15201 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15202 do
15203         case "\$i" in
15204         -D*) echo "\$i" | $sed 's/^-D//';;
15205         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15206         esac
15207 done
15208 $rm -f try.c
15209 EOS
15210 postprocess_cc_v=''
15211 chmod +x ccsym
15212 $eunicefix ccsym
15213 ./ccsym > ccsym1.raw
15214 if $test -s ccsym1.raw; then
15215        $sort ccsym1.raw | $uniq >ccsym.raw
15216 else
15217        mv ccsym1.raw ccsym.raw
15218 fi
15219
15220 $awk '/\=/ { print $0; next }
15221         { print $0"=1" }' ccsym.raw >ccsym.list
15222 $awk '/\=/ { print $0; next }
15223         { print $0"=1" }' Cppsym.true >ccsym.true
15224 $comm -13 ccsym.true ccsym.list >ccsym.own
15225 $comm -12 ccsym.true ccsym.list >ccsym.com
15226 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15227 also=''
15228 if $test -z ccsym.raw; then
15229         echo "Your C compiler doesn't seem to define any symbols!" >&4
15230         echo " "
15231         echo "However, your C preprocessor defines the following symbols:"
15232         $cat Cppsym.true
15233         ccsymbols=''
15234         cppsymbols=`$cat Cppsym.true`
15235         cppsymbols=`echo $cppsymbols`
15236         cppccsymbols="$cppsymbols"
15237 else
15238         if $test -s ccsym.com; then
15239                 echo "Your C compiler and pre-processor define these symbols:"
15240                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15241                 also='also '
15242                 symbols='ones'
15243                 cppccsymbols=`$cat ccsym.com`
15244                 cppccsymbols=`echo $cppccsymbols`
15245                 $test "$silent" || sleep 1
15246         fi
15247         if $test -s ccsym.cpp; then
15248                 $test "$also" && echo " "
15249                 echo "Your C pre-processor ${also}defines the following symbols:"
15250                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15251                 also='further '
15252                 cppsymbols=`$cat ccsym.cpp`
15253                 cppsymbols=`echo $cppsymbols`
15254                 $test "$silent" || sleep 1
15255         fi
15256         if $test -s ccsym.own; then
15257                 $test "$also" && echo " "
15258                 echo "Your C compiler ${also}defines the following cpp symbols:"
15259                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15260                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15261                 ccsymbols=`$cat ccsym.own`
15262                 ccsymbols=`echo $ccsymbols`
15263                 $test "$silent" || sleep 1
15264         fi
15265 fi
15266 $rm -f ccsym* Cppsym.*
15267
15268 : see if this is a termio system
15269 val="$undef"
15270 val2="$undef"
15271 val3="$undef"
15272 if $test `./findhdr termios.h`; then
15273         set tcsetattr i_termios
15274         eval $inlibc
15275         val3="$i_termios"
15276 fi
15277 echo " "
15278 case "$val3" in
15279 "$define") echo "You have POSIX termios.h... good!" >&4;;
15280 *) if ./Cppsym pyr; then
15281                 case "`/bin/universe`" in
15282                 ucb) if $test `./findhdr sgtty.h`; then
15283                                 val2="$define"
15284                                 echo "<sgtty.h> found." >&4
15285                         else
15286                                 echo "System is pyramid with BSD universe."
15287                                 echo "<sgtty.h> not found--you could have problems." >&4
15288                         fi;;
15289                 *) if $test `./findhdr termio.h`; then
15290                                 val="$define"
15291                                 echo "<termio.h> found." >&4
15292                         else
15293                                 echo "System is pyramid with USG universe."
15294                                 echo "<termio.h> not found--you could have problems." >&4
15295                         fi;;
15296                 esac
15297         elif ./usg; then
15298                 if $test `./findhdr termio.h`; then
15299                         echo "<termio.h> found." >&4
15300                         val="$define"
15301                 elif $test `./findhdr sgtty.h`; then
15302                         echo "<sgtty.h> found." >&4
15303                         val2="$define"
15304                 else
15305 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15306                 fi
15307         else
15308                 if $test `./findhdr sgtty.h`; then
15309                         echo "<sgtty.h> found." >&4
15310                         val2="$define"
15311                 elif $test `./findhdr termio.h`; then
15312                         echo "<termio.h> found." >&4
15313                         val="$define"
15314                 else
15315 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15316                 fi
15317         fi;;
15318 esac
15319 set i_termio; eval $setvar
15320 val=$val2; set i_sgtty; eval $setvar
15321 val=$val3; set i_termios; eval $setvar
15322
15323 : see if this is a shadow.h system
15324 set shadow.h i_shadow
15325 eval $inhdr
15326
15327 : see if stddef is available
15328 set stddef.h i_stddef
15329 eval $inhdr
15330
15331 : see if this is a sunmath.h system
15332 set sunmath.h i_sunmath
15333 eval $inhdr
15334
15335 : see if sys/access.h is available
15336 set sys/access.h i_sysaccess
15337 eval $inhdr
15338
15339 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15340 set sys/filio.h i_sysfilio
15341 eval $inhdr
15342 echo " "
15343 if $test `./findhdr sys/ioctl.h`; then
15344         val="$define"
15345         echo '<sys/ioctl.h> found.' >&4
15346 else
15347         val="$undef"
15348         if $test $i_sysfilio = "$define"; then
15349             echo '<sys/ioctl.h> NOT found.' >&4
15350         else
15351                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15352                 $test $i_termio = "$define" && xxx="termio.h"
15353                 $test $i_termios = "$define" && xxx="termios.h"
15354 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15355         fi
15356 fi
15357 set i_sysioctl
15358 eval $setvar
15359
15360
15361 : see if this is a syslog.h system
15362 set syslog.h i_syslog
15363 eval $inhdr
15364
15365
15366 : see if this is a sys/mode.h system
15367 set sys/mode.h i_sysmode
15368 eval $inhdr
15369
15370 : see if sys/resource.h has to be included
15371 set sys/resource.h i_sysresrc
15372 eval $inhdr
15373
15374 : see if sys/security.h is available
15375 set sys/security.h i_syssecrt
15376 eval $inhdr
15377
15378 : see if this is a sys/statvfs.h system
15379 set sys/statvfs.h i_sysstatvfs
15380 eval $inhdr
15381
15382 : see if this is a sys/uio.h system
15383 set sys/uio.h i_sysuio
15384 eval $inhdr
15385
15386 : see if this is a sys/un.h system
15387 set sys/un.h i_sysun
15388 eval $inhdr
15389
15390
15391 : see if this is a sys/utsname.h system
15392 set sys/utsname.h i_sysutsname
15393 eval $inhdr
15394
15395 : see if this is a syswait system
15396 set sys/wait.h i_syswait
15397 eval $inhdr
15398
15399 : see if this is a ustat.h system
15400 set ustat.h i_ustat
15401 eval $inhdr
15402
15403 : see if this is an utime system
15404 set utime.h i_utime
15405 eval $inhdr
15406
15407 : see if this is a values.h system
15408 set values.h i_values
15409 eval $inhdr
15410
15411 : see if this is a vfork system
15412 case "$d_vfork" in
15413 "$define")
15414         set vfork.h i_vfork
15415         eval $inhdr
15416         ;;
15417 *)
15418         i_vfork="$undef"
15419         ;;
15420 esac
15421
15422 : see if gdbm.h is available
15423 set gdbm.h t_gdbm
15424 eval $inhdr
15425 case "$t_gdbm" in
15426 $define)
15427         : see if gdbm_open exists
15428         set gdbm_open d_gdbm_open
15429         eval $inlibc
15430         case "$d_gdbm_open" in
15431         $undef)
15432                 t_gdbm="$undef"
15433                 echo "We won't be including <gdbm.h>"
15434                 ;;
15435         esac
15436         ;;
15437 esac
15438 val="$t_gdbm"
15439 set i_gdbm
15440 eval $setvar
15441
15442 echo " "
15443 echo "Looking for extensions..." >&4
15444 : If we are using the old config.sh, known_extensions may contain
15445 : old or inaccurate or duplicate values.
15446 known_extensions=''
15447 nonxs_extensions=''
15448 : We do not use find because it might not be available.
15449 : We do not just use MANIFEST because the user may have dropped
15450 : some additional extensions into the source tree and expect them
15451 : to be built.
15452
15453 : Function to recursively find available extensions, ignoring DynaLoader
15454 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15455 find_extensions='
15456     for xxx in *; do
15457        case "$xxx" in
15458            DynaLoader|dynaload) ;;
15459            *)
15460            if $test -f $xxx/$xxx.xs; then
15461                known_extensions="$known_extensions $1$xxx";
15462            elif $test -f $xxx/Makefile.PL; then
15463                nonxs_extensions="$nonxs_extensions $1$xxx";
15464            else
15465                if $test -d $xxx -a $# -lt 10; then
15466                    set $1$xxx/ $*;
15467                    cd $xxx;
15468                    eval $find_extensions;
15469                    cd ..;
15470                    shift;
15471                fi;
15472            fi
15473            ;;
15474        esac;
15475     done'
15476 tdir=`pwd`
15477 cd $rsrc/ext
15478 set X
15479 shift
15480 eval $find_extensions
15481 set X $nonxs_extensions
15482 shift
15483 nonxs_extensions="$*"
15484 set X $known_extensions
15485 shift
15486 known_extensions="$*"
15487 cd $tdir
15488
15489 : Now see which are supported on this system.
15490 avail_ext=''
15491 for xxx in $known_extensions ; do
15492         case "$xxx" in
15493         DB_File|db_file)
15494                 case "$i_db" in
15495                 $define) avail_ext="$avail_ext $xxx" ;;
15496                 esac
15497                 ;;
15498         GDBM_File|gdbm_fil)
15499                 case "$i_gdbm" in 
15500                 $define) avail_ext="$avail_ext $xxx" ;;
15501                 esac
15502                 ;;
15503         NDBM_File|ndbm_fil)
15504                 case "$i_ndbm" in
15505                 $define)
15506                     case "$osname-$use64bitint" in
15507                     hpux-define)
15508                         case "$libs" in
15509                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15510                         esac
15511                         ;;
15512                     *) avail_ext="$avail_ext $xxx" ;;
15513                     esac
15514                     ;;
15515                 esac
15516                 ;;
15517         ODBM_File|odbm_fil) 
15518                 case "${i_dbm}${i_rpcsvcdbm}" in
15519                 *"${define}"*)
15520                     case "$osname-$use64bitint" in
15521                     hpux-define)
15522                         case "$libs" in
15523                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15524                         esac
15525                         ;;
15526                     *) avail_ext="$avail_ext $xxx" ;;
15527                     esac
15528                     ;;
15529                 esac
15530                 ;;
15531         POSIX|posix)
15532                 case "$useposix" in
15533                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15534                 esac
15535                 ;;
15536         Opcode|opcode)
15537                 case "$useopcode" in
15538                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15539                 esac
15540                 ;;
15541         Socket|socket)
15542                 case "$d_socket" in 
15543                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15544                 esac
15545                 ;;
15546         Sys/Syslog|sys/syslog)
15547                 : XXX syslog requires socket
15548                 case "$d_socket" in 
15549                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15550                 esac
15551                 ;;
15552         Thread|thread)
15553                 case "$usethreads" in 
15554                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15555                 esac
15556                 ;;
15557         IPC/SysV|ipc/sysv)
15558                 : XXX Do we need a useipcsysv variable here
15559                 case "${d_msg}${d_sem}${d_shm}" in 
15560                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15561                 esac
15562                 ;;
15563         *)      avail_ext="$avail_ext $xxx"
15564                 ;;
15565         esac
15566 done
15567
15568 set X $avail_ext
15569 shift
15570 avail_ext="$*"
15571
15572 : Now see which nonxs extensions are supported on this system.
15573 : For now assume all are.
15574 nonxs_ext=''
15575 for xxx in $nonxs_extensions ; do
15576         case "$xxx" in
15577         *)      nonxs_ext="$nonxs_ext $xxx"
15578                 ;;
15579         esac
15580 done
15581
15582 set X $nonxs_ext
15583 shift
15584 nonxs_ext="$*"
15585
15586 case $usedl in
15587 $define)
15588         $cat <<EOM
15589 A number of extensions are supplied with $package.  You may choose to
15590 compile these extensions for dynamic loading (the default), compile
15591 them into the $package executable (static loading), or not include
15592 them at all.  Answer "none" to include no extensions.
15593 Note that DynaLoader is always built and need not be mentioned here.
15594
15595 EOM
15596         case "$dynamic_ext" in
15597         '') dflt="$avail_ext" ;;
15598         *)      dflt="$dynamic_ext"
15599                 # Perhaps we are reusing an old out-of-date config.sh.
15600                 case "$hint" in
15601                 previous)
15602                         if test X"$dynamic_ext" != X"$avail_ext"; then
15603                                 $cat <<EOM
15604 NOTICE:  Your previous config.sh list may be incorrect. 
15605 The extensions now available to you are 
15606         ${avail_ext}
15607 but the default list from your previous config.sh is
15608         ${dynamic_ext} 
15609
15610 EOM
15611                         fi
15612                         ;;
15613                 esac
15614                 ;;
15615         esac
15616         case "$dflt" in
15617         '')     dflt=none;;
15618         esac
15619         rp="What extensions do you wish to load dynamically?"
15620         . ./myread
15621         case "$ans" in
15622         none) dynamic_ext=' ' ;;
15623         *) dynamic_ext="$ans" ;;
15624         esac
15625
15626         case "$static_ext" in
15627         '')
15628                 : Exclude those already listed in dynamic linking
15629                 dflt=''
15630                 for xxx in $avail_ext; do
15631                         case " $dynamic_ext " in
15632                         *" $xxx "*) ;;
15633                         *) dflt="$dflt $xxx" ;;
15634                         esac
15635                 done
15636                 set X $dflt
15637                 shift
15638                 dflt="$*"
15639                 ;;
15640         *)  dflt="$static_ext" 
15641                 ;;
15642         esac
15643
15644         case "$dflt" in
15645         '')     dflt=none;;
15646         esac
15647         rp="What extensions do you wish to load statically?"
15648         . ./myread
15649         case "$ans" in
15650         none) static_ext=' ' ;;
15651         *) static_ext="$ans" ;;
15652         esac
15653         ;;
15654 *)
15655         $cat <<EOM
15656 A number of extensions are supplied with $package.  Answer "none" 
15657 to include no extensions. 
15658 Note that DynaLoader is always built and need not be mentioned here.
15659
15660 EOM
15661         case "$static_ext" in
15662         '') dflt="$avail_ext" ;;
15663         *)      dflt="$static_ext"
15664                 # Perhaps we are reusing an old out-of-date config.sh.
15665                 case "$hint" in
15666                 previous)
15667                         if test X"$static_ext" != X"$avail_ext"; then
15668                                 $cat <<EOM
15669 NOTICE:  Your previous config.sh list may be incorrect. 
15670 The extensions now available to you are 
15671         ${avail_ext}
15672 but the default list from your previous config.sh is
15673         ${static_ext} 
15674
15675 EOM
15676                         fi
15677                         ;;
15678                 esac
15679                 ;;
15680         esac
15681         : Exclude those that are not xs extensions
15682         case "$dflt" in
15683         '')     dflt=none;;
15684         esac
15685         rp="What extensions do you wish to include?"
15686         . ./myread
15687         case "$ans" in
15688         none) static_ext=' ' ;;
15689         *) static_ext="$ans" ;;
15690         esac
15691         ;;
15692 esac
15693
15694 set X $dynamic_ext $static_ext $nonxs_ext
15695 shift
15696 extensions="$*"
15697
15698 : Remove libraries needed only for extensions
15699 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15700 : The exception is SunOS 4.x, which needs them.
15701 case "${osname}X${osvers}" in
15702 sunos*X4*)
15703     perllibs="$libs"
15704     ;;
15705 *) case "$usedl" in
15706     $define|true|[yY]*)
15707             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15708             shift
15709             perllibs="$*"
15710             ;;
15711     *)  perllibs="$libs"
15712             ;;
15713     esac
15714     ;;
15715 esac
15716
15717 : Remove build directory name from cppstdin so it can be used from
15718 : either the present location or the final installed location.
15719 echo " "
15720 : Get out of the UU directory to get correct path name.
15721 cd ..
15722 case "$cppstdin" in
15723 `pwd`/cppstdin)
15724         echo "Stripping down cppstdin path name"
15725         cppstdin=cppstdin
15726         ;;
15727 esac
15728 cd UU
15729
15730 : end of configuration questions
15731 echo " "
15732 echo "End of configuration questions."
15733 echo " "
15734
15735 : back to where it started
15736 if test -d ../UU; then
15737         cd ..
15738 fi
15739
15740 : configuration may be patched via a 'config.over' file
15741 if $test -f config.over; then
15742         echo " "
15743         dflt=y
15744         rp='I see a config.over file.  Do you wish to load it?'
15745         . UU/myread
15746         case "$ans" in
15747         n*) echo "OK, I'll ignore it.";;
15748         *)      . ./config.over
15749                 echo "Configuration override changes have been loaded."
15750                 ;;
15751         esac
15752 fi
15753
15754 : in case they want portability, strip down executable paths
15755 case "$d_portable" in
15756 "$define")
15757         echo " "
15758         echo "Stripping down executable paths..." >&4
15759         for file in $loclist $trylist; do
15760                 eval temp=\$$file
15761                 eval $file=`basename $temp`
15762         done
15763         ;;
15764 esac
15765
15766 : create config.sh file
15767 echo " "
15768 echo "Creating config.sh..." >&4
15769 $spitshell <<EOT >config.sh
15770 $startsh
15771 #
15772 # This file was produced by running the Configure script. It holds all the
15773 # definitions figured out by Configure. Should you modify one of these values,
15774 # do not forget to propagate your changes by running "Configure -der". You may
15775 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15776 #
15777
15778 # Package name      : $package
15779 # Source directory  : $src
15780 # Configuration time: $cf_time
15781 # Configured by     : $cf_by
15782 # Target system     : $myuname
15783
15784 Author='$Author'
15785 Date='$Date'
15786 Header='$Header'
15787 Id='$Id'
15788 Locker='$Locker'
15789 Log='$Log'
15790 Mcc='$Mcc'
15791 RCSfile='$RCSfile'
15792 Revision='$Revision'
15793 Source='$Source'
15794 State='$State'
15795 _a='$_a'
15796 _exe='$_exe'
15797 _o='$_o'
15798 afs='$afs'
15799 alignbytes='$alignbytes'
15800 ansi2knr='$ansi2knr'
15801 aphostname='$aphostname'
15802 api_revision='$api_revision'
15803 api_subversion='$api_subversion'
15804 api_version='$api_version'
15805 api_versionstring='$api_versionstring'
15806 ar='$ar'
15807 archlib='$archlib'
15808 archlibexp='$archlibexp'
15809 archname64='$archname64'
15810 archname='$archname'
15811 archobjs='$archobjs'
15812 awk='$awk'
15813 baserev='$baserev'
15814 bash='$bash'
15815 bin='$bin'
15816 bincompat5005='$bincompat5005'
15817 binexp='$binexp'
15818 bison='$bison'
15819 byacc='$byacc'
15820 byteorder='$byteorder'
15821 c='$c'
15822 castflags='$castflags'
15823 cat='$cat'
15824 cc='$cc'
15825 cccdlflags='$cccdlflags'
15826 ccdlflags='$ccdlflags'
15827 ccflags='$ccflags'
15828 ccflags_uselargefiles='$ccflags_uselargefiles'
15829 ccname='$ccname'
15830 ccsymbols='$ccsymbols'
15831 ccversion='$ccversion'
15832 cf_by='$cf_by'
15833 cf_email='$cf_email'
15834 cf_time='$cf_time'
15835 charsize='$charsize'
15836 chgrp='$chgrp'
15837 chmod='$chmod'
15838 chown='$chown'
15839 clocktype='$clocktype'
15840 comm='$comm'
15841 compress='$compress'
15842 contains='$contains'
15843 cp='$cp'
15844 cpio='$cpio'
15845 cpp='$cpp'
15846 cpp_stuff='$cpp_stuff'
15847 cppccsymbols='$cppccsymbols'
15848 cppflags='$cppflags'
15849 cpplast='$cpplast'
15850 cppminus='$cppminus'
15851 cpprun='$cpprun'
15852 cppstdin='$cppstdin'
15853 cppsymbols='$cppsymbols'
15854 crosscompile='$crosscompile'
15855 cryptlib='$cryptlib'
15856 csh='$csh'
15857 d_Gconvert='$d_Gconvert'
15858 d_PRIEUldbl='$d_PRIEUldbl'
15859 d_PRIFUldbl='$d_PRIFUldbl'
15860 d_PRIGUldbl='$d_PRIGUldbl'
15861 d_PRIXU64='$d_PRIXU64'
15862 d_PRId64='$d_PRId64'
15863 d_PRIeldbl='$d_PRIeldbl'
15864 d_PRIfldbl='$d_PRIfldbl'
15865 d_PRIgldbl='$d_PRIgldbl'
15866 d_PRIi64='$d_PRIi64'
15867 d_PRIo64='$d_PRIo64'
15868 d_PRIu64='$d_PRIu64'
15869 d_PRIx64='$d_PRIx64'
15870 d_SCNfldbl='$d_SCNfldbl'
15871 d__fwalk='$d__fwalk'
15872 d_access='$d_access'
15873 d_accessx='$d_accessx'
15874 d_alarm='$d_alarm'
15875 d_archlib='$d_archlib'
15876 d_atolf='$d_atolf'
15877 d_atoll='$d_atoll'
15878 d_attribut='$d_attribut'
15879 d_bcmp='$d_bcmp'
15880 d_bcopy='$d_bcopy'
15881 d_bincompat5005='$d_bincompat5005'
15882 d_bsd='$d_bsd'
15883 d_bsdgetpgrp='$d_bsdgetpgrp'
15884 d_bsdsetpgrp='$d_bsdsetpgrp'
15885 d_bzero='$d_bzero'
15886 d_casti32='$d_casti32'
15887 d_castneg='$d_castneg'
15888 d_charvspr='$d_charvspr'
15889 d_chown='$d_chown'
15890 d_chroot='$d_chroot'
15891 d_chsize='$d_chsize'
15892 d_closedir='$d_closedir'
15893 d_const='$d_const'
15894 d_crypt='$d_crypt'
15895 d_csh='$d_csh'
15896 d_cuserid='$d_cuserid'
15897 d_dbl_dig='$d_dbl_dig'
15898 d_difftime='$d_difftime'
15899 d_dirnamlen='$d_dirnamlen'
15900 d_dlerror='$d_dlerror'
15901 d_dlopen='$d_dlopen'
15902 d_dlsymun='$d_dlsymun'
15903 d_dosuid='$d_dosuid'
15904 d_drand48proto='$d_drand48proto'
15905 d_dup2='$d_dup2'
15906 d_eaccess='$d_eaccess'
15907 d_endgrent='$d_endgrent'
15908 d_endhent='$d_endhent'
15909 d_endnent='$d_endnent'
15910 d_endpent='$d_endpent'
15911 d_endpwent='$d_endpwent'
15912 d_endsent='$d_endsent'
15913 d_eofnblk='$d_eofnblk'
15914 d_eunice='$d_eunice'
15915 d_fchmod='$d_fchmod'
15916 d_fchown='$d_fchown'
15917 d_fcntl='$d_fcntl'
15918 d_fcntl_can_lock='$d_fcntl_can_lock'
15919 d_fd_macros='$d_fd_macros'
15920 d_fd_set='$d_fd_set'
15921 d_fds_bits='$d_fds_bits'
15922 d_fgetpos='$d_fgetpos'
15923 d_flexfnam='$d_flexfnam'
15924 d_flock='$d_flock'
15925 d_fork='$d_fork'
15926 d_fpathconf='$d_fpathconf'
15927 d_fpos64_t='$d_fpos64_t'
15928 d_frexpl='$d_frexpl'
15929 d_fs_data_s='$d_fs_data_s'
15930 d_fseeko='$d_fseeko'
15931 d_fsetpos='$d_fsetpos'
15932 d_fstatfs='$d_fstatfs'
15933 d_fstatvfs='$d_fstatvfs'
15934 d_fsync='$d_fsync'
15935 d_ftello='$d_ftello'
15936 d_ftime='$d_ftime'
15937 d_getcwd='$d_getcwd'
15938 d_getespwnam='$d_getespwnam'
15939 d_getfsstat='$d_getfsstat'
15940 d_getgrent='$d_getgrent'
15941 d_getgrps='$d_getgrps'
15942 d_gethbyaddr='$d_gethbyaddr'
15943 d_gethbyname='$d_gethbyname'
15944 d_gethent='$d_gethent'
15945 d_gethname='$d_gethname'
15946 d_gethostprotos='$d_gethostprotos'
15947 d_getlogin='$d_getlogin'
15948 d_getmnt='$d_getmnt'
15949 d_getmntent='$d_getmntent'
15950 d_getnbyaddr='$d_getnbyaddr'
15951 d_getnbyname='$d_getnbyname'
15952 d_getnent='$d_getnent'
15953 d_getnetprotos='$d_getnetprotos'
15954 d_getpagsz='$d_getpagsz'
15955 d_getpbyname='$d_getpbyname'
15956 d_getpbynumber='$d_getpbynumber'
15957 d_getpent='$d_getpent'
15958 d_getpgid='$d_getpgid'
15959 d_getpgrp2='$d_getpgrp2'
15960 d_getpgrp='$d_getpgrp'
15961 d_getppid='$d_getppid'
15962 d_getprior='$d_getprior'
15963 d_getprotoprotos='$d_getprotoprotos'
15964 d_getprpwnam='$d_getprpwnam'
15965 d_getpwent='$d_getpwent'
15966 d_getsbyname='$d_getsbyname'
15967 d_getsbyport='$d_getsbyport'
15968 d_getsent='$d_getsent'
15969 d_getservprotos='$d_getservprotos'
15970 d_getspnam='$d_getspnam'
15971 d_gettimeod='$d_gettimeod'
15972 d_gnulibc='$d_gnulibc'
15973 d_grpasswd='$d_grpasswd'
15974 d_hasmntopt='$d_hasmntopt'
15975 d_htonl='$d_htonl'
15976 d_iconv='$d_iconv'
15977 d_index='$d_index'
15978 d_inetaton='$d_inetaton'
15979 d_int64_t='$d_int64_t'
15980 d_isascii='$d_isascii'
15981 d_isnan='$d_isnan'
15982 d_isnanl='$d_isnanl'
15983 d_killpg='$d_killpg'
15984 d_lchown='$d_lchown'
15985 d_ldbl_dig='$d_ldbl_dig'
15986 d_link='$d_link'
15987 d_locconv='$d_locconv'
15988 d_lockf='$d_lockf'
15989 d_longdbl='$d_longdbl'
15990 d_longlong='$d_longlong'
15991 d_lseekproto='$d_lseekproto'
15992 d_lstat='$d_lstat'
15993 d_madvise='$d_madvise'
15994 d_mblen='$d_mblen'
15995 d_mbstowcs='$d_mbstowcs'
15996 d_mbtowc='$d_mbtowc'
15997 d_memchr='$d_memchr'
15998 d_memcmp='$d_memcmp'
15999 d_memcpy='$d_memcpy'
16000 d_memmove='$d_memmove'
16001 d_memset='$d_memset'
16002 d_mkdir='$d_mkdir'
16003 d_mkdtemp='$d_mkdtemp'
16004 d_mkfifo='$d_mkfifo'
16005 d_mkstemp='$d_mkstemp'
16006 d_mkstemps='$d_mkstemps'
16007 d_mktime='$d_mktime'
16008 d_mmap='$d_mmap'
16009 d_modfl='$d_modfl'
16010 d_mprotect='$d_mprotect'
16011 d_msg='$d_msg'
16012 d_msg_ctrunc='$d_msg_ctrunc'
16013 d_msg_dontroute='$d_msg_dontroute'
16014 d_msg_oob='$d_msg_oob'
16015 d_msg_peek='$d_msg_peek'
16016 d_msg_proxy='$d_msg_proxy'
16017 d_msgctl='$d_msgctl'
16018 d_msgget='$d_msgget'
16019 d_msgrcv='$d_msgrcv'
16020 d_msgsnd='$d_msgsnd'
16021 d_msync='$d_msync'
16022 d_munmap='$d_munmap'
16023 d_mymalloc='$d_mymalloc'
16024 d_nice='$d_nice'
16025 d_nv_preserves_uv='$d_nv_preserves_uv'
16026 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16027 d_off64_t='$d_off64_t'
16028 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16029 d_oldpthreads='$d_oldpthreads'
16030 d_oldsock='$d_oldsock'
16031 d_open3='$d_open3'
16032 d_pathconf='$d_pathconf'
16033 d_pause='$d_pause'
16034 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16035 d_phostname='$d_phostname'
16036 d_pipe='$d_pipe'
16037 d_poll='$d_poll'
16038 d_portable='$d_portable'
16039 d_pthread_yield='$d_pthread_yield'
16040 d_pwage='$d_pwage'
16041 d_pwchange='$d_pwchange'
16042 d_pwclass='$d_pwclass'
16043 d_pwcomment='$d_pwcomment'
16044 d_pwexpire='$d_pwexpire'
16045 d_pwgecos='$d_pwgecos'
16046 d_pwpasswd='$d_pwpasswd'
16047 d_pwquota='$d_pwquota'
16048 d_qgcvt='$d_qgcvt'
16049 d_quad='$d_quad'
16050 d_readdir='$d_readdir'
16051 d_readlink='$d_readlink'
16052 d_rename='$d_rename'
16053 d_rewinddir='$d_rewinddir'
16054 d_rmdir='$d_rmdir'
16055 d_safebcpy='$d_safebcpy'
16056 d_safemcpy='$d_safemcpy'
16057 d_sanemcmp='$d_sanemcmp'
16058 d_sbrkproto='$d_sbrkproto'
16059 d_sched_yield='$d_sched_yield'
16060 d_scm_rights='$d_scm_rights'
16061 d_seekdir='$d_seekdir'
16062 d_select='$d_select'
16063 d_sem='$d_sem'
16064 d_semctl='$d_semctl'
16065 d_semctl_semid_ds='$d_semctl_semid_ds'
16066 d_semctl_semun='$d_semctl_semun'
16067 d_semget='$d_semget'
16068 d_semop='$d_semop'
16069 d_setegid='$d_setegid'
16070 d_seteuid='$d_seteuid'
16071 d_setgrent='$d_setgrent'
16072 d_setgrps='$d_setgrps'
16073 d_sethent='$d_sethent'
16074 d_setlinebuf='$d_setlinebuf'
16075 d_setlocale='$d_setlocale'
16076 d_setnent='$d_setnent'
16077 d_setpent='$d_setpent'
16078 d_setpgid='$d_setpgid'
16079 d_setpgrp2='$d_setpgrp2'
16080 d_setpgrp='$d_setpgrp'
16081 d_setprior='$d_setprior'
16082 d_setproctitle='$d_setproctitle'
16083 d_setpwent='$d_setpwent'
16084 d_setregid='$d_setregid'
16085 d_setresgid='$d_setresgid'
16086 d_setresuid='$d_setresuid'
16087 d_setreuid='$d_setreuid'
16088 d_setrgid='$d_setrgid'
16089 d_setruid='$d_setruid'
16090 d_setsent='$d_setsent'
16091 d_setsid='$d_setsid'
16092 d_setvbuf='$d_setvbuf'
16093 d_sfio='$d_sfio'
16094 d_shm='$d_shm'
16095 d_shmat='$d_shmat'
16096 d_shmatprototype='$d_shmatprototype'
16097 d_shmctl='$d_shmctl'
16098 d_shmdt='$d_shmdt'
16099 d_shmget='$d_shmget'
16100 d_sigaction='$d_sigaction'
16101 d_sigprocmask='$d_sigprocmask'
16102 d_sigsetjmp='$d_sigsetjmp'
16103 d_socket='$d_socket'
16104 d_socklen_t='$d_socklen_t'
16105 d_sockpair='$d_sockpair'
16106 d_socks5_init='$d_socks5_init'
16107 d_sqrtl='$d_sqrtl'
16108 d_statblks='$d_statblks'
16109 d_statfs_f_flags='$d_statfs_f_flags'
16110 d_statfs_s='$d_statfs_s'
16111 d_statvfs='$d_statvfs'
16112 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16113 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16114 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16115 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16116 d_stdio_stream_array='$d_stdio_stream_array'
16117 d_stdiobase='$d_stdiobase'
16118 d_stdstdio='$d_stdstdio'
16119 d_strchr='$d_strchr'
16120 d_strcoll='$d_strcoll'
16121 d_strctcpy='$d_strctcpy'
16122 d_strerrm='$d_strerrm'
16123 d_strerror='$d_strerror'
16124 d_strtod='$d_strtod'
16125 d_strtol='$d_strtol'
16126 d_strtold='$d_strtold'
16127 d_strtoll='$d_strtoll'
16128 d_strtoq='$d_strtoq'
16129 d_strtoul='$d_strtoul'
16130 d_strtoull='$d_strtoull'
16131 d_strtouq='$d_strtouq'
16132 d_strxfrm='$d_strxfrm'
16133 d_suidsafe='$d_suidsafe'
16134 d_symlink='$d_symlink'
16135 d_syscall='$d_syscall'
16136 d_sysconf='$d_sysconf'
16137 d_sysernlst='$d_sysernlst'
16138 d_syserrlst='$d_syserrlst'
16139 d_system='$d_system'
16140 d_tcgetpgrp='$d_tcgetpgrp'
16141 d_tcsetpgrp='$d_tcsetpgrp'
16142 d_telldir='$d_telldir'
16143 d_telldirproto='$d_telldirproto'
16144 d_time='$d_time'
16145 d_times='$d_times'
16146 d_truncate='$d_truncate'
16147 d_tzname='$d_tzname'
16148 d_umask='$d_umask'
16149 d_uname='$d_uname'
16150 d_union_semun='$d_union_semun'
16151 d_ustat='$d_ustat'
16152 d_vendorarch='$d_vendorarch'
16153 d_vendorbin='$d_vendorbin'
16154 d_vendorlib='$d_vendorlib'
16155 d_vfork='$d_vfork'
16156 d_void_closedir='$d_void_closedir'
16157 d_voidsig='$d_voidsig'
16158 d_voidtty='$d_voidtty'
16159 d_volatile='$d_volatile'
16160 d_vprintf='$d_vprintf'
16161 d_wait4='$d_wait4'
16162 d_waitpid='$d_waitpid'
16163 d_wcstombs='$d_wcstombs'
16164 d_wctomb='$d_wctomb'
16165 d_xenix='$d_xenix'
16166 date='$date'
16167 db_hashtype='$db_hashtype'
16168 db_prefixtype='$db_prefixtype'
16169 defvoidused='$defvoidused'
16170 direntrytype='$direntrytype'
16171 dlext='$dlext'
16172 dlsrc='$dlsrc'
16173 doublesize='$doublesize'
16174 drand01='$drand01'
16175 dynamic_ext='$dynamic_ext'
16176 eagain='$eagain'
16177 ebcdic='$ebcdic'
16178 echo='$echo'
16179 egrep='$egrep'
16180 emacs='$emacs'
16181 eunicefix='$eunicefix'
16182 exe_ext='$exe_ext'
16183 expr='$expr'
16184 extensions='$extensions'
16185 fflushNULL='$fflushNULL'
16186 fflushall='$fflushall'
16187 find='$find'
16188 firstmakefile='$firstmakefile'
16189 flex='$flex'
16190 fpossize='$fpossize'
16191 fpostype='$fpostype'
16192 freetype='$freetype'
16193 full_ar='$full_ar'
16194 full_csh='$full_csh'
16195 full_sed='$full_sed'
16196 gccosandvers='$gccosandvers'
16197 gccversion='$gccversion'
16198 gidformat='$gidformat'
16199 gidsign='$gidsign'
16200 gidsize='$gidsize'
16201 gidtype='$gidtype'
16202 glibpth='$glibpth'
16203 grep='$grep'
16204 groupcat='$groupcat'
16205 groupstype='$groupstype'
16206 gzip='$gzip'
16207 h_fcntl='$h_fcntl'
16208 h_sysfile='$h_sysfile'
16209 hint='$hint'
16210 hostcat='$hostcat'
16211 i16size='$i16size'
16212 i16type='$i16type'
16213 i32size='$i32size'
16214 i32type='$i32type'
16215 i64size='$i64size'
16216 i64type='$i64type'
16217 i8size='$i8size'
16218 i8type='$i8type'
16219 i_arpainet='$i_arpainet'
16220 i_bsdioctl='$i_bsdioctl'
16221 i_db='$i_db'
16222 i_dbm='$i_dbm'
16223 i_dirent='$i_dirent'
16224 i_dld='$i_dld'
16225 i_dlfcn='$i_dlfcn'
16226 i_fcntl='$i_fcntl'
16227 i_features='$i_features'
16228 i_float='$i_float'
16229 i_gdbm='$i_gdbm'
16230 i_grp='$i_grp'
16231 i_iconv='$i_iconv'
16232 i_ieeefp='$i_ieeefp'
16233 i_inttypes='$i_inttypes'
16234 i_libutil='$i_libutil'
16235 i_limits='$i_limits'
16236 i_locale='$i_locale'
16237 i_machcthr='$i_machcthr'
16238 i_malloc='$i_malloc'
16239 i_math='$i_math'
16240 i_memory='$i_memory'
16241 i_mntent='$i_mntent'
16242 i_ndbm='$i_ndbm'
16243 i_netdb='$i_netdb'
16244 i_neterrno='$i_neterrno'
16245 i_netinettcp='$i_netinettcp'
16246 i_niin='$i_niin'
16247 i_poll='$i_poll'
16248 i_prot='$i_prot'
16249 i_pthread='$i_pthread'
16250 i_pwd='$i_pwd'
16251 i_rpcsvcdbm='$i_rpcsvcdbm'
16252 i_sfio='$i_sfio'
16253 i_sgtty='$i_sgtty'
16254 i_shadow='$i_shadow'
16255 i_socks='$i_socks'
16256 i_stdarg='$i_stdarg'
16257 i_stddef='$i_stddef'
16258 i_stdlib='$i_stdlib'
16259 i_string='$i_string'
16260 i_sunmath='$i_sunmath'
16261 i_sysaccess='$i_sysaccess'
16262 i_sysdir='$i_sysdir'
16263 i_sysfile='$i_sysfile'
16264 i_sysfilio='$i_sysfilio'
16265 i_sysin='$i_sysin'
16266 i_sysioctl='$i_sysioctl'
16267 i_syslog='$i_syslog'
16268 i_sysmman='$i_sysmman'
16269 i_sysmode='$i_sysmode'
16270 i_sysmount='$i_sysmount'
16271 i_sysndir='$i_sysndir'
16272 i_sysparam='$i_sysparam'
16273 i_sysresrc='$i_sysresrc'
16274 i_syssecrt='$i_syssecrt'
16275 i_sysselct='$i_sysselct'
16276 i_syssockio='$i_syssockio'
16277 i_sysstat='$i_sysstat'
16278 i_sysstatfs='$i_sysstatfs'
16279 i_sysstatvfs='$i_sysstatvfs'
16280 i_systime='$i_systime'
16281 i_systimek='$i_systimek'
16282 i_systimes='$i_systimes'
16283 i_systypes='$i_systypes'
16284 i_sysuio='$i_sysuio'
16285 i_sysun='$i_sysun'
16286 i_sysutsname='$i_sysutsname'
16287 i_sysvfs='$i_sysvfs'
16288 i_syswait='$i_syswait'
16289 i_termio='$i_termio'
16290 i_termios='$i_termios'
16291 i_time='$i_time'
16292 i_unistd='$i_unistd'
16293 i_ustat='$i_ustat'
16294 i_utime='$i_utime'
16295 i_values='$i_values'
16296 i_varargs='$i_varargs'
16297 i_varhdr='$i_varhdr'
16298 i_vfork='$i_vfork'
16299 ignore_versioned_solibs='$ignore_versioned_solibs'
16300 inc_version_list='$inc_version_list'
16301 inc_version_list_init='$inc_version_list_init'
16302 incpath='$incpath'
16303 inews='$inews'
16304 installarchlib='$installarchlib'
16305 installbin='$installbin'
16306 installman1dir='$installman1dir'
16307 installman3dir='$installman3dir'
16308 installprefix='$installprefix'
16309 installprefixexp='$installprefixexp'
16310 installprivlib='$installprivlib'
16311 installscript='$installscript'
16312 installsitearch='$installsitearch'
16313 installsitebin='$installsitebin'
16314 installsitelib='$installsitelib'
16315 installstyle='$installstyle'
16316 installusrbinperl='$installusrbinperl'
16317 installvendorarch='$installvendorarch'
16318 installvendorbin='$installvendorbin'
16319 installvendorlib='$installvendorlib'
16320 intsize='$intsize'
16321 issymlink='$issymlink'
16322 ivdformat='$ivdformat'
16323 ivsize='$ivsize'
16324 ivtype='$ivtype'
16325 known_extensions='$known_extensions'
16326 ksh='$ksh'
16327 ld='$ld'
16328 lddlflags='$lddlflags'
16329 ldflags='$ldflags'
16330 ldflags_uselargefiles='$ldflags_uselargefiles'
16331 ldlibpthname='$ldlibpthname'
16332 less='$less'
16333 lib_ext='$lib_ext'
16334 libc='$libc'
16335 libperl='$libperl'
16336 libpth='$libpth'
16337 libs='$libs'
16338 libsdirs='$libsdirs'
16339 libsfiles='$libsfiles'
16340 libsfound='$libsfound'
16341 libspath='$libspath'
16342 libswanted='$libswanted'
16343 libswanted_uselargefiles='$libswanted_uselargefiles'
16344 line='$line'
16345 lint='$lint'
16346 lkflags='$lkflags'
16347 ln='$ln'
16348 lns='$lns'
16349 locincpth='$locincpth'
16350 loclibpth='$loclibpth'
16351 longdblsize='$longdblsize'
16352 longlongsize='$longlongsize'
16353 longsize='$longsize'
16354 lp='$lp'
16355 lpr='$lpr'
16356 ls='$ls'
16357 lseeksize='$lseeksize'
16358 lseektype='$lseektype'
16359 mail='$mail'
16360 mailx='$mailx'
16361 make='$make'
16362 make_set_make='$make_set_make'
16363 mallocobj='$mallocobj'
16364 mallocsrc='$mallocsrc'
16365 malloctype='$malloctype'
16366 man1dir='$man1dir'
16367 man1direxp='$man1direxp'
16368 man1ext='$man1ext'
16369 man3dir='$man3dir'
16370 man3direxp='$man3direxp'
16371 man3ext='$man3ext'
16372 mips_type='$mips_type'
16373 mkdir='$mkdir'
16374 mmaptype='$mmaptype'
16375 modetype='$modetype'
16376 more='$more'
16377 multiarch='$multiarch'
16378 mv='$mv'
16379 myarchname='$myarchname'
16380 mydomain='$mydomain'
16381 myhostname='$myhostname'
16382 myuname='$myuname'
16383 n='$n'
16384 need_va_copy='$need_va_copy'
16385 netdb_hlen_type='$netdb_hlen_type'
16386 netdb_host_type='$netdb_host_type'
16387 netdb_name_type='$netdb_name_type'
16388 netdb_net_type='$netdb_net_type'
16389 nm='$nm'
16390 nm_opt='$nm_opt'
16391 nm_so_opt='$nm_so_opt'
16392 nonxs_ext='$nonxs_ext'
16393 nroff='$nroff'
16394 nvEUformat='$nvEUformat'
16395 nvFUformat='$nvFUformat'
16396 nvGUformat='$nvGUformat'
16397 nveformat='$nveformat'
16398 nvfformat='$nvfformat'
16399 nvgformat='$nvgformat'
16400 nvsize='$nvsize'
16401 nvtype='$nvtype'
16402 o_nonblock='$o_nonblock'
16403 obj_ext='$obj_ext'
16404 old_pthread_create_joinable='$old_pthread_create_joinable'
16405 optimize='$optimize'
16406 orderlib='$orderlib'
16407 osname='$osname'
16408 osvers='$osvers'
16409 otherlibdirs='$otherlibdirs'
16410 package='$package'
16411 pager='$pager'
16412 passcat='$passcat'
16413 patchlevel='$patchlevel'
16414 path_sep='$path_sep'
16415 perl5='$perl5'
16416 perl='$perl'
16417 perladmin='$perladmin'
16418 perllibs='$perllibs'
16419 perlpath='$perlpath'
16420 pg='$pg'
16421 phostname='$phostname'
16422 pidtype='$pidtype'
16423 plibpth='$plibpth'
16424 pm_apiversion='$pm_apiversion'
16425 pmake='$pmake'
16426 pr='$pr'
16427 prefix='$prefix'
16428 prefixexp='$prefixexp'
16429 privlib='$privlib'
16430 privlibexp='$privlibexp'
16431 prototype='$prototype'
16432 ptrsize='$ptrsize'
16433 quadkind='$quadkind'
16434 quadtype='$quadtype'
16435 randbits='$randbits'
16436 randfunc='$randfunc'
16437 randseedtype='$randseedtype'
16438 ranlib='$ranlib'
16439 rd_nodata='$rd_nodata'
16440 revision='$revision'
16441 rm='$rm'
16442 rmail='$rmail'
16443 runnm='$runnm'
16444 sPRIEUldbl='$sPRIEUldbl'
16445 sPRIFUldbl='$sPRIFUldbl'
16446 sPRIGUldbl='$sPRIGUldbl'
16447 sPRIXU64='$sPRIXU64'
16448 sPRId64='$sPRId64'
16449 sPRIeldbl='$sPRIeldbl'
16450 sPRIfldbl='$sPRIfldbl'
16451 sPRIgldbl='$sPRIgldbl'
16452 sPRIi64='$sPRIi64'
16453 sPRIo64='$sPRIo64'
16454 sPRIu64='$sPRIu64'
16455 sPRIx64='$sPRIx64'
16456 sSCNfldbl='$sSCNfldbl'
16457 sched_yield='$sched_yield'
16458 scriptdir='$scriptdir'
16459 scriptdirexp='$scriptdirexp'
16460 sed='$sed'
16461 seedfunc='$seedfunc'
16462 selectminbits='$selectminbits'
16463 selecttype='$selecttype'
16464 sendmail='$sendmail'
16465 sh='$sh'
16466 shar='$shar'
16467 sharpbang='$sharpbang'
16468 shmattype='$shmattype'
16469 shortsize='$shortsize'
16470 shrpenv='$shrpenv'
16471 shsharp='$shsharp'
16472 sig_count='$sig_count'
16473 sig_name='$sig_name'
16474 sig_name_init='$sig_name_init'
16475 sig_num='$sig_num'
16476 sig_num_init='$sig_num_init'
16477 signal_t='$signal_t'
16478 sitearch='$sitearch'
16479 sitearchexp='$sitearchexp'
16480 sitebin='$sitebin'
16481 sitebinexp='$sitebinexp'
16482 sitelib='$sitelib'
16483 sitelib_stem='$sitelib_stem'
16484 sitelibexp='$sitelibexp'
16485 siteprefix='$siteprefix'
16486 siteprefixexp='$siteprefixexp'
16487 sizesize='$sizesize'
16488 sizetype='$sizetype'
16489 sleep='$sleep'
16490 smail='$smail'
16491 so='$so'
16492 sockethdr='$sockethdr'
16493 socketlib='$socketlib'
16494 socksizetype='$socksizetype'
16495 sort='$sort'
16496 spackage='$spackage'
16497 spitshell='$spitshell'
16498 src='$src'
16499 ssizetype='$ssizetype'
16500 startperl='$startperl'
16501 startsh='$startsh'
16502 static_ext='$static_ext'
16503 stdchar='$stdchar'
16504 stdio_base='$stdio_base'
16505 stdio_bufsiz='$stdio_bufsiz'
16506 stdio_cnt='$stdio_cnt'
16507 stdio_filbuf='$stdio_filbuf'
16508 stdio_ptr='$stdio_ptr'
16509 stdio_stream_array='$stdio_stream_array'
16510 strings='$strings'
16511 submit='$submit'
16512 subversion='$subversion'
16513 sysman='$sysman'
16514 tail='$tail'
16515 tar='$tar'
16516 tbl='$tbl'
16517 tee='$tee'
16518 test='$test'
16519 timeincl='$timeincl'
16520 timetype='$timetype'
16521 touch='$touch'
16522 tr='$tr'
16523 trnl='$trnl'
16524 troff='$troff'
16525 u16size='$u16size'
16526 u16type='$u16type'
16527 u32size='$u32size'
16528 u32type='$u32type'
16529 u64size='$u64size'
16530 u64type='$u64type'
16531 u8size='$u8size'
16532 u8type='$u8type'
16533 uidformat='$uidformat'
16534 uidsign='$uidsign'
16535 uidsize='$uidsize'
16536 uidtype='$uidtype'
16537 uname='$uname'
16538 uniq='$uniq'
16539 uquadtype='$uquadtype'
16540 use5005threads='$use5005threads'
16541 use64bitall='$use64bitall'
16542 use64bitint='$use64bitint'
16543 usedl='$usedl'
16544 useithreads='$useithreads'
16545 uselargefiles='$uselargefiles'
16546 uselongdouble='$uselongdouble'
16547 usemorebits='$usemorebits'
16548 usemultiplicity='$usemultiplicity'
16549 usemymalloc='$usemymalloc'
16550 usenm='$usenm'
16551 useopcode='$useopcode'
16552 useperlio='$useperlio'
16553 useposix='$useposix'
16554 usesfio='$usesfio'
16555 useshrplib='$useshrplib'
16556 usesocks='$usesocks'
16557 usethreads='$usethreads'
16558 usevendorprefix='$usevendorprefix'
16559 usevfork='$usevfork'
16560 usrinc='$usrinc'
16561 uuname='$uuname'
16562 uvXUformat='$uvXUformat'
16563 uvoformat='$uvoformat'
16564 uvsize='$uvsize'
16565 uvtype='$uvtype'
16566 uvuformat='$uvuformat'
16567 uvxformat='$uvxformat'
16568 vendorarch='$vendorarch'
16569 vendorarchexp='$vendorarchexp'
16570 vendorbin='$vendorbin'
16571 vendorbinexp='$vendorbinexp'
16572 vendorlib='$vendorlib'
16573 vendorlib_stem='$vendorlib_stem'
16574 vendorlibexp='$vendorlibexp'
16575 vendorprefix='$vendorprefix'
16576 vendorprefixexp='$vendorprefixexp'
16577 version='$version'
16578 versiononly='$versiononly'
16579 vi='$vi'
16580 voidflags='$voidflags'
16581 xlibpth='$xlibpth'
16582 xs_apiversion='$xs_apiversion'
16583 zcat='$zcat'
16584 zip='$zip'
16585 EOT
16586
16587 : Add in command line options if available
16588 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16589
16590 : add special variables
16591 $test -f $src/patchlevel.h && \
16592 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16593 echo "CONFIGDOTSH=true" >>config.sh
16594
16595 : propagate old symbols
16596 if $test -f UU/config.sh; then
16597         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16598         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16599         $sort | $uniq -u >UU/oldsyms
16600         set X `cat UU/oldsyms`
16601         shift
16602         case $# in
16603         0) ;;
16604         *)
16605                 cat <<EOM
16606 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16607 EOM
16608                 echo "# Variables propagated from previous config.sh file." >>config.sh
16609                 for sym in `cat UU/oldsyms`; do
16610                         echo "    Propagating $hint variable "'$'"$sym..."
16611                         eval 'tmp="$'"${sym}"'"'
16612                         echo "$tmp" | \
16613                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16614                 done
16615                 ;;
16616         esac
16617 fi
16618
16619 : Finish up by extracting the .SH files
16620 case "$alldone" in
16621 exit)
16622         $rm -rf UU
16623         echo "Done."
16624         exit 0
16625         ;;
16626 cont)
16627         ;;
16628 '')
16629         dflt=''
16630         nostick=true
16631         $cat <<EOM
16632
16633 If you'd like to make any changes to the config.sh file before I begin
16634 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16635
16636 EOM
16637         rp="Press return or use a shell escape to edit config.sh:"
16638         . UU/myread
16639         nostick=''
16640         case "$ans" in
16641         '') ;;
16642         *) : in case they cannot read
16643                 sh 1>&4 -c "$ans";;
16644         esac
16645         ;;
16646 esac
16647
16648 : if this fails, just run all the .SH files by hand
16649 . ./config.sh
16650
16651 echo " "
16652 exec 1>&4
16653 . ./UU/extract
16654
16655 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16656         dflt=y
16657         case "$silent" in
16658         true) ;;
16659         *)
16660                 $cat <<EOM
16661
16662 Now you need to generate make dependencies by running "$make depend".
16663 You might prefer to run it in background: "$make depend > makedepend.out &"
16664 It can take a while, so you might not want to run it right now.
16665
16666 EOM
16667                 ;;
16668         esac
16669         rp="Run $make depend now?"
16670         . UU/myread
16671         case "$ans" in
16672         y*)
16673                 $make depend && echo "Now you must run '$make'."
16674                 ;;
16675         *)
16676                 echo "You must run '$make depend' then '$make'."
16677                 ;;
16678         esac
16679 elif test -f [Mm]akefile; then
16680         echo " "
16681         echo "Now you must run a $make."
16682 else
16683         echo "Done."
16684 fi
16685
16686 if $test -f Policy.sh; then
16687     $cat <<EOM
16688
16689 If you compile $package on a different machine or from a different object
16690 directory, copy the Policy.sh file from this object directory to the
16691 new one before you run Configure -- this will help you with most of
16692 the policy defaults.
16693
16694 EOM
16695 fi
16696 if $test -f config.msg; then
16697     echo "Hmm.  I also noted the following information while running:"
16698     echo " "
16699     $cat config.msg >&4
16700     $rm -f config.msg
16701 fi
16702 $rm -f kit*isdone ark*isdone
16703 $rm -rf UU
16704
16705 : End of Configure
16706