ea1ecc028a20349ed8c67bed07763fed60486ef6
[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 Sat Feb  3 18:13:59 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_float=''
635 i_gdbm=''
636 d_grpasswd=''
637 i_grp=''
638 i_iconv=''
639 i_ieeefp=''
640 i_inttypes=''
641 i_libutil=''
642 i_limits=''
643 i_locale=''
644 i_machcthr=''
645 i_malloc=''
646 i_math=''
647 i_memory=''
648 i_mntent=''
649 i_ndbm=''
650 i_netdb=''
651 i_neterrno=''
652 i_netinettcp=''
653 i_niin=''
654 i_sysin=''
655 i_poll=''
656 i_prot=''
657 i_pthread=''
658 d_pwage=''
659 d_pwchange=''
660 d_pwclass=''
661 d_pwcomment=''
662 d_pwexpire=''
663 d_pwgecos=''
664 d_pwpasswd=''
665 d_pwquota=''
666 i_pwd=''
667 i_sfio=''
668 i_shadow=''
669 i_socks=''
670 i_stddef=''
671 i_stdlib=''
672 i_string=''
673 strings=''
674 i_sunmath=''
675 i_sysaccess=''
676 i_sysdir=''
677 i_sysfile=''
678 d_voidtty=''
679 i_bsdioctl=''
680 i_sysfilio=''
681 i_sysioctl=''
682 i_syssockio=''
683 i_syslog=''
684 i_sysmman=''
685 i_sysmode=''
686 i_sysmount=''
687 i_sysndir=''
688 i_sysparam=''
689 i_sysresrc=''
690 i_syssecrt=''
691 i_sysselct=''
692 i_sysstat=''
693 i_sysstatfs=''
694 i_sysstatvfs=''
695 i_systimes=''
696 i_systypes=''
697 i_sysuio=''
698 i_sysun=''
699 i_sysutsname=''
700 i_sysvfs=''
701 i_syswait=''
702 i_sgtty=''
703 i_termio=''
704 i_termios=''
705 i_systime=''
706 i_systimek=''
707 i_time=''
708 timeincl=''
709 i_unistd=''
710 i_ustat=''
711 i_utime=''
712 i_values=''
713 i_stdarg=''
714 i_varargs=''
715 i_varhdr=''
716 i_vfork=''
717 inc_version_list=''
718 inc_version_list_init=''
719 installprefix=''
720 installprefixexp=''
721 installstyle=''
722 installusrbinperl=''
723 intsize=''
724 longsize=''
725 shortsize=''
726 issymlink=''
727 libc=''
728 ldlibpthname=''
729 libperl=''
730 shrpenv=''
731 useshrplib=''
732 glibpth=''
733 libpth=''
734 loclibpth=''
735 plibpth=''
736 xlibpth=''
737 ignore_versioned_solibs=''
738 libs=''
739 libsdirs=''
740 libsfiles=''
741 libsfound=''
742 libspath=''
743 lns=''
744 d_PRIEUldbl=''
745 d_PRIFUldbl=''
746 d_PRIGUldbl=''
747 d_PRIeldbl=''
748 d_PRIfldbl=''
749 d_PRIgldbl=''
750 d_SCNfldbl=''
751 sPRIEUldbl=''
752 sPRIFUldbl=''
753 sPRIGUldbl=''
754 sPRIeldbl=''
755 sPRIfldbl=''
756 sPRIgldbl=''
757 sSCNfldbl=''
758 lseeksize=''
759 lseektype=''
760 make_set_make=''
761 d_mymalloc=''
762 freetype=''
763 mallocobj=''
764 mallocsrc=''
765 malloctype=''
766 usemymalloc=''
767 installman1dir=''
768 man1dir=''
769 man1direxp=''
770 man1ext=''
771 installman3dir=''
772 man3dir=''
773 man3direxp=''
774 man3ext=''
775 modetype=''
776 multiarch=''
777 mydomain=''
778 myhostname=''
779 phostname=''
780 c=''
781 n=''
782 d_eofnblk=''
783 eagain=''
784 o_nonblock=''
785 rd_nodata=''
786 need_va_copy=''
787 netdb_hlen_type=''
788 netdb_host_type=''
789 netdb_name_type=''
790 netdb_net_type=''
791 groupcat=''
792 hostcat=''
793 passcat=''
794 orderlib=''
795 ranlib=''
796 d_perl_otherlibdirs=''
797 otherlibdirs=''
798 package=''
799 spackage=''
800 pager=''
801 api_revision=''
802 api_subversion=''
803 api_version=''
804 api_versionstring=''
805 patchlevel=''
806 revision=''
807 subversion=''
808 version=''
809 perl5=''
810 perladmin=''
811 perlpath=''
812 d_nv_preserves_uv=''
813 d_nv_preserves_uv_bits=''
814 i16size=''
815 i16type=''
816 i32size=''
817 i32type=''
818 i64size=''
819 i64type=''
820 i8size=''
821 i8type=''
822 ivsize=''
823 ivtype=''
824 nvsize=''
825 nvtype=''
826 u16size=''
827 u16type=''
828 u32size=''
829 u32type=''
830 u64size=''
831 u64type=''
832 u8size=''
833 u8type=''
834 uvsize=''
835 uvtype=''
836 ivdformat=''
837 nvEUformat=''
838 nvFUformat=''
839 nvGUformat=''
840 nveformat=''
841 nvfformat=''
842 nvgformat=''
843 uvXUformat=''
844 uvoformat=''
845 uvuformat=''
846 uvxformat=''
847 pidtype=''
848 prefix=''
849 prefixexp=''
850 installprivlib=''
851 privlib=''
852 privlibexp=''
853 prototype=''
854 ptrsize=''
855 d_PRIXU64=''
856 d_PRId64=''
857 d_PRIi64=''
858 d_PRIo64=''
859 d_PRIu64=''
860 d_PRIx64=''
861 sPRIXU64=''
862 sPRId64=''
863 sPRIi64=''
864 sPRIo64=''
865 sPRIu64=''
866 sPRIx64=''
867 d_quad=''
868 quadkind=''
869 quadtype=''
870 uquadtype=''
871 drand01=''
872 randbits=''
873 randfunc=''
874 randseedtype=''
875 seedfunc=''
876 installscript=''
877 scriptdir=''
878 scriptdirexp=''
879 selectminbits=''
880 selecttype=''
881 sh=''
882 sig_count=''
883 sig_name=''
884 sig_name_init=''
885 sig_num=''
886 sig_num_init=''
887 sig_size=''
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                 test=test
2068                 _test=test
2069         fi
2070         ;;
2071 esac
2072 case "$echo" in
2073 echo)
2074         echo "Hopefully echo is built into your sh."
2075         ;;
2076 '') ;;
2077 *)
2078         echo " "
2079 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2080         $echo $n "hi there$c" >foo1
2081         echo $n "hi there$c" >foo2
2082         if cmp foo1 foo2 >/dev/null 2>&1; then
2083                 echo "They are compatible.  In fact, they may be identical."
2084         else
2085                 case "$n" in
2086                 '-n') n='' c='\c';;
2087                 *) n='-n' c='';;
2088                 esac
2089                 cat <<FOO
2090 They are not compatible!  You are probably running ksh on a non-USG system.
2091 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2092 have echo built in and we may have to run some Bourne shell scripts.  That
2093 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2094
2095 FOO
2096                 $echo $n "The star should be here-->$c"
2097                 $echo "*"
2098         fi
2099         $rm -f foo1 foo2
2100         ;;
2101 esac
2102
2103 cat <<EOS >checkcc
2104 $startsh
2105 EOS
2106 cat <<'EOSC' >>checkcc
2107 case "$cc" in
2108 '') ;;
2109 *)  $rm -f try try.*
2110     $cat >try.c <<EOM
2111 int main(int argc, char *argv[]) {
2112   return 0;
2113 }
2114 EOM
2115     if $cc -o try $ccflags try.c; then
2116        :
2117     else
2118         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2119         despair=yes
2120         trygcc=yes
2121         case "$cc" in
2122         *gcc*) trygcc=no ;;
2123         esac
2124         case "`$cc -v -c try.c 2>&1`" in
2125         *gcc*) trygcc=no ;;
2126         esac
2127         if $test X"$trygcc" = Xyes; then
2128             if gcc -o try -c try.c; then
2129                 echo " "
2130                 echo "You seem to have a working gcc, though." >&4
2131                 rp="Would you like to use it?"
2132                 dflt=y
2133                 if $test -f myread; then
2134                     . ./myread
2135                 else
2136                     if $test -f UU/myread; then
2137                         . ./UU/myread
2138                     else
2139                         echo "Cannot find myread, sorry.  Aborting." >&2
2140                         exit 1
2141                     fi
2142                 fi  
2143                 case "$ans" in
2144                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2145                 esac
2146             fi
2147         fi
2148         if $test X"$despair" = Xyes; then
2149             $cat >&4 <<EOM
2150 You need to find a working C compiler.
2151 Either (purchase and) install the C compiler supplied by your OS vendor,
2152 or for a free C compiler try http://gcc.gnu.org/
2153 I cannot continue any further, aborting.
2154 EOM
2155             exit 1
2156         fi
2157     fi
2158     $rm -f try try.*
2159     ;;
2160 esac
2161 EOSC
2162
2163 : determine whether symbolic links are supported
2164 echo " "
2165 $touch blurfl
2166 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2167         echo "Symbolic links are supported." >&4
2168         lns="$ln -s"
2169 else
2170         echo "Symbolic links are NOT supported." >&4
2171         lns="$ln"
2172 fi
2173 $rm -f blurfl sym
2174
2175 : determine whether symbolic links are supported
2176 echo " "
2177 case "$lns" in
2178 *"ln -s")
2179         echo "Checking how to test for symbolic links..." >&4
2180         $lns blurfl sym
2181         if $test "X$issymlink" = X; then
2182                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2183                 if test $? = 0; then
2184                         issymlink="test -h"
2185                 fi              
2186         fi
2187         if $test "X$issymlink" = X; then
2188                 if  $test -h >/dev/null 2>&1; then
2189                         issymlink="$test -h"
2190                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2191                 fi              
2192         fi
2193         if $test "X$issymlink" = X; then
2194                 if $test -L sym 2>/dev/null; then
2195                         issymlink="$test -L"
2196                 fi
2197         fi
2198         if $test "X$issymlink" != X; then
2199                 echo "You can test for symbolic links with '$issymlink'." >&4
2200         else
2201                 echo "I do not know how you can test for symbolic links." >&4
2202         fi
2203         $rm -f blurfl sym
2204         ;;
2205 *)      echo "No symbolic links, so not testing for their testing..." >&4
2206         ;;
2207 esac
2208 echo " "
2209
2210
2211 case "$mksymlinks" in
2212 $define|true|[yY]*)
2213         case "$src" in
2214         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2215                 exit 1
2216                 ;;
2217         *)      case "$lns:$issymlink" in
2218                 *"ln -s:"*"test -"?)
2219                         echo "Creating the symbolic links..." >&4
2220                         echo "(First creating the subdirectories...)" >&4
2221                         cd ..
2222                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2223                                 read directory
2224                                 test -z "$directory" && break
2225                                 mkdir -p $directory
2226                         done
2227                         # Sanity check 1.
2228                         if test ! -d t/base; then
2229                                 echo "Failed to create the subdirectories.  Aborting." >&4
2230                                 exit 1
2231                         fi
2232                         echo "(Then creating the symlinks...)" >&4
2233                         awk '{print $1}' $src/MANIFEST | while true; do
2234                                 read filename
2235                                 test -z "$filename" && break
2236                                 if test -f $filename; then
2237                                         if $issymlink $filename; then
2238                                                 rm -f $filename
2239                                         fi
2240                                 fi
2241                                 if test -f $filename; then
2242                                         echo "$filename already exists, not symlinking."
2243                                 else
2244                                         ln -s $src/$filename $filename
2245                                 fi
2246                         done
2247                         # Sanity check 2.
2248                         if test ! -f t/base/commonsense.t; then
2249                                 echo "Failed to create the symlinks.  Aborting." >&4
2250                                 exit 1
2251                         fi
2252                         cd UU
2253                         ;;
2254                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2255                         ;;
2256                 esac
2257                 ;;
2258         esac
2259         ;;
2260 esac
2261
2262 : see whether [:lower:] and [:upper:] are supported character classes
2263 echo " "
2264 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2265 ABYZ)
2266         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2267         up='[:upper:]'
2268         low='[:lower:]'
2269         ;;
2270 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2271         # (0xc9 and 0xd1), therefore that is a nice testing point.
2272         if test "X$up" = X -o "X$low" = X; then
2273             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2274             ij) up='[A-Z]'
2275                 low='[a-z]'
2276                 ;;
2277             esac
2278         fi
2279         if test "X$up" = X -o "X$low" = X; then
2280             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2281             ij) up='A-Z'
2282                 low='a-z'
2283                 ;;
2284             esac
2285         fi
2286         if test "X$up" = X -o "X$low" = X; then
2287             case "`echo IJ | od -x 2>/dev/null`" in
2288             *C9D1*|*c9d1*)
2289                 echo "Hey, this might be EBCDIC." >&4
2290                 if test "X$up" = X -o "X$low" = X; then
2291                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2292                     ij) up='[A-IJ-RS-Z]'
2293                         low='[a-ij-rs-z]'
2294                         ;;
2295                     esac
2296                 fi
2297                 if test "X$up" = X -o "X$low" = X; then
2298                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2299                     ij) up='A-IJ-RS-Z'
2300                         low='a-ij-rs-z'
2301                         ;;
2302                     esac
2303                 fi
2304                 ;;
2305             esac
2306         fi
2307 esac
2308 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2309 ij)
2310     echo "Using $up and $low to convert case." >&4
2311     ;;
2312 *)
2313     echo "I don't know how to translate letters from upper to lower case." >&4
2314     echo "Your tr is not acting any way I know of." >&4
2315     exit 1
2316     ;;
2317 esac
2318 : set up the translation script tr, must be called with ./tr of course
2319 cat >tr <<EOSC
2320 $startsh
2321 case "\$1\$2" in
2322 '[A-Z][a-z]') exec $tr '$up' '$low';;
2323 '[a-z][A-Z]') exec $tr '$low' '$up';;
2324 esac
2325 exec $tr "\$@"
2326 EOSC
2327 chmod +x tr
2328 $eunicefix tr
2329
2330 : Try to determine whether config.sh was made on this system
2331 case "$config_sh" in
2332 '')
2333 myuname=`$uname -a 2>/dev/null`
2334 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2335 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2336 # because the A-Z/a-z are not consecutive.
2337 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2338         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2339 newmyuname="$myuname"
2340 dflt=n
2341 case "$knowitall" in
2342 '')
2343         if test -f ../config.sh; then
2344                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2345                         eval "`grep myuname= ../config.sh`"
2346                 fi
2347                 if test "X$myuname" = "X$newmyuname"; then
2348                         dflt=y
2349                 fi
2350         fi
2351         ;;
2352 *) dflt=y;;
2353 esac
2354
2355 : Get old answers from old config file if Configure was run on the
2356 : same system, otherwise use the hints.
2357 hint=default
2358 cd ..
2359 if test -f config.sh; then
2360         echo " "
2361         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2362         . UU/myread
2363         case "$ans" in
2364         n*|N*) echo "OK, I'll ignore it."
2365                 mv config.sh config.sh.old
2366                 myuname="$newmyuname"
2367                 ;;
2368         *)  echo "Fetching default answers from your old config.sh file..." >&4
2369                 tmp_n="$n"
2370                 tmp_c="$c"
2371                 tmp_sh="$sh"
2372                 . ./config.sh
2373                 cp config.sh UU
2374                 n="$tmp_n"
2375                 c="$tmp_c"
2376                 : Older versions did not always set $sh.  Catch re-use of such
2377                 : an old config.sh.
2378                 case "$sh" in
2379                 '') sh="$tmp_sh" ;;
2380                 esac
2381                 hint=previous
2382                 ;;
2383         esac
2384 fi
2385 . ./UU/checkcc
2386 if test ! -f config.sh; then
2387         $cat <<EOM
2388
2389 First time through, eh?  I have some defaults handy for some systems
2390 that need some extra help getting the Configure answers right:
2391
2392 EOM
2393         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2394         dflt=''
2395         : Half the following guesses are probably wrong... If you have better
2396         : tests or hints, please send them to perlbug@perl.org
2397         : The metaconfig authors would also appreciate a copy...
2398         $test -f /irix && osname=irix
2399         $test -f /xenix && osname=sco_xenix
2400         $test -f /dynix && osname=dynix
2401         $test -f /dnix && osname=dnix
2402         $test -f /lynx.os && osname=lynxos
2403         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2404         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2405         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2406         $test -f /bin/mips && /bin/mips && osname=mips
2407         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2408                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2409         $test -d /usr/apollo/bin && osname=apollo
2410         $test -f /etc/saf/_sactab && osname=svr4
2411         $test -d /usr/include/minix && osname=minix
2412         if $test -d /MachTen -o -d /MachTen_Folder; then
2413                 osname=machten
2414                 if $test -x /sbin/version; then
2415                         osvers=`/sbin/version | $awk '{print $2}' |
2416                         $sed -e 's/[A-Za-z]$//'`
2417                 elif $test -x /usr/etc/version; then
2418                         osvers=`/usr/etc/version | $awk '{print $2}' |
2419                         $sed -e 's/[A-Za-z]$//'`
2420                 else
2421                         osvers="$2.$3"
2422                 fi
2423         fi
2424
2425         $test -f /sys/posix.dll &&
2426                 $test -f /usr/bin/what &&
2427                 set X `/usr/bin/what /sys/posix.dll` &&
2428                 $test "$3" = UWIN &&
2429                 osname=uwin &&
2430                 osvers="$5"
2431
2432         if $test -f $uname; then
2433                 set X $myuname
2434                 shift
2435
2436                 case "$5" in
2437                 fps*) osname=fps ;;
2438                 mips*)
2439                         case "$4" in
2440                         umips) osname=umips ;;
2441                         *) osname=mips ;;
2442                         esac;;
2443                 [23]100) osname=mips ;;
2444                 next*) osname=next ;;
2445                 i386*)
2446                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2447                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2448                                 osname='sco'
2449                                 osvers=$tmp
2450                         elif $test -f /etc/kconfig; then
2451                                 osname=isc
2452                                 if test "$lns" = "$ln -s"; then
2453                                         osvers=4
2454                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2455                                         osvers=3
2456                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2457                                         osvers=2
2458                                 fi
2459                         fi
2460                         tmp=''
2461                         ;;
2462                 pc*)
2463                         if test -n "$DJGPP"; then
2464                                 osname=dos
2465                                 osvers=djgpp
2466                         fi
2467                         ;;
2468                 esac
2469
2470                 case "$1" in
2471                 aix) osname=aix
2472                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2473                         case "$tmp" in
2474                         'not found') osvers="$4"."$3" ;;
2475                         '<3240'|'<>3240') osvers=3.2.0 ;;
2476                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2477                         '=3250'|'>3250') osvers=3.2.5 ;;
2478                         *) osvers=$tmp;;
2479                         esac
2480                         ;;
2481                 bsd386) osname=bsd386
2482                         osvers=`$uname -r`
2483                         ;;
2484                 cygwin*) osname=cygwin
2485                         osvers="$3"
2486                         ;;
2487                 *dc.osx) osname=dcosx
2488                         osvers="$3"
2489                         ;;
2490                 dnix) osname=dnix
2491                         osvers="$3"
2492                         ;;
2493                 domainos) osname=apollo
2494                         osvers="$3"
2495                         ;;
2496                 dgux) osname=dgux 
2497                         osvers="$3"
2498                         ;;
2499                 dynixptx*) osname=dynixptx
2500                         osvers=`echo "$4"|sed 's/^v//'`
2501                         ;;
2502                 freebsd) osname=freebsd 
2503                         osvers="$3" ;;
2504                 genix) osname=genix ;;
2505                 hp*) osname=hpux 
2506                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2507                         ;;
2508                 irix*) osname=irix
2509                         case "$3" in
2510                         4*) osvers=4 ;;
2511                         5*) osvers=5 ;;
2512                         *)      osvers="$3" ;;
2513                         esac
2514                         ;;
2515                 linux) osname=linux
2516                         case "$3" in
2517                         *)      osvers="$3" ;;
2518                         esac
2519                         ;;
2520                 MiNT) osname=mint
2521                         ;;
2522                 netbsd*) osname=netbsd
2523                         osvers="$3"
2524                         ;;
2525                 news-os) osvers="$3"
2526                         case "$3" in
2527                         4*) osname=newsos4 ;;
2528                         *) osname=newsos ;;
2529                         esac
2530                         ;;
2531                 next*) osname=next ;;
2532                 nonstop-ux) osname=nonstopux ;;
2533                 POSIX-BC | posix-bc ) osname=posix-bc
2534                         osvers="$3"
2535                         ;;
2536                 powerux | power_ux | powermax_os | powermaxos | \
2537                 powerunix | power_unix) osname=powerux
2538                         osvers="$3"
2539                         ;;
2540                 qnx) osname=qnx
2541                         osvers="$4"
2542                         ;;
2543                 solaris) osname=solaris
2544                         case "$3" in
2545                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2546                         *)      osvers="$3" ;;
2547                         esac
2548                         ;;
2549                 sunos) osname=sunos
2550                         case "$3" in
2551                         5*) osname=solaris
2552                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2553                         *)      osvers="$3" ;;
2554                         esac
2555                         ;;
2556                 titanos) osname=titanos
2557                         case "$3" in
2558                         1*) osvers=1 ;;
2559                         2*) osvers=2 ;;
2560                         3*) osvers=3 ;;
2561                         4*) osvers=4 ;;
2562                         *)      osvers="$3" ;;
2563                         esac
2564                         ;;
2565                 ultrix) osname=ultrix
2566                         osvers="$3"
2567                         ;;
2568                 osf1|mls+)      case "$5" in
2569                                 alpha)
2570                                         osname=dec_osf
2571                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2572                                         case "$osvers" in
2573                                         [1-9].[0-9]*) ;;
2574                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2575                                         esac
2576                                         ;;
2577                         hp*)    osname=hp_osf1  ;;
2578                         mips)   osname=mips_osf1 ;;
2579                         esac
2580                         ;;
2581                 unixware) osname=svr5
2582                         osvers="$4"
2583                         ;;
2584                 uts) osname=uts
2585                         osvers="$3"
2586                         ;;
2587                 $2) case "$osname" in
2588                         *isc*) ;;
2589                         *freebsd*) ;;
2590                         svr*)
2591                                 : svr4.x or possibly later
2592                                 case "svr$3" in 
2593                                 ${osname}*)
2594                                         osname=svr$3
2595                                         osvers=$4
2596                                         ;;
2597                                 esac
2598                                 case "$osname" in
2599                                 svr4.0)
2600                                         : Check for ESIX
2601                                         if test -f /stand/boot ; then
2602                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2603                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2604                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2605                                                         if test -n "$isesix"; then
2606                                                                 osname=esix4
2607                                                         fi
2608                                                 fi
2609                                         fi
2610                                         ;;
2611                                 esac
2612                                 ;;
2613                         *)      if test -f /etc/systemid; then
2614                                         osname=sco
2615                                         set `echo $3 | $sed 's/\./ /g'` $4
2616                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2617                                                 osvers=$1.$2.$3
2618                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2619                                                 osvers=$1.$2
2620                                         elif $test -f $src/hints/sco_$1.sh; then
2621                                                 osvers=$1
2622                                         fi
2623                                 else
2624                                         case "$osname" in
2625                                         '') : Still unknown.  Probably a generic Sys V.
2626                                                 osname="sysv"
2627                                                 osvers="$3"
2628                                                 ;;
2629                                         esac
2630                                 fi
2631                                 ;;
2632                         esac
2633                         ;;
2634                 *)      case "$osname" in
2635                         '') : Still unknown.  Probably a generic BSD.
2636                                 osname="$1"
2637                                 osvers="$3"
2638                                 ;;
2639                         esac
2640                         ;;
2641                 esac
2642         else
2643                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2644                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2645                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2646                                 osname=news_os
2647                         fi
2648                         $rm -f UU/kernel.what
2649                 elif test -d c:/.; then
2650                         set X $myuname
2651                         osname=os2
2652                         osvers="$5"
2653                 fi
2654         fi
2655         
2656         : Now look for a hint file osname_osvers, unless one has been
2657         : specified already.
2658         case "$hintfile" in
2659         ''|' ')
2660                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2661                 : Also try without trailing minor version numbers.
2662                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2663                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2664                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2665                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2666                 case "$file" in
2667                 '') dflt=none ;;
2668                 *)  case "$osvers" in
2669                         '') dflt=$file
2670                                 ;;
2671                         *)  if $test -f $src/hints/$file.sh ; then
2672                                         dflt=$file
2673                                 elif $test -f $src/hints/$xfile.sh ; then
2674                                         dflt=$xfile
2675                                 elif $test -f $src/hints/$xxfile.sh ; then
2676                                         dflt=$xxfile
2677                                 elif $test -f $src/hints/$xxxfile.sh ; then
2678                                         dflt=$xxxfile
2679                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2680                                         dflt=$xxxxfile
2681                                 elif $test -f "$src/hints/${osname}.sh" ; then
2682                                         dflt="${osname}"
2683                                 else
2684                                         dflt=none
2685                                 fi
2686                                 ;;
2687                         esac
2688                         ;;
2689                 esac
2690                 if $test -f Policy.sh ; then
2691                         case "$dflt" in
2692                         *Policy*) ;;
2693                         none) dflt="Policy" ;;
2694                         *) dflt="Policy $dflt" ;;
2695                         esac
2696                 fi
2697                 ;;
2698         *)
2699                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2700                 ;;
2701         esac
2702
2703         if $test -f Policy.sh ; then
2704                 $cat <<EOM
2705
2706 There's also a Policy hint file available, which should make the
2707 site-specific (policy) questions easier to answer.
2708 EOM
2709
2710         fi
2711
2712         $cat <<EOM
2713
2714 You may give one or more space-separated answers, or "none" if appropriate.
2715 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2716 is a good thing.  DO NOT give a wrong version or a wrong OS.
2717
2718 EOM
2719
2720         rp="Which of these apply, if any?"
2721         . UU/myread
2722         tans=$ans
2723         for file in $tans; do
2724                 if $test X$file = XPolicy -a -f Policy.sh; then
2725                         . Policy.sh
2726                         $cat Policy.sh >> UU/config.sh
2727                 elif $test -f $src/hints/$file.sh; then
2728                         . $src/hints/$file.sh
2729                         $cat $src/hints/$file.sh >> UU/config.sh
2730                 elif $test X$tans = X -o X$tans = Xnone ; then
2731                         : nothing
2732                 else
2733                         : Give one chance to correct a possible typo.
2734                         echo "$file.sh does not exist"
2735                         dflt=$file
2736                         rp="hint to use instead?"
2737                         . UU/myread
2738                         for file in $ans; do
2739                                 if $test -f "$src/hints/$file.sh"; then
2740                                         . $src/hints/$file.sh
2741                                         $cat $src/hints/$file.sh >> UU/config.sh
2742                                 elif $test X$ans = X -o X$ans = Xnone ; then
2743                                         : nothing
2744                                 else
2745                                         echo "$file.sh does not exist -- ignored."
2746                                 fi
2747                         done
2748                 fi
2749         done
2750
2751         hint=recommended
2752         : Remember our hint file for later.
2753         if $test -f "$src/hints/$file.sh" ; then
2754                 hintfile="$file"
2755         else
2756                 hintfile=''
2757         fi
2758 fi
2759 cd UU
2760 ;;
2761 *)
2762         echo " "
2763         echo "Fetching default answers from $config_sh..." >&4
2764         tmp_n="$n"
2765         tmp_c="$c"
2766         cd ..
2767         cp $config_sh config.sh 2>/dev/null
2768         chmod +w config.sh
2769         . ./config.sh
2770         cd UU
2771         cp ../config.sh .
2772         n="$tmp_n"
2773         c="$tmp_c"
2774         hint=previous
2775         ;;
2776 esac
2777 test "$override" && . ./optdef.sh
2778
2779 : Restore computed paths
2780 for file in $loclist $trylist; do
2781         eval $file="\$_$file"
2782 done
2783
2784 cat << EOM
2785
2786 Configure uses the operating system name and version to set some defaults.
2787 The default value is probably right if the name rings a bell. Otherwise,
2788 since spelling matters for me, either accept the default or answer "none"
2789 to leave it blank.
2790
2791 EOM
2792 case "$osname" in
2793         ''|' ')
2794                 case "$hintfile" in
2795                 ''|' '|none) dflt=none ;;
2796                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2797                 esac
2798                 ;;
2799         *) dflt="$osname" ;;
2800 esac
2801 rp="Operating system name?"
2802 . ./myread
2803 case "$ans" in
2804 none)  osname='' ;;
2805 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2806 esac
2807 echo " "
2808 case "$osvers" in
2809         ''|' ')
2810                 case "$hintfile" in
2811                 ''|' '|none) dflt=none ;;
2812                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2813                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2814                         case "$dflt" in
2815                         ''|' ') dflt=none ;;
2816                         esac
2817                         ;;
2818                 esac
2819                 ;;
2820         *) dflt="$osvers" ;;
2821 esac
2822 rp="Operating system version?"
2823 . ./myread
2824 case "$ans" in
2825 none)  osvers='' ;;
2826 *) osvers="$ans" ;;
2827 esac
2828
2829
2830 . ./posthint.sh
2831
2832 : who configured the system
2833 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2834 cf_by=`(logname) 2>/dev/null`
2835 case "$cf_by" in
2836 "")
2837         cf_by=`(whoami) 2>/dev/null`
2838         case "$cf_by" in
2839         "") cf_by=unknown ;;
2840         esac ;;
2841 esac
2842
2843 : set up the script used to warn in case of inconsistency
2844 cat <<EOS >whoa
2845 $startsh
2846 EOS
2847 cat <<'EOSC' >>whoa
2848 dflt=y
2849 echo " "
2850 echo "*** WHOA THERE!!! ***" >&4
2851 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2852 rp="    Keep the $hint value?"
2853 . ./myread
2854 case "$ans" in
2855 y) td=$was; tu=$was;;
2856 esac
2857 EOSC
2858
2859 : function used to set $1 to $val
2860 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2861 case "$val$was" in
2862 $define$undef) . ./whoa; eval "$var=\$td";;
2863 $undef$define) . ./whoa; eval "$var=\$tu";;
2864 *) eval "$var=$val";;
2865 esac'
2866
2867 case "$usethreads" in
2868 $define|true|[yY]*)     dflt='y';;
2869 *) dflt='n';;
2870 esac
2871 cat <<EOM
2872
2873 Perl can be built to take advantage of threads on some systems.
2874 To do so, Configure can be run with -Dusethreads.
2875
2876 Note that threading is a highly experimental feature, and
2877 some known race conditions still remain.  If you choose to try
2878 it, be very sure to not actually deploy it for production
2879 purposes.  README.threads has more details, and is required
2880 reading if you enable threads.
2881
2882 If this doesn't make any sense to you, just accept the default '$dflt'.
2883 EOM
2884 rp='Build a threading Perl?'
2885 . ./myread
2886 case "$ans" in
2887 y|Y)    val="$define" ;;
2888 *)      val="$undef" ;;
2889 esac
2890 set usethreads
2891 eval $setvar
2892
2893 case "$usethreads" in
2894 $define)
2895         $cat <<EOM
2896
2897 As of 5.5.640, Perl has two different internal threading implementations,
2898 the 5.005 version (5005threads) and an interpreter-based version
2899 (ithreads) that has one interpreter per thread.  Both are very 
2900 experimental.  This arrangement exists to help developers work out
2901 which one is better.
2902
2903 If you're a casual user, you probably don't want interpreter-threads
2904 at this time.  There doesn't yet exist a way to create threads from
2905 within Perl in this model, i.e., "use Thread;" will NOT work.
2906 EOM
2907         : Default to ithreads unless overridden on command line or with
2908         : old config.sh
2909         dflt='y'
2910         case "$use5005threads" in
2911                 $define|true|[yY]*) dflt='n';;
2912         esac
2913         case "$useithreads" in
2914                 $undef|false|[nN]*) dflt='n';;
2915         esac
2916         rp='Use interpreter-based ithreads?'
2917         . ./myread
2918         case "$ans" in
2919         y|Y)    val="$define" ;;
2920         *)      val="$undef" ;;
2921         esac
2922         set useithreads
2923         eval $setvar
2924         : Now set use5005threads to the opposite value.
2925         case "$useithreads" in
2926         $define) val="$undef" ;;
2927         *) val="$define" ;;
2928         esac
2929         set use5005threads
2930         eval $setvar
2931         ;;
2932 *)
2933         useithreads="$undef"
2934         use5005threads="$undef"
2935         ;;
2936 esac
2937
2938 case "$useithreads$use5005threads" in
2939 "$define$define")
2940         $cat >&4 <<EOM
2941
2942 You cannot have both the ithreads and the 5.005 threads enabled
2943 at the same time.  Disabling the 5.005 threads since they are
2944 much less stable than the ithreads.
2945
2946 EOM
2947         use5005threads="$undef"
2948         ;;
2949 esac
2950
2951 case "$d_oldpthreads" in
2952 '')     : Configure tests would be welcome here.  For now, assume undef.
2953         val="$undef" ;;
2954 *)      val="$d_oldpthreads" ;;
2955 esac
2956 set d_oldpthreads
2957 eval $setvar
2958
2959
2960 case "$usethreads" in
2961 "$define"|true|[yY]*)
2962 : Look for a hint-file generated 'call-back-unit'.  If the
2963 : user has specified that a threading perl is to be built,
2964 : we may need to set or change some other defaults.
2965         if $test -f usethreads.cbu; then
2966                 echo "Your platform has some specific hints for threaded builds, using them..."
2967                 . ./usethreads.cbu
2968         else
2969                 $cat <<EOM
2970 (Your platform doesn't have any specific hints for threaded builds.
2971  Assuming POSIX threads, then.)
2972 EOM
2973         fi
2974         ;;
2975 esac
2976
2977 cat <<EOM
2978
2979 Perl can be built so that multiple Perl interpreters can coexist
2980 within the same Perl executable.
2981 EOM
2982
2983 case "$useithreads" in
2984 $define)
2985         cat <<EOM
2986 This multiple interpreter support is required for interpreter-based threads.
2987 EOM
2988         val="$define"
2989         ;;
2990 *)      case "$usemultiplicity" in
2991         $define|true|[yY]*)     dflt='y';;
2992         *) dflt='n';;
2993         esac
2994         echo " "
2995         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2996         rp='Build Perl for multiplicity?'
2997         . ./myread
2998         case "$ans" in
2999         y|Y)    val="$define" ;;
3000         *)      val="$undef" ;;
3001         esac
3002         ;;
3003 esac
3004 set usemultiplicity
3005 eval $setvar
3006
3007 : make some quick guesses about what we are up against
3008 echo " "
3009 $echo $n "Hmm...  $c"
3010 echo exit 1 >bsd
3011 echo exit 1 >usg
3012 echo exit 1 >v7
3013 echo exit 1 >osf1
3014 echo exit 1 >eunice
3015 echo exit 1 >xenix
3016 echo exit 1 >venix
3017 echo exit 1 >os2
3018 d_bsd="$undef"
3019 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3020 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3021 then
3022         echo "Looks kind of like an OSF/1 system, but we'll see..."
3023         echo exit 0 >osf1
3024 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3025         xxx=`./loc addbib blurfl $pth`
3026         if $test -f $xxx; then
3027         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3028                 echo exit 0 >bsd
3029                 echo exit 0 >usg
3030         else
3031                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3032                         echo "Looks kind of like an extended USG system, but we'll see..."
3033                 else
3034                         echo "Looks kind of like a USG system, but we'll see..."
3035                 fi
3036                 echo exit 0 >usg
3037         fi
3038 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3039         echo "Looks kind of like a BSD system, but we'll see..."
3040         d_bsd="$define"
3041         echo exit 0 >bsd
3042 else
3043         echo "Looks kind of like a Version 7 system, but we'll see..."
3044         echo exit 0 >v7
3045 fi
3046 case "$eunicefix" in
3047 *unixtovms*)
3048         $cat <<'EOI'
3049 There is, however, a strange, musty smell in the air that reminds me of
3050 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3051 EOI
3052         echo exit 0 >eunice
3053         d_eunice="$define"
3054 : it so happens the Eunice I know will not run shell scripts in Unix format
3055         ;;
3056 *)
3057         echo " "
3058         echo "Congratulations.  You aren't running Eunice."
3059         d_eunice="$undef"
3060         ;;
3061 esac
3062 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3063 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3064 : semicolon as a patch separator
3065 case "$p_" in
3066 :) ;;
3067 *)
3068         $cat <<'EOI'
3069 I have the feeling something is not exactly right, however...don't tell me...
3070 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3071 (Or you may be running DOS with DJGPP.)
3072 EOI
3073         echo exit 0 >os2
3074         ;;
3075 esac
3076 if test -f /xenix; then
3077         echo "Actually, this looks more like a XENIX system..."
3078         echo exit 0 >xenix
3079         d_xenix="$define"
3080 else
3081         echo " "
3082         echo "It's not Xenix..."
3083         d_xenix="$undef"
3084 fi
3085 chmod +x xenix
3086 $eunicefix xenix
3087 if test -f /venix; then
3088         echo "Actually, this looks more like a VENIX system..."
3089         echo exit 0 >venix
3090 else
3091         echo " "
3092         if ./xenix; then
3093                 : null
3094         else
3095                 echo "Nor is it Venix..."
3096         fi
3097 fi
3098 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3099 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3100 $rm -f foo
3101
3102 case "$cc" in
3103 '') dflt=cc;;
3104 *) dflt="$cc";;
3105 esac
3106 rp="Use which C compiler?"
3107 . ./myread
3108 cc="$ans"
3109 : Look for a hint-file generated 'call-back-unit'.  Now that the
3110 : user has specified the compiler, we may need to set or change some
3111 : other defaults.
3112 if $test -f cc.cbu; then
3113     . ./cc.cbu
3114 fi
3115 . ./checkcc
3116
3117 echo " "
3118 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3119 $cat >gccvers.c <<EOM
3120 #include <stdio.h>
3121 int main() {
3122 #ifdef __GNUC__
3123 #ifdef __VERSION__
3124         printf("%s\n", __VERSION__);
3125 #else
3126         printf("%s\n", "1");
3127 #endif
3128 #endif
3129         exit(0);
3130 }
3131 EOM
3132 if $cc -o gccvers $ldflags gccvers.c; then
3133         gccversion=`./gccvers`
3134         case "$gccversion" in
3135         '') echo "You are not using GNU cc." ;;
3136         *)  echo "You are using GNU cc $gccversion."
3137             ccname=gcc  
3138             ;;
3139         esac
3140 else
3141         echo " "
3142         echo "*** WHOA THERE!!! ***" >&4
3143         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3144         case "$knowitall" in
3145         '')
3146         echo "    You'd better start hunting for one and let me know about it." >&4
3147                 exit 1
3148                 ;;
3149         esac
3150 fi
3151 $rm -f gccvers*
3152 case "$gccversion" in
3153 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3154 esac
3155 case "$gccversion" in
3156 '') gccosandvers='' ;;
3157 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3158    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3159    gccshortvers=''
3160    case "$gccosandvers" in
3161    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3162    $osname$osvers) ;; # looking good
3163    $osname*) cat <<EOM >&4
3164
3165 *** WHOA THERE!!! ***
3166
3167     Your gcc has not been compiled for the exact release of
3168     your operating system ($gccosandvers versus $osname$osvers).
3169
3170     In general it is a good idea to keep gcc synchronized with
3171     the operating system because otherwise serious problems
3172     may ensue when trying to compile software, like Perl.
3173
3174     I'm trying to be optimistic here, though, and will continue.
3175     If later during the configuration and build icky compilation
3176     problems appear (headerfile conflicts being the most common
3177     manifestation), I suggest reinstalling the gcc to match
3178     your operating system release.
3179
3180 EOM
3181       ;;
3182    *) gccosandvers='' ;; # failed to parse, better be silent
3183    esac
3184    ;;
3185 esac
3186 case "$ccname" in
3187 '') ccname="$cc" ;;
3188 esac
3189
3190 : see how we invoke the C preprocessor
3191 echo " "
3192 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3193 cat <<'EOT' >testcpp.c
3194 #define ABC abc
3195 #define XYZ xyz
3196 ABC.XYZ
3197 EOT
3198 cd ..
3199 if test ! -f cppstdin; then
3200         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3201                 # AIX cc -E doesn't show the absolute headerfile
3202                 # locations but we'll cheat by using the -M flag.
3203                 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
3204         else
3205                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3206         fi
3207 else
3208         echo "Keeping your $hint cppstdin wrapper."
3209 fi
3210 chmod 755 cppstdin
3211 wrapper=`pwd`/cppstdin
3212 ok='false'
3213 cd UU
3214
3215 if $test "X$cppstdin" != "X" && \
3216         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3217         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3218 then
3219         echo "You used to use $cppstdin $cppminus so we'll use that again."
3220         case "$cpprun" in
3221         '') echo "But let's see if we can live without a wrapper..." ;;
3222         *)
3223                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3224                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3225                 then
3226                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3227                         ok='true'
3228                 else
3229                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3230                 fi
3231                 ;;
3232         esac
3233 else
3234         case "$cppstdin" in
3235         '') ;;
3236         *)
3237                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3238                 ;;
3239         esac
3240 fi
3241
3242 if $ok; then
3243         : nothing
3244 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3245         $cc -E <testcpp.c >testcpp.out 2>&1; \
3246         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3247         echo "Yup, it does."
3248         x_cpp="$cc -E"
3249         x_minus='';
3250 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3251         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3252         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3253         echo "Yup, it does."
3254         x_cpp="$cc -E"
3255         x_minus='-';
3256 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3257         $cc -P <testcpp.c >testcpp.out 2>&1; \
3258         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3259         echo "Yipee, that works!"
3260         x_cpp="$cc -P"
3261         x_minus='';
3262 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3263         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3265         echo "At long last!"
3266         x_cpp="$cc -P"
3267         x_minus='-';
3268 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3269         $cpp <testcpp.c >testcpp.out 2>&1; \
3270         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3271         echo "It works!"
3272         x_cpp="$cpp"
3273         x_minus='';
3274 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3275         $cpp - <testcpp.c >testcpp.out 2>&1; \
3276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3277         echo "Hooray, it works!  I was beginning to wonder."
3278         x_cpp="$cpp"
3279         x_minus='-';
3280 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3281         $wrapper <testcpp.c >testcpp.out 2>&1; \
3282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3283         x_cpp="$wrapper"
3284         x_minus=''
3285         echo "Eureka!"
3286 else
3287         dflt=''
3288         rp="No dice.  I can't find a C preprocessor.  Name one:"
3289         . ./myread
3290         x_cpp="$ans"
3291         x_minus=''
3292         $x_cpp <testcpp.c >testcpp.out 2>&1
3293         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3294                 echo "OK, that will do." >&4
3295         else
3296 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3297                 exit 1
3298         fi
3299 fi
3300
3301 case "$ok" in
3302 false)
3303         cppstdin="$x_cpp"
3304         cppminus="$x_minus"
3305         cpprun="$x_cpp"
3306         cpplast="$x_minus"
3307         set X $x_cpp
3308         shift
3309         case "$1" in
3310         "$cpp")
3311                 echo "Perhaps can we force $cc -E using a wrapper..."
3312                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3313                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3314                 then
3315                         echo "Yup, we can."
3316                         cppstdin="$wrapper"
3317                         cppminus='';
3318                 else
3319                         echo "Nope, we'll have to live without it..."
3320                 fi
3321                 ;;
3322         esac
3323         case "$cpprun" in
3324         "$wrapper")
3325                 cpprun=''
3326                 cpplast=''
3327                 ;;
3328         esac
3329         ;;
3330 esac
3331
3332 case "$cppstdin" in
3333 "$wrapper"|'cppstdin') ;;
3334 *) $rm -f $wrapper;;
3335 esac
3336 $rm -f testcpp.c testcpp.out
3337
3338 : decide how portable to be.  Allow command line overrides.
3339 case "$d_portable" in
3340 "$undef") ;;
3341 *)      d_portable="$define" ;;
3342 esac
3343
3344 : set up shell script to do ~ expansion
3345 cat >filexp <<EOSS
3346 $startsh
3347 : expand filename
3348 case "\$1" in
3349  ~/*|~)
3350         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3351         ;;
3352  ~*)
3353         if $test -f /bin/csh; then
3354                 /bin/csh -f -c "glob \$1"
3355                 failed=\$?
3356                 echo ""
3357                 exit \$failed
3358         else
3359                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3360                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3361                 if $test ! -d "\$dir"; then
3362                         me=\`basename \$0\`
3363                         echo "\$me: can't locate home directory for: \$name" >&2
3364                         exit 1
3365                 fi
3366                 case "\$1" in
3367                 */*)
3368                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3369                         ;;
3370                 *)
3371                         echo \$dir
3372                         ;;
3373                 esac
3374         fi
3375         ;;
3376 *)
3377         echo \$1
3378         ;;
3379 esac
3380 EOSS
3381 chmod +x filexp
3382 $eunicefix filexp
3383
3384 : now set up to get a file name
3385 cat <<EOS >getfile
3386 $startsh
3387 EOS
3388 cat <<'EOSC' >>getfile
3389 tilde=''
3390 fullpath=''
3391 already=''
3392 skip=''
3393 none_ok=''
3394 exp_file=''
3395 nopath_ok=''
3396 orig_rp="$rp"
3397 orig_dflt="$dflt"
3398 case "$gfpth" in
3399 '') gfpth='.' ;;
3400 esac
3401
3402 case "$fn" in
3403 *\(*)
3404         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3405         fn=`echo $fn | sed 's/(.*)//'`
3406         ;;
3407 esac
3408
3409 case "$fn" in
3410 *:*)
3411         loc_file=`expr $fn : '.*:\(.*\)'`
3412         fn=`expr $fn : '\(.*\):.*'`
3413         ;;
3414 esac
3415
3416 case "$fn" in
3417 *~*) tilde=true;;
3418 esac
3419 case "$fn" in
3420 */*) fullpath=true;;
3421 esac
3422 case "$fn" in
3423 *+*) skip=true;;
3424 esac
3425 case "$fn" in
3426 *n*) none_ok=true;;
3427 esac
3428 case "$fn" in
3429 *e*) exp_file=true;;
3430 esac
3431 case "$fn" in
3432 *p*) nopath_ok=true;;
3433 esac
3434
3435 case "$fn" in
3436 *f*) type='File';;
3437 *d*) type='Directory';;
3438 *l*) type='Locate';;
3439 esac
3440
3441 what="$type"
3442 case "$what" in
3443 Locate) what='File';;
3444 esac
3445
3446 case "$exp_file" in
3447 '')
3448         case "$d_portable" in
3449         "$define") ;;
3450         *) exp_file=true;;
3451         esac
3452         ;;
3453 esac
3454
3455 cd ..
3456 while test "$type"; do
3457         redo=''
3458         rp="$orig_rp"
3459         dflt="$orig_dflt"
3460         case "$tilde" in
3461         true) rp="$rp (~name ok)";;
3462         esac
3463         . UU/myread
3464         if test -f UU/getfile.ok && \
3465                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3466         then
3467                 value="$ans"
3468                 ansexp="$ans"
3469                 break
3470         fi
3471         case "$ans" in
3472         none)
3473                 value=''
3474                 ansexp=''
3475                 case "$none_ok" in
3476                 true) type='';;
3477                 esac
3478                 ;;
3479         *)
3480                 case "$tilde" in
3481                 '') value="$ans"
3482                         ansexp="$ans";;
3483                 *)
3484                         value=`UU/filexp $ans`
3485                         case $? in
3486                         0)
3487                                 if test "$ans" != "$value"; then
3488                                         echo "(That expands to $value on this system.)"
3489                                 fi
3490                                 ;;
3491                         *) value="$ans";;
3492                         esac
3493                         ansexp="$value"
3494                         case "$exp_file" in
3495                         '') value="$ans";;
3496                         esac
3497                         ;;
3498                 esac
3499                 case "$fullpath" in
3500                 true)
3501                         case "$ansexp" in
3502                         /*) value="$ansexp" ;;
3503                         [a-zA-Z]:/*) value="$ansexp" ;;
3504                         *)
3505                                 redo=true
3506                                 case "$already" in
3507                                 true)
3508                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3509                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3510                                         ;;
3511                                 *)
3512                                 echo "Please give a full path name, starting with slash." >&4
3513                                         case "$tilde" in
3514                                         true)
3515                                 echo "Note that using ~name is ok provided it expands well." >&4
3516                                                 already=true
3517                                                 ;;
3518                                         esac
3519                                 esac
3520                                 ;;
3521                         esac
3522                         ;;
3523                 esac
3524                 case "$redo" in
3525                 '')
3526                         case "$type" in
3527                         File)
3528                                 for fp in $gfpth; do
3529                                         if test "X$fp" = X.; then
3530                                             pf="$ansexp"
3531                                         else    
3532                                             pf="$fp/$ansexp"
3533                                         fi
3534                                         if test -f "$pf"; then
3535                                                 type=''
3536                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3537                                         then
3538                                                 echo "($value is not a plain file, but that's ok.)"
3539                                                 type=''
3540                                         fi
3541                                         if test X"$type" = X; then
3542                                             value="$pf"
3543                                             break
3544                                         fi
3545                                 done
3546                                 ;;
3547                         Directory)
3548                                 for fp in $gfpth; do
3549                                         if test "X$fp" = X.; then
3550                                             dir="$ans"
3551                                             direxp="$ansexp"
3552                                         else    
3553                                             dir="$fp/$ansexp"
3554                                             direxp="$fp/$ansexp"
3555                                         fi
3556                                         if test -d "$direxp"; then
3557                                                 type=''
3558                                                 value="$dir"
3559                                                 break
3560                                         fi
3561                                 done
3562                                 ;;
3563                         Locate)
3564                                 if test -d "$ansexp"; then
3565                                         echo "(Looking for $loc_file in directory $value.)"
3566                                         value="$value/$loc_file"
3567                                         ansexp="$ansexp/$loc_file"
3568                                 fi
3569                                 if test -f "$ansexp"; then
3570                                         type=''
3571                                 fi
3572                                 case "$nopath_ok" in
3573                                 true)   case "$value" in
3574                                         */*) ;;
3575                                         *)      echo "Assuming $value will be in people's path."
3576                                                 type=''
3577                                                 ;;
3578                                         esac
3579                                         ;;
3580                                 esac
3581                                 ;;
3582                         esac
3583
3584                         case "$skip" in
3585                         true) type='';
3586                         esac
3587
3588                         case "$type" in
3589                         '') ;;
3590                         *)
3591                                 if test "$fastread" = yes; then
3592                                         dflt=y
3593                                 else
3594                                         dflt=n
3595                                 fi
3596                                 rp="$what $value doesn't exist.  Use that name anyway?"
3597                                 . UU/myread
3598                                 dflt=''
3599                                 case "$ans" in
3600                                 y*) type='';;
3601                                 *) echo " ";;
3602                                 esac
3603                                 ;;
3604                         esac
3605                         ;;
3606                 esac
3607                 ;;
3608         esac
3609 done
3610 cd UU
3611 ans="$value"
3612 rp="$orig_rp"
3613 dflt="$orig_dflt"
3614 rm -f getfile.ok
3615 test "X$gfpthkeep" != Xy && gfpth=""
3616 EOSC
3617
3618 : What should the include directory be ?
3619 echo " "
3620 $echo $n "Hmm...  $c"
3621 dflt='/usr/include'
3622 incpath=''
3623 mips_type=''
3624 if $test -f /bin/mips && /bin/mips; then
3625         echo "Looks like a MIPS system..."
3626         $cat >usr.c <<'EOCP'
3627 #ifdef SYSTYPE_BSD43
3628 /bsd43
3629 #endif
3630 EOCP
3631         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3632                 dflt='/bsd43/usr/include'
3633                 incpath='/bsd43'
3634                 mips_type='BSD 4.3'
3635         else
3636                 mips_type='System V'
3637         fi
3638         $rm -f usr.c usr.out
3639         echo "and you're compiling with the $mips_type compiler and libraries."
3640         xxx_prompt=y
3641         echo "exit 0" >mips
3642 else
3643         echo "Doesn't look like a MIPS system."
3644         xxx_prompt=n
3645         echo "exit 1" >mips
3646 fi
3647 chmod +x mips
3648 $eunicefix mips
3649 case "$usrinc" in
3650 '') ;;
3651 *) dflt="$usrinc";;
3652 esac
3653 case "$xxx_prompt" in
3654 y)      fn=d/
3655         echo " "
3656         rp='Where are the include files you want to use?'
3657         . ./getfile
3658         usrinc="$ans"
3659         ;;
3660 *)      usrinc="$dflt"
3661         ;;
3662 esac
3663
3664 : Set private lib path
3665 case "$plibpth" in
3666 '') if ./mips; then
3667                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3668         fi;;
3669 esac
3670 case "$libpth" in
3671 ' ') dlist='';;
3672 '') dlist="$loclibpth $plibpth $glibpth";;
3673 *) dlist="$libpth";;
3674 esac
3675
3676 : Now check and see which directories actually exist, avoiding duplicates
3677 libpth=''
3678 for xxx in $dlist
3679 do
3680     if $test -d $xxx; then
3681                 case " $libpth " in
3682                 *" $xxx "*) ;;
3683                 *) libpth="$libpth $xxx";;
3684                 esac
3685     fi
3686 done
3687 $cat <<'EOM'
3688
3689 Some systems have incompatible or broken versions of libraries.  Among
3690 the directories listed in the question below, please remove any you
3691 know not to be holding relevant libraries, and add any that are needed.
3692 Say "none" for none.
3693
3694 EOM
3695 case "$libpth" in
3696 '') dflt='none';;
3697 *)
3698         set X $libpth
3699         shift
3700         dflt=${1+"$@"}
3701         ;;
3702 esac
3703 rp="Directories to use for library searches?"
3704 . ./myread
3705 case "$ans" in
3706 none) libpth=' ';;
3707 *) libpth="$ans";;
3708 esac
3709
3710 : compute shared library extension
3711 case "$so" in
3712 '')
3713         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3714                 dflt='sl'
3715         else
3716                 dflt='so'
3717         fi
3718         ;;
3719 *) dflt="$so";;
3720 esac
3721 $cat <<EOM
3722
3723 On some systems, shared libraries may be available.  Answer 'none' if
3724 you want to suppress searching of shared libraries for the remainder
3725 of this configuration.
3726
3727 EOM
3728 rp='What is the file extension used for shared libraries?'
3729 . ./myread
3730 so="$ans"
3731
3732 : Define several unixisms.
3733 : Hints files or command line option can be used to override them.
3734 : The convoluted testing is in case hints files set either the old
3735 : or the new name.
3736 case "$_exe" in
3737 '')     case "$exe_ext" in
3738     '') ;;
3739         *)      _exe="$exe_ext" ;;
3740         esac
3741         ;;
3742 esac
3743 case "$_a" in
3744 '')     case "$lib_ext" in
3745     '') _a='.a';;
3746         *)      _a="$lib_ext" ;;
3747         esac
3748         ;;
3749 esac
3750 case "$_o" in
3751 '') case "$obj_ext" in
3752         '')     _o='.o';;
3753         *)      _o="$obj_ext";;
3754         esac
3755         ;;
3756 esac
3757 case "$p_" in
3758 '') case "$path_sep" in
3759         '')     p_=':';;
3760         *)      p_="$path_sep";;
3761         esac
3762         ;;
3763 esac
3764 exe_ext=$_exe
3765 lib_ext=$_a
3766 obj_ext=$_o
3767 path_sep=$p_
3768
3769 : Which makefile gets called first.  This is used by make depend.
3770 case "$firstmakefile" in
3771 '') firstmakefile='makefile';;
3772 esac
3773
3774 case "$usesocks" in
3775 $define|true|[yY]*)     dflt='y';;
3776 *) dflt='n';;
3777 esac
3778 cat <<EOM
3779
3780 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3781 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3782 to use the PerlIO abstraction layer, this will be implicitly selected.
3783
3784 If this doesn't make any sense to you, just accept the default '$dflt'.
3785 EOM
3786 rp='Build Perl for SOCKS?'
3787 . ./myread
3788 case "$ans" in
3789 y|Y)    val="$define" ;;     
3790 *)      val="$undef" ;;
3791 esac
3792 set usesocks
3793 eval $setvar
3794
3795 case "$usesocks" in
3796 $define|true|[yY]*) useperlio="$define";;
3797 esac
3798
3799 : Looking for optional libraries
3800 echo " "
3801 echo "Checking for optional libraries..." >&4
3802 case "$libs" in
3803 ' '|'') dflt='';;
3804 *) dflt="$libs";;
3805 esac
3806 case "$libswanted" in
3807 '') libswanted='c_s';;
3808 esac
3809 case "$usesocks" in
3810 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3811 esac
3812 libsfound=''
3813 libsfiles=''
3814 libsdirs=''
3815 libspath=''
3816 for thisdir in $libpth $xlibpth; do
3817   test -d $thisdir && libspath="$libspath $thisdir"
3818 done
3819 for thislib in $libswanted; do
3820         for thisdir in $libspath; do
3821             xxx=''
3822             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3823                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3824                 $test -f "$xxx" && eval $libscheck
3825                 $test -f "$xxx" && libstyle=shared
3826             fi
3827             if test ! -f "$xxx"; then
3828                 xxx=$thisdir/lib$thislib.$so
3829                 $test -f "$xxx" && eval $libscheck
3830                 $test -f "$xxx" && libstyle=shared
3831             fi  
3832             if test ! -f "$xxx"; then
3833                 xxx=$thisdir/lib$thislib$_a
3834                 $test -f "$xxx" && eval $libscheck
3835                 $test -f "$xxx" && libstyle=static
3836             fi
3837             if test ! -f "$xxx"; then
3838                 xxx=$thisdir/$thislib$_a
3839                 $test -f "$xxx" && eval $libscheck
3840                 $test -f "$xxx" && libstyle=static
3841             fi
3842             if test ! -f "$xxx"; then
3843                 xxx=$thisdir/lib${thislib}_s$_a
3844                 $test -f "$xxx" && eval $libscheck
3845                 $test -f "$xxx" && libstyle=static
3846                 $test -f "$xxx" && thislib=${thislib}_s
3847             fi
3848             if test ! -f "$xxx"; then
3849                 xxx=$thisdir/Slib$thislib$_a
3850                 $test -f "$xxx" && eval $libscheck
3851                 $test -f "$xxx" && libstyle=static
3852             fi
3853             if $test -f "$xxx"; then
3854                 case "$libstyle" in
3855                 shared) echo "Found -l$thislib (shared)." ;;
3856                 static) echo "Found -l$thislib." ;;
3857                 *)      echo "Found -l$thislib ($libstyle)." ;;
3858                 esac
3859                 case " $dflt " in
3860                 *"-l$thislib "*);;
3861                 *) dflt="$dflt -l$thislib"
3862                    libsfound="$libsfound $xxx"
3863                    yyy=`basename $xxx`
3864                    libsfiles="$libsfiles $yyy"
3865                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3866                    case " $libsdirs " in
3867                    *" $yyy "*) ;;
3868                    *) libsdirs="$libsdirs $yyy" ;;
3869                    esac
3870                    ;;
3871                 esac
3872                 break
3873             fi  
3874         done
3875         if $test ! -f "$xxx"; then
3876             echo "No -l$thislib."
3877         fi
3878 done
3879 set X $dflt
3880 shift
3881 dflt="$*"
3882 case "$libs" in
3883 '') dflt="$dflt";;
3884 *) dflt="$libs";;
3885 esac
3886 case "$dflt" in
3887 ' '|'') dflt='none';;
3888 esac
3889
3890 $cat <<EOM
3891
3892 In order to compile $package on your machine, a number of libraries
3893 are usually needed.  Include any other special libraries here as well.
3894 Say "none" for none.  The default list is almost always right.
3895 EOM
3896
3897 echo " "
3898 rp="What libraries to use?"
3899 . ./myread
3900 case "$ans" in
3901 none) libs=' ';;
3902 *) libs="$ans";;
3903 esac
3904
3905 : determine optimization, if desired, or use for debug flag also
3906 case "$optimize" in
3907 ' '|$undef) dflt='none';;
3908 '') dflt='-O';;
3909 *) dflt="$optimize";;
3910 esac
3911 $cat <<EOH
3912
3913 By default, $package compiles with the -O flag to use the optimizer.
3914 Alternately, you might want to use the symbolic debugger, which uses
3915 the -g flag (on traditional Unix systems).  Either flag can be
3916 specified here.  To use neither flag, specify the word "none".
3917
3918 EOH
3919 rp="What optimizer/debugger flag should be used?"
3920 . ./myread
3921 optimize="$ans"
3922 case "$optimize" in
3923 'none') optimize=" ";;
3924 esac
3925
3926 dflt=''
3927 : We will not override a previous value, but we might want to
3928 : augment a hint file
3929 case "$hint" in
3930 default|recommended)
3931         case "$gccversion" in
3932         1*) dflt='-fpcc-struct-return' ;;
3933         esac
3934         case "$optimize" in
3935         *-g*) dflt="$dflt -DDEBUGGING";;
3936         esac
3937         case "$gccversion" in
3938         2*) if test -d /etc/conf/kconfig.d &&
3939                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3940                 then
3941                         dflt="$dflt -posix"
3942                 fi
3943                 ;;
3944         esac
3945         case "$gccversion" in
3946         1*) ;;
3947         2.[0-8]*) ;;
3948         ?*)     echo " "
3949                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3950                 echo 'int main(void) { return 0; }' > gcctest.c
3951                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3952                         echo "Yes, it does." 2>&1
3953                         case "$ccflags" in
3954                         *strict-aliasing*) 
3955                                 echo "Leaving current flags $ccflags alone." 2>&1
3956                                 ;;
3957                         *) dflt="$dflt -fno-strict-aliasing" ;;
3958                         esac
3959                 else
3960                         echo "Nope, it doesn't, but that's ok." 2>&1
3961                 fi
3962                 ;;
3963         esac
3964         ;;
3965 esac
3966
3967 case "$mips_type" in
3968 *BSD*|'') inclwanted="$locincpth $usrinc";;
3969 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3970 esac
3971 for thisincl in $inclwanted; do
3972         if $test -d $thisincl; then
3973                 if $test x$thisincl != x$usrinc; then
3974                         case "$dflt" in
3975                         *" -I$thisincl "*);;
3976                         *) dflt="$dflt -I$thisincl ";;
3977                         esac
3978                 fi
3979         fi
3980 done
3981
3982 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3983         xxx=true;
3984 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3985         xxx=true;
3986 else
3987         xxx=false;
3988 fi;
3989 if $xxx; then
3990         case "$dflt" in
3991         *$2*);;
3992         *) dflt="$dflt -D$2";;
3993         esac;
3994 fi'
3995
3996 set signal.h LANGUAGE_C; eval $inctest
3997
3998 case "$usesocks" in
3999 $define)
4000         ccflags="$ccflags -DSOCKS"
4001         ;;
4002 esac
4003
4004 case "$hint" in
4005 default|recommended) dflt="$ccflags $dflt" ;;
4006 *) dflt="$ccflags";;
4007 esac
4008
4009 case "$dflt" in
4010 ''|' ') dflt=none;;
4011 esac
4012
4013 $cat <<EOH
4014
4015 Your C compiler may want other flags.  For this question you should include
4016 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4017 but you should NOT include libraries or ld flags like -lwhatever.  If you
4018 want $package to honor its debug switch, you should include -DDEBUGGING here.
4019 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4020
4021 To use no flags, specify the word "none".
4022
4023 EOH
4024 set X $dflt
4025 shift
4026 dflt=${1+"$@"}
4027 rp="Any additional cc flags?"
4028 . ./myread
4029 case "$ans" in
4030 none) ccflags='';;
4031 *) ccflags="$ans";;
4032 esac
4033
4034 : the following weeds options from ccflags that are of no interest to cpp
4035 cppflags="$ccflags"
4036 case "$gccversion" in
4037 1*) cppflags="$cppflags -D__GNUC__"
4038 esac
4039 case "$mips_type" in
4040 '');;
4041 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4042 esac
4043 case "$cppflags" in
4044 '');;
4045 *)
4046         echo " "
4047         echo "Let me guess what the preprocessor flags are..." >&4
4048         set X $cppflags
4049         shift
4050         cppflags=''
4051         $cat >cpp.c <<'EOM'
4052 #define BLURFL foo
4053
4054 BLURFL xx LFRULB
4055 EOM
4056         previous=''
4057         for flag in $*
4058         do
4059                 case "$flag" in
4060                 -*) ftry="$flag";;
4061                 *) ftry="$previous $flag";;
4062                 esac
4063                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4064                         >cpp1.out 2>/dev/null && \
4065                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4066                         >cpp2.out 2>/dev/null && \
4067                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4068                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4069                 then
4070                         cppflags="$cppflags $ftry"
4071                         previous=''
4072                 else
4073                         previous="$flag"
4074                 fi
4075         done
4076         set X $cppflags
4077         shift
4078         cppflags=${1+"$@"}
4079         case "$cppflags" in
4080         *-*)  echo "They appear to be: $cppflags";;
4081         esac
4082         $rm -f cpp.c cpp?.out
4083         ;;
4084 esac
4085
4086 : flags used in final linking phase
4087 case "$ldflags" in
4088 '') if ./venix; then
4089                 dflt='-i -z'
4090         else
4091                 dflt=''
4092         fi
4093         case "$ccflags" in
4094         *-posix*) dflt="$dflt -posix" ;;
4095         esac
4096         ;;
4097 *) dflt="$ldflags";;
4098 esac
4099
4100 : Try to guess additional flags to pick up local libraries.
4101 for thislibdir in $libpth; do
4102         case " $loclibpth " in
4103         *" $thislibdir "*)
4104                 case "$dflt " in 
4105                 *"-L$thislibdir "*) ;;
4106                 *)  dflt="$dflt -L$thislibdir" ;;
4107                 esac
4108                 ;;
4109         esac
4110 done
4111
4112 case "$dflt" in
4113 '') dflt='none' ;;
4114 esac
4115
4116 $cat <<EOH
4117
4118 Your C linker may need flags.  For this question you should
4119 include -L/whatever and any other flags used by the C linker, but you
4120 should NOT include libraries like -lwhatever.
4121
4122 Make sure you include the appropriate -L/path flags if your C linker
4123 does not normally search all of the directories you specified above,
4124 namely
4125         $libpth
4126 To use no flags, specify the word "none".
4127
4128 EOH
4129
4130 rp="Any additional ld flags (NOT including libraries)?"
4131 . ./myread
4132 case "$ans" in
4133 none) ldflags='';;
4134 *) ldflags="$ans";;
4135 esac
4136 rmlist="$rmlist pdp11"
4137
4138 : coherency check
4139 echo " "
4140 echo "Checking your choice of C compiler and flags for coherency..." >&4
4141 $cat > try.c <<'EOF'
4142 #include <stdio.h>
4143 int main() { printf("Ok\n"); exit(0); }
4144 EOF
4145 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4146 shift
4147 $cat >try.msg <<'EOM'
4148 I've tried to compile and run the following simple program:
4149
4150 EOM
4151 $cat try.c >> try.msg
4152
4153 $cat >> try.msg <<EOM
4154
4155 I used the command:
4156
4157         $*
4158         ./try
4159
4160 and I got the following output:
4161
4162 EOM
4163 dflt=y
4164 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4165         if $sh -c './try' >>try.msg 2>&1; then
4166                 xxx=`./try`
4167                 case "$xxx" in
4168                 "Ok") dflt=n ;;
4169                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4170                         case " $libs " in
4171                         *" -lsfio "*)
4172                                 cat >> try.msg <<'EOQS'
4173 If $libs contains -lsfio, and sfio is mis-configured, then it
4174 sometimes (apparently) runs and exits with a 0 status, but with no
4175 output!  It may have to do with sfio's use of _exit vs. exit.
4176
4177 EOQS
4178                                 rp="You have a big problem.  Shall I abort Configure"
4179                                 dflt=y
4180                                 ;;
4181                         esac
4182                         ;;
4183                 esac
4184         else
4185                 echo "The program compiled OK, but exited with status $?." >>try.msg
4186                 rp="You have a problem.  Shall I abort Configure"
4187                 dflt=y
4188         fi
4189 else
4190         echo "I can't compile the test program." >>try.msg
4191         rp="You have a BIG problem.  Shall I abort Configure"
4192         dflt=y
4193 fi
4194 case "$dflt" in
4195 y)
4196         $cat try.msg >&4
4197         case "$knowitall" in
4198         '')
4199                 echo "(The supplied flags or libraries might be incorrect.)"
4200                 ;;
4201         *) dflt=n;;
4202         esac
4203         echo " "
4204         . ./myread
4205         case "$ans" in
4206         n*|N*) ;;
4207         *)      echo "Ok.  Stopping Configure." >&4
4208                 exit 1
4209                 ;;
4210         esac
4211         ;;
4212 n) echo "OK, that should do.";;
4213 esac
4214 $rm -f try try.* core
4215
4216 : define an is-a-typedef? function
4217 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4218 case "$inclist" in
4219 "") inclist="sys/types.h";;
4220 esac;
4221 eval "varval=\$$var";
4222 case "$varval" in
4223 "")
4224         $rm -f temp.c;
4225         for inc in $inclist; do
4226                 echo "#include <$inc>" >>temp.c;
4227         done;
4228         echo "#ifdef $type" >> temp.c;
4229         echo "printf(\"We have $type\");" >> temp.c;
4230         echo "#endif" >> temp.c;
4231         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4232         if $contains $type temp.E >/dev/null 2>&1; then
4233                 eval "$var=\$type";
4234         else
4235                 eval "$var=\$def";
4236         fi;
4237         $rm -f temp.?;;
4238 *) eval "$var=\$varval";;
4239 esac'
4240
4241 : define an is-a-typedef? function that prompts if the type is not available.
4242 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4243 case "$inclist" in
4244 "") inclist="sys/types.h";;
4245 esac;
4246 eval "varval=\$$var";
4247 case "$varval" in
4248 "")
4249         $rm -f temp.c;
4250         for inc in $inclist; do
4251                 echo "#include <$inc>" >>temp.c;
4252         done;
4253         echo "#ifdef $type" >> temp.c;
4254         echo "printf(\"We have $type\");" >> temp.c;
4255         echo "#endif" >> temp.c;
4256         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4257         echo " " ;
4258         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4259         if $contains $type temp.E >/dev/null 2>&1; then
4260                 echo "$type found." >&4;
4261                 eval "$var=\$type";
4262         else
4263                 echo "$type NOT found." >&4;
4264                 dflt="$def";
4265                 . ./myread ;
4266                 eval "$var=\$ans";
4267         fi;
4268         $rm -f temp.?;;
4269 *) eval "$var=\$varval";;
4270 esac'
4271
4272 : define a shorthand compile call
4273 compile='
4274 mc_file=$1;
4275 shift;
4276 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4277 : define a shorthand compile call for compilations that should be ok.
4278 compile_ok='
4279 mc_file=$1;
4280 shift;
4281 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4282
4283 : check for lengths of integral types
4284 echo " "
4285 case "$intsize" in
4286 '')
4287         echo "Checking to see how big your integers are..." >&4
4288         $cat >intsize.c <<'EOCP'
4289 #include <stdio.h>
4290 int main()
4291 {
4292         printf("intsize=%d;\n", (int)sizeof(int));
4293         printf("longsize=%d;\n", (int)sizeof(long));
4294         printf("shortsize=%d;\n", (int)sizeof(short));
4295         exit(0);
4296 }
4297 EOCP
4298         set intsize
4299         if eval $compile_ok && ./intsize > /dev/null; then
4300                 eval `./intsize`
4301                 echo "Your integers are $intsize bytes long."
4302                 echo "Your long integers are $longsize bytes long."
4303                 echo "Your short integers are $shortsize bytes long."
4304         else
4305                 $cat >&4 <<EOM
4306 !
4307 Help! I can't compile and run the intsize test program: please enlighten me!
4308 (This is probably a misconfiguration in your system or libraries, and
4309 you really ought to fix it.  Still, I'll try anyway.)
4310 !
4311 EOM
4312                 dflt=4
4313                 rp="What is the size of an integer (in bytes)?"
4314                 . ./myread
4315                 intsize="$ans"
4316                 dflt=$intsize
4317                 rp="What is the size of a long integer (in bytes)?"
4318                 . ./myread
4319                 longsize="$ans"
4320                 dflt=2
4321                 rp="What is the size of a short integer (in bytes)?"
4322                 . ./myread
4323                 shortsize="$ans"
4324         fi
4325         ;;
4326 esac
4327 $rm -f intsize intsize.*
4328
4329 : see what type lseek is declared as in the kernel
4330 rp="What is the type used for lseek's offset on this system?"
4331 set off_t lseektype long stdio.h sys/types.h
4332 eval $typedef_ask
4333
4334 echo " "
4335 echo "Checking to see how big your file offsets are..." >&4
4336 $cat >try.c <<EOCP
4337 #include <sys/types.h>
4338 #include <stdio.h>
4339 int main()
4340 {
4341     printf("%d\n", (int)sizeof($lseektype));
4342     return(0); 
4343 }
4344 EOCP
4345 set try
4346 if eval $compile_ok; then
4347         lseeksize=`./try`
4348         echo "Your file offsets are $lseeksize bytes long."
4349 else
4350         dflt=$longsize
4351         echo " "
4352         echo "(I can't seem to compile the test program.  Guessing...)"
4353         rp="What is the size of your file offsets (in bytes)?"
4354         . ./myread
4355         lseeksize="$ans"
4356 fi
4357 $rm -f try.c try
4358
4359 : see what type file positions are declared as in the library
4360 rp="What is the type for file position used by fsetpos()?"
4361 set fpos_t fpostype long stdio.h sys/types.h
4362 eval $typedef_ask
4363
4364 echo " "
4365 case "$fpostype" in
4366 *_t) zzz="$fpostype"    ;;
4367 *)   zzz="fpos_t"       ;;
4368 esac
4369 echo "Checking the size of $zzz..." >&4 
4370 cat > try.c <<EOCP
4371 #include <sys/types.h>
4372 #include <stdio.h>
4373 int main() {
4374     printf("%d\n", (int)sizeof($fpostype));
4375     exit(0);
4376 }
4377 EOCP
4378 set try
4379 if eval $compile_ok; then
4380         yyy=`./try`
4381         case "$yyy" in
4382         '')     fpossize=4
4383                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4384                 ;;
4385         *)      fpossize=$yyy
4386                 echo "Your $zzz is $fpossize bytes long."
4387                 ;;
4388         esac
4389 else
4390         dflt="$longsize"
4391         echo " " >&4
4392         echo "(I can't compile the test program.  Guessing...)" >&4
4393         rp="What is the size of your file positions (in bytes)?"
4394         . ./myread
4395         fpossize="$ans"
4396 fi
4397
4398
4399
4400 # Backward compatibility (uselfs is deprecated).
4401 case "$uselfs" in
4402 "$define"|true|[yY]*)
4403         cat <<EOM >&4
4404
4405 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4406 EOM
4407         uselargefiles="$define"
4408         ;;
4409 esac                          
4410
4411 case "$lseeksize:$fpossize" in
4412 8:8) cat <<EOM
4413
4414 You can have files larger than 2 gigabytes.
4415 EOM
4416    val="$define" ;;
4417 *)    case "$uselargefiles" in
4418    "$undef"|false|[nN]*) dflt='n' ;;
4419    *)   dflt='y' ;;
4420    esac
4421    cat <<EOM
4422
4423 Perl can be built to understand large files (files larger than 2 gigabytes)
4424 on some systems.  To do so, Configure can be run with -Duselargefiles.
4425
4426 If this doesn't make any sense to you, just accept the default '$dflt'.
4427 EOM
4428    rp='Try to understand large files, if available?'
4429    . ./myread
4430    case "$ans" in
4431    y|Y)         val="$define" ;;
4432    *)           val="$undef"  ;;
4433    esac
4434    ;;
4435 esac
4436 set uselargefiles
4437 eval $setvar
4438 case "$uselargefiles" in
4439 "$define")
4440 : Look for a hint-file generated 'call-back-unit'.  If the
4441 : user has specified that a large files perl is to be built,
4442 : we may need to set or change some other defaults.
4443         if $test -f uselargefiles.cbu; then
4444                 echo "Your platform has some specific hints for large file builds, using them..."
4445                 . ./uselargefiles.cbu
4446                 echo " "
4447                 echo "Rechecking to see how big your file offsets are..." >&4
4448                 $cat >try.c <<EOCP
4449 #include <sys/types.h>
4450 #include <stdio.h>
4451 int main()
4452 {
4453     printf("%d\n", (int)sizeof($lseektype));
4454     return(0); 
4455 }
4456 EOCP
4457                 set try
4458                 if eval $compile_ok; then
4459                         lseeksize=`./try`
4460                         $echo "Your file offsets are now $lseeksize bytes long."
4461                 else
4462                         dflt="$lseeksize"
4463                         echo " "
4464                         echo "(I can't seem to compile the test program.  Guessing...)"
4465                         rp="What is the size of your file offsets (in bytes)?"
4466                         . ./myread
4467                         lseeksize="$ans"
4468                 fi
4469                 case "$fpostype" in
4470                 *_t) zzz="$fpostype"    ;;
4471                 *)   zzz="fpos_t"       ;;
4472                 esac
4473                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4474                 $cat > try.c <<EOCP
4475 #include <sys/types.h>
4476 #include <stdio.h>
4477 int main() {
4478     printf("%d\n", (int)sizeof($fpostype));
4479     exit(0);
4480 }
4481 EOCP
4482                 set try
4483                 if eval $compile_ok; then
4484                         yyy=`./try`
4485                         dflt="$lseeksize"
4486                         case "$yyy" in
4487                         '')     echo " "
4488                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4489                                 ;;
4490                         *)      fpossize=$yyy
4491                                 echo " $fpossize bytes." >&4
4492                                 ;;
4493                         esac
4494                 else
4495                         dflt="$fpossize"
4496                         echo " "
4497                         echo "(I can't compile the test program.  Guessing...)" >&4
4498                         rp="What is the size of your file positions (in bytes)?"
4499                         . ./myread
4500                         fpossize="$ans"
4501                 fi
4502                 $rm -f try.c try
4503         fi
4504         ;;
4505 esac
4506
4507
4508 case "$usemorebits" in
4509 "$define"|true|[yY]*)
4510         use64bitint="$define"
4511         uselongdouble="$define"
4512         usemorebits="$define"
4513         ;;
4514 *)      usemorebits="$undef"
4515         ;;
4516 esac
4517
4518
4519 case "$uselonglong" in
4520 "$define"|true|[yY]*)
4521         cat <<EOM >&4
4522
4523 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4524 EOM
4525         use64bitint="$define"
4526         ;;
4527 esac                          
4528 case "$use64bits" in
4529 "$define"|true|[yY]*)
4530         cat <<EOM >&4
4531
4532 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4533 EOM
4534         use64bitint="$define"
4535         ;;
4536 esac                          
4537 case "$use64bitints" in
4538 "$define"|true|[yY]*)
4539         cat <<EOM >&4
4540
4541 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4542 EOM
4543         use64bitint="$define"
4544         ;;
4545 esac                          
4546 case "$use64bitsint" in
4547 "$define"|true|[yY]*)
4548         cat <<EOM >&4
4549
4550 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4551 EOM
4552         use64bitint="$define"
4553         ;;
4554 esac                          
4555 case "$uselonglongs" in
4556 "$define"|true|[yY]*)
4557         cat <<EOM >&4
4558
4559 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4560 EOM
4561         use64bitint="$define"
4562         ;;
4563 esac                          
4564 case "$use64bitsall" in
4565 "$define"|true|[yY]*)
4566         cat <<EOM >&4
4567
4568 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4569 EOM
4570         use64bitall="$define"
4571         ;;
4572 esac                          
4573
4574 case "$ccflags" in
4575 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4576 esac
4577 case "$use64bitall" in
4578 "$define"|true|[yY]*) use64bitint="$define" ;;
4579 esac
4580
4581 case "$longsize" in
4582 8) cat <<EOM
4583
4584 You have natively 64-bit long integers.
4585 EOM
4586    val="$define"
4587    ;;
4588 *) case "$use64bitint" in
4589    "$define"|true|[yY]*) dflt='y';;
4590    *) dflt='n';;
4591    esac
4592    cat <<EOM
4593
4594 Perl can be built to take advantage of 64-bit integer types
4595 on some systems.  To do so, Configure can be run with -Duse64bitint.
4596 Choosing this option will most probably introduce binary incompatibilities.
4597
4598 If this doesn't make any sense to you, just accept the default '$dflt'.
4599 EOM
4600    rp='Try to use 64-bit integers, if available?'
4601    . ./myread
4602    case "$ans" in
4603    [yY]*) val="$define" ;;
4604    *)     val="$undef"  ;;
4605    esac
4606    ;;
4607 esac
4608 set use64bitint
4609 eval $setvar
4610
4611 case "$use64bitall" in
4612 "$define"|true|[yY]*) dflt='y' ;;
4613 *) case "$longsize" in
4614    8) dflt='y' ;;
4615    *) dflt='n' ;;
4616    esac
4617    ;;
4618 esac    
4619 cat <<EOM
4620
4621 You may also choose to try maximal 64-bitness.  It means using as much
4622 64-bitness as possible on the platform.  This in turn means even more
4623 binary incompatibilities.  On the other hand, your platform may not
4624 have any more 64-bitness available than what you already have chosen.
4625
4626 If this doesn't make any sense to you, just accept the default '$dflt'.
4627 EOM
4628 rp='Try to use maximal 64-bit support, if available?'
4629 . ./myread
4630 case "$ans" in
4631 [yY]*) val="$define" ;;
4632 *)     val="$undef"  ;;
4633 esac
4634 set use64bitall
4635 eval $setvar
4636 case "$use64bitall" in
4637 "$define")
4638         case "$use64bitint" in
4639         "$undef")
4640                 cat <<EOM
4641
4642 Since you have chosen a maximally 64-bit build, I'm also turning on
4643 the use of 64-bit integers.
4644 EOM
4645                 use64bitint="$define" ;;
4646         esac
4647         ;;
4648 esac
4649
4650 case "$use64bitint" in
4651 "$define"|true|[yY]*)
4652 : Look for a hint-file generated 'call-back-unit'.  If the
4653 : user has specified that a 64-bit perl is to be built,
4654 : we may need to set or change some other defaults.
4655         if $test -f use64bitint.cbu; then
4656                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4657                 . ./use64bitint.cbu
4658         fi
4659         case "$longsize" in
4660         4) case "$archname64" in
4661            '') archname64=64int ;;
4662            esac
4663            ;;
4664         esac
4665         ;;
4666 esac
4667
4668 case "$use64bitall" in
4669 "$define"|true|[yY]*)
4670 : Look for a hint-file generated 'call-back-unit'.  If the
4671 : user has specified that a maximally 64-bit perl is to be built,
4672 : we may need to set or change some other defaults.
4673         if $test -f use64bitall.cbu; then
4674                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4675                 . ./use64bitall.cbu
4676         fi
4677         case "$longsize" in
4678         4) case "$archname64" in
4679            ''|64int) archname64=64all ;;
4680            esac
4681            ;;
4682         esac
4683         ;;
4684 esac
4685
4686 echo " "
4687 echo "Checking for GNU C Library..." >&4
4688 cat >gnulibc.c <<EOM
4689 #include <stdio.h>
4690 int main()
4691 {
4692 #ifdef __GLIBC__
4693     exit(0);
4694 #else
4695     exit(1);
4696 #endif
4697 }
4698 EOM
4699 set gnulibc
4700 if eval $compile_ok && ./gnulibc; then
4701         val="$define"
4702         echo "You are using the GNU C Library"
4703 else
4704         val="$undef"
4705         echo "You are not using the GNU C Library"
4706 fi
4707 $rm -f gnulibc*
4708 set d_gnulibc
4709 eval $setvar
4710
4711 : see if nm is to be used to determine whether a symbol is defined or not
4712 case "$usenm" in
4713 '')
4714         dflt=''
4715         case "$d_gnulibc" in
4716         "$define")
4717                 echo " "
4718                 echo "nm probably won't work on the GNU C Library." >&4
4719                 dflt=n
4720                 ;;
4721         esac
4722         case "$dflt" in
4723         '') 
4724                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4725                         echo " "
4726                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4727                         echo "'nm' won't be sufficient on this sytem." >&4
4728                         dflt=n
4729                 fi
4730                 ;;
4731         esac
4732         case "$dflt" in
4733         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4734                 if $test $dflt -gt 20; then
4735                         dflt=y
4736                 else
4737                         dflt=n
4738                 fi
4739                 ;;
4740         esac
4741         ;;
4742 *)
4743         case "$usenm" in
4744         true|$define) dflt=y;;
4745         *) dflt=n;;
4746         esac
4747         ;;
4748 esac
4749 $cat <<EOM
4750
4751 I can use $nm to extract the symbols from your C libraries. This
4752 is a time consuming task which may generate huge output on the disk (up
4753 to 3 megabytes) but that should make the symbols extraction faster. The
4754 alternative is to skip the 'nm' extraction part and to compile a small
4755 test program instead to determine whether each symbol is present. If
4756 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4757 this may be the best solution.
4758
4759 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4760
4761 EOM
4762 rp="Shall I use $nm to extract C symbols from the libraries?"
4763 . ./myread
4764 case "$ans" in
4765 [Nn]*) usenm=false;;
4766 *) usenm=true;;
4767 esac
4768
4769 runnm=$usenm
4770 case "$reuseval" in
4771 true) runnm=false;;
4772 esac
4773
4774 : nm options which may be necessary
4775 case "$nm_opt" in
4776 '') if $test -f /mach_boot; then
4777                 nm_opt=''       # Mach
4778         elif $test -d /usr/ccs/lib; then
4779                 nm_opt='-p'     # Solaris (and SunOS?)
4780         elif $test -f /dgux; then
4781                 nm_opt='-p'     # DG-UX
4782         elif $test -f /lib64/rld; then
4783                 nm_opt='-p'     # 64-bit Irix
4784         else
4785                 nm_opt=''
4786         fi;;
4787 esac
4788
4789 : nm options which may be necessary for shared libraries but illegal
4790 : for archive libraries.  Thank you, Linux.
4791 case "$nm_so_opt" in
4792 '')     case "$myuname" in
4793         *linux*)
4794                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4795                         nm_so_opt='--dynamic'
4796                 fi
4797                 ;;
4798         esac
4799         ;;
4800 esac
4801
4802 case "$runnm" in
4803 true)
4804 : get list of predefined functions in a handy place
4805 echo " "
4806 case "$libc" in
4807 '') libc=unknown
4808         case "$libs" in
4809         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4810         esac
4811         ;;
4812 esac
4813 libnames='';
4814 case "$libs" in
4815 '') ;;
4816 *)  for thislib in $libs; do
4817         case "$thislib" in
4818         -lc|-lc_s)
4819                 : Handle C library specially below.
4820                 ;;
4821         -l*)
4822                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4823                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4824                         :
4825                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4826                         :
4827                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4828                         :
4829                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4830                         :
4831                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4832                         :
4833                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4834                         :
4835                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4836                         :
4837                 else
4838                         try=''
4839                 fi
4840                 libnames="$libnames $try"
4841                 ;;
4842         *) libnames="$libnames $thislib" ;;
4843         esac
4844         done
4845         ;;
4846 esac
4847 xxx=normal
4848 case "$libc" in
4849 unknown)
4850         set /lib/libc.$so
4851         for xxx in $libpth; do
4852                 $test -r $1 || set $xxx/libc.$so
4853                 : The messy sed command sorts on library version numbers.
4854                 $test -r $1 || \
4855                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4856                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4857                                 h
4858                                 s/[0-9][0-9]*/0000&/g
4859                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4860                                 G
4861                                 s/\n/ /' | \
4862                          $sort | $sed -e 's/^.* //'`
4863                 eval set \$$#
4864         done
4865         $test -r $1 || set /usr/ccs/lib/libc.$so
4866         $test -r $1 || set /lib/libsys_s$_a
4867         ;;
4868 *)
4869         set blurfl
4870         ;;
4871 esac
4872 if $test -r "$1"; then
4873         echo "Your (shared) C library seems to be in $1."
4874         libc="$1"
4875 elif $test -r /lib/libc && $test -r /lib/clib; then
4876         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4877         xxx=apollo
4878         libc='/lib/clib /lib/libc'
4879         if $test -r /lib/syslib; then
4880                 echo "(Your math library is in /lib/syslib.)"
4881                 libc="$libc /lib/syslib"
4882         fi
4883 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4884         echo "Your C library seems to be in $libc, as you said before."
4885 elif $test -r $incpath/usr/lib/libc$_a; then
4886         libc=$incpath/usr/lib/libc$_a;
4887         echo "Your C library seems to be in $libc.  That's fine."
4888 elif $test -r /lib/libc$_a; then
4889         libc=/lib/libc$_a;
4890         echo "Your C library seems to be in $libc.  You're normal."
4891 else
4892         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4893                 :
4894         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4895                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4896         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4897                 :
4898         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4899                 :
4900         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4901                 :
4902         else
4903                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4904         fi
4905         if $test -r "$tans"; then
4906                 echo "Your C library seems to be in $tans, of all places."
4907                 libc=$tans
4908         else
4909                 libc='blurfl'
4910         fi
4911 fi
4912 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4913         dflt="$libc"
4914         cat <<EOM
4915
4916 If the guess above is wrong (which it might be if you're using a strange
4917 compiler, or your machine supports multiple models), you can override it here.
4918
4919 EOM
4920 else
4921         dflt=''
4922         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4923         cat >&4 <<EOM
4924 I can't seem to find your C library.  I've looked in the following places:
4925
4926 EOM
4927         $sed 's/^/      /' libpath
4928         cat <<EOM
4929
4930 None of these seems to contain your C library. I need to get its name...
4931
4932 EOM
4933 fi
4934 fn=f
4935 rp='Where is your C library?'
4936 . ./getfile
4937 libc="$ans"
4938
4939 echo " "
4940 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4941 set X `cat libnames`
4942 shift
4943 xxx=files
4944 case $# in 1) xxx=file; esac
4945 echo "Extracting names from the following $xxx for later perusal:" >&4
4946 echo " "
4947 $sed 's/^/      /' libnames >&4
4948 echo " "
4949 $echo $n "This may take a while...$c" >&4
4950
4951 for file in $*; do
4952         case $file in
4953         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4954         *) $nm $nm_opt $file 2>/dev/null;;
4955         esac
4956 done >libc.tmp
4957
4958 $echo $n ".$c"
4959 $grep fprintf libc.tmp > libc.ptf
4960 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4961 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4962 xxx='[ADTSIW]'
4963 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//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.*/\1/p'";\
4968         eval $xscan;\
4969         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4970                 eval $xrun
4971 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4972         eval $xscan;\
4973         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4974                 eval $xrun
4975 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4976         eval $xscan;\
4977         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4978                 eval $xrun
4979 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4980         eval $xscan;\
4981         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4982                 eval $xrun
4983 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4984         eval $xscan;\
4985         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4986                 eval $xrun
4987 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4988                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4989         eval $xscan;\
4990         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4991                 eval $xrun
4992 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4993         eval $xscan;\
4994         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4995                 eval $xrun
4996 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4997         eval $xscan;\
4998         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4999                 eval $xrun
5000 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5001         eval $xscan;\
5002         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5003                 eval $xrun
5004 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5005         eval $xscan;\
5006         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5007                 eval $xrun
5008 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5009         eval $xscan;\
5010         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5011                 eval $xrun
5012 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5013         eval $xscan;\
5014         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5015                 eval $xrun
5016 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5017         eval $xscan;\
5018         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5019                 eval $xrun
5020 else
5021         $nm -p $* 2>/dev/null >libc.tmp
5022         $grep fprintf libc.tmp > libc.ptf
5023         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5024                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5025         then
5026                 nm_opt='-p'
5027                 eval $xrun
5028         else
5029                 echo " "
5030                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5031                 com=''
5032                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5033                         for thisname in $libnames $libc; do
5034                                 $ar t $thisname >>libc.tmp
5035                         done
5036                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5037                         echo "Ok." >&4
5038                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5039                         # Repeat libc to extract forwarders to DLL entries too
5040                         for thisname in $libnames $libc; do
5041                                 $ar tv $thisname >>libc.tmp
5042                                 # Revision 50 of EMX has bug in $ar.
5043                                 # it will not extract forwarders to DLL entries
5044                                 # Use emximp which will extract exactly them.
5045                                 emximp -o tmp.imp $thisname \
5046                                     2>/dev/null && \
5047                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5048                                     < tmp.imp >>libc.tmp
5049                                 $rm tmp.imp
5050                         done
5051                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5052                         echo "Ok." >&4
5053                 else
5054                         echo "$ar didn't seem to work right." >&4
5055                         echo "Maybe this is a Cray...trying bld instead..." >&4
5056                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5057                         then
5058                                 for thisname in $libnames; do
5059                                         bld t $libnames | \
5060                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5061                                         $ar t $thisname >>libc.tmp
5062                                 done
5063                                 echo "Ok." >&4
5064                         else
5065                                 echo "That didn't work either.  Giving up." >&4
5066                                 exit 1
5067                         fi
5068                 fi
5069         fi
5070 fi
5071 nm_extract="$com"
5072 if $test -f /lib/syscalls.exp; then
5073         echo " "
5074         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5075         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5076 fi
5077 ;;
5078 esac
5079 $rm -f libnames libpath
5080
5081 : is a C symbol defined?
5082 csym='tlook=$1;
5083 case "$3" in
5084 -v) tf=libc.tmp; tc=""; tdc="";;
5085 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5086 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5087 esac;
5088 tx=yes;
5089 case "$reuseval-$4" in
5090 true-) ;;
5091 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5092 esac;
5093 case "$tx" in
5094 yes)
5095         case "$runnm" in
5096         true)
5097                 if $contains $tlook $tf >/dev/null 2>&1;
5098                 then tval=true;
5099                 else tval=false;
5100                 fi;;
5101         *)
5102                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5103                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5104                 then tval=true;
5105                 else tval=false;
5106                 fi;
5107                 $rm -f t t.c;;
5108         esac;;
5109 *)
5110         case "$tval" in
5111         $define) tval=true;;
5112         *) tval=false;;
5113         esac;;
5114 esac;
5115 eval "$2=$tval"'
5116
5117 : define an is-in-libc? function
5118 inlibc='echo " "; td=$define; tu=$undef;
5119 sym=$1; var=$2; eval "was=\$$2";
5120 tx=yes;
5121 case "$reuseval$was" in
5122 true) ;;
5123 true*) tx=no;;
5124 esac;
5125 case "$tx" in
5126 yes)
5127         set $sym tres -f;
5128         eval $csym;
5129         case "$tres" in
5130         true)
5131                 echo "$sym() found." >&4;
5132                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5133         *)
5134                 echo "$sym() NOT found." >&4;
5135                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5136         esac;;
5137 *)
5138         case "$was" in
5139         $define) echo "$sym() found." >&4;;
5140         *) echo "$sym() NOT found." >&4;;
5141         esac;;
5142 esac'
5143
5144 : see if sqrtl exists
5145 set sqrtl d_sqrtl
5146 eval $inlibc
5147
5148 case "$ccflags" in
5149 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5150 esac
5151
5152 case "$uselongdouble" in
5153 $define|true|[yY]*)     dflt='y';;
5154 *) dflt='n';;
5155 esac
5156 cat <<EOM
5157
5158 Perl can be built to take advantage of long doubles which
5159 (if available) may give more accuracy and range for floating point numbers.
5160
5161 If this doesn't make any sense to you, just accept the default '$dflt'.
5162 EOM
5163 rp='Try to use long doubles if available?'
5164 . ./myread
5165 case "$ans" in
5166 y|Y)    val="$define"   ;;
5167 *)      val="$undef"    ;;
5168 esac
5169 set uselongdouble
5170 eval $setvar
5171
5172 case "$uselongdouble" in
5173 true|[yY]*) uselongdouble="$define" ;;
5174 esac
5175
5176 case "$uselongdouble" in
5177 $define)
5178 : Look for a hint-file generated 'call-back-unit'.  If the
5179 : user has specified that long doubles should be used,
5180 : we may need to set or change some other defaults.
5181         if $test -f uselongdouble.cbu; then
5182                 echo "Your platform has some specific hints for long doubles, using them..."
5183                 . ./uselongdouble.cbu
5184         else
5185                 $cat <<EOM
5186 (Your platform doesn't have any specific hints for long doubles.)
5187 EOM
5188         fi
5189         ;;
5190 esac
5191
5192 case "$uselongdouble:$d_sqrtl" in
5193 $define:$undef)
5194                 $cat <<EOM >&4
5195
5196 *** You requested the use of long doubles but you do not seem to have
5197 *** the mathematic functions for long doubles.  I'm disabling the use
5198 *** of long doubles.
5199
5200 EOM
5201         uselongdouble=$undef
5202         ;;
5203 esac
5204
5205 : check for length of double
5206 echo " "
5207 case "$doublesize" in
5208 '')
5209         echo "Checking to see how big your double precision numbers are..." >&4
5210         $cat >try.c <<'EOCP'
5211 #include <stdio.h>
5212 int main()
5213 {
5214     printf("%d\n", (int)sizeof(double));
5215     exit(0);
5216 }
5217 EOCP
5218         set try
5219         if eval $compile_ok; then
5220                 doublesize=`./try`
5221                 echo "Your double is $doublesize bytes long."
5222         else
5223                 dflt='8'
5224                 echo "(I can't seem to compile the test program.  Guessing...)"
5225                 rp="What is the size of a double precision number (in bytes)?"
5226                 . ./myread
5227                 doublesize="$ans"
5228         fi
5229         ;;
5230 esac
5231 $rm -f try.c try
5232
5233 : check for long doubles
5234 echo " "
5235 echo "Checking to see if you have long double..." >&4
5236 echo 'int main() { long double x = 7.0; }' > try.c
5237 set try
5238 if eval $compile; then
5239         val="$define"
5240         echo "You have long double."
5241 else
5242         val="$undef"
5243         echo "You do not have long double."
5244 fi
5245 $rm try.*
5246 set d_longdbl
5247 eval $setvar
5248
5249 : check for length of long double
5250 case "${d_longdbl}${longdblsize}" in
5251 $define)
5252         echo " "
5253         echo "Checking to see how big your long doubles are..." >&4
5254         $cat >try.c <<'EOCP'
5255 #include <stdio.h>
5256 int main()
5257 {
5258         printf("%d\n", sizeof(long double));
5259 }
5260 EOCP
5261         set try
5262         set try
5263         if eval $compile; then
5264                 longdblsize=`./try$exe_ext`
5265                 echo "Your long doubles are $longdblsize bytes long."
5266         else
5267                 dflt='8'
5268                 echo " "
5269                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5270                 rp="What is the size of a long double (in bytes)?"
5271                 . ./myread
5272                 longdblsize="$ans"
5273         fi
5274         if $test "X$doublesize" = "X$longdblsize"; then
5275                 echo "(That isn't any different from an ordinary double.)"
5276         fi      
5277         ;;
5278 esac
5279 $rm -f try.* try
5280
5281 case "$useperlio" in
5282 $define|true|[yY]*)     dflt='y';;
5283 *) dflt='n';;
5284 esac
5285 cat <<EOM
5286
5287 Previous version of $package used the standard IO mechanisms as
5288 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
5289 alternate IO mechanisms via the PerlIO abstraction layer, but the
5290 stdio mechanism is still the default.  This abstraction layer can
5291 use AT&T's sfio (if you already have sfio installed) or regular stdio.
5292 Using PerlIO with sfio may cause problems with some extension modules.
5293
5294 If this doesn't make any sense to you, just accept the default '$dflt'.
5295 EOM
5296 rp='Use the experimental PerlIO abstraction layer?'
5297 . ./myread
5298 case "$ans" in
5299 y|Y) 
5300         val="$define"
5301         ;;     
5302 *)      
5303         echo "Ok, doing things the stdio way."
5304         val="$undef"
5305         ;;
5306 esac
5307 set useperlio
5308 eval $setvar 
5309
5310 case "$usesocks" in
5311 $define|true|[yY]*)
5312         case "$useperlio" in
5313         $define|true|[yY]*) ;;
5314         *)      cat >&4 <<EOM
5315
5316 You are using the SOCKS proxy protocol library which means that you
5317 should also use the PerlIO layer.  You may be headed for trouble.
5318
5319 EOM
5320                 ;;
5321         esac
5322         ;;
5323 esac
5324
5325         
5326 : determine the architecture name
5327 echo " "
5328 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5329         tarch=`arch`"-$osname"
5330 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5331         if uname -m > tmparch 2>&1 ; then
5332                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5333                         -e 's/$/'"-$osname/" tmparch`
5334         else
5335                 tarch="$osname"
5336         fi
5337         $rm -f tmparch
5338 else
5339         tarch="$osname"
5340 fi
5341 case "$myarchname" in
5342 ''|"$tarch") ;;
5343 *)
5344         echo "(Your architecture name used to be $myarchname.)"
5345         archname=''
5346         ;;
5347 esac
5348 myarchname="$tarch"
5349 case "$archname" in
5350 '') dflt="$tarch";;
5351 *) dflt="$archname";;
5352 esac
5353 rp='What is your architecture name'
5354 . ./myread
5355 archname="$ans"
5356 case "$usethreads" in
5357 $define)
5358         echo "Threads selected." >&4
5359         case "$archname" in
5360         *-thread*) echo "...and architecture name already has -thread." >&4
5361                 ;;
5362         *)      archname="$archname-thread"
5363                 echo "...setting architecture name to $archname." >&4
5364                 ;;
5365         esac
5366         ;;
5367 esac
5368 case "$usemultiplicity" in
5369 $define)
5370         echo "Multiplicity selected." >&4
5371         case "$archname" in
5372         *-multi*) echo "...and architecture name already has -multi." >&4
5373                 ;;
5374         *)      archname="$archname-multi"
5375                 echo "...setting architecture name to $archname." >&4
5376                 ;;
5377         esac
5378         ;;
5379 esac
5380 case "$use64bitint$use64bitall" in
5381 *"$define"*)
5382         case "$archname64" in
5383         '')
5384                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5385                 ;;
5386         *)
5387                 case "$use64bitint" in
5388                 "$define") echo "64 bit integers selected." >&4 ;;
5389                 esac
5390                 case "$use64bitall" in
5391                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5392                 esac
5393                 case "$archname" in
5394                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5395                         ;;
5396                 *)      archname="$archname-$archname64"
5397                         echo "...setting architecture name to $archname." >&4
5398                         ;;
5399                 esac
5400                 ;;
5401         esac
5402 esac
5403 case "$uselongdouble" in
5404 $define)
5405         echo "Long doubles selected." >&4
5406         case "$longdblsize" in
5407         $doublesize)
5408                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5409                 ;;
5410         *)
5411                 case "$archname" in
5412                 *-ld*) echo "...and architecture name already has -ld." >&4
5413                         ;;
5414                 *)      archname="$archname-ld"
5415                         echo "...setting architecture name to $archname." >&4
5416                         ;;
5417                 esac
5418                 ;;
5419         esac
5420         ;;
5421 esac
5422 case "$useperlio" in
5423 $define)
5424         echo "Perlio selected." >&4
5425         case "$archname" in
5426         *-perlio*) echo "...and architecture name already has -perlio." >&4
5427                 ;;
5428         *)      archname="$archname-perlio"
5429                 echo "...setting architecture name to $archname." >&4
5430                 ;;
5431         esac
5432         ;;
5433 esac
5434
5435 : determine root of directory hierarchy where package will be installed.
5436 case "$prefix" in
5437 '')
5438         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5439         ;;
5440 *)
5441         dflt="$prefix"
5442         ;;
5443 esac
5444 $cat <<EOM
5445
5446 By default, $package will be installed in $dflt/bin, manual pages
5447 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5448 installation directories. Typically this is something like /usr/local.
5449 If you wish to have binaries under /usr/bin but other parts of the
5450 installation under /usr/local, that's ok: you will be prompted
5451 separately for each of the installation directories, the prefix being
5452 only used to set the defaults.
5453
5454 EOM
5455 fn=d~
5456 rp='Installation prefix to use?'
5457 . ./getfile
5458 oldprefix=''
5459 case "$prefix" in
5460 '') ;;
5461 *)
5462         case "$ans" in
5463         "$prefix") ;;
5464         *) oldprefix="$prefix";;
5465         esac
5466         ;;
5467 esac
5468 prefix="$ans"
5469 prefixexp="$ansexp"
5470
5471 : is AFS running?
5472 echo " "
5473 case "$afs" in
5474 $define|true)   afs=true ;;
5475 $undef|false)   afs=false ;;
5476 *)      if test -d /afs; then
5477                 afs=true
5478         else
5479                 afs=false
5480         fi
5481         ;;
5482 esac
5483 if $afs; then
5484         echo "AFS may be running... I'll be extra cautious then..." >&4
5485 else
5486         echo "AFS does not seem to be running..." >&4
5487 fi
5488
5489 : determine installation prefix for where package is to be installed.
5490 if $afs; then 
5491 $cat <<EOM
5492
5493 Since you are running AFS, I need to distinguish the directory in which
5494 files will reside from the directory in which they are installed (and from
5495 which they are presumably copied to the former directory by occult means).
5496
5497 EOM
5498         case "$installprefix" in
5499         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5500         *) dflt="$installprefix";;
5501         esac
5502 else
5503 $cat <<EOM
5504
5505 In some special cases, particularly when building $package for distribution,
5506 it is convenient to distinguish between the directory in which files should 
5507 be installed from the directory ($prefix) in which they 
5508 will eventually reside.  For most users, these two directories are the same.
5509
5510 EOM
5511         case "$installprefix" in
5512         '') dflt=$prefix ;;
5513         *) dflt=$installprefix;;
5514         esac
5515 fi
5516 fn=d~
5517 rp='What installation prefix should I use for installing files?'
5518 . ./getfile
5519 installprefix="$ans"
5520 installprefixexp="$ansexp"
5521
5522 : set the prefixit variable, to compute a suitable default value
5523 prefixit='case "$3" in
5524 ""|none)
5525         case "$oldprefix" in
5526         "") eval "$1=\"\$$2\"";;
5527         *)
5528                 case "$3" in
5529                 "") eval "$1=";;
5530                 none)
5531                         eval "tp=\"\$$2\"";
5532                         case "$tp" in
5533                         ""|" ") eval "$1=\"\$$2\"";;
5534                         *) eval "$1=";;
5535                         esac;;
5536                 esac;;
5537         esac;;
5538 *)
5539         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5540         case "$tp" in
5541         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5542         /*-$oldprefix/*|\~*-$oldprefix/*)
5543                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5544         *) eval "$1=\"\$$2\"";;
5545         esac;;
5546 esac'
5547
5548
5549 : get the patchlevel
5550 echo " "
5551 echo "Getting the current patchlevel..." >&4
5552 if $test -r $rsrc/patchlevel.h;then
5553         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5554         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5555         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5556         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5557         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5558         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5559 else
5560         revision=0
5561         patchlevel=0
5562         subversion=0
5563         api_revision=0
5564         api_version=0
5565         api_subversion=0
5566 fi
5567 $echo "(You have $package version $patchlevel subversion $subversion.)"
5568 case "$osname" in
5569 dos|vms)
5570         : XXX Should be a Configure test for double-dots in filenames.
5571         version=`echo $revision $patchlevel $subversion | \
5572                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5573         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5574                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5575         ;;
5576 *)
5577         version=`echo $revision $patchlevel $subversion | \
5578                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5579         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5580                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5581         ;;
5582 esac
5583 : Special case the 5.005_xx maintenance series, which used 5.005
5584 : without any subversion label as a subdirectory in $sitelib
5585 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5586         api_versionstring='5.005'
5587 fi
5588
5589 : determine installation style
5590 : For now, try to deduce it from prefix unless it is already set.
5591 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5592 case "$installstyle" in
5593 '')     case "$prefix" in
5594                 *perl*) dflt='lib';;
5595                 *) dflt='lib/perl5' ;;
5596         esac
5597         ;;
5598 *)      dflt="$installstyle" ;;
5599 esac
5600 : Probably not worth prompting for this since we prompt for all
5601 : the directories individually, and the prompt would be too long and
5602 : confusing anyway.
5603 installstyle=$dflt
5604
5605 : determine where private library files go
5606 : Usual default is /usr/local/lib/perl5/$version.
5607 : Also allow things like /opt/perl/lib/$version, since 
5608 : /opt/perl/lib/perl5... would be redundant.
5609 : The default "style" setting is made in installstyle.U
5610 case "$installstyle" in
5611 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5612 *)       set dflt privlib lib/$version ;;
5613 esac
5614 eval $prefixit
5615 $cat <<EOM
5616
5617 There are some auxiliary files for $package that need to be put into a
5618 private library directory that is accessible by everyone.
5619
5620 EOM
5621 fn=d~+
5622 rp='Pathname where the private library files will reside?'
5623 . ./getfile
5624 privlib="$ans"
5625 privlibexp="$ansexp"
5626 : Change installation prefix, if necessary.
5627 if $test X"$prefix" != X"$installprefix"; then
5628         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5629 else
5630         installprivlib="$privlibexp"
5631 fi
5632
5633 : set the prefixup variable, to restore leading tilda escape
5634 prefixup='case "$prefixexp" in
5635 "$prefix") ;;
5636 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5637 esac'
5638
5639 : determine where public architecture dependent libraries go
5640 set archlib archlib
5641 eval $prefixit
5642 : privlib default is /usr/local/lib/$package/$version
5643 : archlib default is /usr/local/lib/$package/$version/$archname
5644 : privlib may have an optional trailing /share.
5645 tdflt=`echo $privlib | $sed 's,/share$,,'`
5646 tdflt=$tdflt/$archname
5647 case "$archlib" in
5648 '')     dflt=$tdflt
5649         ;;
5650 *)      dflt="$archlib"
5651     ;;
5652 esac
5653 $cat <<EOM
5654
5655 $spackage contains architecture-dependent library files.  If you are
5656 sharing libraries in a heterogeneous environment, you might store
5657 these files in a separate location.  Otherwise, you can just include
5658 them with the rest of the public library files.
5659
5660 EOM
5661 fn=d+~
5662 rp='Where do you want to put the public architecture-dependent libraries?'
5663 . ./getfile
5664 archlib="$ans"
5665 archlibexp="$ansexp"
5666 if $test X"$archlib" = X"$privlib"; then
5667         d_archlib="$undef"
5668 else
5669         d_archlib="$define"
5670 fi
5671 : Change installation prefix, if necessary.
5672 if $test X"$prefix" != X"$installprefix"; then
5673         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5674 else
5675         installarchlib="$archlibexp"
5676 fi
5677
5678
5679 : Binary compatibility with 5.005 is not possible for builds
5680 : with advanced features
5681 case "$usethreads$usemultiplicity" in
5682 *define*)
5683         bincompat5005="$undef"
5684         d_bincompat5005="$undef"
5685         ;;
5686 *)      $cat <<EOM
5687
5688 This version of Perl can be compiled for binary compatibility with 5.005.
5689 If you decide to do so, you will be able to continue using most of the
5690 extensions that were compiled for Perl 5.005.
5691
5692 EOM
5693         case "$bincompat5005$d_bincompat5005" in
5694         *"$undef"*) dflt=n ;;
5695         *) dflt=y ;;
5696         esac
5697         rp='Binary compatibility with Perl 5.005?'
5698         . ./myread
5699         case "$ans" in
5700         y*) val="$define" ;;
5701         *)  val="$undef" ;;
5702         esac
5703         set d_bincompat5005
5704         eval $setvar
5705         case "$d_bincompat5005" in
5706         "$define")
5707                 bincompat5005="$define"
5708                 ;;
5709         *)      bincompat5005="$undef"
5710                 d_bincompat5005="$undef"
5711                 ;;
5712         esac
5713         ;;
5714 esac
5715
5716
5717 : see if setuid scripts can be secure
5718 $cat <<EOM
5719
5720 Some kernels have a bug that prevents setuid #! scripts from being
5721 secure.  Some sites have disabled setuid #! scripts because of this.
5722
5723 First let's decide if your kernel supports secure setuid #! scripts.
5724 (If setuid #! scripts would be secure but have been disabled anyway,
5725 don't say that they are secure if asked.)
5726
5727 EOM
5728
5729 val="$undef"
5730 if $test -d /dev/fd; then
5731         echo "#!$ls" >reflect
5732         chmod +x,u+s reflect
5733         ./reflect >flect 2>&1
5734         if $contains "/dev/fd" flect >/dev/null; then
5735                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5736                 val="$define"
5737         else
5738                 $cat <<EOM
5739 If you are not sure if they are secure, I can check but I'll need a
5740 username and password different from the one you are using right now.
5741 If you don't have such a username or don't want me to test, simply
5742 enter 'none'.
5743
5744 EOM
5745                 rp='Other username to test security of setuid scripts with?'
5746                 dflt='none'
5747                 . ./myread
5748                 case "$ans" in
5749                 n|none)
5750                         case "$d_suidsafe" in
5751                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5752                                 dflt=n;;
5753                         "$undef")
5754                                 echo "Well, the $hint value is *not* secure." >&4
5755                                 dflt=n;;
5756                         *)      echo "Well, the $hint value *is* secure." >&4
5757                                 dflt=y;;
5758                         esac
5759                         ;;
5760                 *)
5761                         $rm -f reflect flect
5762                         echo "#!$ls" >reflect
5763                         chmod +x,u+s reflect
5764                         echo >flect
5765                         chmod a+w flect
5766                         echo '"su" will (probably) prompt you for '"$ans's password."
5767                         su $ans -c './reflect >flect'
5768                         if $contains "/dev/fd" flect >/dev/null; then
5769                                 echo "Okay, it looks like setuid scripts are secure." >&4
5770                                 dflt=y
5771                         else
5772                                 echo "I don't think setuid scripts are secure." >&4
5773                                 dflt=n
5774                         fi
5775                         ;;
5776                 esac
5777                 rp='Does your kernel have *secure* setuid scripts?'
5778                 . ./myread
5779                 case "$ans" in
5780                 [yY]*)  val="$define";;
5781                 *)      val="$undef";;
5782                 esac
5783         fi
5784 else
5785         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5786         echo "(That's for file descriptors, not floppy disks.)"
5787         val="$undef"
5788 fi
5789 set d_suidsafe
5790 eval $setvar
5791
5792 $rm -f reflect flect
5793
5794 : now see if they want to do setuid emulation
5795 echo " "
5796 val="$undef"
5797 case "$d_suidsafe" in
5798 "$define")
5799         val="$undef"
5800         echo "No need to emulate SUID scripts since they are secure here." >& 4
5801         ;;
5802 *)
5803         $cat <<EOM
5804 Some systems have disabled setuid scripts, especially systems where
5805 setuid scripts cannot be secure.  On systems where setuid scripts have
5806 been disabled, the setuid/setgid bits on scripts are currently
5807 useless.  It is possible for $package to detect those bits and emulate
5808 setuid/setgid in a secure fashion.  This emulation will only work if
5809 setuid scripts have been disabled in your kernel.
5810
5811 EOM
5812         case "$d_dosuid" in
5813         "$define") dflt=y ;;
5814         *) dflt=n ;;
5815         esac
5816         rp="Do you want to do setuid/setgid emulation?"
5817         . ./myread
5818         case "$ans" in
5819         [yY]*)  val="$define";;
5820         *)      val="$undef";;
5821         esac
5822         ;;
5823 esac
5824 set d_dosuid
5825 eval $setvar
5826
5827 : determine filename position in cpp output
5828 echo " "
5829 echo "Computing filename position in cpp output for #include directives..." >&4
5830 echo '#include <stdio.h>' > foo.c
5831 $cat >fieldn <<EOF
5832 $startsh
5833 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5834 $grep '^[       ]*#.*stdio\.h' | \
5835 while read cline; do
5836         pos=1
5837         set \$cline
5838         while $test \$# -gt 0; do
5839                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5840                         echo "\$pos"
5841                         exit 0
5842                 fi
5843                 shift
5844                 pos=\`expr \$pos + 1\`
5845         done
5846 done
5847 EOF
5848 chmod +x fieldn
5849 fieldn=`./fieldn`
5850 $rm -f foo.c fieldn
5851 case $fieldn in
5852 '') pos='???';;
5853 1) pos=first;;
5854 2) pos=second;;
5855 3) pos=third;;
5856 *) pos="${fieldn}th";;
5857 esac
5858 echo "Your cpp writes the filename in the $pos field of the line."
5859
5860 : locate header file
5861 $cat >findhdr <<EOF
5862 $startsh
5863 wanted=\$1
5864 name=''
5865 for usrincdir in $usrinc
5866 do
5867         if test -f \$usrincdir/\$wanted; then
5868                 echo "\$usrincdir/\$wanted"
5869                 exit 0
5870         fi
5871 done
5872 awkprg='{ print \$$fieldn }'
5873 echo "#include <\$wanted>" > foo\$\$.c
5874 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5875 $grep "^[       ]*#.*\$wanted" | \
5876 while read cline; do
5877         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5878         case "\$name" in
5879         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5880         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5881         *) exit 2;;
5882         esac;
5883 done;
5884 #
5885 # status = 0: grep returned 0 lines, case statement not executed
5886 # status = 1: headerfile found
5887 # status = 2: while loop executed, no headerfile found
5888 #
5889 status=\$?
5890 $rm -f foo\$\$.c;
5891 if test \$status -eq 1; then
5892         exit 0;
5893 fi
5894 exit 1
5895 EOF
5896 chmod +x findhdr
5897
5898 : define an alternate in-header-list? function
5899 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5900 cont=true; xxf="echo \"<\$1> found.\" >&4";
5901 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5902 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5903 esac;
5904 case $# in 4) instead=instead;; *) instead="at last";; esac;
5905 while $test "$cont"; do
5906         xxx=`./findhdr $1`
5907         var=$2; eval "was=\$$2";
5908         if $test "$xxx" && $test -r "$xxx";
5909         then eval $xxf;
5910         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5911                 cont="";
5912         else eval $xxnf;
5913         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5914         set $yyy; shift; shift; yyy=$@;
5915         case $# in 0) cont="";;
5916         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5917                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5918         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5919                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5920         esac;
5921 done;
5922 while $test "$yyy";
5923 do set $yyy; var=$2; eval "was=\$$2";
5924         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5925         set $yyy; shift; shift; yyy=$@;
5926 done'
5927
5928 : see if this is a malloc.h system
5929 set malloc.h i_malloc
5930 eval $inhdr
5931
5932 : see if stdlib is available
5933 set stdlib.h i_stdlib
5934 eval $inhdr
5935
5936 : determine which malloc to compile in
5937 echo " "
5938 case "$usemymalloc" in
5939 ''|[yY]*|true|$define)  dflt='y' ;;
5940 *)      dflt='n' ;;
5941 esac
5942 rp="Do you wish to attempt to use the malloc that comes with $package?"
5943 . ./myread
5944 usemymalloc="$ans"
5945 case "$ans" in
5946 y*|true)
5947         usemymalloc='y'
5948         mallocsrc='malloc.c'
5949         mallocobj="malloc$_o"
5950         d_mymalloc="$define"
5951         case "$libs" in
5952         *-lmalloc*)
5953                 : Remove malloc from list of libraries to use
5954                 echo "Removing unneeded -lmalloc from library list" >&4
5955                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5956                 shift
5957                 libs="$*"
5958                 echo "libs = $libs" >&4
5959                 ;;
5960         esac
5961         ;;
5962 *)
5963         usemymalloc='n'
5964         mallocsrc=''
5965         mallocobj=''
5966         d_mymalloc="$undef"
5967         ;;
5968 esac
5969
5970 : compute the return types of malloc and free
5971 echo " "
5972 $cat >malloc.c <<END
5973 #$i_malloc I_MALLOC
5974 #$i_stdlib I_STDLIB
5975 #include <stdio.h>
5976 #include <sys/types.h>
5977 #ifdef I_MALLOC
5978 #include <malloc.h>
5979 #endif
5980 #ifdef I_STDLIB
5981 #include <stdlib.h>
5982 #endif
5983 #ifdef TRY_MALLOC
5984 void *malloc();
5985 #endif
5986 #ifdef TRY_FREE
5987 void free();
5988 #endif
5989 END
5990 case "$malloctype" in
5991 '')
5992         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5993                 malloctype='void *'
5994         else
5995                 malloctype='char *'
5996         fi
5997         ;;
5998 esac
5999 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6000
6001 case "$freetype" in
6002 '')
6003         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6004                 freetype='void'
6005         else
6006                 freetype='int'
6007         fi
6008         ;;
6009 esac
6010 echo "Your system uses $freetype free(), it would seem." >&4
6011 $rm -f malloc.[co]
6012 $cat <<EOM
6013
6014 After $package is installed, you may wish to install various
6015 add-on modules and utilities.  Typically, these add-ons will
6016 be installed under $prefix with the rest
6017 of this package.  However, you may wish to install such add-ons
6018 elsewhere under a different prefix.
6019
6020 If you do not wish to put everything under a single prefix, that's
6021 ok.  You will be prompted for the individual locations; this siteprefix
6022 is only used to suggest the defaults.
6023
6024 The default should be fine for most people.
6025
6026 EOM
6027 fn=d~+
6028 rp='Installation prefix to use for add-on modules and utilities?'
6029 : XXX Here might be another good place for an installstyle setting.
6030 case "$siteprefix" in
6031 '') dflt=$prefix ;;
6032 *)  dflt=$siteprefix ;;
6033 esac
6034 . ./getfile
6035 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6036 oldsiteprefix=''
6037 case "$siteprefix" in
6038 '') ;;
6039 *)      case "$ans" in
6040         "$prefix") ;;
6041         *) oldsiteprefix="$prefix";;
6042         esac
6043         ;;
6044 esac
6045 siteprefix="$ans"
6046 siteprefixexp="$ansexp"
6047
6048 : determine where site specific libraries go.
6049 : Usual default is /usr/local/lib/perl5/site_perl/$version
6050 : The default "style" setting is made in installstyle.U
6051 : XXX No longer works with Prefixit stuff.
6052 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6053 case "$sitelib" in
6054 '') case "$installstyle" in
6055         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6056         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6057         esac
6058         ;;
6059 *)      dflt="$sitelib"
6060         ;;
6061 esac
6062 $cat <<EOM
6063
6064 The installation process will create a directory for
6065 site-specific extensions and modules.  Most users find it convenient
6066 to place all site-specific files in this directory rather than in the
6067 main distribution directory.
6068
6069 EOM
6070 fn=d~+
6071 rp='Pathname for the site-specific library files?'
6072 . ./getfile
6073 sitelib="$ans"
6074 sitelibexp="$ansexp"
6075 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6076 : Change installation prefix, if necessary.
6077 if $test X"$prefix" != X"$installprefix"; then
6078         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6079 else
6080         installsitelib="$sitelibexp"
6081 fi
6082
6083 : determine where site specific architecture-dependent libraries go.
6084 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6085 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6086 : sitelib may have an optional trailing /share.
6087 case "$sitearch" in
6088 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6089         dflt="$dflt/$archname"
6090         ;;
6091 *)      dflt="$sitearch"
6092         ;;
6093 esac
6094 set sitearch sitearch none
6095 eval $prefixit
6096 $cat <<EOM
6097
6098 The installation process will also create a directory for
6099 architecture-dependent site-specific extensions and modules.
6100
6101 EOM
6102 fn=d~+
6103 rp='Pathname for the site-specific architecture-dependent library files?'
6104 . ./getfile
6105 sitearch="$ans"
6106 sitearchexp="$ansexp"
6107 : Change installation prefix, if necessary.
6108 if $test X"$prefix" != X"$installprefix"; then
6109         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6110 else
6111         installsitearch="$sitearchexp"
6112 fi
6113
6114 $cat <<EOM
6115
6116 The installation process will also create a directory for
6117 vendor-supplied add-ons.  Vendors who supply perl with their system
6118 may find it convenient to place all vendor-supplied files in this
6119 directory rather than in the main distribution directory.  This will
6120 ease upgrades between binary-compatible maintenance versions of perl.
6121
6122 Of course you may also use these directories in whatever way you see
6123 fit.  For example, you might use them to access modules shared over a
6124 company-wide network.
6125
6126 The default answer should be fine for most people.
6127 This causes further questions about vendor add-ons to be skipped
6128 and no vendor-specific directories will be configured for perl.
6129
6130 EOM
6131 rp='Do you want to configure vendor-specific add-on directories?'
6132 case "$usevendorprefix" in
6133 define|true|[yY]*) dflt=y ;;
6134 *)      : User may have set vendorprefix directly on Configure command line.
6135         case "$vendorprefix" in
6136         ''|' ') dflt=n ;;
6137         *)      dflt=y ;;
6138         esac
6139         ;;
6140 esac
6141 . ./myread
6142 case "$ans" in
6143 [yY]*)  fn=d~+
6144         rp='Installation prefix to use for vendor-supplied add-ons?'
6145         case "$vendorprefix" in
6146         '') dflt='' ;;
6147         *)  dflt=$vendorprefix ;;
6148         esac
6149         . ./getfile
6150         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6151         oldvendorprefix=''
6152         case "$vendorprefix" in
6153         '') ;;
6154         *)      case "$ans" in
6155                 "$prefix") ;;
6156                 *) oldvendorprefix="$prefix";;
6157                 esac
6158                 ;;
6159         esac
6160         usevendorprefix="$define"
6161         vendorprefix="$ans"
6162         vendorprefixexp="$ansexp"
6163         ;;
6164 *)      usevendorprefix="$undef"
6165         vendorprefix=''
6166         vendorprefixexp=''
6167         ;;
6168 esac
6169
6170 case "$vendorprefix" in
6171 '')     d_vendorlib="$undef"
6172         vendorlib=''
6173         vendorlibexp=''
6174         ;;
6175 *)      d_vendorlib="$define"
6176         : determine where vendor-supplied modules go.
6177         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6178         case "$vendorlib" in
6179         '')
6180                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6181                 case "$installstyle" in
6182                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6183                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6184                 esac
6185                 ;;
6186         *)      dflt="$vendorlib"
6187                 ;;
6188         esac
6189         fn=d~+
6190         rp='Pathname for the vendor-supplied library files?'
6191         . ./getfile
6192         vendorlib="$ans"
6193         vendorlibexp="$ansexp"
6194         ;;
6195 esac
6196 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6197 : Change installation prefix, if necessary.
6198 if $test X"$prefix" != X"$installprefix"; then
6199         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6200 else
6201         installvendorlib="$vendorlibexp"
6202 fi
6203
6204 case "$vendorprefix" in
6205 '')     d_vendorarch="$undef"
6206         vendorarch=''
6207         vendorarchexp=''
6208         ;;
6209 *)      d_vendorarch="$define"
6210         : determine where vendor-supplied architecture-dependent libraries go.
6211         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6212         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6213         : vendorlib may have an optional trailing /share.
6214         case "$vendorarch" in
6215         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6216                 dflt="$dflt/$archname"
6217                 ;;
6218         *)      dflt="$vendorarch" ;;
6219         esac
6220         fn=d~+
6221         rp='Pathname for vendor-supplied architecture-dependent files?'
6222         . ./getfile
6223         vendorarch="$ans"
6224         vendorarchexp="$ansexp"
6225         ;;
6226 esac
6227 : Change installation prefix, if necessary.
6228 if $test X"$prefix" != X"$installprefix"; then
6229         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6230 else
6231         installvendorarch="$vendorarchexp"
6232 fi
6233
6234 : Final catch-all directories to search
6235 $cat <<EOM
6236
6237 Lastly, you can have perl look in other directories for extensions and
6238 modules in addition to those already specified.
6239 These directories will be searched after 
6240         $sitearch 
6241         $sitelib 
6242 EOM
6243 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6244 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6245 echo ' '
6246 case "$otherlibdirs" in
6247 ''|' ') dflt='none' ;;
6248 *)      dflt="$otherlibdirs" ;;
6249 esac
6250 $cat <<EOM
6251 Enter a colon-separated set of extra paths to include in perl's @INC
6252 search path, or enter 'none' for no extra paths.
6253
6254 EOM
6255
6256 rp='Colon-separated list of additional directories for perl to search?'
6257 . ./myread
6258 case "$ans" in
6259 ' '|''|none)    otherlibdirs=' ' ;;     
6260 *)      otherlibdirs="$ans" ;;
6261 esac
6262 case "$otherlibdirs" in
6263 ' ') val=$undef ;;
6264 *)      val=$define ;;
6265 esac
6266 set d_perl_otherlibdirs
6267 eval $setvar
6268
6269 : Cruising for prototypes
6270 echo " "
6271 echo "Checking out function prototypes..." >&4
6272 $cat >prototype.c <<'EOCP'
6273 int main(int argc, char *argv[]) {
6274         exit(0);}
6275 EOCP
6276 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6277         echo "Your C compiler appears to support function prototypes."
6278         val="$define"
6279 else
6280         echo "Your C compiler doesn't seem to understand function prototypes."
6281         val="$undef"
6282 fi
6283 set prototype
6284 eval $setvar
6285 $rm -f prototype*
6286
6287 case "$prototype" in
6288 "$define") ;;
6289 *)      ansi2knr='ansi2knr'
6290         echo " "
6291         cat <<EOM >&4
6292
6293 $me:  FATAL ERROR:
6294 This version of $package can only be compiled by a compiler that 
6295 understands function prototypes.  Unfortunately, your C compiler 
6296         $cc $ccflags
6297 doesn't seem to understand them.  Sorry about that.
6298
6299 If GNU cc is available for your system, perhaps you could try that instead.  
6300
6301 Eventually, we hope to support building Perl with pre-ANSI compilers.
6302 If you would like to help in that effort, please contact <perlbug@perl.org>.
6303
6304 Aborting Configure now.
6305 EOM
6306         exit 2
6307         ;;
6308 esac
6309
6310 : determine where public executables go
6311 echo " "
6312 set dflt bin bin
6313 eval $prefixit
6314 fn=d~
6315 rp='Pathname where the public executables will reside?'
6316 . ./getfile
6317 if $test "X$ansexp" != "X$binexp"; then
6318         installbin=''
6319 fi
6320 bin="$ans"
6321 binexp="$ansexp"
6322 : Change installation prefix, if necessary.
6323 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6324 if $test X"$prefix" != X"$installprefix"; then
6325         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6326 else
6327         installbin="$binexp"
6328 fi
6329
6330 : Find perl5.005 or later.
6331 echo "Looking for a previously installed perl5.005 or later... "
6332 case "$perl5" in
6333 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6334                 : Check if this perl is recent and can load a simple module
6335                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6336                         perl5=$tdir/perl
6337                         break;
6338                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6339                         perl5=$tdir/perl
6340                         break;
6341                 fi
6342         done
6343         ;;
6344 *)      perl5="$perl5"
6345         ;;
6346 esac
6347 case "$perl5" in
6348 '')     echo "None found.  That's ok.";;
6349 *)      echo "Using $perl5." ;;
6350 esac
6351
6352 : Determine list of previous versions to include in @INC
6353 $cat > getverlist <<EOPL
6354 #!$perl5 -w
6355 use File::Basename;
6356 \$api_versionstring = "$api_versionstring";
6357 \$version = "$version";
6358 \$stem = "$sitelib_stem";
6359 \$archname = "$archname";
6360 EOPL
6361         $cat >> getverlist <<'EOPL'
6362 # Can't have leading @ because metaconfig interprets it as a command!
6363 ;@inc_version_list=();
6364 # XXX Redo to do opendir/readdir? 
6365 if (-d $stem) {
6366     chdir($stem);
6367     ;@candidates = glob("5.*");
6368 }
6369 else {
6370     ;@candidates = ();
6371 }
6372
6373 # XXX ToDo:  These comparisons must be reworked when two-digit
6374 # subversions come along, so that 5.7.10 compares as greater than
6375 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6376 # widespread that we can use the built-in version vectors rather
6377 # than reinventing them here.  For 5.6.0, however, we must
6378 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6379 foreach $d (@candidates) {
6380     if ($d lt $version) {
6381         if ($d ge $api_versionstring) {
6382             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6383         }
6384         elsif ($d ge "5.005") {
6385             unshift(@inc_version_list, grep { -d } $d);
6386         }
6387     }
6388     else {
6389         # Skip newer version.  I.e. don't look in
6390         # 5.7.0 if we're installing 5.6.1.
6391     }
6392 }
6393
6394 if (@inc_version_list) {
6395     print join(' ', @inc_version_list);
6396 }
6397 else {
6398     # Blank space to preserve value for next Configure run.
6399     print " ";
6400 }
6401 EOPL
6402 chmod +x getverlist
6403 case "$inc_version_list" in
6404 '')     if test -x "$perl5"; then
6405                 dflt=`$perl5 getverlist`
6406         else
6407                 dflt='none'
6408         fi
6409         ;;
6410 $undef) dflt='none' ;;
6411 *)  dflt="$inc_version_list" ;;
6412 esac
6413 case "$dflt" in
6414 ''|' ') dflt=none ;;
6415 esac
6416 case "$dflt" in
6417 5.005) case "$bincompat5005" in
6418        $define|true|[yY]*) ;;
6419        *) dflt=none ;;
6420        esac
6421        ;;
6422 esac
6423 $cat <<'EOM'
6424
6425 In order to ease the process of upgrading, this version of perl 
6426 can be configured to use modules built and installed with earlier 
6427 versions of perl that were installed under $prefix.  Specify here
6428 the list of earlier versions that this version of perl should check.
6429 If Configure detected no earlier versions of perl installed under
6430 $prefix, then the list will be empty.  Answer 'none' to tell perl
6431 to not search earlier versions.
6432
6433 The default should almost always be sensible, so if you're not sure,
6434 just accept the default.
6435 EOM
6436
6437 rp='List of earlier versions to include in @INC?'
6438 . ./myread
6439 case "$ans" in
6440 [Nn]one|''|' ') inc_version_list=' ' ;;
6441 *) inc_version_list="$ans" ;;
6442 esac
6443 case "$inc_version_list" in
6444 ''|' ') 
6445         inc_version_list_init='0';;
6446 *)      inc_version_list_init=`echo $inc_version_list |
6447                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6448         ;;
6449 esac
6450 $rm -f getverlist
6451
6452 : determine whether to install perl also as /usr/bin/perl
6453
6454 echo " "
6455 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6456         $cat <<EOM
6457 Many scripts expect perl to be installed as /usr/bin/perl.
6458 I can install the perl you are about to compile also as /usr/bin/perl
6459 (in addition to $installbin/perl).
6460 EOM
6461         case "$installusrbinperl" in
6462         "$undef"|[nN]*) dflt='n';;
6463         *)              dflt='y';;
6464         esac
6465         rp="Do you want to install perl as /usr/bin/perl?"
6466         . ./myread
6467         case "$ans" in
6468         [yY]*)  val="$define";;
6469         *)      val="$undef" ;;
6470         esac
6471 else
6472         val="$undef"
6473 fi
6474 set installusrbinperl
6475 eval $setvar
6476
6477 : see if dld is available
6478 set dld.h i_dld
6479 eval $inhdr
6480
6481 : see if dlopen exists
6482 xxx_runnm="$runnm"
6483 runnm=false
6484 set dlopen d_dlopen
6485 eval $inlibc
6486 runnm="$xxx_runnm"
6487
6488 : determine which dynamic loading, if any, to compile in
6489 echo " "
6490 dldir="ext/DynaLoader"
6491 case "$usedl" in
6492 $define|y|true)
6493         dflt='y'
6494         usedl="$define"
6495         ;;
6496 $undef|n|false)
6497         dflt='n'
6498         usedl="$undef"
6499         ;;
6500 *) 
6501         dflt='n'
6502         case "$d_dlopen" in
6503             $define) dflt='y' ;;
6504         esac
6505         case "$i_dld" in
6506             $define) dflt='y' ;;
6507         esac
6508         : Does a dl_xxx.xs file exist for this operating system
6509         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6510         ;;
6511 esac
6512 rp="Do you wish to use dynamic loading?"
6513 . ./myread
6514 usedl="$ans"
6515 case "$ans" in
6516 y*) usedl="$define"
6517         case "$dlsrc" in
6518         '')
6519                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6520                         dflt="$dldir/dl_${osname}.xs"
6521                 elif $test "$d_dlopen" = "$define" ; then
6522                         dflt="$dldir/dl_dlopen.xs"
6523                 elif $test "$i_dld" = "$define" ; then
6524                         dflt="$dldir/dl_dld.xs"
6525                 else
6526                         dflt=''
6527                 fi
6528                 ;;
6529         *)      dflt="$dldir/$dlsrc"
6530                 ;;
6531         esac
6532     echo "The following dynamic loading files are available:"
6533         : Can not go over to $dldir because getfile has path hard-coded in.
6534         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6535         rp="Source file to use for dynamic loading"
6536         fn="fne"
6537         gfpth="$src"
6538         . ./getfile
6539         usedl="$define"
6540         : emulate basename
6541         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6542
6543         $cat << EOM
6544
6545 Some systems may require passing special flags to $cc -c to
6546 compile modules that will be used to create a shared library.
6547 To use no flags, say "none".
6548
6549 EOM
6550     case "$cccdlflags" in
6551     '') case "$gccversion" in
6552                 '') case "$osname" in
6553                         hpux)   dflt='+z' ;;
6554                         next)   dflt='none' ;;
6555                         irix*)  dflt='-KPIC' ;;
6556                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6557                         sunos)  dflt='-pic' ;;
6558                         *)      dflt='none' ;;
6559                     esac
6560                         ;;
6561                 *)  case "$osname" in
6562                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6563                         *)      dflt='-fpic' ;;
6564                     esac ;;
6565             esac ;;
6566         ' ') dflt='none' ;;
6567     *)  dflt="$cccdlflags" ;;
6568     esac
6569     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6570     . ./myread
6571     case "$ans" in
6572     none) cccdlflags=' ' ;;
6573     *) cccdlflags="$ans" ;;
6574     esac
6575
6576     cat << EOM
6577
6578 Some systems use ld to create libraries that can be dynamically loaded,
6579 while other systems (such as those using ELF) use $cc.
6580
6581 EOM
6582         case "$ld" in
6583         '')     $cat >try.c <<'EOM'
6584 /* Test for whether ELF binaries are produced */
6585 #include <fcntl.h>
6586 #include <stdlib.h>
6587 int main() {
6588         char b[4];
6589         int i = open("a.out",O_RDONLY);
6590         if(i == -1) 
6591                 exit(1); /* fail */
6592         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6593                 exit(0); /* succeed (yes, it's ELF) */
6594         else
6595                 exit(1); /* fail */
6596 }
6597 EOM
6598                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6599                         cat <<EOM
6600 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6601 EOM
6602                         dflt="$cc"
6603                 else
6604                         echo "I'll use ld to build dynamic libraries."
6605                         dflt='ld'
6606                 fi
6607                 rm -f try.c a.out
6608                 ;;
6609         *)      dflt="$ld"
6610                 ;;
6611         esac
6612
6613     rp="What command should be used to create dynamic libraries?"
6614     . ./myread
6615         ld="$ans"
6616
6617     cat << EOM
6618
6619 Some systems may require passing special flags to $ld to create a
6620 library that can be dynamically loaded.  If your ld flags include
6621 -L/other/path options to locate libraries outside your loader's normal
6622 search path, you may need to specify those -L options here as well.  To
6623 use no flags, say "none".
6624
6625 EOM
6626     case "$lddlflags" in
6627     '') case "$osname" in
6628                         beos) dflt='-nostart' ;;
6629                         hpux) dflt='-b';
6630                               case "$gccversion" in
6631                               '') dflt="$dflt +vnocompatwarnings" ;;
6632                               esac
6633                               ;;        
6634                         linux|irix*)    dflt='-shared' ;;
6635                         next)  dflt='none' ;;
6636                         solaris) dflt='-G' ;;
6637                         sunos) dflt='-assert nodefinitions' ;;
6638                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6639                 *)     dflt='none' ;;
6640                         esac
6641                         ;;
6642     *) dflt="$lddlflags" ;;
6643     esac
6644
6645         : Try to guess additional flags to pick up local libraries.
6646         : Be careful not to append to a plain 'none'
6647         case "$dflt" in
6648         none) dflt='' ;;
6649         esac
6650         for thisflag in $ldflags; do
6651                 case "$thisflag" in
6652                 -L*|-R*)
6653                         case " $dflt " in
6654                         *" $thisflag "*) ;;
6655                         *) dflt="$dflt $thisflag" ;;
6656                         esac
6657                         ;;
6658                 esac
6659         done
6660
6661         case "$dflt" in
6662         ''|' ') dflt='none' ;;
6663         esac
6664
6665     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6666     . ./myread
6667     case "$ans" in
6668     none) lddlflags=' ' ;;
6669     *) lddlflags="$ans" ;;
6670     esac
6671
6672         cat <<EOM
6673
6674 Some systems may require passing special flags to $cc to indicate that
6675 the resulting executable will use dynamic linking.  To use no flags,
6676 say "none".
6677
6678 EOM
6679     case "$ccdlflags" in
6680     '') case "$osname" in
6681                 hpux)   dflt='-Wl,-E' ;;
6682                 linux)  dflt='-rdynamic' ;;
6683                 next)   dflt='none' ;;
6684                 sunos)  dflt='none' ;;
6685                 *)      dflt='none' ;;
6686             esac ;;
6687     ' ')  dflt='none' ;;
6688     *)  dflt="$ccdlflags" ;;
6689     esac
6690     rp="Any special flags to pass to $cc to use dynamic linking?"
6691     . ./myread
6692     case "$ans" in
6693     none) ccdlflags=' ' ;;
6694     *) ccdlflags="$ans" ;;
6695     esac
6696     ;;
6697 *)  usedl="$undef"
6698         ld='ld'
6699     dlsrc='dl_none.xs'
6700     lddlflags=''
6701     ccdlflags=''
6702     ;;
6703 esac
6704
6705 also=''
6706 case "$usedl" in
6707 $undef)
6708         # No dynamic loading being used, so don't bother even to prompt.
6709         useshrplib='false'
6710         ;;
6711 *)      case "$useshrplib" in
6712         '')     case "$osname" in
6713                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6714                         dflt=y
6715                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6716                         ;;
6717                 next*)
6718                         case "$osvers" in
6719                         4*)     dflt=y
6720                                 also='Building a shared libperl is needed for MAB support.'
6721                                 ;;
6722                         *)      dflt=n
6723                                 ;;
6724                         esac
6725                         ;;
6726                 *)      dflt=n
6727                         ;;
6728                 esac
6729                 ;;
6730         $define|true|[Yy]*)
6731                 dflt=y
6732                 ;;
6733         *)      dflt=n
6734                 ;;
6735         esac
6736         $cat << EOM
6737
6738 The perl executable is normally obtained by linking perlmain.c with
6739 libperl${_a}, any static extensions (usually just DynaLoader), and
6740 any other libraries needed on this system (such as -lm, etc.).  Since
6741 your system supports dynamic loading, it is probably possible to build
6742 a shared libperl.$so.  If you will have more than one executable linked
6743 to libperl.$so, this will significantly reduce the size of each
6744 executable, but it may have a noticeable affect on performance.  The
6745 default is probably sensible for your system.
6746 $also
6747
6748 EOM
6749         rp="Build a shared libperl.$so (y/n)"
6750         . ./myread
6751         case "$ans" in
6752         true|$define|[Yy]*)
6753                 useshrplib='true'  ;;
6754         *)      useshrplib='false' ;;
6755         esac
6756         ;;
6757 esac
6758
6759 case "$useshrplib" in
6760 true)
6761         case "$libperl" in
6762         '')
6763                 # Figure out a good name for libperl.so.  Since it gets stored in
6764                 # a version-specific architecture-dependent library, the version
6765                 # number isn't really that important, except for making cc/ld happy.
6766                 #
6767                 # A name such as libperl.so.3.1
6768                 majmin="libperl.$so.$patchlevel.$subversion"
6769                 # A name such as libperl.so.301
6770                 majonly=`echo $patchlevel $subversion |
6771                         $awk '{printf "%d%02d", $1, $2}'`
6772                 majonly=libperl.$so.$majonly
6773                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6774                 # rely on figuring it out from the naming of libc.
6775                 case "${osname}${osvers}" in
6776                 next4*)
6777                         dflt=libperl.5.$so
6778                         # XXX How handle the --version stuff for MAB?
6779                         ;;
6780                 linux*)  # ld won't link with a bare -lperl otherwise.
6781                         dflt=libperl.$so
6782                         ;;
6783                 cygwin*) # include version
6784                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6785                         ;;
6786                 *)      # Try to guess based on whether libc has major.minor.
6787                         case "$libc" in
6788                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6789                         *libc.$so.[0-9]*) dflt=$majonly ;;
6790                         *)      dflt=libperl.$so ;;
6791                         esac
6792                         ;;
6793                 esac
6794                 ;;
6795         *)      dflt=$libperl
6796                 ;;
6797         esac
6798         cat << EOM
6799
6800 I need to select a good name for the shared libperl.  If your system uses
6801 library names with major and minor numbers, then you might want something
6802 like $majmin.  Alternatively, if your system uses a single version
6803 number for shared libraries, then you might want to use $majonly.
6804 Or, your system might be quite happy with a simple libperl.$so.
6805
6806 Since the shared libperl will get installed into a version-specific
6807 architecture-dependent directory, the version number of the shared perl
6808 library probably isn't important, so the default should be o.k.
6809
6810 EOM
6811         rp='What name do you want to give to the shared libperl?'
6812         . ./myread
6813         libperl=$ans
6814         echo "Ok, I'll use $libperl"
6815         ;;
6816 *)
6817         libperl="libperl${_a}"
6818         ;;
6819 esac
6820
6821 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6822 case "$shrpdir" in
6823 '') ;;
6824 *)      $cat >&4 <<EOM
6825 WARNING:  Use of the shrpdir variable for the installation location of
6826 the shared $libperl is not supported.  It was never documented and
6827 will not work in this version.  Let me (perlbug@perl.org)
6828 know of any problems this may cause.
6829
6830 EOM
6831         case "$shrpdir" in
6832         "$archlibexp/CORE")
6833                 $cat >&4 <<EOM
6834 But your current setting of $shrpdir is
6835 the default anyway, so it's harmless.
6836 EOM
6837                 ;;
6838         *)
6839                 $cat >&4 <<EOM
6840 Further, your current attempted setting of $shrpdir
6841 conflicts with the value of $archlibexp/CORE
6842 that installperl will use.
6843 EOM
6844                 ;;
6845         esac
6846         ;;
6847 esac
6848
6849 # How will the perl executable find the installed shared $libperl?
6850 # Add $xxx to ccdlflags.
6851 # If we can't figure out a command-line option, use $shrpenv to
6852 # set env LD_RUN_PATH.  The main perl makefile uses this.
6853 shrpdir=$archlibexp/CORE
6854 xxx=''
6855 tmp_shrpenv=''
6856 if "$useshrplib"; then
6857     case "$osname" in 
6858         aix)
6859                 # We'll set it in Makefile.SH...
6860                 ;;
6861         solaris|netbsd)
6862                 xxx="-R $shrpdir"
6863                 ;;
6864         freebsd)
6865                 xxx="-Wl,-R$shrpdir"
6866                 ;;
6867         linux|irix*|dec_osf)
6868                 xxx="-Wl,-rpath,$shrpdir"
6869                 ;;
6870         next)
6871                 # next doesn't like the default...
6872                 ;;
6873         beos)
6874                 # beos doesn't like the default, either.
6875                 ;;
6876         hpux*)
6877                 # hpux doesn't like the default, either.
6878                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6879                 ;;
6880         *)
6881                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6882                 ;;
6883         esac
6884         case "$xxx" in
6885         '') ;;
6886         *)      
6887                 # Only add $xxx if it isn't already in ccdlflags.
6888                 case " $ccdlflags " in
6889                 *" $xxx "*)     ;;
6890                 *)      ccdlflags="$ccdlflags $xxx"
6891                         cat <<EOM >&4
6892
6893 Adding $xxx to the flags
6894 passed to $ld so that the perl executable will find the 
6895 installed shared $libperl.
6896
6897 EOM
6898                         ;;
6899                 esac
6900                 ;;
6901         esac
6902 fi
6903 # Fix ccdlflags in AIX for building external extensions.
6904 # (For building Perl itself bare -bE:perl.exp is needed,
6905 #  Makefile.SH takes care of this.)
6906 case "$osname" in
6907 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6908 esac
6909 # Respect a hint or command-line value.
6910 case "$shrpenv" in
6911 '') shrpenv="$tmp_shrpenv" ;;
6912 esac
6913 case "$ldlibpthname" in
6914 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6915 none)   ldlibpthname='' ;;
6916 esac
6917
6918 : determine where manual pages are on this system
6919 echo " "
6920 case "$sysman" in
6921 '') 
6922         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6923         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6924         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6925         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6926         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6927         sysman=`./loc . /usr/man/man1 $syspath`
6928         ;;
6929 esac
6930 if $test -d "$sysman"; then
6931         echo "System manual is in $sysman." >&4
6932 else
6933         echo "Could not find manual pages in source form." >&4
6934 fi
6935
6936 : determine where manual pages go
6937 set man1dir man1dir none
6938 eval $prefixit
6939 $cat <<EOM
6940
6941 $spackage has manual pages available in source form.
6942 EOM
6943 case "$nroff" in
6944 nroff)
6945         echo "However, you don't have nroff, so they're probably useless to you."
6946         case "$man1dir" in
6947         '') man1dir="none";;
6948         esac;;
6949 esac
6950 echo "If you don't want the manual sources installed, answer 'none'."
6951 case "$man1dir" in
6952 ' ') dflt=none
6953         ;;
6954 '')
6955         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6956         lookpath="$lookpath $prefixexp/man/p_man/man1"
6957         lookpath="$lookpath $prefixexp/man/u_man/man1"
6958         lookpath="$lookpath $prefixexp/man/man.1"
6959         case "$sysman" in
6960         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6961         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6962         esac
6963         set dflt
6964         eval $prefixup
6965         ;;
6966 *)  dflt="$man1dir"
6967         ;;
6968 esac
6969 echo " "
6970 fn=dn+~
6971 rp="Where do the main $spackage manual pages (source) go?"
6972 . ./getfile
6973 if $test "X$man1direxp" != "X$ansexp"; then
6974         installman1dir=''
6975 fi
6976 man1dir="$ans"
6977 man1direxp="$ansexp"
6978 case "$man1dir" in
6979 '')     man1dir=' '
6980         installman1dir='';;
6981 esac
6982
6983 : Change installation prefix, if necessary.
6984 if $test X"$prefix" != X"$installprefix"; then
6985         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6986 else
6987         installman1dir="$man1direxp"
6988 fi
6989
6990 : What suffix to use on installed man pages
6991
6992 case "$man1dir" in
6993 ' ')
6994         man1ext='0'
6995         ;;
6996 *)
6997         rp="What suffix should be used for the main $spackage man pages?"
6998         case "$man1ext" in
6999         '')     case "$man1dir" in
7000                 *1)  dflt=1 ;;
7001                 *1p) dflt=1p ;;
7002                 *1pm) dflt=1pm ;;
7003                 *l) dflt=l;;
7004                 *n) dflt=n;;
7005                 *o) dflt=o;;
7006                 *p) dflt=p;;
7007                 *C) dflt=C;;
7008                 *L) dflt=L;;
7009                 *L1) dflt=L1;;
7010                 *) dflt=1;;
7011                 esac
7012                 ;;
7013         *)      dflt="$man1ext";;
7014         esac
7015         . ./myread
7016         man1ext="$ans"
7017         ;;
7018 esac
7019
7020 : see if we can have long filenames
7021 echo " "
7022 first=123456789abcdef
7023 $rm -f $first
7024 if (echo hi >$first) 2>/dev/null; then
7025         if $test -f 123456789abcde; then
7026                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7027                 val="$undef"
7028         else
7029                 echo 'You can have filenames longer than 14 characters.'>&4
7030                 val="$define"
7031         fi
7032 else
7033         $cat <<'EOM'
7034 You can't have filenames longer than 14 chars.
7035 You can't even think about them!
7036 EOM
7037         val="$undef"
7038 fi 
7039 set d_flexfnam
7040 eval $setvar
7041 $rm -rf 123456789abcde*
7042
7043 : determine where library module manual pages go
7044 set man3dir man3dir none
7045 eval $prefixit
7046 $cat <<EOM
7047
7048 $spackage has manual pages for many of the library modules.
7049 EOM
7050
7051 case "$nroff" in
7052 nroff)
7053         $cat <<'EOM'
7054 However, you don't have nroff, so they're probably useless to you.
7055 EOM
7056         case "$man3dir" in
7057         '') man3dir="none";;
7058         esac;;
7059 esac
7060
7061 case "$d_flexfnam" in
7062 undef)
7063         $cat <<'EOM'
7064 However, your system can't handle the long file names like File::Basename.3. 
7065 EOM
7066         case "$man3dir" in
7067         '') man3dir="none";;
7068         esac;;
7069 esac
7070
7071 echo "If you don't want the manual sources installed, answer 'none'."
7072 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7073 case "$man3dir" in
7074 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7075         if $test -d "$privlib/man/man3"; then
7076                 cat <<EOM >&4
7077
7078 WARNING:  Previous versions of perl installed man3 pages into
7079 $privlib/man/man3.  This version will suggest a 
7080 new default of $dflt.  
7081 EOM
7082                 tdflt=$dflt
7083                 dflt='n'
7084                 rp='Do you wish to preserve the old behavior?(y/n)'
7085                 . ./myread
7086                 case "$ans" in
7087                 y*) dflt="$privlib/man/man3" ;;
7088                 *)  dflt=$tdflt ;;
7089                 esac
7090     fi
7091         ;;
7092 *)      dflt="$man3dir" ;;
7093 esac
7094 case "$dflt" in
7095 ' ') dflt=none ;;
7096 esac
7097 echo " "
7098 fn=dn+~
7099 rp="Where do the $package library man pages (source) go?"
7100 . ./getfile
7101 man3dir="$ans"
7102 man3direxp="$ansexp"
7103 case "$man3dir" in
7104 '')     man3dir=' '
7105         installman3dir='';;
7106 esac
7107
7108 : Change installation prefix, if necessary.
7109 if $test X"$prefix" != X"$installprefix"; then
7110         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7111 else
7112         installman3dir="$man3direxp"
7113 fi
7114
7115 : What suffix to use on installed man pages
7116 case "$man3dir" in
7117 ' ')
7118         man3ext='0'
7119         ;;
7120 *)
7121         rp="What suffix should be used for the $package library man pages?"
7122         case "$man3ext" in
7123         '')     case "$man3dir" in
7124                 *3)  dflt=3 ;;
7125                 *3p) dflt=3p ;;
7126                 *3pm) dflt=3pm ;;
7127                 *l) dflt=l;;
7128                 *n) dflt=n;;
7129                 *o) dflt=o;;
7130                 *p) dflt=p;;
7131                 *C) dflt=C;;
7132                 *L) dflt=L;;
7133                 *L3) dflt=L3;;
7134                 *) dflt=3;;
7135                 esac
7136                 ;;
7137         *)      dflt="$man3ext";;
7138         esac
7139         . ./myread
7140         man3ext="$ans"
7141         ;;
7142 esac
7143
7144 : see if we have to deal with yellow pages, now NIS.
7145 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7146         if $test -f /usr/etc/nibindd; then
7147                 echo " "
7148                 echo "I'm fairly confident you're on a NeXT."
7149                 echo " "
7150                 rp='Do you get the hosts file via NetInfo?'
7151                 dflt=y
7152                 case "$hostcat" in
7153                 nidump*) ;;
7154                 '') ;;
7155                 *) dflt=n;;
7156                 esac
7157                 . ./myread
7158                 case "$ans" in
7159                 y*) hostcat='nidump hosts .';;
7160                 *)      case "$hostcat" in
7161                         nidump*) hostcat='';;
7162                         esac
7163                         ;;
7164                 esac
7165         fi
7166         case "$hostcat" in
7167         nidump*) ;;
7168         *)
7169                 case "$hostcat" in
7170                 *ypcat*) dflt=y;;
7171                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7172                                 dflt=y
7173                         else
7174                                 dflt=n
7175                         fi;;
7176                 *) dflt=n;;
7177                 esac
7178                 echo " "
7179                 rp='Are you getting the hosts file via yellow pages?'
7180                 . ./myread
7181                 case "$ans" in
7182                 y*) hostcat='ypcat hosts';;
7183                 *) hostcat='cat /etc/hosts';;
7184                 esac
7185                 ;;
7186         esac
7187 fi
7188 case "$hostcat" in
7189 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7190 esac
7191 case "$groupcat" in
7192 '') test -f /etc/group && groupcat='cat /etc/group';;
7193 esac
7194 case "$passcat" in
7195 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7196 esac
7197
7198 : now get the host name
7199 echo " "
7200 echo "Figuring out host name..." >&4
7201 case "$myhostname" in
7202 '') cont=true
7203         echo 'Maybe "hostname" will work...'
7204         if tans=`sh -c hostname 2>&1` ; then
7205                 myhostname=$tans
7206                 phostname=hostname
7207                 cont=''
7208         fi
7209         ;;
7210 *) cont='';;
7211 esac
7212 if $test "$cont"; then
7213         if ./xenix; then
7214                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7215                 if tans=`cat /etc/systemid 2>&1` ; then
7216                         myhostname=$tans
7217                         phostname='cat /etc/systemid'
7218                         echo "Whadyaknow.  Xenix always was a bit strange..."
7219                         cont=''
7220                 fi
7221         elif $test -r /etc/systemid; then
7222                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7223         fi
7224 fi
7225 if $test "$cont"; then
7226         echo 'No, maybe "uuname -l" will work...'
7227         if tans=`sh -c 'uuname -l' 2>&1` ; then
7228                 myhostname=$tans
7229                 phostname='uuname -l'
7230         else
7231                 echo 'Strange.  Maybe "uname -n" will work...'
7232                 if tans=`sh -c 'uname -n' 2>&1` ; then
7233                         myhostname=$tans
7234                         phostname='uname -n'
7235                 else
7236                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7237                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7238                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7239                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7240                         else
7241                                 case "$myhostname" in
7242                                 '') echo "Does this machine have an identity crisis or something?"
7243                                         phostname='';;
7244                                 *)
7245                                         echo "Well, you said $myhostname before..."
7246                                         phostname='echo $myhostname';;
7247                                 esac
7248                         fi
7249                 fi
7250         fi
7251 fi
7252 : you do not want to know about this
7253 set $myhostname
7254 myhostname=$1
7255
7256 : verify guess
7257 if $test "$myhostname" ; then
7258         dflt=y
7259         rp='Your host name appears to be "'$myhostname'".'" Right?"
7260         . ./myread
7261         case "$ans" in
7262         y*) ;;
7263         *) myhostname='';;
7264         esac
7265 fi
7266
7267 : bad guess or no guess
7268 while $test "X$myhostname" = X ; do
7269         dflt=''
7270         rp="Please type the (one word) name of your host:"
7271         . ./myread
7272         myhostname="$ans"
7273 done
7274
7275 : translate upper to lower if necessary
7276 case "$myhostname" in
7277 *[A-Z]*)
7278         echo "(Normalizing case in your host name)"
7279         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7280         ;;
7281 esac
7282
7283 case "$myhostname" in
7284 *.*)
7285         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7286         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7287         echo "(Trimming domain name from host name--host name is now $myhostname)"
7288         ;;
7289 *) case "$mydomain" in
7290         '')
7291                 {
7292                         test "X$hostcat" = "Xypcat hosts" &&
7293                         ypmatch "$myhostname" hosts 2>/dev/null |\
7294                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7295                         $test -s hosts
7296                 } || {
7297                         test "X$hostcat" != "X" &&
7298                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7299                                         /[       ]$myhostname[  . ]/p" > hosts
7300                 }
7301                 tmp_re="[       . ]"
7302                 if $test -f hosts; then
7303                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7304                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7305                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7306                                 hosts | $sort | $uniq | \
7307                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7308                         case `$echo X$dflt` in
7309                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7310                                 dflt=.
7311                                 ;;
7312                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7313                                 ;;
7314                         esac
7315                 else
7316                         echo "(I cannot locate a hosts database anywhere)"
7317                         dflt=.
7318                 fi
7319                 case "$dflt" in
7320                 .)
7321                         tans=`./loc resolv.conf X /etc /usr/etc`
7322                         if $test -f "$tans"; then
7323                                 echo "(Attempting domain name extraction from $tans)"
7324                                 dflt=.`$sed -n -e 's/   / /g' \
7325                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7326                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7327                                 case "$dflt" in
7328                                 .) dflt=.`$sed -n -e 's/        / /g' \
7329                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7330                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7331                                         ;;
7332                                 esac
7333                         fi
7334                         ;;
7335                 esac
7336                 case "$dflt" in
7337                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7338                         dflt=.`sh -c domainname 2>/dev/null`
7339                         case "$dflt" in
7340                         '') dflt='.';;
7341                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7342                         esac
7343                         ;;
7344                 esac
7345                 case "$dflt" in
7346                 .) echo "(Lost all hope -- silly guess then)"
7347                         dflt='.uucp'
7348                         ;;
7349                 esac
7350                 $rm -f hosts
7351                 ;;
7352         *) dflt="$mydomain";;
7353         esac;;
7354 esac
7355 echo " "
7356 rp="What is your domain name?"
7357 . ./myread
7358 tans="$ans"
7359 case "$ans" in
7360 '') ;;
7361 .*) ;;
7362 *) tans=".$tans";;
7363 esac
7364 mydomain="$tans"
7365
7366 : translate upper to lower if necessary
7367 case "$mydomain" in
7368 *[A-Z]*)
7369         echo "(Normalizing case in your domain name)"
7370         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7371         ;;
7372 esac
7373
7374 : a little sanity check here
7375 case "$phostname" in
7376 '') ;;
7377 *)
7378         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7379         $myhostname$mydomain|$myhostname) ;;
7380         *)
7381                 case "$phostname" in
7382                 sed*)
7383                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7384                         ;;
7385                 *)
7386                         echo "(That doesn't agree with your $phostname command, by the way.)"
7387                         ;;
7388                 esac
7389         ;;
7390         esac
7391         ;;
7392 esac
7393
7394 $cat <<EOM
7395
7396 I need to get your e-mail address in Internet format if possible, i.e.
7397 something like user@host.domain. Please answer accurately since I have
7398 no easy means to double check it. The default value provided below
7399 is most probably close to reality but may not be valid from outside
7400 your organization...
7401
7402 EOM
7403 cont=x
7404 while test "$cont"; do
7405         case "$cf_email" in
7406         '') dflt="$cf_by@$myhostname$mydomain";;
7407         *) dflt="$cf_email";;
7408         esac
7409         rp='What is your e-mail address?'
7410         . ./myread
7411         cf_email="$ans"
7412         case "$cf_email" in
7413         *@*.*) cont='' ;;
7414         *)
7415                 rp='Address does not look like an Internet one.  Use it anyway?'
7416                 case "$fastread" in
7417                 yes) dflt=y ;;
7418                 *) dflt=n ;;
7419                 esac
7420                 . ./myread
7421                 case "$ans" in
7422                 y*) cont='' ;;
7423                 *) echo " " ;;
7424                 esac
7425                 ;;
7426         esac
7427 done
7428
7429 $cat <<EOM
7430
7431 If you or somebody else will be maintaining perl at your site, please
7432 fill in the correct e-mail address here so that they may be contacted
7433 if necessary. Currently, the "perlbug" program included with perl
7434 will send mail to this address in addition to perlbug@perl.org. You may
7435 enter "none" for no administrator.
7436
7437 EOM
7438 case "$perladmin" in
7439 '') dflt="$cf_email";;
7440 *) dflt="$perladmin";;
7441 esac
7442 rp='Perl administrator e-mail address'
7443 . ./myread
7444 perladmin="$ans"
7445
7446 : determine whether to only install version-specific parts.
7447 echo " "
7448 $cat <<EOM
7449 Do you want to install only the version-specific parts of the perl
7450 distribution?  Usually you do *not* want to do this.
7451 EOM
7452 case "$versiononly" in
7453 "$define"|[Yy]*|true) dflt='y' ;;
7454 *) dflt='n';
7455 esac
7456 rp="Do you want to install only the version-specific parts of perl?"
7457 . ./myread
7458 case "$ans" in
7459 [yY]*)  val="$define";;
7460 *)      val="$undef" ;;
7461 esac
7462 set versiononly
7463 eval $setvar
7464
7465 : figure out how to guarantee perl startup
7466 case "$startperl" in
7467 '')
7468         case "$sharpbang" in
7469         *!)
7470                 $cat <<EOH
7471
7472 I can use the #! construct to start perl on your system. This will
7473 make startup of perl scripts faster, but may cause problems if you
7474 want to share those scripts and perl is not in a standard place
7475 ($binexp/perl) on all your platforms. The alternative is to force
7476 a shell by starting the script with a single ':' character.
7477
7478 EOH
7479                 case "$versiononly" in
7480                 "$define")      dflt="$binexp/perl$version";;  
7481                 *)              dflt="$binexp/perl";;
7482                 esac
7483                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7484                 . ./myread
7485                 case "$ans" in
7486                 none)   startperl=": # use perl";;
7487                 *)      startperl="#!$ans"
7488                         if $test 30 -lt `echo "$ans" | wc -c`; then
7489                                 $cat >&4 <<EOM
7490
7491 WARNING:  Some systems limit the #! command to 32 characters.
7492 If you experience difficulty running Perl scripts with #!, try
7493 installing Perl in a directory with a shorter pathname.
7494
7495 EOM
7496                         fi ;;
7497                 esac
7498                 ;;
7499         *) startperl=": # use perl"
7500                 ;;
7501         esac
7502         ;;
7503 esac
7504 echo "I'll use $startperl to start perl scripts."
7505
7506 : figure best path for perl in scripts
7507 case "$perlpath" in
7508 '')
7509         perlpath="$binexp/perl"
7510         case "$startperl" in
7511         *!*) ;;
7512         *)
7513                 $cat <<EOH
7514
7515 I will use the "eval 'exec'" idiom to start Perl on your system.
7516 I can use the full path of your Perl binary for this purpose, but
7517 doing so may cause problems if you want to share those scripts and
7518 Perl is not always in a standard place ($binexp/perl).
7519
7520 EOH
7521                 dflt="$binexp/perl"
7522                 rp="What path shall I use in \"eval 'exec'\"?"
7523                 . ./myread
7524                 perlpath="$ans"
7525                 ;;
7526         esac
7527         ;;
7528 esac
7529 case "$startperl" in
7530 *!*)    ;;
7531 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7532 esac
7533
7534 : determine where public executable scripts go
7535 set scriptdir scriptdir
7536 eval $prefixit
7537 case "$scriptdir" in
7538 '')
7539         dflt="$bin"
7540         : guess some guesses
7541         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7542         $test -d /usr/share/bin     && dflt=/usr/share/bin
7543         $test -d /usr/local/script  && dflt=/usr/local/script
7544         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7545         $test -d $prefixexp/script  && dflt=$prefixexp/script
7546         set dflt
7547         eval $prefixup
7548         ;;
7549 *)  dflt="$scriptdir"
7550         ;;
7551 esac
7552 $cat <<EOM
7553  
7554 Some installations have a separate directory just for executable scripts so
7555 that they can mount it across multiple architectures but keep the scripts in
7556 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7557 Or you might just lump your scripts in with all your other executables.
7558  
7559 EOM
7560 fn=d~
7561 rp='Where do you keep publicly executable scripts?'
7562 . ./getfile
7563 if $test "X$ansexp" != "X$scriptdirexp"; then
7564         installscript=''
7565 fi
7566 scriptdir="$ans"
7567 scriptdirexp="$ansexp"
7568 : Change installation prefix, if necessary.
7569 if $test X"$prefix" != X"$installprefix"; then
7570         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7571 else
7572         installscript="$scriptdirexp"
7573 fi
7574
7575 : determine where add-on public executables go
7576 case "$sitebin" in
7577 '')     dflt=$siteprefix/bin ;;
7578 *)      dflt=$sitebin ;;
7579 esac
7580 fn=d~
7581 rp='Pathname where the add-on public executables should be installed?'
7582 . ./getfile
7583 sitebin="$ans"
7584 sitebinexp="$ansexp"
7585 : Change installation prefix, if necessary.
7586 if $test X"$prefix" != X"$installprefix"; then
7587         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7588 else
7589         installsitebin="$sitebinexp"
7590 fi
7591
7592 case "$vendorprefix" in
7593 '')     d_vendorbin="$undef"
7594         vendorbin=''
7595         vendorbinexp=''
7596         ;;
7597 *)      d_vendorbin="$define"
7598         : determine where vendor-supplied executables go.
7599         case "$vendorbin" in
7600         '') dflt=$vendorprefix/bin ;;
7601         *)      dflt="$vendorbin" ;;
7602         esac
7603         fn=d~+
7604         rp='Pathname for the vendor-supplied executables directory?'
7605         . ./getfile
7606         vendorbin="$ans"
7607         vendorbinexp="$ansexp"
7608         ;;
7609 esac
7610 : Change installation prefix, if necessary.
7611 if $test X"$prefix" != X"$installprefix"; then
7612         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7613 else
7614         installvendorbin="$vendorbinexp"
7615 fi
7616
7617 : see if qgcvt exists
7618 set qgcvt d_qgcvt
7619 eval $inlibc
7620
7621 echo " "
7622
7623 if $test X"$d_longdbl" = X"$define"; then
7624
7625 echo "Checking how to print long doubles..." >&4
7626
7627 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7628         $cat >try.c <<'EOCP'
7629 #include <sys/types.h>
7630 #include <stdio.h>
7631 int main() {
7632   double d = 123.456;
7633   printf("%.3f\n", d);
7634 }
7635 EOCP
7636         set try
7637         if eval $compile; then
7638                 yyy=`./try$exe_ext`
7639                 case "$yyy" in
7640                 123.456)
7641                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7642                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7643                         echo "We will use %f."
7644                         ;;
7645                 esac
7646         fi
7647 fi
7648
7649 if $test X"$sPRIfldbl" = X; then
7650         $cat >try.c <<'EOCP'
7651 #include <sys/types.h>
7652 #include <stdio.h>
7653 int main() {
7654   long double d = 123.456;
7655   printf("%.3llf\n", d);
7656 }
7657 EOCP
7658         set try
7659         if eval $compile; then
7660                 yyy=`./try$exe_ext`
7661                 case "$yyy" in
7662                 123.456)
7663                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7664                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7665                         echo "We will use %llf."
7666                         ;;
7667                 esac
7668         fi
7669 fi
7670
7671 if $test X"$sPRIfldbl" = X; then
7672         $cat >try.c <<'EOCP'
7673 #include <sys/types.h>
7674 #include <stdio.h>
7675 int main() {
7676   long double d = 123.456;
7677   printf("%.3Lf\n", d);
7678 }
7679 EOCP
7680         set try
7681         if eval $compile; then
7682                 yyy=`./try$exe_ext`
7683                 case "$yyy" in
7684                 123.456)
7685                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7686                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7687                         echo "We will use %Lf."
7688                         ;;
7689                 esac
7690         fi
7691 fi
7692
7693 if $test X"$sPRIfldbl" = X; then
7694         $cat >try.c <<'EOCP'
7695 #include <sys/types.h>
7696 #include <stdio.h>
7697 int main() {
7698   long double d = 123.456;
7699   printf("%.3lf\n", d);
7700 }
7701 EOCP
7702         set try
7703         if eval $compile; then
7704                 yyy=`./try$exe_ext`
7705                 case "$yyy" in
7706                 123.456)
7707                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7708                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7709                         echo "We will use %lf."
7710                         ;;
7711                 esac
7712         fi
7713 fi
7714
7715 if $test X"$sPRIfldbl" = X; then
7716         echo "Cannot figure out how to print long doubles." >&4
7717 else
7718         sSCNfldbl=$sPRIfldbl    # expect consistency
7719 fi
7720
7721 $rm -f try try.*
7722
7723 fi # d_longdbl
7724
7725 case "$sPRIfldbl" in
7726 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7727         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7728         d_SCNfldbl="$undef";
7729         ;;
7730 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7731         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7732         d_SCNfldbl="$define";
7733         ;;
7734 esac
7735
7736 : Check how to convert floats to strings.
7737 echo " "
7738 echo "Checking for an efficient way to convert floats to strings."
7739 echo " " > try.c
7740 case "$uselongdouble" in
7741 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7742 esac
7743 case "$d_longdbl" in
7744 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7745 esac
7746 case "$d_PRIgldbl" in
7747 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7748 esac
7749 $cat >>try.c <<EOP
7750 #ifdef TRY_gconvert
7751 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7752 char *myname = "gconvert";
7753 #endif
7754 #ifdef TRY_gcvt
7755 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7756 char *myname = "gcvt";
7757 #endif
7758 #ifdef TRY_qgcvt
7759 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7760 char *myname = "qgcvt";
7761 #define DOUBLETYPE long double
7762 #endif
7763 #ifdef TRY_sprintf
7764 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7765 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7766 #else
7767 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7768 #endif
7769 char *myname = "sprintf";
7770 #endif
7771
7772 #ifndef DOUBLETYPE
7773 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7774 #define DOUBLETYPE long double
7775 #else
7776 #define DOUBLETYPE double
7777 #endif
7778 #endif
7779
7780 #include <stdio.h>
7781
7782 #define I_STDLIB $i_stdlib
7783 #ifdef I_STDLIB
7784 #include <stdlib.h>
7785 #endif
7786
7787 int
7788 checkit(expect, got)
7789 char *expect;
7790 char *got;
7791 {
7792     if (strcmp(expect, got)) {
7793                 printf("%s oddity:  Expected %s, got %s\n",
7794                         myname, expect, got);
7795                 exit(1);
7796         }
7797 }
7798
7799 int main()
7800
7801         char buf[64]; 
7802         buf[63] = '\0';
7803
7804         /* This must be 1st test on (which?) platform */
7805         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7806         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7807         checkit("0.1", buf);
7808
7809         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7810         checkit("1", buf);
7811
7812         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7813         checkit("1.1", buf);
7814
7815         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7816         checkit("1.01", buf);
7817
7818         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7819         checkit("1.001", buf);
7820
7821         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7822         checkit("1.0001", buf);
7823
7824         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7825         checkit("1.00001", buf);
7826
7827         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7828         checkit("1.000001", buf);
7829
7830         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7831         checkit("0", buf);
7832
7833         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7834         checkit("-1", buf);
7835
7836         /* Some Linux gcvt's give 1.e+5 here. */
7837         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7838         checkit("100000", buf);
7839         
7840         /* Some Linux gcvt's give -1.e+5 here. */
7841         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7842         checkit("-100000", buf);
7843
7844         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7845         checkit("123.456", buf);
7846
7847         exit(0);
7848 }
7849 EOP
7850 case "$d_Gconvert" in
7851 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7852 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7853 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7854 *) xxx_list='gconvert gcvt sprintf' ;;
7855 esac
7856
7857 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7858 "$define$define$define")
7859     # for long doubles prefer first qgcvt, then sprintf
7860     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7861     xxx_list="sprintf $xxx_list"
7862     case "$d_qgcvt" in
7863     "$define") xxx_list="qgcvt $xxx_list" ;;
7864     esac
7865     ;;
7866 esac
7867
7868 for xxx_convert in $xxx_list; do
7869         echo "Trying $xxx_convert..."
7870         $rm -f try try$_o
7871         set try -DTRY_$xxx_convert
7872         if eval $compile; then
7873                 echo "$xxx_convert() found." >&4
7874                 if ./try; then
7875                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7876                         break;
7877                 else
7878                         echo "...But $xxx_convert didn't work as I expected."
7879                 fi
7880         else
7881                 echo "$xxx_convert NOT found." >&4
7882         fi
7883 done
7884         
7885 case "$xxx_convert" in
7886 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7887 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7888 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7889 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7890    "$define$define$define")
7891       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7892    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7893    esac
7894    ;;  
7895 esac
7896
7897 : see if _fwalk exists
7898 set fwalk d__fwalk
7899 eval $inlibc
7900
7901 : Initialize h_fcntl
7902 h_fcntl=false
7903
7904 : Initialize h_sysfile
7905 h_sysfile=false
7906
7907 : access call always available on UNIX
7908 set access d_access
7909 eval $inlibc
7910
7911 : locate the flags for 'access()'
7912 case "$d_access" in
7913 "$define")
7914         echo " "
7915         $cat >access.c <<'EOCP'
7916 #include <sys/types.h>
7917 #ifdef I_FCNTL
7918 #include <fcntl.h>
7919 #endif
7920 #ifdef I_SYS_FILE
7921 #include <sys/file.h>
7922 #endif
7923 #ifdef I_UNISTD
7924 #include <unistd.h>
7925 #endif
7926 int main() {
7927         exit(R_OK);
7928 }
7929 EOCP
7930         : check sys/file.h first, no particular reason here
7931         if $test `./findhdr sys/file.h` && \
7932                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7933                 h_sysfile=true;
7934                 echo "<sys/file.h> defines the *_OK access constants." >&4
7935         elif $test `./findhdr fcntl.h` && \
7936                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7937                 h_fcntl=true;
7938                 echo "<fcntl.h> defines the *_OK access constants." >&4
7939         elif $test `./findhdr unistd.h` && \
7940                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7941                 echo "<unistd.h> defines the *_OK access constants." >&4
7942         else
7943                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7944         fi
7945         ;;
7946 esac
7947 $rm -f access*
7948
7949 : see if accessx exists
7950 set accessx d_accessx
7951 eval $inlibc
7952
7953 : see if alarm exists
7954 set alarm d_alarm
7955 eval $inlibc
7956
7957 : see if atolf exists
7958 set atolf d_atolf
7959 eval $inlibc
7960
7961 : see if atoll exists
7962 set atoll d_atoll
7963 eval $inlibc
7964
7965 : Look for GNU-cc style attribute checking
7966 echo " "
7967 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7968 $cat >attrib.c <<'EOCP'
7969 #include <stdio.h>
7970 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7971 EOCP
7972 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7973         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7974                 echo "Your C compiler doesn't fully support __attribute__."
7975                 val="$undef"
7976         else
7977                 echo "Your C compiler supports __attribute__."
7978                 val="$define"
7979         fi
7980 else
7981         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7982         val="$undef"
7983 fi
7984 set d_attribut
7985 eval $setvar
7986 $rm -f attrib*
7987
7988 : see if bcmp exists
7989 set bcmp d_bcmp
7990 eval $inlibc
7991
7992 : see if bcopy exists
7993 set bcopy d_bcopy
7994 eval $inlibc
7995
7996 : see if this is a unistd.h system
7997 set unistd.h i_unistd
7998 eval $inhdr
7999
8000 : see if getpgrp exists
8001 set getpgrp d_getpgrp
8002 eval $inlibc
8003
8004 case "$d_getpgrp" in
8005 "$define")
8006         echo " "
8007         echo "Checking to see which flavor of getpgrp is in use..."
8008         $cat >set.c <<EOP
8009 #$i_unistd I_UNISTD
8010 #include <sys/types.h>
8011 #ifdef I_UNISTD
8012 #  include <unistd.h>
8013 #endif
8014 int main()
8015 {
8016         if (getuid() == 0) {
8017                 printf("(I see you are running Configure as super-user...)\n");
8018                 setuid(1);
8019         }
8020 #ifdef TRY_BSD_PGRP
8021         if (getpgrp(1) == 0)
8022                 exit(0);
8023 #else
8024         if (getpgrp() > 0)
8025                 exit(0);
8026 #endif
8027         exit(1);
8028 }
8029 EOP
8030         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8031                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8032                 val="$define"
8033         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8034                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8035                 val="$undef"
8036         else
8037                 echo "I can't seem to compile and run the test program."
8038                 if ./usg; then
8039                         xxx="a USG one, i.e. you use getpgrp()."
8040                 else
8041                         # SVR4 systems can appear rather BSD-ish.
8042                         case "$i_unistd" in
8043                         $undef)
8044                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8045                                 val="$define"
8046                                 ;;
8047                         $define)
8048                                 xxx="probably a USG one, i.e. you use getpgrp()."
8049                                 val="$undef"
8050                                 ;;
8051                         esac
8052                 fi
8053                 echo "Assuming your getpgrp is $xxx" >&4
8054         fi
8055         ;;
8056 *) val="$undef";;
8057 esac
8058 set d_bsdgetpgrp
8059 eval $setvar
8060 $rm -f set set.c
8061
8062 : see if setpgrp exists
8063 set setpgrp d_setpgrp
8064 eval $inlibc
8065
8066 case "$d_setpgrp" in
8067 "$define")
8068         echo " "
8069         echo "Checking to see which flavor of setpgrp is in use..."
8070         $cat >set.c <<EOP
8071 #$i_unistd I_UNISTD
8072 #include <sys/types.h>
8073 #ifdef I_UNISTD
8074 #  include <unistd.h>
8075 #endif
8076 int main()
8077 {
8078         if (getuid() == 0) {
8079                 printf("(I see you are running Configure as super-user...)\n");
8080                 setuid(1);
8081         }
8082 #ifdef TRY_BSD_PGRP
8083         if (-1 == setpgrp(1, 1))
8084                 exit(0);
8085 #else
8086         if (setpgrp() != -1)
8087                 exit(0);
8088 #endif
8089         exit(1);
8090 }
8091 EOP
8092         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8093                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8094                 val="$define"
8095         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8096                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8097                 val="$undef"
8098         else
8099                 echo "(I can't seem to compile and run the test program.)"
8100                 if ./usg; then
8101                         xxx="a USG one, i.e. you use setpgrp()."
8102                 else
8103                         # SVR4 systems can appear rather BSD-ish.
8104                         case "$i_unistd" in
8105                         $undef)
8106                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8107                                 val="$define"
8108                                 ;;
8109                         $define)
8110                                 xxx="probably a USG one, i.e. you use setpgrp()."
8111                                 val="$undef"
8112                                 ;;
8113                         esac
8114                 fi
8115                 echo "Assuming your setpgrp is $xxx" >&4
8116         fi
8117         ;;
8118 *) val="$undef";;
8119 esac
8120 set d_bsdsetpgrp
8121 eval $setvar
8122 $rm -f set set.c
8123 : see if bzero exists
8124 set bzero d_bzero
8125 eval $inlibc
8126
8127 : see if signal is declared as pointer to function returning int or void
8128 echo " "
8129 xxx=`./findhdr signal.h`
8130 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8131 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8132         echo "You have int (*signal())() instead of void." >&4
8133         val="$undef"
8134 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8135         echo "You have void (*signal())()." >&4
8136         val="$define"
8137 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8138         echo "You have int (*signal())() instead of void." >&4
8139         val="$undef"
8140 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8141         echo "You have void (*signal())()." >&4
8142         val="$define"
8143 else
8144         case "$d_voidsig" in
8145         '')
8146         echo "I can't determine whether signal handler returns void or int..." >&4
8147                 dflt=void
8148                 rp="What type does your signal handler return?"
8149                 . ./myread
8150                 case "$ans" in
8151                 v*) val="$define";;
8152                 *) val="$undef";;
8153                 esac;;
8154         "$define")
8155                 echo "As you already told me, signal handler returns void." >&4
8156                 val="$define"
8157                 ;;
8158         *)      echo "As you already told me, signal handler returns int." >&4
8159                 val="$undef"
8160                 ;;
8161         esac
8162 fi
8163 set d_voidsig
8164 eval $setvar
8165 case "$d_voidsig" in
8166 "$define") signal_t="void";;
8167 *) signal_t="int";;
8168 esac
8169 $rm -f $$.tmp
8170
8171 : check for ability to cast large floats to 32-bit ints.
8172 echo " "
8173 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8174 if $test "$intsize" -ge 4; then
8175         xxx=int
8176 else
8177         xxx=long
8178 fi
8179 $cat >try.c <<EOCP
8180 #include <stdio.h>
8181 #include <sys/types.h>
8182 #include <signal.h>
8183 $signal_t blech(s) int s; { exit(3); }
8184 int main()
8185 {
8186         $xxx i32;
8187         double f, g;
8188         int result = 0;
8189         char str[16];
8190         signal(SIGFPE, blech);
8191
8192         /* Don't let compiler optimize the test away.  Store the number 
8193            in a writable string for gcc to pass to sscanf under HP/UX.
8194         */
8195         sprintf(str, "2147483647");
8196         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8197         g = 10 * f;
8198         i32  = ($xxx) g;
8199
8200         /* x86 processors will probably give 0x8000 0000, which is a
8201        sign change.  We don't want that.  We want to mimic SPARC
8202            behavior here, which is to preserve the sign and give
8203            back 0x7fff ffff.
8204         */
8205         if (i32 != ($xxx) f)
8206                 result |= 1;
8207         exit(result);
8208 }
8209 EOCP
8210 set try
8211 if eval $compile_ok; then
8212         ./try
8213         yyy=$?
8214 else
8215         echo "(I can't seem to compile the test program--assuming it can't)"
8216         yyy=1
8217 fi
8218 case "$yyy" in
8219 0)      val="$define"
8220         echo "Yup, it can."
8221         ;;
8222 *)      val="$undef"
8223         echo "Nope, it can't."
8224         ;;
8225 esac
8226 set d_casti32
8227 eval $setvar
8228 $rm -f try try.*
8229
8230 : check for ability to cast negative floats to unsigned
8231 echo " "
8232 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8233 $cat >try.c <<EOCP
8234 #include <stdio.h>
8235 #include <sys/types.h>
8236 #include <signal.h>
8237 $signal_t blech(s) int s; { exit(7); }
8238 $signal_t blech_in_list(s) int s; { exit(4); }
8239 unsigned long dummy_long(p) unsigned long p; { return p; }
8240 unsigned int dummy_int(p) unsigned int p; { return p; }
8241 unsigned short dummy_short(p) unsigned short p; { return p; }
8242 int main()
8243 {
8244         double f;
8245         unsigned long along;
8246         unsigned int aint;
8247         unsigned short ashort;
8248         int result = 0;
8249         char str[16];
8250         
8251         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8252            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8253            optimized the whole file away
8254         */
8255         /* Store the number in a writable string for gcc to pass to 
8256            sscanf under HP/UX.
8257         */
8258         sprintf(str, "-123");
8259         sscanf(str, "%lf", &f);  /* f = -123.; */
8260
8261         signal(SIGFPE, blech);
8262         along = (unsigned long)f;
8263         aint = (unsigned int)f;
8264         ashort = (unsigned short)f;
8265         if (along != (unsigned long)-123)
8266                 result |= 1;
8267         if (aint != (unsigned int)-123)
8268                 result |= 1;
8269         if (ashort != (unsigned short)-123)
8270                 result |= 1;
8271         sprintf(str, "1073741824.");
8272         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8273         f = f + f;
8274         along = 0;
8275         along = (unsigned long)f;
8276         if (along != 0x80000000)
8277                 result |= 2;
8278         f -= 1.;
8279         along = 0;
8280         along = (unsigned long)f;
8281         if (along != 0x7fffffff)
8282                 result |= 1;
8283         f += 2.;
8284         along = 0;
8285         along = (unsigned long)f;
8286         if (along != 0x80000001)
8287                 result |= 2;
8288         if (result)
8289                 exit(result);
8290         signal(SIGFPE, blech_in_list);
8291         sprintf(str, "123.");
8292         sscanf(str, "%lf", &f);  /* f = 123.; */
8293         along = dummy_long((unsigned long)f);
8294         aint = dummy_int((unsigned int)f);
8295         ashort = dummy_short((unsigned short)f);
8296         if (along != (unsigned long)123)
8297                 result |= 4;
8298         if (aint != (unsigned int)123)
8299                 result |= 4;
8300         if (ashort != (unsigned short)123)
8301                 result |= 4;
8302         exit(result);
8303
8304 }
8305 EOCP
8306 set try
8307 if eval $compile_ok; then
8308         ./try
8309         castflags=$?
8310 else
8311         echo "(I can't seem to compile the test program--assuming it can't)"
8312         castflags=7
8313 fi
8314 case "$castflags" in
8315 0)      val="$define"
8316         echo "Yup, it can."
8317         ;;
8318 *)      val="$undef"
8319         echo "Nope, it can't."
8320         ;;
8321 esac
8322 set d_castneg
8323 eval $setvar
8324 $rm -f try.*
8325
8326 : see if vprintf exists
8327 echo " "
8328 if set vprintf val -f d_vprintf; eval $csym; $val; then
8329         echo 'vprintf() found.' >&4
8330         val="$define"
8331         $cat >vprintf.c <<'EOF'
8332 #include <varargs.h>
8333
8334 int main() { xxx("foo"); }
8335
8336 xxx(va_alist)
8337 va_dcl
8338 {
8339         va_list args;
8340         char buf[10];
8341
8342         va_start(args);
8343         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8344 }
8345 EOF
8346         set vprintf
8347         if eval $compile && ./vprintf; then
8348                 echo "Your vsprintf() returns (int)." >&4
8349                 val2="$undef"
8350         else
8351                 echo "Your vsprintf() returns (char*)." >&4
8352                 val2="$define"
8353         fi
8354 else
8355         echo 'vprintf() NOT found.' >&4
8356                 val="$undef"
8357                 val2="$undef"
8358 fi
8359 set d_vprintf
8360 eval $setvar
8361 val=$val2
8362 set d_charvspr
8363 eval $setvar
8364
8365 : see if chown exists
8366 set chown d_chown
8367 eval $inlibc
8368
8369 : see if chroot exists
8370 set chroot d_chroot
8371 eval $inlibc
8372
8373 : see if chsize exists
8374 set chsize d_chsize
8375 eval $inlibc
8376
8377 : check for const keyword
8378 echo " "
8379 echo 'Checking to see if your C compiler knows about "const"...' >&4
8380 $cat >const.c <<'EOCP'
8381 typedef struct spug { int drokk; } spug;
8382 int main()
8383 {
8384         const char *foo;
8385         const spug y;
8386 }
8387 EOCP
8388 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8389         val="$define"
8390         echo "Yup, it does."
8391 else
8392         val="$undef"
8393         echo "Nope, it doesn't."
8394 fi
8395 set d_const
8396 eval $setvar
8397
8398 : see if crypt exists
8399 echo " "
8400 if set crypt val -f d_crypt; eval $csym; $val; then
8401         echo 'crypt() found.' >&4
8402         val="$define"
8403         cryptlib=''
8404 else
8405         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8406         if $test -z "$cryptlib"; then
8407                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8408         else
8409                 cryptlib=-lcrypt
8410         fi
8411         if $test -z "$cryptlib"; then
8412                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8413         else
8414                 cryptlib=-lcrypt
8415         fi
8416         if $test -z "$cryptlib"; then
8417                 cryptlib=`./loc libcrypt$_a "" $libpth`
8418         else
8419                 cryptlib=-lcrypt
8420         fi
8421         if $test -z "$cryptlib"; then
8422                 echo 'crypt() NOT found.' >&4
8423                 val="$undef"
8424         else
8425                 val="$define"
8426         fi
8427 fi
8428 set d_crypt
8429 eval $setvar
8430
8431 : get csh whereabouts
8432 case "$csh" in
8433 'csh') val="$undef" ;;
8434 *) val="$define" ;;
8435 esac
8436 set d_csh
8437 eval $setvar
8438 : Respect a hint or command line value for full_csh.
8439 case "$full_csh" in
8440 '') full_csh=$csh ;;
8441 esac
8442
8443 : see if cuserid exists
8444 set cuserid d_cuserid
8445 eval $inlibc
8446
8447 : see if this is a limits.h system
8448 set limits.h i_limits
8449 eval $inhdr
8450
8451 : see if this is a float.h system
8452 set float.h i_float
8453 eval $inhdr
8454
8455 : See if number of significant digits in a double precision number is known
8456 echo " "
8457 $cat >dbl_dig.c <<EOM
8458 #$i_limits I_LIMITS
8459 #$i_float I_FLOAT
8460 #ifdef I_LIMITS
8461 #include <limits.h>
8462 #endif
8463 #ifdef I_FLOAT
8464 #include <float.h>
8465 #endif
8466 #ifdef DBL_DIG
8467 printf("Contains DBL_DIG");
8468 #endif
8469 EOM
8470 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8471 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8472         echo "DBL_DIG found." >&4
8473         val="$define"
8474 else
8475         echo "DBL_DIG NOT found." >&4
8476         val="$undef"
8477 fi
8478 $rm -f dbl_dig.?
8479 set d_dbl_dig
8480 eval $setvar
8481
8482 : see if difftime exists
8483 set difftime d_difftime
8484 eval $inlibc
8485
8486 : see if this is a dirent system
8487 echo " "
8488 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8489         val="$define"
8490         echo "<dirent.h> found." >&4
8491 else
8492         val="$undef"
8493         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8494                 echo "<sys/dir.h> found." >&4
8495                 echo " "
8496         else
8497                 xinc=`./findhdr sys/ndir.h`
8498         fi
8499         echo "<dirent.h> NOT found." >&4
8500 fi
8501 set i_dirent
8502 eval $setvar
8503
8504 : Look for type of directory structure.
8505 echo " "
8506 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8507
8508 case "$direntrytype" in
8509 ''|' ')
8510         case "$i_dirent" in
8511         $define) guess1='struct dirent' ;;
8512         *) guess1='struct direct'  ;;
8513         esac
8514         ;;
8515 *)      guess1="$direntrytype"
8516         ;;
8517 esac
8518
8519 case "$guess1" in
8520 'struct dirent') guess2='struct direct' ;;
8521 *) guess2='struct dirent' ;;
8522 esac
8523                 
8524 if $contains "$guess1" try.c >/dev/null 2>&1; then
8525         direntrytype="$guess1"
8526         echo "Your directory entries are $direntrytype." >&4
8527 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8528         direntrytype="$guess2"
8529         echo "Your directory entries seem to be $direntrytype." >&4
8530 else
8531         echo "I don't recognize your system's directory entries." >&4
8532         rp="What type is used for directory entries on this system?"
8533         dflt="$guess1"
8534         . ./myread
8535         direntrytype="$ans"
8536 fi
8537 $rm -f try.c
8538
8539
8540 : see if the directory entry stores field length
8541 echo " "
8542 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8543 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8544         echo "Good, your directory entry keeps length information in d_namlen." >&4
8545         val="$define"
8546 else
8547         echo "Your directory entry does not know about the d_namlen field." >&4
8548         val="$undef"
8549 fi
8550 set d_dirnamlen
8551 eval $setvar
8552 $rm -f try.c
8553
8554 : see if dlerror exists
8555 xxx_runnm="$runnm"
8556 runnm=false
8557 set dlerror d_dlerror
8558 eval $inlibc
8559 runnm="$xxx_runnm"
8560
8561 : see if dlfcn is available
8562 set dlfcn.h i_dlfcn
8563 eval $inhdr
8564
8565 case "$usedl" in
8566 $define|y|true)
8567         $cat << EOM
8568
8569 On a few systems, the dynamically loaded modules that perl generates and uses
8570 will need a different extension than shared libs. The default will probably
8571 be appropriate.
8572
8573 EOM
8574         case "$dlext" in
8575         '')     dflt="$so" ;;
8576         *)      dflt="$dlext" ;;
8577         esac
8578         rp='What is the extension of dynamically loaded modules'
8579         . ./myread
8580         dlext="$ans"
8581         ;;
8582 *)
8583         dlext="none"
8584         ;;
8585 esac
8586
8587 : Check if dlsym need a leading underscore
8588 echo " "
8589 val="$undef"
8590
8591 case "$dlsrc" in
8592 dl_dlopen.xs)
8593         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8594         $cat >dyna.c <<'EOM'
8595 fred () { }
8596 EOM
8597
8598 $cat >fred.c<<EOM
8599
8600 #include <stdio.h>
8601 #$i_dlfcn I_DLFCN
8602 #ifdef I_DLFCN
8603 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8604 #else
8605 #include <sys/types.h>
8606 #include <nlist.h>
8607 #include <link.h>
8608 #endif
8609
8610 extern int fred() ;
8611
8612 int main()
8613 {
8614     void * handle ;
8615     void * symbol ;
8616 #ifndef RTLD_LAZY
8617     int mode = 1 ;
8618 #else
8619     int mode = RTLD_LAZY ;
8620 #endif
8621     handle = dlopen("./dyna.$dlext", mode) ;
8622     if (handle == NULL) {
8623         printf ("1\n") ;
8624         fflush (stdout) ;
8625         exit(0);
8626     }
8627     symbol = dlsym(handle, "fred") ;
8628     if (symbol == NULL) {
8629         /* try putting a leading underscore */
8630         symbol = dlsym(handle, "_fred") ;
8631         if (symbol == NULL) {
8632             printf ("2\n") ;
8633             fflush (stdout) ;
8634             exit(0);
8635         }
8636         printf ("3\n") ;
8637     }
8638     else
8639         printf ("4\n") ;
8640     fflush (stdout) ;
8641     exit(0);
8642 }
8643 EOM
8644         : Call the object file tmp-dyna.o in case dlext=o.
8645         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8646                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8647                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8648                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8649                 xxx=`./fred`
8650                 case $xxx in
8651                 1)      echo "Test program failed using dlopen." >&4
8652                         echo "Perhaps you should not use dynamic loading." >&4;;
8653                 2)      echo "Test program failed using dlsym." >&4
8654                         echo "Perhaps you should not use dynamic loading." >&4;;
8655                 3)      echo "dlsym needs a leading underscore" >&4
8656                         val="$define" ;;
8657                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8658                 esac
8659         else
8660                 echo "I can't compile and run the test program." >&4
8661                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8662         fi
8663         ;;
8664 esac
8665                 
8666 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8667
8668 set d_dlsymun
8669 eval $setvar
8670
8671 hasproto='varname=$1; func=$2; shift; shift;
8672 while $test $# -ge 2; do
8673         case "$1" in
8674         $define) echo "#include <$2>";;
8675         esac ;
8676     shift 2;
8677 done > try.c;
8678 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8679 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8680         echo "$func() prototype found.";
8681         val="$define";
8682 else
8683         echo "$func() prototype NOT found.";
8684         val="$undef";
8685 fi;
8686 set $varname;
8687 eval $setvar;
8688 $rm -f try.c tryout.c'
8689
8690 : see if prototype for drand48 is available
8691 echo " "
8692 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8693 eval $hasproto
8694
8695 : see if dup2 exists
8696 set dup2 d_dup2
8697 eval $inlibc
8698
8699 : see if eaccess exists
8700 set eaccess d_eaccess
8701 eval $inlibc
8702
8703 : see if endgrent exists
8704 set endgrent d_endgrent
8705 eval $inlibc
8706
8707 : see if endhostent exists
8708 set endhostent d_endhent
8709 eval $inlibc
8710
8711 : see if endnetent exists
8712 set endnetent d_endnent
8713 eval $inlibc
8714
8715 : see if endprotoent exists
8716 set endprotoent d_endpent
8717 eval $inlibc
8718
8719 : see if endpwent exists
8720 set endpwent d_endpwent
8721 eval $inlibc
8722
8723 : see if endservent exists
8724 set endservent d_endsent
8725 eval $inlibc
8726
8727 : Locate the flags for 'open()'
8728 echo " "
8729 $cat >open3.c <<'EOCP'
8730 #include <sys/types.h>
8731 #ifdef I_FCNTL
8732 #include <fcntl.h>
8733 #endif
8734 #ifdef I_SYS_FILE
8735 #include <sys/file.h>
8736 #endif
8737 int main() {
8738         if(O_RDONLY);
8739 #ifdef O_TRUNC
8740         exit(0);
8741 #else
8742         exit(1);
8743 #endif
8744 }
8745 EOCP
8746 : check sys/file.h first to get FREAD on Sun
8747 if $test `./findhdr sys/file.h` && \
8748                 set open3 -DI_SYS_FILE && eval $compile; then
8749         h_sysfile=true;
8750         echo "<sys/file.h> defines the O_* constants..." >&4
8751         if ./open3; then
8752                 echo "and you have the 3 argument form of open()." >&4
8753                 val="$define"
8754         else
8755                 echo "but not the 3 argument form of open().  Oh, well." >&4
8756                 val="$undef"
8757         fi
8758 elif $test `./findhdr fcntl.h` && \
8759                 set open3 -DI_FCNTL && eval $compile; then
8760         h_fcntl=true;
8761         echo "<fcntl.h> defines the O_* constants..." >&4
8762         if ./open3; then
8763                 echo "and you have the 3 argument form of open()." >&4
8764                 val="$define"
8765         else
8766                 echo "but not the 3 argument form of open().  Oh, well." >&4
8767                 val="$undef"
8768         fi
8769 else
8770         val="$undef"
8771         echo "I can't find the O_* constant definitions!  You got problems." >&4
8772 fi
8773 set d_open3
8774 eval $setvar
8775 $rm -f open3*
8776
8777 : see which of string.h or strings.h is needed
8778 echo " "
8779 strings=`./findhdr string.h`
8780 if $test "$strings" && $test -r "$strings"; then
8781         echo "Using <string.h> instead of <strings.h>." >&4
8782         val="$define"
8783 else
8784         val="$undef"
8785         strings=`./findhdr strings.h`
8786         if $test "$strings" && $test -r "$strings"; then
8787                 echo "Using <strings.h> instead of <string.h>." >&4
8788         else
8789                 echo "No string header found -- You'll surely have problems." >&4
8790         fi
8791 fi
8792 set i_string
8793 eval $setvar
8794 case "$i_string" in
8795 "$undef") strings=`./findhdr strings.h`;;
8796 *)        strings=`./findhdr string.h`;;
8797 esac
8798
8799 : check for non-blocking I/O stuff
8800 case "$h_sysfile" in
8801 true) echo "#include <sys/file.h>" >  head.c;;
8802 esac
8803 case "$h_fcntl" in
8804 true) echo "#include <fcntl.h>"    >> head.c;;
8805 *) echo "#include <sys/fcntl.h>"   >> head.c;;
8806 esac
8807 echo " "
8808 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8809 case "$o_nonblock" in
8810 '')
8811         $cat head.c > try.c
8812         $cat >>try.c <<'EOCP'
8813 #include <stdio.h>
8814 int main() {
8815 #ifdef O_NONBLOCK
8816         printf("O_NONBLOCK\n");
8817         exit(0);
8818 #endif
8819 #ifdef O_NDELAY
8820         printf("O_NDELAY\n");
8821         exit(0);
8822 #endif
8823 #ifdef FNDELAY
8824         printf("FNDELAY\n");
8825         exit(0);
8826 #endif
8827         exit(0);
8828 }
8829 EOCP
8830         set try
8831         if eval $compile_ok; then
8832                 o_nonblock=`./try`
8833                 case "$o_nonblock" in
8834                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8835                 *) echo "Seems like we can use $o_nonblock.";;
8836                 esac
8837         else
8838                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8839         fi
8840         ;;
8841 *) echo "Using $hint value $o_nonblock.";;
8842 esac
8843 $rm -f try try.* .out core
8844
8845 echo " "
8846 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8847 case "$eagain" in
8848 '')
8849         $cat head.c > try.c
8850         $cat >>try.c <<EOCP
8851 #include <errno.h>
8852 #include <sys/types.h>
8853 #include <signal.h>
8854 #include <stdio.h> 
8855 #define MY_O_NONBLOCK $o_nonblock
8856 #ifndef errno  /* XXX need better Configure test */
8857 extern int errno;
8858 #endif
8859 #$i_unistd I_UNISTD
8860 #ifdef I_UNISTD
8861 #include <unistd.h>
8862 #endif
8863 #$i_string I_STRING
8864 #ifdef I_STRING
8865 #include <string.h>
8866 #else
8867 #include <strings.h>
8868 #endif
8869 $signal_t blech(x) int x; { exit(3); }
8870 EOCP
8871         $cat >> try.c <<'EOCP'
8872 int main()
8873 {
8874         int pd[2];
8875         int pu[2];
8876         char buf[1];
8877         char string[100];
8878
8879         pipe(pd);       /* Down: child -> parent */
8880         pipe(pu);       /* Up: parent -> child */
8881         if (0 != fork()) {
8882                 int ret;
8883                 close(pd[1]);   /* Parent reads from pd[0] */
8884                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8885                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8886                         exit(1);
8887                 signal(SIGALRM, blech);
8888                 alarm(5);
8889                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8890                         exit(2);
8891                 sprintf(string, "%d\n", ret);
8892                 write(2, string, strlen(string));
8893                 alarm(0);
8894 #ifdef EAGAIN
8895                 if (errno == EAGAIN) {
8896                         printf("EAGAIN\n");
8897                         goto ok;
8898                 }
8899 #endif
8900 #ifdef EWOULDBLOCK
8901                 if (errno == EWOULDBLOCK)
8902                         printf("EWOULDBLOCK\n");
8903 #endif
8904         ok:
8905                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8906                 sleep(2);                               /* Give it time to close our pipe */
8907                 alarm(5);
8908                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8909                 alarm(0);
8910                 sprintf(string, "%d\n", ret);
8911                 write(3, string, strlen(string));
8912                 exit(0);
8913         }
8914
8915         close(pd[0]);                   /* We write to pd[1] */
8916         close(pu[1]);                   /* We read from pu[0] */
8917         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8918         close(pd[1]);                   /* Pipe pd is now fully closed! */
8919         exit(0);                                /* Bye bye, thank you for playing! */
8920 }
8921 EOCP
8922         set try
8923         if eval $compile_ok; then
8924                 echo "$startsh" >mtry
8925                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8926                 chmod +x mtry
8927                 ./mtry >/dev/null 2>&1
8928                 case $? in
8929                 0) eagain=`$cat try.out`;;
8930                 1) echo "Could not perform non-blocking setting!";;
8931                 2) echo "I did a successful read() for something that was not there!";;
8932                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8933                 *) echo "Something terribly wrong happened during testing.";;
8934                 esac
8935                 rd_nodata=`$cat try.ret`
8936                 echo "A read() system call with no data present returns $rd_nodata."
8937                 case "$rd_nodata" in
8938                 0|-1) ;;
8939                 *)
8940                         echo "(That's peculiar, fixing that to be -1.)"
8941                         rd_nodata=-1
8942                         ;;
8943                 esac
8944                 case "$eagain" in
8945                 '')
8946                         echo "Forcing errno EAGAIN on read() with no data available."
8947                         eagain=EAGAIN
8948                         ;;
8949                 *)
8950                         echo "Your read() sets errno to $eagain when no data is available."
8951                         ;;
8952                 esac
8953                 status=`$cat try.err`
8954                 case "$status" in
8955                 0) echo "And it correctly returns 0 to signal EOF.";;
8956                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8957                 *) echo "However, your read() returns '$status' on EOF??";;
8958                 esac
8959                 val="$define"
8960                 if test "$status" = "$rd_nodata"; then
8961                         echo "WARNING: you can't distinguish between EOF and no data!"
8962                         val="$undef"
8963                 fi
8964         else
8965                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8966                 eagain=EAGAIN
8967         fi
8968         set d_eofnblk
8969         eval $setvar
8970         ;;
8971 *)
8972         echo "Using $hint value $eagain."
8973         echo "Your read() returns $rd_nodata when no data is present."
8974         case "$d_eofnblk" in
8975         "$define") echo "And you can see EOF because read() returns 0.";;
8976         "$undef") echo "But you can't see EOF status from read() returned value.";;
8977         *)
8978                 echo "(Assuming you can't see EOF status from read anyway.)"
8979                 d_eofnblk=$undef
8980                 ;;
8981         esac
8982         ;;
8983 esac
8984 $rm -f try try.* .out core head.c mtry
8985
8986 : see if fchmod exists
8987 set fchmod d_fchmod
8988 eval $inlibc
8989
8990 : see if fchown exists
8991 set fchown d_fchown
8992 eval $inlibc
8993
8994 : see if this is an fcntl system
8995 set fcntl d_fcntl
8996 eval $inlibc
8997
8998 echo " "
8999 : See if fcntl-based locking works.
9000 $cat >try.c <<'EOCP'
9001 #include <stdlib.h>
9002 #include <unistd.h>
9003 #include <fcntl.h>
9004 int main() {
9005 #if defined(F_SETLK) && defined(F_SETLKW)
9006      struct flock flock;
9007      int retval, fd;
9008      fd = open("try.c", O_RDONLY);
9009      flock.l_type = F_RDLCK;
9010      flock.l_whence = SEEK_SET;
9011      flock.l_start = flock.l_len = 0;
9012      retval = fcntl(fd, F_SETLK, &flock);
9013      close(fd);
9014      (retval < 0 ? exit(2) : exit(0));
9015 #else
9016      exit(2);
9017 #endif
9018 }
9019 EOCP
9020 echo "Checking if fcntl-based file locking works... "
9021 case "$d_fcntl" in
9022 "$define")
9023         set try
9024         if eval $compile_ok; then
9025                 if ./try; then
9026                         echo "Yes, it seems to work."
9027                         val="$define"
9028                 else
9029                         echo "Nope, it didn't work."
9030                         val="$undef"
9031                 fi
9032         else
9033                 echo "I'm unable to compile the test program, so I'll assume not."
9034                 val="$undef"
9035         fi
9036         ;;
9037 *) val="$undef";
9038         echo "Nope, since you don't even have fcntl()."
9039         ;;
9040 esac
9041 set d_fcntl_can_lock
9042 eval $setvar
9043 $rm -f try*
9044
9045
9046 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9047 while $test $# -ge 2; do
9048         case "$1" in
9049         $define) echo "#include <$2>";;
9050         esac ;
9051     shift 2;
9052 done > try.c;
9053 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9054 set try;
9055 if eval $compile; then
9056         val="$define";
9057 else
9058         val="$undef";
9059 fi;
9060 set $varname;
9061 eval $setvar;
9062 $rm -f try.c try.o'
9063
9064 socketlib=''
9065 sockethdr=''
9066 : see whether socket exists
9067 echo " "
9068 $echo $n "Hmm... $c" >&4
9069 if set socket val -f d_socket; eval $csym; $val; then
9070         echo "Looks like you have Berkeley networking support." >&4
9071         d_socket="$define"
9072         if set setsockopt val -f; eval $csym; $val; then
9073                 d_oldsock="$undef"
9074         else
9075                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9076                 d_oldsock="$define"
9077         fi
9078 else
9079         if $contains socklib libc.list >/dev/null 2>&1; then
9080                 echo "Looks like you have Berkeley networking support." >&4
9081                 d_socket="$define"
9082                 : we will have to assume that it supports the 4.2 BSD interface
9083                 d_oldsock="$undef"
9084         else
9085                 echo "You don't have Berkeley networking in libc$_a..." >&4
9086                 if test "X$d_socket" = "X$define"; then
9087                    echo "...but you seem to believe that you have sockets." >&4
9088                 else
9089                         for net in net socket
9090                         do
9091                                 if test -f /usr/lib/lib$net$_a; then
9092                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9093                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9094                                         if $contains socket libc.list >/dev/null 2>&1; then
9095                                                 d_socket="$define"
9096                                                 socketlib="-l$net"
9097                                                 case "$net" in
9098                                                 net)
9099                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9100                                                         sockethdr="-I/usr/netinclude"
9101                                                         ;;
9102                                                 esac
9103                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9104                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9105                                                         d_oldsock="$undef"
9106                                                 else
9107                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9108                                                         d_oldsock="$define"
9109                                                 fi
9110                                                 break
9111                                         fi
9112                                 fi
9113                         done
9114                         if test "X$d_socket" != "X$define"; then
9115                            echo "or anywhere else I see." >&4
9116                            d_socket="$undef"
9117                            d_oldsock="$undef"
9118                         fi
9119                 fi
9120         fi
9121 fi
9122
9123 : see if socketpair exists
9124 set socketpair d_sockpair
9125 eval $inlibc
9126
9127
9128 echo " "
9129 echo "Checking the availability of certain socket constants..." >& 4
9130 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9131         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9132         $cat >try.c <<EOF
9133 #include <sys/types.h>
9134 #include <sys/socket.h>
9135 int main() {
9136     int i = $ENUM;
9137 }
9138 EOF
9139         val="$undef"
9140         set try; if eval $compile; then
9141                 val="$define"
9142         fi
9143         set d_${enum}; eval $setvar
9144         $rm -f try.c try
9145 done
9146
9147 : see if sys/select.h has to be included
9148 set sys/select.h i_sysselct
9149 eval $inhdr
9150
9151 : see if we should include time.h, sys/time.h, or both
9152 echo " "
9153 if test "X$timeincl" = X; then
9154         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9155         $echo $n "I'm now running the test program...$c"
9156         $cat >try.c <<'EOCP'
9157 #include <sys/types.h>
9158 #ifdef I_TIME
9159 #include <time.h>
9160 #endif
9161 #ifdef I_SYSTIME
9162 #ifdef SYSTIMEKERNEL
9163 #define KERNEL
9164 #endif
9165 #include <sys/time.h>
9166 #endif
9167 #ifdef I_SYSSELECT
9168 #include <sys/select.h>
9169 #endif
9170 int main()
9171 {
9172         struct tm foo;
9173 #ifdef S_TIMEVAL
9174         struct timeval bar;
9175 #endif
9176 #ifdef S_TIMEZONE
9177         struct timezone tzp;
9178 #endif
9179         if (foo.tm_sec == foo.tm_sec)
9180                 exit(0);
9181 #ifdef S_TIMEVAL
9182         if (bar.tv_sec == bar.tv_sec)
9183                 exit(0);
9184 #endif
9185         exit(1);
9186 }
9187 EOCP
9188         flags=''
9189         for s_timezone in '-DS_TIMEZONE' ''; do
9190         sysselect=''
9191         for s_timeval in '-DS_TIMEVAL' ''; do
9192         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9193         for i_time in '' '-DI_TIME'; do
9194         for i_systime in '-DI_SYSTIME' ''; do
9195                 case "$flags" in
9196                 '') $echo $n ".$c"
9197                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9198                         if eval $compile; then
9199                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9200                                 shift
9201                                 flags="$*"
9202                                 echo " "
9203                                 $echo $n "Succeeded with $flags$c"
9204                         fi
9205                         ;;
9206                 esac
9207         done
9208         done
9209         done
9210         done
9211         done
9212         timeincl=''
9213         echo " "
9214         case "$flags" in
9215         *SYSTIMEKERNEL*) i_systimek="$define"
9216                 timeincl=`./findhdr sys/time.h`
9217                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9218         *) i_systimek="$undef";;
9219         esac
9220         case "$flags" in
9221         *I_TIME*) i_time="$define"
9222                 timeincl=`./findhdr time.h`" $timeincl"
9223                 echo "We'll include <time.h>." >&4;;
9224         *) i_time="$undef";;
9225         esac
9226         case "$flags" in
9227         *I_SYSTIME*) i_systime="$define"
9228                 timeincl=`./findhdr sys/time.h`" $timeincl"
9229                 echo "We'll include <sys/time.h>." >&4;;
9230         *) i_systime="$undef";;
9231         esac
9232         $rm -f try.c try
9233 fi
9234
9235 : check for fd_set items
9236 $cat <<EOM
9237
9238 Checking to see how well your C compiler handles fd_set and friends ...
9239 EOM
9240 $cat >fd_set.c <<EOCP
9241 #$i_systime I_SYS_TIME
9242 #$i_sysselct I_SYS_SELECT
9243 #$d_socket HAS_SOCKET
9244 #include <sys/types.h>
9245 #ifdef HAS_SOCKET
9246 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9247 #endif
9248 #ifdef I_SYS_TIME
9249 #include <sys/time.h>
9250 #endif
9251 #ifdef I_SYS_SELECT
9252 #include <sys/select.h>
9253 #endif
9254 int main() {
9255         fd_set fds;
9256
9257 #ifdef TRYBITS
9258         if(fds.fds_bits);
9259 #endif
9260
9261 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9262         exit(0);
9263 #else
9264         exit(1);
9265 #endif
9266 }
9267 EOCP
9268 set fd_set -DTRYBITS
9269 if eval $compile; then
9270         d_fds_bits="$define"
9271         d_fd_set="$define"
9272         echo "Well, your system knows about the normal fd_set typedef..." >&4
9273         if ./fd_set; then
9274                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9275                 d_fd_macros="$define"
9276         else
9277                 $cat >&4 <<'EOM'
9278 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9279 EOM
9280                 d_fd_macros="$undef"
9281         fi
9282 else
9283         $cat <<'EOM'
9284 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9285 EOM
9286         set fd_set
9287         if eval $compile; then
9288                 d_fds_bits="$undef"
9289                 d_fd_set="$define"
9290                 echo "Well, your system has some sort of fd_set available..." >&4
9291                 if ./fd_set; then
9292                         echo "and you have the normal fd_set macros." >&4
9293                         d_fd_macros="$define"
9294                 else
9295                         $cat <<'EOM'
9296 but not the normal fd_set macros!  Gross!  More work for me...
9297 EOM
9298                         d_fd_macros="$undef"
9299                 fi
9300         else
9301         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9302                 d_fd_set="$undef"
9303                 d_fds_bits="$undef"
9304                 d_fd_macros="$undef"
9305         fi
9306 fi
9307 $rm -f fd_set*
9308
9309 : see if fgetpos exists
9310 set fgetpos d_fgetpos
9311 eval $inlibc
9312
9313 : see if flock exists
9314 set flock d_flock
9315 eval $inlibc
9316
9317 : see if fork exists
9318 set fork d_fork
9319 eval $inlibc
9320
9321 : see if pathconf exists
9322 set pathconf d_pathconf
9323 eval $inlibc
9324
9325 : see if fpathconf exists
9326 set fpathconf d_fpathconf
9327 eval $inlibc
9328
9329
9330 : check for fpos64_t
9331 echo " "
9332 echo "Checking to see if you have fpos64_t..." >&4
9333 $cat >try.c <<EOCP
9334 #include <stdio.h>
9335 int main() { fpos64_t x = 7; }
9336 EOCP
9337 set try
9338 if eval $compile; then
9339         val="$define"
9340         echo "You have fpos64_t."
9341 else
9342         val="$undef"
9343         echo "You do not have fpos64_t."
9344         case "$fpossize" in
9345         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9346         esac
9347 fi
9348 $rm -f try.* try
9349 set d_fpos64_t
9350 eval $setvar
9351
9352 : see if frexpl exists
9353 set frexpl d_frexpl
9354 eval $inlibc
9355
9356 hasstruct='varname=$1; struct=$2; shift; shift;
9357 while $test $# -ge 2; do
9358         case "$1" in
9359         $define) echo "#include <$2>";;
9360         esac ;
9361     shift 2;
9362 done > try.c;
9363 echo "int main () { struct $struct foo; }" >> try.c;
9364 set try;
9365 if eval $compile; then
9366         val="$define";
9367 else
9368         val="$undef";
9369 fi;
9370 set $varname;
9371 eval $setvar;
9372 $rm -f try.c try.o'
9373
9374 : see if this is a sys/param system
9375 set sys/param.h i_sysparam
9376 eval $inhdr
9377
9378 : see if this is a sys/mount.h system
9379 set sys/mount.h i_sysmount
9380 eval $inhdr
9381
9382 : see if sys/types.h has to be included
9383 set sys/types.h i_systypes
9384 eval $inhdr
9385
9386
9387 echo " "
9388 echo "Checking to see if your system supports struct fs_data..." >&4
9389 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9390 eval $hasstruct
9391 case "$d_fs_data_s" in
9392 "$define")      echo "Yes, it does."   ;;
9393 *)              echo "No, it doesn't." ;;
9394 esac
9395
9396 : see if fseeko exists
9397 set fseeko d_fseeko
9398 eval $inlibc
9399 case "$longsize" in
9400 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9401 esac
9402
9403 : see if fsetpos exists
9404 set fsetpos d_fsetpos
9405 eval $inlibc
9406
9407
9408 : see if fstatfs exists
9409 set fstatfs d_fstatfs
9410 eval $inlibc
9411
9412
9413 : see if statvfs exists
9414 set statvfs d_statvfs
9415 eval $inlibc
9416
9417 : see if fstatvfs exists
9418 set fstatvfs d_fstatvfs
9419 eval $inlibc
9420
9421
9422 : see if fsync exists
9423 set fsync d_fsync
9424 eval $inlibc
9425
9426 : see if ftello exists
9427 set ftello d_ftello
9428 eval $inlibc
9429 case "$longsize" in
9430 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9431 esac
9432
9433 : see if getcwd exists
9434 set getcwd d_getcwd
9435 eval $inlibc
9436
9437 : see if getespwnam exists
9438 set getespwnam d_getespwnam
9439 eval $inlibc
9440
9441
9442 : see if getfsstat exists
9443 set getfsstat d_getfsstat
9444 eval $inlibc
9445
9446 : see if getgrent exists
9447 set getgrent d_getgrent
9448 eval $inlibc
9449
9450 : see if gethostbyaddr exists
9451 set gethostbyaddr d_gethbyaddr
9452 eval $inlibc
9453
9454 : see if gethostbyname exists
9455 set gethostbyname d_gethbyname
9456 eval $inlibc
9457
9458 : see if gethostent exists
9459 set gethostent d_gethent
9460 eval $inlibc
9461
9462 : see how we will look up host name
9463 echo " "
9464 call=''
9465 if set gethostname val -f d_gethname; eval $csym; $val; then
9466         echo 'gethostname() found.' >&4
9467         d_gethname="$define"
9468         call=gethostname
9469 fi
9470 if set uname val -f d_uname; eval $csym; $val; then
9471         if ./xenix; then
9472                 $cat <<'EOM'
9473 uname() was found, but you're running xenix, and older versions of xenix
9474 have a broken uname(). If you don't really know whether your xenix is old
9475 enough to have a broken system call, use the default answer.
9476
9477 EOM
9478                 dflt=y
9479                 case "$d_uname" in
9480                 "$define") dflt=n;;
9481                 esac
9482                 rp='Is your uname() broken?'
9483                 . ./myread
9484                 case "$ans" in
9485                 n*) d_uname="$define"; call=uname;;
9486                 esac
9487         else
9488                 echo 'uname() found.' >&4
9489                 d_uname="$define"
9490                 case "$call" in
9491                 '') call=uname ;;
9492                 esac
9493         fi
9494 fi
9495 case "$d_gethname" in
9496 '') d_gethname="$undef";;
9497 esac
9498 case "$d_uname" in
9499 '') d_uname="$undef";;
9500 esac
9501 case "$d_uname$d_gethname" in
9502 *define*)
9503         dflt=n
9504         cat <<EOM
9505  
9506 Every now and then someone has a $call() that lies about the hostname
9507 but can't be fixed for political or economic reasons.  If you wish, I can
9508 pretend $call() isn't there and maybe compute hostname at run-time
9509 thanks to the '$phostname' command.
9510
9511 EOM
9512         rp="Shall I ignore $call() from now on?"
9513         . ./myread
9514         case "$ans" in
9515         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9516         esac;;
9517 esac
9518 case "$phostname" in
9519 '') aphostname='';;
9520 *) case "$aphostname" in
9521         /*) ;;
9522         *) set X $phostname
9523                 shift
9524                 file=$1
9525                 shift
9526                 file=`./loc $file $file $pth`
9527                 aphostname=`echo $file $*`
9528                 ;;
9529         esac
9530         ;;
9531 esac
9532 case "$d_uname$d_gethname" in
9533 *define*) ;;
9534 *)
9535         case "$phostname" in
9536         '')
9537                 echo "There will be no way for $package to get your hostname." >&4;;
9538         *)
9539         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9540                 ;;
9541         esac;;
9542 esac
9543 case "$d_phostname" in
9544 '') d_phostname="$undef";;
9545 esac
9546
9547 : see if this is a netdb.h system
9548 set netdb.h i_netdb
9549 eval $inhdr
9550
9551 : see if prototypes for various gethostxxx netdb.h functions are available
9552 echo " "
9553 set d_gethostprotos gethostent $i_netdb netdb.h
9554 eval $hasproto
9555
9556 : see if getlogin exists
9557 set getlogin d_getlogin
9558 eval $inlibc
9559
9560 : see if getmnt exists
9561 set getmnt d_getmnt
9562 eval $inlibc
9563
9564 : see if getmntent exists
9565 set getmntent d_getmntent
9566 eval $inlibc
9567
9568 : see if getnetbyaddr exists
9569 set getnetbyaddr d_getnbyaddr
9570 eval $inlibc
9571
9572 : see if getnetbyname exists
9573 set getnetbyname d_getnbyname
9574 eval $inlibc
9575
9576 : see if getnetent exists
9577 set getnetent d_getnent
9578 eval $inlibc
9579
9580 : see if prototypes for various getnetxxx netdb.h functions are available
9581 echo " "
9582 set d_getnetprotos getnetent $i_netdb netdb.h
9583 eval $hasproto
9584
9585 : see if getpagesize exists
9586 set getpagesize d_getpagsz
9587 eval $inlibc
9588
9589
9590 : see if getprotobyname exists
9591 set getprotobyname d_getpbyname
9592 eval $inlibc
9593
9594 : see if getprotobynumber exists
9595 set getprotobynumber d_getpbynumber
9596 eval $inlibc
9597
9598 : see if getprotoent exists
9599 set getprotoent d_getpent
9600 eval $inlibc
9601
9602 : see if getpgid exists
9603 set getpgid d_getpgid
9604 eval $inlibc
9605
9606 : see if getpgrp2 exists
9607 set getpgrp2 d_getpgrp2
9608 eval $inlibc
9609
9610 : see if getppid exists
9611 set getppid d_getppid
9612 eval $inlibc
9613
9614 : see if getpriority exists
9615 set getpriority d_getprior
9616 eval $inlibc
9617
9618 : see if prototypes for various getprotoxxx netdb.h functions are available
9619 echo " "
9620 set d_getprotoprotos getprotoent $i_netdb netdb.h
9621 eval $hasproto
9622
9623 : see if getprpwnam exists
9624 set getprpwnam d_getprpwnam
9625 eval $inlibc
9626
9627 : see if getpwent exists
9628 set getpwent d_getpwent
9629 eval $inlibc
9630
9631
9632 : see if getservbyname exists
9633 set getservbyname d_getsbyname
9634 eval $inlibc
9635
9636 : see if getservbyport exists
9637 set getservbyport d_getsbyport
9638 eval $inlibc
9639
9640 : see if getservent exists
9641 set getservent d_getsent
9642 eval $inlibc
9643
9644 : see if prototypes for various getservxxx netdb.h functions are available
9645 echo " "
9646 set d_getservprotos getservent $i_netdb netdb.h
9647 eval $hasproto
9648
9649 : see if getspnam exists
9650 set getspnam d_getspnam
9651 eval $inlibc
9652
9653 : see if gettimeofday or ftime exists
9654 set gettimeofday d_gettimeod
9655 eval $inlibc
9656 case "$d_gettimeod" in
9657 "$undef")
9658         set ftime d_ftime 
9659         eval $inlibc
9660         ;;
9661 *)
9662         val="$undef"; set d_ftime; eval $setvar
9663         ;;
9664 esac
9665 case "$d_gettimeod$d_ftime" in
9666 "$undef$undef")
9667         echo " "
9668         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9669         ;;
9670 esac
9671
9672 : see if this is an grp system
9673 set grp.h i_grp
9674 eval $inhdr
9675
9676 case "$i_grp" in
9677 $define)
9678         xxx=`./findhdr grp.h`
9679         $cppstdin $cppflags $cppminus < $xxx >$$.h
9680
9681         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9682                 val="$define"
9683         else
9684                 val="$undef"
9685         fi
9686         set d_grpasswd
9687         eval $setvar
9688
9689         $rm -f $$.h
9690         ;;
9691 *)
9692         val="$undef";
9693         set d_grpasswd; eval $setvar
9694         ;;
9695 esac
9696
9697 : see if hasmntopt exists
9698 set hasmntopt d_hasmntopt
9699 eval $inlibc
9700
9701 : see if this is a netinet/in.h or sys/in.h system
9702 set netinet/in.h i_niin sys/in.h i_sysin
9703 eval $inhdr
9704
9705 : see if arpa/inet.h has to be included
9706 set arpa/inet.h i_arpainet
9707 eval $inhdr
9708
9709 : see if htonl --and friends-- exists
9710 val=''
9711 set htonl val
9712 eval $inlibc
9713
9714 : Maybe they are macros.
9715 case "$val" in
9716 $undef)
9717         $cat >htonl.c <<EOM
9718 #include <stdio.h>
9719 #include <sys/types.h>
9720 #$i_niin I_NETINET_IN
9721 #$i_sysin I_SYS_IN
9722 #$i_arpainet I_ARPA_INET
9723 #ifdef I_NETINET_IN
9724 #include <netinet/in.h>
9725 #endif
9726 #ifdef I_SYS_IN
9727 #include <sys/in.h>
9728 #endif
9729 #ifdef I_ARPA_INET
9730 #include <arpa/inet.h>
9731 #endif
9732 #ifdef htonl
9733 printf("Defined as a macro.");
9734 #endif
9735 EOM
9736         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9737         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9738                 val="$define"
9739                 echo "But it seems to be defined as a macro." >&4
9740         fi
9741         $rm -f htonl.?
9742         ;;
9743 esac
9744 set d_htonl
9745 eval $setvar
9746
9747 : see if iconv exists
9748 set iconv d_iconv
9749 eval $inlibc
9750
9751 : index or strchr
9752 echo " "
9753 if set index val -f; eval $csym; $val; then
9754         if set strchr val -f d_strchr; eval $csym; $val; then
9755                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9756                         val="$define"
9757                         vali="$undef"
9758                         echo "strchr() found." >&4
9759                 else
9760                         val="$undef"
9761                         vali="$define"
9762                         echo "index() found." >&4
9763                 fi
9764         else
9765                 val="$undef"
9766                 vali="$define"
9767                 echo "index() found." >&4
9768         fi
9769 else
9770         if set strchr val -f d_strchr; eval $csym; $val; then
9771                 val="$define"
9772                 vali="$undef"
9773                 echo "strchr() found." >&4
9774         else
9775                 echo "No index() or strchr() found!" >&4
9776                 val="$undef"
9777                 vali="$undef"
9778         fi
9779 fi
9780 set d_strchr; eval $setvar
9781 val="$vali"
9782 set d_index; eval $setvar
9783
9784 : check whether inet_aton exists
9785 set inet_aton d_inetaton
9786 eval $inlibc
9787
9788 : see if inttypes.h is available
9789 : we want a real compile instead of Inhdr because some systems
9790 : have an inttypes.h which includes non-existent headers
9791 echo " "
9792 $cat >try.c <<EOCP
9793 #include <inttypes.h>
9794 int main() {
9795         static int32_t foo32 = 0x12345678;
9796 }
9797 EOCP
9798 set try
9799 if eval $compile; then
9800         echo "<inttypes.h> found." >&4
9801         val="$define"
9802 else
9803         echo "<inttypes.h> NOT found." >&4
9804         val="$undef"
9805 fi
9806 $rm -f try.c try
9807 set i_inttypes
9808 eval $setvar
9809
9810 : check for int64_t
9811 echo " "
9812 echo "Checking to see if you have int64_t..." >&4
9813 $cat >try.c <<EOCP
9814 #include <sys/types.h>
9815 #$i_inttypes I_INTTYPES
9816 #ifdef I_INTTYPES
9817 #include <inttypes.h>
9818 #endif
9819 int main() { int64_t x = 7; }
9820 EOCP
9821 set try
9822 if eval $compile; then
9823         val="$define"
9824         echo "You have int64_t."
9825 else
9826         val="$undef"
9827         echo "You do not have int64_t."
9828 fi
9829 $rm -f try try.*
9830 set d_int64_t
9831 eval $setvar
9832
9833 : Look for isascii
9834 echo " "
9835 $cat >isascii.c <<'EOCP'
9836 #include <stdio.h>
9837 #include <ctype.h>
9838 int main() {
9839         int c = 'A';
9840         if (isascii(c))
9841                 exit(0);
9842         else
9843                 exit(1);
9844 }
9845 EOCP
9846 set isascii
9847 if eval $compile; then
9848         echo "isascii() found." >&4
9849         val="$define"
9850 else
9851         echo "isascii() NOT found." >&4
9852         val="$undef"
9853 fi
9854 set d_isascii
9855 eval $setvar
9856 $rm -f isascii*
9857
9858 : see if isnan exists
9859 set isnan d_isnan
9860 eval $inlibc
9861
9862 : see if isnanl exists
9863 set isnanl d_isnanl
9864 eval $inlibc
9865
9866 : see if killpg exists
9867 set killpg d_killpg
9868 eval $inlibc
9869
9870 : see if lchown exists
9871 echo " "
9872 $cat > try.c <<'EOCP'
9873 /* System header to define __stub macros and hopefully few prototypes,
9874     which can conflict with char lchown(); below.  */
9875 #include <assert.h>
9876 /* Override any gcc2 internal prototype to avoid an error.  */
9877 /* We use char because int might match the return type of a gcc2
9878    builtin and then its argument prototype would still apply.  */
9879 char lchown();
9880 int main() {
9881     /*  The GNU C library defines this for functions which it implements
9882         to always fail with ENOSYS.  Some functions are actually named
9883         something starting with __ and the normal name is an alias.  */
9884 #if defined (__stub_lchown) || defined (__stub___lchown)
9885 choke me
9886 #else
9887 lchown();
9888 #endif
9889 ; return 0; }
9890 EOCP
9891 set try
9892 if eval $compile; then
9893     $echo "lchown() found." >&4
9894     val="$define"
9895 else
9896     $echo "lchown() NOT found." >&4
9897     val="$undef"
9898 fi
9899 set d_lchown
9900 eval $setvar
9901
9902 : See if number of significant digits in a double precision number is known
9903 echo " "
9904 $cat >ldbl_dig.c <<EOM
9905 #$i_limits I_LIMITS
9906 #$i_float I_FLOAT
9907 #ifdef I_LIMITS
9908 #include <limits.h>
9909 #endif
9910 #ifdef I_FLOAT
9911 #include <float.h>
9912 #endif
9913 #ifdef LDBL_DIG
9914 printf("Contains LDBL_DIG");
9915 #endif
9916 EOM
9917 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9918 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9919         echo "LDBL_DIG found." >&4
9920         val="$define"
9921 else
9922         echo "LDBL_DIG NOT found." >&4
9923         val="$undef"
9924 fi
9925 $rm -f ldbl_dig.?
9926 set d_ldbl_dig
9927 eval $setvar
9928
9929 : see if link exists
9930 set link d_link
9931 eval $inlibc
9932
9933 : see if localeconv exists
9934 set localeconv d_locconv
9935 eval $inlibc
9936
9937 : see if lockf exists
9938 set lockf d_lockf
9939 eval $inlibc
9940
9941 : check for long long
9942 echo " "
9943 echo "Checking to see if you have long long..." >&4
9944 echo 'int main() { long long x = 7; return 0; }' > try.c
9945 set try
9946 if eval $compile; then
9947         val="$define"
9948         echo "You have long long."
9949 else
9950         val="$undef"
9951         echo "You do not have long long."
9952 fi
9953 $rm try.*
9954 set d_longlong
9955 eval $setvar
9956
9957 : check for length of long long
9958 case "${d_longlong}${longlongsize}" in
9959 $define)
9960         echo " "
9961         echo "Checking to see how big your long longs are..." >&4
9962         $cat >try.c <<'EOCP'
9963 #include <stdio.h>
9964 int main()
9965 {
9966     printf("%d\n", (int)sizeof(long long));
9967     return(0);
9968 }
9969 EOCP
9970         set try
9971         if eval $compile_ok; then
9972                 longlongsize=`./try$exe_ext`
9973                 echo "Your long longs are $longlongsize bytes long."
9974         else
9975                 dflt='8'
9976                 echo " "
9977                 echo "(I can't seem to compile the test program.  Guessing...)"
9978                 rp="What is the size of a long long (in bytes)?"
9979                 . ./myread
9980                 longlongsize="$ans"
9981         fi
9982         if $test "X$longsize" = "X$longlongsize"; then
9983                 echo "(That isn't any different from an ordinary long.)"
9984         fi      
9985         ;;
9986 esac
9987 $rm -f try.* try
9988
9989 : see if prototype for lseek is available
9990 echo " "
9991 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9992 eval $hasproto
9993
9994 : see if lstat exists
9995 set lstat d_lstat
9996 eval $inlibc
9997
9998 : see if madvise exists
9999 set madvise d_madvise
10000 eval $inlibc
10001
10002 : see if mblen exists
10003 set mblen d_mblen
10004 eval $inlibc
10005
10006 : see if mbstowcs exists
10007 set mbstowcs d_mbstowcs
10008 eval $inlibc
10009
10010 : see if mbtowc exists
10011 set mbtowc d_mbtowc
10012 eval $inlibc
10013
10014 : see if memchr exists
10015 set memchr d_memchr
10016 eval $inlibc
10017
10018 : see if memcmp exists
10019 set memcmp d_memcmp
10020 eval $inlibc
10021
10022 : see if memcpy exists
10023 set memcpy d_memcpy
10024 eval $inlibc
10025
10026 : see if memmove exists
10027 set memmove d_memmove
10028 eval $inlibc
10029
10030 : see if memset exists
10031 set memset d_memset
10032 eval $inlibc
10033
10034 : see if mkdir exists
10035 set mkdir d_mkdir
10036 eval $inlibc
10037
10038 : see if mkdtemp exists
10039 set mkdtemp d_mkdtemp
10040 eval $inlibc
10041
10042 : see if mkfifo exists
10043 set mkfifo d_mkfifo
10044 eval $inlibc
10045
10046 : see if mkstemp exists
10047 set mkstemp d_mkstemp
10048 eval $inlibc
10049
10050 : see if mkstemps exists
10051 set mkstemps d_mkstemps
10052 eval $inlibc
10053
10054 : see if mktime exists
10055 set mktime d_mktime
10056 eval $inlibc
10057
10058 : see if this is a sys/mman.h system
10059 set sys/mman.h i_sysmman
10060 eval $inhdr
10061
10062 : see if mmap exists
10063 set mmap d_mmap
10064 eval $inlibc
10065 : see what shmat returns
10066 : default to something harmless
10067 mmaptype='void *'
10068 case "$i_sysmman$d_mmap" in
10069 "$define$define")
10070         $cat >mmap.c <<'END'
10071 #include <sys/mman.h>
10072 void *mmap();
10073 END
10074         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10075                 mmaptype='void *'
10076         else
10077                 mmaptype='caddr_t'
10078         fi
10079         echo "and it returns ($mmaptype)." >&4
10080         ;;
10081 esac
10082
10083
10084
10085 : see if modfl exists
10086 set modfl d_modfl
10087 eval $inlibc
10088
10089 : see if mprotect exists
10090 set mprotect d_mprotect
10091 eval $inlibc
10092
10093 : see if msgctl exists
10094 set msgctl d_msgctl
10095 eval $inlibc
10096
10097 : see if msgget exists
10098 set msgget d_msgget
10099 eval $inlibc
10100
10101 : see if msgsnd exists
10102 set msgsnd d_msgsnd
10103 eval $inlibc
10104
10105 : see if msgrcv exists
10106 set msgrcv d_msgrcv
10107 eval $inlibc
10108
10109 : see how much of the 'msg*(2)' library is present.
10110 h_msg=true
10111 echo " "
10112 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10113 *"$undef"*) h_msg=false;;
10114 esac
10115 case "$osname" in
10116 freebsd)
10117     case "`ipcs 2>&1`" in
10118     "SVID messages"*"not configured"*)
10119         echo "Your $osname does not have the msg*(2) configured." >&4
10120         h_msg=false
10121         val="$undef"
10122         set msgctl d_msgctl
10123         eval $setvar
10124         set msgget d_msgget
10125         eval $setvar
10126         set msgsnd d_msgsnd
10127         eval $setvar
10128         set msgrcv d_msgrcv
10129         eval $setvar
10130         ;;
10131     esac
10132     ;;
10133 esac
10134 : we could also check for sys/ipc.h ...
10135 if $h_msg && $test `./findhdr sys/msg.h`; then
10136         echo "You have the full msg*(2) library." >&4
10137         val="$define"
10138 else
10139         echo "You don't have the full msg*(2) library." >&4
10140         val="$undef"
10141 fi
10142 set d_msg
10143 eval $setvar
10144
10145 : see if msync exists
10146 set msync d_msync
10147 eval $inlibc
10148
10149 : see if munmap exists
10150 set munmap d_munmap
10151 eval $inlibc
10152
10153 : see if nice exists
10154 set nice d_nice
10155 eval $inlibc
10156
10157
10158 echo " "
10159 echo "Checking which 64-bit integer type we could use..." >&4
10160
10161 case "$intsize" in
10162 8) val=int
10163    set quadtype
10164    eval $setvar
10165    val='"unsigned int"'
10166    set uquadtype
10167    eval $setvar
10168    quadkind=1
10169    ;;
10170 *) case "$longsize" in
10171    8) val=long
10172       set quadtype
10173       eval $setvar
10174       val='"unsigned long"'
10175       set uquadtype
10176       eval $setvar
10177       quadkind=2
10178       ;;
10179    *) case "$d_longlong:$longlongsize" in
10180       define:8)
10181         val='"long long"'
10182         set quadtype
10183         eval $setvar
10184         val='"unsigned long long"'
10185         set uquadtype
10186         eval $setvar
10187         quadkind=3
10188         ;;
10189       *) case "$d_int64_t" in
10190          define)
10191            val=int64_t
10192            set quadtype
10193            eval $setvar
10194            val=uint64_t
10195            set uquadtype
10196            eval $setvar
10197            quadkind=4
10198            ;;
10199          esac
10200          ;;
10201       esac
10202       ;;
10203    esac
10204    ;;
10205 esac
10206
10207 case "$quadtype" in
10208 '')     echo "Alas, no 64-bit integer types in sight." >&4
10209         d_quad="$undef"
10210         ;;
10211 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10212             verb="will"
10213         else
10214             verb="could"
10215         fi
10216         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10217         d_quad="$define"
10218         ;;
10219 esac
10220
10221 : check for length of character
10222 echo " "
10223 case "$charsize" in
10224 '')
10225         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10226         $cat >try.c <<'EOCP'
10227 #include <stdio.h>
10228 int main()
10229 {
10230     printf("%d\n", (int)sizeof(char));
10231     exit(0);
10232 }
10233 EOCP
10234         set try
10235         if eval $compile_ok; then
10236                 dflt=`./try`
10237         else
10238                 dflt='1'
10239                 echo "(I can't seem to compile the test program.  Guessing...)"
10240         fi
10241         ;;
10242 *)
10243         dflt="$charsize"
10244         ;;
10245 esac
10246 rp="What is the size of a character (in bytes)?"
10247 . ./myread
10248 charsize="$ans"
10249 $rm -f try.c try
10250
10251 : check for volatile keyword
10252 echo " "
10253 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10254 $cat >try.c <<'EOCP'
10255 int main()
10256 {
10257         typedef struct _goo_struct goo_struct;
10258         goo_struct * volatile goo = ((goo_struct *)0);
10259         struct _goo_struct {
10260                 long long_int;
10261                 int reg_int;
10262                 char char_var;
10263         };
10264         typedef unsigned short foo_t;
10265         char *volatile foo;
10266         volatile int bar;
10267         volatile foo_t blech;
10268         foo = foo;
10269 }
10270 EOCP
10271 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10272         val="$define"
10273         echo "Yup, it does."
10274 else
10275         val="$undef"
10276         echo "Nope, it doesn't."
10277 fi
10278 set d_volatile
10279 eval $setvar
10280 $rm -f try.*
10281
10282
10283 echo " "
10284 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10285
10286 case "$use64bitint:$d_quad:$quadtype" in
10287 define:define:?*)
10288         ivtype="$quadtype"
10289         uvtype="$uquadtype"
10290         ivsize=8
10291         uvsize=8
10292         ;;
10293 *)      ivtype="long"
10294         uvtype="unsigned long"
10295         ivsize=$longsize
10296         uvsize=$longsize
10297         ;;
10298 esac
10299
10300 case "$uselongdouble:$d_longdbl" in
10301 define:define)
10302         nvtype="long double"
10303         nvsize=$longdblsize
10304         ;;
10305 *)      nvtype=double
10306         nvsize=$doublesize
10307         ;;
10308 esac
10309
10310 $echo "(IV will be "$ivtype", $ivsize bytes)"
10311 $echo "(UV will be "$uvtype", $uvsize bytes)"
10312 $echo "(NV will be "$nvtype", $nvsize bytes)"
10313
10314 $cat >try.c <<EOCP
10315 #$i_inttypes I_INTTYPES
10316 #ifdef I_INTTYPES
10317 #include <inttypes.h>
10318 #endif
10319 #include <stdio.h>
10320 int main() {
10321 #ifdef INT8
10322    int8_t i =  INT8_MAX;
10323   uint8_t u = UINT8_MAX;
10324   printf("int8_t\n");
10325 #endif
10326 #ifdef INT16
10327    int16_t i =  INT16_MAX;
10328   uint16_t i = UINT16_MAX;
10329   printf("int16_t\n");
10330 #endif
10331 #ifdef INT32
10332    int32_t i =  INT32_MAX;
10333   uint32_t u = UINT32_MAX;
10334   printf("int32_t\n");
10335 #endif
10336 }
10337 EOCP
10338
10339 case "$i8type" in
10340 '')     case "$charsize" in
10341         1)      i8type=char
10342                 u8type="unsigned char"
10343                 i8size=$charsize
10344                 u8size=$charsize
10345                 ;;
10346         esac
10347         ;;
10348 esac
10349 case "$i8type" in
10350 '')     set try -DINT8
10351         if eval $compile; then
10352                 case "`./try$exe_ext`" in
10353                 int8_t) i8type=int8_t
10354                         u8type=uint8_t
10355                         i8size=1
10356                         u8size=1
10357                         ;;
10358                 esac
10359         fi
10360         ;;
10361 esac
10362 case "$i8type" in
10363 '')     if $test $charsize -ge 1; then
10364                 i8type=char
10365                 u8type="unsigned char"
10366                 i8size=$charsize
10367                 u8size=$charsize
10368         fi
10369         ;;
10370 esac
10371
10372 case "$i16type" in
10373 '')     case "$shortsize" in
10374         2)      i16type=short
10375                 u16type="unsigned short"
10376                 i16size=$shortsize
10377                 u16size=$shortsize
10378                 ;;
10379         esac
10380         ;;
10381 esac
10382 case "$i16type" in
10383 '')     set try -DINT16
10384         if eval $compile; then
10385                 case "`./try$exe_ext`" in
10386                 int16_t)
10387                         i16type=int16_t
10388                         u16type=uint16_t
10389                         i16size=2
10390                         u16size=2
10391                         ;;
10392                 esac
10393         fi
10394         ;;
10395 esac
10396 case "$i16type" in
10397 '')     if $test $shortsize -ge 2; then
10398                 i16type=short
10399                 u16type="unsigned short"
10400                 i16size=$shortsize
10401                 u16size=$shortsize
10402         fi
10403         ;;
10404 esac
10405
10406 case "$i32type" in
10407 '')     case "$longsize" in
10408         4)      i32type=long
10409                 u32type="unsigned long"
10410                 i32size=$longsize
10411                 u32size=$longsize
10412                 ;;
10413         *)      case "$intsize" in
10414                 4)      i32type=int
10415                         u32type="unsigned int"
10416                         i32size=$intsize
10417                         u32size=$intsize
10418                         ;;
10419                 esac
10420                 ;;
10421         esac
10422         ;;
10423 esac
10424 case "$i32type" in
10425 '')     set try -DINT32
10426         if eval $compile; then
10427                 case "`./try$exe_ext`" in
10428                 int32_t)
10429                         i32type=int32_t
10430                         u32type=uint32_t
10431                         i32size=4
10432                         u32size=4
10433                         ;;
10434                 esac
10435         fi
10436         ;;
10437 esac
10438 case "$i32type" in
10439 '')     if $test $intsize -ge 4; then
10440                 i32type=int
10441                 u32type="unsigned int"
10442                 i32size=$intsize
10443                 u32size=$intsize
10444         fi
10445         ;;
10446 esac
10447
10448 case "$i64type" in
10449 '')     case "$d_quad:$quadtype" in
10450         define:?*)
10451                 i64type="$quadtype"
10452                 u64type="$uquadtype"
10453                 i64size=8
10454                 u64size=8
10455                 ;;
10456         esac
10457         ;;
10458 esac
10459
10460 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10461 : volatile so that the compiler has to store it out to memory.
10462 if test X"$d_volatile" = X"$define"; then
10463         volatile=volatile
10464 fi
10465 $cat <<EOP >try.c
10466 #include <stdio.h>
10467 #include <sys/types.h>
10468 #include <signal.h>
10469 #ifdef SIGFPE
10470 $volatile int bletched = 0;
10471 $signal_t blech(s) int s; { bletched = 1; }
10472 #endif
10473 int main() {
10474     $uvtype u = 0;
10475     $nvtype d;
10476     int     n = 8 * $uvsize;
10477     int     i;
10478 #ifdef SIGFPE
10479     signal(SIGFPE, blech);
10480 #endif
10481
10482     for (i = 0; i < n; i++) {
10483       u = u << 1 | ($uvtype)1;
10484       d = ($nvtype)u;
10485       if (($uvtype)d != u)
10486         break;
10487       if (d <= 0)
10488         break;
10489       d = ($nvtype)(u - 1);
10490       if (($uvtype)d != (u - 1))
10491         break;
10492 #ifdef SIGFPE
10493       if (bletched) {
10494         break;
10495 #endif
10496       } 
10497     }
10498     printf("%d\n", ((i == n) ? -n : i));
10499     exit(0);
10500 }
10501 EOP
10502 set try
10503
10504 d_nv_preserves_uv="$undef"
10505 if eval $compile; then
10506         d_nv_preserves_uv_bits="`./try$exe_ext`"
10507 fi
10508 case "$d_nv_preserves_uv_bits" in
10509 \-[1-9]*)       
10510         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10511         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10512         d_nv_preserves_uv="$define"
10513         ;;
10514 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10515         d_nv_preserves_uv="$undef" ;;
10516 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10517         d_nv_preserves_uv_bits="$undef" ;;
10518 esac
10519
10520 $rm -f try.* try
10521
10522
10523 : check for off64_t
10524 echo " "
10525 echo "Checking to see if you have off64_t..." >&4
10526 $cat >try.c <<EOCP
10527 #include <sys/types.h>
10528 #include <unistd.h>
10529 int main() { off64_t x = 7; }
10530 EOCP
10531 set try
10532 if eval $compile; then
10533         val="$define"
10534         echo "You have off64_t."
10535 else
10536         val="$undef"
10537         echo "You do not have off64_t."
10538         case "$lseeksize" in
10539         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10540         esac
10541 fi
10542 $rm -f try.* try
10543 set d_off64_t
10544 eval $setvar
10545
10546 : see if POSIX threads are available
10547 set pthread.h i_pthread
10548 eval $inhdr
10549
10550
10551
10552
10553 : how to create joinable pthreads
10554 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10555         echo " "
10556         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10557         $cat >try.c <<'EOCP'
10558 #include <pthread.h>
10559 int main() {
10560     int detachstate = JOINABLE;
10561 }
10562 EOCP
10563         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10564         if eval $compile; then
10565                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10566                 val="$undef" # Yes, undef.
10567                 set d_old_pthread_create_joinable
10568                 eval $setvar
10569                 val=""
10570                 set old_pthread_create_joinable
10571                 eval $setvar
10572         else
10573                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10574                 if eval $compile; then
10575                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10576                         val="$define"
10577                         set d_old_pthread_create_joinable
10578                         eval $setvar
10579                         val=PTHREAD_CREATE_UNDETACHED
10580                         set old_pthread_create_joinable
10581                         eval $setvar
10582                 else            
10583                         set try -DJOINABLE=__UNDETACHED
10584                         if eval $compile; then
10585                                 echo "You seem to use __UNDETACHED." >&4
10586                                 val="$define"
10587                                 set d_old_pthread_create_joinable
10588                                 eval $setvar
10589                                 val=__UNDETACHED
10590                                 set old_pthread_create_joinable
10591                                 eval $setvar
10592                         else
10593                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10594                                 val="$define"
10595                                 set d_old_pthread_create_joinable
10596                                 eval $setvar
10597                                 val=0
10598                                 set old_pthread_create_joinable
10599                                 eval $setvar
10600                         fi
10601                 fi
10602         fi
10603         $rm -f try try.*
10604 else
10605     d_old_pthread_create_joinable="$undef"
10606     old_pthread_create_joinable=""
10607 fi
10608
10609 : see if pause exists
10610 set pause d_pause
10611 eval $inlibc
10612
10613 : see if pipe exists
10614 set pipe d_pipe
10615 eval $inlibc
10616
10617 : see if poll exists
10618 set poll d_poll
10619 eval $inlibc
10620
10621
10622 : see whether the various POSIXish _yields exist
10623 $cat >try.c <<EOP
10624 #include <pthread.h>
10625 #include <stdio.h>
10626 int main() {
10627 #ifdef SCHED_YIELD
10628         sched_yield();
10629 #else
10630 #ifdef PTHREAD_YIELD
10631         pthread_yield();
10632 #else
10633 #ifdef PTHREAD_YIELD_NULL
10634         pthread_yield(NULL);
10635 #endif
10636 #endif
10637 #endif
10638 }
10639 EOP
10640 : see if sched_yield exists
10641 set try -DSCHED_YIELD
10642 if eval $compile; then
10643     val="$define"
10644     sched_yield='sched_yield()'
10645 else
10646     val="$undef"
10647 fi
10648 case "$usethreads" in
10649 $define)
10650         case "$val" in
10651         $define) echo 'sched_yield() found.' >&4        ;;
10652         *)       echo 'sched_yield() NOT found.' >&4    ;;
10653         esac
10654 esac
10655 set d_sched_yield
10656 eval $setvar
10657
10658 : see if pthread_yield exists
10659 set try -DPTHREAD_YIELD
10660 if eval $compile; then
10661     val="$define"
10662     case "$sched_yield" in
10663     '') sched_yield='pthread_yield()' ;;
10664     esac
10665 else
10666     set try -DPTHREAD_YIELD_NULL
10667     if eval $compile; then
10668         val="$define"
10669         case "$sched_yield" in
10670         '') sched_yield='pthread_yield(NULL)' ;;
10671         esac
10672     else
10673         val="$undef"
10674     fi
10675 fi
10676 case "$usethreads" in
10677 $define)
10678         case "$val" in
10679         $define) echo 'pthread_yield() found.' >&4      ;;
10680         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10681         esac
10682         ;;
10683 esac
10684 set d_pthread_yield
10685 eval $setvar
10686
10687 case "$sched_yield" in
10688 '') sched_yield=undef ;;
10689 esac
10690
10691 $rm -f try try.*
10692
10693 : see if this is a pwd.h system
10694 set pwd.h i_pwd
10695 eval $inhdr
10696
10697 case "$i_pwd" in
10698 $define)
10699         xxx=`./findhdr pwd.h`
10700         $cppstdin $cppflags $cppminus < $xxx >$$.h
10701
10702         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10703                 val="$define"
10704         else
10705                 val="$undef"
10706         fi
10707         set d_pwquota
10708         eval $setvar
10709
10710         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10711                 val="$define"
10712         else
10713                 val="$undef"
10714         fi
10715         set d_pwage
10716         eval $setvar
10717
10718         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10719                 val="$define"
10720         else
10721                 val="$undef"
10722         fi
10723         set d_pwchange
10724         eval $setvar
10725
10726         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10727                 val="$define"
10728         else
10729                 val="$undef"
10730         fi
10731         set d_pwclass
10732         eval $setvar
10733
10734         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10735                 val="$define"
10736         else
10737                 val="$undef"
10738         fi
10739         set d_pwexpire
10740         eval $setvar
10741
10742         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10743                 val="$define"
10744         else
10745                 val="$undef"
10746         fi
10747         set d_pwcomment
10748         eval $setvar
10749
10750         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10751                 val="$define"
10752         else
10753                 val="$undef"
10754         fi
10755         set d_pwgecos
10756         eval $setvar
10757
10758         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10759                 val="$define"
10760         else
10761                 val="$undef"
10762         fi
10763         set d_pwpasswd
10764         eval $setvar
10765
10766         $rm -f $$.h
10767         ;;
10768 *)
10769         val="$undef"; 
10770         set d_pwquota; eval $setvar
10771         set d_pwage; eval $setvar
10772         set d_pwchange; eval $setvar
10773         set d_pwclass; eval $setvar
10774         set d_pwexpire; eval $setvar
10775         set d_pwcomment; eval $setvar
10776         set d_pwgecos; eval $setvar
10777         set d_pwpasswd; eval $setvar
10778         ;;
10779 esac
10780
10781 : see if readdir and friends exist
10782 set readdir d_readdir
10783 eval $inlibc
10784 set seekdir d_seekdir
10785 eval $inlibc
10786 set telldir d_telldir
10787 eval $inlibc
10788 set rewinddir d_rewinddir
10789 eval $inlibc
10790
10791 : see if readlink exists
10792 set readlink d_readlink
10793 eval $inlibc
10794
10795 : see if rename exists
10796 set rename d_rename
10797 eval $inlibc
10798
10799 : see if rmdir exists
10800 set rmdir d_rmdir
10801 eval $inlibc
10802
10803 : see if memory.h is available.
10804 val=''
10805 set memory.h val
10806 eval $inhdr
10807
10808 : See if it conflicts with string.h
10809 case "$val" in
10810 $define)
10811         case "$strings" in
10812         '') ;;
10813         *)
10814                 $cppstdin $cppflags $cppminus < $strings > mem.h
10815                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10816                         echo " "
10817                         echo "We won't be including <memory.h>."
10818                         val="$undef"
10819                 fi
10820                 $rm -f mem.h
10821                 ;;
10822         esac
10823 esac
10824 set i_memory
10825 eval $setvar
10826
10827 : can bcopy handle overlapping blocks?
10828 val="$undef"
10829 case "$d_bcopy" in
10830 "$define")
10831         echo " "
10832         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10833         $cat >try.c <<EOCP
10834 #$i_memory I_MEMORY
10835 #$i_stdlib I_STDLIB
10836 #$i_string I_STRING
10837 #$i_unistd I_UNISTD
10838 EOCP
10839         $cat >>try.c <<'EOCP'
10840 #include <stdio.h>
10841 #ifdef I_MEMORY
10842 #  include <memory.h>
10843 #endif
10844 #ifdef I_STDLIB
10845 #  include <stdlib.h>
10846 #endif
10847 #ifdef I_STRING
10848 #  include <string.h>
10849 #else
10850 #  include <strings.h>
10851 #endif
10852 #ifdef I_UNISTD
10853 #  include <unistd.h>  /* Needed for NetBSD */
10854 #endif
10855 int main()
10856 {
10857 char buf[128], abc[128];
10858 char *b;
10859 int len;
10860 int off;
10861 int align;
10862
10863 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10864
10865 for (align = 7; align >= 0; align--) {
10866         for (len = 36; len; len--) {
10867                 b = buf+align;
10868                 bcopy(abc, b, len);
10869                 for (off = 1; off <= len; off++) {
10870                         bcopy(b, b+off, len);
10871                         bcopy(b+off, b, len);
10872                         if (bcmp(b, abc, len))
10873                                 exit(1);
10874                 }
10875         }
10876 }
10877 exit(0);
10878 }
10879 EOCP
10880         set try
10881         if eval $compile_ok; then
10882                 if ./try 2>/dev/null; then
10883                         echo "Yes, it can."
10884                         val="$define"
10885                 else
10886                         echo "It can't, sorry."
10887                         case "$d_memmove" in
10888                         "$define") echo "But that's Ok since you have memmove()." ;;
10889                         esac
10890                 fi
10891         else
10892                 echo "(I can't compile the test program, so we'll assume not...)"
10893                 case "$d_memmove" in
10894                 "$define") echo "But that's Ok since you have memmove()." ;;
10895                 esac
10896         fi
10897         ;;
10898 esac
10899 $rm -f try.* try core
10900 set d_safebcpy
10901 eval $setvar
10902
10903 : can memcpy handle overlapping blocks?
10904 val="$undef"
10905 case "$d_memcpy" in
10906 "$define")
10907         echo " "
10908         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10909         $cat >try.c <<EOCP
10910 #$i_memory I_MEMORY
10911 #$i_stdlib I_STDLIB
10912 #$i_string I_STRING
10913 #$i_unistd I_UNISTD
10914 EOCP
10915         $cat >>try.c <<'EOCP'
10916 #include <stdio.h>
10917 #ifdef I_MEMORY
10918 #  include <memory.h>
10919 #endif
10920 #ifdef I_STDLIB
10921 #  include <stdlib.h>
10922 #endif
10923 #ifdef I_STRING
10924 #  include <string.h>
10925 #else
10926 #  include <strings.h>
10927 #endif
10928 #ifdef I_UNISTD
10929 #  include <unistd.h>  /* Needed for NetBSD */
10930 #endif
10931 int main()
10932 {
10933 char buf[128], abc[128];
10934 char *b;
10935 int len;
10936 int off;
10937 int align;
10938
10939 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10940    try to store the string in read-only memory. */
10941 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10942
10943 for (align = 7; align >= 0; align--) {
10944         for (len = 36; len; len--) {
10945                 b = buf+align;
10946                 memcpy(b, abc, len);
10947                 for (off = 1; off <= len; off++) {
10948                         memcpy(b+off, b, len);
10949                         memcpy(b, b+off, len);
10950                         if (memcmp(b, abc, len))
10951                                 exit(1);
10952                 }
10953         }
10954 }
10955 exit(0);
10956 }
10957 EOCP
10958         set try
10959         if eval $compile_ok; then
10960                 if ./try 2>/dev/null; then
10961                         echo "Yes, it can."
10962                         val="$define"
10963                 else
10964                         echo "It can't, sorry."
10965                         case "$d_memmove" in
10966                         "$define") echo "But that's Ok since you have memmove()." ;;
10967                         esac
10968                 fi
10969         else
10970                 echo "(I can't compile the test program, so we'll assume not...)"
10971                 case "$d_memmove" in
10972                 "$define") echo "But that's Ok since you have memmove()." ;;
10973                 esac
10974         fi
10975         ;;
10976 esac
10977 $rm -f try.* try core
10978 set d_safemcpy
10979 eval $setvar
10980
10981 : can memcmp be trusted to compare relative magnitude?
10982 val="$undef"
10983 case "$d_memcmp" in
10984 "$define")
10985         echo " "
10986         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10987         $cat >try.c <<EOCP
10988 #$i_memory I_MEMORY
10989 #$i_stdlib I_STDLIB
10990 #$i_string I_STRING
10991 #$i_unistd I_UNISTD
10992 EOCP
10993         $cat >>try.c <<'EOCP'
10994 #include <stdio.h>
10995 #ifdef I_MEMORY
10996 #  include <memory.h>
10997 #endif
10998 #ifdef I_STDLIB
10999 #  include <stdlib.h>
11000 #endif
11001 #ifdef I_STRING
11002 #  include <string.h>
11003 #else
11004 #  include <strings.h>
11005 #endif
11006 #ifdef I_UNISTD
11007 #  include <unistd.h>  /* Needed for NetBSD */
11008 #endif
11009 int main()
11010 {
11011 char a = -1;
11012 char b = 0;
11013 if ((a < b) && memcmp(&a, &b, 1) < 0)
11014         exit(1);
11015 exit(0);
11016 }
11017 EOCP
11018         set try
11019         if eval $compile_ok; then
11020                 if ./try 2>/dev/null; then
11021                         echo "Yes, it can."
11022                         val="$define"
11023                 else
11024                         echo "No, it can't (it uses signed chars)."
11025                 fi
11026         else
11027                 echo "(I can't compile the test program, so we'll assume not...)"
11028         fi
11029         ;;
11030 esac
11031 $rm -f try.* try core
11032 set d_sanemcmp
11033 eval $setvar
11034
11035 : see if prototype for sbrk is available
11036 echo " "
11037 set d_sbrkproto sbrk $i_unistd unistd.h
11038 eval $hasproto
11039
11040 : see if select exists
11041 set select d_select
11042 eval $inlibc
11043
11044 : see if semctl exists
11045 set semctl d_semctl
11046 eval $inlibc
11047
11048 : see if semget exists
11049 set semget d_semget
11050 eval $inlibc
11051
11052 : see if semop exists
11053 set semop d_semop
11054 eval $inlibc
11055
11056 : see how much of the 'sem*(2)' library is present.
11057 h_sem=true
11058 echo " "
11059 case "$d_semctl$d_semget$d_semop" in
11060 *"$undef"*) h_sem=false;;
11061 esac
11062 case "$osname" in
11063 freebsd)
11064     case "`ipcs 2>&1`" in
11065     "SVID messages"*"not configured"*)
11066         echo "Your $osname does not have the sem*(2) configured." >&4
11067         h_sem=false
11068         val="$undef"
11069         set semctl d_semctl
11070         eval $setvar
11071         set semget d_semget
11072         eval $setvar
11073         set semop d_semop
11074         eval $setvar
11075         ;;
11076     esac
11077     ;;
11078 esac
11079 : we could also check for sys/ipc.h ...
11080 if $h_sem && $test `./findhdr sys/sem.h`; then
11081         echo "You have the full sem*(2) library." >&4
11082         val="$define"
11083 else
11084         echo "You don't have the full sem*(2) library." >&4
11085         val="$undef"
11086 fi
11087 set d_sem
11088 eval $setvar
11089
11090 : see whether sys/sem.h defines union semun
11091 echo " "
11092 $cat > try.c <<'END'
11093 #include <sys/types.h>
11094 #include <sys/ipc.h>
11095 #include <sys/sem.h>
11096 int main () { union semun semun; semun.buf = 0; }
11097 END
11098 set try
11099 if eval $compile; then
11100     echo "You have union semun in <sys/sem.h>." >&4
11101     val="$define"
11102 else
11103     echo "You do not have union semun in <sys/sem.h>." >&4
11104     val="$undef"
11105 fi
11106 $rm -f try try.c try.h
11107 set d_union_semun
11108 eval $setvar
11109
11110 : see how to do semctl IPC_STAT
11111 case "$d_sem" in
11112 $define)
11113     : see whether semctl IPC_STAT can use union semun
11114     echo " "
11115     $cat > try.h <<END
11116 #ifndef S_IRUSR
11117 #   ifdef S_IREAD
11118 #       define S_IRUSR S_IREAD
11119 #       define S_IWUSR S_IWRITE
11120 #       define S_IXUSR S_IEXEC
11121 #   else
11122 #       define S_IRUSR 0400
11123 #       define S_IWUSR 0200
11124 #       define S_IXUSR 0100
11125 #   endif
11126 #   define S_IRGRP (S_IRUSR>>3)
11127 #   define S_IWGRP (S_IWUSR>>3)
11128 #   define S_IXGRP (S_IXUSR>>3)
11129 #   define S_IROTH (S_IRUSR>>6)
11130 #   define S_IWOTH (S_IWUSR>>6)
11131 #   define S_IXOTH (S_IXUSR>>6)
11132 #endif
11133 #ifndef S_IRWXU
11134 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11135 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11136 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11137 #endif
11138 END
11139
11140     $cat > try.c <<END
11141 #include <sys/types.h>
11142 #include <sys/ipc.h>
11143 #include <sys/sem.h>
11144 #include <sys/stat.h>
11145 #include <stdio.h>
11146 #include <errno.h>
11147 #include "try.h"
11148 #ifndef errno
11149 extern int errno;
11150 #endif
11151 #$d_union_semun HAS_UNION_SEMUN
11152 int main() {
11153     union semun
11154 #ifndef HAS_UNION_SEMUN
11155     {
11156         int val;
11157         struct semid_ds *buf;
11158         unsigned short *array;
11159     }
11160 #endif
11161     arg;
11162     int sem, st;
11163
11164 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11165     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11166     if (sem > -1) {
11167         struct semid_ds argbuf;
11168         arg.buf = &argbuf;
11169 #       ifdef IPC_STAT
11170         st = semctl(sem, 0, IPC_STAT, arg);
11171         if (st == 0)
11172             printf("semun\n");
11173         else
11174 #       endif /* IPC_STAT */
11175             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11176 #       ifdef IPC_RMID
11177         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11178 #       endif /* IPC_RMID */
11179             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11180     } else
11181 #endif /* IPC_PRIVATE && ... */
11182         printf("semget failed: errno = %d\n", errno);
11183   return 0;
11184 }
11185 END
11186     val="$undef"
11187     set try
11188     if eval $compile; then
11189         xxx=`./try`
11190         case "$xxx" in
11191         semun) val="$define" ;;
11192         esac
11193     fi
11194     $rm -f try try.c
11195     set d_semctl_semun
11196     eval $setvar
11197     case "$d_semctl_semun" in
11198     $define)
11199         echo "You can use union semun for semctl IPC_STAT." >&4
11200         also='also'
11201         ;;
11202     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11203         also=''
11204         ;;
11205     esac
11206
11207     : see whether semctl IPC_STAT can use struct semid_ds pointer
11208     $cat > try.c <<'END'
11209 #include <sys/types.h>
11210 #include <sys/ipc.h>
11211 #include <sys/sem.h>
11212 #include <sys/stat.h>
11213 #include "try.h"
11214 #include <stdio.h>
11215 #include <errno.h>
11216 #ifndef errno
11217 extern int errno;
11218 #endif
11219 int main() {
11220     struct semid_ds arg;
11221     int sem, st;
11222
11223 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11224     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11225     if (sem > -1) {
11226 #       ifdef IPC_STAT
11227         st = semctl(sem, 0, IPC_STAT, &arg);
11228         if (st == 0)
11229             printf("semid_ds\n");
11230         else
11231 #       endif /* IPC_STAT */
11232             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11233 #       ifdef IPC_RMID
11234         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11235 #       endif /* IPC_RMID */
11236             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11237     } else
11238 #endif /* IPC_PRIVATE && ... */
11239         printf("semget failed: errno = %d\n", errno);
11240
11241     return 0;
11242 }
11243 END
11244     val="$undef"
11245     set try
11246     if eval $compile; then
11247         xxx=`./try`
11248         case "$xxx" in
11249         semid_ds) val="$define" ;;
11250         esac
11251     fi
11252     $rm -f try try.c
11253     set d_semctl_semid_ds
11254     eval $setvar
11255     case "$d_semctl_semid_ds" in
11256     $define)
11257         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11258         ;;
11259     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11260         ;;
11261     esac
11262     $rm -f try.h
11263     ;;
11264 *)  val="$undef"
11265
11266     # We do not have the full sem*(2) library, so assume we can not
11267     # use either.
11268
11269     set d_semctl_semun
11270     eval $setvar
11271
11272     set d_semctl_semid_ds
11273     eval $setvar
11274     ;;
11275 esac
11276
11277 : see if setegid exists
11278 set setegid d_setegid
11279 eval $inlibc
11280
11281 : see if seteuid exists
11282 set seteuid d_seteuid
11283 eval $inlibc
11284
11285 : see if setgrent exists
11286 set setgrent d_setgrent
11287 eval $inlibc
11288
11289 : see if sethostent exists
11290 set sethostent d_sethent
11291 eval $inlibc
11292
11293 : see if setlinebuf exists
11294 set setlinebuf d_setlinebuf
11295 eval $inlibc
11296
11297 : see if setlocale exists
11298 set setlocale d_setlocale
11299 eval $inlibc
11300
11301 : see if setnetent exists
11302 set setnetent d_setnent
11303 eval $inlibc
11304
11305 : see if setprotoent exists
11306 set setprotoent d_setpent
11307 eval $inlibc
11308
11309 : see if setpgid exists
11310 set setpgid d_setpgid
11311 eval $inlibc
11312
11313 : see if setpgrp2 exists
11314 set setpgrp2 d_setpgrp2
11315 eval $inlibc
11316
11317 : see if setpriority exists
11318 set setpriority d_setprior
11319 eval $inlibc
11320
11321 : see if setproctitle exists
11322 set setproctitle d_setproctitle
11323 eval $inlibc
11324
11325 : see if setpwent exists
11326 set setpwent d_setpwent
11327 eval $inlibc
11328
11329 : see if setregid exists
11330 set setregid d_setregid
11331 eval $inlibc
11332 set setresgid d_setresgid
11333 eval $inlibc
11334
11335 : see if setreuid exists
11336 set setreuid d_setreuid
11337 eval $inlibc
11338 set setresuid d_setresuid
11339 eval $inlibc
11340
11341 : see if setrgid exists
11342 set setrgid d_setrgid
11343 eval $inlibc
11344
11345 : see if setruid exists
11346 set setruid d_setruid
11347 eval $inlibc
11348
11349 : see if setservent exists
11350 set setservent d_setsent
11351 eval $inlibc
11352
11353 : see if setsid exists
11354 set setsid d_setsid
11355 eval $inlibc
11356
11357 : see if setvbuf exists
11358 set setvbuf d_setvbuf
11359 eval $inlibc
11360
11361 : see if sfio.h is available
11362 set sfio.h i_sfio
11363 eval $inhdr
11364
11365
11366 : see if sfio library is available
11367 case "$i_sfio" in
11368 $define)
11369         val=''
11370         set sfreserve val
11371         eval $inlibc
11372         ;;
11373 *)
11374         val="$undef"
11375         ;;
11376 esac
11377 : Ok, but do we want to use it.
11378 case "$val" in
11379 $define)
11380         case "$usesfio" in
11381         true|$define|[yY]*) dflt='y';;
11382         *) dflt='n';;
11383         esac
11384         echo "$package can use the sfio library, but it is experimental."
11385         case "$useperlio" in
11386         "$undef")
11387             echo "For sfio also the PerlIO abstraction layer is needed."
11388             echo "Earlier you said you wouldn't want that."
11389             ;;
11390         esac
11391         rp="You seem to have sfio available, do you want to try using it?"
11392         . ./myread
11393         case "$ans" in
11394         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11395                 useperlio="$define"
11396                 val="$define"
11397                 ;;
11398         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11399                 val="$undef"
11400                 : Remove sfio from list of libraries to use
11401                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11402                 shift
11403                 libs="$*"
11404                 echo "libs = $libs" >&4
11405                 ;;
11406         esac
11407         ;;
11408 *)      case "$usesfio" in
11409         true|$define|[yY]*)
11410                 echo "Sorry, cannot find sfio on this machine." >&4
11411                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11412                 val="$undef"
11413                 ;;
11414         esac
11415         ;;
11416 esac
11417 set d_sfio
11418 eval $setvar
11419 case "$d_sfio" in
11420 $define) usesfio='true';;
11421 *) usesfio='false';;
11422 esac
11423
11424 : see if shmctl exists
11425 set shmctl d_shmctl
11426 eval $inlibc
11427
11428 : see if shmget exists
11429 set shmget d_shmget
11430 eval $inlibc
11431
11432 : see if shmat exists
11433 set shmat d_shmat
11434 eval $inlibc
11435 : see what shmat returns
11436 case "$d_shmat" in
11437 "$define")
11438         $cat >shmat.c <<'END'
11439 #include <sys/shm.h>
11440 void *shmat();
11441 END
11442         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11443                 shmattype='void *'
11444         else
11445                 shmattype='char *'
11446         fi
11447         echo "and it returns ($shmattype)." >&4
11448         : see if a prototype for shmat is available
11449         xxx=`./findhdr sys/shm.h`
11450         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11451         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11452                 val="$define"
11453         else
11454                 val="$undef"
11455         fi
11456         $rm -f shmat.[co]
11457         ;;
11458 *)
11459         val="$undef"
11460         ;;
11461 esac
11462 set d_shmatprototype
11463 eval $setvar
11464
11465 : see if shmdt exists
11466 set shmdt d_shmdt
11467 eval $inlibc
11468
11469 : see how much of the 'shm*(2)' library is present.
11470 h_shm=true
11471 echo " "
11472 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11473 *"$undef"*) h_shm=false;;
11474 esac
11475 case "$osname" in
11476 freebsd)
11477     case "`ipcs 2>&1`" in
11478     "SVID shared memory"*"not configured"*)
11479         echo "Your $osname does not have the shm*(2) configured." >&4
11480         h_shm=false
11481         val="$undef"
11482         set shmctl d_shmctl
11483         evat $setvar
11484         set shmget d_shmget
11485         evat $setvar
11486         set shmat d_shmat
11487         evat $setvar
11488         set shmdt d_shmdt
11489         evat $setvar
11490         ;;
11491     esac
11492     ;;
11493 esac
11494 : we could also check for sys/ipc.h ...
11495 if $h_shm && $test `./findhdr sys/shm.h`; then
11496         echo "You have the full shm*(2) library." >&4
11497         val="$define"
11498 else
11499         echo "You don't have the full shm*(2) library." >&4
11500         val="$undef"
11501 fi
11502 set d_shm
11503 eval $setvar
11504
11505 echo " "
11506 : see if we have sigaction
11507 if set sigaction val -f d_sigaction; eval $csym; $val; then
11508         echo 'sigaction() found.' >&4
11509         $cat > try.c <<'EOP'
11510 #include <stdio.h>
11511 #include <sys/types.h>
11512 #include <signal.h>
11513 int main()
11514 {
11515     struct sigaction act, oact;
11516     act.sa_flags = 0;
11517     oact.sa_handler = 0;
11518     /* so that act and oact are used */
11519     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11520 }
11521 EOP
11522         set try
11523         if eval $compile_ok; then
11524                 val="$define"
11525         else
11526                 echo "But you don't seem to have a useable struct sigaction." >&4
11527                 val="$undef"
11528         fi
11529 else
11530         echo 'sigaction NOT found.' >&4
11531         val="$undef"
11532 fi
11533 set d_sigaction; eval $setvar
11534 $rm -f try try$_o try.c
11535
11536 : see if sigprocmask exists
11537 set sigprocmask d_sigprocmask
11538 eval $inlibc
11539
11540 : see if sigsetjmp exists
11541 echo " "
11542 case "$d_sigsetjmp" in
11543 '')
11544         $cat >try.c <<'EOP'
11545 #include <setjmp.h>
11546 sigjmp_buf env;
11547 int set = 1;
11548 int main()
11549 {
11550         if (sigsetjmp(env,1))
11551                 exit(set);
11552         set = 0;
11553         siglongjmp(env, 1);
11554         exit(1);
11555 }
11556 EOP
11557         set try
11558         if eval $compile; then
11559                 if ./try >/dev/null 2>&1; then
11560                         echo "POSIX sigsetjmp found." >&4
11561                         val="$define"
11562                 else
11563                         $cat >&4 <<EOM
11564 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11565 I'll ignore them.
11566 EOM
11567                         val="$undef"
11568                 fi
11569         else
11570                 echo "sigsetjmp not found." >&4
11571                 val="$undef"
11572         fi
11573         ;;
11574 *) val="$d_sigsetjmp"
11575         case "$d_sigsetjmp" in
11576         $define) echo "POSIX sigsetjmp found." >&4;;
11577         $undef) echo "sigsetjmp not found." >&4;;
11578         esac
11579         ;;
11580 esac
11581 set d_sigsetjmp
11582 eval $setvar
11583 $rm -f try.c try
11584
11585 : see if socks5_init exists
11586 set socks5_init d_socks5_init
11587 eval $inlibc
11588
11589 : see if sys/stat.h is available
11590 set sys/stat.h i_sysstat
11591 eval $inhdr
11592
11593
11594 : see if stat knows about block sizes
11595 echo " "
11596 echo "Checking to see if your struct stat has st_blocks field..." >&4
11597 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11598 eval $hasfield
11599
11600
11601 : see if this is a sys/vfs.h system
11602 set sys/vfs.h i_sysvfs
11603 eval $inhdr
11604
11605
11606 : see if this is a sys/statfs.h system
11607 set sys/statfs.h i_sysstatfs
11608 eval $inhdr
11609
11610
11611 echo " "
11612 echo "Checking to see if your system supports struct statfs..." >&4
11613 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
11614 eval $hasstruct
11615 case "$d_statfs_s" in
11616 "$define")      echo "Yes, it does."   ;;
11617 *)              echo "No, it doesn't." ;;
11618 esac
11619
11620
11621
11622 : see if struct statfs knows about f_flags
11623 case "$d_statfs_s" in
11624 define) 
11625         echo " "
11626         echo "Checking to see if your struct statfs has f_flags field..." >&4
11627         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
11628         eval $hasfield
11629         ;;
11630 *)      val="$undef"
11631         set d_statfs_f_flags
11632         eval $setvar
11633         ;;
11634 esac
11635 case "$d_statfs_f_flags" in
11636 "$define")      echo "Yes, it does."   ;;
11637 *)              echo "No, it doesn't." ;;
11638 esac
11639
11640 : see if _ptr and _cnt from stdio act std
11641 echo " "
11642
11643 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11644         echo "(Looks like you have stdio.h from BSD.)"
11645         case "$stdio_ptr" in
11646         '') stdio_ptr='((fp)->_p)'
11647                 ptr_lval=$define
11648                 ;;
11649         *)      ptr_lval=$d_stdio_ptr_lval;;
11650         esac
11651         case "$stdio_cnt" in
11652         '') stdio_cnt='((fp)->_r)'
11653                 cnt_lval=$define
11654                 ;;
11655         *)      cnt_lval=$d_stdio_cnt_lval;;
11656         esac
11657         case "$stdio_base" in
11658         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11659         esac
11660         case "$stdio_bufsiz" in
11661         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11662         esac
11663 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11664         echo "(Looks like you have stdio.h from Linux.)"
11665         case "$stdio_ptr" in
11666         '') stdio_ptr='((fp)->_IO_read_ptr)'
11667                 ptr_lval=$define
11668                 ;;
11669         *)      ptr_lval=$d_stdio_ptr_lval;;
11670         esac
11671         case "$stdio_cnt" in
11672         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11673                 cnt_lval=$undef
11674                 ;;
11675         *)      cnt_lval=$d_stdio_cnt_lval;;
11676         esac
11677         case "$stdio_base" in
11678         '') stdio_base='((fp)->_IO_read_base)';;
11679         esac
11680         case "$stdio_bufsiz" in
11681         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11682         esac
11683 else
11684         case "$stdio_ptr" in
11685         '') stdio_ptr='((fp)->_ptr)'
11686                 ptr_lval=$define
11687                 ;;
11688         *)      ptr_lval=$d_stdio_ptr_lval;;
11689         esac
11690         case "$stdio_cnt" in
11691         '') stdio_cnt='((fp)->_cnt)'
11692                 cnt_lval=$define
11693                 ;;
11694         *)      cnt_lval=$d_stdio_cnt_lval;;
11695         esac
11696         case "$stdio_base" in
11697         '') stdio_base='((fp)->_base)';;
11698         esac
11699         case "$stdio_bufsiz" in
11700         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11701         esac
11702 fi
11703
11704 : test whether _ptr and _cnt really work
11705 echo "Checking how std your stdio is..." >&4
11706 $cat >try.c <<EOP
11707 #include <stdio.h>
11708 #define FILE_ptr(fp)    $stdio_ptr
11709 #define FILE_cnt(fp)    $stdio_cnt
11710 int main() {
11711         FILE *fp = fopen("try.c", "r");
11712         char c = getc(fp);
11713         if (
11714                 18 <= FILE_cnt(fp) &&
11715                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11716         )
11717                 exit(0);
11718         exit(1);
11719 }
11720 EOP
11721 val="$undef"
11722 set try
11723 if eval $compile; then
11724         if ./try; then
11725                 echo "Your stdio acts pretty std."
11726                 val="$define"
11727         else
11728                 echo "Your stdio isn't very std."
11729         fi
11730 else
11731         echo "Your stdio doesn't appear very std."
11732 fi
11733 $rm -f try.c try
11734 set d_stdstdio
11735 eval $setvar
11736
11737 : Can _ptr be used as an lvalue?
11738 case "$d_stdstdio$ptr_lval" in
11739 $define$define) val=$define ;;
11740 *) val=$undef ;;
11741 esac
11742 set d_stdio_ptr_lval
11743 eval $setvar
11744
11745 : Can _cnt be used as an lvalue?
11746 case "$d_stdstdio$cnt_lval" in
11747 $define$define) val=$define ;;
11748 *) val=$undef ;;
11749 esac
11750 set d_stdio_cnt_lval
11751 eval $setvar
11752
11753
11754 : test whether setting _ptr sets _cnt as a side effect
11755 d_stdio_ptr_lval_sets_cnt="$undef"
11756 d_stdio_ptr_lval_nochange_cnt="$undef"
11757 case "$d_stdio_ptr_lval$d_stdstdio" in
11758 $define$define)
11759         echo "Checking to see what happens if we set the stdio ptr..." >&4
11760 $cat >try.c <<EOP
11761 #include <stdio.h>
11762 /* Can we scream? */
11763 /* Eat dust sed :-) */
11764 /* In the buffer space, no one can hear you scream. */
11765 #define FILE_ptr(fp)    $stdio_ptr
11766 #define FILE_cnt(fp)    $stdio_cnt
11767 #include <sys/types.h>
11768 int main() {
11769         FILE *fp = fopen("try.c", "r");
11770         int c;
11771         char *ptr;
11772         size_t cnt;
11773         if (!fp) {
11774             puts("Fail even to read");
11775             exit(1);
11776         }
11777         c = getc(fp); /* Read away the first # */
11778         if (c == EOF) {
11779             puts("Fail even to read");
11780             exit(1);
11781         }
11782         if (!(
11783                 18 <= FILE_cnt(fp) &&
11784                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11785         )) {
11786                 puts("Fail even to read");
11787                 exit (1);
11788         }
11789         ptr = (char*) FILE_ptr(fp);
11790         cnt = (size_t)FILE_cnt(fp);
11791
11792         FILE_ptr(fp) += 42;
11793
11794         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11795                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11796                 exit (1);
11797         }
11798         if (FILE_cnt(fp) <= 20) {
11799                 printf ("Fail (<20 chars to test)");
11800                 exit (1);
11801         }
11802         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11803                 puts("Fail compare");
11804                 exit (1);
11805         }
11806         if (cnt == FILE_cnt(fp)) {
11807                 puts("Pass_unchanged");
11808                 exit (0);
11809         }       
11810         if (FILE_cnt(fp) == (cnt - 42)) {
11811                 puts("Pass_changed");
11812                 exit (0);
11813         }
11814         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11815         return 1;
11816
11817 }
11818 EOP
11819         set try
11820         if eval $compile; then
11821                 case `./try$exe_ext` in
11822                 Pass_changed)
11823                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11824                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11825                 Pass_unchanged)
11826                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11827                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11828                 Fail*)
11829                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11830                 *)
11831                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11832         esac
11833         else
11834                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11835         fi
11836         $rm -f try.c try
11837         ;;
11838 esac
11839
11840 : see if _base is also standard
11841 val="$undef"
11842 case "$d_stdstdio" in
11843 $define)
11844         $cat >try.c <<EOP
11845 #include <stdio.h>
11846 #define FILE_base(fp)   $stdio_base
11847 #define FILE_bufsiz(fp) $stdio_bufsiz
11848 int main() {
11849         FILE *fp = fopen("try.c", "r");
11850         char c = getc(fp);
11851         if (
11852                 19 <= FILE_bufsiz(fp) &&
11853                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11854         )
11855                 exit(0);
11856         exit(1);
11857 }
11858 EOP
11859         set try
11860         if eval $compile; then
11861                 if ./try; then
11862                         echo "And its _base field acts std."
11863                         val="$define"
11864                 else
11865                         echo "But its _base field isn't std."
11866                 fi
11867         else
11868                 echo "However, it seems to be lacking the _base field."
11869         fi
11870         $rm -f try.c try
11871         ;;
11872 esac
11873 set d_stdiobase
11874 eval $setvar
11875
11876 $cat >&4 <<EOM
11877 Checking how to access stdio streams by file descriptor number...
11878 EOM
11879 case "$stdio_stream_array" in
11880 '')     $cat >try.c <<EOCP
11881 #include <stdio.h>
11882 int main() {
11883   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11884     printf("yes\n");
11885 }
11886 EOCP
11887         for s in _iob __iob __sF
11888         do
11889                 set try -DSTDIO_STREAM_ARRAY=$s
11890                 if eval $compile; then
11891                         case "`./try$exe_ext`" in
11892                         yes)    stdio_stream_array=$s; break ;;
11893                         esac
11894                 fi
11895         done
11896         $rm -f try.* try$exe_ext
11897 esac
11898 case "$stdio_stream_array" in
11899 '')     $cat >&4 <<EOM
11900 I can't figure out how to access stdio streams by file descriptor number.
11901 EOM
11902         d_stdio_stream_array="$undef"
11903         ;;
11904 *)      $cat >&4 <<EOM
11905 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11906 EOM
11907         d_stdio_stream_array="$define"
11908         ;;
11909 esac
11910
11911 : see if strcoll exists
11912 set strcoll d_strcoll
11913 eval $inlibc
11914
11915 : check for structure copying
11916 echo " "
11917 echo "Checking to see if your C compiler can copy structs..." >&4
11918 $cat >try.c <<'EOCP'
11919 int main()
11920 {
11921         struct blurfl {
11922                 int dyick;
11923         } foo, bar;
11924
11925         foo = bar;
11926 }
11927 EOCP
11928 if $cc -c try.c >/dev/null 2>&1 ; then
11929         val="$define"
11930         echo "Yup, it can."
11931 else
11932         val="$undef"
11933         echo "Nope, it can't."
11934 fi
11935 set d_strctcpy
11936 eval $setvar
11937 $rm -f try.*
11938
11939 : see if strerror and/or sys_errlist[] exist
11940 echo " "
11941 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11942     if set strerror val -f d_strerror; eval $csym; $val; then
11943                 echo 'strerror() found.' >&4
11944                 d_strerror="$define"
11945                 d_strerrm='strerror(e)'
11946                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11947                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11948                         d_syserrlst="$define"
11949                 else
11950                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11951                         d_syserrlst="$undef"
11952                 fi
11953     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11954                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11955                 echo 'strerror() found in string header.' >&4
11956                 d_strerror="$define"
11957                 d_strerrm='strerror(e)'
11958                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11959                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11960                                 d_syserrlst="$define"
11961                 else
11962                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11963                         d_syserrlst="$undef"
11964                 fi
11965     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11966                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11967                 d_strerror="$undef"
11968                 d_syserrlst="$define"
11969                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11970     else
11971                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11972                 d_strerror="$undef"
11973                 d_syserrlst="$undef"
11974                 d_strerrm='"unknown"'
11975     fi
11976 fi
11977
11978 : see if strtod exists
11979 set strtod d_strtod
11980 eval $inlibc
11981
11982 : see if strtol exists
11983 set strtol d_strtol
11984 eval $inlibc
11985
11986 : see if strtold exists
11987 set strtold d_strtold
11988 eval $inlibc
11989
11990 : see if strtoll exists
11991 set strtoll d_strtoll
11992 eval $inlibc
11993
11994 case "$d_longlong-$d_strtoll" in
11995 "$define-$define")
11996         $cat <<EOM
11997 Checking whether your strtoll() works okay...
11998 EOM
11999         $cat >try.c <<'EOCP'
12000 #include <errno.h>
12001 #ifdef __hpux
12002 #define strtoll __strtoll
12003 #endif
12004 #ifdef __EMX__
12005 #define strtoll _strtoll
12006 #endif
12007 #include <stdio.h>
12008 extern long long int strtoll(char *s, char **, int); 
12009 static int bad = 0;
12010 int check(char *s, long long ell, int een) {
12011         long long gll;
12012         errno = 0;
12013         gll = strtoll(s, 0, 10);
12014         if (!((gll == ell) && (errno == een)))
12015                 bad++;
12016 }
12017 int main() {
12018         check(" 1",                                      1LL, 0);
12019         check(" 0",                                      0LL, 0);
12020         check("-1",                                     -1LL, 0);
12021         check("-9223372036854775808", -9223372036854775808LL, 0);
12022         check("-9223372036854775808", -9223372036854775808LL, 0);
12023         check(" 9223372036854775807",  9223372036854775807LL, 0);
12024         check("-9223372036854775808", -9223372036854775808LL, 0);
12025         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12026         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12027         if (!bad)
12028                 printf("ok\n");
12029 }
12030 EOCP
12031         set try
12032         if eval $compile; then
12033                 yyy=`./try`
12034                 case "$yyy" in
12035                 ok) echo "Your strtoll() seems to be working okay." ;;
12036                 *) cat <<EOM >&4
12037 Your strtoll() doesn't seem to be working okay.
12038 EOM
12039                    d_strtoll="$undef"
12040                    ;;
12041                 esac
12042         else
12043                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12044                 d_strtoll="$undef"
12045         fi
12046         ;;
12047 esac
12048
12049 : see if strtoq exists
12050 set strtoq d_strtoq
12051 eval $inlibc
12052
12053 : see if strtoul exists
12054 set strtoul d_strtoul
12055 eval $inlibc
12056
12057 case "$d_strtoul" in
12058 "$define")
12059         $cat <<EOM
12060 Checking whether your strtoul() works okay...
12061 EOM
12062         $cat >try.c <<'EOCP'
12063 #include <errno.h>
12064 #include <stdio.h>
12065 extern unsigned long int strtoul(char *s, char **, int); 
12066 static int bad = 0;
12067 void check(char *s, unsigned long eul, int een) {
12068         unsigned long gul;
12069         errno = 0;
12070         gul = strtoul(s, 0, 10);
12071         if (!((gul == eul) && (errno == een)))
12072                 bad++;
12073 }
12074 int main() {
12075         check(" 1", 1L, 0);
12076         check(" 0", 0L, 0);
12077 EOCP
12078         case "$longsize" in
12079         8)
12080             $cat >>try.c <<'EOCP'
12081         check("18446744073709551615", 18446744073709551615UL, 0);
12082         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12083 #if 0 /* strtoul() for /^-/ strings is undefined. */
12084         check("-1", 18446744073709551615UL, 0);
12085         check("-18446744073709551614", 2, 0);
12086         check("-18446744073709551615", 1, 0);
12087         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12088         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12089 #endif
12090 EOCP
12091                 ;;
12092         4)
12093                     $cat >>try.c <<'EOCP'
12094         check("4294967295", 4294967295UL, 0);
12095         check("4294967296", 4294967295UL, ERANGE);
12096 #if 0 /* strtoul() for /^-/ strings is undefined. */
12097         check("-1", 4294967295UL, 0);
12098         check("-4294967294", 2, 0);
12099         check("-4294967295", 1, 0);
12100         check("-4294967296", 4294967295UL, ERANGE);
12101         check("-4294967297", 4294967295UL, ERANGE);
12102 #endif
12103 EOCP
12104                 ;;
12105         *)
12106 : Should we write these tests to be more portable by sprintf-ing
12107 : ~0 and then manipulating that char string as input for strtol?
12108                 ;;
12109         esac
12110         $cat >>try.c <<'EOCP'
12111         if (!bad)
12112                 printf("ok\n");
12113         return 0;
12114 }
12115 EOCP
12116         set try
12117         if eval $compile; then
12118                 case "`./try`" in
12119                 ok) echo "Your strtoul() seems to be working okay." ;;
12120                 *) cat <<EOM >&4
12121 Your strtoul() doesn't seem to be working okay.
12122 EOM
12123                    d_strtoul="$undef"
12124                    ;;
12125                 esac
12126         fi
12127         ;;
12128 esac
12129
12130 : see if strtoull exists
12131 set strtoull d_strtoull
12132 eval $inlibc
12133
12134 case "$d_longlong-$d_strtoull" in
12135 "$define-$define")
12136         $cat <<EOM
12137 Checking whether your strtoull() works okay...
12138 EOM
12139         $cat >try.c <<'EOCP'
12140 #include <errno.h>
12141 #ifdef __hpux
12142 #define strtoull __strtoull
12143 #endif
12144 #include <stdio.h>
12145 extern unsigned long long int strtoull(char *s, char **, int); 
12146 static int bad = 0;
12147 int check(char *s, long long eull, int een) {
12148         long long gull;
12149         errno = 0;
12150         gull = strtoull(s, 0, 10);
12151         if (!((gull == eull) && (errno == een)))
12152                 bad++;
12153 }
12154 int main() {
12155         check(" 1",                                        1LL, 0);
12156         check(" 0",                                        0LL, 0);
12157         check("18446744073709551615",  18446744073709551615ULL, 0);
12158         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12159 #if 0 /* strtoull() for /^-/ strings is undefined. */
12160         check("-1",                    18446744073709551615ULL, 0);
12161         check("-18446744073709551614",                     2LL, 0);
12162         check("-18446744073709551615",                     1LL, 0);
12163         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12164         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12165 #endif
12166         if (!bad)
12167                 printf("ok\n");
12168 }
12169 EOCP
12170         set try
12171         if eval $compile; then
12172                 case "`./try`" in
12173                 ok) echo "Your strtoull() seems to be working okay." ;;
12174                 *) cat <<EOM >&4
12175 Your strtoull() doesn't seem to be working okay.
12176 EOM
12177                    d_strtoull="$undef"
12178                    ;;
12179                 esac
12180         fi
12181         ;;
12182 esac
12183
12184 : see if strtouq exists
12185 set strtouq d_strtouq
12186 eval $inlibc
12187
12188 case "$d_strtouq" in
12189 "$define")
12190         $cat <<EOM
12191 Checking whether your strtouq() works okay...
12192 EOM
12193         $cat >try.c <<'EOCP'
12194 #include <errno.h>
12195 #include <stdio.h>
12196 extern unsigned long long int strtouq(char *s, char **, int); 
12197 static int bad = 0;
12198 void check(char *s, unsigned long long eull, int een) {
12199         unsigned long long gull;
12200         errno = 0;
12201         gull = strtouq(s, 0, 10);
12202         if (!((gull == eull) && (errno == een)))
12203                 bad++;
12204 }
12205 int main() {
12206         check(" 1",                                        1LL, 0);
12207         check(" 0",                                        0LL, 0);
12208         check("18446744073709551615",  18446744073709551615ULL, 0);
12209         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12210 #if 0 /* strtouq() for /^-/ strings is undefined. */
12211         check("-1",                    18446744073709551615ULL, 0);
12212         check("-18446744073709551614",                     2LL, 0);
12213         check("-18446744073709551615",                     1LL, 0);
12214         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12215         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12216 #endif
12217         if (!bad)
12218                 printf("ok\n");
12219         return 0;
12220 }
12221 EOCP
12222         set try
12223         if eval $compile; then
12224                 case "`./try`" in
12225                 ok) echo "Your strtouq() seems to be working okay." ;;
12226                 *) cat <<EOM >&4
12227 Your strtouq() doesn't seem to be working okay.
12228 EOM
12229                    d_strtouq="$undef"
12230                    ;;
12231                 esac
12232         fi
12233         ;;
12234 esac
12235
12236 : see if strxfrm exists
12237 set strxfrm d_strxfrm
12238 eval $inlibc
12239
12240 : see if symlink exists
12241 set symlink d_symlink
12242 eval $inlibc
12243
12244 : see if syscall exists
12245 set syscall d_syscall
12246 eval $inlibc
12247
12248 : see if sysconf exists
12249 set sysconf d_sysconf
12250 eval $inlibc
12251
12252 : see if system exists
12253 set system d_system
12254 eval $inlibc
12255
12256 : see if tcgetpgrp exists
12257 set tcgetpgrp d_tcgetpgrp
12258 eval $inlibc
12259
12260 : see if tcsetpgrp exists
12261 set tcsetpgrp d_tcsetpgrp
12262 eval $inlibc
12263
12264 : see if prototype for telldir is available
12265 echo " "
12266 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12267 eval $hasproto
12268
12269 : see if this is a sys/times.h system
12270 set sys/times.h i_systimes
12271 eval $inhdr
12272
12273 : see if times exists
12274 echo " "
12275 if set times val -f d_times; eval $csym; $val; then
12276         echo 'times() found.' >&4
12277         d_times="$define"
12278         inc=''
12279         case "$i_systimes" in
12280         "$define") inc='sys/times.h';;
12281         esac
12282         rp="What is the type returned by times() on this system?"
12283         set clock_t clocktype long stdio.h sys/types.h $inc
12284         eval $typedef_ask
12285 else
12286         echo 'times() NOT found, hope that will do.' >&4
12287         d_times="$undef"
12288         clocktype='int'
12289 fi
12290
12291 : see if truncate exists
12292 set truncate d_truncate
12293 eval $inlibc
12294
12295 : see if tzname[] exists
12296 echo " "
12297 if set tzname val -a d_tzname; eval $csym; $val; then
12298         val="$define"
12299         echo 'tzname[] found.' >&4
12300 else
12301         val="$undef"
12302         echo 'tzname[] NOT found.' >&4
12303 fi
12304 set d_tzname
12305 eval $setvar
12306
12307 : see if umask exists
12308 set umask d_umask
12309 eval $inlibc
12310
12311 : see if ustat exists
12312 set ustat d_ustat
12313 eval $inlibc
12314
12315 : backward compatibility for d_hvfork
12316 if test X$d_hvfork != X; then
12317         d_vfork="$d_hvfork"
12318         d_hvfork=''
12319 fi
12320 : see if there is a vfork
12321 val=''
12322 set vfork val
12323 eval $inlibc
12324
12325 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12326 : perl on Solaris 2.x, and probably elsewhere.
12327 case "$val" in
12328 $define)
12329         echo " "
12330         case "$usevfork" in
12331         false) dflt='n';;
12332         *) dflt='y';;
12333         esac
12334         cat <<'EOM'
12335  
12336 Perl can only use a vfork() that doesn't suffer from strict
12337 restrictions on calling functions or modifying global data in
12338 the child.  For example, glibc-2.1 contains such a vfork()
12339 that is unsuitable.  If your system provides a proper fork()
12340 call, chances are that you do NOT want perl to use vfork().
12341
12342 EOM
12343         rp="Do you still want to use vfork()?"
12344         . ./myread
12345         case "$ans" in
12346         y|Y) ;;
12347         *)
12348                 echo "Ok, we won't use vfork()."
12349                 val="$undef"
12350                 ;;
12351         esac
12352         ;;
12353 esac
12354 set d_vfork
12355 eval $setvar
12356 case "$d_vfork" in
12357 $define) usevfork='true';;
12358 *) usevfork='false';;
12359 esac
12360
12361 : see if this is an sysdir system
12362 set sys/dir.h i_sysdir
12363 eval $inhdr
12364
12365 : see if this is an sysndir system
12366 set sys/ndir.h i_sysndir
12367 eval $inhdr
12368
12369 : see if closedir exists
12370 set closedir d_closedir
12371 eval $inlibc
12372
12373 case "$d_closedir" in
12374 "$define")
12375         echo " "
12376         echo "Checking whether closedir() returns a status..." >&4
12377         cat > closedir.c <<EOM
12378 #$i_dirent I_DIRENT             /**/
12379 #$i_sysdir I_SYS_DIR            /**/
12380 #$i_sysndir I_SYS_NDIR          /**/
12381 #$i_systypes I_SYS_TYPES        /**/
12382
12383 #if defined(I_SYS_TYPES)
12384 #include <sys/types.h>
12385 #endif
12386 #if defined(I_DIRENT)
12387 #include <dirent.h>
12388 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12389 #include <sys/dir.h>
12390 #endif
12391 #else
12392 #ifdef I_SYS_NDIR
12393 #include <sys/ndir.h>
12394 #else
12395 #ifdef I_SYS_DIR
12396 #ifdef hp9000s500
12397 #include <ndir.h>       /* may be wrong in the future */
12398 #else
12399 #include <sys/dir.h>
12400 #endif
12401 #endif
12402 #endif
12403 #endif 
12404 int main() { return closedir(opendir(".")); }
12405 EOM
12406         set closedir
12407         if eval $compile_ok; then
12408                 if ./closedir > /dev/null 2>&1 ; then
12409                         echo "Yes, it does."
12410                         val="$undef"
12411                 else
12412                         echo "No, it doesn't."
12413                         val="$define"
12414                 fi
12415         else
12416                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12417                 val="$define"
12418         fi
12419         ;;
12420 *)
12421         val="$undef";
12422         ;;
12423 esac
12424 set d_void_closedir
12425 eval $setvar
12426 $rm -f closedir*
12427 : see if there is a wait4
12428 set wait4 d_wait4
12429 eval $inlibc
12430
12431 : see if waitpid exists
12432 set waitpid d_waitpid
12433 eval $inlibc
12434
12435 : see if wcstombs exists
12436 set wcstombs d_wcstombs
12437 eval $inlibc
12438
12439 : see if wctomb exists
12440 set wctomb d_wctomb
12441 eval $inlibc
12442
12443 : preserve RCS keywords in files with variable substitution, grrr
12444 Date='$Date'
12445 Id='$Id'
12446 Log='$Log'
12447 RCSfile='$RCSfile'
12448 Revision='$Revision'
12449
12450 case "$crosscompile" in
12451 ''|[nN]*) crosscompile="$undef" ;;
12452 esac
12453
12454 case "$osname" in
12455 next|rhapsody|darwin) multiarch="$define" ;;
12456 esac
12457 case "$multiarch" in
12458 ''|[nN]*) multiarch="$undef" ;;
12459 esac
12460
12461 : check for alignment requirements
12462 echo " "
12463 case "$crosscompile$multiarch" in
12464 *$define*)
12465         $cat <<EOM
12466 You seem to be either cross-compiling or doing a multiarchitecture build,
12467 skipping the memory alignment check.
12468
12469 EOM
12470         case "$alignbytes" in
12471         '') alignbytes=8 ;;
12472         esac
12473         ;;
12474 *)
12475         case "$alignbytes" in
12476         '') echo "Checking alignment constraints..." >&4
12477                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12478                         $cat >try.c <<'EOCP'
12479 typedef long double NV;
12480 EOCP
12481                 else
12482                         $cat >try.c <<'EOCP'
12483 typedef double NV;
12484 EOCP
12485                 fi
12486                 $cat >>try.c <<'EOCP'
12487 #include <stdio.h>
12488 struct foobar {
12489         char foo;
12490         NV bar;
12491 } try_algn;
12492 int main()
12493 {
12494     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12495     return(0);
12496 }
12497 EOCP
12498                 set try
12499                 if eval $compile_ok; then
12500                         dflt=`./try`
12501                 else
12502                         dflt='8'
12503                         echo "(I can't seem to compile the test program...)"
12504                 fi
12505                 ;;
12506         *) dflt="$alignbytes"
12507                 ;;
12508         esac
12509         rp="Doubles must be aligned on a how-many-byte boundary?"
12510         . ./myread
12511         alignbytes="$ans"
12512         $rm -f try.c try
12513         ;;
12514 esac
12515
12516
12517 : set the base revision
12518 baserev=5.0
12519
12520 : check for ordering of bytes in a long
12521 echo " "
12522 case "$crosscompile$multiarch" in
12523 *$define*)
12524         $cat <<EOM
12525 You seem to be either cross-compiling or doing a multiarchitecture build,
12526 skipping the byteorder check.
12527
12528 EOM
12529         byteorder='0xffff'
12530         ;;
12531 *)
12532         case "$byteorder" in
12533         '')
12534                 $cat <<'EOM'
12535 In the following, larger digits indicate more significance.  A big-endian
12536 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12537 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12538 machines may have weird orders like 3412.  A Cray will report 87654321,
12539 an Alpha will report 12345678. If the test program works the default is
12540 probably right.
12541 I'm now running the test program...
12542 EOM
12543                 $cat >try.c <<'EOCP'
12544 #include <stdio.h>
12545 int main()
12546 {
12547         int i;
12548         union {
12549                 unsigned long l;
12550                 char c[sizeof(long)];
12551         } u;
12552
12553         if (sizeof(long) > 4)
12554                 u.l = (0x08070605L << 32) | 0x04030201L;
12555         else
12556                 u.l = 0x04030201L;
12557         for (i = 0; i < sizeof(long); i++)
12558                 printf("%c", u.c[i]+'0');
12559         printf("\n");
12560         exit(0);
12561 }
12562 EOCP
12563                 xxx_prompt=y
12564                 set try
12565                 if eval $compile && ./try > /dev/null; then
12566                         dflt=`./try`
12567                         case "$dflt" in
12568                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12569                                 echo "(The test program ran ok.)"
12570                                 echo "byteorder=$dflt"
12571                                 xxx_prompt=n
12572                         ;;
12573                         ????|????????) echo "(The test program ran ok.)" ;;
12574                         *) echo "(The test program didn't run right for some reason.)" ;;
12575                         esac
12576                 else
12577                         dflt='4321'
12578                         cat <<'EOM'
12579 (I can't seem to compile the test program.  Guessing big-endian...)
12580 EOM
12581                 fi
12582                 case "$xxx_prompt" in
12583                 y)
12584                         rp="What is the order of bytes in a long?"
12585                         . ./myread
12586                         byteorder="$ans"
12587                         ;;
12588                 *)      byteorder=$dflt
12589                         ;;
12590                 esac
12591                 ;;
12592         esac
12593         $rm -f try.c try
12594         ;;
12595 esac
12596
12597
12598 : how do we catenate cpp tokens here?
12599 echo " "
12600 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12601 $cat >cpp_stuff.c <<'EOCP'
12602 #define RCAT(a,b)a/**/b
12603 #define ACAT(a,b)a ## b
12604 RCAT(Rei,ser)
12605 ACAT(Cir,cus)
12606 EOCP
12607 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12608 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12609         echo "Oh!  Smells like ANSI's been here." >&4
12610         echo "We can catify or stringify, separately or together!"
12611         cpp_stuff=42
12612 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12613         echo "Ah, yes!  The good old days!" >&4
12614         echo "However, in the good old days we don't know how to stringify and"
12615         echo "catify at the same time."
12616         cpp_stuff=1
12617 else
12618         $cat >&4 <<EOM
12619 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12620 to have to edit the values of CAT[2-5] in config.h...
12621 EOM
12622         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12623 fi
12624 $rm -f cpp_stuff.*
12625
12626 : see if this is a db.h system
12627 set db.h i_db
12628 eval $inhdr
12629
12630 case "$i_db" in
12631 $define)
12632         : Check db version.
12633         echo " "
12634         echo "Checking Berkeley DB version ..." >&4
12635         $cat >try.c <<EOCP
12636 #$d_const HASCONST
12637 #ifndef HASCONST
12638 #define const
12639 #endif
12640 #include <sys/types.h>
12641 #include <stdio.h>
12642 #include <db.h>
12643 int main()
12644 {
12645 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12646     int Major, Minor, Patch ;
12647     unsigned long Version ;
12648     (void)db_version(&Major, &Minor, &Patch) ;
12649     printf("You have Berkeley DB Version 2 or greater\n");
12650
12651     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12652                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12653     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12654                 Major, Minor, Patch) ;
12655
12656     /* check that db.h & libdb are compatible */
12657     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12658         printf("db.h and libdb are incompatible\n") ;
12659         exit(3);        
12660     }
12661
12662     printf("db.h and libdb are compatible\n") ;
12663
12664     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12665                 + DB_VERSION_PATCH ;
12666
12667     /* needs to be >= 2.3.4 */
12668     if (Version < 2003004) {
12669     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12670         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12671         exit(2);        
12672     }
12673
12674     exit(0);
12675 #else
12676 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12677     printf("You have Berkeley DB Version 1\n");
12678     exit(0);    /* DB version < 2: the coast is clear. */
12679 #else
12680     exit(1);    /* <db.h> not Berkeley DB? */
12681 #endif
12682 #endif
12683 }
12684 EOCP
12685         set try
12686         if eval $compile_ok && ./try; then
12687                 echo 'Looks OK.' >&4
12688         else
12689                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12690                 i_db=$undef
12691                 case " $libs " in
12692                 *"-ldb "*)
12693                         : Remove db from list of libraries to use
12694                         echo "Removing unusable -ldb from library list" >&4
12695                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12696                         shift
12697                         libs="$*"
12698                         echo "libs = $libs" >&4
12699                         ;;
12700                 esac
12701         fi
12702         $rm -f try.*
12703         ;;
12704 esac
12705
12706 case "$i_db" in
12707 define)
12708         : Check the return type needed for hash 
12709         echo " "
12710         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12711         $cat >try.c <<EOCP
12712 #$d_const HASCONST
12713 #ifndef HASCONST
12714 #define const
12715 #endif
12716 #include <sys/types.h>
12717 #include <db.h>
12718
12719 #ifndef DB_VERSION_MAJOR
12720 u_int32_t hash_cb (ptr, size)
12721 const void *ptr;
12722 size_t size;
12723 {
12724 }
12725 HASHINFO info;
12726 int main()
12727 {
12728         info.hash = hash_cb;
12729 }
12730 #endif
12731 EOCP
12732         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12733                 if $contains warning try.out >>/dev/null 2>&1 ; then
12734                         db_hashtype='int'
12735                 else
12736                         db_hashtype='u_int32_t'
12737                 fi
12738         else
12739                 : XXX Maybe we should just give up here.
12740                 db_hashtype=u_int32_t
12741                 $cat try.out >&4
12742                 echo "Help:  I can't seem to compile the db test program." >&4
12743                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12744         fi
12745         $rm -f try.*
12746         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12747         ;;
12748 *)      db_hashtype=u_int32_t
12749         ;;
12750 esac
12751 case "$i_db" in
12752 define)
12753         : Check the return type needed for prefix 
12754         echo " "
12755         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12756         cat >try.c <<EOCP
12757 #$d_const HASCONST
12758 #ifndef HASCONST
12759 #define const
12760 #endif
12761 #include <sys/types.h>
12762 #include <db.h>
12763
12764 #ifndef DB_VERSION_MAJOR
12765 size_t prefix_cb (key1, key2)
12766 const DBT *key1;
12767 const DBT *key2;
12768 {
12769 }
12770 BTREEINFO info;
12771 int main()
12772 {
12773         info.prefix = prefix_cb;
12774 }
12775 #endif
12776 EOCP
12777         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12778                 if $contains warning try.out >>/dev/null 2>&1 ; then
12779                         db_prefixtype='int'
12780                 else
12781                         db_prefixtype='size_t'
12782                 fi
12783         else
12784                 db_prefixtype='size_t'
12785                 : XXX Maybe we should just give up here.
12786                 $cat try.out >&4
12787                 echo "Help:  I can't seem to compile the db test program." >&4
12788                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12789         fi
12790         $rm -f try.*
12791         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12792         ;;
12793 *)      db_prefixtype='size_t'
12794         ;;
12795 esac
12796
12797 : check for void type
12798 echo " "
12799 echo "Checking to see how well your C compiler groks the void type..." >&4
12800 case "$voidflags" in
12801 '')
12802         $cat >try.c <<'EOCP'
12803 #if TRY & 1
12804 void sub() {
12805 #else
12806 sub() {
12807 #endif
12808         extern void moo();      /* function returning void */
12809         void (*goo)();          /* ptr to func returning void */
12810 #if TRY & 8
12811         void *hue;              /* generic ptr */
12812 #endif
12813 #if TRY & 2
12814         void (*foo[10])();
12815 #endif
12816
12817 #if TRY & 4
12818         if(goo == moo) {
12819                 exit(0);
12820         }
12821 #endif
12822         exit(0);
12823 }
12824 int main() { sub(); }
12825 EOCP
12826         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12827                 voidflags=$defvoidused
12828         echo "Good.  It appears to support void to the level $package wants.">&4
12829                 if $contains warning .out >/dev/null 2>&1; then
12830                         echo "However, you might get some warnings that look like this:"
12831                         $cat .out
12832                 fi
12833         else
12834 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12835                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12836                         echo "It supports 1..."
12837                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12838                                 echo "It also supports 2..."
12839                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12840                                         voidflags=7
12841                                         echo "And it supports 4 but not 8 definitely."
12842                                 else
12843                                         echo "It doesn't support 4..."
12844                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12845                                                 voidflags=11
12846                                                 echo "But it supports 8."
12847                                         else
12848                                                 voidflags=3
12849                                                 echo "Neither does it support 8."
12850                                         fi
12851                                 fi
12852                         else
12853                                 echo "It does not support 2..."
12854                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12855                                         voidflags=13
12856                                         echo "But it supports 4 and 8."
12857                                 else
12858                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12859                                                 voidflags=5
12860                                                 echo "And it supports 4 but has not heard about 8."
12861                                         else
12862                                                 echo "However it supports 8 but not 4."
12863                                         fi
12864                                 fi
12865                         fi
12866                 else
12867                         echo "There is no support at all for void."
12868                         voidflags=0
12869                 fi
12870         fi
12871 esac
12872 case "$voidflags" in
12873 "$defvoidused") ;;
12874 *)      $cat >&4 <<'EOM'
12875   Support flag bits are:
12876     1: basic void declarations.
12877     2: arrays of pointers to functions returning void.
12878     4: operations between pointers to and addresses of void functions.
12879     8: generic void pointers.
12880 EOM
12881         dflt="$voidflags";
12882         rp="Your void support flags add up to what?"
12883         . ./myread
12884         voidflags="$ans"
12885         ;;
12886 esac
12887 $rm -f try.* .out
12888
12889
12890 : How can we generate normalized random numbers ?
12891 echo " "
12892 echo "Looking for a random number function..." >&4
12893 case "$randfunc" in
12894 '')
12895         if set drand48 val -f; eval $csym; $val; then
12896                 dflt="drand48"
12897                 echo "Good, found drand48()." >&4
12898         elif set random val -f; eval $csym; $val; then
12899                 dflt="random"
12900                 echo "OK, found random()." >&4
12901         else
12902                 dflt="rand"
12903                 echo "Yick, looks like I have to use rand()." >&4
12904         fi
12905         echo " "
12906         ;;
12907 *)
12908         dflt="$randfunc"
12909         ;;
12910 esac
12911 cont=true
12912
12913 case "$ccflags" in
12914 *-Dmy_rand=*|*-Dmy_srand=*)
12915         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12916         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12917         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12918         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12919         ;;
12920 esac
12921
12922 while $test "$cont"; do
12923         rp="Use which function to generate random numbers?"
12924         . ./myread
12925         if $test "$ans" = "$dflt"; then
12926                 : null
12927         else
12928                 randbits=''
12929         fi
12930         randfunc="$ans"
12931         if set $ans val -f; eval $csym; $val; then
12932                 cont=''
12933         else
12934                 dflt=y
12935                 rp="I cannot find function $ans. Use that name anyway?"
12936                 . ./myread
12937                 dflt=rand
12938                 case "$ans" in
12939                         [yY]*) cont='';;
12940                 esac
12941         fi
12942         case "$cont" in
12943         '')
12944                 case "$randfunc" in
12945                 drand48)
12946                         drand01="drand48()"
12947                         seedfunc="srand48"
12948                         randbits=48
12949                         randseedtype=long
12950                         ;;
12951                 rand|random)
12952                         case "$randbits" in
12953                         '')
12954 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12955                                 $cat >try.c <<EOCP
12956 #$i_unistd I_UNISTD
12957 #$i_stdlib I_STDLIB
12958 #include <stdio.h>
12959 #ifdef I_UNISTD
12960 #  include <unistd.h>
12961 #endif
12962 #ifdef I_STDLIB
12963 #  include <stdlib.h>
12964 #endif
12965 int main()
12966 {
12967         register int i;
12968         register unsigned long tmp;
12969         register unsigned long max = 0L;
12970
12971         for (i = 1000; i; i--) {
12972                 tmp = (unsigned long) $randfunc();
12973                 if (tmp > max) max = tmp;
12974         }
12975         for (i = 0; max; i++)
12976                 max /= 2;
12977         printf("%d\n",i);
12978 }
12979 EOCP
12980                                 set try
12981                                 if eval $compile_ok; then
12982                                         dflt=`try`
12983                                 else
12984                                         dflt='?'
12985                                         echo "(I can't seem to compile the test program...)"
12986                                 fi
12987                                 ;;
12988                         *)
12989                                 dflt="$randbits"
12990                                 ;;
12991                         esac
12992                         rp="How many bits does your $randfunc() function produce?"
12993                         . ./myread
12994                         randbits="$ans"
12995                         $rm -f try.c try
12996                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12997                         seedfunc="s$randfunc"
12998                         randseedtype=unsigned
12999                         ;;
13000                 *)
13001                         dflt="31"
13002                         rp="How many bits does your $randfunc() function produce?"
13003                         . ./myread
13004                         randbits="$ans"
13005                         seedfunc="s$randfunc"
13006                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13007                         if set $seedfunc val -f; eval $csym; $val; then
13008                                 echo "(Using $seedfunc() to seed random generator)"
13009                         else
13010                                 echo "(Warning: no $seedfunc() to seed random generator)"
13011                                 seedfunc=rand
13012                         fi
13013                         randseedtype=unsigned
13014                         ;;
13015                 esac
13016                 ;;
13017         esac
13018 done
13019
13020 echo " "
13021 echo "Determining whether or not we are on an EBCDIC system..." >&4
13022 $cat >tebcdic.c <<'EOM'
13023 int main()
13024 {
13025   if ('M'==0xd4) return 0;
13026   return 1;
13027 }
13028 EOM
13029
13030 val=$undef
13031 set tebcdic
13032 if eval $compile_ok; then
13033         if ./tebcdic; then
13034                 echo "You seem to speak EBCDIC." >&4
13035                 val="$define"
13036         else
13037                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13038         fi
13039 else
13040         echo "I'm unable to compile the test program." >&4
13041         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13042 fi
13043 $rm -f tebcdic.c tebcdic
13044 set ebcdic
13045 eval $setvar
13046
13047 echo " "
13048 $cat >&4 <<EOM
13049 Checking how to flush all pending stdio output...
13050 EOM
13051 # I only know how to find the first 32 possibly open files on SunOS.
13052 # See also hints/sunos_4_1.sh and util.c  --AD
13053 case "$osname" in
13054 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13055 esac
13056 $cat >>try.c <<EOCP
13057 #include <stdio.h>
13058 #$i_unistd I_UNISTD
13059 #ifdef I_UNISTD
13060 # include <unistd.h>
13061 #endif
13062 #$d_sysconf HAS_SYSCONF
13063 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13064 #ifdef HAS_STDIO_STREAM_ARRAY
13065 # define STDIO_STREAM_ARRAY $stdio_stream_array
13066 #endif
13067 int main() {
13068   FILE* p = fopen("try.out", "w");
13069 #ifdef TRY_FPUTC
13070   fputc('x', p);
13071 #else
13072 # ifdef TRY_FPRINTF
13073   fprintf(p, "x");
13074 # endif
13075 #endif
13076 #ifdef TRY_FFLUSH_NULL
13077   fflush(NULL);
13078 #endif
13079 #ifdef TRY_FFLUSH_ALL
13080   {
13081     long open_max = -1;
13082 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13083     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13084 # else
13085 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13086     open_max = sysconf(_SC_OPEN_MAX);
13087 #  else
13088 #   ifdef FOPEN_MAX
13089     open_max = FOPEN_MAX;
13090 #   else
13091 #    ifdef OPEN_MAX
13092     open_max = OPEN_MAX;
13093 #    else
13094 #     ifdef _NFILE
13095     open_max = _NFILE;
13096 #     endif
13097 #    endif
13098 #   endif
13099 #  endif
13100 # endif 
13101 # ifdef HAS_STDIO_STREAM_ARRAY
13102     if (open_max > 0) {
13103       long i;
13104       for (i = 0; i < open_max; i++)
13105             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13106                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13107                 STDIO_STREAM_ARRAY[i]._flag)
13108                 fflush(&STDIO_STREAM_ARRAY[i]);
13109     }   
13110   }
13111 # endif
13112 #endif
13113   _exit(42);
13114 }
13115 EOCP
13116 : first we have to find out how _not_ to flush
13117 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13118     output=''
13119     set try -DTRY_FPUTC
13120     if eval $compile; then
13121             $rm -f try.out
13122             ./try$exe_ext 2>/dev/null
13123             if $test ! -s try.out -a "X$?" = X42; then
13124                 output=-DTRY_FPUTC
13125             fi
13126     fi
13127     case "$output" in
13128     '')
13129             set try -DTRY_FPRINTF
13130             $rm -f try.out
13131             if eval $compile; then
13132                     $rm -f try.out
13133                     ./try$exe_ext 2>/dev/null
13134                     if $test ! -s try.out -a "X$?" = X42; then
13135                         output=-DTRY_FPRINTF
13136                     fi
13137             fi
13138         ;;
13139     esac
13140 fi
13141 : check for fflush NULL behaviour
13142 case "$fflushNULL" in
13143 '')     set try -DTRY_FFLUSH_NULL $output
13144         if eval $compile; then
13145                 $rm -f try.out
13146                 ./try$exe_ext 2>/dev/null
13147                 code="$?"
13148                 if $test -s try.out -a "X$code" = X42; then
13149                         fflushNULL="`$cat try.out`"
13150                 else
13151                         if $test "X$code" != X42; then
13152                                 $cat >&4 <<EOM
13153 (If this test failed, don't worry, we'll try another method shortly.)
13154 EOM
13155                         fi
13156                 fi
13157         fi
13158         $rm -f core try.core core.try.*
13159         case "$fflushNULL" in
13160         x)      $cat >&4 <<EOM
13161 Your fflush(NULL) works okay for output streams.
13162 Let's see if it clobbers input pipes...
13163 EOM
13164 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13165 # bug that improperly flushes the input end of pipes.  So we avoid the
13166 # autoflush on fork/system/exec support for now. :-(
13167 $cat >tryp.c <<EOCP
13168 #include <stdio.h>
13169 int
13170 main(int argc, char **argv)
13171 {
13172     char buf[1024];
13173     int i;
13174     char *bp = buf;
13175     while (1) {
13176         while ((i = getc(stdin)) != -1
13177                && (*bp++ = i) != '\n'
13178                && bp < &buf[1024])
13179         /* DO NOTHING */ ;
13180         *bp = '\0';
13181         fprintf(stdout, "%s", buf);
13182         fflush(NULL);
13183         if (i == -1)
13184             return 0;
13185         bp = buf;
13186     }
13187 }
13188 EOCP
13189                 fflushNULL="$define"
13190                 set tryp
13191                 if eval $compile; then
13192                     $rm -f tryp.out
13193                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13194                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13195                        $cat >&4 <<EOM
13196 fflush(NULL) seems to behave okay with input streams.
13197 EOM
13198                         fflushNULL="$define"
13199                     else
13200                         $cat >&4 <<EOM
13201 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13202 EOM
13203                         fflushNULL="$undef"
13204                     fi
13205                 fi
13206                 $rm -f core tryp.c tryp.core core.tryp.*
13207                 ;;
13208         '')     $cat >&4 <<EOM
13209 Your fflush(NULL) isn't working (contrary to ANSI C).
13210 EOM
13211                 fflushNULL="$undef"
13212                 ;;
13213         *)      $cat >&4 <<EOM
13214 Cannot figure out whether your fflush(NULL) works or not.
13215 I'm assuming it doesn't (contrary to ANSI C).
13216 EOM
13217                 fflushNULL="$undef"
13218                 ;;
13219         esac
13220         ;;
13221 $define|true|[yY]*)
13222         fflushNULL="$define"
13223         ;;
13224 *)
13225         fflushNULL="$undef"
13226         ;;
13227 esac
13228 : check explicit looping only if NULL did not work, and if the pipe
13229 : bug does not show up on an explicit flush too
13230 case "$fflushNULL" in
13231 "$undef")
13232         $cat >tryp.c <<EOCP
13233 #include <stdio.h>
13234 int
13235 main(int argc, char **argv)
13236 {
13237     char buf[1024];
13238     int i;
13239     char *bp = buf;
13240     while (1) {
13241         while ((i = getc(stdin)) != -1
13242                && (*bp++ = i) != '\n'
13243                && bp < &buf[1024])
13244         /* DO NOTHING */ ;
13245         *bp = '\0';
13246         fprintf(stdout, "%s", buf);
13247         fflush(stdin);
13248         if (i == -1)
13249             return 0;
13250         bp = buf;
13251     }
13252 }
13253 EOCP
13254         set tryp
13255         if eval $compile; then
13256             $rm -f tryp.out
13257             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13258             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13259                $cat >&4 <<EOM
13260 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13261 EOM
13262                 : now check for fflushall behaviour
13263                 case "$fflushall" in
13264                 '')     set try -DTRY_FFLUSH_ALL $output
13265                         if eval $compile; then
13266                                 $cat >&4 <<EOM
13267 (Now testing the other method--but note that this also may fail.)
13268 EOM
13269                                 $rm -f try.out
13270                                 ./try$exe_ext 2>/dev/null
13271                                 if $test -s try.out -a "X$?" = X42; then
13272                                         fflushall="`$cat try.out`"
13273                                 fi
13274                         fi
13275                         $rm -f core try.core core.try.*
13276                         case "$fflushall" in
13277                         x)      $cat >&4 <<EOM
13278 Whew. Flushing explicitly all the stdio streams works.
13279 EOM
13280                                 fflushall="$define"
13281                                 ;;
13282                         '')     $cat >&4 <<EOM
13283 Sigh. Flushing explicitly all the stdio streams doesn't work.
13284 EOM
13285                                 fflushall="$undef"
13286                                 ;;
13287                         *)      $cat >&4 <<EOM
13288 Cannot figure out whether flushing stdio streams explicitly works or not.
13289 I'm assuming it doesn't.
13290 EOM
13291                                 fflushall="$undef"
13292                                 ;;
13293                         esac
13294                         ;;
13295                 "$define"|true|[yY]*)
13296                         fflushall="$define"
13297                         ;;
13298                 *)
13299                         fflushall="$undef"
13300                         ;;
13301                 esac
13302             else
13303                 $cat >&4 <<EOM
13304 All is futile.  Even fflush(stdin) clobbers input pipes!
13305 EOM
13306                 fflushall="$undef"
13307             fi
13308         else
13309             fflushall="$undef"
13310         fi
13311         $rm -f core tryp.c tryp.core core.tryp.*
13312         ;;
13313 *)      fflushall="$undef"
13314         ;;
13315 esac
13316
13317 case "$fflushNULL$fflushall" in
13318 undefundef)
13319         $cat <<EOM
13320 OK, I give up.  I cannot figure out how to flush pending stdio output.
13321 We won't be flushing handles at all before fork/exec/popen.
13322 EOM
13323         ;;
13324 esac
13325 $rm -f try.* try$exe_ext
13326
13327 : Store the full pathname to the ar program for use in the C program
13328 : Respect a hint or command line value for full_ar.
13329 case "$full_ar" in
13330 '') full_ar=$ar ;;
13331 esac
13332
13333 : Store the full pathname to the sed program for use in the C program
13334 full_sed=$sed
13335
13336 : see what type gids are declared as in the kernel
13337 echo " "
13338 echo "Looking for the type for group ids returned by getgid()."
13339 set gid_t gidtype xxx stdio.h sys/types.h
13340 eval $typedef
13341 case "$gidtype" in
13342 xxx)
13343         xxx=`./findhdr sys/user.h`
13344         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13345         case $1 in
13346         unsigned) dflt="$1 $2" ;;
13347         *) dflt="$1" ;;
13348         esac
13349         ;;
13350 *) dflt="$gidtype";;
13351 esac
13352 case "$gidtype" in
13353 gid_t) echo "gid_t found." ;;
13354 *)      rp="What is the type for group ids returned by getgid()?"
13355         . ./myread
13356         gidtype="$ans"
13357         ;;
13358 esac
13359
13360 echo " "
13361 case "$gidtype" in
13362 *_t) zzz="$gidtype"     ;;
13363 *)   zzz="gid"          ;;
13364 esac
13365 echo "Checking the size of $zzz..." >&4 
13366 cat > try.c <<EOCP
13367 #include <sys/types.h>
13368 #include <stdio.h>
13369 int main() {
13370     printf("%d\n", (int)sizeof($gidtype));
13371     exit(0);
13372 }
13373 EOCP
13374 set try
13375 if eval $compile_ok; then
13376         yyy=`./try`
13377         case "$yyy" in
13378         '')     gidsize=4
13379                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13380                 ;;
13381         *)      gidsize=$yyy
13382                 echo "Your $zzz is $gidsize bytes long."
13383                 ;;
13384         esac
13385 else
13386         gidsize=4
13387         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13388 fi
13389
13390
13391 echo " "
13392 case "$gidtype" in
13393 *_t) zzz="$gidtype"     ;;
13394 *)   zzz="gid"          ;;
13395 esac
13396 echo "Checking the sign of $zzz..." >&4 
13397 cat > try.c <<EOCP
13398 #include <sys/types.h>
13399 #include <stdio.h>
13400 int main() {
13401         $gidtype foo = -1;
13402         if (foo < 0)
13403                 printf("-1\n");
13404         else
13405                 printf("1\n");
13406 }
13407 EOCP
13408 set try
13409 if eval $compile; then
13410         yyy=`./try`
13411         case "$yyy" in
13412         '')     gidsign=1
13413                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13414                 ;;
13415         *)      gidsign=$yyy
13416                 case "$gidsign" in
13417                  1) echo "Your $zzz is unsigned." ;;
13418                 -1) echo "Your $zzz is signed."   ;;
13419                 esac
13420                 ;;
13421         esac
13422 else
13423         gidsign=1
13424         echo "(I can't compile the test program--guessing unsigned.)" >&4
13425 fi
13426
13427
13428 echo " "
13429
13430 if $test X"$quadtype" != X; then
13431
13432 echo "Checking how to print 64-bit integers..." >&4
13433
13434 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13435         $cat >try.c <<'EOCP'
13436 #include <sys/types.h>
13437 #include <stdio.h>
13438 int main() {
13439   int q = 12345678901;
13440   printf("%ld\n", q);
13441 }
13442 EOCP
13443         set try
13444         if eval $compile; then
13445                 yyy=`./try$exe_ext`
13446                 case "$yyy" in
13447                 12345678901)
13448                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13449                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13450                         echo "We will use %d."
13451                         ;;
13452                 esac
13453         fi
13454 fi
13455
13456 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13457         $cat >try.c <<'EOCP'
13458 #include <sys/types.h>
13459 #include <stdio.h>
13460 int main() {
13461   long q = 12345678901;
13462   printf("%ld\n", q);
13463 }
13464 EOCP
13465         set try
13466         if eval $compile; then
13467                 yyy=`./try$exe_ext`
13468                 case "$yyy" in
13469                 12345678901)
13470                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13471                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13472                         echo "We will use %ld."
13473                         ;;
13474                 esac
13475         fi
13476 fi
13477
13478 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13479         $cat >try.c <<'EOCP'
13480 #include <sys/types.h>
13481 #include <inttypes.h>
13482 #include <stdio.h>
13483 int main() {
13484   int64_t q = 12345678901;
13485   printf("%" PRId64 "\n", q);
13486 }
13487 EOCP
13488         set try
13489         if eval $compile; then
13490                 yyy=`./try$exe_ext`
13491                 case "$yyy" in
13492                 12345678901)
13493                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13494                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13495                         echo "We will use the C9X style."
13496                         ;;
13497                 esac
13498         fi
13499 fi
13500
13501 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13502         $cat >try.c <<'EOCP'
13503 #include <sys/types.h>
13504 #include <stdio.h>
13505 int main() {
13506   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13507   printf("%lld\n", q);
13508 }
13509 EOCP
13510         set try
13511         if eval $compile; then
13512                 yyy=`./try$exe_ext`
13513                 case "$yyy" in
13514                 12345678901)
13515                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13516                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13517                         echo "We will use the %lld style."
13518                         ;;
13519                 esac
13520         fi
13521 fi
13522
13523 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13524         $cat >try.c <<EOCP
13525 #include <sys/types.h>
13526 #include <stdio.h>
13527 int main() {
13528   $quadtype q = 12345678901;
13529   printf("%Ld\n", q);
13530 }
13531 EOCP
13532         set try
13533         if eval $compile; then
13534                 yyy=`./try$exe_ext`
13535                 case "$yyy" in
13536                 12345678901)
13537                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13538                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13539                         echo "We will use %Ld."
13540                         ;;
13541                 esac
13542         fi
13543 fi
13544
13545 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13546         $cat >try.c <<EOCP
13547 #include <sys/types.h>
13548 #include <stdio.h>
13549 int main() {
13550   $quadtype q = 12345678901;
13551   printf("%qd\n", q);
13552 }
13553 EOCP
13554         set try
13555         if eval $compile; then
13556                 yyy=`./try$exe_ext`
13557                 case "$yyy" in
13558                 12345678901)
13559                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13560                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13561                         echo "We will use %qd."
13562                         ;;
13563                 esac
13564         fi
13565 fi
13566
13567 if $test X"$sPRId64" = X; then
13568         echo "Cannot figure out how to print 64-bit integers." >&4
13569 fi
13570
13571 $rm -f try try.*
13572
13573 fi
13574
13575 case "$sPRId64" in
13576 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13577         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13578         ;;
13579 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13580         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13581         ;;
13582 esac
13583
13584
13585 echo " "
13586 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13587
13588 if $test X"$ivsize" = X8; then
13589         ivdformat="$sPRId64"
13590         uvuformat="$sPRIu64"
13591         uvoformat="$sPRIo64"
13592         uvxformat="$sPRIx64"
13593         uvXUformat="$sPRIXU64"
13594 else
13595         if $test X"$ivsize" = X"$longsize"; then
13596                 ivdformat='"ld"'
13597                 uvuformat='"lu"'
13598                 uvoformat='"lo"'
13599                 uvxformat='"lx"'
13600                 uvXUformat='"lX"'
13601         else
13602                 if $test X"$ivsize" = X"$intsize"; then
13603                         ivdformat='"d"'
13604                         uvuformat='"u"'
13605                         uvoformat='"o"'
13606                         uvxformat='"x"'
13607                         uvXUformat='"X"'
13608                 else
13609                         : far out
13610                         if $test X"$ivsize" = X"$shortsize"; then
13611                                 ivdformat='"hd"'
13612                                 uvuformat='"hu"'
13613                                 uvoformat='"ho"'
13614                                 uvxformat='"hx"'
13615                                 uvXUformat='"hX"'
13616                         fi
13617                 fi
13618         fi
13619 fi
13620
13621 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13622         nveformat="$sPRIeldbl"
13623         nvfformat="$sPRIfldbl"
13624         nvgformat="$sPRIgldbl"
13625         nvEUformat="$sPRIEUldbl"
13626         nvFUformat="$sPRIFUldbl"
13627         nvGUformat="$sPRIGUldbl"
13628 else
13629         nveformat='"e"'
13630         nvfformat='"f"'
13631         nvgformat='"g"'
13632         nvEUformat='"E"'
13633         nvFUformat='"F"'
13634         nvGUformat='"G"'
13635 fi
13636
13637 case "$ivdformat" in
13638 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13639     exit 1
13640     ;;
13641 esac
13642
13643
13644 echo " "
13645 $echo "Checking the format string to be used for gids..." >&4
13646
13647 case "$gidsign" in
13648 -1)     if $test X"$gidsize" = X"$ivsize"; then
13649                 gidformat="$ivdformat"
13650         else
13651                 if $test X"$gidsize" = X"$longsize"; then
13652                         gidformat='"ld"'
13653                 else
13654                         if $test X"$gidsize" = X"$intsize"; then
13655                                 gidformat='"d"'
13656                         else
13657                                 if $test X"$gidsize" = X"$shortsize"; then
13658                                         gidformat='"hd"'
13659                                 fi
13660                         fi
13661                 fi
13662         fi
13663         ;;
13664 *)      if $test X"$gidsize" = X"$uvsize"; then
13665                 gidformat="$uvuformat"
13666         else
13667                 if $test X"$gidsize" = X"$longsize"; then
13668                         gidformat='"lu"'
13669                 else
13670                         if $test X"$gidsize" = X"$intsize"; then
13671                                 gidformat='"u"'
13672                         else
13673                                 if $test X"$gidsize" = X"$shortsize"; then
13674                                         gidformat='"hu"'
13675                                 fi
13676                         fi
13677                 fi
13678         fi
13679         ;;
13680 esac
13681
13682 : see if getgroups exists
13683 set getgroups d_getgrps
13684 eval $inlibc
13685
13686 : see if setgroups exists
13687 set setgroups d_setgrps
13688 eval $inlibc
13689
13690
13691 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13692 echo " "
13693 case "$d_getgrps$d_setgrps" in
13694 *define*)
13695         case "$groupstype" in
13696         '') dflt="$gidtype" ;;
13697         *)  dflt="$groupstype" ;;
13698         esac
13699         $cat <<EOM
13700 What type of pointer is the second argument to getgroups() and setgroups()?
13701 Usually this is the same as group ids, $gidtype, but not always.
13702
13703 EOM
13704         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13705         . ./myread
13706         groupstype="$ans"
13707         ;;
13708 *)  groupstype="$gidtype";;
13709 esac
13710
13711 echo " "
13712 echo "Checking if your $make program sets \$(MAKE)..." >&4
13713 case "$make_set_make" in
13714 '')
13715         $sed 's/^X //' > testmake.mak << 'EOF'
13716 Xall:
13717 X       @echo 'maketemp="$(MAKE)"'
13718 EOF
13719         case "`$make -f testmake.mak 2>/dev/null`" in
13720         *maketemp=*) make_set_make='#' ;;
13721         *)      make_set_make="MAKE=$make" ;;
13722         esac
13723         $rm -f testmake.mak
13724         ;;
13725 esac
13726 case "$make_set_make" in
13727 '#') echo "Yup, it does.";;
13728 *) echo "Nope, it doesn't.";;
13729 esac
13730
13731 : see what type is used for mode_t
13732 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13733 set mode_t modetype int stdio.h sys/types.h
13734 eval $typedef_ask
13735
13736 : see if stdarg is available
13737 echo " "
13738 if $test `./findhdr stdarg.h`; then
13739         echo "<stdarg.h> found." >&4
13740         valstd="$define"
13741 else
13742         echo "<stdarg.h> NOT found." >&4
13743         valstd="$undef"
13744 fi
13745
13746 : see if varags is available
13747 echo " "
13748 if $test `./findhdr varargs.h`; then
13749         echo "<varargs.h> found." >&4
13750 else
13751         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13752 fi
13753
13754 : set up the varargs testing programs
13755 $cat > varargs.c <<EOP
13756 #ifdef I_STDARG
13757 #include <stdarg.h>
13758 #endif
13759 #ifdef I_VARARGS
13760 #include <varargs.h>
13761 #endif
13762
13763 #ifdef I_STDARG
13764 int f(char *p, ...)
13765 #else
13766 int f(va_alist)
13767 va_dcl
13768 #endif
13769 {
13770         va_list ap;
13771 #ifndef I_STDARG
13772         char *p;
13773 #endif
13774 #ifdef I_STDARG
13775         va_start(ap,p);
13776 #else
13777         va_start(ap);
13778         p = va_arg(ap, char *);
13779 #endif
13780         va_end(ap);
13781 }
13782 EOP
13783 $cat > varargs <<EOP
13784 $startsh
13785 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13786         echo "true"
13787 else
13788         echo "false"
13789 fi
13790 $rm -f varargs$_o
13791 EOP
13792 chmod +x varargs
13793
13794 : now check which varargs header should be included
13795 echo " "
13796 i_varhdr=''
13797 case "$valstd" in
13798 "$define")
13799         if `./varargs I_STDARG`; then
13800                 val='stdarg.h'
13801         elif `./varargs I_VARARGS`; then
13802                 val='varargs.h'
13803         fi
13804         ;;
13805 *)
13806         if `./varargs I_VARARGS`; then
13807                 val='varargs.h'
13808         fi
13809         ;;
13810 esac
13811 case "$val" in
13812 '')
13813 echo "I could not find the definition for va_dcl... You have problems..." >&4
13814         val="$undef"; set i_stdarg; eval $setvar
13815         val="$undef"; set i_varargs; eval $setvar
13816         ;;
13817 *) 
13818         set i_varhdr
13819         eval $setvar
13820         case "$i_varhdr" in
13821         stdarg.h)
13822                 val="$define"; set i_stdarg; eval $setvar
13823                 val="$undef"; set i_varargs; eval $setvar
13824                 ;;
13825         varargs.h)
13826                 val="$undef"; set i_stdarg; eval $setvar
13827                 val="$define"; set i_varargs; eval $setvar
13828                 ;;
13829         esac
13830         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13831 esac
13832 $rm -f varargs*
13833
13834 : see if we need va_copy
13835 echo " "
13836 case "$i_stdarg" in
13837 "$define")
13838         $cat >try.c <<EOCP
13839 #include <stdarg.h>
13840 #include <stdio.h>
13841 #$i_stdlib I_STDLIB
13842 #ifdef I_STDLIB
13843 #include <stdlib.h>
13844 #endif
13845 #include <signal.h>
13846
13847 int
13848 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13849 {
13850   return vfprintf(f, fmt, *valp);
13851 }
13852  
13853 int    
13854 myvfprintf(FILE *f, const  char *fmt, va_list val)
13855 {
13856   return ivfprintf(f, fmt, &val);
13857 }
13858       
13859 int
13860 myprintf(char *fmt, ...) 
13861 {
13862   va_list val;
13863   va_start(val, fmt);
13864   return myvfprintf(stdout, fmt, val); 
13865 }         
13866
13867 int
13868 main(int ac, char **av)
13869 {
13870   signal(SIGSEGV, exit);
13871
13872   myprintf("%s%cs all right, then\n", "that", '\'');                            
13873   exit(0);      
13874 }
13875 EOCP
13876         set try
13877         if eval $compile && ./try 2>&1 >/dev/null; then
13878                 case "`./try`" in
13879                 "that's all right, then")
13880                         okay=yes
13881                         ;;
13882                 esac
13883         fi
13884         case "$okay" in
13885         yes)    echo "It seems that you don't need va_copy()." >&4
13886                 need_va_copy="$undef"
13887                 ;;
13888         *)      echo "It seems that va_copy() or similar will be needed." >&4
13889                 need_va_copy="$define"
13890                 ;;
13891         esac
13892         $rm -f try.* core core.* *.core *.core.*
13893         ;;
13894 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13895         ;;
13896 esac
13897
13898 : define a fucntion to check prototypes
13899 $cat > protochk <<EOSH
13900 $startsh
13901 cc="$cc"
13902 optimize="$optimize"
13903 ccflags="$ccflags"
13904 prototype="$prototype"
13905 define="$define"
13906 rm=$rm
13907 EOSH
13908
13909 $cat >> protochk <<'EOSH'
13910
13911 $rm -f try.c
13912 foo="$1"
13913 shift
13914 while test $# -ge 2; do
13915         case "$1" in
13916                 $define) echo "#include <$2>" >> try.c ;;
13917                 literal) echo "$2" >> try.c ;;
13918         esac
13919     shift 2
13920 done
13921 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13922 cat >> try.c <<'EOCP'
13923 #ifdef CAN_PROTOTYPE
13924 #define _(args) args
13925 #else
13926 #define _(args) ()
13927 #endif
13928 EOCP
13929 echo "$foo" >> try.c
13930 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13931 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13932 status=$?
13933 $rm -f try.[co]
13934 exit $status
13935 EOSH
13936 chmod +x protochk
13937 $eunicefix protochk
13938
13939 : see what type is used for size_t
13940 rp="What is the type used for the length parameter for string functions?"
13941 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13942 eval $typedef_ask
13943
13944 : check for type of arguments to gethostbyaddr. 
13945 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13946         case "$d_gethbyaddr" in
13947         $define)
13948                 $cat <<EOM
13949
13950 Checking to see what type of arguments are accepted by gethostbyaddr().
13951 EOM
13952                 hdrs="$define sys/types.h
13953                         $d_socket sys/socket.h 
13954                         $i_niin netinet/in.h 
13955                         $i_netdb netdb.h
13956                         $i_unistd unistd.h"
13957                 : The first arg can 'char *' or 'void *'
13958                 : The second arg is some of integral type
13959                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13960                         for yyy in size_t long int; do
13961                                 case "$netdb_host_type" in
13962                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13963                                         if ./protochk "$try" $hdrs; then
13964                                                 echo "Your system accepts $xxx for the first arg."
13965                                                 echo "...and $yyy for the second arg."
13966                                                 netdb_host_type="$xxx"
13967                                                 netdb_hlen_type="$yyy"
13968                                         fi
13969                                         ;;
13970                                 esac
13971                         done
13972                 done
13973                 : In case none of those worked, prompt the user.
13974                 case "$netdb_host_type" in
13975                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13976                         dflt='char *'
13977                         . ./myread
13978                         netdb_host_type=$ans
13979                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13980                         dflt="$sizetype"
13981                         . ./myread
13982                         netdb_hlen_type=$ans
13983                         ;;
13984                 esac
13985                 ;;
13986         *)      : no gethostbyaddr, so pick harmless defaults
13987                 netdb_host_type='char *'
13988                 netdb_hlen_type="$sizetype"
13989                 ;;
13990         esac
13991         # Remove the "const" if needed. -- but then we'll have a 
13992         # prototype clash!
13993         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13994 fi
13995
13996 : check for type of argument to gethostbyname. 
13997 if test "X$netdb_name_type" = X ; then
13998         case "$d_gethbyname" in
13999         $define)
14000                 $cat <<EOM
14001
14002 Checking to see what type of argument is accepted by gethostbyname().
14003 EOM
14004                 hdrs="$define sys/types.h
14005                         $d_socket sys/socket.h 
14006                         $i_niin netinet/in.h 
14007                         $i_netdb netdb.h
14008                         $i_unistd unistd.h"
14009                 for xxx in "const char *" "char *"; do
14010                         case "$netdb_name_type" in
14011                         '')     try="extern struct hostent *gethostbyname($xxx);"
14012                                 if ./protochk "$try" $hdrs; then
14013                                         echo "Your system accepts $xxx."
14014                                         netdb_name_type="$xxx"
14015                                 fi
14016                                 ;;
14017                         esac
14018                 done
14019                 : In case none of those worked, prompt the user.
14020                 case "$netdb_name_type" in
14021                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14022                         dflt='char *'
14023                         . ./myread
14024                         netdb_name_type=$ans
14025                         ;;
14026                 esac
14027                 ;;
14028         *)      : no gethostbyname, so pick harmless default
14029                 netdb_name_type='char *'
14030                 ;;
14031         esac
14032 fi
14033
14034 : check for type of 1st argument to getnetbyaddr. 
14035 if test "X$netdb_net_type" = X ; then
14036         case "$d_getnbyaddr" in
14037         $define)
14038                 $cat <<EOM
14039
14040 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14041 EOM
14042                 hdrs="$define sys/types.h
14043                         $d_socket sys/socket.h 
14044                         $i_niin netinet/in.h 
14045                         $i_netdb netdb.h
14046                         $i_unistd unistd.h"
14047                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14048                         case "$netdb_net_type" in
14049                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14050                                 if ./protochk "$try" $hdrs; then
14051                                         echo "Your system accepts $xxx."
14052                                         netdb_net_type="$xxx"
14053                                 fi
14054                                 ;;
14055                         esac
14056                 done
14057                 : In case none of those worked, prompt the user.
14058                 case "$netdb_net_type" in
14059                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14060                         dflt='long'
14061                         . ./myread
14062                         netdb_net_type=$ans
14063                         ;;
14064                 esac
14065                 ;;
14066         *)      : no getnetbyaddr, so pick harmless default
14067                 netdb_net_type='long'
14068                 ;;
14069         esac
14070 fi
14071 : locate the preferred pager for this system
14072 case "$pager" in
14073 '')
14074         dflt=''
14075         case "$pg" in
14076         /*) dflt=$pg;;
14077         [a-zA-Z]:/*) dflt=$pg;;
14078         esac
14079         case "$more" in
14080         /*) dflt=$more;;
14081         [a-zA-Z]:/*) dflt=$more;;
14082         esac
14083         case "$less" in
14084         /*) dflt=$less;;
14085         [a-zA-Z]:/*) dflt=$less;;
14086         esac
14087         case "$dflt" in
14088         '') dflt=/usr/ucb/more;;
14089         esac
14090         ;;
14091 *) dflt="$pager";;
14092 esac
14093 echo " "
14094 fn=f/
14095 rp='What pager is used on your system?'
14096 . ./getfile
14097 pager="$ans"
14098
14099 : see what type pids are declared as in the kernel
14100 rp="What is the type of process ids on this system?"
14101 set pid_t pidtype int stdio.h sys/types.h
14102 eval $typedef_ask
14103
14104 : Find earliest binary compatible site_perl subdirectory perl can use.
14105 case "$bincompat5005" in
14106 "$define") xs_apiversion='5.005' ;;
14107 *) xs_apiversion=$version ;;   # The current site_perl version.
14108 esac
14109 : Find earliest pure perl site_perl subdirectory perl can use.
14110 : The versioned directories started at 5.005.
14111 pm_apiversion='5.005'
14112
14113 : check for length of pointer
14114 echo " "
14115 case "$ptrsize" in
14116 '')
14117         echo "Checking to see how big your pointers are..." >&4
14118         if test "$voidflags" -gt 7; then
14119                 echo '#define VOID_PTR char *' > try.c
14120         else
14121                 echo '#define VOID_PTR void *' > try.c
14122         fi
14123         $cat >>try.c <<'EOCP'
14124 #include <stdio.h>
14125 int main()
14126 {
14127     printf("%d\n", (int)sizeof(VOID_PTR));
14128     exit(0);
14129 }
14130 EOCP
14131         set try
14132         if eval $compile_ok; then
14133                 ptrsize=`./try`
14134                 echo "Your pointers are $ptrsize bytes long."
14135         else
14136                 dflt='4'
14137                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14138                 rp="What is the size of a pointer (in bytes)?"
14139                 . ./myread
14140                 ptrsize="$ans"
14141         fi
14142         ;;
14143 esac
14144 $rm -f try.c try
14145
14146 : see if ar generates random libraries by itself
14147 echo " "
14148 echo "Checking how to generate random libraries on your machine..." >&4
14149 echo 'int bar1() { return bar2(); }' > bar1.c
14150 echo 'int bar2() { return 2; }' > bar2.c
14151 $cat > foo.c <<'EOP'
14152 int main() { printf("%d\n", bar1()); exit(0); }
14153 EOP
14154 $cc $ccflags -c bar1.c >/dev/null 2>&1
14155 $cc $ccflags -c bar2.c >/dev/null 2>&1
14156 $cc $ccflags -c foo.c >/dev/null 2>&1
14157 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14158 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14159         ./foobar >/dev/null 2>&1; then
14160         echo "$ar appears to generate random libraries itself."
14161         orderlib=false
14162         ranlib=":"
14163 elif $ar ts bar$_a >/dev/null 2>&1 &&
14164         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14165         ./foobar >/dev/null 2>&1; then
14166                 echo "a table of contents needs to be added with '$ar ts'."
14167                 orderlib=false
14168                 ranlib="$ar ts"
14169 else
14170         case "$ranlib" in
14171         :) ranlib='';;
14172         '')
14173                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14174                 $test -f $ranlib || ranlib=''
14175                 ;;
14176         esac
14177         if $test -n "$ranlib"; then
14178                 echo "your system has '$ranlib'; we'll use that."
14179                 orderlib=false
14180         else
14181                 echo "your system doesn't seem to support random libraries"
14182                 echo "so we'll use lorder and tsort to order the libraries."
14183                 orderlib=true
14184                 ranlib=":"
14185         fi
14186 fi
14187 $rm -f foo* bar* 
14188
14189 : check for type of arguments to select. 
14190 case "$selecttype" in
14191 '') case "$d_select" in
14192         $define)
14193                 echo " "
14194                 $cat <<EOM
14195 Checking to see what type of arguments are accepted by select().
14196 EOM
14197                 hdrs="$define sys/types.h
14198                         $i_systime sys/time.h 
14199                         $i_sysselct sys/select.h
14200                         $d_socket sys/socket.h"
14201                 : The first arg can be int, unsigned, or size_t
14202                 : The last arg may or may not be 'const'
14203                 val=''
14204                 : void pointer has been seen but using that
14205                 : breaks the selectminbits test
14206                 for xxx in 'fd_set *' 'int *'; do
14207                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14208                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14209                                         case "$val" in
14210                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14211                                                 if ./protochk "$try" $hdrs; then
14212                                                         echo "Your system accepts $xxx."
14213                                                         val="$xxx"
14214                                                 fi
14215                                                 ;;
14216                                         esac
14217                                 done
14218                         done
14219                 done
14220                 case "$val" in
14221                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14222                         case "$d_fd_set" in
14223                                 $define) dflt="fd_set *" ;;
14224                                 *)              dflt="int *" ;;
14225                         esac
14226                         . ./myread
14227                         val=$ans
14228                         ;;
14229                 esac
14230                 selecttype="$val"
14231                 ;;
14232         *)      : no select, so pick a harmless default
14233                 selecttype='int *'
14234                 ;;
14235         esac
14236         ;;
14237 esac
14238
14239 : check for the select 'width'
14240 case "$selectminbits" in
14241 '') case "$d_select" in
14242         $define)
14243                 $cat <<EOM
14244
14245 Checking to see on how many bits at a time your select() operates...
14246 EOM
14247                 $cat >try.c <<EOCP
14248 #include <sys/types.h>
14249 #$i_time I_TIME
14250 #$i_systime I_SYS_TIME
14251 #$i_systimek I_SYS_TIME_KERNEL
14252 #ifdef I_TIME
14253 #   include <time.h>
14254 #endif
14255 #ifdef I_SYS_TIME
14256 #   ifdef I_SYS_TIME_KERNEL
14257 #       define KERNEL
14258 #   endif
14259 #   include <sys/time.h>
14260 #   ifdef I_SYS_TIME_KERNEL
14261 #       undef KERNEL
14262 #   endif
14263 #endif
14264 #$i_sysselct I_SYS_SELECT
14265 #ifdef I_SYS_SELECT
14266 #include <sys/select.h>
14267 #endif
14268 #$d_socket HAS_SOCKET
14269 #ifdef HAS_SOCKET
14270 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14271 #endif
14272 #include <stdio.h>
14273 $selecttype b;
14274 #define S sizeof(*(b))
14275 #define MINBITS 64
14276 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14277 #define NBITS  (NBYTES * 8)
14278 int main() {
14279     char s[NBYTES];
14280     struct timeval t;
14281     int i;
14282     FILE* fp;
14283     int fd;
14284
14285     fclose(stdin);
14286     fp = fopen("try.c", "r");
14287     if (fp == 0)
14288       exit(1);
14289     fd = fileno(fp);
14290     if (fd < 0)
14291       exit(2);
14292     b = ($selecttype)s;
14293     for (i = 0; i < NBITS; i++)
14294         FD_SET(i, b);
14295     t.tv_sec  = 0;
14296     t.tv_usec = 0;
14297     select(fd + 1, b, 0, 0, &t);
14298     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14299     printf("%d\n", i + 1);
14300     return 0;
14301 }
14302 EOCP
14303                 set try
14304                 if eval $compile_ok; then
14305                         selectminbits=`./try`
14306                         case "$selectminbits" in
14307                         '')     cat >&4 <<EOM
14308 Cannot figure out on how many bits at a time your select() operates.
14309 I'll play safe and guess it is 32 bits.
14310 EOM
14311                                 selectminbits=32
14312                                 bits="32 bits"
14313                                 ;;
14314                         1)      bits="1 bit" ;;
14315                         *)      bits="$selectminbits bits" ;;
14316                         esac
14317                         echo "Your select() operates on $bits at a time." >&4
14318                 else
14319                         rp='What is the minimum number of bits your select() operates on?'
14320                         case "$byteorder" in
14321                         1234|12345678)  dflt=32 ;;
14322                         *)              dflt=1  ;;
14323                         esac
14324                         . ./myread
14325                         val=$ans
14326                         selectminbits="$val"
14327                 fi
14328                 $rm -f try.* try
14329                 ;;
14330         *)      : no select, so pick a harmless default
14331                 selectminbits='32'
14332                 ;;
14333         esac
14334         ;;
14335 esac
14336
14337 : Trace out the files included by signal.h, then look for SIGxxx names.
14338 : Remove SIGARRAYSIZE used by HPUX.
14339 : Remove SIGSTKSIZE used by Linux.
14340 : Remove SIGSTKSZ used by Posix.
14341 : Remove SIGTYP void lines used by OS2.
14342 : Some cpps, like os390, dont give the file name anywhere
14343 if [ "X$fieldn" = X ]; then
14344         : Just make some guesses.  We check them later.
14345         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14346 else
14347         xxx=`echo '#include <signal.h>' |
14348         $cppstdin $cppminus $cppflags 2>/dev/null |
14349         $grep '^[       ]*#.*include' | 
14350         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14351 fi
14352 : Check this list of files to be sure we have parsed the cpp output ok.
14353 : This will also avoid potentially non-existent files, such 
14354 : as ../foo/bar.h
14355 xxxfiles=''
14356 for xx in $xxx /dev/null ; do
14357         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14358 done
14359 : If we have found no files, at least try signal.h
14360 case "$xxxfiles" in
14361 '')     xxxfiles=`./findhdr signal.h` ;;
14362 esac
14363 xxx=`awk '
14364 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14365         print substr($2, 4, 20)
14366 }
14367 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14368         print substr($3, 4, 20)
14369 }' $xxxfiles`
14370 : Append some common names just in case the awk scan failed.
14371 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14372 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14373 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14374 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14375 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14376
14377 : generate a few handy files for later
14378 $cat > signal.c <<'EOCP'
14379 #include <sys/types.h>
14380 #include <signal.h>
14381 #include <stdio.h>
14382 int main() {
14383
14384 /* Strange style to avoid deeply-nested #if/#else/#endif */
14385 #ifndef NSIG
14386 #  ifdef _NSIG
14387 #    define NSIG (_NSIG)
14388 #  endif
14389 #endif
14390
14391 #ifndef NSIG
14392 #  ifdef SIGMAX
14393 #    define NSIG (SIGMAX+1)
14394 #  endif
14395 #endif
14396
14397 #ifndef NSIG
14398 #  ifdef SIG_MAX
14399 #    define NSIG (SIG_MAX+1)
14400 #  endif
14401 #endif
14402
14403 #ifndef NSIG
14404 #  ifdef MAXSIG
14405 #    define NSIG (MAXSIG+1)
14406 #  endif
14407 #endif
14408
14409 #ifndef NSIG
14410 #  ifdef MAX_SIG
14411 #    define NSIG (MAX_SIG+1)
14412 #  endif
14413 #endif
14414
14415 #ifndef NSIG
14416 #  ifdef SIGARRAYSIZE
14417 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14418 #  endif
14419 #endif
14420
14421 #ifndef NSIG
14422 #  ifdef _sys_nsig
14423 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14424 #  endif
14425 #endif
14426
14427 /* Default to some arbitrary number that's big enough to get most
14428    of the common signals.
14429 */
14430 #ifndef NSIG
14431 #    define NSIG 50
14432 #endif
14433
14434 printf("NSIG %d\n", NSIG);
14435
14436 #ifndef JUST_NSIG
14437
14438 EOCP
14439
14440 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14441 {
14442         printf "#ifdef SIG"; printf $1; printf "\n"
14443         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14444         printf $1; printf ");\n"
14445         printf "#endif\n"
14446 }
14447 END {
14448         printf "#endif /* JUST_NSIG */\n";
14449         printf "exit(0);\n}\n";
14450 }
14451 ' >>signal.c
14452 $cat >signal.awk <<'EOP'
14453 BEGIN { ndups = 0 }
14454 $1 ~ /^NSIG$/ { nsig = $2 }
14455 ($1 !~ /^NSIG$/) && (NF == 2) {
14456     if ($2 > maxsig) { maxsig = $2 }
14457     if (sig_name[$2]) {
14458         dup_name[ndups] = $1
14459         dup_num[ndups] = $2
14460         ndups++ 
14461     }
14462     else {
14463         sig_name[$2] = $1
14464         sig_num[$2] = $2
14465     }
14466 }
14467 END { 
14468     if (nsig == 0) {
14469         nsig = maxsig + 1
14470     }
14471     printf("NSIG %d\n", nsig);
14472     for (n = 1; n < nsig; n++) {
14473         if (sig_name[n]) {
14474             printf("%s %d\n", sig_name[n], sig_num[n])
14475         }
14476         else {
14477             printf("NUM%d %d\n", n, n) 
14478         }
14479     }
14480     for (n = 0; n < ndups; n++) {
14481         printf("%s %d\n", dup_name[n], dup_num[n])
14482     }
14483 }
14484 EOP
14485 $cat >signal_cmd <<EOS
14486 $startsh
14487 if $test -s signal.lst; then
14488     echo "Using your existing signal.lst file"
14489         exit 0
14490 fi
14491 xxx="$xxx"
14492 EOS
14493 $cat >>signal_cmd <<'EOS'
14494
14495 set signal
14496 if eval $compile_ok; then
14497         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14498 else
14499         echo "(I can't seem be able to compile the whole test program)" >&4
14500         echo "(I'll try it in little pieces.)" >&4
14501         set signal -DJUST_NSIG
14502         if eval $compile_ok; then
14503                 ./signal$_exe > signal.nsg
14504                 $cat signal.nsg
14505         else
14506                 echo "I can't seem to figure out how many signals you have." >&4
14507                 echo "Guessing 50." >&4
14508                 echo 'NSIG 50' > signal.nsg
14509         fi
14510         : Now look at all the signal names, one at a time.
14511         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14512                 $cat > signal.c <<EOCP
14513 #include <sys/types.h>
14514 #include <signal.h>
14515 #include <stdio.h>
14516 int main() {
14517 printf("$xx %d\n", SIG${xx});
14518 return 0;
14519 }
14520 EOCP
14521                 set signal
14522                 if eval $compile; then
14523                         echo "SIG${xx} found."
14524                         ./signal$_exe  >> signal.ls1
14525                 else
14526                         echo "SIG${xx} NOT found."
14527                 fi
14528         done
14529         if $test -s signal.ls1; then
14530                 $cat signal.nsg signal.ls1 |
14531                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14532         fi
14533
14534 fi
14535 if $test -s signal.lst; then
14536         :
14537 else
14538         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14539         echo 'kill -l' >signal
14540         set X `csh -f <signal`
14541         $rm -f signal
14542         shift
14543         case $# in
14544         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14545         esac
14546         echo $@ | $tr ' ' $trnl | \
14547             $awk '{ printf "%s %d\n", $1, ++s; }
14548                   END { printf "NSIG %d\n", ++s }' >signal.lst
14549 fi
14550 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14551 EOS
14552 chmod a+x signal_cmd
14553 $eunicefix signal_cmd
14554
14555 : generate list of signal names
14556 echo " "
14557 case "$sig_name_init" in
14558 '') doinit=yes ;;
14559 *)  case "$sig_num_init" in
14560     ''|*,*) doinit=yes ;;
14561     esac ;;
14562 esac
14563 case "$doinit" in
14564 yes)
14565         echo "Generating a list of signal names and numbers..." >&4
14566         . ./signal_cmd
14567         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14568         sig_name=`$awk 'BEGIN { printf "ZERO " }
14569                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14570         sig_num=`$awk  'BEGIN { printf "0 " }
14571                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14572         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14573                              !/^NSIG/   { printf "\"%s\", ", $1 }
14574                              END        { printf "0\n" }' signal.lst`
14575         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14576                              !/^NSIG/   { printf "%d, ", $2}
14577                              END        { printf "0\n"}' signal.lst`
14578         ;;
14579 esac
14580 echo "The following $sig_count signals are available:"
14581 echo " "
14582 echo $sig_name | $awk \
14583 'BEGIN { linelen = 0 }
14584 {
14585         for (i = 1; i <= NF; i++) {
14586                 name = "SIG" $i " "
14587                 linelen = linelen + length(name)
14588                 if (linelen > 70) {
14589                         printf "\n"
14590                         linelen = length(name)
14591                 }
14592                 printf "%s", name
14593         }
14594         printf "\n"
14595 }'
14596 sig_size=`echo $sig_name | awk '{print NF}'`
14597 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14598
14599 echo " "
14600 case "$sizetype" in
14601 *_t) zzz="$sizetype"    ;;
14602 *)   zzz="filesize"     ;;
14603 esac
14604 echo "Checking the size of $zzz..." >&4 
14605 cat > try.c <<EOCP
14606 #include <sys/types.h>
14607 #include <stdio.h>
14608 int main() {
14609     printf("%d\n", (int)sizeof($sizetype));
14610     exit(0);
14611 }
14612 EOCP
14613 set try
14614 if eval $compile_ok; then
14615         yyy=`./try`
14616         case "$yyy" in
14617         '')     sizesize=4
14618                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14619                 ;;
14620         *)      sizesize=$yyy
14621                 echo "Your $zzz size is $sizesize bytes."
14622                 ;;
14623         esac
14624 else
14625         sizesize=4
14626         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14627 fi
14628
14629
14630 : check for socklen_t
14631 echo " "
14632 echo "Checking to see if you have socklen_t..." >&4
14633 $cat >try.c <<EOCP
14634 #include <sys/types.h>
14635 #$d_socket HAS_SOCKET
14636 #ifdef HAS_SOCKET
14637 #include <sys/socket.h>
14638 #endif
14639 int main() { socklen_t x = 16; }
14640 EOCP
14641 set try
14642 if eval $compile; then
14643         val="$define"
14644         echo "You have socklen_t."
14645 else
14646         val="$undef"
14647         echo "You do not have socklen_t."
14648         case "$sizetype" in
14649         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14650         esac
14651 fi
14652 $rm -f try try.*
14653 set d_socklen_t
14654 eval $setvar
14655
14656 : see if this is a socks.h system
14657 set socks.h i_socks
14658 eval $inhdr
14659
14660 : check for type of the size argument to socket calls
14661 case "$d_socket" in
14662 "$define")
14663         $cat <<EOM
14664
14665 Checking to see what type is the last argument of accept().
14666 EOM
14667         yyy=''
14668         case "$d_socklen_t" in
14669         "$define") yyy="$yyy socklen_t"
14670         esac
14671         yyy="$yyy $sizetype int long unsigned"
14672         for xxx in $yyy; do
14673                 case "$socksizetype" in
14674                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14675                         case "$usesocks" in
14676                         "$define")
14677                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14678                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14679                                         socksizetype="$xxx"
14680                                 fi
14681                                 ;;
14682                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14683                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14684                                         socksizetype="$xxx"
14685                                 fi
14686                                 ;;
14687                         esac
14688                         ;;
14689                 esac
14690         done
14691 : In case none of those worked, prompt the user.
14692         case "$socksizetype" in
14693         '')     rp='What is the type for socket address structure sizes?'
14694                 dflt='int'
14695                 . ./myread
14696                 socksizetype=$ans
14697                 ;;
14698         esac
14699         ;;
14700 *)      : no sockets, so pick relatively harmless default
14701         socksizetype='int'
14702         ;;
14703 esac
14704
14705 : see what type is used for signed size_t
14706 set ssize_t ssizetype int stdio.h sys/types.h
14707 eval $typedef
14708 dflt="$ssizetype"
14709 $cat > ssize.c <<EOM
14710 #include <stdio.h>
14711 #include <sys/types.h>
14712 #define Size_t $sizetype
14713 #define SSize_t $dflt
14714 int main()
14715 {
14716         if (sizeof(Size_t) == sizeof(SSize_t))
14717                 printf("$dflt\n");
14718         else if (sizeof(Size_t) == sizeof(int))
14719                 printf("int\n");
14720         else 
14721                 printf("long\n");
14722         exit(0);
14723 }
14724 EOM
14725 echo " "
14726 set ssize
14727 if eval $compile_ok && ./ssize > /dev/null; then
14728         ssizetype=`./ssize`
14729         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14730 else
14731         $cat >&4 <<EOM
14732 Help! I can't compile and run the ssize_t test program: please enlighten me!
14733 (This is probably a misconfiguration in your system or libraries, and
14734 you really ought to fix it.  Still, I'll try anyway.)
14735
14736 I need a type that is the same size as $sizetype, but is guaranteed to
14737 be signed.  Common values are ssize_t, int and long.
14738
14739 EOM
14740         rp="What signed type is the same size as $sizetype?"
14741         . ./myread
14742         ssizetype="$ans"
14743 fi
14744 $rm -f ssize ssize.*
14745
14746 : see what type of char stdio uses.
14747 echo " "
14748 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14749 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14750         echo "Your stdio uses unsigned chars." >&4
14751         stdchar="unsigned char"
14752 else
14753         echo "Your stdio uses signed chars." >&4
14754         stdchar="char"
14755 fi
14756 $rm -f stdioh
14757
14758
14759
14760 : see if time exists
14761 echo " "
14762 if test "X$d_time" = X -o X"$timetype" = X; then
14763     if set time val -f d_time; eval $csym; $val; then
14764                 echo 'time() found.' >&4
14765                 val="$define"
14766                 rp="What is the type returned by time() on this system?"
14767                 set time_t timetype long stdio.h sys/types.h
14768                 eval $typedef_ask
14769     else
14770                 echo 'time() not found, hope that will do.' >&4
14771                 val="$undef"
14772                 timetype='int';
14773     fi
14774     set d_time
14775     eval $setvar
14776 fi
14777
14778 : see what type uids are declared as in the kernel
14779 echo " "
14780 echo "Looking for the type for user ids returned by getuid()."
14781 set uid_t uidtype xxx stdio.h sys/types.h
14782 eval $typedef
14783 case "$uidtype" in
14784 xxx)
14785         xxx=`./findhdr sys/user.h`
14786         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14787         case $1 in
14788         unsigned) dflt="$1 $2" ;;
14789         *) dflt="$1" ;;
14790         esac
14791         ;;
14792 *) dflt="$uidtype";;
14793 esac
14794 case "$uidtype" in
14795 uid_t)  echo "uid_t found." ;;
14796 *)      rp="What is the type for user ids returned by getuid()?"
14797         . ./myread
14798         uidtype="$ans"
14799         ;;
14800 esac
14801
14802 echo " "
14803 case "$uidtype" in
14804 *_t) zzz="$uidtype"     ;;
14805 *)   zzz="uid"          ;;
14806 esac
14807 echo "Checking the size of $zzz..." >&4 
14808 cat > try.c <<EOCP
14809 #include <sys/types.h>
14810 #include <stdio.h>
14811 int main() {
14812     printf("%d\n", (int)sizeof($uidtype));
14813     exit(0);
14814 }
14815 EOCP
14816 set try
14817 if eval $compile_ok; then
14818         yyy=`./try`
14819         case "$yyy" in
14820         '')     uidsize=4
14821                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14822                 ;;
14823         *)      uidsize=$yyy
14824                 echo "Your $zzz is $uidsize bytes long."
14825                 ;;
14826         esac
14827 else
14828         uidsize=4
14829         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14830 fi
14831
14832 echo " "
14833 case "$uidtype" in
14834 *_t) zzz="$uidtype"     ;;
14835 *)   zzz="uid"          ;;
14836 esac
14837 echo "Checking the sign of $zzz..." >&4
14838 cat > try.c <<EOCP
14839 #include <sys/types.h>
14840 #include <stdio.h>
14841 int main() {
14842         $uidtype foo = -1;
14843         if (foo < 0)
14844                 printf("-1\n");
14845         else
14846                 printf("1\n");
14847 }
14848 EOCP
14849 set try
14850 if eval $compile; then
14851         yyy=`./try`
14852         case "$yyy" in
14853         '')     uidsign=1
14854                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14855                 ;;
14856         *)      uidsign=$yyy
14857                 case "$uidsign" in
14858                  1) echo "Your $zzz is unsigned." ;;
14859                 -1) echo "Your $zzz is signed."   ;;
14860                 esac
14861                 ;;
14862         esac
14863 else
14864         uidsign=1
14865         echo "(I can't compile the test program--guessing unsigned.)" >&4
14866 fi
14867
14868
14869
14870 echo " "
14871 $echo "Checking the format string to be used for uids..." >&4
14872
14873 case "$uidsign" in
14874 -1)     if $test X"$uidsize" = X"$ivsize"; then
14875                 uidformat="$ivdformat"
14876         else
14877                 if $test X"$uidsize" = X"$longsize"; then
14878                         uidformat='"ld"'
14879                 else
14880                         if $test X"$uidsize" = X"$intsize"; then
14881                                 uidformat='"d"'
14882                         else
14883                                 if $test X"$uidsize" = X"$shortsize"; then
14884                                         uidformat='"hd"'
14885                                 fi
14886                         fi
14887                 fi
14888         fi
14889         ;;
14890 *)      if $test X"$uidsize" = X"$uvsize"; then
14891                 uidformat="$uvuformat"
14892         else
14893                 if $test X"$uidsize" = X"$longsize"; then
14894                         uidformat='"lu"'
14895                 else
14896                         if $test X"$uidsize" = X"$intsize"; then
14897                                 uidformat='"u"'
14898                         else
14899                                 if $test X"$uidsize" = X"$shortsize"; then
14900                                         uidformat='"hu"'
14901                                 fi
14902                         fi
14903                 fi
14904         fi
14905         ;;
14906 esac
14907
14908 : see if dbm.h is available
14909 : see if dbmclose exists
14910 set dbmclose d_dbmclose
14911 eval $inlibc
14912
14913 case "$d_dbmclose" in
14914 $define)
14915         set dbm.h i_dbm
14916         eval $inhdr
14917         case "$i_dbm" in
14918         $define)
14919                 val="$undef"
14920                 set i_rpcsvcdbm
14921                 eval $setvar
14922                 ;;
14923         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14924                 eval $inhdr
14925                 ;;
14926         esac
14927         ;;
14928 *)      echo "We won't be including <dbm.h>"
14929         val="$undef"
14930         set i_dbm
14931         eval $setvar
14932         val="$undef"
14933         set i_rpcsvcdbm
14934         eval $setvar
14935         ;;
14936 esac
14937
14938 : see if this is a sys/file.h system
14939 val=''
14940 set sys/file.h val
14941 eval $inhdr
14942
14943 : do we need to include sys/file.h ?
14944 case "$val" in
14945 "$define")
14946         echo " "
14947         if $h_sysfile; then
14948                 val="$define"
14949                 echo "We'll be including <sys/file.h>." >&4
14950         else
14951                 val="$undef"
14952                 echo "We won't be including <sys/file.h>." >&4
14953         fi
14954         ;;
14955 *)
14956         h_sysfile=false
14957         ;;
14958 esac
14959 set i_sysfile
14960 eval $setvar
14961
14962 : see if fcntl.h is there
14963 val=''
14964 set fcntl.h val
14965 eval $inhdr
14966
14967 : see if we can include fcntl.h
14968 case "$val" in
14969 "$define")
14970         echo " "
14971         if $h_fcntl; then
14972                 val="$define"
14973                 echo "We'll be including <fcntl.h>." >&4
14974         else
14975                 val="$undef"
14976                 if $h_sysfile; then
14977         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14978                 else
14979                         echo "We won't be including <fcntl.h>." >&4
14980                 fi
14981         fi
14982         ;;
14983 *)
14984         h_fcntl=false
14985         val="$undef"
14986         ;;
14987 esac
14988 set i_fcntl
14989 eval $setvar
14990
14991 : see if this is a iconv.h system
14992 set iconv.h i_iconv
14993 eval $inhdr
14994
14995 : see if this is a ieeefp.h system
14996 set ieeefp.h i_ieeefp
14997 eval $inhdr
14998
14999 : see if this is a libutil.h system
15000 set libutil.h i_libutil
15001 eval $inhdr
15002
15003 : see if locale.h is available
15004 set locale.h i_locale
15005 eval $inhdr
15006
15007 : see if mach cthreads are available
15008 if test "X$usethreads" = "X$define"; then
15009         set mach/cthreads.h i_machcthr
15010         eval $inhdr
15011 else
15012         i_machcthr="$undef"
15013 fi
15014
15015
15016
15017 : see if this is a math.h system
15018 set math.h i_math
15019 eval $inhdr
15020
15021 : see if this is a mntent.h system
15022 set mntent.h i_mntent
15023 eval $inhdr
15024
15025 : see if ndbm.h is available
15026 set ndbm.h t_ndbm
15027 eval $inhdr
15028 case "$t_ndbm" in
15029 $define)
15030         : see if dbm_open exists
15031         set dbm_open d_dbm_open
15032         eval $inlibc
15033         case "$d_dbm_open" in
15034         $undef)
15035                 t_ndbm="$undef"
15036                 echo "We won't be including <ndbm.h>"
15037                 ;;
15038         esac
15039         ;;
15040 esac
15041 val="$t_ndbm"
15042 set i_ndbm
15043 eval $setvar
15044
15045 : see if net/errno.h is available
15046 val=''
15047 set net/errno.h val
15048 eval $inhdr
15049
15050 : Unfortunately, it causes problems on some systems.  Arrgh.
15051 case "$val" in
15052 $define)
15053         cat > try.c <<'EOM'
15054 #include <stdio.h>
15055 #include <errno.h>
15056 #include <net/errno.h>
15057 int func()
15058 {
15059         return ENOTSOCK;
15060 }
15061 EOM
15062         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15063                 echo "We'll be including <net/errno.h>." >&4
15064         else
15065                 echo "We won't be including <net/errno.h>." >&4
15066                 val="$undef"
15067         fi
15068         $rm -f try.* try
15069         ;;
15070 esac
15071 set i_neterrno
15072 eval $setvar
15073
15074 : see if netinet/tcp.h is available
15075 set netinet/tcp.h i_netinettcp
15076 eval $inhdr
15077
15078 : see if this is a poll.h system
15079 set poll.h i_poll
15080 eval $inhdr
15081
15082 : see if this is a prot.h system
15083 set prot.h i_prot
15084 eval $inhdr
15085
15086 echo " "
15087 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15088 $cat <<'EOSH' > Cppsym.know
15089 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15090 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15091 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15092 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15093 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15094 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15095 bull c cadmus clipper CMU COFF COMPILER_VERSION
15096 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15097 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15098 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15099 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15100 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15101 H3050R H3050RX hbullx20 hcx host_mips
15102 hp200 hp300 hp700 HP700 hp800 hp9000
15103 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15104 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15105 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15106 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15107 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15108 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15109 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15110 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15111 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15112 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15113 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15114 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15115 MATH_HAS_NO_SIDE_EFFECTS
15116 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15117 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15118 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15119 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15120 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15121 NetBSD news1500 news1700 news1800 news1900 news3700
15122 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15123 ns32016 ns32332 ns32k nsc32000
15124 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15125 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15126 pc532 pdp11 PGC PIC plexus PORTAR posix
15127 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15128 POSIX_C_SOURCE POSIX_SOURCE POWER
15129 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15130 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15131 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15132 sony sony_news sonyrisc sparc sparclite spectrum
15133 stardent stdc STDC_EXT stratos sun sun3 sun386
15134 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15135 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15136 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15137 sysV68 sysV88 Tek4132 Tek4300 titan
15138 tower tower32 tower32_200 tower32_600 tower32_700
15139 tower32_800 tower32_850 tss
15140 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15141 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15142 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15143 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15144 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15145 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15146 z8000
15147 EOSH
15148 # Maybe put other stuff here too.
15149 cat <<EOSH >>Cppsym.know
15150 $osname
15151 EOSH
15152 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15153 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15154 $cat Cppsym.know > Cppsym.c
15155 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15156 $rm -f Cppsym.a Cppsym.b Cppsym.c
15157 cat <<EOSH > Cppsym
15158 $startsh
15159 if $test \$# -gt 0; then
15160     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15161     if $test -s Cppsym.got; then
15162         $rm -f Cppsym.got
15163         exit 0
15164     fi
15165     $rm -f Cppsym.got
15166     exit 1
15167 else
15168     $tr " " "$trnl" | ./Cppsym.try
15169     exit 0
15170 fi
15171 EOSH
15172 chmod +x Cppsym
15173 $eunicefix Cppsym
15174 cat <<EOSH > Cppsym.try
15175 $startsh
15176 cat <<'EOCP' > try.c
15177 #include <stdio.h>
15178 int main() {
15179 EOCP
15180 $awk \\
15181 EOSH
15182 cat <<'EOSH' >> Cppsym.try
15183 'length($1) > 0 {
15184     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
15185     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
15186     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
15187     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
15188 }'       >> try.c
15189 echo '}' >> try.c
15190 EOSH
15191 cat <<EOSH >> Cppsym.try
15192 ccflags="$ccflags"
15193 case "$osname-$gccversion" in
15194 irix-) ccflags="\$ccflags -woff 1178" ;;
15195 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15196 esac
15197 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15198 EOSH
15199 chmod +x Cppsym.try
15200 $eunicefix Cppsym.try
15201 ./Cppsym < Cppsym.know > Cppsym.true
15202 : now check the C compiler for additional symbols
15203 postprocess_cc_v=''
15204 case "$osname" in
15205 aix) postprocess_cc_v="|$tr , ' '" ;;
15206 esac
15207 $cat >ccsym <<EOS
15208 $startsh
15209 $cat >tmp.c <<EOF
15210 extern int foo;
15211 EOF
15212 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15213 do
15214         case "\$i" in
15215         -D*) echo "\$i" | $sed 's/^-D//';;
15216         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15217         esac
15218 done
15219 $rm -f try.c
15220 EOS
15221 postprocess_cc_v=''
15222 chmod +x ccsym
15223 $eunicefix ccsym
15224 ./ccsym > ccsym1.raw
15225 if $test -s ccsym1.raw; then
15226        $sort ccsym1.raw | $uniq >ccsym.raw
15227 else
15228        mv ccsym1.raw ccsym.raw
15229 fi
15230
15231 $awk '/\=/ { print $0; next }
15232         { print $0"=1" }' ccsym.raw >ccsym.list
15233 $awk '/\=/ { print $0; next }
15234         { print $0"=1" }' Cppsym.true >ccsym.true
15235 $comm -13 ccsym.true ccsym.list >ccsym.own
15236 $comm -12 ccsym.true ccsym.list >ccsym.com
15237 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15238 also=''
15239 if $test -z ccsym.raw; then
15240         echo "Your C compiler doesn't seem to define any symbols!" >&4
15241         echo " "
15242         echo "However, your C preprocessor defines the following symbols:"
15243         $cat Cppsym.true
15244         ccsymbols=''
15245         cppsymbols=`$cat Cppsym.true`
15246         cppsymbols=`echo $cppsymbols`
15247         cppccsymbols="$cppsymbols"
15248 else
15249         if $test -s ccsym.com; then
15250                 echo "Your C compiler and pre-processor define these symbols:"
15251                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15252                 also='also '
15253                 symbols='ones'
15254                 cppccsymbols=`$cat ccsym.com`
15255                 cppccsymbols=`echo $cppccsymbols`
15256                 $test "$silent" || sleep 1
15257         fi
15258         if $test -s ccsym.cpp; then
15259                 $test "$also" && echo " "
15260                 echo "Your C pre-processor ${also}defines the following symbols:"
15261                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15262                 also='further '
15263                 cppsymbols=`$cat ccsym.cpp`
15264                 cppsymbols=`echo $cppsymbols`
15265                 $test "$silent" || sleep 1
15266         fi
15267         if $test -s ccsym.own; then
15268                 $test "$also" && echo " "
15269                 echo "Your C compiler ${also}defines the following cpp symbols:"
15270                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15271                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15272                 ccsymbols=`$cat ccsym.own`
15273                 ccsymbols=`echo $ccsymbols`
15274                 $test "$silent" || sleep 1
15275         fi
15276 fi
15277 $rm -f ccsym* Cppsym.*
15278
15279 : see if this is a termio system
15280 val="$undef"
15281 val2="$undef"
15282 val3="$undef"
15283 if $test `./findhdr termios.h`; then
15284         set tcsetattr i_termios
15285         eval $inlibc
15286         val3="$i_termios"
15287 fi
15288 echo " "
15289 case "$val3" in
15290 "$define") echo "You have POSIX termios.h... good!" >&4;;
15291 *) if ./Cppsym pyr; then
15292                 case "`/bin/universe`" in
15293                 ucb) if $test `./findhdr sgtty.h`; then
15294                                 val2="$define"
15295                                 echo "<sgtty.h> found." >&4
15296                         else
15297                                 echo "System is pyramid with BSD universe."
15298                                 echo "<sgtty.h> not found--you could have problems." >&4
15299                         fi;;
15300                 *) if $test `./findhdr termio.h`; then
15301                                 val="$define"
15302                                 echo "<termio.h> found." >&4
15303                         else
15304                                 echo "System is pyramid with USG universe."
15305                                 echo "<termio.h> not found--you could have problems." >&4
15306                         fi;;
15307                 esac
15308         elif ./usg; then
15309                 if $test `./findhdr termio.h`; then
15310                         echo "<termio.h> found." >&4
15311                         val="$define"
15312                 elif $test `./findhdr sgtty.h`; then
15313                         echo "<sgtty.h> found." >&4
15314                         val2="$define"
15315                 else
15316 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15317                 fi
15318         else
15319                 if $test `./findhdr sgtty.h`; then
15320                         echo "<sgtty.h> found." >&4
15321                         val2="$define"
15322                 elif $test `./findhdr termio.h`; then
15323                         echo "<termio.h> found." >&4
15324                         val="$define"
15325                 else
15326 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15327                 fi
15328         fi;;
15329 esac
15330 set i_termio; eval $setvar
15331 val=$val2; set i_sgtty; eval $setvar
15332 val=$val3; set i_termios; eval $setvar
15333
15334 : see if this is a shadow.h system
15335 set shadow.h i_shadow
15336 eval $inhdr
15337
15338 : see if stddef is available
15339 set stddef.h i_stddef
15340 eval $inhdr
15341
15342 : see if this is a sunmath.h system
15343 set sunmath.h i_sunmath
15344 eval $inhdr
15345
15346 : see if sys/access.h is available
15347 set sys/access.h i_sysaccess
15348 eval $inhdr
15349
15350 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15351 set sys/filio.h i_sysfilio
15352 eval $inhdr
15353 echo " "
15354 if $test `./findhdr sys/ioctl.h`; then
15355         val="$define"
15356         echo '<sys/ioctl.h> found.' >&4
15357 else
15358         val="$undef"
15359         if $test $i_sysfilio = "$define"; then
15360             echo '<sys/ioctl.h> NOT found.' >&4
15361         else
15362                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15363                 $test $i_termio = "$define" && xxx="termio.h"
15364                 $test $i_termios = "$define" && xxx="termios.h"
15365 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15366         fi
15367 fi
15368 set i_sysioctl
15369 eval $setvar
15370
15371
15372 : see if this is a syslog.h system
15373 set syslog.h i_syslog
15374 eval $inhdr
15375
15376
15377 : see if this is a sys/mode.h system
15378 set sys/mode.h i_sysmode
15379 eval $inhdr
15380
15381 : see if sys/resource.h has to be included
15382 set sys/resource.h i_sysresrc
15383 eval $inhdr
15384
15385 : see if sys/security.h is available
15386 set sys/security.h i_syssecrt
15387 eval $inhdr
15388
15389 : see if this is a sys/statvfs.h system
15390 set sys/statvfs.h i_sysstatvfs
15391 eval $inhdr
15392
15393 : see if this is a sys/uio.h system
15394 set sys/uio.h i_sysuio
15395 eval $inhdr
15396
15397 : see if this is a sys/un.h system
15398 set sys/un.h i_sysun
15399 eval $inhdr
15400
15401
15402 : see if this is a sys/utsname.h system
15403 set sys/utsname.h i_sysutsname
15404 eval $inhdr
15405
15406 : see if this is a syswait system
15407 set sys/wait.h i_syswait
15408 eval $inhdr
15409
15410 : see if this is a ustat.h system
15411 set ustat.h i_ustat
15412 eval $inhdr
15413
15414 : see if this is an utime system
15415 set utime.h i_utime
15416 eval $inhdr
15417
15418 : see if this is a values.h system
15419 set values.h i_values
15420 eval $inhdr
15421
15422 : see if this is a vfork system
15423 case "$d_vfork" in
15424 "$define")
15425         set vfork.h i_vfork
15426         eval $inhdr
15427         ;;
15428 *)
15429         i_vfork="$undef"
15430         ;;
15431 esac
15432
15433 : see if gdbm.h is available
15434 set gdbm.h t_gdbm
15435 eval $inhdr
15436 case "$t_gdbm" in
15437 $define)
15438         : see if gdbm_open exists
15439         set gdbm_open d_gdbm_open
15440         eval $inlibc
15441         case "$d_gdbm_open" in
15442         $undef)
15443                 t_gdbm="$undef"
15444                 echo "We won't be including <gdbm.h>"
15445                 ;;
15446         esac
15447         ;;
15448 esac
15449 val="$t_gdbm"
15450 set i_gdbm
15451 eval $setvar
15452
15453 echo " "
15454 echo "Looking for extensions..." >&4
15455 : If we are using the old config.sh, known_extensions may contain
15456 : old or inaccurate or duplicate values.
15457 known_extensions=''
15458 nonxs_extensions=''
15459 : We do not use find because it might not be available.
15460 : We do not just use MANIFEST because the user may have dropped
15461 : some additional extensions into the source tree and expect them
15462 : to be built.
15463
15464 : Function to recursively find available extensions, ignoring DynaLoader
15465 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15466 find_extensions='
15467     for xxx in *; do
15468        case "$xxx" in
15469            DynaLoader|dynaload) ;;
15470            *)
15471            if $test -f $xxx/$xxx.xs; then
15472                known_extensions="$known_extensions $1$xxx";
15473            elif $test -f $xxx/Makefile.PL; then
15474                nonxs_extensions="$nonxs_extensions $1$xxx";
15475            else
15476                if $test -d $xxx -a $# -lt 10; then
15477                    set $1$xxx/ $*;
15478                    cd $xxx;
15479                    eval $find_extensions;
15480                    cd ..;
15481                    shift;
15482                fi;
15483            fi
15484            ;;
15485        esac;
15486     done'
15487 tdir=`pwd`
15488 cd $rsrc/ext
15489 set X
15490 shift
15491 eval $find_extensions
15492 set X $nonxs_extensions
15493 shift
15494 nonxs_extensions="$*"
15495 set X $known_extensions
15496 shift
15497 known_extensions="$*"
15498 cd $tdir
15499
15500 : Now see which are supported on this system.
15501 avail_ext=''
15502 for xxx in $known_extensions ; do
15503         case "$xxx" in
15504         DB_File|db_file)
15505                 case "$i_db" in
15506                 $define) avail_ext="$avail_ext $xxx" ;;
15507                 esac
15508                 ;;
15509         GDBM_File|gdbm_fil)
15510                 case "$i_gdbm" in 
15511                 $define) avail_ext="$avail_ext $xxx" ;;
15512                 esac
15513                 ;;
15514         NDBM_File|ndbm_fil)
15515                 case "$i_ndbm" in
15516                 $define)
15517                     case "$osname-$use64bitint" in
15518                     hpux-define)
15519                         case "$libs" in
15520                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15521                         esac
15522                         ;;
15523                     *) avail_ext="$avail_ext $xxx" ;;
15524                     esac
15525                     ;;
15526                 esac
15527                 ;;
15528         ODBM_File|odbm_fil) 
15529                 case "${i_dbm}${i_rpcsvcdbm}" in
15530                 *"${define}"*)
15531                     case "$osname-$use64bitint" in
15532                     hpux-define)
15533                         case "$libs" in
15534                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15535                         esac
15536                         ;;
15537                     *) avail_ext="$avail_ext $xxx" ;;
15538                     esac
15539                     ;;
15540                 esac
15541                 ;;
15542         POSIX|posix)
15543                 case "$useposix" in
15544                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15545                 esac
15546                 ;;
15547         Opcode|opcode)
15548                 case "$useopcode" in
15549                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15550                 esac
15551                 ;;
15552         Socket|socket)
15553                 case "$d_socket" in 
15554                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15555                 esac
15556                 ;;
15557         Sys/Syslog|sys/syslog)
15558                 : XXX syslog requires socket
15559                 case "$d_socket" in 
15560                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15561                 esac
15562                 ;;
15563         Thread|thread)
15564                 case "$usethreads" in 
15565                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15566                 esac
15567                 ;;
15568         IPC/SysV|ipc/sysv)
15569                 : XXX Do we need a useipcsysv variable here
15570                 case "${d_msg}${d_sem}${d_shm}" in 
15571                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15572                 esac
15573                 ;;
15574         *)      avail_ext="$avail_ext $xxx"
15575                 ;;
15576         esac
15577 done
15578
15579 set X $avail_ext
15580 shift
15581 avail_ext="$*"
15582
15583 : Now see which nonxs extensions are supported on this system.
15584 : For now assume all are.
15585 nonxs_ext=''
15586 for xxx in $nonxs_extensions ; do
15587         case "$xxx" in
15588         *)      nonxs_ext="$nonxs_ext $xxx"
15589                 ;;
15590         esac
15591 done
15592
15593 set X $nonxs_ext
15594 shift
15595 nonxs_ext="$*"
15596
15597 case $usedl in
15598 $define)
15599         $cat <<EOM
15600 A number of extensions are supplied with $package.  You may choose to
15601 compile these extensions for dynamic loading (the default), compile
15602 them into the $package executable (static loading), or not include
15603 them at all.  Answer "none" to include no extensions.
15604 Note that DynaLoader is always built and need not be mentioned here.
15605
15606 EOM
15607         case "$dynamic_ext" in
15608         '') dflt="$avail_ext" ;;
15609         *)      dflt="$dynamic_ext"
15610                 # Perhaps we are reusing an old out-of-date config.sh.
15611                 case "$hint" in
15612                 previous)
15613                         if test X"$dynamic_ext" != X"$avail_ext"; then
15614                                 $cat <<EOM
15615 NOTICE:  Your previous config.sh list may be incorrect. 
15616 The extensions now available to you are 
15617         ${avail_ext}
15618 but the default list from your previous config.sh is
15619         ${dynamic_ext} 
15620
15621 EOM
15622                         fi
15623                         ;;
15624                 esac
15625                 ;;
15626         esac
15627         case "$dflt" in
15628         '')     dflt=none;;
15629         esac
15630         rp="What extensions do you wish to load dynamically?"
15631         . ./myread
15632         case "$ans" in
15633         none) dynamic_ext=' ' ;;
15634         *) dynamic_ext="$ans" ;;
15635         esac
15636
15637         case "$static_ext" in
15638         '')
15639                 : Exclude those already listed in dynamic linking
15640                 dflt=''
15641                 for xxx in $avail_ext; do
15642                         case " $dynamic_ext " in
15643                         *" $xxx "*) ;;
15644                         *) dflt="$dflt $xxx" ;;
15645                         esac
15646                 done
15647                 set X $dflt
15648                 shift
15649                 dflt="$*"
15650                 ;;
15651         *)  dflt="$static_ext" 
15652                 ;;
15653         esac
15654
15655         case "$dflt" in
15656         '')     dflt=none;;
15657         esac
15658         rp="What extensions do you wish to load statically?"
15659         . ./myread
15660         case "$ans" in
15661         none) static_ext=' ' ;;
15662         *) static_ext="$ans" ;;
15663         esac
15664         ;;
15665 *)
15666         $cat <<EOM
15667 A number of extensions are supplied with $package.  Answer "none" 
15668 to include no extensions. 
15669 Note that DynaLoader is always built and need not be mentioned here.
15670
15671 EOM
15672         case "$static_ext" in
15673         '') dflt="$avail_ext" ;;
15674         *)      dflt="$static_ext"
15675                 # Perhaps we are reusing an old out-of-date config.sh.
15676                 case "$hint" in
15677                 previous)
15678                         if test X"$static_ext" != X"$avail_ext"; then
15679                                 $cat <<EOM
15680 NOTICE:  Your previous config.sh list may be incorrect. 
15681 The extensions now available to you are 
15682         ${avail_ext}
15683 but the default list from your previous config.sh is
15684         ${static_ext} 
15685
15686 EOM
15687                         fi
15688                         ;;
15689                 esac
15690                 ;;
15691         esac
15692         : Exclude those that are not xs extensions
15693         case "$dflt" in
15694         '')     dflt=none;;
15695         esac
15696         rp="What extensions do you wish to include?"
15697         . ./myread
15698         case "$ans" in
15699         none) static_ext=' ' ;;
15700         *) static_ext="$ans" ;;
15701         esac
15702         ;;
15703 esac
15704
15705 set X $dynamic_ext $static_ext $nonxs_ext
15706 shift
15707 extensions="$*"
15708
15709 : Remove libraries needed only for extensions
15710 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15711 : The exception is SunOS 4.x, which needs them.
15712 case "${osname}X${osvers}" in
15713 sunos*X4*)
15714     perllibs="$libs"
15715     ;;
15716 *) case "$usedl" in
15717     $define|true|[yY]*)
15718             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15719             shift
15720             perllibs="$*"
15721             ;;
15722     *)  perllibs="$libs"
15723             ;;
15724     esac
15725     ;;
15726 esac
15727
15728 : Remove build directory name from cppstdin so it can be used from
15729 : either the present location or the final installed location.
15730 echo " "
15731 : Get out of the UU directory to get correct path name.
15732 cd ..
15733 case "$cppstdin" in
15734 `pwd`/cppstdin)
15735         echo "Stripping down cppstdin path name"
15736         cppstdin=cppstdin
15737         ;;
15738 esac
15739 cd UU
15740
15741 : end of configuration questions
15742 echo " "
15743 echo "End of configuration questions."
15744 echo " "
15745
15746 : back to where it started
15747 if test -d ../UU; then
15748         cd ..
15749 fi
15750
15751 : configuration may be patched via a 'config.over' file
15752 if $test -f config.over; then
15753         echo " "
15754         dflt=y
15755         rp='I see a config.over file.  Do you wish to load it?'
15756         . UU/myread
15757         case "$ans" in
15758         n*) echo "OK, I'll ignore it.";;
15759         *)      . ./config.over
15760                 echo "Configuration override changes have been loaded."
15761                 ;;
15762         esac
15763 fi
15764
15765 : in case they want portability, strip down executable paths
15766 case "$d_portable" in
15767 "$define")
15768         echo " "
15769         echo "Stripping down executable paths..." >&4
15770         for file in $loclist $trylist; do
15771                 eval temp=\$$file
15772                 eval $file=`basename $temp`
15773         done
15774         ;;
15775 esac
15776
15777 : create config.sh file
15778 echo " "
15779 echo "Creating config.sh..." >&4
15780 $spitshell <<EOT >config.sh
15781 $startsh
15782 #
15783 # This file was produced by running the Configure script. It holds all the
15784 # definitions figured out by Configure. Should you modify one of these values,
15785 # do not forget to propagate your changes by running "Configure -der". You may
15786 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15787 #
15788
15789 # Package name      : $package
15790 # Source directory  : $src
15791 # Configuration time: $cf_time
15792 # Configured by     : $cf_by
15793 # Target system     : $myuname
15794
15795 Author='$Author'
15796 Date='$Date'
15797 Header='$Header'
15798 Id='$Id'
15799 Locker='$Locker'
15800 Log='$Log'
15801 Mcc='$Mcc'
15802 RCSfile='$RCSfile'
15803 Revision='$Revision'
15804 Source='$Source'
15805 State='$State'
15806 _a='$_a'
15807 _exe='$_exe'
15808 _o='$_o'
15809 afs='$afs'
15810 alignbytes='$alignbytes'
15811 ansi2knr='$ansi2knr'
15812 aphostname='$aphostname'
15813 api_revision='$api_revision'
15814 api_subversion='$api_subversion'
15815 api_version='$api_version'
15816 api_versionstring='$api_versionstring'
15817 ar='$ar'
15818 archlib='$archlib'
15819 archlibexp='$archlibexp'
15820 archname64='$archname64'
15821 archname='$archname'
15822 archobjs='$archobjs'
15823 awk='$awk'
15824 baserev='$baserev'
15825 bash='$bash'
15826 bin='$bin'
15827 bincompat5005='$bincompat5005'
15828 binexp='$binexp'
15829 bison='$bison'
15830 byacc='$byacc'
15831 byteorder='$byteorder'
15832 c='$c'
15833 castflags='$castflags'
15834 cat='$cat'
15835 cc='$cc'
15836 cccdlflags='$cccdlflags'
15837 ccdlflags='$ccdlflags'
15838 ccflags='$ccflags'
15839 ccflags_uselargefiles='$ccflags_uselargefiles'
15840 ccname='$ccname'
15841 ccsymbols='$ccsymbols'
15842 ccversion='$ccversion'
15843 cf_by='$cf_by'
15844 cf_email='$cf_email'
15845 cf_time='$cf_time'
15846 charsize='$charsize'
15847 chgrp='$chgrp'
15848 chmod='$chmod'
15849 chown='$chown'
15850 clocktype='$clocktype'
15851 comm='$comm'
15852 compress='$compress'
15853 contains='$contains'
15854 cp='$cp'
15855 cpio='$cpio'
15856 cpp='$cpp'
15857 cpp_stuff='$cpp_stuff'
15858 cppccsymbols='$cppccsymbols'
15859 cppflags='$cppflags'
15860 cpplast='$cpplast'
15861 cppminus='$cppminus'
15862 cpprun='$cpprun'
15863 cppstdin='$cppstdin'
15864 cppsymbols='$cppsymbols'
15865 crosscompile='$crosscompile'
15866 cryptlib='$cryptlib'
15867 csh='$csh'
15868 d_Gconvert='$d_Gconvert'
15869 d_PRIEUldbl='$d_PRIEUldbl'
15870 d_PRIFUldbl='$d_PRIFUldbl'
15871 d_PRIGUldbl='$d_PRIGUldbl'
15872 d_PRIXU64='$d_PRIXU64'
15873 d_PRId64='$d_PRId64'
15874 d_PRIeldbl='$d_PRIeldbl'
15875 d_PRIfldbl='$d_PRIfldbl'
15876 d_PRIgldbl='$d_PRIgldbl'
15877 d_PRIi64='$d_PRIi64'
15878 d_PRIo64='$d_PRIo64'
15879 d_PRIu64='$d_PRIu64'
15880 d_PRIx64='$d_PRIx64'
15881 d_SCNfldbl='$d_SCNfldbl'
15882 d__fwalk='$d__fwalk'
15883 d_access='$d_access'
15884 d_accessx='$d_accessx'
15885 d_alarm='$d_alarm'
15886 d_archlib='$d_archlib'
15887 d_atolf='$d_atolf'
15888 d_atoll='$d_atoll'
15889 d_attribut='$d_attribut'
15890 d_bcmp='$d_bcmp'
15891 d_bcopy='$d_bcopy'
15892 d_bincompat5005='$d_bincompat5005'
15893 d_bsd='$d_bsd'
15894 d_bsdgetpgrp='$d_bsdgetpgrp'
15895 d_bsdsetpgrp='$d_bsdsetpgrp'
15896 d_bzero='$d_bzero'
15897 d_casti32='$d_casti32'
15898 d_castneg='$d_castneg'
15899 d_charvspr='$d_charvspr'
15900 d_chown='$d_chown'
15901 d_chroot='$d_chroot'
15902 d_chsize='$d_chsize'
15903 d_closedir='$d_closedir'
15904 d_const='$d_const'
15905 d_crypt='$d_crypt'
15906 d_csh='$d_csh'
15907 d_cuserid='$d_cuserid'
15908 d_dbl_dig='$d_dbl_dig'
15909 d_difftime='$d_difftime'
15910 d_dirnamlen='$d_dirnamlen'
15911 d_dlerror='$d_dlerror'
15912 d_dlopen='$d_dlopen'
15913 d_dlsymun='$d_dlsymun'
15914 d_dosuid='$d_dosuid'
15915 d_drand48proto='$d_drand48proto'
15916 d_dup2='$d_dup2'
15917 d_eaccess='$d_eaccess'
15918 d_endgrent='$d_endgrent'
15919 d_endhent='$d_endhent'
15920 d_endnent='$d_endnent'
15921 d_endpent='$d_endpent'
15922 d_endpwent='$d_endpwent'
15923 d_endsent='$d_endsent'
15924 d_eofnblk='$d_eofnblk'
15925 d_eunice='$d_eunice'
15926 d_fchmod='$d_fchmod'
15927 d_fchown='$d_fchown'
15928 d_fcntl='$d_fcntl'
15929 d_fcntl_can_lock='$d_fcntl_can_lock'
15930 d_fd_macros='$d_fd_macros'
15931 d_fd_set='$d_fd_set'
15932 d_fds_bits='$d_fds_bits'
15933 d_fgetpos='$d_fgetpos'
15934 d_flexfnam='$d_flexfnam'
15935 d_flock='$d_flock'
15936 d_fork='$d_fork'
15937 d_fpathconf='$d_fpathconf'
15938 d_fpos64_t='$d_fpos64_t'
15939 d_frexpl='$d_frexpl'
15940 d_fs_data_s='$d_fs_data_s'
15941 d_fseeko='$d_fseeko'
15942 d_fsetpos='$d_fsetpos'
15943 d_fstatfs='$d_fstatfs'
15944 d_fstatvfs='$d_fstatvfs'
15945 d_fsync='$d_fsync'
15946 d_ftello='$d_ftello'
15947 d_ftime='$d_ftime'
15948 d_getcwd='$d_getcwd'
15949 d_getespwnam='$d_getespwnam'
15950 d_getfsstat='$d_getfsstat'
15951 d_getgrent='$d_getgrent'
15952 d_getgrps='$d_getgrps'
15953 d_gethbyaddr='$d_gethbyaddr'
15954 d_gethbyname='$d_gethbyname'
15955 d_gethent='$d_gethent'
15956 d_gethname='$d_gethname'
15957 d_gethostprotos='$d_gethostprotos'
15958 d_getlogin='$d_getlogin'
15959 d_getmnt='$d_getmnt'
15960 d_getmntent='$d_getmntent'
15961 d_getnbyaddr='$d_getnbyaddr'
15962 d_getnbyname='$d_getnbyname'
15963 d_getnent='$d_getnent'
15964 d_getnetprotos='$d_getnetprotos'
15965 d_getpagsz='$d_getpagsz'
15966 d_getpbyname='$d_getpbyname'
15967 d_getpbynumber='$d_getpbynumber'
15968 d_getpent='$d_getpent'
15969 d_getpgid='$d_getpgid'
15970 d_getpgrp2='$d_getpgrp2'
15971 d_getpgrp='$d_getpgrp'
15972 d_getppid='$d_getppid'
15973 d_getprior='$d_getprior'
15974 d_getprotoprotos='$d_getprotoprotos'
15975 d_getprpwnam='$d_getprpwnam'
15976 d_getpwent='$d_getpwent'
15977 d_getsbyname='$d_getsbyname'
15978 d_getsbyport='$d_getsbyport'
15979 d_getsent='$d_getsent'
15980 d_getservprotos='$d_getservprotos'
15981 d_getspnam='$d_getspnam'
15982 d_gettimeod='$d_gettimeod'
15983 d_gnulibc='$d_gnulibc'
15984 d_grpasswd='$d_grpasswd'
15985 d_hasmntopt='$d_hasmntopt'
15986 d_htonl='$d_htonl'
15987 d_iconv='$d_iconv'
15988 d_index='$d_index'
15989 d_inetaton='$d_inetaton'
15990 d_int64_t='$d_int64_t'
15991 d_isascii='$d_isascii'
15992 d_isnan='$d_isnan'
15993 d_isnanl='$d_isnanl'
15994 d_killpg='$d_killpg'
15995 d_lchown='$d_lchown'
15996 d_ldbl_dig='$d_ldbl_dig'
15997 d_link='$d_link'
15998 d_locconv='$d_locconv'
15999 d_lockf='$d_lockf'
16000 d_longdbl='$d_longdbl'
16001 d_longlong='$d_longlong'
16002 d_lseekproto='$d_lseekproto'
16003 d_lstat='$d_lstat'
16004 d_madvise='$d_madvise'
16005 d_mblen='$d_mblen'
16006 d_mbstowcs='$d_mbstowcs'
16007 d_mbtowc='$d_mbtowc'
16008 d_memchr='$d_memchr'
16009 d_memcmp='$d_memcmp'
16010 d_memcpy='$d_memcpy'
16011 d_memmove='$d_memmove'
16012 d_memset='$d_memset'
16013 d_mkdir='$d_mkdir'
16014 d_mkdtemp='$d_mkdtemp'
16015 d_mkfifo='$d_mkfifo'
16016 d_mkstemp='$d_mkstemp'
16017 d_mkstemps='$d_mkstemps'
16018 d_mktime='$d_mktime'
16019 d_mmap='$d_mmap'
16020 d_modfl='$d_modfl'
16021 d_mprotect='$d_mprotect'
16022 d_msg='$d_msg'
16023 d_msg_ctrunc='$d_msg_ctrunc'
16024 d_msg_dontroute='$d_msg_dontroute'
16025 d_msg_oob='$d_msg_oob'
16026 d_msg_peek='$d_msg_peek'
16027 d_msg_proxy='$d_msg_proxy'
16028 d_msgctl='$d_msgctl'
16029 d_msgget='$d_msgget'
16030 d_msgrcv='$d_msgrcv'
16031 d_msgsnd='$d_msgsnd'
16032 d_msync='$d_msync'
16033 d_munmap='$d_munmap'
16034 d_mymalloc='$d_mymalloc'
16035 d_nice='$d_nice'
16036 d_nv_preserves_uv='$d_nv_preserves_uv'
16037 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16038 d_off64_t='$d_off64_t'
16039 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16040 d_oldpthreads='$d_oldpthreads'
16041 d_oldsock='$d_oldsock'
16042 d_open3='$d_open3'
16043 d_pathconf='$d_pathconf'
16044 d_pause='$d_pause'
16045 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16046 d_phostname='$d_phostname'
16047 d_pipe='$d_pipe'
16048 d_poll='$d_poll'
16049 d_portable='$d_portable'
16050 d_pthread_yield='$d_pthread_yield'
16051 d_pwage='$d_pwage'
16052 d_pwchange='$d_pwchange'
16053 d_pwclass='$d_pwclass'
16054 d_pwcomment='$d_pwcomment'
16055 d_pwexpire='$d_pwexpire'
16056 d_pwgecos='$d_pwgecos'
16057 d_pwpasswd='$d_pwpasswd'
16058 d_pwquota='$d_pwquota'
16059 d_qgcvt='$d_qgcvt'
16060 d_quad='$d_quad'
16061 d_readdir='$d_readdir'
16062 d_readlink='$d_readlink'
16063 d_rename='$d_rename'
16064 d_rewinddir='$d_rewinddir'
16065 d_rmdir='$d_rmdir'
16066 d_safebcpy='$d_safebcpy'
16067 d_safemcpy='$d_safemcpy'
16068 d_sanemcmp='$d_sanemcmp'
16069 d_sbrkproto='$d_sbrkproto'
16070 d_sched_yield='$d_sched_yield'
16071 d_scm_rights='$d_scm_rights'
16072 d_seekdir='$d_seekdir'
16073 d_select='$d_select'
16074 d_sem='$d_sem'
16075 d_semctl='$d_semctl'
16076 d_semctl_semid_ds='$d_semctl_semid_ds'
16077 d_semctl_semun='$d_semctl_semun'
16078 d_semget='$d_semget'
16079 d_semop='$d_semop'
16080 d_setegid='$d_setegid'
16081 d_seteuid='$d_seteuid'
16082 d_setgrent='$d_setgrent'
16083 d_setgrps='$d_setgrps'
16084 d_sethent='$d_sethent'
16085 d_setlinebuf='$d_setlinebuf'
16086 d_setlocale='$d_setlocale'
16087 d_setnent='$d_setnent'
16088 d_setpent='$d_setpent'
16089 d_setpgid='$d_setpgid'
16090 d_setpgrp2='$d_setpgrp2'
16091 d_setpgrp='$d_setpgrp'
16092 d_setprior='$d_setprior'
16093 d_setproctitle='$d_setproctitle'
16094 d_setpwent='$d_setpwent'
16095 d_setregid='$d_setregid'
16096 d_setresgid='$d_setresgid'
16097 d_setresuid='$d_setresuid'
16098 d_setreuid='$d_setreuid'
16099 d_setrgid='$d_setrgid'
16100 d_setruid='$d_setruid'
16101 d_setsent='$d_setsent'
16102 d_setsid='$d_setsid'
16103 d_setvbuf='$d_setvbuf'
16104 d_sfio='$d_sfio'
16105 d_shm='$d_shm'
16106 d_shmat='$d_shmat'
16107 d_shmatprototype='$d_shmatprototype'
16108 d_shmctl='$d_shmctl'
16109 d_shmdt='$d_shmdt'
16110 d_shmget='$d_shmget'
16111 d_sigaction='$d_sigaction'
16112 d_sigprocmask='$d_sigprocmask'
16113 d_sigsetjmp='$d_sigsetjmp'
16114 d_socket='$d_socket'
16115 d_socklen_t='$d_socklen_t'
16116 d_sockpair='$d_sockpair'
16117 d_socks5_init='$d_socks5_init'
16118 d_sqrtl='$d_sqrtl'
16119 d_statblks='$d_statblks'
16120 d_statfs_f_flags='$d_statfs_f_flags'
16121 d_statfs_s='$d_statfs_s'
16122 d_statvfs='$d_statvfs'
16123 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16124 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16125 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16126 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16127 d_stdio_stream_array='$d_stdio_stream_array'
16128 d_stdiobase='$d_stdiobase'
16129 d_stdstdio='$d_stdstdio'
16130 d_strchr='$d_strchr'
16131 d_strcoll='$d_strcoll'
16132 d_strctcpy='$d_strctcpy'
16133 d_strerrm='$d_strerrm'
16134 d_strerror='$d_strerror'
16135 d_strtod='$d_strtod'
16136 d_strtol='$d_strtol'
16137 d_strtold='$d_strtold'
16138 d_strtoll='$d_strtoll'
16139 d_strtoq='$d_strtoq'
16140 d_strtoul='$d_strtoul'
16141 d_strtoull='$d_strtoull'
16142 d_strtouq='$d_strtouq'
16143 d_strxfrm='$d_strxfrm'
16144 d_suidsafe='$d_suidsafe'
16145 d_symlink='$d_symlink'
16146 d_syscall='$d_syscall'
16147 d_sysconf='$d_sysconf'
16148 d_sysernlst='$d_sysernlst'
16149 d_syserrlst='$d_syserrlst'
16150 d_system='$d_system'
16151 d_tcgetpgrp='$d_tcgetpgrp'
16152 d_tcsetpgrp='$d_tcsetpgrp'
16153 d_telldir='$d_telldir'
16154 d_telldirproto='$d_telldirproto'
16155 d_time='$d_time'
16156 d_times='$d_times'
16157 d_truncate='$d_truncate'
16158 d_tzname='$d_tzname'
16159 d_umask='$d_umask'
16160 d_uname='$d_uname'
16161 d_union_semun='$d_union_semun'
16162 d_ustat='$d_ustat'
16163 d_vendorarch='$d_vendorarch'
16164 d_vendorbin='$d_vendorbin'
16165 d_vendorlib='$d_vendorlib'
16166 d_vfork='$d_vfork'
16167 d_void_closedir='$d_void_closedir'
16168 d_voidsig='$d_voidsig'
16169 d_voidtty='$d_voidtty'
16170 d_volatile='$d_volatile'
16171 d_vprintf='$d_vprintf'
16172 d_wait4='$d_wait4'
16173 d_waitpid='$d_waitpid'
16174 d_wcstombs='$d_wcstombs'
16175 d_wctomb='$d_wctomb'
16176 d_xenix='$d_xenix'
16177 date='$date'
16178 db_hashtype='$db_hashtype'
16179 db_prefixtype='$db_prefixtype'
16180 defvoidused='$defvoidused'
16181 direntrytype='$direntrytype'
16182 dlext='$dlext'
16183 dlsrc='$dlsrc'
16184 doublesize='$doublesize'
16185 drand01='$drand01'
16186 dynamic_ext='$dynamic_ext'
16187 eagain='$eagain'
16188 ebcdic='$ebcdic'
16189 echo='$echo'
16190 egrep='$egrep'
16191 emacs='$emacs'
16192 eunicefix='$eunicefix'
16193 exe_ext='$exe_ext'
16194 expr='$expr'
16195 extensions='$extensions'
16196 fflushNULL='$fflushNULL'
16197 fflushall='$fflushall'
16198 find='$find'
16199 firstmakefile='$firstmakefile'
16200 flex='$flex'
16201 fpossize='$fpossize'
16202 fpostype='$fpostype'
16203 freetype='$freetype'
16204 full_ar='$full_ar'
16205 full_csh='$full_csh'
16206 full_sed='$full_sed'
16207 gccosandvers='$gccosandvers'
16208 gccversion='$gccversion'
16209 gidformat='$gidformat'
16210 gidsign='$gidsign'
16211 gidsize='$gidsize'
16212 gidtype='$gidtype'
16213 glibpth='$glibpth'
16214 grep='$grep'
16215 groupcat='$groupcat'
16216 groupstype='$groupstype'
16217 gzip='$gzip'
16218 h_fcntl='$h_fcntl'
16219 h_sysfile='$h_sysfile'
16220 hint='$hint'
16221 hostcat='$hostcat'
16222 i16size='$i16size'
16223 i16type='$i16type'
16224 i32size='$i32size'
16225 i32type='$i32type'
16226 i64size='$i64size'
16227 i64type='$i64type'
16228 i8size='$i8size'
16229 i8type='$i8type'
16230 i_arpainet='$i_arpainet'
16231 i_bsdioctl='$i_bsdioctl'
16232 i_db='$i_db'
16233 i_dbm='$i_dbm'
16234 i_dirent='$i_dirent'
16235 i_dld='$i_dld'
16236 i_dlfcn='$i_dlfcn'
16237 i_fcntl='$i_fcntl'
16238 i_float='$i_float'
16239 i_gdbm='$i_gdbm'
16240 i_grp='$i_grp'
16241 i_iconv='$i_iconv'
16242 i_ieeefp='$i_ieeefp'
16243 i_inttypes='$i_inttypes'
16244 i_libutil='$i_libutil'
16245 i_limits='$i_limits'
16246 i_locale='$i_locale'
16247 i_machcthr='$i_machcthr'
16248 i_malloc='$i_malloc'
16249 i_math='$i_math'
16250 i_memory='$i_memory'
16251 i_mntent='$i_mntent'
16252 i_ndbm='$i_ndbm'
16253 i_netdb='$i_netdb'
16254 i_neterrno='$i_neterrno'
16255 i_netinettcp='$i_netinettcp'
16256 i_niin='$i_niin'
16257 i_poll='$i_poll'
16258 i_prot='$i_prot'
16259 i_pthread='$i_pthread'
16260 i_pwd='$i_pwd'
16261 i_rpcsvcdbm='$i_rpcsvcdbm'
16262 i_sfio='$i_sfio'
16263 i_sgtty='$i_sgtty'
16264 i_shadow='$i_shadow'
16265 i_socks='$i_socks'
16266 i_stdarg='$i_stdarg'
16267 i_stddef='$i_stddef'
16268 i_stdlib='$i_stdlib'
16269 i_string='$i_string'
16270 i_sunmath='$i_sunmath'
16271 i_sysaccess='$i_sysaccess'
16272 i_sysdir='$i_sysdir'
16273 i_sysfile='$i_sysfile'
16274 i_sysfilio='$i_sysfilio'
16275 i_sysin='$i_sysin'
16276 i_sysioctl='$i_sysioctl'
16277 i_syslog='$i_syslog'
16278 i_sysmman='$i_sysmman'
16279 i_sysmode='$i_sysmode'
16280 i_sysmount='$i_sysmount'
16281 i_sysndir='$i_sysndir'
16282 i_sysparam='$i_sysparam'
16283 i_sysresrc='$i_sysresrc'
16284 i_syssecrt='$i_syssecrt'
16285 i_sysselct='$i_sysselct'
16286 i_syssockio='$i_syssockio'
16287 i_sysstat='$i_sysstat'
16288 i_sysstatfs='$i_sysstatfs'
16289 i_sysstatvfs='$i_sysstatvfs'
16290 i_systime='$i_systime'
16291 i_systimek='$i_systimek'
16292 i_systimes='$i_systimes'
16293 i_systypes='$i_systypes'
16294 i_sysuio='$i_sysuio'
16295 i_sysun='$i_sysun'
16296 i_sysutsname='$i_sysutsname'
16297 i_sysvfs='$i_sysvfs'
16298 i_syswait='$i_syswait'
16299 i_termio='$i_termio'
16300 i_termios='$i_termios'
16301 i_time='$i_time'
16302 i_unistd='$i_unistd'
16303 i_ustat='$i_ustat'
16304 i_utime='$i_utime'
16305 i_values='$i_values'
16306 i_varargs='$i_varargs'
16307 i_varhdr='$i_varhdr'
16308 i_vfork='$i_vfork'
16309 ignore_versioned_solibs='$ignore_versioned_solibs'
16310 inc_version_list='$inc_version_list'
16311 inc_version_list_init='$inc_version_list_init'
16312 incpath='$incpath'
16313 inews='$inews'
16314 installarchlib='$installarchlib'
16315 installbin='$installbin'
16316 installman1dir='$installman1dir'
16317 installman3dir='$installman3dir'
16318 installprefix='$installprefix'
16319 installprefixexp='$installprefixexp'
16320 installprivlib='$installprivlib'
16321 installscript='$installscript'
16322 installsitearch='$installsitearch'
16323 installsitebin='$installsitebin'
16324 installsitelib='$installsitelib'
16325 installstyle='$installstyle'
16326 installusrbinperl='$installusrbinperl'
16327 installvendorarch='$installvendorarch'
16328 installvendorbin='$installvendorbin'
16329 installvendorlib='$installvendorlib'
16330 intsize='$intsize'
16331 issymlink='$issymlink'
16332 ivdformat='$ivdformat'
16333 ivsize='$ivsize'
16334 ivtype='$ivtype'
16335 known_extensions='$known_extensions'
16336 ksh='$ksh'
16337 ld='$ld'
16338 lddlflags='$lddlflags'
16339 ldflags='$ldflags'
16340 ldflags_uselargefiles='$ldflags_uselargefiles'
16341 ldlibpthname='$ldlibpthname'
16342 less='$less'
16343 lib_ext='$lib_ext'
16344 libc='$libc'
16345 libperl='$libperl'
16346 libpth='$libpth'
16347 libs='$libs'
16348 libsdirs='$libsdirs'
16349 libsfiles='$libsfiles'
16350 libsfound='$libsfound'
16351 libspath='$libspath'
16352 libswanted='$libswanted'
16353 libswanted_uselargefiles='$libswanted_uselargefiles'
16354 line='$line'
16355 lint='$lint'
16356 lkflags='$lkflags'
16357 ln='$ln'
16358 lns='$lns'
16359 locincpth='$locincpth'
16360 loclibpth='$loclibpth'
16361 longdblsize='$longdblsize'
16362 longlongsize='$longlongsize'
16363 longsize='$longsize'
16364 lp='$lp'
16365 lpr='$lpr'
16366 ls='$ls'
16367 lseeksize='$lseeksize'
16368 lseektype='$lseektype'
16369 mail='$mail'
16370 mailx='$mailx'
16371 make='$make'
16372 make_set_make='$make_set_make'
16373 mallocobj='$mallocobj'
16374 mallocsrc='$mallocsrc'
16375 malloctype='$malloctype'
16376 man1dir='$man1dir'
16377 man1direxp='$man1direxp'
16378 man1ext='$man1ext'
16379 man3dir='$man3dir'
16380 man3direxp='$man3direxp'
16381 man3ext='$man3ext'
16382 mips_type='$mips_type'
16383 mkdir='$mkdir'
16384 mmaptype='$mmaptype'
16385 modetype='$modetype'
16386 more='$more'
16387 multiarch='$multiarch'
16388 mv='$mv'
16389 myarchname='$myarchname'
16390 mydomain='$mydomain'
16391 myhostname='$myhostname'
16392 myuname='$myuname'
16393 n='$n'
16394 need_va_copy='$need_va_copy'
16395 netdb_hlen_type='$netdb_hlen_type'
16396 netdb_host_type='$netdb_host_type'
16397 netdb_name_type='$netdb_name_type'
16398 netdb_net_type='$netdb_net_type'
16399 nm='$nm'
16400 nm_opt='$nm_opt'
16401 nm_so_opt='$nm_so_opt'
16402 nonxs_ext='$nonxs_ext'
16403 nroff='$nroff'
16404 nvEUformat='$nvEUformat'
16405 nvFUformat='$nvFUformat'
16406 nvGUformat='$nvGUformat'
16407 nveformat='$nveformat'
16408 nvfformat='$nvfformat'
16409 nvgformat='$nvgformat'
16410 nvsize='$nvsize'
16411 nvtype='$nvtype'
16412 o_nonblock='$o_nonblock'
16413 obj_ext='$obj_ext'
16414 old_pthread_create_joinable='$old_pthread_create_joinable'
16415 optimize='$optimize'
16416 orderlib='$orderlib'
16417 osname='$osname'
16418 osvers='$osvers'
16419 otherlibdirs='$otherlibdirs'
16420 package='$package'
16421 pager='$pager'
16422 passcat='$passcat'
16423 patchlevel='$patchlevel'
16424 path_sep='$path_sep'
16425 perl5='$perl5'
16426 perl='$perl'
16427 perladmin='$perladmin'
16428 perllibs='$perllibs'
16429 perlpath='$perlpath'
16430 pg='$pg'
16431 phostname='$phostname'
16432 pidtype='$pidtype'
16433 plibpth='$plibpth'
16434 pm_apiversion='$pm_apiversion'
16435 pmake='$pmake'
16436 pr='$pr'
16437 prefix='$prefix'
16438 prefixexp='$prefixexp'
16439 privlib='$privlib'
16440 privlibexp='$privlibexp'
16441 prototype='$prototype'
16442 ptrsize='$ptrsize'
16443 quadkind='$quadkind'
16444 quadtype='$quadtype'
16445 randbits='$randbits'
16446 randfunc='$randfunc'
16447 randseedtype='$randseedtype'
16448 ranlib='$ranlib'
16449 rd_nodata='$rd_nodata'
16450 revision='$revision'
16451 rm='$rm'
16452 rmail='$rmail'
16453 runnm='$runnm'
16454 sPRIEUldbl='$sPRIEUldbl'
16455 sPRIFUldbl='$sPRIFUldbl'
16456 sPRIGUldbl='$sPRIGUldbl'
16457 sPRIXU64='$sPRIXU64'
16458 sPRId64='$sPRId64'
16459 sPRIeldbl='$sPRIeldbl'
16460 sPRIfldbl='$sPRIfldbl'
16461 sPRIgldbl='$sPRIgldbl'
16462 sPRIi64='$sPRIi64'
16463 sPRIo64='$sPRIo64'
16464 sPRIu64='$sPRIu64'
16465 sPRIx64='$sPRIx64'
16466 sSCNfldbl='$sSCNfldbl'
16467 sched_yield='$sched_yield'
16468 scriptdir='$scriptdir'
16469 scriptdirexp='$scriptdirexp'
16470 sed='$sed'
16471 seedfunc='$seedfunc'
16472 selectminbits='$selectminbits'
16473 selecttype='$selecttype'
16474 sendmail='$sendmail'
16475 sh='$sh'
16476 shar='$shar'
16477 sharpbang='$sharpbang'
16478 shmattype='$shmattype'
16479 shortsize='$shortsize'
16480 shrpenv='$shrpenv'
16481 shsharp='$shsharp'
16482 sig_count='$sig_count'
16483 sig_name='$sig_name'
16484 sig_name_init='$sig_name_init'
16485 sig_num='$sig_num'
16486 sig_num_init='$sig_num_init'
16487 sig_size='$sig_size'
16488 signal_t='$signal_t'
16489 sitearch='$sitearch'
16490 sitearchexp='$sitearchexp'
16491 sitebin='$sitebin'
16492 sitebinexp='$sitebinexp'
16493 sitelib='$sitelib'
16494 sitelib_stem='$sitelib_stem'
16495 sitelibexp='$sitelibexp'
16496 siteprefix='$siteprefix'
16497 siteprefixexp='$siteprefixexp'
16498 sizesize='$sizesize'
16499 sizetype='$sizetype'
16500 sleep='$sleep'
16501 smail='$smail'
16502 so='$so'
16503 sockethdr='$sockethdr'
16504 socketlib='$socketlib'
16505 socksizetype='$socksizetype'
16506 sort='$sort'
16507 spackage='$spackage'
16508 spitshell='$spitshell'
16509 src='$src'
16510 ssizetype='$ssizetype'
16511 startperl='$startperl'
16512 startsh='$startsh'
16513 static_ext='$static_ext'
16514 stdchar='$stdchar'
16515 stdio_base='$stdio_base'
16516 stdio_bufsiz='$stdio_bufsiz'
16517 stdio_cnt='$stdio_cnt'
16518 stdio_filbuf='$stdio_filbuf'
16519 stdio_ptr='$stdio_ptr'
16520 stdio_stream_array='$stdio_stream_array'
16521 strings='$strings'
16522 submit='$submit'
16523 subversion='$subversion'
16524 sysman='$sysman'
16525 tail='$tail'
16526 tar='$tar'
16527 tbl='$tbl'
16528 tee='$tee'
16529 test='$test'
16530 timeincl='$timeincl'
16531 timetype='$timetype'
16532 touch='$touch'
16533 tr='$tr'
16534 trnl='$trnl'
16535 troff='$troff'
16536 u16size='$u16size'
16537 u16type='$u16type'
16538 u32size='$u32size'
16539 u32type='$u32type'
16540 u64size='$u64size'
16541 u64type='$u64type'
16542 u8size='$u8size'
16543 u8type='$u8type'
16544 uidformat='$uidformat'
16545 uidsign='$uidsign'
16546 uidsize='$uidsize'
16547 uidtype='$uidtype'
16548 uname='$uname'
16549 uniq='$uniq'
16550 uquadtype='$uquadtype'
16551 use5005threads='$use5005threads'
16552 use64bitall='$use64bitall'
16553 use64bitint='$use64bitint'
16554 usedl='$usedl'
16555 useithreads='$useithreads'
16556 uselargefiles='$uselargefiles'
16557 uselongdouble='$uselongdouble'
16558 usemorebits='$usemorebits'
16559 usemultiplicity='$usemultiplicity'
16560 usemymalloc='$usemymalloc'
16561 usenm='$usenm'
16562 useopcode='$useopcode'
16563 useperlio='$useperlio'
16564 useposix='$useposix'
16565 usesfio='$usesfio'
16566 useshrplib='$useshrplib'
16567 usesocks='$usesocks'
16568 usethreads='$usethreads'
16569 usevendorprefix='$usevendorprefix'
16570 usevfork='$usevfork'
16571 usrinc='$usrinc'
16572 uuname='$uuname'
16573 uvXUformat='$uvXUformat'
16574 uvoformat='$uvoformat'
16575 uvsize='$uvsize'
16576 uvtype='$uvtype'
16577 uvuformat='$uvuformat'
16578 uvxformat='$uvxformat'
16579 vendorarch='$vendorarch'
16580 vendorarchexp='$vendorarchexp'
16581 vendorbin='$vendorbin'
16582 vendorbinexp='$vendorbinexp'
16583 vendorlib='$vendorlib'
16584 vendorlib_stem='$vendorlib_stem'
16585 vendorlibexp='$vendorlibexp'
16586 vendorprefix='$vendorprefix'
16587 vendorprefixexp='$vendorprefixexp'
16588 version='$version'
16589 versiononly='$versiononly'
16590 vi='$vi'
16591 voidflags='$voidflags'
16592 xlibpth='$xlibpth'
16593 xs_apiversion='$xs_apiversion'
16594 zcat='$zcat'
16595 zip='$zip'
16596 EOT
16597
16598 : Add in command line options if available
16599 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16600
16601 : add special variables
16602 $test -f $src/patchlevel.h && \
16603 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16604 echo "CONFIGDOTSH=true" >>config.sh
16605
16606 : propagate old symbols
16607 if $test -f UU/config.sh; then
16608         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16609         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16610         $sort | $uniq -u >UU/oldsyms
16611         set X `cat UU/oldsyms`
16612         shift
16613         case $# in
16614         0) ;;
16615         *)
16616                 cat <<EOM
16617 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16618 EOM
16619                 echo "# Variables propagated from previous config.sh file." >>config.sh
16620                 for sym in `cat UU/oldsyms`; do
16621                         echo "    Propagating $hint variable "'$'"$sym..."
16622                         eval 'tmp="$'"${sym}"'"'
16623                         echo "$tmp" | \
16624                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16625                 done
16626                 ;;
16627         esac
16628 fi
16629
16630 : Finish up by extracting the .SH files
16631 case "$alldone" in
16632 exit)
16633         $rm -rf UU
16634         echo "Done."
16635         exit 0
16636         ;;
16637 cont)
16638         ;;
16639 '')
16640         dflt=''
16641         nostick=true
16642         $cat <<EOM
16643
16644 If you'd like to make any changes to the config.sh file before I begin
16645 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16646
16647 EOM
16648         rp="Press return or use a shell escape to edit config.sh:"
16649         . UU/myread
16650         nostick=''
16651         case "$ans" in
16652         '') ;;
16653         *) : in case they cannot read
16654                 sh 1>&4 -c "$ans";;
16655         esac
16656         ;;
16657 esac
16658
16659 : if this fails, just run all the .SH files by hand
16660 . ./config.sh
16661
16662 echo " "
16663 exec 1>&4
16664 . ./UU/extract
16665
16666 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16667         dflt=y
16668         case "$silent" in
16669         true) ;;
16670         *)
16671                 $cat <<EOM
16672
16673 Now you need to generate make dependencies by running "$make depend".
16674 You might prefer to run it in background: "$make depend > makedepend.out &"
16675 It can take a while, so you might not want to run it right now.
16676
16677 EOM
16678                 ;;
16679         esac
16680         rp="Run $make depend now?"
16681         . UU/myread
16682         case "$ans" in
16683         y*)
16684                 $make depend && echo "Now you must run '$make'."
16685                 ;;
16686         *)
16687                 echo "You must run '$make depend' then '$make'."
16688                 ;;
16689         esac
16690 elif test -f [Mm]akefile; then
16691         echo " "
16692         echo "Now you must run a $make."
16693 else
16694         echo "Done."
16695 fi
16696
16697 if $test -f Policy.sh; then
16698     $cat <<EOM
16699
16700 If you compile $package on a different machine or from a different object
16701 directory, copy the Policy.sh file from this object directory to the
16702 new one before you run Configure -- this will help you with most of
16703 the policy defaults.
16704
16705 EOM
16706 fi
16707 if $test -f config.msg; then
16708     echo "Hmm.  I also noted the following information while running:"
16709     echo " "
16710     $cat config.msg >&4
16711     $rm -f config.msg
16712 fi
16713 $rm -f kit*isdone ark*isdone
16714 $rm -rf UU
16715
16716 : End of Configure
16717