More VMS patches from Peter Prymmer.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Feb 24 20:37:06 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getgrent=''
368 d_getgrps=''
369 d_gethbyaddr=''
370 d_gethbyname=''
371 d_gethent=''
372 aphostname=''
373 d_gethname=''
374 d_phostname=''
375 d_uname=''
376 d_gethostprotos=''
377 d_getlogin=''
378 d_getmnt=''
379 d_getmntent=''
380 d_getnbyaddr=''
381 d_getnbyname=''
382 d_getnent=''
383 d_getnetprotos=''
384 d_getpent=''
385 d_getpgid=''
386 d_getpgrp2=''
387 d_bsdgetpgrp=''
388 d_getpgrp=''
389 d_getppid=''
390 d_getprior=''
391 d_getpbyname=''
392 d_getpbynumber=''
393 d_getprotoprotos=''
394 d_getpwent=''
395 d_getsent=''
396 d_getservprotos=''
397 d_getspent=''
398 d_getspnam=''
399 d_getsbyname=''
400 d_getsbyport=''
401 d_gnulibc=''
402 d_hasmntopt=''
403 d_htonl=''
404 d_iconv=''
405 d_inetaton=''
406 d_int64_t=''
407 d_isascii=''
408 d_killpg=''
409 d_lchown=''
410 d_ldbl_dig=''
411 d_link=''
412 d_locconv=''
413 d_lockf=''
414 d_longdbl=''
415 longdblsize=''
416 d_longlong=''
417 longlongsize=''
418 d_lstat=''
419 d_mblen=''
420 d_mbstowcs=''
421 d_mbtowc=''
422 d_memchr=''
423 d_memcmp=''
424 d_memcpy=''
425 d_memmove=''
426 d_memset=''
427 d_mkdir=''
428 d_mkdtemp=''
429 d_mkfifo=''
430 d_mkstemp=''
431 d_mkstemps=''
432 d_mktime=''
433 d_mmap=''
434 mmaptype=''
435 d_mprotect=''
436 d_msg=''
437 d_msgctl=''
438 d_msgget=''
439 d_msgrcv=''
440 d_msgsnd=''
441 d_msync=''
442 d_munmap=''
443 d_nice=''
444 d_off64_t=''
445 d_open3=''
446 d_fpathconf=''
447 d_pathconf=''
448 d_pause=''
449 d_pipe=''
450 d_poll=''
451 d_portable=''
452 d_old_pthread_create_joinable=''
453 old_pthread_create_joinable=''
454 d_pthread_yield=''
455 d_sched_yield=''
456 sched_yield=''
457 d_readdir=''
458 d_rewinddir=''
459 d_seekdir=''
460 d_telldir=''
461 d_readlink=''
462 d_rename=''
463 d_rmdir=''
464 d_safebcpy=''
465 d_safemcpy=''
466 d_sanemcmp=''
467 d_select=''
468 d_sem=''
469 d_semctl=''
470 d_semget=''
471 d_semop=''
472 d_setegid=''
473 d_seteuid=''
474 d_setgrent=''
475 d_setgrps=''
476 d_sethent=''
477 d_setlinebuf=''
478 d_setlocale=''
479 d_setnent=''
480 d_setpent=''
481 d_setpgid=''
482 d_setpgrp2=''
483 d_bsdsetpgrp=''
484 d_setpgrp=''
485 d_setprior=''
486 d_setpwent=''
487 d_setregid=''
488 d_setresgid=''
489 d_setresuid=''
490 d_setreuid=''
491 d_setrgid=''
492 d_setruid=''
493 d_setsent=''
494 d_setsid=''
495 d_setspent=''
496 d_setvbuf=''
497 d_sfio=''
498 usesfio=''
499 d_shm=''
500 d_shmat=''
501 d_shmatprototype=''
502 shmattype=''
503 d_shmctl=''
504 d_shmdt=''
505 d_shmget=''
506 d_sigaction=''
507 d_sigsetjmp=''
508 d_msg_ctrunc=''
509 d_msg_dontroute=''
510 d_msg_oob=''
511 d_msg_peek=''
512 d_msg_proxy=''
513 d_oldsock=''
514 d_scm_rights=''
515 d_socket=''
516 d_sockpair=''
517 sockethdr=''
518 socketlib=''
519 d_socklen_t=''
520 d_sqrtl=''
521 d_statblks=''
522 d_statfs_f_flags=''
523 d_statfs_s=''
524 d_fstatvfs=''
525 d_statvfs=''
526 d_stdio_cnt_lval=''
527 d_stdio_ptr_lval=''
528 d_stdiobase=''
529 d_stdstdio=''
530 stdio_base=''
531 stdio_bufsiz=''
532 stdio_cnt=''
533 stdio_filbuf=''
534 stdio_ptr=''
535 d_index=''
536 d_strchr=''
537 d_strcoll=''
538 d_strctcpy=''
539 d_strerrm=''
540 d_strerror=''
541 d_sysernlst=''
542 d_syserrlst=''
543 d_strtod=''
544 d_strtol=''
545 d_strtold=''
546 d_strtoll=''
547 d_strtoul=''
548 d_strtoull=''
549 d_strtouq=''
550 d_strxfrm=''
551 d_symlink=''
552 d_syscall=''
553 d_sysconf=''
554 d_system=''
555 d_tcgetpgrp=''
556 d_tcsetpgrp=''
557 d_telldirproto=''
558 d_time=''
559 timetype=''
560 clocktype=''
561 d_times=''
562 d_truncate=''
563 d_tzname=''
564 d_umask=''
565 d_semctl_semid_ds=''
566 d_semctl_semun=''
567 d_union_semun=''
568 d_ustat=''
569 d_vfork=''
570 usevfork=''
571 d_voidsig=''
572 signal_t=''
573 d_volatile=''
574 d_charvspr=''
575 d_vprintf=''
576 d_wait4=''
577 d_waitpid=''
578 d_wcstombs=''
579 d_wctomb=''
580 dlext=''
581 cccdlflags=''
582 ccdlflags=''
583 dlsrc=''
584 ld=''
585 lddlflags=''
586 usedl=''
587 doublesize=''
588 ebcdic=''
589 fflushNULL=''
590 fflushall=''
591 fpossize=''
592 fpostype=''
593 gidformat=''
594 gidsign=''
595 gidsize=''
596 gidtype=''
597 groupstype=''
598 h_fcntl=''
599 h_sysfile=''
600 i_arpainet=''
601 db_hashtype=''
602 db_prefixtype=''
603 i_db=''
604 i_dbm=''
605 i_rpcsvcdbm=''
606 d_dirnamlen=''
607 direntrytype=''
608 i_dirent=''
609 i_dld=''
610 i_dlfcn=''
611 i_fcntl=''
612 i_float=''
613 i_gdbm=''
614 d_grpasswd=''
615 i_grp=''
616 i_iconv=''
617 i_inttypes=''
618 i_limits=''
619 i_locale=''
620 i_machcthr=''
621 i_malloc=''
622 i_math=''
623 i_memory=''
624 i_mntent=''
625 i_ndbm=''
626 i_netdb=''
627 i_neterrno=''
628 i_netinettcp=''
629 i_niin=''
630 i_sysin=''
631 i_poll=''
632 i_pthread=''
633 d_pwage=''
634 d_pwchange=''
635 d_pwclass=''
636 d_pwcomment=''
637 d_pwexpire=''
638 d_pwgecos=''
639 d_pwpasswd=''
640 d_pwquota=''
641 i_pwd=''
642 i_sfio=''
643 i_shadow=''
644 i_socks=''
645 i_stddef=''
646 i_stdlib=''
647 i_string=''
648 strings=''
649 i_sysaccess=''
650 i_sysdir=''
651 i_sysfile=''
652 d_voidtty=''
653 i_bsdioctl=''
654 i_sysfilio=''
655 i_sysioctl=''
656 i_syssockio=''
657 i_syslog=''
658 i_sysmman=''
659 i_sysmode=''
660 i_sysmount=''
661 i_sysndir=''
662 i_sysparam=''
663 i_sysresrc=''
664 i_syssecrt=''
665 i_sysselct=''
666 i_sysstat=''
667 i_sysstatfs=''
668 i_sysstatvfs=''
669 i_systimes=''
670 i_systypes=''
671 i_sysuio=''
672 i_sysun=''
673 i_sysutsname=''
674 i_sysvfs=''
675 i_syswait=''
676 i_sgtty=''
677 i_termio=''
678 i_termios=''
679 i_systime=''
680 i_systimek=''
681 i_time=''
682 timeincl=''
683 i_unistd=''
684 i_ustat=''
685 i_utime=''
686 i_values=''
687 i_stdarg=''
688 i_varargs=''
689 i_varhdr=''
690 i_vfork=''
691 inc_version_list=''
692 inc_version_list_init=''
693 installprefix=''
694 installprefixexp=''
695 installstyle=''
696 installusrbinperl=''
697 intsize=''
698 longsize=''
699 shortsize=''
700 libc=''
701 ldlibpthname=''
702 libperl=''
703 shrpenv=''
704 useshrplib=''
705 glibpth=''
706 libpth=''
707 loclibpth=''
708 plibpth=''
709 xlibpth=''
710 ignore_versioned_solibs=''
711 libs=''
712 libsdirs=''
713 libsfiles=''
714 libsfound=''
715 libspath=''
716 lns=''
717 d_PRIEldbl=''
718 d_PRIFldbl=''
719 d_PRIGldbl=''
720 d_PRIeldbl=''
721 d_PRIfldbl=''
722 d_PRIgldbl=''
723 sPRIEldbl=''
724 sPRIFldbl=''
725 sPRIGldbl=''
726 sPRIeldbl=''
727 sPRIfldbl=''
728 sPRIgldbl=''
729 lseeksize=''
730 lseektype=''
731 make_set_make=''
732 d_mymalloc=''
733 freetype=''
734 mallocobj=''
735 mallocsrc=''
736 malloctype=''
737 usemymalloc=''
738 installman1dir=''
739 man1dir=''
740 man1direxp=''
741 man1ext=''
742 installman3dir=''
743 man3dir=''
744 man3direxp=''
745 man3ext=''
746 huge=''
747 large=''
748 medium=''
749 models=''
750 small=''
751 split=''
752 modetype=''
753 multiarch=''
754 mydomain=''
755 myhostname=''
756 phostname=''
757 c=''
758 n=''
759 d_eofnblk=''
760 eagain=''
761 o_nonblock=''
762 rd_nodata=''
763 netdb_hlen_type=''
764 netdb_host_type=''
765 netdb_name_type=''
766 netdb_net_type=''
767 groupcat=''
768 hostcat=''
769 passcat=''
770 orderlib=''
771 ranlib=''
772 package=''
773 spackage=''
774 pager=''
775 api_revision=''
776 api_subversion=''
777 api_version=''
778 api_versionstring=''
779 patchlevel=''
780 subversion=''
781 version=''
782 perladmin=''
783 perlpath=''
784 d_nv_preserves_uv=''
785 i16size=''
786 i16type=''
787 i32size=''
788 i32type=''
789 i64size=''
790 i64type=''
791 i8size=''
792 i8type=''
793 ivsize=''
794 ivtype=''
795 nvsize=''
796 nvtype=''
797 u16size=''
798 u16type=''
799 u32size=''
800 u32type=''
801 u64size=''
802 u64type=''
803 u8size=''
804 u8type=''
805 uvsize=''
806 uvtype=''
807 ivdformat=''
808 uvoformat=''
809 uvuformat=''
810 uvxformat=''
811 pidtype=''
812 prefix=''
813 prefixexp=''
814 installprivlib=''
815 privlib=''
816 privlibexp=''
817 prototype=''
818 ptrsize=''
819 d_PRIX64=''
820 d_PRId64=''
821 d_PRIi64=''
822 d_PRIo64=''
823 d_PRIu64=''
824 d_PRIx64=''
825 sPRIX64=''
826 sPRId64=''
827 sPRIi64=''
828 sPRIo64=''
829 sPRIu64=''
830 sPRIx64=''
831 d_quad=''
832 quadkind=''
833 quadtype=''
834 uquadtype=''
835 drand01=''
836 randbits=''
837 randfunc=''
838 randseedtype=''
839 seedfunc=''
840 installscript=''
841 scriptdir=''
842 scriptdirexp=''
843 selectminbits=''
844 selecttype=''
845 sh=''
846 sig_count=''
847 sig_name=''
848 sig_name_init=''
849 sig_num=''
850 sig_num_init=''
851 installsitearch=''
852 sitearch=''
853 sitearchexp=''
854 installsitebin=''
855 sitebin=''
856 sitebinexp=''
857 installsitelib=''
858 sitelib=''
859 sitelibexp=''
860 siteprefix=''
861 siteprefixexp=''
862 sizetype=''
863 so=''
864 sharpbang=''
865 shsharp=''
866 spitshell=''
867 src=''
868 ssizetype=''
869 startperl=''
870 startsh=''
871 stdchar=''
872 d_stdio_stream_array=''
873 stdio_stream_array=''
874 sysman=''
875 trnl=''
876 uidformat=''
877 uidsign=''
878 uidsize=''
879 uidtype=''
880 archname64=''
881 use64bits=''
882 uselargefiles=''
883 uselongdouble=''
884 usemorebits=''
885 usemultiplicity=''
886 nm_opt=''
887 nm_so_opt=''
888 runnm=''
889 usenm=''
890 useperlio=''
891 usesocks=''
892 d_oldpthreads=''
893 use5005threads=''
894 useithreads=''
895 usethreads=''
896 incpath=''
897 mips_type=''
898 usrinc=''
899 d_vendorbin=''
900 installvendorbin=''
901 vendorbin=''
902 vendorbinexp=''
903 d_vendorlib=''
904 installvendorlib=''
905 vendorlib=''
906 vendorlibexp=''
907 usevendorprefix=''
908 vendorprefix=''
909 vendorprefixexp=''
910 defvoidused=''
911 voidflags=''
912 pm_apiversion=''
913 xs_apiversion=''
914 CONFIG=''
915
916 define='define'
917 undef='undef'
918 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
919 rmlist=''
920
921 : We must find out about Eunice early
922 eunicefix=':'
923 if test -f /etc/unixtovms; then
924         eunicefix=/etc/unixtovms
925 fi
926 if test -f /etc/unixtovms.exe; then
927         eunicefix=/etc/unixtovms.exe
928 fi
929
930 i_whoami=''
931 : set useposix=false in your hint file to disable the POSIX extension.
932 useposix=true
933 : set useopcode=false in your hint file to disable the Opcode extension.
934 useopcode=true
935 : Trailing extension.  Override this in a hint file, if needed.
936 _exe=''
937 : Extra object files, if any, needed on this platform.
938 archobjs=''
939 : Possible local include directories to search.
940 : Set locincpth to "" in a hint file to defeat local include searches.
941 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
942 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
943 :
944 : no include file wanted by default
945 inclwanted=''
946
947 groupstype=''
948 : change the next line if compiling for Xenix/286 on Xenix/386
949 xlibpth='/usr/lib/386 /lib/386'
950 : Possible local library directories to search.
951 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
952 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
953
954 : general looking path for locating libraries
955 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
956 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
957 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
958 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
959 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
960
961 : Private path used by Configure to find libraries.  Its value
962 : is prepended to libpth. This variable takes care of special
963 : machines, like the mips.  Usually, it should be empty.
964 plibpth=''
965
966 : default library list
967 libswanted=''
968 : some systems want to use only the non-versioned libso:s
969 ignore_versioned_solibs=''
970 : set usemultiplicity on the Configure command line to enable multiplicity.
971 : set usesocks on the Configure command line to enable socks.
972 : set usethreads on the Configure command line to enable threads.
973 : full support for void wanted by default
974 defvoidused=15
975
976 : List of libraries we want.
977 : If anyone needs -lnet, put it in a hint file.
978 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
979 libswanted="$libswanted dld ld sun m c cposix posix"
980 libswanted="$libswanted ndir dir crypt sec"
981 libswanted="$libswanted ucb bsd BSD PW x"
982 : We probably want to search /usr/shlib before most other libraries.
983 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
984 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
985 glibpth="/usr/shlib $glibpth"
986 : Do not use vfork unless overridden by a hint file.
987 usevfork=false
988
989 : Find the basic shell for Bourne shell scripts
990 case "$sh" in
991 '')
992         case "$SYSTYPE" in
993         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
994         *) xxx='/bin/sh';;
995         esac
996         if test -f "$xxx"; then
997                 sh="$xxx"
998         else
999                 : Build up a list and do a single loop so we can 'break' out.
1000                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1001                 for xxx in sh bash ksh pdksh ash; do
1002                         for p in $pth; do
1003                                 try="$try ${p}/${xxx}"
1004                         done
1005                 done
1006                 for xxx in $try; do
1007                         if test -f "$xxx"; then
1008                                 sh="$xxx";
1009                                 break
1010                         elif test -f "$xxx.exe"; then
1011                                 sh="$xxx";
1012                                 break
1013                         fi
1014                 done
1015         fi
1016         ;;
1017 esac
1018
1019 case "$sh" in
1020 '')     cat <<EOM >&2
1021 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1022
1023 Usually it's in /bin/sh.  How did you even get this far?
1024 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1025 we'll try to straighten this all out.
1026 EOM
1027         exit 1
1028         ;;
1029 esac
1030
1031 : see if sh knows # comments
1032 if `$sh -c '#' >/dev/null 2>&1`; then
1033         shsharp=true
1034         spitshell=cat
1035         xcat=/bin/cat
1036         test -f $xcat || xcat=/usr/bin/cat
1037         echo "#!$xcat" >try
1038         $eunicefix try
1039         chmod +x try
1040         ./try > today
1041         if test -s today; then
1042                 sharpbang='#!'
1043         else
1044                 echo "#! $xcat" > try
1045                 $eunicefix try
1046                 chmod +x try
1047                 ./try > today
1048                 if test -s today; then
1049                         sharpbang='#! '
1050                 else
1051                         sharpbang=': use '
1052                 fi
1053         fi
1054 else
1055         echo " "
1056         echo "Your $sh doesn't grok # comments--I will strip them later on."
1057         shsharp=false
1058         cd ..
1059         echo "exec grep -v '^[  ]*#'" >spitshell
1060         chmod +x spitshell
1061         $eunicefix spitshell
1062         spitshell=`pwd`/spitshell
1063         cd UU
1064         echo "I presume that if # doesn't work, #! won't work either!"
1065         sharpbang=': use '
1066 fi
1067 rm -f try today
1068
1069 : figure out how to guarantee sh startup
1070 case "$startsh" in
1071 '') startsh=${sharpbang}${sh} ;;
1072 *)
1073 esac
1074 cat >try <<EOSS
1075 $startsh
1076 set abc
1077 test "$?abc" != 1
1078 EOSS
1079
1080 chmod +x try
1081 $eunicefix try
1082 if ./try; then
1083         : echo "Yup, it does."
1084 else
1085         echo "Hmm... '$startsh' does not guarantee sh startup..."
1086         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1087 fi
1088 rm -f try
1089
1090
1091 : Save command line options in file UU/cmdline.opt for later use in
1092 : generating config.sh.
1093 cat > cmdline.opt <<EOSH
1094 # Configure command line arguments.
1095 config_arg0='$0'
1096 config_args='$*'
1097 config_argc=$#
1098 EOSH
1099 argn=1
1100 for arg in "$@"; do
1101         cat >>cmdline.opt <<EOSH
1102 config_arg$argn='$arg'
1103 EOSH
1104         argn=`expr $argn + 1`
1105 done
1106
1107 : produce awk script to parse command line options
1108 cat >options.awk <<'EOF'
1109 BEGIN {
1110         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1111
1112         len = length(optstr);
1113         for (i = 1; i <= len; i++) {
1114                 c = substr(optstr, i, 1);
1115                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1116                 if (a == ":") {
1117                         arg[c] = 1;
1118                         i++;
1119                 }
1120                 opt[c] = 1;
1121         }
1122 }
1123 {
1124         expect = 0;
1125         str = $0;
1126         if (substr(str, 1, 1) != "-") {
1127                 printf("'%s'\n", str);
1128                 next;
1129         }
1130         len = length($0);
1131         for (i = 2; i <= len; i++) {
1132                 c = substr(str, i, 1);
1133                 if (!opt[c]) {
1134                         printf("-%s\n", substr(str, i));
1135                         next;
1136                 }
1137                 printf("-%s\n", c);
1138                 if (arg[c]) {
1139                         if (i < len)
1140                                 printf("'%s'\n", substr(str, i + 1));
1141                         else
1142                                 expect = 1;
1143                         next;
1144                 }
1145         }
1146 }
1147 END {
1148         if (expect)
1149                 print "?";
1150 }
1151 EOF
1152
1153 : process the command line options
1154 set X `for arg in "$@"; do echo "X$arg"; done |
1155         sed -e s/X// | awk -f options.awk`
1156 eval "set $*"
1157 shift
1158 rm -f options.awk
1159
1160 : set up default values
1161 fastread=''
1162 reuseval=false
1163 config_sh=''
1164 alldone=''
1165 error=''
1166 silent=''
1167 extractsh=''
1168 override=''
1169 knowitall=''
1170 rm -f optdef.sh posthint.sh
1171 cat >optdef.sh <<EOS
1172 $startsh
1173 EOS
1174
1175
1176 : option parsing
1177 while test $# -gt 0; do
1178         case "$1" in
1179         -d) shift; fastread=yes;;
1180         -e) shift; alldone=cont;;
1181         -f)
1182                 shift
1183                 cd ..
1184                 if test -r "$1"; then
1185                         config_sh="$1"
1186                 else
1187                         echo "$me: cannot read config file $1." >&2
1188                         error=true
1189                 fi
1190                 cd UU
1191                 shift;;
1192         -h) shift; error=true;;
1193         -r) shift; reuseval=true;;
1194         -s) shift; silent=true; realsilent=true;;
1195         -E) shift; alldone=exit;;
1196         -K) shift; knowitall=true;;
1197         -O) shift; override=true;;
1198         -S) shift; silent=true; extractsh=true;;
1199         -D)
1200                 shift
1201                 case "$1" in
1202                 *=)
1203                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1204                         echo "$me: ignoring -D $1" >&2
1205                         ;;
1206                 *=*) echo "$1" | \
1207                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1208                 *) echo "$1='define'" >> optdef.sh;;
1209                 esac
1210                 shift
1211                 ;;
1212         -U)
1213                 shift
1214                 case "$1" in
1215                 *=) echo "$1" >> optdef.sh;;
1216                 *=*)
1217                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1218                         echo "$me: ignoring -U $1" >&2
1219                         ;;
1220                 *) echo "$1='undef'" >> optdef.sh;;
1221                 esac
1222                 shift
1223                 ;;
1224         -A)
1225             shift
1226             xxx=''
1227             yyy="$1"
1228             zzz=''
1229             uuu=undef
1230             case "$yyy" in
1231             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1232                  case "$zzz" in
1233                  *:*) zzz='' ;;
1234                  *)   xxx=append
1235                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1236                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1237                  esac
1238                  ;;
1239             esac
1240             case "$xxx" in
1241             '')  case "$yyy" in
1242                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1243                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1244                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1245                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1246                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1247                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1248                  esac
1249                  ;;       
1250             esac
1251             case "$xxx" in
1252             append)
1253                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1254             clear)
1255                 echo "$yyy=''"                  >> posthint.sh ;;
1256             define)
1257                 case "$zzz" in
1258                 '') zzz=define ;;
1259                 esac
1260                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1261             eval)
1262                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1263             prepend)
1264                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1265             undef)
1266                 case "$zzz" in
1267                 '') zzz="$uuu" ;;
1268                 esac
1269                 echo "$yyy=$zzz"                >> posthint.sh ;;
1270             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1271             esac
1272             shift
1273             ;;
1274         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1275             exit 0;;
1276         --) break;;
1277         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1278         *) break;;
1279         esac
1280 done
1281
1282 case "$error" in
1283 true)
1284         cat >&2 <<EOM
1285 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1286                  [-U symbol] [-U symbol=] [-A command:symbol...]
1287   -d : use defaults for all answers.
1288   -e : go on without questioning past the production of config.sh.
1289   -f : specify an alternate default configuration file.
1290   -h : print this help message and exit (with an error status).
1291   -r : reuse C symbols value if possible (skips costly nm extraction).
1292   -s : silent mode, only echoes questions and essential information.
1293   -D : define symbol to have some value:
1294          -D symbol         symbol gets the value 'define'
1295          -D symbol=value   symbol gets the value 'value'
1296   -E : stop at the end of questions, after having produced config.sh.
1297   -K : do not use unless you know what you are doing.
1298   -O : let -D and -U override definitions from loaded configuration file.
1299   -S : perform variable substitutions on all .SH files (can mix with -f)
1300   -U : undefine symbol:
1301          -U symbol    symbol gets the value 'undef'
1302          -U symbol=   symbol gets completely empty
1303   -A : manipulate symbol after the platform specific hints have been applied:
1304          -A symbol=value                append " "value to symbol
1305          -A append:symbol=value         append value to symbol
1306          -A define:symbol=value         define symbol to have value
1307          -A clear:symbol                define symbol to be ''
1308          -A define:symbol               define symbol to be 'define'
1309          -A eval:symbol=value           define symbol to be eval of value
1310          -A prepend:symbol=value        prepend value to symbol
1311          -A undef:symbol                define symbol to be 'undef'
1312          -A undef:symbol=               define symbol to be ''
1313   -V : print version number and exit (with a zero status).
1314 EOM
1315         exit 1
1316         ;;
1317 esac
1318
1319 : Sanity checks
1320 case "$fastread$alldone" in
1321 yescont|yesexit) ;;
1322 *)
1323         if test ! -t 0; then
1324                 echo "Say 'sh Configure', not 'sh <Configure'"
1325                 exit 1
1326         fi
1327         ;;
1328 esac
1329
1330 exec 4>&1
1331 case "$silent" in
1332 true) exec 1>/dev/null;;
1333 esac
1334
1335 : run the defines and the undefines, if any, but leave the file out there...
1336 touch optdef.sh
1337 . ./optdef.sh
1338 : create the posthint manipulation script and leave the file out there...
1339 touch posthint.sh
1340
1341 : set package name
1342 package=perl5
1343 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1344 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1345 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1346 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1347 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1348 esac
1349
1350 : Some greps do not return status, grrr.
1351 echo "grimblepritz" >grimble
1352 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1353         contains=contains
1354 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1355         contains=grep
1356 else
1357         contains=contains
1358 fi
1359 rm -f grimble
1360 : the following should work in any shell
1361 case "$contains" in
1362 contains*)
1363         echo " "
1364         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1365         cat >contains <<'EOSS'
1366 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1367 EOSS
1368 chmod +x contains
1369 esac
1370
1371 : Find the path to the source tree
1372 case "$src" in
1373 '') case "$0" in
1374     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1375          case "$src" in
1376          /*)    ;;
1377          *)     src=`cd ../$src && pwd` ;;
1378          esac
1379          ;;
1380     *)   src='.';;
1381     esac;;
1382 esac
1383 case "$src" in
1384 '')     src=/
1385         rsrc=/
1386         ;;
1387 /*) rsrc="$src";;
1388 *) rsrc="../$src";;
1389 esac
1390 if test -f $rsrc/Configure && \
1391         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1392 then
1393    : found it, so we are ok.
1394 else
1395         rsrc=''
1396         for src in . .. ../.. ../../.. ../../../..; do
1397                 if test -f ../$src/Configure && \
1398                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1399                 then
1400                         rsrc=../$src
1401                         break
1402                 fi
1403         done
1404 fi
1405 case "$rsrc" in
1406 '')
1407         cat <<EOM >&4
1408
1409 Sorry, I can't seem to locate the source dir for $package.  Please start
1410 Configure with an explicit path -- i.e. /some/path/Configure.
1411
1412 EOM
1413         exit 1
1414         ;;
1415 ../.)   rsrc='..';;
1416 *)
1417         echo " "
1418         echo "Sources for $package found in \"$src\"." >&4
1419         ;;
1420 esac
1421
1422 : script used to extract .SH files with variable substitutions
1423 cat >extract <<'EOS'
1424 CONFIGDOTSH=true
1425 echo "Doing variable substitutions on .SH files..."
1426 if test -f $src/MANIFEST; then
1427         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1428 else
1429         echo "(Looking for .SH files under the source directory.)"
1430         set x `(cd $src; find . -name "*.SH" -print)`
1431 fi
1432 shift
1433 case $# in
1434 0) set x `(cd $src; echo *.SH)`; shift;;
1435 esac
1436 if test ! -f $src/$1; then
1437         shift
1438 fi
1439 mkdir_p='
1440 name=$1;
1441 create="";
1442 while test $name; do
1443         if test ! -d "$name"; then
1444                 create="$name $create";
1445                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1446                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1447         else
1448                 name="";
1449         fi;
1450 done;
1451 for file in $create; do
1452         mkdir $file;
1453 done
1454 '
1455 for file in $*; do
1456         case "$src" in
1457         ".")
1458                 case "$file" in
1459                 */*)
1460                         dir=`expr X$file : 'X\(.*\)/'`
1461                         file=`expr X$file : 'X.*/\(.*\)'`
1462                         (cd $dir && . ./$file)
1463                         ;;
1464                 *)
1465                         . ./$file
1466                         ;;
1467                 esac
1468                 ;;
1469         *)
1470                 case "$file" in
1471                 */*)
1472                         dir=`expr X$file : 'X\(.*\)/'`
1473                         file=`expr X$file : 'X.*/\(.*\)'`
1474                         (set x $dir; shift; eval $mkdir_p)
1475                         sh <$src/$dir/$file
1476                         ;;
1477                 *)
1478                         sh <$src/$file
1479                         ;;
1480                 esac
1481                 ;;
1482         esac
1483 done
1484 if test -f $src/config_h.SH; then
1485         if test ! -f config.h; then
1486         : oops, they left it out of MANIFEST, probably, so do it anyway.
1487         . $src/config_h.SH
1488         fi
1489 fi
1490 EOS
1491
1492 : extract files and exit if asked to do so
1493 case "$extractsh" in
1494 true)
1495         case "$realsilent" in
1496         true) ;;
1497         *) exec 1>&4;;
1498         esac
1499         case "$config_sh" in
1500         '') config_sh='config.sh';;
1501         esac
1502         echo " "
1503         echo "Fetching answers from $config_sh..."
1504         cd ..
1505         . $config_sh
1506         test "$override" && . ./optdef.sh
1507         echo " "
1508         . UU/extract
1509         rm -rf UU
1510         echo "Done."
1511         exit 0
1512         ;;
1513 esac
1514
1515 : Eunice requires " " instead of "", can you believe it
1516 echo " "
1517 : Here we go...
1518 echo "Beginning of configuration questions for $package."
1519
1520 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1521
1522 : first determine how to suppress newline on echo command
1523 echo " "
1524 echo "Checking echo to see how to suppress newlines..."
1525 (echo "hi there\c" ; echo " ") >.echotmp
1526 if $contains c .echotmp >/dev/null 2>&1 ; then
1527         echo "...using -n."
1528         n='-n'
1529         c=''
1530 else
1531         cat <<'EOM'
1532 ...using \c
1533 EOM
1534         n=''
1535         c='\c'
1536 fi
1537 echo $n "The star should be here-->$c"
1538 echo '*'
1539 rm -f .echotmp
1540
1541 : Now test for existence of everything in MANIFEST
1542 echo " "
1543 if test -f $rsrc/MANIFEST; then
1544         echo "First let's make sure your kit is complete.  Checking..." >&4
1545         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1546         rm -f missing
1547         tmppwd=`pwd`
1548         for filelist in x??; do
1549                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1550         done
1551         if test -s missing; then
1552                 cat missing >&4
1553                 cat >&4 <<'EOM'
1554
1555 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1556
1557 You have the option of continuing the configuration process, despite the
1558 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1559 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1560 and contact the author (perlbug@perl.com).
1561
1562 EOM
1563                 echo $n "Continue? [n] $c" >&4
1564                 read ans
1565                 case "$ans" in
1566                 y*)
1567                         echo "Continuing..." >&4
1568                         rm -f missing
1569                         ;;
1570                 *)
1571                         echo "ABORTING..." >&4
1572                         kill $$
1573                         ;;
1574                 esac
1575         else
1576                 echo "Looks good..."
1577         fi
1578 else
1579         echo "There is no MANIFEST file.  I hope your kit is complete !"
1580 fi
1581 rm -f missing x??
1582
1583 echo " "
1584 : Find the appropriate value for a newline for tr
1585 if test -n "$DJGPP"; then
1586        trnl='\012'
1587 fi
1588 if test X"$trnl" = X; then
1589         case "`echo foo|tr '\n' x 2>/dev/null`" in
1590         foox) trnl='\n' ;;
1591         esac
1592 fi
1593 if test X"$trnl" = X; then
1594         case "`echo foo|tr '\012' x 2>/dev/null`" in
1595         foox) trnl='\012' ;;
1596         esac
1597 fi
1598 if test X"$trnl" = X; then
1599         cat <<EOM >&2
1600
1601 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1602
1603 EOM
1604         exit 1
1605 fi
1606
1607 : compute the number of columns on the terminal for proper question formatting
1608 case "$COLUMNS" in
1609 '') COLUMNS='80';;
1610 esac
1611
1612 : set up the echo used in my read
1613 myecho="case \"\$xxxm\" in
1614 '') echo $n \"\$rp $c\" >&4;;
1615 *) case \"\$rp\" in
1616         '') echo $n \"[\$xxxm] $c\";;
1617         *)
1618                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1619                         echo \"\$rp\" >&4
1620                         echo $n \"[\$xxxm] $c\" >&4
1621                 else
1622                         echo $n \"\$rp [\$xxxm] $c\" >&4
1623                 fi
1624                 ;;
1625         esac;;
1626 esac"
1627
1628 : now set up to do reads with possible shell escape and default assignment
1629 cat <<EOSC >myread
1630 $startsh
1631 xxxm=\$dflt
1632 $myecho
1633 ans='!'
1634 case "\$fastread" in
1635 yes) case "\$dflt" in
1636         '') ;;
1637         *) ans='';
1638                 case "\$silent-\$rp" in
1639                 true-) ;;
1640                 *) echo " " >&4;;
1641                 esac;;
1642         esac;;
1643 *) case "\$silent" in
1644         true) case "\$rp" in
1645                 '') ans='';;
1646                 esac;;
1647         esac;;
1648 esac
1649 while expr "X\$ans" : "X!" >/dev/null; do
1650         read answ
1651         set x \$xxxm
1652         shift
1653         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1654         case  "\$answ" in
1655         "!")
1656                 sh 1>&4
1657                 echo " "
1658                 $myecho
1659                 ;;
1660         !*)
1661                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1662                 shift
1663                 sh 1>&4 -c "\$*"
1664                 echo " "
1665                 $myecho
1666                 ;;
1667         "\$ans")
1668                 case "\$ans" in
1669                 \\&*)
1670                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1671                         shift
1672                         case "\$1" in
1673                         -d)
1674                                 fastread=yes
1675                                 echo "(OK, I'll run with -d after this question.)" >&4
1676                                 ;;
1677                         -*)
1678                                 echo "*** Sorry, \$1 not supported yet." >&4
1679                                 ;;
1680                         esac
1681                         $myecho
1682                         ans=!
1683                         ;;
1684                 esac;;
1685         *)
1686                 case "\$aok" in
1687                 y)
1688                         echo "*** Substitution done -- please confirm."
1689                         xxxm="\$ans"
1690                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1691                         xxxm="\$ans"
1692                         ans=!
1693                         ;;
1694                 *)
1695                         echo "*** Error -- try again."
1696                         ans=!
1697                         ;;
1698                 esac
1699                 $myecho
1700                 ;;
1701         esac
1702         case "\$ans\$xxxm\$nostick" in
1703         '')
1704                 ans=!
1705                 $myecho
1706                 ;;
1707         esac
1708 done
1709 case "\$ans" in
1710 '') ans="\$xxxm";;
1711 esac
1712 EOSC
1713
1714 : create .config dir to save info across Configure sessions
1715 test -d ../.config || mkdir ../.config
1716 cat >../.config/README <<EOF
1717 This directory created by Configure to save information that should
1718 persist across sessions for $package.
1719
1720 You may safely delete it if you wish.
1721 EOF
1722
1723 : general instructions
1724 needman=true
1725 firsttime=true
1726 user=`(logname) 2>/dev/null`
1727 case "$user" in
1728 '') user=`whoami 2>&1`;;
1729 esac
1730 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1731         firsttime=false
1732         echo " "
1733         rp='Would you like to see the instructions?'
1734         dflt=n
1735         . ./myread
1736         case "$ans" in
1737         [yY]*) ;;
1738         *) needman=false;;
1739         esac
1740 fi
1741 if $needman; then
1742         cat <<EOH
1743
1744 This installation shell script will examine your system and ask you questions
1745 to determine how the perl5 package should be installed. If you get
1746 stuck on a question, you may use a ! shell escape to start a subshell or
1747 execute a command.  Many of the questions will have default answers in square
1748 brackets; typing carriage return will give you the default.
1749
1750 On some of the questions which ask for file or directory names you are allowed
1751 to use the ~name construct to specify the login directory belonging to "name",
1752 even if you don't have a shell which knows about that.  Questions where this is
1753 allowed will be marked "(~name ok)".
1754
1755 EOH
1756         rp=''
1757         dflt='Type carriage return to continue'
1758         . ./myread
1759         cat <<'EOH'
1760
1761 The prompter used in this script allows you to use shell variables and
1762 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1763 in the default answer, as if the default line was a set of arguments given to a
1764 script shell.  This means you may also use $* to repeat the whole default line,
1765 so you do not have to re-type everything to add something to the default.
1766
1767 Everytime there is a substitution, you will have to confirm.  If there is an
1768 error (e.g. an unmatched backtick), the default answer will remain unchanged
1769 and you will be prompted again.
1770
1771 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1772 the questions and use the computed defaults (or the previous answers if there
1773 was already a config.sh file). Type 'Configure -h' for a list of options.
1774 You may also start interactively and then answer '& -d' at any prompt to turn
1775 on the non-interactive behaviour for the remainder of the execution.
1776
1777 EOH
1778         . ./myread
1779         cat <<EOH
1780
1781 Much effort has been expended to ensure that this shell script will run on any
1782 Unix system.  If despite that it blows up on yours, your best bet is to edit
1783 Configure and run it again.  If you can't run Configure for some reason,
1784 you'll have to generate a config.sh file by hand.  Whatever problems you
1785 have, let me (perlbug@perl.com) know how I blew it.
1786
1787 This installation script affects things in two ways:
1788
1789 1) it may do direct variable substitutions on some of the files included
1790    in this kit.
1791 2) it builds a config.h file for inclusion in C programs.  You may edit
1792    any of these files as the need arises after running this script.
1793
1794 If you make a mistake on a question, there is no easy way to back up to it
1795 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1796 files.  Configure will offer to let you do this before it runs the SH files.
1797
1798 EOH
1799         dflt='Type carriage return to continue'
1800         . ./myread
1801         case "$firsttime" in
1802         true) echo $user >>../.config/instruct;;
1803         esac
1804 fi
1805
1806 : find out where common programs are
1807 echo " "
1808 echo "Locating common programs..." >&4
1809 cat <<EOSC >loc
1810 $startsh
1811 case \$# in
1812 0) exit 1;;
1813 esac
1814 thing=\$1
1815 shift
1816 dflt=\$1
1817 shift
1818 for dir in \$*; do
1819         case "\$thing" in
1820         .)
1821         if test -d \$dir/\$thing; then
1822                 echo \$dir
1823                 exit 0
1824         fi
1825         ;;
1826         *)
1827         for thisthing in \$dir/\$thing; do
1828                 : just loop through to pick last item
1829         done
1830         if test -f \$thisthing; then
1831                 echo \$thisthing
1832                 exit 0
1833         elif test -f \$dir/\$thing.exe; then
1834                 if test -n "$DJGPP"; then
1835                         echo \$dir/\$thing.exe
1836                 else
1837                         : on Eunice apparently
1838                         echo \$dir/\$thing
1839                 fi
1840                 exit 0
1841         fi
1842         ;;
1843         esac
1844 done
1845 echo \$dflt
1846 exit 1
1847 EOSC
1848 chmod +x loc
1849 $eunicefix loc
1850 loclist="
1851 awk
1852 cat
1853 comm
1854 cp
1855 echo
1856 expr
1857 grep
1858 ls
1859 make
1860 mkdir
1861 rm
1862 sed
1863 sort
1864 touch
1865 tr
1866 uniq
1867 "
1868 trylist="
1869 Mcc
1870 ar
1871 byacc
1872 cpp
1873 csh
1874 date
1875 egrep
1876 gzip
1877 less
1878 ln
1879 more
1880 nm
1881 nroff
1882 perl
1883 pg
1884 test
1885 uname
1886 zip
1887 "
1888 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1889 pth="$pth /lib /usr/lib"
1890 for file in $loclist; do
1891         eval xxx=\$$file
1892         case "$xxx" in
1893         /*|?:[\\/]*)
1894                 if test -f "$xxx"; then
1895                         : ok
1896                 else
1897                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1898                         xxx=`./loc $file $file $pth`
1899                 fi
1900                 ;;
1901         '') xxx=`./loc $file $file $pth`;;
1902         *) xxx=`./loc $xxx $xxx $pth`;;
1903         esac
1904         eval $file=$xxx
1905         eval _$file=$xxx
1906         case "$xxx" in
1907         /*)
1908                 echo $file is in $xxx.
1909                 ;;
1910         ?:[\\/]*)
1911                 echo $file is in $xxx.
1912                 ;;
1913         *)
1914                 echo "I don't know where '$file' is, and my life depends on it." >&4
1915                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1916                 exit 1
1917                 ;;
1918         esac
1919 done
1920 echo " "
1921 echo "Don't worry if any of the following aren't found..."
1922 say=offhand
1923 for file in $trylist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't see $file out there, $say."
1948                 say=either
1949                 ;;
1950         esac
1951 done
1952 case "$egrep" in
1953 egrep)
1954         echo "Substituting grep for egrep."
1955         egrep=$grep
1956         ;;
1957 esac
1958 case "$ln" in
1959 ln)
1960         echo "Substituting cp for ln."
1961         ln=$cp
1962         ;;
1963 esac
1964 case "$test" in
1965 test)
1966         echo "Hopefully test is built into your sh."
1967         ;;
1968 *)
1969         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1970                 echo "Using the test built into your sh."
1971                 test=test
1972                 _test=test
1973         fi
1974         ;;
1975 esac
1976 case "$echo" in
1977 echo)
1978         echo "Hopefully echo is built into your sh."
1979         ;;
1980 '') ;;
1981 *)
1982         echo " "
1983 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1984         $echo $n "hi there$c" >foo1
1985         echo $n "hi there$c" >foo2
1986         if cmp foo1 foo2 >/dev/null 2>&1; then
1987                 echo "They are compatible.  In fact, they may be identical."
1988         else
1989                 case "$n" in
1990                 '-n') n='' c='\c';;
1991                 *) n='-n' c='';;
1992                 esac
1993                 cat <<FOO
1994 They are not compatible!  You are probably running ksh on a non-USG system.
1995 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1996 have echo built in and we may have to run some Bourne shell scripts.  That
1997 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1998
1999 FOO
2000                 $echo $n "The star should be here-->$c"
2001                 $echo "*"
2002         fi
2003         $rm -f foo1 foo2
2004         ;;
2005 esac
2006
2007 : determine whether symbolic links are supported
2008 echo " "
2009 $touch blurfl
2010 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2011         echo "Symbolic links are supported." >&4
2012         lns="$ln -s"
2013 else
2014         echo "Symbolic links are NOT supported." >&4
2015         lns="$ln"
2016 fi
2017 $rm -f blurfl sym
2018
2019 : see whether [:lower:] and [:upper:] are supported character classes
2020 echo " "
2021 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2022 ABYZ)
2023         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2024         up='[:upper:]'
2025         low='[:lower:]'
2026         ;;
2027 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2028         # (0xc9 and 0xd1), therefore that is a nice testing point.
2029         if test "X$up" = X -o "X$low" = X; then
2030             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2031             ij) up='[A-Z]'
2032                 low='[a-z]'
2033                 ;;
2034             esac
2035         fi
2036         if test "X$up" = X -o "X$low" = X; then
2037             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2038             ij) up='A-Z'
2039                 low='a-z'
2040                 ;;
2041             esac
2042         fi
2043         if test "X$up" = X -o "X$low" = X; then
2044             case "`echo IJ | od -x 2>/dev/null`" in
2045             *C9D1*|*c9d1*)
2046                 echo "Hey, this might be EBCDIC." >&4
2047                 if test "X$up" = X -o "X$low" = X; then
2048                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2049                     ij) up='[A-IJ-RS-Z]'
2050                         low='[a-ij-rs-z]'
2051                         ;;
2052                     esac
2053                 fi
2054                 if test "X$up" = X -o "X$low" = X; then
2055                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2056                     ij) up='A-IJ-RS-Z'
2057                         low='a-ij-rs-z'
2058                         ;;
2059                     esac
2060                 fi
2061                 ;;
2062             esac
2063         fi
2064 esac
2065 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2066 ij)
2067     echo "Using $up and $low to convert case." >&4
2068     ;;
2069 *)
2070     echo "I don't know how to translate letters from upper to lower case." >&4
2071     echo "Your tr is not acting any way I know of." >&4
2072     exit 1
2073     ;;
2074 esac
2075 : set up the translation script tr, must be called with ./tr of course
2076 cat >tr <<EOSC
2077 $startsh
2078 case "\$1\$2" in
2079 '[A-Z][a-z]') exec $tr '$up' '$low';;
2080 '[a-z][A-Z]') exec $tr '$low' '$up';;
2081 esac
2082 exec $tr "\$@"
2083 EOSC
2084 chmod +x tr
2085 $eunicefix tr
2086
2087 : Try to determine whether config.sh was made on this system
2088 case "$config_sh" in
2089 '')
2090 myuname=`$uname -a 2>/dev/null`
2091 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2092 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2093 # because the A-Z/a-z are not consecutive.
2094 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2095         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2096 newmyuname="$myuname"
2097 dflt=n
2098 case "$knowitall" in
2099 '')
2100         if test -f ../config.sh; then
2101                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2102                         eval "`grep myuname= ../config.sh`"
2103                 fi
2104                 if test "X$myuname" = "X$newmyuname"; then
2105                         dflt=y
2106                 fi
2107         fi
2108         ;;
2109 *) dflt=y;;
2110 esac
2111
2112 : Get old answers from old config file if Configure was run on the
2113 : same system, otherwise use the hints.
2114 hint=default
2115 cd ..
2116 if test -f config.sh; then
2117         echo " "
2118         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2119         . UU/myread
2120         case "$ans" in
2121         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2122         *)  echo "Fetching default answers from your old config.sh file..." >&4
2123                 tmp_n="$n"
2124                 tmp_c="$c"
2125                 tmp_sh="$sh"
2126                 . ./config.sh
2127                 cp config.sh UU
2128                 n="$tmp_n"
2129                 c="$tmp_c"
2130                 : Older versions did not always set $sh.  Catch re-use of such
2131                 : an old config.sh.
2132                 case "$sh" in
2133                 '') sh="$tmp_sh" ;;
2134                 esac
2135                 hint=previous
2136                 ;;
2137         esac
2138 fi
2139 if test ! -f config.sh; then
2140         $cat <<EOM
2141
2142 First time through, eh?  I have some defaults handy for some systems
2143 that need some extra help getting the Configure answers right:
2144
2145 EOM
2146         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2147         dflt=''
2148         : Half the following guesses are probably wrong... If you have better
2149         : tests or hints, please send them to perlbug@perl.com
2150         : The metaconfig authors would also appreciate a copy...
2151         $test -f /irix && osname=irix
2152         $test -f /xenix && osname=sco_xenix
2153         $test -f /dynix && osname=dynix
2154         $test -f /dnix && osname=dnix
2155         $test -f /lynx.os && osname=lynxos
2156         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2157         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2158         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2159         $test -f /bin/mips && /bin/mips && osname=mips
2160         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2161                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2162         $test -d /usr/apollo/bin && osname=apollo
2163         $test -f /etc/saf/_sactab && osname=svr4
2164         $test -d /usr/include/minix && osname=minix
2165         if $test -d /MachTen -o -d /MachTen_Folder; then
2166                 osname=machten
2167                 if $test -x /sbin/version; then
2168                         osvers=`/sbin/version | $awk '{print $2}' |
2169                         $sed -e 's/[A-Za-z]$//'`
2170                 elif $test -x /usr/etc/version; then
2171                         osvers=`/usr/etc/version | $awk '{print $2}' |
2172                         $sed -e 's/[A-Za-z]$//'`
2173                 else
2174                         osvers="$2.$3"
2175                 fi
2176         fi
2177
2178         $test -f /sys/posix.dll &&
2179                 $test -f /usr/bin/what &&
2180                 set X `/usr/bin/what /sys/posix.dll` &&
2181                 $test "$3" = UWIN &&
2182                 osname=uwin &&
2183                 osvers="$5"
2184
2185         if $test -f $uname; then
2186                 set X $myuname
2187                 shift
2188
2189                 case "$5" in
2190                 fps*) osname=fps ;;
2191                 mips*)
2192                         case "$4" in
2193                         umips) osname=umips ;;
2194                         *) osname=mips ;;
2195                         esac;;
2196                 [23]100) osname=mips ;;
2197                 next*) osname=next ;;
2198                 i386*)
2199                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2200                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2201                                 osname='sco'
2202                                 osvers=$tmp
2203                         elif $test -f /etc/kconfig; then
2204                                 osname=isc
2205                                 if test "$lns" = "$ln -s"; then
2206                                         osvers=4
2207                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2208                                         osvers=3
2209                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2210                                         osvers=2
2211                                 fi
2212                         fi
2213                         tmp=''
2214                         ;;
2215                 pc*)
2216                         if test -n "$DJGPP"; then
2217                                 osname=dos
2218                                 osvers=djgpp
2219                         fi
2220                         ;;
2221                 esac
2222
2223                 case "$1" in
2224                 aix) osname=aix
2225                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2226                         case "$tmp" in
2227                         'not found') osvers="$4"."$3" ;;
2228                         '<3240'|'<>3240') osvers=3.2.0 ;;
2229                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2230                         '=3250'|'>3250') osvers=3.2.5 ;;
2231                         *) osvers=$tmp;;
2232                         esac
2233                         ;;
2234                 bsd386) osname=bsd386
2235                         osvers=`$uname -r`
2236                         ;;
2237                 cygwin*) osname=cygwin
2238                         osvers="$3"
2239                         ;;
2240                 *dc.osx) osname=dcosx
2241                         osvers="$3"
2242                         ;;
2243                 dnix) osname=dnix
2244                         osvers="$3"
2245                         ;;
2246                 domainos) osname=apollo
2247                         osvers="$3"
2248                         ;;
2249                 dgux) osname=dgux 
2250                         osvers="$3"
2251                         ;;
2252                 dynixptx*) osname=dynixptx
2253                         osvers=`echo "$4"|sed 's/^v//'`
2254                         ;;
2255                 freebsd) osname=freebsd 
2256                         osvers="$3" ;;
2257                 genix) osname=genix ;;
2258                 hp*) osname=hpux 
2259                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2260                         ;;
2261                 irix*) osname=irix
2262                         case "$3" in
2263                         4*) osvers=4 ;;
2264                         5*) osvers=5 ;;
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 linux) osname=linux
2269                         case "$3" in
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 MiNT) osname=mint
2274                         ;;
2275                 netbsd*) osname=netbsd
2276                         osvers="$3"
2277                         ;;
2278                 news-os) osvers="$3"
2279                         case "$3" in
2280                         4*) osname=newsos4 ;;
2281                         *) osname=newsos ;;
2282                         esac
2283                         ;;
2284                 next*) osname=next ;;
2285                 POSIX-BC | posix-bc ) osname=posix-bc
2286                         osvers="$3"
2287                         ;;
2288                 powerux | power_ux | powermax_os | powermaxos | \
2289                 powerunix | power_unix) osname=powerux
2290                         osvers="$3"
2291                         ;;
2292                 qnx) osname=qnx
2293                         osvers="$4"
2294                         ;;
2295                 solaris) osname=solaris
2296                         case "$3" in
2297                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2298                         *)      osvers="$3" ;;
2299                         esac
2300                         ;;
2301                 sunos) osname=sunos
2302                         case "$3" in
2303                         5*) osname=solaris
2304                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2305                         *)      osvers="$3" ;;
2306                         esac
2307                         ;;
2308                 titanos) osname=titanos
2309                         case "$3" in
2310                         1*) osvers=1 ;;
2311                         2*) osvers=2 ;;
2312                         3*) osvers=3 ;;
2313                         4*) osvers=4 ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 ultrix) osname=ultrix
2318                         osvers="$3"
2319                         ;;
2320                 osf1|mls+)      case "$5" in
2321                                 alpha)
2322                                         osname=dec_osf
2323                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2324                                         ;;
2325                         hp*)    osname=hp_osf1  ;;
2326                         mips)   osname=mips_osf1 ;;
2327                         esac
2328                         ;;
2329                 unixware) osname=svr5
2330                         osvers="$4"
2331                         ;;
2332                 uts) osname=uts
2333                         osvers="$3"
2334                         ;;
2335                 $2) case "$osname" in
2336                         *isc*) ;;
2337                         *freebsd*) ;;
2338                         svr*)
2339                                 : svr4.x or possibly later
2340                                 case "svr$3" in 
2341                                 ${osname}*)
2342                                         osname=svr$3
2343                                         osvers=$4
2344                                         ;;
2345                                 esac
2346                                 case "$osname" in
2347                                 svr4.0)
2348                                         : Check for ESIX
2349                                         if test -f /stand/boot ; then
2350                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2351                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2352                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2353                                                         if test -n "$isesix"; then
2354                                                                 osname=esix4
2355                                                         fi
2356                                                 fi
2357                                         fi
2358                                         ;;
2359                                 esac
2360                                 ;;
2361                         *)      if test -f /etc/systemid; then
2362                                         osname=sco
2363                                         set `echo $3 | $sed 's/\./ /g'` $4
2364                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2365                                                 osvers=$1.$2.$3
2366                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2367                                                 osvers=$1.$2
2368                                         elif $test -f $src/hints/sco_$1.sh; then
2369                                                 osvers=$1
2370                                         fi
2371                                 else
2372                                         case "$osname" in
2373                                         '') : Still unknown.  Probably a generic Sys V.
2374                                                 osname="sysv"
2375                                                 osvers="$3"
2376                                                 ;;
2377                                         esac
2378                                 fi
2379                                 ;;
2380                         esac
2381                         ;;
2382                 *)      case "$osname" in
2383                         '') : Still unknown.  Probably a generic BSD.
2384                                 osname="$1"
2385                                 osvers="$3"
2386                                 ;;
2387                         esac
2388                         ;;
2389                 esac
2390         else
2391                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2392                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2393                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2394                                 osname=news_os
2395                         fi
2396                         $rm -f UU/kernel.what
2397                 elif test -d c:/.; then
2398                         set X $myuname
2399                         osname=os2
2400                         osvers="$5"
2401                 fi
2402         fi
2403         
2404         : Now look for a hint file osname_osvers, unless one has been
2405         : specified already.
2406         case "$hintfile" in
2407         ''|' ')
2408                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2409                 : Also try without trailing minor version numbers.
2410                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2411                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2412                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2413                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2414                 case "$file" in
2415                 '') dflt=none ;;
2416                 *)  case "$osvers" in
2417                         '') dflt=$file
2418                                 ;;
2419                         *)  if $test -f $src/hints/$file.sh ; then
2420                                         dflt=$file
2421                                 elif $test -f $src/hints/$xfile.sh ; then
2422                                         dflt=$xfile
2423                                 elif $test -f $src/hints/$xxfile.sh ; then
2424                                         dflt=$xxfile
2425                                 elif $test -f $src/hints/$xxxfile.sh ; then
2426                                         dflt=$xxxfile
2427                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2428                                         dflt=$xxxxfile
2429                                 elif $test -f "$src/hints/${osname}.sh" ; then
2430                                         dflt="${osname}"
2431                                 else
2432                                         dflt=none
2433                                 fi
2434                                 ;;
2435                         esac
2436                         ;;
2437                 esac
2438                 if $test -f Policy.sh ; then
2439                         case "$dflt" in
2440                         *Policy*) ;;
2441                         none) dflt="Policy" ;;
2442                         *) dflt="Policy $dflt" ;;
2443                         esac
2444                 fi
2445                 ;;
2446         *)
2447                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2448                 ;;
2449         esac
2450
2451         if $test -f Policy.sh ; then
2452                 $cat <<EOM
2453
2454 There's also a Policy hint file available, which should make the
2455 site-specific (policy) questions easier to answer.
2456 EOM
2457
2458         fi
2459
2460         $cat <<EOM
2461
2462 You may give one or more space-separated answers, or "none" if appropriate.
2463 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2464 is a good thing.  DO NOT give a wrong version or a wrong OS.
2465
2466 EOM
2467
2468         rp="Which of these apply, if any?"
2469         . UU/myread
2470         tans=$ans
2471         for file in $tans; do
2472                 if $test X$file = XPolicy -a -f Policy.sh; then
2473                         . Policy.sh
2474                         $cat Policy.sh >> UU/config.sh
2475                 elif $test -f $src/hints/$file.sh; then
2476                         . $src/hints/$file.sh
2477                         $cat $src/hints/$file.sh >> UU/config.sh
2478                 elif $test X$tans = X -o X$tans = Xnone ; then
2479                         : nothing
2480                 else
2481                         : Give one chance to correct a possible typo.
2482                         echo "$file.sh does not exist"
2483                         dflt=$file
2484                         rp="hint to use instead?"
2485                         . UU/myread
2486                         for file in $ans; do
2487                                 if $test -f "$src/hints/$file.sh"; then
2488                                         . $src/hints/$file.sh
2489                                         $cat $src/hints/$file.sh >> UU/config.sh
2490                                 elif $test X$ans = X -o X$ans = Xnone ; then
2491                                         : nothing
2492                                 else
2493                                         echo "$file.sh does not exist -- ignored."
2494                                 fi
2495                         done
2496                 fi
2497         done
2498
2499         hint=recommended
2500         : Remember our hint file for later.
2501         if $test -f "$src/hints/$file.sh" ; then
2502                 hintfile="$file"
2503         else
2504                 hintfile=''
2505         fi
2506 fi
2507 cd UU
2508 ;;
2509 *)
2510         echo " "
2511         echo "Fetching default answers from $config_sh..." >&4
2512         tmp_n="$n"
2513         tmp_c="$c"
2514         cd ..
2515         cp $config_sh config.sh 2>/dev/null
2516         chmod +w config.sh
2517         . ./config.sh
2518         cd UU
2519         cp ../config.sh .
2520         n="$tmp_n"
2521         c="$tmp_c"
2522         hint=previous
2523         ;;
2524 esac
2525 test "$override" && . ./optdef.sh
2526 myuname="$newmyuname"
2527
2528 : Restore computed paths
2529 for file in $loclist $trylist; do
2530         eval $file="\$_$file"
2531 done
2532
2533 cat << EOM
2534
2535 Configure uses the operating system name and version to set some defaults.
2536 The default value is probably right if the name rings a bell. Otherwise,
2537 since spelling matters for me, either accept the default or answer "none"
2538 to leave it blank.
2539
2540 EOM
2541 case "$osname" in
2542         ''|' ')
2543                 case "$hintfile" in
2544                 ''|' '|none) dflt=none ;;
2545                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2546                 esac
2547                 ;;
2548         *) dflt="$osname" ;;
2549 esac
2550 rp="Operating system name?"
2551 . ./myread
2552 case "$ans" in
2553 none)  osname='' ;;
2554 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2555 esac
2556 echo " "
2557 case "$osvers" in
2558         ''|' ')
2559                 case "$hintfile" in
2560                 ''|' '|none) dflt=none ;;
2561                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2562                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2563                         case "$dflt" in
2564                         ''|' ') dflt=none ;;
2565                         esac
2566                         ;;
2567                 esac
2568                 ;;
2569         *) dflt="$osvers" ;;
2570 esac
2571 rp="Operating system version?"
2572 . ./myread
2573 case "$ans" in
2574 none)  osvers='' ;;
2575 *) osvers="$ans" ;;
2576 esac
2577
2578
2579 . ./posthint.sh
2580
2581 : who configured the system
2582 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2583 cf_by=`(logname) 2>/dev/null`
2584 case "$cf_by" in
2585 "")
2586         cf_by=`(whoami) 2>/dev/null`
2587         case "$cf_by" in
2588         "") cf_by=unknown ;;
2589         esac ;;
2590 esac
2591
2592 : set up the script used to warn in case of inconsistency
2593 cat <<EOS >whoa
2594 $startsh
2595 EOS
2596 cat <<'EOSC' >>whoa
2597 dflt=y
2598 echo " "
2599 echo "*** WHOA THERE!!! ***" >&4
2600 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2601 rp="    Keep the $hint value?"
2602 . ./myread
2603 case "$ans" in
2604 y) td=$was; tu=$was;;
2605 esac
2606 EOSC
2607
2608 : function used to set $1 to $val
2609 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2610 case "$val$was" in
2611 $define$undef) . ./whoa; eval "$var=\$td";;
2612 $undef$define) . ./whoa; eval "$var=\$tu";;
2613 *) eval "$var=$val";;
2614 esac'
2615
2616 case "$usethreads" in
2617 $define|true|[yY]*)     dflt='y';;
2618 *) dflt='n';;
2619 esac
2620 cat <<EOM
2621
2622 Perl can be built to take advantage of threads on some systems.
2623 To do so, Configure can be run with -Dusethreads.
2624
2625 Note that threading is a highly experimental feature, and
2626 some known race conditions still remain.  If you choose to try
2627 it, be very sure to not actually deploy it for production
2628 purposes.  README.threads has more details, and is required
2629 reading if you enable threads.
2630
2631 If this doesn't make any sense to you, just accept the default '$dflt'.
2632 EOM
2633 rp='Build a threading Perl?'
2634 . ./myread
2635 case "$ans" in
2636 y|Y)    val="$define" ;;
2637 *)      val="$undef" ;;
2638 esac
2639 set usethreads
2640 eval $setvar
2641
2642 case "$usethreads" in
2643 $define)
2644         $cat <<EOM
2645
2646 As of 5.5.640, Perl has two different internal threading implementations,
2647 the 5.005 version (5005threads) and an interpreter-based version
2648 (ithreads) that has one interpreter per thread.  Both are very 
2649 experimental.  This arrangement exists to help developers work out
2650 which one is better.
2651
2652 If you're a casual user, you probably don't want interpreter-threads
2653 at this time.  There doesn't yet exist a way to create threads from
2654 within Perl in this model, i.e., "use Thread;" will NOT work.
2655 EOM
2656         : Default to ithreads unless overridden on command line or with
2657         : old config.sh
2658         dflt='y'
2659         case "$use5005threads" in
2660                 $define|true|[yY]*) dflt='n';;
2661         esac
2662         case "$useithreads" in
2663                 $undef|false|[nN]*) dflt='n';;
2664         esac
2665         rp='Use interpreter-based ithreads?'
2666         . ./myread
2667         case "$ans" in
2668         y|Y)    val="$define" ;;
2669         *)      val="$undef" ;;
2670         esac
2671         set useithreads
2672         eval $setvar
2673         : Now set use5005threads to the opposite value.
2674         case "$useithreads" in
2675         $define) val="$undef" ;;
2676         *) val="$define" ;;
2677         esac
2678         set use5005threads
2679         eval $setvar
2680         ;;
2681 *)
2682         useithreads="$undef"
2683         use5005threads="$undef"
2684         ;;
2685 esac
2686
2687 case "$d_oldpthreads" in
2688 '')     : Configure tests would be welcome here.  For now, assume undef.
2689         val="$undef" ;;
2690 *)      val="$d_oldpthreads" ;;
2691 esac
2692 set d_oldpthreads
2693 eval $setvar
2694
2695
2696 case "$usethreads" in
2697 "$define"|true|[yY]*)
2698 : Look for a hint-file generated 'call-back-unit'.  If the
2699 : user has specified that a threading perl is to be built,
2700 : we may need to set or change some other defaults.
2701         if $test -f usethreads.cbu; then
2702                 echo "Your platform has some specific hints for threaded builds, using them..."
2703                 . ./usethreads.cbu
2704         else
2705                 $cat <<EOM
2706 (Your platform doesn't have any specific hints for threaded builds.
2707  Assuming POSIX threads, then.)
2708 EOM
2709         fi
2710         ;;
2711 esac
2712
2713 cat <<EOM
2714
2715 Perl can be built so that multiple Perl interpreters can coexist
2716 within the same Perl executable.
2717 EOM
2718
2719 case "$useithreads" in
2720 $define)
2721         cat <<EOM
2722 This multiple interpreter support is required for interpreter-based threads.
2723 EOM
2724         val="$define"
2725         ;;
2726 *)      case "$usemultiplicity" in
2727         $define|true|[yY]*)     dflt='y';;
2728         *) dflt='n';;
2729         esac
2730         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2731         rp='Build Perl for multiplicity?'
2732         . ./myread
2733         case "$ans" in
2734         y|Y)    val="$define" ;;
2735         *)      val="$undef" ;;
2736         esac
2737         ;;
2738 esac
2739 set usemultiplicity
2740 eval $setvar
2741
2742 : determine where manual pages are on this system
2743 echo " "
2744 case "$sysman" in
2745 '') 
2746         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2747         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2748         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2749         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2750         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2751         sysman=`./loc . /usr/man/man1 $syspath`
2752         ;;
2753 esac
2754 if $test -d "$sysman"; then
2755         echo "System manual is in $sysman." >&4
2756 else
2757         echo "Could not find manual pages in source form." >&4
2758 fi
2759
2760 : see what memory models we can support
2761 case "$models" in
2762 '')
2763         $cat >pdp11.c <<'EOP'
2764 int main() {
2765 #ifdef pdp11
2766         exit(0);
2767 #else
2768         exit(1);
2769 #endif
2770 }
2771 EOP
2772         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2773         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2774                 dflt='unsplit split'
2775         else
2776                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2777                 case "$tans" in
2778                 X) dflt='none';;
2779                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2780                                 dflt='small'
2781                         else
2782                                 dflt=''
2783                         fi
2784                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2785                                 dflt="$dflt medium"
2786                         fi
2787                         if $test -d /lib/large || $test -d /usr/lib/large; then
2788                                 dflt="$dflt large"
2789                         fi
2790                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2791                                 dflt="$dflt huge"
2792                         fi
2793                 esac
2794         fi;;
2795 *) dflt="$models";;
2796 esac
2797 $cat <<EOM
2798  
2799 Some systems have different model sizes.  On most systems they are called
2800 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2801 split.  If your system doesn't support different memory models, say "none".
2802 If you wish to force everything to one memory model, say "none" here and
2803 put the appropriate flags later when it asks you for other cc and ld flags.
2804 Venix systems may wish to put "none" and let the compiler figure things out.
2805 (In the following question multiple model names should be space separated.)
2806
2807 The default for most systems is "none".
2808
2809 EOM
2810 rp="Which memory models are supported?"
2811 . ./myread
2812 models="$ans"
2813
2814 case "$models" in
2815 none)
2816         small=''
2817         medium=''
2818         large=''
2819         huge=''
2820         unsplit=''
2821         split=''
2822         ;;
2823 *split)
2824         case "$split" in
2825         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2826                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2827                         dflt='-i'
2828                 else
2829                         dflt='none'
2830                 fi;;
2831         *) dflt="$split";;
2832         esac
2833         rp="What flag indicates separate I and D space?"
2834         . ./myread
2835         tans="$ans"
2836         case "$tans" in
2837         none) tans='';;
2838         esac
2839         split="$tans"
2840         unsplit='';;
2841 *large*|*small*|*medium*|*huge*)
2842         case "$models" in
2843         *large*)
2844                 case "$large" in
2845                 '') dflt='-Ml';;
2846                 *) dflt="$large";;
2847                 esac
2848         rp="What flag indicates large model?"
2849         . ./myread
2850         tans="$ans"
2851         case "$tans" in
2852         none) tans='';
2853         esac
2854         large="$tans";;
2855         *) large='';;
2856         esac
2857         case "$models" in
2858         *huge*) case "$huge" in
2859                 '') dflt='-Mh';;
2860                 *) dflt="$huge";;
2861                 esac
2862                 rp="What flag indicates huge model?"
2863                 . ./myread
2864                 tans="$ans"
2865                 case "$tans" in
2866                 none) tans='';
2867                 esac
2868                 huge="$tans";;
2869         *) huge="$large";;
2870         esac
2871         case "$models" in
2872         *medium*) case "$medium" in
2873                 '') dflt='-Mm';;
2874                 *) dflt="$medium";;
2875                 esac
2876                 rp="What flag indicates medium model?"
2877                 . ./myread
2878                 tans="$ans"
2879                 case "$tans" in
2880                 none) tans='';
2881                 esac
2882                 medium="$tans";;
2883         *) medium="$large";;
2884         esac
2885         case "$models" in
2886         *small*) case "$small" in
2887                 '') dflt='none';;
2888                 *) dflt="$small";;
2889                 esac
2890                 rp="What flag indicates small model?"
2891                 . ./myread
2892                 tans="$ans"
2893                 case "$tans" in
2894                 none) tans='';
2895                 esac
2896                 small="$tans";;
2897         *) small='';;
2898         esac
2899         ;;
2900 *)
2901         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2902         ;;
2903 esac
2904 $rm -f pdp11.* pdp11
2905
2906 : make some quick guesses about what we are up against
2907 echo " "
2908 $echo $n "Hmm...  $c"
2909 echo exit 1 >bsd
2910 echo exit 1 >usg
2911 echo exit 1 >v7
2912 echo exit 1 >osf1
2913 echo exit 1 >eunice
2914 echo exit 1 >xenix
2915 echo exit 1 >venix
2916 echo exit 1 >os2
2917 d_bsd="$undef"
2918 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2919 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2920 then
2921         echo "Looks kind of like an OSF/1 system, but we'll see..."
2922         echo exit 0 >osf1
2923 elif test `echo abc | tr a-z A-Z` = Abc ; then
2924         xxx=`./loc addbib blurfl $pth`
2925         if $test -f $xxx; then
2926         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2927                 echo exit 0 >bsd
2928                 echo exit 0 >usg
2929         else
2930                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931                         echo "Looks kind of like an extended USG system, but we'll see..."
2932                 else
2933                         echo "Looks kind of like a USG system, but we'll see..."
2934                 fi
2935                 echo exit 0 >usg
2936         fi
2937 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2938         echo "Looks kind of like a BSD system, but we'll see..."
2939         d_bsd="$define"
2940         echo exit 0 >bsd
2941 else
2942         echo "Looks kind of like a Version 7 system, but we'll see..."
2943         echo exit 0 >v7
2944 fi
2945 case "$eunicefix" in
2946 *unixtovms*)
2947         $cat <<'EOI'
2948 There is, however, a strange, musty smell in the air that reminds me of
2949 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2950 EOI
2951         echo exit 0 >eunice
2952         d_eunice="$define"
2953 : it so happens the Eunice I know will not run shell scripts in Unix format
2954         ;;
2955 *)
2956         echo " "
2957         echo "Congratulations.  You aren't running Eunice."
2958         d_eunice="$undef"
2959         ;;
2960 esac
2961 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2962 case "$p_" in
2963 :) ;;
2964 *)
2965         $cat <<'EOI'
2966 I have the feeling something is not exactly right, however...don't tell me...
2967 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2968 EOI
2969         echo exit 0 >os2
2970         ;;
2971 esac
2972 if test -f /xenix; then
2973         echo "Actually, this looks more like a XENIX system..."
2974         echo exit 0 >xenix
2975         d_xenix="$define"
2976 else
2977         echo " "
2978         echo "It's not Xenix..."
2979         d_xenix="$undef"
2980 fi
2981 chmod +x xenix
2982 $eunicefix xenix
2983 if test -f /venix; then
2984         echo "Actually, this looks more like a VENIX system..."
2985         echo exit 0 >venix
2986 else
2987         echo " "
2988         if ./xenix; then
2989                 : null
2990         else
2991                 echo "Nor is it Venix..."
2992         fi
2993 fi
2994 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2995 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2996 $rm -f foo
2997
2998 : see if we need a special compiler
2999 echo " "
3000 if ./usg; then
3001         case "$cc" in
3002         '') case "$Mcc" in
3003                 /*) dflt='Mcc';;
3004                 *) case "$large" in
3005                         -M*) dflt='cc';;
3006                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3007                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3008                                                 dflt='cc'
3009                                         else
3010                                                 dflt='cc -M'
3011                                         fi
3012                                 else
3013                                         dflt='cc'
3014                                 fi;;
3015                         esac;;
3016                 esac;;
3017         *)  dflt="$cc";;
3018         esac
3019         case "$dflt" in
3020         *M*)    $cat <<'EOM'
3021 On some older systems the default C compiler will not resolve multiple global
3022 references that happen to have the same name.  On some such systems the "Mcc"
3023 command may be used to force these to be resolved.  On other systems a "cc -M"
3024 command is required.  (Note that the -M flag on other systems indicates a
3025 memory model to use!) If you have the Gnu C compiler, you might wish to use
3026 that instead.
3027
3028 EOM
3029         ;;
3030         esac
3031         rp="Use which C compiler?"
3032         . ./myread
3033         cc="$ans"
3034 else
3035         case "$cc" in
3036         '') dflt=cc;;
3037         *) dflt="$cc";;
3038         esac
3039         rp="Use which C compiler?"
3040         . ./myread
3041         cc="$ans"
3042 fi
3043 : Look for a hint-file generated 'call-back-unit'.  Now that the
3044 : user has specified the compiler, we may need to set or change some
3045 : other defaults.
3046 if $test -f cc.cbu; then
3047     . ./cc.cbu
3048 fi
3049 echo " "
3050 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3051 $cat >gccvers.c <<EOM
3052 #include <stdio.h>
3053 int main() {
3054 #ifdef __GNUC__
3055 #ifdef __VERSION__
3056         printf("%s\n", __VERSION__);
3057 #else
3058         printf("%s\n", "1");
3059 #endif
3060 #endif
3061         exit(0);
3062 }
3063 EOM
3064 if $cc $ldflags -o gccvers gccvers.c; then
3065         gccversion=`./gccvers`
3066         case "$gccversion" in
3067         '') echo "You are not using GNU cc." ;;
3068         *)  echo "You are using GNU cc $gccversion."
3069             ;;
3070         esac
3071 else
3072         echo " "
3073         echo "*** WHOA THERE!!! ***" >&4
3074         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3075         case "$knowitall" in
3076         '')
3077         echo "    You'd better start hunting for one and let me know about it." >&4
3078                 exit 1
3079                 ;;
3080         esac
3081 fi
3082 $rm -f gccvers*
3083 case "$gccversion" in
3084 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3085 esac
3086
3087 : decide how portable to be.  Allow command line overrides.
3088 case "$d_portable" in
3089 "$undef") ;;
3090 *)      d_portable="$define" ;;
3091 esac
3092
3093 : set up shell script to do ~ expansion
3094 cat >filexp <<EOSS
3095 $startsh
3096 : expand filename
3097 case "\$1" in
3098  ~/*|~)
3099         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3100         ;;
3101  ~*)
3102         if $test -f /bin/csh; then
3103                 /bin/csh -f -c "glob \$1"
3104                 failed=\$?
3105                 echo ""
3106                 exit \$failed
3107         else
3108                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3109                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3110                 if $test ! -d "\$dir"; then
3111                         me=\`basename \$0\`
3112                         echo "\$me: can't locate home directory for: \$name" >&2
3113                         exit 1
3114                 fi
3115                 case "\$1" in
3116                 */*)
3117                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3118                         ;;
3119                 *)
3120                         echo \$dir
3121                         ;;
3122                 esac
3123         fi
3124         ;;
3125 *)
3126         echo \$1
3127         ;;
3128 esac
3129 EOSS
3130 chmod +x filexp
3131 $eunicefix filexp
3132
3133 : now set up to get a file name
3134 cat <<EOS >getfile
3135 $startsh
3136 EOS
3137 cat <<'EOSC' >>getfile
3138 tilde=''
3139 fullpath=''
3140 already=''
3141 skip=''
3142 none_ok=''
3143 exp_file=''
3144 nopath_ok=''
3145 orig_rp="$rp"
3146 orig_dflt="$dflt"
3147 case "$gfpth" in
3148 '') gfpth='.' ;;
3149 esac
3150
3151 case "$fn" in
3152 *\(*)
3153         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3154         fn=`echo $fn | sed 's/(.*)//'`
3155         ;;
3156 esac
3157
3158 case "$fn" in
3159 *:*)
3160         loc_file=`expr $fn : '.*:\(.*\)'`
3161         fn=`expr $fn : '\(.*\):.*'`
3162         ;;
3163 esac
3164
3165 case "$fn" in
3166 *~*) tilde=true;;
3167 esac
3168 case "$fn" in
3169 */*) fullpath=true;;
3170 esac
3171 case "$fn" in
3172 *+*) skip=true;;
3173 esac
3174 case "$fn" in
3175 *n*) none_ok=true;;
3176 esac
3177 case "$fn" in
3178 *e*) exp_file=true;;
3179 esac
3180 case "$fn" in
3181 *p*) nopath_ok=true;;
3182 esac
3183
3184 case "$fn" in
3185 *f*) type='File';;
3186 *d*) type='Directory';;
3187 *l*) type='Locate';;
3188 esac
3189
3190 what="$type"
3191 case "$what" in
3192 Locate) what='File';;
3193 esac
3194
3195 case "$exp_file" in
3196 '')
3197         case "$d_portable" in
3198         "$define") ;;
3199         *) exp_file=true;;
3200         esac
3201         ;;
3202 esac
3203
3204 cd ..
3205 while test "$type"; do
3206         redo=''
3207         rp="$orig_rp"
3208         dflt="$orig_dflt"
3209         case "$tilde" in
3210         true) rp="$rp (~name ok)";;
3211         esac
3212         . UU/myread
3213         if test -f UU/getfile.ok && \
3214                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3215         then
3216                 value="$ans"
3217                 ansexp="$ans"
3218                 break
3219         fi
3220         case "$ans" in
3221         none)
3222                 value=''
3223                 ansexp=''
3224                 case "$none_ok" in
3225                 true) type='';;
3226                 esac
3227                 ;;
3228         *)
3229                 case "$tilde" in
3230                 '') value="$ans"
3231                         ansexp="$ans";;
3232                 *)
3233                         value=`UU/filexp $ans`
3234                         case $? in
3235                         0)
3236                                 if test "$ans" != "$value"; then
3237                                         echo "(That expands to $value on this system.)"
3238                                 fi
3239                                 ;;
3240                         *) value="$ans";;
3241                         esac
3242                         ansexp="$value"
3243                         case "$exp_file" in
3244                         '') value="$ans";;
3245                         esac
3246                         ;;
3247                 esac
3248                 case "$fullpath" in
3249                 true)
3250                         case "$ansexp" in
3251                         /*) value="$ansexp" ;;
3252                         *)
3253                                 redo=true
3254                                 case "$already" in
3255                                 true)
3256                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3257                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3258                                         ;;
3259                                 *)
3260                                 echo "Please give a full path name, starting with slash." >&4
3261                                         case "$tilde" in
3262                                         true)
3263                                 echo "Note that using ~name is ok provided it expands well." >&4
3264                                                 already=true
3265                                                 ;;
3266                                         esac
3267                                 esac
3268                                 ;;
3269                         esac
3270                         ;;
3271                 esac
3272                 case "$redo" in
3273                 '')
3274                         case "$type" in
3275                         File)
3276                                 for fp in $gfpth; do
3277                                         if test "X$fp" = X.; then
3278                                             pf="$ansexp"
3279                                         else    
3280                                             pf="$fp/$ansexp"
3281                                         fi
3282                                         if test -f "$pf"; then
3283                                                 type=''
3284                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3285                                         then
3286                                                 echo "($value is not a plain file, but that's ok.)"
3287                                                 type=''
3288                                         fi
3289                                         if test X"$type" = X; then
3290                                             value="$pf"
3291                                             break
3292                                         fi
3293                                 done
3294                                 ;;
3295                         Directory)
3296                                 for fp in $gfpth; do
3297                                         if test "X$fp" = X.; then
3298                                             pf="$ansexp"
3299                                         else    
3300                                             pf="$fp/$ansexp"
3301                                         fi
3302                                         if test -d "$pf"; then
3303                                                 type=''
3304                                                 value="$pf"
3305                                                 break
3306                                         fi
3307                                 done
3308                                 ;;
3309                         Locate)
3310                                 if test -d "$ansexp"; then
3311                                         echo "(Looking for $loc_file in directory $value.)"
3312                                         value="$value/$loc_file"
3313                                         ansexp="$ansexp/$loc_file"
3314                                 fi
3315                                 if test -f "$ansexp"; then
3316                                         type=''
3317                                 fi
3318                                 case "$nopath_ok" in
3319                                 true)   case "$value" in
3320                                         */*) ;;
3321                                         *)      echo "Assuming $value will be in people's path."
3322                                                 type=''
3323                                                 ;;
3324                                         esac
3325                                         ;;
3326                                 esac
3327                                 ;;
3328                         esac
3329
3330                         case "$skip" in
3331                         true) type='';
3332                         esac
3333
3334                         case "$type" in
3335                         '') ;;
3336                         *)
3337                                 if test "$fastread" = yes; then
3338                                         dflt=y
3339                                 else
3340                                         dflt=n
3341                                 fi
3342                                 rp="$what $value doesn't exist.  Use that name anyway?"
3343                                 . UU/myread
3344                                 dflt=''
3345                                 case "$ans" in
3346                                 y*) type='';;
3347                                 *) echo " ";;
3348                                 esac
3349                                 ;;
3350                         esac
3351                         ;;
3352                 esac
3353                 ;;
3354         esac
3355 done
3356 cd UU
3357 ans="$value"
3358 rp="$orig_rp"
3359 dflt="$orig_dflt"
3360 rm -f getfile.ok
3361 test "X$gfpthkeep" != Xy && gfpth=""
3362 EOSC
3363
3364 : What should the include directory be ?
3365 echo " "
3366 $echo $n "Hmm...  $c"
3367 dflt='/usr/include'
3368 incpath=''
3369 mips_type=''
3370 if $test -f /bin/mips && /bin/mips; then
3371         echo "Looks like a MIPS system..."
3372         $cat >usr.c <<'EOCP'
3373 #ifdef SYSTYPE_BSD43
3374 /bsd43
3375 #endif
3376 EOCP
3377         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3378                 dflt='/bsd43/usr/include'
3379                 incpath='/bsd43'
3380                 mips_type='BSD 4.3'
3381         else
3382                 mips_type='System V'
3383         fi
3384         $rm -f usr.c usr.out
3385         echo "and you're compiling with the $mips_type compiler and libraries."
3386         xxx_prompt=y
3387         echo "exit 0" >mips
3388 else
3389         echo "Doesn't look like a MIPS system."
3390         xxx_prompt=n
3391         echo "exit 1" >mips
3392 fi
3393 chmod +x mips
3394 $eunicefix mips
3395 case "$usrinc" in
3396 '') ;;
3397 *) dflt="$usrinc";;
3398 esac
3399 case "$xxx_prompt" in
3400 y)      fn=d/
3401         echo " "
3402         rp='Where are the include files you want to use?'
3403         . ./getfile
3404         usrinc="$ans"
3405         ;;
3406 *)      usrinc="$dflt"
3407         ;;
3408 esac
3409
3410 : see how we invoke the C preprocessor
3411 echo " "
3412 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3413 cat <<'EOT' >testcpp.c
3414 #define ABC abc
3415 #define XYZ xyz
3416 ABC.XYZ
3417 EOT
3418 cd ..
3419 if test ! -f cppstdin; then
3420         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3421                 # AIX cc -E doesn't show the absolute headerfile
3422                 # locations but we'll cheat by using the -M flag.
3423                 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
3424         else
3425                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3426         fi
3427 else
3428         echo "Keeping your $hint cppstdin wrapper."
3429 fi
3430 chmod 755 cppstdin
3431 wrapper=`pwd`/cppstdin
3432 ok='false'
3433 cd UU
3434
3435 if $test "X$cppstdin" != "X" && \
3436         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3437         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3438 then
3439         echo "You used to use $cppstdin $cppminus so we'll use that again."
3440         case "$cpprun" in
3441         '') echo "But let's see if we can live without a wrapper..." ;;
3442         *)
3443                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3444                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3445                 then
3446                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3447                         ok='true'
3448                 else
3449                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3450                 fi
3451                 ;;
3452         esac
3453 else
3454         case "$cppstdin" in
3455         '') ;;
3456         *)
3457                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3458                 ;;
3459         esac
3460 fi
3461
3462 if $ok; then
3463         : nothing
3464 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3465         $cc -E <testcpp.c >testcpp.out 2>&1; \
3466         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3467         echo "Yup, it does."
3468         x_cpp="$cc -E"
3469         x_minus='';
3470 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3471         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "Yup, it does."
3474         x_cpp="$cc -E"
3475         x_minus='-';
3476 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3477         $cc -P <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Yipee, that works!"
3480         x_cpp="$cc -P"
3481         x_minus='';
3482 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3483         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         echo "At long last!"
3486         x_cpp="$cc -P"
3487         x_minus='-';
3488 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3489         $cpp <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "It works!"
3492         x_cpp="$cpp"
3493         x_minus='';
3494 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3495         $cpp - <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         echo "Hooray, it works!  I was beginning to wonder."
3498         x_cpp="$cpp"
3499         x_minus='-';
3500 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3501         $wrapper <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         x_cpp="$wrapper"
3504         x_minus=''
3505         echo "Eureka!"
3506 else
3507         dflt=''
3508         rp="No dice.  I can't find a C preprocessor.  Name one:"
3509         . ./myread
3510         x_cpp="$ans"
3511         x_minus=''
3512         $x_cpp <testcpp.c >testcpp.out 2>&1
3513         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3514                 echo "OK, that will do." >&4
3515         else
3516 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3517                 exit 1
3518         fi
3519 fi
3520
3521 case "$ok" in
3522 false)
3523         cppstdin="$x_cpp"
3524         cppminus="$x_minus"
3525         cpprun="$x_cpp"
3526         cpplast="$x_minus"
3527         set X $x_cpp
3528         shift
3529         case "$1" in
3530         "$cpp")
3531                 echo "Perhaps can we force $cc -E using a wrapper..."
3532                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3533                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3534                 then
3535                         echo "Yup, we can."
3536                         cppstdin="$wrapper"
3537                         cppminus='';
3538                 else
3539                         echo "Nope, we'll have to live without it..."
3540                 fi
3541                 ;;
3542         esac
3543         case "$cpprun" in
3544         "$wrapper")
3545                 cpprun=''
3546                 cpplast=''
3547                 ;;
3548         esac
3549         ;;
3550 esac
3551
3552 case "$cppstdin" in
3553 "$wrapper"|'cppstdin') ;;
3554 *) $rm -f $wrapper;;
3555 esac
3556 $rm -f testcpp.c testcpp.out
3557
3558 : Set private lib path
3559 case "$plibpth" in
3560 '') if ./mips; then
3561                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3562         fi;;
3563 esac
3564 case "$libpth" in
3565 ' ') dlist='';;
3566 '') dlist="$loclibpth $plibpth $glibpth";;
3567 *) dlist="$libpth";;
3568 esac
3569
3570 : Now check and see which directories actually exist, avoiding duplicates
3571 libpth=''
3572 for xxx in $dlist
3573 do
3574     if $test -d $xxx; then
3575                 case " $libpth " in
3576                 *" $xxx "*) ;;
3577                 *) libpth="$libpth $xxx";;
3578                 esac
3579     fi
3580 done
3581 $cat <<'EOM'
3582
3583 Some systems have incompatible or broken versions of libraries.  Among
3584 the directories listed in the question below, please remove any you
3585 know not to be holding relevant libraries, and add any that are needed.
3586 Say "none" for none.
3587
3588 EOM
3589 case "$libpth" in
3590 '') dflt='none';;
3591 *)
3592         set X $libpth
3593         shift
3594         dflt=${1+"$@"}
3595         ;;
3596 esac
3597 rp="Directories to use for library searches?"
3598 . ./myread
3599 case "$ans" in
3600 none) libpth=' ';;
3601 *) libpth="$ans";;
3602 esac
3603
3604 : compute shared library extension
3605 case "$so" in
3606 '')
3607         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3608                 dflt='sl'
3609         else
3610                 dflt='so'
3611         fi
3612         ;;
3613 *) dflt="$so";;
3614 esac
3615 $cat <<EOM
3616
3617 On some systems, shared libraries may be available.  Answer 'none' if
3618 you want to suppress searching of shared libraries for the remainder
3619 of this configuration.
3620
3621 EOM
3622 rp='What is the file extension used for shared libraries?'
3623 . ./myread
3624 so="$ans"
3625
3626 : Define several unixisms.
3627 : Hints files or command line option can be used to override them.
3628 : The convoluted testing is in case hints files set either the old
3629 : or the new name.
3630 case "$_exe" in
3631 '')     case "$exe_ext" in
3632     '') ;;
3633         *)      _exe="$exe_ext" ;;
3634         esac
3635         ;;
3636 esac
3637 case "$_a" in
3638 '')     case "$lib_ext" in
3639     '') _a='.a';;
3640         *)      _a="$lib_ext" ;;
3641         esac
3642         ;;
3643 esac
3644 case "$_o" in
3645 '') case "$obj_ext" in
3646         '')     _o='.o';;
3647         *)      _o="$obj_ext";;
3648         esac
3649         ;;
3650 esac
3651 case "$p_" in
3652 '') case "$path_sep" in
3653         '')     p_=':';;
3654         *)      p_="$path_sep";;
3655         esac
3656         ;;
3657 esac
3658 exe_ext=$_exe
3659 lib_ext=$_a
3660 obj_ext=$_o
3661 path_sep=$p_
3662
3663 : Which makefile gets called first.  This is used by make depend.
3664 case "$firstmakefile" in
3665 '') firstmakefile='makefile';;
3666 esac
3667
3668 case "$usesocks" in
3669 $define|true|[yY]*)     dflt='y';;
3670 *) dflt='n';;
3671 esac
3672 cat <<EOM
3673
3674 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3675 Configure must be run with -Dusesocks.
3676
3677 If this doesn't make any sense to you, just accept the default '$dflt'.
3678 EOM
3679 rp='Build Perl for SOCKS?'
3680 . ./myread
3681 case "$ans" in
3682 y|Y)    val="$define" ;;     
3683 *)      val="$undef" ;;
3684 esac
3685 set usesocks
3686 eval $setvar
3687
3688 : Looking for optional libraries
3689 echo " "
3690 echo "Checking for optional libraries..." >&4
3691 case "$libs" in
3692 ' '|'') dflt='';;
3693 *) dflt="$libs";;
3694 esac
3695 case "$libswanted" in
3696 '') libswanted='c_s';;
3697 esac
3698 case "$usesocks" in
3699 $define)
3700         libswanted="$libswanted socks5 socks5_sh"
3701         ;;
3702 esac
3703 libsfound=''
3704 libsfiles=''
3705 libsdirs=''
3706 libspath=''
3707 for thisdir in $libpth $xlibpth; do
3708   test -d $thisdir && libspath="$libspath $thisdir"
3709 done
3710 for thislib in $libswanted; do
3711         for thisdir in $libspath; do
3712             xxx=''
3713             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3714                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3715                 $test -f "$xxx" && eval $libscheck
3716                 $test -f "$xxx" && libstyle=shared
3717             fi
3718             if test ! -f "$xxx"; then
3719                 xxx=$thisdir/lib$thislib.$so
3720                 $test -f "$xxx" && eval $libscheck
3721                 $test -f "$xxx" && libstyle=shared
3722             fi  
3723             if test ! -f "$xxx"; then
3724                 xxx=$thisdir/lib$thislib$_a
3725                 $test -f "$xxx" && eval $libscheck
3726                 $test -f "$xxx" && libstyle=static
3727             fi
3728             if test ! -f "$xxx"; then
3729                 xxx=$thisdir/$thislib$_a
3730                 $test -f "$xxx" && eval $libscheck
3731                 $test -f "$xxx" && libstyle=static
3732             fi
3733             if test ! -f "$xxx"; then
3734                 xxx=$thisdir/lib${thislib}_s$_a
3735                 $test -f "$xxx" && eval $libscheck
3736                 $test -f "$xxx" && libstyle=static
3737             fi
3738             if test ! -f "$xxx"; then
3739                 xxx=$thisdir/Slib$thislib$_a
3740                 $test -f "$xxx" && eval $libscheck
3741                 $test -f "$xxx" && libstyle=static
3742             fi
3743             if $test -f "$xxx"; then
3744                 case "$libstyle" in
3745                 shared) echo "Found -l$thislib (shared)." ;;
3746                 static) echo "Found -l$thislib." ;;
3747                 *)      echo "Found -l$thislib ($libstyle)." ;;
3748                 esac
3749                 case " $dflt " in
3750                 *"-l$thislib "*);;
3751                 *) dflt="$dflt -l$thislib"
3752                    libsfound="$libsfound $xxx"
3753                    yyy=`basename $xxx`
3754                    libsfiles="$libsfiles $yyy"
3755                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3756                    case " $libsdirs " in
3757                    *" $yyy "*) ;;
3758                    *) libsdirs="$libsdirs $yyy" ;;
3759                    esac
3760                    ;;
3761                 esac
3762                 break
3763             fi  
3764         done
3765         if $test ! -f "$xxx"; then
3766             echo "No -l$thislib."
3767         fi
3768 done
3769 set X $dflt
3770 shift
3771 dflt="$*"
3772 case "$libs" in
3773 '') dflt="$dflt";;
3774 *) dflt="$libs";;
3775 esac
3776 case "$dflt" in
3777 ' '|'') dflt='none';;
3778 esac
3779
3780 $cat <<EOM
3781
3782 In order to compile $package on your machine, a number of libraries
3783 are usually needed.  Include any other special libraries here as well.
3784 Say "none" for none.  The default list is almost always right.
3785 EOM
3786
3787 echo " "
3788 rp="What libraries to use?"
3789 . ./myread
3790 case "$ans" in
3791 none) libs=' ';;
3792 *) libs="$ans";;
3793 esac
3794
3795 : determine optimization, if desired, or use for debug flag also
3796 case "$optimize" in
3797 ' '|$undef) dflt='none';;
3798 '') dflt='-O';;
3799 *) dflt="$optimize";;
3800 esac
3801 $cat <<EOH
3802
3803 By default, $package compiles with the -O flag to use the optimizer.
3804 Alternately, you might want to use the symbolic debugger, which uses
3805 the -g flag (on traditional Unix systems).  Either flag can be
3806 specified here.  To use neither flag, specify the word "none".
3807
3808 EOH
3809 rp="What optimizer/debugger flag should be used?"
3810 . ./myread
3811 optimize="$ans"
3812 case "$optimize" in
3813 'none') optimize=" ";;
3814 esac
3815
3816 dflt=''
3817 : We will not override a previous value, but we might want to
3818 : augment a hint file
3819 case "$hint" in
3820 default|recommended)
3821         case "$gccversion" in
3822         1*) dflt='-fpcc-struct-return' ;;
3823         esac
3824         case "$optimize" in
3825         *-g*) dflt="$dflt -DDEBUGGING";;
3826         esac
3827         case "$gccversion" in
3828         2*) if test -d /etc/conf/kconfig.d &&
3829                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3830                 then
3831                         dflt="$dflt -posix"
3832                 fi
3833                 ;;
3834         esac
3835         case "$gccversion" in
3836         1*) ;;
3837         2.[0-8]*) ;;
3838         ?*)     echo " "
3839                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3840                 echo 'int main(void) { return 0; }' > gcctest.c
3841                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3842                         echo "Yes, it does." 2>&1
3843                         case "$ccflags" in
3844                         *strict-aliasing*) 
3845                                 echo "Leaving current flags $ccflags alone." 2>&1
3846                                 ;;
3847                         *) dflt="$dflt -fno-strict-aliasing" ;;
3848                         esac
3849                 else
3850                         echo "Nope, it doesn't, but that's ok." 2>&1
3851                 fi
3852                 ;;
3853         esac
3854         ;;
3855 esac
3856
3857 case "$mips_type" in
3858 *BSD*|'') inclwanted="$locincpth $usrinc";;
3859 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3860 esac
3861 for thisincl in $inclwanted; do
3862         if $test -d $thisincl; then
3863                 if $test x$thisincl != x$usrinc; then
3864                         case "$dflt" in
3865                         *$thisincl*);;
3866                         *) dflt="$dflt -I$thisincl";;
3867                         esac
3868                 fi
3869         fi
3870 done
3871
3872 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3873         xxx=true;
3874 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3875         xxx=true;
3876 else
3877         xxx=false;
3878 fi;
3879 if $xxx; then
3880         case "$dflt" in
3881         *$2*);;
3882         *) dflt="$dflt -D$2";;
3883         esac;
3884 fi'
3885
3886 set signal.h LANGUAGE_C; eval $inctest
3887
3888 case "$usesocks" in
3889 $define)
3890         ccflags="$ccflags -DSOCKS"
3891         ;;
3892 esac
3893
3894 case "$hint" in
3895 default|recommended) dflt="$ccflags $dflt" ;;
3896 *) dflt="$ccflags";;
3897 esac
3898
3899 case "$dflt" in
3900 ''|' ') dflt=none;;
3901 esac
3902 $cat <<EOH
3903
3904 Your C compiler may want other flags.  For this question you should include
3905 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3906 but you should NOT include libraries or ld flags like -lwhatever.  If you
3907 want $package to honor its debug switch, you should include -DDEBUGGING here.
3908 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3909
3910 To use no flags, specify the word "none".
3911
3912 EOH
3913 set X $dflt
3914 shift
3915 dflt=${1+"$@"}
3916 rp="Any additional cc flags?"
3917 . ./myread
3918 case "$ans" in
3919 none) ccflags='';;
3920 *) ccflags="$ans";;
3921 esac
3922
3923 : the following weeds options from ccflags that are of no interest to cpp
3924 cppflags="$ccflags"
3925 case "$gccversion" in
3926 1*) cppflags="$cppflags -D__GNUC__"
3927 esac
3928 case "$mips_type" in
3929 '');;
3930 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3931 esac
3932 case "$cppflags" in
3933 '');;
3934 *)
3935         echo " "
3936         echo "Let me guess what the preprocessor flags are..." >&4
3937         set X $cppflags
3938         shift
3939         cppflags=''
3940         $cat >cpp.c <<'EOM'
3941 #define BLURFL foo
3942
3943 BLURFL xx LFRULB
3944 EOM
3945         previous=''
3946         for flag in $*
3947         do
3948                 case "$flag" in
3949                 -*) ftry="$flag";;
3950                 *) ftry="$previous $flag";;
3951                 esac
3952                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3953                         >cpp1.out 2>/dev/null && \
3954                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3955                         >cpp2.out 2>/dev/null && \
3956                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3957                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3958                 then
3959                         cppflags="$cppflags $ftry"
3960                         previous=''
3961                 else
3962                         previous="$flag"
3963                 fi
3964         done
3965         set X $cppflags
3966         shift
3967         cppflags=${1+"$@"}
3968         case "$cppflags" in
3969         *-*)  echo "They appear to be: $cppflags";;
3970         esac
3971         $rm -f cpp.c cpp?.out
3972         ;;
3973 esac
3974
3975 : flags used in final linking phase
3976 case "$ldflags" in
3977 '') if ./venix; then
3978                 dflt='-i -z'
3979         else
3980                 dflt=''
3981         fi
3982         case "$ccflags" in
3983         *-posix*) dflt="$dflt -posix" ;;
3984         esac
3985         ;;
3986 *) dflt="$ldflags";;
3987 esac
3988
3989 : Try to guess additional flags to pick up local libraries.
3990 for thislibdir in $libpth; do
3991         case " $loclibpth " in
3992         *" $thislibdir "*)
3993                 case "$dflt " in 
3994                 *"-L$thislibdir "*) ;;
3995                 *)  dflt="$dflt -L$thislibdir" ;;
3996                 esac
3997                 ;;
3998         esac
3999 done
4000
4001 case "$dflt" in
4002 '') dflt='none' ;;
4003 esac
4004
4005 $cat <<EOH
4006
4007 Your C linker may need flags.  For this question you should
4008 include -L/whatever and any other flags used by the C linker, but you
4009 should NOT include libraries like -lwhatever.
4010
4011 Make sure you include the appropriate -L/path flags if your C linker
4012 does not normally search all of the directories you specified above,
4013 namely
4014         $libpth
4015 To use no flags, specify the word "none".
4016
4017 EOH
4018
4019 rp="Any additional ld flags (NOT including libraries)?"
4020 . ./myread
4021 case "$ans" in
4022 none) ldflags='';;
4023 *) ldflags="$ans";;
4024 esac
4025 rmlist="$rmlist pdp11"
4026
4027 : coherency check
4028 echo " "
4029 echo "Checking your choice of C compiler and flags for coherency..." >&4
4030 $cat > try.c <<'EOF'
4031 #include <stdio.h>
4032 int main() { printf("Ok\n"); exit(0); }
4033 EOF
4034 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4035 shift
4036 $cat >try.msg <<'EOM'
4037 I've tried to compile and run the following simple program:
4038
4039 EOM
4040 $cat try.c >> try.msg
4041
4042 $cat >> try.msg <<EOM
4043
4044 I used the command:
4045
4046         $*
4047         ./try
4048
4049 and I got the following output:
4050
4051 EOM
4052 dflt=y
4053 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4054         if sh -c './try' >>try.msg 2>&1; then
4055                 xxx=`./try`
4056                 case "$xxx" in
4057                 "Ok") dflt=n ;;
4058                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4059                         case " $libs " in
4060                         *" -lsfio "*)
4061                                 cat >> try.msg <<'EOQS'
4062 If $libs contains -lsfio, and sfio is mis-configured, then it
4063 sometimes (apparently) runs and exits with a 0 status, but with no
4064 output!  It may have to do with sfio's use of _exit vs. exit.
4065
4066 EOQS
4067                                 rp="You have a big problem.  Shall I abort Configure"
4068                                 dflt=y
4069                                 ;;
4070                         esac
4071                         ;;
4072                 esac
4073         else
4074                 echo "The program compiled OK, but exited with status $?." >>try.msg
4075                 rp="You have a problem.  Shall I abort Configure"
4076                 dflt=y
4077         fi
4078 else
4079         echo "I can't compile the test program." >>try.msg
4080         rp="You have a BIG problem.  Shall I abort Configure"
4081         dflt=y
4082 fi
4083 case "$dflt" in
4084 y)
4085         $cat try.msg >&4
4086         case "$knowitall" in
4087         '')
4088                 echo "(The supplied flags or libraries might be incorrect.)"
4089                 ;;
4090         *) dflt=n;;
4091         esac
4092         echo " "
4093         . ./myread
4094         case "$ans" in
4095         n*|N*) ;;
4096         *)      echo "Ok.  Stopping Configure." >&4
4097                 exit 1
4098                 ;;
4099         esac
4100         ;;
4101 n) echo "OK, that should do.";;
4102 esac
4103 $rm -f try try.* core
4104
4105 : define an is-a-typedef? function
4106 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4107 case "$inclist" in
4108 "") inclist="sys/types.h";;
4109 esac;
4110 eval "varval=\$$var";
4111 case "$varval" in
4112 "")
4113         $rm -f temp.c;
4114         for inc in $inclist; do
4115                 echo "#include <$inc>" >>temp.c;
4116         done;
4117         echo "#ifdef $type" >> temp.c;
4118         echo "printf(\"We have $type\");" >> temp.c;
4119         echo "#endif" >> temp.c;
4120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4121         if $contains $type temp.E >/dev/null 2>&1; then
4122                 eval "$var=\$type";
4123         else
4124                 eval "$var=\$def";
4125         fi;
4126         $rm -f temp.?;;
4127 *) eval "$var=\$varval";;
4128 esac'
4129
4130 : define an is-a-typedef? function that prompts if the type is not available.
4131 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4132 case "$inclist" in
4133 "") inclist="sys/types.h";;
4134 esac;
4135 eval "varval=\$$var";
4136 case "$varval" in
4137 "")
4138         $rm -f temp.c;
4139         for inc in $inclist; do
4140                 echo "#include <$inc>" >>temp.c;
4141         done;
4142         echo "#ifdef $type" >> temp.c;
4143         echo "printf(\"We have $type\");" >> temp.c;
4144         echo "#endif" >> temp.c;
4145         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4146         echo " " ;
4147         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4148         if $contains $type temp.E >/dev/null 2>&1; then
4149                 echo "$type found." >&4;
4150                 eval "$var=\$type";
4151         else
4152                 echo "$type NOT found." >&4;
4153                 dflt="$def";
4154                 . ./myread ;
4155                 eval "$var=\$ans";
4156         fi;
4157         $rm -f temp.?;;
4158 *) eval "$var=\$varval";;
4159 esac'
4160
4161 : define a shorthand compile call
4162 compile='
4163 mc_file=$1;
4164 shift;
4165 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4166 : define a shorthand compile call for compilations that should be ok.
4167 compile_ok='
4168 mc_file=$1;
4169 shift;
4170 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4171
4172 : check for lengths of integral types
4173 echo " "
4174 case "$intsize" in
4175 '')
4176         echo "Checking to see how big your integers are..." >&4
4177         $cat >intsize.c <<'EOCP'
4178 #include <stdio.h>
4179 int main()
4180 {
4181         printf("intsize=%d;\n", (int)sizeof(int));
4182         printf("longsize=%d;\n", (int)sizeof(long));
4183         printf("shortsize=%d;\n", (int)sizeof(short));
4184         exit(0);
4185 }
4186 EOCP
4187         set intsize
4188         if eval $compile_ok && ./intsize > /dev/null; then
4189                 eval `./intsize`
4190                 echo "Your integers are $intsize bytes long."
4191                 echo "Your long integers are $longsize bytes long."
4192                 echo "Your short integers are $shortsize bytes long."
4193         else
4194                 $cat >&4 <<EOM
4195 !
4196 Help! I can't compile and run the intsize test program: please enlighten me!
4197 (This is probably a misconfiguration in your system or libraries, and
4198 you really ought to fix it.  Still, I'll try anyway.)
4199 !
4200 EOM
4201                 dflt=4
4202                 rp="What is the size of an integer (in bytes)?"
4203                 . ./myread
4204                 intsize="$ans"
4205                 dflt=$intsize
4206                 rp="What is the size of a long integer (in bytes)?"
4207                 . ./myread
4208                 longsize="$ans"
4209                 dflt=2
4210                 rp="What is the size of a short integer (in bytes)?"
4211                 . ./myread
4212                 shortsize="$ans"
4213         fi
4214         ;;
4215 esac
4216 $rm -f intsize intsize.*
4217
4218 : see what type lseek is declared as in the kernel
4219 rp="What is the type used for lseek's offset on this system?"
4220 set off_t lseektype long stdio.h sys/types.h
4221 eval $typedef_ask
4222
4223 echo " "
4224 $echo $n "Checking to see how big your file offsets are...$c" >&4
4225 $cat >try.c <<EOCP
4226 #include <sys/types.h>
4227 #include <stdio.h>
4228 int main()
4229 {
4230     printf("%d\n", (int)sizeof($lseektype));
4231     return(0); 
4232 }
4233 EOCP
4234 set try
4235 if eval $compile_ok; then
4236         lseeksize=`./try`
4237         $echo " $lseeksize bytes." >&4
4238 else
4239         dflt=$longsize
4240         echo " "
4241         echo "(I can't seem to compile the test program.  Guessing...)"
4242         rp="What is the size of your file offsets (in bytes)?"
4243         . ./myread
4244         lseeksize="$ans"
4245 fi
4246 $rm -f try.c try
4247
4248 : see what type file positions are declared as in the library
4249 rp="What is the type for file position used by fsetpos()?"
4250 set fpos_t fpostype long stdio.h sys/types.h
4251 eval $typedef_ask
4252
4253 echo " "
4254 case "$fpostype" in
4255 *_t) zzz="$fpostype"    ;;
4256 *)   zzz="fpos_t"       ;;
4257 esac
4258 $echo $n "Checking the size of $zzz...$c" >&4 
4259 cat > try.c <<EOCP
4260 #include <sys/types.h>
4261 #include <stdio.h>
4262 int main() {
4263     printf("%d\n", (int)sizeof($fpostype));
4264     exit(0);
4265 }
4266 EOCP
4267 set try
4268 if eval $compile_ok; then
4269         yyy=`./try`
4270         case "$yyy" in
4271         '')     fpossize=4
4272                 echo " " >&4
4273                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4274                 ;;
4275         *)      fpossize=$yyy
4276                 echo " $fpossize bytes." >&4
4277                 ;;
4278         esac
4279 else
4280         dflt="$longsize"
4281         echo " " >&4
4282         echo "(I can't compile the test program.  Guessing...)" >&4
4283         rp="What is the size of your file positions (in bytes)?"
4284         . ./myread
4285         fpossize="$ans"
4286 fi
4287
4288
4289
4290 case "$lseeksize:$fpossize" in
4291 8:8) cat <<EOM
4292
4293 You can have files larger than 2 gigabytes.
4294 EOM
4295    val="$define" ;;
4296 *)    case "$uselargefiles" in
4297    "$undef"|false|[nN]*) dflt='n' ;;
4298    *)   dflt='y' ;;
4299    esac
4300    cat <<EOM
4301
4302 Perl can be built to understand large files (files larger than 2 gigabytes)
4303 on some systems.  To do so, Configure can be run with -Duselargefiles.
4304
4305 If this doesn't make any sense to you, just accept the default '$dflt'.
4306 EOM
4307    rp='Try to understand large files, if available?'
4308    . ./myread
4309    case "$ans" in
4310    y|Y)         val="$define" ;;
4311    *)           val="$undef"  ;;
4312    esac
4313    ;;
4314 esac
4315 set uselargefiles
4316 eval $setvar
4317 case "$uselargefiles" in
4318 "$define")
4319 : Look for a hint-file generated 'call-back-unit'.  If the
4320 : user has specified that a large files perl is to be built,
4321 : we may need to set or change some other defaults.
4322         if $test -f uselfs.cbu; then
4323                 echo "Your platform has some specific hints for large file builds, using them..."
4324                 . ./uselfs.cbu
4325                 echo " "
4326                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4327                 $cat >try.c <<EOCP
4328 #include <sys/types.h>
4329 #include <stdio.h>
4330 int main()
4331 {
4332     printf("%d\n", (int)sizeof($lseektype));
4333     return(0); 
4334 }
4335 EOCP
4336                 set try
4337                 if eval $compile_ok; then
4338                         lseeksize=`./try`
4339                         $echo " $lseeksize bytes." >&4
4340                 else
4341                         dflt="$lseeksize"
4342                         echo " "
4343                         echo "(I can't seem to compile the test program.  Guessing...)"
4344                         rp="What is the size of your file offsets (in bytes)?"
4345                         . ./myread
4346                         lseeksize="$ans"
4347                 fi
4348                 case "$fpostype" in
4349                 *_t) zzz="$fpostype"    ;;
4350                 *)   zzz="fpos_t"       ;;
4351                 esac
4352                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4353                 $cat > try.c <<EOCP
4354 #include <sys/types.h>
4355 #include <stdio.h>
4356 int main() {
4357     printf("%d\n", (int)sizeof($fpostype));
4358     exit(0);
4359 }
4360 EOCP
4361                 set try
4362                 if eval $compile_ok; then
4363                         yyy=`./try`
4364                         dflt="$lseeksize"
4365                         case "$yyy" in
4366                         '')     echo " "
4367                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4368                                 ;;
4369                         *)      fpossize=$yyy
4370                                 echo " $fpossize bytes."
4371                                 ;;
4372                         esac
4373                 else
4374                         dflt="$fpossize"
4375                         echo " "
4376                         echo "(I can't compile the test program.  Guessing...)" >&4
4377                         rp="What is the size of your file positions (in bytes)?"
4378                         . ./myread
4379                         fpossize="$ans"
4380                 fi
4381                 $rm -f try.c try
4382         fi
4383         ;;
4384 esac
4385
4386
4387 case "$usemorebits" in
4388 "$define"|true|[yY]*)
4389         use64bits="$define"
4390         uselongdouble="$define"
4391         usemorebits="$define"
4392         ;;
4393 *)      usemorebits="$undef"
4394         ;;
4395 esac
4396
4397
4398 case "$intsize:$longsize" in
4399 8:*|*:8) cat <<EOM
4400
4401 You have natively 64-bit integers.
4402 EOM
4403    val="$define"
4404    ;;
4405 *) case "$ccflags" in
4406    *-DUSE_64_BITS*|*-DUSE_LONG_LONG*) use64bits="$define";;
4407    *) case "$uselonglong" in
4408       $define|true|[yY]*) use64bits="$define";;
4409       esac
4410       ;;
4411    esac
4412    case "$use64bits" in
4413    $define|true|[yY]*) dflt='y';;
4414    *) dflt='n';;
4415    esac
4416 cat <<EOM
4417
4418 Perl can be built to take advantage of 64-bit integer types
4419 on some systems.  To do so, Configure can be run with -Duse64bits.
4420
4421 If this doesn't make any sense to you, just accept the default '$dflt'.
4422 EOM
4423    rp='Try to use 64-bit integers, if available?'
4424    . ./myread
4425    case "$ans" in
4426    [yY]*) val="$define" ;;
4427    *)     val="$undef"  ;;
4428    esac
4429    ;;
4430 esac
4431 set use64bits
4432 eval $setvar
4433
4434 case "$archname64" in
4435 '') archname64='' ;;    # not a typo
4436 esac
4437
4438 case "$use64bits" in
4439 "$define"|true|[yY]*)
4440 : Look for a hint-file generated 'call-back-unit'.  If the
4441 : user has specified that a 64-bit perl is to be built,
4442 : we may need to set or change some other defaults.
4443         if $test -f use64bits.cbu; then
4444                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4445                 . ./use64bits.cbu
4446         else
4447                 $cat <<EOM
4448 (Your platform doesn't have any specific hints for 64-bit builds.)
4449 EOM
4450                 case "$intsize:$longsize" in
4451 8:*|*:8) cat <<EOM
4452 (This is probably okay, as your system is a natively 64-bit system.)
4453 EOM
4454                   ;;
4455                 esac
4456                 case "$gccversion" in
4457                 '')     ;;
4458                 *)      case "$ccflags" in
4459                         *-DUSE_64_BITS*) ;;
4460                         *) $cat <<EOM
4461 But since you seem to be using gcc, I will now add -DUSE_64_BITS
4462 to the compilation flags to get long longs.
4463 EOM
4464                            ccflags="$ccflags -DUSE_64_BITS"
4465                            ;;
4466                         esac
4467                         ;;
4468                 esac
4469         fi
4470         ;;
4471 esac
4472
4473 : determine the architecture name
4474 echo " "
4475 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4476         tarch=`arch`"-$osname"
4477 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4478         if uname -m > tmparch 2>&1 ; then
4479                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4480                         -e 's/$/'"-$osname/" tmparch`
4481         else
4482                 tarch="$osname"
4483         fi
4484         $rm -f tmparch
4485 else
4486         tarch="$osname"
4487 fi
4488 case "$myarchname" in
4489 ''|"$tarch") ;;
4490 *)
4491         echo "(Your architecture name used to be $myarchname.)"
4492         archname=''
4493         ;;
4494 esac
4495 myarchname="$tarch"
4496 case "$archname" in
4497 '') dflt="$tarch";;
4498 *) dflt="$archname";;
4499 esac
4500 rp='What is your architecture name'
4501 . ./myread
4502 archname="$ans"
4503 case "$usethreads" in
4504 $define)
4505         echo "Threads selected." >&4
4506         case "$archname" in
4507         *-thread*) echo "...and architecture name already has -thread." >&4
4508                 ;;
4509         *)      archname="$archname-thread"
4510                 echo "...setting architecture name to $archname." >&4
4511                 ;;
4512         esac
4513         ;;
4514 esac
4515 case "$usemultiplicity" in
4516 $define)
4517         echo "Multiplicity selected." >&4
4518         case "$archname" in
4519         *-multi*) echo "...and architecture name already has -multi." >&4
4520                 ;;
4521         *)      archname="$archname-multi"
4522                 echo "...setting architecture name to $archname." >&4
4523                 ;;
4524         esac
4525         ;;
4526 esac
4527 case "$use64bits" in
4528 $define)
4529         case "$archname64" in
4530         '')
4531                 ;;
4532         *)
4533                 case "$archname" in
4534                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4535                         ;;
4536                 *)      archname="$archname-$archname64"
4537                         echo "...setting architecture name to $archname." >&4
4538                         ;;
4539                 esac
4540                 ;;
4541         esac
4542 esac
4543
4544 : determine root of directory hierarchy where package will be installed.
4545 case "$prefix" in
4546 '')
4547         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4548         ;;
4549 *)
4550         dflt="$prefix"
4551         ;;
4552 esac
4553 $cat <<EOM
4554
4555 By default, $package will be installed in $dflt/bin, manual pages
4556 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4557 installation directories. Typically this is something like /usr/local.
4558 If you wish to have binaries under /usr/bin but other parts of the
4559 installation under /usr/local, that's ok: you will be prompted
4560 separately for each of the installation directories, the prefix being
4561 only used to set the defaults.
4562
4563 EOM
4564 fn=d~
4565 rp='Installation prefix to use?'
4566 . ./getfile
4567 oldprefix=''
4568 case "$prefix" in
4569 '') ;;
4570 *)
4571         case "$ans" in
4572         "$prefix") ;;
4573         *) oldprefix="$prefix";;
4574         esac
4575         ;;
4576 esac
4577 prefix="$ans"
4578 prefixexp="$ansexp"
4579
4580 : is AFS running?
4581 echo " "
4582 case "$afs" in
4583 $define|true)   afs=true ;;
4584 $undef|false)   afs=false ;;
4585 *)      if test -d /afs; then
4586                 afs=true
4587         else
4588                 afs=false
4589         fi
4590         ;;
4591 esac
4592 if $afs; then
4593         echo "AFS may be running... I'll be extra cautious then..." >&4
4594 else
4595         echo "AFS does not seem to be running..." >&4
4596 fi
4597
4598 : determine installation prefix for where package is to be installed.
4599 if $afs; then 
4600 $cat <<EOM
4601
4602 Since you are running AFS, I need to distinguish the directory in which
4603 files will reside from the directory in which they are installed (and from
4604 which they are presumably copied to the former directory by occult means).
4605
4606 EOM
4607         case "$installprefix" in
4608         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4609         *) dflt="$installprefix";;
4610         esac
4611 else
4612 $cat <<EOM
4613
4614 In some special cases, particularly when building $package for distribution,
4615 it is convenient to distinguish between the directory in which files should 
4616 be installed from the directory ($prefix) in which they 
4617 will eventually reside.  For most users, these two directories are the same.
4618
4619 EOM
4620         case "$installprefix" in
4621         '') dflt=$prefix ;;
4622         *) dflt=$installprefix;;
4623         esac
4624 fi
4625 fn=d~
4626 rp='What installation prefix should I use for installing files?'
4627 . ./getfile
4628 installprefix="$ans"
4629 installprefixexp="$ansexp"
4630
4631 : set the prefixit variable, to compute a suitable default value
4632 prefixit='case "$3" in
4633 ""|none)
4634         case "$oldprefix" in
4635         "") eval "$1=\"\$$2\"";;
4636         *)
4637                 case "$3" in
4638                 "") eval "$1=";;
4639                 none)
4640                         eval "tp=\"\$$2\"";
4641                         case "$tp" in
4642                         ""|" ") eval "$1=\"\$$2\"";;
4643                         *) eval "$1=";;
4644                         esac;;
4645                 esac;;
4646         esac;;
4647 *)
4648         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4649         case "$tp" in
4650         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4651         /*-$oldprefix/*|\~*-$oldprefix/*)
4652                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4653         *) eval "$1=\"\$$2\"";;
4654         esac;;
4655 esac'
4656
4657 : set the base revision
4658 baserev=5.0
4659
4660
4661 : get the patchlevel
4662 echo " "
4663 echo "Getting the current patchlevel..." >&4
4664 if $test -r $rsrc/patchlevel.h;then
4665         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4666         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4667         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4668         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4669         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4670 else
4671         patchlevel=0
4672         subversion=0
4673         api_revision=0
4674         api_version=0
4675         api_subversion=0
4676 fi
4677 $echo $n "(You have $package" $c
4678 case "$package" in
4679 "*$baserev")    ;;
4680 *)              $echo $n " $baserev" $c ;;
4681 esac
4682 $echo $n " patchlevel $patchlevel" $c
4683 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4684 echo ".)"
4685 case "$osname" in
4686 dos|vms)
4687         : XXX Should be a Configure test for double-dots in filenames.
4688         version=`echo $baserev $patchlevel $subversion | \
4689                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4690         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4691                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4692         ;;
4693 *)
4694         version=`echo $baserev $patchlevel $subversion | \
4695                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4696         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4697                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4698         ;;
4699 esac
4700 : Special case the 5.005_xx maintenance series, which used 5.005
4701 : without any subversion label as a subdirectory in $sitelib
4702 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4703         api_versionstring='5.005'
4704 fi
4705
4706 : determine installation style
4707 : For now, try to deduce it from prefix unless it is already set.
4708 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4709 case "$installstyle" in
4710 '')     case "$prefix" in
4711                 *perl*) dflt='lib';;
4712                 *) dflt='lib/perl5' ;;
4713         esac
4714         ;;
4715 *)      dflt='lib/perl5' ;;
4716 esac
4717 : Probably not worth prompting for this since we prompt for all
4718 : the directories individually, and the prompt would be too long and
4719 : confusing anyway.
4720 installstyle=$dflt
4721
4722 : determine where private library files go
4723 : Usual default is /usr/local/lib/perl5/$version.
4724 : Also allow things like /opt/perl/lib/$version, since 
4725 : /opt/perl/lib/perl5... would be redundant.
4726 : The default "style" setting is made in installstyle.U
4727 case "$installstyle" in
4728 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4729 *)       set dflt privlib lib/$version ;;
4730 esac
4731 eval $prefixit
4732 $cat <<EOM
4733
4734 There are some auxiliary files for $package that need to be put into a
4735 private library directory that is accessible by everyone.
4736
4737 EOM
4738 fn=d~+
4739 rp='Pathname where the private library files will reside?'
4740 . ./getfile
4741 privlib="$ans"
4742 privlibexp="$ansexp"
4743 : Change installation prefix, if necessary.
4744 if $test X"$prefix" != X"$installprefix"; then
4745         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4746 else
4747         installprivlib="$privlibexp"
4748 fi
4749
4750 : set the prefixup variable, to restore leading tilda escape
4751 prefixup='case "$prefixexp" in
4752 "$prefix") ;;
4753 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4754 esac'
4755
4756 : determine where public architecture dependent libraries go
4757 set archlib archlib
4758 eval $prefixit
4759 : privlib default is /usr/local/lib/$package/$version
4760 : archlib default is /usr/local/lib/$package/$version/$archname
4761 : privlib may have an optional trailing /share.
4762 tdflt=`echo $privlib | $sed 's,/share$,,'`
4763 tdflt=$tdflt/$archname
4764 case "$archlib" in
4765 '')     dflt=$tdflt
4766         ;;
4767 *)      dflt="$archlib"
4768     ;;
4769 esac
4770 $cat <<EOM
4771
4772 $spackage contains architecture-dependent library files.  If you are
4773 sharing libraries in a heterogeneous environment, you might store
4774 these files in a separate location.  Otherwise, you can just include
4775 them with the rest of the public library files.
4776
4777 EOM
4778 fn=d+~
4779 rp='Where do you want to put the public architecture-dependent libraries?'
4780 . ./getfile
4781 archlib="$ans"
4782 archlibexp="$ansexp"
4783 if $test X"$archlib" = X"$privlib"; then
4784         d_archlib="$undef"
4785 else
4786         d_archlib="$define"
4787 fi
4788 : Change installation prefix, if necessary.
4789 if $test X"$prefix" != X"$installprefix"; then
4790         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4791 else
4792         installarchlib="$archlibexp"
4793 fi
4794
4795
4796 : Binary compatibility with 5.005 is not possible for builds
4797 : with advanced features
4798 case "$usethreads$usemultiplicity" in
4799 *define*)
4800         bincompat5005="$undef"
4801         d_bincompat5005="$undef"
4802         ;;
4803 *)      $cat <<EOM
4804
4805 Perl 5.006 can be compiled for binary compatibility with 5.005.
4806 If you decide to do so, you will be able to continue using most
4807 of the extensions that were compiled for Perl 5.005.
4808
4809 EOM
4810         case "$bincompat5005$d_bincompat5005" in
4811         *"$undef"*) dflt=n ;;
4812         *) dflt=y ;;
4813         esac
4814         rp='Binary compatibility with Perl 5.005?'
4815         . ./myread
4816         case "$ans" in
4817         y*) val="$define" ;;
4818         *)  val="$undef" ;;
4819         esac
4820         set d_bincompat5005
4821         eval $setvar
4822         case "$d_bincompat5005" in
4823         "$define")
4824                 bincompat5005="$define"
4825                 ;;
4826         *)      bincompat5005="$undef"
4827                 d_bincompat5005="$undef"
4828                 ;;
4829         esac
4830         ;;
4831 esac
4832
4833
4834 : see if setuid scripts can be secure
4835 $cat <<EOM
4836
4837 Some kernels have a bug that prevents setuid #! scripts from being
4838 secure.  Some sites have disabled setuid #! scripts because of this.
4839
4840 First let's decide if your kernel supports secure setuid #! scripts.
4841 (If setuid #! scripts would be secure but have been disabled anyway,
4842 don't say that they are secure if asked.)
4843
4844 EOM
4845
4846 val="$undef"
4847 if $test -d /dev/fd; then
4848         echo "#!$ls" >reflect
4849         chmod +x,u+s reflect
4850         ./reflect >flect 2>&1
4851         if $contains "/dev/fd" flect >/dev/null; then
4852                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4853                 val="$define"
4854         else
4855                 $cat <<EOM
4856 If you are not sure if they are secure, I can check but I'll need a
4857 username and password different from the one you are using right now.
4858 If you don't have such a username or don't want me to test, simply
4859 enter 'none'.
4860
4861 EOM
4862                 rp='Other username to test security of setuid scripts with?'
4863                 dflt='none'
4864                 . ./myread
4865                 case "$ans" in
4866                 n|none)
4867                         case "$d_suidsafe" in
4868                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4869                                 dflt=n;;
4870                         "$undef")
4871                                 echo "Well, the $hint value is *not* secure." >&4
4872                                 dflt=n;;
4873                         *)      echo "Well, the $hint value *is* secure." >&4
4874                                 dflt=y;;
4875                         esac
4876                         ;;
4877                 *)
4878                         $rm -f reflect flect
4879                         echo "#!$ls" >reflect
4880                         chmod +x,u+s reflect
4881                         echo >flect
4882                         chmod a+w flect
4883                         echo '"su" will (probably) prompt you for '"$ans's password."
4884                         su $ans -c './reflect >flect'
4885                         if $contains "/dev/fd" flect >/dev/null; then
4886                                 echo "Okay, it looks like setuid scripts are secure." >&4
4887                                 dflt=y
4888                         else
4889                                 echo "I don't think setuid scripts are secure." >&4
4890                                 dflt=n
4891                         fi
4892                         ;;
4893                 esac
4894                 rp='Does your kernel have *secure* setuid scripts?'
4895                 . ./myread
4896                 case "$ans" in
4897                 [yY]*)  val="$define";;
4898                 *)      val="$undef";;
4899                 esac
4900         fi
4901 else
4902         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4903         echo "(That's for file descriptors, not floppy disks.)"
4904         val="$undef"
4905 fi
4906 set d_suidsafe
4907 eval $setvar
4908
4909 $rm -f reflect flect
4910
4911 : now see if they want to do setuid emulation
4912 echo " "
4913 val="$undef"
4914 case "$d_suidsafe" in
4915 "$define")
4916         val="$undef"
4917         echo "No need to emulate SUID scripts since they are secure here." >& 4
4918         ;;
4919 *)
4920         $cat <<EOM
4921 Some systems have disabled setuid scripts, especially systems where
4922 setuid scripts cannot be secure.  On systems where setuid scripts have
4923 been disabled, the setuid/setgid bits on scripts are currently
4924 useless.  It is possible for $package to detect those bits and emulate
4925 setuid/setgid in a secure fashion.  This emulation will only work if
4926 setuid scripts have been disabled in your kernel.
4927
4928 EOM
4929         case "$d_dosuid" in
4930         "$define") dflt=y ;;
4931         *) dflt=n ;;
4932         esac
4933         rp="Do you want to do setuid/setgid emulation?"
4934         . ./myread
4935         case "$ans" in
4936         [yY]*)  val="$define";;
4937         *)      val="$undef";;
4938         esac
4939         ;;
4940 esac
4941 set d_dosuid
4942 eval $setvar
4943
4944 : determine filename position in cpp output
4945 echo " "
4946 echo "Computing filename position in cpp output for #include directives..." >&4
4947 echo '#include <stdio.h>' > foo.c
4948 $cat >fieldn <<EOF
4949 $startsh
4950 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4951 $grep '^[       ]*#.*stdio\.h' | \
4952 while read cline; do
4953         pos=1
4954         set \$cline
4955         while $test \$# -gt 0; do
4956                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4957                         echo "\$pos"
4958                         exit 0
4959                 fi
4960                 shift
4961                 pos=\`expr \$pos + 1\`
4962         done
4963 done
4964 EOF
4965 chmod +x fieldn
4966 fieldn=`./fieldn`
4967 $rm -f foo.c fieldn
4968 case $fieldn in
4969 '') pos='???';;
4970 1) pos=first;;
4971 2) pos=second;;
4972 3) pos=third;;
4973 *) pos="${fieldn}th";;
4974 esac
4975 echo "Your cpp writes the filename in the $pos field of the line."
4976
4977 : locate header file
4978 $cat >findhdr <<EOF
4979 $startsh
4980 wanted=\$1
4981 name=''
4982 for usrincdir in $usrinc
4983 do
4984         if test -f \$usrincdir/\$wanted; then
4985                 echo "\$usrincdir/\$wanted"
4986                 exit 0
4987         fi
4988 done
4989 awkprg='{ print \$$fieldn }'
4990 echo "#include <\$wanted>" > foo\$\$.c
4991 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4992 $grep "^[       ]*#.*\$wanted" | \
4993 while read cline; do
4994         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4995         case "\$name" in
4996         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4997         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4998         *) exit 2;;
4999         esac;
5000 done;
5001 #
5002 # status = 0: grep returned 0 lines, case statement not executed
5003 # status = 1: headerfile found
5004 # status = 2: while loop executed, no headerfile found
5005 #
5006 status=\$?
5007 $rm -f foo\$\$.c;
5008 if test \$status -eq 1; then
5009         exit 0;
5010 fi
5011 exit 1
5012 EOF
5013 chmod +x findhdr
5014
5015 : define an alternate in-header-list? function
5016 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5017 cont=true; xxf="echo \"<\$1> found.\" >&4";
5018 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5019 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5020 esac;
5021 case $# in 4) instead=instead;; *) instead="at last";; esac;
5022 while $test "$cont"; do
5023         xxx=`./findhdr $1`
5024         var=$2; eval "was=\$$2";
5025         if $test "$xxx" && $test -r "$xxx";
5026         then eval $xxf;
5027         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5028                 cont="";
5029         else eval $xxnf;
5030         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5031         set $yyy; shift; shift; yyy=$@;
5032         case $# in 0) cont="";;
5033         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5034                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5035         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5036                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5037         esac;
5038 done;
5039 while $test "$yyy";
5040 do set $yyy; var=$2; eval "was=\$$2";
5041         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5042         set $yyy; shift; shift; yyy=$@;
5043 done'
5044
5045 : see if this is a malloc.h system
5046 set malloc.h i_malloc
5047 eval $inhdr
5048
5049 : see if stdlib is available
5050 set stdlib.h i_stdlib
5051 eval $inhdr
5052
5053 : determine which malloc to compile in
5054 echo " "
5055 case "$usemymalloc" in
5056 ''|[yY]*|true|$define)  dflt='y' ;;
5057 *)      dflt='n' ;;
5058 esac
5059 rp="Do you wish to attempt to use the malloc that comes with $package?"
5060 . ./myread
5061 usemymalloc="$ans"
5062 case "$ans" in
5063 y*|true)
5064         usemymalloc='y'
5065         mallocsrc='malloc.c'
5066         mallocobj="malloc$_o"
5067         d_mymalloc="$define"
5068         case "$libs" in
5069         *-lmalloc*)
5070                 : Remove malloc from list of libraries to use
5071                 echo "Removing unneeded -lmalloc from library list" >&4
5072                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5073                 shift
5074                 libs="$*"
5075                 echo "libs = $libs" >&4
5076                 ;;
5077         esac
5078         ;;
5079 *)
5080         usemymalloc='n'
5081         mallocsrc=''
5082         mallocobj=''
5083         d_mymalloc="$undef"
5084         ;;
5085 esac
5086
5087 : compute the return types of malloc and free
5088 echo " "
5089 $cat >malloc.c <<END
5090 #$i_malloc I_MALLOC
5091 #$i_stdlib I_STDLIB
5092 #include <stdio.h>
5093 #include <sys/types.h>
5094 #ifdef I_MALLOC
5095 #include <malloc.h>
5096 #endif
5097 #ifdef I_STDLIB
5098 #include <stdlib.h>
5099 #endif
5100 #ifdef TRY_MALLOC
5101 void *malloc();
5102 #endif
5103 #ifdef TRY_FREE
5104 void free();
5105 #endif
5106 END
5107 case "$malloctype" in
5108 '')
5109         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5110                 malloctype='void *'
5111         else
5112                 malloctype='char *'
5113         fi
5114         ;;
5115 esac
5116 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5117
5118 case "$freetype" in
5119 '')
5120         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5121                 freetype='void'
5122         else
5123                 freetype='int'
5124         fi
5125         ;;
5126 esac
5127 echo "Your system uses $freetype free(), it would seem." >&4
5128 $rm -f malloc.[co]
5129 $cat <<EOM
5130
5131 The installation process will also create a directory for
5132 vendor-supplied add-ons.  Vendors who supply perl with their system
5133 may find it convenient to place all vendor-supplied files in this
5134 directory rather than in the main distribution directory.  This will
5135 ease upgrades between binary-compatible maintenance versions of perl.
5136
5137 Of course you may also use these directories in whatever way you see
5138 fit.  For example, you might use them to access modules shared over a
5139 company-wide network.
5140
5141 The default answer should be fine for most people.
5142 This causes further questions about vendor add-ons to be skipped
5143 and no vendor-specific directories will be configured for perl.
5144
5145 EOM
5146 rp='Do you want to configure vendor-specific add-on directories?'
5147 case "$usevendorprefix" in
5148 define|true|[yY]*) dflt=y ;;
5149 *) dflt=n ;;
5150 esac
5151 . ./myread
5152 case "$ans" in
5153 [yY]*)  fn=d~+
5154         rp='Installation prefix to use for vendor-supplied add-ons?'
5155         case "$vendorprefix" in
5156         '') dflt='' ;;
5157         *)  dflt=$vendorprefix ;;
5158         esac
5159         . ./getfile
5160         oldvendorprefix=''
5161         case "$vendorprefix" in
5162         '') ;;
5163         *)      case "$ans" in
5164                 "$prefix") ;;
5165                 *) oldvendorprefix="$prefix";;
5166                 esac
5167                 ;;
5168         esac
5169         usevendorprefix="$define"
5170         vendorprefix="$ans"
5171         vendorprefixexp="$ansexp"
5172         ;;
5173 *)      usevendorprefix="$undef"
5174         vendorprefix=''
5175         vendorprefixexp=''
5176         ;;
5177 esac
5178
5179 case "$vendorprefix" in
5180 '')     d_vendorlib="$undef"
5181         vendorlib=''
5182         vendorlibexp=''
5183         ;;
5184 *)      d_vendorlib="$define"
5185         : determine where vendor-supplied modules go.
5186         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5187         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5188         case "$installstyle" in
5189         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5190         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5191         esac
5192         fn=d~+
5193         rp='Pathname for the vendor-supplied library files?'
5194         . ./getfile
5195         vendorlib="$ans"
5196         vendorlibexp="$ansexp"
5197         : Change installation prefix, if necessary.
5198         if $test X"$prefix" != X"$installprefix"; then
5199                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5200         else
5201                 installvendorlib="$vendorlibexp"
5202         fi
5203         ;;
5204 esac
5205
5206 : Cruising for prototypes
5207 echo " "
5208 echo "Checking out function prototypes..." >&4
5209 $cat >prototype.c <<'EOCP'
5210 int main(int argc, char *argv[]) {
5211         exit(0);}
5212 EOCP
5213 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5214         echo "Your C compiler appears to support function prototypes."
5215         val="$define"
5216 else
5217         echo "Your C compiler doesn't seem to understand function prototypes."
5218         val="$undef"
5219 fi
5220 set prototype
5221 eval $setvar
5222 $rm -f prototype*
5223
5224 case "$prototype" in
5225 "$define") ;;
5226 *)      ansi2knr='ansi2knr'
5227         echo " "
5228         cat <<EOM >&4
5229
5230 $me:  FATAL ERROR:
5231 This version of $package can only be compiled by a compiler that 
5232 understands function prototypes.  Unfortunately, your C compiler 
5233         $cc $ccflags
5234 doesn't seem to understand them.  Sorry about that.
5235
5236 If GNU cc is available for your system, perhaps you could try that instead.  
5237
5238 Eventually, we hope to support building Perl with pre-ANSI compilers.
5239 If you would like to help in that effort, please contact <perlbug@perl.org>.
5240
5241 Aborting Configure now.
5242 EOM
5243         exit 2
5244         ;;
5245 esac
5246
5247 : determine where public executables go
5248 echo " "
5249 set dflt bin bin
5250 eval $prefixit
5251 fn=d~
5252 rp='Pathname where the public executables will reside?'
5253 . ./getfile
5254 if $test "X$ansexp" != "X$binexp"; then
5255         installbin=''
5256 fi
5257 bin="$ans"
5258 binexp="$ansexp"
5259 : Change installation prefix, if necessary.
5260 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5261 if $test X"$prefix" != X"$installprefix"; then
5262         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5263 else
5264         installbin="$binexp"
5265 fi
5266
5267 $cat <<EOM
5268
5269 After $package is installed, you may wish to install various
5270 add-on modules and utilities.  Typically, these add-ons will
5271 be installed under $prefix with the rest
5272 of this package.  However, you may wish to install such add-ons
5273 elsewhere under a different prefix.
5274
5275 If you do not wish to put everything under a single prefix, that's
5276 ok.  You will be prompted for the individual locations; this siteprefix
5277 is only used to suggest the defaults.
5278
5279 The default should be fine for most people.
5280
5281 EOM
5282 fn=d~+
5283 rp='Installation prefix to use for add-on modules and utilities?'
5284 : XXX Here might be another good place for an installstyle setting.
5285 case "$siteprefix" in
5286 '') dflt=$prefix ;;
5287 *)  dflt=$siteprefix ;;
5288 esac
5289 . ./getfile
5290 oldsiteprefix=''
5291 case "$siteprefix" in
5292 '') ;;
5293 *)
5294         case "$ans" in
5295         "$prefix") ;;
5296         *) oldsiteprefix="$prefix";;
5297         esac
5298         ;;
5299 esac
5300 siteprefix="$ans"
5301 siteprefixexp="$ansexp"
5302
5303 : determine where site specific libraries go.
5304 : Usual default is /usr/local/lib/perl5/site_perl/$version
5305 : The default "style" setting is made in installstyle.U
5306 : XXX No longer works with Prefixit stuff.
5307 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5308 case "$installstyle" in
5309 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5310 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5311 esac
5312 $cat <<EOM
5313
5314 The installation process will create a directory for
5315 site-specific extensions and modules.  Most users find it convenient
5316 to place all site-specific files in this directory rather than in the
5317 main distribution directory.
5318
5319 EOM
5320 fn=d~+
5321 rp='Pathname for the site-specific library files?'
5322 . ./getfile
5323 sitelib="$ans"
5324 sitelibexp="$ansexp"
5325 : Change installation prefix, if necessary.
5326 if $test X"$prefix" != X"$installprefix"; then
5327         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5328 else
5329         installsitelib="$sitelibexp"
5330 fi
5331
5332 : Determine list of previous versions to include in @INC
5333 $cat > getverlist <<EOPL
5334 #!$perl -w
5335 use File::Basename;
5336 \$api_versionstring = "$api_versionstring";
5337 \$version = "$version";
5338 \$sitelib = "$sitelib";
5339 \$archname = "$archname";
5340 EOPL
5341         $cat >> getverlist <<'EOPL'
5342 # Can't have leading @ because metaconfig interprets it as a command!
5343 ;@inc_version_list=();
5344 $stem=dirname($sitelib);
5345 # Redo to do opendir/readdir? 
5346 if (-d $stem) {
5347     chdir($stem);
5348     ;@candidates = glob("5.*");
5349 }
5350 else {
5351     ;@candidates = ();
5352 }
5353
5354 # XXX ToDo:  These comparisons must be reworked when two-digit
5355 # subversions come along, so that 5.7.10 compares as greater than
5356 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5357 # widespread that we can use the built-in version vectors rather
5358 # than reinventing them here.  For 5.6.0, however, we must
5359 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5360 foreach $d (@candidates) {
5361     if ($d lt $version) {
5362         if ($d ge $api_versionstring) {
5363             unshift(@inc_version_list, "$d/$archname", $d);
5364         }
5365         elsif ($d ge "5.005") {
5366             unshift(@inc_version_list, $d);
5367         }
5368     }
5369     else {
5370         # Skip newer version.  I.e. don't look in
5371         # 5.7.0 if we're installing 5.6.1.
5372     }
5373 }
5374
5375 if (@inc_version_list) {
5376     print join(' ', @inc_version_list);
5377 }
5378 else {
5379     # Blank space to preserve value for next Configure run.
5380     print " ";
5381 }
5382 EOPL
5383 chmod +x getverlist
5384 case "$inc_version_list" in
5385 '')     if test -x $perl; then
5386                 dflt=`$perl getverlist`
5387         else
5388                 dflt='none'
5389         fi
5390         ;;
5391 $undef) dflt='none' ;;
5392 *)  dflt="$inc_version_list" ;;
5393 esac
5394 $cat <<'EOM'
5395
5396 In order to ease the process of upgrading, this version of perl 
5397 can be configured to use modules built and installed with earlier 
5398 versions of perl that were installed under $prefix.  Specify here
5399 the list of earlier versions that this version of perl should check.
5400 If Configure detected no earlier versions of perl installed under
5401 $prefix, then the list will be empty.  Answer 'none' to tell perl
5402 to not search earlier versions.
5403
5404 The default should almost always be sensible, so if you're not sure,
5405 just accept the default.
5406 EOM
5407
5408 rp='List of earlier versions to include in @INC?'
5409 . ./myread
5410 case "$ans" in
5411 [Nn]one) inc_version_list=' ' ;;
5412 *) inc_version_list="$ans" ;;
5413 esac
5414 case "$inc_version_list" in
5415 ''|' ') 
5416         inc_version_list_init='0';;
5417 *)      inc_version_list_init=`echo $inc_version_list |
5418                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5419         ;;
5420 esac
5421 $rm -f getverlist
5422
5423 : determine whether to install perl also as /usr/bin/perl
5424
5425 echo " "
5426 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5427         $cat <<EOM
5428 Many scripts expect to perl to be installed as /usr/bin/perl.
5429 I can install the perl you are about to compile also as /usr/bin/perl
5430 (in addition to $installbin/perl).
5431 EOM
5432         case "$installusrbinperl" in
5433         "$undef"|[nN]*) dflt='n';;
5434         *)              dflt='y';;
5435         esac
5436         rp="Do you want to install perl as /usr/bin/perl?"
5437         . ./myread
5438         case "$ans" in
5439         [yY]*)  val="$define";;
5440         *)      val="$undef" ;;
5441         esac
5442 else
5443         val="$undef"
5444 fi
5445 set installusrbinperl
5446 eval $setvar
5447
5448 echo " "
5449 echo "Checking for GNU C Library..." >&4
5450 cat >gnulibc.c <<EOM
5451 #include <stdio.h>
5452 int main()
5453 {
5454 #ifdef __GLIBC__
5455     exit(0);
5456 #else
5457     exit(1);
5458 #endif
5459 }
5460 EOM
5461 set gnulibc
5462 if eval $compile_ok && ./gnulibc; then
5463         val="$define"
5464         echo "You are using the GNU C Library"
5465 else
5466         val="$undef"
5467         echo "You are not using the GNU C Library"
5468 fi
5469 $rm -f gnulibc*
5470 set d_gnulibc
5471 eval $setvar
5472
5473 : see if nm is to be used to determine whether a symbol is defined or not
5474 case "$usenm" in
5475 '')
5476         dflt=''
5477         case "$d_gnulibc" in
5478         "$define")
5479                 echo " "
5480                 echo "nm probably won't work on the GNU C Library." >&4
5481                 dflt=n
5482                 ;;
5483         esac
5484         case "$dflt" in
5485         '') 
5486                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5487                         echo " "
5488                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5489                         echo "'nm' won't be sufficient on this sytem." >&4
5490                         dflt=n
5491                 fi
5492                 ;;
5493         esac
5494         case "$dflt" in
5495         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5496                 if $test $dflt -gt 20; then
5497                         dflt=y
5498                 else
5499                         dflt=n
5500                 fi
5501                 ;;
5502         esac
5503         ;;
5504 *)
5505         case "$usenm" in
5506         true|$define) dflt=y;;
5507         *) dflt=n;;
5508         esac
5509         ;;
5510 esac
5511 $cat <<EOM
5512
5513 I can use $nm to extract the symbols from your C libraries. This
5514 is a time consuming task which may generate huge output on the disk (up
5515 to 3 megabytes) but that should make the symbols extraction faster. The
5516 alternative is to skip the 'nm' extraction part and to compile a small
5517 test program instead to determine whether each symbol is present. If
5518 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5519 this may be the best solution.
5520
5521 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5522
5523 EOM
5524 rp="Shall I use $nm to extract C symbols from the libraries?"
5525 . ./myread
5526 case "$ans" in
5527 [Nn]*) usenm=false;;
5528 *) usenm=true;;
5529 esac
5530
5531 runnm=$usenm
5532 case "$reuseval" in
5533 true) runnm=false;;
5534 esac
5535
5536 : nm options which may be necessary
5537 case "$nm_opt" in
5538 '') if $test -f /mach_boot; then
5539                 nm_opt=''       # Mach
5540         elif $test -d /usr/ccs/lib; then
5541                 nm_opt='-p'     # Solaris (and SunOS?)
5542         elif $test -f /dgux; then
5543                 nm_opt='-p'     # DG-UX
5544         elif $test -f /lib64/rld; then
5545                 nm_opt='-p'     # 64-bit Irix
5546         else
5547                 nm_opt=''
5548         fi;;
5549 esac
5550
5551 : nm options which may be necessary for shared libraries but illegal
5552 : for archive libraries.  Thank you, Linux.
5553 case "$nm_so_opt" in
5554 '')     case "$myuname" in
5555         *linux*)
5556                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5557                         nm_so_opt='--dynamic'
5558                 fi
5559                 ;;
5560         esac
5561         ;;
5562 esac
5563
5564 case "$runnm" in
5565 true)
5566 : get list of predefined functions in a handy place
5567 echo " "
5568 case "$libc" in
5569 '') libc=unknown
5570         case "$libs" in
5571         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5572         esac
5573         ;;
5574 esac
5575 libnames='';
5576 case "$libs" in
5577 '') ;;
5578 *)  for thislib in $libs; do
5579         case "$thislib" in
5580         -lc|-lc_s)
5581                 : Handle C library specially below.
5582                 ;;
5583         -l*)
5584                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5585                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5586                         :
5587                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5588                         :
5589                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5594                         :
5595                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5596                         :
5597                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5598                         :
5599                 else
5600                         try=''
5601                 fi
5602                 libnames="$libnames $try"
5603                 ;;
5604         *) libnames="$libnames $thislib" ;;
5605         esac
5606         done
5607         ;;
5608 esac
5609 xxx=normal
5610 case "$libc" in
5611 unknown)
5612         set /lib/libc.$so
5613         for xxx in $libpth; do
5614                 $test -r $1 || set $xxx/libc.$so
5615                 : The messy sed command sorts on library version numbers.
5616                 $test -r $1 || \
5617                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5618                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5619                                 h
5620                                 s/[0-9][0-9]*/0000&/g
5621                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5622                                 G
5623                                 s/\n/ /' | \
5624                          sort | $sed -e 's/^.* //'`
5625                 eval set \$$#
5626         done
5627         $test -r $1 || set /usr/ccs/lib/libc.$so
5628         $test -r $1 || set /lib/libsys_s$_a
5629         ;;
5630 *)
5631         set blurfl
5632         ;;
5633 esac
5634 if $test -r "$1"; then
5635         echo "Your (shared) C library seems to be in $1."
5636         libc="$1"
5637 elif $test -r /lib/libc && $test -r /lib/clib; then
5638         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5639         xxx=apollo
5640         libc='/lib/clib /lib/libc'
5641         if $test -r /lib/syslib; then
5642                 echo "(Your math library is in /lib/syslib.)"
5643                 libc="$libc /lib/syslib"
5644         fi
5645 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5646         echo "Your C library seems to be in $libc, as you said before."
5647 elif $test -r $incpath/usr/lib/libc$_a; then
5648         libc=$incpath/usr/lib/libc$_a;
5649         echo "Your C library seems to be in $libc.  That's fine."
5650 elif $test -r /lib/libc$_a; then
5651         libc=/lib/libc$_a;
5652         echo "Your C library seems to be in $libc.  You're normal."
5653 else
5654         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5655                 :
5656         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5657                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5658         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5659                 :
5660         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5661                 :
5662         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5663                 :
5664         else
5665                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5666         fi
5667         if $test -r "$tans"; then
5668                 echo "Your C library seems to be in $tans, of all places."
5669                 libc=$tans
5670         else
5671                 libc='blurfl'
5672         fi
5673 fi
5674 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5675         dflt="$libc"
5676         cat <<EOM
5677
5678 If the guess above is wrong (which it might be if you're using a strange
5679 compiler, or your machine supports multiple models), you can override it here.
5680
5681 EOM
5682 else
5683         dflt=''
5684         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5685         cat >&4 <<EOM
5686 I can't seem to find your C library.  I've looked in the following places:
5687
5688 EOM
5689         $sed 's/^/      /' libpath
5690         cat <<EOM
5691
5692 None of these seems to contain your C library. I need to get its name...
5693
5694 EOM
5695 fi
5696 fn=f
5697 rp='Where is your C library?'
5698 . ./getfile
5699 libc="$ans"
5700
5701 echo " "
5702 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5703 set X `cat libnames`
5704 shift
5705 xxx=files
5706 case $# in 1) xxx=file; esac
5707 echo "Extracting names from the following $xxx for later perusal:" >&4
5708 echo " "
5709 $sed 's/^/      /' libnames >&4
5710 echo " "
5711 $echo $n "This may take a while...$c" >&4
5712
5713 for file in $*; do
5714         case $file in
5715         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5716         *) $nm $nm_opt $file 2>/dev/null;;
5717         esac
5718 done >libc.tmp
5719
5720 $echo $n ".$c"
5721 $grep fprintf libc.tmp > libc.ptf
5722 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5723 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5724 xxx='[ADTSIW]'
5725 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5750                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5763         eval $xscan;\
5764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765                 eval $xrun
5766 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5767         eval $xscan;\
5768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769                 eval $xrun
5770 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5771         eval $xscan;\
5772         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5773                 eval $xrun
5774 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5775         eval $xscan;\
5776         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5777                 eval $xrun
5778 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5779         eval $xscan;\
5780         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5781                 eval $xrun
5782 else
5783         $nm -p $* 2>/dev/null >libc.tmp
5784         $grep fprintf libc.tmp > libc.ptf
5785         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5786                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5787         then
5788                 nm_opt='-p'
5789                 eval $xrun
5790         else
5791                 echo " "
5792                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5793                 com=''
5794                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5795                         for thisname in $libnames $libc; do
5796                                 $ar t $thisname >>libc.tmp
5797                         done
5798                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5799                         echo "Ok." >&4
5800                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5801                         # Repeat libc to extract forwarders to DLL entries too
5802                         for thisname in $libnames $libc; do
5803                                 $ar tv $thisname >>libc.tmp
5804                                 # Revision 50 of EMX has bug in $ar.
5805                                 # it will not extract forwarders to DLL entries
5806                                 # Use emximp which will extract exactly them.
5807                                 emximp -o tmp.imp $thisname \
5808                                     2>/dev/null && \
5809                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5810                                     < tmp.imp >>libc.tmp
5811                                 $rm tmp.imp
5812                         done
5813                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5814                         echo "Ok." >&4
5815                 else
5816                         echo "$ar didn't seem to work right." >&4
5817                         echo "Maybe this is a Cray...trying bld instead..." >&4
5818                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5819                         then
5820                                 for thisname in $libnames; do
5821                                         bld t $libnames | \
5822                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5823                                         $ar t $thisname >>libc.tmp
5824                                 done
5825                                 echo "Ok." >&4
5826                         else
5827                                 echo "That didn't work either.  Giving up." >&4
5828                                 exit 1
5829                         fi
5830                 fi
5831         fi
5832 fi
5833 nm_extract="$com"
5834 if $test -f /lib/syscalls.exp; then
5835         echo " "
5836         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5837         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5838 fi
5839 ;;
5840 esac
5841 $rm -f libnames libpath
5842
5843 : see if dld is available
5844 set dld.h i_dld
5845 eval $inhdr
5846
5847 : is a C symbol defined?
5848 csym='tlook=$1;
5849 case "$3" in
5850 -v) tf=libc.tmp; tc=""; tdc="";;
5851 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5852 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5853 esac;
5854 tx=yes;
5855 case "$reuseval-$4" in
5856 true-) ;;
5857 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5858 esac;
5859 case "$tx" in
5860 yes)
5861         case "$runnm" in
5862         true)
5863                 if $contains $tlook $tf >/dev/null 2>&1;
5864                 then tval=true;
5865                 else tval=false;
5866                 fi;;
5867         *)
5868                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5869                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5870                 then tval=true;
5871                 else tval=false;
5872                 fi;
5873                 $rm -f t t.c;;
5874         esac;;
5875 *)
5876         case "$tval" in
5877         $define) tval=true;;
5878         *) tval=false;;
5879         esac;;
5880 esac;
5881 eval "$2=$tval"'
5882
5883 : define an is-in-libc? function
5884 inlibc='echo " "; td=$define; tu=$undef;
5885 sym=$1; var=$2; eval "was=\$$2";
5886 tx=yes;
5887 case "$reuseval$was" in
5888 true) ;;
5889 true*) tx=no;;
5890 esac;
5891 case "$tx" in
5892 yes)
5893         set $sym tres -f;
5894         eval $csym;
5895         case "$tres" in
5896         true)
5897                 echo "$sym() found." >&4;
5898                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5899         *)
5900                 echo "$sym() NOT found." >&4;
5901                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5902         esac;;
5903 *)
5904         case "$was" in
5905         $define) echo "$sym() found." >&4;;
5906         *) echo "$sym() NOT found." >&4;;
5907         esac;;
5908 esac'
5909
5910 : see if dlopen exists
5911 xxx_runnm="$runnm"
5912 runnm=false
5913 set dlopen d_dlopen
5914 eval $inlibc
5915 runnm="$xxx_runnm"
5916
5917 : determine which dynamic loading, if any, to compile in
5918 echo " "
5919 dldir="ext/DynaLoader"
5920 case "$usedl" in
5921 $define|y|true)
5922         dflt='y'
5923         usedl="$define"
5924         ;;
5925 $undef|n|false)
5926         dflt='n'
5927         usedl="$undef"
5928         ;;
5929 *) 
5930         dflt='n'
5931         case "$d_dlopen" in
5932             $define) dflt='y' ;;
5933         esac
5934         case "$i_dld" in
5935             $define) dflt='y' ;;
5936         esac
5937         : Does a dl_xxx.xs file exist for this operating system
5938         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5939         ;;
5940 esac
5941 rp="Do you wish to use dynamic loading?"
5942 . ./myread
5943 usedl="$ans"
5944 case "$ans" in
5945 y*) usedl="$define"
5946         case "$dlsrc" in
5947         '')
5948                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5949                         dflt="$dldir/dl_${osname}.xs"
5950                 elif $test "$d_dlopen" = "$define" ; then
5951                         dflt="$dldir/dl_dlopen.xs"
5952                 elif $test "$i_dld" = "$define" ; then
5953                         dflt="$dldir/dl_dld.xs"
5954                 else
5955                         dflt=''
5956                 fi
5957                 ;;
5958         *)      dflt="$dldir/$dlsrc"
5959                 ;;
5960         esac
5961     echo "The following dynamic loading files are available:"
5962         : Can not go over to $dldir because getfile has path hard-coded in.
5963         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5964         rp="Source file to use for dynamic loading"
5965         fn="fne"
5966         gfpth="$src"
5967         . ./getfile
5968         usedl="$define"
5969         : emulate basename
5970         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
5971
5972         $cat << EOM
5973
5974 Some systems may require passing special flags to $cc -c to
5975 compile modules that will be used to create a shared library.
5976 To use no flags, say "none".
5977
5978 EOM
5979     case "$cccdlflags" in
5980     '') case "$gccversion" in
5981                 '') case "$osname" in
5982                         hpux)   dflt='+z' ;;
5983                         next)   dflt='none' ;;
5984                         irix*)  dflt='-KPIC' ;;
5985                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5986                         sunos)  dflt='-pic' ;;
5987                         *)      dflt='none' ;;
5988                     esac
5989                         ;;
5990                 *)  case "$osname" in
5991                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5992                         *)      dflt='-fpic' ;;
5993                     esac ;;
5994             esac ;;
5995         ' ') dflt='none' ;;
5996     *)  dflt="$cccdlflags" ;;
5997     esac
5998     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5999     . ./myread
6000     case "$ans" in
6001     none) cccdlflags=' ' ;;
6002     *) cccdlflags="$ans" ;;
6003     esac
6004
6005     cat << EOM
6006
6007 Some systems use ld to create libraries that can be dynamically loaded,
6008 while other systems (such as those using ELF) use $cc.
6009
6010 EOM
6011         case "$ld" in
6012         '')     $cat >try.c <<'EOM'
6013 /* Test for whether ELF binaries are produced */
6014 #include <fcntl.h>
6015 #include <stdlib.h>
6016 int main() {
6017         char b[4];
6018         int i = open("a.out",O_RDONLY);
6019         if(i == -1) 
6020                 exit(1); /* fail */
6021         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6022                 exit(0); /* succeed (yes, it's ELF) */
6023         else
6024                 exit(1); /* fail */
6025 }
6026 EOM
6027                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6028                         cat <<EOM
6029 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6030 EOM
6031                         dflt="$cc"
6032                 else
6033                         echo "I'll use ld to build dynamic libraries."
6034                         dflt='ld'
6035                 fi
6036                 rm -f try.c a.out
6037                 ;;
6038         *)      dflt="$ld"
6039                 ;;
6040         esac
6041
6042     rp="What command should be used to create dynamic libraries?"
6043     . ./myread
6044         ld="$ans"
6045
6046     cat << EOM
6047
6048 Some systems may require passing special flags to $ld to create a
6049 library that can be dynamically loaded.  If your ld flags include
6050 -L/other/path options to locate libraries outside your loader's normal
6051 search path, you may need to specify those -L options here as well.  To
6052 use no flags, say "none".
6053
6054 EOM
6055     case "$lddlflags" in
6056     '') case "$osname" in
6057                         beos) dflt='-nostart' ;;
6058                         hpux)  dflt='-b +vnocompatwarnings' ;;
6059                         linux|irix*)    dflt='-shared' ;;
6060                         next)  dflt='none' ;;
6061                         solaris) dflt='-G' ;;
6062                         sunos) dflt='-assert nodefinitions' ;;
6063                         svr4*|esix*) dflt="-G $ldflags" ;;
6064                 *)     dflt='none' ;;
6065                         esac
6066                         ;;
6067     *) dflt="$lddlflags" ;;
6068     esac
6069
6070         : Try to guess additional flags to pick up local libraries.
6071         : Be careful not to append to a plain 'none'
6072         case "$dflt" in
6073         none) dflt='' ;;
6074         esac
6075         for thisflag in $ldflags; do
6076                 case "$thisflag" in
6077                 -L*)
6078                         case " $dflt " in
6079                         *" $thisflag "*) ;;
6080                         *) dflt="$dflt $thisflag" ;;
6081                         esac
6082                         ;;
6083                 esac
6084         done
6085
6086         case "$dflt" in
6087         ''|' ') dflt='none' ;;
6088         esac
6089
6090     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6091     . ./myread
6092     case "$ans" in
6093     none) lddlflags=' ' ;;
6094     *) lddlflags="$ans" ;;
6095     esac
6096
6097         cat <<EOM
6098
6099 Some systems may require passing special flags to $cc to indicate that
6100 the resulting executable will use dynamic linking.  To use no flags,
6101 say "none".
6102
6103 EOM
6104     case "$ccdlflags" in
6105     '') case "$osname" in
6106                 hpux)   dflt='-Wl,-E' ;;
6107                 linux)  dflt='-rdynamic' ;;
6108                 next)   dflt='none' ;;
6109                 sunos)  dflt='none' ;;
6110                 *)      dflt='none' ;;
6111             esac ;;
6112     ' ')  dflt='none' ;;
6113     *)  dflt="$ccdlflags" ;;
6114     esac
6115     rp="Any special flags to pass to $cc to use dynamic linking?"
6116     . ./myread
6117     case "$ans" in
6118     none) ccdlflags=' ' ;;
6119     *) ccdlflags="$ans" ;;
6120     esac
6121     ;;
6122 *)  usedl="$undef"
6123         ld='ld'
6124     dlsrc='dl_none.xs'
6125     lddlflags=''
6126     ccdlflags=''
6127     ;;
6128 esac
6129
6130 also=''
6131 case "$usedl" in
6132 $undef)
6133         # No dynamic loading being used, so don't bother even to prompt.
6134         useshrplib='false'
6135         ;;
6136 *)      case "$useshrplib" in
6137         '')     case "$osname" in
6138                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6139                         dflt=y
6140                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6141                         ;;
6142                 next*)
6143                         case "$osvers" in
6144                         4*)     dflt=y
6145                                 also='Building a shared libperl is needed for MAB support.'
6146                                 ;;
6147                         *)      dflt=n
6148                                 ;;
6149                         esac
6150                         ;;
6151                 *)      dflt=n
6152                         ;;
6153                 esac
6154                 ;;
6155         $define|true|[Yy]*)
6156                 dflt=y
6157                 ;;
6158         *)      dflt=n
6159                 ;;
6160         esac
6161         $cat << EOM
6162
6163 The perl executable is normally obtained by linking perlmain.c with
6164 libperl${_a}, any static extensions (usually just DynaLoader), and
6165 any other libraries needed on this system (such as -lm, etc.).  Since
6166 your system supports dynamic loading, it is probably possible to build
6167 a shared libperl.$so.  If you will have more than one executable linked
6168 to libperl.$so, this will significantly reduce the size of each
6169 executable, but it may have a noticeable affect on performance.  The
6170 default is probably sensible for your system.
6171 $also
6172
6173 EOM
6174         rp="Build a shared libperl.$so (y/n)"
6175         . ./myread
6176         case "$ans" in
6177         true|$define|[Yy]*)
6178                 useshrplib='true'  ;;
6179         *)      useshrplib='false' ;;
6180         esac
6181         ;;
6182 esac
6183
6184 case "$useshrplib" in
6185 true)
6186         case "$libperl" in
6187         '')
6188                 # Figure out a good name for libperl.so.  Since it gets stored in
6189                 # a version-specific architecture-dependent library, the version
6190                 # number isn't really that important, except for making cc/ld happy.
6191                 #
6192                 # A name such as libperl.so.3.1
6193                 majmin="libperl.$so.$patchlevel.$subversion"
6194                 # A name such as libperl.so.301
6195                 majonly=`echo $patchlevel $subversion |
6196                         $awk '{printf "%d%02d", $1, $2}'`
6197                 majonly=libperl.$so.$majonly
6198                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6199                 # rely on figuring it out from the naming of libc.
6200                 case "${osname}${osvers}" in
6201                 next4*)
6202                         dflt=libperl.5.$so
6203                         # XXX How handle the --version stuff for MAB?
6204                         ;;
6205                 linux*)  # ld won't link with a bare -lperl otherwise.
6206                         dflt=libperl.$so
6207                         ;;
6208                 cygwin*) # include version
6209                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6210                         ;;
6211                 *)      # Try to guess based on whether libc has major.minor.
6212                         case "$libc" in
6213                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6214                         *libc.$so.[0-9]*) dflt=$majonly ;;
6215                         *)      dflt=libperl.$so ;;
6216                         esac
6217                         ;;
6218                 esac
6219                 ;;
6220         *)      dflt=$libperl
6221                 ;;
6222         esac
6223         cat << EOM
6224
6225 I need to select a good name for the shared libperl.  If your system uses
6226 library names with major and minor numbers, then you might want something
6227 like $majmin.  Alternatively, if your system uses a single version
6228 number for shared libraries, then you might want to use $majonly.
6229 Or, your system might be quite happy with a simple libperl.$so.
6230
6231 Since the shared libperl will get installed into a version-specific
6232 architecture-dependent directory, the version number of the shared perl
6233 library probably isn't important, so the default should be o.k.
6234
6235 EOM
6236         rp='What name do you want to give to the shared libperl?'
6237         . ./myread
6238         libperl=$ans
6239         echo "Ok, I'll use $libperl"
6240         ;;
6241 *)
6242         libperl="libperl${_a}"
6243         ;;
6244 esac
6245
6246 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6247 case "$shrpdir" in
6248 '') ;;
6249 *)      $cat >&4 <<EOM
6250 WARNING:  Use of the shrpdir variable for the installation location of
6251 the shared $libperl is not supported.  It was never documented and
6252 will not work in this version.  Let me (perlbug@perl.com)
6253 know of any problems this may cause.
6254
6255 EOM
6256         case "$shrpdir" in
6257         "$archlibexp/CORE")
6258                 $cat >&4 <<EOM
6259 But your current setting of $shrpdir is
6260 the default anyway, so it's harmless.
6261 EOM
6262                 ;;
6263         *)
6264                 $cat >&4 <<EOM
6265 Further, your current attempted setting of $shrpdir
6266 conflicts with the value of $archlibexp/CORE
6267 that installperl will use.
6268 EOM
6269                 ;;
6270         esac
6271         ;;
6272 esac
6273
6274 # How will the perl executable find the installed shared $libperl?
6275 # Add $xxx to ccdlflags.
6276 # If we can't figure out a command-line option, use $shrpenv to
6277 # set env LD_RUN_PATH.  The main perl makefile uses this.
6278 shrpdir=$archlibexp/CORE
6279 xxx=''
6280 tmp_shrpenv=''
6281 if "$useshrplib"; then
6282     case "$osname" in 
6283         aix)
6284                 # We'll set it in Makefile.SH...
6285                 ;;
6286         solaris|netbsd)
6287                 xxx="-R $shrpdir"
6288                 ;;
6289         freebsd)
6290                 xxx="-Wl,-R$shrpdir"
6291                 ;;
6292         linux|irix*|dec_osf)
6293                 xxx="-Wl,-rpath,$shrpdir"
6294                 ;;
6295         next)
6296                 # next doesn't like the default...
6297                 ;;
6298         beos)
6299                 # beos doesn't like the default, either.
6300                 ;;
6301         hpux*)
6302                 # hpux doesn't like the default, either.
6303                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6304                 ;;
6305         *)
6306                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6307                 ;;
6308         esac
6309         case "$xxx" in
6310         '') ;;
6311         *)      
6312                 # Only add $xxx if it isn't already in ccdlflags.
6313                 case " $ccdlflags " in
6314                 *" $xxx "*)     ;;
6315                 *)      ccdlflags="$ccdlflags $xxx"
6316                         cat <<EOM >&4
6317
6318 Adding $xxx to the flags
6319 passed to $ld so that the perl executable will find the 
6320 installed shared $libperl.
6321
6322 EOM
6323                         ;;
6324                 esac
6325                 ;;
6326         esac
6327 fi
6328 # Fix ccdlflags in AIX for building external extensions.
6329 # (For building Perl itself bare -bE:perl.exp is needed,
6330 #  Makefile.SH takes care of this.)
6331 case "$osname" in
6332 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6333 esac
6334 # Respect a hint or command-line value.
6335 case "$shrpenv" in
6336 '') shrpenv="$tmp_shrpenv" ;;
6337 esac
6338 case "$ldlibpthname" in
6339 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6340 none)   ldlibpthname='' ;;
6341 esac
6342
6343 : determine where manual pages go
6344 set man1dir man1dir none
6345 eval $prefixit
6346 $cat <<EOM
6347
6348 $spackage has manual pages available in source form.
6349 EOM
6350 case "$nroff" in
6351 nroff)
6352         echo "However, you don't have nroff, so they're probably useless to you."
6353         case "$man1dir" in
6354         '') man1dir="none";;
6355         esac;;
6356 esac
6357 echo "If you don't want the manual sources installed, answer 'none'."
6358 case "$man1dir" in
6359 ' ') dflt=none
6360         ;;
6361 '')
6362         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6363         lookpath="$lookpath $prefixexp/man/p_man/man1"
6364         lookpath="$lookpath $prefixexp/man/u_man/man1"
6365         lookpath="$lookpath $prefixexp/man/man.1"
6366         case "$sysman" in
6367         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6368         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6369         esac
6370         set dflt
6371         eval $prefixup
6372         ;;
6373 *)  dflt="$man1dir"
6374         ;;
6375 esac
6376 echo " "
6377 fn=dn+~
6378 rp="Where do the main $spackage manual pages (source) go?"
6379 . ./getfile
6380 if $test "X$man1direxp" != "X$ansexp"; then
6381         installman1dir=''
6382 fi
6383 man1dir="$ans"
6384 man1direxp="$ansexp"
6385 case "$man1dir" in
6386 '')     man1dir=' '
6387         installman1dir='';;
6388 esac
6389
6390 : Change installation prefix, if necessary.
6391 if $test X"$prefix" != X"$installprefix"; then
6392         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6393 else
6394         installman1dir="$man1direxp"
6395 fi
6396
6397 : What suffix to use on installed man pages
6398
6399 case "$man1dir" in
6400 ' ')
6401         man1ext='0'
6402         ;;
6403 *)
6404         rp="What suffix should be used for the main $spackage man pages?"
6405         case "$man1ext" in
6406         '')     case "$man1dir" in
6407                 *1)  dflt=1 ;;
6408                 *1p) dflt=1p ;;
6409                 *1pm) dflt=1pm ;;
6410                 *l) dflt=l;;
6411                 *n) dflt=n;;
6412                 *o) dflt=o;;
6413                 *p) dflt=p;;
6414                 *C) dflt=C;;
6415                 *L) dflt=L;;
6416                 *L1) dflt=L1;;
6417                 *) dflt=1;;
6418                 esac
6419                 ;;
6420         *)      dflt="$man1ext";;
6421         esac
6422         . ./myread
6423         man1ext="$ans"
6424         ;;
6425 esac
6426
6427 : see if we can have long filenames
6428 echo " "
6429 rmlist="$rmlist /tmp/cf$$"
6430 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6431 first=123456789abcdef
6432 second=/tmp/cf$$/$first
6433 $rm -f $first $second
6434 if (echo hi >$first) 2>/dev/null; then
6435         if $test -f 123456789abcde; then
6436                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6437                 val="$undef"
6438         else
6439                 if (echo hi >$second) 2>/dev/null; then
6440                         if $test -f /tmp/cf$$/123456789abcde; then
6441                                 $cat <<'EOM'
6442 That's peculiar... You can have filenames longer than 14 characters, but only
6443 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6444 I shall consider your system cannot support long filenames at all.
6445 EOM
6446                                 val="$undef"
6447                         else
6448                                 echo 'You can have filenames longer than 14 characters.' >&4
6449                                 val="$define"
6450                         fi
6451                 else
6452                         $cat <<'EOM'
6453 How confusing! Some of your filesystems are sane enough to allow filenames
6454 longer than 14 characters but some others like /tmp can't even think about them.
6455 So, for now on, I shall assume your kernel does not allow them at all.
6456 EOM
6457                         val="$undef"
6458                 fi
6459         fi
6460 else
6461         $cat <<'EOM'
6462 You can't have filenames longer than 14 chars.  You can't even think about them!
6463 EOM
6464         val="$undef"
6465 fi 
6466 set d_flexfnam
6467 eval $setvar
6468 $rm -rf /tmp/cf$$ 123456789abcde*
6469
6470 : determine where library module manual pages go
6471 set man3dir man3dir none
6472 eval $prefixit
6473 $cat <<EOM
6474
6475 $spackage has manual pages for many of the library modules.
6476 EOM
6477
6478 case "$nroff" in
6479 nroff)
6480         $cat <<'EOM'
6481 However, you don't have nroff, so they're probably useless to you.
6482 EOM
6483         case "$man3dir" in
6484         '') man3dir="none";;
6485         esac;;
6486 esac
6487
6488 case "$d_flexfnam" in
6489 undef)
6490         $cat <<'EOM'
6491 However, your system can't handle the long file names like File::Basename.3. 
6492 EOM
6493         case "$man3dir" in
6494         '') man3dir="none";;
6495         esac;;
6496 esac
6497
6498 echo "If you don't want the manual sources installed, answer 'none'."
6499 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6500 case "$man3dir" in
6501 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6502         if $test -d "$privlib/man/man3"; then
6503                 cat <<EOM >&4
6504
6505 WARNING:  Previous versions of perl installed man3 pages into
6506 $privlib/man/man3.  This version will suggest a 
6507 new default of $dflt.  
6508 EOM
6509                 tdflt=$dflt
6510                 dflt='n'
6511                 rp='Do you wish to preserve the old behavior?(y/n)'
6512                 . ./myread
6513                 case "$ans" in
6514                 y*) dflt="$privlib/man/man3" ;;
6515                 *)  dflt=$tdflt ;;
6516                 esac
6517     fi
6518         ;;
6519 ' ') dflt=none;;
6520 *)      dflt="$man3dir" ;;
6521 esac
6522 echo " "
6523 fn=dn+~
6524 rp="Where do the $package library man pages (source) go?"
6525 . ./getfile
6526 man3dir="$ans"
6527 man3direxp="$ansexp"
6528 case "$man1dir" in
6529 '')     man3dir=' '
6530         installman3dir='';;
6531 esac
6532
6533 : Change installation prefix, if necessary.
6534 if $test X"$prefix" != X"$installprefix"; then
6535         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6536 else
6537         installman3dir="$man3direxp"
6538 fi
6539
6540 : What suffix to use on installed man pages
6541 case "$man3dir" in
6542 ' ')
6543         man3ext='0'
6544         ;;
6545 *)
6546         rp="What suffix should be used for the $package library man pages?"
6547         case "$man3ext" in
6548         '')     case "$man3dir" in
6549                 *3)  dflt=3 ;;
6550                 *3p) dflt=3p ;;
6551                 *3pm) dflt=3pm ;;
6552                 *l) dflt=l;;
6553                 *n) dflt=n;;
6554                 *o) dflt=o;;
6555                 *p) dflt=p;;
6556                 *C) dflt=C;;
6557                 *L) dflt=L;;
6558                 *L3) dflt=L3;;
6559                 *) dflt=3;;
6560                 esac
6561                 ;;
6562         *)      dflt="$man3ext";;
6563         esac
6564         . ./myread
6565         man3ext="$ans"
6566         ;;
6567 esac
6568
6569 : see if we have to deal with yellow pages, now NIS.
6570 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6571         if $test -f /usr/etc/nibindd; then
6572                 echo " "
6573                 echo "I'm fairly confident you're on a NeXT."
6574                 echo " "
6575                 rp='Do you get the hosts file via NetInfo?'
6576                 dflt=y
6577                 case "$hostcat" in
6578                 nidump*) ;;
6579                 '') ;;
6580                 *) dflt=n;;
6581                 esac
6582                 . ./myread
6583                 case "$ans" in
6584                 y*) hostcat='nidump hosts .';;
6585                 *)      case "$hostcat" in
6586                         nidump*) hostcat='';;
6587                         esac
6588                         ;;
6589                 esac
6590         fi
6591         case "$hostcat" in
6592         nidump*) ;;
6593         *)
6594                 case "$hostcat" in
6595                 *ypcat*) dflt=y;;
6596                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6597                                 dflt=y
6598                         else
6599                                 dflt=n
6600                         fi;;
6601                 *) dflt=n;;
6602                 esac
6603                 echo " "
6604                 rp='Are you getting the hosts file via yellow pages?'
6605                 . ./myread
6606                 case "$ans" in
6607                 y*) hostcat='ypcat hosts';;
6608                 *) hostcat='cat /etc/hosts';;
6609                 esac
6610                 ;;
6611         esac
6612 fi
6613 case "$hostcat" in
6614 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6615 esac
6616 case "$groupcat" in
6617 '') test -f /etc/group && groupcat='cat /etc/group';;
6618 esac
6619 case "$passcat" in
6620 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6621 esac
6622
6623 : now get the host name
6624 echo " "
6625 echo "Figuring out host name..." >&4
6626 case "$myhostname" in
6627 '') cont=true
6628         echo 'Maybe "hostname" will work...'
6629         if tans=`sh -c hostname 2>&1` ; then
6630                 myhostname=$tans
6631                 phostname=hostname
6632                 cont=''
6633         fi
6634         ;;
6635 *) cont='';;
6636 esac
6637 if $test "$cont"; then
6638         if ./xenix; then
6639                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6640                 if tans=`cat /etc/systemid 2>&1` ; then
6641                         myhostname=$tans
6642                         phostname='cat /etc/systemid'
6643                         echo "Whadyaknow.  Xenix always was a bit strange..."
6644                         cont=''
6645                 fi
6646         elif $test -r /etc/systemid; then
6647                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6648         fi
6649 fi
6650 if $test "$cont"; then
6651         echo 'No, maybe "uuname -l" will work...'
6652         if tans=`sh -c 'uuname -l' 2>&1` ; then
6653                 myhostname=$tans
6654                 phostname='uuname -l'
6655         else
6656                 echo 'Strange.  Maybe "uname -n" will work...'
6657                 if tans=`sh -c 'uname -n' 2>&1` ; then
6658                         myhostname=$tans
6659                         phostname='uname -n'
6660                 else
6661                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6662                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6663                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6664                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6665                         else
6666                                 case "$myhostname" in
6667                                 '') echo "Does this machine have an identity crisis or something?"
6668                                         phostname='';;
6669                                 *)
6670                                         echo "Well, you said $myhostname before..."
6671                                         phostname='echo $myhostname';;
6672                                 esac
6673                         fi
6674                 fi
6675         fi
6676 fi
6677 : you do not want to know about this
6678 set $myhostname
6679 myhostname=$1
6680
6681 : verify guess
6682 if $test "$myhostname" ; then
6683         dflt=y
6684         rp='Your host name appears to be "'$myhostname'".'" Right?"
6685         . ./myread
6686         case "$ans" in
6687         y*) ;;
6688         *) myhostname='';;
6689         esac
6690 fi
6691
6692 : bad guess or no guess
6693 while $test "X$myhostname" = X ; do
6694         dflt=''
6695         rp="Please type the (one word) name of your host:"
6696         . ./myread
6697         myhostname="$ans"
6698 done
6699
6700 : translate upper to lower if necessary
6701 case "$myhostname" in
6702 *[A-Z]*)
6703         echo "(Normalizing case in your host name)"
6704         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6705         ;;
6706 esac
6707
6708 case "$myhostname" in
6709 *.*)
6710         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6711         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6712         echo "(Trimming domain name from host name--host name is now $myhostname)"
6713         ;;
6714 *) case "$mydomain" in
6715         '')
6716                 {
6717                         test "X$hostcat" = "Xypcat hosts" &&
6718                         ypmatch "$myhostname" hosts 2>/dev/null |\
6719                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6720                         $test -s hosts
6721                 } || {
6722                         test "X$hostcat" != "X" &&
6723                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6724                                         /[       ]$myhostname[  . ]/p" > hosts
6725                 }
6726                 tmp_re="[       . ]"
6727                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6728                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6729                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6730                         hosts | $sort | $uniq | \
6731                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6732                 case `$echo X$dflt` in
6733                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6734                         dflt=.
6735                         ;;
6736                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6737                         ;;
6738                 esac
6739                 case "$dflt" in
6740                 .)
6741                         tans=`./loc resolv.conf X /etc /usr/etc`
6742                         if $test -f "$tans"; then
6743                                 echo "(Attempting domain name extraction from $tans)"
6744                                 dflt=.`$sed -n -e 's/   / /g' \
6745                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6746                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6747                                 case "$dflt" in
6748                                 .) dflt=.`$sed -n -e 's/        / /g' \
6749                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6750                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6751                                         ;;
6752                                 esac
6753                         fi
6754                         ;;
6755                 esac
6756                 case "$dflt" in
6757                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6758                         dflt=.`sh -c domainname 2>/dev/null`
6759                         case "$dflt" in
6760                         '') dflt='.';;
6761                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6762                         esac
6763                         ;;
6764                 esac
6765                 case "$dflt" in
6766                 .) echo "(Lost all hope -- silly guess then)"
6767                         dflt='.uucp'
6768                         ;;
6769                 esac
6770                 $rm -f hosts
6771                 ;;
6772         *) dflt="$mydomain";;
6773         esac;;
6774 esac
6775 echo " "
6776 rp="What is your domain name?"
6777 . ./myread
6778 tans="$ans"
6779 case "$ans" in
6780 '') ;;
6781 .*) ;;
6782 *) tans=".$tans";;
6783 esac
6784 mydomain="$tans"
6785
6786 : translate upper to lower if necessary
6787 case "$mydomain" in
6788 *[A-Z]*)
6789         echo "(Normalizing case in your domain name)"
6790         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6791         ;;
6792 esac
6793
6794 : a little sanity check here
6795 case "$phostname" in
6796 '') ;;
6797 *)
6798         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6799         $myhostname$mydomain|$myhostname) ;;
6800         *)
6801                 case "$phostname" in
6802                 sed*)
6803                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6804                         ;;
6805                 *)
6806                         echo "(That doesn't agree with your $phostname command, by the way.)"
6807                         ;;
6808                 esac
6809         ;;
6810         esac
6811         ;;
6812 esac
6813
6814 $cat <<EOM
6815
6816 I need to get your e-mail address in Internet format if possible, i.e.
6817 something like user@host.domain. Please answer accurately since I have
6818 no easy means to double check it. The default value provided below
6819 is most probably close to reality but may not be valid from outside
6820 your organization...
6821
6822 EOM
6823 cont=x
6824 while test "$cont"; do
6825         case "$cf_email" in
6826         '') dflt="$cf_by@$myhostname$mydomain";;
6827         *) dflt="$cf_email";;
6828         esac
6829         rp='What is your e-mail address?'
6830         . ./myread
6831         cf_email="$ans"
6832         case "$cf_email" in
6833         *@*.*) cont='' ;;
6834         *)
6835                 rp='Address does not look like an Internet one.  Use it anyway?'
6836                 case "$fastread" in
6837                 yes) dflt=y ;;
6838                 *) dflt=n ;;
6839                 esac
6840                 . ./myread
6841                 case "$ans" in
6842                 y*) cont='' ;;
6843                 *) echo " " ;;
6844                 esac
6845                 ;;
6846         esac
6847 done
6848
6849 $cat <<EOM
6850
6851 If you or somebody else will be maintaining perl at your site, please
6852 fill in the correct e-mail address here so that they may be contacted
6853 if necessary. Currently, the "perlbug" program included with perl
6854 will send mail to this address in addition to perlbug@perl.com. You may
6855 enter "none" for no administrator.
6856
6857 EOM
6858 case "$perladmin" in
6859 '') dflt="$cf_email";;
6860 *) dflt="$perladmin";;
6861 esac
6862 rp='Perl administrator e-mail address'
6863 . ./myread
6864 perladmin="$ans"
6865
6866 : figure out how to guarantee perl startup
6867 case "$startperl" in
6868 '')
6869         case "$sharpbang" in
6870         *!)
6871                 $cat <<EOH
6872
6873 I can use the #! construct to start perl on your system. This will
6874 make startup of perl scripts faster, but may cause problems if you
6875 want to share those scripts and perl is not in a standard place
6876 ($binexp/perl) on all your platforms. The alternative is to force
6877 a shell by starting the script with a single ':' character.
6878
6879 EOH
6880                 dflt="$binexp/perl"
6881                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6882                 . ./myread
6883                 case "$ans" in
6884                 none)   startperl=": # use perl";;
6885                 *)      startperl="#!$ans"
6886                         if $test 30 -lt `echo "$ans" | wc -c`; then
6887                                 $cat >&4 <<EOM
6888
6889 WARNING:  Some systems limit the #! command to 32 characters.
6890 If you experience difficulty running Perl scripts with #!, try
6891 installing Perl in a directory with a shorter pathname.
6892
6893 EOM
6894                         fi ;;
6895                 esac
6896                 ;;
6897         *) startperl=": # use perl"
6898                 ;;
6899         esac
6900         ;;
6901 esac
6902 echo "I'll use $startperl to start perl scripts."
6903
6904 : figure best path for perl in scripts
6905 case "$perlpath" in
6906 '')
6907         perlpath="$binexp/perl"
6908         case "$startperl" in
6909         *!*) ;;
6910         *)
6911                 $cat <<EOH
6912
6913 I will use the "eval 'exec'" idiom to start Perl on your system.
6914 I can use the full path of your Perl binary for this purpose, but
6915 doing so may cause problems if you want to share those scripts and
6916 Perl is not always in a standard place ($binexp/perl).
6917
6918 EOH
6919                 dflt="$binexp/perl"
6920                 rp="What path shall I use in \"eval 'exec'\"?"
6921                 . ./myread
6922                 perlpath="$ans"
6923                 ;;
6924         esac
6925         ;;
6926 esac
6927 case "$startperl" in
6928 *!*)    ;;
6929 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6930 esac
6931
6932 : determine where public executable scripts go
6933 set scriptdir scriptdir
6934 eval $prefixit
6935 case "$scriptdir" in
6936 '')
6937         dflt="$bin"
6938         : guess some guesses
6939         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6940         $test -d /usr/share/bin     && dflt=/usr/share/bin
6941         $test -d /usr/local/script  && dflt=/usr/local/script
6942         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6943         $test -d $prefixexp/script  && dflt=$prefixexp/script
6944         set dflt
6945         eval $prefixup
6946         ;;
6947 *)  dflt="$scriptdir"
6948         ;;
6949 esac
6950 $cat <<EOM
6951  
6952 Some installations have a separate directory just for executable scripts so
6953 that they can mount it across multiple architectures but keep the scripts in
6954 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6955 Or you might just lump your scripts in with all your other executables.
6956  
6957 EOM
6958 fn=d~
6959 rp='Where do you keep publicly executable scripts?'
6960 . ./getfile
6961 if $test "X$ansexp" != "X$scriptdirexp"; then
6962         installscript=''
6963 fi
6964 scriptdir="$ans"
6965 scriptdirexp="$ansexp"
6966 : Change installation prefix, if necessary.
6967 if $test X"$prefix" != X"$installprefix"; then
6968         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6969 else
6970         installscript="$scriptdirexp"
6971 fi
6972
6973 : determine where site specific architecture-dependent libraries go.
6974 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6975 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6976 : sitelib may have an optional trailing /share.
6977 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6978 tdflt="$tdflt/$archname"
6979 set sitearch sitearch none
6980 eval $prefixit
6981 case "$sitearch" in
6982 '')     dflt="$tdflt" ;;
6983 *)      dflt="$sitearch" ;;
6984 esac
6985 $cat <<EOM
6986
6987 The installation process will also create a directory for
6988 architecture-dependent site-specific extensions and modules.
6989
6990 EOM
6991 fn=nd~+
6992 rp='Pathname for the site-specific architecture-dependent library files?'
6993 . ./getfile
6994 sitearch="$ans"
6995 sitearchexp="$ansexp"
6996 : Change installation prefix, if necessary.
6997 if $test X"$prefix" != X"$installprefix"; then
6998         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6999 else
7000         installsitearch="$sitearchexp"
7001 fi
7002
7003 : determine where add-on public executables go
7004 case "$sitebin" in
7005 '')     dflt=$siteprefix/bin ;;
7006 *)      dflt=$sitebin ;;
7007 esac
7008 fn=d~
7009 rp='Pathname where the add-on public executables should be installed?'
7010 . ./getfile
7011 sitebin="$ans"
7012 sitebinexp="$ansexp"
7013 : Change installation prefix, if necessary.
7014 if $test X"$prefix" != X"$installprefix"; then
7015         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7016 else
7017         installsitebin="$sitebinexp"
7018 fi
7019
7020 : see if sqrtl exists
7021 set sqrtl d_sqrtl
7022 eval $inlibc
7023
7024 case "$ccflags" in
7025 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7026 esac
7027
7028 case "$uselongdouble" in
7029 $define|true|[yY]*)     dflt='y';;
7030 *) dflt='n';;
7031 esac
7032 cat <<EOM
7033
7034 Perl can be built to take advantage of long doubles which
7035 (if available) may give more accuracy and range for floating point numbers.
7036
7037 If this doesn't make any sense to you, just accept the default '$dflt'.
7038 EOM
7039 rp='Try to use long doubles if available?'
7040 . ./myread
7041 case "$ans" in
7042 y|Y)    val="$define"   ;;
7043 *)      val="$undef"    ;;
7044 esac
7045 set uselongdouble
7046 eval $setvar
7047
7048 case "$uselongdouble" in
7049 true|[yY]*) uselongdouble="$define" ;;
7050 esac
7051
7052 case "$uselongdouble" in
7053 $define)
7054 : Look for a hint-file generated 'call-back-unit'.  If the
7055 : user has specified that long doubles should be used,
7056 : we may need to set or change some other defaults.
7057         if $test -f uselongdouble.cbu; then
7058                 echo "Your platform has some specific hints for long doubles, using them..."
7059                 . ./uselongdouble.cbu
7060         else
7061                 $cat <<EOM
7062 (Your platform doesn't have any specific hints for long doubles.)
7063 EOM
7064         fi
7065         ;;
7066 esac
7067
7068 case "$uselongdouble:$d_sqrtl" in
7069 $define:$undef)
7070                 $cat <<EOM >&4
7071
7072 You requested the use of long doubles but you do not seem to have
7073 the mathematic functions for long doubles.  I'm disabling the use
7074 of long doubles.
7075 EOM
7076         uselongdouble=$undef
7077         ;;
7078 esac
7079
7080 case "$useperlio" in
7081 $define|true|[yY]*)     dflt='y';;
7082 *) dflt='n';;
7083 esac
7084 cat <<EOM
7085
7086 Previous version of $package used the standard IO mechanisms as defined
7087 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7088 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7089 the default.  This abstraction layer can use AT&T's sfio (if you already
7090 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7091 problems with some extension modules.  Using PerlIO with stdio is safe,
7092 but it is slower than plain stdio and therefore is not the default.
7093
7094 If this doesn't make any sense to you, just accept the default '$dflt'.
7095 EOM
7096 rp='Use the experimental PerlIO abstraction layer?'
7097 . ./myread
7098 case "$ans" in
7099 y|Y) 
7100         val="$define"
7101         ;;     
7102 *)      
7103         echo "Ok, doing things the stdio way"
7104         val="$undef"
7105         ;;
7106 esac
7107 set useperlio
7108 eval $setvar 
7109
7110 case "$vendorprefix" in
7111 '')     d_vendorbin="$undef"
7112         vendorbin=''
7113         vendorbinexp=''
7114         ;;
7115 *)      d_vendorbin="$define"
7116         : determine where vendor-supplied executables go.
7117         dflt=$vendorprefix/bin
7118         fn=d~+
7119         rp='Pathname for the vendor-supplied executables directory?'
7120         . ./getfile
7121         vendorbin="$ans"
7122         vendorbinexp="$ansexp"
7123         : Change installation prefix, if necessary.
7124         if $test X"$prefix" != X"$installprefix"; then
7125                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7126         else
7127                 installvendorbin="$vendorbinexp"
7128         fi
7129         ;;
7130 esac
7131
7132 : check for length of double
7133 echo " "
7134 case "$doublesize" in
7135 '')
7136         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7137         $cat >try.c <<'EOCP'
7138 #include <stdio.h>
7139 int main()
7140 {
7141     printf("%d\n", (int)sizeof(double));
7142     exit(0);
7143 }
7144 EOCP
7145         set try
7146         if eval $compile_ok; then
7147                 doublesize=`./try`
7148                 $echo " $doublesize bytes." >&4
7149         else
7150                 dflt='8'
7151                 echo "(I can't seem to compile the test program.  Guessing...)"
7152                 rp="What is the size of a double precision number (in bytes)?"
7153                 . ./myread
7154                 doublesize="$ans"
7155         fi
7156         ;;
7157 esac
7158 $rm -f try.c try
7159
7160 : check for long doubles
7161 echo " "
7162 echo "Checking to see if you have long double..." >&4
7163 echo 'int main() { long double x = 7.0; }' > try.c
7164 set try
7165 if eval $compile; then
7166         val="$define"
7167         echo "You have long double."
7168 else
7169         val="$undef"
7170         echo "You do not have long double."
7171 fi
7172 $rm try.*
7173 set d_longdbl
7174 eval $setvar
7175
7176 : check for length of long double
7177 case "${d_longdbl}${longdblsize}" in
7178 $define)
7179         echo " "
7180         $echo $n "Checking to see how big your long doubles are..." $c >&4
7181         $cat >try.c <<'EOCP'
7182 #include <stdio.h>
7183 int main()
7184 {
7185         printf("%d\n", sizeof(long double));
7186 }
7187 EOCP
7188         set try
7189         set try
7190         if eval $compile; then
7191                 longdblsize=`./try$exe_ext`
7192                 $echo " $longdblsize bytes." >&4
7193         else
7194                 dflt='8'
7195                 echo " "
7196                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7197                 rp="What is the size of a long double (in bytes)?"
7198                 . ./myread
7199                 longdblsize="$ans"
7200         fi
7201         if $test "X$doublesize" = "X$longdblsize"; then
7202                 echo "(That isn't any different from an ordinary double.)"
7203         fi      
7204         ;;
7205 esac
7206 $rm -f try.* try
7207
7208 : Check how to convert floats to strings.
7209 if test "X$d_Gconvert" = X; then
7210         echo " "
7211         echo "Checking for an efficient way to convert floats to strings."
7212         $cat >try.c <<EOP
7213 #ifdef TRY_gconvert
7214 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7215 char *myname = "gconvert";
7216 #endif
7217 #ifdef TRY_gcvt
7218 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7219 char *myname = "gcvt";
7220 #endif
7221 #ifdef TRY_qgcvt
7222 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7223 char *myname = "qgcvt";
7224 #define DOUBLETYPE long double
7225 #endif
7226 #ifdef TRY_sprintf
7227 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7228 char *myname = "sprintf";
7229 #endif
7230
7231 #ifndef DOUBLETYPE
7232 #define DOUBLETYPE double
7233 #endif
7234
7235 #include <stdio.h>
7236
7237 #define I_STDLIB $i_stdlib
7238 #ifdef I_STDLIB
7239 #include <stdlib.h>
7240 #endif
7241
7242 int
7243 checkit(expect, got)
7244 char *expect;
7245 char *got;
7246 {
7247     if (strcmp(expect, got)) {
7248                 printf("%s oddity:  Expected %s, got %s\n",
7249                         myname, expect, got);
7250                 exit(1);
7251         }
7252 }
7253
7254 int main()
7255
7256         char buf[64]; 
7257         buf[63] = '\0';
7258
7259         /* This must be 1st test on (which?) platform */
7260         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7261         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7262         checkit("0.1", buf);
7263
7264         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7265         checkit("1", buf);
7266
7267         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7268         checkit("0", buf);
7269
7270         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7271         checkit("-1", buf);
7272
7273         /* Some Linux gcvt's give 1.e+5 here. */
7274         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7275         checkit("100000", buf);
7276         
7277         /* Some Linux gcvt's give -1.e+5 here. */
7278         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7279         checkit("-100000", buf);
7280
7281         exit(0);
7282 }
7283 EOP
7284         case "$d_Gconvert" in
7285         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7286         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7287         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7288         *) xxx_list='gconvert gcvt sprintf' ;;
7289         esac
7290
7291         case "$d_longdbl$uselongdouble" in
7292         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7293         esac
7294
7295         for xxx_convert in $xxx_list; do
7296                 echo "Trying $xxx_convert..."
7297                 $rm -f try try$_o
7298                 set try -DTRY_$xxx_convert
7299                 if eval $compile; then
7300                         echo "$xxx_convert() found." >&4
7301                         if ./try; then
7302                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7303                                 break;
7304                         else
7305                                 echo "...But $xxx_convert didn't work as I expected."
7306                         fi
7307                 else
7308                         echo "$xxx_convert NOT found." >&4
7309                 fi
7310         done
7311                 
7312         case "$xxx_convert" in
7313         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7314         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7315         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7316         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7317         esac
7318 fi
7319
7320 echo " "
7321
7322 if $test X"$d_longdbl" = X"$define"; then
7323
7324 echo "Checking how to print long doubles..." >&4
7325
7326 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7327         $cat >try.c <<'EOCP'
7328 #include <sys/types.h>
7329 #include <stdio.h>
7330 int main() {
7331   double d = 123.456;
7332   printf("%.3f\n", d);
7333 }
7334 EOCP
7335         set try
7336         if eval $compile; then
7337                 yyy=`./try$exe_ext`
7338                 case "$yyy" in
7339                 123.456)
7340                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7341                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7342                         echo "We will use %f."
7343                         ;;
7344                 esac
7345         fi
7346 fi
7347
7348 if $test X"$sPRIfldbl" = X; then
7349         $cat >try.c <<'EOCP'
7350 #include <sys/types.h>
7351 #include <stdio.h>
7352 int main() {
7353   long double d = 123.456;
7354   printf("%.3llf\n", d);
7355 }
7356 EOCP
7357         set try
7358         if eval $compile; then
7359                 yyy=`./try$exe_ext`
7360                 case "$yyy" in
7361                 123.456)
7362                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7363                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7364                         echo "We will use %llf."
7365                         ;;
7366                 esac
7367         fi
7368 fi
7369
7370 if $test X"$sPRIfldbl" = X; then
7371         $cat >try.c <<'EOCP'
7372 #include <sys/types.h>
7373 #include <stdio.h>
7374 int main() {
7375   long double d = 123.456;
7376   printf("%.3Lf\n", d);
7377 }
7378 EOCP
7379         set try
7380         if eval $compile; then
7381                 yyy=`./try$exe_ext`
7382                 case "$yyy" in
7383                 123.456)
7384                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7385                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7386                         echo "We will use %Lf."
7387                         ;;
7388                 esac
7389         fi
7390 fi
7391
7392 if $test X"$sPRIfldbl" = X; then
7393         $cat >try.c <<'EOCP'
7394 #include <sys/types.h>
7395 #include <stdio.h>
7396 int main() {
7397   long double d = 123.456;
7398   printf("%.3lf\n", d);
7399 }
7400 EOCP
7401         set try
7402         if eval $compile; then
7403                 yyy=`./try$exe_ext`
7404                 case "$yyy" in
7405                 123.456)
7406                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7407                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7408                         echo "We will use %lf."
7409                         ;;
7410                 esac
7411         fi
7412 fi
7413
7414 if $test X"$sPRIfldbl" = X; then
7415         echo "Cannot figure out how to print long doubles." >&4
7416 fi
7417
7418 $rm -f try try.*
7419
7420 fi # d_longdbl
7421
7422 case "$sPRIfldbl" in
7423 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7424         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7425         ;;
7426 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7427         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7428         ;;
7429 esac
7430
7431 : Initialize h_fcntl
7432 h_fcntl=false
7433
7434 : Initialize h_sysfile
7435 h_sysfile=false
7436
7437 : access call always available on UNIX
7438 set access d_access
7439 eval $inlibc
7440
7441 : locate the flags for 'access()'
7442 case "$d_access" in
7443 "$define")
7444         echo " "
7445         $cat >access.c <<'EOCP'
7446 #include <sys/types.h>
7447 #ifdef I_FCNTL
7448 #include <fcntl.h>
7449 #endif
7450 #ifdef I_SYS_FILE
7451 #include <sys/file.h>
7452 #endif
7453 #ifdef I_UNISTD
7454 #include <unistd.h>
7455 #endif
7456 int main() {
7457         exit(R_OK);
7458 }
7459 EOCP
7460         : check sys/file.h first, no particular reason here
7461         if $test `./findhdr sys/file.h` && \
7462                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7463                 h_sysfile=true;
7464                 echo "<sys/file.h> defines the *_OK access constants." >&4
7465         elif $test `./findhdr fcntl.h` && \
7466                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7467                 h_fcntl=true;
7468                 echo "<fcntl.h> defines the *_OK access constants." >&4
7469         elif $test `./findhdr unistd.h` && \
7470                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7471                 echo "<unistd.h> defines the *_OK access constants." >&4
7472         else
7473                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7474         fi
7475         ;;
7476 esac
7477 $rm -f access*
7478
7479 : see if accessx exists
7480 set accessx d_accessx
7481 eval $inlibc
7482
7483 : see if alarm exists
7484 set alarm d_alarm
7485 eval $inlibc
7486
7487 : see if atolf exists
7488 set atolf d_atolf
7489 eval $inlibc
7490
7491 : see if atoll exists
7492 set atoll d_atoll
7493 eval $inlibc
7494
7495 : Look for GNU-cc style attribute checking
7496 echo " "
7497 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7498 $cat >attrib.c <<'EOCP'
7499 #include <stdio.h>
7500 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7501 EOCP
7502 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7503         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7504                 echo "Your C compiler doesn't fully support __attribute__."
7505                 val="$undef"
7506         else
7507                 echo "Your C compiler supports __attribute__."
7508                 val="$define"
7509         fi
7510 else
7511         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7512         val="$undef"
7513 fi
7514 set d_attribut
7515 eval $setvar
7516 $rm -f attrib*
7517
7518 : see if bcmp exists
7519 set bcmp d_bcmp
7520 eval $inlibc
7521
7522 : see if bcopy exists
7523 set bcopy d_bcopy
7524 eval $inlibc
7525
7526 : see if this is a unistd.h system
7527 set unistd.h i_unistd
7528 eval $inhdr
7529
7530 : see if getpgrp exists
7531 set getpgrp d_getpgrp
7532 eval $inlibc
7533
7534 case "$d_getpgrp" in
7535 "$define")
7536         echo " "
7537         echo "Checking to see which flavor of getpgrp is in use..."
7538         $cat >set.c <<EOP
7539 #$i_unistd I_UNISTD
7540 #include <sys/types.h>
7541 #ifdef I_UNISTD
7542 #  include <unistd.h>
7543 #endif
7544 int main()
7545 {
7546         if (getuid() == 0) {
7547                 printf("(I see you are running Configure as super-user...)\n");
7548                 setuid(1);
7549         }
7550 #ifdef TRY_BSD_PGRP
7551         if (getpgrp(1) == 0)
7552                 exit(0);
7553 #else
7554         if (getpgrp() > 0)
7555                 exit(0);
7556 #endif
7557         exit(1);
7558 }
7559 EOP
7560         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7561                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7562                 val="$define"
7563         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7564                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7565                 val="$undef"
7566         else
7567                 echo "I can't seem to compile and run the test program."
7568                 if ./usg; then
7569                         xxx="a USG one, i.e. you use getpgrp()."
7570                 else
7571                         # SVR4 systems can appear rather BSD-ish.
7572                         case "$i_unistd" in
7573                         $undef)
7574                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7575                                 val="$define"
7576                                 ;;
7577                         $define)
7578                                 xxx="probably a USG one, i.e. you use getpgrp()."
7579                                 val="$undef"
7580                                 ;;
7581                         esac
7582                 fi
7583                 echo "Assuming your getpgrp is $xxx" >&4
7584         fi
7585         ;;
7586 *) val="$undef";;
7587 esac
7588 set d_bsdgetpgrp
7589 eval $setvar
7590 $rm -f set set.c
7591
7592 : see if setpgrp exists
7593 set setpgrp d_setpgrp
7594 eval $inlibc
7595
7596 case "$d_setpgrp" in
7597 "$define")
7598         echo " "
7599         echo "Checking to see which flavor of setpgrp is in use..."
7600         $cat >set.c <<EOP
7601 #$i_unistd I_UNISTD
7602 #include <sys/types.h>
7603 #ifdef I_UNISTD
7604 #  include <unistd.h>
7605 #endif
7606 int main()
7607 {
7608         if (getuid() == 0) {
7609                 printf("(I see you are running Configure as super-user...)\n");
7610                 setuid(1);
7611         }
7612 #ifdef TRY_BSD_PGRP
7613         if (-1 == setpgrp(1, 1))
7614                 exit(0);
7615 #else
7616         if (setpgrp() != -1)
7617                 exit(0);
7618 #endif
7619         exit(1);
7620 }
7621 EOP
7622         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7623                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7624                 val="$define"
7625         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7626                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7627                 val="$undef"
7628         else
7629                 echo "(I can't seem to compile and run the test program.)"
7630                 if ./usg; then
7631                         xxx="a USG one, i.e. you use setpgrp()."
7632                 else
7633                         # SVR4 systems can appear rather BSD-ish.
7634                         case "$i_unistd" in
7635                         $undef)
7636                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7637                                 val="$define"
7638                                 ;;
7639                         $define)
7640                                 xxx="probably a USG one, i.e. you use setpgrp()."
7641                                 val="$undef"
7642                                 ;;
7643                         esac
7644                 fi
7645                 echo "Assuming your setpgrp is $xxx" >&4
7646         fi
7647         ;;
7648 *) val="$undef";;
7649 esac
7650 set d_bsdsetpgrp
7651 eval $setvar
7652 $rm -f set set.c
7653 : see if bzero exists
7654 set bzero d_bzero
7655 eval $inlibc
7656
7657 : see if signal is declared as pointer to function returning int or void
7658 echo " "
7659 xxx=`./findhdr signal.h`
7660 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7661 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7662         echo "You have int (*signal())() instead of void." >&4
7663         val="$undef"
7664 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7665         echo "You have void (*signal())()." >&4
7666         val="$define"
7667 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7668         echo "You have int (*signal())() instead of void." >&4
7669         val="$undef"
7670 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7671         echo "You have void (*signal())()." >&4
7672         val="$define"
7673 else
7674         case "$d_voidsig" in
7675         '')
7676         echo "I can't determine whether signal handler returns void or int..." >&4
7677                 dflt=void
7678                 rp="What type does your signal handler return?"
7679                 . ./myread
7680                 case "$ans" in
7681                 v*) val="$define";;
7682                 *) val="$undef";;
7683                 esac;;
7684         "$define")
7685                 echo "As you already told me, signal handler returns void." >&4
7686                 val="$define"
7687                 ;;
7688         *)      echo "As you already told me, signal handler returns int." >&4
7689                 val="$undef"
7690                 ;;
7691         esac
7692 fi
7693 set d_voidsig
7694 eval $setvar
7695 case "$d_voidsig" in
7696 "$define") signal_t="void";;
7697 *) signal_t="int";;
7698 esac
7699 $rm -f $$.tmp
7700
7701 : check for ability to cast large floats to 32-bit ints.
7702 echo " "
7703 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7704 if $test "$intsize" -ge 4; then
7705         xxx=int
7706 else
7707         xxx=long
7708 fi
7709 $cat >try.c <<EOCP
7710 #include <stdio.h>
7711 #include <sys/types.h>
7712 #include <signal.h>
7713 $signal_t blech(s) int s; { exit(3); }
7714 int main()
7715 {
7716         $xxx i32;
7717         double f, g;
7718         int result = 0;
7719         char str[16];
7720         signal(SIGFPE, blech);
7721
7722         /* Don't let compiler optimize the test away.  Store the number 
7723            in a writable string for gcc to pass to sscanf under HP/UX.
7724         */
7725         sprintf(str, "2147483647");
7726         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7727         g = 10 * f;
7728         i32  = ($xxx) g;
7729
7730         /* x86 processors will probably give 0x8000 0000, which is a
7731        sign change.  We don't want that.  We want to mimic SPARC
7732            behavior here, which is to preserve the sign and give
7733            back 0x7fff ffff.
7734         */
7735         if (i32 != ($xxx) f)
7736                 result |= 1;
7737         exit(result);
7738 }
7739 EOCP
7740 set try
7741 if eval $compile_ok; then
7742         ./try
7743         yyy=$?
7744 else
7745         echo "(I can't seem to compile the test program--assuming it can't)"
7746         yyy=1
7747 fi
7748 case "$yyy" in
7749 0)      val="$define"
7750         echo "Yup, it can."
7751         ;;
7752 *)      val="$undef"
7753         echo "Nope, it can't."
7754         ;;
7755 esac
7756 set d_casti32
7757 eval $setvar
7758 $rm -f try try.*
7759
7760 : check for ability to cast negative floats to unsigned
7761 echo " "
7762 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7763 $cat >try.c <<EOCP
7764 #include <stdio.h>
7765 #include <sys/types.h>
7766 #include <signal.h>
7767 $signal_t blech(s) int s; { exit(7); }
7768 $signal_t blech_in_list(s) int s; { exit(4); }
7769 unsigned long dummy_long(p) unsigned long p; { return p; }
7770 unsigned int dummy_int(p) unsigned int p; { return p; }
7771 unsigned short dummy_short(p) unsigned short p; { return p; }
7772 int main()
7773 {
7774         double f;
7775         unsigned long along;
7776         unsigned int aint;
7777         unsigned short ashort;
7778         int result = 0;
7779         char str[16];
7780         
7781         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7782            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7783            optimized the whole file away
7784         */
7785         /* Store the number in a writable string for gcc to pass to 
7786            sscanf under HP/UX.
7787         */
7788         sprintf(str, "-123");
7789         sscanf(str, "%lf", &f);  /* f = -123.; */
7790
7791         signal(SIGFPE, blech);
7792         along = (unsigned long)f;
7793         aint = (unsigned int)f;
7794         ashort = (unsigned short)f;
7795         if (along != (unsigned long)-123)
7796                 result |= 1;
7797         if (aint != (unsigned int)-123)
7798                 result |= 1;
7799         if (ashort != (unsigned short)-123)
7800                 result |= 1;
7801         sprintf(str, "1073741824.");
7802         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7803         f = f + f;
7804         along = 0;
7805         along = (unsigned long)f;
7806         if (along != 0x80000000)
7807                 result |= 2;
7808         f -= 1.;
7809         along = 0;
7810         along = (unsigned long)f;
7811         if (along != 0x7fffffff)
7812                 result |= 1;
7813         f += 2.;
7814         along = 0;
7815         along = (unsigned long)f;
7816         if (along != 0x80000001)
7817                 result |= 2;
7818         if (result)
7819                 exit(result);
7820         signal(SIGFPE, blech_in_list);
7821         sprintf(str, "123.");
7822         sscanf(str, "%lf", &f);  /* f = 123.; */
7823         along = dummy_long((unsigned long)f);
7824         aint = dummy_int((unsigned int)f);
7825         ashort = dummy_short((unsigned short)f);
7826         if (along != (unsigned long)123)
7827                 result |= 4;
7828         if (aint != (unsigned int)123)
7829                 result |= 4;
7830         if (ashort != (unsigned short)123)
7831                 result |= 4;
7832         exit(result);
7833
7834 }
7835 EOCP
7836 set try
7837 if eval $compile_ok; then
7838         ./try
7839         castflags=$?
7840 else
7841         echo "(I can't seem to compile the test program--assuming it can't)"
7842         castflags=7
7843 fi
7844 case "$castflags" in
7845 0)      val="$define"
7846         echo "Yup, it can."
7847         ;;
7848 *)      val="$undef"
7849         echo "Nope, it can't."
7850         ;;
7851 esac
7852 set d_castneg
7853 eval $setvar
7854 $rm -f try.*
7855
7856 : see if vprintf exists
7857 echo " "
7858 if set vprintf val -f d_vprintf; eval $csym; $val; then
7859         echo 'vprintf() found.' >&4
7860         val="$define"
7861         $cat >vprintf.c <<'EOF'
7862 #include <varargs.h>
7863
7864 int main() { xxx("foo"); }
7865
7866 xxx(va_alist)
7867 va_dcl
7868 {
7869         va_list args;
7870         char buf[10];
7871
7872         va_start(args);
7873         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7874 }
7875 EOF
7876         set vprintf
7877         if eval $compile && ./vprintf; then
7878                 echo "Your vsprintf() returns (int)." >&4
7879                 val2="$undef"
7880         else
7881                 echo "Your vsprintf() returns (char*)." >&4
7882                 val2="$define"
7883         fi
7884 else
7885         echo 'vprintf() NOT found.' >&4
7886                 val="$undef"
7887                 val2="$undef"
7888 fi
7889 set d_vprintf
7890 eval $setvar
7891 val=$val2
7892 set d_charvspr
7893 eval $setvar
7894
7895 : see if chown exists
7896 set chown d_chown
7897 eval $inlibc
7898
7899 : see if chroot exists
7900 set chroot d_chroot
7901 eval $inlibc
7902
7903 : see if chsize exists
7904 set chsize d_chsize
7905 eval $inlibc
7906
7907 : check for const keyword
7908 echo " "
7909 echo 'Checking to see if your C compiler knows about "const"...' >&4
7910 $cat >const.c <<'EOCP'
7911 typedef struct spug { int drokk; } spug;
7912 int main()
7913 {
7914         const char *foo;
7915         const spug y;
7916 }
7917 EOCP
7918 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7919         val="$define"
7920         echo "Yup, it does."
7921 else
7922         val="$undef"
7923         echo "Nope, it doesn't."
7924 fi
7925 set d_const
7926 eval $setvar
7927
7928 : see if crypt exists
7929 echo " "
7930 if set crypt val -f d_crypt; eval $csym; $val; then
7931         echo 'crypt() found.' >&4
7932         val="$define"
7933         cryptlib=''
7934 else
7935         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7936         if $test -z "$cryptlib"; then
7937                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7938         else
7939                 cryptlib=-lcrypt
7940         fi
7941         if $test -z "$cryptlib"; then
7942                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7943         else
7944                 cryptlib=-lcrypt
7945         fi
7946         if $test -z "$cryptlib"; then
7947                 cryptlib=`./loc libcrypt$_a "" $libpth`
7948         else
7949                 cryptlib=-lcrypt
7950         fi
7951         if $test -z "$cryptlib"; then
7952                 echo 'crypt() NOT found.' >&4
7953                 val="$undef"
7954         else
7955                 val="$define"
7956         fi
7957 fi
7958 set d_crypt
7959 eval $setvar
7960
7961 : get csh whereabouts
7962 case "$csh" in
7963 'csh') val="$undef" ;;
7964 *) val="$define" ;;
7965 esac
7966 set d_csh
7967 eval $setvar
7968 : Respect a hint or command line value for full_csh.
7969 case "$full_csh" in
7970 '') full_csh=$csh ;;
7971 esac
7972
7973 : see if cuserid exists
7974 set cuserid d_cuserid
7975 eval $inlibc
7976
7977 : see if this is a limits.h system
7978 set limits.h i_limits
7979 eval $inhdr
7980
7981 : see if this is a float.h system
7982 set float.h i_float
7983 eval $inhdr
7984
7985 : See if number of significant digits in a double precision number is known
7986 echo " "
7987 $cat >dbl_dig.c <<EOM
7988 #$i_limits I_LIMITS
7989 #$i_float I_FLOAT
7990 #ifdef I_LIMITS
7991 #include <limits.h>
7992 #endif
7993 #ifdef I_FLOAT
7994 #include <float.h>
7995 #endif
7996 #ifdef DBL_DIG
7997 printf("Contains DBL_DIG");
7998 #endif
7999 EOM
8000 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8001 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8002         echo "DBL_DIG found." >&4
8003         val="$define"
8004 else
8005         echo "DBL_DIG NOT found." >&4
8006         val="$undef"
8007 fi
8008 $rm -f dbl_dig.?
8009 set d_dbl_dig
8010 eval $setvar
8011
8012 : see if difftime exists
8013 set difftime d_difftime
8014 eval $inlibc
8015
8016 : see if this is a dirent system
8017 echo " "
8018 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8019         val="$define"
8020         echo "<dirent.h> found." >&4
8021 else
8022         val="$undef"
8023         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8024                 echo "<sys/dir.h> found." >&4
8025                 echo " "
8026         else
8027                 xinc=`./findhdr sys/ndir.h`
8028         fi
8029         echo "<dirent.h> NOT found." >&4
8030 fi
8031 set i_dirent
8032 eval $setvar
8033
8034 : Look for type of directory structure.
8035 echo " "
8036 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8037
8038 case "$direntrytype" in
8039 ''|' ')
8040         case "$i_dirent" in
8041         $define) guess1='struct dirent' ;;
8042         *) guess1='struct direct'  ;;
8043         esac
8044         ;;
8045 *)      guess1="$direntrytype"
8046         ;;
8047 esac
8048
8049 case "$guess1" in
8050 'struct dirent') guess2='struct direct' ;;
8051 *) guess2='struct dirent' ;;
8052 esac
8053                 
8054 if $contains "$guess1" try.c >/dev/null 2>&1; then
8055         direntrytype="$guess1"
8056         echo "Your directory entries are $direntrytype." >&4
8057 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8058         direntrytype="$guess2"
8059         echo "Your directory entries seem to be $direntrytype." >&4
8060 else
8061         echo "I don't recognize your system's directory entries." >&4
8062         rp="What type is used for directory entries on this system?"
8063         dflt="$guess1"
8064         . ./myread
8065         direntrytype="$ans"
8066 fi
8067 $rm -f try.c
8068
8069
8070 : see if the directory entry stores field length
8071 echo " "
8072 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8073 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8074         echo "Good, your directory entry keeps length information in d_namlen." >&4
8075         val="$define"
8076 else
8077         echo "Your directory entry does not know about the d_namlen field." >&4
8078         val="$undef"
8079 fi
8080 set d_dirnamlen
8081 eval $setvar
8082 $rm -f try.c
8083
8084 : see if dlerror exists
8085 xxx_runnm="$runnm"
8086 runnm=false
8087 set dlerror d_dlerror
8088 eval $inlibc
8089 runnm="$xxx_runnm"
8090
8091 : see if dlfcn is available
8092 set dlfcn.h i_dlfcn
8093 eval $inhdr
8094
8095 case "$usedl" in
8096 $define|y|true)
8097         $cat << EOM
8098
8099 On a few systems, the dynamically loaded modules that perl generates and uses
8100 will need a different extension than shared libs. The default will probably
8101 be appropriate.
8102
8103 EOM
8104         case "$dlext" in
8105         '')     dflt="$so" ;;
8106         *)      dflt="$dlext" ;;
8107         esac
8108         rp='What is the extension of dynamically loaded modules'
8109         . ./myread
8110         dlext="$ans"
8111         ;;
8112 *)
8113         dlext="none"
8114         ;;
8115 esac
8116
8117 : Check if dlsym need a leading underscore
8118 echo " "
8119 val="$undef"
8120
8121 case "$dlsrc" in
8122 dl_dlopen.xs)
8123         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8124         $cat >dyna.c <<'EOM'
8125 fred () { }
8126 EOM
8127
8128 $cat >fred.c<<EOM
8129
8130 #include <stdio.h>
8131 #$i_dlfcn I_DLFCN
8132 #ifdef I_DLFCN
8133 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8134 #else
8135 #include <sys/types.h>
8136 #include <nlist.h>
8137 #include <link.h>
8138 #endif
8139
8140 extern int fred() ;
8141
8142 int main()
8143 {
8144     void * handle ;
8145     void * symbol ;
8146 #ifndef RTLD_LAZY
8147     int mode = 1 ;
8148 #else
8149     int mode = RTLD_LAZY ;
8150 #endif
8151     handle = dlopen("./dyna.$dlext", mode) ;
8152     if (handle == NULL) {
8153         printf ("1\n") ;
8154         fflush (stdout) ;
8155         exit(0);
8156     }
8157     symbol = dlsym(handle, "fred") ;
8158     if (symbol == NULL) {
8159         /* try putting a leading underscore */
8160         symbol = dlsym(handle, "_fred") ;
8161         if (symbol == NULL) {
8162             printf ("2\n") ;
8163             fflush (stdout) ;
8164             exit(0);
8165         }
8166         printf ("3\n") ;
8167     }
8168     else
8169         printf ("4\n") ;
8170     fflush (stdout) ;
8171     exit(0);
8172 }
8173 EOM
8174         : Call the object file tmp-dyna.o in case dlext=o.
8175         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8176                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8177                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8178                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8179                 xxx=`./fred`
8180                 case $xxx in
8181                 1)      echo "Test program failed using dlopen." >&4
8182                         echo "Perhaps you should not use dynamic loading." >&4;;
8183                 2)      echo "Test program failed using dlsym." >&4
8184                         echo "Perhaps you should not use dynamic loading." >&4;;
8185                 3)      echo "dlsym needs a leading underscore" >&4
8186                         val="$define" ;;
8187                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8188                 esac
8189         else
8190                 echo "I can't compile and run the test program." >&4
8191                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8192         fi
8193         ;;
8194 esac
8195                 
8196 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8197
8198 set d_dlsymun
8199 eval $setvar
8200
8201 hasproto='varname=$1; func=$2; shift; shift;
8202 while $test $# -ge 2; do
8203         case "$1" in
8204         $define) echo "#include <$2>";;
8205         esac ;
8206     shift 2;
8207 done > try.c;
8208 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8209 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8210         echo "$func() prototype found.";
8211         val="$define";
8212 else
8213         echo "$func() prototype NOT found.";
8214         val="$undef";
8215 fi;
8216 set $varname;
8217 eval $setvar;
8218 $rm -f try.c tryout.c'
8219
8220 : see if prototype for drand48 is available
8221 echo " "
8222 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8223 eval $hasproto
8224
8225 : see if dup2 exists
8226 set dup2 d_dup2
8227 eval $inlibc
8228
8229 : see if eaccess exists
8230 set eaccess d_eaccess
8231 eval $inlibc
8232
8233 : see if endgrent exists
8234 set endgrent d_endgrent
8235 eval $inlibc
8236
8237 : see if endhostent exists
8238 set endhostent d_endhent
8239 eval $inlibc
8240
8241 : see if endnetent exists
8242 set endnetent d_endnent
8243 eval $inlibc
8244
8245 : see if endprotoent exists
8246 set endprotoent d_endpent
8247 eval $inlibc
8248
8249 : see if endpwent exists
8250 set endpwent d_endpwent
8251 eval $inlibc
8252
8253 : see if endservent exists
8254 set endservent d_endsent
8255 eval $inlibc
8256
8257 : see if endspent exists
8258 set endspent d_endspent
8259 eval $inlibc
8260
8261 : Locate the flags for 'open()'
8262 echo " "
8263 $cat >open3.c <<'EOCP'
8264 #include <sys/types.h>
8265 #ifdef I_FCNTL
8266 #include <fcntl.h>
8267 #endif
8268 #ifdef I_SYS_FILE
8269 #include <sys/file.h>
8270 #endif
8271 int main() {
8272         if(O_RDONLY);
8273 #ifdef O_TRUNC
8274         exit(0);
8275 #else
8276         exit(1);
8277 #endif
8278 }
8279 EOCP
8280 : check sys/file.h first to get FREAD on Sun
8281 if $test `./findhdr sys/file.h` && \
8282                 set open3 -DI_SYS_FILE && eval $compile; then
8283         h_sysfile=true;
8284         echo "<sys/file.h> defines the O_* constants..." >&4
8285         if ./open3; then
8286                 echo "and you have the 3 argument form of open()." >&4
8287                 val="$define"
8288         else
8289                 echo "but not the 3 argument form of open().  Oh, well." >&4
8290                 val="$undef"
8291         fi
8292 elif $test `./findhdr fcntl.h` && \
8293                 set open3 -DI_FCNTL && eval $compile; then
8294         h_fcntl=true;
8295         echo "<fcntl.h> defines the O_* constants..." >&4
8296         if ./open3; then
8297                 echo "and you have the 3 argument form of open()." >&4
8298                 val="$define"
8299         else
8300                 echo "but not the 3 argument form of open().  Oh, well." >&4
8301                 val="$undef"
8302         fi
8303 else
8304         val="$undef"
8305         echo "I can't find the O_* constant definitions!  You got problems." >&4
8306 fi
8307 set d_open3
8308 eval $setvar
8309 $rm -f open3*
8310
8311 : see which of string.h or strings.h is needed
8312 echo " "
8313 strings=`./findhdr string.h`
8314 if $test "$strings" && $test -r "$strings"; then
8315         echo "Using <string.h> instead of <strings.h>." >&4
8316         val="$define"
8317 else
8318         val="$undef"
8319         strings=`./findhdr strings.h`
8320         if $test "$strings" && $test -r "$strings"; then
8321                 echo "Using <strings.h> instead of <string.h>." >&4
8322         else
8323                 echo "No string header found -- You'll surely have problems." >&4
8324         fi
8325 fi
8326 set i_string
8327 eval $setvar
8328 case "$i_string" in
8329 "$undef") strings=`./findhdr strings.h`;;
8330 *)        strings=`./findhdr string.h`;;
8331 esac
8332
8333 : check for non-blocking I/O stuff
8334 case "$h_sysfile" in
8335 true) echo "#include <sys/file.h>" > head.c;;
8336 *)
8337         case "$h_fcntl" in
8338         true) echo "#include <fcntl.h>" > head.c;;
8339         *) echo "#include <sys/fcntl.h>" > head.c;;
8340         esac
8341         ;;
8342 esac
8343 echo " "
8344 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8345 case "$o_nonblock" in
8346 '')
8347         $cat head.c > try.c
8348         $cat >>try.c <<'EOCP'
8349 #include <stdio.h>
8350 int main() {
8351 #ifdef O_NONBLOCK
8352         printf("O_NONBLOCK\n");
8353         exit(0);
8354 #endif
8355 #ifdef O_NDELAY
8356         printf("O_NDELAY\n");
8357         exit(0);
8358 #endif
8359 #ifdef FNDELAY
8360         printf("FNDELAY\n");
8361         exit(0);
8362 #endif
8363         exit(0);
8364 }
8365 EOCP
8366         set try
8367         if eval $compile_ok; then
8368                 o_nonblock=`./try`
8369                 case "$o_nonblock" in
8370                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8371                 *) echo "Seems like we can use $o_nonblock.";;
8372                 esac
8373         else
8374                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8375         fi
8376         ;;
8377 *) echo "Using $hint value $o_nonblock.";;
8378 esac
8379 $rm -f try try.* .out core
8380
8381 echo " "
8382 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8383 case "$eagain" in
8384 '')
8385         $cat head.c > try.c
8386         $cat >>try.c <<EOCP
8387 #include <errno.h>
8388 #include <sys/types.h>
8389 #include <signal.h>
8390 #include <stdio.h> 
8391 #define MY_O_NONBLOCK $o_nonblock
8392 #ifndef errno  /* XXX need better Configure test */
8393 extern int errno;
8394 #endif
8395 #$i_unistd I_UNISTD
8396 #ifdef I_UNISTD
8397 #include <unistd.h>
8398 #endif
8399 #ifdef $i_string
8400 #include <string.h>
8401 #else
8402 #include <strings.h>
8403 #endif
8404 $signal_t blech(x) int x; { exit(3); }
8405 EOCP
8406         $cat >> try.c <<'EOCP'
8407 int main()
8408 {
8409         int pd[2];
8410         int pu[2];
8411         char buf[1];
8412         char string[100];
8413
8414         pipe(pd);       /* Down: child -> parent */
8415         pipe(pu);       /* Up: parent -> child */
8416         if (0 != fork()) {
8417                 int ret;
8418                 close(pd[1]);   /* Parent reads from pd[0] */
8419                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8420                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8421                         exit(1);
8422                 signal(SIGALRM, blech);
8423                 alarm(5);
8424                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8425                         exit(2);
8426                 sprintf(string, "%d\n", ret);
8427                 write(2, string, strlen(string));
8428                 alarm(0);
8429 #ifdef EAGAIN
8430                 if (errno == EAGAIN) {
8431                         printf("EAGAIN\n");
8432                         goto ok;
8433                 }
8434 #endif
8435 #ifdef EWOULDBLOCK
8436                 if (errno == EWOULDBLOCK)
8437                         printf("EWOULDBLOCK\n");
8438 #endif
8439         ok:
8440                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8441                 sleep(2);                               /* Give it time to close our pipe */
8442                 alarm(5);
8443                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8444                 alarm(0);
8445                 sprintf(string, "%d\n", ret);
8446                 write(3, string, strlen(string));
8447                 exit(0);
8448         }
8449
8450         close(pd[0]);                   /* We write to pd[1] */
8451         close(pu[1]);                   /* We read from pu[0] */
8452         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8453         close(pd[1]);                   /* Pipe pd is now fully closed! */
8454         exit(0);                                /* Bye bye, thank you for playing! */
8455 }
8456 EOCP
8457         set try
8458         if eval $compile_ok; then
8459                 echo "$startsh" >mtry
8460                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8461                 chmod +x mtry
8462                 ./mtry >/dev/null 2>&1
8463                 case $? in
8464                 0) eagain=`$cat try.out`;;
8465                 1) echo "Could not perform non-blocking setting!";;
8466                 2) echo "I did a successful read() for something that was not there!";;
8467                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8468                 *) echo "Something terribly wrong happened during testing.";;
8469                 esac
8470                 rd_nodata=`$cat try.ret`
8471                 echo "A read() system call with no data present returns $rd_nodata."
8472                 case "$rd_nodata" in
8473                 0|-1) ;;
8474                 *)
8475                         echo "(That's peculiar, fixing that to be -1.)"
8476                         rd_nodata=-1
8477                         ;;
8478                 esac
8479                 case "$eagain" in
8480                 '')
8481                         echo "Forcing errno EAGAIN on read() with no data available."
8482                         eagain=EAGAIN
8483                         ;;
8484                 *)
8485                         echo "Your read() sets errno to $eagain when no data is available."
8486                         ;;
8487                 esac
8488                 status=`$cat try.err`
8489                 case "$status" in
8490                 0) echo "And it correctly returns 0 to signal EOF.";;
8491                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8492                 *) echo "However, your read() returns '$status' on EOF??";;
8493                 esac
8494                 val="$define"
8495                 if test "$status" = "$rd_nodata"; then
8496                         echo "WARNING: you can't distinguish between EOF and no data!"
8497                         val="$undef"
8498                 fi
8499         else
8500                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8501                 eagain=EAGAIN
8502         fi
8503         set d_eofnblk
8504         eval $setvar
8505         ;;
8506 *)
8507         echo "Using $hint value $eagain."
8508         echo "Your read() returns $rd_nodata when no data is present."
8509         case "$d_eofnblk" in
8510         "$define") echo "And you can see EOF because read() returns 0.";;
8511         "$undef") echo "But you can't see EOF status from read() returned value.";;
8512         *)
8513                 echo "(Assuming you can't see EOF status from read anyway.)"
8514                 d_eofnblk=$undef
8515                 ;;
8516         esac
8517         ;;
8518 esac
8519 $rm -f try try.* .out core head.c mtry
8520
8521 : see if fchmod exists
8522 set fchmod d_fchmod
8523 eval $inlibc
8524
8525 : see if fchown exists
8526 set fchown d_fchown
8527 eval $inlibc
8528
8529 : see if this is an fcntl system
8530 set fcntl d_fcntl
8531 eval $inlibc
8532
8533 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8534 while $test $# -ge 2; do
8535         case "$1" in
8536         $define) echo "#include <$2>";;
8537         esac ;
8538     shift 2;
8539 done > try.c;
8540 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8541 set try;
8542 if eval $compile; then
8543         val="$define";
8544 else
8545         val="$undef";
8546 fi;
8547 set $varname;
8548 eval $setvar;
8549 $rm -f try.c try.o'
8550
8551 socketlib=''
8552 sockethdr=''
8553 : see whether socket exists
8554 echo " "
8555 $echo $n "Hmm... $c" >&4
8556 if set socket val -f d_socket; eval $csym; $val; then
8557         echo "Looks like you have Berkeley networking support." >&4
8558         d_socket="$define"
8559         if set setsockopt val -f; eval $csym; $val; then
8560                 d_oldsock="$undef"
8561         else
8562                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8563                 d_oldsock="$define"
8564         fi
8565 else
8566         if $contains socklib libc.list >/dev/null 2>&1; then
8567                 echo "Looks like you have Berkeley networking support." >&4
8568                 d_socket="$define"
8569                 : we will have to assume that it supports the 4.2 BSD interface
8570                 d_oldsock="$undef"
8571         else
8572                 echo "You don't have Berkeley networking in libc$_a..." >&4
8573                 if test "X$d_socket" = "X$define"; then
8574                    echo "...but you seem to believe that you have sockets." >&4
8575                 else
8576                         for net in net socket
8577                         do
8578                                 if test -f /usr/lib/lib$net$_a; then
8579                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8580                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8581                                         if $contains socket libc.list >/dev/null 2>&1; then
8582                                                 d_socket="$define"
8583                                                 socketlib="-l$net"
8584                                                 case "$net" in
8585                                                 net)
8586                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8587                                                         sockethdr="-I/usr/netinclude"
8588                                                         ;;
8589                                                 esac
8590                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8591                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8592                                                         d_oldsock="$undef"
8593                                                 else
8594                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8595                                                         d_oldsock="$define"
8596                                                 fi
8597                                                 break
8598                                         fi
8599                                 fi
8600                         done
8601                         if test "X$d_socket" != "X$define"; then
8602                            echo "or anywhere else I see." >&4
8603                            d_socket="$undef"
8604                            d_oldsock="$undef"
8605                         fi
8606                 fi
8607         fi
8608 fi
8609
8610 : see if socketpair exists
8611 set socketpair d_sockpair
8612 eval $inlibc
8613
8614
8615 echo " "
8616 echo "Checking the availability of certain socket constants..." >& 4
8617 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8618         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8619         $cat >try.c <<EOF
8620 #include <sys/types.h>
8621 #include <sys/socket.h>
8622 int main() {
8623     int i = $ENUM;
8624 }
8625 EOF
8626         val="$undef"
8627         set try; if eval $compile; then
8628                 val="$define"
8629         fi
8630         set d_${enum}; eval $setvar
8631         $rm -f try.c try
8632 done
8633
8634 : see if sys/select.h has to be included
8635 set sys/select.h i_sysselct
8636 eval $inhdr
8637
8638 : see if we should include time.h, sys/time.h, or both
8639 echo " "
8640 if test "X$timeincl" = X; then
8641         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8642         $echo $n "I'm now running the test program...$c"
8643         $cat >try.c <<'EOCP'
8644 #include <sys/types.h>
8645 #ifdef I_TIME
8646 #include <time.h>
8647 #endif
8648 #ifdef I_SYSTIME
8649 #ifdef SYSTIMEKERNEL
8650 #define KERNEL
8651 #endif
8652 #include <sys/time.h>
8653 #endif
8654 #ifdef I_SYSSELECT
8655 #include <sys/select.h>
8656 #endif
8657 int main()
8658 {
8659         struct tm foo;
8660 #ifdef S_TIMEVAL
8661         struct timeval bar;
8662 #endif
8663 #ifdef S_TIMEZONE
8664         struct timezone tzp;
8665 #endif
8666         if (foo.tm_sec == foo.tm_sec)
8667                 exit(0);
8668 #ifdef S_TIMEVAL
8669         if (bar.tv_sec == bar.tv_sec)
8670                 exit(0);
8671 #endif
8672         exit(1);
8673 }
8674 EOCP
8675         flags=''
8676         for s_timezone in '-DS_TIMEZONE' ''; do
8677         sysselect=''
8678         for s_timeval in '-DS_TIMEVAL' ''; do
8679         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8680         for i_time in '' '-DI_TIME'; do
8681         for i_systime in '-DI_SYSTIME' ''; do
8682                 case "$flags" in
8683                 '') $echo $n ".$c"
8684                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8685                         if eval $compile; then
8686                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8687                                 shift
8688                                 flags="$*"
8689                                 echo " "
8690                                 $echo $n "Succeeded with $flags$c"
8691                         fi
8692                         ;;
8693                 esac
8694         done
8695         done
8696         done
8697         done
8698         done
8699         timeincl=''
8700         echo " "
8701         case "$flags" in
8702         *SYSTIMEKERNEL*) i_systimek="$define"
8703                 timeincl=`./findhdr sys/time.h`
8704                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8705         *) i_systimek="$undef";;
8706         esac
8707         case "$flags" in
8708         *I_TIME*) i_time="$define"
8709                 timeincl=`./findhdr time.h`" $timeincl"
8710                 echo "We'll include <time.h>." >&4;;
8711         *) i_time="$undef";;
8712         esac
8713         case "$flags" in
8714         *I_SYSTIME*) i_systime="$define"
8715                 timeincl=`./findhdr sys/time.h`" $timeincl"
8716                 echo "We'll include <sys/time.h>." >&4;;
8717         *) i_systime="$undef";;
8718         esac
8719         $rm -f try.c try
8720 fi
8721
8722 : check for fd_set items
8723 $cat <<EOM
8724
8725 Checking to see how well your C compiler handles fd_set and friends ...
8726 EOM
8727 $cat >fd_set.c <<EOCP
8728 #$i_systime I_SYS_TIME
8729 #$i_sysselct I_SYS_SELECT
8730 #$d_socket HAS_SOCKET
8731 #include <sys/types.h>
8732 #ifdef HAS_SOCKET
8733 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8734 #endif
8735 #ifdef I_SYS_TIME
8736 #include <sys/time.h>
8737 #endif
8738 #ifdef I_SYS_SELECT
8739 #include <sys/select.h>
8740 #endif
8741 int main() {
8742         fd_set fds;
8743
8744 #ifdef TRYBITS
8745         if(fds.fds_bits);
8746 #endif
8747
8748 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8749         exit(0);
8750 #else
8751         exit(1);
8752 #endif
8753 }
8754 EOCP
8755 set fd_set -DTRYBITS
8756 if eval $compile; then
8757         d_fds_bits="$define"
8758         d_fd_set="$define"
8759         echo "Well, your system knows about the normal fd_set typedef..." >&4
8760         if ./fd_set; then
8761                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8762                 d_fd_macros="$define"
8763         else
8764                 $cat >&4 <<'EOM'
8765 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8766 EOM
8767                 d_fd_macros="$undef"
8768         fi
8769 else
8770         $cat <<'EOM'
8771 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8772 EOM
8773         set fd_set
8774         if eval $compile; then
8775                 d_fds_bits="$undef"
8776                 d_fd_set="$define"
8777                 echo "Well, your system has some sort of fd_set available..." >&4
8778                 if ./fd_set; then
8779                         echo "and you have the normal fd_set macros." >&4
8780                         d_fd_macros="$define"
8781                 else
8782                         $cat <<'EOM'
8783 but not the normal fd_set macros!  Gross!  More work for me...
8784 EOM
8785                         d_fd_macros="$undef"
8786                 fi
8787         else
8788         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8789                 d_fd_set="$undef"
8790                 d_fds_bits="$undef"
8791                 d_fd_macros="$undef"
8792         fi
8793 fi
8794 $rm -f fd_set*
8795
8796 : see if fgetpos exists
8797 set fgetpos d_fgetpos
8798 eval $inlibc
8799
8800 : see if flock exists
8801 set flock d_flock
8802 eval $inlibc
8803
8804 : see if fork exists
8805 set fork d_fork
8806 eval $inlibc
8807
8808 : see if pathconf exists
8809 set pathconf d_pathconf
8810 eval $inlibc
8811
8812 : see if fpathconf exists
8813 set fpathconf d_fpathconf
8814 eval $inlibc
8815
8816
8817 : check for fpos64_t
8818 echo " "
8819 echo "Checking to see if you have fpos64_t..." >&4
8820 $cat >try.c <<EOCP
8821 #include <stdio.h>
8822 int main() { fpos64_t x = 7; }
8823 EOCP
8824 set try
8825 if eval $compile; then
8826         val="$define"
8827         echo "You have fpos64_t."
8828 else
8829         val="$undef"
8830         echo "You do not have fpos64_t."
8831         case "$fpossize" in
8832         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8833         esac
8834 fi
8835 $rm -f try.* try
8836 set d_fpos64_t
8837 eval $setvar
8838
8839 hasstruct='varname=$1; struct=$2; shift; shift;
8840 while $test $# -ge 2; do
8841         case "$1" in
8842         $define) echo "#include <$2>";;
8843         esac ;
8844     shift 2;
8845 done > try.c;
8846 echo "int main () { struct $struct foo; }" >> try.c;
8847 set try;
8848 if eval $compile; then
8849         val="$define";
8850 else
8851         val="$undef";
8852 fi;
8853 set $varname;
8854 eval $setvar;
8855 $rm -f try.c try.o'
8856
8857 : see if this is a sys/param system
8858 set sys/param.h i_sysparam
8859 eval $inhdr
8860
8861 : see if this is a sys/mount.h system
8862 set sys/mount.h i_sysmount
8863 eval $inhdr
8864
8865 : see if sys/types.h has to be included
8866 set sys/types.h i_systypes
8867 eval $inhdr
8868
8869
8870 echo " "
8871 echo "Checking to see if your system supports struct fs_data..." >&4
8872 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8873 eval $hasstruct
8874 case "$d_fs_data_s" in
8875 "$define")      echo "Yes, it does."   ;;
8876 *)              echo "No, it doesn't." ;;
8877 esac
8878
8879 : see if fseeko exists
8880 set fseeko d_fseeko
8881 eval $inlibc
8882 case "$longsize" in
8883 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8884 esac
8885
8886 : see if fsetpos exists
8887 set fsetpos d_fsetpos
8888 eval $inlibc
8889
8890
8891 : see if fstatfs exists
8892 set fstatfs d_fstatfs
8893 eval $inlibc
8894
8895
8896 : see if statvfs exists
8897 set statvfs d_statvfs
8898 eval $inlibc
8899
8900 : see if fstatvfs exists
8901 set fstatvfs d_fstatvfs
8902 eval $inlibc
8903
8904
8905 : see if ftello exists
8906 set ftello d_ftello
8907 eval $inlibc
8908 case "$longsize" in
8909 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8910 esac
8911
8912 : see if getcwd exists
8913 set getcwd d_getcwd
8914 eval $inlibc
8915
8916 : see if getgrent exists
8917 set getgrent d_getgrent
8918 eval $inlibc
8919
8920 : see if gethostbyaddr exists
8921 set gethostbyaddr d_gethbyaddr
8922 eval $inlibc
8923
8924 : see if gethostbyname exists
8925 set gethostbyname d_gethbyname
8926 eval $inlibc
8927
8928 : see if gethostent exists
8929 set gethostent d_gethent
8930 eval $inlibc
8931
8932 : see how we will look up host name
8933 echo " "
8934 call=''
8935 if set gethostname val -f d_gethname; eval $csym; $val; then
8936         echo 'gethostname() found.' >&4
8937         d_gethname="$define"
8938         call=gethostname
8939 fi
8940 if set uname val -f d_uname; eval $csym; $val; then
8941         if ./xenix; then
8942                 $cat <<'EOM'
8943 uname() was found, but you're running xenix, and older versions of xenix
8944 have a broken uname(). If you don't really know whether your xenix is old
8945 enough to have a broken system call, use the default answer.
8946
8947 EOM
8948                 dflt=y
8949                 case "$d_uname" in
8950                 "$define") dflt=n;;
8951                 esac
8952                 rp='Is your uname() broken?'
8953                 . ./myread
8954                 case "$ans" in
8955                 n*) d_uname="$define"; call=uname;;
8956                 esac
8957         else
8958                 echo 'uname() found.' >&4
8959                 d_uname="$define"
8960                 case "$call" in
8961                 '') call=uname ;;
8962                 esac
8963         fi
8964 fi
8965 case "$d_gethname" in
8966 '') d_gethname="$undef";;
8967 esac
8968 case "$d_uname" in
8969 '') d_uname="$undef";;
8970 esac
8971 case "$d_uname$d_gethname" in
8972 *define*)
8973         dflt=n
8974         cat <<EOM
8975  
8976 Every now and then someone has a $call() that lies about the hostname
8977 but can't be fixed for political or economic reasons.  If you wish, I can
8978 pretend $call() isn't there and maybe compute hostname at run-time
8979 thanks to the '$phostname' command.
8980
8981 EOM
8982         rp="Shall I ignore $call() from now on?"
8983         . ./myread
8984         case "$ans" in
8985         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8986         esac;;
8987 esac
8988 case "$phostname" in
8989 '') aphostname='';;
8990 *) case "$aphostname" in
8991         /*) ;;
8992         *) set X $phostname
8993                 shift
8994                 file=$1
8995                 shift
8996                 file=`./loc $file $file $pth`
8997                 aphostname=`echo $file $*`
8998                 ;;
8999         esac
9000         ;;
9001 esac
9002 case "$d_uname$d_gethname" in
9003 *define*) ;;
9004 *)
9005         case "$phostname" in
9006         '')
9007                 echo "There will be no way for $package to get your hostname." >&4;;
9008         *)
9009         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9010                 ;;
9011         esac;;
9012 esac
9013 case "$d_phostname" in
9014 '') d_phostname="$undef";;
9015 esac
9016
9017 : see if this is a netdb.h system
9018 set netdb.h i_netdb
9019 eval $inhdr
9020
9021 : see if prototypes for various gethostxxx netdb.h functions are available
9022 echo " "
9023 set d_gethostprotos gethostent $i_netdb netdb.h
9024 eval $hasproto
9025
9026 : see if getlogin exists
9027 set getlogin d_getlogin
9028 eval $inlibc
9029
9030 : see if getmnt exists
9031 set getmnt d_getmnt
9032 eval $inlibc
9033
9034 : see if getmntent exists
9035 set getmntent d_getmntent
9036 eval $inlibc
9037
9038 : see if getnetbyaddr exists
9039 set getnetbyaddr d_getnbyaddr
9040 eval $inlibc
9041
9042 : see if getnetbyname exists
9043 set getnetbyname d_getnbyname
9044 eval $inlibc
9045
9046 : see if getnetent exists
9047 set getnetent d_getnent
9048 eval $inlibc
9049
9050 : see if prototypes for various getnetxxx netdb.h functions are available
9051 echo " "
9052 set d_getnetprotos getnetent $i_netdb netdb.h
9053 eval $hasproto
9054
9055
9056 : see if getprotobyname exists
9057 set getprotobyname d_getpbyname
9058 eval $inlibc
9059
9060 : see if getprotobynumber exists
9061 set getprotobynumber d_getpbynumber
9062 eval $inlibc
9063
9064 : see if getprotoent exists
9065 set getprotoent d_getpent
9066 eval $inlibc
9067
9068 : see if getpgid exists
9069 set getpgid d_getpgid
9070 eval $inlibc
9071
9072 : see if getpgrp2 exists
9073 set getpgrp2 d_getpgrp2
9074 eval $inlibc
9075
9076 : see if getppid exists
9077 set getppid d_getppid
9078 eval $inlibc
9079
9080 : see if getpriority exists
9081 set getpriority d_getprior
9082 eval $inlibc
9083
9084 : see if prototypes for various getprotoxxx netdb.h functions are available
9085 echo " "
9086 set d_getprotoprotos getprotoent $i_netdb netdb.h
9087 eval $hasproto
9088
9089 : see if getpwent exists
9090 set getpwent d_getpwent
9091 eval $inlibc
9092
9093
9094 : see if getservbyname exists
9095 set getservbyname d_getsbyname
9096 eval $inlibc
9097
9098 : see if getservbyport exists
9099 set getservbyport d_getsbyport
9100 eval $inlibc
9101
9102 : see if getservent exists
9103 set getservent d_getsent
9104 eval $inlibc
9105
9106 : see if prototypes for various getservxxx netdb.h functions are available
9107 echo " "
9108 set d_getservprotos getservent $i_netdb netdb.h
9109 eval $hasproto
9110
9111 : see if getspent exists
9112 set getspent d_getspent
9113 eval $inlibc
9114
9115 : see if getspnam exists
9116 set getspnam d_getspnam
9117 eval $inlibc
9118
9119 : see if gettimeofday or ftime exists
9120 set gettimeofday d_gettimeod
9121 eval $inlibc
9122 case "$d_gettimeod" in
9123 "$undef")
9124         set ftime d_ftime 
9125         eval $inlibc
9126         ;;
9127 *)
9128         val="$undef"; set d_ftime; eval $setvar
9129         ;;
9130 esac
9131 case "$d_gettimeod$d_ftime" in
9132 "$undef$undef")
9133         echo " "
9134         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9135         ;;
9136 esac
9137
9138 : see if this is an grp system
9139 set grp.h i_grp
9140 eval $inhdr
9141
9142 case "$i_grp" in
9143 $define)
9144         xxx=`./findhdr grp.h`
9145         $cppstdin $cppflags $cppminus < $xxx >$$.h
9146
9147         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9148                 val="$define"
9149         else
9150                 val="$undef"
9151         fi
9152         set d_grpasswd
9153         eval $setvar
9154
9155         $rm -f $$.h
9156         ;;
9157 *)
9158         val="$undef";
9159         set d_grpasswd; eval $setvar
9160         ;;
9161 esac
9162
9163 : see if hasmntopt exists
9164 set hasmntopt d_hasmntopt
9165 eval $inlibc
9166
9167 : see if this is a netinet/in.h or sys/in.h system
9168 set netinet/in.h i_niin sys/in.h i_sysin
9169 eval $inhdr
9170
9171 : see if arpa/inet.h has to be included
9172 set arpa/inet.h i_arpainet
9173 eval $inhdr
9174
9175 : see if htonl --and friends-- exists
9176 val=''
9177 set htonl val
9178 eval $inlibc
9179
9180 : Maybe they are macros.
9181 case "$val" in
9182 $undef)
9183         $cat >htonl.c <<EOM
9184 #include <stdio.h>
9185 #include <sys/types.h>
9186 #$i_niin I_NETINET_IN
9187 #$i_sysin I_SYS_IN
9188 #$i_arpainet I_ARPA_INET
9189 #ifdef I_NETINET_IN
9190 #include <netinet/in.h>
9191 #endif
9192 #ifdef I_SYS_IN
9193 #include <sys/in.h>
9194 #endif
9195 #ifdef I_ARPA_INET
9196 #include <arpa/inet.h>
9197 #endif
9198 #ifdef htonl
9199 printf("Defined as a macro.");
9200 #endif
9201 EOM
9202         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9203         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9204                 val="$define"
9205                 echo "But it seems to be defined as a macro." >&4
9206         fi
9207         $rm -f htonl.?
9208         ;;
9209 esac
9210 set d_htonl
9211 eval $setvar
9212
9213 : see if iconv exists
9214 set iconv d_iconv
9215 eval $inlibc
9216
9217 : index or strchr
9218 echo " "
9219 if set index val -f; eval $csym; $val; then
9220         if set strchr val -f d_strchr; eval $csym; $val; then
9221                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9222                         val="$define"
9223                         vali="$undef"
9224                         echo "strchr() found." >&4
9225                 else
9226                         val="$undef"
9227                         vali="$define"
9228                         echo "index() found." >&4
9229                 fi
9230         else
9231                 val="$undef"
9232                 vali="$define"
9233                 echo "index() found." >&4
9234         fi
9235 else
9236         if set strchr val -f d_strchr; eval $csym; $val; then
9237                 val="$define"
9238                 vali="$undef"
9239                 echo "strchr() found." >&4
9240         else
9241                 echo "No index() or strchr() found!" >&4
9242                 val="$undef"
9243                 vali="$undef"
9244         fi
9245 fi
9246 set d_strchr; eval $setvar
9247 val="$vali"
9248 set d_index; eval $setvar
9249
9250 : check whether inet_aton exists
9251 set inet_aton d_inetaton
9252 eval $inlibc
9253
9254 : see if inttypes.h is available
9255 : we want a real compile instead of Inhdr because some systems
9256 : have an inttypes.h which includes non-existent headers
9257 echo " "
9258 $cat >try.c <<EOCP
9259 #include <inttypes.h>
9260 int main() {
9261         static int32_t foo32 = 0x12345678;
9262 }
9263 EOCP
9264 set try
9265 if eval $compile; then
9266         echo "<inttypes.h> found." >&4
9267         val="$define"
9268 else
9269         echo "<inttypes.h> NOT found." >&4
9270         val="$undef"
9271 fi
9272 $rm -f try.c try
9273 set i_inttypes
9274 eval $setvar
9275
9276 : check for int64_t
9277 echo " "
9278 echo "Checking to see if you have int64_t..." >&4
9279 $cat >try.c <<EOCP
9280 #include <sys/types.h>
9281 #$i_inttypes I_INTTYPES
9282 #ifdef I_INTTYPES
9283 #include <inttypes.h>
9284 #endif
9285 int main() { int64_t x = 7; }
9286 EOCP
9287 set try
9288 if eval $compile; then
9289         val="$define"
9290         echo "You have int64_t."
9291 else
9292         val="$undef"
9293         echo "You do not have int64_t."
9294 fi
9295 $rm -f try try.*
9296 set d_int64_t
9297 eval $setvar
9298
9299 : Look for isascii
9300 echo " "
9301 $cat >isascii.c <<'EOCP'
9302 #include <stdio.h>
9303 #include <ctype.h>
9304 int main() {
9305         int c = 'A';
9306         if (isascii(c))
9307                 exit(0);
9308         else
9309                 exit(1);
9310 }
9311 EOCP
9312 set isascii
9313 if eval $compile; then
9314         echo "isascii() found." >&4
9315         val="$define"
9316 else
9317         echo "isascii() NOT found." >&4
9318         val="$undef"
9319 fi
9320 set d_isascii
9321 eval $setvar
9322 $rm -f isascii*
9323
9324 : see if killpg exists
9325 set killpg d_killpg
9326 eval $inlibc
9327
9328 : see if lchown exists
9329 echo " "
9330 $cat > try.c <<'EOCP'
9331 /* System header to define __stub macros and hopefully few prototypes,
9332     which can conflict with char lchown(); below.  */
9333 #include <assert.h>
9334 /* Override any gcc2 internal prototype to avoid an error.  */
9335 /* We use char because int might match the return type of a gcc2
9336    builtin and then its argument prototype would still apply.  */
9337 char lchown();
9338 int main() {
9339     /*  The GNU C library defines this for functions which it implements
9340         to always fail with ENOSYS.  Some functions are actually named
9341         something starting with __ and the normal name is an alias.  */
9342 #if defined (__stub_lchown) || defined (__stub___lchown)
9343 choke me
9344 #else
9345 lchown();
9346 #endif
9347 ; return 0; }
9348 EOCP
9349 set try
9350 if eval $compile; then
9351     $echo "lchown() found." >&4
9352     val="$define"
9353 else
9354     $echo "lchown() NOT found." >&4
9355     val="$undef"
9356 fi
9357 set d_lchown
9358 eval $setvar
9359
9360 : See if number of significant digits in a double precision number is known
9361 echo " "
9362 $cat >ldbl_dig.c <<EOM
9363 #$i_limits I_LIMITS
9364 #$i_float I_FLOAT
9365 #ifdef I_LIMITS
9366 #include <limits.h>
9367 #endif
9368 #ifdef I_FLOAT
9369 #include <float.h>
9370 #endif
9371 #ifdef LDBL_DIG
9372 printf("Contains LDBL_DIG");
9373 #endif
9374 EOM
9375 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9376 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9377         echo "LDBL_DIG found." >&4
9378         val="$define"
9379 else
9380         echo "LDBL_DIG NOT found." >&4
9381         val="$undef"
9382 fi
9383 $rm -f ldbl_dig.?
9384 set d_ldbl_dig
9385 eval $setvar
9386
9387 : see if link exists
9388 set link d_link
9389 eval $inlibc
9390
9391 : see if localeconv exists
9392 set localeconv d_locconv
9393 eval $inlibc
9394
9395 : see if lockf exists
9396 set lockf d_lockf
9397 eval $inlibc
9398
9399 : check for long long
9400 echo " "
9401 echo "Checking to see if you have long long..." >&4
9402 echo 'int main() { long long x = 7; return 0; }' > try.c
9403 set try
9404 if eval $compile; then
9405         val="$define"
9406         echo "You have have long long."
9407 else
9408         val="$undef"
9409         echo "You do not have long long."
9410 fi
9411 $rm try.*
9412 set d_longlong
9413 eval $setvar
9414
9415 : check for length of long long
9416 case "${d_longlong}${longlongsize}" in
9417 $define)
9418         echo " "
9419         $echo $n "Checking to see how big your long longs are..." $c >&4
9420         $cat >try.c <<'EOCP'
9421 #include <stdio.h>
9422 int main()
9423 {
9424     printf("%d\n", (int)sizeof(long long));
9425     return(0);
9426 }
9427 EOCP
9428         set try
9429         if eval $compile_ok; then
9430                 longlongsize=`./try$exe_ext`
9431                 $echo " $longlongsize bytes." >&4
9432         else
9433                 dflt='8'
9434                 echo " "
9435                 echo "(I can't seem to compile the test program.  Guessing...)"
9436                 rp="What is the size of a long long (in bytes)?"
9437                 . ./myread
9438                 longlongsize="$ans"
9439         fi
9440         if $test "X$longsize" = "X$longlongsize"; then
9441                 echo "(That isn't any different from an ordinary long.)"
9442         fi      
9443         ;;
9444 esac
9445 $rm -f try.* try
9446
9447 : see if lstat exists
9448 set lstat d_lstat
9449 eval $inlibc
9450
9451 : see if mblen exists
9452 set mblen d_mblen
9453 eval $inlibc
9454
9455 : see if mbstowcs exists
9456 set mbstowcs d_mbstowcs
9457 eval $inlibc
9458
9459 : see if mbtowc exists
9460 set mbtowc d_mbtowc
9461 eval $inlibc
9462
9463 : see if memchr exists
9464 set memchr d_memchr
9465 eval $inlibc
9466
9467 : see if memcmp exists
9468 set memcmp d_memcmp
9469 eval $inlibc
9470
9471 : see if memcpy exists
9472 set memcpy d_memcpy
9473 eval $inlibc
9474
9475 : see if memmove exists
9476 set memmove d_memmove
9477 eval $inlibc
9478
9479 : see if memset exists
9480 set memset d_memset
9481 eval $inlibc
9482
9483 : see if mkdir exists
9484 set mkdir d_mkdir
9485 eval $inlibc
9486
9487 : see if mkdtemp exists
9488 set mkdtemp d_mkdtemp
9489 eval $inlibc
9490
9491 : see if mkfifo exists
9492 set mkfifo d_mkfifo
9493 eval $inlibc
9494
9495 : see if mkstemp exists
9496 set mkstemp d_mkstemp
9497 eval $inlibc
9498
9499 : see if mkstemps exists
9500 set mkstemps d_mkstemps
9501 eval $inlibc
9502
9503 : see if mktime exists
9504 set mktime d_mktime
9505 eval $inlibc
9506
9507 : see if this is a sys/mman.h system
9508 set sys/mman.h i_sysmman
9509 eval $inhdr
9510
9511 : see if mmap exists
9512 set mmap d_mmap
9513 eval $inlibc
9514 : see what shmat returns
9515 : default to something harmless
9516 mmaptype='void *'
9517 case "$i_sysmman$d_mmap" in
9518 "$define$define")
9519         $cat >mmap.c <<'END'
9520 #include <sys/mman.h>
9521 void *mmap();
9522 END
9523         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9524                 mmaptype='void *'
9525         else
9526                 mmaptype='caddr_t'
9527         fi
9528         echo "and it returns ($mmaptype)." >&4
9529         ;;
9530 esac
9531
9532
9533
9534 : see if mprotect exists
9535 set mprotect d_mprotect
9536 eval $inlibc
9537
9538 : see if msgctl exists
9539 set msgctl d_msgctl
9540 eval $inlibc
9541
9542 : see if msgget exists
9543 set msgget d_msgget
9544 eval $inlibc
9545
9546 : see if msgsnd exists
9547 set msgsnd d_msgsnd
9548 eval $inlibc
9549
9550 : see if msgrcv exists
9551 set msgrcv d_msgrcv
9552 eval $inlibc
9553
9554 : see how much of the 'msg*(2)' library is present.
9555 h_msg=true
9556 echo " "
9557 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9558 *"$undef"*) h_msg=false;;
9559 esac
9560 case "$osname" in
9561 freebsd)
9562     case "`ipcs 2>&1`" in
9563     "SVID messages"*"not configured"*)
9564         echo "Your $osname does not have the msg*(2) configured." >&4
9565         h_msg=false
9566         val="$undef"
9567         set msgctl d_msgctl
9568         eval $setvar
9569         set msgget d_msgget
9570         eval $setvar
9571         set msgsnd d_msgsnd
9572         eval $setvar
9573         set msgrcv d_msgrcv
9574         eval $setvar
9575         ;;
9576     esac
9577     ;;
9578 esac
9579 : we could also check for sys/ipc.h ...
9580 if $h_msg && $test `./findhdr sys/msg.h`; then
9581         echo "You have the full msg*(2) library." >&4
9582         val="$define"
9583 else
9584         echo "You don't have the full msg*(2) library." >&4
9585         val="$undef"
9586 fi
9587 set d_msg
9588 eval $setvar
9589
9590 : see if msync exists
9591 set msync d_msync
9592 eval $inlibc
9593
9594 : see if munmap exists
9595 set munmap d_munmap
9596 eval $inlibc
9597
9598 : see if nice exists
9599 set nice d_nice
9600 eval $inlibc
9601
9602
9603 echo " "
9604 echo "Checking which 64-bit integer type we could use..." >&4
9605
9606 case "$intsize" in
9607 8) val=int
9608    set quadtype
9609    eval $setvar
9610    val='"unsigned int"'
9611    set uquadtype
9612    eval $setvar
9613    quadkind=1
9614    ;;
9615 *) case "$longsize" in
9616    8) val=long
9617       set quadtype
9618       eval $setvar
9619       val='"unsigned long"'
9620       set uquadtype
9621       eval $setvar
9622       quadkind=2
9623       ;;
9624    *) case "$d_longlong:$longlongsize" in
9625       define:8)
9626         val='"long long"'
9627         set quadtype
9628         eval $setvar
9629         val='"unsigned long long"'
9630         set uquadtype
9631         eval $setvar
9632         quadkind=3
9633         ;;
9634       *) case "$d_int64_t" in
9635          define)
9636            val=int64_t
9637            set quadtype
9638            eval $setvar
9639            val=uint64_t
9640            set uquadtype
9641            eval $setvar
9642            quadkind=4
9643            ;;
9644          esac
9645          ;;
9646       esac
9647       ;;
9648    esac
9649    ;;
9650 esac
9651
9652 case "$quadtype" in
9653 '')     echo "Alas, no 64-bit integer types in sight." >&4
9654         d_quad="$undef"
9655         ;;
9656 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9657             verb="will"
9658         else
9659             verb="could"
9660         fi
9661         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9662         d_quad="$define"
9663         ;;
9664 esac
9665
9666 : check for length of character
9667 echo " "
9668 case "$charsize" in
9669 '')
9670         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9671         $cat >try.c <<'EOCP'
9672 #include <stdio.h>
9673 int main()
9674 {
9675     printf("%d\n", (int)sizeof(char));
9676     exit(0);
9677 }
9678 EOCP
9679         set try
9680         if eval $compile_ok; then
9681                 dflt=`./try`
9682         else
9683                 dflt='1'
9684                 echo "(I can't seem to compile the test program.  Guessing...)"
9685         fi
9686         ;;
9687 *)
9688         dflt="$charsize"
9689         ;;
9690 esac
9691 rp="What is the size of a character (in bytes)?"
9692 . ./myread
9693 charsize="$ans"
9694 $rm -f try.c try
9695
9696
9697 echo " "
9698 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9699
9700 case "$use64bits:$d_quad:$quadtype" in
9701 define:define:?*)
9702         ivtype="$quadtype"
9703         uvtype="$uquadtype"
9704         ivsize=8
9705         uvsize=8
9706         ;;
9707 *)      ivtype="long"
9708         uvtype="unsigned long"
9709         ivsize=$longsize
9710         uvsize=$longsize
9711         ;;
9712 esac
9713
9714 case "$uselongdouble:$d_longdbl" in
9715 define:define)
9716         nvtype="long double"
9717         nvsize=$longdblsize
9718         ;;
9719 *)      nvtype=double
9720         nvsize=$doublesize
9721         ;;
9722 esac
9723
9724 $echo "(IV will be "$ivtype", $ivsize bytes)"
9725 $echo "(UV will be "$uvtype", $uvsize bytes)"
9726 $echo "(NV will be "$nvtype", $nvsize bytes)"
9727
9728 $cat >try.c <<EOCP
9729 #$i_inttypes I_INTTYPES
9730 #ifdef I_INTTYPES
9731 #include <inttypes.h>
9732 #endif
9733 #include <stdio.h>
9734 int main() {
9735 #ifdef INT8
9736    int8_t i =  INT8_MAX;
9737   uint8_t u = UINT8_MAX;
9738   printf("int8_t\n");
9739 #endif
9740 #ifdef INT16
9741    int16_t i =  INT16_MAX;
9742   uint16_t i = UINT16_MAX;
9743   printf("int16_t\n");
9744 #endif
9745 #ifdef INT32
9746    int32_t i =  INT32_MAX;
9747   uint32_t u = UINT32_MAX;
9748   printf("int32_t\n");
9749 #endif
9750 }
9751 EOCP
9752
9753 case "$i8type" in
9754 '')     case "$charsize" in
9755         1)      i8type=char
9756                 u8type="unsigned char"
9757                 i8size=$charsize
9758                 u8size=$charsize
9759                 ;;
9760         esac
9761         ;;
9762 esac
9763 case "$i8type" in
9764 '')     set try -DINT8
9765         if eval $compile; then
9766                 case "`./try$exe_ext`" in
9767                 int8_t) i8type=int8_t
9768                         u8type=uint8_t
9769                         i8size=1
9770                         u8size=1
9771                         ;;
9772                 esac
9773         fi
9774         ;;
9775 esac
9776 case "$i8type" in
9777 '')     if $test $charsize -ge 1; then
9778                 i8type=char
9779                 u8type="unsigned char"
9780                 i8size=$charsize
9781                 u8size=$charsize
9782         fi
9783         ;;
9784 esac
9785
9786 case "$i16type" in
9787 '')     case "$shortsize" in
9788         2)      i16type=short
9789                 u16type="unsigned short"
9790                 i16size=$shortsize
9791                 u16size=$shortsize
9792                 ;;
9793         esac
9794         ;;
9795 esac
9796 case "$i16type" in
9797 '')     set try -DINT16
9798         if eval $compile; then
9799                 case "`./try$exe_ext`" in
9800                 int16_t)
9801                         i16type=int16_t
9802                         u16type=uint16_t
9803                         i16size=2
9804                         u16size=2
9805                         ;;
9806                 esac
9807         fi
9808         ;;
9809 esac
9810 case "$i16type" in
9811 '')     if $test $shortsize -ge 2; then
9812                 i16type=short
9813                 u16type="unsigned short"
9814                 i16size=$shortsize
9815                 u16size=$shortsize
9816         fi
9817         ;;
9818 esac
9819
9820 case "$i32type" in
9821 '')     case "$longsize" in
9822         4)      i32type=long
9823                 u32type="unsigned long"
9824                 i32size=$longsize
9825                 u32size=$longsize
9826                 ;;
9827         *)      case "$intsize" in
9828                 4)      i32type=int
9829                         u32type="unsigned int"
9830                         i32size=$intsize
9831                         u32size=$intsize
9832                         ;;
9833                 esac
9834                 ;;
9835         esac
9836         ;;
9837 esac
9838 case "$i32type" in
9839 '')     set try -DINT32
9840         if eval $compile; then
9841                 case "`./try$exe_ext`" in
9842                 int32_t)
9843                         i32type=int32_t
9844                         u32type=uint32_t
9845                         i32size=4
9846                         u32size=4
9847                         ;;
9848                 esac
9849         fi
9850         ;;
9851 esac
9852 case "$i32type" in
9853 '')     if $test $intsize -ge 4; then
9854                 i32type=int
9855                 u32type="unsigned int"
9856                 i32size=$intsize
9857                 u32size=$intsize
9858         fi
9859         ;;
9860 esac
9861
9862 case "$i64type" in
9863 '')     case "$d_quad:$quadtype" in
9864         define:?*)
9865                 i64type="$quadtype"
9866                 u64type="$uquadtype"
9867                 i64size=8
9868                 u64size=8
9869                 ;;
9870         esac
9871         ;;
9872 esac
9873
9874 $echo "Checking whether your NVs can preserve your UVs..." >&4
9875 $cat <<EOP >try.c
9876 #include <stdio.h>
9877 int main() {
9878     $uvtype k = ($uvtype)~0, l;
9879     $nvtype d;
9880     l = k;
9881     d = ($nvtype)l;
9882     l = ($uvtype)d;
9883     if (l == k)
9884        printf("preserve\n");
9885     exit(0);
9886 }
9887 EOP
9888 set try
9889 if eval $compile; then
9890         case "`./try$exe_ext`" in
9891         preserve) d_nv_preserves_uv="$define" ;;
9892         esac
9893 fi      
9894 case "$d_nv_preserves_uv" in
9895 $define) $echo "Yes, they can."  2>&1 ;;
9896 *)       $echo "No, they can't." 2>&1
9897          d_nv_preserves_uv="$undef"
9898          ;;
9899 esac
9900
9901 $rm -f try.* try
9902
9903
9904 : check for off64_t
9905 echo " "
9906 echo "Checking to see if you have off64_t..." >&4
9907 $cat >try.c <<EOCP
9908 #include <sys/types.h>
9909 #include <unistd.h>
9910 int main() { off64_t x = 7; }
9911 EOCP
9912 set try
9913 if eval $compile; then
9914         val="$define"
9915         echo "You have off64_t."
9916 else
9917         val="$undef"
9918         echo "You do not have off64_t."
9919         case "$lseeksize" in
9920         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
9921         esac
9922 fi
9923 $rm -f try.* try
9924 set d_off64_t
9925 eval $setvar
9926
9927 : see if POSIX threads are available
9928 set pthread.h i_pthread
9929 eval $inhdr
9930
9931
9932
9933
9934 : how to create joinable pthreads
9935 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9936         echo " "
9937         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9938         $cat >try.c <<'EOCP'
9939 #include <pthread.h>
9940 int main() {
9941     int detachstate = JOINABLE;
9942 }
9943 EOCP
9944         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9945         if eval $compile; then
9946                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9947                 val="$undef" # Yes, undef.
9948                 set d_old_pthread_create_joinable
9949                 eval $setvar
9950                 val=""
9951                 set old_pthread_create_joinable
9952                 eval $setvar
9953         else
9954                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9955                 if eval $compile; then
9956                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9957                         val="$define"
9958                         set d_old_pthread_create_joinable
9959                         eval $setvar
9960                         val=PTHREAD_CREATE_UNDETACHED
9961                         set old_pthread_create_joinable
9962                         eval $setvar
9963                 else            
9964                         set try -DJOINABLE=__UNDETACHED
9965                         if eval $compile; then
9966                                 echo "You seem to use __UNDETACHED." >&4
9967                                 val="$define"
9968                                 set d_old_pthread_create_joinable
9969                                 eval $setvar
9970                                 val=__UNDETACHED
9971                                 set old_pthread_create_joinable
9972                                 eval $setvar
9973                         else
9974                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9975                                 val="$define"
9976                                 set d_old_pthread_create_joinable
9977                                 eval $setvar
9978                                 val=0
9979                                 set old_pthread_create_joinable
9980                                 eval $setvar
9981                         fi
9982                 fi
9983         fi
9984         $rm -f try try.*
9985 else
9986     d_old_pthread_create_joinable="$undef"
9987     old_pthread_create_joinable=""
9988 fi
9989
9990 : see if pause exists
9991 set pause d_pause
9992 eval $inlibc
9993
9994 : see if pipe exists
9995 set pipe d_pipe
9996 eval $inlibc
9997
9998 : see if poll exists
9999 set poll d_poll
10000 eval $inlibc
10001
10002
10003 : see whether the various POSIXish _yields exist
10004 $cat >try.c <<EOP
10005 #include <pthread.h>
10006 #include <stdio.h>
10007 int main() {
10008 #ifdef SCHED_YIELD
10009         sched_yield();
10010 #else
10011 #ifdef PTHREAD_YIELD
10012         pthread_yield();
10013 #else
10014 #ifdef PTHREAD_YIELD_NULL
10015         pthread_yield(NULL);
10016 #endif
10017 #endif
10018 #endif
10019 }
10020 EOP
10021 : see if sched_yield exists
10022 set try -DSCHED_YIELD
10023 if eval $compile; then
10024     val="$define"
10025     sched_yield='sched_yield()'
10026 else
10027     val="$undef"
10028 fi
10029 case "$usethreads" in
10030 $define)
10031         case "$val" in
10032         $define) echo 'sched_yield() found.' >&4        ;;
10033         *)       echo 'sched_yield() NOT found.' >&4    ;;
10034         esac
10035 esac
10036 set d_sched_yield
10037 eval $setvar
10038
10039 : see if pthread_yield exists
10040 set try -DPTHREAD_YIELD
10041 if eval $compile; then
10042     val="$define"
10043     case "$sched_yield" in
10044     '') sched_yield='pthread_yield()' ;;
10045     esac
10046 else
10047     set try -DPTHREAD_YIELD_NULL
10048     if eval $compile; then
10049         val="$define"
10050         case "$sched_yield" in
10051         '') sched_yield='pthread_yield(NULL)' ;;
10052         esac
10053     else
10054         val="$undef"
10055     fi
10056 fi
10057 case "$usethreads" in
10058 $define)
10059         case "$val" in
10060         $define) echo 'pthread_yield() found.' >&4      ;;
10061         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10062         esac
10063         ;;
10064 esac
10065 set d_pthread_yield
10066 eval $setvar
10067
10068 case "$sched_yield" in
10069 '') sched_yield=undef ;;
10070 esac
10071
10072 $rm -f try try.*
10073
10074 : see if this is a pwd.h system
10075 set pwd.h i_pwd
10076 eval $inhdr
10077
10078 case "$i_pwd" in
10079 $define)
10080         xxx=`./findhdr pwd.h`
10081         $cppstdin $cppflags $cppminus < $xxx >$$.h
10082
10083         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10084                 val="$define"
10085         else
10086                 val="$undef"
10087         fi
10088         set d_pwquota
10089         eval $setvar
10090
10091         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10092                 val="$define"
10093         else
10094                 val="$undef"
10095         fi
10096         set d_pwage
10097         eval $setvar
10098
10099         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10100                 val="$define"
10101         else
10102                 val="$undef"
10103         fi
10104         set d_pwchange
10105         eval $setvar
10106
10107         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10108                 val="$define"
10109         else
10110                 val="$undef"
10111         fi
10112         set d_pwclass
10113         eval $setvar
10114
10115         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10116                 val="$define"
10117         else
10118                 val="$undef"
10119         fi
10120         set d_pwexpire
10121         eval $setvar
10122
10123         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10124                 val="$define"
10125         else
10126                 val="$undef"
10127         fi
10128         set d_pwcomment
10129         eval $setvar
10130
10131         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10132                 val="$define"
10133         else
10134                 val="$undef"
10135         fi
10136         set d_pwgecos
10137         eval $setvar
10138
10139         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10140                 val="$define"
10141         else
10142                 val="$undef"
10143         fi
10144         set d_pwpasswd
10145         eval $setvar
10146
10147         $rm -f $$.h
10148         ;;
10149 *)
10150         val="$undef"; 
10151         set d_pwquota; eval $setvar
10152         set d_pwage; eval $setvar
10153         set d_pwchange; eval $setvar
10154         set d_pwclass; eval $setvar
10155         set d_pwexpire; eval $setvar
10156         set d_pwcomment; eval $setvar
10157         set d_pwgecos; eval $setvar
10158         set d_pwpasswd; eval $setvar
10159         ;;
10160 esac
10161
10162 : see if readdir and friends exist
10163 set readdir d_readdir
10164 eval $inlibc
10165 set seekdir d_seekdir
10166 eval $inlibc
10167 set telldir d_telldir
10168 eval $inlibc
10169 set rewinddir d_rewinddir
10170 eval $inlibc
10171
10172 : see if readlink exists
10173 set readlink d_readlink
10174 eval $inlibc
10175
10176 : see if rename exists
10177 set rename d_rename
10178 eval $inlibc
10179
10180 : see if rmdir exists
10181 set rmdir d_rmdir
10182 eval $inlibc
10183
10184 : see if memory.h is available.
10185 val=''
10186 set memory.h val
10187 eval $inhdr
10188
10189 : See if it conflicts with string.h
10190 case "$val" in
10191 $define)
10192         case "$strings" in
10193         '') ;;
10194         *)
10195                 $cppstdin $cppflags $cppminus < $strings > mem.h
10196                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10197                         echo " "
10198                         echo "We won't be including <memory.h>."
10199                         val="$undef"
10200                 fi
10201                 $rm -f mem.h
10202                 ;;
10203         esac
10204 esac
10205 set i_memory
10206 eval $setvar
10207
10208 : can bcopy handle overlapping blocks?
10209 val="$undef"
10210 case "$d_bcopy" in
10211 "$define")
10212         echo " "
10213         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10214         $cat >try.c <<EOCP
10215 #$i_memory I_MEMORY
10216 #$i_stdlib I_STDLIB
10217 #$i_string I_STRING
10218 #$i_unistd I_UNISTD
10219 EOCP
10220         $cat >>try.c <<'EOCP'
10221 #include <stdio.h>
10222 #ifdef I_MEMORY
10223 #  include <memory.h>
10224 #endif
10225 #ifdef I_STDLIB
10226 #  include <stdlib.h>
10227 #endif
10228 #ifdef I_STRING
10229 #  include <string.h>
10230 #else
10231 #  include <strings.h>
10232 #endif
10233 #ifdef I_UNISTD
10234 #  include <unistd.h>  /* Needed for NetBSD */
10235 #endif
10236 int main()
10237 {
10238 char buf[128], abc[128];
10239 char *b;
10240 int len;
10241 int off;
10242 int align;
10243
10244 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10245
10246 for (align = 7; align >= 0; align--) {
10247         for (len = 36; len; len--) {
10248                 b = buf+align;
10249                 bcopy(abc, b, len);
10250                 for (off = 1; off <= len; off++) {
10251                         bcopy(b, b+off, len);
10252                         bcopy(b+off, b, len);
10253                         if (bcmp(b, abc, len))
10254                                 exit(1);
10255                 }
10256         }
10257 }
10258 exit(0);
10259 }
10260 EOCP
10261         set try
10262         if eval $compile_ok; then
10263                 if ./try 2>/dev/null; then
10264                         echo "Yes, it can."
10265                         val="$define"
10266                 else
10267                         echo "It can't, sorry."
10268                         case "$d_memmove" in
10269                         "$define") echo "But that's Ok since you have memmove()." ;;
10270                         esac
10271                 fi
10272         else
10273                 echo "(I can't compile the test program, so we'll assume not...)"
10274                 case "$d_memmove" in
10275                 "$define") echo "But that's Ok since you have memmove()." ;;
10276                 esac
10277         fi
10278         ;;
10279 esac
10280 $rm -f try.* try core
10281 set d_safebcpy
10282 eval $setvar
10283
10284 : can memcpy handle overlapping blocks?
10285 val="$undef"
10286 case "$d_memcpy" in
10287 "$define")
10288         echo " "
10289         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10290         $cat >try.c <<EOCP
10291 #$i_memory I_MEMORY
10292 #$i_stdlib I_STDLIB
10293 #$i_string I_STRING
10294 #$i_unistd I_UNISTD
10295 EOCP
10296         $cat >>try.c <<'EOCP'
10297 #include <stdio.h>
10298 #ifdef I_MEMORY
10299 #  include <memory.h>
10300 #endif
10301 #ifdef I_STDLIB
10302 #  include <stdlib.h>
10303 #endif
10304 #ifdef I_STRING
10305 #  include <string.h>
10306 #else
10307 #  include <strings.h>
10308 #endif
10309 #ifdef I_UNISTD
10310 #  include <unistd.h>  /* Needed for NetBSD */
10311 #endif
10312 int main()
10313 {
10314 char buf[128], abc[128];
10315 char *b;
10316 int len;
10317 int off;
10318 int align;
10319
10320 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10321    try to store the string in read-only memory. */
10322 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10323
10324 for (align = 7; align >= 0; align--) {
10325         for (len = 36; len; len--) {
10326                 b = buf+align;
10327                 memcpy(b, abc, len);
10328                 for (off = 1; off <= len; off++) {
10329                         memcpy(b+off, b, len);
10330                         memcpy(b, b+off, len);
10331                         if (memcmp(b, abc, len))
10332                                 exit(1);
10333                 }
10334         }
10335 }
10336 exit(0);
10337 }
10338 EOCP
10339         set try
10340         if eval $compile_ok; then
10341                 if ./try 2>/dev/null; then
10342                         echo "Yes, it can."
10343                         val="$define"
10344                 else
10345                         echo "It can't, sorry."
10346                         case "$d_memmove" in
10347                         "$define") echo "But that's Ok since you have memmove()." ;;
10348                         esac
10349                 fi
10350         else
10351                 echo "(I can't compile the test program, so we'll assume not...)"
10352                 case "$d_memmove" in
10353                 "$define") echo "But that's Ok since you have memmove()." ;;
10354                 esac
10355         fi
10356         ;;
10357 esac
10358 $rm -f try.* try core
10359 set d_safemcpy
10360 eval $setvar
10361
10362 : can memcmp be trusted to compare relative magnitude?
10363 val="$undef"
10364 case "$d_memcmp" in
10365 "$define")
10366         echo " "
10367         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10368         $cat >try.c <<EOCP
10369 #$i_memory I_MEMORY
10370 #$i_stdlib I_STDLIB
10371 #$i_string I_STRING
10372 #$i_unistd I_UNISTD
10373 EOCP
10374         $cat >>try.c <<'EOCP'
10375 #include <stdio.h>
10376 #ifdef I_MEMORY
10377 #  include <memory.h>
10378 #endif
10379 #ifdef I_STDLIB
10380 #  include <stdlib.h>
10381 #endif
10382 #ifdef I_STRING
10383 #  include <string.h>
10384 #else
10385 #  include <strings.h>
10386 #endif
10387 #ifdef I_UNISTD
10388 #  include <unistd.h>  /* Needed for NetBSD */
10389 #endif
10390 int main()
10391 {
10392 char a = -1;
10393 char b = 0;
10394 if ((a < b) && memcmp(&a, &b, 1) < 0)
10395         exit(1);
10396 exit(0);
10397 }
10398 EOCP
10399         set try
10400         if eval $compile_ok; then
10401                 if ./try 2>/dev/null; then
10402                         echo "Yes, it can."
10403                         val="$define"
10404                 else
10405                         echo "No, it can't (it uses signed chars)."
10406                 fi
10407         else
10408                 echo "(I can't compile the test program, so we'll assume not...)"
10409         fi
10410         ;;
10411 esac
10412 $rm -f try.* try core
10413 set d_sanemcmp
10414 eval $setvar
10415
10416 : see if select exists
10417 set select d_select
10418 eval $inlibc
10419
10420 : see if semctl exists
10421 set semctl d_semctl
10422 eval $inlibc
10423
10424 : see if semget exists
10425 set semget d_semget
10426 eval $inlibc
10427
10428 : see if semop exists
10429 set semop d_semop
10430 eval $inlibc
10431
10432 : see how much of the 'sem*(2)' library is present.
10433 h_sem=true
10434 echo " "
10435 case "$d_semctl$d_semget$d_semop" in
10436 *"$undef"*) h_sem=false;;
10437 esac
10438 case "$osname" in
10439 freebsd)
10440     case "`ipcs 2>&1`" in
10441     "SVID messages"*"not configured"*)
10442         echo "Your $osname does not have the sem*(2) configured." >&4
10443         h_sem=false
10444         val="$undef"
10445         set semctl d_semctl
10446         eval $setvar
10447         set semget d_semget
10448         eval $setvar
10449         set semop d_semop
10450         eval $setvar
10451         ;;
10452     esac
10453     ;;
10454 esac
10455 : we could also check for sys/ipc.h ...
10456 if $h_sem && $test `./findhdr sys/sem.h`; then
10457         echo "You have the full sem*(2) library." >&4
10458         val="$define"
10459 else
10460         echo "You don't have the full sem*(2) library." >&4
10461         val="$undef"
10462 fi
10463 set d_sem
10464 eval $setvar
10465
10466 : see whether sys/sem.h defines union semun
10467 echo " "
10468 $cat > try.c <<'END'
10469 #include <sys/types.h>
10470 #include <sys/ipc.h>
10471 #include <sys/sem.h>
10472 int main () { union semun semun; semun.buf = 0; }
10473 END
10474 set try
10475 if eval $compile; then
10476     echo "You have union semun in <sys/sem.h>." >&4
10477     val="$define"
10478 else
10479     echo "You do not have union semun in <sys/sem.h>." >&4
10480     val="$undef"
10481 fi
10482 $rm -f try try.c try.h
10483 set d_union_semun
10484 eval $setvar
10485
10486 : see how to do semctl IPC_STAT
10487 case "$d_sem" in
10488 $define)
10489     : see whether semctl IPC_STAT can use union semun
10490     echo " "
10491     $cat > try.h <<END
10492 #ifndef S_IRUSR
10493 #   ifdef S_IREAD
10494 #       define S_IRUSR S_IREAD
10495 #       define S_IWUSR S_IWRITE
10496 #       define S_IXUSR S_IEXEC
10497 #   else
10498 #       define S_IRUSR 0400
10499 #       define S_IWUSR 0200
10500 #       define S_IXUSR 0100
10501 #   endif
10502 #   define S_IRGRP (S_IRUSR>>3)
10503 #   define S_IWGRP (S_IWUSR>>3)
10504 #   define S_IXGRP (S_IXUSR>>3)
10505 #   define S_IROTH (S_IRUSR>>6)
10506 #   define S_IWOTH (S_IWUSR>>6)
10507 #   define S_IXOTH (S_IXUSR>>6)
10508 #endif
10509 #ifndef S_IRWXU
10510 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10511 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10512 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10513 #endif
10514 END
10515
10516     $cat > try.c <<END
10517 #include <sys/types.h>
10518 #include <sys/ipc.h>
10519 #include <sys/sem.h>
10520 #include <sys/stat.h>
10521 #include <stdio.h>
10522 #include <errno.h>
10523 #include "try.h"
10524 #ifndef errno
10525 extern int errno;
10526 #endif
10527 #$d_union_semun HAS_UNION_SEMUN
10528 int main() {
10529     union semun
10530 #ifndef HAS_UNION_SEMUN
10531     {
10532         int val;
10533         struct semid_ds *buf;
10534         unsigned short *array;
10535     }
10536 #endif
10537     arg;
10538     int sem, st;
10539
10540 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10541     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10542     if (sem > -1) {
10543         struct semid_ds argbuf;
10544         arg.buf = &argbuf;
10545 #       ifdef IPC_STAT
10546         st = semctl(sem, 0, IPC_STAT, arg);
10547         if (st == 0)
10548             printf("semun\n");
10549         else
10550 #       endif /* IPC_STAT */
10551             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10552 #       ifdef IPC_RMID
10553         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10554 #       endif /* IPC_RMID */
10555             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10556     } else
10557 #endif /* IPC_PRIVATE && ... */
10558         printf("semget failed: errno = %d\n", errno);
10559   return 0;
10560 }
10561 END
10562     val="$undef"
10563     set try
10564     if eval $compile; then
10565         xxx=`./try`
10566         case "$xxx" in
10567         semun) val="$define" ;;
10568         esac
10569     fi
10570     $rm -f try try.c
10571     set d_semctl_semun
10572     eval $setvar
10573     case "$d_semctl_semun" in
10574     $define)
10575         echo "You can use union semun for semctl IPC_STAT." >&4
10576         also='also'
10577         ;;
10578     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10579         also=''
10580         ;;
10581     esac
10582
10583     : see whether semctl IPC_STAT can use struct semid_ds pointer
10584     $cat > try.c <<'END'
10585 #include <sys/types.h>
10586 #include <sys/ipc.h>
10587 #include <sys/sem.h>
10588 #include <sys/stat.h>
10589 #include "try.h"
10590 #include <stdio.h>
10591 #include <errno.h>
10592 #ifndef errno
10593 extern int errno;
10594 #endif
10595 int main() {
10596     struct semid_ds arg;
10597     int sem, st;
10598
10599 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10600     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10601     if (sem > -1) {
10602 #       ifdef IPC_STAT
10603         st = semctl(sem, 0, IPC_STAT, &arg);
10604         if (st == 0)
10605             printf("semid_ds\n");
10606         else
10607 #       endif /* IPC_STAT */
10608             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10609 #       ifdef IPC_RMID
10610         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10611 #       endif /* IPC_RMID */
10612             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10613     } else
10614 #endif /* IPC_PRIVATE && ... */
10615         printf("semget failed: errno = %d\n", errno);
10616
10617     return 0;
10618 }
10619 END
10620     val="$undef"
10621     set try
10622     if eval $compile; then
10623         xxx=`./try`
10624         case "$xxx" in
10625         semid_ds) val="$define" ;;
10626         esac
10627     fi
10628     $rm -f try try.c
10629     set d_semctl_semid_ds
10630     eval $setvar
10631     case "$d_semctl_semid_ds" in
10632     $define)
10633         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10634         ;;
10635     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10636         ;;
10637     esac
10638     $rm -f try.h
10639     ;;
10640 *)  val="$undef"
10641
10642     # We do not have the full sem*(2) library, so assume we can not
10643     # use either.
10644
10645     set d_semctl_semun
10646     eval $setvar
10647
10648     set d_semctl_semid_ds
10649     eval $setvar
10650     ;;
10651 esac
10652
10653 : see if setegid exists
10654 set setegid d_setegid
10655 eval $inlibc
10656
10657 : see if seteuid exists
10658 set seteuid d_seteuid
10659 eval $inlibc
10660
10661 : see if setgrent exists
10662 set setgrent d_setgrent
10663 eval $inlibc
10664
10665 : see if sethostent exists
10666 set sethostent d_sethent
10667 eval $inlibc
10668
10669 : see if setlinebuf exists
10670 set setlinebuf d_setlinebuf
10671 eval $inlibc
10672
10673 : see if setlocale exists
10674 set setlocale d_setlocale
10675 eval $inlibc
10676
10677 : see if setnetent exists
10678 set setnetent d_setnent
10679 eval $inlibc
10680
10681 : see if setprotoent exists
10682 set setprotoent d_setpent
10683 eval $inlibc
10684
10685 : see if setpgid exists
10686 set setpgid d_setpgid
10687 eval $inlibc
10688
10689 : see if setpgrp2 exists
10690 set setpgrp2 d_setpgrp2
10691 eval $inlibc
10692
10693 : see if setpriority exists
10694 set setpriority d_setprior
10695 eval $inlibc
10696
10697 : see if setpwent exists
10698 set setpwent d_setpwent
10699 eval $inlibc
10700
10701 : see if setregid exists
10702 set setregid d_setregid
10703 eval $inlibc
10704 set setresgid d_setresgid
10705 eval $inlibc
10706
10707 : see if setreuid exists
10708 set setreuid d_setreuid
10709 eval $inlibc
10710 set setresuid d_setresuid
10711 eval $inlibc
10712
10713 : see if setrgid exists
10714 set setrgid d_setrgid
10715 eval $inlibc
10716
10717 : see if setruid exists
10718 set setruid d_setruid
10719 eval $inlibc
10720
10721 : see if setservent exists
10722 set setservent d_setsent
10723 eval $inlibc
10724
10725 : see if setsid exists
10726 set setsid d_setsid
10727 eval $inlibc
10728
10729 : see if setspent exists
10730 set setspent d_setspent
10731 eval $inlibc
10732
10733 : see if setvbuf exists
10734 set setvbuf d_setvbuf
10735 eval $inlibc
10736
10737 : see if sfio.h is available
10738 set sfio.h i_sfio
10739 eval $inhdr
10740
10741
10742 : see if sfio library is available
10743 case "$i_sfio" in
10744 $define)
10745         val=''
10746         set sfreserve val
10747         eval $inlibc
10748         ;;
10749 *)
10750         val="$undef"
10751         ;;
10752 esac
10753 : Ok, but do we want to use it.
10754 case "$val" in
10755 $define)
10756         case "$usesfio" in
10757         true|$define|[yY]*) dflt='y';;
10758         *) dflt='n';;
10759         esac
10760         echo "$package can use the sfio library, but it is experimental."
10761         rp="You seem to have sfio available, do you want to try using it?"
10762         . ./myread
10763         case "$ans" in
10764         y|Y) ;;
10765         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10766                 val="$undef"
10767                 : Remove sfio from list of libraries to use
10768                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10769                 shift
10770                 libs="$*"
10771                 echo "libs = $libs" >&4
10772                 ;;
10773         esac
10774         ;;
10775 *)      case "$usesfio" in
10776         true|$define|[yY]*)
10777                 echo "Sorry, cannot find sfio on this machine" >&4
10778                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10779                 ;;
10780         esac
10781         ;;
10782 esac
10783 set d_sfio
10784 eval $setvar
10785 case "$d_sfio" in
10786 $define) usesfio='true';;
10787 *) usesfio='false';;
10788 esac
10789
10790 : see if shmctl exists
10791 set shmctl d_shmctl
10792 eval $inlibc
10793
10794 : see if shmget exists
10795 set shmget d_shmget
10796 eval $inlibc
10797
10798 : see if shmat exists
10799 set shmat d_shmat
10800 eval $inlibc
10801 : see what shmat returns
10802 case "$d_shmat" in
10803 "$define")
10804         $cat >shmat.c <<'END'
10805 #include <sys/shm.h>
10806 void *shmat();
10807 END
10808         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10809                 shmattype='void *'
10810         else
10811                 shmattype='char *'
10812         fi
10813         echo "and it returns ($shmattype)." >&4
10814         : see if a prototype for shmat is available
10815         xxx=`./findhdr sys/shm.h`
10816         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10817         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10818                 val="$define"
10819         else
10820                 val="$undef"
10821         fi
10822         $rm -f shmat.[co]
10823         ;;
10824 *)
10825         val="$undef"
10826         ;;
10827 esac
10828 set d_shmatprototype
10829 eval $setvar
10830
10831 : see if shmdt exists
10832 set shmdt d_shmdt
10833 eval $inlibc
10834
10835 : see how much of the 'shm*(2)' library is present.
10836 h_shm=true
10837 echo " "
10838 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10839 *"$undef"*) h_shm=false;;
10840 esac
10841 case "$osname" in
10842 freebsd)
10843     case "`ipcs 2>&1`" in
10844     "SVID shared memory"*"not configured"*)
10845         echo "Your $osname does not have the shm*(2) configured." >&4
10846         h_shm=false
10847         val="$undef"
10848         set shmctl d_shmctl
10849         evat $setvar
10850         set shmget d_shmget
10851         evat $setvar
10852         set shmat d_shmat
10853         evat $setvar
10854         set shmdt d_shmdt
10855         evat $setvar
10856         ;;
10857     esac
10858     ;;
10859 esac
10860 : we could also check for sys/ipc.h ...
10861 if $h_shm && $test `./findhdr sys/shm.h`; then
10862         echo "You have the full shm*(2) library." >&4
10863         val="$define"
10864 else
10865         echo "You don't have the full shm*(2) library." >&4
10866         val="$undef"
10867 fi
10868 set d_shm
10869 eval $setvar
10870
10871 echo " "
10872 : see if we have sigaction
10873 if set sigaction val -f d_sigaction; eval $csym; $val; then
10874         echo 'sigaction() found.' >&4
10875         $cat > try.c <<'EOP'
10876 #include <stdio.h>
10877 #include <sys/types.h>
10878 #include <signal.h>
10879 int main()
10880 {
10881     struct sigaction act, oact;
10882     act.sa_flags = 0;
10883     oact.sa_handler = 0;
10884     /* so that act and oact are used */
10885     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10886 }
10887 EOP
10888         set try
10889         if eval $compile_ok; then
10890                 val="$define"
10891         else
10892                 echo "But you don't seem to have a useable struct sigaction." >&4
10893                 val="$undef"
10894         fi
10895 else
10896         echo 'sigaction NOT found.' >&4
10897         val="$undef"
10898 fi
10899 set d_sigaction; eval $setvar
10900 $rm -f try try$_o try.c
10901
10902 : see if sigsetjmp exists
10903 echo " "
10904 case "$d_sigsetjmp" in
10905 '')
10906         $cat >try.c <<'EOP'
10907 #include <setjmp.h>
10908 sigjmp_buf env;
10909 int set = 1;
10910 int main()
10911 {
10912         if (sigsetjmp(env,1))
10913                 exit(set);
10914         set = 0;
10915         siglongjmp(env, 1);
10916         exit(1);
10917 }
10918 EOP
10919         set try
10920         if eval $compile; then
10921                 if ./try >/dev/null 2>&1; then
10922                         echo "POSIX sigsetjmp found." >&4
10923                         val="$define"
10924                 else
10925                         $cat >&4 <<EOM
10926 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10927 I'll ignore them.
10928 EOM
10929                         val="$undef"
10930                 fi
10931         else
10932                 echo "sigsetjmp not found." >&4
10933                 val="$undef"
10934         fi
10935         ;;
10936 *) val="$d_sigsetjmp"
10937         case "$d_sigsetjmp" in
10938         $define) echo "POSIX sigsetjmp found." >&4;;
10939         $undef) echo "sigsetjmp not found." >&4;;
10940         esac
10941         ;;
10942 esac
10943 set d_sigsetjmp
10944 eval $setvar
10945 $rm -f try.c try
10946
10947 : see what type is used for size_t
10948 rp="What is the type used for the length parameter for string functions?"
10949 set size_t sizetype 'unsigned int' stdio.h sys/types.h
10950 eval $typedef_ask
10951
10952 : check for socklen_t
10953 echo " "
10954 echo "Checking to see if you have socklen_t..." >&4
10955 $cat >try.c <<EOCP
10956 #include <sys/types.h>
10957 #$d_socket HAS_SOCKET
10958 #ifdef HAS_SOCKET
10959 #include <sys/socket.h>
10960 #endif
10961 int main() { socklen_t x = 16; }
10962 EOCP
10963 set try
10964 if eval $compile; then
10965         val="$define"
10966         echo "You have socklen_t."
10967 else
10968         val="$undef"
10969         echo "You do not have socklen_t."
10970         case "$sizetype" in
10971         size_t) echo "(You do have size_t, that might work.)" ;;
10972         esac
10973 fi
10974 $rm -f try try.*
10975 set d_socklen_t
10976 eval $setvar
10977
10978 : see if sys/stat.h is available
10979 set sys/stat.h i_sysstat
10980 eval $inhdr
10981
10982
10983 : see if stat knows about block sizes
10984 echo " "
10985 echo "Checking to see if your struct stat has st_blocks field..." >&4
10986 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10987 eval $hasfield
10988
10989
10990 : see if this is a sys/vfs.h system
10991 set sys/vfs.h i_sysvfs
10992 eval $inhdr
10993
10994
10995 : see if this is a sys/statfs.h system
10996 set sys/statfs.h i_sysstatfs
10997 eval $inhdr
10998
10999
11000 echo " "
11001 echo "Checking to see if your system supports struct statfs..." >&4
11002 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
11003 eval $hasstruct
11004 case "$d_statfs_s" in
11005 "$define")      echo "Yes, it does."   ;;
11006 *)              echo "No, it doesn't." ;;
11007 esac
11008
11009
11010
11011 : see if struct statfs knows about f_flags
11012 case "$d_statfs_s" in
11013 define) 
11014         echo " "
11015         echo "Checking to see if your struct statfs has f_flags field..." >&4
11016         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
11017         eval $hasfield
11018         ;;
11019 *)      val="$undef"
11020         set d_statfs_f_flags
11021         eval $setvar
11022         ;;
11023 esac
11024 case "$d_statfs_f_flags" in
11025 "$define")      echo "Yes, it does."   ;;
11026 *)              echo "No, it doesn't." ;;
11027 esac
11028
11029 : see if _ptr and _cnt from stdio act std
11030 echo " "
11031 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11032         echo "(Looks like you have stdio.h from Linux.)"
11033         case "$stdio_ptr" in
11034         '') stdio_ptr='((fp)->_IO_read_ptr)'
11035                 ptr_lval=$define
11036                 ;;
11037         *)      ptr_lval=$d_stdio_ptr_lval;;
11038         esac
11039         case "$stdio_cnt" in
11040         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11041                 cnt_lval=$undef
11042                 ;;
11043         *)      cnt_lval=$d_stdio_cnt_lval;;
11044         esac
11045         case "$stdio_base" in
11046         '') stdio_base='((fp)->_IO_read_base)';;
11047         esac
11048         case "$stdio_bufsiz" in
11049         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11050         esac
11051 else
11052         case "$stdio_ptr" in
11053         '') stdio_ptr='((fp)->_ptr)'
11054                 ptr_lval=$define
11055                 ;;
11056         *)      ptr_lval=$d_stdio_ptr_lval;;
11057         esac
11058         case "$stdio_cnt" in
11059         '') stdio_cnt='((fp)->_cnt)'
11060                 cnt_lval=$define
11061                 ;;
11062         *)      cnt_lval=$d_stdio_cnt_lval;;
11063         esac
11064         case "$stdio_base" in
11065         '') stdio_base='((fp)->_base)';;
11066         esac
11067         case "$stdio_bufsiz" in
11068         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11069         esac
11070 fi
11071 : test whether _ptr and _cnt really work
11072 echo "Checking how std your stdio is..." >&4
11073 $cat >try.c <<EOP
11074 #include <stdio.h>
11075 #define FILE_ptr(fp)    $stdio_ptr
11076 #define FILE_cnt(fp)    $stdio_cnt
11077 int main() {
11078         FILE *fp = fopen("try.c", "r");
11079         char c = getc(fp);
11080         if (
11081                 18 <= FILE_cnt(fp) &&
11082                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11083         )
11084                 exit(0);
11085         exit(1);
11086 }
11087 EOP
11088 val="$undef"
11089 set try
11090 if eval $compile; then
11091         if ./try; then
11092                 echo "Your stdio acts pretty std."
11093                 val="$define"
11094         else
11095                 echo "Your stdio isn't very std."
11096         fi
11097 else
11098         echo "Your stdio doesn't appear very std."
11099 fi
11100 $rm -f try.c try
11101 set d_stdstdio
11102 eval $setvar
11103
11104 : Can _ptr be used as an lvalue?
11105 case "$d_stdstdio$ptr_lval" in
11106 $define$define) val=$define ;;
11107 *) val=$undef ;;
11108 esac
11109 set d_stdio_ptr_lval
11110 eval $setvar
11111
11112 : Can _cnt be used as an lvalue?
11113 case "$d_stdstdio$cnt_lval" in
11114 $define$define) val=$define ;;
11115 *) val=$undef ;;
11116 esac
11117 set d_stdio_cnt_lval
11118 eval $setvar
11119
11120 : see if _base is also standard
11121 val="$undef"
11122 case "$d_stdstdio" in
11123 $define)
11124         $cat >try.c <<EOP
11125 #include <stdio.h>
11126 #define FILE_base(fp)   $stdio_base
11127 #define FILE_bufsiz(fp) $stdio_bufsiz
11128 int main() {
11129         FILE *fp = fopen("try.c", "r");
11130         char c = getc(fp);
11131         if (
11132                 19 <= FILE_bufsiz(fp) &&
11133                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11134         )
11135                 exit(0);
11136         exit(1);
11137 }
11138 EOP
11139         set try
11140         if eval $compile; then
11141                 if ./try; then
11142                         echo "And its _base field acts std."
11143                         val="$define"
11144                 else
11145                         echo "But its _base field isn't std."
11146                 fi
11147         else
11148                 echo "However, it seems to be lacking the _base field."
11149         fi
11150         $rm -f try.c try
11151         ;;
11152 esac
11153 set d_stdiobase
11154 eval $setvar
11155
11156 $cat >&4 <<EOM
11157 Checking how to access stdio streams by file descriptor number...
11158 EOM
11159 case "$stdio_stream_array" in
11160 '')     $cat >try.c <<EOCP
11161 #include <stdio.h>
11162 int main() {
11163   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11164     printf("yes\n");
11165 }
11166 EOCP
11167         for s in _iob __iob __sF
11168         do
11169                 set try -DSTDIO_STREAM_ARRAY=$s
11170                 if eval $compile; then
11171                         case "`./try$exe_ext`" in
11172                         yes)    stdio_stream_array=$s; break ;;
11173                         esac
11174                 fi
11175         done
11176         $rm -f try.* try$exe_ext
11177 esac
11178 case "$stdio_stream_array" in
11179 '')     $cat >&4 <<EOM
11180 I can't figure out how to access stdio streams by file descriptor number.
11181 EOM
11182         d_stdio_stream_array="$undef"
11183         ;;
11184 *)      $cat >&4 <<EOM
11185 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11186 EOM
11187         d_stdio_stream_array="$define"
11188         ;;
11189 esac
11190
11191 : see if strcoll exists
11192 set strcoll d_strcoll
11193 eval $inlibc
11194
11195 : check for structure copying
11196 echo " "
11197 echo "Checking to see if your C compiler can copy structs..." >&4
11198 $cat >try.c <<'EOCP'
11199 int main()
11200 {
11201         struct blurfl {
11202                 int dyick;
11203         } foo, bar;
11204
11205         foo = bar;
11206 }
11207 EOCP
11208 if $cc -c try.c >/dev/null 2>&1 ; then
11209         val="$define"
11210         echo "Yup, it can."
11211 else
11212         val="$undef"
11213         echo "Nope, it can't."
11214 fi
11215 set d_strctcpy
11216 eval $setvar
11217 $rm -f try.*
11218
11219 : see if strerror and/or sys_errlist[] exist
11220 echo " "
11221 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11222     if set strerror val -f d_strerror; eval $csym; $val; then
11223                 echo 'strerror() found.' >&4
11224                 d_strerror="$define"
11225                 d_strerrm='strerror(e)'
11226                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11227                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11228                         d_syserrlst="$define"
11229                 else
11230                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11231                         d_syserrlst="$undef"
11232                 fi
11233     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11234                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11235                 echo 'strerror() found in string header.' >&4
11236                 d_strerror="$define"
11237                 d_strerrm='strerror(e)'
11238                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11239                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11240                                 d_syserrlst="$define"
11241                 else
11242                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11243                         d_syserrlst="$undef"
11244                 fi
11245     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11246                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11247                 d_strerror="$undef"
11248                 d_syserrlst="$define"
11249                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11250     else
11251                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11252                 d_strerror="$undef"
11253                 d_syserrlst="$undef"
11254                 d_strerrm='"unknown"'
11255     fi
11256 fi
11257
11258 : see if strtod exists
11259 set strtod d_strtod
11260 eval $inlibc
11261
11262 : see if strtol exists
11263 set strtol d_strtol
11264 eval $inlibc
11265
11266 : see if strtold exists
11267 set strtold d_strtold
11268 eval $inlibc
11269
11270 : see if strtoll exists
11271 set strtoll d_strtoll
11272 eval $inlibc
11273
11274 : see if strtoul exists
11275 set strtoul d_strtoul
11276 eval $inlibc
11277
11278 : see if strtoull exists
11279 set strtoull d_strtoull
11280 eval $inlibc
11281
11282 : see if strtouq exists
11283 set strtouq d_strtouq
11284 eval $inlibc
11285
11286 : see if strxfrm exists
11287 set strxfrm d_strxfrm
11288 eval $inlibc
11289
11290 : see if symlink exists
11291 set symlink d_symlink
11292 eval $inlibc
11293
11294 : see if syscall exists
11295 set syscall d_syscall
11296 eval $inlibc
11297
11298 : see if sysconf exists
11299 set sysconf d_sysconf
11300 eval $inlibc
11301
11302 : see if system exists
11303 set system d_system
11304 eval $inlibc
11305
11306 : see if tcgetpgrp exists
11307 set tcgetpgrp d_tcgetpgrp
11308 eval $inlibc
11309
11310 : see if tcsetpgrp exists
11311 set tcsetpgrp d_tcsetpgrp
11312 eval $inlibc
11313
11314 : see if prototype for telldir is available
11315 echo " "
11316 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11317 eval $hasproto
11318
11319 : see if this is a sys/times.h system
11320 set sys/times.h i_systimes
11321 eval $inhdr
11322
11323 : see if times exists
11324 echo " "
11325 if set times val -f d_times; eval $csym; $val; then
11326         echo 'times() found.' >&4
11327         d_times="$define"
11328         inc=''
11329         case "$i_systimes" in
11330         "$define") inc='sys/times.h';;
11331         esac
11332         rp="What is the type returned by times() on this system?"
11333         set clock_t clocktype long stdio.h sys/types.h $inc
11334         eval $typedef_ask
11335 else
11336         echo 'times() NOT found, hope that will do.' >&4
11337         d_times="$undef"
11338         clocktype='int'
11339 fi
11340
11341 : see if truncate exists
11342 set truncate d_truncate
11343 eval $inlibc
11344
11345 : see if tzname[] exists
11346 echo " "
11347 if set tzname val -a d_tzname; eval $csym; $val; then
11348         val="$define"
11349         echo 'tzname[] found.' >&4
11350 else
11351         val="$undef"
11352         echo 'tzname[] NOT found.' >&4
11353 fi
11354 set d_tzname
11355 eval $setvar
11356
11357 : see if umask exists
11358 set umask d_umask
11359 eval $inlibc
11360
11361 : see if ustat exists
11362 set ustat d_ustat
11363 eval $inlibc
11364
11365 : backward compatibility for d_hvfork
11366 if test X$d_hvfork != X; then
11367         d_vfork="$d_hvfork"
11368         d_hvfork=''
11369 fi
11370 : see if there is a vfork
11371 val=''
11372 set vfork val
11373 eval $inlibc
11374
11375 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11376 : perl on Solaris 2.x, and probably elsewhere.
11377 case "$val" in
11378 $define)
11379         echo " "
11380         case "$usevfork" in
11381         false) dflt='n';;
11382         *) dflt='y';;
11383         esac
11384         cat <<'EOM'
11385  
11386 Perl can only use a vfork() that doesn't suffer from strict
11387 restrictions on calling functions or modifying global data in
11388 the child.  For example, glibc-2.1 contains such a vfork()
11389 that is unsuitable.  If your system provides a proper fork()
11390 call, chances are that you do NOT want perl to use vfork().
11391
11392 EOM
11393         rp="Do you still want to use vfork()?"
11394         . ./myread
11395         case "$ans" in
11396         y|Y) ;;
11397         *)
11398                 echo "Ok, we won't use vfork()."
11399                 val="$undef"
11400                 ;;
11401         esac
11402         ;;
11403 esac
11404 set d_vfork
11405 eval $setvar
11406 case "$d_vfork" in
11407 $define) usevfork='true';;
11408 *) usevfork='false';;
11409 esac
11410
11411 : see if this is an sysdir system
11412 set sys/dir.h i_sysdir
11413 eval $inhdr
11414
11415 : see if this is an sysndir system
11416 set sys/ndir.h i_sysndir
11417 eval $inhdr
11418
11419 : see if closedir exists
11420 set closedir d_closedir
11421 eval $inlibc
11422
11423 case "$d_closedir" in
11424 "$define")
11425         echo " "
11426         echo "Checking whether closedir() returns a status..." >&4
11427         cat > closedir.c <<EOM
11428 #$i_dirent I_DIRENT             /**/
11429 #$i_sysdir I_SYS_DIR            /**/
11430 #$i_sysndir I_SYS_NDIR          /**/
11431 #$i_systypes I_SYS_TYPES        /**/
11432
11433 #if defined(I_SYS_TYPES)
11434 #include <sys/types.h>
11435 #endif
11436 #if defined(I_DIRENT)
11437 #include <dirent.h>
11438 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11439 #include <sys/dir.h>
11440 #endif
11441 #else
11442 #ifdef I_SYS_NDIR
11443 #include <sys/ndir.h>
11444 #else
11445 #ifdef I_SYS_DIR
11446 #ifdef hp9000s500
11447 #include <ndir.h>       /* may be wrong in the future */
11448 #else
11449 #include <sys/dir.h>
11450 #endif
11451 #endif
11452 #endif
11453 #endif 
11454 int main() { return closedir(opendir(".")); }
11455 EOM
11456         set closedir
11457         if eval $compile_ok; then
11458                 if ./closedir > /dev/null 2>&1 ; then
11459                         echo "Yes, it does."
11460                         val="$undef"
11461                 else
11462                         echo "No, it doesn't."
11463                         val="$define"
11464                 fi
11465         else
11466                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11467                 val="$define"
11468         fi
11469         ;;
11470 *)
11471         val="$undef";
11472         ;;
11473 esac
11474 set d_void_closedir
11475 eval $setvar
11476 $rm -f closedir*
11477 : check for volatile keyword
11478 echo " "
11479 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11480 $cat >try.c <<'EOCP'
11481 int main()
11482 {
11483         typedef struct _goo_struct goo_struct;
11484         goo_struct * volatile goo = ((goo_struct *)0);
11485         struct _goo_struct {
11486                 long long_int;
11487                 int reg_int;
11488                 char char_var;
11489         };
11490         typedef unsigned short foo_t;
11491         char *volatile foo;
11492         volatile int bar;
11493         volatile foo_t blech;
11494         foo = foo;
11495 }
11496 EOCP
11497 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11498         val="$define"
11499         echo "Yup, it does."
11500 else
11501         val="$undef"
11502         echo "Nope, it doesn't."
11503 fi
11504 set d_volatile
11505 eval $setvar
11506 $rm -f try.*
11507
11508 : see if there is a wait4
11509 set wait4 d_wait4
11510 eval $inlibc
11511
11512 : see if waitpid exists
11513 set waitpid d_waitpid
11514 eval $inlibc
11515
11516 : see if wcstombs exists
11517 set wcstombs d_wcstombs
11518 eval $inlibc
11519
11520 : see if wctomb exists
11521 set wctomb d_wctomb
11522 eval $inlibc
11523
11524 : preserve RCS keywords in files with variable substitution, grrr
11525 Date='$Date'
11526 Id='$Id'
11527 Log='$Log'
11528 RCSfile='$RCSfile'
11529 Revision='$Revision'
11530
11531 case "$crosscompile" in
11532 ''|[nN]*) crosscompile="$undef" ;;
11533 esac
11534
11535 case "$osname" in
11536 next|rhapsody) multiarch="$define" ;;
11537 esac
11538 case "$multiarch" in
11539 ''|[nN]*) multiarch="$undef" ;;
11540 esac
11541
11542 : check for alignment requirements
11543 echo " "
11544 case "$crosscompile$multiarch" in
11545 *$define*)
11546         $cat <<EOM
11547 You seem to be either cross-compiling or doing a multiarchitecture build,
11548 skipping the memory alignment check.
11549
11550 EOM
11551         case "$alignbytes" in
11552         '') alignbytes=8 ;;
11553         esac
11554         ;;
11555 *)
11556         case "$alignbytes" in
11557         '') echo "Checking alignment constraints..." >&4
11558                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11559                         $cat >try.c <<'EOCP'
11560 typedef long double NV;
11561 EOCP
11562                 else
11563                         $cat >try.c <<'EOCP'
11564 typedef double NV;
11565 EOCP
11566                 fi
11567                 $cat >>try.c <<'EOCP'
11568 #include <stdio.h>
11569 struct foobar {
11570         char foo;
11571         NV bar;
11572 } try_algn;
11573 int main()
11574 {
11575     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11576     return(0);
11577 }
11578 EOCP
11579                 set try
11580                 if eval $compile_ok; then
11581                         dflt=`./try`
11582                 else
11583                         dflt='8'
11584                         echo "(I can't seem to compile the test program...)"
11585                 fi
11586                 ;;
11587         *) dflt="$alignbytes"
11588                 ;;
11589         esac
11590         rp="Doubles must be aligned on a how-many-byte boundary?"
11591         . ./myread
11592         alignbytes="$ans"
11593         $rm -f try.c try
11594         ;;
11595 esac
11596
11597
11598 : check for ordering of bytes in a long
11599 echo " "
11600 case "$crosscompile$multiarch" in
11601 *$define*)
11602         $cat <<EOM
11603 You seem to be either cross-compiling or doing a multiarchitecture build,
11604 skipping the byteorder check.
11605
11606 EOM
11607         byteorder='0xffff'
11608         ;;
11609 *)
11610         case "$byteorder" in
11611         '')
11612                 $cat <<'EOM'
11613 In the following, larger digits indicate more significance.  A big-endian
11614 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11615 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11616 machines may have weird orders like 3412.  A Cray will report 87654321,
11617 an Alpha will report 12345678. If the test program works the default is
11618 probably right.
11619 I'm now running the test program...
11620 EOM
11621                 $cat >try.c <<'EOCP'
11622 #include <stdio.h>
11623 int main()
11624 {
11625         int i;
11626         union {
11627                 unsigned long l;
11628                 char c[sizeof(long)];
11629         } u;
11630
11631         if (sizeof(long) > 4)
11632                 u.l = (0x08070605L << 32) | 0x04030201L;
11633         else
11634                 u.l = 0x04030201L;
11635         for (i = 0; i < sizeof(long); i++)
11636                 printf("%c", u.c[i]+'0');
11637         printf("\n");
11638         exit(0);
11639 }
11640 EOCP
11641                 xxx_prompt=y
11642                 set try
11643                 if eval $compile && ./try > /dev/null; then
11644                         dflt=`./try`
11645                         case "$dflt" in
11646                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11647                                 echo "(The test program ran ok.)"
11648                                 echo "byteorder=$dflt"
11649                                 xxx_prompt=n
11650                         ;;
11651                         ????|????????) echo "(The test program ran ok.)" ;;
11652                         *) echo "(The test program didn't run right for some reason.)" ;;
11653                         esac
11654                 else
11655                         dflt='4321'
11656                         cat <<'EOM'
11657 (I can't seem to compile the test program.  Guessing big-endian...)
11658 EOM
11659                 fi
11660                 case "$xxx_prompt" in
11661                 y)
11662                         rp="What is the order of bytes in a long?"
11663                         . ./myread
11664                         byteorder="$ans"
11665                         ;;
11666                 *)      byteorder=$dflt
11667                         ;;
11668                 esac
11669                 ;;
11670         esac
11671         $rm -f try.c try
11672         ;;
11673 esac
11674
11675
11676 : how do we catenate cpp tokens here?
11677 echo " "
11678 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11679 $cat >cpp_stuff.c <<'EOCP'
11680 #define RCAT(a,b)a/**/b
11681 #define ACAT(a,b)a ## b
11682 RCAT(Rei,ser)
11683 ACAT(Cir,cus)
11684 EOCP
11685 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11686 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11687         echo "Oh!  Smells like ANSI's been here." >&4
11688         echo "We can catify or stringify, separately or together!"
11689         cpp_stuff=42
11690 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11691         echo "Ah, yes!  The good old days!" >&4
11692         echo "However, in the good old days we don't know how to stringify and"
11693         echo "catify at the same time."
11694         cpp_stuff=1
11695 else
11696         $cat >&4 <<EOM
11697 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11698 to have to edit the values of CAT[2-5] in config.h...
11699 EOM
11700         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11701 fi
11702 $rm -f cpp_stuff.*
11703
11704 : see if this is a db.h system
11705 set db.h i_db
11706 eval $inhdr
11707
11708 case "$i_db" in
11709 $define)
11710         : Check db version.
11711         echo " "
11712         echo "Checking Berkeley DB version ..." >&4
11713         $cat >try.c <<EOCP
11714 #$d_const HASCONST
11715 #ifndef HASCONST
11716 #define const
11717 #endif
11718 #include <sys/types.h>
11719 #include <stdio.h>
11720 #include <db.h>
11721 int main()
11722 {
11723 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11724     int Major, Minor, Patch ;
11725     unsigned long Version ;
11726     (void)db_version(&Major, &Minor, &Patch) ;
11727     printf("You have Berkeley DB Version 2 or greater\n");
11728
11729     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11730                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11731     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11732                 Major, Minor, Patch) ;
11733
11734     /* check that db.h & libdb are compatible */
11735     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11736         printf("db.h and libdb are incompatible\n") ;
11737         exit(3);        
11738     }
11739
11740     printf("db.h and libdb are compatible\n") ;
11741
11742     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11743                 + DB_VERSION_PATCH ;
11744
11745     /* needs to be >= 2.3.4 */
11746     if (Version < 2003004) {
11747     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11748         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11749         exit(2);        
11750     }
11751
11752     exit(0);
11753 #else
11754 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11755     printf("You have Berkeley DB Version 1\n");
11756     exit(0);    /* DB version < 2: the coast is clear. */
11757 #else
11758     exit(1);    /* <db.h> not Berkeley DB? */
11759 #endif
11760 #endif
11761 }
11762 EOCP
11763         set try
11764         if eval $compile_ok && ./try; then
11765                 echo 'Looks OK.' >&4
11766         else
11767                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11768                 i_db=$undef
11769                 case " $libs " in
11770                 *"-ldb "*)
11771                         : Remove db from list of libraries to use
11772                         echo "Removing unusable -ldb from library list" >&4
11773                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11774                         shift
11775                         libs="$*"
11776                         echo "libs = $libs" >&4
11777                         ;;
11778                 esac
11779         fi
11780         $rm -f try.*
11781         ;;
11782 esac
11783
11784 case "$i_db" in
11785 define)
11786         : Check the return type needed for hash 
11787         echo " "
11788         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11789         $cat >try.c <<EOCP
11790 #$d_const HASCONST
11791 #ifndef HASCONST
11792 #define const
11793 #endif
11794 #include <sys/types.h>
11795 #include <db.h>
11796
11797 #ifndef DB_VERSION_MAJOR
11798 u_int32_t hash_cb (ptr, size)
11799 const void *ptr;
11800 size_t size;
11801 {
11802 }
11803 HASHINFO info;
11804 int main()
11805 {
11806         info.hash = hash_cb;
11807 }
11808 #endif
11809 EOCP
11810         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11811                 if $contains warning try.out >>/dev/null 2>&1 ; then
11812                         db_hashtype='int'
11813                 else
11814                         db_hashtype='u_int32_t'
11815                 fi
11816         else
11817                 : XXX Maybe we should just give up here.
11818                 db_hashtype=u_int32_t
11819                 $cat try.out >&4
11820                 echo "Help:  I can't seem to compile the db test program." >&4
11821                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11822         fi
11823         $rm -f try.*
11824         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11825         ;;
11826 *)      db_hashtype=u_int32_t
11827         ;;
11828 esac
11829 case "$i_db" in
11830 define)
11831         : Check the return type needed for prefix 
11832         echo " "
11833         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11834         cat >try.c <<EOCP
11835 #$d_const HASCONST
11836 #ifndef HASCONST
11837 #define const
11838 #endif
11839 #include <sys/types.h>
11840 #include <db.h>
11841
11842 #ifndef DB_VERSION_MAJOR
11843 size_t prefix_cb (key1, key2)
11844 const DBT *key1;
11845 const DBT *key2;
11846 {
11847 }
11848 BTREEINFO info;
11849 int main()
11850 {
11851         info.prefix = prefix_cb;
11852 }
11853 #endif
11854 EOCP
11855         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11856                 if $contains warning try.out >>/dev/null 2>&1 ; then
11857                         db_prefixtype='int'
11858                 else
11859                         db_prefixtype='size_t'
11860                 fi
11861         else
11862                 db_prefixtype='size_t'
11863                 : XXX Maybe we should just give up here.
11864                 $cat try.out >&4
11865                 echo "Help:  I can't seem to compile the db test program." >&4
11866                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11867         fi
11868         $rm -f try.*
11869         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11870         ;;
11871 *)      db_prefixtype='size_t'
11872         ;;
11873 esac
11874
11875 : check for void type
11876 echo " "
11877 echo "Checking to see how well your C compiler groks the void type..." >&4
11878 case "$voidflags" in
11879 '')
11880         $cat >try.c <<'EOCP'
11881 #if TRY & 1
11882 void sub() {
11883 #else
11884 sub() {
11885 #endif
11886         extern void moo();      /* function returning void */
11887         void (*goo)();          /* ptr to func returning void */
11888 #if TRY & 8
11889         void *hue;              /* generic ptr */
11890 #endif
11891 #if TRY & 2
11892         void (*foo[10])();
11893 #endif
11894
11895 #if TRY & 4
11896         if(goo == moo) {
11897                 exit(0);
11898         }
11899 #endif
11900         exit(0);
11901 }
11902 int main() { sub(); }
11903 EOCP
11904         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11905                 voidflags=$defvoidused
11906         echo "Good.  It appears to support void to the level $package wants.">&4
11907                 if $contains warning .out >/dev/null 2>&1; then
11908                         echo "However, you might get some warnings that look like this:"
11909                         $cat .out
11910                 fi
11911         else
11912 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11913                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11914                         echo "It supports 1..."
11915                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11916                                 echo "It also supports 2..."
11917                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11918                                         voidflags=7
11919                                         echo "And it supports 4 but not 8 definitely."
11920                                 else
11921                                         echo "It doesn't support 4..."
11922                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11923                                                 voidflags=11
11924                                                 echo "But it supports 8."
11925                                         else
11926                                                 voidflags=3
11927                                                 echo "Neither does it support 8."
11928                                         fi
11929                                 fi
11930                         else
11931                                 echo "It does not support 2..."
11932                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11933                                         voidflags=13
11934                                         echo "But it supports 4 and 8."
11935                                 else
11936                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11937                                                 voidflags=5
11938                                                 echo "And it supports 4 but has not heard about 8."
11939                                         else
11940                                                 echo "However it supports 8 but not 4."
11941                                         fi
11942                                 fi
11943                         fi
11944                 else
11945                         echo "There is no support at all for void."
11946                         voidflags=0
11947                 fi
11948         fi
11949 esac
11950 case "$voidflags" in
11951 "$defvoidused") ;;
11952 *)      $cat >&4 <<'EOM'
11953   Support flag bits are:
11954     1: basic void declarations.
11955     2: arrays of pointers to functions returning void.
11956     4: operations between pointers to and addresses of void functions.
11957     8: generic void pointers.
11958 EOM
11959         dflt="$voidflags";
11960         rp="Your void support flags add up to what?"
11961         . ./myread
11962         voidflags="$ans"
11963         ;;
11964 esac
11965 $rm -f try.* .out
11966
11967
11968 : How can we generate normalized random numbers ?
11969 echo " "
11970 echo "Looking for a random number function..." >&4
11971 case "$randfunc" in
11972 '')
11973         if set drand48 val -f; eval $csym; $val; then
11974                 dflt="drand48"
11975                 echo "Good, found drand48()." >&4
11976         elif set random val -f; eval $csym; $val; then
11977                 dflt="random"
11978                 echo "OK, found random()." >&4
11979         else
11980                 dflt="rand"
11981                 echo "Yick, looks like I have to use rand()." >&4
11982         fi
11983         echo " "
11984         ;;
11985 *)
11986         dflt="$randfunc"
11987         ;;
11988 esac
11989 cont=true
11990
11991 case "$ccflags" in
11992 *-Dmy_rand=*|*-Dmy_srand=*)
11993         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11994         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11995         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11996         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11997         ;;
11998 esac
11999
12000 while $test "$cont"; do
12001         rp="Use which function to generate random numbers?"
12002         . ./myread
12003         if $test "$ans" = "$dflt"; then
12004                 : null
12005         else
12006                 randbits=''
12007         fi
12008         randfunc="$ans"
12009         if set $ans val -f; eval $csym; $val; then
12010                 cont=''
12011         else
12012                 dflt=y
12013                 rp="I cannot find function $ans. Use that name anyway?"
12014                 . ./myread
12015                 dflt=rand
12016                 case "$ans" in
12017                         [yY]*) cont='';;
12018                 esac
12019         fi
12020         case "$cont" in
12021         '')
12022                 case "$randfunc" in
12023                 drand48)
12024                         drand01="drand48()"
12025                         seedfunc="srand48"
12026                         randbits=48
12027                         randseedtype=long
12028                         ;;
12029                 rand|random)
12030                         case "$randbits" in
12031                         '')
12032 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12033                                 $cat >try.c <<EOCP
12034 #$i_unistd I_UNISTD
12035 #$i_stdlib I_STDLIB
12036 #include <stdio.h>
12037 #ifdef I_UNISTD
12038 #  include <unistd.h>
12039 #endif
12040 #ifdef I_STDLIB
12041 #  include <stdlib.h>
12042 #endif
12043 int main()
12044 {
12045         register int i;
12046         register unsigned long tmp;
12047         register unsigned long max = 0L;
12048
12049         for (i = 1000; i; i--) {
12050                 tmp = (unsigned long) $randfunc();
12051                 if (tmp > max) max = tmp;
12052         }
12053         for (i = 0; max; i++)
12054                 max /= 2;
12055         printf("%d\n",i);
12056 }
12057 EOCP
12058                                 set try
12059                                 if eval $compile_ok; then
12060                                         dflt=`try`
12061                                 else
12062                                         dflt='?'
12063                                         echo "(I can't seem to compile the test program...)"
12064                                 fi
12065                                 ;;
12066                         *)
12067                                 dflt="$randbits"
12068                                 ;;
12069                         esac
12070                         rp="How many bits does your $randfunc() function produce?"
12071                         . ./myread
12072                         randbits="$ans"
12073                         $rm -f try.c try
12074                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12075                         seedfunc="s$randfunc"
12076                         randseedtype=unsigned
12077                         ;;
12078                 *)
12079                         dflt="31"
12080                         rp="How many bits does your $randfunc() function produce?"
12081                         . ./myread
12082                         randbits="$ans"
12083                         seedfunc="s$randfunc"
12084                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12085                         if set $seedfunc val -f; eval $csym; $val; then
12086                                 echo "(Using $seedfunc() to seed random generator)"
12087                         else
12088                                 echo "(Warning: no $seedfunc() to seed random generator)"
12089                                 seedfunc=rand
12090                         fi
12091                         randseedtype=unsigned
12092                         ;;
12093                 esac
12094                 ;;
12095         esac
12096 done
12097
12098 echo " "
12099 echo "Determining whether or not we are on an EBCDIC system..." >&4
12100 $cat >tebcdic.c <<'EOM'
12101 int main()
12102 {
12103   if ('M'==0xd4) return 0;
12104   return 1;
12105 }
12106 EOM
12107
12108 val=$undef
12109 set tebcdic
12110 if eval $compile_ok; then
12111         if ./tebcdic; then
12112                 echo "You have EBCDIC." >&4
12113                 val="$define"
12114         else
12115                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12116         fi
12117 else
12118         echo "I'm unable to compile the test program." >&4
12119         echo "I'll assume ASCII or some ISO Latin." >&4
12120 fi
12121 $rm -f tebcdic.c tebcdic
12122 set ebcdic
12123 eval $setvar
12124
12125 echo " "
12126 $cat >&4 <<EOM
12127 Checking how to flush all pending stdio output...
12128 EOM
12129 # I only know how to find the first 32 possibly open files on SunOS.
12130 # See also hints/sunos_4_1.sh and util.c  --AD
12131 case "$osname" in
12132 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12133 esac
12134 $cat >>try.c <<EOCP
12135 #include <stdio.h>
12136 #$i_unistd I_UNISTD
12137 #ifdef I_UNISTD
12138 # include <unistd.h>
12139 #endif
12140 #$d_sysconf HAS_SYSCONF
12141 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12142 #ifdef HAS_STDIO_STREAM_ARRAY
12143 # define STDIO_STREAM_ARRAY $stdio_stream_array
12144 #endif
12145 int main() {
12146   FILE* p = fopen("try.out", "w");
12147 #ifdef TRY_FPUTC
12148   fputc('x', p);
12149 #else
12150 # ifdef TRY_FPRINTF
12151   fprintf(p, "x");
12152 # endif
12153 #endif
12154 #ifdef TRY_FFLUSH_NULL
12155   fflush(NULL);
12156 #endif
12157 #ifdef TRY_FFLUSH_ALL
12158   {
12159     long open_max = -1;
12160 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12161     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12162 # else
12163 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12164     open_max = sysconf(_SC_OPEN_MAX);
12165 #  else
12166 #   ifdef FOPEN_MAX
12167     open_max = FOPEN_MAX;
12168 #   else
12169 #    ifdef OPEN_MAX
12170     open_max = OPEN_MAX;
12171 #    else
12172 #     ifdef _NFILE
12173     open_max = _NFILE;
12174 #     endif
12175 #    endif
12176 #   endif
12177 #  endif
12178 # endif 
12179 # ifdef HAS_STDIO_STREAM_ARRAY
12180     if (open_max > 0) {
12181       long i;
12182       for (i = 0; i < open_max; i++)
12183             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12184                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12185                 STDIO_STREAM_ARRAY[i]._flag)
12186                 fflush(&STDIO_STREAM_ARRAY[i]);
12187     }   
12188   }
12189 # endif
12190 #endif
12191   _exit(42);
12192 }
12193 EOCP
12194 : first we have to find out how _not_ to flush
12195 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12196     output=''
12197     set try -DTRY_FPUTC
12198     if eval $compile; then
12199             $rm -f try.out
12200             ./try$exe_ext 2>/dev/null
12201             if $test ! -s try.out -a "X$?" = X42; then
12202                 output=-DTRY_FPUTC
12203             fi
12204     fi
12205     case "$output" in
12206     '')
12207             set try -DTRY_FPRINTF
12208             $rm -f try.out
12209             if eval $compile; then
12210                     $rm -f try.out
12211                     ./try$exe_ext 2>/dev/null
12212                     if $test ! -s try.out -a "X$?" = X42; then
12213                         output=-DTRY_FPRINTF
12214                     fi
12215             fi
12216         ;;
12217     esac
12218 fi
12219 : check for fflush NULL behaviour
12220 case "$fflushNULL" in
12221 '')     set try -DTRY_FFLUSH_NULL $output
12222         if eval $compile; then
12223                 $rm -f try.out
12224                 ./try$exe_ext 2>/dev/null
12225                 code="$?"
12226                 if $test -s try.out -a "X$code" = X42; then
12227                         fflushNULL="`$cat try.out`"
12228                 else
12229                         if $test "X$code" != X42; then
12230                                 $cat >&4 <<EOM
12231 (If this test failed, don't worry, we'll try another method shortly.)
12232 EOM
12233                         fi
12234                 fi
12235         fi
12236         $rm -f core try.core core.try.*
12237         case "$fflushNULL" in
12238         x)      $cat >&4 <<EOM
12239 Your fflush(NULL) works okay.
12240 EOM
12241                 fflushNULL="$define"
12242                 ;;
12243         '')     $cat >&4 <<EOM
12244 Your fflush(NULL) isn't working (contrary to ANSI C).
12245 EOM
12246                 fflushNULL="$undef"
12247                 ;;
12248         *)      $cat >&4 <<EOM
12249 Cannot figure out whether your fflush(NULL) works or not.
12250 I'm assuming it doesn't (contrary to ANSI C).
12251 EOM
12252                 fflushNULL="$undef"
12253                 ;;
12254         esac
12255         ;;
12256 $define|true|[yY]*)
12257         fflushNULL="$define"
12258         ;;
12259 *)
12260         fflushNULL="$undef"
12261         ;;
12262 esac
12263 : check explicit looping only if NULL did not work
12264 case "$fflushNULL" in
12265 "$undef")
12266         : check for fflush all behaviour
12267         case "$fflushall" in
12268         '')     set try -DTRY_FFLUSH_ALL $output
12269                 if eval $compile; then
12270                         $cat >&4 <<EOM
12271 (Now testing the other method--but note that also this may fail.)
12272 EOM
12273                         $rm -f try.out
12274                         ./try$exe_ext 2>/dev/null
12275                         if $test -s try.out -a "X$?" = X42; then
12276                                 fflushall="`$cat try.out`"
12277                         fi
12278                 fi
12279                 $rm -f core try.core core.try.*
12280                 case "$fflushall" in
12281                 x)      $cat >&4 <<EOM
12282 Whew. Flushing explicitly all the stdio streams works.
12283 EOM
12284                         fflushall="$define"
12285                         ;;
12286                 '')     $cat >&4 <<EOM
12287 Sigh. Flushing explicitly all the stdio streams doesn't work.
12288 EOM
12289                         fflushall="$undef"
12290                         ;;
12291                 *)      $cat >&4 <<EOM
12292 Cannot figure out whether flushing stdio streams explicitly works or not.
12293 I'm assuming it doesn't.
12294 EOM
12295                         fflushall="$undef"
12296                         ;;
12297                 esac
12298                 ;;
12299         "$define"|true|[yY]*)
12300                 fflushall="$define"
12301                 ;;
12302         *)
12303                 fflushall="$undef"
12304                 ;;
12305         esac
12306         ;;
12307 *)      fflushall="$undef"      
12308         ;;
12309 esac
12310 case "$fflushNULL$fflushall" in
12311 undefundef)
12312         $cat <<EOM
12313 I cannot figure out how to flush pending stdio output.
12314 EOM
12315         ;;
12316 esac
12317 $rm -f try.* try$exe_ext
12318
12319 : Store the full pathname to the ar program for use in the C program
12320 : Respect a hint or command line value for full_ar.
12321 case "$full_ar" in
12322 '') full_ar=$ar ;;
12323 esac
12324
12325 : Store the full pathname to the sed program for use in the C program
12326 full_sed=$sed
12327
12328 : see what type gids are declared as in the kernel
12329 echo " "
12330 echo "Looking for the type for group ids returned by getgid()."
12331 set gid_t gidtype xxx stdio.h sys/types.h
12332 eval $typedef
12333 case "$gidtype" in
12334 xxx)
12335         xxx=`./findhdr sys/user.h`
12336         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12337         case $1 in
12338         unsigned) dflt="$1 $2" ;;
12339         *) dflt="$1" ;;
12340         esac
12341         ;;
12342 *) dflt="$gidtype";;
12343 esac
12344 case "$gidtype" in
12345 gid_t) echo "gid_t found." ;;
12346 *)      rp="What is the type for group ids returned by getgid()?"
12347         . ./myread
12348         gidtype="$ans"
12349         ;;
12350 esac
12351
12352 echo " "
12353 case "$gidtype" in
12354 *_t) zzz="$gidtype"     ;;
12355 *)   zzz="gid"          ;;
12356 esac
12357 echo "Checking the size of $zzz..." >&4 
12358 cat > try.c <<EOCP
12359 #include <sys/types.h>
12360 #include <stdio.h>
12361 int main() {
12362     printf("%d\n", (int)sizeof($gidtype));
12363     exit(0);
12364 }
12365 EOCP
12366 set try
12367 if eval $compile_ok; then
12368         yyy=`./try`
12369         case "$yyy" in
12370         '')     gidsize=4
12371                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12372                 ;;
12373         *)      gidsize=$yyy
12374                 echo "Your $zzz size is $gidsize bytes."
12375                 ;;
12376         esac
12377 else
12378         gidsize=4
12379         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12380 fi
12381
12382
12383 echo " "
12384 case "$gidtype" in
12385 *_t) zzz="$gidtype"     ;;
12386 *)   zzz="gid"          ;;
12387 esac
12388 echo "Checking the sign of $zzz..." >&4 
12389 cat > try.c <<EOCP
12390 #include <sys/types.h>
12391 #include <stdio.h>
12392 int main() {
12393         $gidtype foo = -1;
12394         if (foo < 0)
12395                 printf("-1\n");
12396         else
12397                 printf("1\n");
12398 }
12399 EOCP
12400 set try
12401 if eval $compile; then
12402         yyy=`./try`
12403         case "$yyy" in
12404         '')     gidsign=1
12405                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12406                 ;;
12407         *)      gidsign=$yyy
12408                 case "$gidsign" in
12409                  1) echo "Your $zzz is unsigned." ;;
12410                 -1) echo "Your $zzz is signed."   ;;
12411                 esac
12412                 ;;
12413         esac
12414 else
12415         gidsign=1
12416         echo "(I can't compile the test program--guessing unsigned.)" >&4
12417 fi
12418
12419
12420 echo " "
12421
12422 if $test X"$quadtype" != X; then
12423
12424 echo "Checking how to print 64-bit integers..." >&4
12425
12426 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12427         $cat >try.c <<'EOCP'
12428 #include <sys/types.h>
12429 #include <stdio.h>
12430 int main() {
12431   int q = 12345678901;
12432   printf("%ld\n", q);
12433 }
12434 EOCP
12435         set try
12436         if eval $compile; then
12437                 yyy=`./try$exe_ext`
12438                 case "$yyy" in
12439                 12345678901)
12440                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12441                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12442                         echo "We will use %d."
12443                         ;;
12444                 esac
12445         fi
12446 fi
12447
12448 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12449         $cat >try.c <<'EOCP'
12450 #include <sys/types.h>
12451 #include <stdio.h>
12452 int main() {
12453   long q = 12345678901;
12454   printf("%ld\n", q);
12455 }
12456 EOCP
12457         set try
12458         if eval $compile; then
12459                 yyy=`./try$exe_ext`
12460                 case "$yyy" in
12461                 12345678901)
12462                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12463                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12464                         echo "We will use %ld."
12465                         ;;
12466                 esac
12467         fi
12468 fi
12469
12470 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12471         $cat >try.c <<'EOCP'
12472 #include <sys/types.h>
12473 #include <inttypes.h>
12474 #include <stdio.h>
12475 int main() {
12476   int64_t q = 12345678901;
12477   printf("%" PRId64 "\n", q);
12478 }
12479 EOCP
12480         set try
12481         if eval $compile; then
12482                 yyy=`./try$exe_ext`
12483                 case "$yyy" in
12484                 12345678901)
12485                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12486                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12487                         echo "We will use the C9X style."
12488                         ;;
12489                 esac
12490         fi
12491 fi
12492
12493 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12494         $cat >try.c <<'EOCP'
12495 #include <sys/types.h>
12496 #include <stdio.h>
12497 int main() {
12498   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12499   printf("%lld\n", q);
12500 }
12501 EOCP
12502         set try
12503         if eval $compile; then
12504                 yyy=`./try$exe_ext`
12505                 case "$yyy" in
12506                 12345678901)
12507                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12508                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12509                         echo "We will use the %lld style."
12510                         ;;
12511                 esac
12512         fi
12513 fi
12514
12515 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12516         $cat >try.c <<EOCP
12517 #include <sys/types.h>
12518 #include <stdio.h>
12519 int main() {
12520   $quadtype q = 12345678901;
12521   printf("%Ld\n", q);
12522 }
12523 EOCP
12524         set try
12525         if eval $compile; then
12526                 yyy=`./try$exe_ext`
12527                 case "$yyy" in
12528                 12345678901)
12529                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12530                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12531                         echo "We will use %Ld."
12532                         ;;
12533                 esac
12534         fi
12535 fi
12536
12537 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12538         $cat >try.c <<EOCP
12539 #include <sys/types.h>
12540 #include <stdio.h>
12541 int main() {
12542   $quadtype q = 12345678901;
12543   printf("%qd\n", q);
12544 }
12545 EOCP
12546         set try
12547         if eval $compile; then
12548                 yyy=`./try$exe_ext`
12549                 case "$yyy" in
12550                 12345678901)
12551                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12552                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12553                         echo "We will use %qd."
12554                         ;;
12555                 esac
12556         fi
12557 fi
12558
12559 if $test X"$sPRId64" = X; then
12560         echo "Cannot figure out how to print 64-bit integers." >&4
12561 fi
12562
12563 $rm -f try try.*
12564
12565 fi
12566
12567 case "$sPRId64" in
12568 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12569         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12570         ;;
12571 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12572         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12573         ;;
12574 esac
12575
12576
12577 echo " "
12578 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12579
12580 if $test X"$ivsize" = X8; then
12581         ivdformat="$sPRId64"
12582         uvuformat="$sPRIu64"
12583         uvoformat="$sPRIo64"
12584         uvxformat="$sPRIx64"
12585 else
12586         if $test X"$ivsize" = X"$longsize"; then
12587                 ivdformat='"ld"'
12588                 uvuformat='"lu"'
12589                 uvoformat='"lo"'
12590                 uvxformat='"lx"'
12591         else
12592                 if $test X"$ivsize" = X"$intsize"; then
12593                         ivdformat='"d"'
12594                         uvuformat='"u"'
12595                         uvoformat='"o"'
12596                         uvxformat='"x"'
12597                 else
12598                         : far out
12599                         if $test X"$ivsize" = X"$shortsize"; then
12600                                 ivdformat='"hd"'
12601                                 uvuformat='"hu"'
12602                                 uvoformat='"ho"'
12603                                 uvxformat='"hx"'
12604                         fi
12605                 fi
12606         fi
12607 fi
12608
12609 case "$ivdformat" in
12610 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12611     exit 1
12612     ;;
12613 esac
12614
12615
12616 echo " "
12617 $echo "Checking the format string to be used for gids..." >&4
12618
12619 case "$gidsign" in
12620 -1)     if $test X"$gidsize" = X"$ivsize"; then
12621                 gidformat="$ivdformat"
12622         else
12623                 if $test X"$gidsize" = X"$longsize"; then
12624                         gidformat='"ld"'
12625                 else
12626                         if $test X"$gidsize" = X"$intsize"; then
12627                                 gidformat='"d"'
12628                         else
12629                                 if $test X"$gidsize" = X"$shortsize"; then
12630                                         gidformat='"hd"'
12631                                 fi
12632                         fi
12633                 fi
12634         fi
12635         ;;
12636 *)      if $test X"$gidsize" = X"$uvsize"; then
12637                 gidformat="$uvuformat"
12638         else
12639                 if $test X"$gidsize" = X"$longsize"; then
12640                         gidformat='"lu"'
12641                 else
12642                         if $test X"$gidsize" = X"$intsize"; then
12643                                 gidformat='"u"'
12644                         else
12645                                 if $test X"$gidsize" = X"$shortsize"; then
12646                                         gidformat='"hu"'
12647                                 fi
12648                         fi
12649                 fi
12650         fi
12651         ;;
12652 esac
12653
12654 : see if getgroups exists
12655 set getgroups d_getgrps
12656 eval $inlibc
12657
12658 : see if setgroups exists
12659 set setgroups d_setgrps
12660 eval $inlibc
12661
12662
12663 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12664 echo " "
12665 case "$d_getgrps$d_setgrps" in
12666 *define*)
12667         case "$groupstype" in
12668         '') dflt="$gidtype" ;;
12669         *)  dflt="$groupstype" ;;
12670         esac
12671         $cat <<EOM
12672 What type of pointer is the second argument to getgroups() and setgroups()?
12673 Usually this is the same as group ids, $gidtype, but not always.
12674
12675 EOM
12676         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12677         . ./myread
12678         groupstype="$ans"
12679         ;;
12680 *)  groupstype="$gidtype";;
12681 esac
12682
12683 echo " "
12684 echo "Checking if your $make program sets \$(MAKE)..." >&4
12685 case "$make_set_make" in
12686 '')
12687         $sed 's/^X //' > testmake.mak << 'EOF'
12688 Xall:
12689 X       @echo 'maketemp="$(MAKE)"'
12690 EOF
12691         case "`$make -f testmake.mak 2>/dev/null`" in
12692         *maketemp=*) make_set_make='#' ;;
12693         *)      make_set_make="MAKE=$make" ;;
12694         esac
12695         $rm -f testmake.mak
12696         ;;
12697 esac
12698 case "$make_set_make" in
12699 '#') echo "Yup, it does.";;
12700 *) echo "Nope, it doesn't.";;
12701 esac
12702
12703 : see what type is used for mode_t
12704 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12705 set mode_t modetype int stdio.h sys/types.h
12706 eval $typedef_ask
12707
12708 : define a fucntion to check prototypes
12709 $cat > protochk <<EOSH
12710 $startsh
12711 cc="$cc"
12712 optimize="$optimize"
12713 ccflags="$ccflags"
12714 prototype="$prototype"
12715 define="$define"
12716 rm=$rm
12717 EOSH
12718
12719 $cat >> protochk <<'EOSH'
12720
12721 $rm -f try.c
12722 foo="$1"
12723 shift
12724 while test $# -ge 2; do
12725         case "$1" in
12726                 $define) echo "#include <$2>" >> try.c ;;
12727                 literal) echo "$2" >> try.c ;;
12728         esac
12729     shift 2
12730 done
12731 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12732 cat >> try.c <<'EOCP'
12733 #ifdef CAN_PROTOTYPE
12734 #define _(args) args
12735 #else
12736 #define _(args) ()
12737 #endif
12738 EOCP
12739 echo "$foo" >> try.c
12740 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12741 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12742 status=$?
12743 $rm -f try.[co]
12744 exit $status
12745 EOSH
12746 chmod +x protochk
12747 $eunicefix protochk
12748
12749 : check for type of arguments to gethostbyaddr. 
12750 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12751         case "$d_gethbyaddr" in
12752         $define)
12753                 $cat <<EOM
12754
12755 Checking to see what type of arguments are accepted by gethostbyaddr().
12756 EOM
12757                 hdrs="$define sys/types.h
12758                         $d_socket sys/socket.h 
12759                         $i_niin netinet/in.h 
12760                         $i_netdb netdb.h
12761                         $i_unistd unistd.h"
12762                 : The first arg can 'char *' or 'void *'
12763                 : The second arg is some of integral type
12764                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12765                         for yyy in size_t long int; do
12766                                 case "$netdb_host_type" in
12767                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12768                                         if ./protochk "$try" $hdrs; then
12769                                                 echo "Your system accepts $xxx for the first arg."
12770                                                 echo "...and $yyy for the second arg."
12771                                                 netdb_host_type="$xxx"
12772                                                 netdb_hlen_type="$yyy"
12773                                         fi
12774                                         ;;
12775                                 esac
12776                         done
12777                 done
12778                 : In case none of those worked, prompt the user.
12779                 case "$netdb_host_type" in
12780                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12781                         dflt='char *'
12782                         . ./myread
12783                         netdb_host_type=$ans
12784                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12785                         dflt="$sizetype"
12786                         . ./myread
12787                         netdb_hlen_type=$ans
12788                         ;;
12789                 esac
12790                 ;;
12791         *)      : no gethostbyaddr, so pick harmless defaults
12792                 netdb_host_type='char *'
12793                 netdb_hlen_type="$sizetype"
12794                 ;;
12795         esac
12796         # Remove the "const" if needed. -- but then we'll have a 
12797         # prototype clash!
12798         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12799 fi
12800
12801 : check for type of argument to gethostbyname. 
12802 if test "X$netdb_name_type" = X ; then
12803         case "$d_gethbyname" in
12804         $define)
12805                 $cat <<EOM
12806
12807 Checking to see what type of argument is accepted by gethostbyname().
12808 EOM
12809                 hdrs="$define sys/types.h
12810                         $d_socket sys/socket.h 
12811                         $i_niin netinet/in.h 
12812                         $i_netdb netdb.h
12813                         $i_unistd unistd.h"
12814                 for xxx in "const char *" "char *"; do
12815                         case "$netdb_name_type" in
12816                         '')     try="extern struct hostent *gethostbyname($xxx);"
12817                                 if ./protochk "$try" $hdrs; then
12818                                         echo "Your system accepts $xxx."
12819                                         netdb_name_type="$xxx"
12820                                 fi
12821                                 ;;
12822                         esac
12823                 done
12824                 : In case none of those worked, prompt the user.
12825                 case "$netdb_name_type" in
12826                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12827                         dflt='char *'
12828                         . ./myread
12829                         netdb_name_type=$ans
12830                         ;;
12831                 esac
12832                 ;;
12833         *)      : no gethostbyname, so pick harmless default
12834                 netdb_name_type='char *'
12835                 ;;
12836         esac
12837 fi
12838
12839 : check for type of 1st argument to getnetbyaddr. 
12840 if test "X$netdb_net_type" = X ; then
12841         case "$d_getnbyaddr" in
12842         $define)
12843                 $cat <<EOM
12844
12845 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12846 EOM
12847                 hdrs="$define sys/types.h
12848                         $d_socket sys/socket.h 
12849                         $i_niin netinet/in.h 
12850                         $i_netdb netdb.h
12851                         $i_unistd unistd.h"
12852                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12853                         case "$netdb_net_type" in
12854                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12855                                 if ./protochk "$try" $hdrs; then
12856                                         echo "Your system accepts $xxx."
12857                                         netdb_net_type="$xxx"
12858                                 fi
12859                                 ;;
12860                         esac
12861                 done
12862                 : In case none of those worked, prompt the user.
12863                 case "$netdb_net_type" in
12864                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12865                         dflt='long'
12866                         . ./myread
12867                         netdb_net_type=$ans
12868                         ;;
12869                 esac
12870                 ;;
12871         *)      : no getnetbyaddr, so pick harmless default
12872                 netdb_net_type='long'
12873                 ;;
12874         esac
12875 fi
12876 : locate the preferred pager for this system
12877 case "$pager" in
12878 '')
12879         dflt=''
12880         case "$pg" in
12881         /*) dflt=$pg;;
12882         esac
12883         case "$more" in
12884         /*) dflt=$more;;
12885         esac
12886         case "$less" in
12887         /*) dflt=$less;;
12888         esac
12889         case "$dflt" in
12890         '') dflt=/usr/ucb/more;;
12891         esac
12892         ;;
12893 *) dflt="$pager";;
12894 esac
12895 echo " "
12896 fn=f/
12897 rp='What pager is used on your system?'
12898 . ./getfile
12899 pager="$ans"
12900
12901 : see what type pids are declared as in the kernel
12902 rp="What is the type of process ids on this system?"
12903 set pid_t pidtype int stdio.h sys/types.h
12904 eval $typedef_ask
12905
12906 : Find earliest binary compatible site_perl subdirectory perl can use.
12907 case "$bincompat5005" in
12908 "$define") xs_apiversion='5.005' ;;
12909 *) xs_apiversion=$version ;;   # The current site_perl version.
12910 esac
12911 : Find earliest pure perl site_perl subdirectory perl can use.
12912 : The versioned directories started at 5.005.
12913 pm_apiversion='5.005'
12914
12915 : check for length of pointer
12916 echo " "
12917 case "$ptrsize" in
12918 '')
12919         $echo $n "Checking to see how big your pointers are...$c" >&4
12920         if test "$voidflags" -gt 7; then
12921                 echo '#define VOID_PTR char *' > try.c
12922         else
12923                 echo '#define VOID_PTR void *' > try.c
12924         fi
12925         $cat >>try.c <<'EOCP'
12926 #include <stdio.h>
12927 int main()
12928 {
12929     printf("%d\n", (int)sizeof(VOID_PTR));
12930     exit(0);
12931 }
12932 EOCP
12933         set try
12934         if eval $compile_ok; then
12935                 ptrsize=`./try`
12936                 $echo " $ptrsize bytes." >&4
12937         else
12938                 dflt='4'
12939                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12940                 rp="What is the size of a pointer (in bytes)?"
12941                 . ./myread
12942                 ptrsize="$ans"
12943         fi
12944         ;;
12945 esac
12946 $rm -f try.c try
12947
12948 : see if ar generates random libraries by itself
12949 echo " "
12950 echo "Checking how to generate random libraries on your machine..." >&4
12951 echo 'int bar1() { return bar2(); }' > bar1.c
12952 echo 'int bar2() { return 2; }' > bar2.c
12953 $cat > foo.c <<'EOP'
12954 int main() { printf("%d\n", bar1()); exit(0); }
12955 EOP
12956 $cc $ccflags -c bar1.c >/dev/null 2>&1
12957 $cc $ccflags -c bar2.c >/dev/null 2>&1
12958 $cc $ccflags -c foo.c >/dev/null 2>&1
12959 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12960 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12961         ./foobar >/dev/null 2>&1; then
12962         echo "$ar appears to generate random libraries itself."
12963         orderlib=false
12964         ranlib=":"
12965 elif $ar ts bar$_a >/dev/null 2>&1 &&
12966         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12967         ./foobar >/dev/null 2>&1; then
12968                 echo "a table of contents needs to be added with '$ar ts'."
12969                 orderlib=false
12970                 ranlib="$ar ts"
12971 else
12972         case "$ranlib" in
12973         :) ranlib='';;
12974         '')
12975                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12976                 $test -f $ranlib || ranlib=''
12977                 ;;
12978         esac
12979         if $test -n "$ranlib"; then
12980                 echo "your system has '$ranlib'; we'll use that."
12981                 orderlib=false
12982         else
12983                 echo "your system doesn't seem to support random libraries"
12984                 echo "so we'll use lorder and tsort to order the libraries."
12985                 orderlib=true
12986                 ranlib=":"
12987         fi
12988 fi
12989 $rm -f foo* bar* 
12990
12991 : check for type of arguments to select. 
12992 case "$selecttype" in
12993 '') case "$d_select" in
12994         $define)
12995                 echo " "
12996                 $cat <<EOM
12997 Checking to see what type of arguments are accepted by select().
12998 EOM
12999                 hdrs="$define sys/types.h
13000                         $i_systime sys/time.h 
13001                         $i_sysselct sys/select.h
13002                         $d_socket sys/socket.h"
13003                 : The first arg can be int, unsigned, or size_t
13004                 : The last arg may or may not be 'const'
13005                 val=''
13006                 : void pointer has been seen but using that
13007                 : breaks the selectminbits test
13008                 for xxx in 'fd_set *' 'int *'; do
13009                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13010                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13011                                         case "$val" in
13012                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13013                                                 if ./protochk "$try" $hdrs; then
13014                                                         echo "Your system accepts $xxx."
13015                                                         val="$xxx"
13016                                                 fi
13017                                                 ;;
13018                                         esac
13019                                 done
13020                         done
13021                 done
13022                 case "$val" in
13023                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13024                         case "$d_fd_set" in
13025                                 $define) dflt="fd_set *" ;;
13026                                 *)              dflt="int *" ;;
13027                         esac
13028                         . ./myread
13029                         val=$ans
13030                         ;;
13031                 esac
13032                 selecttype="$val"
13033                 ;;
13034         *)      : no select, so pick a harmless default
13035                 selecttype='int *'
13036                 ;;
13037         esac
13038         ;;
13039 esac
13040
13041 : check for the select 'width'
13042 case "$selectminbits" in
13043 '') case "$d_select" in
13044         $define)
13045                 $cat <<EOM
13046
13047 Checking to see on how many bits at a time your select() operates...
13048 EOM
13049                 $cat >try.c <<EOCP
13050 #include <sys/types.h>
13051 #$i_time I_TIME
13052 #$i_systime I_SYS_TIME
13053 #$i_systimek I_SYS_TIME_KERNEL
13054 #ifdef I_TIME
13055 #   include <time.h>
13056 #endif
13057 #ifdef I_SYS_TIME
13058 #   ifdef I_SYS_TIME_KERNEL
13059 #       define KERNEL
13060 #   endif
13061 #   include <sys/time.h>
13062 #   ifdef I_SYS_TIME_KERNEL
13063 #       undef KERNEL
13064 #   endif
13065 #endif
13066 #$i_sysselct I_SYS_SELECT
13067 #ifdef I_SYS_SELECT
13068 #include <sys/select.h>
13069 #endif
13070 #$d_socket HAS_SOCKET
13071 #ifdef HAS_SOCKET
13072 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13073 #endif
13074 #include <stdio.h>
13075 $selecttype b;
13076 #define S sizeof(*(b))
13077 #define MINBITS 64
13078 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13079 #define NBITS  (NBYTES * 8)
13080 int main() {
13081     char s[NBYTES];
13082     struct timeval t;
13083     int i;
13084     FILE* fp;
13085     int fd;
13086
13087     fclose(stdin);
13088     fp = fopen("try.c", "r");
13089     if (fp == 0)
13090       exit(1);
13091     fd = fileno(fp);
13092     if (fd < 0)
13093       exit(2);
13094     b = ($selecttype)s;
13095     for (i = 0; i < NBITS; i++)
13096         FD_SET(i, b);
13097     t.tv_sec  = 0;
13098     t.tv_usec = 0;
13099     select(fd + 1, b, 0, 0, &t);
13100     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13101     printf("%d\n", i + 1);
13102     return 0;
13103 }
13104 EOCP
13105                 set try
13106                 if eval $compile_ok; then
13107                         selectminbits=`./try`
13108                         case "$selectminbits" in
13109                         '')     cat >&4 <<EOM
13110 Cannot figure out on how many bits at a time your select() operates.
13111 I'll play safe and guess it is 32 bits.
13112 EOM
13113                                 selectminbits=32
13114                                 bits="32 bits"
13115                                 ;;
13116                         1)      bits="1 bit" ;;
13117                         *)      bits="$selectminbits bits" ;;
13118                         esac
13119                         echo "Your select() operates on $bits at a time." >&4
13120                 else
13121                         rp='What is the minimum number of bits your select() operates on?'
13122                         case "$byteorder" in
13123                         1234|12345678)  dflt=32 ;;
13124                         *)              dflt=1  ;;
13125                         esac
13126                         . ./myread
13127                         val=$ans
13128                         selectminbits="$val"
13129                 fi
13130                 $rm -f try.* try
13131                 ;;
13132         *)      : no select, so pick a harmless default
13133                 selectminbits='32'
13134                 ;;
13135         esac
13136         ;;
13137 esac
13138
13139 : Trace out the files included by signal.h, then look for SIGxxx names.
13140 : Remove SIGARRAYSIZE used by HPUX.
13141 : Remove SIGSTKSIZE used by Linux.
13142 : Remove SIGSTKSZ used by Posix.
13143 : Remove SIGTYP void lines used by OS2.
13144 : Some cpps, like os390, dont give the file name anywhere
13145 if [ "X$fieldn" = X ]; then
13146         : Just make some guesses.  We check them later.
13147         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13148 else
13149         xxx=`echo '#include <signal.h>' |
13150         $cppstdin $cppminus $cppflags 2>/dev/null |
13151         $grep '^[       ]*#.*include' | 
13152         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13153 fi
13154 : Check this list of files to be sure we have parsed the cpp output ok.
13155 : This will also avoid potentially non-existent files, such 
13156 : as ../foo/bar.h
13157 xxxfiles=''
13158 for xx in $xxx /dev/null ; do
13159         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13160 done
13161 : If we have found no files, at least try signal.h
13162 case "$xxxfiles" in
13163 '')     xxxfiles=`./findhdr signal.h` ;;
13164 esac
13165 xxx=`awk '
13166 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13167         print substr($2, 4, 20)
13168 }
13169 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13170         print substr($3, 4, 20)
13171 }' $xxxfiles`
13172 : Append some common names just in case the awk scan failed.
13173 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13174 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13175 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13176 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13177 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13178
13179 : generate a few handy files for later
13180 $cat > signal.c <<'EOCP'
13181 #include <sys/types.h>
13182 #include <signal.h>
13183 #include <stdio.h>
13184 int main() {
13185
13186 /* Strange style to avoid deeply-nested #if/#else/#endif */
13187 #ifndef NSIG
13188 #  ifdef _NSIG
13189 #    define NSIG (_NSIG)
13190 #  endif
13191 #endif
13192
13193 #ifndef NSIG
13194 #  ifdef SIGMAX
13195 #    define NSIG (SIGMAX+1)
13196 #  endif
13197 #endif
13198
13199 #ifndef NSIG
13200 #  ifdef SIG_MAX
13201 #    define NSIG (SIG_MAX+1)
13202 #  endif
13203 #endif
13204
13205 #ifndef NSIG
13206 #  ifdef MAXSIG
13207 #    define NSIG (MAXSIG+1)
13208 #  endif
13209 #endif
13210
13211 #ifndef NSIG
13212 #  ifdef MAX_SIG
13213 #    define NSIG (MAX_SIG+1)
13214 #  endif
13215 #endif
13216
13217 #ifndef NSIG
13218 #  ifdef SIGARRAYSIZE
13219 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13220 #  endif
13221 #endif
13222
13223 #ifndef NSIG
13224 #  ifdef _sys_nsig
13225 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13226 #  endif
13227 #endif
13228
13229 /* Default to some arbitrary number that's big enough to get most
13230    of the common signals.
13231 */
13232 #ifndef NSIG
13233 #    define NSIG 50
13234 #endif
13235
13236 printf("NSIG %d\n", NSIG);
13237
13238 #ifndef JUST_NSIG
13239
13240 EOCP
13241
13242 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13243 {
13244         printf "#ifdef SIG"; printf $1; printf "\n"
13245         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13246         printf $1; printf ");\n"
13247         printf "#endif\n"
13248 }
13249 END {
13250         printf "#endif /* JUST_NSIG */\n";
13251         printf "exit(0);\n}\n";
13252 }
13253 ' >>signal.c
13254 $cat >signal.awk <<'EOP'
13255 BEGIN { ndups = 0 }
13256 $1 ~ /^NSIG$/ { nsig = $2 }
13257 ($1 !~ /^NSIG$/) && (NF == 2) {
13258     if ($2 > maxsig) { maxsig = $2 }
13259     if (sig_name[$2]) {
13260         dup_name[ndups] = $1
13261         dup_num[ndups] = $2
13262         ndups++ 
13263     }
13264     else {
13265         sig_name[$2] = $1
13266         sig_num[$2] = $2
13267     }
13268 }
13269 END { 
13270     if (nsig == 0) {
13271         nsig = maxsig + 1
13272     }
13273     printf("NSIG %d\n", nsig);
13274     for (n = 1; n < nsig; n++) {
13275         if (sig_name[n]) {
13276             printf("%s %d\n", sig_name[n], sig_num[n])
13277         }
13278         else {
13279             printf("NUM%d %d\n", n, n) 
13280         }
13281     }
13282     for (n = 0; n < ndups; n++) {
13283         printf("%s %d\n", dup_name[n], dup_num[n])
13284     }
13285 }
13286 EOP
13287 $cat >signal_cmd <<EOS
13288 $startsh
13289 if $test -s signal.lst; then
13290     echo "Using your existing signal.lst file"
13291         exit 0
13292 fi
13293 xxx="$xxx"
13294 EOS
13295 $cat >>signal_cmd <<'EOS'
13296
13297 set signal
13298 if eval $compile_ok; then
13299         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13300 else
13301         echo "(I can't seem be able to compile the whole test program)" >&4
13302         echo "(I'll try it in little pieces.)" >&4
13303         set signal -DJUST_NSIG
13304         if eval $compile_ok; then
13305                 ./signal$_exe > signal.nsg
13306                 $cat signal.nsg
13307         else
13308                 echo "I can't seem to figure out how many signals you have." >&4
13309                 echo "Guessing 50." >&4
13310                 echo 'NSIG 50' > signal.nsg
13311         fi
13312         : Now look at all the signal names, one at a time.
13313         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13314                 $cat > signal.c <<EOCP
13315 #include <sys/types.h>
13316 #include <signal.h>
13317 #include <stdio.h>
13318 int main() {
13319 printf("$xx %d\n", SIG${xx});
13320 return 0;
13321 }
13322 EOCP
13323                 set signal
13324                 if eval $compile; then
13325                         echo "SIG${xx} found."
13326                         ./signal$_exe  >> signal.ls1
13327                 else
13328                         echo "SIG${xx} NOT found."
13329                 fi
13330         done
13331         if $test -s signal.ls1; then
13332                 $cat signal.nsg signal.ls1 |
13333                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13334         fi
13335
13336 fi
13337 if $test -s signal.lst; then
13338         :
13339 else
13340         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13341         echo 'kill -l' >signal
13342         set X `csh -f <signal`
13343         $rm -f signal
13344         shift
13345         case $# in
13346         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13347         esac
13348         echo $@ | $tr ' ' $trnl | \
13349             $awk '{ printf "%s %d\n", $1, ++s; }
13350                   END { printf "NSIG %d\n", ++s }' >signal.lst
13351 fi
13352 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13353 EOS
13354 chmod a+x signal_cmd
13355 $eunicefix signal_cmd
13356
13357 : generate list of signal names
13358 echo " "
13359 case "$sig_name_init" in
13360 '') doinit=yes ;;
13361 *)  case "$sig_num_init" in
13362     ''|*,*) doinit=yes ;;
13363     esac ;;
13364 esac
13365 case "$doinit" in
13366 yes)
13367         echo "Generating a list of signal names and numbers..." >&4
13368         . ./signal_cmd
13369         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13370         sig_name=`$awk 'BEGIN { printf "ZERO " }
13371                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13372         sig_num=`$awk  'BEGIN { printf "0 " }
13373                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13374         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13375                              !/^NSIG/   { printf "\"%s\", ", $1 }
13376                              END        { printf "0\n" }' signal.lst`
13377         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13378                              !/^NSIG/   { printf "%d, ", $2}
13379                              END        { printf "0\n"}' signal.lst`
13380         ;;
13381 esac
13382 echo "The following $sig_count signals are available:"
13383 echo " "
13384 echo $sig_name | $awk \
13385 'BEGIN { linelen = 0 }
13386 {
13387         for (i = 1; i <= NF; i++) {
13388                 name = "SIG" $i " "
13389                 linelen = linelen + length(name)
13390                 if (linelen > 70) {
13391                         printf "\n"
13392                         linelen = length(name)
13393                 }
13394                 printf "%s", name
13395         }
13396         printf "\n"
13397 }'
13398 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13399
13400 : see what type is used for signed size_t
13401 set ssize_t ssizetype int stdio.h sys/types.h
13402 eval $typedef
13403 dflt="$ssizetype"
13404 $cat > ssize.c <<EOM
13405 #include <stdio.h>
13406 #include <sys/types.h>
13407 #define Size_t $sizetype
13408 #define SSize_t $dflt
13409 int main()
13410 {
13411         if (sizeof(Size_t) == sizeof(SSize_t))
13412                 printf("$dflt\n");
13413         else if (sizeof(Size_t) == sizeof(int))
13414                 printf("int\n");
13415         else 
13416                 printf("long\n");
13417         exit(0);
13418 }
13419 EOM
13420 echo " "
13421 set ssize
13422 if eval $compile_ok && ./ssize > /dev/null; then
13423         ssizetype=`./ssize`
13424         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13425 else
13426         $cat >&4 <<EOM
13427 Help! I can't compile and run the ssize_t test program: please enlighten me!
13428 (This is probably a misconfiguration in your system or libraries, and
13429 you really ought to fix it.  Still, I'll try anyway.)
13430
13431 I need a type that is the same size as $sizetype, but is guaranteed to
13432 be signed.  Common values are ssize_t, int and long.
13433
13434 EOM
13435         rp="What signed type is the same size as $sizetype?"
13436         . ./myread
13437         ssizetype="$ans"
13438 fi
13439 $rm -f ssize ssize.*
13440
13441 : see what type of char stdio uses.
13442 echo " "
13443 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13444         echo "Your stdio uses unsigned chars." >&4
13445         stdchar="unsigned char"
13446 else
13447         echo "Your stdio uses signed chars." >&4
13448         stdchar="char"
13449 fi
13450
13451 : see if time exists
13452 echo " "
13453 if test "X$d_time" = X -o X"$timetype" = X; then
13454     if set time val -f d_time; eval $csym; $val; then
13455                 echo 'time() found.' >&4
13456                 val="$define"
13457                 rp="What is the type returned by time() on this system?"
13458                 set time_t timetype long stdio.h sys/types.h
13459                 eval $typedef_ask
13460     else
13461                 echo 'time() not found, hope that will do.' >&4
13462                 val="$undef"
13463                 timetype='int';
13464     fi
13465     set d_time
13466     eval $setvar
13467 fi
13468
13469 : see what type uids are declared as in the kernel
13470 echo " "
13471 echo "Looking for the type for user ids returned by getuid()."
13472 set uid_t uidtype xxx stdio.h sys/types.h
13473 eval $typedef
13474 case "$uidtype" in
13475 xxx)
13476         xxx=`./findhdr sys/user.h`
13477         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13478         case $1 in
13479         unsigned) dflt="$1 $2" ;;
13480         *) dflt="$1" ;;
13481         esac
13482         ;;
13483 *) dflt="$uidtype";;
13484 esac
13485 case "$uidtype" in
13486 uid_t)  echo "uid_t found." ;;
13487 *)      rp="What is the type for user ids returned by getuid()?"
13488         . ./myread
13489         uidtype="$ans"
13490         ;;
13491 esac
13492
13493 echo " "
13494 case "$uidtype" in
13495 *_t) zzz="$uidtype"     ;;
13496 *)   zzz="uid"          ;;
13497 esac
13498 echo "Checking the size of $zzz..." >&4 
13499 cat > try.c <<EOCP
13500 #include <sys/types.h>
13501 #include <stdio.h>
13502 int main() {
13503     printf("%d\n", (int)sizeof($uidtype));
13504     exit(0);
13505 }
13506 EOCP
13507 set try
13508 if eval $compile_ok; then
13509         yyy=`./try`
13510         case "$yyy" in
13511         '')     uidsize=4
13512                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13513                 ;;
13514         *)      uidsize=$yyy
13515                 echo "Your $zzz size is $uidsize bytes."
13516                 ;;
13517         esac
13518 else
13519         uidsize=4
13520         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13521 fi
13522
13523 echo " "
13524 case "$uidtype" in
13525 *_t) zzz="$uidtype"     ;;
13526 *)   zzz="uid"          ;;
13527 esac
13528 echo "Checking the sign of $zzz..." >&4
13529 cat > try.c <<EOCP
13530 #include <sys/types.h>
13531 #include <stdio.h>
13532 int main() {
13533         $uidtype foo = -1;
13534         if (foo < 0)
13535                 printf("-1\n");
13536         else
13537                 printf("1\n");
13538 }
13539 EOCP
13540 set try
13541 if eval $compile; then
13542         yyy=`./try`
13543         case "$yyy" in
13544         '')     uidsign=1
13545                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13546                 ;;
13547         *)      uidsign=$yyy
13548                 case "$uidsign" in
13549                  1) echo "Your $zzz is unsigned." ;;
13550                 -1) echo "Your $zzz is signed."   ;;
13551                 esac
13552                 ;;
13553         esac
13554 else
13555         uidsign=1
13556         echo "(I can't compile the test program--guessing unsigned.)" >&4
13557 fi
13558
13559
13560
13561 echo " "
13562 $echo "Checking the format string to be used for uids..." >&4
13563
13564 case "$uidsign" in
13565 -1)     if $test X"$uidsize" = X"$ivsize"; then
13566                 uidformat="$ivdformat"
13567         else
13568                 if $test X"$uidsize" = X"$longsize"; then
13569                         uidformat='"ld"'
13570                 else
13571                         if $test X"$uidsize" = X"$intsize"; then
13572                                 uidformat='"d"'
13573                         else
13574                                 if $test X"$uidsize" = X"$shortsize"; then
13575                                         uidformat='"hd"'
13576                                 fi
13577                         fi
13578                 fi
13579         fi
13580         ;;
13581 *)      if $test X"$uidsize" = X"$uvsize"; then
13582                 uidformat="$uvuformat"
13583         else
13584                 if $test X"$uidsize" = X"$longsize"; then
13585                         uidformat='"lu"'
13586                 else
13587                         if $test X"$uidsize" = X"$intsize"; then
13588                                 uidformat='"u"'
13589                         else
13590                                 if $test X"$uidsize" = X"$shortsize"; then
13591                                         uidformat='"hu"'
13592                                 fi
13593                         fi
13594                 fi
13595         fi
13596         ;;
13597 esac
13598
13599 : see if dbm.h is available
13600 : see if dbmclose exists
13601 set dbmclose d_dbmclose
13602 eval $inlibc
13603
13604 case "$d_dbmclose" in
13605 $define)
13606         set dbm.h i_dbm
13607         eval $inhdr
13608         case "$i_dbm" in
13609         $define)
13610                 val="$undef"
13611                 set i_rpcsvcdbm
13612                 eval $setvar
13613                 ;;
13614         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13615                 eval $inhdr
13616                 ;;
13617         esac
13618         ;;
13619 *)      echo "We won't be including <dbm.h>"
13620         val="$undef"
13621         set i_dbm
13622         eval $setvar
13623         val="$undef"
13624         set i_rpcsvcdbm
13625         eval $setvar
13626         ;;
13627 esac
13628
13629 : see if this is a sys/file.h system
13630 val=''
13631 set sys/file.h val
13632 eval $inhdr
13633
13634 : do we need to include sys/file.h ?
13635 case "$val" in
13636 "$define")
13637         echo " "
13638         if $h_sysfile; then
13639                 val="$define"
13640                 echo "We'll be including <sys/file.h>." >&4
13641         else
13642                 val="$undef"
13643                 echo "We won't be including <sys/file.h>." >&4
13644         fi
13645         ;;
13646 *)
13647         h_sysfile=false
13648         ;;
13649 esac
13650 set i_sysfile
13651 eval $setvar
13652
13653 : see if fcntl.h is there
13654 val=''
13655 set fcntl.h val
13656 eval $inhdr
13657
13658 : see if we can include fcntl.h
13659 case "$val" in
13660 "$define")
13661         echo " "
13662         if $h_fcntl; then
13663                 val="$define"
13664                 echo "We'll be including <fcntl.h>." >&4
13665         else
13666                 val="$undef"
13667                 if $h_sysfile; then
13668         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13669                 else
13670                         echo "We won't be including <fcntl.h>." >&4
13671                 fi
13672         fi
13673         ;;
13674 *)
13675         h_fcntl=false
13676         val="$undef"
13677         ;;
13678 esac
13679 set i_fcntl
13680 eval $setvar
13681
13682 : see if this is a iconv.h system
13683 set iconv.h i_iconv
13684 eval $inhdr
13685
13686 : see if locale.h is available
13687 set locale.h i_locale
13688 eval $inhdr
13689
13690 : see if mach cthreads are available
13691 if test "X$usethreads" = "X$define"; then
13692         set mach/cthreads.h i_machcthr
13693         eval $inhdr
13694 else
13695         i_machcthr="$undef"
13696 fi
13697
13698
13699
13700 : see if this is a math.h system
13701 set math.h i_math
13702 eval $inhdr
13703
13704 : see if this is a mntent.h system
13705 set mntent.h i_mntent
13706 eval $inhdr
13707
13708 : see if ndbm.h is available
13709 set ndbm.h t_ndbm
13710 eval $inhdr
13711 case "$t_ndbm" in
13712 $define)
13713         : see if dbm_open exists
13714         set dbm_open d_dbm_open
13715         eval $inlibc
13716         case "$d_dbm_open" in
13717         $undef)
13718                 t_ndbm="$undef"
13719                 echo "We won't be including <ndbm.h>"
13720                 ;;
13721         esac
13722         ;;
13723 esac
13724 val="$t_ndbm"
13725 set i_ndbm
13726 eval $setvar
13727
13728 : see if net/errno.h is available
13729 val=''
13730 set net/errno.h val
13731 eval $inhdr
13732
13733 : Unfortunately, it causes problems on some systems.  Arrgh.
13734 case "$val" in
13735 $define)
13736         cat > try.c <<'EOM'
13737 #include <stdio.h>
13738 #include <errno.h>
13739 #include <net/errno.h>
13740 int func()
13741 {
13742         return ENOTSOCK;
13743 }
13744 EOM
13745         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13746                 echo "We'll be including <net/errno.h>." >&4
13747         else
13748                 echo "We won't be including <net/errno.h>." >&4
13749                 val="$undef"
13750         fi
13751         $rm -f try.* try
13752         ;;
13753 esac
13754 set i_neterrno
13755 eval $setvar
13756
13757 : see if netinet/tcp.h is available
13758 set netinet/tcp.h i_netinettcp
13759 eval $inhdr
13760
13761 : see if this is a poll.h system
13762 set poll.h i_poll
13763 eval $inhdr
13764
13765 echo " "
13766 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13767 $cat <<'EOSH' > Cppsym.know
13768 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13769 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13770 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13771 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13772 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13773 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13774 bull c cadmus clipper CMU COFF COMPILER_VERSION
13775 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13776 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13777 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13778 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13779 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13780 H3050R H3050RX hbullx20 hcx host_mips
13781 hp200 hp300 hp700 HP700 hp800 hp9000
13782 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13783 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13784 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13785 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13786 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13787 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13788 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13789 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13790 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13791 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13792 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13793 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13794 MATH_HAS_NO_SIDE_EFFECTS
13795 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13796 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13797 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13798 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13799 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13800 NetBSD news1500 news1700 news1800 news1900 news3700
13801 news700 news800 news900 NeXT NLS ns16000 ns32000
13802 ns32016 ns32332 ns32k nsc32000
13803 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13804 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13805 pc532 pdp11 PGC PIC plexus PORTAR posix
13806 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13807 POSIX_C_SOURCE POSIX_SOURCE POWER
13808 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13809 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13810 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13811 sony sony_news sonyrisc sparc sparclite spectrum
13812 stardent stdc STDC_EXT stratos sun sun3 sun386
13813 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13814 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13815 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13816 sysV68 sysV88 Tek4132 Tek4300 titan
13817 tower tower32 tower32_200 tower32_600 tower32_700
13818 tower32_800 tower32_850 tss
13819 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13820 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13821 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13822 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13823 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13824 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13825 z8000
13826 EOSH
13827 # Maybe put other stuff here too.
13828 cat <<EOSH >>Cppsym.know
13829 $osname
13830 EOSH
13831 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13832 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13833 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13834 $rm -f Cppsym.a Cppsym.b
13835 cat <<EOSH > Cppsym
13836 $startsh
13837 if $test \$# -gt 0; then
13838     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13839     if $test -s Cppsym.got; then
13840         $rm -f Cppsym.got
13841         exit 0
13842     fi
13843     $rm -f Cppsym.got
13844     exit 1
13845 else
13846     $tr " " "$trnl" | ./Cppsym.try
13847     exit 0
13848 fi
13849 EOSH
13850 chmod +x Cppsym
13851 $eunicefix Cppsym
13852 cat <<EOSH > Cppsym.try
13853 $startsh
13854 cat <<'EOCP' > try.c
13855 #include <stdio.h>
13856 int main() {
13857 EOCP
13858 $awk \\
13859 EOSH
13860 cat <<'EOSH' >> Cppsym.try
13861 'length($1) > 0 {
13862     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
13863     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
13864     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
13865     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
13866 }'       >> try.c
13867 echo '}' >> try.c
13868 EOSH
13869 cat <<EOSH >> Cppsym.try
13870 cc="$cc"
13871 optimize="$optimize"
13872 ccflags="$ccflags"
13873 ldflags="$ldflags"
13874 libs="$libs"
13875 exe_ext="$exe_ext"
13876 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
13877 EOSH
13878 chmod +x Cppsym.try
13879 $eunicefix Cppsym.try
13880 ./Cppsym < Cppsym.know > Cppsym.true
13881 : now check the C compiler for additional symbols
13882 postprocess_cc_v=''
13883 case "$osname" in
13884 aix) postprocess_cc_v="|$tr , ' '" ;;
13885 esac
13886 $cat >ccsym <<EOS
13887 $startsh
13888 $cat >tmp.c <<EOF
13889 extern int foo;
13890 EOF
13891 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13892 do
13893         case "\$i" in
13894         -D*) echo "\$i" | $sed 's/^-D//';;
13895         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13896         esac
13897 done
13898 $rm -f try.c
13899 EOS
13900 postprocess_cc_v=''
13901 chmod +x ccsym
13902 $eunicefix ccsym
13903 ./ccsym > ccsym1.raw
13904 if $test -s ccsym1.raw; then
13905        $sort ccsym1.raw | $uniq >ccsym.raw
13906 else
13907        mv ccsym1.raw ccsym.raw
13908 fi
13909
13910 $awk '/\=/ { print $0; next }
13911         { print $0"=1" }' ccsym.raw >ccsym.list
13912 $awk '/\=/ { print $0; next }
13913         { print $0"=1" }' Cppsym.true >ccsym.true
13914 $comm -13 ccsym.true ccsym.list >ccsym.own
13915 $comm -12 ccsym.true ccsym.list >ccsym.com
13916 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13917 also=''
13918 if $test -z ccsym.raw; then
13919         echo "Your C compiler doesn't seem to define any symbols!" >&4
13920         echo " "
13921         echo "However, your C preprocessor defines the following symbols:"
13922         $cat Cppsym.true
13923         ccsymbols=''
13924         cppsymbols=`$cat Cppsym.true`
13925         cppsymbols=`echo $cppsymbols`
13926         cppccsymbols="$cppsymbols"
13927 else
13928         if $test -s ccsym.com; then
13929                 echo "Your C compiler and pre-processor define these symbols:"
13930                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13931                 also='also '
13932                 symbols='ones'
13933                 cppccsymbols=`$cat ccsym.com`
13934                 cppccsymbols=`echo $cppccsymbols`
13935                 $test "$silent" || sleep 1
13936         fi
13937         if $test -s ccsym.cpp; then
13938                 $test "$also" && echo " "
13939                 echo "Your C pre-processor ${also}defines the following symbols:"
13940                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13941                 also='further '
13942                 cppsymbols=`$cat ccsym.cpp`
13943                 cppsymbols=`echo $cppsymbols`
13944                 $test "$silent" || sleep 1
13945         fi
13946         if $test -s ccsym.own; then
13947                 $test "$also" && echo " "
13948                 echo "Your C compiler ${also}defines the following cpp symbols:"
13949                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13950                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13951                 ccsymbols=`$cat ccsym.own`
13952                 ccsymbols=`echo $ccsymbols`
13953                 $test "$silent" || sleep 1
13954         fi
13955 fi
13956 $rm -f ccsym*
13957
13958 : see if this is a termio system
13959 val="$undef"
13960 val2="$undef"
13961 val3="$undef"
13962 if $test `./findhdr termios.h`; then
13963         set tcsetattr i_termios
13964         eval $inlibc
13965         val3="$i_termios"
13966 fi
13967 echo " "
13968 case "$val3" in
13969 "$define") echo "You have POSIX termios.h... good!" >&4;;
13970 *) if ./Cppsym pyr; then
13971                 case "`/bin/universe`" in
13972                 ucb) if $test `./findhdr sgtty.h`; then
13973                                 val2="$define"
13974                                 echo "<sgtty.h> found." >&4
13975                         else
13976                                 echo "System is pyramid with BSD universe."
13977                                 echo "<sgtty.h> not found--you could have problems." >&4
13978                         fi;;
13979                 *) if $test `./findhdr termio.h`; then
13980                                 val="$define"
13981                                 echo "<termio.h> found." >&4
13982                         else
13983                                 echo "System is pyramid with USG universe."
13984                                 echo "<termio.h> not found--you could have problems." >&4
13985                         fi;;
13986                 esac
13987         elif ./usg; then
13988                 if $test `./findhdr termio.h`; then
13989                         echo "<termio.h> found." >&4
13990                         val="$define"
13991                 elif $test `./findhdr sgtty.h`; then
13992                         echo "<sgtty.h> found." >&4
13993                         val2="$define"
13994                 else
13995 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13996                 fi
13997         else
13998                 if $test `./findhdr sgtty.h`; then
13999                         echo "<sgtty.h> found." >&4
14000                         val2="$define"
14001                 elif $test `./findhdr termio.h`; then
14002                         echo "<termio.h> found." >&4
14003                         val="$define"
14004                 else
14005 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14006                 fi
14007         fi;;
14008 esac
14009 set i_termio; eval $setvar
14010 val=$val2; set i_sgtty; eval $setvar
14011 val=$val3; set i_termios; eval $setvar
14012
14013 : see if this is a shadow.h system
14014 set shadow.h i_shadow
14015 eval $inhdr
14016
14017 : see if this is a socks.h system
14018 set socks.h i_socks
14019 eval $inhdr
14020
14021 : see if stdarg is available
14022 echo " "
14023 if $test `./findhdr stdarg.h`; then
14024         echo "<stdarg.h> found." >&4
14025         valstd="$define"
14026 else
14027         echo "<stdarg.h> NOT found." >&4
14028         valstd="$undef"
14029 fi
14030
14031 : see if varags is available
14032 echo " "
14033 if $test `./findhdr varargs.h`; then
14034         echo "<varargs.h> found." >&4
14035 else
14036         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14037 fi
14038
14039 : set up the varargs testing programs
14040 $cat > varargs.c <<EOP
14041 #ifdef I_STDARG
14042 #include <stdarg.h>
14043 #endif
14044 #ifdef I_VARARGS
14045 #include <varargs.h>
14046 #endif
14047
14048 #ifdef I_STDARG
14049 int f(char *p, ...)
14050 #else
14051 int f(va_alist)
14052 va_dcl
14053 #endif
14054 {
14055         va_list ap;
14056 #ifndef I_STDARG
14057         char *p;
14058 #endif
14059 #ifdef I_STDARG
14060         va_start(ap,p);
14061 #else
14062         va_start(ap);
14063         p = va_arg(ap, char *);
14064 #endif
14065         va_end(ap);
14066 }
14067 EOP
14068 $cat > varargs <<EOP
14069 $startsh
14070 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14071         echo "true"
14072 else
14073         echo "false"
14074 fi
14075 $rm -f varargs$_o
14076 EOP
14077 chmod +x varargs
14078
14079 : now check which varargs header should be included
14080 echo " "
14081 i_varhdr=''
14082 case "$valstd" in
14083 "$define")
14084         if `./varargs I_STDARG`; then
14085                 val='stdarg.h'
14086         elif `./varargs I_VARARGS`; then
14087                 val='varargs.h'
14088         fi
14089         ;;
14090 *)
14091         if `./varargs I_VARARGS`; then
14092                 val='varargs.h'
14093         fi
14094         ;;
14095 esac
14096 case "$val" in
14097 '')
14098 echo "I could not find the definition for va_dcl... You have problems..." >&4
14099         val="$undef"; set i_stdarg; eval $setvar
14100         val="$undef"; set i_varargs; eval $setvar
14101         ;;
14102 *) 
14103         set i_varhdr
14104         eval $setvar
14105         case "$i_varhdr" in
14106         stdarg.h)
14107                 val="$define"; set i_stdarg; eval $setvar
14108                 val="$undef"; set i_varargs; eval $setvar
14109                 ;;
14110         varargs.h)
14111                 val="$undef"; set i_stdarg; eval $setvar
14112                 val="$define"; set i_varargs; eval $setvar
14113                 ;;
14114         esac
14115         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14116 esac
14117 $rm -f varargs*
14118
14119 : see if stddef is available
14120 set stddef.h i_stddef
14121 eval $inhdr
14122
14123 : see if sys/access.h is available
14124 set sys/access.h i_sysaccess
14125 eval $inhdr
14126
14127 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14128 set sys/filio.h i_sysfilio
14129 eval $inhdr
14130 echo " "
14131 if $test `./findhdr sys/ioctl.h`; then
14132         val="$define"
14133         echo '<sys/ioctl.h> found.' >&4
14134 else
14135         val="$undef"
14136         if $test $i_sysfilio = "$define"; then
14137             echo '<sys/ioctl.h> NOT found.' >&4
14138         else
14139                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14140                 $test $i_termio = "$define" && xxx="termio.h"
14141                 $test $i_termios = "$define" && xxx="termios.h"
14142 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14143         fi
14144 fi
14145 set i_sysioctl
14146 eval $setvar
14147
14148
14149 : see if this is a syslog.h system
14150 set syslog.h i_syslog
14151 eval $inhdr
14152
14153
14154 : see if this is a sys/mode.h system
14155 set sys/mode.h i_sysmode
14156 eval $inhdr
14157
14158 : see if sys/resource.h has to be included
14159 set sys/resource.h i_sysresrc
14160 eval $inhdr
14161
14162 : see if sys/security.h is available
14163 set sys/security.h i_syssecrt
14164 eval $inhdr
14165
14166 : see if this is a sys/statvfs.h system
14167 set sys/statvfs.h i_sysstatvfs
14168 eval $inhdr
14169
14170 : see if this is a sys/uio.h system
14171 set sys/uio.h i_sysuio
14172 eval $inhdr
14173
14174 : see if this is a sys/un.h system
14175 set sys/un.h i_sysun
14176 eval $inhdr
14177
14178
14179 : see if this is a sys/utsname.h system
14180 set sys/utsname.h i_sysutsname
14181 eval $inhdr
14182
14183 : see if this is a syswait system
14184 set sys/wait.h i_syswait
14185 eval $inhdr
14186
14187 : see if this is a ustat.h system
14188 set ustat.h i_ustat
14189 eval $inhdr
14190
14191 : see if this is an utime system
14192 set utime.h i_utime
14193 eval $inhdr
14194
14195 : see if this is a values.h system
14196 set values.h i_values
14197 eval $inhdr
14198
14199 : see if this is a vfork system
14200 case "$d_vfork" in
14201 "$define")
14202         set vfork.h i_vfork
14203         eval $inhdr
14204         ;;
14205 *)
14206         i_vfork="$undef"
14207         ;;
14208 esac
14209
14210 : see if gdbm.h is available
14211 set gdbm.h t_gdbm
14212 eval $inhdr
14213 case "$t_gdbm" in
14214 $define)
14215         : see if gdbm_open exists
14216         set gdbm_open d_gdbm_open
14217         eval $inlibc
14218         case "$d_gdbm_open" in
14219         $undef)
14220                 t_gdbm="$undef"
14221                 echo "We won't be including <gdbm.h>"
14222                 ;;
14223         esac
14224         ;;
14225 esac
14226 val="$t_gdbm"
14227 set i_gdbm
14228 eval $setvar
14229
14230 echo " "
14231 echo "Looking for extensions..." >&4
14232 : If we are using the old config.sh, known_extensions may contain
14233 : old or inaccurate or duplicate values.
14234 known_extensions=''
14235 nonxs_extensions=''
14236 : We do not use find because it might not be available.
14237 : We do not just use MANIFEST because the user may have dropped
14238 : some additional extensions into the source tree and expect them
14239 : to be built.
14240
14241 : Function to recursively find available extensions, ignoring DynaLoader
14242 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14243 find_extensions='
14244     for xxx in *; do
14245        case "$xxx" in
14246            DynaLoader|dynaload) ;;
14247            *)
14248            if $test -f $xxx/$xxx.xs; then
14249                known_extensions="$known_extensions $1$xxx";
14250            elif $test -f $xxx/Makefile.PL; then
14251                nonxs_extensions="$nonxs_extensions $1$xxx";
14252            else
14253                if $test -d $xxx -a $# -lt 10; then
14254                    set $1$xxx/ $*;
14255                    cd $xxx;
14256                    eval $find_extensions;
14257                    cd ..;
14258                    shift;
14259                fi;
14260            fi
14261            ;;
14262        esac;
14263     done'
14264 tdir=`pwd`
14265 cd $rsrc/ext
14266 set X
14267 shift
14268 eval $find_extensions
14269 set X $nonxs_extensions
14270 shift
14271 nonxs_extensions="$*"
14272 set X $known_extensions
14273 shift
14274 known_extensions="$*"
14275 cd $tdir
14276
14277 : Now see which are supported on this system.
14278 avail_ext=''
14279 for xxx in $known_extensions ; do
14280         case "$xxx" in
14281         DB_File|db_file)
14282                 case "$i_db" in
14283                 $define) avail_ext="$avail_ext $xxx" ;;
14284                 esac
14285                 ;;
14286         GDBM_File|gdbm_fil)
14287                 case "$i_gdbm" in 
14288                 $define) avail_ext="$avail_ext $xxx" ;;
14289                 esac
14290                 ;;
14291         NDBM_File|ndbm_fil)
14292                 case "$i_ndbm" in
14293                 $define)
14294                     case "$osname-$use64bits" in
14295                     hpux-define)
14296                         case "$libs" in
14297                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14298                         esac
14299                         ;;
14300                     *) avail_ext="$avail_ext $xxx" ;;
14301                     esac
14302                     ;;
14303                 esac
14304                 ;;
14305         ODBM_File|odbm_fil) 
14306                 case "${i_dbm}${i_rpcsvcdbm}" in
14307                 *"${define}"*)
14308                     case "$osname-$use64bits" in
14309                     hpux-define)
14310                         case "$libs" in
14311                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14312                         esac
14313                         ;;
14314                     *) avail_ext="$avail_ext $xxx" ;;
14315                     esac
14316                     ;;
14317                 esac
14318                 ;;
14319         POSIX|posix)
14320                 case "$useposix" in
14321                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14322                 esac
14323                 ;;
14324         Opcode|opcode)
14325                 case "$useopcode" in
14326                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14327                 esac
14328                 ;;
14329         Socket|socket)
14330                 case "$d_socket" in 
14331                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14332                 esac
14333                 ;;
14334         Thread|thread)
14335                 case "$usethreads" in 
14336                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14337                 esac
14338                 ;;
14339         IPC/SysV|ipc/sysv)
14340                 : XXX Do we need a useipcsysv variable here
14341                 case "${d_msg}${d_sem}${d_shm}" in 
14342                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14343                 esac
14344                 ;;
14345         *)      avail_ext="$avail_ext $xxx"
14346                 ;;
14347         esac
14348 done
14349
14350 set X $avail_ext
14351 shift
14352 avail_ext="$*"
14353
14354 : Now see which nonxs extensions are supported on this system.
14355 : For now assume all are.
14356 nonxs_ext=''
14357 for xxx in $nonxs_extensions ; do
14358         case "$xxx" in
14359         *)      nonxs_ext="$nonxs_ext $xxx"
14360                 ;;
14361         esac
14362 done
14363
14364 set X $nonxs_ext
14365 shift
14366 nonxs_ext="$*"
14367
14368 case $usedl in
14369 $define)
14370         $cat <<EOM
14371 A number of extensions are supplied with $package.  You may choose to
14372 compile these extensions for dynamic loading (the default), compile
14373 them into the $package executable (static loading), or not include
14374 them at all.  Answer "none" to include no extensions.
14375 Note that DynaLoader is always built and need not be mentioned here.
14376
14377 EOM
14378         case "$dynamic_ext" in
14379         '') dflt="$avail_ext" ;;
14380         *)      dflt="$dynamic_ext"
14381                 # Perhaps we are reusing an old out-of-date config.sh.
14382                 case "$hint" in
14383                 previous)
14384                         if test X"$dynamic_ext" != X"$avail_ext"; then
14385                                 $cat <<EOM
14386 NOTICE:  Your previous config.sh list may be incorrect. 
14387 The extensions now available to you are 
14388         ${avail_ext}
14389 but the default list from your previous config.sh is
14390         ${dynamic_ext} 
14391
14392 EOM
14393                         fi
14394                         ;;
14395                 esac
14396                 ;;
14397         esac
14398         case "$dflt" in
14399         '')     dflt=none;;
14400         esac
14401         rp="What extensions do you wish to load dynamically?"
14402         . ./myread
14403         case "$ans" in
14404         none) dynamic_ext=' ' ;;
14405         *) dynamic_ext="$ans" ;;
14406         esac
14407
14408         case "$static_ext" in
14409         '')
14410                 : Exclude those already listed in dynamic linking
14411                 dflt=''
14412                 for xxx in $avail_ext; do
14413                         case " $dynamic_ext " in
14414                         *" $xxx "*) ;;
14415                         *) dflt="$dflt $xxx" ;;
14416                         esac
14417                 done
14418                 set X $dflt
14419                 shift
14420                 dflt="$*"
14421                 ;;
14422         *)  dflt="$static_ext" 
14423                 ;;
14424         esac
14425
14426         case "$dflt" in
14427         '')     dflt=none;;
14428         esac
14429         rp="What extensions do you wish to load statically?"
14430         . ./myread
14431         case "$ans" in
14432         none) static_ext=' ' ;;
14433         *) static_ext="$ans" ;;
14434         esac
14435         ;;
14436 *)
14437         $cat <<EOM
14438 A number of extensions are supplied with $package.  Answer "none" 
14439 to include no extensions. 
14440 Note that DynaLoader is always built and need not be mentioned here.
14441
14442 EOM
14443         case "$static_ext" in
14444         '') dflt="$avail_ext" ;;
14445         *)      dflt="$static_ext"
14446                 # Perhaps we are reusing an old out-of-date config.sh.
14447                 case "$hint" in
14448                 previous)
14449                         if test X"$static_ext" != X"$avail_ext"; then
14450                                 $cat <<EOM
14451 NOTICE:  Your previous config.sh list may be incorrect. 
14452 The extensions now available to you are 
14453         ${avail_ext}
14454 but the default list from your previous config.sh is
14455         ${static_ext} 
14456
14457 EOM
14458                         fi
14459                         ;;
14460                 esac
14461                 ;;
14462         esac
14463         : Exclude those that are not xs extensions
14464         case "$dflt" in
14465         '')     dflt=none;;
14466         esac
14467         rp="What extensions do you wish to include?"
14468         . ./myread
14469         case "$ans" in
14470         none) static_ext=' ' ;;
14471         *) static_ext="$ans" ;;
14472         esac
14473         ;;
14474 esac
14475
14476 set X $dynamic_ext $static_ext $nonxs_ext
14477 shift
14478 extensions="$*"
14479
14480 : Remove build directory name from cppstdin so it can be used from
14481 : either the present location or the final installed location.
14482 echo " "
14483 : Get out of the UU directory to get correct path name.
14484 cd ..
14485 case "$cppstdin" in
14486 `pwd`/cppstdin)
14487         echo "Stripping down cppstdin path name"
14488         cppstdin=cppstdin
14489         ;;
14490 esac
14491 cd UU
14492
14493 : end of configuration questions
14494 echo " "
14495 echo "End of configuration questions."
14496 echo " "
14497
14498 : back to where it started
14499 if test -d ../UU; then
14500         cd ..
14501 fi
14502
14503 : configuration may be patched via a 'config.over' file
14504 if $test -f config.over; then
14505         echo " "
14506         dflt=y
14507         rp='I see a config.over file.  Do you wish to load it?'
14508         . UU/myread
14509         case "$ans" in
14510         n*) echo "OK, I'll ignore it.";;
14511         *)      . ./config.over
14512                 echo "Configuration override changes have been loaded."
14513                 ;;
14514         esac
14515 fi
14516
14517 : in case they want portability, strip down executable paths
14518 case "$d_portable" in
14519 "$define")
14520         echo " "
14521         echo "Stripping down executable paths..." >&4
14522         for file in $loclist $trylist; do
14523                 eval temp=\$$file
14524                 eval $file=`basename $temp`
14525         done
14526         ;;
14527 esac
14528
14529 : create config.sh file
14530 echo " "
14531 echo "Creating config.sh..." >&4
14532 $spitshell <<EOT >config.sh
14533 $startsh
14534 #
14535 # This file was produced by running the Configure script. It holds all the
14536 # definitions figured out by Configure. Should you modify one of these values,
14537 # do not forget to propagate your changes by running "Configure -der". You may
14538 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14539 #
14540
14541 # Package name      : $package
14542 # Source directory  : $src
14543 # Configuration time: $cf_time
14544 # Configured by     : $cf_by
14545 # Target system     : $myuname
14546
14547 Author='$Author'
14548 Date='$Date'
14549 Header='$Header'
14550 Id='$Id'
14551 Locker='$Locker'
14552 Log='$Log'
14553 Mcc='$Mcc'
14554 RCSfile='$RCSfile'
14555 Revision='$Revision'
14556 Source='$Source'
14557 State='$State'
14558 _a='$_a'
14559 _exe='$_exe'
14560 _o='$_o'
14561 afs='$afs'
14562 alignbytes='$alignbytes'
14563 ansi2knr='$ansi2knr'
14564 aphostname='$aphostname'
14565 api_revision='$api_revision'
14566 api_subversion='$api_subversion'
14567 api_version='$api_version'
14568 api_versionstring='$api_versionstring'
14569 ar='$ar'
14570 archlib='$archlib'
14571 archlibexp='$archlibexp'
14572 archname64='$archname64'
14573 archname='$archname'
14574 archobjs='$archobjs'
14575 awk='$awk'
14576 baserev='$baserev'
14577 bash='$bash'
14578 bin='$bin'
14579 bincompat5005='$bincompat5005'
14580 binexp='$binexp'
14581 bison='$bison'
14582 byacc='$byacc'
14583 byteorder='$byteorder'
14584 c='$c'
14585 castflags='$castflags'
14586 cat='$cat'
14587 cc='$cc'
14588 cccdlflags='$cccdlflags'
14589 ccdlflags='$ccdlflags'
14590 ccflags='$ccflags'
14591 ccsymbols='$ccsymbols'
14592 cf_by='$cf_by'
14593 cf_email='$cf_email'
14594 cf_time='$cf_time'
14595 charsize='$charsize'
14596 chgrp='$chgrp'
14597 chmod='$chmod'
14598 chown='$chown'
14599 clocktype='$clocktype'
14600 comm='$comm'
14601 compress='$compress'
14602 contains='$contains'
14603 cp='$cp'
14604 cpio='$cpio'
14605 cpp='$cpp'
14606 cpp_stuff='$cpp_stuff'
14607 cppccsymbols='$cppccsymbols'
14608 cppflags='$cppflags'
14609 cpplast='$cpplast'
14610 cppminus='$cppminus'
14611 cpprun='$cpprun'
14612 cppstdin='$cppstdin'
14613 cppsymbols='$cppsymbols'
14614 crosscompile='$crosscompile'
14615 cryptlib='$cryptlib'
14616 csh='$csh'
14617 d_Gconvert='$d_Gconvert'
14618 d_PRIEldbl='$d_PRIEldbl'
14619 d_PRIFldbl='$d_PRIFldbl'
14620 d_PRIGldbl='$d_PRIGldbl'
14621 d_PRIX64='$d_PRIX64'
14622 d_PRId64='$d_PRId64'
14623 d_PRIeldbl='$d_PRIeldbl'
14624 d_PRIfldbl='$d_PRIfldbl'
14625 d_PRIgldbl='$d_PRIgldbl'
14626 d_PRIi64='$d_PRIi64'
14627 d_PRIo64='$d_PRIo64'
14628 d_PRIu64='$d_PRIu64'
14629 d_PRIx64='$d_PRIx64'
14630 d_access='$d_access'
14631 d_accessx='$d_accessx'
14632 d_alarm='$d_alarm'
14633 d_archlib='$d_archlib'
14634 d_atolf='$d_atolf'
14635 d_atoll='$d_atoll'
14636 d_attribut='$d_attribut'
14637 d_bcmp='$d_bcmp'
14638 d_bcopy='$d_bcopy'
14639 d_bincompat5005='$d_bincompat5005'
14640 d_bsd='$d_bsd'
14641 d_bsdgetpgrp='$d_bsdgetpgrp'
14642 d_bsdsetpgrp='$d_bsdsetpgrp'
14643 d_bzero='$d_bzero'
14644 d_casti32='$d_casti32'
14645 d_castneg='$d_castneg'
14646 d_charvspr='$d_charvspr'
14647 d_chown='$d_chown'
14648 d_chroot='$d_chroot'
14649 d_chsize='$d_chsize'
14650 d_closedir='$d_closedir'
14651 d_const='$d_const'
14652 d_crypt='$d_crypt'
14653 d_csh='$d_csh'
14654 d_cuserid='$d_cuserid'
14655 d_dbl_dig='$d_dbl_dig'
14656 d_difftime='$d_difftime'
14657 d_dirnamlen='$d_dirnamlen'
14658 d_dlerror='$d_dlerror'
14659 d_dlopen='$d_dlopen'
14660 d_dlsymun='$d_dlsymun'
14661 d_dosuid='$d_dosuid'
14662 d_drand48proto='$d_drand48proto'
14663 d_dup2='$d_dup2'
14664 d_eaccess='$d_eaccess'
14665 d_endgrent='$d_endgrent'
14666 d_endhent='$d_endhent'
14667 d_endnent='$d_endnent'
14668 d_endpent='$d_endpent'
14669 d_endpwent='$d_endpwent'
14670 d_endsent='$d_endsent'
14671 d_endspent='$d_endspent'
14672 d_eofnblk='$d_eofnblk'
14673 d_eunice='$d_eunice'
14674 d_fchmod='$d_fchmod'
14675 d_fchown='$d_fchown'
14676 d_fcntl='$d_fcntl'
14677 d_fd_macros='$d_fd_macros'
14678 d_fd_set='$d_fd_set'
14679 d_fds_bits='$d_fds_bits'
14680 d_fgetpos='$d_fgetpos'
14681 d_flexfnam='$d_flexfnam'
14682 d_flock='$d_flock'
14683 d_fork='$d_fork'
14684 d_fpathconf='$d_fpathconf'
14685 d_fpos64_t='$d_fpos64_t'
14686 d_fs_data_s='$d_fs_data_s'
14687 d_fseeko='$d_fseeko'
14688 d_fsetpos='$d_fsetpos'
14689 d_fstatfs='$d_fstatfs'
14690 d_fstatvfs='$d_fstatvfs'
14691 d_ftello='$d_ftello'
14692 d_ftime='$d_ftime'
14693 d_getcwd='$d_getcwd'
14694 d_getgrent='$d_getgrent'
14695 d_getgrps='$d_getgrps'
14696 d_gethbyaddr='$d_gethbyaddr'
14697 d_gethbyname='$d_gethbyname'
14698 d_gethent='$d_gethent'
14699 d_gethname='$d_gethname'
14700 d_gethostprotos='$d_gethostprotos'
14701 d_getlogin='$d_getlogin'
14702 d_getmnt='$d_getmnt'
14703 d_getmntent='$d_getmntent'
14704 d_getnbyaddr='$d_getnbyaddr'
14705 d_getnbyname='$d_getnbyname'
14706 d_getnent='$d_getnent'
14707 d_getnetprotos='$d_getnetprotos'
14708 d_getpbyname='$d_getpbyname'
14709 d_getpbynumber='$d_getpbynumber'
14710 d_getpent='$d_getpent'
14711 d_getpgid='$d_getpgid'
14712 d_getpgrp2='$d_getpgrp2'
14713 d_getpgrp='$d_getpgrp'
14714 d_getppid='$d_getppid'
14715 d_getprior='$d_getprior'
14716 d_getprotoprotos='$d_getprotoprotos'
14717 d_getpwent='$d_getpwent'
14718 d_getsbyname='$d_getsbyname'
14719 d_getsbyport='$d_getsbyport'
14720 d_getsent='$d_getsent'
14721 d_getservprotos='$d_getservprotos'
14722 d_getspent='$d_getspent'
14723 d_getspnam='$d_getspnam'
14724 d_gettimeod='$d_gettimeod'
14725 d_gnulibc='$d_gnulibc'
14726 d_grpasswd='$d_grpasswd'
14727 d_hasmntopt='$d_hasmntopt'
14728 d_htonl='$d_htonl'
14729 d_iconv='$d_iconv'
14730 d_index='$d_index'
14731 d_inetaton='$d_inetaton'
14732 d_int64_t='$d_int64_t'
14733 d_isascii='$d_isascii'
14734 d_killpg='$d_killpg'
14735 d_lchown='$d_lchown'
14736 d_ldbl_dig='$d_ldbl_dig'
14737 d_link='$d_link'
14738 d_locconv='$d_locconv'
14739 d_lockf='$d_lockf'
14740 d_longdbl='$d_longdbl'
14741 d_longlong='$d_longlong'
14742 d_lstat='$d_lstat'
14743 d_mblen='$d_mblen'
14744 d_mbstowcs='$d_mbstowcs'
14745 d_mbtowc='$d_mbtowc'
14746 d_memchr='$d_memchr'
14747 d_memcmp='$d_memcmp'
14748 d_memcpy='$d_memcpy'
14749 d_memmove='$d_memmove'
14750 d_memset='$d_memset'
14751 d_mkdir='$d_mkdir'
14752 d_mkdtemp='$d_mkdtemp'
14753 d_mkfifo='$d_mkfifo'
14754 d_mkstemp='$d_mkstemp'
14755 d_mkstemps='$d_mkstemps'
14756 d_mktime='$d_mktime'
14757 d_mmap='$d_mmap'
14758 d_mprotect='$d_mprotect'
14759 d_msg='$d_msg'
14760 d_msg_ctrunc='$d_msg_ctrunc'
14761 d_msg_dontroute='$d_msg_dontroute'
14762 d_msg_oob='$d_msg_oob'
14763 d_msg_peek='$d_msg_peek'
14764 d_msg_proxy='$d_msg_proxy'
14765 d_msgctl='$d_msgctl'
14766 d_msgget='$d_msgget'
14767 d_msgrcv='$d_msgrcv'
14768 d_msgsnd='$d_msgsnd'
14769 d_msync='$d_msync'
14770 d_munmap='$d_munmap'
14771 d_mymalloc='$d_mymalloc'
14772 d_nice='$d_nice'
14773 d_nv_preserves_uv='$d_nv_preserves_uv'
14774 d_off64_t='$d_off64_t'
14775 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14776 d_oldpthreads='$d_oldpthreads'
14777 d_oldsock='$d_oldsock'
14778 d_open3='$d_open3'
14779 d_pathconf='$d_pathconf'
14780 d_pause='$d_pause'
14781 d_phostname='$d_phostname'
14782 d_pipe='$d_pipe'
14783 d_poll='$d_poll'
14784 d_portable='$d_portable'
14785 d_pthread_yield='$d_pthread_yield'
14786 d_pwage='$d_pwage'
14787 d_pwchange='$d_pwchange'
14788 d_pwclass='$d_pwclass'
14789 d_pwcomment='$d_pwcomment'
14790 d_pwexpire='$d_pwexpire'
14791 d_pwgecos='$d_pwgecos'
14792 d_pwpasswd='$d_pwpasswd'
14793 d_pwquota='$d_pwquota'
14794 d_quad='$d_quad'
14795 d_readdir='$d_readdir'
14796 d_readlink='$d_readlink'
14797 d_rename='$d_rename'
14798 d_rewinddir='$d_rewinddir'
14799 d_rmdir='$d_rmdir'
14800 d_safebcpy='$d_safebcpy'
14801 d_safemcpy='$d_safemcpy'
14802 d_sanemcmp='$d_sanemcmp'
14803 d_sched_yield='$d_sched_yield'
14804 d_scm_rights='$d_scm_rights'
14805 d_seekdir='$d_seekdir'
14806 d_select='$d_select'
14807 d_sem='$d_sem'
14808 d_semctl='$d_semctl'
14809 d_semctl_semid_ds='$d_semctl_semid_ds'
14810 d_semctl_semun='$d_semctl_semun'
14811 d_semget='$d_semget'
14812 d_semop='$d_semop'
14813 d_setegid='$d_setegid'
14814 d_seteuid='$d_seteuid'
14815 d_setgrent='$d_setgrent'
14816 d_setgrps='$d_setgrps'
14817 d_sethent='$d_sethent'
14818 d_setlinebuf='$d_setlinebuf'
14819 d_setlocale='$d_setlocale'
14820 d_setnent='$d_setnent'
14821 d_setpent='$d_setpent'
14822 d_setpgid='$d_setpgid'
14823 d_setpgrp2='$d_setpgrp2'
14824 d_setpgrp='$d_setpgrp'
14825 d_setprior='$d_setprior'
14826 d_setpwent='$d_setpwent'
14827 d_setregid='$d_setregid'
14828 d_setresgid='$d_setresgid'
14829 d_setresuid='$d_setresuid'
14830 d_setreuid='$d_setreuid'
14831 d_setrgid='$d_setrgid'
14832 d_setruid='$d_setruid'
14833 d_setsent='$d_setsent'
14834 d_setsid='$d_setsid'
14835 d_setspent='$d_setspent'
14836 d_setvbuf='$d_setvbuf'
14837 d_sfio='$d_sfio'
14838 d_shm='$d_shm'
14839 d_shmat='$d_shmat'
14840 d_shmatprototype='$d_shmatprototype'
14841 d_shmctl='$d_shmctl'
14842 d_shmdt='$d_shmdt'
14843 d_shmget='$d_shmget'
14844 d_sigaction='$d_sigaction'
14845 d_sigsetjmp='$d_sigsetjmp'
14846 d_socket='$d_socket'
14847 d_socklen_t='$d_socklen_t'
14848 d_sockpair='$d_sockpair'
14849 d_sqrtl='$d_sqrtl'
14850 d_statblks='$d_statblks'
14851 d_statfs_f_flags='$d_statfs_f_flags'
14852 d_statfs_s='$d_statfs_s'
14853 d_statvfs='$d_statvfs'
14854 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14855 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14856 d_stdio_stream_array='$d_stdio_stream_array'
14857 d_stdiobase='$d_stdiobase'
14858 d_stdstdio='$d_stdstdio'
14859 d_strchr='$d_strchr'
14860 d_strcoll='$d_strcoll'
14861 d_strctcpy='$d_strctcpy'
14862 d_strerrm='$d_strerrm'
14863 d_strerror='$d_strerror'
14864 d_strtod='$d_strtod'
14865 d_strtol='$d_strtol'
14866 d_strtold='$d_strtold'
14867 d_strtoll='$d_strtoll'
14868 d_strtoul='$d_strtoul'
14869 d_strtoull='$d_strtoull'
14870 d_strtouq='$d_strtouq'
14871 d_strxfrm='$d_strxfrm'
14872 d_suidsafe='$d_suidsafe'
14873 d_symlink='$d_symlink'
14874 d_syscall='$d_syscall'
14875 d_sysconf='$d_sysconf'
14876 d_sysernlst='$d_sysernlst'
14877 d_syserrlst='$d_syserrlst'
14878 d_system='$d_system'
14879 d_tcgetpgrp='$d_tcgetpgrp'
14880 d_tcsetpgrp='$d_tcsetpgrp'
14881 d_telldir='$d_telldir'
14882 d_telldirproto='$d_telldirproto'
14883 d_time='$d_time'
14884 d_times='$d_times'
14885 d_truncate='$d_truncate'
14886 d_tzname='$d_tzname'
14887 d_umask='$d_umask'
14888 d_uname='$d_uname'
14889 d_union_semun='$d_union_semun'
14890 d_ustat='$d_ustat'
14891 d_vendorbin='$d_vendorbin'
14892 d_vendorlib='$d_vendorlib'
14893 d_vfork='$d_vfork'
14894 d_void_closedir='$d_void_closedir'
14895 d_voidsig='$d_voidsig'
14896 d_voidtty='$d_voidtty'
14897 d_volatile='$d_volatile'
14898 d_vprintf='$d_vprintf'
14899 d_wait4='$d_wait4'
14900 d_waitpid='$d_waitpid'
14901 d_wcstombs='$d_wcstombs'
14902 d_wctomb='$d_wctomb'
14903 d_xenix='$d_xenix'
14904 date='$date'
14905 db_hashtype='$db_hashtype'
14906 db_prefixtype='$db_prefixtype'
14907 defvoidused='$defvoidused'
14908 direntrytype='$direntrytype'
14909 dlext='$dlext'
14910 dlsrc='$dlsrc'
14911 doublesize='$doublesize'
14912 drand01='$drand01'
14913 dynamic_ext='$dynamic_ext'
14914 eagain='$eagain'
14915 ebcdic='$ebcdic'
14916 echo='$echo'
14917 egrep='$egrep'
14918 emacs='$emacs'
14919 eunicefix='$eunicefix'
14920 exe_ext='$exe_ext'
14921 expr='$expr'
14922 extensions='$extensions'
14923 fflushNULL='$fflushNULL'
14924 fflushall='$fflushall'
14925 find='$find'
14926 firstmakefile='$firstmakefile'
14927 flex='$flex'
14928 fpossize='$fpossize'
14929 fpostype='$fpostype'
14930 freetype='$freetype'
14931 full_ar='$full_ar'
14932 full_csh='$full_csh'
14933 full_sed='$full_sed'
14934 gccversion='$gccversion'
14935 gidformat='$gidformat'
14936 gidsign='$gidsign'
14937 gidsize='$gidsize'
14938 gidtype='$gidtype'
14939 glibpth='$glibpth'
14940 grep='$grep'
14941 groupcat='$groupcat'
14942 groupstype='$groupstype'
14943 gzip='$gzip'
14944 h_fcntl='$h_fcntl'
14945 h_sysfile='$h_sysfile'
14946 hint='$hint'
14947 hostcat='$hostcat'
14948 huge='$huge'
14949 i16size='$i16size'
14950 i16type='$i16type'
14951 i32size='$i32size'
14952 i32type='$i32type'
14953 i64size='$i64size'
14954 i64type='$i64type'
14955 i8size='$i8size'
14956 i8type='$i8type'
14957 i_arpainet='$i_arpainet'
14958 i_bsdioctl='$i_bsdioctl'
14959 i_db='$i_db'
14960 i_dbm='$i_dbm'
14961 i_dirent='$i_dirent'
14962 i_dld='$i_dld'
14963 i_dlfcn='$i_dlfcn'
14964 i_fcntl='$i_fcntl'
14965 i_float='$i_float'
14966 i_gdbm='$i_gdbm'
14967 i_grp='$i_grp'
14968 i_iconv='$i_iconv'
14969 i_inttypes='$i_inttypes'
14970 i_limits='$i_limits'
14971 i_locale='$i_locale'
14972 i_machcthr='$i_machcthr'
14973 i_malloc='$i_malloc'
14974 i_math='$i_math'
14975 i_memory='$i_memory'
14976 i_mntent='$i_mntent'
14977 i_ndbm='$i_ndbm'
14978 i_netdb='$i_netdb'
14979 i_neterrno='$i_neterrno'
14980 i_netinettcp='$i_netinettcp'
14981 i_niin='$i_niin'
14982 i_poll='$i_poll'
14983 i_pthread='$i_pthread'
14984 i_pwd='$i_pwd'
14985 i_rpcsvcdbm='$i_rpcsvcdbm'
14986 i_sfio='$i_sfio'
14987 i_sgtty='$i_sgtty'
14988 i_shadow='$i_shadow'
14989 i_socks='$i_socks'
14990 i_stdarg='$i_stdarg'
14991 i_stddef='$i_stddef'
14992 i_stdlib='$i_stdlib'
14993 i_string='$i_string'
14994 i_sysaccess='$i_sysaccess'
14995 i_sysdir='$i_sysdir'
14996 i_sysfile='$i_sysfile'
14997 i_sysfilio='$i_sysfilio'
14998 i_sysin='$i_sysin'
14999 i_sysioctl='$i_sysioctl'
15000 i_syslog='$i_syslog'
15001 i_sysmman='$i_sysmman'
15002 i_sysmode='$i_sysmode'
15003 i_sysmount='$i_sysmount'
15004 i_sysndir='$i_sysndir'
15005 i_sysparam='$i_sysparam'
15006 i_sysresrc='$i_sysresrc'
15007 i_syssecrt='$i_syssecrt'
15008 i_sysselct='$i_sysselct'
15009 i_syssockio='$i_syssockio'
15010 i_sysstat='$i_sysstat'
15011 i_sysstatfs='$i_sysstatfs'
15012 i_sysstatvfs='$i_sysstatvfs'
15013 i_systime='$i_systime'
15014 i_systimek='$i_systimek'
15015 i_systimes='$i_systimes'
15016 i_systypes='$i_systypes'
15017 i_sysuio='$i_sysuio'
15018 i_sysun='$i_sysun'
15019 i_sysutsname='$i_sysutsname'
15020 i_sysvfs='$i_sysvfs'
15021 i_syswait='$i_syswait'
15022 i_termio='$i_termio'
15023 i_termios='$i_termios'
15024 i_time='$i_time'
15025 i_unistd='$i_unistd'
15026 i_ustat='$i_ustat'
15027 i_utime='$i_utime'
15028 i_values='$i_values'
15029 i_varargs='$i_varargs'
15030 i_varhdr='$i_varhdr'
15031 i_vfork='$i_vfork'
15032 ignore_versioned_solibs='$ignore_versioned_solibs'
15033 inc_version_list='$inc_version_list'
15034 inc_version_list_init='$inc_version_list_init'
15035 incpath='$incpath'
15036 inews='$inews'
15037 installarchlib='$installarchlib'
15038 installbin='$installbin'
15039 installman1dir='$installman1dir'
15040 installman3dir='$installman3dir'
15041 installprefix='$installprefix'
15042 installprefixexp='$installprefixexp'
15043 installprivlib='$installprivlib'
15044 installscript='$installscript'
15045 installsitearch='$installsitearch'
15046 installsitebin='$installsitebin'
15047 installsitelib='$installsitelib'
15048 installstyle='$installstyle'
15049 installusrbinperl='$installusrbinperl'
15050 installvendorbin='$installvendorbin'
15051 installvendorlib='$installvendorlib'
15052 intsize='$intsize'
15053 ivdformat='$ivdformat'
15054 ivsize='$ivsize'
15055 ivtype='$ivtype'
15056 known_extensions='$known_extensions'
15057 ksh='$ksh'
15058 large='$large'
15059 ld='$ld'
15060 lddlflags='$lddlflags'
15061 ldflags='$ldflags'
15062 ldlibpthname='$ldlibpthname'
15063 less='$less'
15064 lib_ext='$lib_ext'
15065 libc='$libc'
15066 libperl='$libperl'
15067 libpth='$libpth'
15068 libs='$libs'
15069 libsdirs='$libsdirs'
15070 libsfiles='$libsfiles'
15071 libsfound='$libsfound'
15072 libspath='$libspath'
15073 libswanted='$libswanted'
15074 line='$line'
15075 lint='$lint'
15076 lkflags='$lkflags'
15077 ln='$ln'
15078 lns='$lns'
15079 locincpth='$locincpth'
15080 loclibpth='$loclibpth'
15081 longdblsize='$longdblsize'
15082 longlongsize='$longlongsize'
15083 longsize='$longsize'
15084 lp='$lp'
15085 lpr='$lpr'
15086 ls='$ls'
15087 lseeksize='$lseeksize'
15088 lseektype='$lseektype'
15089 mail='$mail'
15090 mailx='$mailx'
15091 make='$make'
15092 make_set_make='$make_set_make'
15093 mallocobj='$mallocobj'
15094 mallocsrc='$mallocsrc'
15095 malloctype='$malloctype'
15096 man1dir='$man1dir'
15097 man1direxp='$man1direxp'
15098 man1ext='$man1ext'
15099 man3dir='$man3dir'
15100 man3direxp='$man3direxp'
15101 man3ext='$man3ext'
15102 medium='$medium'
15103 mips_type='$mips_type'
15104 mkdir='$mkdir'
15105 mmaptype='$mmaptype'
15106 models='$models'
15107 modetype='$modetype'
15108 more='$more'
15109 multiarch='$multiarch'
15110 mv='$mv'
15111 myarchname='$myarchname'
15112 mydomain='$mydomain'
15113 myhostname='$myhostname'
15114 myuname='$myuname'
15115 n='$n'
15116 netdb_hlen_type='$netdb_hlen_type'
15117 netdb_host_type='$netdb_host_type'
15118 netdb_name_type='$netdb_name_type'
15119 netdb_net_type='$netdb_net_type'
15120 nm='$nm'
15121 nm_opt='$nm_opt'
15122 nm_so_opt='$nm_so_opt'
15123 nonxs_ext='$nonxs_ext'
15124 nroff='$nroff'
15125 nvsize='$nvsize'
15126 nvtype='$nvtype'
15127 o_nonblock='$o_nonblock'
15128 obj_ext='$obj_ext'
15129 old_pthread_create_joinable='$old_pthread_create_joinable'
15130 optimize='$optimize'
15131 orderlib='$orderlib'
15132 osname='$osname'
15133 osvers='$osvers'
15134 package='$package'
15135 pager='$pager'
15136 passcat='$passcat'
15137 patchlevel='$patchlevel'
15138 path_sep='$path_sep'
15139 perl='$perl'
15140 perladmin='$perladmin'
15141 perlpath='$perlpath'
15142 pg='$pg'
15143 phostname='$phostname'
15144 pidtype='$pidtype'
15145 plibpth='$plibpth'
15146 pm_apiversion='$pm_apiversion'
15147 pmake='$pmake'
15148 pr='$pr'
15149 prefix='$prefix'
15150 prefixexp='$prefixexp'
15151 privlib='$privlib'
15152 privlibexp='$privlibexp'
15153 prototype='$prototype'
15154 ptrsize='$ptrsize'
15155 quadkind='$quadkind'
15156 quadtype='$quadtype'
15157 randbits='$randbits'
15158 randfunc='$randfunc'
15159 randseedtype='$randseedtype'
15160 ranlib='$ranlib'
15161 rd_nodata='$rd_nodata'
15162 rm='$rm'
15163 rmail='$rmail'
15164 runnm='$runnm'
15165 sPRIEldbl='$sPRIEldbl'
15166 sPRIFldbl='$sPRIFldbl'
15167 sPRIGldbl='$sPRIGldbl'
15168 sPRIX64='$sPRIX64'
15169 sPRId64='$sPRId64'
15170 sPRIeldbl='$sPRIeldbl'
15171 sPRIfldbl='$sPRIfldbl'
15172 sPRIgldbl='$sPRIgldbl'
15173 sPRIi64='$sPRIi64'
15174 sPRIo64='$sPRIo64'
15175 sPRIu64='$sPRIu64'
15176 sPRIx64='$sPRIx64'
15177 sched_yield='$sched_yield'
15178 scriptdir='$scriptdir'
15179 scriptdirexp='$scriptdirexp'
15180 sed='$sed'
15181 seedfunc='$seedfunc'
15182 selectminbits='$selectminbits'
15183 selecttype='$selecttype'
15184 sendmail='$sendmail'
15185 sh='$sh'
15186 shar='$shar'
15187 sharpbang='$sharpbang'
15188 shmattype='$shmattype'
15189 shortsize='$shortsize'
15190 shrpenv='$shrpenv'
15191 shsharp='$shsharp'
15192 sig_count='$sig_count'
15193 sig_name='$sig_name'
15194 sig_name_init='$sig_name_init'
15195 sig_num='$sig_num'
15196 sig_num_init='$sig_num_init'
15197 signal_t='$signal_t'
15198 sitearch='$sitearch'
15199 sitearchexp='$sitearchexp'
15200 sitebin='$sitebin'
15201 sitebinexp='$sitebinexp'
15202 sitelib='$sitelib'
15203 sitelibexp='$sitelibexp'
15204 siteprefix='$siteprefix'
15205 siteprefixexp='$siteprefixexp'
15206 sizetype='$sizetype'
15207 sleep='$sleep'
15208 smail='$smail'
15209 small='$small'
15210 so='$so'
15211 sockethdr='$sockethdr'
15212 socketlib='$socketlib'
15213 sort='$sort'
15214 spackage='$spackage'
15215 spitshell='$spitshell'
15216 split='$split'
15217 src='$src'
15218 ssizetype='$ssizetype'
15219 startperl='$startperl'
15220 startsh='$startsh'
15221 static_ext='$static_ext'
15222 stdchar='$stdchar'
15223 stdio_base='$stdio_base'
15224 stdio_bufsiz='$stdio_bufsiz'
15225 stdio_cnt='$stdio_cnt'
15226 stdio_filbuf='$stdio_filbuf'
15227 stdio_ptr='$stdio_ptr'
15228 stdio_stream_array='$stdio_stream_array'
15229 strings='$strings'
15230 submit='$submit'
15231 subversion='$subversion'
15232 sysman='$sysman'
15233 tail='$tail'
15234 tar='$tar'
15235 tbl='$tbl'
15236 tee='$tee'
15237 test='$test'
15238 timeincl='$timeincl'
15239 timetype='$timetype'
15240 touch='$touch'
15241 tr='$tr'
15242 trnl='$trnl'
15243 troff='$troff'
15244 u16size='$u16size'
15245 u16type='$u16type'
15246 u32size='$u32size'
15247 u32type='$u32type'
15248 u64size='$u64size'
15249 u64type='$u64type'
15250 u8size='$u8size'
15251 u8type='$u8type'
15252 uidformat='$uidformat'
15253 uidsign='$uidsign'
15254 uidsize='$uidsize'
15255 uidtype='$uidtype'
15256 uname='$uname'
15257 uniq='$uniq'
15258 uquadtype='$uquadtype'
15259 use5005threads='$use5005threads'
15260 use64bits='$use64bits'
15261 usedl='$usedl'
15262 useithreads='$useithreads'
15263 uselargefiles='$uselargefiles'
15264 uselongdouble='$uselongdouble'
15265 usemorebits='$usemorebits'
15266 usemultiplicity='$usemultiplicity'
15267 usemymalloc='$usemymalloc'
15268 usenm='$usenm'
15269 useopcode='$useopcode'
15270 useperlio='$useperlio'
15271 useposix='$useposix'
15272 usesfio='$usesfio'
15273 useshrplib='$useshrplib'
15274 usesocks='$usesocks'
15275 usethreads='$usethreads'
15276 usevendorprefix='$usevendorprefix'
15277 usevfork='$usevfork'
15278 usrinc='$usrinc'
15279 uuname='$uuname'
15280 uvoformat='$uvoformat'
15281 uvsize='$uvsize'
15282 uvtype='$uvtype'
15283 uvuformat='$uvuformat'
15284 uvxformat='$uvxformat'
15285 vendorbin='$vendorbin'
15286 vendorbinexp='$vendorbinexp'
15287 vendorlib='$vendorlib'
15288 vendorlibexp='$vendorlibexp'
15289 vendorprefix='$vendorprefix'
15290 vendorprefixexp='$vendorprefixexp'
15291 version='$version'
15292 vi='$vi'
15293 voidflags='$voidflags'
15294 xlibpth='$xlibpth'
15295 xs_apiversion='$xs_apiversion'
15296 zcat='$zcat'
15297 zip='$zip'
15298 EOT
15299
15300 : Add in command line options if available
15301 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15302
15303 : add special variables
15304 $test -f $src/patchlevel.h && \
15305 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15306 echo "CONFIGDOTSH=true" >>config.sh
15307
15308 : propagate old symbols
15309 if $test -f UU/config.sh; then
15310         <UU/config.sh sort | uniq >UU/oldconfig.sh
15311         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15312         sort | uniq -u >UU/oldsyms
15313         set X `cat UU/oldsyms`
15314         shift
15315         case $# in
15316         0) ;;
15317         *)
15318                 cat <<EOM
15319 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15320 EOM
15321                 echo "# Variables propagated from previous config.sh file." >>config.sh
15322                 for sym in `cat UU/oldsyms`; do
15323                         echo "    Propagating $hint variable "'$'"$sym..."
15324                         eval 'tmp="$'"${sym}"'"'
15325                         echo "$tmp" | \
15326                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15327                 done
15328                 ;;
15329         esac
15330 fi
15331
15332 : Finish up by extracting the .SH files
15333 case "$alldone" in
15334 exit)
15335         $rm -rf UU
15336         echo "Done."
15337         exit 0
15338         ;;
15339 cont)
15340         ;;
15341 '')
15342         dflt=''
15343         nostick=true
15344         $cat <<EOM
15345
15346 If you'd like to make any changes to the config.sh file before I begin
15347 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15348
15349 EOM
15350         rp="Press return or use a shell escape to edit config.sh:"
15351         . UU/myread
15352         nostick=''
15353         case "$ans" in
15354         '') ;;
15355         *) : in case they cannot read
15356                 sh 1>&4 -c "$ans";;
15357         esac
15358         ;;
15359 esac
15360
15361 : if this fails, just run all the .SH files by hand
15362 . ./config.sh
15363
15364 echo " "
15365 exec 1>&4
15366 . ./UU/extract
15367
15368 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15369         dflt=y
15370         case "$silent" in
15371         true) ;;
15372         *)
15373                 $cat <<EOM
15374
15375 Now you need to generate make dependencies by running "$make depend".
15376 You might prefer to run it in background: "$make depend > makedepend.out &"
15377 It can take a while, so you might not want to run it right now.
15378
15379 EOM
15380                 ;;
15381         esac
15382         rp="Run $make depend now?"
15383         . UU/myread
15384         case "$ans" in
15385         y*)
15386                 $make depend && echo "Now you must run a $make."
15387                 ;;
15388         *)
15389                 echo "You must run '$make depend' then '$make'."
15390                 ;;
15391         esac
15392 elif test -f [Mm]akefile; then
15393         echo " "
15394         echo "Now you must run a $make."
15395 else
15396         echo "Done."
15397 fi
15398
15399 if $test -f Policy.sh; then
15400     $cat <<EOM
15401
15402 If you compile $package on a different machine or from a different object
15403 directory, copy the Policy.sh file from this object directory to the
15404 new one before you run Configure -- this will help you with most of
15405 the policy defaults.
15406
15407 EOM
15408 fi
15409 if $test -f config.msg; then
15410     echo "Hmm.  I also noted the following information while running:"
15411     echo " "
15412     $cat config.msg >&4
15413     $rm -f config.msg
15414 fi
15415 $rm -f kit*isdone ark*isdone
15416 $rm -rf UU
15417
15418 : End of Configure
15419