lib scan fix
[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 Wed Feb  9 04:26:02 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_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_iconv=''
403 d_inetaton=''
404 d_int64t=''
405 d_isascii=''
406 d_killpg=''
407 d_lchown=''
408 d_ldbl_dig=''
409 d_link=''
410 d_locconv=''
411 d_lockf=''
412 d_longdbl=''
413 longdblsize=''
414 d_longlong=''
415 longlongsize=''
416 d_lstat=''
417 d_mblen=''
418 d_mbstowcs=''
419 d_mbtowc=''
420 d_memchr=''
421 d_memcmp=''
422 d_memcpy=''
423 d_memmove=''
424 d_memset=''
425 d_mkdir=''
426 d_mkdtemp=''
427 d_mkfifo=''
428 d_mkstemp=''
429 d_mkstemps=''
430 d_mktime=''
431 d_mmap=''
432 mmaptype=''
433 d_mprotect=''
434 d_msg=''
435 d_msgctl=''
436 d_msgget=''
437 d_msgrcv=''
438 d_msgsnd=''
439 d_msync=''
440 d_munmap=''
441 d_nice=''
442 d_open3=''
443 d_fpathconf=''
444 d_pathconf=''
445 d_pause=''
446 d_pipe=''
447 d_poll=''
448 d_portable=''
449 d_old_pthread_create_joinable=''
450 old_pthread_create_joinable=''
451 d_pthread_yield=''
452 d_sched_yield=''
453 sched_yield=''
454 d_readdir=''
455 d_rewinddir=''
456 d_seekdir=''
457 d_telldir=''
458 d_readlink=''
459 d_rename=''
460 d_rmdir=''
461 d_safebcpy=''
462 d_safemcpy=''
463 d_sanemcmp=''
464 d_select=''
465 d_sem=''
466 d_semctl=''
467 d_semget=''
468 d_semop=''
469 d_setegid=''
470 d_seteuid=''
471 d_setgrent=''
472 d_setgrps=''
473 d_sethent=''
474 d_setlinebuf=''
475 d_setlocale=''
476 d_setnent=''
477 d_setpent=''
478 d_setpgid=''
479 d_setpgrp2=''
480 d_bsdsetpgrp=''
481 d_setpgrp=''
482 d_setprior=''
483 d_setpwent=''
484 d_setregid=''
485 d_setresgid=''
486 d_setresuid=''
487 d_setreuid=''
488 d_setrgid=''
489 d_setruid=''
490 d_setsent=''
491 d_setsid=''
492 d_setspent=''
493 d_setvbuf=''
494 d_sfio=''
495 usesfio=''
496 d_shm=''
497 d_shmat=''
498 d_shmatprototype=''
499 shmattype=''
500 d_shmctl=''
501 d_shmdt=''
502 d_shmget=''
503 d_sigaction=''
504 d_sigsetjmp=''
505 d_msg_ctrunc=''
506 d_msg_dontroute=''
507 d_msg_oob=''
508 d_msg_peek=''
509 d_msg_proxy=''
510 d_oldsock=''
511 d_scm_rights=''
512 d_socket=''
513 d_sockpair=''
514 sockethdr=''
515 socketlib=''
516 d_sqrtl=''
517 d_statblks=''
518 d_statfs_f_flags=''
519 d_statfs_s=''
520 d_fstatvfs=''
521 d_statvfs=''
522 d_stdio_cnt_lval=''
523 d_stdio_ptr_lval=''
524 d_stdiobase=''
525 d_stdstdio=''
526 stdio_base=''
527 stdio_bufsiz=''
528 stdio_cnt=''
529 stdio_filbuf=''
530 stdio_ptr=''
531 d_index=''
532 d_strchr=''
533 d_strcoll=''
534 d_strctcpy=''
535 d_strerrm=''
536 d_strerror=''
537 d_sysernlst=''
538 d_syserrlst=''
539 d_strtod=''
540 d_strtol=''
541 d_strtold=''
542 d_strtoll=''
543 d_strtoul=''
544 d_strtoull=''
545 d_strtouq=''
546 d_strxfrm=''
547 d_symlink=''
548 d_syscall=''
549 d_sysconf=''
550 d_system=''
551 d_tcgetpgrp=''
552 d_tcsetpgrp=''
553 d_telldirproto=''
554 d_time=''
555 timetype=''
556 clocktype=''
557 d_times=''
558 d_truncate=''
559 d_tzname=''
560 d_umask=''
561 d_semctl_semid_ds=''
562 d_semctl_semun=''
563 d_union_semun=''
564 d_ustat=''
565 d_vfork=''
566 usevfork=''
567 d_voidsig=''
568 signal_t=''
569 d_volatile=''
570 d_charvspr=''
571 d_vprintf=''
572 d_wait4=''
573 d_waitpid=''
574 d_wcstombs=''
575 d_wctomb=''
576 dlext=''
577 cccdlflags=''
578 ccdlflags=''
579 dlsrc=''
580 ld=''
581 lddlflags=''
582 usedl=''
583 doublesize=''
584 ebcdic=''
585 fflushNULL=''
586 fflushall=''
587 fpossize=''
588 fpostype=''
589 gidformat=''
590 gidsign=''
591 gidsize=''
592 gidtype=''
593 groupstype=''
594 h_fcntl=''
595 h_sysfile=''
596 i_arpainet=''
597 db_hashtype=''
598 db_prefixtype=''
599 i_db=''
600 i_dbm=''
601 i_rpcsvcdbm=''
602 d_dirnamlen=''
603 direntrytype=''
604 i_dirent=''
605 i_dld=''
606 i_dlfcn=''
607 i_fcntl=''
608 i_float=''
609 i_gdbm=''
610 d_grpasswd=''
611 i_grp=''
612 i_iconv=''
613 i_inttypes=''
614 i_limits=''
615 i_locale=''
616 i_machcthr=''
617 i_malloc=''
618 i_math=''
619 i_memory=''
620 i_mntent=''
621 i_ndbm=''
622 i_netdb=''
623 i_neterrno=''
624 i_netinettcp=''
625 i_niin=''
626 i_sysin=''
627 i_poll=''
628 i_pthread=''
629 d_pwage=''
630 d_pwchange=''
631 d_pwclass=''
632 d_pwcomment=''
633 d_pwexpire=''
634 d_pwgecos=''
635 d_pwpasswd=''
636 d_pwquota=''
637 i_pwd=''
638 i_sfio=''
639 i_shadow=''
640 i_socks=''
641 i_stddef=''
642 i_stdlib=''
643 i_string=''
644 strings=''
645 i_sysaccess=''
646 i_sysdir=''
647 i_sysfile=''
648 d_voidtty=''
649 i_bsdioctl=''
650 i_sysfilio=''
651 i_sysioctl=''
652 i_syssockio=''
653 i_sysmman=''
654 i_sysmount=''
655 i_sysndir=''
656 i_sysparam=''
657 i_sysresrc=''
658 i_syssecrt=''
659 i_sysselct=''
660 i_sysstat=''
661 i_sysstatfs=''
662 i_sysstatvfs=''
663 i_systimes=''
664 i_systypes=''
665 i_sysuio=''
666 i_sysun=''
667 i_sysvfs=''
668 i_syswait=''
669 i_sgtty=''
670 i_termio=''
671 i_termios=''
672 i_systime=''
673 i_systimek=''
674 i_time=''
675 timeincl=''
676 i_unistd=''
677 i_ustat=''
678 i_utime=''
679 i_values=''
680 i_stdarg=''
681 i_varargs=''
682 i_varhdr=''
683 i_vfork=''
684 inc_version_list=''
685 inc_version_list_init=''
686 installprefix=''
687 installprefixexp=''
688 installstyle=''
689 installusrbinperl=''
690 intsize=''
691 longsize=''
692 shortsize=''
693 d_fpos64_t=''
694 d_off64_t=''
695 libc=''
696 ldlibpthname=''
697 libperl=''
698 shrpenv=''
699 useshrplib=''
700 glibpth=''
701 libpth=''
702 loclibpth=''
703 plibpth=''
704 xlibpth=''
705 ignore_versioned_solibs=''
706 libs=''
707 libsdirs=''
708 libsfiles=''
709 libsfound=''
710 lns=''
711 d_PRIEldbl=''
712 d_PRIFldbl=''
713 d_PRIGldbl=''
714 d_PRIeldbl=''
715 d_PRIfldbl=''
716 d_PRIgldbl=''
717 sPRIEldbl=''
718 sPRIFldbl=''
719 sPRIGldbl=''
720 sPRIeldbl=''
721 sPRIfldbl=''
722 sPRIgldbl=''
723 lseeksize=''
724 lseektype=''
725 make_set_make=''
726 d_mymalloc=''
727 freetype=''
728 mallocobj=''
729 mallocsrc=''
730 malloctype=''
731 usemymalloc=''
732 installman1dir=''
733 man1dir=''
734 man1direxp=''
735 man1ext=''
736 installman3dir=''
737 man3dir=''
738 man3direxp=''
739 man3ext=''
740 huge=''
741 large=''
742 medium=''
743 models=''
744 small=''
745 split=''
746 modetype=''
747 multiarch=''
748 mydomain=''
749 myhostname=''
750 phostname=''
751 c=''
752 n=''
753 d_eofnblk=''
754 eagain=''
755 o_nonblock=''
756 rd_nodata=''
757 netdb_hlen_type=''
758 netdb_host_type=''
759 netdb_name_type=''
760 netdb_net_type=''
761 groupcat=''
762 hostcat=''
763 passcat=''
764 orderlib=''
765 ranlib=''
766 package=''
767 spackage=''
768 pager=''
769 api_revision=''
770 api_subversion=''
771 api_version=''
772 api_versionstring=''
773 patchlevel=''
774 subversion=''
775 version=''
776 perladmin=''
777 perlpath=''
778 d_nv_preserves_uv=''
779 i16size=''
780 i16type=''
781 i32size=''
782 i32type=''
783 i64size=''
784 i64type=''
785 i8size=''
786 i8type=''
787 ivsize=''
788 ivtype=''
789 nvsize=''
790 nvtype=''
791 u16size=''
792 u16type=''
793 u32size=''
794 u32type=''
795 u64size=''
796 u64type=''
797 u8size=''
798 u8type=''
799 uvsize=''
800 uvtype=''
801 ivdformat=''
802 uvoformat=''
803 uvuformat=''
804 uvxformat=''
805 pidtype=''
806 prefix=''
807 prefixexp=''
808 installprivlib=''
809 privlib=''
810 privlibexp=''
811 prototype=''
812 ptrsize=''
813 d_PRIX64=''
814 d_PRId64=''
815 d_PRIi64=''
816 d_PRIo64=''
817 d_PRIu64=''
818 d_PRIx64=''
819 sPRIX64=''
820 sPRId64=''
821 sPRIi64=''
822 sPRIo64=''
823 sPRIu64=''
824 sPRIx64=''
825 d_quad=''
826 quadkind=''
827 quadtype=''
828 uquadtype=''
829 drand01=''
830 randbits=''
831 randfunc=''
832 randseedtype=''
833 seedfunc=''
834 installscript=''
835 scriptdir=''
836 scriptdirexp=''
837 selectminbits=''
838 selecttype=''
839 sh=''
840 sig_count=''
841 sig_name=''
842 sig_name_init=''
843 sig_num=''
844 sig_num_init=''
845 installsitearch=''
846 sitearch=''
847 sitearchexp=''
848 installsitebin=''
849 sitebin=''
850 sitebinexp=''
851 installsitelib=''
852 sitelib=''
853 sitelibexp=''
854 siteprefix=''
855 siteprefixexp=''
856 sizetype=''
857 so=''
858 sharpbang=''
859 shsharp=''
860 spitshell=''
861 src=''
862 ssizetype=''
863 startperl=''
864 startsh=''
865 stdchar=''
866 d_stdio_stream_array=''
867 stdio_stream_array=''
868 sysman=''
869 trnl=''
870 uidformat=''
871 uidsign=''
872 uidsize=''
873 uidtype=''
874 archname64=''
875 use64bits=''
876 uselargefiles=''
877 uselongdouble=''
878 uselonglong=''
879 usemorebits=''
880 usemultiplicity=''
881 nm_opt=''
882 nm_so_opt=''
883 runnm=''
884 usenm=''
885 useperlio=''
886 usesocks=''
887 d_oldpthreads=''
888 use5005threads=''
889 useithreads=''
890 usethreads=''
891 incpath=''
892 mips_type=''
893 usrinc=''
894 d_vendorbin=''
895 installvendorbin=''
896 vendorbin=''
897 vendorbinexp=''
898 d_vendorlib=''
899 installvendorlib=''
900 vendorlib=''
901 vendorlibexp=''
902 usevendorprefix=''
903 vendorprefix=''
904 vendorprefixexp=''
905 defvoidused=''
906 voidflags=''
907 pm_apiversion=''
908 xs_apiversion=''
909 CONFIG=''
910
911 define='define'
912 undef='undef'
913 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
914 rmlist=''
915
916 : We must find out about Eunice early
917 eunicefix=':'
918 if test -f /etc/unixtovms; then
919         eunicefix=/etc/unixtovms
920 fi
921 if test -f /etc/unixtovms.exe; then
922         eunicefix=/etc/unixtovms.exe
923 fi
924
925 i_whoami=''
926 : set useposix=false in your hint file to disable the POSIX extension.
927 useposix=true
928 : set useopcode=false in your hint file to disable the Opcode extension.
929 useopcode=true
930 : Trailing extension.  Override this in a hint file, if needed.
931 _exe=''
932 : Extra object files, if any, needed on this platform.
933 archobjs=''
934 : Possible local include directories to search.
935 : Set locincpth to "" in a hint file to defeat local include searches.
936 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
937 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
938 :
939 : no include file wanted by default
940 inclwanted=''
941
942 groupstype=''
943 : change the next line if compiling for Xenix/286 on Xenix/386
944 xlibpth='/usr/lib/386 /lib/386'
945
946 : Possible local library directories to search.
947 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
948 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
949
950 : general looking path for locating libraries
951 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
952 glibpth="$glibpth /lib /usr/lib $xlibpth"
953 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
954 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
955
956 : Private path used by Configure to find libraries.  Its value
957 : is prepended to libpth. This variable takes care of special
958 : machines, like the mips.  Usually, it should be empty.
959 plibpth=''
960
961 : default library list
962 libswanted=''
963 : some systems want to use only the non-versioned libso:s
964 ignore_versioned_solibs=''
965 : set usemultiplicity on the Configure command line to enable multiplicity.
966 : set usesocks on the Configure command line to enable socks.
967 : set usethreads on the Configure command line to enable threads.
968 : full support for void wanted by default
969 defvoidused=15
970
971 : List of libraries we want.
972 : If anyone needs -lnet, put it in a hint file.
973 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
974 libswanted="$libswanted dld ld sun m c cposix posix"
975 libswanted="$libswanted ndir dir crypt sec"
976 libswanted="$libswanted ucb bsd BSD PW x"
977 : We probably want to search /usr/shlib before most other libraries.
978 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
979 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
980 glibpth="/usr/shlib $glibpth"
981 : Do not use vfork unless overridden by a hint file.
982 usevfork=false
983
984 : Find the basic shell for Bourne shell scripts
985 case "$sh" in
986 '')
987         case "$SYSTYPE" in
988         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
989         *) xxx='/bin/sh';;
990         esac
991         if test -f "$xxx"; then
992                 sh="$xxx"
993         else
994                 : Build up a list and do a single loop so we can 'break' out.
995                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
996                 for xxx in sh bash ksh pdksh ash; do
997                         for p in $pth; do
998                                 try="$try ${p}/${xxx}"
999                         done
1000                 done
1001                 for xxx in $try; do
1002                         if test -f "$xxx"; then
1003                                 sh="$xxx";
1004                                 break
1005                         elif test -f "$xxx.exe"; then
1006                                 sh="$xxx";
1007                                 break
1008                         fi
1009                 done
1010         fi
1011         ;;
1012 esac
1013
1014 case "$sh" in
1015 '')     cat <<EOM >&2
1016 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1017
1018 Usually it's in /bin/sh.  How did you even get this far?
1019 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1020 we'll try to straighten this all out.
1021 EOM
1022         exit 1
1023         ;;
1024 esac
1025
1026 : see if sh knows # comments
1027 if `$sh -c '#' >/dev/null 2>&1`; then
1028         shsharp=true
1029         spitshell=cat
1030         xcat=/bin/cat
1031         test -f $xcat || xcat=/usr/bin/cat
1032         echo "#!$xcat" >try
1033         $eunicefix try
1034         chmod +x try
1035         ./try > today
1036         if test -s today; then
1037                 sharpbang='#!'
1038         else
1039                 echo "#! $xcat" > try
1040                 $eunicefix try
1041                 chmod +x try
1042                 ./try > today
1043                 if test -s today; then
1044                         sharpbang='#! '
1045                 else
1046                         sharpbang=': use '
1047                 fi
1048         fi
1049 else
1050         echo " "
1051         echo "Your $sh doesn't grok # comments--I will strip them later on."
1052         shsharp=false
1053         cd ..
1054         echo "exec grep -v '^[  ]*#'" >spitshell
1055         chmod +x spitshell
1056         $eunicefix spitshell
1057         spitshell=`pwd`/spitshell
1058         cd UU
1059         echo "I presume that if # doesn't work, #! won't work either!"
1060         sharpbang=': use '
1061 fi
1062 rm -f try today
1063
1064 : figure out how to guarantee sh startup
1065 case "$startsh" in
1066 '') startsh=${sharpbang}${sh} ;;
1067 *)
1068 esac
1069 cat >try <<EOSS
1070 $startsh
1071 set abc
1072 test "$?abc" != 1
1073 EOSS
1074
1075 chmod +x try
1076 $eunicefix try
1077 if ./try; then
1078         : echo "Yup, it does."
1079 else
1080         echo "Hmm... '$startsh' does not guarantee sh startup..."
1081         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1082 fi
1083 rm -f try
1084
1085
1086 : Save command line options in file UU/cmdline.opt for later use in
1087 : generating config.sh.
1088 cat > cmdline.opt <<EOSH
1089 # Configure command line arguments.
1090 config_arg0='$0'
1091 config_args='$*'
1092 config_argc=$#
1093 EOSH
1094 argn=1
1095 for arg in "$@"; do
1096         cat >>cmdline.opt <<EOSH
1097 config_arg$argn='$arg'
1098 EOSH
1099         argn=`expr $argn + 1`
1100 done
1101
1102 : produce awk script to parse command line options
1103 cat >options.awk <<'EOF'
1104 BEGIN {
1105         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1106
1107         len = length(optstr);
1108         for (i = 1; i <= len; i++) {
1109                 c = substr(optstr, i, 1);
1110                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1111                 if (a == ":") {
1112                         arg[c] = 1;
1113                         i++;
1114                 }
1115                 opt[c] = 1;
1116         }
1117 }
1118 {
1119         expect = 0;
1120         str = $0;
1121         if (substr(str, 1, 1) != "-") {
1122                 printf("'%s'\n", str);
1123                 next;
1124         }
1125         len = length($0);
1126         for (i = 2; i <= len; i++) {
1127                 c = substr(str, i, 1);
1128                 if (!opt[c]) {
1129                         printf("-%s\n", substr(str, i));
1130                         next;
1131                 }
1132                 printf("-%s\n", c);
1133                 if (arg[c]) {
1134                         if (i < len)
1135                                 printf("'%s'\n", substr(str, i + 1));
1136                         else
1137                                 expect = 1;
1138                         next;
1139                 }
1140         }
1141 }
1142 END {
1143         if (expect)
1144                 print "?";
1145 }
1146 EOF
1147
1148 : process the command line options
1149 set X `for arg in "$@"; do echo "X$arg"; done |
1150         sed -e s/X// | awk -f options.awk`
1151 eval "set $*"
1152 shift
1153 rm -f options.awk
1154
1155 : set up default values
1156 fastread=''
1157 reuseval=false
1158 config_sh=''
1159 alldone=''
1160 error=''
1161 silent=''
1162 extractsh=''
1163 override=''
1164 knowitall=''
1165 rm -f optdef.sh posthint.sh
1166 cat >optdef.sh <<EOS
1167 $startsh
1168 EOS
1169
1170
1171 : option parsing
1172 while test $# -gt 0; do
1173         case "$1" in
1174         -d) shift; fastread=yes;;
1175         -e) shift; alldone=cont;;
1176         -f)
1177                 shift
1178                 cd ..
1179                 if test -r "$1"; then
1180                         config_sh="$1"
1181                 else
1182                         echo "$me: cannot read config file $1." >&2
1183                         error=true
1184                 fi
1185                 cd UU
1186                 shift;;
1187         -h) shift; error=true;;
1188         -r) shift; reuseval=true;;
1189         -s) shift; silent=true; realsilent=true;;
1190         -E) shift; alldone=exit;;
1191         -K) shift; knowitall=true;;
1192         -O) shift; override=true;;
1193         -S) shift; silent=true; extractsh=true;;
1194         -D)
1195                 shift
1196                 case "$1" in
1197                 *=)
1198                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1199                         echo "$me: ignoring -D $1" >&2
1200                         ;;
1201                 *=*) echo "$1" | \
1202                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1203                 *) echo "$1='define'" >> optdef.sh;;
1204                 esac
1205                 shift
1206                 ;;
1207         -U)
1208                 shift
1209                 case "$1" in
1210                 *=) echo "$1" >> optdef.sh;;
1211                 *=*)
1212                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1213                         echo "$me: ignoring -U $1" >&2
1214                         ;;
1215                 *) echo "$1='undef'" >> optdef.sh;;
1216                 esac
1217                 shift
1218                 ;;
1219         -A)
1220             shift
1221             xxx=''
1222             yyy="$1"
1223             zzz=''
1224             uuu=undef
1225             case "$yyy" in
1226             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1227                  case "$zzz" in
1228                  *:*) zzz='' ;;
1229                  *)   xxx=append
1230                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1231                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1232                  esac
1233                  ;;
1234             esac
1235             case "$xxx" in
1236             '')  case "$yyy" in
1237                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1238                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1239                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1240                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1241                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1242                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1243                  esac
1244                  ;;       
1245             esac
1246             case "$xxx" in
1247             append)
1248                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1249             clear)
1250                 echo "$yyy=''"                  >> posthint.sh ;;
1251             define)
1252                 case "$zzz" in
1253                 '') zzz=define ;;
1254                 esac
1255                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1256             eval)
1257                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1258             prepend)
1259                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1260             undef)
1261                 case "$zzz" in
1262                 '') zzz="$uuu" ;;
1263                 esac
1264                 echo "$yyy=$zzz"                >> posthint.sh ;;
1265             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1266             esac
1267             ;;
1268         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1269             exit 0;;
1270         --) break;;
1271         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1272         *) break;;
1273         esac
1274 done
1275
1276 case "$error" in
1277 true)
1278         cat >&2 <<EOM
1279 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1280                  [-U symbol] [-U symbol=] [-A command:symbol...]
1281   -d : use defaults for all answers.
1282   -e : go on without questioning past the production of config.sh.
1283   -f : specify an alternate default configuration file.
1284   -h : print this help message and exit (with an error status).
1285   -r : reuse C symbols value if possible (skips costly nm extraction).
1286   -s : silent mode, only echoes questions and essential information.
1287   -D : define symbol to have some value:
1288          -D symbol         symbol gets the value 'define'
1289          -D symbol=value   symbol gets the value 'value'
1290   -E : stop at the end of questions, after having produced config.sh.
1291   -K : do not use unless you know what you are doing.
1292   -O : let -D and -U override definitions from loaded configuration file.
1293   -S : perform variable substitutions on all .SH files (can mix with -f)
1294   -U : undefine symbol:
1295          -U symbol    symbol gets the value 'undef'
1296          -U symbol=   symbol gets completely empty
1297   -A : manipulate symbol after the platform specific hints have been applied:
1298          -A symbol=value                append " "value to symbol
1299          -A append:symbol=value         append value to symbol
1300          -A define:symbol=value         define symbol to have value
1301          -A clear:symbol                define symbol to be ''
1302          -A define:symbol               define symbol to be 'define'
1303          -A eval:symbol=value           define symbol to be eval of value
1304          -A prepend:symbol=value        prepend value to symbol
1305          -A undef:symbol                define symbol to be 'undef'
1306          -A undef:symbol=               define symbol to be ''
1307   -V : print version number and exit (with a zero status).
1308 EOM
1309         exit 1
1310         ;;
1311 esac
1312
1313 : Sanity checks
1314 case "$fastread$alldone" in
1315 yescont|yesexit) ;;
1316 *)
1317         if test ! -t 0; then
1318                 echo "Say 'sh Configure', not 'sh <Configure'"
1319                 exit 1
1320         fi
1321         ;;
1322 esac
1323
1324 exec 4>&1
1325 case "$silent" in
1326 true) exec 1>/dev/null;;
1327 esac
1328
1329 : run the defines and the undefines, if any, but leave the file out there...
1330 touch optdef.sh
1331 . ./optdef.sh
1332 : create the posthint manipulation script and leave the file out there...
1333 touch posthint.sh
1334
1335 : set package name
1336 package=perl5
1337 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1338 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1339 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1340 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1341 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1342 esac
1343
1344 : Some greps do not return status, grrr.
1345 echo "grimblepritz" >grimble
1346 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1347         contains=contains
1348 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1349         contains=grep
1350 else
1351         contains=contains
1352 fi
1353 rm -f grimble
1354 : the following should work in any shell
1355 case "$contains" in
1356 contains*)
1357         echo " "
1358         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1359         cat >contains <<'EOSS'
1360 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1361 EOSS
1362 chmod +x contains
1363 esac
1364
1365 : Find the path to the source tree
1366 case "$src" in
1367 '') case "$0" in
1368     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1369          case "$src" in
1370          /*)    ;;
1371          *)     src=`cd ../$src && pwd` ;;
1372          esac
1373          ;;
1374     *)   src='.';;
1375     esac;;
1376 esac
1377 case "$src" in
1378 '')     src=/
1379         rsrc=/
1380         ;;
1381 /*) rsrc="$src";;
1382 *) rsrc="../$src";;
1383 esac
1384 if test -f $rsrc/Configure && \
1385         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1386 then
1387    : found it, so we are ok.
1388 else
1389         rsrc=''
1390         for src in . .. ../.. ../../.. ../../../..; do
1391                 if test -f ../$src/Configure && \
1392                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1393                 then
1394                         rsrc=../$src
1395                         break
1396                 fi
1397         done
1398 fi
1399 case "$rsrc" in
1400 '')
1401         cat <<EOM >&4
1402
1403 Sorry, I can't seem to locate the source dir for $package.  Please start
1404 Configure with an explicit path -- i.e. /some/path/Configure.
1405
1406 EOM
1407         exit 1
1408         ;;
1409 ../.)   rsrc='..';;
1410 *)
1411         echo " "
1412         echo "Sources for $package found in \"$src\"." >&4
1413         ;;
1414 esac
1415
1416 : script used to extract .SH files with variable substitutions
1417 cat >extract <<'EOS'
1418 CONFIGDOTSH=true
1419 echo "Doing variable substitutions on .SH files..."
1420 if test -f $src/MANIFEST; then
1421         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1422 else
1423         echo "(Looking for .SH files under the source directory.)"
1424         set x `(cd $src; find . -name "*.SH" -print)`
1425 fi
1426 shift
1427 case $# in
1428 0) set x `(cd $src; echo *.SH)`; shift;;
1429 esac
1430 if test ! -f $src/$1; then
1431         shift
1432 fi
1433 mkdir_p='
1434 name=$1;
1435 create="";
1436 while test $name; do
1437         if test ! -d "$name"; then
1438                 create="$name $create";
1439                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1440                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1441         else
1442                 name="";
1443         fi;
1444 done;
1445 for file in $create; do
1446         mkdir $file;
1447 done
1448 '
1449 for file in $*; do
1450         case "$src" in
1451         ".")
1452                 case "$file" in
1453                 */*)
1454                         dir=`expr X$file : 'X\(.*\)/'`
1455                         file=`expr X$file : 'X.*/\(.*\)'`
1456                         (cd $dir && . ./$file)
1457                         ;;
1458                 *)
1459                         . ./$file
1460                         ;;
1461                 esac
1462                 ;;
1463         *)
1464                 case "$file" in
1465                 */*)
1466                         dir=`expr X$file : 'X\(.*\)/'`
1467                         file=`expr X$file : 'X.*/\(.*\)'`
1468                         (set x $dir; shift; eval $mkdir_p)
1469                         sh <$src/$dir/$file
1470                         ;;
1471                 *)
1472                         sh <$src/$file
1473                         ;;
1474                 esac
1475                 ;;
1476         esac
1477 done
1478 if test -f $src/config_h.SH; then
1479         if test ! -f config.h; then
1480         : oops, they left it out of MANIFEST, probably, so do it anyway.
1481         . $src/config_h.SH
1482         fi
1483 fi
1484 EOS
1485
1486 : extract files and exit if asked to do so
1487 case "$extractsh" in
1488 true)
1489         case "$realsilent" in
1490         true) ;;
1491         *) exec 1>&4;;
1492         esac
1493         case "$config_sh" in
1494         '') config_sh='config.sh';;
1495         esac
1496         echo " "
1497         echo "Fetching answers from $config_sh..."
1498         cd ..
1499         . $config_sh
1500         test "$override" && . ./optdef.sh
1501         echo " "
1502         . UU/extract
1503         rm -rf UU
1504         echo "Done."
1505         exit 0
1506         ;;
1507 esac
1508
1509 : Eunice requires " " instead of "", can you believe it
1510 echo " "
1511 : Here we go...
1512 echo "Beginning of configuration questions for $package."
1513
1514 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1515
1516 : first determine how to suppress newline on echo command
1517 echo " "
1518 echo "Checking echo to see how to suppress newlines..."
1519 (echo "hi there\c" ; echo " ") >.echotmp
1520 if $contains c .echotmp >/dev/null 2>&1 ; then
1521         echo "...using -n."
1522         n='-n'
1523         c=''
1524 else
1525         cat <<'EOM'
1526 ...using \c
1527 EOM
1528         n=''
1529         c='\c'
1530 fi
1531 echo $n "The star should be here-->$c"
1532 echo '*'
1533 rm -f .echotmp
1534
1535 : Now test for existence of everything in MANIFEST
1536 echo " "
1537 if test -f $rsrc/MANIFEST; then
1538         echo "First let's make sure your kit is complete.  Checking..." >&4
1539         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1540         rm -f missing
1541         tmppwd=`pwd`
1542         for filelist in x??; do
1543                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1544         done
1545         if test -s missing; then
1546                 cat missing >&4
1547                 cat >&4 <<'EOM'
1548
1549 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1550
1551 You have the option of continuing the configuration process, despite the
1552 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1553 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1554 and contact the author (perlbug@perl.com).
1555
1556 EOM
1557                 echo $n "Continue? [n] $c" >&4
1558                 read ans
1559                 case "$ans" in
1560                 y*)
1561                         echo "Continuing..." >&4
1562                         rm -f missing
1563                         ;;
1564                 *)
1565                         echo "ABORTING..." >&4
1566                         kill $$
1567                         ;;
1568                 esac
1569         else
1570                 echo "Looks good..."
1571         fi
1572 else
1573         echo "There is no MANIFEST file.  I hope your kit is complete !"
1574 fi
1575 rm -f missing x??
1576
1577 echo " "
1578 : Find the appropriate value for a newline for tr
1579 if test -n "$DJGPP"; then
1580        trnl='\012'
1581 fi
1582 if test X"$trnl" = X; then
1583         case "`echo foo|tr '\n' x 2>/dev/null`" in
1584         foox) trnl='\n' ;;
1585         esac
1586 fi
1587 if test X"$trnl" = X; then
1588         case "`echo foo|tr '\012' x 2>/dev/null`" in
1589         foox) trnl='\012' ;;
1590         esac
1591 fi
1592 if test X"$trnl" = X; then
1593         cat <<EOM >&2
1594
1595 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1596
1597 EOM
1598         exit 1
1599 fi
1600
1601 : compute the number of columns on the terminal for proper question formatting
1602 case "$COLUMNS" in
1603 '') COLUMNS='80';;
1604 esac
1605
1606 : set up the echo used in my read
1607 myecho="case \"\$xxxm\" in
1608 '') echo $n \"\$rp $c\" >&4;;
1609 *) case \"\$rp\" in
1610         '') echo $n \"[\$xxxm] $c\";;
1611         *)
1612                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1613                         echo \"\$rp\" >&4
1614                         echo $n \"[\$xxxm] $c\" >&4
1615                 else
1616                         echo $n \"\$rp [\$xxxm] $c\" >&4
1617                 fi
1618                 ;;
1619         esac;;
1620 esac"
1621
1622 : now set up to do reads with possible shell escape and default assignment
1623 cat <<EOSC >myread
1624 $startsh
1625 xxxm=\$dflt
1626 $myecho
1627 ans='!'
1628 case "\$fastread" in
1629 yes) case "\$dflt" in
1630         '') ;;
1631         *) ans='';
1632                 case "\$silent-\$rp" in
1633                 true-) ;;
1634                 *) echo " " >&4;;
1635                 esac;;
1636         esac;;
1637 *) case "\$silent" in
1638         true) case "\$rp" in
1639                 '') ans='';;
1640                 esac;;
1641         esac;;
1642 esac
1643 while expr "X\$ans" : "X!" >/dev/null; do
1644         read answ
1645         set x \$xxxm
1646         shift
1647         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1648         case  "\$answ" in
1649         "!")
1650                 sh 1>&4
1651                 echo " "
1652                 $myecho
1653                 ;;
1654         !*)
1655                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1656                 shift
1657                 sh 1>&4 -c "\$*"
1658                 echo " "
1659                 $myecho
1660                 ;;
1661         "\$ans")
1662                 case "\$ans" in
1663                 \\&*)
1664                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1665                         shift
1666                         case "\$1" in
1667                         -d)
1668                                 fastread=yes
1669                                 echo "(OK, I'll run with -d after this question.)" >&4
1670                                 ;;
1671                         -*)
1672                                 echo "*** Sorry, \$1 not supported yet." >&4
1673                                 ;;
1674                         esac
1675                         $myecho
1676                         ans=!
1677                         ;;
1678                 esac;;
1679         *)
1680                 case "\$aok" in
1681                 y)
1682                         echo "*** Substitution done -- please confirm."
1683                         xxxm="\$ans"
1684                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1685                         xxxm="\$ans"
1686                         ans=!
1687                         ;;
1688                 *)
1689                         echo "*** Error -- try again."
1690                         ans=!
1691                         ;;
1692                 esac
1693                 $myecho
1694                 ;;
1695         esac
1696         case "\$ans\$xxxm\$nostick" in
1697         '')
1698                 ans=!
1699                 $myecho
1700                 ;;
1701         esac
1702 done
1703 case "\$ans" in
1704 '') ans="\$xxxm";;
1705 esac
1706 EOSC
1707
1708 : create .config dir to save info across Configure sessions
1709 test -d ../.config || mkdir ../.config
1710 cat >../.config/README <<EOF
1711 This directory created by Configure to save information that should
1712 persist across sessions for $package.
1713
1714 You may safely delete it if you wish.
1715 EOF
1716
1717 : general instructions
1718 needman=true
1719 firsttime=true
1720 user=`(logname) 2>/dev/null`
1721 case "$user" in
1722 '') user=`whoami 2>&1`;;
1723 esac
1724 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1725         firsttime=false
1726         echo " "
1727         rp='Would you like to see the instructions?'
1728         dflt=n
1729         . ./myread
1730         case "$ans" in
1731         [yY]*) ;;
1732         *) needman=false;;
1733         esac
1734 fi
1735 if $needman; then
1736         cat <<EOH
1737
1738 This installation shell script will examine your system and ask you questions
1739 to determine how the perl5 package should be installed. If you get
1740 stuck on a question, you may use a ! shell escape to start a subshell or
1741 execute a command.  Many of the questions will have default answers in square
1742 brackets; typing carriage return will give you the default.
1743
1744 On some of the questions which ask for file or directory names you are allowed
1745 to use the ~name construct to specify the login directory belonging to "name",
1746 even if you don't have a shell which knows about that.  Questions where this is
1747 allowed will be marked "(~name ok)".
1748
1749 EOH
1750         rp=''
1751         dflt='Type carriage return to continue'
1752         . ./myread
1753         cat <<'EOH'
1754
1755 The prompter used in this script allows you to use shell variables and
1756 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1757 in the default answer, as if the default line was a set of arguments given to a
1758 script shell.  This means you may also use $* to repeat the whole default line,
1759 so you do not have to re-type everything to add something to the default.
1760
1761 Everytime there is a substitution, you will have to confirm.  If there is an
1762 error (e.g. an unmatched backtick), the default answer will remain unchanged
1763 and you will be prompted again.
1764
1765 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1766 the questions and use the computed defaults (or the previous answers if there
1767 was already a config.sh file). Type 'Configure -h' for a list of options.
1768 You may also start interactively and then answer '& -d' at any prompt to turn
1769 on the non-interactive behaviour for the remainder of the execution.
1770
1771 EOH
1772         . ./myread
1773         cat <<EOH
1774
1775 Much effort has been expended to ensure that this shell script will run on any
1776 Unix system.  If despite that it blows up on yours, your best bet is to edit
1777 Configure and run it again.  If you can't run Configure for some reason,
1778 you'll have to generate a config.sh file by hand.  Whatever problems you
1779 have, let me (perlbug@perl.com) know how I blew it.
1780
1781 This installation script affects things in two ways:
1782
1783 1) it may do direct variable substitutions on some of the files included
1784    in this kit.
1785 2) it builds a config.h file for inclusion in C programs.  You may edit
1786    any of these files as the need arises after running this script.
1787
1788 If you make a mistake on a question, there is no easy way to back up to it
1789 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1790 files.  Configure will offer to let you do this before it runs the SH files.
1791
1792 EOH
1793         dflt='Type carriage return to continue'
1794         . ./myread
1795         case "$firsttime" in
1796         true) echo $user >>../.config/instruct;;
1797         esac
1798 fi
1799
1800 : find out where common programs are
1801 echo " "
1802 echo "Locating common programs..." >&4
1803 cat <<EOSC >loc
1804 $startsh
1805 case \$# in
1806 0) exit 1;;
1807 esac
1808 thing=\$1
1809 shift
1810 dflt=\$1
1811 shift
1812 for dir in \$*; do
1813         case "\$thing" in
1814         .)
1815         if test -d \$dir/\$thing; then
1816                 echo \$dir
1817                 exit 0
1818         fi
1819         ;;
1820         *)
1821         for thisthing in \$dir/\$thing; do
1822                 : just loop through to pick last item
1823         done
1824         if test -f \$thisthing; then
1825                 echo \$thisthing
1826                 exit 0
1827         elif test -f \$dir/\$thing.exe; then
1828                 if test -n "$DJGPP"; then
1829                         echo \$dir/\$thing.exe
1830                 else
1831                         : on Eunice apparently
1832                         echo \$dir/\$thing
1833                 fi
1834                 exit 0
1835         fi
1836         ;;
1837         esac
1838 done
1839 echo \$dflt
1840 exit 1
1841 EOSC
1842 chmod +x loc
1843 $eunicefix loc
1844 loclist="
1845 awk
1846 cat
1847 comm
1848 cp
1849 echo
1850 expr
1851 grep
1852 ls
1853 make
1854 mkdir
1855 rm
1856 sed
1857 sort
1858 touch
1859 tr
1860 uniq
1861 "
1862 trylist="
1863 Mcc
1864 ar
1865 byacc
1866 cpp
1867 csh
1868 date
1869 egrep
1870 gzip
1871 less
1872 ln
1873 more
1874 nm
1875 nroff
1876 perl
1877 pg
1878 test
1879 uname
1880 zip
1881 "
1882 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1883 pth="$pth /lib /usr/lib"
1884 for file in $loclist; do
1885         eval xxx=\$$file
1886         case "$xxx" in
1887         /*|?:[\\/]*)
1888                 if test -f "$xxx"; then
1889                         : ok
1890                 else
1891                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1892                         xxx=`./loc $file $file $pth`
1893                 fi
1894                 ;;
1895         '') xxx=`./loc $file $file $pth`;;
1896         *) xxx=`./loc $xxx $xxx $pth`;;
1897         esac
1898         eval $file=$xxx
1899         eval _$file=$xxx
1900         case "$xxx" in
1901         /*)
1902                 echo $file is in $xxx.
1903                 ;;
1904         ?:[\\/]*)
1905                 echo $file is in $xxx.
1906                 ;;
1907         *)
1908                 echo "I don't know where '$file' is, and my life depends on it." >&4
1909                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1910                 exit 1
1911                 ;;
1912         esac
1913 done
1914 echo " "
1915 echo "Don't worry if any of the following aren't found..."
1916 say=offhand
1917 for file in $trylist; do
1918         eval xxx=\$$file
1919         case "$xxx" in
1920         /*|?:[\\/]*)
1921                 if test -f "$xxx"; then
1922                         : ok
1923                 else
1924                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1925                         xxx=`./loc $file $file $pth`
1926                 fi
1927                 ;;
1928         '') xxx=`./loc $file $file $pth`;;
1929         *) xxx=`./loc $xxx $xxx $pth`;;
1930         esac
1931         eval $file=$xxx
1932         eval _$file=$xxx
1933         case "$xxx" in
1934         /*)
1935                 echo $file is in $xxx.
1936                 ;;
1937         ?:[\\/]*)
1938                 echo $file is in $xxx.
1939                 ;;
1940         *)
1941                 echo "I don't see $file out there, $say."
1942                 say=either
1943                 ;;
1944         esac
1945 done
1946 case "$egrep" in
1947 egrep)
1948         echo "Substituting grep for egrep."
1949         egrep=$grep
1950         ;;
1951 esac
1952 case "$ln" in
1953 ln)
1954         echo "Substituting cp for ln."
1955         ln=$cp
1956         ;;
1957 esac
1958 case "$test" in
1959 test)
1960         echo "Hopefully test is built into your sh."
1961         ;;
1962 *)
1963         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1964                 echo "Using the test built into your sh."
1965                 test=test
1966                 _test=test
1967         fi
1968         ;;
1969 esac
1970 case "$echo" in
1971 echo)
1972         echo "Hopefully echo is built into your sh."
1973         ;;
1974 '') ;;
1975 *)
1976         echo " "
1977 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1978         $echo $n "hi there$c" >foo1
1979         echo $n "hi there$c" >foo2
1980         if cmp foo1 foo2 >/dev/null 2>&1; then
1981                 echo "They are compatible.  In fact, they may be identical."
1982         else
1983                 case "$n" in
1984                 '-n') n='' c='\c';;
1985                 *) n='-n' c='';;
1986                 esac
1987                 cat <<FOO
1988 They are not compatible!  You are probably running ksh on a non-USG system.
1989 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1990 have echo built in and we may have to run some Bourne shell scripts.  That
1991 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1992
1993 FOO
1994                 $echo $n "The star should be here-->$c"
1995                 $echo "*"
1996         fi
1997         $rm -f foo1 foo2
1998         ;;
1999 esac
2000
2001 : determine whether symbolic links are supported
2002 echo " "
2003 $touch blurfl
2004 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2005         echo "Symbolic links are supported." >&4
2006         lns="$ln -s"
2007 else
2008         echo "Symbolic links are NOT supported." >&4
2009         lns="$ln"
2010 fi
2011 $rm -f blurfl sym
2012
2013 : see whether [:lower:] and [:upper:] are supported character classes
2014 echo " "
2015 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2016 ABYZ)
2017         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2018         up='[:upper:]'
2019         low='[:lower:]'
2020         ;;
2021 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2022         # (0xc9 and 0xd1), therefore that is a nice testing point.
2023         if test "X$up" = X -o "X$low" = X; then
2024             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2025             ij) up='[A-Z]'
2026                 low='[a-z]'
2027                 ;;
2028             esac
2029         fi
2030         if test "X$up" = X -o "X$low" = X; then
2031             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2032             ij) up='A-Z'
2033                 low='a-z'
2034                 ;;
2035             esac
2036         fi
2037         if test "X$up" = X -o "X$low" = X; then
2038             case "`echo IJ | od -x 2>/dev/null`" in
2039             *C9D1*|*c9d1*)
2040                 echo "Hey, this might be EBCDIC." >&4
2041                 if test "X$up" = X -o "X$low" = X; then
2042                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2043                     ij) up='[A-IJ-RS-Z]'
2044                         low='[a-ij-rs-z]'
2045                         ;;
2046                     esac
2047                 fi
2048                 if test "X$up" = X -o "X$low" = X; then
2049                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2050                     ij) up='A-IJ-RS-Z'
2051                         low='a-ij-rs-z'
2052                         ;;
2053                     esac
2054                 fi
2055                 ;;
2056             esac
2057         fi
2058 esac
2059 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2060 ij)
2061     echo "Using $up and $low to convert case." >&4
2062     ;;
2063 *)
2064     echo "I don't know how to translate letters from upper to lower case." >&4
2065     echo "Your tr is not acting any way I know of." >&4
2066     exit 1
2067     ;;
2068 esac
2069 : set up the translation script tr, must be called with ./tr of course
2070 cat >tr <<EOSC
2071 $startsh
2072 case "\$1\$2" in
2073 '[A-Z][a-z]') exec $tr '$up' '$low';;
2074 '[a-z][A-Z]') exec $tr '$low' '$up';;
2075 esac
2076 exec $tr "\$@"
2077 EOSC
2078 chmod +x tr
2079 $eunicefix tr
2080
2081 : Try to determine whether config.sh was made on this system
2082 case "$config_sh" in
2083 '')
2084 myuname=`$uname -a 2>/dev/null`
2085 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2086 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2087 # because the A-Z/a-z are not consecutive.
2088 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2089         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2090 newmyuname="$myuname"
2091 dflt=n
2092 case "$knowitall" in
2093 '')
2094         if test -f ../config.sh; then
2095                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2096                         eval "`grep myuname= ../config.sh`"
2097                 fi
2098                 if test "X$myuname" = "X$newmyuname"; then
2099                         dflt=y
2100                 fi
2101         fi
2102         ;;
2103 *) dflt=y;;
2104 esac
2105
2106 : Get old answers from old config file if Configure was run on the
2107 : same system, otherwise use the hints.
2108 hint=default
2109 cd ..
2110 if test -f config.sh; then
2111         echo " "
2112         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2113         . UU/myread
2114         case "$ans" in
2115         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2116         *)  echo "Fetching default answers from your old config.sh file..." >&4
2117                 tmp_n="$n"
2118                 tmp_c="$c"
2119                 tmp_sh="$sh"
2120                 . ./config.sh
2121                 cp config.sh UU
2122                 n="$tmp_n"
2123                 c="$tmp_c"
2124                 : Older versions did not always set $sh.  Catch re-use of such
2125                 : an old config.sh.
2126                 case "$sh" in
2127                 '') sh="$tmp_sh" ;;
2128                 esac
2129                 hint=previous
2130                 ;;
2131         esac
2132 fi
2133 if test ! -f config.sh; then
2134         $cat <<EOM
2135
2136 First time through, eh?  I have some defaults handy for some systems
2137 that need some extra help getting the Configure answers right:
2138
2139 EOM
2140         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2141         dflt=''
2142         : Half the following guesses are probably wrong... If you have better
2143         : tests or hints, please send them to perlbug@perl.com
2144         : The metaconfig authors would also appreciate a copy...
2145         $test -f /irix && osname=irix
2146         $test -f /xenix && osname=sco_xenix
2147         $test -f /dynix && osname=dynix
2148         $test -f /dnix && osname=dnix
2149         $test -f /lynx.os && osname=lynxos
2150         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2151         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2152         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2153         $test -f /bin/mips && /bin/mips && osname=mips
2154         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2155                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2156         $test -d /usr/apollo/bin && osname=apollo
2157         $test -f /etc/saf/_sactab && osname=svr4
2158         $test -d /usr/include/minix && osname=minix
2159         if $test -d /MachTen -o -d /MachTen_Folder; then
2160                 osname=machten
2161                 if $test -x /sbin/version; then
2162                         osvers=`/sbin/version | $awk '{print $2}' |
2163                         $sed -e 's/[A-Za-z]$//'`
2164                 elif $test -x /usr/etc/version; then
2165                         osvers=`/usr/etc/version | $awk '{print $2}' |
2166                         $sed -e 's/[A-Za-z]$//'`
2167                 else
2168                         osvers="$2.$3"
2169                 fi
2170         fi
2171
2172         $test -f /sys/posix.dll &&
2173                 $test -f /usr/bin/what &&
2174                 set X `/usr/bin/what /sys/posix.dll` &&
2175                 $test "$3" = UWIN &&
2176                 osname=uwin &&
2177                 osvers="$5"
2178
2179         if $test -f $uname; then
2180                 set X $myuname
2181                 shift
2182
2183                 case "$5" in
2184                 fps*) osname=fps ;;
2185                 mips*)
2186                         case "$4" in
2187                         umips) osname=umips ;;
2188                         *) osname=mips ;;
2189                         esac;;
2190                 [23]100) osname=mips ;;
2191                 next*) osname=next ;;
2192                 i386*)
2193                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2194                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2195                                 osname='sco'
2196                                 osvers=$tmp
2197                         elif $test -f /etc/kconfig; then
2198                                 osname=isc
2199                                 if test "$lns" = "$ln -s"; then
2200                                         osvers=4
2201                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2202                                         osvers=3
2203                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2204                                         osvers=2
2205                                 fi
2206                         fi
2207                         tmp=''
2208                         ;;
2209                 pc*)
2210                         if test -n "$DJGPP"; then
2211                                 osname=dos
2212                                 osvers=djgpp
2213                         fi
2214                         ;;
2215                 esac
2216
2217                 case "$1" in
2218                 aix) osname=aix
2219                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2220                         case "$tmp" in
2221                         'not found') osvers="$4"."$3" ;;
2222                         '<3240'|'<>3240') osvers=3.2.0 ;;
2223                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2224                         '=3250'|'>3250') osvers=3.2.5 ;;
2225                         *) osvers=$tmp;;
2226                         esac
2227                         ;;
2228                 bsd386) osname=bsd386
2229                         osvers=`$uname -r`
2230                         ;;
2231                 cygwin*) osname=cygwin
2232                         osvers="$3"
2233                         ;;
2234                 *dc.osx) osname=dcosx
2235                         osvers="$3"
2236                         ;;
2237                 dnix) osname=dnix
2238                         osvers="$3"
2239                         ;;
2240                 domainos) osname=apollo
2241                         osvers="$3"
2242                         ;;
2243                 dgux) osname=dgux 
2244                         osvers="$3"
2245                         ;;
2246                 dynixptx*) osname=dynixptx
2247                         osvers=`echo "$4"|sed 's/^v//'`
2248                         ;;
2249                 freebsd) osname=freebsd 
2250                         osvers="$3" ;;
2251                 genix) osname=genix ;;
2252                 hp*) osname=hpux 
2253                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2254                         ;;
2255                 irix*) osname=irix
2256                         case "$3" in
2257                         4*) osvers=4 ;;
2258                         5*) osvers=5 ;;
2259                         *)      osvers="$3" ;;
2260                         esac
2261                         ;;
2262                 linux) osname=linux
2263                         case "$3" in
2264                         *)      osvers="$3" ;;
2265                         esac
2266                         ;;
2267                 MiNT) osname=mint
2268                         ;;
2269                 netbsd*) osname=netbsd
2270                         osvers="$3"
2271                         ;;
2272                 news-os) osvers="$3"
2273                         case "$3" in
2274                         4*) osname=newsos4 ;;
2275                         *) osname=newsos ;;
2276                         esac
2277                         ;;
2278                 next*) osname=next ;;
2279                 POSIX-BC | posix-bc ) osname=posix-bc
2280                         osvers="$3"
2281                         ;;
2282                 powerux | power_ux | powermax_os | powermaxos | \
2283                 powerunix | power_unix) osname=powerux
2284                         osvers="$3"
2285                         ;;
2286                 qnx) osname=qnx
2287                         osvers="$4"
2288                         ;;
2289                 solaris) osname=solaris
2290                         case "$3" in
2291                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2292                         *)      osvers="$3" ;;
2293                         esac
2294                         ;;
2295                 sunos) osname=sunos
2296                         case "$3" in
2297                         5*) osname=solaris
2298                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2299                         *)      osvers="$3" ;;
2300                         esac
2301                         ;;
2302                 titanos) osname=titanos
2303                         case "$3" in
2304                         1*) osvers=1 ;;
2305                         2*) osvers=2 ;;
2306                         3*) osvers=3 ;;
2307                         4*) osvers=4 ;;
2308                         *)      osvers="$3" ;;
2309                         esac
2310                         ;;
2311                 ultrix) osname=ultrix
2312                         osvers="$3"
2313                         ;;
2314                 osf1|mls+)      case "$5" in
2315                                 alpha)
2316                                         osname=dec_osf
2317                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2318                                         ;;
2319                         hp*)    osname=hp_osf1  ;;
2320                         mips)   osname=mips_osf1 ;;
2321                         esac
2322                         ;;
2323                 unixware) osname=svr5
2324                         osvers="$4"
2325                         ;;
2326                 uts) osname=uts
2327                         osvers="$3"
2328                         ;;
2329                 $2) case "$osname" in
2330                         *isc*) ;;
2331                         *freebsd*) ;;
2332                         svr*)
2333                                 : svr4.x or possibly later
2334                                 case "svr$3" in 
2335                                 ${osname}*)
2336                                         osname=svr$3
2337                                         osvers=$4
2338                                         ;;
2339                                 esac
2340                                 case "$osname" in
2341                                 svr4.0)
2342                                         : Check for ESIX
2343                                         if test -f /stand/boot ; then
2344                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2345                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2346                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2347                                                         if test -n "$isesix"; then
2348                                                                 osname=esix4
2349                                                         fi
2350                                                 fi
2351                                         fi
2352                                         ;;
2353                                 esac
2354                                 ;;
2355                         *)      if test -f /etc/systemid; then
2356                                         osname=sco
2357                                         set `echo $3 | $sed 's/\./ /g'` $4
2358                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2359                                                 osvers=$1.$2.$3
2360                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2361                                                 osvers=$1.$2
2362                                         elif $test -f $src/hints/sco_$1.sh; then
2363                                                 osvers=$1
2364                                         fi
2365                                 else
2366                                         case "$osname" in
2367                                         '') : Still unknown.  Probably a generic Sys V.
2368                                                 osname="sysv"
2369                                                 osvers="$3"
2370                                                 ;;
2371                                         esac
2372                                 fi
2373                                 ;;
2374                         esac
2375                         ;;
2376                 *)      case "$osname" in
2377                         '') : Still unknown.  Probably a generic BSD.
2378                                 osname="$1"
2379                                 osvers="$3"
2380                                 ;;
2381                         esac
2382                         ;;
2383                 esac
2384         else
2385                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2386                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2387                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2388                                 osname=news_os
2389                         fi
2390                         $rm -f UU/kernel.what
2391                 elif test -d c:/.; then
2392                         set X $myuname
2393                         osname=os2
2394                         osvers="$5"
2395                 fi
2396         fi
2397         
2398         : Now look for a hint file osname_osvers, unless one has been
2399         : specified already.
2400         case "$hintfile" in
2401         ''|' ')
2402                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2403                 : Also try without trailing minor version numbers.
2404                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2405                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2406                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2407                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2408                 case "$file" in
2409                 '') dflt=none ;;
2410                 *)  case "$osvers" in
2411                         '') dflt=$file
2412                                 ;;
2413                         *)  if $test -f $src/hints/$file.sh ; then
2414                                         dflt=$file
2415                                 elif $test -f $src/hints/$xfile.sh ; then
2416                                         dflt=$xfile
2417                                 elif $test -f $src/hints/$xxfile.sh ; then
2418                                         dflt=$xxfile
2419                                 elif $test -f $src/hints/$xxxfile.sh ; then
2420                                         dflt=$xxxfile
2421                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2422                                         dflt=$xxxxfile
2423                                 elif $test -f "$src/hints/${osname}.sh" ; then
2424                                         dflt="${osname}"
2425                                 else
2426                                         dflt=none
2427                                 fi
2428                                 ;;
2429                         esac
2430                         ;;
2431                 esac
2432                 if $test -f Policy.sh ; then
2433                         case "$dflt" in
2434                         *Policy*) ;;
2435                         none) dflt="Policy" ;;
2436                         *) dflt="Policy $dflt" ;;
2437                         esac
2438                 fi
2439                 ;;
2440         *)
2441                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2442                 ;;
2443         esac
2444
2445         if $test -f Policy.sh ; then
2446                 $cat <<EOM
2447
2448 There's also a Policy hint file available, which should make the
2449 site-specific (policy) questions easier to answer.
2450 EOM
2451
2452         fi
2453
2454         $cat <<EOM
2455
2456 You may give one or more space-separated answers, or "none" if appropriate.
2457 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2458 is a good thing.  DO NOT give a wrong version or a wrong OS.
2459
2460 EOM
2461
2462         rp="Which of these apply, if any?"
2463         . UU/myread
2464         tans=$ans
2465         for file in $tans; do
2466                 if $test X$file = XPolicy -a -f Policy.sh; then
2467                         . Policy.sh
2468                         $cat Policy.sh >> UU/config.sh
2469                 elif $test -f $src/hints/$file.sh; then
2470                         . $src/hints/$file.sh
2471                         $cat $src/hints/$file.sh >> UU/config.sh
2472                 elif $test X$tans = X -o X$tans = Xnone ; then
2473                         : nothing
2474                 else
2475                         : Give one chance to correct a possible typo.
2476                         echo "$file.sh does not exist"
2477                         dflt=$file
2478                         rp="hint to use instead?"
2479                         . UU/myread
2480                         for file in $ans; do
2481                                 if $test -f "$src/hints/$file.sh"; then
2482                                         . $src/hints/$file.sh
2483                                         $cat $src/hints/$file.sh >> UU/config.sh
2484                                 elif $test X$ans = X -o X$ans = Xnone ; then
2485                                         : nothing
2486                                 else
2487                                         echo "$file.sh does not exist -- ignored."
2488                                 fi
2489                         done
2490                 fi
2491         done
2492
2493         hint=recommended
2494         : Remember our hint file for later.
2495         if $test -f "$src/hints/$file.sh" ; then
2496                 hintfile="$file"
2497         else
2498                 hintfile=''
2499         fi
2500 fi
2501 cd UU
2502 ;;
2503 *)
2504         echo " "
2505         echo "Fetching default answers from $config_sh..." >&4
2506         tmp_n="$n"
2507         tmp_c="$c"
2508         cd ..
2509         cp $config_sh config.sh 2>/dev/null
2510         chmod +w config.sh
2511         . ./config.sh
2512         cd UU
2513         cp ../config.sh .
2514         n="$tmp_n"
2515         c="$tmp_c"
2516         hint=previous
2517         ;;
2518 esac
2519 test "$override" && . ./optdef.sh
2520 myuname="$newmyuname"
2521
2522 : Restore computed paths
2523 for file in $loclist $trylist; do
2524         eval $file="\$_$file"
2525 done
2526
2527 cat << EOM
2528
2529 Configure uses the operating system name and version to set some defaults.
2530 The default value is probably right if the name rings a bell. Otherwise,
2531 since spelling matters for me, either accept the default or answer "none"
2532 to leave it blank.
2533
2534 EOM
2535 case "$osname" in
2536         ''|' ')
2537                 case "$hintfile" in
2538                 ''|' '|none) dflt=none ;;
2539                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2540                 esac
2541                 ;;
2542         *) dflt="$osname" ;;
2543 esac
2544 rp="Operating system name?"
2545 . ./myread
2546 case "$ans" in
2547 none)  osname='' ;;
2548 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2549 esac
2550 echo " "
2551 case "$osvers" in
2552         ''|' ')
2553                 case "$hintfile" in
2554                 ''|' '|none) dflt=none ;;
2555                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2556                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2557                         case "$dflt" in
2558                         ''|' ') dflt=none ;;
2559                         esac
2560                         ;;
2561                 esac
2562                 ;;
2563         *) dflt="$osvers" ;;
2564 esac
2565 rp="Operating system version?"
2566 . ./myread
2567 case "$ans" in
2568 none)  osvers='' ;;
2569 *) osvers="$ans" ;;
2570 esac
2571
2572
2573 . ./posthint.sh
2574
2575 : who configured the system
2576 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2577 cf_by=`(logname) 2>/dev/null`
2578 case "$cf_by" in
2579 "")
2580         cf_by=`(whoami) 2>/dev/null`
2581         case "$cf_by" in
2582         "") cf_by=unknown ;;
2583         esac ;;
2584 esac
2585
2586 : set up the script used to warn in case of inconsistency
2587 cat <<EOS >whoa
2588 $startsh
2589 EOS
2590 cat <<'EOSC' >>whoa
2591 dflt=y
2592 echo " "
2593 echo "*** WHOA THERE!!! ***" >&4
2594 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2595 rp="    Keep the $hint value?"
2596 . ./myread
2597 case "$ans" in
2598 y) td=$was; tu=$was;;
2599 esac
2600 EOSC
2601
2602 : function used to set $1 to $val
2603 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2604 case "$val$was" in
2605 $define$undef) . ./whoa; eval "$var=\$td";;
2606 $undef$define) . ./whoa; eval "$var=\$tu";;
2607 *) eval "$var=$val";;
2608 esac'
2609
2610 cat <<EOM
2611
2612 Perl can be built to take advantage of threads on some systems.
2613 To do so, Configure must be run with -Dusethreads.
2614
2615 Note that threading is a highly experimental feature, and
2616 some known race conditions still remain.  If you choose to try
2617 it, be very sure to not actually deploy it for production
2618 purposes.  README.threads has more details, and is required
2619 reading if you enable threads.
2620 EOM
2621 case "$usethreads" in
2622 $define|true|[yY]*)     dflt='y';;
2623 *) dflt='n';;
2624 esac
2625 rp='Build a threading Perl?'
2626 . ./myread
2627 case "$ans" in
2628 y|Y)    val="$define" ;;
2629 *)      val="$undef" ;;
2630 esac
2631 set usethreads
2632 eval $setvar
2633
2634 case "$usethreads" in
2635 $define)
2636         $cat <<EOM
2637
2638 As of 5.5.640, Perl has two different internal threading implementations,
2639 the 5.005 version (5005threads) and an interpreter-based version
2640 (ithreads) that has one interpreter per thread.  Both are very 
2641 experimental.  This arrangement exists to help developers work out
2642 which one is better.
2643
2644 If you're a casual user, you probably don't want interpreter-threads
2645 at this time.  There doesn't yet exist a way to create threads from
2646 within Perl in this model, i.e., "use Thread;" will NOT work.
2647 EOM
2648         : Default to ithreads unless overridden on command line or with
2649         : old config.sh
2650         dflt='y'
2651         case "$use5005threads" in
2652                 $define|true|[yY]*) dflt='n';;
2653         esac
2654         case "$useithreads" in
2655                 $undef|false|[nN]*) dflt='n';;
2656         esac
2657         rp='Use interpreter-based ithreads?'
2658         . ./myread
2659         case "$ans" in
2660         y|Y)    val="$define" ;;
2661         *)      val="$undef" ;;
2662         esac
2663         set useithreads
2664         eval $setvar
2665         : Now set use5005threads to the opposite value.
2666         case "$useithreads" in
2667         $define) val="$undef" ;;
2668         *) val="$define" ;;
2669         esac
2670         set use5005threads
2671         eval $setvar
2672         ;;
2673 *)
2674         useithreads="$undef"
2675         use5005threads="$undef"
2676         ;;
2677 esac
2678
2679 case "$d_oldpthreads" in
2680 '')     : Configure tests would be welcome here.  For now, assume undef.
2681         val="$undef" ;;
2682 *)      val="$d_oldpthreads" ;;
2683 esac
2684 set d_oldpthreads
2685 eval $setvar
2686
2687
2688 case "$usethreads" in
2689 "$define"|true|[yY]*)
2690 : Look for a hint-file generated 'call-back-unit'.  If the
2691 : user has specified that a threading perl is to be built,
2692 : we may need to set or change some other defaults.
2693         if $test -f usethreads.cbu; then
2694                 echo "Your platform has some specific hints for threaded builds, using them..."
2695                 . ./usethreads.cbu
2696         else
2697                 $cat <<EOM
2698 (Your platform doesn't have any specific hints for threaded builds.
2699  Assuming POSIX threads, then.)
2700 EOM
2701         fi
2702         ;;
2703 esac
2704
2705 cat <<EOM
2706
2707 Perl can be built so that multiple Perl interpreters can coexist
2708 within the same Perl executable.
2709 EOM
2710
2711 case "$useithreads" in
2712 $define)
2713         cat <<EOM
2714 This multiple interpreter support is required for interpreter-based threads.
2715 EOM
2716         val="$define"
2717         ;;
2718 *)
2719         echo 'Normally you do not need this and you should answer no.'
2720         case "$usemultiplicity" in
2721         $define|true|[yY]*)     dflt='y';;
2722         *) dflt='n';;
2723         esac
2724         rp='Build Perl for multiplicity?'
2725         . ./myread
2726         case "$ans" in
2727         y|Y)    val="$define" ;;
2728         *)      val="$undef" ;;
2729         esac
2730         ;;
2731 esac
2732 set usemultiplicity
2733 eval $setvar
2734
2735 : determine where manual pages are on this system
2736 echo " "
2737 case "$sysman" in
2738 '') 
2739         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2740         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2741         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2742         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2743         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2744         sysman=`./loc . /usr/man/man1 $syspath`
2745         ;;
2746 esac
2747 if $test -d "$sysman"; then
2748         echo "System manual is in $sysman." >&4
2749 else
2750         echo "Could not find manual pages in source form." >&4
2751 fi
2752
2753 : see what memory models we can support
2754 case "$models" in
2755 '')
2756         $cat >pdp11.c <<'EOP'
2757 int main() {
2758 #ifdef pdp11
2759         exit(0);
2760 #else
2761         exit(1);
2762 #endif
2763 }
2764 EOP
2765         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2766         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2767                 dflt='unsplit split'
2768         else
2769                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2770                 case "$tans" in
2771                 X) dflt='none';;
2772                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2773                                 dflt='small'
2774                         else
2775                                 dflt=''
2776                         fi
2777                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2778                                 dflt="$dflt medium"
2779                         fi
2780                         if $test -d /lib/large || $test -d /usr/lib/large; then
2781                                 dflt="$dflt large"
2782                         fi
2783                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2784                                 dflt="$dflt huge"
2785                         fi
2786                 esac
2787         fi;;
2788 *) dflt="$models";;
2789 esac
2790 $cat <<EOM
2791  
2792 Some systems have different model sizes.  On most systems they are called
2793 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2794 split.  If your system doesn't support different memory models, say "none".
2795 If you wish to force everything to one memory model, say "none" here and
2796 put the appropriate flags later when it asks you for other cc and ld flags.
2797 Venix systems may wish to put "none" and let the compiler figure things out.
2798 (In the following question multiple model names should be space separated.)
2799
2800 The default for most systems is "none".
2801
2802 EOM
2803 rp="Which memory models are supported?"
2804 . ./myread
2805 models="$ans"
2806
2807 case "$models" in
2808 none)
2809         small=''
2810         medium=''
2811         large=''
2812         huge=''
2813         unsplit=''
2814         split=''
2815         ;;
2816 *split)
2817         case "$split" in
2818         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2819                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2820                         dflt='-i'
2821                 else
2822                         dflt='none'
2823                 fi;;
2824         *) dflt="$split";;
2825         esac
2826         rp="What flag indicates separate I and D space?"
2827         . ./myread
2828         tans="$ans"
2829         case "$tans" in
2830         none) tans='';;
2831         esac
2832         split="$tans"
2833         unsplit='';;
2834 *large*|*small*|*medium*|*huge*)
2835         case "$models" in
2836         *large*)
2837                 case "$large" in
2838                 '') dflt='-Ml';;
2839                 *) dflt="$large";;
2840                 esac
2841         rp="What flag indicates large model?"
2842         . ./myread
2843         tans="$ans"
2844         case "$tans" in
2845         none) tans='';
2846         esac
2847         large="$tans";;
2848         *) large='';;
2849         esac
2850         case "$models" in
2851         *huge*) case "$huge" in
2852                 '') dflt='-Mh';;
2853                 *) dflt="$huge";;
2854                 esac
2855                 rp="What flag indicates huge model?"
2856                 . ./myread
2857                 tans="$ans"
2858                 case "$tans" in
2859                 none) tans='';
2860                 esac
2861                 huge="$tans";;
2862         *) huge="$large";;
2863         esac
2864         case "$models" in
2865         *medium*) case "$medium" in
2866                 '') dflt='-Mm';;
2867                 *) dflt="$medium";;
2868                 esac
2869                 rp="What flag indicates medium model?"
2870                 . ./myread
2871                 tans="$ans"
2872                 case "$tans" in
2873                 none) tans='';
2874                 esac
2875                 medium="$tans";;
2876         *) medium="$large";;
2877         esac
2878         case "$models" in
2879         *small*) case "$small" in
2880                 '') dflt='none';;
2881                 *) dflt="$small";;
2882                 esac
2883                 rp="What flag indicates small model?"
2884                 . ./myread
2885                 tans="$ans"
2886                 case "$tans" in
2887                 none) tans='';
2888                 esac
2889                 small="$tans";;
2890         *) small='';;
2891         esac
2892         ;;
2893 *)
2894         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2895         ;;
2896 esac
2897 $rm -f pdp11.* pdp11
2898
2899 : make some quick guesses about what we are up against
2900 echo " "
2901 $echo $n "Hmm...  $c"
2902 echo exit 1 >bsd
2903 echo exit 1 >usg
2904 echo exit 1 >v7
2905 echo exit 1 >osf1
2906 echo exit 1 >eunice
2907 echo exit 1 >xenix
2908 echo exit 1 >venix
2909 echo exit 1 >os2
2910 d_bsd="$undef"
2911 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2912 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2913 then
2914         echo "Looks kind of like an OSF/1 system, but we'll see..."
2915         echo exit 0 >osf1
2916 elif test `echo abc | tr a-z A-Z` = Abc ; then
2917         xxx=`./loc addbib blurfl $pth`
2918         if $test -f $xxx; then
2919         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2920                 echo exit 0 >bsd
2921                 echo exit 0 >usg
2922         else
2923                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2924                         echo "Looks kind of like an extended USG system, but we'll see..."
2925                 else
2926                         echo "Looks kind of like a USG system, but we'll see..."
2927                 fi
2928                 echo exit 0 >usg
2929         fi
2930 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931         echo "Looks kind of like a BSD system, but we'll see..."
2932         d_bsd="$define"
2933         echo exit 0 >bsd
2934 else
2935         echo "Looks kind of like a Version 7 system, but we'll see..."
2936         echo exit 0 >v7
2937 fi
2938 case "$eunicefix" in
2939 *unixtovms*)
2940         $cat <<'EOI'
2941 There is, however, a strange, musty smell in the air that reminds me of
2942 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2943 EOI
2944         echo exit 0 >eunice
2945         d_eunice="$define"
2946 : it so happens the Eunice I know will not run shell scripts in Unix format
2947         ;;
2948 *)
2949         echo " "
2950         echo "Congratulations.  You aren't running Eunice."
2951         d_eunice="$undef"
2952         ;;
2953 esac
2954 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2955 case "$p_" in
2956 :) ;;
2957 *)
2958         $cat <<'EOI'
2959 I have the feeling something is not exactly right, however...don't tell me...
2960 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2961 EOI
2962         echo exit 0 >os2
2963         ;;
2964 esac
2965 if test -f /xenix; then
2966         echo "Actually, this looks more like a XENIX system..."
2967         echo exit 0 >xenix
2968         d_xenix="$define"
2969 else
2970         echo " "
2971         echo "It's not Xenix..."
2972         d_xenix="$undef"
2973 fi
2974 chmod +x xenix
2975 $eunicefix xenix
2976 if test -f /venix; then
2977         echo "Actually, this looks more like a VENIX system..."
2978         echo exit 0 >venix
2979 else
2980         echo " "
2981         if ./xenix; then
2982                 : null
2983         else
2984                 echo "Nor is it Venix..."
2985         fi
2986 fi
2987 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2988 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2989 $rm -f foo
2990
2991 : see if we need a special compiler
2992 echo " "
2993 if ./usg; then
2994         case "$cc" in
2995         '') case "$Mcc" in
2996                 /*) dflt='Mcc';;
2997                 *) case "$large" in
2998                         -M*) dflt='cc';;
2999                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3000                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3001                                                 dflt='cc'
3002                                         else
3003                                                 dflt='cc -M'
3004                                         fi
3005                                 else
3006                                         dflt='cc'
3007                                 fi;;
3008                         esac;;
3009                 esac;;
3010         *)  dflt="$cc";;
3011         esac
3012         case "$dflt" in
3013         *M*)    $cat <<'EOM'
3014 On some older systems the default C compiler will not resolve multiple global
3015 references that happen to have the same name.  On some such systems the "Mcc"
3016 command may be used to force these to be resolved.  On other systems a "cc -M"
3017 command is required.  (Note that the -M flag on other systems indicates a
3018 memory model to use!) If you have the Gnu C compiler, you might wish to use
3019 that instead.
3020
3021 EOM
3022         ;;
3023         esac
3024         rp="Use which C compiler?"
3025         . ./myread
3026         cc="$ans"
3027 else
3028         case "$cc" in
3029         '') dflt=cc;;
3030         *) dflt="$cc";;
3031         esac
3032         rp="Use which C compiler?"
3033         . ./myread
3034         cc="$ans"
3035 fi
3036 : Look for a hint-file generated 'call-back-unit'.  Now that the
3037 : user has specified the compiler, we may need to set or change some
3038 : other defaults.
3039 if $test -f cc.cbu; then
3040     . ./cc.cbu
3041 fi
3042 echo " "
3043 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3044 $cat >gccvers.c <<EOM
3045 #include <stdio.h>
3046 int main() {
3047 #ifdef __GNUC__
3048 #ifdef __VERSION__
3049         printf("%s\n", __VERSION__);
3050 #else
3051         printf("%s\n", "1");
3052 #endif
3053 #endif
3054         exit(0);
3055 }
3056 EOM
3057 if $cc -o gccvers gccvers.c; then
3058         gccversion=`./gccvers`
3059         case "$gccversion" in
3060         '') echo "You are not using GNU cc." ;;
3061         *)  echo "You are using GNU cc $gccversion."
3062             ;;
3063         esac
3064 else
3065         echo " "
3066         echo "*** WHOA THERE!!! ***" >&4
3067         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3068         case "$knowitall" in
3069         '')
3070         echo "    You'd better start hunting for one and let me know about it." >&4
3071                 exit 1
3072                 ;;
3073         esac
3074 fi
3075 $rm -f gccvers*
3076 case "$gccversion" in
3077 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3078 esac
3079
3080 : decide how portable to be.  Allow command line overrides.
3081 case "$d_portable" in
3082 "$undef") ;;
3083 *)      d_portable="$define" ;;
3084 esac
3085
3086 : set up shell script to do ~ expansion
3087 cat >filexp <<EOSS
3088 $startsh
3089 : expand filename
3090 case "\$1" in
3091  ~/*|~)
3092         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3093         ;;
3094  ~*)
3095         if $test -f /bin/csh; then
3096                 /bin/csh -f -c "glob \$1"
3097                 failed=\$?
3098                 echo ""
3099                 exit \$failed
3100         else
3101                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3102                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3103                 if $test ! -d "\$dir"; then
3104                         me=\`basename \$0\`
3105                         echo "\$me: can't locate home directory for: \$name" >&2
3106                         exit 1
3107                 fi
3108                 case "\$1" in
3109                 */*)
3110                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3111                         ;;
3112                 *)
3113                         echo \$dir
3114                         ;;
3115                 esac
3116         fi
3117         ;;
3118 *)
3119         echo \$1
3120         ;;
3121 esac
3122 EOSS
3123 chmod +x filexp
3124 $eunicefix filexp
3125
3126 : now set up to get a file name
3127 cat <<EOS >getfile
3128 $startsh
3129 EOS
3130 cat <<'EOSC' >>getfile
3131 tilde=''
3132 fullpath=''
3133 already=''
3134 skip=''
3135 none_ok=''
3136 exp_file=''
3137 nopath_ok=''
3138 orig_rp="$rp"
3139 orig_dflt="$dflt"
3140 case "$gfpth" in
3141 '') gfpth='.' ;;
3142 esac
3143
3144 case "$fn" in
3145 *\(*)
3146         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3147         fn=`echo $fn | sed 's/(.*)//'`
3148         ;;
3149 esac
3150
3151 case "$fn" in
3152 *:*)
3153         loc_file=`expr $fn : '.*:\(.*\)'`
3154         fn=`expr $fn : '\(.*\):.*'`
3155         ;;
3156 esac
3157
3158 case "$fn" in
3159 *~*) tilde=true;;
3160 esac
3161 case "$fn" in
3162 */*) fullpath=true;;
3163 esac
3164 case "$fn" in
3165 *+*) skip=true;;
3166 esac
3167 case "$fn" in
3168 *n*) none_ok=true;;
3169 esac
3170 case "$fn" in
3171 *e*) exp_file=true;;
3172 esac
3173 case "$fn" in
3174 *p*) nopath_ok=true;;
3175 esac
3176
3177 case "$fn" in
3178 *f*) type='File';;
3179 *d*) type='Directory';;
3180 *l*) type='Locate';;
3181 esac
3182
3183 what="$type"
3184 case "$what" in
3185 Locate) what='File';;
3186 esac
3187
3188 case "$exp_file" in
3189 '')
3190         case "$d_portable" in
3191         "$define") ;;
3192         *) exp_file=true;;
3193         esac
3194         ;;
3195 esac
3196
3197 cd ..
3198 while test "$type"; do
3199         redo=''
3200         rp="$orig_rp"
3201         dflt="$orig_dflt"
3202         case "$tilde" in
3203         true) rp="$rp (~name ok)";;
3204         esac
3205         . UU/myread
3206         if test -f UU/getfile.ok && \
3207                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3208         then
3209                 value="$ans"
3210                 ansexp="$ans"
3211                 break
3212         fi
3213         case "$ans" in
3214         none)
3215                 value=''
3216                 ansexp=''
3217                 case "$none_ok" in
3218                 true) type='';;
3219                 esac
3220                 ;;
3221         *)
3222                 case "$tilde" in
3223                 '') value="$ans"
3224                         ansexp="$ans";;
3225                 *)
3226                         value=`UU/filexp $ans`
3227                         case $? in
3228                         0)
3229                                 if test "$ans" != "$value"; then
3230                                         echo "(That expands to $value on this system.)"
3231                                 fi
3232                                 ;;
3233                         *) value="$ans";;
3234                         esac
3235                         ansexp="$value"
3236                         case "$exp_file" in
3237                         '') value="$ans";;
3238                         esac
3239                         ;;
3240                 esac
3241                 case "$fullpath" in
3242                 true)
3243                         case "$ansexp" in
3244                         /*) value="$ansexp" ;;
3245                         *)
3246                                 redo=true
3247                                 case "$already" in
3248                                 true)
3249                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3250                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3251                                         ;;
3252                                 *)
3253                                 echo "Please give a full path name, starting with slash." >&4
3254                                         case "$tilde" in
3255                                         true)
3256                                 echo "Note that using ~name is ok provided it expands well." >&4
3257                                                 already=true
3258                                                 ;;
3259                                         esac
3260                                 esac
3261                                 ;;
3262                         esac
3263                         ;;
3264                 esac
3265                 case "$redo" in
3266                 '')
3267                         case "$type" in
3268                         File)
3269                                 for fp in $gfpth; do
3270                                         if test "X$fp" = X.; then
3271                                             pf="$ansexp"
3272                                         else    
3273                                             pf="$fp/$ansexp"
3274                                         fi
3275                                         if test -f "$pf"; then
3276                                                 type=''
3277                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3278                                         then
3279                                                 echo "($value is not a plain file, but that's ok.)"
3280                                                 type=''
3281                                         fi
3282                                         if test X"$type" = X; then
3283                                             value="$pf"
3284                                             break
3285                                         fi
3286                                 done
3287                                 ;;
3288                         Directory)
3289                                 for fp in $gfpth; do
3290                                         if test "X$fp" = X.; then
3291                                             pf="$ansexp"
3292                                         else    
3293                                             pf="$fp/$ansexp"
3294                                         fi
3295                                         if test -d "$pf"; then
3296                                                 type=''
3297                                                 value="$pf"
3298                                                 break
3299                                         fi
3300                                 done
3301                                 ;;
3302                         Locate)
3303                                 if test -d "$ansexp"; then
3304                                         echo "(Looking for $loc_file in directory $value.)"
3305                                         value="$value/$loc_file"
3306                                         ansexp="$ansexp/$loc_file"
3307                                 fi
3308                                 if test -f "$ansexp"; then
3309                                         type=''
3310                                 fi
3311                                 case "$nopath_ok" in
3312                                 true)   case "$value" in
3313                                         */*) ;;
3314                                         *)      echo "Assuming $value will be in people's path."
3315                                                 type=''
3316                                                 ;;
3317                                         esac
3318                                         ;;
3319                                 esac
3320                                 ;;
3321                         esac
3322
3323                         case "$skip" in
3324                         true) type='';
3325                         esac
3326
3327                         case "$type" in
3328                         '') ;;
3329                         *)
3330                                 if test "$fastread" = yes; then
3331                                         dflt=y
3332                                 else
3333                                         dflt=n
3334                                 fi
3335                                 rp="$what $value doesn't exist.  Use that name anyway?"
3336                                 . UU/myread
3337                                 dflt=''
3338                                 case "$ans" in
3339                                 y*) type='';;
3340                                 *) echo " ";;
3341                                 esac
3342                                 ;;
3343                         esac
3344                         ;;
3345                 esac
3346                 ;;
3347         esac
3348 done
3349 cd UU
3350 ans="$value"
3351 rp="$orig_rp"
3352 dflt="$orig_dflt"
3353 rm -f getfile.ok
3354 test "X$gfpthkeep" != Xy && gfpth=""
3355 EOSC
3356
3357 : What should the include directory be ?
3358 echo " "
3359 $echo $n "Hmm...  $c"
3360 dflt='/usr/include'
3361 incpath=''
3362 mips_type=''
3363 if $test -f /bin/mips && /bin/mips; then
3364         echo "Looks like a MIPS system..."
3365         $cat >usr.c <<'EOCP'
3366 #ifdef SYSTYPE_BSD43
3367 /bsd43
3368 #endif
3369 EOCP
3370         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3371                 dflt='/bsd43/usr/include'
3372                 incpath='/bsd43'
3373                 mips_type='BSD 4.3'
3374         else
3375                 mips_type='System V'
3376         fi
3377         $rm -f usr.c usr.out
3378         echo "and you're compiling with the $mips_type compiler and libraries."
3379         xxx_prompt=y
3380         echo "exit 0" >mips
3381 else
3382         echo "Doesn't look like a MIPS system."
3383         xxx_prompt=n
3384         echo "exit 1" >mips
3385 fi
3386 chmod +x mips
3387 $eunicefix mips
3388 case "$usrinc" in
3389 '') ;;
3390 *) dflt="$usrinc";;
3391 esac
3392 case "$xxx_prompt" in
3393 y)      fn=d/
3394         echo " "
3395         rp='Where are the include files you want to use?'
3396         . ./getfile
3397         usrinc="$ans"
3398         ;;
3399 *)      usrinc="$dflt"
3400         ;;
3401 esac
3402
3403 : see how we invoke the C preprocessor
3404 echo " "
3405 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3406 cat <<'EOT' >testcpp.c
3407 #define ABC abc
3408 #define XYZ xyz
3409 ABC.XYZ
3410 EOT
3411 cd ..
3412 if test ! -f cppstdin; then
3413         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3414                 # AIX cc -E doesn't show the absolute headerfile
3415                 # locations but we'll cheat by using the -M flag.
3416                 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
3417         else
3418                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3419         fi
3420 else
3421         echo "Keeping your $hint cppstdin wrapper."
3422 fi
3423 chmod 755 cppstdin
3424 wrapper=`pwd`/cppstdin
3425 ok='false'
3426 cd UU
3427
3428 if $test "X$cppstdin" != "X" && \
3429         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3430         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3431 then
3432         echo "You used to use $cppstdin $cppminus so we'll use that again."
3433         case "$cpprun" in
3434         '') echo "But let's see if we can live without a wrapper..." ;;
3435         *)
3436                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3437                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3438                 then
3439                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3440                         ok='true'
3441                 else
3442                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3443                 fi
3444                 ;;
3445         esac
3446 else
3447         case "$cppstdin" in
3448         '') ;;
3449         *)
3450                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3451                 ;;
3452         esac
3453 fi
3454
3455 if $ok; then
3456         : nothing
3457 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3458         $cc -E <testcpp.c >testcpp.out 2>&1; \
3459         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3460         echo "Yup, it does."
3461         x_cpp="$cc -E"
3462         x_minus='';
3463 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3464         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3465         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3466         echo "Yup, it does."
3467         x_cpp="$cc -E"
3468         x_minus='-';
3469 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3470         $cc -P <testcpp.c >testcpp.out 2>&1; \
3471         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3472         echo "Yipee, that works!"
3473         x_cpp="$cc -P"
3474         x_minus='';
3475 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3476         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3477         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3478         echo "At long last!"
3479         x_cpp="$cc -P"
3480         x_minus='-';
3481 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3482         $cpp <testcpp.c >testcpp.out 2>&1; \
3483         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3484         echo "It works!"
3485         x_cpp="$cpp"
3486         x_minus='';
3487 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3488         $cpp - <testcpp.c >testcpp.out 2>&1; \
3489         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3490         echo "Hooray, it works!  I was beginning to wonder."
3491         x_cpp="$cpp"
3492         x_minus='-';
3493 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3494         $wrapper <testcpp.c >testcpp.out 2>&1; \
3495         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496         x_cpp="$wrapper"
3497         x_minus=''
3498         echo "Eureka!"
3499 else
3500         dflt=''
3501         rp="No dice.  I can't find a C preprocessor.  Name one:"
3502         . ./myread
3503         x_cpp="$ans"
3504         x_minus=''
3505         $x_cpp <testcpp.c >testcpp.out 2>&1
3506         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3507                 echo "OK, that will do." >&4
3508         else
3509 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3510                 exit 1
3511         fi
3512 fi
3513
3514 case "$ok" in
3515 false)
3516         cppstdin="$x_cpp"
3517         cppminus="$x_minus"
3518         cpprun="$x_cpp"
3519         cpplast="$x_minus"
3520         set X $x_cpp
3521         shift
3522         case "$1" in
3523         "$cpp")
3524                 echo "Perhaps can we force $cc -E using a wrapper..."
3525                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3526                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3527                 then
3528                         echo "Yup, we can."
3529                         cppstdin="$wrapper"
3530                         cppminus='';
3531                 else
3532                         echo "Nope, we'll have to live without it..."
3533                 fi
3534                 ;;
3535         esac
3536         case "$cpprun" in
3537         "$wrapper")
3538                 cpprun=''
3539                 cpplast=''
3540                 ;;
3541         esac
3542         ;;
3543 esac
3544
3545 case "$cppstdin" in
3546 "$wrapper"|'cppstdin') ;;
3547 *) $rm -f $wrapper;;
3548 esac
3549 $rm -f testcpp.c testcpp.out
3550
3551 : Set private lib path
3552 case "$plibpth" in
3553 '') if ./mips; then
3554                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3555         fi;;
3556 esac
3557 case "$libpth" in
3558 ' ') dlist='';;
3559 '') dlist="$loclibpth $plibpth $glibpth";;
3560 *) dlist="$libpth";;
3561 esac
3562
3563 : Now check and see which directories actually exist, avoiding duplicates
3564 libpth=''
3565 for xxx in $dlist
3566 do
3567     if $test -d $xxx; then
3568                 case " $libpth " in
3569                 *" $xxx "*) ;;
3570                 *) libpth="$libpth $xxx";;
3571                 esac
3572     fi
3573 done
3574 $cat <<'EOM'
3575
3576 Some systems have incompatible or broken versions of libraries.  Among
3577 the directories listed in the question below, please remove any you
3578 know not to be holding relevant libraries, and add any that are needed.
3579 Say "none" for none.
3580
3581 EOM
3582 case "$libpth" in
3583 '') dflt='none';;
3584 *)
3585         set X $libpth
3586         shift
3587         dflt=${1+"$@"}
3588         ;;
3589 esac
3590 rp="Directories to use for library searches?"
3591 . ./myread
3592 case "$ans" in
3593 none) libpth=' ';;
3594 *) libpth="$ans";;
3595 esac
3596
3597 : compute shared library extension
3598 case "$so" in
3599 '')
3600         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3601                 dflt='sl'
3602         else
3603                 dflt='so'
3604         fi
3605         ;;
3606 *) dflt="$so";;
3607 esac
3608 $cat <<EOM
3609
3610 On some systems, shared libraries may be available.  Answer 'none' if
3611 you want to suppress searching of shared libraries for the remainder
3612 of this configuration.
3613
3614 EOM
3615 rp='What is the file extension used for shared libraries?'
3616 . ./myread
3617 so="$ans"
3618
3619 : Define several unixisms.
3620 : Hints files or command line option can be used to override them.
3621 : The convoluted testing is in case hints files set either the old
3622 : or the new name.
3623 case "$_exe" in
3624 '')     case "$exe_ext" in
3625     '') ;;
3626         *)      _exe="$exe_ext" ;;
3627         esac
3628         ;;
3629 esac
3630 case "$_a" in
3631 '')     case "$lib_ext" in
3632     '') _a='.a';;
3633         *)      _a="$lib_ext" ;;
3634         esac
3635         ;;
3636 esac
3637 case "$_o" in
3638 '') case "$obj_ext" in
3639         '')     _o='.o';;
3640         *)      _o="$obj_ext";;
3641         esac
3642         ;;
3643 esac
3644 case "$p_" in
3645 '') case "$path_sep" in
3646         '')     p_=':';;
3647         *)      p_="$path_sep";;
3648         esac
3649         ;;
3650 esac
3651 exe_ext=$_exe
3652 lib_ext=$_a
3653 obj_ext=$_o
3654 path_sep=$p_
3655
3656 : Which makefile gets called first.  This is used by make depend.
3657 case "$firstmakefile" in
3658 '') firstmakefile='makefile';;
3659 esac
3660
3661 cat <<EOM
3662
3663 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3664 Configure must be run with -Dusesocks.
3665
3666 Normally you do not need this and you should answer no.
3667
3668 EOM
3669 case "$usesocks" in
3670 $define|true|[yY]*)     dflt='y';;
3671 *) dflt='n';;
3672 esac
3673 rp='Build Perl for SOCKS?'
3674 . ./myread
3675 case "$ans" in
3676 y|Y)    val="$define" ;;     
3677 *)      val="$undef" ;;
3678 esac
3679 set usesocks
3680 eval $setvar
3681
3682 : Looking for optional libraries
3683 echo " "
3684 echo "Checking for optional libraries..." >&4
3685 case "$libs" in
3686 ' '|'') dflt='';;
3687 *) dflt="$libs";;
3688 esac
3689 case "$libswanted" in
3690 '') libswanted='c_s';;
3691 esac
3692 case "$usesocks" in
3693 $define)
3694         libswanted="$libswanted socks5 socks5_sh"
3695         ;;
3696 esac
3697 for thislib in $libswanted; do
3698         
3699         libname="$thislib"
3700         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`
3701            $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X" ; then
3702                 libstyle=shared
3703         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3704                 libstyle=shared
3705         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3706                 libstyle=static
3707         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3708                 libstyle=static
3709         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3710                 libstyle=static
3711                 libname=${thislib}_s
3712         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3713                 libstyle="static"
3714         fi
3715         if $test -f "$xxx"; then
3716                 eval $libscheck
3717         fi
3718         if $test -f "$xxx"; then
3719                 case "$libstyle" in
3720                 shared) echo "Found -l$libname (shared)." ;;
3721                 static) echo "Found -l$libname." ;;
3722                 *)      echo "Found -l$libname ($libstyle)." ;;
3723                 esac
3724                 case " $dflt " in
3725                 *"-l$thislib "*);;
3726                 *) dflt="$dflt -l$libname"
3727                    libsfound="$libsfound $xxx"
3728                    yyy=`basename $xxx`
3729                    libsfiles="$libsfiles $yyy"
3730                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3731                    case " $libsdirs " in
3732                    *" $yyy "*) ;;
3733                    *) libsdirs="$libsdirs $yyy" ;;
3734                    esac
3735                    ;;
3736                 esac
3737         else
3738                 echo "No -l$thislib."
3739         fi
3740 done
3741 set X $dflt
3742 shift
3743 dflt="$*"
3744 case "$libs" in
3745 '') dflt="$dflt";;
3746 *) dflt="$libs";;
3747 esac
3748 case "$dflt" in
3749 ' '|'') dflt='none';;
3750 esac
3751
3752 $cat <<EOM
3753
3754 In order to compile $package on your machine, a number of libraries
3755 are usually needed.  Include any other special libraries here as well.
3756 Say "none" for none.  The default list is almost always right.
3757 EOM
3758
3759 echo " "
3760 rp="What libraries to use?"
3761 . ./myread
3762 case "$ans" in
3763 none) libs=' ';;
3764 *) libs="$ans";;
3765 esac
3766
3767 : determine optimization, if desired, or use for debug flag also
3768 case "$optimize" in
3769 ' '|$undef) dflt='none';;
3770 '') dflt='-O';;
3771 *) dflt="$optimize";;
3772 esac
3773 $cat <<EOH
3774
3775 By default, $package compiles with the -O flag to use the optimizer.
3776 Alternately, you might want to use the symbolic debugger, which uses
3777 the -g flag (on traditional Unix systems).  Either flag can be
3778 specified here.  To use neither flag, specify the word "none".
3779
3780 EOH
3781 rp="What optimizer/debugger flag should be used?"
3782 . ./myread
3783 optimize="$ans"
3784 case "$optimize" in
3785 'none') optimize=" ";;
3786 esac
3787
3788 dflt=''
3789 : We will not override a previous value, but we might want to
3790 : augment a hint file
3791 case "$hint" in
3792 default|recommended)
3793         case "$gccversion" in
3794         1*) dflt='-fpcc-struct-return' ;;
3795         esac
3796         case "$optimize" in
3797         *-g*) dflt="$dflt -DDEBUGGING";;
3798         esac
3799         case "$gccversion" in
3800         2*) if test -d /etc/conf/kconfig.d &&
3801                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3802                 then
3803                         dflt="$dflt -posix"
3804                 fi
3805                 ;;
3806         esac
3807         case "$gccversion" in
3808         1*) ;;
3809         2.[0-8]*) ;;
3810         ?*)     echo " "
3811                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3812                 echo 'int main(void) { return 0; }' > gcctest.c
3813                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3814                         echo "Yes, it does." 2>&1
3815                         case "$ccflags" in
3816                         *strict-aliasing*) 
3817                                 echo "Leaving current flags $ccflags alone." 2>&1
3818                                 ;;
3819                         *) dflt="$dflt -fno-strict-aliasing" ;;
3820                         esac
3821                 else
3822                         echo "Nope, it doesn't, but that's ok." 2>&1
3823                 fi
3824                 ;;
3825         esac
3826         ;;
3827 esac
3828
3829 case "$mips_type" in
3830 *BSD*|'') inclwanted="$locincpth $usrinc";;
3831 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3832 esac
3833 for thisincl in $inclwanted; do
3834         if $test -d $thisincl; then
3835                 if $test x$thisincl != x$usrinc; then
3836                         case "$dflt" in
3837                         *$thisincl*);;
3838                         *) dflt="$dflt -I$thisincl";;
3839                         esac
3840                 fi
3841         fi
3842 done
3843
3844 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3845         xxx=true;
3846 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3847         xxx=true;
3848 else
3849         xxx=false;
3850 fi;
3851 if $xxx; then
3852         case "$dflt" in
3853         *$2*);;
3854         *) dflt="$dflt -D$2";;
3855         esac;
3856 fi'
3857
3858 set signal.h LANGUAGE_C; eval $inctest
3859
3860 case "$usesocks" in
3861 $define)
3862         ccflags="$ccflags -DSOCKS"
3863         ;;
3864 esac
3865
3866 case "$hint" in
3867 default|recommended) dflt="$ccflags $dflt" ;;
3868 *) dflt="$ccflags";;
3869 esac
3870
3871 case "$dflt" in
3872 ''|' ') dflt=none;;
3873 esac
3874 $cat <<EOH
3875
3876 Your C compiler may want other flags.  For this question you should include
3877 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3878 but you should NOT include libraries or ld flags like -lwhatever.  If you
3879 want $package to honor its debug switch, you should include -DDEBUGGING here.
3880 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3881
3882 To use no flags, specify the word "none".
3883
3884 EOH
3885 set X $dflt
3886 shift
3887 dflt=${1+"$@"}
3888 rp="Any additional cc flags?"
3889 . ./myread
3890 case "$ans" in
3891 none) ccflags='';;
3892 *) ccflags="$ans";;
3893 esac
3894
3895 : the following weeds options from ccflags that are of no interest to cpp
3896 cppflags="$ccflags"
3897 case "$gccversion" in
3898 1*) cppflags="$cppflags -D__GNUC__"
3899 esac
3900 case "$mips_type" in
3901 '');;
3902 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3903 esac
3904 case "$cppflags" in
3905 '');;
3906 *)
3907         echo " "
3908         echo "Let me guess what the preprocessor flags are..." >&4
3909         set X $cppflags
3910         shift
3911         cppflags=''
3912         $cat >cpp.c <<'EOM'
3913 #define BLURFL foo
3914
3915 BLURFL xx LFRULB
3916 EOM
3917         previous=''
3918         for flag in $*
3919         do
3920                 case "$flag" in
3921                 -*) ftry="$flag";;
3922                 *) ftry="$previous $flag";;
3923                 esac
3924                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3925                         >cpp1.out 2>/dev/null && \
3926                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3927                         >cpp2.out 2>/dev/null && \
3928                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3929                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3930                 then
3931                         cppflags="$cppflags $ftry"
3932                         previous=''
3933                 else
3934                         previous="$flag"
3935                 fi
3936         done
3937         set X $cppflags
3938         shift
3939         cppflags=${1+"$@"}
3940         case "$cppflags" in
3941         *-*)  echo "They appear to be: $cppflags";;
3942         esac
3943         $rm -f cpp.c cpp?.out
3944         ;;
3945 esac
3946
3947 : flags used in final linking phase
3948 case "$ldflags" in
3949 '') if ./venix; then
3950                 dflt='-i -z'
3951         else
3952                 dflt=''
3953         fi
3954         case "$ccflags" in
3955         *-posix*) dflt="$dflt -posix" ;;
3956         esac
3957         ;;
3958 *) dflt="$ldflags";;
3959 esac
3960
3961 : Try to guess additional flags to pick up local libraries.
3962 for thislibdir in $libpth; do
3963         case " $loclibpth " in
3964         *" $thislibdir "*)
3965                 case "$dflt " in 
3966                 *"-L$thislibdir "*) ;;
3967                 *)  dflt="$dflt -L$thislibdir" ;;
3968                 esac
3969                 ;;
3970         esac
3971 done
3972
3973 case "$dflt" in
3974 '') dflt='none' ;;
3975 esac
3976
3977 $cat <<EOH
3978
3979 Your C linker may need flags.  For this question you should
3980 include -L/whatever and any other flags used by the C linker, but you
3981 should NOT include libraries like -lwhatever.
3982
3983 Make sure you include the appropriate -L/path flags if your C linker
3984 does not normally search all of the directories you specified above,
3985 namely
3986         $libpth
3987 To use no flags, specify the word "none".
3988
3989 EOH
3990
3991 rp="Any additional ld flags (NOT including libraries)?"
3992 . ./myread
3993 case "$ans" in
3994 none) ldflags='';;
3995 *) ldflags="$ans";;
3996 esac
3997 rmlist="$rmlist pdp11"
3998
3999 : coherency check
4000 echo " "
4001 echo "Checking your choice of C compiler and flags for coherency..." >&4
4002 $cat > try.c <<'EOF'
4003 #include <stdio.h>
4004 int main() { printf("Ok\n"); exit(0); }
4005 EOF
4006 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4007 shift
4008 $cat >try.msg <<'EOM'
4009 I've tried to compile and run the following simple program:
4010
4011 EOM
4012 $cat try.c >> try.msg
4013
4014 $cat >> try.msg <<EOM
4015
4016 I used the command:
4017
4018         $*
4019         ./try
4020
4021 and I got the following output:
4022
4023 EOM
4024 dflt=y
4025 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4026         if sh -c './try' >>try.msg 2>&1; then
4027                 xxx=`./try`
4028                 case "$xxx" in
4029                 "Ok") dflt=n ;;
4030                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4031                         case " $libs " in
4032                         *" -lsfio "*)
4033                                 cat >> try.msg <<'EOQS'
4034 If $libs contains -lsfio, and sfio is mis-configured, then it
4035 sometimes (apparently) runs and exits with a 0 status, but with no
4036 output!  It may have to do with sfio's use of _exit vs. exit.
4037
4038 EOQS
4039                                 rp="You have a big problem.  Shall I abort Configure"
4040                                 dflt=y
4041                                 ;;
4042                         esac
4043                         ;;
4044                 esac
4045         else
4046                 echo "The program compiled OK, but exited with status $?." >>try.msg
4047                 rp="You have a problem.  Shall I abort Configure"
4048                 dflt=y
4049         fi
4050 else
4051         echo "I can't compile the test program." >>try.msg
4052         rp="You have a BIG problem.  Shall I abort Configure"
4053         dflt=y
4054 fi
4055 case "$dflt" in
4056 y)
4057         $cat try.msg >&4
4058         case "$knowitall" in
4059         '')
4060                 echo "(The supplied flags or libraries might be incorrect.)"
4061                 ;;
4062         *) dflt=n;;
4063         esac
4064         echo " "
4065         . ./myread
4066         case "$ans" in
4067         n*|N*) ;;
4068         *)      echo "Ok.  Stopping Configure." >&4
4069                 exit 1
4070                 ;;
4071         esac
4072         ;;
4073 n) echo "OK, that should do.";;
4074 esac
4075 $rm -f try try.* core
4076
4077 : define an is-a-typedef? function
4078 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4079 case "$inclist" in
4080 "") inclist="sys/types.h";;
4081 esac;
4082 eval "varval=\$$var";
4083 case "$varval" in
4084 "")
4085         $rm -f temp.c;
4086         for inc in $inclist; do
4087                 echo "#include <$inc>" >>temp.c;
4088         done;
4089         echo "#ifdef $type" >> temp.c;
4090         echo "printf(\"We have $type\");" >> temp.c;
4091         echo "#endif" >> temp.c;
4092         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4093         if $contains $type temp.E >/dev/null 2>&1; then
4094                 eval "$var=\$type";
4095         else
4096                 eval "$var=\$def";
4097         fi;
4098         $rm -f temp.?;;
4099 *) eval "$var=\$varval";;
4100 esac'
4101
4102 : define an is-a-typedef? function that prompts if the type is not available.
4103 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4104 case "$inclist" in
4105 "") inclist="sys/types.h";;
4106 esac;
4107 eval "varval=\$$var";
4108 case "$varval" in
4109 "")
4110         $rm -f temp.c;
4111         for inc in $inclist; do
4112                 echo "#include <$inc>" >>temp.c;
4113         done;
4114         echo "#ifdef $type" >> temp.c;
4115         echo "printf(\"We have $type\");" >> temp.c;
4116         echo "#endif" >> temp.c;
4117         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4118         echo " " ;
4119         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4120         if $contains $type temp.E >/dev/null 2>&1; then
4121                 echo "$type found." >&4;
4122                 eval "$var=\$type";
4123         else
4124                 echo "$type NOT found." >&4;
4125                 dflt="$def";
4126                 . ./myread ;
4127                 eval "$var=\$ans";
4128         fi;
4129         $rm -f temp.?;;
4130 *) eval "$var=\$varval";;
4131 esac'
4132
4133 : define a shorthand compile call
4134 compile='
4135 mc_file=$1;
4136 shift;
4137 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4138 : define a shorthand compile call for compilations that should be ok.
4139 compile_ok='
4140 mc_file=$1;
4141 shift;
4142 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4143
4144 : check for lengths of integral types
4145 echo " "
4146 case "$intsize" in
4147 '')
4148         echo "Checking to see how big your integers are..." >&4
4149         $cat >intsize.c <<'EOCP'
4150 #include <stdio.h>
4151 int main()
4152 {
4153         printf("intsize=%d;\n", (int)sizeof(int));
4154         printf("longsize=%d;\n", (int)sizeof(long));
4155         printf("shortsize=%d;\n", (int)sizeof(short));
4156         exit(0);
4157 }
4158 EOCP
4159         set intsize
4160         if eval $compile_ok && ./intsize > /dev/null; then
4161                 eval `./intsize`
4162                 echo "Your integers are $intsize bytes long."
4163                 echo "Your long integers are $longsize bytes long."
4164                 echo "Your short integers are $shortsize bytes long."
4165         else
4166                 $cat >&4 <<EOM
4167 !
4168 Help! I can't compile and run the intsize test program: please enlighten me!
4169 (This is probably a misconfiguration in your system or libraries, and
4170 you really ought to fix it.  Still, I'll try anyway.)
4171 !
4172 EOM
4173                 dflt=4
4174                 rp="What is the size of an integer (in bytes)?"
4175                 . ./myread
4176                 intsize="$ans"
4177                 dflt=$intsize
4178                 rp="What is the size of a long integer (in bytes)?"
4179                 . ./myread
4180                 longsize="$ans"
4181                 dflt=2
4182                 rp="What is the size of a short integer (in bytes)?"
4183                 . ./myread
4184                 shortsize="$ans"
4185         fi
4186         ;;
4187 esac
4188 $rm -f intsize intsize.*
4189
4190 : see what type lseek is declared as in the kernel
4191 rp="What is the type used for lseek's offset on this system?"
4192 set off_t lseektype long stdio.h sys/types.h
4193 eval $typedef_ask
4194
4195 echo " "
4196 $echo $n "Checking to see how big your file offsets are...$c" >&4
4197 $cat >try.c <<EOCP
4198 #include <sys/types.h>
4199 #include <stdio.h>
4200 int main()
4201 {
4202     printf("%d\n", (int)sizeof($lseektype));
4203     return(0); 
4204 }
4205 EOCP
4206 set try
4207 if eval $compile_ok; then
4208         lseeksize=`./try`
4209         $echo " $lseeksize bytes." >&4
4210 else
4211         dflt=$longsize
4212         echo " "
4213         echo "(I can't seem to compile the test program.  Guessing...)"
4214         rp="What is the size of your file offsets (in bytes)?"
4215         . ./myread
4216         lseeksize="$ans"
4217 fi
4218 $rm -f try.c try
4219
4220 : see what type file positions are declared as in the library
4221 rp="What is the type for file position used by fsetpos()?"
4222 set fpos_t fpostype long stdio.h sys/types.h
4223 eval $typedef_ask
4224
4225 echo " "
4226 case "$fpostype" in
4227 *_t) zzz="$fpostype"    ;;
4228 *)   zzz="fpos_t"       ;;
4229 esac
4230 $echo $n "Checking the size of $zzz...$c" >&4 
4231 cat > try.c <<EOCP
4232 #include <sys/types.h>
4233 #include <stdio.h>
4234 int main() {
4235     printf("%d\n", (int)sizeof($fpostype));
4236     exit(0);
4237 }
4238 EOCP
4239 set try
4240 if eval $compile_ok; then
4241         yyy=`./try`
4242         case "$yyy" in
4243         '')     fpossize=4
4244                 echo " "
4245                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4246                 ;;
4247         *)      fpossize=$yyy
4248                 echo " $fpossize bytes."
4249                 ;;
4250         esac
4251 else
4252         dflt="$longsize"
4253         echo " "
4254         echo "(I can't compile the test program.  Guessing...)" >&4
4255         rp="What is the size of your file positions (in bytes)?"
4256         . ./myread
4257         fpossize="$ans"
4258 fi
4259
4260
4261
4262 case "$lseeksize:$fpossize" in
4263 8:8) cat <<EOM
4264
4265 You can have files larger than 2 gigabytes.
4266 EOM
4267    val="$define" ;;
4268 *) cat <<EOM
4269
4270 Perl can be built to understand large files (files larger than 2 gigabytes)
4271 on some systems.  To do so, Configure must be run with -Duselargefiles.
4272
4273 If this doesn't make any sense to you, just accept the default 'y'.
4274 EOM
4275    case "$uselargefiles" in
4276    "$undef"|false|[nN]*) dflt='n' ;;
4277    *)   dflt='y' ;;
4278    esac
4279    rp='Try to understand large files, if available?'
4280    . ./myread
4281    case "$ans" in
4282    y|Y)         val="$define" ;;
4283    *)           val="$undef"  ;;
4284    esac
4285    ;;
4286 esac
4287 set uselargefiles
4288 eval $setvar
4289 case "$uselargefiles" in
4290 "$define")
4291 : Look for a hint-file generated 'call-back-unit'.  If the
4292 : user has specified that a large files perl is to be built,
4293 : we may need to set or change some other defaults.
4294         if $test -f uselfs.cbu; then
4295                 echo "Your platform has some specific hints for large file builds, using them..."
4296                 . ./uselfs.cbu
4297                 echo " "
4298                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4299                 $cat >try.c <<EOCP
4300 #include <sys/types.h>
4301 #include <stdio.h>
4302 int main()
4303 {
4304     printf("%d\n", (int)sizeof($lseektype));
4305     return(0); 
4306 }
4307 EOCP
4308                 set try
4309                 if eval $compile_ok; then
4310                         lseeksize=`./try`
4311                         $echo " $lseeksize bytes." >&4
4312                 else
4313                         dflt="$lseeksize"
4314                         echo " "
4315                         echo "(I can't seem to compile the test program.  Guessing...)"
4316                         rp="What is the size of your file offsets (in bytes)?"
4317                         . ./myread
4318                         lseeksize="$ans"
4319                 fi
4320                 case "$fpostype" in
4321                 *_t) zzz="$fpostype"    ;;
4322                 *)   zzz="fpos_t"       ;;
4323                 esac
4324                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4325                 $cat > try.c <<EOCP
4326 #include <sys/types.h>
4327 #include <stdio.h>
4328 int main() {
4329     printf("%d\n", (int)sizeof($fpostype));
4330     exit(0);
4331 }
4332 EOCP
4333                 set try
4334                 if eval $compile_ok; then
4335                         yyy=`./try`
4336                         dflt="$lseeksize"
4337                         case "$yyy" in
4338                         '')     echo " "
4339                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4340                                 ;;
4341                         *)      fpossize=$yyy
4342                                 echo " $fpossize bytes."
4343                                 ;;
4344                         esac
4345                 else
4346                         dflt="$fpossize"
4347                         echo " "
4348                         echo "(I can't compile the test program.  Guessing...)" >&4
4349                         rp="What is the size of your file positions (in bytes)?"
4350                         . ./myread
4351                         fpossize="$ans"
4352                 fi
4353                 $rm -f try.c try
4354         fi
4355         ;;
4356 esac
4357
4358
4359 case "$usemorebits" in
4360 "$define"|true|[yY]*)
4361         use64bits="$define"
4362         uselongdouble="$define"
4363         usemorebits="$define"
4364         ;;
4365 *)      usemorebits="$undef"
4366         ;;
4367 esac
4368
4369
4370 case "$intsize:$longsize" in
4371 8:*|*:8) cat <<EOM
4372
4373 You have natively 64-bit integers.
4374 EOM
4375    val="$define" ;;
4376 *) cat <<EOM
4377
4378 Perl can be built to take advantage of 64-bit integer types
4379 on some systems.  To do so, Configure must be run with -Duse64bits.
4380
4381 If this doesn't make any sense to you, just accept the default.
4382 EOM
4383   case "$use64bits" in
4384   $define|true|[yY]*)   dflt='y';;
4385   *) dflt='n';;
4386   esac
4387   rp='Try to use 64-bit integers, if available?'
4388   . ./myread
4389   case "$ans" in
4390   y|Y) val="$define" ;;
4391   *)   val="$undef"  ;;
4392   esac
4393   ;;
4394 esac
4395 set use64bits
4396 eval $setvar
4397
4398 case "$archname64" in
4399 '') archname64='' ;;    # not a typo
4400 esac
4401
4402 case "$use64bits" in
4403 "$define"|true|[yY]*)
4404 : Look for a hint-file generated 'call-back-unit'.  If the
4405 : user has specified that a 64-bit perl is to be built,
4406 : we may need to set or change some other defaults.
4407         if $test -f use64bits.cbu; then
4408                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4409                 . ./use64bits.cbu
4410         else
4411                 $cat <<EOM
4412 (Your platform doesn't have any specific hints for 64-bit builds.)
4413 EOM
4414                 case "$intsize:$longsize" in
4415 8:*|*:8) cat <<EOM
4416 (This is probably okay, as your system is a natively 64-bit system.)
4417 EOM
4418                   ;;
4419                 esac
4420                 case "$gccversion" in
4421                 '')     ;;
4422                 *)      case "$ccflags" in
4423                         *-DUSE_LONG_LONG*) ;;
4424                         *) $cat <<EOM
4425 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4426 to the compilation flags.
4427 EOM
4428                            ccflags="$ccflags -DUSE_LONG_LONG"
4429                            ;;
4430                         esac
4431                         ;;
4432                 esac
4433         fi
4434         ;;
4435 esac
4436
4437 : determine the architecture name
4438 echo " "
4439 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4440         tarch=`arch`"-$osname"
4441 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4442         if uname -m > tmparch 2>&1 ; then
4443                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4444                         -e 's/$/'"-$osname/" tmparch`
4445         else
4446                 tarch="$osname"
4447         fi
4448         $rm -f tmparch
4449 else
4450         tarch="$osname"
4451 fi
4452 case "$myarchname" in
4453 ''|"$tarch") ;;
4454 *)
4455         echo "(Your architecture name used to be $myarchname.)"
4456         archname=''
4457         ;;
4458 esac
4459 myarchname="$tarch"
4460 case "$archname" in
4461 '') dflt="$tarch";;
4462 *) dflt="$archname";;
4463 esac
4464 rp='What is your architecture name'
4465 . ./myread
4466 archname="$ans"
4467 case "$usethreads" in
4468 $define)
4469         echo "Threads selected." >&4
4470         case "$archname" in
4471         *-thread*) echo "...and architecture name already has -thread." >&4
4472                 ;;
4473         *)      archname="$archname-thread"
4474                 echo "...setting architecture name to $archname." >&4
4475                 ;;
4476         esac
4477         ;;
4478 esac
4479 case "$usemultiplicity" in
4480 $define)
4481         echo "Multiplicity selected." >&4
4482         case "$archname" in
4483         *-multi*) echo "...and architecture name already has -multi." >&4
4484                 ;;
4485         *)      archname="$archname-multi"
4486                 echo "...setting architecture name to $archname." >&4
4487                 ;;
4488         esac
4489         ;;
4490 esac
4491 case "$use64bits" in
4492 $define)
4493         case "$archname64" in
4494         '')
4495                 ;;
4496         *)
4497                 case "$archname" in
4498                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4499                         ;;
4500                 *)      archname="$archname-$archname64"
4501                         echo "...setting architecture name to $archname." >&4
4502                         ;;
4503                 esac
4504                 ;;
4505         esac
4506 esac
4507
4508 : determine root of directory hierarchy where package will be installed.
4509 case "$prefix" in
4510 '')
4511         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4512         ;;
4513 *)
4514         dflt="$prefix"
4515         ;;
4516 esac
4517 $cat <<EOM
4518
4519 By default, $package will be installed in $dflt/bin, manual pages
4520 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4521 installation directories. Typically this is something like /usr/local.
4522 If you wish to have binaries under /usr/bin but other parts of the
4523 installation under /usr/local, that's ok: you will be prompted
4524 separately for each of the installation directories, the prefix being
4525 only used to set the defaults.
4526
4527 EOM
4528 fn=d~
4529 rp='Installation prefix to use?'
4530 . ./getfile
4531 oldprefix=''
4532 case "$prefix" in
4533 '') ;;
4534 *)
4535         case "$ans" in
4536         "$prefix") ;;
4537         *) oldprefix="$prefix";;
4538         esac
4539         ;;
4540 esac
4541 prefix="$ans"
4542 prefixexp="$ansexp"
4543
4544 : is AFS running?
4545 echo " "
4546 case "$afs" in
4547 $define|true)   afs=true ;;
4548 $undef|false)   afs=false ;;
4549 *)      if test -d /afs; then
4550                 afs=true
4551         else
4552                 afs=false
4553         fi
4554         ;;
4555 esac
4556 if $afs; then
4557         echo "AFS may be running... I'll be extra cautious then..." >&4
4558 else
4559         echo "AFS does not seem to be running..." >&4
4560 fi
4561
4562 : determine installation prefix for where package is to be installed.
4563 if $afs; then 
4564 $cat <<EOM
4565
4566 Since you are running AFS, I need to distinguish the directory in which
4567 files will reside from the directory in which they are installed (and from
4568 which they are presumably copied to the former directory by occult means).
4569
4570 EOM
4571         case "$installprefix" in
4572         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4573         *) dflt="$installprefix";;
4574         esac
4575 else
4576 $cat <<EOM
4577
4578 In some special cases, particularly when building $package for distribution,
4579 it is convenient to distinguish between the directory in which files should 
4580 be installed from the directory ($prefix) in which they 
4581 will eventually reside.  For most users, these two directories are the same.
4582
4583 EOM
4584         case "$installprefix" in
4585         '') dflt=$prefix ;;
4586         *) dflt=$installprefix;;
4587         esac
4588 fi
4589 fn=d~
4590 rp='What installation prefix should I use for installing files?'
4591 . ./getfile
4592 installprefix="$ans"
4593 installprefixexp="$ansexp"
4594
4595 : set the prefixit variable, to compute a suitable default value
4596 prefixit='case "$3" in
4597 ""|none)
4598         case "$oldprefix" in
4599         "") eval "$1=\"\$$2\"";;
4600         *)
4601                 case "$3" in
4602                 "") eval "$1=";;
4603                 none)
4604                         eval "tp=\"\$$2\"";
4605                         case "$tp" in
4606                         ""|" ") eval "$1=\"\$$2\"";;
4607                         *) eval "$1=";;
4608                         esac;;
4609                 esac;;
4610         esac;;
4611 *)
4612         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4613         case "$tp" in
4614         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4615         /*-$oldprefix/*|\~*-$oldprefix/*)
4616                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4617         *) eval "$1=\"\$$2\"";;
4618         esac;;
4619 esac'
4620
4621 : set the base revision
4622 baserev=5.0
4623
4624
4625 : get the patchlevel
4626 echo " "
4627 echo "Getting the current patchlevel..." >&4
4628 if $test -r $rsrc/patchlevel.h;then
4629         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4630         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4631         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4632         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4633         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4634 else
4635         patchlevel=0
4636         subversion=0
4637         api_revision=0
4638         api_version=0
4639         api_subversion=0
4640 fi
4641 $echo $n "(You have $package" $c
4642 case "$package" in
4643 "*$baserev")    ;;
4644 *)              $echo $n " $baserev" $c ;;
4645 esac
4646 $echo $n " patchlevel $patchlevel" $c
4647 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4648 echo ".)"
4649 case "$osname" in
4650 dos|vms)
4651         : XXX Should be a Configure test for double-dots in filenames.
4652         version=`echo $baserev $patchlevel $subversion | \
4653                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4654         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4655                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4656         ;;
4657 *)
4658         version=`echo $baserev $patchlevel $subversion | \
4659                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4660         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4661                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4662         ;;
4663 esac
4664 : Special case the 5.005_xx maintenance series, which used 5.005
4665 : without any subversion label as a subdirectory in $sitelib
4666 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4667         api_versionstring='5.005'
4668 fi
4669
4670 : determine installation style
4671 : For now, try to deduce it from prefix unless it is already set.
4672 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4673 case "$installstyle" in
4674 '')     case "$prefix" in
4675                 *perl*) dflt='lib';;
4676                 *) dflt='lib/perl5' ;;
4677         esac
4678         ;;
4679 *)      dflt='lib/perl5' ;;
4680 esac
4681 : Probably not worth prompting for this since we prompt for all
4682 : the directories individually, and the prompt would be too long and
4683 : confusing anyway.
4684 installstyle=$dflt
4685
4686 : determine where private library files go
4687 : Usual default is /usr/local/lib/perl5/$version.
4688 : Also allow things like /opt/perl/lib/$version, since 
4689 : /opt/perl/lib/perl5... would be redundant.
4690 : The default "style" setting is made in installstyle.U
4691 case "$installstyle" in
4692 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4693 *)       set dflt privlib lib/$version ;;
4694 esac
4695 eval $prefixit
4696 $cat <<EOM
4697
4698 There are some auxiliary files for $package that need to be put into a
4699 private library directory that is accessible by everyone.
4700
4701 EOM
4702 fn=d~+
4703 rp='Pathname where the private library files will reside?'
4704 . ./getfile
4705 privlib="$ans"
4706 privlibexp="$ansexp"
4707 : Change installation prefix, if necessary.
4708 if $test X"$prefix" != X"$installprefix"; then
4709         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4710 else
4711         installprivlib="$privlibexp"
4712 fi
4713
4714 : set the prefixup variable, to restore leading tilda escape
4715 prefixup='case "$prefixexp" in
4716 "$prefix") ;;
4717 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4718 esac'
4719
4720 : determine where public architecture dependent libraries go
4721 set archlib archlib
4722 eval $prefixit
4723 : privlib default is /usr/local/lib/$package/$version
4724 : archlib default is /usr/local/lib/$package/$version/$archname
4725 : privlib may have an optional trailing /share.
4726 tdflt=`echo $privlib | $sed 's,/share$,,'`
4727 tdflt=$tdflt/$archname
4728 case "$archlib" in
4729 '')     dflt=$tdflt
4730         ;;
4731 *)      dflt="$archlib"
4732     ;;
4733 esac
4734 $cat <<EOM
4735
4736 $spackage contains architecture-dependent library files.  If you are
4737 sharing libraries in a heterogeneous environment, you might store
4738 these files in a separate location.  Otherwise, you can just include
4739 them with the rest of the public library files.
4740
4741 EOM
4742 fn=d+~
4743 rp='Where do you want to put the public architecture-dependent libraries?'
4744 . ./getfile
4745 archlib="$ans"
4746 archlibexp="$ansexp"
4747 if $test X"$archlib" = X"$privlib"; then
4748         d_archlib="$undef"
4749 else
4750         d_archlib="$define"
4751 fi
4752 : Change installation prefix, if necessary.
4753 if $test X"$prefix" != X"$installprefix"; then
4754         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4755 else
4756         installarchlib="$archlibexp"
4757 fi
4758
4759
4760 : Binary compatibility with 5.005 is not possible for builds
4761 : with advanced features
4762 case "$usethreads$usemultiplicity" in
4763 *define*)
4764         bincompat5005="$undef"
4765         d_bincompat5005="$undef"
4766         ;;
4767 *)      $cat <<EOM
4768
4769 Perl 5.006 can be compiled for binary compatibility with 5.005.
4770 If you decide to do so, you will be able to continue using most
4771 of the extensions that were compiled for Perl 5.005.
4772
4773 EOM
4774         case "$bincompat5005$d_bincompat5005" in
4775         *"$undef"*) dflt=n ;;
4776         *) dflt=y ;;
4777         esac
4778         rp='Binary compatibility with Perl 5.005?'
4779         . ./myread
4780         case "$ans" in
4781         y*) val="$define" ;;
4782         *)  val="$undef" ;;
4783         esac
4784         set d_bincompat5005
4785         eval $setvar
4786         case "$d_bincompat5005" in
4787         "$define")
4788                 bincompat5005="$define"
4789                 ;;
4790         *)      bincompat5005="$undef"
4791                 d_bincompat5005="$undef"
4792                 ;;
4793         esac
4794         ;;
4795 esac
4796
4797
4798 : see if setuid scripts can be secure
4799 $cat <<EOM
4800
4801 Some kernels have a bug that prevents setuid #! scripts from being
4802 secure.  Some sites have disabled setuid #! scripts because of this.
4803
4804 First let's decide if your kernel supports secure setuid #! scripts.
4805 (If setuid #! scripts would be secure but have been disabled anyway,
4806 don't say that they are secure if asked.)
4807
4808 EOM
4809
4810 val="$undef"
4811 if $test -d /dev/fd; then
4812         echo "#!$ls" >reflect
4813         chmod +x,u+s reflect
4814         ./reflect >flect 2>&1
4815         if $contains "/dev/fd" flect >/dev/null; then
4816                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4817                 val="$define"
4818         else
4819                 $cat <<EOM
4820 If you are not sure if they are secure, I can check but I'll need a
4821 username and password different from the one you are using right now.
4822 If you don't have such a username or don't want me to test, simply
4823 enter 'none'.
4824
4825 EOM
4826                 rp='Other username to test security of setuid scripts with?'
4827                 dflt='none'
4828                 . ./myread
4829                 case "$ans" in
4830                 n|none)
4831                         case "$d_suidsafe" in
4832                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4833                                 dflt=n;;
4834                         "$undef")
4835                                 echo "Well, the $hint value is *not* secure." >&4
4836                                 dflt=n;;
4837                         *)      echo "Well, the $hint value *is* secure." >&4
4838                                 dflt=y;;
4839                         esac
4840                         ;;
4841                 *)
4842                         $rm -f reflect flect
4843                         echo "#!$ls" >reflect
4844                         chmod +x,u+s reflect
4845                         echo >flect
4846                         chmod a+w flect
4847                         echo '"su" will (probably) prompt you for '"$ans's password."
4848                         su $ans -c './reflect >flect'
4849                         if $contains "/dev/fd" flect >/dev/null; then
4850                                 echo "Okay, it looks like setuid scripts are secure." >&4
4851                                 dflt=y
4852                         else
4853                                 echo "I don't think setuid scripts are secure." >&4
4854                                 dflt=n
4855                         fi
4856                         ;;
4857                 esac
4858                 rp='Does your kernel have *secure* setuid scripts?'
4859                 . ./myread
4860                 case "$ans" in
4861                 [yY]*)  val="$define";;
4862                 *)      val="$undef";;
4863                 esac
4864         fi
4865 else
4866         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4867         echo "(That's for file descriptors, not floppy disks.)"
4868         val="$undef"
4869 fi
4870 set d_suidsafe
4871 eval $setvar
4872
4873 $rm -f reflect flect
4874
4875 : now see if they want to do setuid emulation
4876 echo " "
4877 val="$undef"
4878 case "$d_suidsafe" in
4879 "$define")
4880         val="$undef"
4881         echo "No need to emulate SUID scripts since they are secure here." >& 4
4882         ;;
4883 *)
4884         $cat <<EOM
4885 Some systems have disabled setuid scripts, especially systems where
4886 setuid scripts cannot be secure.  On systems where setuid scripts have
4887 been disabled, the setuid/setgid bits on scripts are currently
4888 useless.  It is possible for $package to detect those bits and emulate
4889 setuid/setgid in a secure fashion.  This emulation will only work if
4890 setuid scripts have been disabled in your kernel.
4891
4892 EOM
4893         case "$d_dosuid" in
4894         "$define") dflt=y ;;
4895         *) dflt=n ;;
4896         esac
4897         rp="Do you want to do setuid/setgid emulation?"
4898         . ./myread
4899         case "$ans" in
4900         [yY]*)  val="$define";;
4901         *)      val="$undef";;
4902         esac
4903         ;;
4904 esac
4905 set d_dosuid
4906 eval $setvar
4907
4908 : determine filename position in cpp output
4909 echo " "
4910 echo "Computing filename position in cpp output for #include directives..." >&4
4911 echo '#include <stdio.h>' > foo.c
4912 $cat >fieldn <<EOF
4913 $startsh
4914 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4915 $grep '^[       ]*#.*stdio\.h' | \
4916 while read cline; do
4917         pos=1
4918         set \$cline
4919         while $test \$# -gt 0; do
4920                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4921                         echo "\$pos"
4922                         exit 0
4923                 fi
4924                 shift
4925                 pos=\`expr \$pos + 1\`
4926         done
4927 done
4928 EOF
4929 chmod +x fieldn
4930 fieldn=`./fieldn`
4931 $rm -f foo.c fieldn
4932 case $fieldn in
4933 '') pos='???';;
4934 1) pos=first;;
4935 2) pos=second;;
4936 3) pos=third;;
4937 *) pos="${fieldn}th";;
4938 esac
4939 echo "Your cpp writes the filename in the $pos field of the line."
4940
4941 : locate header file
4942 $cat >findhdr <<EOF
4943 $startsh
4944 wanted=\$1
4945 name=''
4946 for usrincdir in $usrinc
4947 do
4948         if test -f \$usrincdir/\$wanted; then
4949                 echo "\$usrincdir/\$wanted"
4950                 exit 0
4951         fi
4952 done
4953 awkprg='{ print \$$fieldn }'
4954 echo "#include <\$wanted>" > foo\$\$.c
4955 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4956 $grep "^[       ]*#.*\$wanted" | \
4957 while read cline; do
4958         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4959         case "\$name" in
4960         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4961         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4962         *) exit 2;;
4963         esac;
4964 done;
4965 #
4966 # status = 0: grep returned 0 lines, case statement not executed
4967 # status = 1: headerfile found
4968 # status = 2: while loop executed, no headerfile found
4969 #
4970 status=\$?
4971 $rm -f foo\$\$.c;
4972 if test \$status -eq 1; then
4973         exit 0;
4974 fi
4975 exit 1
4976 EOF
4977 chmod +x findhdr
4978
4979 : define an alternate in-header-list? function
4980 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4981 cont=true; xxf="echo \"<\$1> found.\" >&4";
4982 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4983 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4984 esac;
4985 case $# in 4) instead=instead;; *) instead="at last";; esac;
4986 while $test "$cont"; do
4987         xxx=`./findhdr $1`
4988         var=$2; eval "was=\$$2";
4989         if $test "$xxx" && $test -r "$xxx";
4990         then eval $xxf;
4991         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4992                 cont="";
4993         else eval $xxnf;
4994         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4995         set $yyy; shift; shift; yyy=$@;
4996         case $# in 0) cont="";;
4997         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4998                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4999         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5000                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5001         esac;
5002 done;
5003 while $test "$yyy";
5004 do set $yyy; var=$2; eval "was=\$$2";
5005         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5006         set $yyy; shift; shift; yyy=$@;
5007 done'
5008
5009 : see if this is a malloc.h system
5010 set malloc.h i_malloc
5011 eval $inhdr
5012
5013 : see if stdlib is available
5014 set stdlib.h i_stdlib
5015 eval $inhdr
5016
5017 : determine which malloc to compile in
5018 echo " "
5019 case "$usemymalloc" in
5020 ''|[yY]*|true|$define)  dflt='y' ;;
5021 *)      dflt='n' ;;
5022 esac
5023 rp="Do you wish to attempt to use the malloc that comes with $package?"
5024 . ./myread
5025 usemymalloc="$ans"
5026 case "$ans" in
5027 y*|true)
5028         usemymalloc='y'
5029         mallocsrc='malloc.c'
5030         mallocobj="malloc$_o"
5031         d_mymalloc="$define"
5032         case "$libs" in
5033         *-lmalloc*)
5034                 : Remove malloc from list of libraries to use
5035                 echo "Removing unneeded -lmalloc from library list" >&4
5036                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5037                 shift
5038                 libs="$*"
5039                 echo "libs = $libs" >&4
5040                 ;;
5041         esac
5042         ;;
5043 *)
5044         usemymalloc='n'
5045         mallocsrc=''
5046         mallocobj=''
5047         d_mymalloc="$undef"
5048         ;;
5049 esac
5050
5051 : compute the return types of malloc and free
5052 echo " "
5053 $cat >malloc.c <<END
5054 #$i_malloc I_MALLOC
5055 #$i_stdlib I_STDLIB
5056 #include <stdio.h>
5057 #include <sys/types.h>
5058 #ifdef I_MALLOC
5059 #include <malloc.h>
5060 #endif
5061 #ifdef I_STDLIB
5062 #include <stdlib.h>
5063 #endif
5064 #ifdef TRY_MALLOC
5065 void *malloc();
5066 #endif
5067 #ifdef TRY_FREE
5068 void free();
5069 #endif
5070 END
5071 case "$malloctype" in
5072 '')
5073         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5074                 malloctype='void *'
5075         else
5076                 malloctype='char *'
5077         fi
5078         ;;
5079 esac
5080 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5081
5082 case "$freetype" in
5083 '')
5084         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5085                 freetype='void'
5086         else
5087                 freetype='int'
5088         fi
5089         ;;
5090 esac
5091 echo "Your system uses $freetype free(), it would seem." >&4
5092 $rm -f malloc.[co]
5093 $cat <<EOM
5094
5095 The installation process will also create a directory for
5096 vendor-supplied add-ons.  Vendors who supply perl with their system
5097 may find it convenient to place all vendor-supplied files in this
5098 directory rather than in the main distribution directory.  This will
5099 ease upgrades between binary-compatible maintenance versions of perl.
5100
5101 Of course you may also use these directories in whatever way you see
5102 fit.  For example, you might use them to access modules shared over a
5103 company-wide network.
5104
5105 The default answer should be fine for most people.
5106 This causes further questions about vendor add-ons to be skipped
5107 and no vendor-specific directories will be configured for perl.
5108
5109 EOM
5110 rp='Do you want to configure vendor-specific add-on directories?'
5111 case "$usevendorprefix" in
5112 define|true|[yY]*) dflt=y ;;
5113 *) dflt=n ;;
5114 esac
5115 . ./myread
5116 case "$ans" in
5117 [yY]*)  fn=d~+
5118         rp='Installation prefix to use for vendor-supplied add-ons?'
5119         case "$vendorprefix" in
5120         '') dflt='' ;;
5121         *)  dflt=$vendorprefix ;;
5122         esac
5123         . ./getfile
5124         oldvendorprefix=''
5125         case "$vendorprefix" in
5126         '') ;;
5127         *)      case "$ans" in
5128                 "$prefix") ;;
5129                 *) oldvendorprefix="$prefix";;
5130                 esac
5131                 ;;
5132         esac
5133         usevendorprefix="$define"
5134         vendorprefix="$ans"
5135         vendorprefixexp="$ansexp"
5136         ;;
5137 *)      usevendorprefix="$undef"
5138         vendorprefix=''
5139         vendorprefixexp=''
5140         ;;
5141 esac
5142
5143 case "$vendorprefix" in
5144 '')     d_vendorlib="$undef"
5145         vendorlib=''
5146         vendorlibexp=''
5147         ;;
5148 *)      d_vendorlib="$define"
5149         : determine where vendor-supplied modules go.
5150         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5151         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5152         case "$installstyle" in
5153         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5154         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5155         esac
5156         fn=d~+
5157         rp='Pathname for the vendor-supplied library files?'
5158         . ./getfile
5159         vendorlib="$ans"
5160         vendorlibexp="$ansexp"
5161         : Change installation prefix, if necessary.
5162         if $test X"$prefix" != X"$installprefix"; then
5163                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5164         else
5165                 installvendorlib="$vendorlibexp"
5166         fi
5167         ;;
5168 esac
5169
5170 : Cruising for prototypes
5171 echo " "
5172 echo "Checking out function prototypes..." >&4
5173 $cat >prototype.c <<'EOCP'
5174 int main(int argc, char *argv[]) {
5175         exit(0);}
5176 EOCP
5177 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5178         echo "Your C compiler appears to support function prototypes."
5179         val="$define"
5180 else
5181         echo "Your C compiler doesn't seem to understand function prototypes."
5182         val="$undef"
5183 fi
5184 set prototype
5185 eval $setvar
5186 $rm -f prototype*
5187
5188 case "$prototype" in
5189 "$define") ;;
5190 *)      ansi2knr='ansi2knr'
5191         echo " "
5192         cat <<EOM >&4
5193
5194 $me:  FATAL ERROR:
5195 This version of $package can only be compiled by a compiler that 
5196 understands function prototypes.  Unfortunately, your C compiler 
5197         $cc $ccflags
5198 doesn't seem to understand them.  Sorry about that.
5199
5200 If GNU cc is available for your system, perhaps you could try that instead.  
5201
5202 Eventually, we hope to support building Perl with pre-ANSI compilers.
5203 If you would like to help in that effort, please contact <perlbug@perl.org>.
5204
5205 Aborting Configure now.
5206 EOM
5207         exit 2
5208         ;;
5209 esac
5210
5211 : determine where public executables go
5212 echo " "
5213 set dflt bin bin
5214 eval $prefixit
5215 fn=d~
5216 rp='Pathname where the public executables will reside?'
5217 . ./getfile
5218 if $test "X$ansexp" != "X$binexp"; then
5219         installbin=''
5220 fi
5221 bin="$ans"
5222 binexp="$ansexp"
5223 : Change installation prefix, if necessary.
5224 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5225 if $test X"$prefix" != X"$installprefix"; then
5226         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5227 else
5228         installbin="$binexp"
5229 fi
5230
5231 $cat <<EOM
5232
5233 After $package is installed, you may wish to install various
5234 add-on modules and utilities.  Typically, these add-ons will
5235 be installed under $prefix with the rest
5236 of this package.  However, you may wish to install such add-ons
5237 elsewhere under a different prefix.
5238
5239 If you do not wish to put everything under a single prefix, that's
5240 ok.  You will be prompted for the individual locations; this siteprefix
5241 is only used to suggest the defaults.
5242
5243 The default should be fine for most people.
5244
5245 EOM
5246 fn=d~+
5247 rp='Installation prefix to use for add-on modules and utilities?'
5248 : XXX Here might be another good place for an installstyle setting.
5249 case "$siteprefix" in
5250 '') dflt=$prefix ;;
5251 *)  dflt=$siteprefix ;;
5252 esac
5253 . ./getfile
5254 oldsiteprefix=''
5255 case "$siteprefix" in
5256 '') ;;
5257 *)
5258         case "$ans" in
5259         "$prefix") ;;
5260         *) oldsiteprefix="$prefix";;
5261         esac
5262         ;;
5263 esac
5264 siteprefix="$ans"
5265 siteprefixexp="$ansexp"
5266
5267 : determine where site specific libraries go.
5268 : Usual default is /usr/local/lib/perl5/site_perl/$version
5269 : The default "style" setting is made in installstyle.U
5270 : XXX No longer works with Prefixit stuff.
5271 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5272 case "$installstyle" in
5273 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5274 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5275 esac
5276 $cat <<EOM
5277
5278 The installation process will create a directory for
5279 site-specific extensions and modules.  Most users find it convenient
5280 to place all site-specific files in this directory rather than in the
5281 main distribution directory.
5282
5283 EOM
5284 fn=d~+
5285 rp='Pathname for the site-specific library files?'
5286 . ./getfile
5287 sitelib="$ans"
5288 sitelibexp="$ansexp"
5289 : Change installation prefix, if necessary.
5290 if $test X"$prefix" != X"$installprefix"; then
5291         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5292 else
5293         installsitelib="$sitelibexp"
5294 fi
5295
5296 : Determine list of previous versions to include in @INC
5297 $cat > getverlist <<EOPL
5298 #!$perl -w
5299 use File::Basename;
5300 \$api_versionstring = "$api_versionstring";
5301 \$version = "$version";
5302 \$sitelib = "$sitelib";
5303 \$archname = "$archname";
5304 EOPL
5305         $cat >> getverlist <<'EOPL'
5306 # Can't have leading @ because metaconfig interprets it as a command!
5307 ;@inc_version_list=();
5308 $stem=dirname($sitelib);
5309 # Redo to do opendir/readdir? 
5310 if (-d $stem) {
5311     chdir($stem);
5312     ;@candidates = glob("5.*");
5313 }
5314 else {
5315     ;@candidates = ();
5316 }
5317
5318 # XXX ToDo:  These comparisons must be reworked when two-digit
5319 # subversions come along, so that 5.7.10 compares as greater than
5320 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5321 # widespread that we can use the built-in version vectors rather
5322 # than reinventing them here.  For 5.6.0, however, we must
5323 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5324 foreach $d (@candidates) {
5325     if ($d lt $version) {
5326         if ($d ge $api_versionstring) {
5327             unshift(@inc_version_list, "$d/$archname", $d);
5328         }
5329         elsif ($d ge "5.005") {
5330             unshift(@inc_version_list, $d);
5331         }
5332     }
5333     else {
5334         # Skip newer version.  I.e. don't look in
5335         # 5.7.0 if we're installing 5.6.1.
5336     }
5337 }
5338
5339 if (@inc_version_list) {
5340     print join(' ', @inc_version_list);
5341 }
5342 else {
5343     # Blank space to preserve value for next Configure run.
5344     print " ";
5345 }
5346 EOPL
5347 chmod +x getverlist
5348 case "$inc_version_list" in
5349 '')     if test -x $perl; then
5350                 dflt=`$perl getverlist`
5351         else
5352                 dflt='none'
5353         fi
5354         ;;
5355 $undef) dflt='none' ;;
5356 *)  dflt="$inc_version_list" ;;
5357 esac
5358 $cat <<'EOM'
5359
5360 In order to ease the process of upgrading, this version of perl 
5361 can be configured to use modules built and installed with earlier 
5362 versions of perl that were installed under $prefix.  Specify here
5363 the list of earlier versions that this version of perl should check.
5364 If Configure detected no earlier versions of perl installed under
5365 $prefix, then the list will be empty.  Answer 'none' to tell perl
5366 to not search earlier versions.
5367
5368 The default should almost always be sensible, so if you're not sure,
5369 just accept the default.
5370 EOM
5371
5372 rp='List of earlier versions to include in @INC?'
5373 . ./myread
5374 case "$ans" in
5375 [Nn]one) inc_version_list=' ' ;;
5376 *) inc_version_list="$ans" ;;
5377 esac
5378 case "$inc_version_list" in
5379 ''|' ') 
5380         inc_version_list_init='0';;
5381 *)      inc_version_list_init=`echo $inc_version_list |
5382                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5383         ;;
5384 esac
5385 $rm -f getverlist
5386
5387 : determine whether to install perl also as /usr/bin/perl
5388
5389 echo " "
5390 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5391         $cat <<EOM
5392 Many scripts expect to perl to be installed as /usr/bin/perl.
5393 I can install the perl you are about to compile also as /usr/bin/perl
5394 (in addition to $installbin/perl).
5395 EOM
5396         case "$installusrbinperl" in
5397         "$undef"|[nN]*) dflt='n';;
5398         *)              dflt='y';;
5399         esac
5400         rp="Do you want to install perl as /usr/bin/perl?"
5401         . ./myread
5402         case "$ans" in
5403         [yY]*)  val="$define";;
5404         *)      val="$undef" ;;
5405         esac
5406 else
5407         val="$undef"
5408 fi
5409 set installusrbinperl
5410 eval $setvar
5411
5412 echo " "
5413 echo "Checking for GNU C Library..." >&4
5414 cat >gnulibc.c <<EOM
5415 #include <stdio.h>
5416 int main()
5417 {
5418 #ifdef __GLIBC__
5419     exit(0);
5420 #else
5421     exit(1);
5422 #endif
5423 }
5424 EOM
5425 set gnulibc
5426 if eval $compile_ok && ./gnulibc; then
5427         val="$define"
5428         echo "You are using the GNU C Library"
5429 else
5430         val="$undef"
5431         echo "You are not using the GNU C Library"
5432 fi
5433 $rm -f gnulibc*
5434 set d_gnulibc
5435 eval $setvar
5436
5437 : see if nm is to be used to determine whether a symbol is defined or not
5438 case "$usenm" in
5439 '')
5440         dflt=''
5441         case "$d_gnulibc" in
5442         "$define")
5443                 echo " "
5444                 echo "nm probably won't work on the GNU C Library." >&4
5445                 dflt=n
5446                 ;;
5447         esac
5448         case "$dflt" in
5449         '') 
5450                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5451                         echo " "
5452                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5453                         echo "'nm' won't be sufficient on this sytem." >&4
5454                         dflt=n
5455                 fi
5456                 ;;
5457         esac
5458         case "$dflt" in
5459         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5460                 if $test $dflt -gt 20; then
5461                         dflt=y
5462                 else
5463                         dflt=n
5464                 fi
5465                 ;;
5466         esac
5467         ;;
5468 *)
5469         case "$usenm" in
5470         true|$define) dflt=y;;
5471         *) dflt=n;;
5472         esac
5473         ;;
5474 esac
5475 $cat <<EOM
5476
5477 I can use $nm to extract the symbols from your C libraries. This
5478 is a time consuming task which may generate huge output on the disk (up
5479 to 3 megabytes) but that should make the symbols extraction faster. The
5480 alternative is to skip the 'nm' extraction part and to compile a small
5481 test program instead to determine whether each symbol is present. If
5482 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5483 this may be the best solution.
5484
5485 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5486
5487 EOM
5488 rp="Shall I use $nm to extract C symbols from the libraries?"
5489 . ./myread
5490 case "$ans" in
5491 [Nn]*) usenm=false;;
5492 *) usenm=true;;
5493 esac
5494
5495 runnm=$usenm
5496 case "$reuseval" in
5497 true) runnm=false;;
5498 esac
5499
5500 : nm options which may be necessary
5501 case "$nm_opt" in
5502 '') if $test -f /mach_boot; then
5503                 nm_opt=''       # Mach
5504         elif $test -d /usr/ccs/lib; then
5505                 nm_opt='-p'     # Solaris (and SunOS?)
5506         elif $test -f /dgux; then
5507                 nm_opt='-p'     # DG-UX
5508         elif $test -f /lib64/rld; then
5509                 nm_opt='-p'     # 64-bit Irix
5510         else
5511                 nm_opt=''
5512         fi;;
5513 esac
5514
5515 : nm options which may be necessary for shared libraries but illegal
5516 : for archive libraries.  Thank you, Linux.
5517 case "$nm_so_opt" in
5518 '')     case "$myuname" in
5519         *linux*)
5520                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5521                         nm_so_opt='--dynamic'
5522                 fi
5523                 ;;
5524         esac
5525         ;;
5526 esac
5527
5528 case "$runnm" in
5529 true)
5530 : get list of predefined functions in a handy place
5531 echo " "
5532 case "$libc" in
5533 '') libc=unknown
5534         case "$libs" in
5535         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5536         esac
5537         ;;
5538 esac
5539 libnames='';
5540 case "$libs" in
5541 '') ;;
5542 *)  for thislib in $libs; do
5543         case "$thislib" in
5544         -lc|-lc_s)
5545                 : Handle C library specially below.
5546                 ;;
5547         -l*)
5548                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5549                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5550                         :
5551                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5552                         :
5553                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5554                         :
5555                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5556                         :
5557                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5558                         :
5559                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5560                         :
5561                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5562                         :
5563                 else
5564                         try=''
5565                 fi
5566                 libnames="$libnames $try"
5567                 ;;
5568         *) libnames="$libnames $thislib" ;;
5569         esac
5570         done
5571         ;;
5572 esac
5573 xxx=normal
5574 case "$libc" in
5575 unknown)
5576         set /lib/libc.$so
5577         for xxx in $libpth; do
5578                 $test -r $1 || set $xxx/libc.$so
5579                 : The messy sed command sorts on library version numbers.
5580                 $test -r $1 || \
5581                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5582                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5583                                 h
5584                                 s/[0-9][0-9]*/0000&/g
5585                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5586                                 G
5587                                 s/\n/ /' | \
5588                          sort | $sed -e 's/^.* //'`
5589                 eval set \$$#
5590         done
5591         $test -r $1 || set /usr/ccs/lib/libc.$so
5592         $test -r $1 || set /lib/libsys_s$_a
5593         ;;
5594 *)
5595         set blurfl
5596         ;;
5597 esac
5598 if $test -r "$1"; then
5599         echo "Your (shared) C library seems to be in $1."
5600         libc="$1"
5601 elif $test -r /lib/libc && $test -r /lib/clib; then
5602         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5603         xxx=apollo
5604         libc='/lib/clib /lib/libc'
5605         if $test -r /lib/syslib; then
5606                 echo "(Your math library is in /lib/syslib.)"
5607                 libc="$libc /lib/syslib"
5608         fi
5609 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5610         echo "Your C library seems to be in $libc, as you said before."
5611 elif $test -r $incpath/usr/lib/libc$_a; then
5612         libc=$incpath/usr/lib/libc$_a;
5613         echo "Your C library seems to be in $libc.  That's fine."
5614 elif $test -r /lib/libc$_a; then
5615         libc=/lib/libc$_a;
5616         echo "Your C library seems to be in $libc.  You're normal."
5617 else
5618         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5619                 :
5620         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5621                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5622         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5623                 :
5624         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5625                 :
5626         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5627                 :
5628         else
5629                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5630         fi
5631         if $test -r "$tans"; then
5632                 echo "Your C library seems to be in $tans, of all places."
5633                 libc=$tans
5634         else
5635                 libc='blurfl'
5636         fi
5637 fi
5638 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5639         dflt="$libc"
5640         cat <<EOM
5641
5642 If the guess above is wrong (which it might be if you're using a strange
5643 compiler, or your machine supports multiple models), you can override it here.
5644
5645 EOM
5646 else
5647         dflt=''
5648         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5649         cat >&4 <<EOM
5650 I can't seem to find your C library.  I've looked in the following places:
5651
5652 EOM
5653         $sed 's/^/      /' libpath
5654         cat <<EOM
5655
5656 None of these seems to contain your C library. I need to get its name...
5657
5658 EOM
5659 fi
5660 fn=f
5661 rp='Where is your C library?'
5662 . ./getfile
5663 libc="$ans"
5664
5665 echo " "
5666 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5667 set X `cat libnames`
5668 shift
5669 xxx=files
5670 case $# in 1) xxx=file; esac
5671 echo "Extracting names from the following $xxx for later perusal:" >&4
5672 echo " "
5673 $sed 's/^/      /' libnames >&4
5674 echo " "
5675 $echo $n "This may take a while...$c" >&4
5676
5677 for file in $*; do
5678         case $file in
5679         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5680         *) $nm $nm_opt $file 2>/dev/null;;
5681         esac
5682 done >libc.tmp
5683
5684 $echo $n ".$c"
5685 $grep fprintf libc.tmp > libc.ptf
5686 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5687 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5688 xxx='[ADTSIW]'
5689 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5690         eval $xscan;\
5691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5692                 eval $xrun
5693 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5694         eval $xscan;\
5695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5696                 eval $xrun
5697 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5698         eval $xscan;\
5699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5700                 eval $xrun
5701 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5702         eval $xscan;\
5703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5704                 eval $xrun
5705 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5706         eval $xscan;\
5707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5708                 eval $xrun
5709 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5710         eval $xscan;\
5711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5712                 eval $xrun
5713 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5714                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5715         eval $xscan;\
5716         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5717                 eval $xrun
5718 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5719         eval $xscan;\
5720         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5721                 eval $xrun
5722 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5723         eval $xscan;\
5724         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5725                 eval $xrun
5726 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5727         eval $xscan;\
5728         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5729                 eval $xrun
5730 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5731         eval $xscan;\
5732         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5733                 eval $xrun
5734 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5735         eval $xscan;\
5736         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5737                 eval $xrun
5738 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5739         eval $xscan;\
5740         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5741                 eval $xrun
5742 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5743         eval $xscan;\
5744         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5745                 eval $xrun
5746 else
5747         $nm -p $* 2>/dev/null >libc.tmp
5748         $grep fprintf libc.tmp > libc.ptf
5749         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5750                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5751         then
5752                 nm_opt='-p'
5753                 eval $xrun
5754         else
5755                 echo " "
5756                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5757                 com=''
5758                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5759                         for thisname in $libnames $libc; do
5760                                 $ar t $thisname >>libc.tmp
5761                         done
5762                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5763                         echo "Ok." >&4
5764                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5765                         # Repeat libc to extract forwarders to DLL entries too
5766                         for thisname in $libnames $libc; do
5767                                 $ar tv $thisname >>libc.tmp
5768                                 # Revision 50 of EMX has bug in $ar.
5769                                 # it will not extract forwarders to DLL entries
5770                                 # Use emximp which will extract exactly them.
5771                                 emximp -o tmp.imp $thisname \
5772                                     2>/dev/null && \
5773                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5774                                     < tmp.imp >>libc.tmp
5775                                 $rm tmp.imp
5776                         done
5777                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5778                         echo "Ok." >&4
5779                 else
5780                         echo "$ar didn't seem to work right." >&4
5781                         echo "Maybe this is a Cray...trying bld instead..." >&4
5782                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5783                         then
5784                                 for thisname in $libnames; do
5785                                         bld t $libnames | \
5786                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5787                                         $ar t $thisname >>libc.tmp
5788                                 done
5789                                 echo "Ok." >&4
5790                         else
5791                                 echo "That didn't work either.  Giving up." >&4
5792                                 exit 1
5793                         fi
5794                 fi
5795         fi
5796 fi
5797 nm_extract="$com"
5798 if $test -f /lib/syscalls.exp; then
5799         echo " "
5800         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5801         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5802 fi
5803 ;;
5804 esac
5805 $rm -f libnames libpath
5806
5807 : see if dld is available
5808 set dld.h i_dld
5809 eval $inhdr
5810
5811 : is a C symbol defined?
5812 csym='tlook=$1;
5813 case "$3" in
5814 -v) tf=libc.tmp; tc=""; tdc="";;
5815 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5816 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5817 esac;
5818 tx=yes;
5819 case "$reuseval-$4" in
5820 true-) ;;
5821 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5822 esac;
5823 case "$tx" in
5824 yes)
5825         case "$runnm" in
5826         true)
5827                 if $contains $tlook $tf >/dev/null 2>&1;
5828                 then tval=true;
5829                 else tval=false;
5830                 fi;;
5831         *)
5832                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5833                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5834                 then tval=true;
5835                 else tval=false;
5836                 fi;
5837                 $rm -f t t.c;;
5838         esac;;
5839 *)
5840         case "$tval" in
5841         $define) tval=true;;
5842         *) tval=false;;
5843         esac;;
5844 esac;
5845 eval "$2=$tval"'
5846
5847 : define an is-in-libc? function
5848 inlibc='echo " "; td=$define; tu=$undef;
5849 sym=$1; var=$2; eval "was=\$$2";
5850 tx=yes;
5851 case "$reuseval$was" in
5852 true) ;;
5853 true*) tx=no;;
5854 esac;
5855 case "$tx" in
5856 yes)
5857         set $sym tres -f;
5858         eval $csym;
5859         case "$tres" in
5860         true)
5861                 echo "$sym() found." >&4;
5862                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5863         *)
5864                 echo "$sym() NOT found." >&4;
5865                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5866         esac;;
5867 *)
5868         case "$was" in
5869         $define) echo "$sym() found." >&4;;
5870         *) echo "$sym() NOT found." >&4;;
5871         esac;;
5872 esac'
5873
5874 : see if dlopen exists
5875 xxx_runnm="$runnm"
5876 runnm=false
5877 set dlopen d_dlopen
5878 eval $inlibc
5879 runnm="$xxx_runnm"
5880
5881 : determine which dynamic loading, if any, to compile in
5882 echo " "
5883 dldir="ext/DynaLoader"
5884 case "$usedl" in
5885 $define|y|true)
5886         dflt='y'
5887         usedl="$define"
5888         ;;
5889 $undef|n|false)
5890         dflt='n'
5891         usedl="$undef"
5892         ;;
5893 *) 
5894         dflt='n'
5895         case "$d_dlopen" in
5896             $define) dflt='y' ;;
5897         esac
5898         case "$i_dld" in
5899             $define) dflt='y' ;;
5900         esac
5901         : Does a dl_xxx.xs file exist for this operating system
5902         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5903         ;;
5904 esac
5905 rp="Do you wish to use dynamic loading?"
5906 . ./myread
5907 usedl="$ans"
5908 case "$ans" in
5909 y*) usedl="$define"
5910         case "$dlsrc" in
5911         '')
5912                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5913                         dflt="$dldir/dl_${osname}.xs"
5914                 elif $test "$d_dlopen" = "$define" ; then
5915                         dflt="$dldir/dl_dlopen.xs"
5916                 elif $test "$i_dld" = "$define" ; then
5917                         dflt="$dldir/dl_dld.xs"
5918                 else
5919                         dflt=''
5920                 fi
5921                 ;;
5922         *)      dflt="$dldir/$dlsrc"
5923                 ;;
5924         esac
5925     echo "The following dynamic loading files are available:"
5926         : Can not go over to $dldir because getfile has path hard-coded in.
5927         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5928         rp="Source file to use for dynamic loading"
5929         fn="fne"
5930         gfpth="$src"
5931         . ./getfile
5932         usedl="$define"
5933         : emulate basename
5934         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5935
5936         $cat << EOM
5937
5938 Some systems may require passing special flags to $cc -c to
5939 compile modules that will be used to create a shared library.
5940 To use no flags, say "none".
5941
5942 EOM
5943     case "$cccdlflags" in
5944     '') case "$gccversion" in
5945                 '') case "$osname" in
5946                         hpux)   dflt='+z' ;;
5947                         next)   dflt='none' ;;
5948                         irix*)  dflt='-KPIC' ;;
5949                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5950                         sunos)  dflt='-pic' ;;
5951                         *)      dflt='none' ;;
5952                     esac
5953                         ;;
5954                 *)  case "$osname" in
5955                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5956                         *)      dflt='-fpic' ;;
5957                     esac ;;
5958             esac ;;
5959         ' ') dflt='none' ;;
5960     *)  dflt="$cccdlflags" ;;
5961     esac
5962     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5963     . ./myread
5964     case "$ans" in
5965     none) cccdlflags=' ' ;;
5966     *) cccdlflags="$ans" ;;
5967     esac
5968
5969     cat << EOM
5970
5971 Some systems use ld to create libraries that can be dynamically loaded,
5972 while other systems (such as those using ELF) use $cc.
5973
5974 EOM
5975         case "$ld" in
5976         '')     $cat >try.c <<'EOM'
5977 /* Test for whether ELF binaries are produced */
5978 #include <fcntl.h>
5979 #include <stdlib.h>
5980 int main() {
5981         char b[4];
5982         int i = open("a.out",O_RDONLY);
5983         if(i == -1) 
5984                 exit(1); /* fail */
5985         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5986                 exit(0); /* succeed (yes, it's ELF) */
5987         else
5988                 exit(1); /* fail */
5989 }
5990 EOM
5991                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5992                         cat <<EOM
5993 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5994 EOM
5995                         dflt="$cc"
5996                 else
5997                         echo "I'll use ld to build dynamic libraries."
5998                         dflt='ld'
5999                 fi
6000                 rm -f try.c a.out
6001                 ;;
6002         *)      dflt="$ld"
6003                 ;;
6004         esac
6005
6006     rp="What command should be used to create dynamic libraries?"
6007     . ./myread
6008         ld="$ans"
6009
6010     cat << EOM
6011
6012 Some systems may require passing special flags to $ld to create a
6013 library that can be dynamically loaded.  If your ld flags include
6014 -L/other/path options to locate libraries outside your loader's normal
6015 search path, you may need to specify those -L options here as well.  To
6016 use no flags, say "none".
6017
6018 EOM
6019     case "$lddlflags" in
6020     '') case "$osname" in
6021                         beos) dflt='-nostart' ;;
6022                         hpux)  dflt='-b' ;;
6023                         linux|irix*)    dflt='-shared' ;;
6024                         next)  dflt='none' ;;
6025                         solaris) dflt='-G' ;;
6026                         sunos) dflt='-assert nodefinitions' ;;
6027                         svr4*|esix*) dflt="-G $ldflags" ;;
6028                 *)     dflt='none' ;;
6029                         esac
6030                         ;;
6031     *) dflt="$lddlflags" ;;
6032     esac
6033
6034         : Try to guess additional flags to pick up local libraries.
6035         : Be careful not to append to a plain 'none'
6036         case "$dflt" in
6037         none) dflt='' ;;
6038         esac
6039         for thisflag in $ldflags; do
6040                 case "$thisflag" in
6041                 -L*)
6042                         case " $dflt " in
6043                         *" $thisflag "*) ;;
6044                         *) dflt="$dflt $thisflag" ;;
6045                         esac
6046                         ;;
6047                 esac
6048         done
6049
6050         case "$dflt" in
6051         ''|' ') dflt='none' ;;
6052         esac
6053
6054     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6055     . ./myread
6056     case "$ans" in
6057     none) lddlflags=' ' ;;
6058     *) lddlflags="$ans" ;;
6059     esac
6060
6061         cat <<EOM
6062
6063 Some systems may require passing special flags to $cc to indicate that
6064 the resulting executable will use dynamic linking.  To use no flags,
6065 say "none".
6066
6067 EOM
6068     case "$ccdlflags" in
6069     '') case "$osname" in
6070                 hpux)   dflt='-Wl,-E' ;;
6071                 linux)  dflt='-rdynamic' ;;
6072                 next)   dflt='none' ;;
6073                 sunos)  dflt='none' ;;
6074                 *)      dflt='none' ;;
6075             esac ;;
6076     ' ')  dflt='none' ;;
6077     *)  dflt="$ccdlflags" ;;
6078     esac
6079     rp="Any special flags to pass to $cc to use dynamic linking?"
6080     . ./myread
6081     case "$ans" in
6082     none) ccdlflags=' ' ;;
6083     *) ccdlflags="$ans" ;;
6084     esac
6085     ;;
6086 *)  usedl="$undef"
6087         ld='ld'
6088     dlsrc='dl_none.xs'
6089     lddlflags=''
6090     ccdlflags=''
6091     ;;
6092 esac
6093
6094 also=''
6095 case "$usedl" in
6096 $undef)
6097         # No dynamic loading being used, so don't bother even to prompt.
6098         useshrplib='false'
6099         ;;
6100 *)      case "$useshrplib" in
6101         '')     case "$osname" in
6102                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6103                         dflt=y
6104                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6105                         ;;
6106                 next*)
6107                         case "$osvers" in
6108                         4*)     dflt=y
6109                                 also='Building a shared libperl is needed for MAB support.'
6110                                 ;;
6111                         *)      dflt=n
6112                                 ;;
6113                         esac
6114                         ;;
6115                 *)      dflt=n
6116                         ;;
6117                 esac
6118                 ;;
6119         $define|true|[Yy]*)
6120                 dflt=y
6121                 ;;
6122         *)      dflt=n
6123                 ;;
6124         esac
6125         $cat << EOM
6126
6127 The perl executable is normally obtained by linking perlmain.c with
6128 libperl${_a}, any static extensions (usually just DynaLoader), and
6129 any other libraries needed on this system (such as -lm, etc.).  Since
6130 your system supports dynamic loading, it is probably possible to build
6131 a shared libperl.$so.  If you will have more than one executable linked
6132 to libperl.$so, this will significantly reduce the size of each
6133 executable, but it may have a noticeable affect on performance.  The
6134 default is probably sensible for your system.
6135 $also
6136
6137 EOM
6138         rp="Build a shared libperl.$so (y/n)"
6139         . ./myread
6140         case "$ans" in
6141         true|$define|[Yy]*)
6142                 useshrplib='true'  ;;
6143         *)      useshrplib='false' ;;
6144         esac
6145         ;;
6146 esac
6147
6148 case "$useshrplib" in
6149 true)
6150         case "$libperl" in
6151         '')
6152                 # Figure out a good name for libperl.so.  Since it gets stored in
6153                 # a version-specific architecture-dependent library, the version
6154                 # number isn't really that important, except for making cc/ld happy.
6155                 #
6156                 # A name such as libperl.so.3.1
6157                 majmin="libperl.$so.$patchlevel.$subversion"
6158                 # A name such as libperl.so.301
6159                 majonly=`echo $patchlevel $subversion |
6160                         $awk '{printf "%d%02d", $1, $2}'`
6161                 majonly=libperl.$so.$majonly
6162                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6163                 # rely on figuring it out from the naming of libc.
6164                 case "${osname}${osvers}" in
6165                 next4*)
6166                         dflt=libperl.5.$so
6167                         # XXX How handle the --version stuff for MAB?
6168                         ;;
6169                 linux*)  # ld won't link with a bare -lperl otherwise.
6170                         dflt=libperl.$so
6171                         ;;
6172                 cygwin*) # include version
6173                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6174                         ;;
6175                 *)      # Try to guess based on whether libc has major.minor.
6176                         case "$libc" in
6177                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6178                         *libc.$so.[0-9]*) dflt=$majonly ;;
6179                         *)      dflt=libperl.$so ;;
6180                         esac
6181                         ;;
6182                 esac
6183                 ;;
6184         *)      dflt=$libperl
6185                 ;;
6186         esac
6187         cat << EOM
6188
6189 I need to select a good name for the shared libperl.  If your system uses
6190 library names with major and minor numbers, then you might want something
6191 like $majmin.  Alternatively, if your system uses a single version
6192 number for shared libraries, then you might want to use $majonly.
6193 Or, your system might be quite happy with a simple libperl.$so.
6194
6195 Since the shared libperl will get installed into a version-specific
6196 architecture-dependent directory, the version number of the shared perl
6197 library probably isn't important, so the default should be o.k.
6198
6199 EOM
6200         rp='What name do you want to give to the shared libperl?'
6201         . ./myread
6202         libperl=$ans
6203         echo "Ok, I'll use $libperl"
6204         ;;
6205 *)
6206         libperl="libperl${_a}"
6207         ;;
6208 esac
6209
6210 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6211 case "$shrpdir" in
6212 '') ;;
6213 *)      $cat >&4 <<EOM
6214 WARNING:  Use of the shrpdir variable for the installation location of
6215 the shared $libperl is not supported.  It was never documented and
6216 will not work in this version.  Let me (perlbug@perl.com)
6217 know of any problems this may cause.
6218
6219 EOM
6220         case "$shrpdir" in
6221         "$archlibexp/CORE")
6222                 $cat >&4 <<EOM
6223 But your current setting of $shrpdir is
6224 the default anyway, so it's harmless.
6225 EOM
6226                 ;;
6227         *)
6228                 $cat >&4 <<EOM
6229 Further, your current attempted setting of $shrpdir
6230 conflicts with the value of $archlibexp/CORE
6231 that installperl will use.
6232 EOM
6233                 ;;
6234         esac
6235         ;;
6236 esac
6237
6238 # How will the perl executable find the installed shared $libperl?
6239 # Add $xxx to ccdlflags.
6240 # If we can't figure out a command-line option, use $shrpenv to
6241 # set env LD_RUN_PATH.  The main perl makefile uses this.
6242 shrpdir=$archlibexp/CORE
6243 xxx=''
6244 tmp_shrpenv=''
6245 if "$useshrplib"; then
6246     case "$osname" in 
6247         aix)
6248                 # We'll set it in Makefile.SH...
6249                 ;;
6250         solaris|netbsd)
6251                 xxx="-R $shrpdir"
6252                 ;;
6253         freebsd)
6254                 xxx="-Wl,-R$shrpdir"
6255                 ;;
6256         linux|irix*|dec_osf)
6257                 xxx="-Wl,-rpath,$shrpdir"
6258                 ;;
6259         next)
6260                 # next doesn't like the default...
6261                 ;;
6262         beos)
6263                 # beos doesn't like the default, either.
6264                 ;;
6265         hpux*)
6266                 # hpux doesn't like the default, either.
6267                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6268                 ;;
6269         *)
6270                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6271                 ;;
6272         esac
6273         case "$xxx" in
6274         '') ;;
6275         *)      
6276                 # Only add $xxx if it isn't already in ccdlflags.
6277                 case " $ccdlflags " in
6278                 *" $xxx "*)     ;;
6279                 *)      ccdlflags="$ccdlflags $xxx"
6280                         cat <<EOM >&4
6281
6282 Adding $xxx to the flags
6283 passed to $ld so that the perl executable will find the 
6284 installed shared $libperl.
6285
6286 EOM
6287                         ;;
6288                 esac
6289                 ;;
6290         esac
6291 fi
6292 # Fix ccdlflags in AIX for building external extensions.
6293 # (For building Perl itself bare -bE:perl.exp is needed,
6294 #  Makefile.SH takes care of this.)
6295 case "$osname" in
6296 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6297 esac
6298 # Respect a hint or command-line value.
6299 case "$shrpenv" in
6300 '') shrpenv="$tmp_shrpenv" ;;
6301 esac
6302 case "$ldlibpthname" in
6303 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6304 none)   ldlibpthname='' ;;
6305 esac
6306
6307 : determine where manual pages go
6308 set man1dir man1dir none
6309 eval $prefixit
6310 $cat <<EOM
6311
6312 $spackage has manual pages available in source form.
6313 EOM
6314 case "$nroff" in
6315 nroff)
6316         echo "However, you don't have nroff, so they're probably useless to you."
6317         case "$man1dir" in
6318         '') man1dir="none";;
6319         esac;;
6320 esac
6321 echo "If you don't want the manual sources installed, answer 'none'."
6322 case "$man1dir" in
6323 ' ') dflt=none
6324         ;;
6325 '')
6326         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6327         lookpath="$lookpath $prefixexp/man/p_man/man1"
6328         lookpath="$lookpath $prefixexp/man/u_man/man1"
6329         lookpath="$lookpath $prefixexp/man/man.1"
6330         case "$sysman" in
6331         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6332         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6333         esac
6334         set dflt
6335         eval $prefixup
6336         ;;
6337 *)  dflt="$man1dir"
6338         ;;
6339 esac
6340 echo " "
6341 fn=dn+~
6342 rp="Where do the main $spackage manual pages (source) go?"
6343 . ./getfile
6344 if $test "X$man1direxp" != "X$ansexp"; then
6345         installman1dir=''
6346 fi
6347 man1dir="$ans"
6348 man1direxp="$ansexp"
6349 case "$man1dir" in
6350 '')     man1dir=' '
6351         installman1dir='';;
6352 esac
6353
6354 : Change installation prefix, if necessary.
6355 if $test X"$prefix" != X"$installprefix"; then
6356         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6357 else
6358         installman1dir="$man1direxp"
6359 fi
6360
6361 : What suffix to use on installed man pages
6362
6363 case "$man1dir" in
6364 ' ')
6365         man1ext='0'
6366         ;;
6367 *)
6368         rp="What suffix should be used for the main $spackage man pages?"
6369         case "$man1ext" in
6370         '')     case "$man1dir" in
6371                 *1)  dflt=1 ;;
6372                 *1p) dflt=1p ;;
6373                 *1pm) dflt=1pm ;;
6374                 *l) dflt=l;;
6375                 *n) dflt=n;;
6376                 *o) dflt=o;;
6377                 *p) dflt=p;;
6378                 *C) dflt=C;;
6379                 *L) dflt=L;;
6380                 *L1) dflt=L1;;
6381                 *) dflt=1;;
6382                 esac
6383                 ;;
6384         *)      dflt="$man1ext";;
6385         esac
6386         . ./myread
6387         man1ext="$ans"
6388         ;;
6389 esac
6390
6391 : see if we can have long filenames
6392 echo " "
6393 rmlist="$rmlist /tmp/cf$$"
6394 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6395 first=123456789abcdef
6396 second=/tmp/cf$$/$first
6397 $rm -f $first $second
6398 if (echo hi >$first) 2>/dev/null; then
6399         if $test -f 123456789abcde; then
6400                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6401                 val="$undef"
6402         else
6403                 if (echo hi >$second) 2>/dev/null; then
6404                         if $test -f /tmp/cf$$/123456789abcde; then
6405                                 $cat <<'EOM'
6406 That's peculiar... You can have filenames longer than 14 characters, but only
6407 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6408 I shall consider your system cannot support long filenames at all.
6409 EOM
6410                                 val="$undef"
6411                         else
6412                                 echo 'You can have filenames longer than 14 characters.' >&4
6413                                 val="$define"
6414                         fi
6415                 else
6416                         $cat <<'EOM'
6417 How confusing! Some of your filesystems are sane enough to allow filenames
6418 longer than 14 characters but some others like /tmp can't even think about them.
6419 So, for now on, I shall assume your kernel does not allow them at all.
6420 EOM
6421                         val="$undef"
6422                 fi
6423         fi
6424 else
6425         $cat <<'EOM'
6426 You can't have filenames longer than 14 chars.  You can't even think about them!
6427 EOM
6428         val="$undef"
6429 fi 
6430 set d_flexfnam
6431 eval $setvar
6432 $rm -rf /tmp/cf$$ 123456789abcde*
6433
6434 : determine where library module manual pages go
6435 set man3dir man3dir none
6436 eval $prefixit
6437 $cat <<EOM
6438
6439 $spackage has manual pages for many of the library modules.
6440 EOM
6441
6442 case "$nroff" in
6443 nroff)
6444         $cat <<'EOM'
6445 However, you don't have nroff, so they're probably useless to you.
6446 EOM
6447         case "$man3dir" in
6448         '') man3dir="none";;
6449         esac;;
6450 esac
6451
6452 case "$d_flexfnam" in
6453 undef)
6454         $cat <<'EOM'
6455 However, your system can't handle the long file names like File::Basename.3. 
6456 EOM
6457         case "$man3dir" in
6458         '') man3dir="none";;
6459         esac;;
6460 esac
6461
6462 echo "If you don't want the manual sources installed, answer 'none'."
6463 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6464 case "$man3dir" in
6465 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6466         if $test -d "$privlib/man/man3"; then
6467                 cat <<EOM >&4
6468
6469 WARNING:  Previous versions of perl installed man3 pages into
6470 $privlib/man/man3.  This version will suggest a 
6471 new default of $dflt.  
6472 EOM
6473                 tdflt=$dflt
6474                 dflt='n'
6475                 rp='Do you wish to preserve the old behavior?(y/n)'
6476                 . ./myread
6477                 case "$ans" in
6478                 y*) dflt="$privlib/man/man3" ;;
6479                 *)  dflt=$tdflt ;;
6480                 esac
6481     fi
6482         ;;
6483 ' ') dflt=none;;
6484 *)      dflt="$man3dir" ;;
6485 esac
6486 echo " "
6487 fn=dn+~
6488 rp="Where do the $package library man pages (source) go?"
6489 . ./getfile
6490 man3dir="$ans"
6491 man3direxp="$ansexp"
6492 case "$man1dir" in
6493 '')     man3dir=' '
6494         installman3dir='';;
6495 esac
6496
6497 : Change installation prefix, if necessary.
6498 if $test X"$prefix" != X"$installprefix"; then
6499         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6500 else
6501         installman3dir="$man3direxp"
6502 fi
6503
6504 : What suffix to use on installed man pages
6505 case "$man3dir" in
6506 ' ')
6507         man3ext='0'
6508         ;;
6509 *)
6510         rp="What suffix should be used for the $package library man pages?"
6511         case "$man3ext" in
6512         '')     case "$man3dir" in
6513                 *3)  dflt=3 ;;
6514                 *3p) dflt=3p ;;
6515                 *3pm) dflt=3pm ;;
6516                 *l) dflt=l;;
6517                 *n) dflt=n;;
6518                 *o) dflt=o;;
6519                 *p) dflt=p;;
6520                 *C) dflt=C;;
6521                 *L) dflt=L;;
6522                 *L3) dflt=L3;;
6523                 *) dflt=3;;
6524                 esac
6525                 ;;
6526         *)      dflt="$man3ext";;
6527         esac
6528         . ./myread
6529         man3ext="$ans"
6530         ;;
6531 esac
6532
6533 : see if we have to deal with yellow pages, now NIS.
6534 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6535         if $test -f /usr/etc/nibindd; then
6536                 echo " "
6537                 echo "I'm fairly confident you're on a NeXT."
6538                 echo " "
6539                 rp='Do you get the hosts file via NetInfo?'
6540                 dflt=y
6541                 case "$hostcat" in
6542                 nidump*) ;;
6543                 '') ;;
6544                 *) dflt=n;;
6545                 esac
6546                 . ./myread
6547                 case "$ans" in
6548                 y*) hostcat='nidump hosts .';;
6549                 *)      case "$hostcat" in
6550                         nidump*) hostcat='';;
6551                         esac
6552                         ;;
6553                 esac
6554         fi
6555         case "$hostcat" in
6556         nidump*) ;;
6557         *)
6558                 case "$hostcat" in
6559                 *ypcat*) dflt=y;;
6560                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6561                                 dflt=y
6562                         else
6563                                 dflt=n
6564                         fi;;
6565                 *) dflt=n;;
6566                 esac
6567                 echo " "
6568                 rp='Are you getting the hosts file via yellow pages?'
6569                 . ./myread
6570                 case "$ans" in
6571                 y*) hostcat='ypcat hosts';;
6572                 *) hostcat='cat /etc/hosts';;
6573                 esac
6574                 ;;
6575         esac
6576 fi
6577 case "$hostcat" in
6578 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6579 esac
6580 case "$groupcat" in
6581 '') test -f /etc/group && groupcat='cat /etc/group';;
6582 esac
6583 case "$passcat" in
6584 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6585 esac
6586
6587 : now get the host name
6588 echo " "
6589 echo "Figuring out host name..." >&4
6590 case "$myhostname" in
6591 '') cont=true
6592         echo 'Maybe "hostname" will work...'
6593         if tans=`sh -c hostname 2>&1` ; then
6594                 myhostname=$tans
6595                 phostname=hostname
6596                 cont=''
6597         fi
6598         ;;
6599 *) cont='';;
6600 esac
6601 if $test "$cont"; then
6602         if ./xenix; then
6603                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6604                 if tans=`cat /etc/systemid 2>&1` ; then
6605                         myhostname=$tans
6606                         phostname='cat /etc/systemid'
6607                         echo "Whadyaknow.  Xenix always was a bit strange..."
6608                         cont=''
6609                 fi
6610         elif $test -r /etc/systemid; then
6611                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6612         fi
6613 fi
6614 if $test "$cont"; then
6615         echo 'No, maybe "uuname -l" will work...'
6616         if tans=`sh -c 'uuname -l' 2>&1` ; then
6617                 myhostname=$tans
6618                 phostname='uuname -l'
6619         else
6620                 echo 'Strange.  Maybe "uname -n" will work...'
6621                 if tans=`sh -c 'uname -n' 2>&1` ; then
6622                         myhostname=$tans
6623                         phostname='uname -n'
6624                 else
6625                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6626                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6627                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6628                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6629                         else
6630                                 case "$myhostname" in
6631                                 '') echo "Does this machine have an identity crisis or something?"
6632                                         phostname='';;
6633                                 *)
6634                                         echo "Well, you said $myhostname before..."
6635                                         phostname='echo $myhostname';;
6636                                 esac
6637                         fi
6638                 fi
6639         fi
6640 fi
6641 : you do not want to know about this
6642 set $myhostname
6643 myhostname=$1
6644
6645 : verify guess
6646 if $test "$myhostname" ; then
6647         dflt=y
6648         rp='Your host name appears to be "'$myhostname'".'" Right?"
6649         . ./myread
6650         case "$ans" in
6651         y*) ;;
6652         *) myhostname='';;
6653         esac
6654 fi
6655
6656 : bad guess or no guess
6657 while $test "X$myhostname" = X ; do
6658         dflt=''
6659         rp="Please type the (one word) name of your host:"
6660         . ./myread
6661         myhostname="$ans"
6662 done
6663
6664 : translate upper to lower if necessary
6665 case "$myhostname" in
6666 *[A-Z]*)
6667         echo "(Normalizing case in your host name)"
6668         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6669         ;;
6670 esac
6671
6672 case "$myhostname" in
6673 *.*)
6674         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6675         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6676         echo "(Trimming domain name from host name--host name is now $myhostname)"
6677         ;;
6678 *) case "$mydomain" in
6679         '')
6680                 {
6681                         test "X$hostcat" = "Xypcat hosts" &&
6682                         ypmatch "$myhostname" hosts 2>/dev/null |\
6683                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6684                         $test -s hosts
6685                 } || {
6686                         test "X$hostcat" != "X" &&
6687                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6688                                         /[       ]$myhostname[  . ]/p" > hosts
6689                 }
6690                 tmp_re="[       . ]"
6691                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6692                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6693                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6694                         hosts | $sort | $uniq | \
6695                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6696                 case `$echo X$dflt` in
6697                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6698                         dflt=.
6699                         ;;
6700                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6701                         ;;
6702                 esac
6703                 case "$dflt" in
6704                 .)
6705                         tans=`./loc resolv.conf X /etc /usr/etc`
6706                         if $test -f "$tans"; then
6707                                 echo "(Attempting domain name extraction from $tans)"
6708                                 dflt=.`$sed -n -e 's/   / /g' \
6709                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6710                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6711                                 case "$dflt" in
6712                                 .) dflt=.`$sed -n -e 's/        / /g' \
6713                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6714                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6715                                         ;;
6716                                 esac
6717                         fi
6718                         ;;
6719                 esac
6720                 case "$dflt" in
6721                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6722                         dflt=.`sh -c domainname 2>/dev/null`
6723                         case "$dflt" in
6724                         '') dflt='.';;
6725                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6726                         esac
6727                         ;;
6728                 esac
6729                 case "$dflt" in
6730                 .) echo "(Lost all hope -- silly guess then)"
6731                         dflt='.uucp'
6732                         ;;
6733                 esac
6734                 $rm -f hosts
6735                 ;;
6736         *) dflt="$mydomain";;
6737         esac;;
6738 esac
6739 echo " "
6740 rp="What is your domain name?"
6741 . ./myread
6742 tans="$ans"
6743 case "$ans" in
6744 '') ;;
6745 .*) ;;
6746 *) tans=".$tans";;
6747 esac
6748 mydomain="$tans"
6749
6750 : translate upper to lower if necessary
6751 case "$mydomain" in
6752 *[A-Z]*)
6753         echo "(Normalizing case in your domain name)"
6754         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6755         ;;
6756 esac
6757
6758 : a little sanity check here
6759 case "$phostname" in
6760 '') ;;
6761 *)
6762         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6763         $myhostname$mydomain|$myhostname) ;;
6764         *)
6765                 case "$phostname" in
6766                 sed*)
6767                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6768                         ;;
6769                 *)
6770                         echo "(That doesn't agree with your $phostname command, by the way.)"
6771                         ;;
6772                 esac
6773         ;;
6774         esac
6775         ;;
6776 esac
6777
6778 $cat <<EOM
6779
6780 I need to get your e-mail address in Internet format if possible, i.e.
6781 something like user@host.domain. Please answer accurately since I have
6782 no easy means to double check it. The default value provided below
6783 is most probably close to reality but may not be valid from outside
6784 your organization...
6785
6786 EOM
6787 cont=x
6788 while test "$cont"; do
6789         case "$cf_email" in
6790         '') dflt="$cf_by@$myhostname$mydomain";;
6791         *) dflt="$cf_email";;
6792         esac
6793         rp='What is your e-mail address?'
6794         . ./myread
6795         cf_email="$ans"
6796         case "$cf_email" in
6797         *@*.*) cont='' ;;
6798         *)
6799                 rp='Address does not look like an Internet one.  Use it anyway?'
6800                 case "$fastread" in
6801                 yes) dflt=y ;;
6802                 *) dflt=n ;;
6803                 esac
6804                 . ./myread
6805                 case "$ans" in
6806                 y*) cont='' ;;
6807                 *) echo " " ;;
6808                 esac
6809                 ;;
6810         esac
6811 done
6812
6813 $cat <<EOM
6814
6815 If you or somebody else will be maintaining perl at your site, please
6816 fill in the correct e-mail address here so that they may be contacted
6817 if necessary. Currently, the "perlbug" program included with perl
6818 will send mail to this address in addition to perlbug@perl.com. You may
6819 enter "none" for no administrator.
6820
6821 EOM
6822 case "$perladmin" in
6823 '') dflt="$cf_email";;
6824 *) dflt="$perladmin";;
6825 esac
6826 rp='Perl administrator e-mail address'
6827 . ./myread
6828 perladmin="$ans"
6829
6830 : figure out how to guarantee perl startup
6831 case "$startperl" in
6832 '')
6833         case "$sharpbang" in
6834         *!)
6835                 $cat <<EOH
6836
6837 I can use the #! construct to start perl on your system. This will
6838 make startup of perl scripts faster, but may cause problems if you
6839 want to share those scripts and perl is not in a standard place
6840 ($binexp/perl) on all your platforms. The alternative is to force
6841 a shell by starting the script with a single ':' character.
6842
6843 EOH
6844                 dflt="$binexp/perl"
6845                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6846                 . ./myread
6847                 case "$ans" in
6848                 none)   startperl=": # use perl";;
6849                 *)      startperl="#!$ans"
6850                         if $test 30 -lt `echo "$ans" | wc -c`; then
6851                                 $cat >&4 <<EOM
6852
6853 WARNING:  Some systems limit the #! command to 32 characters.
6854 If you experience difficulty running Perl scripts with #!, try
6855 installing Perl in a directory with a shorter pathname.
6856
6857 EOM
6858                         fi ;;
6859                 esac
6860                 ;;
6861         *) startperl=": # use perl"
6862                 ;;
6863         esac
6864         ;;
6865 esac
6866 echo "I'll use $startperl to start perl scripts."
6867
6868 : figure best path for perl in scripts
6869 case "$perlpath" in
6870 '')
6871         perlpath="$binexp/perl"
6872         case "$startperl" in
6873         *!*) ;;
6874         *)
6875                 $cat <<EOH
6876
6877 I will use the "eval 'exec'" idiom to start Perl on your system.
6878 I can use the full path of your Perl binary for this purpose, but
6879 doing so may cause problems if you want to share those scripts and
6880 Perl is not always in a standard place ($binexp/perl).
6881
6882 EOH
6883                 dflt="$binexp/perl"
6884                 rp="What path shall I use in \"eval 'exec'\"?"
6885                 . ./myread
6886                 perlpath="$ans"
6887                 ;;
6888         esac
6889         ;;
6890 esac
6891 case "$startperl" in
6892 *!*)    ;;
6893 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6894 esac
6895
6896 : determine where public executable scripts go
6897 set scriptdir scriptdir
6898 eval $prefixit
6899 case "$scriptdir" in
6900 '')
6901         dflt="$bin"
6902         : guess some guesses
6903         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6904         $test -d /usr/share/bin     && dflt=/usr/share/bin
6905         $test -d /usr/local/script  && dflt=/usr/local/script
6906         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6907         $test -d $prefixexp/script  && dflt=$prefixexp/script
6908         set dflt
6909         eval $prefixup
6910         ;;
6911 *)  dflt="$scriptdir"
6912         ;;
6913 esac
6914 $cat <<EOM
6915  
6916 Some installations have a separate directory just for executable scripts so
6917 that they can mount it across multiple architectures but keep the scripts in
6918 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6919 Or you might just lump your scripts in with all your other executables.
6920  
6921 EOM
6922 fn=d~
6923 rp='Where do you keep publicly executable scripts?'
6924 . ./getfile
6925 if $test "X$ansexp" != "X$scriptdirexp"; then
6926         installscript=''
6927 fi
6928 scriptdir="$ans"
6929 scriptdirexp="$ansexp"
6930 : Change installation prefix, if necessary.
6931 if $test X"$prefix" != X"$installprefix"; then
6932         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6933 else
6934         installscript="$scriptdirexp"
6935 fi
6936
6937 : determine where site specific architecture-dependent libraries go.
6938 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6939 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6940 : sitelib may have an optional trailing /share.
6941 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6942 tdflt="$tdflt/$archname"
6943 set sitearch sitearch none
6944 eval $prefixit
6945 case "$sitearch" in
6946 '')     dflt="$tdflt" ;;
6947 *)      dflt="$sitearch" ;;
6948 esac
6949 $cat <<EOM
6950
6951 The installation process will also create a directory for
6952 architecture-dependent site-specific extensions and modules.
6953
6954 EOM
6955 fn=nd~+
6956 rp='Pathname for the site-specific architecture-dependent library files?'
6957 . ./getfile
6958 sitearch="$ans"
6959 sitearchexp="$ansexp"
6960 : Change installation prefix, if necessary.
6961 if $test X"$prefix" != X"$installprefix"; then
6962         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6963 else
6964         installsitearch="$sitearchexp"
6965 fi
6966
6967 : determine where add-on public executables go
6968 case "$sitebin" in
6969 '')     dflt=$siteprefix/bin ;;
6970 *)      dflt=$sitebin ;;
6971 esac
6972 fn=d~
6973 rp='Pathname where the add-on public executables should be installed?'
6974 . ./getfile
6975 sitebin="$ans"
6976 sitebinexp="$ansexp"
6977 : Change installation prefix, if necessary.
6978 if $test X"$prefix" != X"$installprefix"; then
6979         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6980 else
6981         installsitebin="$sitebinexp"
6982 fi
6983
6984 : see if sqrtl exists
6985 set sqrtl d_sqrtl
6986 eval $inlibc
6987
6988 cat <<EOM
6989
6990 Perl can be built to take advantage of long doubles which
6991 (if available) may give more accuracy and range for floating point numbers.
6992
6993 If this doesn't make any sense to you, just accept the default 'n'.
6994 EOM
6995
6996 case "$ccflags" in
6997 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6998 esac
6999
7000 case "$uselongdouble" in
7001 $define|true|[yY]*)     dflt='y';;
7002 *) dflt='n';;
7003 esac
7004 rp='Try to use long doubles if available?'
7005 . ./myread
7006 case "$ans" in
7007 y|Y)    val="$define"   ;;
7008 *)      val="$undef"    ;;
7009 esac
7010 set uselongdouble
7011 eval $setvar
7012
7013 case "$uselongdouble" in
7014 true|[yY]*) uselongdouble="$define" ;;
7015 esac
7016
7017 case "$uselongdouble" in
7018 $define)
7019 : Look for a hint-file generated 'call-back-unit'.  If the
7020 : user has specified that long doubles should be used,
7021 : we may need to set or change some other defaults.
7022         if $test -f uselongdouble.cbu; then
7023                 echo "Your platform has some specific hints for long doubles, using them..."
7024                 . ./uselongdouble.cbu
7025         else
7026                 $cat <<EOM
7027 (Your platform doesn't have any specific hints for long doubles.)
7028 EOM
7029         fi
7030         ;;
7031 esac
7032
7033 case "$uselongdouble:$d_sqrtl" in
7034 $define:$undef)
7035                 $cat <<EOM >&4
7036
7037 You requested the use of long doubles but you do not seem to have
7038 the mathematic functions for long doubles.  I'm disabling the use
7039 of long doubles.
7040 EOM
7041         uselongdouble=$undef
7042         ;;
7043 esac
7044
7045 cat <<EOM
7046
7047 Perl can be built to take advantage of long longs which
7048 (if available) may give more range for integer numbers.
7049
7050 If this doesn't make any sense to you, just accept the default 'n'.
7051 EOM
7052
7053 case "$ccflags" in
7054 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7055 esac
7056
7057 case "$uselonglong" in
7058 '')     dflt='y';;
7059 esac
7060 rp='Try to use long longs if available?'
7061 . ./myread
7062 case "$ans" in
7063 y|Y)    val="$define"   ;;
7064 *)      val="$undef"    ;;
7065 esac
7066 set uselonglong
7067 eval $setvar
7068
7069 case "$uselonglong" in
7070 true|[yY]*) uselonglong="$define" ;;
7071 esac
7072
7073 case "$uselonglong" in
7074 $define)
7075 : Look for a hint-file generated 'call-back-unit'.  If the
7076 : user has specified that long longs should be used,
7077 : we may need to set or change some other defaults.
7078         if $test -f uselonglong.cbu; then
7079                 echo "Your platform has some specific hints for long longs, using them..."
7080                 . ./uselonglong.cbu
7081         else
7082                 $cat <<EOM
7083 (Your platform doesn't have any specific hints for long longs.)
7084 EOM
7085         fi
7086         ;;
7087 esac
7088
7089 cat <<EOM
7090
7091 Previous version of $package used the standard IO mechanisms as defined
7092 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7093 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7094 the default.  This abstraction layer can use AT&T's sfio (if you already
7095 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7096 problems with some extension modules.  Using PerlIO with stdio is safe,
7097 but it is slower than plain stdio and therefore is not the default.
7098
7099 If this doesn't make any sense to you, just accept the default 'n'.
7100 EOM
7101 case "$useperlio" in
7102 $define|true|[yY]*)     dflt='y';;
7103 *) dflt='n';;
7104 esac
7105 rp='Use the experimental PerlIO abstraction layer?'
7106 . ./myread
7107 case "$ans" in
7108 y|Y) 
7109         val="$define"
7110         ;;     
7111 *)      
7112         echo "Ok, doing things the stdio way"
7113         val="$undef"
7114         ;;
7115 esac
7116 set useperlio
7117 eval $setvar 
7118
7119 case "$vendorprefix" in
7120 '')     d_vendorbin="$undef"
7121         vendorbin=''
7122         vendorbinexp=''
7123         ;;
7124 *)      d_vendorbin="$define"
7125         : determine where vendor-supplied executables go.
7126         dflt=$vendorprefix/bin
7127         fn=d~+
7128         rp='Pathname for the vendor-supplied executables directory?'
7129         . ./getfile
7130         vendorbin="$ans"
7131         vendorbinexp="$ansexp"
7132         : Change installation prefix, if necessary.
7133         if $test X"$prefix" != X"$installprefix"; then
7134                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7135         else
7136                 installvendorbin="$vendorbinexp"
7137         fi
7138         ;;
7139 esac
7140
7141 : check for length of double
7142 echo " "
7143 case "$doublesize" in
7144 '')
7145         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7146         $cat >try.c <<'EOCP'
7147 #include <stdio.h>
7148 int main()
7149 {
7150     printf("%d\n", (int)sizeof(double));
7151     exit(0);
7152 }
7153 EOCP
7154         set try
7155         if eval $compile_ok; then
7156                 doublesize=`./try`
7157                 $echo " $doublesize bytes." >&4
7158         else
7159                 dflt='8'
7160                 echo "(I can't seem to compile the test program.  Guessing...)"
7161                 rp="What is the size of a double precision number (in bytes)?"
7162                 . ./myread
7163                 doublesize="$ans"
7164         fi
7165         ;;
7166 esac
7167 $rm -f try.c try
7168
7169 : check for long doubles
7170 echo " "
7171 $echo $n "Checking to see if your system supports long double..." $c >&4
7172 echo 'int main() { long double x = 7.0; }' > try.c
7173 set try
7174 if eval $compile; then
7175         val="$define"
7176         echo " Yes, it does." >&4
7177 else
7178         val="$undef"
7179         echo " No, it doesn't." >&4
7180 fi
7181 $rm try.*
7182 set d_longdbl
7183 eval $setvar
7184
7185 : check for length of long double
7186 case "${d_longdbl}${longdblsize}" in
7187 $define)
7188         echo " "
7189         $echo $n "Checking to see how big your long doubles are..." $c >&4
7190         $cat >try.c <<'EOCP'
7191 #include <stdio.h>
7192 int main()
7193 {
7194         printf("%d\n", sizeof(long double));
7195 }
7196 EOCP
7197         set try
7198         set try
7199         if eval $compile; then
7200                 longdblsize=`./try$exe_ext`
7201                 $echo " $longdblsize bytes." >&4
7202         else
7203                 dflt='8'
7204                 echo " "
7205                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7206                 rp="What is the size of a long double (in bytes)?"
7207                 . ./myread
7208                 longdblsize="$ans"
7209         fi
7210         if $test "X$doublesize" = "X$longdblsize"; then
7211                 echo "(That isn't any different from an ordinary double.)"
7212         fi      
7213         ;;
7214 esac
7215 $rm -f try.* try
7216
7217 : Check how to convert floats to strings.
7218 if test "X$d_Gconvert" = X; then
7219         echo " "
7220         echo "Checking for an efficient way to convert floats to strings."
7221         $cat >try.c <<EOP
7222 #ifdef TRY_gconvert
7223 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7224 char *myname = "gconvert";
7225 #endif
7226 #ifdef TRY_gcvt
7227 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7228 char *myname = "gcvt";
7229 #endif
7230 #ifdef TRY_qgcvt
7231 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7232 char *myname = "qgcvt";
7233 #define DOUBLETYPE long double
7234 #endif
7235 #ifdef TRY_sprintf
7236 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7237 char *myname = "sprintf";
7238 #endif
7239
7240 #ifndef DOUBLETYPE
7241 #define DOUBLETYPE double
7242 #endif
7243
7244 #include <stdio.h>
7245
7246 #define I_STDLIB $i_stdlib
7247 #ifdef I_STDLIB
7248 #include <stdlib.h>
7249 #endif
7250
7251 int
7252 checkit(expect, got)
7253 char *expect;
7254 char *got;
7255 {
7256     if (strcmp(expect, got)) {
7257                 printf("%s oddity:  Expected %s, got %s\n",
7258                         myname, expect, got);
7259                 exit(1);
7260         }
7261 }
7262
7263 int main()
7264
7265         char buf[64]; 
7266         buf[63] = '\0';
7267
7268         /* This must be 1st test on (which?) platform */
7269         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7270         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7271         checkit("0.1", buf);
7272
7273         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7274         checkit("1", buf);
7275
7276         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7277         checkit("0", buf);
7278
7279         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7280         checkit("-1", buf);
7281
7282         /* Some Linux gcvt's give 1.e+5 here. */
7283         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7284         checkit("100000", buf);
7285         
7286         /* Some Linux gcvt's give -1.e+5 here. */
7287         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7288         checkit("-100000", buf);
7289
7290         exit(0);
7291 }
7292 EOP
7293         case "$d_Gconvert" in
7294         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7295         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7296         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7297         *) xxx_list='gconvert gcvt sprintf' ;;
7298         esac
7299
7300         case "$d_longdbl$uselongdouble" in
7301         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7302         esac
7303
7304         for xxx_convert in $xxx_list; do
7305                 echo "Trying $xxx_convert..."
7306                 $rm -f try try$_o
7307                 set try -DTRY_$xxx_convert
7308                 if eval $compile; then
7309                         echo "$xxx_convert() found." >&4
7310                         if ./try; then
7311                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7312                                 break;
7313                         else
7314                                 echo "...But $xxx_convert didn't work as I expected."
7315                         fi
7316                 else
7317                         echo "$xxx_convert NOT found." >&4
7318                 fi
7319         done
7320                 
7321         case "$xxx_convert" in
7322         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7323         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7324         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7325         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7326         esac
7327 fi
7328
7329 echo " "
7330
7331 if $test X"$d_longdbl" = X"$define"; then
7332
7333 echo "Checking how to print long doubles..." >&4
7334
7335 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7336         $cat >try.c <<'EOCP'
7337 #include <sys/types.h>
7338 #include <stdio.h>
7339 int main() {
7340   double d = 123.456;
7341   printf("%.3f\n", d);
7342 }
7343 EOCP
7344         set try
7345         if eval $compile; then
7346                 yyy=`./try$exe_ext`
7347                 case "$yyy" in
7348                 123.456)
7349                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7350                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7351                         echo "We will use %f."
7352                         ;;
7353                 esac
7354         fi
7355 fi
7356
7357 if $test X"$sPRIfldbl" = X; then
7358         $cat >try.c <<'EOCP'
7359 #include <sys/types.h>
7360 #include <stdio.h>
7361 int main() {
7362   long double d = 123.456;
7363   printf("%.3llf\n", d);
7364 }
7365 EOCP
7366         set try
7367         if eval $compile; then
7368                 yyy=`./try$exe_ext`
7369                 case "$yyy" in
7370                 123.456)
7371                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7372                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7373                         echo "We will use %llf."
7374                         ;;
7375                 esac
7376         fi
7377 fi
7378
7379 if $test X"$sPRIfldbl" = X; then
7380         $cat >try.c <<'EOCP'
7381 #include <sys/types.h>
7382 #include <stdio.h>
7383 int main() {
7384   long double d = 123.456;
7385   printf("%.3Lf\n", d);
7386 }
7387 EOCP
7388         set try
7389         if eval $compile; then
7390                 yyy=`./try$exe_ext`
7391                 case "$yyy" in
7392                 123.456)
7393                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7394                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7395                         echo "We will use %Lf."
7396                         ;;
7397                 esac
7398         fi
7399 fi
7400
7401 if $test X"$sPRIfldbl" = X; then
7402         $cat >try.c <<'EOCP'
7403 #include <sys/types.h>
7404 #include <stdio.h>
7405 int main() {
7406   long double d = 123.456;
7407   printf("%.3lf\n", d);
7408 }
7409 EOCP
7410         set try
7411         if eval $compile; then
7412                 yyy=`./try$exe_ext`
7413                 case "$yyy" in
7414                 123.456)
7415                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7416                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7417                         echo "We will use %lf."
7418                         ;;
7419                 esac
7420         fi
7421 fi
7422
7423 if $test X"$sPRIfldbl" = X; then
7424         echo "Cannot figure out how to print long doubles." >&4
7425 fi
7426
7427 $rm -f try try.*
7428
7429 fi # d_longdbl
7430
7431 case "$sPRIfldbl" in
7432 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7433         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7434         ;;
7435 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7436         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7437         ;;
7438 esac
7439
7440 : Initialize h_fcntl
7441 h_fcntl=false
7442
7443 : Initialize h_sysfile
7444 h_sysfile=false
7445
7446 : access call always available on UNIX
7447 set access d_access
7448 eval $inlibc
7449
7450 : locate the flags for 'access()'
7451 case "$d_access" in
7452 "$define")
7453         echo " "
7454         $cat >access.c <<'EOCP'
7455 #include <sys/types.h>
7456 #ifdef I_FCNTL
7457 #include <fcntl.h>
7458 #endif
7459 #ifdef I_SYS_FILE
7460 #include <sys/file.h>
7461 #endif
7462 #ifdef I_UNISTD
7463 #include <unistd.h>
7464 #endif
7465 int main() {
7466         exit(R_OK);
7467 }
7468 EOCP
7469         : check sys/file.h first, no particular reason here
7470         if $test `./findhdr sys/file.h` && \
7471                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7472                 h_sysfile=true;
7473                 echo "<sys/file.h> defines the *_OK access constants." >&4
7474         elif $test `./findhdr fcntl.h` && \
7475                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7476                 h_fcntl=true;
7477                 echo "<fcntl.h> defines the *_OK access constants." >&4
7478         elif $test `./findhdr unistd.h` && \
7479                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7480                 echo "<unistd.h> defines the *_OK access constants." >&4
7481         else
7482                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7483         fi
7484         ;;
7485 esac
7486 $rm -f access*
7487
7488 : see if accessx exists
7489 set accessx d_accessx
7490 eval $inlibc
7491
7492 : see if alarm exists
7493 set alarm d_alarm
7494 eval $inlibc
7495
7496 : see if atolf exists
7497 set atolf d_atolf
7498 eval $inlibc
7499
7500 : see if atoll exists
7501 set atoll d_atoll
7502 eval $inlibc
7503
7504 : Look for GNU-cc style attribute checking
7505 echo " "
7506 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7507 $cat >attrib.c <<'EOCP'
7508 #include <stdio.h>
7509 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7510 EOCP
7511 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7512         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7513                 echo "Your C compiler doesn't fully support __attribute__."
7514                 val="$undef"
7515         else
7516                 echo "Your C compiler supports __attribute__."
7517                 val="$define"
7518         fi
7519 else
7520         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7521         val="$undef"
7522 fi
7523 set d_attribut
7524 eval $setvar
7525 $rm -f attrib*
7526
7527 : see if bcmp exists
7528 set bcmp d_bcmp
7529 eval $inlibc
7530
7531 : see if bcopy exists
7532 set bcopy d_bcopy
7533 eval $inlibc
7534
7535 : see if this is a unistd.h system
7536 set unistd.h i_unistd
7537 eval $inhdr
7538
7539 : see if getpgrp exists
7540 set getpgrp d_getpgrp
7541 eval $inlibc
7542
7543 case "$d_getpgrp" in
7544 "$define")
7545         echo " "
7546         echo "Checking to see which flavor of getpgrp is in use..."
7547         $cat >set.c <<EOP
7548 #$i_unistd I_UNISTD
7549 #include <sys/types.h>
7550 #ifdef I_UNISTD
7551 #  include <unistd.h>
7552 #endif
7553 int main()
7554 {
7555         if (getuid() == 0) {
7556                 printf("(I see you are running Configure as super-user...)\n");
7557                 setuid(1);
7558         }
7559 #ifdef TRY_BSD_PGRP
7560         if (getpgrp(1) == 0)
7561                 exit(0);
7562 #else
7563         if (getpgrp() > 0)
7564                 exit(0);
7565 #endif
7566         exit(1);
7567 }
7568 EOP
7569         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7570                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7571                 val="$define"
7572         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7573                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7574                 val="$undef"
7575         else
7576                 echo "I can't seem to compile and run the test program."
7577                 if ./usg; then
7578                         xxx="a USG one, i.e. you use getpgrp()."
7579                 else
7580                         # SVR4 systems can appear rather BSD-ish.
7581                         case "$i_unistd" in
7582                         $undef)
7583                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7584                                 val="$define"
7585                                 ;;
7586                         $define)
7587                                 xxx="probably a USG one, i.e. you use getpgrp()."
7588                                 val="$undef"
7589                                 ;;
7590                         esac
7591                 fi
7592                 echo "Assuming your getpgrp is $xxx" >&4
7593         fi
7594         ;;
7595 *) val="$undef";;
7596 esac
7597 set d_bsdgetpgrp
7598 eval $setvar
7599 $rm -f set set.c
7600
7601 : see if setpgrp exists
7602 set setpgrp d_setpgrp
7603 eval $inlibc
7604
7605 case "$d_setpgrp" in
7606 "$define")
7607         echo " "
7608         echo "Checking to see which flavor of setpgrp is in use..."
7609         $cat >set.c <<EOP
7610 #$i_unistd I_UNISTD
7611 #include <sys/types.h>
7612 #ifdef I_UNISTD
7613 #  include <unistd.h>
7614 #endif
7615 int main()
7616 {
7617         if (getuid() == 0) {
7618                 printf("(I see you are running Configure as super-user...)\n");
7619                 setuid(1);
7620         }
7621 #ifdef TRY_BSD_PGRP
7622         if (-1 == setpgrp(1, 1))
7623                 exit(0);
7624 #else
7625         if (setpgrp() != -1)
7626                 exit(0);
7627 #endif
7628         exit(1);
7629 }
7630 EOP
7631         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7632                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7633                 val="$define"
7634         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7635                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7636                 val="$undef"
7637         else
7638                 echo "(I can't seem to compile and run the test program.)"
7639                 if ./usg; then
7640                         xxx="a USG one, i.e. you use setpgrp()."
7641                 else
7642                         # SVR4 systems can appear rather BSD-ish.
7643                         case "$i_unistd" in
7644                         $undef)
7645                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7646                                 val="$define"
7647                                 ;;
7648                         $define)
7649                                 xxx="probably a USG one, i.e. you use setpgrp()."
7650                                 val="$undef"
7651                                 ;;
7652                         esac
7653                 fi
7654                 echo "Assuming your setpgrp is $xxx" >&4
7655         fi
7656         ;;
7657 *) val="$undef";;
7658 esac
7659 set d_bsdsetpgrp
7660 eval $setvar
7661 $rm -f set set.c
7662 : see if bzero exists
7663 set bzero d_bzero
7664 eval $inlibc
7665
7666 : see if signal is declared as pointer to function returning int or void
7667 echo " "
7668 xxx=`./findhdr signal.h`
7669 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7670 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7671         echo "You have int (*signal())() instead of void." >&4
7672         val="$undef"
7673 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7674         echo "You have void (*signal())()." >&4
7675         val="$define"
7676 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7677         echo "You have int (*signal())() instead of void." >&4
7678         val="$undef"
7679 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7680         echo "You have void (*signal())()." >&4
7681         val="$define"
7682 else
7683         case "$d_voidsig" in
7684         '')
7685         echo "I can't determine whether signal handler returns void or int..." >&4
7686                 dflt=void
7687                 rp="What type does your signal handler return?"
7688                 . ./myread
7689                 case "$ans" in
7690                 v*) val="$define";;
7691                 *) val="$undef";;
7692                 esac;;
7693         "$define")
7694                 echo "As you already told me, signal handler returns void." >&4
7695                 val="$define"
7696                 ;;
7697         *)      echo "As you already told me, signal handler returns int." >&4
7698                 val="$undef"
7699                 ;;
7700         esac
7701 fi
7702 set d_voidsig
7703 eval $setvar
7704 case "$d_voidsig" in
7705 "$define") signal_t="void";;
7706 *) signal_t="int";;
7707 esac
7708 $rm -f $$.tmp
7709
7710 : check for ability to cast large floats to 32-bit ints.
7711 echo " "
7712 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7713 if $test "$intsize" -ge 4; then
7714         xxx=int
7715 else
7716         xxx=long
7717 fi
7718 $cat >try.c <<EOCP
7719 #include <stdio.h>
7720 #include <sys/types.h>
7721 #include <signal.h>
7722 $signal_t blech(s) int s; { exit(3); }
7723 int main()
7724 {
7725         $xxx i32;
7726         double f, g;
7727         int result = 0;
7728         char str[16];
7729         signal(SIGFPE, blech);
7730
7731         /* Don't let compiler optimize the test away.  Store the number 
7732            in a writable string for gcc to pass to sscanf under HP/UX.
7733         */
7734         sprintf(str, "2147483647");
7735         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7736         g = 10 * f;
7737         i32  = ($xxx) g;
7738
7739         /* x86 processors will probably give 0x8000 0000, which is a
7740        sign change.  We don't want that.  We want to mimic SPARC
7741            behavior here, which is to preserve the sign and give
7742            back 0x7fff ffff.
7743         */
7744         if (i32 != ($xxx) f)
7745                 result |= 1;
7746         exit(result);
7747 }
7748 EOCP
7749 set try
7750 if eval $compile_ok; then
7751         ./try
7752         yyy=$?
7753 else
7754         echo "(I can't seem to compile the test program--assuming it can't)"
7755         yyy=1
7756 fi
7757 case "$yyy" in
7758 0)      val="$define"
7759         echo "Yup, it can."
7760         ;;
7761 *)      val="$undef"
7762         echo "Nope, it can't."
7763         ;;
7764 esac
7765 set d_casti32
7766 eval $setvar
7767 $rm -f try try.*
7768
7769 : check for ability to cast negative floats to unsigned
7770 echo " "
7771 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7772 $cat >try.c <<EOCP
7773 #include <stdio.h>
7774 #include <sys/types.h>
7775 #include <signal.h>
7776 $signal_t blech(s) int s; { exit(7); }
7777 $signal_t blech_in_list(s) int s; { exit(4); }
7778 unsigned long dummy_long(p) unsigned long p; { return p; }
7779 unsigned int dummy_int(p) unsigned int p; { return p; }
7780 unsigned short dummy_short(p) unsigned short p; { return p; }
7781 int main()
7782 {
7783         double f;
7784         unsigned long along;
7785         unsigned int aint;
7786         unsigned short ashort;
7787         int result = 0;
7788         char str[16];
7789         
7790         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7791            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7792            optimized the whole file away
7793         */
7794         /* Store the number in a writable string for gcc to pass to 
7795            sscanf under HP/UX.
7796         */
7797         sprintf(str, "-123");
7798         sscanf(str, "%lf", &f);  /* f = -123.; */
7799
7800         signal(SIGFPE, blech);
7801         along = (unsigned long)f;
7802         aint = (unsigned int)f;
7803         ashort = (unsigned short)f;
7804         if (along != (unsigned long)-123)
7805                 result |= 1;
7806         if (aint != (unsigned int)-123)
7807                 result |= 1;
7808         if (ashort != (unsigned short)-123)
7809                 result |= 1;
7810         sprintf(str, "1073741824.");
7811         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7812         f = f + f;
7813         along = 0;
7814         along = (unsigned long)f;
7815         if (along != 0x80000000)
7816                 result |= 2;
7817         f -= 1.;
7818         along = 0;
7819         along = (unsigned long)f;
7820         if (along != 0x7fffffff)
7821                 result |= 1;
7822         f += 2.;
7823         along = 0;
7824         along = (unsigned long)f;
7825         if (along != 0x80000001)
7826                 result |= 2;
7827         if (result)
7828                 exit(result);
7829         signal(SIGFPE, blech_in_list);
7830         sprintf(str, "123.");
7831         sscanf(str, "%lf", &f);  /* f = 123.; */
7832         along = dummy_long((unsigned long)f);
7833         aint = dummy_int((unsigned int)f);
7834         ashort = dummy_short((unsigned short)f);
7835         if (along != (unsigned long)123)
7836                 result |= 4;
7837         if (aint != (unsigned int)123)
7838                 result |= 4;
7839         if (ashort != (unsigned short)123)
7840                 result |= 4;
7841         exit(result);
7842
7843 }
7844 EOCP
7845 set try
7846 if eval $compile_ok; then
7847         ./try
7848         castflags=$?
7849 else
7850         echo "(I can't seem to compile the test program--assuming it can't)"
7851         castflags=7
7852 fi
7853 case "$castflags" in
7854 0)      val="$define"
7855         echo "Yup, it can."
7856         ;;
7857 *)      val="$undef"
7858         echo "Nope, it can't."
7859         ;;
7860 esac
7861 set d_castneg
7862 eval $setvar
7863 $rm -f try.*
7864
7865 : see if vprintf exists
7866 echo " "
7867 if set vprintf val -f d_vprintf; eval $csym; $val; then
7868         echo 'vprintf() found.' >&4
7869         val="$define"
7870         $cat >vprintf.c <<'EOF'
7871 #include <varargs.h>
7872
7873 int main() { xxx("foo"); }
7874
7875 xxx(va_alist)
7876 va_dcl
7877 {
7878         va_list args;
7879         char buf[10];
7880
7881         va_start(args);
7882         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7883 }
7884 EOF
7885         set vprintf
7886         if eval $compile && ./vprintf; then
7887                 echo "Your vsprintf() returns (int)." >&4
7888                 val2="$undef"
7889         else
7890                 echo "Your vsprintf() returns (char*)." >&4
7891                 val2="$define"
7892         fi
7893 else
7894         echo 'vprintf() NOT found.' >&4
7895                 val="$undef"
7896                 val2="$undef"
7897 fi
7898 set d_vprintf
7899 eval $setvar
7900 val=$val2
7901 set d_charvspr
7902 eval $setvar
7903
7904 : see if chown exists
7905 set chown d_chown
7906 eval $inlibc
7907
7908 : see if chroot exists
7909 set chroot d_chroot
7910 eval $inlibc
7911
7912 : see if chsize exists
7913 set chsize d_chsize
7914 eval $inlibc
7915
7916 : check for const keyword
7917 echo " "
7918 echo 'Checking to see if your C compiler knows about "const"...' >&4
7919 $cat >const.c <<'EOCP'
7920 typedef struct spug { int drokk; } spug;
7921 int main()
7922 {
7923         const char *foo;
7924         const spug y;
7925 }
7926 EOCP
7927 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7928         val="$define"
7929         echo "Yup, it does."
7930 else
7931         val="$undef"
7932         echo "Nope, it doesn't."
7933 fi
7934 set d_const
7935 eval $setvar
7936
7937 : see if crypt exists
7938 echo " "
7939 if set crypt val -f d_crypt; eval $csym; $val; then
7940         echo 'crypt() found.' >&4
7941         val="$define"
7942         cryptlib=''
7943 else
7944         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7945         if $test -z "$cryptlib"; then
7946                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7947         else
7948                 cryptlib=-lcrypt
7949         fi
7950         if $test -z "$cryptlib"; then
7951                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7952         else
7953                 cryptlib=-lcrypt
7954         fi
7955         if $test -z "$cryptlib"; then
7956                 cryptlib=`./loc libcrypt$_a "" $libpth`
7957         else
7958                 cryptlib=-lcrypt
7959         fi
7960         if $test -z "$cryptlib"; then
7961                 echo 'crypt() NOT found.' >&4
7962                 val="$undef"
7963         else
7964                 val="$define"
7965         fi
7966 fi
7967 set d_crypt
7968 eval $setvar
7969
7970 : get csh whereabouts
7971 case "$csh" in
7972 'csh') val="$undef" ;;
7973 *) val="$define" ;;
7974 esac
7975 set d_csh
7976 eval $setvar
7977 : Respect a hint or command line value for full_csh.
7978 case "$full_csh" in
7979 '') full_csh=$csh ;;
7980 esac
7981
7982 : see if cuserid exists
7983 set cuserid d_cuserid
7984 eval $inlibc
7985
7986 : see if this is a limits.h system
7987 set limits.h i_limits
7988 eval $inhdr
7989
7990 : see if this is a float.h system
7991 set float.h i_float
7992 eval $inhdr
7993
7994 : See if number of significant digits in a double precision number is known
7995 echo " "
7996 $cat >dbl_dig.c <<EOM
7997 #$i_limits I_LIMITS
7998 #$i_float I_FLOAT
7999 #ifdef I_LIMITS
8000 #include <limits.h>
8001 #endif
8002 #ifdef I_FLOAT
8003 #include <float.h>
8004 #endif
8005 #ifdef DBL_DIG
8006 printf("Contains DBL_DIG");
8007 #endif
8008 EOM
8009 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8010 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8011         echo "DBL_DIG found." >&4
8012         val="$define"
8013 else
8014         echo "DBL_DIG NOT found." >&4
8015         val="$undef"
8016 fi
8017 $rm -f dbl_dig.?
8018 set d_dbl_dig
8019 eval $setvar
8020
8021 : see if difftime exists
8022 set difftime d_difftime
8023 eval $inlibc
8024
8025 : see if this is a dirent system
8026 echo " "
8027 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8028         val="$define"
8029         echo "<dirent.h> found." >&4
8030 else
8031         val="$undef"
8032         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8033                 echo "<sys/dir.h> found." >&4
8034                 echo " "
8035         else
8036                 xinc=`./findhdr sys/ndir.h`
8037         fi
8038         echo "<dirent.h> NOT found." >&4
8039 fi
8040 set i_dirent
8041 eval $setvar
8042
8043 : Look for type of directory structure.
8044 echo " "
8045 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8046
8047 case "$direntrytype" in
8048 ''|' ')
8049         case "$i_dirent" in
8050         $define) guess1='struct dirent' ;;
8051         *) guess1='struct direct'  ;;
8052         esac
8053         ;;
8054 *)      guess1="$direntrytype"
8055         ;;
8056 esac
8057
8058 case "$guess1" in
8059 'struct dirent') guess2='struct direct' ;;
8060 *) guess2='struct dirent' ;;
8061 esac
8062                 
8063 if $contains "$guess1" try.c >/dev/null 2>&1; then
8064         direntrytype="$guess1"
8065         echo "Your directory entries are $direntrytype." >&4
8066 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8067         direntrytype="$guess2"
8068         echo "Your directory entries seem to be $direntrytype." >&4
8069 else
8070         echo "I don't recognize your system's directory entries." >&4
8071         rp="What type is used for directory entries on this system?"
8072         dflt="$guess1"
8073         . ./myread
8074         direntrytype="$ans"
8075 fi
8076 $rm -f try.c
8077
8078
8079 : see if the directory entry stores field length
8080 echo " "
8081 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8082 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8083         echo "Good, your directory entry keeps length information in d_namlen." >&4
8084         val="$define"
8085 else
8086         echo "Your directory entry does not know about the d_namlen field." >&4
8087         val="$undef"
8088 fi
8089 set d_dirnamlen
8090 eval $setvar
8091 $rm -f try.c
8092
8093 : see if dlerror exists
8094 xxx_runnm="$runnm"
8095 runnm=false
8096 set dlerror d_dlerror
8097 eval $inlibc
8098 runnm="$xxx_runnm"
8099
8100 : see if dlfcn is available
8101 set dlfcn.h i_dlfcn
8102 eval $inhdr
8103
8104 case "$usedl" in
8105 $define|y|true)
8106         $cat << EOM
8107
8108 On a few systems, the dynamically loaded modules that perl generates and uses
8109 will need a different extension than shared libs. The default will probably
8110 be appropriate.
8111
8112 EOM
8113         case "$dlext" in
8114         '')     dflt="$so" ;;
8115         *)      dflt="$dlext" ;;
8116         esac
8117         rp='What is the extension of dynamically loaded modules'
8118         . ./myread
8119         dlext="$ans"
8120         ;;
8121 *)
8122         dlext="none"
8123         ;;
8124 esac
8125
8126 : Check if dlsym need a leading underscore
8127 echo " "
8128 val="$undef"
8129
8130 case "$dlsrc" in
8131 dl_dlopen.xs)
8132         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8133         $cat >dyna.c <<'EOM'
8134 fred () { }
8135 EOM
8136
8137 $cat >fred.c<<EOM
8138
8139 #include <stdio.h>
8140 #$i_dlfcn I_DLFCN
8141 #ifdef I_DLFCN
8142 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8143 #else
8144 #include <sys/types.h>
8145 #include <nlist.h>
8146 #include <link.h>
8147 #endif
8148
8149 extern int fred() ;
8150
8151 int main()
8152 {
8153     void * handle ;
8154     void * symbol ;
8155 #ifndef RTLD_LAZY
8156     int mode = 1 ;
8157 #else
8158     int mode = RTLD_LAZY ;
8159 #endif
8160     handle = dlopen("./dyna.$dlext", mode) ;
8161     if (handle == NULL) {
8162         printf ("1\n") ;
8163         fflush (stdout) ;
8164         exit(0);
8165     }
8166     symbol = dlsym(handle, "fred") ;
8167     if (symbol == NULL) {
8168         /* try putting a leading underscore */
8169         symbol = dlsym(handle, "_fred") ;
8170         if (symbol == NULL) {
8171             printf ("2\n") ;
8172             fflush (stdout) ;
8173             exit(0);
8174         }
8175         printf ("3\n") ;
8176     }
8177     else
8178         printf ("4\n") ;
8179     fflush (stdout) ;
8180     exit(0);
8181 }
8182 EOM
8183         : Call the object file tmp-dyna.o in case dlext=o.
8184         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8185                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8186                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8187                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8188                 xxx=`./fred`
8189                 case $xxx in
8190                 1)      echo "Test program failed using dlopen." >&4
8191                         echo "Perhaps you should not use dynamic loading." >&4;;
8192                 2)      echo "Test program failed using dlsym." >&4
8193                         echo "Perhaps you should not use dynamic loading." >&4;;
8194                 3)      echo "dlsym needs a leading underscore" >&4
8195                         val="$define" ;;
8196                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8197                 esac
8198         else
8199                 echo "I can't compile and run the test program." >&4
8200                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8201         fi
8202         ;;
8203 esac
8204                 
8205 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8206
8207 set d_dlsymun
8208 eval $setvar
8209
8210 hasproto='varname=$1; func=$2; shift; shift;
8211 while $test $# -ge 2; do
8212         case "$1" in
8213         $define) echo "#include <$2>";;
8214         esac ;
8215     shift 2;
8216 done > try.c;
8217 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8218 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8219         echo "$func() prototype found.";
8220         val="$define";
8221 else
8222         echo "$func() prototype NOT found.";
8223         val="$undef";
8224 fi;
8225 set $varname;
8226 eval $setvar;
8227 $rm -f try.c tryout.c'
8228
8229 : see if prototype for drand48 is available
8230 echo " "
8231 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8232 eval $hasproto
8233
8234 : see if dup2 exists
8235 set dup2 d_dup2
8236 eval $inlibc
8237
8238 : see if eaccess exists
8239 set eaccess d_eaccess
8240 eval $inlibc
8241
8242 : see if endgrent exists
8243 set endgrent d_endgrent
8244 eval $inlibc
8245
8246 : see if endhostent exists
8247 set endhostent d_endhent
8248 eval $inlibc
8249
8250 : see if endnetent exists
8251 set endnetent d_endnent
8252 eval $inlibc
8253
8254 : see if endprotoent exists
8255 set endprotoent d_endpent
8256 eval $inlibc
8257
8258 : see if endpwent exists
8259 set endpwent d_endpwent
8260 eval $inlibc
8261
8262 : see if endservent exists
8263 set endservent d_endsent
8264 eval $inlibc
8265
8266 : see if endspent exists
8267 set endspent d_endspent
8268 eval $inlibc
8269
8270 : Locate the flags for 'open()'
8271 echo " "
8272 $cat >open3.c <<'EOCP'
8273 #include <sys/types.h>
8274 #ifdef I_FCNTL
8275 #include <fcntl.h>
8276 #endif
8277 #ifdef I_SYS_FILE
8278 #include <sys/file.h>
8279 #endif
8280 int main() {
8281         if(O_RDONLY);
8282 #ifdef O_TRUNC
8283         exit(0);
8284 #else
8285         exit(1);
8286 #endif
8287 }
8288 EOCP
8289 : check sys/file.h first to get FREAD on Sun
8290 if $test `./findhdr sys/file.h` && \
8291                 set open3 -DI_SYS_FILE && eval $compile; then
8292         h_sysfile=true;
8293         echo "<sys/file.h> defines the O_* constants..." >&4
8294         if ./open3; then
8295                 echo "and you have the 3 argument form of open()." >&4
8296                 val="$define"
8297         else
8298                 echo "but not the 3 argument form of open().  Oh, well." >&4
8299                 val="$undef"
8300         fi
8301 elif $test `./findhdr fcntl.h` && \
8302                 set open3 -DI_FCNTL && eval $compile; then
8303         h_fcntl=true;
8304         echo "<fcntl.h> defines the O_* constants..." >&4
8305         if ./open3; then
8306                 echo "and you have the 3 argument form of open()." >&4
8307                 val="$define"
8308         else
8309                 echo "but not the 3 argument form of open().  Oh, well." >&4
8310                 val="$undef"
8311         fi
8312 else
8313         val="$undef"
8314         echo "I can't find the O_* constant definitions!  You got problems." >&4
8315 fi
8316 set d_open3
8317 eval $setvar
8318 $rm -f open3*
8319
8320 : see which of string.h or strings.h is needed
8321 echo " "
8322 strings=`./findhdr string.h`
8323 if $test "$strings" && $test -r "$strings"; then
8324         echo "Using <string.h> instead of <strings.h>." >&4
8325         val="$define"
8326 else
8327         val="$undef"
8328         strings=`./findhdr strings.h`
8329         if $test "$strings" && $test -r "$strings"; then
8330                 echo "Using <strings.h> instead of <string.h>." >&4
8331         else
8332                 echo "No string header found -- You'll surely have problems." >&4
8333         fi
8334 fi
8335 set i_string
8336 eval $setvar
8337 case "$i_string" in
8338 "$undef") strings=`./findhdr strings.h`;;
8339 *)        strings=`./findhdr string.h`;;
8340 esac
8341
8342 : check for non-blocking I/O stuff
8343 case "$h_sysfile" in
8344 true) echo "#include <sys/file.h>" > head.c;;
8345 *)
8346         case "$h_fcntl" in
8347         true) echo "#include <fcntl.h>" > head.c;;
8348         *) echo "#include <sys/fcntl.h>" > head.c;;
8349         esac
8350         ;;
8351 esac
8352 echo " "
8353 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8354 case "$o_nonblock" in
8355 '')
8356         $cat head.c > try.c
8357         $cat >>try.c <<'EOCP'
8358 #include <stdio.h>
8359 int main() {
8360 #ifdef O_NONBLOCK
8361         printf("O_NONBLOCK\n");
8362         exit(0);
8363 #endif
8364 #ifdef O_NDELAY
8365         printf("O_NDELAY\n");
8366         exit(0);
8367 #endif
8368 #ifdef FNDELAY
8369         printf("FNDELAY\n");
8370         exit(0);
8371 #endif
8372         exit(0);
8373 }
8374 EOCP
8375         set try
8376         if eval $compile_ok; then
8377                 o_nonblock=`./try`
8378                 case "$o_nonblock" in
8379                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8380                 *) echo "Seems like we can use $o_nonblock.";;
8381                 esac
8382         else
8383                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8384         fi
8385         ;;
8386 *) echo "Using $hint value $o_nonblock.";;
8387 esac
8388 $rm -f try try.* .out core
8389
8390 echo " "
8391 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8392 case "$eagain" in
8393 '')
8394         $cat head.c > try.c
8395         $cat >>try.c <<EOCP
8396 #include <errno.h>
8397 #include <sys/types.h>
8398 #include <signal.h>
8399 #include <stdio.h> 
8400 #define MY_O_NONBLOCK $o_nonblock
8401 #ifndef errno  /* XXX need better Configure test */
8402 extern int errno;
8403 #endif
8404 #$i_unistd I_UNISTD
8405 #ifdef I_UNISTD
8406 #include <unistd.h>
8407 #endif
8408 #ifdef $i_string
8409 #include <string.h>
8410 #else
8411 #include <strings.h>
8412 #endif
8413 $signal_t blech(x) int x; { exit(3); }
8414 EOCP
8415         $cat >> try.c <<'EOCP'
8416 int main()
8417 {
8418         int pd[2];
8419         int pu[2];
8420         char buf[1];
8421         char string[100];
8422
8423         pipe(pd);       /* Down: child -> parent */
8424         pipe(pu);       /* Up: parent -> child */
8425         if (0 != fork()) {
8426                 int ret;
8427                 close(pd[1]);   /* Parent reads from pd[0] */
8428                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8429                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8430                         exit(1);
8431                 signal(SIGALRM, blech);
8432                 alarm(5);
8433                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8434                         exit(2);
8435                 sprintf(string, "%d\n", ret);
8436                 write(2, string, strlen(string));
8437                 alarm(0);
8438 #ifdef EAGAIN
8439                 if (errno == EAGAIN) {
8440                         printf("EAGAIN\n");
8441                         goto ok;
8442                 }
8443 #endif
8444 #ifdef EWOULDBLOCK
8445                 if (errno == EWOULDBLOCK)
8446                         printf("EWOULDBLOCK\n");
8447 #endif
8448         ok:
8449                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8450                 sleep(2);                               /* Give it time to close our pipe */
8451                 alarm(5);
8452                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8453                 alarm(0);
8454                 sprintf(string, "%d\n", ret);
8455                 write(3, string, strlen(string));
8456                 exit(0);
8457         }
8458
8459         close(pd[0]);                   /* We write to pd[1] */
8460         close(pu[1]);                   /* We read from pu[0] */
8461         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8462         close(pd[1]);                   /* Pipe pd is now fully closed! */
8463         exit(0);                                /* Bye bye, thank you for playing! */
8464 }
8465 EOCP
8466         set try
8467         if eval $compile_ok; then
8468                 echo "$startsh" >mtry
8469                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8470                 chmod +x mtry
8471                 ./mtry >/dev/null 2>&1
8472                 case $? in
8473                 0) eagain=`$cat try.out`;;
8474                 1) echo "Could not perform non-blocking setting!";;
8475                 2) echo "I did a successful read() for something that was not there!";;
8476                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8477                 *) echo "Something terribly wrong happened during testing.";;
8478                 esac
8479                 rd_nodata=`$cat try.ret`
8480                 echo "A read() system call with no data present returns $rd_nodata."
8481                 case "$rd_nodata" in
8482                 0|-1) ;;
8483                 *)
8484                         echo "(That's peculiar, fixing that to be -1.)"
8485                         rd_nodata=-1
8486                         ;;
8487                 esac
8488                 case "$eagain" in
8489                 '')
8490                         echo "Forcing errno EAGAIN on read() with no data available."
8491                         eagain=EAGAIN
8492                         ;;
8493                 *)
8494                         echo "Your read() sets errno to $eagain when no data is available."
8495                         ;;
8496                 esac
8497                 status=`$cat try.err`
8498                 case "$status" in
8499                 0) echo "And it correctly returns 0 to signal EOF.";;
8500                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8501                 *) echo "However, your read() returns '$status' on EOF??";;
8502                 esac
8503                 val="$define"
8504                 if test "$status" = "$rd_nodata"; then
8505                         echo "WARNING: you can't distinguish between EOF and no data!"
8506                         val="$undef"
8507                 fi
8508         else
8509                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8510                 eagain=EAGAIN
8511         fi
8512         set d_eofnblk
8513         eval $setvar
8514         ;;
8515 *)
8516         echo "Using $hint value $eagain."
8517         echo "Your read() returns $rd_nodata when no data is present."
8518         case "$d_eofnblk" in
8519         "$define") echo "And you can see EOF because read() returns 0.";;
8520         "$undef") echo "But you can't see EOF status from read() returned value.";;
8521         *)
8522                 echo "(Assuming you can't see EOF status from read anyway.)"
8523                 d_eofnblk=$undef
8524                 ;;
8525         esac
8526         ;;
8527 esac
8528 $rm -f try try.* .out core head.c mtry
8529
8530 : see if fchmod exists
8531 set fchmod d_fchmod
8532 eval $inlibc
8533
8534 : see if fchown exists
8535 set fchown d_fchown
8536 eval $inlibc
8537
8538 : see if this is an fcntl system
8539 set fcntl d_fcntl
8540 eval $inlibc
8541
8542 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8543 while $test $# -ge 2; do
8544         case "$1" in
8545         $define) echo "#include <$2>";;
8546         esac ;
8547     shift 2;
8548 done > try.c;
8549 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8550 set try;
8551 if eval $compile; then
8552         val="$define";
8553 else
8554         val="$undef";
8555 fi;
8556 set $varname;
8557 eval $setvar;
8558 $rm -f try.c try.o'
8559
8560 socketlib=''
8561 sockethdr=''
8562 : see whether socket exists
8563 echo " "
8564 $echo $n "Hmm... $c" >&4
8565 if set socket val -f d_socket; eval $csym; $val; then
8566         echo "Looks like you have Berkeley networking support." >&4
8567         d_socket="$define"
8568         if set setsockopt val -f; eval $csym; $val; then
8569                 d_oldsock="$undef"
8570         else
8571                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8572                 d_oldsock="$define"
8573         fi
8574 else
8575         if $contains socklib libc.list >/dev/null 2>&1; then
8576                 echo "Looks like you have Berkeley networking support." >&4
8577                 d_socket="$define"
8578                 : we will have to assume that it supports the 4.2 BSD interface
8579                 d_oldsock="$undef"
8580         else
8581                 echo "You don't have Berkeley networking in libc$_a..." >&4
8582                 if test "X$d_socket" = "X$define"; then
8583                    echo "...but you seem to believe that you have sockets." >&4
8584                 else
8585                         for net in net socket
8586                         do
8587                                 if test -f /usr/lib/lib$net$_a; then
8588                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8589                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8590                                         if $contains socket libc.list >/dev/null 2>&1; then
8591                                                 d_socket="$define"
8592                                                 socketlib="-l$net"
8593                                                 case "$net" in
8594                                                 net)
8595                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8596                                                         sockethdr="-I/usr/netinclude"
8597                                                         ;;
8598                                                 esac
8599                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8600                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8601                                                         d_oldsock="$undef"
8602                                                 else
8603                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8604                                                         d_oldsock="$define"
8605                                                 fi
8606                                                 break
8607                                         fi
8608                                 fi
8609                         done
8610                         if test "X$d_socket" != "X$define"; then
8611                            echo "or anywhere else I see." >&4
8612                            d_socket="$undef"
8613                            d_oldsock="$undef"
8614                         fi
8615                 fi
8616         fi
8617 fi
8618
8619 : see if socketpair exists
8620 set socketpair d_sockpair
8621 eval $inlibc
8622
8623
8624 echo " "
8625 echo "Checking the availability of certain socket constants..." >& 4
8626 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8627         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8628         $cat >try.c <<EOF
8629 #include <sys/types.h>
8630 #include <sys/socket.h>
8631 int main() {
8632     int i = $ENUM;
8633 }
8634 EOF
8635         val="$undef"
8636         set try; if eval $compile; then
8637                 val="$define"
8638         fi
8639         set d_${enum}; eval $setvar
8640         $rm -f try.c try
8641 done
8642
8643 : see if sys/select.h has to be included
8644 set sys/select.h i_sysselct
8645 eval $inhdr
8646
8647 : see if we should include time.h, sys/time.h, or both
8648 echo " "
8649 if test "X$timeincl" = X; then
8650         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8651         $echo $n "I'm now running the test program...$c"
8652         $cat >try.c <<'EOCP'
8653 #include <sys/types.h>
8654 #ifdef I_TIME
8655 #include <time.h>
8656 #endif
8657 #ifdef I_SYSTIME
8658 #ifdef SYSTIMEKERNEL
8659 #define KERNEL
8660 #endif
8661 #include <sys/time.h>
8662 #endif
8663 #ifdef I_SYSSELECT
8664 #include <sys/select.h>
8665 #endif
8666 int main()
8667 {
8668         struct tm foo;
8669 #ifdef S_TIMEVAL
8670         struct timeval bar;
8671 #endif
8672 #ifdef S_TIMEZONE
8673         struct timezone tzp;
8674 #endif
8675         if (foo.tm_sec == foo.tm_sec)
8676                 exit(0);
8677 #ifdef S_TIMEVAL
8678         if (bar.tv_sec == bar.tv_sec)
8679                 exit(0);
8680 #endif
8681         exit(1);
8682 }
8683 EOCP
8684         flags=''
8685         for s_timezone in '-DS_TIMEZONE' ''; do
8686         sysselect=''
8687         for s_timeval in '-DS_TIMEVAL' ''; do
8688         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8689         for i_time in '' '-DI_TIME'; do
8690         for i_systime in '-DI_SYSTIME' ''; do
8691                 case "$flags" in
8692                 '') $echo $n ".$c"
8693                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8694                         if eval $compile; then
8695                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8696                                 shift
8697                                 flags="$*"
8698                                 echo " "
8699                                 $echo $n "Succeeded with $flags$c"
8700                         fi
8701                         ;;
8702                 esac
8703         done
8704         done
8705         done
8706         done
8707         done
8708         timeincl=''
8709         echo " "
8710         case "$flags" in
8711         *SYSTIMEKERNEL*) i_systimek="$define"
8712                 timeincl=`./findhdr sys/time.h`
8713                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8714         *) i_systimek="$undef";;
8715         esac
8716         case "$flags" in
8717         *I_TIME*) i_time="$define"
8718                 timeincl=`./findhdr time.h`" $timeincl"
8719                 echo "We'll include <time.h>." >&4;;
8720         *) i_time="$undef";;
8721         esac
8722         case "$flags" in
8723         *I_SYSTIME*) i_systime="$define"
8724                 timeincl=`./findhdr sys/time.h`" $timeincl"
8725                 echo "We'll include <sys/time.h>." >&4;;
8726         *) i_systime="$undef";;
8727         esac
8728         $rm -f try.c try
8729 fi
8730
8731 : check for fd_set items
8732 $cat <<EOM
8733
8734 Checking to see how well your C compiler handles fd_set and friends ...
8735 EOM
8736 $cat >fd_set.c <<EOCP
8737 #$i_systime I_SYS_TIME
8738 #$i_sysselct I_SYS_SELECT
8739 #$d_socket HAS_SOCKET
8740 #include <sys/types.h>
8741 #ifdef HAS_SOCKET
8742 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8743 #endif
8744 #ifdef I_SYS_TIME
8745 #include <sys/time.h>
8746 #endif
8747 #ifdef I_SYS_SELECT
8748 #include <sys/select.h>
8749 #endif
8750 int main() {
8751         fd_set fds;
8752
8753 #ifdef TRYBITS
8754         if(fds.fds_bits);
8755 #endif
8756
8757 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8758         exit(0);
8759 #else
8760         exit(1);
8761 #endif
8762 }
8763 EOCP
8764 set fd_set -DTRYBITS
8765 if eval $compile; then
8766         d_fds_bits="$define"
8767         d_fd_set="$define"
8768         echo "Well, your system knows about the normal fd_set typedef..." >&4
8769         if ./fd_set; then
8770                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8771                 d_fd_macros="$define"
8772         else
8773                 $cat >&4 <<'EOM'
8774 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8775 EOM
8776                 d_fd_macros="$undef"
8777         fi
8778 else
8779         $cat <<'EOM'
8780 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8781 EOM
8782         set fd_set
8783         if eval $compile; then
8784                 d_fds_bits="$undef"
8785                 d_fd_set="$define"
8786                 echo "Well, your system has some sort of fd_set available..." >&4
8787                 if ./fd_set; then
8788                         echo "and you have the normal fd_set macros." >&4
8789                         d_fd_macros="$define"
8790                 else
8791                         $cat <<'EOM'
8792 but not the normal fd_set macros!  Gross!  More work for me...
8793 EOM
8794                         d_fd_macros="$undef"
8795                 fi
8796         else
8797         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8798                 d_fd_set="$undef"
8799                 d_fds_bits="$undef"
8800                 d_fd_macros="$undef"
8801         fi
8802 fi
8803 $rm -f fd_set*
8804
8805 : see if fgetpos exists
8806 set fgetpos d_fgetpos
8807 eval $inlibc
8808
8809 : see if flock exists
8810 set flock d_flock
8811 eval $inlibc
8812
8813 : see if fork exists
8814 set fork d_fork
8815 eval $inlibc
8816
8817 : see if pathconf exists
8818 set pathconf d_pathconf
8819 eval $inlibc
8820
8821 : see if fpathconf exists
8822 set fpathconf d_fpathconf
8823 eval $inlibc
8824
8825
8826 : check for off64_t
8827 echo " "
8828 echo "Checking to see if your system supports off64_t..." >&4
8829 $cat >try.c <<EOCP
8830 #include <sys/types.h>
8831 #include <unistd.h>
8832 int main() { off64_t x = 7; }'
8833 EOCP
8834 set try
8835 if eval $compile; then
8836         val="$define"
8837         echo "Yes, it does."
8838 else
8839         val="$undef"
8840         echo "No, it doesn't."
8841         case "$lseeksize" in
8842         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8843         esac
8844 fi
8845 $rm -f try.* try
8846 set d_off64_t
8847 eval $setvar
8848
8849 : check for fpos64_t
8850 echo " "
8851 echo "Checking to see if your system supports fpos64_t..." >&4
8852 $cat >try.c <<EOCP
8853 #include <sys/stdio.h>
8854 int main() { fpos64_t x x = 7; }'
8855 EOCP
8856 set try
8857 if eval $compile; then
8858         val="$define"
8859         echo "Yes, it does."
8860 else
8861         val="$undef"
8862         echo "No, it doesn't."
8863         case "$fpossize" in
8864         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8865         esac
8866 fi
8867 $rm -f try.* try
8868 set d_fpos64_t
8869 eval $setvar
8870
8871 hasstruct='varname=$1; struct=$2; shift; shift;
8872 while $test $# -ge 2; do
8873         case "$1" in
8874         $define) echo "#include <$2>";;
8875         esac ;
8876     shift 2;
8877 done > try.c;
8878 echo "int main () { struct $struct foo; }" >> try.c;
8879 set try;
8880 if eval $compile; then
8881         val="$define";
8882 else
8883         val="$undef";
8884 fi;
8885 set $varname;
8886 eval $setvar;
8887 $rm -f try.c try.o'
8888
8889 : see if this is a sys/param system
8890 set sys/param.h i_sysparam
8891 eval $inhdr
8892
8893 : see if this is a sys/mount.h system
8894 set sys/mount.h i_sysmount
8895 eval $inhdr
8896
8897 : see if sys/types.h has to be included
8898 set sys/types.h i_systypes
8899 eval $inhdr
8900
8901
8902 echo " "
8903 echo "Checking to see if your system supports struct fs_data..." >&4
8904 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8905 eval $hasstruct
8906 case "$d_fs_data_s" in
8907 "$define")      echo "Yes, it does."   ;;
8908 *)              echo "No, it doesn't." ;;
8909 esac
8910
8911 : see if fseeko exists
8912 set fseeko d_fseeko
8913 eval $inlibc
8914 case "$longsize" in
8915 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8916 esac
8917
8918 : see if fsetpos exists
8919 set fsetpos d_fsetpos
8920 eval $inlibc
8921
8922
8923 : see if fstatfs exists
8924 set fstatfs d_fstatfs
8925 eval $inlibc
8926
8927
8928 : see if statvfs exists
8929 set statvfs d_statvfs
8930 eval $inlibc
8931
8932 : see if fstatvfs exists
8933 set fstatvfs d_fstatvfs
8934 eval $inlibc
8935
8936
8937 : see if ftello exists
8938 set ftello d_ftello
8939 eval $inlibc
8940 case "$longsize" in
8941 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8942 esac
8943
8944 : see if getgrent exists
8945 set getgrent d_getgrent
8946 eval $inlibc
8947
8948 : see if gethostbyaddr exists
8949 set gethostbyaddr d_gethbyaddr
8950 eval $inlibc
8951
8952 : see if gethostbyname exists
8953 set gethostbyname d_gethbyname
8954 eval $inlibc
8955
8956 : see if gethostent exists
8957 set gethostent d_gethent
8958 eval $inlibc
8959
8960 : see how we will look up host name
8961 echo " "
8962 call=''
8963 if set gethostname val -f d_gethname; eval $csym; $val; then
8964         echo 'gethostname() found.' >&4
8965         d_gethname="$define"
8966         call=gethostname
8967 fi
8968 if set uname val -f d_uname; eval $csym; $val; then
8969         if ./xenix; then
8970                 $cat <<'EOM'
8971 uname() was found, but you're running xenix, and older versions of xenix
8972 have a broken uname(). If you don't really know whether your xenix is old
8973 enough to have a broken system call, use the default answer.
8974
8975 EOM
8976                 dflt=y
8977                 case "$d_uname" in
8978                 "$define") dflt=n;;
8979                 esac
8980                 rp='Is your uname() broken?'
8981                 . ./myread
8982                 case "$ans" in
8983                 n*) d_uname="$define"; call=uname;;
8984                 esac
8985         else
8986                 echo 'uname() found.' >&4
8987                 d_uname="$define"
8988                 case "$call" in
8989                 '') call=uname ;;
8990                 esac
8991         fi
8992 fi
8993 case "$d_gethname" in
8994 '') d_gethname="$undef";;
8995 esac
8996 case "$d_uname" in
8997 '') d_uname="$undef";;
8998 esac
8999 case "$d_uname$d_gethname" in
9000 *define*)
9001         dflt=n
9002         cat <<EOM
9003  
9004 Every now and then someone has a $call() that lies about the hostname
9005 but can't be fixed for political or economic reasons.  If you wish, I can
9006 pretend $call() isn't there and maybe compute hostname at run-time
9007 thanks to the '$phostname' command.
9008
9009 EOM
9010         rp="Shall I ignore $call() from now on?"
9011         . ./myread
9012         case "$ans" in
9013         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9014         esac;;
9015 esac
9016 case "$phostname" in
9017 '') aphostname='';;
9018 *) case "$aphostname" in
9019         /*) ;;
9020         *) set X $phostname
9021                 shift
9022                 file=$1
9023                 shift
9024                 file=`./loc $file $file $pth`
9025                 aphostname=`echo $file $*`
9026                 ;;
9027         esac
9028         ;;
9029 esac
9030 case "$d_uname$d_gethname" in
9031 *define*) ;;
9032 *)
9033         case "$phostname" in
9034         '')
9035                 echo "There will be no way for $package to get your hostname." >&4;;
9036         *)
9037         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9038                 ;;
9039         esac;;
9040 esac
9041 case "$d_phostname" in
9042 '') d_phostname="$undef";;
9043 esac
9044
9045 : see if this is a netdb.h system
9046 set netdb.h i_netdb
9047 eval $inhdr
9048
9049 : see if prototypes for various gethostxxx netdb.h functions are available
9050 echo " "
9051 set d_gethostprotos gethostent $i_netdb netdb.h
9052 eval $hasproto
9053
9054 : see if getlogin exists
9055 set getlogin d_getlogin
9056 eval $inlibc
9057
9058 : see if getmnt exists
9059 set getmnt d_getmnt
9060 eval $inlibc
9061
9062 : see if getmntent exists
9063 set getmntent d_getmntent
9064 eval $inlibc
9065
9066 : see if getnetbyaddr exists
9067 set getnetbyaddr d_getnbyaddr
9068 eval $inlibc
9069
9070 : see if getnetbyname exists
9071 set getnetbyname d_getnbyname
9072 eval $inlibc
9073
9074 : see if getnetent exists
9075 set getnetent d_getnent
9076 eval $inlibc
9077
9078 : see if prototypes for various getnetxxx netdb.h functions are available
9079 echo " "
9080 set d_getnetprotos getnetent $i_netdb netdb.h
9081 eval $hasproto
9082
9083
9084 : see if getprotobyname exists
9085 set getprotobyname d_getpbyname
9086 eval $inlibc
9087
9088 : see if getprotobynumber exists
9089 set getprotobynumber d_getpbynumber
9090 eval $inlibc
9091
9092 : see if getprotoent exists
9093 set getprotoent d_getpent
9094 eval $inlibc
9095
9096 : see if getpgid exists
9097 set getpgid d_getpgid
9098 eval $inlibc
9099
9100 : see if getpgrp2 exists
9101 set getpgrp2 d_getpgrp2
9102 eval $inlibc
9103
9104 : see if getppid exists
9105 set getppid d_getppid
9106 eval $inlibc
9107
9108 : see if getpriority exists
9109 set getpriority d_getprior
9110 eval $inlibc
9111
9112 : see if prototypes for various getprotoxxx netdb.h functions are available
9113 echo " "
9114 set d_getprotoprotos getprotoent $i_netdb netdb.h
9115 eval $hasproto
9116
9117 : see if getpwent exists
9118 set getpwent d_getpwent
9119 eval $inlibc
9120
9121
9122 : see if getservbyname exists
9123 set getservbyname d_getsbyname
9124 eval $inlibc
9125
9126 : see if getservbyport exists
9127 set getservbyport d_getsbyport
9128 eval $inlibc
9129
9130 : see if getservent exists
9131 set getservent d_getsent
9132 eval $inlibc
9133
9134 : see if prototypes for various getservxxx netdb.h functions are available
9135 echo " "
9136 set d_getservprotos getservent $i_netdb netdb.h
9137 eval $hasproto
9138
9139 : see if getspent exists
9140 set getspent d_getspent
9141 eval $inlibc
9142
9143 : see if getspnam exists
9144 set getspnam d_getspnam
9145 eval $inlibc
9146
9147 : see if gettimeofday or ftime exists
9148 set gettimeofday d_gettimeod
9149 eval $inlibc
9150 case "$d_gettimeod" in
9151 "$undef")
9152         set ftime d_ftime 
9153         eval $inlibc
9154         ;;
9155 *)
9156         val="$undef"; set d_ftime; eval $setvar
9157         ;;
9158 esac
9159 case "$d_gettimeod$d_ftime" in
9160 "$undef$undef")
9161         echo " "
9162         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9163         ;;
9164 esac
9165
9166 : see if this is an grp system
9167 set grp.h i_grp
9168 eval $inhdr
9169
9170 case "$i_grp" in
9171 $define)
9172         xxx=`./findhdr grp.h`
9173         $cppstdin $cppflags $cppminus < $xxx >$$.h
9174
9175         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9176                 val="$define"
9177         else
9178                 val="$undef"
9179         fi
9180         set d_grpasswd
9181         eval $setvar
9182
9183         $rm -f $$.h
9184         ;;
9185 *)
9186         val="$undef";
9187         set d_grpasswd; eval $setvar
9188         ;;
9189 esac
9190
9191 : see if hasmntopt exists
9192 set hasmntopt d_hasmntopt
9193 eval $inlibc
9194
9195 : see if this is a netinet/in.h or sys/in.h system
9196 set netinet/in.h i_niin sys/in.h i_sysin
9197 eval $inhdr
9198
9199 : see if arpa/inet.h has to be included
9200 set arpa/inet.h i_arpainet
9201 eval $inhdr
9202
9203 : see if htonl --and friends-- exists
9204 val=''
9205 set htonl val
9206 eval $inlibc
9207
9208 : Maybe they are macros.
9209 case "$val" in
9210 $undef)
9211         $cat >htonl.c <<EOM
9212 #include <stdio.h>
9213 #include <sys/types.h>
9214 #$i_niin I_NETINET_IN
9215 #$i_sysin I_SYS_IN
9216 #$i_arpainet I_ARPA_INET
9217 #ifdef I_NETINET_IN
9218 #include <netinet/in.h>
9219 #endif
9220 #ifdef I_SYS_IN
9221 #include <sys/in.h>
9222 #endif
9223 #ifdef I_ARPA_INET
9224 #include <arpa/inet.h>
9225 #endif
9226 #ifdef htonl
9227 printf("Defined as a macro.");
9228 #endif
9229 EOM
9230         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9231         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9232                 val="$define"
9233                 echo "But it seems to be defined as a macro." >&4
9234         fi
9235         $rm -f htonl.?
9236         ;;
9237 esac
9238 set d_htonl
9239 eval $setvar
9240
9241 : see if iconv exists
9242 set iconv d_iconv
9243 eval $inlibc
9244
9245 : index or strchr
9246 echo " "
9247 if set index val -f; eval $csym; $val; then
9248         if set strchr val -f d_strchr; eval $csym; $val; then
9249                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9250                         val="$define"
9251                         vali="$undef"
9252                         echo "strchr() found." >&4
9253                 else
9254                         val="$undef"
9255                         vali="$define"
9256                         echo "index() found." >&4
9257                 fi
9258         else
9259                 val="$undef"
9260                 vali="$define"
9261                 echo "index() found." >&4
9262         fi
9263 else
9264         if set strchr val -f d_strchr; eval $csym; $val; then
9265                 val="$define"
9266                 vali="$undef"
9267                 echo "strchr() found." >&4
9268         else
9269                 echo "No index() or strchr() found!" >&4
9270                 val="$undef"
9271                 vali="$undef"
9272         fi
9273 fi
9274 set d_strchr; eval $setvar
9275 val="$vali"
9276 set d_index; eval $setvar
9277
9278 : check whether inet_aton exists
9279 set inet_aton d_inetaton
9280 eval $inlibc
9281
9282 : see if inttypes.h is available
9283 : we want a real compile instead of Inhdr because some systems
9284 : have an inttypes.h which includes non-existent headers
9285 echo " "
9286 $cat >try.c <<EOCP
9287 #include <inttypes.h>
9288 int main() {
9289         static int32_t foo32 = 0x12345678;
9290 }
9291 EOCP
9292 set try
9293 if eval $compile; then
9294         echo "<inttypes.h> found." >&4
9295         val="$define"
9296 else
9297         echo "<inttypes.h> NOT found." >&4
9298         val="$undef"
9299 fi
9300 $rm -f try.c try
9301 set i_inttypes
9302 eval $setvar
9303
9304 : check for int64_t
9305 echo " "
9306 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9307 $cat >try.c <<EOCP
9308 #include <sys/types.h>
9309 #$i_inttypes I_INTTYPES
9310 #ifdef I_INTTYPES
9311 #include <inttypes.h>
9312 #endif
9313 int main() { int64_t x = 7; }
9314 EOCP
9315 set try
9316 if eval $compile; then
9317         val="$define"
9318         echo " Yes, it does." >&4
9319 else
9320         val="$undef"
9321         echo " No, it doesn't." >&4
9322 fi
9323 $rm -f try try.*
9324 set d_int64t
9325 eval $setvar
9326
9327 : Look for isascii
9328 echo " "
9329 $cat >isascii.c <<'EOCP'
9330 #include <stdio.h>
9331 #include <ctype.h>
9332 int main() {
9333         int c = 'A';
9334         if (isascii(c))
9335                 exit(0);
9336         else
9337                 exit(1);
9338 }
9339 EOCP
9340 set isascii
9341 if eval $compile; then
9342         echo "isascii() found." >&4
9343         val="$define"
9344 else
9345         echo "isascii() NOT found." >&4
9346         val="$undef"
9347 fi
9348 set d_isascii
9349 eval $setvar
9350 $rm -f isascii*
9351
9352 : see if killpg exists
9353 set killpg d_killpg
9354 eval $inlibc
9355
9356 : see if lchown exists
9357 echo " "
9358 $cat > try.c <<'EOCP'
9359 /* System header to define __stub macros and hopefully few prototypes,
9360     which can conflict with char lchown(); below.  */
9361 #include <assert.h>
9362 /* Override any gcc2 internal prototype to avoid an error.  */
9363 /* We use char because int might match the return type of a gcc2
9364    builtin and then its argument prototype would still apply.  */
9365 char lchown();
9366 int main() {
9367     /*  The GNU C library defines this for functions which it implements
9368         to always fail with ENOSYS.  Some functions are actually named
9369         something starting with __ and the normal name is an alias.  */
9370 #if defined (__stub_lchown) || defined (__stub___lchown)
9371 choke me
9372 #else
9373 lchown();
9374 #endif
9375 ; return 0; }
9376 EOCP
9377 set try
9378 if eval $compile; then
9379     $echo "lchown() found." >&4
9380     val="$define"
9381 else
9382     $echo "lchown() NOT found." >&4
9383     val="$undef"
9384 fi
9385 set d_lchown
9386 eval $setvar
9387
9388 : See if number of significant digits in a double precision number is known
9389 echo " "
9390 $cat >ldbl_dig.c <<EOM
9391 #$i_limits I_LIMITS
9392 #$i_float I_FLOAT
9393 #ifdef I_LIMITS
9394 #include <limits.h>
9395 #endif
9396 #ifdef I_FLOAT
9397 #include <float.h>
9398 #endif
9399 #ifdef LDBL_DIG
9400 printf("Contains LDBL_DIG");
9401 #endif
9402 EOM
9403 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9404 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9405         echo "LDBL_DIG found." >&4
9406         val="$define"
9407 else
9408         echo "LDBL_DIG NOT found." >&4
9409         val="$undef"
9410 fi
9411 $rm -f ldbl_dig.?
9412 set d_ldbl_dig
9413 eval $setvar
9414
9415 : see if link exists
9416 set link d_link
9417 eval $inlibc
9418
9419 : see if localeconv exists
9420 set localeconv d_locconv
9421 eval $inlibc
9422
9423 : see if lockf exists
9424 set lockf d_lockf
9425 eval $inlibc
9426
9427 : check for long long
9428 echo " "
9429 $echo $n "Checking to see if your system supports long long..." $c >&4
9430 echo 'int main() { long long x = 7; return 0; }' > try.c
9431 set try
9432 if eval $compile; then
9433         val="$define"
9434         echo " Yes, it does." >&4
9435 else
9436         val="$undef"
9437         echo " No, it doesn't." >&4
9438 fi
9439 $rm try.*
9440 set d_longlong
9441 eval $setvar
9442
9443 : check for length of long long
9444 case "${d_longlong}${longlongsize}" in
9445 $define)
9446         echo " "
9447         $echo $n "Checking to see how big your long longs are..." $c >&4
9448         $cat >try.c <<'EOCP'
9449 #include <stdio.h>
9450 int main()
9451 {
9452     printf("%d\n", (int)sizeof(long long));
9453     return(0);
9454 }
9455 EOCP
9456         set try
9457         if eval $compile_ok; then
9458                 longlongsize=`./try$exe_ext`
9459                 $echo " $longlongsize bytes." >&4
9460         else
9461                 dflt='8'
9462                 echo " "
9463                 echo "(I can't seem to compile the test program.  Guessing...)"
9464                 rp="What is the size of a long long (in bytes)?"
9465                 . ./myread
9466                 longlongsize="$ans"
9467         fi
9468         if $test "X$longsize" = "X$longlongsize"; then
9469                 echo "(That isn't any different from an ordinary long.)"
9470         fi      
9471         ;;
9472 esac
9473 $rm -f try.* try
9474
9475 : see if lstat exists
9476 set lstat d_lstat
9477 eval $inlibc
9478
9479 : see if mblen exists
9480 set mblen d_mblen
9481 eval $inlibc
9482
9483 : see if mbstowcs exists
9484 set mbstowcs d_mbstowcs
9485 eval $inlibc
9486
9487 : see if mbtowc exists
9488 set mbtowc d_mbtowc
9489 eval $inlibc
9490
9491 : see if memchr exists
9492 set memchr d_memchr
9493 eval $inlibc
9494
9495 : see if memcmp exists
9496 set memcmp d_memcmp
9497 eval $inlibc
9498
9499 : see if memcpy exists
9500 set memcpy d_memcpy
9501 eval $inlibc
9502
9503 : see if memmove exists
9504 set memmove d_memmove
9505 eval $inlibc
9506
9507 : see if memset exists
9508 set memset d_memset
9509 eval $inlibc
9510
9511 : see if mkdir exists
9512 set mkdir d_mkdir
9513 eval $inlibc
9514
9515 : see if mkdtemp exists
9516 set mkdtemp d_mkdtemp
9517 eval $inlibc
9518
9519 : see if mkfifo exists
9520 set mkfifo d_mkfifo
9521 eval $inlibc
9522
9523 : see if mkstemp exists
9524 set mkstemp d_mkstemp
9525 eval $inlibc
9526
9527 : see if mkstemps exists
9528 set mkstemps d_mkstemps
9529 eval $inlibc
9530
9531 : see if mktime exists
9532 set mktime d_mktime
9533 eval $inlibc
9534
9535 : see if mprotect exists
9536 set mprotect d_mprotect
9537 eval $inlibc
9538
9539 : see if msgctl exists
9540 set msgctl d_msgctl
9541 eval $inlibc
9542
9543 : see if msgget exists
9544 set msgget d_msgget
9545 eval $inlibc
9546
9547 : see if msgsnd exists
9548 set msgsnd d_msgsnd
9549 eval $inlibc
9550
9551 : see if msgrcv exists
9552 set msgrcv d_msgrcv
9553 eval $inlibc
9554
9555 : see how much of the 'msg*(2)' library is present.
9556 h_msg=true
9557 echo " "
9558 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9559 *"$undef"*) h_msg=false;;
9560 esac
9561 case "$osname" in
9562 freebsd)
9563     case "`ipcs 2>&1`" in
9564     "SVID messages"*"not configured"*)
9565         echo "Your $osname does not have the msg*(2) configured." >&4
9566         h_msg=false
9567         val="$undef"
9568         set msgctl d_msgctl
9569         eval $setvar
9570         set msgget d_msgget
9571         eval $setvar
9572         set msgsnd d_msgsnd
9573         eval $setvar
9574         set msgrcv d_msgrcv
9575         eval $setvar
9576         ;;
9577     esac
9578     ;;
9579 esac
9580 : we could also check for sys/ipc.h ...
9581 if $h_msg && $test `./findhdr sys/msg.h`; then
9582         echo "You have the full msg*(2) library." >&4
9583         val="$define"
9584 else
9585         echo "You don't have the full msg*(2) library." >&4
9586         val="$undef"
9587 fi
9588 set d_msg
9589 eval $setvar
9590
9591 : see if msync exists
9592 set msync d_msync
9593 eval $inlibc
9594
9595 : see if munmap exists
9596 set munmap d_munmap
9597 eval $inlibc
9598
9599 : see if nice exists
9600 set nice d_nice
9601 eval $inlibc
9602
9603
9604 echo " "
9605 echo "Checking which 64-bit integer type we could use..." >&4
9606
9607 case "$intsize" in
9608 8) val=int
9609    set quadtype
9610    eval $setvar
9611    val='"unsigned int"'
9612    set uquadtype
9613    eval $setvar
9614    quadkind=1
9615    ;;
9616 *) case "$longsize" in
9617    8) val=long
9618       set quadtype
9619       eval $setvar
9620       val='"unsigned long"'
9621       set uquadtype
9622       eval $setvar
9623       quadkind=2
9624       ;;
9625    *) case "$d_longlong:$longlongsize" in
9626       define:8)
9627         val='"long long"'
9628         set quadtype
9629         eval $setvar
9630         val='"unsigned long long"'
9631         set uquadtype
9632         eval $setvar
9633         quadkind=3
9634         ;;
9635       *) case "$d_int64t" in
9636          define)
9637            val=int64_t
9638            set quadtype
9639            eval $setvar
9640            val=uint64_t
9641            set uquadtype
9642            eval $setvar
9643            quadkind=4
9644            ;;
9645          esac
9646          ;;
9647       esac
9648       ;;
9649    esac
9650    ;;
9651 esac
9652
9653 case "$quadtype" in
9654 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9655         undef:define:8)
9656            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9657         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9658         esac
9659         d_quad="$undef"
9660         ;;
9661 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9662             verb="will"
9663         else
9664             verb="could"
9665         fi
9666         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9667         d_quad="$define"
9668         ;;
9669 esac
9670
9671 : check for length of character
9672 echo " "
9673 case "$charsize" in
9674 '')
9675         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9676         $cat >try.c <<'EOCP'
9677 #include <stdio.h>
9678 int main()
9679 {
9680     printf("%d\n", (int)sizeof(char));
9681     exit(0);
9682 }
9683 EOCP
9684         set try
9685         if eval $compile_ok; then
9686                 dflt=`./try`
9687         else
9688                 dflt='1'
9689                 echo "(I can't seem to compile the test program.  Guessing...)"
9690         fi
9691         ;;
9692 *)
9693         dflt="$charsize"
9694         ;;
9695 esac
9696 rp="What is the size of a character (in bytes)?"
9697 . ./myread
9698 charsize="$ans"
9699 $rm -f try.c try
9700
9701
9702 echo " "
9703 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9704
9705 case "$use64bits:$d_quad:$quadtype" in
9706 define:define:?*)
9707         ivtype="$quadtype"
9708         uvtype="$uquadtype"
9709         ivsize=8
9710         uvsize=8
9711         ;;
9712 *)      ivtype="long"
9713         uvtype="unsigned long"
9714         ivsize=$longsize
9715         uvsize=$longsize
9716         ;;
9717 esac
9718
9719 case "$uselongdouble:$d_longdbl" in
9720 define:define)
9721         nvtype="long double"
9722         nvsize=$longdblsize
9723         ;;
9724 *)      nvtype=double
9725         nvsize=$doublesize
9726         ;;
9727 esac
9728
9729 $echo "(IV will be "$ivtype", $ivsize bytes)"
9730 $echo "(UV will be "$uvtype", $uvsize bytes)"
9731 $echo "(NV will be "$nvtype", $nvsize bytes)"
9732
9733 $cat >try.c <<EOCP
9734 #$i_inttypes I_INTTYPES
9735 #ifdef I_INTTYPES
9736 #include <inttypes.h>
9737 #endif
9738 #include <stdio.h>
9739 int main() {
9740 #ifdef INT8
9741    int8_t i =  INT8_MAX;
9742   uint8_t u = UINT8_MAX;
9743   printf("int8_t\n");
9744 #endif
9745 #ifdef INT16
9746    int16_t i =  INT16_MAX;
9747   uint16_t i = UINT16_MAX;
9748   printf("int16_t\n");
9749 #endif
9750 #ifdef INT32
9751    int32_t i =  INT32_MAX;
9752   uint32_t u = UINT32_MAX;
9753   printf("int32_t\n");
9754 #endif
9755 }
9756 EOCP
9757
9758 case "$i8type" in
9759 '')     case "$charsize" in
9760         1)      i8type=char
9761                 u8type="unsigned char"
9762                 i8size=$charsize
9763                 u8size=$charsize
9764                 ;;
9765         esac
9766         ;;
9767 esac
9768 case "$i8type" in
9769 '')     set try -DINT8
9770         if eval $compile; then
9771                 case "`./try$exe_ext`" in
9772                 int8_t) i8type=int8_t
9773                         u8type=uint8_t
9774                         i8size=1
9775                         u8size=1
9776                         ;;
9777                 esac
9778         fi
9779         ;;
9780 esac
9781 case "$i8type" in
9782 '')     if $test $charsize -ge 1; then
9783                 i8type=char
9784                 u8type="unsigned char"
9785                 i8size=$charsize
9786                 u8size=$charsize
9787         fi
9788         ;;
9789 esac
9790
9791 case "$i16type" in
9792 '')     case "$shortsize" in
9793         2)      i16type=short
9794                 u16type="unsigned short"
9795                 i16size=$shortsize
9796                 u16size=$shortsize
9797                 ;;
9798         esac
9799         ;;
9800 esac
9801 case "$i16type" in
9802 '')     set try -DINT16
9803         if eval $compile; then
9804                 case "`./try$exe_ext`" in
9805                 int16_t)
9806                         i16type=int16_t
9807                         u16type=uint16_t
9808                         i16size=2
9809                         u16size=2
9810                         ;;
9811                 esac
9812         fi
9813         ;;
9814 esac
9815 case "$i16type" in
9816 '')     if $test $shortsize -ge 2; then
9817                 i16type=short
9818                 u16type="unsigned short"
9819                 i16size=$shortsize
9820                 u16size=$shortsize
9821         fi
9822         ;;
9823 esac
9824
9825 case "$i32type" in
9826 '')     case "$longsize" in
9827         4)      i32type=long
9828                 u32type="unsigned long"
9829                 i32size=$longsize
9830                 u32size=$longsize
9831                 ;;
9832         *)      case "$intsize" in
9833                 4)      i32type=int
9834                         u32type="unsigned int"
9835                         i32size=$intsize
9836                         u32size=$intsize
9837                         ;;
9838                 esac
9839                 ;;
9840         esac
9841         ;;
9842 esac
9843 case "$i32type" in
9844 '')     set try -DINT32
9845         if eval $compile; then
9846                 case "`./try$exe_ext`" in
9847                 int32_t)
9848                         i32type=int32_t
9849                         u32type=uint32_t
9850                         i32size=4
9851                         u32size=4
9852                         ;;
9853                 esac
9854         fi
9855         ;;
9856 esac
9857 case "$i32type" in
9858 '')     if $test $intsize -ge 4; then
9859                 i32type=int
9860                 u32type="unsigned int"
9861                 i32size=$intsize
9862                 u32size=$intsize
9863         fi
9864         ;;
9865 esac
9866
9867 case "$i64type" in
9868 '')     case "$d_quad:$quadtype" in
9869         define:?*)
9870                 i64type="$quadtype"
9871                 u64type="$uquadtype"
9872                 i64size=8
9873                 u64size=8
9874                 ;;
9875         esac
9876         ;;
9877 esac
9878
9879 $echo "Checking whether your NVs can preserve your UVs..." >&4
9880 $cat <<EOP >try.c
9881 #include <stdio.h>
9882 int main() {
9883     $uvtype k = ($uvtype)~0, l;
9884     $nvtype d;
9885     l = k;
9886     d = ($nvtype)l;
9887     l = ($uvtype)d;
9888     if (l == k)
9889        printf("preserve\n");
9890     exit(0);
9891 }
9892 EOP
9893 set try
9894 if eval $compile; then
9895         case "`./try$exe_ext`" in
9896         preserve) d_nv_preserves_uv="$define" ;;
9897         esac
9898 fi      
9899 case "$d_nv_preserves_uv" in
9900 $define) $echo "Yes, they can."  2>&1 ;;
9901 *)       $echo "No, they can't." 2>&1
9902          d_nv_preserves_uv="$undef"
9903          ;;
9904 esac
9905
9906 $rm -f try.* try
9907
9908 : see if POSIX threads are available
9909 set pthread.h i_pthread
9910 eval $inhdr
9911
9912
9913
9914
9915 : how to create joinable pthreads
9916 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9917         echo " "
9918         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9919         $cat >try.c <<'EOCP'
9920 #include <pthread.h>
9921 int main() {
9922     int detachstate = JOINABLE;
9923 }
9924 EOCP
9925         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9926         if eval $compile; then
9927                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9928                 val="$undef" # Yes, undef.
9929                 set d_old_pthread_create_joinable
9930                 eval $setvar
9931                 val=""
9932                 set old_pthread_create_joinable
9933                 eval $setvar
9934         else
9935                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9936                 if eval $compile; then
9937                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9938                         val="$define"
9939                         set d_old_pthread_create_joinable
9940                         eval $setvar
9941                         val=PTHREAD_CREATE_UNDETACHED
9942                         set old_pthread_create_joinable
9943                         eval $setvar
9944                 else            
9945                         set try -DJOINABLE=__UNDETACHED
9946                         if eval $compile; then
9947                                 echo "You seem to use __UNDETACHED." >&4
9948                                 val="$define"
9949                                 set d_old_pthread_create_joinable
9950                                 eval $setvar
9951                                 val=__UNDETACHED
9952                                 set old_pthread_create_joinable
9953                                 eval $setvar
9954                         else
9955                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9956                                 val="$define"
9957                                 set d_old_pthread_create_joinable
9958                                 eval $setvar
9959                                 val=0
9960                                 set old_pthread_create_joinable
9961                                 eval $setvar
9962                         fi
9963                 fi
9964         fi
9965         $rm -f try try.*
9966 else
9967     d_old_pthread_create_joinable="$undef"
9968     old_pthread_create_joinable=""
9969 fi
9970
9971 : see if pause exists
9972 set pause d_pause
9973 eval $inlibc
9974
9975 : see if pipe exists
9976 set pipe d_pipe
9977 eval $inlibc
9978
9979 : see if poll exists
9980 set poll d_poll
9981 eval $inlibc
9982
9983
9984 : see whether the various POSIXish _yields exist
9985 $cat >try.c <<EOP
9986 #include <pthread.h>
9987 #include <stdio.h>
9988 int main() {
9989 #ifdef SCHED_YIELD
9990         sched_yield();
9991 #else
9992 #ifdef PTHREAD_YIELD
9993         pthread_yield();
9994 #else
9995 #ifdef PTHREAD_YIELD_NULL
9996         pthread_yield(NULL);
9997 #endif
9998 #endif
9999 #endif
10000 }
10001 EOP
10002 : see if sched_yield exists
10003 set try -DSCHED_YIELD
10004 if eval $compile; then
10005     val="$define"
10006     sched_yield='sched_yield()'
10007 else
10008     val="$undef"
10009 fi
10010 case "$usethreads" in
10011 $define)
10012         case "$val" in
10013         $define) echo 'sched_yield() found.' >&4        ;;
10014         *)       echo 'sched_yield() NOT found.' >&4    ;;
10015         esac
10016 esac
10017 set d_sched_yield
10018 eval $setvar
10019
10020 : see if pthread_yield exists
10021 set try -DPTHREAD_YIELD
10022 if eval $compile; then
10023     val="$define"
10024     case "$sched_yield" in
10025     '') sched_yield='pthread_yield()' ;;
10026     esac
10027 else
10028     set try -DPTHREAD_YIELD_NULL
10029     if eval $compile; then
10030         val="$define"
10031         case "$sched_yield" in
10032         '') sched_yield='pthread_yield(NULL)' ;;
10033         esac
10034     else
10035         val="$undef"
10036     fi
10037 fi
10038 case "$usethreads" in
10039 $define)
10040         case "$val" in
10041         $define) echo 'pthread_yield() found.' >&4      ;;
10042         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10043         esac
10044         ;;
10045 esac
10046 set d_pthread_yield
10047 eval $setvar
10048
10049 case "$sched_yield" in
10050 '') sched_yield=undef ;;
10051 esac
10052
10053 $rm -f try try.*
10054
10055 : see if this is a pwd.h system
10056 set pwd.h i_pwd
10057 eval $inhdr
10058
10059 case "$i_pwd" in
10060 $define)
10061         xxx=`./findhdr pwd.h`
10062         $cppstdin $cppflags $cppminus < $xxx >$$.h
10063
10064         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10065                 val="$define"
10066         else
10067                 val="$undef"
10068         fi
10069         set d_pwquota
10070         eval $setvar
10071
10072         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10073                 val="$define"
10074         else
10075                 val="$undef"
10076         fi
10077         set d_pwage
10078         eval $setvar
10079
10080         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10081                 val="$define"
10082         else
10083                 val="$undef"
10084         fi
10085         set d_pwchange
10086         eval $setvar
10087
10088         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10089                 val="$define"
10090         else
10091                 val="$undef"
10092         fi
10093         set d_pwclass
10094         eval $setvar
10095
10096         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10097                 val="$define"
10098         else
10099                 val="$undef"
10100         fi
10101         set d_pwexpire
10102         eval $setvar
10103
10104         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10105                 val="$define"
10106         else
10107                 val="$undef"
10108         fi
10109         set d_pwcomment
10110         eval $setvar
10111
10112         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10113                 val="$define"
10114         else
10115                 val="$undef"
10116         fi
10117         set d_pwgecos
10118         eval $setvar
10119
10120         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10121                 val="$define"
10122         else
10123                 val="$undef"
10124         fi
10125         set d_pwpasswd
10126         eval $setvar
10127
10128         $rm -f $$.h
10129         ;;
10130 *)
10131         val="$undef"; 
10132         set d_pwquota; eval $setvar
10133         set d_pwage; eval $setvar
10134         set d_pwchange; eval $setvar
10135         set d_pwclass; eval $setvar
10136         set d_pwexpire; eval $setvar
10137         set d_pwcomment; eval $setvar
10138         set d_pwgecos; eval $setvar
10139         set d_pwpasswd; eval $setvar
10140         ;;
10141 esac
10142
10143 : see if readdir and friends exist
10144 set readdir d_readdir
10145 eval $inlibc
10146 set seekdir d_seekdir
10147 eval $inlibc
10148 set telldir d_telldir
10149 eval $inlibc
10150 set rewinddir d_rewinddir
10151 eval $inlibc
10152
10153 : see if readlink exists
10154 set readlink d_readlink
10155 eval $inlibc
10156
10157 : see if rename exists
10158 set rename d_rename
10159 eval $inlibc
10160
10161 : see if rmdir exists
10162 set rmdir d_rmdir
10163 eval $inlibc
10164
10165 : see if memory.h is available.
10166 val=''
10167 set memory.h val
10168 eval $inhdr
10169
10170 : See if it conflicts with string.h
10171 case "$val" in
10172 $define)
10173         case "$strings" in
10174         '') ;;
10175         *)
10176                 $cppstdin $cppflags $cppminus < $strings > mem.h
10177                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10178                         echo " "
10179                         echo "We won't be including <memory.h>."
10180                         val="$undef"
10181                 fi
10182                 $rm -f mem.h
10183                 ;;
10184         esac
10185 esac
10186 set i_memory
10187 eval $setvar
10188
10189 : can bcopy handle overlapping blocks?
10190 val="$undef"
10191 case "$d_bcopy" in
10192 "$define")
10193         echo " "
10194         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10195         $cat >try.c <<EOCP
10196 #$i_memory I_MEMORY
10197 #$i_stdlib I_STDLIB
10198 #$i_string I_STRING
10199 #$i_unistd I_UNISTD
10200 EOCP
10201         $cat >>try.c <<'EOCP'
10202 #include <stdio.h>
10203 #ifdef I_MEMORY
10204 #  include <memory.h>
10205 #endif
10206 #ifdef I_STDLIB
10207 #  include <stdlib.h>
10208 #endif
10209 #ifdef I_STRING
10210 #  include <string.h>
10211 #else
10212 #  include <strings.h>
10213 #endif
10214 #ifdef I_UNISTD
10215 #  include <unistd.h>  /* Needed for NetBSD */
10216 #endif
10217 int main()
10218 {
10219 char buf[128], abc[128];
10220 char *b;
10221 int len;
10222 int off;
10223 int align;
10224
10225 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10226
10227 for (align = 7; align >= 0; align--) {
10228         for (len = 36; len; len--) {
10229                 b = buf+align;
10230                 bcopy(abc, b, len);
10231                 for (off = 1; off <= len; off++) {
10232                         bcopy(b, b+off, len);
10233                         bcopy(b+off, b, len);
10234                         if (bcmp(b, abc, len))
10235                                 exit(1);
10236                 }
10237         }
10238 }
10239 exit(0);
10240 }
10241 EOCP
10242         set try
10243         if eval $compile_ok; then
10244                 if ./try 2>/dev/null; then
10245                         echo "Yes, it can."
10246                         val="$define"
10247                 else
10248                         echo "It can't, sorry."
10249                         case "$d_memmove" in
10250                         "$define") echo "But that's Ok since you have memmove()." ;;
10251                         esac
10252                 fi
10253         else
10254                 echo "(I can't compile the test program, so we'll assume not...)"
10255                 case "$d_memmove" in
10256                 "$define") echo "But that's Ok since you have memmove()." ;;
10257                 esac
10258         fi
10259         ;;
10260 esac
10261 $rm -f try.* try core
10262 set d_safebcpy
10263 eval $setvar
10264
10265 : can memcpy handle overlapping blocks?
10266 val="$undef"
10267 case "$d_memcpy" in
10268 "$define")
10269         echo " "
10270         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10271         $cat >try.c <<EOCP
10272 #$i_memory I_MEMORY
10273 #$i_stdlib I_STDLIB
10274 #$i_string I_STRING
10275 #$i_unistd I_UNISTD
10276 EOCP
10277         $cat >>try.c <<'EOCP'
10278 #include <stdio.h>
10279 #ifdef I_MEMORY
10280 #  include <memory.h>
10281 #endif
10282 #ifdef I_STDLIB
10283 #  include <stdlib.h>
10284 #endif
10285 #ifdef I_STRING
10286 #  include <string.h>
10287 #else
10288 #  include <strings.h>
10289 #endif
10290 #ifdef I_UNISTD
10291 #  include <unistd.h>  /* Needed for NetBSD */
10292 #endif
10293 int main()
10294 {
10295 char buf[128], abc[128];
10296 char *b;
10297 int len;
10298 int off;
10299 int align;
10300
10301 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10302    try to store the string in read-only memory. */
10303 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10304
10305 for (align = 7; align >= 0; align--) {
10306         for (len = 36; len; len--) {
10307                 b = buf+align;
10308                 memcpy(b, abc, len);
10309                 for (off = 1; off <= len; off++) {
10310                         memcpy(b+off, b, len);
10311                         memcpy(b, b+off, len);
10312                         if (memcmp(b, abc, len))
10313                                 exit(1);
10314                 }
10315         }
10316 }
10317 exit(0);
10318 }
10319 EOCP
10320         set try
10321         if eval $compile_ok; then
10322                 if ./try 2>/dev/null; then
10323                         echo "Yes, it can."
10324                         val="$define"
10325                 else
10326                         echo "It can't, sorry."
10327                         case "$d_memmove" in
10328                         "$define") echo "But that's Ok since you have memmove()." ;;
10329                         esac
10330                 fi
10331         else
10332                 echo "(I can't compile the test program, so we'll assume not...)"
10333                 case "$d_memmove" in
10334                 "$define") echo "But that's Ok since you have memmove()." ;;
10335                 esac
10336         fi
10337         ;;
10338 esac
10339 $rm -f try.* try core
10340 set d_safemcpy
10341 eval $setvar
10342
10343 : can memcmp be trusted to compare relative magnitude?
10344 val="$undef"
10345 case "$d_memcmp" in
10346 "$define")
10347         echo " "
10348         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10349         $cat >try.c <<EOCP
10350 #$i_memory I_MEMORY
10351 #$i_stdlib I_STDLIB
10352 #$i_string I_STRING
10353 #$i_unistd I_UNISTD
10354 EOCP
10355         $cat >>try.c <<'EOCP'
10356 #include <stdio.h>
10357 #ifdef I_MEMORY
10358 #  include <memory.h>
10359 #endif
10360 #ifdef I_STDLIB
10361 #  include <stdlib.h>
10362 #endif
10363 #ifdef I_STRING
10364 #  include <string.h>
10365 #else
10366 #  include <strings.h>
10367 #endif
10368 #ifdef I_UNISTD
10369 #  include <unistd.h>  /* Needed for NetBSD */
10370 #endif
10371 int main()
10372 {
10373 char a = -1;
10374 char b = 0;
10375 if ((a < b) && memcmp(&a, &b, 1) < 0)
10376         exit(1);
10377 exit(0);
10378 }
10379 EOCP
10380         set try
10381         if eval $compile_ok; then
10382                 if ./try 2>/dev/null; then
10383                         echo "Yes, it can."
10384                         val="$define"
10385                 else
10386                         echo "No, it can't (it uses signed chars)."
10387                 fi
10388         else
10389                 echo "(I can't compile the test program, so we'll assume not...)"
10390         fi
10391         ;;
10392 esac
10393 $rm -f try.* try core
10394 set d_sanemcmp
10395 eval $setvar
10396
10397 : see if select exists
10398 set select d_select
10399 eval $inlibc
10400
10401 : see if semctl exists
10402 set semctl d_semctl
10403 eval $inlibc
10404
10405 : see if semget exists
10406 set semget d_semget
10407 eval $inlibc
10408
10409 : see if semop exists
10410 set semop d_semop
10411 eval $inlibc
10412
10413 : see how much of the 'sem*(2)' library is present.
10414 h_sem=true
10415 echo " "
10416 case "$d_semctl$d_semget$d_semop" in
10417 *"$undef"*) h_sem=false;;
10418 esac
10419 case "$osname" in
10420 freebsd)
10421     case "`ipcs 2>&1`" in
10422     "SVID messages"*"not configured"*)
10423         echo "Your $osname does not have the sem*(2) configured." >&4
10424         h_sem=false
10425         val="$undef"
10426         set semctl d_semctl
10427         eval $setvar
10428         set semget d_semget
10429         eval $setvar
10430         set semop d_semop
10431         eval $setvar
10432         ;;
10433     esac
10434     ;;
10435 esac
10436 : we could also check for sys/ipc.h ...
10437 if $h_sem && $test `./findhdr sys/sem.h`; then
10438         echo "You have the full sem*(2) library." >&4
10439         val="$define"
10440 else
10441         echo "You don't have the full sem*(2) library." >&4
10442         val="$undef"
10443 fi
10444 set d_sem
10445 eval $setvar
10446
10447 : see whether sys/sem.h defines union semun
10448 echo " "
10449 $cat > try.c <<'END'
10450 #include <sys/types.h>
10451 #include <sys/ipc.h>
10452 #include <sys/sem.h>
10453 int main () { union semun semun; semun.buf = 0; }
10454 END
10455 set try
10456 if eval $compile; then
10457     echo "You have union semun in <sys/sem.h>." >&4
10458     val="$define"
10459 else
10460     echo "You do not have union semun in <sys/sem.h>." >&4
10461     val="$undef"
10462 fi
10463 $rm -f try try.c try.h
10464 set d_union_semun
10465 eval $setvar
10466
10467 : see how to do semctl IPC_STAT
10468 case "$d_sem" in
10469 $define)
10470     : see whether semctl IPC_STAT can use union semun
10471     echo " "
10472     $cat > try.h <<END
10473 #ifndef S_IRUSR
10474 #   ifdef S_IREAD
10475 #       define S_IRUSR S_IREAD
10476 #       define S_IWUSR S_IWRITE
10477 #       define S_IXUSR S_IEXEC
10478 #   else
10479 #       define S_IRUSR 0400
10480 #       define S_IWUSR 0200
10481 #       define S_IXUSR 0100
10482 #   endif
10483 #   define S_IRGRP (S_IRUSR>>3)
10484 #   define S_IWGRP (S_IWUSR>>3)
10485 #   define S_IXGRP (S_IXUSR>>3)
10486 #   define S_IROTH (S_IRUSR>>6)
10487 #   define S_IWOTH (S_IWUSR>>6)
10488 #   define S_IXOTH (S_IXUSR>>6)
10489 #endif
10490 #ifndef S_IRWXU
10491 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10492 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10493 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10494 #endif
10495 END
10496
10497     $cat > try.c <<END
10498 #include <sys/types.h>
10499 #include <sys/ipc.h>
10500 #include <sys/sem.h>
10501 #include <sys/stat.h>
10502 #include <stdio.h>
10503 #include <errno.h>
10504 #include "try.h"
10505 #ifndef errno
10506 extern int errno;
10507 #endif
10508 #$d_union_semun HAS_UNION_SEMUN
10509 int main() {
10510     union semun
10511 #ifndef HAS_UNION_SEMUN
10512     {
10513         int val;
10514         struct semid_ds *buf;
10515         unsigned short *array;
10516     }
10517 #endif
10518     arg;
10519     int sem, st;
10520
10521 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10522     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10523     if (sem > -1) {
10524         struct semid_ds argbuf;
10525         arg.buf = &argbuf;
10526 #       ifdef IPC_STAT
10527         st = semctl(sem, 0, IPC_STAT, arg);
10528         if (st == 0)
10529             printf("semun\n");
10530         else
10531 #       endif /* IPC_STAT */
10532             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10533 #       ifdef IPC_RMID
10534         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10535 #       endif /* IPC_RMID */
10536             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10537     } else
10538 #endif /* IPC_PRIVATE && ... */
10539         printf("semget failed: errno = %d\n", errno);
10540   return 0;
10541 }
10542 END
10543     val="$undef"
10544     set try
10545     if eval $compile; then
10546         xxx=`./try`
10547         case "$xxx" in
10548         semun) val="$define" ;;
10549         esac
10550     fi
10551     $rm -f try try.c
10552     set d_semctl_semun
10553     eval $setvar
10554     case "$d_semctl_semun" in
10555     $define)
10556         echo "You can use union semun for semctl IPC_STAT." >&4
10557         also='also'
10558         ;;
10559     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10560         also=''
10561         ;;
10562     esac
10563
10564     : see whether semctl IPC_STAT can use struct semid_ds pointer
10565     $cat > try.c <<'END'
10566 #include <sys/types.h>
10567 #include <sys/ipc.h>
10568 #include <sys/sem.h>
10569 #include <sys/stat.h>
10570 #include "try.h"
10571 #include <stdio.h>
10572 #include <errno.h>
10573 #ifndef errno
10574 extern int errno;
10575 #endif
10576 int main() {
10577     struct semid_ds arg;
10578     int sem, st;
10579
10580 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10581     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10582     if (sem > -1) {
10583 #       ifdef IPC_STAT
10584         st = semctl(sem, 0, IPC_STAT, &arg);
10585         if (st == 0)
10586             printf("semid_ds\n");
10587         else
10588 #       endif /* IPC_STAT */
10589             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10590 #       ifdef IPC_RMID
10591         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10592 #       endif /* IPC_RMID */
10593             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10594     } else
10595 #endif /* IPC_PRIVATE && ... */
10596         printf("semget failed: errno = %d\n", errno);
10597
10598     return 0;
10599 }
10600 END
10601     val="$undef"
10602     set try
10603     if eval $compile; then
10604         xxx=`./try`
10605         case "$xxx" in
10606         semid_ds) val="$define" ;;
10607         esac
10608     fi
10609     $rm -f try try.c
10610     set d_semctl_semid_ds
10611     eval $setvar
10612     case "$d_semctl_semid_ds" in
10613     $define)
10614         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10615         ;;
10616     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10617         ;;
10618     esac
10619     $rm -f try.h
10620     ;;
10621 *)  val="$undef"
10622
10623     # We do not have the full sem*(2) library, so assume we can not
10624     # use either.
10625
10626     set d_semctl_semun
10627     eval $setvar
10628
10629     set d_semctl_semid_ds
10630     eval $setvar
10631     ;;
10632 esac
10633
10634 : see if setegid exists
10635 set setegid d_setegid
10636 eval $inlibc
10637
10638 : see if seteuid exists
10639 set seteuid d_seteuid
10640 eval $inlibc
10641
10642 : see if setgrent exists
10643 set setgrent d_setgrent
10644 eval $inlibc
10645
10646 : see if sethostent exists
10647 set sethostent d_sethent
10648 eval $inlibc
10649
10650 : see if setlinebuf exists
10651 set setlinebuf d_setlinebuf
10652 eval $inlibc
10653
10654 : see if setlocale exists
10655 set setlocale d_setlocale
10656 eval $inlibc
10657
10658 : see if setnetent exists
10659 set setnetent d_setnent
10660 eval $inlibc
10661
10662 : see if setprotoent exists
10663 set setprotoent d_setpent
10664 eval $inlibc
10665
10666 : see if setpgid exists
10667 set setpgid d_setpgid
10668 eval $inlibc
10669
10670 : see if setpgrp2 exists
10671 set setpgrp2 d_setpgrp2
10672 eval $inlibc
10673
10674 : see if setpriority exists
10675 set setpriority d_setprior
10676 eval $inlibc
10677
10678 : see if setpwent exists
10679 set setpwent d_setpwent
10680 eval $inlibc
10681
10682 : see if setregid exists
10683 set setregid d_setregid
10684 eval $inlibc
10685 set setresgid d_setresgid
10686 eval $inlibc
10687
10688 : see if setreuid exists
10689 set setreuid d_setreuid
10690 eval $inlibc
10691 set setresuid d_setresuid
10692 eval $inlibc
10693
10694 : see if setrgid exists
10695 set setrgid d_setrgid
10696 eval $inlibc
10697
10698 : see if setruid exists
10699 set setruid d_setruid
10700 eval $inlibc
10701
10702 : see if setservent exists
10703 set setservent d_setsent
10704 eval $inlibc
10705
10706 : see if setsid exists
10707 set setsid d_setsid
10708 eval $inlibc
10709
10710 : see if setspent exists
10711 set setspent d_setspent
10712 eval $inlibc
10713
10714 : see if setvbuf exists
10715 set setvbuf d_setvbuf
10716 eval $inlibc
10717
10718 : see if sfio.h is available
10719 set sfio.h i_sfio
10720 eval $inhdr
10721
10722
10723 : see if sfio library is available
10724 case "$i_sfio" in
10725 $define)
10726         val=''
10727         set sfreserve val
10728         eval $inlibc
10729         ;;
10730 *)
10731         val="$undef"
10732         ;;
10733 esac
10734 : Ok, but do we want to use it.
10735 case "$val" in
10736 $define)
10737         case "$usesfio" in
10738         true|$define|[yY]*) dflt='y';;
10739         *) dflt='n';;
10740         esac
10741         echo "$package can use the sfio library, but it is experimental."
10742         rp="You seem to have sfio available, do you want to try using it?"
10743         . ./myread
10744         case "$ans" in
10745         y|Y) ;;
10746         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10747                 val="$undef"
10748                 : Remove sfio from list of libraries to use
10749                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10750                 shift
10751                 libs="$*"
10752                 echo "libs = $libs" >&4
10753                 ;;
10754         esac
10755         ;;
10756 *)      case "$usesfio" in
10757         true|$define|[yY]*)
10758                 echo "Sorry, cannot find sfio on this machine" >&4
10759                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10760                 ;;
10761         esac
10762         ;;
10763 esac
10764 set d_sfio
10765 eval $setvar
10766 case "$d_sfio" in
10767 $define) usesfio='true';;
10768 *) usesfio='false';;
10769 esac
10770
10771 : see if shmctl exists
10772 set shmctl d_shmctl
10773 eval $inlibc
10774
10775 : see if shmget exists
10776 set shmget d_shmget
10777 eval $inlibc
10778
10779 : see if shmat exists
10780 set shmat d_shmat
10781 eval $inlibc
10782 : see what shmat returns
10783 case "$d_shmat" in
10784 "$define")
10785         $cat >shmat.c <<'END'
10786 #include <sys/shm.h>
10787 void *shmat();
10788 END
10789         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10790                 shmattype='void *'
10791         else
10792                 shmattype='char *'
10793         fi
10794         echo "and it returns ($shmattype)." >&4
10795         : see if a prototype for shmat is available
10796         xxx=`./findhdr sys/shm.h`
10797         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10798         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10799                 val="$define"
10800         else
10801                 val="$undef"
10802         fi
10803         $rm -f shmat.[co]
10804         ;;
10805 *)
10806         val="$undef"
10807         ;;
10808 esac
10809 set d_shmatprototype
10810 eval $setvar
10811
10812 : see if shmdt exists
10813 set shmdt d_shmdt
10814 eval $inlibc
10815
10816 : see how much of the 'shm*(2)' library is present.
10817 h_shm=true
10818 echo " "
10819 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10820 *"$undef"*) h_shm=false;;
10821 esac
10822 case "$osname" in
10823 freebsd)
10824     case "`ipcs 2>&1`" in
10825     "SVID shared memory"*"not configured"*)
10826         echo "Your $osname does not have the shm*(2) configured." >&4
10827         h_shm=false
10828         val="$undef"
10829         set shmctl d_shmctl
10830         evat $setvar
10831         set shmget d_shmget
10832         evat $setvar
10833         set shmat d_shmat
10834         evat $setvar
10835         set shmdt d_shmdt
10836         evat $setvar
10837         ;;
10838     esac
10839     ;;
10840 esac
10841 : we could also check for sys/ipc.h ...
10842 if $h_shm && $test `./findhdr sys/shm.h`; then
10843         echo "You have the full shm*(2) library." >&4
10844         val="$define"
10845 else
10846         echo "You don't have the full shm*(2) library." >&4
10847         val="$undef"
10848 fi
10849 set d_shm
10850 eval $setvar
10851
10852 echo " "
10853 : see if we have sigaction
10854 if set sigaction val -f d_sigaction; eval $csym; $val; then
10855         echo 'sigaction() found.' >&4
10856         $cat > try.c <<'EOP'
10857 #include <stdio.h>
10858 #include <sys/types.h>
10859 #include <signal.h>
10860 int main()
10861 {
10862     struct sigaction act, oact;
10863     act.sa_flags = 0;
10864     oact.sa_handler = 0;
10865     /* so that act and oact are used */
10866     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10867 }
10868 EOP
10869         set try
10870         if eval $compile_ok; then
10871                 val="$define"
10872         else
10873                 echo "But you don't seem to have a useable struct sigaction." >&4
10874                 val="$undef"
10875         fi
10876 else
10877         echo 'sigaction NOT found.' >&4
10878         val="$undef"
10879 fi
10880 set d_sigaction; eval $setvar
10881 $rm -f try try$_o try.c
10882
10883 : see if sigsetjmp exists
10884 echo " "
10885 case "$d_sigsetjmp" in
10886 '')
10887         $cat >try.c <<'EOP'
10888 #include <setjmp.h>
10889 sigjmp_buf env;
10890 int set = 1;
10891 int main()
10892 {
10893         if (sigsetjmp(env,1))
10894                 exit(set);
10895         set = 0;
10896         siglongjmp(env, 1);
10897         exit(1);
10898 }
10899 EOP
10900         set try
10901         if eval $compile; then
10902                 if ./try >/dev/null 2>&1; then
10903                         echo "POSIX sigsetjmp found." >&4
10904                         val="$define"
10905                 else
10906                         $cat >&4 <<EOM
10907 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10908 I'll ignore them.
10909 EOM
10910                         val="$undef"
10911                 fi
10912         else
10913                 echo "sigsetjmp not found." >&4
10914                 val="$undef"
10915         fi
10916         ;;
10917 *) val="$d_sigsetjmp"
10918         case "$d_sigsetjmp" in
10919         $define) echo "POSIX sigsetjmp found." >&4;;
10920         $undef) echo "sigsetjmp not found." >&4;;
10921         esac
10922         ;;
10923 esac
10924 set d_sigsetjmp
10925 eval $setvar
10926 $rm -f try.c try
10927
10928 : see if sys/stat.h is available
10929 set sys/stat.h i_sysstat
10930 eval $inhdr
10931
10932
10933 : see if stat knows about block sizes
10934 echo " "
10935 echo "Checking to see if your struct stat has st_blocks field..." >&4
10936 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10937 eval $hasfield
10938
10939
10940 : see if this is a sys/vfs.h system
10941 set sys/vfs.h i_sysvfs
10942 eval $inhdr
10943
10944
10945 : see if this is a sys/statfs.h system
10946 set sys/statfs.h i_sysstatfs
10947 eval $inhdr
10948
10949
10950 echo " "
10951 echo "Checking to see if your system supports struct statfs..." >&4
10952 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
10953 eval $hasstruct
10954 case "$d_statfs_s" in
10955 "$define")      echo "Yes, it does."   ;;
10956 *)              echo "No, it doesn't." ;;
10957 esac
10958
10959
10960
10961 : see if struct statfs knows about f_flags
10962 case "$d_statfs_s" in
10963 define) 
10964         echo " "
10965         echo "Checking to see if your struct statfs has f_flags field..." >&4
10966         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
10967         eval $hasfield
10968         ;;
10969 *)      val="$undef"
10970         set d_statfs_f_flags
10971         eval $setvar
10972         ;;
10973 esac
10974 case "$d_statfs_f_flags" in
10975 "$define")      echo "Yes, it does."   ;;
10976 *)              echo "No, it doesn't." ;;
10977 esac
10978
10979 : see if _ptr and _cnt from stdio act std
10980 echo " "
10981 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10982         echo "(Looks like you have stdio.h from Linux.)"
10983         case "$stdio_ptr" in
10984         '') stdio_ptr='((fp)->_IO_read_ptr)'
10985                 ptr_lval=$define
10986                 ;;
10987         *)      ptr_lval=$d_stdio_ptr_lval;;
10988         esac
10989         case "$stdio_cnt" in
10990         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10991                 cnt_lval=$undef
10992                 ;;
10993         *)      cnt_lval=$d_stdio_cnt_lval;;
10994         esac
10995         case "$stdio_base" in
10996         '') stdio_base='((fp)->_IO_read_base)';;
10997         esac
10998         case "$stdio_bufsiz" in
10999         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11000         esac
11001 else
11002         case "$stdio_ptr" in
11003         '') stdio_ptr='((fp)->_ptr)'
11004                 ptr_lval=$define
11005                 ;;
11006         *)      ptr_lval=$d_stdio_ptr_lval;;
11007         esac
11008         case "$stdio_cnt" in
11009         '') stdio_cnt='((fp)->_cnt)'
11010                 cnt_lval=$define
11011                 ;;
11012         *)      cnt_lval=$d_stdio_cnt_lval;;
11013         esac
11014         case "$stdio_base" in
11015         '') stdio_base='((fp)->_base)';;
11016         esac
11017         case "$stdio_bufsiz" in
11018         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11019         esac
11020 fi
11021 : test whether _ptr and _cnt really work
11022 echo "Checking how std your stdio is..." >&4
11023 $cat >try.c <<EOP
11024 #include <stdio.h>
11025 #define FILE_ptr(fp)    $stdio_ptr
11026 #define FILE_cnt(fp)    $stdio_cnt
11027 int main() {
11028         FILE *fp = fopen("try.c", "r");
11029         char c = getc(fp);
11030         if (
11031                 18 <= FILE_cnt(fp) &&
11032                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11033         )
11034                 exit(0);
11035         exit(1);
11036 }
11037 EOP
11038 val="$undef"
11039 set try
11040 if eval $compile; then
11041         if ./try; then
11042                 echo "Your stdio acts pretty std."
11043                 val="$define"
11044         else
11045                 echo "Your stdio isn't very std."
11046         fi
11047 else
11048         echo "Your stdio doesn't appear very std."
11049 fi
11050 $rm -f try.c try
11051 set d_stdstdio
11052 eval $setvar
11053
11054 : Can _ptr be used as an lvalue?
11055 case "$d_stdstdio$ptr_lval" in
11056 $define$define) val=$define ;;
11057 *) val=$undef ;;
11058 esac
11059 set d_stdio_ptr_lval
11060 eval $setvar
11061
11062 : Can _cnt be used as an lvalue?
11063 case "$d_stdstdio$cnt_lval" in
11064 $define$define) val=$define ;;
11065 *) val=$undef ;;
11066 esac
11067 set d_stdio_cnt_lval
11068 eval $setvar
11069
11070 : see if _base is also standard
11071 val="$undef"
11072 case "$d_stdstdio" in
11073 $define)
11074         $cat >try.c <<EOP
11075 #include <stdio.h>
11076 #define FILE_base(fp)   $stdio_base
11077 #define FILE_bufsiz(fp) $stdio_bufsiz
11078 int main() {
11079         FILE *fp = fopen("try.c", "r");
11080         char c = getc(fp);
11081         if (
11082                 19 <= FILE_bufsiz(fp) &&
11083                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11084         )
11085                 exit(0);
11086         exit(1);
11087 }
11088 EOP
11089         set try
11090         if eval $compile; then
11091                 if ./try; then
11092                         echo "And its _base field acts std."
11093                         val="$define"
11094                 else
11095                         echo "But its _base field isn't std."
11096                 fi
11097         else
11098                 echo "However, it seems to be lacking the _base field."
11099         fi
11100         $rm -f try.c try
11101         ;;
11102 esac
11103 set d_stdiobase
11104 eval $setvar
11105
11106 $cat >&4 <<EOM
11107 Checking how to access stdio streams by file descriptor number...
11108 EOM
11109 case "$stdio_stream_array" in
11110 '')     $cat >try.c <<EOCP
11111 #include <stdio.h>
11112 int main() {
11113   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11114     printf("yes\n");
11115 }
11116 EOCP
11117         for s in _iob __iob __sF
11118         do
11119                 set try -DSTDIO_STREAM_ARRAY=$s
11120                 if eval $compile; then
11121                         case "`./try$exe_ext`" in
11122                         yes)    stdio_stream_array=$s; break ;;
11123                         esac
11124                 fi
11125         done
11126         $rm -f try.* try$exe_ext
11127 esac
11128 case "$stdio_stream_array" in
11129 '')     $cat >&4 <<EOM
11130 I can't figure out how to access stdio streams by file descriptor number.
11131 EOM
11132         d_stdio_stream_array="$undef"
11133         ;;
11134 *)      $cat >&4 <<EOM
11135 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11136 EOM
11137         d_stdio_stream_array="$define"
11138         ;;
11139 esac
11140
11141 : see if strcoll exists
11142 set strcoll d_strcoll
11143 eval $inlibc
11144
11145 : check for structure copying
11146 echo " "
11147 echo "Checking to see if your C compiler can copy structs..." >&4
11148 $cat >try.c <<'EOCP'
11149 int main()
11150 {
11151         struct blurfl {
11152                 int dyick;
11153         } foo, bar;
11154
11155         foo = bar;
11156 }
11157 EOCP
11158 if $cc -c try.c >/dev/null 2>&1 ; then
11159         val="$define"
11160         echo "Yup, it can."
11161 else
11162         val="$undef"
11163         echo "Nope, it can't."
11164 fi
11165 set d_strctcpy
11166 eval $setvar
11167 $rm -f try.*
11168
11169 : see if strerror and/or sys_errlist[] exist
11170 echo " "
11171 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11172     if set strerror val -f d_strerror; eval $csym; $val; then
11173                 echo 'strerror() found.' >&4
11174                 d_strerror="$define"
11175                 d_strerrm='strerror(e)'
11176                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11177                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11178                         d_syserrlst="$define"
11179                 else
11180                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11181                         d_syserrlst="$undef"
11182                 fi
11183     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11184                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11185                 echo 'strerror() found in string header.' >&4
11186                 d_strerror="$define"
11187                 d_strerrm='strerror(e)'
11188                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11189                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11190                                 d_syserrlst="$define"
11191                 else
11192                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11193                         d_syserrlst="$undef"
11194                 fi
11195     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11196                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11197                 d_strerror="$undef"
11198                 d_syserrlst="$define"
11199                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11200     else
11201                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11202                 d_strerror="$undef"
11203                 d_syserrlst="$undef"
11204                 d_strerrm='"unknown"'
11205     fi
11206 fi
11207
11208 : see if strtod exists
11209 set strtod d_strtod
11210 eval $inlibc
11211
11212 : see if strtol exists
11213 set strtol d_strtol
11214 eval $inlibc
11215
11216 : see if strtold exists
11217 set strtold d_strtold
11218 eval $inlibc
11219
11220 : see if strtoll exists
11221 set strtoll d_strtoll
11222 eval $inlibc
11223
11224 : see if strtoul exists
11225 set strtoul d_strtoul
11226 eval $inlibc
11227
11228 : see if strtoull exists
11229 set strtoull d_strtoull
11230 eval $inlibc
11231
11232 : see if strtouq exists
11233 set strtouq d_strtouq
11234 eval $inlibc
11235
11236 : see if strxfrm exists
11237 set strxfrm d_strxfrm
11238 eval $inlibc
11239
11240 : see if symlink exists
11241 set symlink d_symlink
11242 eval $inlibc
11243
11244 : see if syscall exists
11245 set syscall d_syscall
11246 eval $inlibc
11247
11248 : see if sysconf exists
11249 set sysconf d_sysconf
11250 eval $inlibc
11251
11252 : see if system exists
11253 set system d_system
11254 eval $inlibc
11255
11256 : see if tcgetpgrp exists
11257 set tcgetpgrp d_tcgetpgrp
11258 eval $inlibc
11259
11260 : see if tcsetpgrp exists
11261 set tcsetpgrp d_tcsetpgrp
11262 eval $inlibc
11263
11264 : see if prototype for telldir is available
11265 echo " "
11266 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11267 eval $hasproto
11268
11269 : see if this is a sys/times.h system
11270 set sys/times.h i_systimes
11271 eval $inhdr
11272
11273 : see if times exists
11274 echo " "
11275 if set times val -f d_times; eval $csym; $val; then
11276         echo 'times() found.' >&4
11277         d_times="$define"
11278         inc=''
11279         case "$i_systimes" in
11280         "$define") inc='sys/times.h';;
11281         esac
11282         rp="What is the type returned by times() on this system?"
11283         set clock_t clocktype long stdio.h sys/types.h $inc
11284         eval $typedef_ask
11285 else
11286         echo 'times() NOT found, hope that will do.' >&4
11287         d_times="$undef"
11288         clocktype='int'
11289 fi
11290
11291 : see if truncate exists
11292 set truncate d_truncate
11293 eval $inlibc
11294
11295 : see if tzname[] exists
11296 echo " "
11297 if set tzname val -a d_tzname; eval $csym; $val; then
11298         val="$define"
11299         echo 'tzname[] found.' >&4
11300 else
11301         val="$undef"
11302         echo 'tzname[] NOT found.' >&4
11303 fi
11304 set d_tzname
11305 eval $setvar
11306
11307 : see if umask exists
11308 set umask d_umask
11309 eval $inlibc
11310
11311 : see if ustat exists
11312 set ustat d_ustat
11313 eval $inlibc
11314
11315 : backward compatibility for d_hvfork
11316 if test X$d_hvfork != X; then
11317         d_vfork="$d_hvfork"
11318         d_hvfork=''
11319 fi
11320 : see if there is a vfork
11321 val=''
11322 set vfork val
11323 eval $inlibc
11324
11325 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11326 : perl on Solaris 2.x, and probably elsewhere.
11327 case "$val" in
11328 $define)
11329         echo " "
11330         case "$usevfork" in
11331         false) dflt='n';;
11332         *) dflt='y';;
11333         esac
11334         cat <<'EOM'
11335  
11336 Perl can only use a vfork() that doesn't suffer from strict
11337 restrictions on calling functions or modifying global data in
11338 the child.  For example, glibc-2.1 contains such a vfork()
11339 that is unsuitable.  If your system provides a proper fork()
11340 call, chances are that you do NOT want perl to use vfork().
11341
11342 EOM
11343         rp="Do you still want to use vfork()?"
11344         . ./myread
11345         case "$ans" in
11346         y|Y) ;;
11347         *)
11348                 echo "Ok, we won't use vfork()."
11349                 val="$undef"
11350                 ;;
11351         esac
11352         ;;
11353 esac
11354 set d_vfork
11355 eval $setvar
11356 case "$d_vfork" in
11357 $define) usevfork='true';;
11358 *) usevfork='false';;
11359 esac
11360
11361 : see if this is an sysdir system
11362 set sys/dir.h i_sysdir
11363 eval $inhdr
11364
11365 : see if this is an sysndir system
11366 set sys/ndir.h i_sysndir
11367 eval $inhdr
11368
11369 : see if closedir exists
11370 set closedir d_closedir
11371 eval $inlibc
11372
11373 case "$d_closedir" in
11374 "$define")
11375         echo " "
11376         echo "Checking whether closedir() returns a status..." >&4
11377         cat > closedir.c <<EOM
11378 #$i_dirent I_DIRENT             /**/
11379 #$i_sysdir I_SYS_DIR            /**/
11380 #$i_sysndir I_SYS_NDIR          /**/
11381 #$i_systypes I_SYS_TYPES        /**/
11382
11383 #if defined(I_SYS_TYPES)
11384 #include <sys/types.h>
11385 #endif
11386 #if defined(I_DIRENT)
11387 #include <dirent.h>
11388 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11389 #include <sys/dir.h>
11390 #endif
11391 #else
11392 #ifdef I_SYS_NDIR
11393 #include <sys/ndir.h>
11394 #else
11395 #ifdef I_SYS_DIR
11396 #ifdef hp9000s500
11397 #include <ndir.h>       /* may be wrong in the future */
11398 #else
11399 #include <sys/dir.h>
11400 #endif
11401 #endif
11402 #endif
11403 #endif 
11404 int main() { return closedir(opendir(".")); }
11405 EOM
11406         set closedir
11407         if eval $compile_ok; then
11408                 if ./closedir > /dev/null 2>&1 ; then
11409                         echo "Yes, it does."
11410                         val="$undef"
11411                 else
11412                         echo "No, it doesn't."
11413                         val="$define"
11414                 fi
11415         else
11416                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11417                 val="$define"
11418         fi
11419         ;;
11420 *)
11421         val="$undef";
11422         ;;
11423 esac
11424 set d_void_closedir
11425 eval $setvar
11426 $rm -f closedir*
11427 : check for volatile keyword
11428 echo " "
11429 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11430 $cat >try.c <<'EOCP'
11431 int main()
11432 {
11433         typedef struct _goo_struct goo_struct;
11434         goo_struct * volatile goo = ((goo_struct *)0);
11435         struct _goo_struct {
11436                 long long_int;
11437                 int reg_int;
11438                 char char_var;
11439         };
11440         typedef unsigned short foo_t;
11441         char *volatile foo;
11442         volatile int bar;
11443         volatile foo_t blech;
11444         foo = foo;
11445 }
11446 EOCP
11447 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11448         val="$define"
11449         echo "Yup, it does."
11450 else
11451         val="$undef"
11452         echo "Nope, it doesn't."
11453 fi
11454 set d_volatile
11455 eval $setvar
11456 $rm -f try.*
11457
11458 : see if there is a wait4
11459 set wait4 d_wait4
11460 eval $inlibc
11461
11462 : see if waitpid exists
11463 set waitpid d_waitpid
11464 eval $inlibc
11465
11466 : see if wcstombs exists
11467 set wcstombs d_wcstombs
11468 eval $inlibc
11469
11470 : see if wctomb exists
11471 set wctomb d_wctomb
11472 eval $inlibc
11473
11474 : preserve RCS keywords in files with variable substitution, grrr
11475 Date='$Date'
11476 Id='$Id'
11477 Log='$Log'
11478 RCSfile='$RCSfile'
11479 Revision='$Revision'
11480
11481 case "$crosscompile" in
11482 ''|[nN]*) crosscompile="$undef" ;;
11483 esac
11484
11485 case "$osname" in
11486 next|rhapsody) multiarch="$define" ;;
11487 esac
11488 case "$multiarch" in
11489 ''|[nN]*) multiarch="$undef" ;;
11490 esac
11491
11492 : check for alignment requirements
11493 echo " "
11494 case "$crosscompile$multiarch" in
11495 *$define*)
11496         $cat <<EOM
11497 You seem to be either cross-compiling or doing a multiarchitecture build,
11498 skipping the memory alignment check.
11499
11500 EOM
11501         case "$alignbytes" in
11502         '') alignbytes=8 ;;
11503         esac
11504         ;;
11505 *)
11506         case "$alignbytes" in
11507         '') echo "Checking alignment constraints..." >&4
11508                 $cat >try.c <<'EOCP'
11509 #include <stdio.h>
11510 struct foobar {
11511         char foo;
11512         double bar;
11513 } try_algn;
11514 int main()
11515 {
11516     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11517     return(0);
11518 }
11519 EOCP
11520                 set try
11521                 if eval $compile_ok; then
11522                         dflt=`./try`
11523                 else
11524                         dflt='8'
11525                         echo "(I can't seem to compile the test program...)"
11526                 fi
11527                 ;;
11528         *) dflt="$alignbytes"
11529                 ;;
11530         esac
11531         rp="Doubles must be aligned on a how-many-byte boundary?"
11532         . ./myread
11533         alignbytes="$ans"
11534         $rm -f try.c try
11535         ;;
11536 esac
11537
11538
11539 : check for ordering of bytes in a long
11540 echo " "
11541 case "$crosscompile$multiarch" in
11542 *$define*)
11543         $cat <<EOM
11544 You seem to be either cross-compiling or doing a multiarchitecture build,
11545 skipping the byteorder check.
11546
11547 EOM
11548         byteorder='0xffff'
11549         ;;
11550 *)
11551         case "$byteorder" in
11552         '')
11553                 $cat <<'EOM'
11554 In the following, larger digits indicate more significance.  A big-endian
11555 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11556 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11557 machines may have weird orders like 3412.  A Cray will report 87654321,
11558 an Alpha will report 12345678. If the test program works the default is
11559 probably right.
11560 I'm now running the test program...
11561 EOM
11562                 $cat >try.c <<'EOCP'
11563 #include <stdio.h>
11564 int main()
11565 {
11566         int i;
11567         union {
11568                 unsigned long l;
11569                 char c[sizeof(long)];
11570         } u;
11571
11572         if (sizeof(long) > 4)
11573                 u.l = (0x08070605L << 32) | 0x04030201L;
11574         else
11575                 u.l = 0x04030201L;
11576         for (i = 0; i < sizeof(long); i++)
11577                 printf("%c", u.c[i]+'0');
11578         printf("\n");
11579         exit(0);
11580 }
11581 EOCP
11582                 xxx_prompt=y
11583                 set try
11584                 if eval $compile && ./try > /dev/null; then
11585                         dflt=`./try`
11586                         case "$dflt" in
11587                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11588                                 echo "(The test program ran ok.)"
11589                                 echo "byteorder=$dflt"
11590                                 xxx_prompt=n
11591                         ;;
11592                         ????|????????) echo "(The test program ran ok.)" ;;
11593                         *) echo "(The test program didn't run right for some reason.)" ;;
11594                         esac
11595                 else
11596                         dflt='4321'
11597                         cat <<'EOM'
11598 (I can't seem to compile the test program.  Guessing big-endian...)
11599 EOM
11600                 fi
11601                 case "$xxx_prompt" in
11602                 y)
11603                         rp="What is the order of bytes in a long?"
11604                         . ./myread
11605                         byteorder="$ans"
11606                         ;;
11607                 *)      byteorder=$dflt
11608                         ;;
11609                 esac
11610                 ;;
11611         esac
11612         $rm -f try.c try
11613         ;;
11614 esac
11615
11616
11617 : how do we catenate cpp tokens here?
11618 echo " "
11619 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11620 $cat >cpp_stuff.c <<'EOCP'
11621 #define RCAT(a,b)a/**/b
11622 #define ACAT(a,b)a ## b
11623 RCAT(Rei,ser)
11624 ACAT(Cir,cus)
11625 EOCP
11626 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11627 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11628         echo "Oh!  Smells like ANSI's been here." >&4
11629         echo "We can catify or stringify, separately or together!"
11630         cpp_stuff=42
11631 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11632         echo "Ah, yes!  The good old days!" >&4
11633         echo "However, in the good old days we don't know how to stringify and"
11634         echo "catify at the same time."
11635         cpp_stuff=1
11636 else
11637         $cat >&4 <<EOM
11638 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11639 to have to edit the values of CAT[2-5] in config.h...
11640 EOM
11641         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11642 fi
11643 $rm -f cpp_stuff.*
11644
11645 : see if this is a db.h system
11646 set db.h i_db
11647 eval $inhdr
11648
11649 case "$i_db" in
11650 $define)
11651         : Check db version.
11652         echo " "
11653         echo "Checking Berkeley DB version ..." >&4
11654         $cat >try.c <<EOCP
11655 #$d_const HASCONST
11656 #ifndef HASCONST
11657 #define const
11658 #endif
11659 #include <sys/types.h>
11660 #include <stdio.h>
11661 #include <db.h>
11662 int main()
11663 {
11664 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11665     int Major, Minor, Patch ;
11666     unsigned long Version ;
11667     (void)db_version(&Major, &Minor, &Patch) ;
11668     printf("You have Berkeley DB Version 2 or greater\n");
11669
11670     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11671                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11672     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11673                 Major, Minor, Patch) ;
11674
11675     /* check that db.h & libdb are compatible */
11676     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11677         printf("db.h and libdb are incompatible\n") ;
11678         exit(3);        
11679     }
11680
11681     printf("db.h and libdb are compatible\n") ;
11682
11683     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11684                 + DB_VERSION_PATCH ;
11685
11686     /* needs to be >= 2.3.4 */
11687     if (Version < 2003004) {
11688     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11689         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11690         exit(2);        
11691     }
11692
11693     exit(0);
11694 #else
11695 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11696     printf("You have Berkeley DB Version 1\n");
11697     exit(0);    /* DB version < 2: the coast is clear. */
11698 #else
11699     exit(1);    /* <db.h> not Berkeley DB? */
11700 #endif
11701 #endif
11702 }
11703 EOCP
11704         set try
11705         if eval $compile_ok && ./try; then
11706                 echo 'Looks OK.' >&4
11707         else
11708                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11709                 i_db=$undef
11710                 case " $libs " in
11711                 *"-ldb "*)
11712                         : Remove db from list of libraries to use
11713                         echo "Removing unusable -ldb from library list" >&4
11714                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11715                         shift
11716                         libs="$*"
11717                         echo "libs = $libs" >&4
11718                         ;;
11719                 esac
11720         fi
11721         $rm -f try.*
11722         ;;
11723 esac
11724
11725 case "$i_db" in
11726 define)
11727         : Check the return type needed for hash 
11728         echo " "
11729         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11730         $cat >try.c <<EOCP
11731 #$d_const HASCONST
11732 #ifndef HASCONST
11733 #define const
11734 #endif
11735 #include <sys/types.h>
11736 #include <db.h>
11737
11738 #ifndef DB_VERSION_MAJOR
11739 u_int32_t hash_cb (ptr, size)
11740 const void *ptr;
11741 size_t size;
11742 {
11743 }
11744 HASHINFO info;
11745 int main()
11746 {
11747         info.hash = hash_cb;
11748 }
11749 #endif
11750 EOCP
11751         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11752                 if $contains warning try.out >>/dev/null 2>&1 ; then
11753                         db_hashtype='int'
11754                 else
11755                         db_hashtype='u_int32_t'
11756                 fi
11757         else
11758                 : XXX Maybe we should just give up here.
11759                 db_hashtype=u_int32_t
11760                 $cat try.out >&4
11761                 echo "Help:  I can't seem to compile the db test program." >&4
11762                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11763         fi
11764         $rm -f try.*
11765         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11766         ;;
11767 *)      db_hashtype=u_int32_t
11768         ;;
11769 esac
11770 case "$i_db" in
11771 define)
11772         : Check the return type needed for prefix 
11773         echo " "
11774         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11775         cat >try.c <<EOCP
11776 #$d_const HASCONST
11777 #ifndef HASCONST
11778 #define const
11779 #endif
11780 #include <sys/types.h>
11781 #include <db.h>
11782
11783 #ifndef DB_VERSION_MAJOR
11784 size_t prefix_cb (key1, key2)
11785 const DBT *key1;
11786 const DBT *key2;
11787 {
11788 }
11789 BTREEINFO info;
11790 int main()
11791 {
11792         info.prefix = prefix_cb;
11793 }
11794 #endif
11795 EOCP
11796         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11797                 if $contains warning try.out >>/dev/null 2>&1 ; then
11798                         db_prefixtype='int'
11799                 else
11800                         db_prefixtype='size_t'
11801                 fi
11802         else
11803                 db_prefixtype='size_t'
11804                 : XXX Maybe we should just give up here.
11805                 $cat try.out >&4
11806                 echo "Help:  I can't seem to compile the db test program." >&4
11807                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11808         fi
11809         $rm -f try.*
11810         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11811         ;;
11812 *)      db_prefixtype='size_t'
11813         ;;
11814 esac
11815
11816 : check for void type
11817 echo " "
11818 echo "Checking to see how well your C compiler groks the void type..." >&4
11819 case "$voidflags" in
11820 '')
11821         $cat >try.c <<'EOCP'
11822 #if TRY & 1
11823 void sub() {
11824 #else
11825 sub() {
11826 #endif
11827         extern void moo();      /* function returning void */
11828         void (*goo)();          /* ptr to func returning void */
11829 #if TRY & 8
11830         void *hue;              /* generic ptr */
11831 #endif
11832 #if TRY & 2
11833         void (*foo[10])();
11834 #endif
11835
11836 #if TRY & 4
11837         if(goo == moo) {
11838                 exit(0);
11839         }
11840 #endif
11841         exit(0);
11842 }
11843 int main() { sub(); }
11844 EOCP
11845         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11846                 voidflags=$defvoidused
11847         echo "Good.  It appears to support void to the level $package wants.">&4
11848                 if $contains warning .out >/dev/null 2>&1; then
11849                         echo "However, you might get some warnings that look like this:"
11850                         $cat .out
11851                 fi
11852         else
11853 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11854                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11855                         echo "It supports 1..."
11856                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11857                                 echo "It also supports 2..."
11858                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11859                                         voidflags=7
11860                                         echo "And it supports 4 but not 8 definitely."
11861                                 else
11862                                         echo "It doesn't support 4..."
11863                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11864                                                 voidflags=11
11865                                                 echo "But it supports 8."
11866                                         else
11867                                                 voidflags=3
11868                                                 echo "Neither does it support 8."
11869                                         fi
11870                                 fi
11871                         else
11872                                 echo "It does not support 2..."
11873                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11874                                         voidflags=13
11875                                         echo "But it supports 4 and 8."
11876                                 else
11877                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11878                                                 voidflags=5
11879                                                 echo "And it supports 4 but has not heard about 8."
11880                                         else
11881                                                 echo "However it supports 8 but not 4."
11882                                         fi
11883                                 fi
11884                         fi
11885                 else
11886                         echo "There is no support at all for void."
11887                         voidflags=0
11888                 fi
11889         fi
11890 esac
11891 case "$voidflags" in
11892 "$defvoidused") ;;
11893 *)      $cat >&4 <<'EOM'
11894   Support flag bits are:
11895     1: basic void declarations.
11896     2: arrays of pointers to functions returning void.
11897     4: operations between pointers to and addresses of void functions.
11898     8: generic void pointers.
11899 EOM
11900         dflt="$voidflags";
11901         rp="Your void support flags add up to what?"
11902         . ./myread
11903         voidflags="$ans"
11904         ;;
11905 esac
11906 $rm -f try.* .out
11907
11908
11909 : How can we generate normalized random numbers ?
11910 echo " "
11911 echo "Looking for a random number function..." >&4
11912 case "$randfunc" in
11913 '')
11914         if set drand48 val -f; eval $csym; $val; then
11915                 dflt="drand48"
11916                 echo "Good, found drand48()." >&4
11917         elif set random val -f; eval $csym; $val; then
11918                 dflt="random"
11919                 echo "OK, found random()." >&4
11920         else
11921                 dflt="rand"
11922                 echo "Yick, looks like I have to use rand()." >&4
11923         fi
11924         echo " "
11925         ;;
11926 *)
11927         dflt="$randfunc"
11928         ;;
11929 esac
11930 cont=true
11931
11932 case "$ccflags" in
11933 *-Dmy_rand=*|*-Dmy_srand=*)
11934         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11935         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11936         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11937         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11938         ;;
11939 esac
11940
11941 while $test "$cont"; do
11942         rp="Use which function to generate random numbers?"
11943         . ./myread
11944         if $test "$ans" = "$dflt"; then
11945                 : null
11946         else
11947                 randbits=''
11948         fi
11949         randfunc="$ans"
11950         if set $ans val -f; eval $csym; $val; then
11951                 cont=''
11952         else
11953                 dflt=y
11954                 rp="I cannot find function $ans. Use that name anyway?"
11955                 . ./myread
11956                 dflt=rand
11957                 case "$ans" in
11958                         [yY]*) cont='';;
11959                 esac
11960         fi
11961         case "$cont" in
11962         '')
11963                 case "$randfunc" in
11964                 drand48)
11965                         drand01="drand48()"
11966                         seedfunc="srand48"
11967                         randbits=48
11968                         randseedtype=long
11969                         ;;
11970                 rand|random)
11971                         case "$randbits" in
11972                         '')
11973 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11974                                 $cat >try.c <<EOCP
11975 #$i_unistd I_UNISTD
11976 #$i_stdlib I_STDLIB
11977 #include <stdio.h>
11978 #ifdef I_UNISTD
11979 #  include <unistd.h>
11980 #endif
11981 #ifdef I_STDLIB
11982 #  include <stdlib.h>
11983 #endif
11984 int main()
11985 {
11986         register int i;
11987         register unsigned long tmp;
11988         register unsigned long max = 0L;
11989
11990         for (i = 1000; i; i--) {
11991                 tmp = (unsigned long) $randfunc();
11992                 if (tmp > max) max = tmp;
11993         }
11994         for (i = 0; max; i++)
11995                 max /= 2;
11996         printf("%d\n",i);
11997 }
11998 EOCP
11999                                 set try
12000                                 if eval $compile_ok; then
12001                                         dflt=`try`
12002                                 else
12003                                         dflt='?'
12004                                         echo "(I can't seem to compile the test program...)"
12005                                 fi
12006                                 ;;
12007                         *)
12008                                 dflt="$randbits"
12009                                 ;;
12010                         esac
12011                         rp="How many bits does your $randfunc() function produce?"
12012                         . ./myread
12013                         randbits="$ans"
12014                         $rm -f try.c try
12015                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12016                         seedfunc="s$randfunc"
12017                         randseedtype=unsigned
12018                         ;;
12019                 *)
12020                         dflt="31"
12021                         rp="How many bits does your $randfunc() function produce?"
12022                         . ./myread
12023                         randbits="$ans"
12024                         seedfunc="s$randfunc"
12025                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12026                         if set $seedfunc val -f; eval $csym; $val; then
12027                                 echo "(Using $seedfunc() to seed random generator)"
12028                         else
12029                                 echo "(Warning: no $seedfunc() to seed random generator)"
12030                                 seedfunc=rand
12031                         fi
12032                         randseedtype=unsigned
12033                         ;;
12034                 esac
12035                 ;;
12036         esac
12037 done
12038
12039 echo " "
12040 echo "Determining whether or not we are on an EBCDIC system..." >&4
12041 $cat >tebcdic.c <<'EOM'
12042 int main()
12043 {
12044   if ('M'==0xd4) return 0;
12045   return 1;
12046 }
12047 EOM
12048
12049 val=$undef
12050 set tebcdic
12051 if eval $compile_ok; then
12052         if ./tebcdic; then
12053                 echo "You have EBCDIC." >&4
12054                 val="$define"
12055         else
12056                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12057         fi
12058 else
12059         echo "I'm unable to compile the test program." >&4
12060         echo "I'll assume ASCII or some ISO Latin." >&4
12061 fi
12062 $rm -f tebcdic.c tebcdic
12063 set ebcdic
12064 eval $setvar
12065
12066 echo " "
12067 $cat >&4 <<EOM
12068 Checking how to flush all pending stdio output...
12069 EOM
12070 # I only know how to find the first 32 possibly open files on SunOS.
12071 # See also hints/sunos_4_1.sh and util.c  --AD
12072 case "$osname" in
12073 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12074 esac
12075 $cat >>try.c <<EOCP
12076 #include <stdio.h>
12077 #$i_unistd I_UNISTD
12078 #ifdef I_UNISTD
12079 # include <unistd.h>
12080 #endif
12081 #$d_sysconf HAS_SYSCONF
12082 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12083 #ifdef HAS_STDIO_STREAM_ARRAY
12084 # define STDIO_STREAM_ARRAY $stdio_stream_array
12085 #endif
12086 int main() {
12087   FILE* p = fopen("try.out", "w");
12088 #ifdef TRY_FPUTC
12089   fputc('x', p);
12090 #else
12091 # ifdef TRY_FPRINTF
12092   fprintf(p, "x");
12093 # endif
12094 #endif
12095 #ifdef TRY_FFLUSH_NULL
12096   fflush(NULL);
12097 #endif
12098 #ifdef TRY_FFLUSH_ALL
12099   {
12100     long open_max = -1;
12101 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12102     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12103 # else
12104 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12105     open_max = sysconf(_SC_OPEN_MAX);
12106 #  else
12107 #   ifdef FOPEN_MAX
12108     open_max = FOPEN_MAX;
12109 #   else
12110 #    ifdef OPEN_MAX
12111     open_max = OPEN_MAX;
12112 #    else
12113 #     ifdef _NFILE
12114     open_max = _NFILE;
12115 #     endif
12116 #    endif
12117 #   endif
12118 #  endif
12119 # endif 
12120 # ifdef HAS_STDIO_STREAM_ARRAY
12121     if (open_max > 0) {
12122       long i;
12123       for (i = 0; i < open_max; i++)
12124             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12125                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12126                 STDIO_STREAM_ARRAY[i]._flag)
12127                 fflush(&STDIO_STREAM_ARRAY[i]);
12128     }   
12129   }
12130 # endif
12131 #endif
12132   _exit(42);
12133 }
12134 EOCP
12135 : first we have to find out how _not_ to flush
12136 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12137     output=''
12138     set try -DTRY_FPUTC
12139     if eval $compile; then
12140             $rm -f try.out
12141             ./try$exe_ext 2>/dev/null
12142             if $test ! -s try.out -a "X$?" = X42; then
12143                 output=-DTRY_FPUTC
12144             fi
12145     fi
12146     case "$output" in
12147     '')
12148             set try -DTRY_FPRINTF
12149             $rm -f try.out
12150             if eval $compile; then
12151                     $rm -f try.out
12152                     ./try$exe_ext 2>/dev/null
12153                     if $test ! -s try.out -a "X$?" = X42; then
12154                         output=-DTRY_FPRINTF
12155                     fi
12156             fi
12157         ;;
12158     esac
12159 fi
12160 : check for fflush NULL behaviour
12161 case "$fflushNULL" in
12162 '')     set try -DTRY_FFLUSH_NULL $output
12163         if eval $compile; then
12164                 $rm -f try.out
12165                 ./try$exe_ext 2>/dev/null
12166                 code="$?"
12167                 if $test -s try.out -a "X$code" = X42; then
12168                         fflushNULL="`$cat try.out`"
12169                 else
12170                         if $test "X$code" != X42; then
12171                                 $cat >&4 <<EOM
12172 (If this test failed, don't worry, we'll try another method shortly.)
12173 EOM
12174                         fi
12175                 fi
12176         fi
12177         $rm -f core try.core core.try.*
12178         case "$fflushNULL" in
12179         x)      $cat >&4 <<EOM
12180 Your fflush(NULL) works okay.
12181 EOM
12182                 fflushNULL="$define"
12183                 ;;
12184         '')     $cat >&4 <<EOM
12185 Your fflush(NULL) isn't working (contrary to ANSI C).
12186 EOM
12187                 fflushNULL="$undef"
12188                 ;;
12189         *)      $cat >&4 <<EOM
12190 Cannot figure out whether your fflush(NULL) works or not.
12191 I'm assuming it doesn't (contrary to ANSI C).
12192 EOM
12193                 fflushNULL="$undef"
12194                 ;;
12195         esac
12196         ;;
12197 $define|true|[yY]*)
12198         fflushNULL="$define"
12199         ;;
12200 *)
12201         fflushNULL="$undef"
12202         ;;
12203 esac
12204 : check explicit looping only if NULL did not work
12205 case "$fflushNULL" in
12206 "$undef")
12207         : check for fflush all behaviour
12208         case "$fflushall" in
12209         '')     set try -DTRY_FFLUSH_ALL $output
12210                 if eval $compile; then
12211                         $cat >&4 <<EOM
12212 (Now testing the other method--but note that also this may fail.)
12213 EOM
12214                         $rm -f try.out
12215                         ./try$exe_ext 2>/dev/null
12216                         if $test -s try.out -a "X$?" = X42; then
12217                                 fflushall="`$cat try.out`"
12218                         fi
12219                 fi
12220                 $rm -f core try.core core.try.*
12221                 case "$fflushall" in
12222                 x)      $cat >&4 <<EOM
12223 Whew. Flushing explicitly all the stdio streams works.
12224 EOM
12225                         fflushall="$define"
12226                         ;;
12227                 '')     $cat >&4 <<EOM
12228 Sigh. Flushing explicitly all the stdio streams doesn't work.
12229 EOM
12230                         fflushall="$undef"
12231                         ;;
12232                 *)      $cat >&4 <<EOM
12233 Cannot figure out whether flushing stdio streams explicitly works or not.
12234 I'm assuming it doesn't.
12235 EOM
12236                         fflushall="$undef"
12237                         ;;
12238                 esac
12239                 ;;
12240         "$define"|true|[yY]*)
12241                 fflushall="$define"
12242                 ;;
12243         *)
12244                 fflushall="$undef"
12245                 ;;
12246         esac
12247         ;;
12248 *)      fflushall="$undef"      
12249         ;;
12250 esac
12251 case "$fflushNULL$fflushall" in
12252 undefundef)
12253         $cat <<EOM
12254 I cannot figure out how to flush pending stdio output.
12255 EOM
12256         ;;
12257 esac
12258 $rm -f try.* try$exe_ext
12259
12260 : Store the full pathname to the ar program for use in the C program
12261 : Respect a hint or command line value for full_ar.
12262 case "$full_ar" in
12263 '') full_ar=$ar ;;
12264 esac
12265
12266 : Store the full pathname to the sed program for use in the C program
12267 full_sed=$sed
12268
12269 : see what type gids are declared as in the kernel
12270 echo " "
12271 echo "Looking for the type for group ids returned by getgid()."
12272 set gid_t gidtype xxx stdio.h sys/types.h
12273 eval $typedef
12274 case "$gidtype" in
12275 xxx)
12276         xxx=`./findhdr sys/user.h`
12277         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12278         case $1 in
12279         unsigned) dflt="$1 $2" ;;
12280         *) dflt="$1" ;;
12281         esac
12282         ;;
12283 *) dflt="$gidtype";;
12284 esac
12285 case "$gidtype" in
12286 gid_t) echo "gid_t found." ;;
12287 *)      rp="What is the type for group ids returned by getgid()?"
12288         . ./myread
12289         gidtype="$ans"
12290         ;;
12291 esac
12292
12293 echo " "
12294 case "$gidtype" in
12295 *_t) zzz="$gidtype"     ;;
12296 *)   zzz="gid"          ;;
12297 esac
12298 echo "Checking the size of $zzz..." >&4 
12299 cat > try.c <<EOCP
12300 #include <sys/types.h>
12301 #include <stdio.h>
12302 int main() {
12303     printf("%d\n", (int)sizeof($gidtype));
12304     exit(0);
12305 }
12306 EOCP
12307 set try
12308 if eval $compile_ok; then
12309         yyy=`./try`
12310         case "$yyy" in
12311         '')     gidsize=4
12312                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12313                 ;;
12314         *)      gidsize=$yyy
12315                 echo "Your $zzz size is $gidsize bytes."
12316                 ;;
12317         esac
12318 else
12319         gidsize=4
12320         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12321 fi
12322
12323
12324 echo " "
12325 case "$gidtype" in
12326 *_t) zzz="$gidtype"     ;;
12327 *)   zzz="gid"          ;;
12328 esac
12329 echo "Checking the sign of $zzz..." >&4 
12330 cat > try.c <<EOCP
12331 #include <sys/types.h>
12332 #include <stdio.h>
12333 int main() {
12334         $gidtype foo = -1;
12335         if (foo < 0)
12336                 printf("-1\n");
12337         else
12338                 printf("1\n");
12339 }
12340 EOCP
12341 set try
12342 if eval $compile; then
12343         yyy=`./try`
12344         case "$yyy" in
12345         '')     gidsign=1
12346                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12347                 ;;
12348         *)      gidsign=$yyy
12349                 case "$gidsign" in
12350                  1) echo "Your $zzz is unsigned." ;;
12351                 -1) echo "Your $zzz is signed."   ;;
12352                 esac
12353                 ;;
12354         esac
12355 else
12356         gidsign=1
12357         echo "(I can't compile the test program--guessing unsigned.)" >&4
12358 fi
12359
12360
12361 echo " "
12362
12363 if $test X"$quadtype" != X; then
12364
12365 echo "Checking how to print 64-bit integers..." >&4
12366
12367 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12368         $cat >try.c <<'EOCP'
12369 #include <sys/types.h>
12370 #include <stdio.h>
12371 int main() {
12372   int q = 12345678901;
12373   printf("%ld\n", q);
12374 }
12375 EOCP
12376         set try
12377         if eval $compile; then
12378                 yyy=`./try$exe_ext`
12379                 case "$yyy" in
12380                 12345678901)
12381                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12382                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12383                         echo "We will use %d."
12384                         ;;
12385                 esac
12386         fi
12387 fi
12388
12389 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12390         $cat >try.c <<'EOCP'
12391 #include <sys/types.h>
12392 #include <stdio.h>
12393 int main() {
12394   long q = 12345678901;
12395   printf("%ld\n", q);
12396 }
12397 EOCP
12398         set try
12399         if eval $compile; then
12400                 yyy=`./try$exe_ext`
12401                 case "$yyy" in
12402                 12345678901)
12403                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12404                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12405                         echo "We will use %ld."
12406                         ;;
12407                 esac
12408         fi
12409 fi
12410
12411 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12412         $cat >try.c <<'EOCP'
12413 #include <sys/types.h>
12414 #include <inttypes.h>
12415 #include <stdio.h>
12416 int main() {
12417   int64_t q = 12345678901;
12418   printf("%" PRId64 "\n", q);
12419 }
12420 EOCP
12421         set try
12422         if eval $compile; then
12423                 yyy=`./try$exe_ext`
12424                 case "$yyy" in
12425                 12345678901)
12426                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12427                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12428                         echo "We will use the C9X style."
12429                         ;;
12430                 esac
12431         fi
12432 fi
12433
12434 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12435         $cat >try.c <<'EOCP'
12436 #include <sys/types.h>
12437 #include <stdio.h>
12438 int main() {
12439   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12440   printf("%lld\n", q);
12441 }
12442 EOCP
12443         set try
12444         if eval $compile; then
12445                 yyy=`./try$exe_ext`
12446                 case "$yyy" in
12447                 12345678901)
12448                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12449                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12450                         echo "We will use the %lld style."
12451                         ;;
12452                 esac
12453         fi
12454 fi
12455
12456 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12457         $cat >try.c <<EOCP
12458 #include <sys/types.h>
12459 #include <stdio.h>
12460 int main() {
12461   $quadtype q = 12345678901;
12462   printf("%Ld\n", q);
12463 }
12464 EOCP
12465         set try
12466         if eval $compile; then
12467                 yyy=`./try$exe_ext`
12468                 case "$yyy" in
12469                 12345678901)
12470                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12471                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12472                         echo "We will use %Ld."
12473                         ;;
12474                 esac
12475         fi
12476 fi
12477
12478 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12479         $cat >try.c <<EOCP
12480 #include <sys/types.h>
12481 #include <stdio.h>
12482 int main() {
12483   $quadtype q = 12345678901;
12484   printf("%qd\n", q);
12485 }
12486 EOCP
12487         set try
12488         if eval $compile; then
12489                 yyy=`./try$exe_ext`
12490                 case "$yyy" in
12491                 12345678901)
12492                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12493                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12494                         echo "We will use %qd."
12495                         ;;
12496                 esac
12497         fi
12498 fi
12499
12500 if $test X"$sPRId64" = X; then
12501         echo "Cannot figure out how to print 64-bit integers." >&4
12502 fi
12503
12504 $rm -f try try.*
12505
12506 fi
12507
12508 case "$sPRId64" in
12509 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12510         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12511         ;;
12512 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12513         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12514         ;;
12515 esac
12516
12517
12518 echo " "
12519 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12520
12521 if $test X"$ivsize" = X8; then
12522         ivdformat="$sPRId64"
12523         uvuformat="$sPRIu64"
12524         uvoformat="$sPRIo64"
12525         uvxformat="$sPRIx64"
12526 else
12527         if $test X"$ivsize" = X"$longsize"; then
12528                 ivdformat='"ld"'
12529                 uvuformat='"lu"'
12530                 uvoformat='"lo"'
12531                 uvxformat='"lx"'
12532         else
12533                 if $test X"$ivsize" = X"$intsize"; then
12534                         ivdformat='"d"'
12535                         uvuformat='"u"'
12536                         uvoformat='"o"'
12537                         uvxformat='"x"'
12538                 else
12539                         : far out
12540                         if $test X"$ivsize" = X"$shortsize"; then
12541                                 ivdformat='"hd"'
12542                                 uvuformat='"hu"'
12543                                 uvoformat='"ho"'
12544                                 uvxformat='"hx"'
12545                         fi
12546                 fi
12547         fi
12548 fi
12549
12550 case "$ivdformat" in
12551 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12552     exit 1
12553     ;;
12554 esac
12555
12556
12557 echo " "
12558 $echo "Checking the format string to be used for gids..." >&4
12559
12560 case "$gidsign" in
12561 -1)     if $test X"$gidsize" = X"$ivsize"; then
12562                 gidformat="$ivdformat"
12563         else
12564                 if $test X"$gidsize" = X"$longsize"; then
12565                         gidformat='"ld"'
12566                 else
12567                         if $test X"$gidsize" = X"$intsize"; then
12568                                 gidformat='"d"'
12569                         else
12570                                 if $test X"$gidsize" = X"$shortsize"; then
12571                                         gidformat='"hd"'
12572                                 fi
12573                         fi
12574                 fi
12575         fi
12576         ;;
12577 *)      if $test X"$gidsize" = X"$uvsize"; then
12578                 gidformat="$uvuformat"
12579         else
12580                 if $test X"$gidsize" = X"$longsize"; then
12581                         gidformat='"lu"'
12582                 else
12583                         if $test X"$gidsize" = X"$intsize"; then
12584                                 gidformat='"u"'
12585                         else
12586                                 if $test X"$gidsize" = X"$shortsize"; then
12587                                         gidformat='"hu"'
12588                                 fi
12589                         fi
12590                 fi
12591         fi
12592         ;;
12593 esac
12594
12595 : see if getgroups exists
12596 set getgroups d_getgrps
12597 eval $inlibc
12598
12599 : see if setgroups exists
12600 set setgroups d_setgrps
12601 eval $inlibc
12602
12603
12604 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12605 echo " "
12606 case "$d_getgrps$d_setgrps" in
12607 *define*)
12608         case "$groupstype" in
12609         '') dflt="$gidtype" ;;
12610         *)  dflt="$groupstype" ;;
12611         esac
12612         $cat <<EOM
12613 What type of pointer is the second argument to getgroups() and setgroups()?
12614 Usually this is the same as group ids, $gidtype, but not always.
12615
12616 EOM
12617         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12618         . ./myread
12619         groupstype="$ans"
12620         ;;
12621 *)  groupstype="$gidtype";;
12622 esac
12623
12624 echo " "
12625 echo "Checking if your $make program sets \$(MAKE)..." >&4
12626 case "$make_set_make" in
12627 '')
12628         $sed 's/^X //' > testmake.mak << 'EOF'
12629 Xall:
12630 X       @echo 'maketemp="$(MAKE)"'
12631 EOF
12632         case "`$make -f testmake.mak 2>/dev/null`" in
12633         *maketemp=*) make_set_make='#' ;;
12634         *)      make_set_make="MAKE=$make" ;;
12635         esac
12636         $rm -f testmake.mak
12637         ;;
12638 esac
12639 case "$make_set_make" in
12640 '#') echo "Yup, it does.";;
12641 *) echo "Nope, it doesn't.";;
12642 esac
12643
12644 : see if this is a sys/mman.h system
12645 set sys/mman.h i_sysmman
12646 eval $inhdr
12647
12648 : see if mmap exists
12649 set mmap d_mmap
12650 eval $inlibc
12651 : see what shmat returns
12652 : default to something harmless
12653 mmaptype='void *'
12654 case "$i_sysmman$d_mmap" in
12655 "$define$define")
12656         $cat >mmap.c <<'END'
12657 #include <sys/mman.h>
12658 void *mmap();
12659 END
12660         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
12661                 mmaptype='void *'
12662         else
12663                 mmaptype='caddr_t'
12664         fi
12665         echo "and it returns ($mmaptype)." >&4
12666         ;;
12667 esac
12668
12669
12670
12671 : see what type is used for mode_t
12672 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12673 set mode_t modetype int stdio.h sys/types.h
12674 eval $typedef_ask
12675
12676 : define a fucntion to check prototypes
12677 $cat > protochk <<EOSH
12678 $startsh
12679 cc="$cc"
12680 optimize="$optimize"
12681 ccflags="$ccflags"
12682 prototype="$prototype"
12683 define="$define"
12684 rm=$rm
12685 EOSH
12686
12687 $cat >> protochk <<'EOSH'
12688
12689 $rm -f try.c
12690 foo="$1"
12691 shift
12692 while test $# -ge 2; do
12693         case "$1" in
12694                 $define) echo "#include <$2>" >> try.c ;;
12695                 literal) echo "$2" >> try.c ;;
12696         esac
12697     shift 2
12698 done
12699 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12700 cat >> try.c <<'EOCP'
12701 #ifdef CAN_PROTOTYPE
12702 #define _(args) args
12703 #else
12704 #define _(args) ()
12705 #endif
12706 EOCP
12707 echo "$foo" >> try.c
12708 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12709 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12710 status=$?
12711 $rm -f try.[co]
12712 exit $status
12713 EOSH
12714 chmod +x protochk
12715 $eunicefix protochk
12716
12717 : see what type is used for size_t
12718 rp="What is the type used for the length parameter for string functions?"
12719 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12720 eval $typedef_ask
12721
12722 : check for type of arguments to gethostbyaddr. 
12723 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12724         case "$d_gethbyaddr" in
12725         $define)
12726                 $cat <<EOM
12727
12728 Checking to see what type of arguments are accepted by gethostbyaddr().
12729 EOM
12730                 hdrs="$define sys/types.h
12731                         $d_socket sys/socket.h 
12732                         $i_niin netinet/in.h 
12733                         $i_netdb netdb.h
12734                         $i_unistd unistd.h"
12735                 : The first arg can 'char *' or 'void *'
12736                 : The second arg is some of integral type
12737                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12738                         for yyy in size_t long int; do
12739                                 case "$netdb_host_type" in
12740                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12741                                         if ./protochk "$try" $hdrs; then
12742                                                 echo "Your system accepts $xxx for the first arg."
12743                                                 echo "...and $yyy for the second arg."
12744                                                 netdb_host_type="$xxx"
12745                                                 netdb_hlen_type="$yyy"
12746                                         fi
12747                                         ;;
12748                                 esac
12749                         done
12750                 done
12751                 : In case none of those worked, prompt the user.
12752                 case "$netdb_host_type" in
12753                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12754                         dflt='char *'
12755                         . ./myread
12756                         netdb_host_type=$ans
12757                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12758                         dflt="$sizetype"
12759                         . ./myread
12760                         netdb_hlen_type=$ans
12761                         ;;
12762                 esac
12763                 ;;
12764         *)      : no gethostbyaddr, so pick harmless defaults
12765                 netdb_host_type='char *'
12766                 netdb_hlen_type="$sizetype"
12767                 ;;
12768         esac
12769         # Remove the "const" if needed. -- but then we'll have a 
12770         # prototype clash!
12771         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12772 fi
12773
12774 : check for type of argument to gethostbyname. 
12775 if test "X$netdb_name_type" = X ; then
12776         case "$d_gethbyname" in
12777         $define)
12778                 $cat <<EOM
12779
12780 Checking to see what type of argument is accepted by gethostbyname().
12781 EOM
12782                 hdrs="$define sys/types.h
12783                         $d_socket sys/socket.h 
12784                         $i_niin netinet/in.h 
12785                         $i_netdb netdb.h
12786                         $i_unistd unistd.h"
12787                 for xxx in "const char *" "char *"; do
12788                         case "$netdb_name_type" in
12789                         '')     try="extern struct hostent *gethostbyname($xxx);"
12790                                 if ./protochk "$try" $hdrs; then
12791                                         echo "Your system accepts $xxx."
12792                                         netdb_name_type="$xxx"
12793                                 fi
12794                                 ;;
12795                         esac
12796                 done
12797                 : In case none of those worked, prompt the user.
12798                 case "$netdb_name_type" in
12799                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12800                         dflt='char *'
12801                         . ./myread
12802                         netdb_name_type=$ans
12803                         ;;
12804                 esac
12805                 ;;
12806         *)      : no gethostbyname, so pick harmless default
12807                 netdb_name_type='char *'
12808                 ;;
12809         esac
12810 fi
12811
12812 : check for type of 1st argument to getnetbyaddr. 
12813 if test "X$netdb_net_type" = X ; then
12814         case "$d_getnbyaddr" in
12815         $define)
12816                 $cat <<EOM
12817
12818 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12819 EOM
12820                 hdrs="$define sys/types.h
12821                         $d_socket sys/socket.h 
12822                         $i_niin netinet/in.h 
12823                         $i_netdb netdb.h
12824                         $i_unistd unistd.h"
12825                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12826                         case "$netdb_net_type" in
12827                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12828                                 if ./protochk "$try" $hdrs; then
12829                                         echo "Your system accepts $xxx."
12830                                         netdb_net_type="$xxx"
12831                                 fi
12832                                 ;;
12833                         esac
12834                 done
12835                 : In case none of those worked, prompt the user.
12836                 case "$netdb_net_type" in
12837                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12838                         dflt='long'
12839                         . ./myread
12840                         netdb_net_type=$ans
12841                         ;;
12842                 esac
12843                 ;;
12844         *)      : no getnetbyaddr, so pick harmless default
12845                 netdb_net_type='long'
12846                 ;;
12847         esac
12848 fi
12849 : locate the preferred pager for this system
12850 case "$pager" in
12851 '')
12852         dflt=''
12853         case "$pg" in
12854         /*) dflt=$pg;;
12855         esac
12856         case "$more" in
12857         /*) dflt=$more;;
12858         esac
12859         case "$less" in
12860         /*) dflt=$less;;
12861         esac
12862         case "$dflt" in
12863         '') dflt=/usr/ucb/more;;
12864         esac
12865         ;;
12866 *) dflt="$pager";;
12867 esac
12868 echo " "
12869 fn=f/
12870 rp='What pager is used on your system?'
12871 . ./getfile
12872 pager="$ans"
12873
12874 : see what type pids are declared as in the kernel
12875 rp="What is the type of process ids on this system?"
12876 set pid_t pidtype int stdio.h sys/types.h
12877 eval $typedef_ask
12878
12879 : Find earliest binary compatible site_perl subdirectory perl can use.
12880 case "$bincompat5005" in
12881 "$define") xs_apiversion='5.005' ;;
12882 *) xs_apiversion=$version ;;   # The current site_perl version.
12883 esac
12884 : Find earliest pure perl site_perl subdirectory perl can use.
12885 : The versioned directories started at 5.005.
12886 pm_apiversion='5.005'
12887
12888 : check for length of pointer
12889 echo " "
12890 case "$ptrsize" in
12891 '')
12892         $echo $n "Checking to see how big your pointers are...$c" >&4
12893         if test "$voidflags" -gt 7; then
12894                 echo '#define VOID_PTR char *' > try.c
12895         else
12896                 echo '#define VOID_PTR void *' > try.c
12897         fi
12898         $cat >>try.c <<'EOCP'
12899 #include <stdio.h>
12900 int main()
12901 {
12902     printf("%d\n", (int)sizeof(VOID_PTR));
12903     exit(0);
12904 }
12905 EOCP
12906         set try
12907         if eval $compile_ok; then
12908                 ptrsize=`./try`
12909                 $echo " $ptrsize bytes." >&4
12910         else
12911                 dflt='4'
12912                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12913                 rp="What is the size of a pointer (in bytes)?"
12914                 . ./myread
12915                 ptrsize="$ans"
12916         fi
12917         ;;
12918 esac
12919 $rm -f try.c try
12920
12921 : see if ar generates random libraries by itself
12922 echo " "
12923 echo "Checking how to generate random libraries on your machine..." >&4
12924 echo 'int bar1() { return bar2(); }' > bar1.c
12925 echo 'int bar2() { return 2; }' > bar2.c
12926 $cat > foo.c <<'EOP'
12927 int main() { printf("%d\n", bar1()); exit(0); }
12928 EOP
12929 $cc $ccflags -c bar1.c >/dev/null 2>&1
12930 $cc $ccflags -c bar2.c >/dev/null 2>&1
12931 $cc $ccflags -c foo.c >/dev/null 2>&1
12932 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12933 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12934         ./foobar >/dev/null 2>&1; then
12935         echo "$ar appears to generate random libraries itself."
12936         orderlib=false
12937         ranlib=":"
12938 elif $ar ts bar$_a >/dev/null 2>&1 &&
12939         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12940         ./foobar >/dev/null 2>&1; then
12941                 echo "a table of contents needs to be added with '$ar ts'."
12942                 orderlib=false
12943                 ranlib="$ar ts"
12944 else
12945         case "$ranlib" in
12946         :) ranlib='';;
12947         '')
12948                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12949                 $test -f $ranlib || ranlib=''
12950                 ;;
12951         esac
12952         if $test -n "$ranlib"; then
12953                 echo "your system has '$ranlib'; we'll use that."
12954                 orderlib=false
12955         else
12956                 echo "your system doesn't seem to support random libraries"
12957                 echo "so we'll use lorder and tsort to order the libraries."
12958                 orderlib=true
12959                 ranlib=":"
12960         fi
12961 fi
12962 $rm -f foo* bar* 
12963
12964 : check for type of arguments to select. 
12965 case "$selecttype" in
12966 '') case "$d_select" in
12967         $define)
12968                 echo " "
12969                 $cat <<EOM
12970 Checking to see what type of arguments are accepted by select().
12971 EOM
12972                 hdrs="$define sys/types.h
12973                         $i_systime sys/time.h 
12974                         $i_sysselct sys/select.h
12975                         $d_socket sys/socket.h"
12976                 : The first arg can be int, unsigned, or size_t
12977                 : The last arg may or may not be 'const'
12978                 val=''
12979                 : void pointer has been seen but using that
12980                 : breaks the selectminbits test
12981                 for xxx in 'fd_set *' 'int *'; do
12982                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12983                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12984                                         case "$val" in
12985                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12986                                                 if ./protochk "$try" $hdrs; then
12987                                                         echo "Your system accepts $xxx."
12988                                                         val="$xxx"
12989                                                 fi
12990                                                 ;;
12991                                         esac
12992                                 done
12993                         done
12994                 done
12995                 case "$val" in
12996                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12997                         case "$d_fd_set" in
12998                                 $define) dflt="fd_set *" ;;
12999                                 *)              dflt="int *" ;;
13000                         esac
13001                         . ./myread
13002                         val=$ans
13003                         ;;
13004                 esac
13005                 selecttype="$val"
13006                 ;;
13007         *)      : no select, so pick a harmless default
13008                 selecttype='int *'
13009                 ;;
13010         esac
13011         ;;
13012 esac
13013
13014 : check for the select 'width'
13015 case "$selectminbits" in
13016 '') case "$d_select" in
13017         $define)
13018                 $cat <<EOM
13019
13020 Checking to see on how many bits at a time your select() operates...
13021 EOM
13022                 $cat >try.c <<EOCP
13023 #include <sys/types.h>
13024 #$i_time I_TIME
13025 #$i_systime I_SYS_TIME
13026 #$i_systimek I_SYS_TIME_KERNEL
13027 #ifdef I_TIME
13028 #   include <time.h>
13029 #endif
13030 #ifdef I_SYS_TIME
13031 #   ifdef I_SYS_TIME_KERNEL
13032 #       define KERNEL
13033 #   endif
13034 #   include <sys/time.h>
13035 #   ifdef I_SYS_TIME_KERNEL
13036 #       undef KERNEL
13037 #   endif
13038 #endif
13039 #$i_sysselct I_SYS_SELECT
13040 #ifdef I_SYS_SELECT
13041 #include <sys/select.h>
13042 #endif
13043 #$d_socket HAS_SOCKET
13044 #ifdef HAS_SOCKET
13045 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13046 #endif
13047 #include <stdio.h>
13048 $selecttype b;
13049 #define S sizeof(*(b))
13050 #define MINBITS 64
13051 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13052 #define NBITS  (NBYTES * 8)
13053 int main() {
13054     char s[NBYTES];
13055     struct timeval t;
13056     int i;
13057     FILE* fp;
13058     int fd;
13059
13060     fclose(stdin);
13061     fp = fopen("try.c", "r");
13062     if (fp == 0)
13063       exit(1);
13064     fd = fileno(fp);
13065     if (fd < 0)
13066       exit(2);
13067     b = ($selecttype)s;
13068     for (i = 0; i < NBITS; i++)
13069         FD_SET(i, b);
13070     t.tv_sec  = 0;
13071     t.tv_usec = 0;
13072     select(fd + 1, b, 0, 0, &t);
13073     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13074     printf("%d\n", i + 1);
13075     return 0;
13076 }
13077 EOCP
13078                 set try
13079                 if eval $compile_ok; then
13080                         selectminbits=`./try`
13081                         case "$selectminbits" in
13082                         '')     cat >&4 <<EOM
13083 Cannot figure out on how many bits at a time your select() operates.
13084 I'll play safe and guess it is 32 bits.
13085 EOM
13086                                 selectminbits=32
13087                                 bits="32 bits"
13088                                 ;;
13089                         1)      bits="1 bit" ;;
13090                         *)      bits="$selectminbits bits" ;;
13091                         esac
13092                         echo "Your select() operates on $bits at a time." >&4
13093                 else
13094                         rp='What is the minimum number of bits your select() operates on?'
13095                         case "$byteorder" in
13096                         1234|12345678)  dflt=32 ;;
13097                         *)              dflt=1  ;;
13098                         esac
13099                         . ./myread
13100                         val=$ans
13101                         selectminbits="$val"
13102                 fi
13103                 $rm -f try.* try
13104                 ;;
13105         *)      : no select, so pick a harmless default
13106                 selectminbits='32'
13107                 ;;
13108         esac
13109         ;;
13110 esac
13111
13112 : Trace out the files included by signal.h, then look for SIGxxx names.
13113 : Remove SIGARRAYSIZE used by HPUX.
13114 : Remove SIGSTKSIZE used by Linux.
13115 : Remove SIGSTKSZ used by Posix.
13116 : Remove SIGTYP void lines used by OS2.
13117 : Some cpps, like os390, dont give the file name anywhere
13118 if [ "X$fieldn" = X ]; then
13119         : Just make some guesses.  We check them later.
13120         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13121 else
13122         xxx=`echo '#include <signal.h>' |
13123         $cppstdin $cppminus $cppflags 2>/dev/null |
13124         $grep '^[       ]*#.*include' | 
13125         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13126 fi
13127 : Check this list of files to be sure we have parsed the cpp output ok.
13128 : This will also avoid potentially non-existent files, such 
13129 : as ../foo/bar.h
13130 xxxfiles=''
13131 for xx in $xxx /dev/null ; do
13132         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13133 done
13134 : If we have found no files, at least try signal.h
13135 case "$xxxfiles" in
13136 '')     xxxfiles=`./findhdr signal.h` ;;
13137 esac
13138 xxx=`awk '
13139 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13140         print substr($2, 4, 20)
13141 }
13142 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13143         print substr($3, 4, 20)
13144 }' $xxxfiles`
13145 : Append some common names just in case the awk scan failed.
13146 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13147 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13148 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13149 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13150 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13151
13152 : generate a few handy files for later
13153 $cat > signal.c <<'EOCP'
13154 #include <sys/types.h>
13155 #include <signal.h>
13156 #include <stdio.h>
13157 int main() {
13158
13159 /* Strange style to avoid deeply-nested #if/#else/#endif */
13160 #ifndef NSIG
13161 #  ifdef _NSIG
13162 #    define NSIG (_NSIG)
13163 #  endif
13164 #endif
13165
13166 #ifndef NSIG
13167 #  ifdef SIGMAX
13168 #    define NSIG (SIGMAX+1)
13169 #  endif
13170 #endif
13171
13172 #ifndef NSIG
13173 #  ifdef SIG_MAX
13174 #    define NSIG (SIG_MAX+1)
13175 #  endif
13176 #endif
13177
13178 #ifndef NSIG
13179 #  ifdef MAXSIG
13180 #    define NSIG (MAXSIG+1)
13181 #  endif
13182 #endif
13183
13184 #ifndef NSIG
13185 #  ifdef MAX_SIG
13186 #    define NSIG (MAX_SIG+1)
13187 #  endif
13188 #endif
13189
13190 #ifndef NSIG
13191 #  ifdef SIGARRAYSIZE
13192 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13193 #  endif
13194 #endif
13195
13196 #ifndef NSIG
13197 #  ifdef _sys_nsig
13198 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13199 #  endif
13200 #endif
13201
13202 /* Default to some arbitrary number that's big enough to get most
13203    of the common signals.
13204 */
13205 #ifndef NSIG
13206 #    define NSIG 50
13207 #endif
13208
13209 printf("NSIG %d\n", NSIG);
13210
13211 #ifndef JUST_NSIG
13212
13213 EOCP
13214
13215 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13216 {
13217         printf "#ifdef SIG"; printf $1; printf "\n"
13218         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13219         printf $1; printf ");\n"
13220         printf "#endif\n"
13221 }
13222 END {
13223         printf "#endif /* JUST_NSIG */\n";
13224         printf "exit(0);\n}\n";
13225 }
13226 ' >>signal.c
13227 $cat >signal.awk <<'EOP'
13228 BEGIN { ndups = 0 }
13229 $1 ~ /^NSIG$/ { nsig = $2 }
13230 ($1 !~ /^NSIG$/) && (NF == 2) {
13231     if ($2 > maxsig) { maxsig = $2 }
13232     if (sig_name[$2]) {
13233         dup_name[ndups] = $1
13234         dup_num[ndups] = $2
13235         ndups++ 
13236     }
13237     else {
13238         sig_name[$2] = $1
13239         sig_num[$2] = $2
13240     }
13241 }
13242 END { 
13243     if (nsig == 0) {
13244         nsig = maxsig + 1
13245     }
13246     printf("NSIG %d\n", nsig);
13247     for (n = 1; n < nsig; n++) {
13248         if (sig_name[n]) {
13249             printf("%s %d\n", sig_name[n], sig_num[n])
13250         }
13251         else {
13252             printf("NUM%d %d\n", n, n) 
13253         }
13254     }
13255     for (n = 0; n < ndups; n++) {
13256         printf("%s %d\n", dup_name[n], dup_num[n])
13257     }
13258 }
13259 EOP
13260 $cat >signal_cmd <<EOS
13261 $startsh
13262 if $test -s signal.lst; then
13263     echo "Using your existing signal.lst file"
13264         exit 0
13265 fi
13266 xxx="$xxx"
13267 EOS
13268 $cat >>signal_cmd <<'EOS'
13269
13270 set signal
13271 if eval $compile_ok; then
13272         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13273 else
13274         echo "(I can't seem be able to compile the whole test program)" >&4
13275         echo "(I'll try it in little pieces.)" >&4
13276         set signal -DJUST_NSIG
13277         if eval $compile_ok; then
13278                 ./signal$_exe > signal.nsg
13279                 $cat signal.nsg
13280         else
13281                 echo "I can't seem to figure out how many signals you have." >&4
13282                 echo "Guessing 50." >&4
13283                 echo 'NSIG 50' > signal.nsg
13284         fi
13285         : Now look at all the signal names, one at a time.
13286         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13287                 $cat > signal.c <<EOCP
13288 #include <sys/types.h>
13289 #include <signal.h>
13290 #include <stdio.h>
13291 int main() {
13292 printf("$xx %d\n", SIG${xx});
13293 return 0;
13294 }
13295 EOCP
13296                 set signal
13297                 if eval $compile; then
13298                         echo "SIG${xx} found."
13299                         ./signal$_exe  >> signal.ls1
13300                 else
13301                         echo "SIG${xx} NOT found."
13302                 fi
13303         done
13304         if $test -s signal.ls1; then
13305                 $cat signal.nsg signal.ls1 |
13306                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13307         fi
13308
13309 fi
13310 if $test -s signal.lst; then
13311         :
13312 else
13313         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13314         echo 'kill -l' >signal
13315         set X `csh -f <signal`
13316         $rm -f signal
13317         shift
13318         case $# in
13319         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13320         esac
13321         echo $@ | $tr ' ' $trnl | \
13322             $awk '{ printf "%s %d\n", $1, ++s; }
13323                   END { printf "NSIG %d\n", ++s }' >signal.lst
13324 fi
13325 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13326 EOS
13327 chmod a+x signal_cmd
13328 $eunicefix signal_cmd
13329
13330 : generate list of signal names
13331 echo " "
13332 case "$sig_name_init" in
13333 '') doinit=yes ;;
13334 *)  case "$sig_num_init" in
13335     ''|*,*) doinit=yes ;;
13336     esac ;;
13337 esac
13338 case "$doinit" in
13339 yes)
13340         echo "Generating a list of signal names and numbers..." >&4
13341         . ./signal_cmd
13342         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13343         sig_name=`$awk 'BEGIN { printf "ZERO " }
13344                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13345         sig_num=`$awk  'BEGIN { printf "0 " }
13346                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13347         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13348                              !/^NSIG/   { printf "\"%s\", ", $1 }
13349                              END        { printf "0\n" }' signal.lst`
13350         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13351                              !/^NSIG/   { printf "%d, ", $2}
13352                              END        { printf "0\n"}' signal.lst`
13353         ;;
13354 esac
13355 echo "The following $sig_count signals are available:"
13356 echo " "
13357 echo $sig_name | $awk \
13358 'BEGIN { linelen = 0 }
13359 {
13360         for (i = 1; i <= NF; i++) {
13361                 name = "SIG" $i " "
13362                 linelen = linelen + length(name)
13363                 if (linelen > 70) {
13364                         printf "\n"
13365                         linelen = length(name)
13366                 }
13367                 printf "%s", name
13368         }
13369         printf "\n"
13370 }'
13371 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13372
13373 : see what type is used for signed size_t
13374 set ssize_t ssizetype int stdio.h sys/types.h
13375 eval $typedef
13376 dflt="$ssizetype"
13377 $cat > ssize.c <<EOM
13378 #include <stdio.h>
13379 #include <sys/types.h>
13380 #define Size_t $sizetype
13381 #define SSize_t $dflt
13382 int main()
13383 {
13384         if (sizeof(Size_t) == sizeof(SSize_t))
13385                 printf("$dflt\n");
13386         else if (sizeof(Size_t) == sizeof(int))
13387                 printf("int\n");
13388         else 
13389                 printf("long\n");
13390         exit(0);
13391 }
13392 EOM
13393 echo " "
13394 set ssize
13395 if eval $compile_ok && ./ssize > /dev/null; then
13396         ssizetype=`./ssize`
13397         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13398 else
13399         $cat >&4 <<EOM
13400 Help! I can't compile and run the ssize_t test program: please enlighten me!
13401 (This is probably a misconfiguration in your system or libraries, and
13402 you really ought to fix it.  Still, I'll try anyway.)
13403
13404 I need a type that is the same size as $sizetype, but is guaranteed to
13405 be signed.  Common values are ssize_t, int and long.
13406
13407 EOM
13408         rp="What signed type is the same size as $sizetype?"
13409         . ./myread
13410         ssizetype="$ans"
13411 fi
13412 $rm -f ssize ssize.*
13413
13414 : see what type of char stdio uses.
13415 echo " "
13416 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13417         echo "Your stdio uses unsigned chars." >&4
13418         stdchar="unsigned char"
13419 else
13420         echo "Your stdio uses signed chars." >&4
13421         stdchar="char"
13422 fi
13423
13424 : see if time exists
13425 echo " "
13426 if test "X$d_time" = X -o X"$timetype" = X; then
13427     if set time val -f d_time; eval $csym; $val; then
13428                 echo 'time() found.' >&4
13429                 val="$define"
13430                 rp="What is the type returned by time() on this system?"
13431                 set time_t timetype long stdio.h sys/types.h
13432                 eval $typedef_ask
13433     else
13434                 echo 'time() not found, hope that will do.' >&4
13435                 val="$undef"
13436                 timetype='int';
13437     fi
13438     set d_time
13439     eval $setvar
13440 fi
13441
13442 : see what type uids are declared as in the kernel
13443 echo " "
13444 echo "Looking for the type for user ids returned by getuid()."
13445 set uid_t uidtype xxx stdio.h sys/types.h
13446 eval $typedef
13447 case "$uidtype" in
13448 xxx)
13449         xxx=`./findhdr sys/user.h`
13450         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13451         case $1 in
13452         unsigned) dflt="$1 $2" ;;
13453         *) dflt="$1" ;;
13454         esac
13455         ;;
13456 *) dflt="$uidtype";;
13457 esac
13458 case "$uidtype" in
13459 uid_t)  echo "uid_t found." ;;
13460 *)      rp="What is the type for user ids returned by getuid()?"
13461         . ./myread
13462         uidtype="$ans"
13463         ;;
13464 esac
13465
13466 echo " "
13467 case "$uidtype" in
13468 *_t) zzz="$uidtype"     ;;
13469 *)   zzz="uid"          ;;
13470 esac
13471 echo "Checking the size of $zzz..." >&4 
13472 cat > try.c <<EOCP
13473 #include <sys/types.h>
13474 #include <stdio.h>
13475 int main() {
13476     printf("%d\n", (int)sizeof($uidtype));
13477     exit(0);
13478 }
13479 EOCP
13480 set try
13481 if eval $compile_ok; then
13482         yyy=`./try`
13483         case "$yyy" in
13484         '')     uidsize=4
13485                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13486                 ;;
13487         *)      uidsize=$yyy
13488                 echo "Your $zzz size is $uidsize bytes."
13489                 ;;
13490         esac
13491 else
13492         uidsize=4
13493         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13494 fi
13495
13496 echo " "
13497 case "$uidtype" in
13498 *_t) zzz="$uidtype"     ;;
13499 *)   zzz="uid"          ;;
13500 esac
13501 echo "Checking the sign of $zzz..." >&4
13502 cat > try.c <<EOCP
13503 #include <sys/types.h>
13504 #include <stdio.h>
13505 int main() {
13506         $uidtype foo = -1;
13507         if (foo < 0)
13508                 printf("-1\n");
13509         else
13510                 printf("1\n");
13511 }
13512 EOCP
13513 set try
13514 if eval $compile; then
13515         yyy=`./try`
13516         case "$yyy" in
13517         '')     uidsign=1
13518                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13519                 ;;
13520         *)      uidsign=$yyy
13521                 case "$uidsign" in
13522                  1) echo "Your $zzz is unsigned." ;;
13523                 -1) echo "Your $zzz is signed."   ;;
13524                 esac
13525                 ;;
13526         esac
13527 else
13528         uidsign=1
13529         echo "(I can't compile the test program--guessing unsigned.)" >&4
13530 fi
13531
13532
13533
13534 echo " "
13535 $echo "Checking the format string to be used for uids..." >&4
13536
13537 case "$uidsign" in
13538 -1)     if $test X"$uidsize" = X"$ivsize"; then
13539                 uidformat="$ivdformat"
13540         else
13541                 if $test X"$uidsize" = X"$longsize"; then
13542                         uidformat='"ld"'
13543                 else
13544                         if $test X"$uidsize" = X"$intsize"; then
13545                                 uidformat='"d"'
13546                         else
13547                                 if $test X"$uidsize" = X"$shortsize"; then
13548                                         uidformat='"hd"'
13549                                 fi
13550                         fi
13551                 fi
13552         fi
13553         ;;
13554 *)      if $test X"$uidsize" = X"$uvsize"; then
13555                 uidformat="$uvuformat"
13556         else
13557                 if $test X"$uidsize" = X"$longsize"; then
13558                         uidformat='"lu"'
13559                 else
13560                         if $test X"$uidsize" = X"$intsize"; then
13561                                 uidformat='"u"'
13562                         else
13563                                 if $test X"$uidsize" = X"$shortsize"; then
13564                                         uidformat='"hu"'
13565                                 fi
13566                         fi
13567                 fi
13568         fi
13569         ;;
13570 esac
13571
13572 : see if dbm.h is available
13573 : see if dbmclose exists
13574 set dbmclose d_dbmclose
13575 eval $inlibc
13576
13577 case "$d_dbmclose" in
13578 $define)
13579         set dbm.h i_dbm
13580         eval $inhdr
13581         case "$i_dbm" in
13582         $define)
13583                 val="$undef"
13584                 set i_rpcsvcdbm
13585                 eval $setvar
13586                 ;;
13587         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13588                 eval $inhdr
13589                 ;;
13590         esac
13591         ;;
13592 *)      echo "We won't be including <dbm.h>"
13593         val="$undef"
13594         set i_dbm
13595         eval $setvar
13596         val="$undef"
13597         set i_rpcsvcdbm
13598         eval $setvar
13599         ;;
13600 esac
13601
13602 : see if this is a sys/file.h system
13603 val=''
13604 set sys/file.h val
13605 eval $inhdr
13606
13607 : do we need to include sys/file.h ?
13608 case "$val" in
13609 "$define")
13610         echo " "
13611         if $h_sysfile; then
13612                 val="$define"
13613                 echo "We'll be including <sys/file.h>." >&4
13614         else
13615                 val="$undef"
13616                 echo "We won't be including <sys/file.h>." >&4
13617         fi
13618         ;;
13619 *)
13620         h_sysfile=false
13621         ;;
13622 esac
13623 set i_sysfile
13624 eval $setvar
13625
13626 : see if fcntl.h is there
13627 val=''
13628 set fcntl.h val
13629 eval $inhdr
13630
13631 : see if we can include fcntl.h
13632 case "$val" in
13633 "$define")
13634         echo " "
13635         if $h_fcntl; then
13636                 val="$define"
13637                 echo "We'll be including <fcntl.h>." >&4
13638         else
13639                 val="$undef"
13640                 if $h_sysfile; then
13641         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13642                 else
13643                         echo "We won't be including <fcntl.h>." >&4
13644                 fi
13645         fi
13646         ;;
13647 *)
13648         h_fcntl=false
13649         val="$undef"
13650         ;;
13651 esac
13652 set i_fcntl
13653 eval $setvar
13654
13655 : see if this is a iconv.h system
13656 set iconv.h i_iconv
13657 eval $inhdr
13658
13659 : see if locale.h is available
13660 set locale.h i_locale
13661 eval $inhdr
13662
13663 : see if mach cthreads are available
13664 if test "X$usethreads" = "X$define"; then
13665         set mach/cthreads.h i_machcthr
13666         eval $inhdr
13667 else
13668         i_machcthr="$undef"
13669 fi
13670
13671
13672
13673 : see if this is a math.h system
13674 set math.h i_math
13675 eval $inhdr
13676
13677 : see if this is a mntent.h system
13678 set mntent.h i_mntent
13679 eval $inhdr
13680
13681 : see if ndbm.h is available
13682 set ndbm.h t_ndbm
13683 eval $inhdr
13684 case "$t_ndbm" in
13685 $define)
13686         : see if dbm_open exists
13687         set dbm_open d_dbm_open
13688         eval $inlibc
13689         case "$d_dbm_open" in
13690         $undef)
13691                 t_ndbm="$undef"
13692                 echo "We won't be including <ndbm.h>"
13693                 ;;
13694         esac
13695         ;;
13696 esac
13697 val="$t_ndbm"
13698 set i_ndbm
13699 eval $setvar
13700
13701 : see if net/errno.h is available
13702 val=''
13703 set net/errno.h val
13704 eval $inhdr
13705
13706 : Unfortunately, it causes problems on some systems.  Arrgh.
13707 case "$val" in
13708 $define)
13709         cat > try.c <<'EOM'
13710 #include <stdio.h>
13711 #include <errno.h>
13712 #include <net/errno.h>
13713 int func()
13714 {
13715         return ENOTSOCK;
13716 }
13717 EOM
13718         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13719                 echo "We'll be including <net/errno.h>." >&4
13720         else
13721                 echo "We won't be including <net/errno.h>." >&4
13722                 val="$undef"
13723         fi
13724         $rm -f try.* try
13725         ;;
13726 esac
13727 set i_neterrno
13728 eval $setvar
13729
13730 : see if netinet/tcp.h is available
13731 set netinet/tcp.h i_netinettcp
13732 eval $inhdr
13733
13734 : see if this is a poll.h system
13735 set poll.h i_poll
13736 eval $inhdr
13737
13738 echo " "
13739 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13740 $cat <<'EOSH' > Cppsym.know
13741 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13742 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13743 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13744 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13745 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13746 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13747 bull c cadmus clipper CMU COFF COMPILER_VERSION
13748 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13749 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13750 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13751 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13752 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13753 H3050R H3050RX hbullx20 hcx host_mips
13754 hp200 hp300 hp700 HP700 hp800 hp9000
13755 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13756 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13757 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13758 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13759 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13760 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13761 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13762 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13763 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13764 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13765 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13766 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13767 MATH_HAS_NO_SIDE_EFFECTS
13768 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13769 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13770 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13771 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13772 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13773 NetBSD news1500 news1700 news1800 news1900 news3700
13774 news700 news800 news900 NeXT NLS ns16000 ns32000
13775 ns32016 ns32332 ns32k nsc32000
13776 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13777 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13778 pc532 pdp11 PGC PIC plexus PORTAR posix
13779 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13780 POSIX_C_SOURCE POSIX_SOURCE POWER
13781 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13782 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13783 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13784 sony sony_news sonyrisc sparc sparclite spectrum
13785 stardent stdc STDC_EXT stratos sun sun3 sun386
13786 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13787 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13788 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13789 sysV68 sysV88 Tek4132 Tek4300 titan
13790 tower tower32 tower32_200 tower32_600 tower32_700
13791 tower32_800 tower32_850 tss
13792 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13793 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13794 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13795 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13796 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13797 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13798 z8000
13799 EOSH
13800 # Maybe put other stuff here too.
13801 cat <<EOSH >>Cppsym.know
13802 $osname
13803 EOSH
13804 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13805 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13806 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13807 $rm -f Cppsym.a Cppsym.b
13808 cat <<EOSH > Cppsym
13809 $startsh
13810 if $test \$# -gt 0; then
13811     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13812     if $test -s Cppsym.got; then
13813         $rm -f Cppsym.got
13814         exit 0
13815     fi
13816     $rm -f Cppsym.got
13817     exit 1
13818 else
13819     $tr " " "$trnl" | ./Cppsym.try
13820     exit 0
13821 fi
13822 EOSH
13823 chmod +x Cppsym
13824 $eunicefix Cppsym
13825 cat <<EOSH > Cppsym.try
13826 $startsh
13827 cat <<'EOCP' > try.c
13828 #include <stdio.h>
13829 int main() {
13830 EOCP
13831 $awk \\
13832 EOSH
13833 cat <<'EOSH' >> Cppsym.try
13834 'length($1) > 0 {
13835     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
13836     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
13837     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
13838     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
13839 }'       >> try.c
13840 echo '}' >> try.c
13841 EOSH
13842 cat <<EOSH >> Cppsym.try
13843 cc="$cc"
13844 optimize="$optimize"
13845 ccflags="$ccflags"
13846 ldflags="$ldflags"
13847 libs="$libs"
13848 exe_ext="$exe_ext"
13849 $cc $optimize $ccflags $ldflags -o try$exe_ext try.c $libs && ./try$exe_ext
13850 EOSH
13851 chmod +x Cppsym.try
13852 $eunicefix Cppsym.try
13853 ./Cppsym < Cppsym.know > Cppsym.true
13854 : now check the C compiler for additional symbols
13855 postprocess_cc_v=''
13856 case "$osname" in
13857 aix) postprocess_cc_v="|$tr , ' '" ;;
13858 esac
13859 $cat >ccsym <<EOS
13860 $startsh
13861 $cat >tmp.c <<EOF
13862 extern int foo;
13863 EOF
13864 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13865 do
13866         case "\$i" in
13867         -D*) echo "\$i" | $sed 's/^-D//';;
13868         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13869         esac
13870 done
13871 $rm -f try.c
13872 EOS
13873 postprocess_cc_v=''
13874 chmod +x ccsym
13875 $eunicefix ccsym
13876 ./ccsym > ccsym1.raw
13877 if $test -s ccsym1.raw; then
13878        $sort ccsym1.raw | $uniq >ccsym.raw
13879 else
13880        mv ccsym1.raw ccsym.raw
13881 fi
13882
13883 $awk '/\=/ { print $0; next }
13884         { print $0"=1" }' ccsym.raw >ccsym.list
13885 $awk '/\=/ { print $0; next }
13886         { print $0"=1" }' Cppsym.true >ccsym.true
13887 $comm -13 ccsym.true ccsym.list >ccsym.own
13888 $comm -12 ccsym.true ccsym.list >ccsym.com
13889 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13890 also=''
13891 if $test -z ccsym.raw; then
13892         echo "Your C compiler doesn't seem to define any symbols!" >&4
13893         echo " "
13894         echo "However, your C preprocessor defines the following symbols:"
13895         $cat Cppsym.true
13896         ccsymbols=''
13897         cppsymbols=`$cat Cppsym.true`
13898         cppsymbols=`echo $cppsymbols`
13899         cppccsymbols="$cppsymbols"
13900 else
13901         if $test -s ccsym.com; then
13902                 echo "Your C compiler and pre-processor define these symbols:"
13903                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13904                 also='also '
13905                 symbols='ones'
13906                 cppccsymbols=`$cat ccsym.com`
13907                 cppccsymbols=`echo $cppccsymbols`
13908                 $test "$silent" || sleep 1
13909         fi
13910         if $test -s ccsym.cpp; then
13911                 $test "$also" && echo " "
13912                 echo "Your C pre-processor ${also}defines the following symbols:"
13913                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13914                 also='further '
13915                 cppsymbols=`$cat ccsym.cpp`
13916                 cppsymbols=`echo $cppsymbols`
13917                 $test "$silent" || sleep 1
13918         fi
13919         if $test -s ccsym.own; then
13920                 $test "$also" && echo " "
13921                 echo "Your C compiler ${also}defines the following cpp symbols:"
13922                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13923                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13924                 ccsymbols=`$cat ccsym.own`
13925                 ccsymbols=`echo $ccsymbols`
13926                 $test "$silent" || sleep 1
13927         fi
13928 fi
13929 $rm -f ccsym*
13930
13931 : see if this is a termio system
13932 val="$undef"
13933 val2="$undef"
13934 val3="$undef"
13935 if $test `./findhdr termios.h`; then
13936         set tcsetattr i_termios
13937         eval $inlibc
13938         val3="$i_termios"
13939 fi
13940 echo " "
13941 case "$val3" in
13942 "$define") echo "You have POSIX termios.h... good!" >&4;;
13943 *) if ./Cppsym pyr; then
13944                 case "`/bin/universe`" in
13945                 ucb) if $test `./findhdr sgtty.h`; then
13946                                 val2="$define"
13947                                 echo "<sgtty.h> found." >&4
13948                         else
13949                                 echo "System is pyramid with BSD universe."
13950                                 echo "<sgtty.h> not found--you could have problems." >&4
13951                         fi;;
13952                 *) if $test `./findhdr termio.h`; then
13953                                 val="$define"
13954                                 echo "<termio.h> found." >&4
13955                         else
13956                                 echo "System is pyramid with USG universe."
13957                                 echo "<termio.h> not found--you could have problems." >&4
13958                         fi;;
13959                 esac
13960         elif ./usg; then
13961                 if $test `./findhdr termio.h`; then
13962                         echo "<termio.h> found." >&4
13963                         val="$define"
13964                 elif $test `./findhdr sgtty.h`; then
13965                         echo "<sgtty.h> found." >&4
13966                         val2="$define"
13967                 else
13968 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13969                 fi
13970         else
13971                 if $test `./findhdr sgtty.h`; then
13972                         echo "<sgtty.h> found." >&4
13973                         val2="$define"
13974                 elif $test `./findhdr termio.h`; then
13975                         echo "<termio.h> found." >&4
13976                         val="$define"
13977                 else
13978 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13979                 fi
13980         fi;;
13981 esac
13982 set i_termio; eval $setvar
13983 val=$val2; set i_sgtty; eval $setvar
13984 val=$val3; set i_termios; eval $setvar
13985
13986 : see if this is a shadow.h system
13987 set shadow.h i_shadow
13988 eval $inhdr
13989
13990 : see if this is a socks.h system
13991 set socks.h i_socks
13992 eval $inhdr
13993
13994 : see if stdarg is available
13995 echo " "
13996 if $test `./findhdr stdarg.h`; then
13997         echo "<stdarg.h> found." >&4
13998         valstd="$define"
13999 else
14000         echo "<stdarg.h> NOT found." >&4
14001         valstd="$undef"
14002 fi
14003
14004 : see if varags is available
14005 echo " "
14006 if $test `./findhdr varargs.h`; then
14007         echo "<varargs.h> found." >&4
14008 else
14009         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14010 fi
14011
14012 : set up the varargs testing programs
14013 $cat > varargs.c <<EOP
14014 #ifdef I_STDARG
14015 #include <stdarg.h>
14016 #endif
14017 #ifdef I_VARARGS
14018 #include <varargs.h>
14019 #endif
14020
14021 #ifdef I_STDARG
14022 int f(char *p, ...)
14023 #else
14024 int f(va_alist)
14025 va_dcl
14026 #endif
14027 {
14028         va_list ap;
14029 #ifndef I_STDARG
14030         char *p;
14031 #endif
14032 #ifdef I_STDARG
14033         va_start(ap,p);
14034 #else
14035         va_start(ap);
14036         p = va_arg(ap, char *);
14037 #endif
14038         va_end(ap);
14039 }
14040 EOP
14041 $cat > varargs <<EOP
14042 $startsh
14043 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14044         echo "true"
14045 else
14046         echo "false"
14047 fi
14048 $rm -f varargs$_o
14049 EOP
14050 chmod +x varargs
14051
14052 : now check which varargs header should be included
14053 echo " "
14054 i_varhdr=''
14055 case "$valstd" in
14056 "$define")
14057         if `./varargs I_STDARG`; then
14058                 val='stdarg.h'
14059         elif `./varargs I_VARARGS`; then
14060                 val='varargs.h'
14061         fi
14062         ;;
14063 *)
14064         if `./varargs I_VARARGS`; then
14065                 val='varargs.h'
14066         fi
14067         ;;
14068 esac
14069 case "$val" in
14070 '')
14071 echo "I could not find the definition for va_dcl... You have problems..." >&4
14072         val="$undef"; set i_stdarg; eval $setvar
14073         val="$undef"; set i_varargs; eval $setvar
14074         ;;
14075 *) 
14076         set i_varhdr
14077         eval $setvar
14078         case "$i_varhdr" in
14079         stdarg.h)
14080                 val="$define"; set i_stdarg; eval $setvar
14081                 val="$undef"; set i_varargs; eval $setvar
14082                 ;;
14083         varargs.h)
14084                 val="$undef"; set i_stdarg; eval $setvar
14085                 val="$define"; set i_varargs; eval $setvar
14086                 ;;
14087         esac
14088         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14089 esac
14090 $rm -f varargs*
14091
14092 : see if stddef is available
14093 set stddef.h i_stddef
14094 eval $inhdr
14095
14096 : see if sys/access.h is available
14097 set sys/access.h i_sysaccess
14098 eval $inhdr
14099
14100 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14101 set sys/filio.h i_sysfilio
14102 eval $inhdr
14103 echo " "
14104 if $test `./findhdr sys/ioctl.h`; then
14105         val="$define"
14106         echo '<sys/ioctl.h> found.' >&4
14107 else
14108         val="$undef"
14109         if $test $i_sysfilio = "$define"; then
14110             echo '<sys/ioctl.h> NOT found.' >&4
14111         else
14112                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14113                 $test $i_termio = "$define" && xxx="termio.h"
14114                 $test $i_termios = "$define" && xxx="termios.h"
14115 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14116         fi
14117 fi
14118 set i_sysioctl
14119 eval $setvar
14120
14121 : see if sys/resource.h has to be included
14122 set sys/resource.h i_sysresrc
14123 eval $inhdr
14124
14125 : see if sys/security.h is available
14126 set sys/security.h i_syssecrt
14127 eval $inhdr
14128
14129 : see if this is a sys/statvfs.h system
14130 set sys/statvfs.h i_sysstatvfs
14131 eval $inhdr
14132
14133 : see if this is a sys/uio.h system
14134 set sys/uio.h i_sysuio
14135 eval $inhdr
14136
14137 : see if this is a sys/un.h system
14138 set sys/un.h i_sysun
14139 eval $inhdr
14140
14141 : see if this is a syswait system
14142 set sys/wait.h i_syswait
14143 eval $inhdr
14144
14145 : see if this is a ustat.h system
14146 set ustat.h i_ustat
14147 eval $inhdr
14148
14149 : see if this is an utime system
14150 set utime.h i_utime
14151 eval $inhdr
14152
14153 : see if this is a values.h system
14154 set values.h i_values
14155 eval $inhdr
14156
14157 : see if this is a vfork system
14158 case "$d_vfork" in
14159 "$define")
14160         set vfork.h i_vfork
14161         eval $inhdr
14162         ;;
14163 *)
14164         i_vfork="$undef"
14165         ;;
14166 esac
14167
14168 : see if gdbm.h is available
14169 set gdbm.h t_gdbm
14170 eval $inhdr
14171 case "$t_gdbm" in
14172 $define)
14173         : see if gdbm_open exists
14174         set gdbm_open d_gdbm_open
14175         eval $inlibc
14176         case "$d_gdbm_open" in
14177         $undef)
14178                 t_gdbm="$undef"
14179                 echo "We won't be including <gdbm.h>"
14180                 ;;
14181         esac
14182         ;;
14183 esac
14184 val="$t_gdbm"
14185 set i_gdbm
14186 eval $setvar
14187
14188 echo " "
14189 echo "Looking for extensions..." >&4
14190 : If we are using the old config.sh, known_extensions may contain
14191 : old or inaccurate or duplicate values.
14192 known_extensions=''
14193 nonxs_extensions=''
14194 : We do not use find because it might not be available.
14195 : We do not just use MANIFEST because the user may have dropped
14196 : some additional extensions into the source tree and expect them
14197 : to be built.
14198
14199 : Function to recursively find available extensions, ignoring DynaLoader
14200 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14201 find_extensions='
14202     for xxx in *; do
14203        case "$xxx" in
14204            DynaLoader|dynaload) ;;
14205            *)
14206            if $test -f $xxx/$xxx.xs; then
14207                known_extensions="$known_extensions $1$xxx";
14208            elif $test -f $xxx/Makefile.PL; then
14209                nonxs_extensions="$nonxs_extensions $1$xxx";
14210            else
14211                if $test -d $xxx -a $# -lt 10; then
14212                    set $1$xxx/ $*;
14213                    cd $xxx;
14214                    eval $find_extensions;
14215                    cd ..;
14216                    shift;
14217                fi;
14218            fi
14219            ;;
14220        esac;
14221     done'
14222 tdir=`pwd`
14223 cd $rsrc/ext
14224 set X
14225 shift
14226 eval $find_extensions
14227 set X $nonxs_extensions
14228 shift
14229 nonxs_extensions="$*"
14230 set X $known_extensions
14231 shift
14232 known_extensions="$*"
14233 cd $tdir
14234
14235 : Now see which are supported on this system.
14236 avail_ext=''
14237 for xxx in $known_extensions ; do
14238         case "$xxx" in
14239         DB_File|db_file)
14240                 case "$i_db" in
14241                 $define) avail_ext="$avail_ext $xxx" ;;
14242                 esac
14243                 ;;
14244         GDBM_File|gdbm_fil)
14245                 case "$i_gdbm" in 
14246                 $define) avail_ext="$avail_ext $xxx" ;;
14247                 esac
14248                 ;;
14249         NDBM_File|ndbm_fil)
14250                 case "$i_ndbm" in
14251                 $define) avail_ext="$avail_ext $xxx" ;;
14252                 esac
14253                 ;;
14254         ODBM_File|odbm_fil) 
14255                 case "${i_dbm}${i_rpcsvcdbm}" in
14256                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14257                 esac
14258                 ;;
14259         POSIX|posix)
14260                 case "$useposix" in
14261                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14262                 esac
14263                 ;;
14264         Opcode|opcode)
14265                 case "$useopcode" in
14266                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14267                 esac
14268                 ;;
14269         Socket|socket)
14270                 case "$d_socket" in 
14271                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14272                 esac
14273                 ;;
14274         Thread|thread)
14275                 case "$usethreads" in 
14276                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14277                 esac
14278                 ;;
14279         IPC/SysV|ipc/sysv)
14280                 : XXX Do we need a useipcsysv variable here
14281                 case "${d_msg}${d_sem}${d_shm}" in 
14282                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14283                 esac
14284                 ;;
14285         *)      avail_ext="$avail_ext $xxx"
14286                 ;;
14287         esac
14288 done
14289
14290 set X $avail_ext
14291 shift
14292 avail_ext="$*"
14293
14294 : Now see which nonxs extensions are supported on this system.
14295 : For now assume all are.
14296 nonxs_ext=''
14297 for xxx in $nonxs_extensions ; do
14298         case "$xxx" in
14299         *)      nonxs_ext="$nonxs_ext $xxx"
14300                 ;;
14301         esac
14302 done
14303
14304 set X $nonxs_ext
14305 shift
14306 nonxs_ext="$*"
14307
14308 case $usedl in
14309 $define)
14310         $cat <<EOM
14311 A number of extensions are supplied with $package.  You may choose to
14312 compile these extensions for dynamic loading (the default), compile
14313 them into the $package executable (static loading), or not include
14314 them at all.  Answer "none" to include no extensions.
14315 Note that DynaLoader is always built and need not be mentioned here.
14316
14317 EOM
14318         case "$dynamic_ext" in
14319         '') dflt="$avail_ext" ;;
14320         *)      dflt="$dynamic_ext"
14321                 # Perhaps we are reusing an old out-of-date config.sh.
14322                 case "$hint" in
14323                 previous)
14324                         if test X"$dynamic_ext" != X"$avail_ext"; then
14325                                 $cat <<EOM
14326 NOTICE:  Your previous config.sh list may be incorrect. 
14327 The extensions now available to you are 
14328         ${avail_ext}
14329 but the default list from your previous config.sh is
14330         ${dynamic_ext} 
14331
14332 EOM
14333                         fi
14334                         ;;
14335                 esac
14336                 ;;
14337         esac
14338         case "$dflt" in
14339         '')     dflt=none;;
14340         esac
14341         rp="What extensions do you wish to load dynamically?"
14342         . ./myread
14343         case "$ans" in
14344         none) dynamic_ext=' ' ;;
14345         *) dynamic_ext="$ans" ;;
14346         esac
14347
14348         case "$static_ext" in
14349         '')
14350                 : Exclude those already listed in dynamic linking
14351                 dflt=''
14352                 for xxx in $avail_ext; do
14353                         case " $dynamic_ext " in
14354                         *" $xxx "*) ;;
14355                         *) dflt="$dflt $xxx" ;;
14356                         esac
14357                 done
14358                 set X $dflt
14359                 shift
14360                 dflt="$*"
14361                 ;;
14362         *)  dflt="$static_ext" 
14363                 ;;
14364         esac
14365
14366         case "$dflt" in
14367         '')     dflt=none;;
14368         esac
14369         rp="What extensions do you wish to load statically?"
14370         . ./myread
14371         case "$ans" in
14372         none) static_ext=' ' ;;
14373         *) static_ext="$ans" ;;
14374         esac
14375         ;;
14376 *)
14377         $cat <<EOM
14378 A number of extensions are supplied with $package.  Answer "none" 
14379 to include no extensions. 
14380 Note that DynaLoader is always built and need not be mentioned here.
14381
14382 EOM
14383         case "$static_ext" in
14384         '') dflt="$avail_ext" ;;
14385         *)      dflt="$static_ext"
14386                 # Perhaps we are reusing an old out-of-date config.sh.
14387                 case "$hint" in
14388                 previous)
14389                         if test X"$static_ext" != X"$avail_ext"; then
14390                                 $cat <<EOM
14391 NOTICE:  Your previous config.sh list may be incorrect. 
14392 The extensions now available to you are 
14393         ${avail_ext}
14394 but the default list from your previous config.sh is
14395         ${static_ext} 
14396
14397 EOM
14398                         fi
14399                         ;;
14400                 esac
14401                 ;;
14402         esac
14403         : Exclude those that are not xs extensions
14404         case "$dflt" in
14405         '')     dflt=none;;
14406         esac
14407         rp="What extensions do you wish to include?"
14408         . ./myread
14409         case "$ans" in
14410         none) static_ext=' ' ;;
14411         *) static_ext="$ans" ;;
14412         esac
14413         ;;
14414 esac
14415
14416 set X $dynamic_ext $static_ext $nonxs_ext
14417 shift
14418 extensions="$*"
14419
14420 : Remove build directory name from cppstdin so it can be used from
14421 : either the present location or the final installed location.
14422 echo " "
14423 : Get out of the UU directory to get correct path name.
14424 cd ..
14425 case "$cppstdin" in
14426 `pwd`/cppstdin)
14427         echo "Stripping down cppstdin path name"
14428         cppstdin=cppstdin
14429         ;;
14430 esac
14431 cd UU
14432
14433 : end of configuration questions
14434 echo " "
14435 echo "End of configuration questions."
14436 echo " "
14437
14438 : back to where it started
14439 if test -d ../UU; then
14440         cd ..
14441 fi
14442
14443 : configuration may be patched via a 'config.over' file
14444 if $test -f config.over; then
14445         echo " "
14446         dflt=y
14447         rp='I see a config.over file.  Do you wish to load it?'
14448         . UU/myread
14449         case "$ans" in
14450         n*) echo "OK, I'll ignore it.";;
14451         *)      . ./config.over
14452                 echo "Configuration override changes have been loaded."
14453                 ;;
14454         esac
14455 fi
14456
14457 : in case they want portability, strip down executable paths
14458 case "$d_portable" in
14459 "$define")
14460         echo " "
14461         echo "Stripping down executable paths..." >&4
14462         for file in $loclist $trylist; do
14463                 eval temp=\$$file
14464                 eval $file=`basename $temp`
14465         done
14466         ;;
14467 esac
14468
14469 : create config.sh file
14470 echo " "
14471 echo "Creating config.sh..." >&4
14472 $spitshell <<EOT >config.sh
14473 $startsh
14474 #
14475 # This file was produced by running the Configure script. It holds all the
14476 # definitions figured out by Configure. Should you modify one of these values,
14477 # do not forget to propagate your changes by running "Configure -der". You may
14478 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14479 #
14480
14481 # Package name      : $package
14482 # Source directory  : $src
14483 # Configuration time: $cf_time
14484 # Configured by     : $cf_by
14485 # Target system     : $myuname
14486
14487 Author='$Author'
14488 Date='$Date'
14489 Header='$Header'
14490 Id='$Id'
14491 Locker='$Locker'
14492 Log='$Log'
14493 Mcc='$Mcc'
14494 RCSfile='$RCSfile'
14495 Revision='$Revision'
14496 Source='$Source'
14497 State='$State'
14498 _a='$_a'
14499 _exe='$_exe'
14500 _o='$_o'
14501 afs='$afs'
14502 alignbytes='$alignbytes'
14503 ansi2knr='$ansi2knr'
14504 aphostname='$aphostname'
14505 api_revision='$api_revision'
14506 api_subversion='$api_subversion'
14507 api_version='$api_version'
14508 api_versionstring='$api_versionstring'
14509 ar='$ar'
14510 archlib='$archlib'
14511 archlibexp='$archlibexp'
14512 archname64='$archname64'
14513 archname='$archname'
14514 archobjs='$archobjs'
14515 awk='$awk'
14516 baserev='$baserev'
14517 bash='$bash'
14518 bin='$bin'
14519 bincompat5005='$bincompat5005'
14520 binexp='$binexp'
14521 bison='$bison'
14522 byacc='$byacc'
14523 byteorder='$byteorder'
14524 c='$c'
14525 castflags='$castflags'
14526 cat='$cat'
14527 cc='$cc'
14528 cccdlflags='$cccdlflags'
14529 ccdlflags='$ccdlflags'
14530 ccflags='$ccflags'
14531 ccsymbols='$ccsymbols'
14532 cf_by='$cf_by'
14533 cf_email='$cf_email'
14534 cf_time='$cf_time'
14535 charsize='$charsize'
14536 chgrp='$chgrp'
14537 chmod='$chmod'
14538 chown='$chown'
14539 clocktype='$clocktype'
14540 comm='$comm'
14541 compress='$compress'
14542 contains='$contains'
14543 cp='$cp'
14544 cpio='$cpio'
14545 cpp='$cpp'
14546 cpp_stuff='$cpp_stuff'
14547 cppccsymbols='$cppccsymbols'
14548 cppflags='$cppflags'
14549 cpplast='$cpplast'
14550 cppminus='$cppminus'
14551 cpprun='$cpprun'
14552 cppstdin='$cppstdin'
14553 cppsymbols='$cppsymbols'
14554 crosscompile='$crosscompile'
14555 cryptlib='$cryptlib'
14556 csh='$csh'
14557 d_Gconvert='$d_Gconvert'
14558 d_PRIEldbl='$d_PRIEldbl'
14559 d_PRIFldbl='$d_PRIFldbl'
14560 d_PRIGldbl='$d_PRIGldbl'
14561 d_PRIX64='$d_PRIX64'
14562 d_PRId64='$d_PRId64'
14563 d_PRIeldbl='$d_PRIeldbl'
14564 d_PRIfldbl='$d_PRIfldbl'
14565 d_PRIgldbl='$d_PRIgldbl'
14566 d_PRIi64='$d_PRIi64'
14567 d_PRIo64='$d_PRIo64'
14568 d_PRIu64='$d_PRIu64'
14569 d_PRIx64='$d_PRIx64'
14570 d_access='$d_access'
14571 d_accessx='$d_accessx'
14572 d_alarm='$d_alarm'
14573 d_archlib='$d_archlib'
14574 d_atolf='$d_atolf'
14575 d_atoll='$d_atoll'
14576 d_attribut='$d_attribut'
14577 d_bcmp='$d_bcmp'
14578 d_bcopy='$d_bcopy'
14579 d_bincompat5005='$d_bincompat5005'
14580 d_bsd='$d_bsd'
14581 d_bsdgetpgrp='$d_bsdgetpgrp'
14582 d_bsdsetpgrp='$d_bsdsetpgrp'
14583 d_bzero='$d_bzero'
14584 d_casti32='$d_casti32'
14585 d_castneg='$d_castneg'
14586 d_charvspr='$d_charvspr'
14587 d_chown='$d_chown'
14588 d_chroot='$d_chroot'
14589 d_chsize='$d_chsize'
14590 d_closedir='$d_closedir'
14591 d_const='$d_const'
14592 d_crypt='$d_crypt'
14593 d_csh='$d_csh'
14594 d_cuserid='$d_cuserid'
14595 d_dbl_dig='$d_dbl_dig'
14596 d_difftime='$d_difftime'
14597 d_dirnamlen='$d_dirnamlen'
14598 d_dlerror='$d_dlerror'
14599 d_dlopen='$d_dlopen'
14600 d_dlsymun='$d_dlsymun'
14601 d_dosuid='$d_dosuid'
14602 d_drand48proto='$d_drand48proto'
14603 d_dup2='$d_dup2'
14604 d_eaccess='$d_eaccess'
14605 d_endgrent='$d_endgrent'
14606 d_endhent='$d_endhent'
14607 d_endnent='$d_endnent'
14608 d_endpent='$d_endpent'
14609 d_endpwent='$d_endpwent'
14610 d_endsent='$d_endsent'
14611 d_endspent='$d_endspent'
14612 d_eofnblk='$d_eofnblk'
14613 d_eunice='$d_eunice'
14614 d_fchmod='$d_fchmod'
14615 d_fchown='$d_fchown'
14616 d_fcntl='$d_fcntl'
14617 d_fd_macros='$d_fd_macros'
14618 d_fd_set='$d_fd_set'
14619 d_fds_bits='$d_fds_bits'
14620 d_fgetpos='$d_fgetpos'
14621 d_flexfnam='$d_flexfnam'
14622 d_flock='$d_flock'
14623 d_fork='$d_fork'
14624 d_fpathconf='$d_fpathconf'
14625 d_fpos64_t='$d_fpos64_t'
14626 d_fs_data_s='$d_fs_data_s'
14627 d_fseeko='$d_fseeko'
14628 d_fsetpos='$d_fsetpos'
14629 d_fstatfs='$d_fstatfs'
14630 d_fstatvfs='$d_fstatvfs'
14631 d_ftello='$d_ftello'
14632 d_ftime='$d_ftime'
14633 d_getgrent='$d_getgrent'
14634 d_getgrps='$d_getgrps'
14635 d_gethbyaddr='$d_gethbyaddr'
14636 d_gethbyname='$d_gethbyname'
14637 d_gethent='$d_gethent'
14638 d_gethname='$d_gethname'
14639 d_gethostprotos='$d_gethostprotos'
14640 d_getlogin='$d_getlogin'
14641 d_getmnt='$d_getmnt'
14642 d_getmntent='$d_getmntent'
14643 d_getnbyaddr='$d_getnbyaddr'
14644 d_getnbyname='$d_getnbyname'
14645 d_getnent='$d_getnent'
14646 d_getnetprotos='$d_getnetprotos'
14647 d_getpbyname='$d_getpbyname'
14648 d_getpbynumber='$d_getpbynumber'
14649 d_getpent='$d_getpent'
14650 d_getpgid='$d_getpgid'
14651 d_getpgrp2='$d_getpgrp2'
14652 d_getpgrp='$d_getpgrp'
14653 d_getppid='$d_getppid'
14654 d_getprior='$d_getprior'
14655 d_getprotoprotos='$d_getprotoprotos'
14656 d_getpwent='$d_getpwent'
14657 d_getsbyname='$d_getsbyname'
14658 d_getsbyport='$d_getsbyport'
14659 d_getsent='$d_getsent'
14660 d_getservprotos='$d_getservprotos'
14661 d_getspent='$d_getspent'
14662 d_getspnam='$d_getspnam'
14663 d_gettimeod='$d_gettimeod'
14664 d_gnulibc='$d_gnulibc'
14665 d_grpasswd='$d_grpasswd'
14666 d_hasmntopt='$d_hasmntopt'
14667 d_htonl='$d_htonl'
14668 d_iconv='$d_iconv'
14669 d_index='$d_index'
14670 d_inetaton='$d_inetaton'
14671 d_int64t='$d_int64t'
14672 d_isascii='$d_isascii'
14673 d_killpg='$d_killpg'
14674 d_lchown='$d_lchown'
14675 d_ldbl_dig='$d_ldbl_dig'
14676 d_link='$d_link'
14677 d_locconv='$d_locconv'
14678 d_lockf='$d_lockf'
14679 d_longdbl='$d_longdbl'
14680 d_longlong='$d_longlong'
14681 d_lstat='$d_lstat'
14682 d_mblen='$d_mblen'
14683 d_mbstowcs='$d_mbstowcs'
14684 d_mbtowc='$d_mbtowc'
14685 d_memchr='$d_memchr'
14686 d_memcmp='$d_memcmp'
14687 d_memcpy='$d_memcpy'
14688 d_memmove='$d_memmove'
14689 d_memset='$d_memset'
14690 d_mkdir='$d_mkdir'
14691 d_mkdtemp='$d_mkdtemp'
14692 d_mkfifo='$d_mkfifo'
14693 d_mkstemp='$d_mkstemp'
14694 d_mkstemps='$d_mkstemps'
14695 d_mktime='$d_mktime'
14696 d_mmap='$d_mmap'
14697 d_mprotect='$d_mprotect'
14698 d_msg='$d_msg'
14699 d_msg_ctrunc='$d_msg_ctrunc'
14700 d_msg_dontroute='$d_msg_dontroute'
14701 d_msg_oob='$d_msg_oob'
14702 d_msg_peek='$d_msg_peek'
14703 d_msg_proxy='$d_msg_proxy'
14704 d_msgctl='$d_msgctl'
14705 d_msgget='$d_msgget'
14706 d_msgrcv='$d_msgrcv'
14707 d_msgsnd='$d_msgsnd'
14708 d_msync='$d_msync'
14709 d_munmap='$d_munmap'
14710 d_mymalloc='$d_mymalloc'
14711 d_nice='$d_nice'
14712 d_nv_preserves_uv='$d_nv_preserves_uv'
14713 d_off64_t='$d_off64_t'
14714 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14715 d_oldpthreads='$d_oldpthreads'
14716 d_oldsock='$d_oldsock'
14717 d_open3='$d_open3'
14718 d_pathconf='$d_pathconf'
14719 d_pause='$d_pause'
14720 d_phostname='$d_phostname'
14721 d_pipe='$d_pipe'
14722 d_poll='$d_poll'
14723 d_portable='$d_portable'
14724 d_pthread_yield='$d_pthread_yield'
14725 d_pwage='$d_pwage'
14726 d_pwchange='$d_pwchange'
14727 d_pwclass='$d_pwclass'
14728 d_pwcomment='$d_pwcomment'
14729 d_pwexpire='$d_pwexpire'
14730 d_pwgecos='$d_pwgecos'
14731 d_pwpasswd='$d_pwpasswd'
14732 d_pwquota='$d_pwquota'
14733 d_quad='$d_quad'
14734 d_readdir='$d_readdir'
14735 d_readlink='$d_readlink'
14736 d_rename='$d_rename'
14737 d_rewinddir='$d_rewinddir'
14738 d_rmdir='$d_rmdir'
14739 d_safebcpy='$d_safebcpy'
14740 d_safemcpy='$d_safemcpy'
14741 d_sanemcmp='$d_sanemcmp'
14742 d_sched_yield='$d_sched_yield'
14743 d_scm_rights='$d_scm_rights'
14744 d_seekdir='$d_seekdir'
14745 d_select='$d_select'
14746 d_sem='$d_sem'
14747 d_semctl='$d_semctl'
14748 d_semctl_semid_ds='$d_semctl_semid_ds'
14749 d_semctl_semun='$d_semctl_semun'
14750 d_semget='$d_semget'
14751 d_semop='$d_semop'
14752 d_setegid='$d_setegid'
14753 d_seteuid='$d_seteuid'
14754 d_setgrent='$d_setgrent'
14755 d_setgrps='$d_setgrps'
14756 d_sethent='$d_sethent'
14757 d_setlinebuf='$d_setlinebuf'
14758 d_setlocale='$d_setlocale'
14759 d_setnent='$d_setnent'
14760 d_setpent='$d_setpent'
14761 d_setpgid='$d_setpgid'
14762 d_setpgrp2='$d_setpgrp2'
14763 d_setpgrp='$d_setpgrp'
14764 d_setprior='$d_setprior'
14765 d_setpwent='$d_setpwent'
14766 d_setregid='$d_setregid'
14767 d_setresgid='$d_setresgid'
14768 d_setresuid='$d_setresuid'
14769 d_setreuid='$d_setreuid'
14770 d_setrgid='$d_setrgid'
14771 d_setruid='$d_setruid'
14772 d_setsent='$d_setsent'
14773 d_setsid='$d_setsid'
14774 d_setspent='$d_setspent'
14775 d_setvbuf='$d_setvbuf'
14776 d_sfio='$d_sfio'
14777 d_shm='$d_shm'
14778 d_shmat='$d_shmat'
14779 d_shmatprototype='$d_shmatprototype'
14780 d_shmctl='$d_shmctl'
14781 d_shmdt='$d_shmdt'
14782 d_shmget='$d_shmget'
14783 d_sigaction='$d_sigaction'
14784 d_sigsetjmp='$d_sigsetjmp'
14785 d_socket='$d_socket'
14786 d_sockpair='$d_sockpair'
14787 d_sqrtl='$d_sqrtl'
14788 d_statblks='$d_statblks'
14789 d_statfs_f_flags='$d_statfs_f_flags'
14790 d_statfs_s='$d_statfs_s'
14791 d_statvfs='$d_statvfs'
14792 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14793 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14794 d_stdio_stream_array='$d_stdio_stream_array'
14795 d_stdiobase='$d_stdiobase'
14796 d_stdstdio='$d_stdstdio'
14797 d_strchr='$d_strchr'
14798 d_strcoll='$d_strcoll'
14799 d_strctcpy='$d_strctcpy'
14800 d_strerrm='$d_strerrm'
14801 d_strerror='$d_strerror'
14802 d_strtod='$d_strtod'
14803 d_strtol='$d_strtol'
14804 d_strtold='$d_strtold'
14805 d_strtoll='$d_strtoll'
14806 d_strtoul='$d_strtoul'
14807 d_strtoull='$d_strtoull'
14808 d_strtouq='$d_strtouq'
14809 d_strxfrm='$d_strxfrm'
14810 d_suidsafe='$d_suidsafe'
14811 d_symlink='$d_symlink'
14812 d_syscall='$d_syscall'
14813 d_sysconf='$d_sysconf'
14814 d_sysernlst='$d_sysernlst'
14815 d_syserrlst='$d_syserrlst'
14816 d_system='$d_system'
14817 d_tcgetpgrp='$d_tcgetpgrp'
14818 d_tcsetpgrp='$d_tcsetpgrp'
14819 d_telldir='$d_telldir'
14820 d_telldirproto='$d_telldirproto'
14821 d_time='$d_time'
14822 d_times='$d_times'
14823 d_truncate='$d_truncate'
14824 d_tzname='$d_tzname'
14825 d_umask='$d_umask'
14826 d_uname='$d_uname'
14827 d_union_semun='$d_union_semun'
14828 d_ustat='$d_ustat'
14829 d_vendorbin='$d_vendorbin'
14830 d_vendorlib='$d_vendorlib'
14831 d_vfork='$d_vfork'
14832 d_void_closedir='$d_void_closedir'
14833 d_voidsig='$d_voidsig'
14834 d_voidtty='$d_voidtty'
14835 d_volatile='$d_volatile'
14836 d_vprintf='$d_vprintf'
14837 d_wait4='$d_wait4'
14838 d_waitpid='$d_waitpid'
14839 d_wcstombs='$d_wcstombs'
14840 d_wctomb='$d_wctomb'
14841 d_xenix='$d_xenix'
14842 date='$date'
14843 db_hashtype='$db_hashtype'
14844 db_prefixtype='$db_prefixtype'
14845 defvoidused='$defvoidused'
14846 direntrytype='$direntrytype'
14847 dlext='$dlext'
14848 dlsrc='$dlsrc'
14849 doublesize='$doublesize'
14850 drand01='$drand01'
14851 dynamic_ext='$dynamic_ext'
14852 eagain='$eagain'
14853 ebcdic='$ebcdic'
14854 echo='$echo'
14855 egrep='$egrep'
14856 emacs='$emacs'
14857 eunicefix='$eunicefix'
14858 exe_ext='$exe_ext'
14859 expr='$expr'
14860 extensions='$extensions'
14861 fflushNULL='$fflushNULL'
14862 fflushall='$fflushall'
14863 find='$find'
14864 firstmakefile='$firstmakefile'
14865 flex='$flex'
14866 fpossize='$fpossize'
14867 fpostype='$fpostype'
14868 freetype='$freetype'
14869 full_ar='$full_ar'
14870 full_csh='$full_csh'
14871 full_sed='$full_sed'
14872 gccversion='$gccversion'
14873 gidformat='$gidformat'
14874 gidsign='$gidsign'
14875 gidsize='$gidsize'
14876 gidtype='$gidtype'
14877 glibpth='$glibpth'
14878 grep='$grep'
14879 groupcat='$groupcat'
14880 groupstype='$groupstype'
14881 gzip='$gzip'
14882 h_fcntl='$h_fcntl'
14883 h_sysfile='$h_sysfile'
14884 hint='$hint'
14885 hostcat='$hostcat'
14886 huge='$huge'
14887 i16size='$i16size'
14888 i16type='$i16type'
14889 i32size='$i32size'
14890 i32type='$i32type'
14891 i64size='$i64size'
14892 i64type='$i64type'
14893 i8size='$i8size'
14894 i8type='$i8type'
14895 i_arpainet='$i_arpainet'
14896 i_bsdioctl='$i_bsdioctl'
14897 i_db='$i_db'
14898 i_dbm='$i_dbm'
14899 i_dirent='$i_dirent'
14900 i_dld='$i_dld'
14901 i_dlfcn='$i_dlfcn'
14902 i_fcntl='$i_fcntl'
14903 i_float='$i_float'
14904 i_gdbm='$i_gdbm'
14905 i_grp='$i_grp'
14906 i_iconv='$i_iconv'
14907 i_inttypes='$i_inttypes'
14908 i_limits='$i_limits'
14909 i_locale='$i_locale'
14910 i_machcthr='$i_machcthr'
14911 i_malloc='$i_malloc'
14912 i_math='$i_math'
14913 i_memory='$i_memory'
14914 i_mntent='$i_mntent'
14915 i_ndbm='$i_ndbm'
14916 i_netdb='$i_netdb'
14917 i_neterrno='$i_neterrno'
14918 i_netinettcp='$i_netinettcp'
14919 i_niin='$i_niin'
14920 i_poll='$i_poll'
14921 i_pthread='$i_pthread'
14922 i_pwd='$i_pwd'
14923 i_rpcsvcdbm='$i_rpcsvcdbm'
14924 i_sfio='$i_sfio'
14925 i_sgtty='$i_sgtty'
14926 i_shadow='$i_shadow'
14927 i_socks='$i_socks'
14928 i_stdarg='$i_stdarg'
14929 i_stddef='$i_stddef'
14930 i_stdlib='$i_stdlib'
14931 i_string='$i_string'
14932 i_sysaccess='$i_sysaccess'
14933 i_sysdir='$i_sysdir'
14934 i_sysfile='$i_sysfile'
14935 i_sysfilio='$i_sysfilio'
14936 i_sysin='$i_sysin'
14937 i_sysioctl='$i_sysioctl'
14938 i_sysmman='$i_sysmman'
14939 i_sysmount='$i_sysmount'
14940 i_sysndir='$i_sysndir'
14941 i_sysparam='$i_sysparam'
14942 i_sysresrc='$i_sysresrc'
14943 i_syssecrt='$i_syssecrt'
14944 i_sysselct='$i_sysselct'
14945 i_syssockio='$i_syssockio'
14946 i_sysstat='$i_sysstat'
14947 i_sysstatfs='$i_sysstatfs'
14948 i_sysstatvfs='$i_sysstatvfs'
14949 i_systime='$i_systime'
14950 i_systimek='$i_systimek'
14951 i_systimes='$i_systimes'
14952 i_systypes='$i_systypes'
14953 i_sysuio='$i_sysuio'
14954 i_sysun='$i_sysun'
14955 i_sysvfs='$i_sysvfs'
14956 i_syswait='$i_syswait'
14957 i_termio='$i_termio'
14958 i_termios='$i_termios'
14959 i_time='$i_time'
14960 i_unistd='$i_unistd'
14961 i_ustat='$i_ustat'
14962 i_utime='$i_utime'
14963 i_values='$i_values'
14964 i_varargs='$i_varargs'
14965 i_varhdr='$i_varhdr'
14966 i_vfork='$i_vfork'
14967 ignore_versioned_solibs='$ignore_versioned_solibs'
14968 inc_version_list='$inc_version_list'
14969 inc_version_list_init='$inc_version_list_init'
14970 incpath='$incpath'
14971 inews='$inews'
14972 installarchlib='$installarchlib'
14973 installbin='$installbin'
14974 installman1dir='$installman1dir'
14975 installman3dir='$installman3dir'
14976 installprefix='$installprefix'
14977 installprefixexp='$installprefixexp'
14978 installprivlib='$installprivlib'
14979 installscript='$installscript'
14980 installsitearch='$installsitearch'
14981 installsitebin='$installsitebin'
14982 installsitelib='$installsitelib'
14983 installstyle='$installstyle'
14984 installusrbinperl='$installusrbinperl'
14985 installvendorbin='$installvendorbin'
14986 installvendorlib='$installvendorlib'
14987 intsize='$intsize'
14988 ivdformat='$ivdformat'
14989 ivsize='$ivsize'
14990 ivtype='$ivtype'
14991 known_extensions='$known_extensions'
14992 ksh='$ksh'
14993 large='$large'
14994 ld='$ld'
14995 lddlflags='$lddlflags'
14996 ldflags='$ldflags'
14997 ldlibpthname='$ldlibpthname'
14998 less='$less'
14999 lib_ext='$lib_ext'
15000 libc='$libc'
15001 libperl='$libperl'
15002 libpth='$libpth'
15003 libs='$libs'
15004 libsdirs='$libsdirs'
15005 libsfiles='$libsfiles'
15006 libsfound='$libsfound'
15007 libswanted='$libswanted'
15008 line='$line'
15009 lint='$lint'
15010 lkflags='$lkflags'
15011 ln='$ln'
15012 lns='$lns'
15013 locincpth='$locincpth'
15014 loclibpth='$loclibpth'
15015 longdblsize='$longdblsize'
15016 longlongsize='$longlongsize'
15017 longsize='$longsize'
15018 lp='$lp'
15019 lpr='$lpr'
15020 ls='$ls'
15021 lseeksize='$lseeksize'
15022 lseektype='$lseektype'
15023 mail='$mail'
15024 mailx='$mailx'
15025 make='$make'
15026 make_set_make='$make_set_make'
15027 mallocobj='$mallocobj'
15028 mallocsrc='$mallocsrc'
15029 malloctype='$malloctype'
15030 man1dir='$man1dir'
15031 man1direxp='$man1direxp'
15032 man1ext='$man1ext'
15033 man3dir='$man3dir'
15034 man3direxp='$man3direxp'
15035 man3ext='$man3ext'
15036 medium='$medium'
15037 mips_type='$mips_type'
15038 mkdir='$mkdir'
15039 mmaptype='$mmaptype'
15040 models='$models'
15041 modetype='$modetype'
15042 more='$more'
15043 multiarch='$multiarch'
15044 mv='$mv'
15045 myarchname='$myarchname'
15046 mydomain='$mydomain'
15047 myhostname='$myhostname'
15048 myuname='$myuname'
15049 n='$n'
15050 netdb_hlen_type='$netdb_hlen_type'
15051 netdb_host_type='$netdb_host_type'
15052 netdb_name_type='$netdb_name_type'
15053 netdb_net_type='$netdb_net_type'
15054 nm='$nm'
15055 nm_opt='$nm_opt'
15056 nm_so_opt='$nm_so_opt'
15057 nonxs_ext='$nonxs_ext'
15058 nroff='$nroff'
15059 nvsize='$nvsize'
15060 nvtype='$nvtype'
15061 o_nonblock='$o_nonblock'
15062 obj_ext='$obj_ext'
15063 old_pthread_create_joinable='$old_pthread_create_joinable'
15064 optimize='$optimize'
15065 orderlib='$orderlib'
15066 osname='$osname'
15067 osvers='$osvers'
15068 package='$package'
15069 pager='$pager'
15070 passcat='$passcat'
15071 patchlevel='$patchlevel'
15072 path_sep='$path_sep'
15073 perl='$perl'
15074 perladmin='$perladmin'
15075 perlpath='$perlpath'
15076 pg='$pg'
15077 phostname='$phostname'
15078 pidtype='$pidtype'
15079 plibpth='$plibpth'
15080 pm_apiversion='$pm_apiversion'
15081 pmake='$pmake'
15082 pr='$pr'
15083 prefix='$prefix'
15084 prefixexp='$prefixexp'
15085 privlib='$privlib'
15086 privlibexp='$privlibexp'
15087 prototype='$prototype'
15088 ptrsize='$ptrsize'
15089 quadkind='$quadkind'
15090 quadtype='$quadtype'
15091 randbits='$randbits'
15092 randfunc='$randfunc'
15093 randseedtype='$randseedtype'
15094 ranlib='$ranlib'
15095 rd_nodata='$rd_nodata'
15096 rm='$rm'
15097 rmail='$rmail'
15098 runnm='$runnm'
15099 sPRIEldbl='$sPRIEldbl'
15100 sPRIFldbl='$sPRIFldbl'
15101 sPRIGldbl='$sPRIGldbl'
15102 sPRIX64='$sPRIX64'
15103 sPRId64='$sPRId64'
15104 sPRIeldbl='$sPRIeldbl'
15105 sPRIfldbl='$sPRIfldbl'
15106 sPRIgldbl='$sPRIgldbl'
15107 sPRIi64='$sPRIi64'
15108 sPRIo64='$sPRIo64'
15109 sPRIu64='$sPRIu64'
15110 sPRIx64='$sPRIx64'
15111 sched_yield='$sched_yield'
15112 scriptdir='$scriptdir'
15113 scriptdirexp='$scriptdirexp'
15114 sed='$sed'
15115 seedfunc='$seedfunc'
15116 selectminbits='$selectminbits'
15117 selecttype='$selecttype'
15118 sendmail='$sendmail'
15119 sh='$sh'
15120 shar='$shar'
15121 sharpbang='$sharpbang'
15122 shmattype='$shmattype'
15123 shortsize='$shortsize'
15124 shrpenv='$shrpenv'
15125 shsharp='$shsharp'
15126 sig_count='$sig_count'
15127 sig_name='$sig_name'
15128 sig_name_init='$sig_name_init'
15129 sig_num='$sig_num'
15130 sig_num_init='$sig_num_init'
15131 signal_t='$signal_t'
15132 sitearch='$sitearch'
15133 sitearchexp='$sitearchexp'
15134 sitebin='$sitebin'
15135 sitebinexp='$sitebinexp'
15136 sitelib='$sitelib'
15137 sitelibexp='$sitelibexp'
15138 siteprefix='$siteprefix'
15139 siteprefixexp='$siteprefixexp'
15140 sizetype='$sizetype'
15141 sleep='$sleep'
15142 smail='$smail'
15143 small='$small'
15144 so='$so'
15145 sockethdr='$sockethdr'
15146 socketlib='$socketlib'
15147 sort='$sort'
15148 spackage='$spackage'
15149 spitshell='$spitshell'
15150 split='$split'
15151 src='$src'
15152 ssizetype='$ssizetype'
15153 startperl='$startperl'
15154 startsh='$startsh'
15155 static_ext='$static_ext'
15156 stdchar='$stdchar'
15157 stdio_base='$stdio_base'
15158 stdio_bufsiz='$stdio_bufsiz'
15159 stdio_cnt='$stdio_cnt'
15160 stdio_filbuf='$stdio_filbuf'
15161 stdio_ptr='$stdio_ptr'
15162 stdio_stream_array='$stdio_stream_array'
15163 strings='$strings'
15164 submit='$submit'
15165 subversion='$subversion'
15166 sysman='$sysman'
15167 tail='$tail'
15168 tar='$tar'
15169 tbl='$tbl'
15170 tee='$tee'
15171 test='$test'
15172 timeincl='$timeincl'
15173 timetype='$timetype'
15174 touch='$touch'
15175 tr='$tr'
15176 trnl='$trnl'
15177 troff='$troff'
15178 u16size='$u16size'
15179 u16type='$u16type'
15180 u32size='$u32size'
15181 u32type='$u32type'
15182 u64size='$u64size'
15183 u64type='$u64type'
15184 u8size='$u8size'
15185 u8type='$u8type'
15186 uidformat='$uidformat'
15187 uidsign='$uidsign'
15188 uidsize='$uidsize'
15189 uidtype='$uidtype'
15190 uname='$uname'
15191 uniq='$uniq'
15192 uquadtype='$uquadtype'
15193 use5005threads='$use5005threads'
15194 use64bits='$use64bits'
15195 usedl='$usedl'
15196 useithreads='$useithreads'
15197 uselargefiles='$uselargefiles'
15198 uselongdouble='$uselongdouble'
15199 uselonglong='$uselonglong'
15200 usemorebits='$usemorebits'
15201 usemultiplicity='$usemultiplicity'
15202 usemymalloc='$usemymalloc'
15203 usenm='$usenm'
15204 useopcode='$useopcode'
15205 useperlio='$useperlio'
15206 useposix='$useposix'
15207 usesfio='$usesfio'
15208 useshrplib='$useshrplib'
15209 usesocks='$usesocks'
15210 usethreads='$usethreads'
15211 usevendorprefix='$usevendorprefix'
15212 usevfork='$usevfork'
15213 usrinc='$usrinc'
15214 uuname='$uuname'
15215 uvoformat='$uvoformat'
15216 uvsize='$uvsize'
15217 uvtype='$uvtype'
15218 uvuformat='$uvuformat'
15219 uvxformat='$uvxformat'
15220 vendorbin='$vendorbin'
15221 vendorbinexp='$vendorbinexp'
15222 vendorlib='$vendorlib'
15223 vendorlibexp='$vendorlibexp'
15224 vendorprefix='$vendorprefix'
15225 vendorprefixexp='$vendorprefixexp'
15226 version='$version'
15227 vi='$vi'
15228 voidflags='$voidflags'
15229 xlibpth='$xlibpth'
15230 xs_apiversion='$xs_apiversion'
15231 zcat='$zcat'
15232 zip='$zip'
15233 EOT
15234
15235 : Add in command line options if available
15236 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15237
15238 : add special variables
15239 $test -f $src/patchlevel.h && \
15240 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15241 echo "CONFIGDOTSH=true" >>config.sh
15242
15243 : propagate old symbols
15244 if $test -f UU/config.sh; then
15245         <UU/config.sh sort | uniq >UU/oldconfig.sh
15246         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15247         sort | uniq -u >UU/oldsyms
15248         set X `cat UU/oldsyms`
15249         shift
15250         case $# in
15251         0) ;;
15252         *)
15253                 cat <<EOM
15254 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15255 EOM
15256                 echo "# Variables propagated from previous config.sh file." >>config.sh
15257                 for sym in `cat UU/oldsyms`; do
15258                         echo "    Propagating $hint variable "'$'"$sym..."
15259                         eval 'tmp="$'"${sym}"'"'
15260                         echo "$tmp" | \
15261                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15262                 done
15263                 ;;
15264         esac
15265 fi
15266
15267 : Finish up by extracting the .SH files
15268 case "$alldone" in
15269 exit)
15270         $rm -rf UU
15271         echo "Done."
15272         exit 0
15273         ;;
15274 cont)
15275         ;;
15276 '')
15277         dflt=''
15278         nostick=true
15279         $cat <<EOM
15280
15281 If you'd like to make any changes to the config.sh file before I begin
15282 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15283
15284 EOM
15285         rp="Press return or use a shell escape to edit config.sh:"
15286         . UU/myread
15287         nostick=''
15288         case "$ans" in
15289         '') ;;
15290         *) : in case they cannot read
15291                 sh 1>&4 -c "$ans";;
15292         esac
15293         ;;
15294 esac
15295
15296 : if this fails, just run all the .SH files by hand
15297 . ./config.sh
15298
15299 echo " "
15300 exec 1>&4
15301 . ./UU/extract
15302
15303 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15304         dflt=y
15305         case "$silent" in
15306         true) ;;
15307         *)
15308                 $cat <<EOM
15309
15310 Now you need to generate make dependencies by running "$make depend".
15311 You might prefer to run it in background: "$make depend > makedepend.out &"
15312 It can take a while, so you might not want to run it right now.
15313
15314 EOM
15315                 ;;
15316         esac
15317         rp="Run $make depend now?"
15318         . UU/myread
15319         case "$ans" in
15320         y*)
15321                 $make depend && echo "Now you must run a $make."
15322                 ;;
15323         *)
15324                 echo "You must run '$make depend' then '$make'."
15325                 ;;
15326         esac
15327 elif test -f [Mm]akefile; then
15328         echo " "
15329         echo "Now you must run a $make."
15330 else
15331         echo "Done."
15332 fi
15333
15334 if $test -f Policy.sh; then
15335     $cat <<EOM
15336
15337 If you compile $package on a different machine or from a different object
15338 directory, copy the Policy.sh file from this object directory to the
15339 new one before you run Configure -- this will help you with most of
15340 the policy defaults.
15341
15342 EOM
15343 fi
15344 if $test -f config.msg; then
15345     echo "Hmm.  I also noted the following information while running:"
15346     echo " "
15347     $cat config.msg >&4
15348     $rm -f config.msg
15349 fi
15350 $rm -f kit*isdone ark*isdone
15351 $rm -rf UU
15352
15353 : End of Configure
15354