Regen Configure.
[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 Tue Nov 16 23:04:27 EET 1999 [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_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtoul=''
533 d_strxfrm=''
534 d_symlink=''
535 d_syscall=''
536 d_sysconf=''
537 d_system=''
538 d_tcgetpgrp=''
539 d_tcsetpgrp=''
540 d_telldirproto=''
541 d_time=''
542 timetype=''
543 clocktype=''
544 d_times=''
545 d_truncate=''
546 d_tzname=''
547 d_umask=''
548 d_semctl_semid_ds=''
549 d_semctl_semun=''
550 d_union_semun=''
551 d_ustat=''
552 d_vfork=''
553 usevfork=''
554 d_voidsig=''
555 signal_t=''
556 d_volatile=''
557 d_charvspr=''
558 d_vprintf=''
559 d_wait4=''
560 d_waitpid=''
561 d_wcstombs=''
562 d_wctomb=''
563 dlext=''
564 cccdlflags=''
565 ccdlflags=''
566 dlsrc=''
567 ld=''
568 lddlflags=''
569 usedl=''
570 doublesize=''
571 ebcdic=''
572 fflushNULL=''
573 fflushall=''
574 fpossize=''
575 fpostype=''
576 gidformat=''
577 gidsign=''
578 gidsize=''
579 gidtype=''
580 groupstype=''
581 h_fcntl=''
582 h_sysfile=''
583 i_arpainet=''
584 db_hashtype=''
585 db_prefixtype=''
586 i_db=''
587 i_dbm=''
588 i_rpcsvcdbm=''
589 d_dirnamlen=''
590 direntrytype=''
591 i_dirent=''
592 i_dld=''
593 i_dlfcn=''
594 i_fcntl=''
595 i_float=''
596 i_gdbm=''
597 d_grpasswd=''
598 i_grp=''
599 i_inttypes=''
600 i_limits=''
601 i_locale=''
602 i_machcthr=''
603 i_malloc=''
604 i_math=''
605 i_memory=''
606 i_mntent=''
607 i_ndbm=''
608 i_netdb=''
609 i_neterrno=''
610 i_netinettcp=''
611 i_niin=''
612 i_sysin=''
613 i_poll=''
614 i_pthread=''
615 d_pwage=''
616 d_pwchange=''
617 d_pwclass=''
618 d_pwcomment=''
619 d_pwexpire=''
620 d_pwgecos=''
621 d_pwpasswd=''
622 d_pwquota=''
623 i_pwd=''
624 i_sfio=''
625 i_shadow=''
626 i_socks=''
627 i_stddef=''
628 i_stdlib=''
629 i_string=''
630 strings=''
631 i_sysaccess=''
632 i_sysdir=''
633 i_sysfile=''
634 d_voidtty=''
635 i_bsdioctl=''
636 i_sysfilio=''
637 i_sysioctl=''
638 i_syssockio=''
639 i_sysmount=''
640 i_sysndir=''
641 i_sysparam=''
642 i_sysresrc=''
643 i_syssecrt=''
644 i_sysselct=''
645 i_sysstat=''
646 i_sysstatfs=''
647 i_sysstatvfs=''
648 i_systimes=''
649 i_systypes=''
650 i_sysuio=''
651 i_sysun=''
652 i_sysvfs=''
653 i_syswait=''
654 i_sgtty=''
655 i_termio=''
656 i_termios=''
657 i_systime=''
658 i_systimek=''
659 i_time=''
660 timeincl=''
661 i_unistd=''
662 i_ustat=''
663 i_utime=''
664 i_values=''
665 i_stdarg=''
666 i_varargs=''
667 i_varhdr=''
668 i_vfork=''
669 installprefix=''
670 installprefixexp=''
671 installstyle=''
672 installusrbinperl=''
673 intsize=''
674 longsize=''
675 shortsize=''
676 d_fpos64_t=''
677 d_off64_t=''
678 libc=''
679 ldlibpthname=''
680 libperl=''
681 shrpenv=''
682 useshrplib=''
683 glibpth=''
684 libpth=''
685 loclibpth=''
686 plibpth=''
687 xlibpth=''
688 ignore_versioned_solibs=''
689 libs=''
690 lns=''
691 d_PRIEldbl=''
692 d_PRIFldbl=''
693 d_PRIGldbl=''
694 d_PRIeldbl=''
695 d_PRIfldbl=''
696 d_PRIgldbl=''
697 sPRIEldbl=''
698 sPRIFldbl=''
699 sPRIGldbl=''
700 sPRIeldbl=''
701 sPRIfldbl=''
702 sPRIgldbl=''
703 lseeksize=''
704 lseektype=''
705 make_set_make=''
706 d_mymalloc=''
707 freetype=''
708 mallocobj=''
709 mallocsrc=''
710 malloctype=''
711 usemymalloc=''
712 installman1dir=''
713 man1dir=''
714 man1direxp=''
715 man1ext=''
716 installman3dir=''
717 man3dir=''
718 man3direxp=''
719 man3ext=''
720 huge=''
721 large=''
722 medium=''
723 models=''
724 small=''
725 split=''
726 modetype=''
727 multiarch=''
728 mydomain=''
729 myhostname=''
730 phostname=''
731 c=''
732 n=''
733 d_eofnblk=''
734 eagain=''
735 o_nonblock=''
736 rd_nodata=''
737 netdb_hlen_type=''
738 netdb_host_type=''
739 netdb_name_type=''
740 netdb_net_type=''
741 groupcat=''
742 hostcat=''
743 passcat=''
744 orderlib=''
745 ranlib=''
746 package=''
747 spackage=''
748 pager=''
749 apiversion=''
750 patchlevel=''
751 subversion=''
752 version=''
753 perladmin=''
754 perlpath=''
755 i16size=''
756 i16type=''
757 i32size=''
758 i32type=''
759 i64size=''
760 i64type=''
761 i8size=''
762 i8type=''
763 ivsize=''
764 ivtype=''
765 nvsize=''
766 nvtype=''
767 u16size=''
768 u16type=''
769 u32size=''
770 u32type=''
771 u64size=''
772 u64type=''
773 u8size=''
774 u8type=''
775 uvsize=''
776 uvtype=''
777 ivdformat=''
778 uvoformat=''
779 uvuformat=''
780 uvxformat=''
781 pidtype=''
782 prefix=''
783 prefixexp=''
784 installprivlib=''
785 privlib=''
786 privlibexp=''
787 prototype=''
788 ptrsize=''
789 d_PRIX64=''
790 d_PRId64=''
791 d_PRIi64=''
792 d_PRIo64=''
793 d_PRIu64=''
794 d_PRIx64=''
795 sPRIX64=''
796 sPRId64=''
797 sPRIi64=''
798 sPRIo64=''
799 sPRIu64=''
800 sPRIx64=''
801 d_quad=''
802 quadkind=''
803 quadtype=''
804 uquadtype=''
805 drand01=''
806 randbits=''
807 randfunc=''
808 randseedtype=''
809 seedfunc=''
810 installscript=''
811 scriptdir=''
812 scriptdirexp=''
813 selectminbits=''
814 selecttype=''
815 sh=''
816 sig_count=''
817 sig_name=''
818 sig_name_init=''
819 sig_num=''
820 sig_num_init=''
821 installsitearch=''
822 sitearch=''
823 sitearchexp=''
824 installsitebin=''
825 sitebin=''
826 sitebinexp=''
827 installsitelib=''
828 sitelib=''
829 sitelibexp=''
830 siteprefix=''
831 siteprefixexp=''
832 sizetype=''
833 so=''
834 sharpbang=''
835 shsharp=''
836 spitshell=''
837 src=''
838 ssizetype=''
839 startperl=''
840 startsh=''
841 stdchar=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidformat=''
848 uidsign=''
849 uidsize=''
850 uidtype=''
851 archname64=''
852 use64bits=''
853 uselargefiles=''
854 uselongdouble=''
855 uselonglong=''
856 usemorebits=''
857 usemultiplicity=''
858 nm_opt=''
859 nm_so_opt=''
860 runnm=''
861 usenm=''
862 useperlio=''
863 usesocks=''
864 d_oldpthreads=''
865 usethreads=''
866 incpath=''
867 mips_type=''
868 usrinc=''
869 d_vendorbin=''
870 installvendorbin=''
871 vendorbin=''
872 vendorbinexp=''
873 d_vendorlib=''
874 installvendorlib=''
875 vendorlib=''
876 vendorlibexp=''
877 usevendorprefix=''
878 vendorprefix=''
879 vendorprefixexp=''
880 defvoidused=''
881 voidflags=''
882 pm_apiversion=''
883 xs_apiversion=''
884 CONFIG=''
885
886 define='define'
887 undef='undef'
888 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
889 rmlist=''
890
891 : We must find out about Eunice early
892 eunicefix=':'
893 if test -f /etc/unixtovms; then
894         eunicefix=/etc/unixtovms
895 fi
896 if test -f /etc/unixtovms.exe; then
897         eunicefix=/etc/unixtovms.exe
898 fi
899
900 i_whoami=''
901 : Possible local include directories to search.
902 : Set locincpth to "" in a hint file to defeat local include searches.
903 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
904 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
905 :
906 : no include file wanted by default
907 inclwanted=''
908
909 : list of known cpp symbols, sorted alphabetically
910 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
911 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
912 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
913 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
914 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
915 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
916 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
917 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
918 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
919 al="$al VMS Xenix286"
920 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
921 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
922 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
923 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
924 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
925 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
926 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
927 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
928 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
929 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
930 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
931 al="$al __SVR4_2__ __UMAXV__"
932 al="$al ____386BSD____ __alpha __alpha__ __amiga"
933 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
934 al="$al __host_mips__"
935 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
936 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
937 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
938 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
939 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
940 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
941 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
942 al="$al __mc88100 __mc88100__ __mips __mips__"
943 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
944 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
945 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
946 al="$al _host_mips _mips _unix"
947 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
948 al="$al apollo ardent att386 att3b"
949 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
950 al="$al cadmus clipper concurrent convex cray ctix"
951 al="$al dmert encore gcos gcx gimpel gould"
952 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
953 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
954 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
955 al="$al i186 i286 i386 i486 i8086"
956 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
957 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
958 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
959 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
960 al="$al mc88000 mc88100 merlin mert mips mvs n16"
961 al="$al ncl_el ncl_mr"
962 al="$al news1500 news1700 news1800 news1900 news3700"
963 al="$al news700 news800 news900 ns16000 ns32000"
964 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
965 al="$al parisc pc532 pdp11 plexus posix pyr"
966 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
967 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
968 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
969 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
970 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
971 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
972 al="$al xenix z8000"
973
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 groupstype=''
979 : change the next line if compiling for Xenix/286 on Xenix/386
980 xlibpth='/usr/lib/386 /lib/386'
981
982 : Possible local library directories to search.
983 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
984 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
985
986 : general looking path for locating libraries
987 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
988 glibpth="$glibpth /lib /usr/lib $xlibpth"
989 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
990 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
991
992 : Private path used by Configure to find libraries.  Its value
993 : is prepended to libpth. This variable takes care of special
994 : machines, like the mips.  Usually, it should be empty.
995 plibpth=''
996
997 : default library list
998 libswanted=''
999 : some systems want to use only the non-versioned libso:s
1000 ignore_versioned_solibs=''
1001 : full support for void wanted by default
1002 defvoidused=15
1003
1004 : set useposix=false in your hint file to disable the POSIX extension.
1005 useposix=true
1006 : set useopcode=false in your hint file to disable the Opcode extension.
1007 useopcode=true
1008 : set usemultiplicity on the Configure command line to enable multiplicity.
1009 : set usesocks on the Configure command line to enable socks.
1010 : set usethreads on the Configure command line to enable threads.
1011 : List of libraries we want.
1012 : If anyone needs -lnet, put it in a hint file.
1013 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1014 libswanted="$libswanted dld ld sun m c cposix posix"
1015 libswanted="$libswanted ndir dir crypt sec"
1016 libswanted="$libswanted ucb bsd BSD PW x"
1017 : We probably want to search /usr/shlib before most other libraries.
1018 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1019 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1020 glibpth="/usr/shlib $glibpth"
1021 : Do not use vfork unless overridden by a hint file.
1022 usevfork=false
1023
1024 : Find the basic shell for Bourne shell scripts
1025 case "$sh" in
1026 '')
1027         case "$SYSTYPE" in
1028         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1029         *) xxx='/bin/sh';;
1030         esac
1031         if test -f "$xxx"; then
1032                 sh="$xxx"
1033         else
1034                 : Build up a list and do a single loop so we can 'break' out.
1035                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1036                 for xxx in sh bash ksh pdksh ash; do
1037                         for p in $pth; do
1038                                 try="$try ${p}/${xxx}"
1039                         done
1040                 done
1041                 for xxx in $try; do
1042                         if test -f "$xxx"; then
1043                                 sh="$xxx";
1044                                 break
1045                         elif test -f "$xxx.exe"; then
1046                                 sh="$xxx";
1047                                 break
1048                         fi
1049                 done
1050         fi
1051         ;;
1052 esac
1053
1054 case "$sh" in
1055 '')     cat <<EOM >&2
1056 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1057
1058 Usually it's in /bin/sh.  How did you even get this far?
1059 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1060 we'll try to straighten this all out.
1061 EOM
1062         exit 1
1063         ;;
1064 esac
1065
1066 : see if sh knows # comments
1067 if `$sh -c '#' >/dev/null 2>&1`; then
1068         shsharp=true
1069         spitshell=cat
1070         xcat=/bin/cat
1071         test -f $xcat || xcat=/usr/bin/cat
1072         echo "#!$xcat" >try
1073         $eunicefix try
1074         chmod +x try
1075         ./try > today
1076         if test -s today; then
1077                 sharpbang='#!'
1078         else
1079                 echo "#! $xcat" > try
1080                 $eunicefix try
1081                 chmod +x try
1082                 ./try > today
1083                 if test -s today; then
1084                         sharpbang='#! '
1085                 else
1086                         sharpbang=': use '
1087                 fi
1088         fi
1089 else
1090         echo " "
1091         echo "Your $sh doesn't grok # comments--I will strip them later on."
1092         shsharp=false
1093         cd ..
1094         echo "exec grep -v '^[  ]*#'" >spitshell
1095         chmod +x spitshell
1096         $eunicefix spitshell
1097         spitshell=`pwd`/spitshell
1098         cd UU
1099         echo "I presume that if # doesn't work, #! won't work either!"
1100         sharpbang=': use '
1101 fi
1102 rm -f try today
1103
1104 : figure out how to guarantee sh startup
1105 case "$startsh" in
1106 '') startsh=${sharpbang}${sh} ;;
1107 *)
1108 esac
1109 cat >try <<EOSS
1110 $startsh
1111 set abc
1112 test "$?abc" != 1
1113 EOSS
1114
1115 chmod +x try
1116 $eunicefix try
1117 if ./try; then
1118         : echo "Yup, it does."
1119 else
1120         echo "Hmm... '$startsh' does not guarantee sh startup..."
1121         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1122 fi
1123 rm -f try
1124
1125
1126 : Save command line options in file UU/cmdline.opt for later use in
1127 : generating config.sh.
1128 cat > cmdline.opt <<EOSH
1129 # Configure command line arguments.
1130 config_arg0='$0'
1131 config_args='$*'
1132 config_argc=$#
1133 EOSH
1134 argn=1
1135 for arg in "$@"; do
1136         cat >>cmdline.opt <<EOSH
1137 config_arg$argn='$arg'
1138 EOSH
1139         argn=`expr $argn + 1`
1140 done
1141
1142 : produce awk script to parse command line options
1143 cat >options.awk <<'EOF'
1144 BEGIN {
1145         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1146
1147         len = length(optstr);
1148         for (i = 1; i <= len; i++) {
1149                 c = substr(optstr, i, 1);
1150                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1151                 if (a == ":") {
1152                         arg[c] = 1;
1153                         i++;
1154                 }
1155                 opt[c] = 1;
1156         }
1157 }
1158 {
1159         expect = 0;
1160         str = $0;
1161         if (substr(str, 1, 1) != "-") {
1162                 printf("'%s'\n", str);
1163                 next;
1164         }
1165         len = length($0);
1166         for (i = 2; i <= len; i++) {
1167                 c = substr(str, i, 1);
1168                 if (!opt[c]) {
1169                         printf("-%s\n", substr(str, i));
1170                         next;
1171                 }
1172                 printf("-%s\n", c);
1173                 if (arg[c]) {
1174                         if (i < len)
1175                                 printf("'%s'\n", substr(str, i + 1));
1176                         else
1177                                 expect = 1;
1178                         next;
1179                 }
1180         }
1181 }
1182 END {
1183         if (expect)
1184                 print "?";
1185 }
1186 EOF
1187
1188 : process the command line options
1189 set X `for arg in "$@"; do echo "X$arg"; done |
1190         sed -e s/X// | awk -f options.awk`
1191 eval "set $*"
1192 shift
1193 rm -f options.awk
1194
1195 : set up default values
1196 fastread=''
1197 reuseval=false
1198 config_sh=''
1199 alldone=''
1200 error=''
1201 silent=''
1202 extractsh=''
1203 override=''
1204 knowitall=''
1205 rm -f optdef.sh posthint.sh
1206 cat >optdef.sh <<EOS
1207 $startsh
1208 EOS
1209
1210
1211 : option parsing
1212 while test $# -gt 0; do
1213         case "$1" in
1214         -d) shift; fastread=yes;;
1215         -e) shift; alldone=cont;;
1216         -f)
1217                 shift
1218                 cd ..
1219                 if test -r "$1"; then
1220                         config_sh="$1"
1221                 else
1222                         echo "$me: cannot read config file $1." >&2
1223                         error=true
1224                 fi
1225                 cd UU
1226                 shift;;
1227         -h) shift; error=true;;
1228         -r) shift; reuseval=true;;
1229         -s) shift; silent=true; realsilent=true;;
1230         -E) shift; alldone=exit;;
1231         -K) shift; knowitall=true;;
1232         -O) shift; override=true;;
1233         -S) shift; silent=true; extractsh=true;;
1234         -D)
1235                 shift
1236                 case "$1" in
1237                 *=)
1238                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1239                         echo "$me: ignoring -D $1" >&2
1240                         ;;
1241                 *=*) echo "$1" | \
1242                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1243                 *) echo "$1='define'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -U)
1248                 shift
1249                 case "$1" in
1250                 *=) echo "$1" >> optdef.sh;;
1251                 *=*)
1252                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1253                         echo "$me: ignoring -U $1" >&2
1254                         ;;
1255                 *) echo "$1='undef'" >> optdef.sh;;
1256                 esac
1257                 shift
1258                 ;;
1259         -A)
1260             shift
1261             xxx=''
1262             yyy="$1"
1263             zzz=''
1264             uuu=undef
1265             case "$yyy" in
1266             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1267                  case "$zzz" in
1268                  *:*) zzz='' ;;
1269                  *)   xxx=append
1270                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1271                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1272                  esac
1273                  ;;
1274             esac
1275             case "$xxx" in
1276             '')  case "$yyy" in
1277                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1278                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1279                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1280                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1282                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1283                  esac
1284                  ;;       
1285             esac
1286             case "$xxx" in
1287             append)
1288                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1289             clear)
1290                 echo "$yyy=''"                  >> posthint.sh ;;
1291             define)
1292                 case "$zzz" in
1293                 '') zzz=define ;;
1294                 esac
1295                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1296             eval)
1297                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1298             prepend)
1299                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1300             undef)
1301                 case "$zzz" in
1302                 '') zzz="$uuu" ;;
1303                 esac
1304                 echo "$yyy=$zzz"                >> posthint.sh ;;
1305             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1306             esac
1307             ;;
1308         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1309             exit 0;;
1310         --) break;;
1311         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1312         *) break;;
1313         esac
1314 done
1315
1316 case "$error" in
1317 true)
1318         cat >&2 <<EOM
1319 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1320                  [-U symbol] [-U symbol=] [-A command:symbol...]
1321   -d : use defaults for all answers.
1322   -e : go on without questioning past the production of config.sh.
1323   -f : specify an alternate default configuration file.
1324   -h : print this help message and exit (with an error status).
1325   -r : reuse C symbols value if possible (skips costly nm extraction).
1326   -s : silent mode, only echoes questions and essential information.
1327   -D : define symbol to have some value:
1328          -D symbol         symbol gets the value 'define'
1329          -D symbol=value   symbol gets the value 'value'
1330   -E : stop at the end of questions, after having produced config.sh.
1331   -K : do not use unless you know what you are doing.
1332   -O : let -D and -U override definitions from loaded configuration file.
1333   -S : perform variable substitutions on all .SH files (can mix with -f)
1334   -U : undefine symbol:
1335          -U symbol    symbol gets the value 'undef'
1336          -U symbol=   symbol gets completely empty
1337   -A : manipulate symbol after the platform specific hints have been applied:
1338          -A symbol=value                append " "value to symbol
1339          -A append:symbol=value         append value to symbol
1340          -A define:symbol=value         define symbol to have value
1341          -A clear:symbol                define symbol to be ''
1342          -A define:symbol               define symbol to be 'define'
1343          -A eval:symbol=value           define symbol to be eval of value
1344          -A prepend:symbol=value        prepend value to symbol
1345          -A undef:symbol                define symbol to be 'undef'
1346          -A undef:symbol=               define symbol to be ''
1347   -V : print version number and exit (with a zero status).
1348 EOM
1349         exit 1
1350         ;;
1351 esac
1352
1353 : Sanity checks
1354 case "$fastread$alldone" in
1355 yescont|yesexit) ;;
1356 *)
1357         if test ! -t 0; then
1358                 echo "Say 'sh Configure', not 'sh <Configure'"
1359                 exit 1
1360         fi
1361         ;;
1362 esac
1363
1364 exec 4>&1
1365 case "$silent" in
1366 true) exec 1>/dev/null;;
1367 esac
1368
1369 : run the defines and the undefines, if any, but leave the file out there...
1370 touch optdef.sh
1371 . ./optdef.sh
1372 : create the posthint manipulation script and leave the file out there...
1373 touch posthint.sh
1374
1375 : set package name
1376 package=perl5
1377 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1378 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1379 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1380 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1381 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1382 esac
1383
1384 : Some greps do not return status, grrr.
1385 echo "grimblepritz" >grimble
1386 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1387         contains=contains
1388 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1389         contains=grep
1390 else
1391         contains=contains
1392 fi
1393 rm -f grimble
1394 : the following should work in any shell
1395 case "$contains" in
1396 contains*)
1397         echo " "
1398         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1399         cat >contains <<'EOSS'
1400 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1401 EOSS
1402 chmod +x contains
1403 esac
1404
1405 : Find the path to the source tree
1406 case "$src" in
1407 '') case "$0" in
1408     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1409          case "$src" in
1410          /*)    ;;
1411          *)     src=`cd ../$src && pwd` ;;
1412          esac
1413          ;;
1414     *)   src='.';;
1415     esac;;
1416 esac
1417 case "$src" in
1418 '')     src=/
1419         rsrc=/
1420         ;;
1421 /*) rsrc="$src";;
1422 *) rsrc="../$src";;
1423 esac
1424 if test -f $rsrc/Configure && \
1425         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1426 then
1427    : found it, so we are ok.
1428 else
1429         rsrc=''
1430         for src in . .. ../.. ../../.. ../../../..; do
1431                 if test -f ../$src/Configure && \
1432                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1433                 then
1434                         rsrc=../$src
1435                         break
1436                 fi
1437         done
1438 fi
1439 case "$rsrc" in
1440 '')
1441         cat <<EOM >&4
1442
1443 Sorry, I can't seem to locate the source dir for $package.  Please start
1444 Configure with an explicit path -- i.e. /some/path/Configure.
1445
1446 EOM
1447         exit 1
1448         ;;
1449 ../.)   rsrc='..';;
1450 *)
1451         echo " "
1452         echo "Sources for $package found in \"$src\"." >&4
1453         ;;
1454 esac
1455
1456 : script used to extract .SH files with variable substitutions
1457 cat >extract <<'EOS'
1458 CONFIGDOTSH=true
1459 echo "Doing variable substitutions on .SH files..."
1460 if test -f $src/MANIFEST; then
1461         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1462 else
1463         echo "(Looking for .SH files under the source directory.)"
1464         set x `(cd $src; find . -name "*.SH" -print)`
1465 fi
1466 shift
1467 case $# in
1468 0) set x `(cd $src; echo *.SH)`; shift;;
1469 esac
1470 if test ! -f $src/$1; then
1471         shift
1472 fi
1473 mkdir_p='
1474 name=$1;
1475 create="";
1476 while test $name; do
1477         if test ! -d "$name"; then
1478                 create="$name $create";
1479                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1480                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1481         else
1482                 name="";
1483         fi;
1484 done;
1485 for file in $create; do
1486         mkdir $file;
1487 done
1488 '
1489 for file in $*; do
1490         case "$src" in
1491         ".")
1492                 case "$file" in
1493                 */*)
1494                         dir=`expr X$file : 'X\(.*\)/'`
1495                         file=`expr X$file : 'X.*/\(.*\)'`
1496                         (cd $dir && . ./$file)
1497                         ;;
1498                 *)
1499                         . ./$file
1500                         ;;
1501                 esac
1502                 ;;
1503         *)
1504                 case "$file" in
1505                 */*)
1506                         dir=`expr X$file : 'X\(.*\)/'`
1507                         file=`expr X$file : 'X.*/\(.*\)'`
1508                         (set x $dir; shift; eval $mkdir_p)
1509                         sh <$src/$dir/$file
1510                         ;;
1511                 *)
1512                         sh <$src/$file
1513                         ;;
1514                 esac
1515                 ;;
1516         esac
1517 done
1518 if test -f $src/config_h.SH; then
1519         if test ! -f config.h; then
1520         : oops, they left it out of MANIFEST, probably, so do it anyway.
1521         . $src/config_h.SH
1522         fi
1523 fi
1524 EOS
1525
1526 : extract files and exit if asked to do so
1527 case "$extractsh" in
1528 true)
1529         case "$realsilent" in
1530         true) ;;
1531         *) exec 1>&4;;
1532         esac
1533         case "$config_sh" in
1534         '') config_sh='config.sh';;
1535         esac
1536         echo " "
1537         echo "Fetching answers from $config_sh..."
1538         cd ..
1539         . $config_sh
1540         test "$override" && . ./optdef.sh
1541         echo " "
1542         . UU/extract
1543         rm -rf UU
1544         echo "Done."
1545         exit 0
1546         ;;
1547 esac
1548
1549 : Eunice requires " " instead of "", can you believe it
1550 echo " "
1551 : Here we go...
1552 echo "Beginning of configuration questions for $package."
1553
1554 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1555
1556 : first determine how to suppress newline on echo command
1557 echo " "
1558 echo "Checking echo to see how to suppress newlines..."
1559 (echo "hi there\c" ; echo " ") >.echotmp
1560 if $contains c .echotmp >/dev/null 2>&1 ; then
1561         echo "...using -n."
1562         n='-n'
1563         c=''
1564 else
1565         cat <<'EOM'
1566 ...using \c
1567 EOM
1568         n=''
1569         c='\c'
1570 fi
1571 echo $n "The star should be here-->$c"
1572 echo '*'
1573 rm -f .echotmp
1574
1575 : Now test for existence of everything in MANIFEST
1576 echo " "
1577 if test -f $rsrc/MANIFEST; then
1578         echo "First let's make sure your kit is complete.  Checking..." >&4
1579         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1580         rm -f missing
1581         tmppwd=`pwd`
1582         for filelist in x??; do
1583                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1584         done
1585         if test -s missing; then
1586                 cat missing >&4
1587                 cat >&4 <<'EOM'
1588
1589 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1590
1591 You have the option of continuing the configuration process, despite the
1592 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1593 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1594 and contact the author (perlbug@perl.com).
1595
1596 EOM
1597                 echo $n "Continue? [n] $c" >&4
1598                 read ans
1599                 case "$ans" in
1600                 y*)
1601                         echo "Continuing..." >&4
1602                         rm -f missing
1603                         ;;
1604                 *)
1605                         echo "ABORTING..." >&4
1606                         kill $$
1607                         ;;
1608                 esac
1609         else
1610                 echo "Looks good..."
1611         fi
1612 else
1613         echo "There is no MANIFEST file.  I hope your kit is complete !"
1614 fi
1615 rm -f missing x??
1616
1617 echo " "
1618 : Find the appropriate value for a newline for tr
1619 if test -n "$DJGPP"; then
1620        trnl='\012'
1621 fi
1622 if test X"$trnl" = X; then
1623         case "`echo foo|tr '\n' x 2>/dev/null`" in
1624         foox) trnl='\n' ;;
1625         esac
1626 fi
1627 if test X"$trnl" = X; then
1628         case "`echo foo|tr '\012' x 2>/dev/null`" in
1629         foox) trnl='\012' ;;
1630         esac
1631 fi
1632 if test X"$trnl" = X; then
1633         cat <<EOM >&2
1634
1635 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1636
1637 EOM
1638         exit 1
1639 fi
1640
1641 : compute the number of columns on the terminal for proper question formatting
1642 case "$COLUMNS" in
1643 '') COLUMNS='80';;
1644 esac
1645
1646 : set up the echo used in my read
1647 myecho="case \"\$xxxm\" in
1648 '') echo $n \"\$rp $c\" >&4;;
1649 *) case \"\$rp\" in
1650         '') echo $n \"[\$xxxm] $c\";;
1651         *)
1652                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1653                         echo \"\$rp\" >&4
1654                         echo $n \"[\$xxxm] $c\" >&4
1655                 else
1656                         echo $n \"\$rp [\$xxxm] $c\" >&4
1657                 fi
1658                 ;;
1659         esac;;
1660 esac"
1661
1662 : now set up to do reads with possible shell escape and default assignment
1663 cat <<EOSC >myread
1664 $startsh
1665 xxxm=\$dflt
1666 $myecho
1667 ans='!'
1668 case "\$fastread" in
1669 yes) case "\$dflt" in
1670         '') ;;
1671         *) ans='';
1672                 case "\$silent-\$rp" in
1673                 true-) ;;
1674                 *) echo " " >&4;;
1675                 esac;;
1676         esac;;
1677 *) case "\$silent" in
1678         true) case "\$rp" in
1679                 '') ans='';;
1680                 esac;;
1681         esac;;
1682 esac
1683 while expr "X\$ans" : "X!" >/dev/null; do
1684         read answ
1685         set x \$xxxm
1686         shift
1687         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1688         case  "\$answ" in
1689         "!")
1690                 sh 1>&4
1691                 echo " "
1692                 $myecho
1693                 ;;
1694         !*)
1695                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1696                 shift
1697                 sh 1>&4 -c "\$*"
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         "\$ans")
1702                 case "\$ans" in
1703                 \\&*)
1704                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1705                         shift
1706                         case "\$1" in
1707                         -d)
1708                                 fastread=yes
1709                                 echo "(OK, I'll run with -d after this question.)" >&4
1710                                 ;;
1711                         -*)
1712                                 echo "*** Sorry, \$1 not supported yet." >&4
1713                                 ;;
1714                         esac
1715                         $myecho
1716                         ans=!
1717                         ;;
1718                 esac;;
1719         *)
1720                 case "\$aok" in
1721                 y)
1722                         echo "*** Substitution done -- please confirm."
1723                         xxxm="\$ans"
1724                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1725                         xxxm="\$ans"
1726                         ans=!
1727                         ;;
1728                 *)
1729                         echo "*** Error -- try again."
1730                         ans=!
1731                         ;;
1732                 esac
1733                 $myecho
1734                 ;;
1735         esac
1736         case "\$ans\$xxxm\$nostick" in
1737         '')
1738                 ans=!
1739                 $myecho
1740                 ;;
1741         esac
1742 done
1743 case "\$ans" in
1744 '') ans="\$xxxm";;
1745 esac
1746 EOSC
1747
1748 : create .config dir to save info across Configure sessions
1749 test -d ../.config || mkdir ../.config
1750 cat >../.config/README <<EOF
1751 This directory created by Configure to save information that should
1752 persist across sessions for $package.
1753
1754 You may safely delete it if you wish.
1755 EOF
1756
1757 : general instructions
1758 needman=true
1759 firsttime=true
1760 user=`(logname) 2>/dev/null`
1761 case "$user" in
1762 '') user=`whoami 2>&1`;;
1763 esac
1764 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1765         firsttime=false
1766         echo " "
1767         rp='Would you like to see the instructions?'
1768         dflt=n
1769         . ./myread
1770         case "$ans" in
1771         [yY]*) ;;
1772         *) needman=false;;
1773         esac
1774 fi
1775 if $needman; then
1776         cat <<EOH
1777
1778 This installation shell script will examine your system and ask you questions
1779 to determine how the perl5 package should be installed. If you get
1780 stuck on a question, you may use a ! shell escape to start a subshell or
1781 execute a command.  Many of the questions will have default answers in square
1782 brackets; typing carriage return will give you the default.
1783
1784 On some of the questions which ask for file or directory names you are allowed
1785 to use the ~name construct to specify the login directory belonging to "name",
1786 even if you don't have a shell which knows about that.  Questions where this is
1787 allowed will be marked "(~name ok)".
1788
1789 EOH
1790         rp=''
1791         dflt='Type carriage return to continue'
1792         . ./myread
1793         cat <<'EOH'
1794
1795 The prompter used in this script allows you to use shell variables and
1796 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1797 in the default answer, as if the default line was a set of arguments given to a
1798 script shell.  This means you may also use $* to repeat the whole default line,
1799 so you do not have to re-type everything to add something to the default.
1800
1801 Everytime there is a substitution, you will have to confirm.  If there is an
1802 error (e.g. an unmatched backtick), the default answer will remain unchanged
1803 and you will be prompted again.
1804
1805 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1806 the questions and use the computed defaults (or the previous answers if there
1807 was already a config.sh file). Type 'Configure -h' for a list of options.
1808 You may also start interactively and then answer '& -d' at any prompt to turn
1809 on the non-interactive behaviour for the remainder of the execution.
1810
1811 EOH
1812         . ./myread
1813         cat <<EOH
1814
1815 Much effort has been expended to ensure that this shell script will run on any
1816 Unix system.  If despite that it blows up on yours, your best bet is to edit
1817 Configure and run it again.  If you can't run Configure for some reason,
1818 you'll have to generate a config.sh file by hand.  Whatever problems you
1819 have, let me (perlbug@perl.com) know how I blew it.
1820
1821 This installation script affects things in two ways:
1822
1823 1) it may do direct variable substitutions on some of the files included
1824    in this kit.
1825 2) it builds a config.h file for inclusion in C programs.  You may edit
1826    any of these files as the need arises after running this script.
1827
1828 If you make a mistake on a question, there is no easy way to back up to it
1829 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1830 files.  Configure will offer to let you do this before it runs the SH files.
1831
1832 EOH
1833         dflt='Type carriage return to continue'
1834         . ./myread
1835         case "$firsttime" in
1836         true) echo $user >>../.config/instruct;;
1837         esac
1838 fi
1839
1840 : find out where common programs are
1841 echo " "
1842 echo "Locating common programs..." >&4
1843 cat <<EOSC >loc
1844 $startsh
1845 case \$# in
1846 0) exit 1;;
1847 esac
1848 thing=\$1
1849 shift
1850 dflt=\$1
1851 shift
1852 for dir in \$*; do
1853         case "\$thing" in
1854         .)
1855         if test -d \$dir/\$thing; then
1856                 echo \$dir
1857                 exit 0
1858         fi
1859         ;;
1860         *)
1861         for thisthing in \$dir/\$thing; do
1862                 : just loop through to pick last item
1863         done
1864         if test -f \$thisthing; then
1865                 echo \$thisthing
1866                 exit 0
1867         elif test -f \$dir/\$thing.exe; then
1868                 if test -n "$DJGPP"; then
1869                         echo \$dir/\$thing.exe
1870                 else
1871                         : on Eunice apparently
1872                         echo \$dir/\$thing
1873                 fi
1874                 exit 0
1875         fi
1876         ;;
1877         esac
1878 done
1879 echo \$dflt
1880 exit 1
1881 EOSC
1882 chmod +x loc
1883 $eunicefix loc
1884 loclist="
1885 awk
1886 cat
1887 comm
1888 cp
1889 echo
1890 expr
1891 grep
1892 ls
1893 make
1894 mkdir
1895 rm
1896 sed
1897 sort
1898 touch
1899 tr
1900 uniq
1901 "
1902 trylist="
1903 Mcc
1904 ar
1905 byacc
1906 cpp
1907 csh
1908 date
1909 egrep
1910 gzip
1911 less
1912 ln
1913 more
1914 nm
1915 nroff
1916 pg
1917 test
1918 uname
1919 zip
1920 "
1921 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1922 pth="$pth /lib /usr/lib"
1923 for file in $loclist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't know where '$file' is, and my life depends on it." >&4
1948                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1949                 exit 1
1950                 ;;
1951         esac
1952 done
1953 echo " "
1954 echo "Don't worry if any of the following aren't found..."
1955 say=offhand
1956 for file in $trylist; do
1957         eval xxx=\$$file
1958         case "$xxx" in
1959         /*|?:[\\/]*)
1960                 if test -f "$xxx"; then
1961                         : ok
1962                 else
1963                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1964                         xxx=`./loc $file $file $pth`
1965                 fi
1966                 ;;
1967         '') xxx=`./loc $file $file $pth`;;
1968         *) xxx=`./loc $xxx $xxx $pth`;;
1969         esac
1970         eval $file=$xxx
1971         eval _$file=$xxx
1972         case "$xxx" in
1973         /*)
1974                 echo $file is in $xxx.
1975                 ;;
1976         ?:[\\/]*)
1977                 echo $file is in $xxx.
1978                 ;;
1979         *)
1980                 echo "I don't see $file out there, $say."
1981                 say=either
1982                 ;;
1983         esac
1984 done
1985 case "$egrep" in
1986 egrep)
1987         echo "Substituting grep for egrep."
1988         egrep=$grep
1989         ;;
1990 esac
1991 case "$ln" in
1992 ln)
1993         echo "Substituting cp for ln."
1994         ln=$cp
1995         ;;
1996 esac
1997 case "$test" in
1998 test)
1999         echo "Hopefully test is built into your sh."
2000         ;;
2001 *)
2002         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2003                 echo "Using the test built into your sh."
2004                 test=test
2005                 _test=test
2006         fi
2007         ;;
2008 esac
2009 case "$echo" in
2010 echo)
2011         echo "Hopefully echo is built into your sh."
2012         ;;
2013 '') ;;
2014 *)
2015         echo " "
2016 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2017         $echo $n "hi there$c" >foo1
2018         echo $n "hi there$c" >foo2
2019         if cmp foo1 foo2 >/dev/null 2>&1; then
2020                 echo "They are compatible.  In fact, they may be identical."
2021         else
2022                 case "$n" in
2023                 '-n') n='' c='\c';;
2024                 *) n='-n' c='';;
2025                 esac
2026                 cat <<FOO
2027 They are not compatible!  You are probably running ksh on a non-USG system.
2028 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2029 have echo built in and we may have to run some Bourne shell scripts.  That
2030 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2031
2032 FOO
2033                 $echo $n "The star should be here-->$c"
2034                 $echo "*"
2035         fi
2036         $rm -f foo1 foo2
2037         ;;
2038 esac
2039
2040 : determine whether symbolic links are supported
2041 echo " "
2042 $touch blurfl
2043 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2044         echo "Symbolic links are supported." >&4
2045         lns="$ln -s"
2046 else
2047         echo "Symbolic links are NOT supported." >&4
2048         lns="$ln"
2049 fi
2050 $rm -f blurfl sym
2051
2052 : see whether [:lower:] and [:upper:] are supported character classes
2053 echo " "
2054 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2055 ABYZ)
2056         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2057         up='[:upper:]'
2058         low='[:lower:]'
2059         ;;
2060 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2061         # (0xc9 and 0xd1), therefore that is a nice testing point.
2062         if test "X$up" = X -o "X$low" = X; then
2063             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2064             ij) up='[A-Z]'
2065                 low='[a-z]'
2066                 ;;
2067             esac
2068         fi
2069         if test "X$up" = X -o "X$low" = X; then
2070             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2071             ij) up='A-Z'
2072                 low='a-z'
2073                 ;;
2074             esac
2075         fi
2076         if test "X$up" = X -o "X$low" = X; then
2077             case "`echo IJ | od -x 2>/dev/null`" in
2078             *C9D1*|*c9d1*)
2079                 echo "Hey, this might be EBCDIC." >&4
2080                 if test "X$up" = X -o "X$low" = X; then
2081                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2082                     ij) up='[A-IJ-RS-Z]'
2083                         low='[a-ij-rs-z]'
2084                         ;;
2085                     esac
2086                 fi
2087                 if test "X$up" = X -o "X$low" = X; then
2088                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2089                     ij) up='A-IJ-RS-Z'
2090                         low='a-ij-rs-z'
2091                         ;;
2092                     esac
2093                 fi
2094                 ;;
2095             esac
2096         fi
2097 esac
2098 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2099 ij)
2100     echo "Using $up and $low to convert case." >&4
2101     ;;
2102 *)
2103     echo "I don't know how to translate letters from upper to lower case." >&4
2104     echo "Your tr is not acting any way I know of." >&4
2105     exit 1
2106     ;;
2107 esac
2108 : set up the translation script tr, must be called with ./tr of course
2109 cat >tr <<EOSC
2110 $startsh
2111 case "\$1\$2" in
2112 '[A-Z][a-z]') exec $tr '$up' '$low';;
2113 '[a-z][A-Z]') exec $tr '$low' '$up';;
2114 esac
2115 exec $tr "\$@"
2116 EOSC
2117 chmod +x tr
2118 $eunicefix tr
2119
2120 : Try to determine whether config.sh was made on this system
2121 case "$config_sh" in
2122 '')
2123 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2124 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2125 # because the A-Z/a-z are not consecutive.
2126 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2127         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2128 newmyuname="$myuname"
2129 dflt=n
2130 case "$knowitall" in
2131 '')
2132         if test -f ../config.sh; then
2133                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2134                         eval "`grep myuname= ../config.sh`"
2135                 fi
2136                 if test "X$myuname" = "X$newmyuname"; then
2137                         dflt=y
2138                 fi
2139         fi
2140         ;;
2141 *) dflt=y;;
2142 esac
2143
2144 : Get old answers from old config file if Configure was run on the
2145 : same system, otherwise use the hints.
2146 hint=default
2147 cd ..
2148 if test -f config.sh; then
2149         echo " "
2150         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2151         . UU/myread
2152         case "$ans" in
2153         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2154         *)  echo "Fetching default answers from your old config.sh file..." >&4
2155                 tmp_n="$n"
2156                 tmp_c="$c"
2157                 tmp_sh="$sh"
2158                 . ./config.sh
2159                 cp config.sh UU
2160                 n="$tmp_n"
2161                 c="$tmp_c"
2162                 : Older versions did not always set $sh.  Catch re-use of such
2163                 : an old config.sh.
2164                 case "$sh" in
2165                 '') sh="$tmp_sh" ;;
2166                 esac
2167                 hint=previous
2168                 ;;
2169         esac
2170 fi
2171 if test ! -f config.sh; then
2172         $cat <<EOM
2173
2174 First time through, eh?  I have some defaults handy for some systems
2175 that need some extra help getting the Configure answers right:
2176
2177 EOM
2178         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2179         dflt=''
2180         : Half the following guesses are probably wrong... If you have better
2181         : tests or hints, please send them to perlbug@perl.com
2182         : The metaconfig authors would also appreciate a copy...
2183         $test -f /irix && osname=irix
2184         $test -f /xenix && osname=sco_xenix
2185         $test -f /dynix && osname=dynix
2186         $test -f /dnix && osname=dnix
2187         $test -f /lynx.os && osname=lynxos
2188         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2189         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2190         $test -f /bin/mips && /bin/mips && osname=mips
2191         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2192                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2193         $test -d /usr/apollo/bin && osname=apollo
2194         $test -f /etc/saf/_sactab && osname=svr4
2195         $test -d /usr/include/minix && osname=minix
2196         if $test -d /MachTen -o -d /MachTen_Folder; then
2197                 osname=machten
2198                 if $test -x /sbin/version; then
2199                         osvers=`/sbin/version | $awk '{print $2}' |
2200                         $sed -e 's/[A-Za-z]$//'`
2201                 elif $test -x /usr/etc/version; then
2202                         osvers=`/usr/etc/version | $awk '{print $2}' |
2203                         $sed -e 's/[A-Za-z]$//'`
2204                 else
2205                         osvers="$2.$3"
2206                 fi
2207         fi
2208        $test -f /sys/posix.dll &&
2209                $test -f /usr/bin/what &&
2210                set X `/usr/bin/what /sys/posix.dll` &&
2211                $test "$3" = UWIN &&
2212                osname=uwin &&
2213                osvers="$5"
2214         if $test -f $uname; then
2215                 set X $myuname
2216                 shift
2217
2218                 case "$5" in
2219                 fps*) osname=fps ;;
2220                 mips*)
2221                         case "$4" in
2222                         umips) osname=umips ;;
2223                         *) osname=mips ;;
2224                         esac;;
2225                 [23]100) osname=mips ;;
2226                 next*) osname=next ;;
2227                 i386*)
2228                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2229                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2230                                 osname='sco'
2231                                 osvers=$tmp
2232                         elif $test -f /etc/kconfig; then
2233                                 osname=isc
2234                                 if test "$lns" = "$ln -s"; then
2235                                         osvers=4
2236                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2237                                         osvers=3
2238                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2239                                         osvers=2
2240                                 fi
2241                         fi
2242                         tmp=''
2243                         ;;
2244                 pc*)
2245                         if test -n "$DJGPP"; then
2246                                 osname=dos
2247                                 osvers=djgpp
2248                         fi
2249                         ;;
2250                 esac
2251
2252                 case "$1" in
2253                 aix) osname=aix
2254                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2255                         case "$tmp" in
2256                         'not found') osvers="$4"."$3" ;;
2257                         '<3240'|'<>3240') osvers=3.2.0 ;;
2258                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2259                         '=3250'|'>3250') osvers=3.2.5 ;;
2260                         *) osvers=$tmp;;
2261                         esac
2262                         ;;
2263                 *dc.osx) osname=dcosx
2264                         osvers="$3"
2265                         ;;
2266                 dnix) osname=dnix
2267                         osvers="$3"
2268                         ;;
2269                 domainos) osname=apollo
2270                         osvers="$3"
2271                         ;;
2272                 dgux) osname=dgux 
2273                         osvers="$3"
2274                         ;;
2275                 dynixptx*) osname=dynixptx
2276                         osvers=`echo "$4"|sed 's/^v//'`
2277                         ;;
2278                 freebsd) osname=freebsd 
2279                         osvers="$3" ;;
2280                 genix) osname=genix ;;
2281                 hp*) osname=hpux 
2282                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2283                         ;;
2284                 irix*) osname=irix
2285                         case "$3" in
2286                         4*) osvers=4 ;;
2287                         5*) osvers=5 ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 linux) osname=linux
2292                         case "$3" in
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 MiNT) osname=mint
2297                         ;;
2298                 netbsd*) osname=netbsd
2299                         osvers="$3"
2300                         ;;
2301                 news-os) osvers="$3"
2302                         case "$3" in
2303                         4*) osname=newsos4 ;;
2304                         *) osname=newsos ;;
2305                         esac
2306                         ;;
2307                 bsd386) osname=bsd386
2308                         osvers=`$uname -r`
2309                         ;;
2310                 POSIX-BC | posix-bc ) osname=posix-bc
2311                         osvers="$3"
2312                         ;;
2313                 powerux | power_ux | powermax_os | powermaxos | \
2314                 powerunix | power_unix) osname=powerux
2315                         osvers="$3"
2316                         ;;
2317                 next*) osname=next ;;
2318                 solaris) osname=solaris
2319                         case "$3" in
2320                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 sunos) osname=sunos
2325                         case "$3" in
2326                         5*) osname=solaris
2327                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2328                         *)      osvers="$3" ;;
2329                         esac
2330                         ;;
2331                 titanos) osname=titanos
2332                         case "$3" in
2333                         1*) osvers=1 ;;
2334                         2*) osvers=2 ;;
2335                         3*) osvers=3 ;;
2336                         4*) osvers=4 ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 ultrix) osname=ultrix
2341                         osvers="$3"
2342                         ;;
2343                 osf1|mls+)      case "$5" in
2344                                 alpha)
2345                                         osname=dec_osf
2346                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2347                                         ;;
2348                         hp*)    osname=hp_osf1  ;;
2349                         mips)   osname=mips_osf1 ;;
2350                         esac
2351                         ;;
2352                 unixware) osname=svr5
2353                         osvers="$4"
2354                         ;;
2355                 uts) osname=uts
2356                         osvers="$3"
2357                         ;;
2358                 qnx) osname=qnx
2359                         osvers="$4"
2360                         ;;
2361                 $2) case "$osname" in
2362                         *isc*) ;;
2363                         *freebsd*) ;;
2364                         svr*)
2365                                 : svr4.x or possibly later
2366                                 case "svr$3" in 
2367                                 ${osname}*)
2368                                         osname=svr$3
2369                                         osvers=$4
2370                                         ;;
2371                                 esac
2372                                 case "$osname" in
2373                                 svr4.0)
2374                                         : Check for ESIX
2375                                         if test -f /stand/boot ; then
2376                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2377                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2378                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2379                                                         if test -n "$isesix"; then
2380                                                                 osname=esix4
2381                                                         fi
2382                                                 fi
2383                                         fi
2384                                         ;;
2385                                 esac
2386                                 ;;
2387                         *)      if test -f /etc/systemid; then
2388                                         osname=sco
2389                                         set `echo $3 | $sed 's/\./ /g'` $4
2390                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2391                                                 osvers=$1.$2.$3
2392                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2393                                                 osvers=$1.$2
2394                                         elif $test -f $src/hints/sco_$1.sh; then
2395                                                 osvers=$1
2396                                         fi
2397                                 else
2398                                         case "$osname" in
2399                                         '') : Still unknown.  Probably a generic Sys V.
2400                                                 osname="sysv"
2401                                                 osvers="$3"
2402                                                 ;;
2403                                         esac
2404                                 fi
2405                                 ;;
2406                         esac
2407                         ;;
2408                 *)      case "$osname" in
2409                         '') : Still unknown.  Probably a generic BSD.
2410                                 osname="$1"
2411                                 osvers="$3"
2412                                 ;;
2413                         esac
2414                         ;;
2415                 esac
2416         else
2417                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2418                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2419                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2420                                 osname=news_os
2421                         fi
2422                         $rm -f UU/kernel.what
2423                 elif test -d c:/.; then
2424                         set X $myuname
2425                         osname=os2
2426                         osvers="$5"
2427                 fi
2428         fi
2429         
2430         : Now look for a hint file osname_osvers, unless one has been
2431         : specified already.
2432         case "$hintfile" in
2433         ''|' ')
2434                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2435                 : Also try without trailing minor version numbers.
2436                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2437                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2438                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2439                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2440                 case "$file" in
2441                 '') dflt=none ;;
2442                 *)  case "$osvers" in
2443                         '') dflt=$file
2444                                 ;;
2445                         *)  if $test -f $src/hints/$file.sh ; then
2446                                         dflt=$file
2447                                 elif $test -f $src/hints/$xfile.sh ; then
2448                                         dflt=$xfile
2449                                 elif $test -f $src/hints/$xxfile.sh ; then
2450                                         dflt=$xxfile
2451                                 elif $test -f $src/hints/$xxxfile.sh ; then
2452                                         dflt=$xxxfile
2453                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2454                                         dflt=$xxxxfile
2455                                 elif $test -f "$src/hints/${osname}.sh" ; then
2456                                         dflt="${osname}"
2457                                 else
2458                                         dflt=none
2459                                 fi
2460                                 ;;
2461                         esac
2462                         ;;
2463                 esac
2464                 if $test -f Policy.sh ; then
2465                         case "$dflt" in
2466                         *Policy*) ;;
2467                         none) dflt="Policy" ;;
2468                         *) dflt="Policy $dflt" ;;
2469                         esac
2470                 fi
2471                 ;;
2472         *)
2473                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2474                 ;;
2475         esac
2476
2477         if $test -f Policy.sh ; then
2478                 $cat <<EOM
2479
2480 There's also a Policy hint file available, which should make the
2481 site-specific (policy) questions easier to answer.
2482 EOM
2483
2484         fi
2485
2486         $cat <<EOM
2487
2488 You may give one or more space-separated answers, or "none" if appropriate.
2489 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2490 is a good thing.  DO NOT give a wrong version or a wrong OS.
2491
2492 EOM
2493
2494         rp="Which of these apply, if any?"
2495         . UU/myread
2496         tans=$ans
2497         for file in $tans; do
2498                 if $test X$file = XPolicy -a -f Policy.sh; then
2499                         . Policy.sh
2500                         $cat Policy.sh >> UU/config.sh
2501                 elif $test -f $src/hints/$file.sh; then
2502                         . $src/hints/$file.sh
2503                         $cat $src/hints/$file.sh >> UU/config.sh
2504                 elif $test X$tans = X -o X$tans = Xnone ; then
2505                         : nothing
2506                 else
2507                         : Give one chance to correct a possible typo.
2508                         echo "$file.sh does not exist"
2509                         dflt=$file
2510                         rp="hint to use instead?"
2511                         . UU/myread
2512                         for file in $ans; do
2513                                 if $test -f "$src/hints/$file.sh"; then
2514                                         . $src/hints/$file.sh
2515                                         $cat $src/hints/$file.sh >> UU/config.sh
2516                                 elif $test X$ans = X -o X$ans = Xnone ; then
2517                                         : nothing
2518                                 else
2519                                         echo "$file.sh does not exist -- ignored."
2520                                 fi
2521                         done
2522                 fi
2523         done
2524
2525         hint=recommended
2526         : Remember our hint file for later.
2527         if $test -f "$src/hints/$file.sh" ; then
2528                 hintfile="$file"
2529         else
2530                 hintfile=''
2531         fi
2532 fi
2533 cd UU
2534 ;;
2535 *)
2536         echo " "
2537         echo "Fetching default answers from $config_sh..." >&4
2538         tmp_n="$n"
2539         tmp_c="$c"
2540         cd ..
2541         cp $config_sh config.sh 2>/dev/null
2542         chmod +w config.sh
2543         . ./config.sh
2544         cd UU
2545         cp ../config.sh .
2546         n="$tmp_n"
2547         c="$tmp_c"
2548         hint=previous
2549         ;;
2550 esac
2551 test "$override" && . ./optdef.sh
2552 myuname="$newmyuname"
2553
2554 : Restore computed paths
2555 for file in $loclist $trylist; do
2556         eval $file="\$_$file"
2557 done
2558
2559 cat << EOM
2560
2561 Configure uses the operating system name and version to set some defaults.
2562 The default value is probably right if the name rings a bell. Otherwise,
2563 since spelling matters for me, either accept the default or answer "none"
2564 to leave it blank.
2565
2566 EOM
2567 case "$osname" in
2568         ''|' ')
2569                 case "$hintfile" in
2570                 ''|' '|none) dflt=none ;;
2571                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2572                 esac
2573                 ;;
2574         *) dflt="$osname" ;;
2575 esac
2576 rp="Operating system name?"
2577 . ./myread
2578 case "$ans" in
2579 none)  osname='' ;;
2580 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2581 esac
2582 echo " "
2583 case "$osvers" in
2584         ''|' ')
2585                 case "$hintfile" in
2586                 ''|' '|none) dflt=none ;;
2587                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2588                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2589                         case "$dflt" in
2590                         ''|' ') dflt=none ;;
2591                         esac
2592                         ;;
2593                 esac
2594                 ;;
2595         *) dflt="$osvers" ;;
2596 esac
2597 rp="Operating system version?"
2598 . ./myread
2599 case "$ans" in
2600 none)  osvers='' ;;
2601 *) osvers="$ans" ;;
2602 esac
2603
2604
2605 . ./posthint.sh
2606
2607 : who configured the system
2608 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2609 cf_by=`(logname) 2>/dev/null`
2610 case "$cf_by" in
2611 "")
2612         cf_by=`(whoami) 2>/dev/null`
2613         case "$cf_by" in
2614         "") cf_by=unknown ;;
2615         esac ;;
2616 esac
2617
2618 : set up the script used to warn in case of inconsistency
2619 cat <<EOS >whoa
2620 $startsh
2621 EOS
2622 cat <<'EOSC' >>whoa
2623 dflt=y
2624 echo " "
2625 echo "*** WHOA THERE!!! ***" >&4
2626 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2627 rp="    Keep the $hint value?"
2628 . ./myread
2629 case "$ans" in
2630 y) td=$was; tu=$was;;
2631 esac
2632 EOSC
2633
2634 : function used to set $1 to $val
2635 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2636 case "$val$was" in
2637 $define$undef) . ./whoa; eval "$var=\$td";;
2638 $undef$define) . ./whoa; eval "$var=\$tu";;
2639 *) eval "$var=$val";;
2640 esac'
2641
2642 cat <<EOM
2643
2644 Perl can be built to take advantage of threads, on some systems.
2645 To do so, Configure must be run with -Dusethreads.
2646
2647 Note that threading is a highly experimental feature, and
2648 some known race conditions still remain.  If you choose to try
2649 it, be very sure to not actually deploy it for production
2650 purposes.  README.threads has more details, and is required
2651 reading if you enable threads.
2652 EOM
2653 case "$usethreads" in
2654 $define|true|[yY]*)     dflt='y';;
2655 *) dflt='n';;
2656 esac
2657 rp='Build a threading Perl?'
2658 . ./myread
2659 case "$ans" in
2660 y|Y)    val="$define" ;;     
2661 *)      val="$undef" ;;
2662 esac
2663 set usethreads
2664 eval $setvar 
2665
2666 case "$d_oldpthreads" in
2667 '')     : Configure tests would be welcome here.  For now, assume undef.
2668         val="$undef" ;;
2669 *)      val="$d_oldpthreads" ;;
2670 esac
2671 set d_oldpthreads
2672 eval $setvar
2673
2674
2675 case "$usethreads" in
2676 "$define"|true|[yY]*)
2677 : Look for a hint-file generated 'call-back-unit'.  If the
2678 : user has specified that a threading perl is to be built,
2679 : we may need to set or change some other defaults.
2680         if $test -f usethreads.cbu; then
2681                 echo "Your platform has some specific hints for threaded builds, using them..."
2682                 . ./usethreads.cbu
2683         else
2684                 $cat <<EOM
2685 (Your platform doesn't have any specific hints for threaded builds.
2686  Assuming POSIX threads, then.)
2687 EOM
2688         fi
2689     ;;
2690 esac
2691
2692 cat <<EOM
2693
2694 Perl can be built so that multiple Perl interpreters can coexist
2695 within the same Perl executable.  To do so, Configure must be run with
2696 -Dusemultiplicity.
2697
2698 Normally you do not need this and you should answer no.
2699
2700 EOM
2701 case "$usemultiplicity" in
2702 $define|true|[yY]*)     dflt='y';;
2703 *) dflt='n';;
2704 esac
2705 rp='Build Perl for multiplicity?'
2706 . ./myread
2707 case "$ans" in
2708 y|Y)    val="$define" ;;     
2709 *)      val="$undef" ;;
2710 esac
2711 set usemultiplicity
2712 eval $setvar 
2713
2714 : determine where manual pages are on this system
2715 echo " "
2716 case "$sysman" in
2717 '') 
2718         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2719         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2720         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2721         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2722         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2723         sysman=`./loc . /usr/man/man1 $syspath`
2724         ;;
2725 esac
2726 if $test -d "$sysman"; then
2727         echo "System manual is in $sysman." >&4
2728 else
2729         echo "Could not find manual pages in source form." >&4
2730 fi
2731
2732 : see what memory models we can support
2733 case "$models" in
2734 '')
2735         $cat >pdp11.c <<'EOP'
2736 int main() {
2737 #ifdef pdp11
2738         exit(0);
2739 #else
2740         exit(1);
2741 #endif
2742 }
2743 EOP
2744         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2745         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2746                 dflt='unsplit split'
2747         else
2748                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2749                 case "$tans" in
2750                 X) dflt='none';;
2751                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2752                                 dflt='small'
2753                         else
2754                                 dflt=''
2755                         fi
2756                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2757                                 dflt="$dflt medium"
2758                         fi
2759                         if $test -d /lib/large || $test -d /usr/lib/large; then
2760                                 dflt="$dflt large"
2761                         fi
2762                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2763                                 dflt="$dflt huge"
2764                         fi
2765                 esac
2766         fi;;
2767 *) dflt="$models";;
2768 esac
2769 $cat <<EOM
2770  
2771 Some systems have different model sizes.  On most systems they are called
2772 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2773 split.  If your system doesn't support different memory models, say "none".
2774 If you wish to force everything to one memory model, say "none" here and
2775 put the appropriate flags later when it asks you for other cc and ld flags.
2776 Venix systems may wish to put "none" and let the compiler figure things out.
2777 (In the following question multiple model names should be space separated.)
2778
2779 The default for most systems is "none".
2780
2781 EOM
2782 rp="Which memory models are supported?"
2783 . ./myread
2784 models="$ans"
2785
2786 case "$models" in
2787 none)
2788         small=''
2789         medium=''
2790         large=''
2791         huge=''
2792         unsplit=''
2793         split=''
2794         ;;
2795 *split)
2796         case "$split" in
2797         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2798                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2799                         dflt='-i'
2800                 else
2801                         dflt='none'
2802                 fi;;
2803         *) dflt="$split";;
2804         esac
2805         rp="What flag indicates separate I and D space?"
2806         . ./myread
2807         tans="$ans"
2808         case "$tans" in
2809         none) tans='';;
2810         esac
2811         split="$tans"
2812         unsplit='';;
2813 *large*|*small*|*medium*|*huge*)
2814         case "$models" in
2815         *large*)
2816                 case "$large" in
2817                 '') dflt='-Ml';;
2818                 *) dflt="$large";;
2819                 esac
2820         rp="What flag indicates large model?"
2821         . ./myread
2822         tans="$ans"
2823         case "$tans" in
2824         none) tans='';
2825         esac
2826         large="$tans";;
2827         *) large='';;
2828         esac
2829         case "$models" in
2830         *huge*) case "$huge" in
2831                 '') dflt='-Mh';;
2832                 *) dflt="$huge";;
2833                 esac
2834                 rp="What flag indicates huge model?"
2835                 . ./myread
2836                 tans="$ans"
2837                 case "$tans" in
2838                 none) tans='';
2839                 esac
2840                 huge="$tans";;
2841         *) huge="$large";;
2842         esac
2843         case "$models" in
2844         *medium*) case "$medium" in
2845                 '') dflt='-Mm';;
2846                 *) dflt="$medium";;
2847                 esac
2848                 rp="What flag indicates medium model?"
2849                 . ./myread
2850                 tans="$ans"
2851                 case "$tans" in
2852                 none) tans='';
2853                 esac
2854                 medium="$tans";;
2855         *) medium="$large";;
2856         esac
2857         case "$models" in
2858         *small*) case "$small" in
2859                 '') dflt='none';;
2860                 *) dflt="$small";;
2861                 esac
2862                 rp="What flag indicates small model?"
2863                 . ./myread
2864                 tans="$ans"
2865                 case "$tans" in
2866                 none) tans='';
2867                 esac
2868                 small="$tans";;
2869         *) small='';;
2870         esac
2871         ;;
2872 *)
2873         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2874         ;;
2875 esac
2876 $rm -f pdp11.* pdp11
2877
2878 : make some quick guesses about what we are up against
2879 echo " "
2880 $echo $n "Hmm...  $c"
2881 echo exit 1 >bsd
2882 echo exit 1 >usg
2883 echo exit 1 >v7
2884 echo exit 1 >osf1
2885 echo exit 1 >eunice
2886 echo exit 1 >xenix
2887 echo exit 1 >venix
2888 echo exit 1 >os2
2889 d_bsd="$undef"
2890 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2891 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2892 then
2893         echo "Looks kind of like an OSF/1 system, but we'll see..."
2894         echo exit 0 >osf1
2895 elif test `echo abc | tr a-z A-Z` = Abc ; then
2896         xxx=`./loc addbib blurfl $pth`
2897         if $test -f $xxx; then
2898         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2899                 echo exit 0 >bsd
2900                 echo exit 0 >usg
2901         else
2902                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2903                         echo "Looks kind of like an extended USG system, but we'll see..."
2904                 else
2905                         echo "Looks kind of like a USG system, but we'll see..."
2906                 fi
2907                 echo exit 0 >usg
2908         fi
2909 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2910         echo "Looks kind of like a BSD system, but we'll see..."
2911         d_bsd="$define"
2912         echo exit 0 >bsd
2913 else
2914         echo "Looks kind of like a Version 7 system, but we'll see..."
2915         echo exit 0 >v7
2916 fi
2917 case "$eunicefix" in
2918 *unixtovms*)
2919         $cat <<'EOI'
2920 There is, however, a strange, musty smell in the air that reminds me of
2921 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2922 EOI
2923         echo exit 0 >eunice
2924         d_eunice="$define"
2925 : it so happens the Eunice I know will not run shell scripts in Unix format
2926         ;;
2927 *)
2928         echo " "
2929         echo "Congratulations.  You aren't running Eunice."
2930         d_eunice="$undef"
2931         ;;
2932 esac
2933 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2934 case "$p_" in
2935 :) ;;
2936 *)
2937         $cat <<'EOI'
2938 I have the feeling something is not exactly right, however...don't tell me...
2939 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2940 EOI
2941         echo exit 0 >os2
2942         ;;
2943 esac
2944 if test -f /xenix; then
2945         echo "Actually, this looks more like a XENIX system..."
2946         echo exit 0 >xenix
2947         d_xenix="$define"
2948 else
2949         echo " "
2950         echo "It's not Xenix..."
2951         d_xenix="$undef"
2952 fi
2953 chmod +x xenix
2954 $eunicefix xenix
2955 if test -f /venix; then
2956         echo "Actually, this looks more like a VENIX system..."
2957         echo exit 0 >venix
2958 else
2959         echo " "
2960         if ./xenix; then
2961                 : null
2962         else
2963                 echo "Nor is it Venix..."
2964         fi
2965 fi
2966 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2967 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2968 $rm -f foo
2969
2970 : see if we need a special compiler
2971 echo " "
2972 if ./usg; then
2973         case "$cc" in
2974         '') case "$Mcc" in
2975                 /*) dflt='Mcc';;
2976                 *) case "$large" in
2977                         -M*) dflt='cc';;
2978                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2979                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2980                                                 dflt='cc'
2981                                         else
2982                                                 dflt='cc -M'
2983                                         fi
2984                                 else
2985                                         dflt='cc'
2986                                 fi;;
2987                         esac;;
2988                 esac;;
2989         *)  dflt="$cc";;
2990         esac
2991         case "$dflt" in
2992         *M*)    $cat <<'EOM'
2993 On some older systems the default C compiler will not resolve multiple global
2994 references that happen to have the same name.  On some such systems the "Mcc"
2995 command may be used to force these to be resolved.  On other systems a "cc -M"
2996 command is required.  (Note that the -M flag on other systems indicates a
2997 memory model to use!) If you have the Gnu C compiler, you might wish to use
2998 that instead.
2999
3000 EOM
3001         ;;
3002         esac
3003         rp="Use which C compiler?"
3004         . ./myread
3005         cc="$ans"
3006 else
3007         case "$cc" in
3008         '') dflt=cc;;
3009         *) dflt="$cc";;
3010         esac
3011         rp="Use which C compiler?"
3012         . ./myread
3013         cc="$ans"
3014 fi
3015 : Look for a hint-file generated 'call-back-unit'.  Now that the
3016 : user has specified the compiler, we may need to set or change some
3017 : other defaults.
3018 if $test -f cc.cbu; then
3019     . ./cc.cbu
3020 fi
3021 echo " "
3022 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3023 $cat >gccvers.c <<EOM
3024 #include <stdio.h>
3025 int main() {
3026 #ifdef __GNUC__
3027 #ifdef __VERSION__
3028         printf("%s\n", __VERSION__);
3029 #else
3030         printf("%s\n", "1");
3031 #endif
3032 #endif
3033         exit(0);
3034 }
3035 EOM
3036 if $cc -o gccvers gccvers.c; then
3037         gccversion=`./gccvers`
3038         case "$gccversion" in
3039         '') echo "You are not using GNU cc." ;;
3040         *)  echo "You are using GNU cc $gccversion." ;;
3041         esac
3042 else
3043         echo " "
3044         echo "*** WHOA THERE!!! ***" >&4
3045         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3046         case "$knowitall" in
3047         '')
3048         echo "    You'd better start hunting for one and let me know about it." >&4
3049                 exit 1
3050                 ;;
3051         esac
3052 fi
3053 $rm -f gccvers*
3054 case "$gccversion" in
3055 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3056 esac
3057
3058 : see how we invoke the C preprocessor
3059 echo " "
3060 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3061 cat <<'EOT' >testcpp.c
3062 #define ABC abc
3063 #define XYZ xyz
3064 ABC.XYZ
3065 EOT
3066 cd ..
3067 if test ! -f cppstdin; then
3068         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3069                 # AIX cc -E doesn't show the absolute headerfile
3070                 # locations but we'll cheat by using the -M flag.
3071                 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
3072         else
3073                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3074         fi
3075 else
3076         echo "Keeping your $hint cppstdin wrapper."
3077 fi
3078 chmod 755 cppstdin
3079 wrapper=`pwd`/cppstdin
3080 ok='false'
3081 cd UU
3082
3083 if $test "X$cppstdin" != "X" && \
3084         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3085         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3086 then
3087         echo "You used to use $cppstdin $cppminus so we'll use that again."
3088         case "$cpprun" in
3089         '') echo "But let's see if we can live without a wrapper..." ;;
3090         *)
3091                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3092                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3093                 then
3094                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3095                         ok='true'
3096                 else
3097                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3098                 fi
3099                 ;;
3100         esac
3101 else
3102         case "$cppstdin" in
3103         '') ;;
3104         *)
3105                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3106                 ;;
3107         esac
3108 fi
3109
3110 if $ok; then
3111         : nothing
3112 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3113         $cc -E <testcpp.c >testcpp.out 2>&1; \
3114         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3115         echo "Yup, it does."
3116         x_cpp="$cc -E"
3117         x_minus='';
3118 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3119         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3120         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3121         echo "Yup, it does."
3122         x_cpp="$cc -E"
3123         x_minus='-';
3124 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3125         $cc -P <testcpp.c >testcpp.out 2>&1; \
3126         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3127         echo "Yipee, that works!"
3128         x_cpp="$cc -P"
3129         x_minus='';
3130 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3131         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3132         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3133         echo "At long last!"
3134         x_cpp="$cc -P"
3135         x_minus='-';
3136 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3137         $cpp <testcpp.c >testcpp.out 2>&1; \
3138         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3139         echo "It works!"
3140         x_cpp="$cpp"
3141         x_minus='';
3142 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3143         $cpp - <testcpp.c >testcpp.out 2>&1; \
3144         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3145         echo "Hooray, it works!  I was beginning to wonder."
3146         x_cpp="$cpp"
3147         x_minus='-';
3148 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3149         $wrapper <testcpp.c >testcpp.out 2>&1; \
3150         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3151         x_cpp="$wrapper"
3152         x_minus=''
3153         echo "Eureka!"
3154 else
3155         dflt=''
3156         rp="No dice.  I can't find a C preprocessor.  Name one:"
3157         . ./myread
3158         x_cpp="$ans"
3159         x_minus=''
3160         $x_cpp <testcpp.c >testcpp.out 2>&1
3161         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3162                 echo "OK, that will do." >&4
3163         else
3164 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3165                 exit 1
3166         fi
3167 fi
3168
3169 case "$ok" in
3170 false)
3171         cppstdin="$x_cpp"
3172         cppminus="$x_minus"
3173         cpprun="$x_cpp"
3174         cpplast="$x_minus"
3175         set X $x_cpp
3176         shift
3177         case "$1" in
3178         "$cpp")
3179                 echo "Perhaps can we force $cc -E using a wrapper..."
3180                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3181                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3182                 then
3183                         echo "Yup, we can."
3184                         cppstdin="$wrapper"
3185                         cppminus='';
3186                 else
3187                         echo "Nope, we'll have to live without it..."
3188                 fi
3189                 ;;
3190         esac
3191         case "$cpprun" in
3192         "$wrapper")
3193                 cpprun=''
3194                 cpplast=''
3195                 ;;
3196         esac
3197         ;;
3198 esac
3199
3200 case "$cppstdin" in
3201 "$wrapper"|'cppstdin') ;;
3202 *) $rm -f $wrapper;;
3203 esac
3204 $rm -f testcpp.c testcpp.out
3205
3206 : decide how portable to be.  Allow command line overrides.
3207 case "$d_portable" in
3208 "$undef") ;;
3209 *)      d_portable="$define" ;;
3210 esac
3211
3212 : set up shell script to do ~ expansion
3213 cat >filexp <<EOSS
3214 $startsh
3215 : expand filename
3216 case "\$1" in
3217  ~/*|~)
3218         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3219         ;;
3220  ~*)
3221         if $test -f /bin/csh; then
3222                 /bin/csh -f -c "glob \$1"
3223                 failed=\$?
3224                 echo ""
3225                 exit \$failed
3226         else
3227                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3228                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3229                 if $test ! -d "\$dir"; then
3230                         me=\`basename \$0\`
3231                         echo "\$me: can't locate home directory for: \$name" >&2
3232                         exit 1
3233                 fi
3234                 case "\$1" in
3235                 */*)
3236                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3237                         ;;
3238                 *)
3239                         echo \$dir
3240                         ;;
3241                 esac
3242         fi
3243         ;;
3244 *)
3245         echo \$1
3246         ;;
3247 esac
3248 EOSS
3249 chmod +x filexp
3250 $eunicefix filexp
3251
3252 : now set up to get a file name
3253 cat <<EOS >getfile
3254 $startsh
3255 EOS
3256 cat <<'EOSC' >>getfile
3257 tilde=''
3258 fullpath=''
3259 already=''
3260 skip=''
3261 none_ok=''
3262 exp_file=''
3263 nopath_ok=''
3264 orig_rp="$rp"
3265 orig_dflt="$dflt"
3266 case "$gfpth" in
3267 '') gfpth='.' ;;
3268 esac
3269
3270 case "$fn" in
3271 *\(*)
3272         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3273         fn=`echo $fn | sed 's/(.*)//'`
3274         ;;
3275 esac
3276
3277 case "$fn" in
3278 *:*)
3279         loc_file=`expr $fn : '.*:\(.*\)'`
3280         fn=`expr $fn : '\(.*\):.*'`
3281         ;;
3282 esac
3283
3284 case "$fn" in
3285 *~*) tilde=true;;
3286 esac
3287 case "$fn" in
3288 */*) fullpath=true;;
3289 esac
3290 case "$fn" in
3291 *+*) skip=true;;
3292 esac
3293 case "$fn" in
3294 *n*) none_ok=true;;
3295 esac
3296 case "$fn" in
3297 *e*) exp_file=true;;
3298 esac
3299 case "$fn" in
3300 *p*) nopath_ok=true;;
3301 esac
3302
3303 case "$fn" in
3304 *f*) type='File';;
3305 *d*) type='Directory';;
3306 *l*) type='Locate';;
3307 esac
3308
3309 what="$type"
3310 case "$what" in
3311 Locate) what='File';;
3312 esac
3313
3314 case "$exp_file" in
3315 '')
3316         case "$d_portable" in
3317         "$define") ;;
3318         *) exp_file=true;;
3319         esac
3320         ;;
3321 esac
3322
3323 cd ..
3324 while test "$type"; do
3325         redo=''
3326         rp="$orig_rp"
3327         dflt="$orig_dflt"
3328         case "$tilde" in
3329         true) rp="$rp (~name ok)";;
3330         esac
3331         . UU/myread
3332         if test -f UU/getfile.ok && \
3333                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3334         then
3335                 value="$ans"
3336                 ansexp="$ans"
3337                 break
3338         fi
3339         case "$ans" in
3340         none)
3341                 value=''
3342                 ansexp=''
3343                 case "$none_ok" in
3344                 true) type='';;
3345                 esac
3346                 ;;
3347         *)
3348                 case "$tilde" in
3349                 '') value="$ans"
3350                         ansexp="$ans";;
3351                 *)
3352                         value=`UU/filexp $ans`
3353                         case $? in
3354                         0)
3355                                 if test "$ans" != "$value"; then
3356                                         echo "(That expands to $value on this system.)"
3357                                 fi
3358                                 ;;
3359                         *) value="$ans";;
3360                         esac
3361                         ansexp="$value"
3362                         case "$exp_file" in
3363                         '') value="$ans";;
3364                         esac
3365                         ;;
3366                 esac
3367                 case "$fullpath" in
3368                 true)
3369                         case "$ansexp" in
3370                         /*) value="$ansexp" ;;
3371                         *)
3372                                 redo=true
3373                                 case "$already" in
3374                                 true)
3375                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3376                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3377                                         ;;
3378                                 *)
3379                                 echo "Please give a full path name, starting with slash." >&4
3380                                         case "$tilde" in
3381                                         true)
3382                                 echo "Note that using ~name is ok provided it expands well." >&4
3383                                                 already=true
3384                                                 ;;
3385                                         esac
3386                                 esac
3387                                 ;;
3388                         esac
3389                         ;;
3390                 esac
3391                 case "$redo" in
3392                 '')
3393                         case "$type" in
3394                         File)
3395                                 for fp in $gfpth; do
3396                                         if test "X$fp" = X.; then
3397                                             pf="$ansexp"
3398                                         else    
3399                                             pf="$fp/$ansexp"
3400                                         fi
3401                                         if test -f "$pf"; then
3402                                                 type=''
3403                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3404                                         then
3405                                                 echo "($value is not a plain file, but that's ok.)"
3406                                                 type=''
3407                                         fi
3408                                         if test X"$type" = X; then
3409                                             value="$pf"
3410                                             break
3411                                         fi
3412                                 done
3413                                 ;;
3414                         Directory)
3415                                 for fp in $gfpth; do
3416                                         if test "X$fp" = X.; then
3417                                             pf="$ansexp"
3418                                         else    
3419                                             pf="$fp/$ansexp"
3420                                         fi
3421                                         if test -d "$pf"; then
3422                                                 type=''
3423                                                 value="$pf"
3424                                                 break
3425                                         fi
3426                                 done
3427                                 ;;
3428                         Locate)
3429                                 if test -d "$ansexp"; then
3430                                         echo "(Looking for $loc_file in directory $value.)"
3431                                         value="$value/$loc_file"
3432                                         ansexp="$ansexp/$loc_file"
3433                                 fi
3434                                 if test -f "$ansexp"; then
3435                                         type=''
3436                                 fi
3437                                 case "$nopath_ok" in
3438                                 true)   case "$value" in
3439                                         */*) ;;
3440                                         *)      echo "Assuming $value will be in people's path."
3441                                                 type=''
3442                                                 ;;
3443                                         esac
3444                                         ;;
3445                                 esac
3446                                 ;;
3447                         esac
3448
3449                         case "$skip" in
3450                         true) type='';
3451                         esac
3452
3453                         case "$type" in
3454                         '') ;;
3455                         *)
3456                                 if test "$fastread" = yes; then
3457                                         dflt=y
3458                                 else
3459                                         dflt=n
3460                                 fi
3461                                 rp="$what $value doesn't exist.  Use that name anyway?"
3462                                 . UU/myread
3463                                 dflt=''
3464                                 case "$ans" in
3465                                 y*) type='';;
3466                                 *) echo " ";;
3467                                 esac
3468                                 ;;
3469                         esac
3470                         ;;
3471                 esac
3472                 ;;
3473         esac
3474 done
3475 cd UU
3476 ans="$value"
3477 rp="$orig_rp"
3478 dflt="$orig_dflt"
3479 rm -f getfile.ok
3480 test "X$gfpthkeep" != Xy && gfpth=""
3481 EOSC
3482
3483 : What should the include directory be ?
3484 echo " "
3485 $echo $n "Hmm...  $c"
3486 dflt='/usr/include'
3487 incpath=''
3488 mips_type=''
3489 if $test -f /bin/mips && /bin/mips; then
3490         echo "Looks like a MIPS system..."
3491         $cat >usr.c <<'EOCP'
3492 #ifdef SYSTYPE_BSD43
3493 /bsd43
3494 #endif
3495 EOCP
3496         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3497                 dflt='/bsd43/usr/include'
3498                 incpath='/bsd43'
3499                 mips_type='BSD 4.3'
3500         else
3501                 mips_type='System V'
3502         fi
3503         $rm -f usr.c usr.out
3504         echo "and you're compiling with the $mips_type compiler and libraries."
3505         xxx_prompt=y
3506         echo "exit 0" >mips
3507 else
3508         echo "Doesn't look like a MIPS system."
3509         xxx_prompt=n
3510         echo "exit 1" >mips
3511 fi
3512 chmod +x mips
3513 $eunicefix mips
3514 case "$usrinc" in
3515 '') ;;
3516 *) dflt="$usrinc";;
3517 esac
3518 case "$xxx_prompt" in
3519 y)      fn=d/
3520         echo " "
3521         rp='Where are the include files you want to use?'
3522         . ./getfile
3523         usrinc="$ans"
3524         ;;
3525 *)      usrinc="$dflt"
3526         ;;
3527 esac
3528
3529 : Set private lib path
3530 case "$plibpth" in
3531 '') if ./mips; then
3532                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3533         fi;;
3534 esac
3535 case "$libpth" in
3536 ' ') dlist='';;
3537 '') dlist="$loclibpth $plibpth $glibpth";;
3538 *) dlist="$libpth";;
3539 esac
3540
3541 : Now check and see which directories actually exist, avoiding duplicates
3542 libpth=''
3543 for xxx in $dlist
3544 do
3545     if $test -d $xxx; then
3546                 case " $libpth " in
3547                 *" $xxx "*) ;;
3548                 *) libpth="$libpth $xxx";;
3549                 esac
3550     fi
3551 done
3552 $cat <<'EOM'
3553
3554 Some systems have incompatible or broken versions of libraries.  Among
3555 the directories listed in the question below, please remove any you
3556 know not to be holding relevant libraries, and add any that are needed.
3557 Say "none" for none.
3558
3559 EOM
3560 case "$libpth" in
3561 '') dflt='none';;
3562 *)
3563         set X $libpth
3564         shift
3565         dflt=${1+"$@"}
3566         ;;
3567 esac
3568 rp="Directories to use for library searches?"
3569 . ./myread
3570 case "$ans" in
3571 none) libpth=' ';;
3572 *) libpth="$ans";;
3573 esac
3574
3575 : compute shared library extension
3576 case "$so" in
3577 '')
3578         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3579                 dflt='sl'
3580         else
3581                 dflt='so'
3582         fi
3583         ;;
3584 *) dflt="$so";;
3585 esac
3586 $cat <<EOM
3587
3588 On some systems, shared libraries may be available.  Answer 'none' if
3589 you want to suppress searching of shared libraries for the remaining
3590 of this configuration.
3591
3592 EOM
3593 rp='What is the file extension used for shared libraries?'
3594 . ./myread
3595 so="$ans"
3596
3597 : Define several unixisms.
3598 : Hints files or command line option can be used to override them.
3599 : The convoluted testing is in case hints files set either the old
3600 : or the new name.
3601 case "$_exe" in
3602 '')     case "$exe_ext" in
3603     '') ;;
3604         *)      _exe="$exe_ext" ;;
3605         esac
3606         ;;
3607 esac
3608 case "$_a" in
3609 '')     case "$lib_ext" in
3610     '') _a='.a';;
3611         *)      _a="$lib_ext" ;;
3612         esac
3613         ;;
3614 esac
3615 case "$_o" in
3616 '') case "$obj_ext" in
3617         '')     _o='.o';;
3618         *)      _o="$obj_ext";;
3619         esac
3620         ;;
3621 esac
3622 case "$p_" in
3623 '') case "$path_sep" in
3624         '')     p_=':';;
3625         *)      p_="$path_sep";;
3626         esac
3627         ;;
3628 esac
3629 exe_ext=$_exe
3630 lib_ext=$_a
3631 obj_ext=$_o
3632 path_sep=$p_
3633
3634 : Which makefile gets called first.  This is used by make depend.
3635 case "$firstmakefile" in
3636 '') firstmakefile='makefile';;
3637 esac
3638
3639 cat <<EOM
3640
3641 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3642 Configure must be run with -Dusesocks.
3643
3644 Normally you do not need this and you should answer no.
3645
3646 EOM
3647 case "$usesocks" in
3648 $define|true|[yY]*)     dflt='y';;
3649 *) dflt='n';;
3650 esac
3651 rp='Build Perl for SOCKS?'
3652 . ./myread
3653 case "$ans" in
3654 y|Y)    val="$define" ;;     
3655 *)      val="$undef" ;;
3656 esac
3657 set usesocks
3658 eval $setvar
3659
3660 : Looking for optional libraries
3661 echo " "
3662 echo "Checking for optional libraries..." >&4
3663 case "$libs" in
3664 ' '|'') dflt='';;
3665 *) dflt="$libs";;
3666 esac
3667 case "$libswanted" in
3668 '') libswanted='c_s';;
3669 esac
3670 case "$usesocks" in
3671 $define)
3672         libswanted="$libswanted socks5 socks5_sh"
3673         ;;
3674 esac
3675 for thislib in $libswanted; do
3676         
3677         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3678                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3679                 echo "Found -l$thislib (shared)."
3680                 case " $dflt " in
3681                 *"-l$thislib "*);;
3682                 *) dflt="$dflt -l$thislib";;
3683                 esac
3684         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3685                 echo "Found -l$thislib (shared)."
3686                 case " $dflt " in
3687                 *"-l$thislib "*);;
3688                 *) dflt="$dflt -l$thislib";;
3689                 esac
3690         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3691                 echo "Found -l$thislib."
3692                 case " $dflt " in
3693                 *"-l$thislib "*);;
3694                 *) dflt="$dflt -l$thislib";;
3695                 esac
3696         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3697                 echo "Found -l$thislib."
3698                 case " $dflt " in
3699                 *"-l$thislib "*);;
3700                 *) dflt="$dflt -l$thislib";;
3701                 esac
3702         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3703                 echo "Found -l${thislib}_s."
3704                 case " $dflt " in
3705                 *"-l$thislib "*);;
3706                 *) dflt="$dflt -l${thislib}_s";;
3707                 esac
3708         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3709                 echo "Found -l$thislib."
3710                 case " $dflt " in
3711                 *"-l$thislib "*);;
3712                 *) dflt="$dflt -l$thislib";;
3713                 esac
3714         else
3715                 echo "No -l$thislib."
3716         fi
3717 done
3718 set X $dflt
3719 shift
3720 dflt="$*"
3721 case "$libs" in
3722 '') dflt="$dflt";;
3723 *) dflt="$libs";;
3724 esac
3725 case "$dflt" in
3726 ' '|'') dflt='none';;
3727 esac
3728
3729 $cat <<EOM
3730
3731 In order to compile $package on your machine, a number of libraries
3732 are usually needed.  Include any other special libraries here as well.
3733 Say "none" for none.  The default list is almost always right.
3734 EOM
3735
3736 echo " "
3737 rp="What libraries to use?"
3738 . ./myread
3739 case "$ans" in
3740 none) libs=' ';;
3741 *) libs="$ans";;
3742 esac
3743
3744 : determine optimization, if desired, or use for debug flag also
3745 case "$optimize" in
3746 ' '|$undef) dflt='none';;
3747 '') dflt='-O';;
3748 *) dflt="$optimize";;
3749 esac
3750 $cat <<EOH
3751
3752 By default, $package compiles with the -O flag to use the optimizer.
3753 Alternately, you might want to use the symbolic debugger, which uses
3754 the -g flag (on traditional Unix systems).  Either flag can be
3755 specified here.  To use neither flag, specify the word "none".
3756
3757 EOH
3758 rp="What optimizer/debugger flag should be used?"
3759 . ./myread
3760 optimize="$ans"
3761 case "$optimize" in
3762 'none') optimize=" ";;
3763 esac
3764
3765 dflt=''
3766 : We will not override a previous value, but we might want to
3767 : augment a hint file
3768 case "$hint" in
3769 default|recommended)
3770         case "$gccversion" in
3771         1*) dflt='-fpcc-struct-return' ;;
3772         esac
3773         case "$optimize" in
3774         *-g*) dflt="$dflt -DDEBUGGING";;
3775         esac
3776         case "$gccversion" in
3777         2*) if test -d /etc/conf/kconfig.d &&
3778                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3779                 then
3780                         dflt="$dflt -posix"
3781                 fi
3782                 ;;
3783         esac
3784         case "$gccversion" in
3785         1*) ;;
3786         2.[0-8]*) ;;
3787         ?*)     echo " "
3788                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3789                 echo 'int main(void) { return 0; }' > gcctest.c
3790                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3791                         echo "Yes, it does." 2>&1
3792                         case "$ccflags" in
3793                         *strict-aliasing*) 
3794                                 echo "Leaving current flags $ccflags alone." 2>&1
3795                                 ;;
3796                         *) dflt="$dflt -fno-strict-aliasing" ;;
3797                         esac
3798                 else
3799                         echo "Nope, it doesn't, but that's ok." 2>&1
3800                 fi
3801                 ;;
3802         esac
3803         ;;
3804 esac
3805
3806 case "$mips_type" in
3807 *BSD*|'') inclwanted="$locincpth $usrinc";;
3808 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3809 esac
3810 for thisincl in $inclwanted; do
3811         if $test -d $thisincl; then
3812                 if $test x$thisincl != x$usrinc; then
3813                         case "$dflt" in
3814                         *$thisincl*);;
3815                         *) dflt="$dflt -I$thisincl";;
3816                         esac
3817                 fi
3818         fi
3819 done
3820
3821 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3822         xxx=true;
3823 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3824         xxx=true;
3825 else
3826         xxx=false;
3827 fi;
3828 if $xxx; then
3829         case "$dflt" in
3830         *$2*);;
3831         *) dflt="$dflt -D$2";;
3832         esac;
3833 fi'
3834
3835 set signal.h LANGUAGE_C; eval $inctest
3836
3837 case "$usesocks" in
3838 $define)
3839         ccflags="$ccflags -DSOCKS"
3840         ;;
3841 esac
3842
3843 case "$hint" in
3844 default|recommended) dflt="$ccflags $dflt" ;;
3845 *) dflt="$ccflags";;
3846 esac
3847
3848 case "$dflt" in
3849 ''|' ') dflt=none;;
3850 esac
3851 $cat <<EOH
3852
3853 Your C compiler may want other flags.  For this question you should include
3854 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3855 but you should NOT include libraries or ld flags like -lwhatever.  If you
3856 want $package to honor its debug switch, you should include -DDEBUGGING here.
3857 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3858
3859 To use no flags, specify the word "none".
3860
3861 EOH
3862 set X $dflt
3863 shift
3864 dflt=${1+"$@"}
3865 rp="Any additional cc flags?"
3866 . ./myread
3867 case "$ans" in
3868 none) ccflags='';;
3869 *) ccflags="$ans";;
3870 esac
3871
3872 : the following weeds options from ccflags that are of no interest to cpp
3873 cppflags="$ccflags"
3874 case "$gccversion" in
3875 1*) cppflags="$cppflags -D__GNUC__"
3876 esac
3877 case "$mips_type" in
3878 '');;
3879 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3880 esac
3881 case "$cppflags" in
3882 '');;
3883 *)
3884         echo " "
3885         echo "Let me guess what the preprocessor flags are..." >&4
3886         set X $cppflags
3887         shift
3888         cppflags=''
3889         $cat >cpp.c <<'EOM'
3890 #define BLURFL foo
3891
3892 BLURFL xx LFRULB
3893 EOM
3894         previous=''
3895         for flag in $*
3896         do
3897                 case "$flag" in
3898                 -*) ftry="$flag";;
3899                 *) ftry="$previous $flag";;
3900                 esac
3901                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3902                         >cpp1.out 2>/dev/null && \
3903                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3904                         >cpp2.out 2>/dev/null && \
3905                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3906                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3907                 then
3908                         cppflags="$cppflags $ftry"
3909                         previous=''
3910                 else
3911                         previous="$flag"
3912                 fi
3913         done
3914         set X $cppflags
3915         shift
3916         cppflags=${1+"$@"}
3917         case "$cppflags" in
3918         *-*)  echo "They appear to be: $cppflags";;
3919         esac
3920         $rm -f cpp.c cpp?.out
3921         ;;
3922 esac
3923
3924 : flags used in final linking phase
3925 case "$ldflags" in
3926 '') if ./venix; then
3927                 dflt='-i -z'
3928         else
3929                 dflt=''
3930         fi
3931         case "$ccflags" in
3932         *-posix*) dflt="$dflt -posix" ;;
3933         esac
3934         ;;
3935 *) dflt="$ldflags";;
3936 esac
3937
3938 : Try to guess additional flags to pick up local libraries.
3939 for thislibdir in $libpth; do
3940         case " $loclibpth " in
3941         *" $thislibdir "*)
3942                 case "$dflt " in 
3943                 *"-L$thislibdir "*) ;;
3944                 *)  dflt="$dflt -L$thislibdir" ;;
3945                 esac
3946                 ;;
3947         esac
3948 done
3949
3950 case "$dflt" in
3951 '') dflt='none' ;;
3952 esac
3953
3954 $cat <<EOH
3955
3956 Your C linker may need flags.  For this question you should
3957 include -L/whatever and any other flags used by the C linker, but you
3958 should NOT include libraries like -lwhatever.
3959
3960 Make sure you include the appropriate -L/path flags if your C linker
3961 does not normally search all of the directories you specified above,
3962 namely
3963         $libpth
3964 To use no flags, specify the word "none".
3965
3966 EOH
3967
3968 rp="Any additional ld flags (NOT including libraries)?"
3969 . ./myread
3970 case "$ans" in
3971 none) ldflags='';;
3972 *) ldflags="$ans";;
3973 esac
3974 rmlist="$rmlist pdp11"
3975
3976 : coherency check
3977 echo " "
3978 echo "Checking your choice of C compiler and flags for coherency..." >&4
3979 $cat > try.c <<'EOF'
3980 #include <stdio.h>
3981 int main() { printf("Ok\n"); exit(0); }
3982 EOF
3983 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3984 shift
3985 $cat >try.msg <<'EOM'
3986 I've tried to compile and run the following simple program:
3987
3988 EOM
3989 $cat try.c >> try.msg
3990
3991 $cat >> try.msg <<EOM
3992
3993 I used the command:
3994
3995         $*
3996         ./try
3997
3998 and I got the following output:
3999
4000 EOM
4001 dflt=y
4002 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4003         if sh -c './try' >>try.msg 2>&1; then
4004                 xxx=`./try`
4005                 case "$xxx" in
4006                 "Ok") dflt=n ;;
4007                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4008                         case " $libs " in
4009                         *" -lsfio "*)
4010                                 cat >> try.msg <<'EOQS'
4011 If $libs contains -lsfio, and sfio is mis-configured, then it
4012 sometimes (apparently) runs and exits with a 0 status, but with no
4013 output!  It may have to do with sfio's use of _exit vs. exit.
4014
4015 EOQS
4016                                 rp="You have a big problem.  Shall I abort Configure"
4017                                 dflt=y
4018                                 ;;
4019                         esac
4020                         ;;
4021                 esac
4022         else
4023                 echo "The program compiled OK, but exited with status $?." >>try.msg
4024                 rp="You have a problem.  Shall I abort Configure"
4025                 dflt=y
4026         fi
4027 else
4028         echo "I can't compile the test program." >>try.msg
4029         rp="You have a BIG problem.  Shall I abort Configure"
4030         dflt=y
4031 fi
4032 case "$dflt" in
4033 y)
4034         $cat try.msg >&4
4035         case "$knowitall" in
4036         '')
4037                 echo "(The supplied flags or libraries might be incorrect.)"
4038                 ;;
4039         *) dflt=n;;
4040         esac
4041         echo " "
4042         . ./myread
4043         case "$ans" in
4044         n*|N*) ;;
4045         *)      echo "Ok.  Stopping Configure." >&4
4046                 exit 1
4047                 ;;
4048         esac
4049         ;;
4050 n) echo "OK, that should do.";;
4051 esac
4052 $rm -f try try.* core
4053
4054 : define an is-a-typedef? function
4055 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4056 case "$inclist" in
4057 "") inclist="sys/types.h";;
4058 esac;
4059 eval "varval=\$$var";
4060 case "$varval" in
4061 "")
4062         $rm -f temp.c;
4063         for inc in $inclist; do
4064                 echo "#include <$inc>" >>temp.c;
4065         done;
4066         echo "#ifdef $type" >> temp.c;
4067         echo "printf(\"We have $type\");" >> temp.c;
4068         echo "#endif" >> temp.c;
4069         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4070         if $contains $type temp.E >/dev/null 2>&1; then
4071                 eval "$var=\$type";
4072         else
4073                 eval "$var=\$def";
4074         fi;
4075         $rm -f temp.?;;
4076 *) eval "$var=\$varval";;
4077 esac'
4078
4079 : define an is-a-typedef? function that prompts if the type is not available.
4080 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4081 case "$inclist" in
4082 "") inclist="sys/types.h";;
4083 esac;
4084 eval "varval=\$$var";
4085 case "$varval" in
4086 "")
4087         $rm -f temp.c;
4088         for inc in $inclist; do
4089                 echo "#include <$inc>" >>temp.c;
4090         done;
4091         echo "#ifdef $type" >> temp.c;
4092         echo "printf(\"We have $type\");" >> temp.c;
4093         echo "#endif" >> temp.c;
4094         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4095         echo " " ;
4096         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4097         if $contains $type temp.E >/dev/null 2>&1; then
4098                 echo "$type found." >&4;
4099                 eval "$var=\$type";
4100         else
4101                 echo "$type NOT found." >&4;
4102                 dflt="$def";
4103                 . ./myread ;
4104                 eval "$var=\$ans";
4105         fi;
4106         $rm -f temp.?;;
4107 *) eval "$var=\$varval";;
4108 esac'
4109
4110 : define a shorthand compile call
4111 compile='
4112 mc_file=$1;
4113 shift;
4114 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4115 : define a shorthand compile call for compilations that should be ok.
4116 compile_ok='
4117 mc_file=$1;
4118 shift;
4119 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4120
4121 : check for lengths of integral types
4122 echo " "
4123 case "$intsize" in
4124 '')
4125         echo "Checking to see how big your integers are..." >&4
4126         $cat >intsize.c <<'EOCP'
4127 #include <stdio.h>
4128 int main()
4129 {
4130         printf("intsize=%d;\n", (int)sizeof(int));
4131         printf("longsize=%d;\n", (int)sizeof(long));
4132         printf("shortsize=%d;\n", (int)sizeof(short));
4133         exit(0);
4134 }
4135 EOCP
4136         set intsize
4137         if eval $compile_ok && ./intsize > /dev/null; then
4138                 eval `./intsize`
4139                 echo "Your integers are $intsize bytes long."
4140                 echo "Your long integers are $longsize bytes long."
4141                 echo "Your short integers are $shortsize bytes long."
4142         else
4143                 $cat >&4 <<EOM
4144 !
4145 Help! I can't compile and run the intsize test program: please enlighten me!
4146 (This is probably a misconfiguration in your system or libraries, and
4147 you really ought to fix it.  Still, I'll try anyway.)
4148 !
4149 EOM
4150                 dflt=4
4151                 rp="What is the size of an integer (in bytes)?"
4152                 . ./myread
4153                 intsize="$ans"
4154                 dflt=$intsize
4155                 rp="What is the size of a long integer (in bytes)?"
4156                 . ./myread
4157                 longsize="$ans"
4158                 dflt=2
4159                 rp="What is the size of a short integer (in bytes)?"
4160                 . ./myread
4161                 shortsize="$ans"
4162         fi
4163         ;;
4164 esac
4165 $rm -f intsize intsize.*
4166
4167 : see what type lseek is declared as in the kernel
4168 rp="What is the type used for lseek's offset on this system?"
4169 set off_t lseektype long stdio.h sys/types.h
4170 eval $typedef_ask
4171
4172 echo " "
4173 $echo $n "Checking to see how big your file offsets are...$c" >&4
4174 $cat >try.c <<EOCP
4175 #include <sys/types.h>
4176 #include <stdio.h>
4177 int main()
4178 {
4179     printf("%d\n", (int)sizeof($lseektype));
4180     return(0); 
4181 }
4182 EOCP
4183 set try
4184 if eval $compile_ok; then
4185         lseeksize=`./try`
4186         $echo " $lseeksize bytes." >&4
4187 else
4188         dflt=$longsize
4189         echo " "
4190         echo "(I can't seem to compile the test program.  Guessing...)"
4191         rp="What is the size of your file offsets (in bytes)?"
4192         . ./myread
4193         lseeksize="$ans"
4194 fi
4195 $rm -f try.c try
4196
4197 : see what type file positions are declared as in the library
4198 rp="What is the type for file position used by fsetpos()?"
4199 set fpos_t fpostype long stdio.h sys/types.h
4200 eval $typedef_ask
4201
4202 echo " "
4203 case "$fpostype" in
4204 *_t) zzz="$fpostype"    ;;
4205 *)   zzz="fpos_t"       ;;
4206 esac
4207 $echo $n "Checking the size of $zzz...$c" >&4 
4208 cat > try.c <<EOCP
4209 #include <sys/types.h>
4210 #include <stdio.h>
4211 int main() {
4212     printf("%d\n", (int)sizeof($fpostype));
4213     exit(0);
4214 }
4215 EOCP
4216 set try
4217 if eval $compile_ok; then
4218         yyy=`./try`
4219         case "$yyy" in
4220         '')     fpossize=4
4221                 echo " "
4222                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4223                 ;;
4224         *)      fpossize=$yyy
4225                 echo " $fpossize bytes."
4226                 ;;
4227         esac
4228 else
4229         dflt="$longsize"
4230         echo " "
4231         echo "(I can't compile the test program.  Guessing...)" >&4
4232         rp="What is the size of your file positions (in bytes)?"
4233         . ./myread
4234         fpossize="$ans"
4235 fi
4236
4237
4238
4239 case "$lseeksize:$fpossize" in
4240 8:8) cat <<EOM
4241
4242 You can have files larger than 2 gigabytes.
4243 EOM
4244    val="$define" ;;
4245 *) cat <<EOM
4246
4247 Perl can be built to understand large files (files larger than 2 gigabytes)
4248 on some systems.  To do so, Configure must be run with -Duselargefiles.
4249
4250 If this doesn't make any sense to you, just accept the default 'y'.
4251 EOM
4252    case "$uselargefiles" in
4253    "$undef"|false|[nN]*) dflt='n' ;;
4254    *)   dflt='y' ;;
4255    esac
4256    rp='Try to understand large files, if available?'
4257    . ./myread
4258    case "$ans" in
4259    y|Y)         val="$define" ;;
4260    *)           val="$undef"  ;;
4261    esac
4262    ;;
4263 esac
4264 set uselargefiles
4265 eval $setvar
4266 case "$uselargefiles" in
4267 "$define")
4268 : Look for a hint-file generated 'call-back-unit'.  If the
4269 : user has specified that a large files perl is to be built,
4270 : we may need to set or change some other defaults.
4271         if $test -f uselfs.cbu; then
4272                 echo "Your platform has some specific hints for large file builds, using them..."
4273                 . ./uselfs.cbu
4274                 echo " "
4275                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4276                 $cat >try.c <<EOCP
4277 #include <sys/types.h>
4278 #include <stdio.h>
4279 int main()
4280 {
4281     printf("%d\n", (int)sizeof($lseektype));
4282     return(0); 
4283 }
4284 EOCP
4285                 set try
4286                 if eval $compile_ok; then
4287                         lseeksize=`./try`
4288                         $echo " $lseeksize bytes." >&4
4289                 else
4290                         dflt="$lseeksize"
4291                         echo " "
4292                         echo "(I can't seem to compile the test program.  Guessing...)"
4293                         rp="What is the size of your file offsets (in bytes)?"
4294                         . ./myread
4295                         lseeksize="$ans"
4296                 fi
4297                 case "$fpostype" in
4298                 *_t) zzz="$fpostype"    ;;
4299                 *)   zzz="fpos_t"       ;;
4300                 esac
4301                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4302                 $cat > try.c <<EOCP
4303 #include <sys/types.h>
4304 #include <stdio.h>
4305 int main() {
4306     printf("%d\n", (int)sizeof($fpostype));
4307     exit(0);
4308 }
4309 EOCP
4310                 set try
4311                 if eval $compile_ok; then
4312                         yyy=`./try`
4313                         dflt="$lseeksize"
4314                         case "$yyy" in
4315                         '')     echo " "
4316                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4317                                 ;;
4318                         *)      fpossize=$yyy
4319                                 echo " $fpossize bytes."
4320                                 ;;
4321                         esac
4322                 else
4323                         dflt="$fpossize"
4324                         echo " "
4325                         echo "(I can't compile the test program.  Guessing...)" >&4
4326                         rp="What is the size of your file positions (in bytes)?"
4327                         . ./myread
4328                         fpossize="$ans"
4329                 fi
4330                 $rm -f try.c try
4331         fi
4332         ;;
4333 esac
4334
4335
4336 case "$usemorebits" in
4337 "$define"|true|[yY]*)
4338         use64bits="$define"
4339         uselongdouble="$define"
4340         usemorebits="$define"
4341         ;;
4342 *)      usemorebits="$undef"
4343         ;;
4344 esac
4345
4346
4347 case "$intsize:$longsize" in
4348 8:*|*:8) cat <<EOM
4349
4350 You have natively 64-bit integers.
4351 EOM
4352    val="$define" ;;
4353 *) cat <<EOM
4354
4355 Perl can be built to take advantage of 64-bit integer types
4356 on some systems.  To do so, Configure must be run with -Duse64bits.
4357
4358 If this doesn't make any sense to you, just accept the default.
4359 EOM
4360   case "$use64bits" in
4361   $define|true|[yY]*)   dflt='y';;
4362   *) dflt='n';;
4363   esac
4364   rp='Try to use 64-bit integers, if available?'
4365   . ./myread
4366   case "$ans" in
4367   y|Y) val="$define" ;;
4368   *)   val="$undef"  ;;
4369   esac
4370   ;;
4371 esac
4372 set use64bits
4373 eval $setvar
4374
4375 case "$archname64" in
4376 '') archname64='' ;;    # not a typo
4377 esac
4378
4379 case "$use64bits" in
4380 "$define"|true|[yY]*)
4381 : Look for a hint-file generated 'call-back-unit'.  If the
4382 : user has specified that a 64-bit perl is to be built,
4383 : we may need to set or change some other defaults.
4384         if $test -f use64bits.cbu; then
4385                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4386                 . ./use64bits.cbu
4387         else
4388                 $cat <<EOM
4389 (Your platform doesn't have any specific hints for 64-bit builds.)
4390 EOM
4391                 case "$intsize:$longsize" in
4392 8:*|*:8) cat <<EOM
4393 (This is probably okay, as your system is a natively 64-bit system.)
4394 EOM
4395                   ;;
4396                 esac
4397                 case "$gccversion" in
4398                 '')     ;;
4399                 *)      case "$ccflags" in
4400                         *-DUSE_LONG_LONG*) ;;
4401                         *) $cat <<EOM
4402 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4403 to the compilation flags.
4404 EOM
4405                            ccflags="$ccflags -DUSE_LONG_LONG"
4406                            ;;
4407                         esac
4408                         ;;
4409                 esac
4410         fi
4411         ;;
4412 esac
4413
4414 : determine the architecture name
4415 echo " "
4416 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4417         tarch=`arch`"-$osname"
4418 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4419         if uname -m > tmparch 2>&1 ; then
4420                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4421                         -e 's/$/'"-$osname/" tmparch`
4422         else
4423                 tarch="$osname"
4424         fi
4425         $rm -f tmparch
4426 else
4427         tarch="$osname"
4428 fi
4429 case "$myarchname" in
4430 ''|"$tarch") ;;
4431 *)
4432         echo "(Your architecture name used to be $myarchname.)"
4433         archname=''
4434         ;;
4435 esac
4436 myarchname="$tarch"
4437 case "$archname" in
4438 '') dflt="$tarch";;
4439 *) dflt="$archname";;
4440 esac
4441 rp='What is your architecture name'
4442 . ./myread
4443 archname="$ans"
4444 case "$usethreads" in
4445 $define)
4446         echo "Threads selected." >&4
4447         case "$archname" in
4448         *-thread*) echo "...and architecture name already has -thread." >&4
4449                 ;;
4450         *)      archname="$archname-thread"
4451                 echo "...setting architecture name to $archname." >&4
4452                 ;;
4453         esac
4454         ;;
4455 esac
4456 case "$usemultiplicity" in
4457 $define)
4458         echo "Multiplicity selected." >&4
4459         case "$archname" in
4460         *-multi*) echo "...and architecture name already has -multi." >&4
4461                 ;;
4462         *)      archname="$archname-multi"
4463                 echo "...setting architecture name to $archname." >&4
4464                 ;;
4465         esac
4466         ;;
4467 esac
4468 case "$use64bits" in
4469 $define)
4470         case "$archname64" in
4471         '')
4472                 ;;
4473         *)
4474                 case "$archname" in
4475                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4476                         ;;
4477                 *)      archname="$archname-$archname64"
4478                         echo "...setting architecture name to $archname." >&4
4479                         ;;
4480                 esac
4481                 ;;
4482         esac
4483 esac
4484
4485 : determine root of directory hierarchy where package will be installed.
4486 case "$prefix" in
4487 '')
4488         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4489         ;;
4490 *)
4491         dflt="$prefix"
4492         ;;
4493 esac
4494 $cat <<EOM
4495
4496 By default, $package will be installed in $dflt/bin, manual pages
4497 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4498 installation directories. Typically this is something like /usr/local.
4499 If you wish to have binaries under /usr/bin but other parts of the
4500 installation under /usr/local, that's ok: you will be prompted
4501 separately for each of the installation directories, the prefix being
4502 only used to set the defaults.
4503
4504 EOM
4505 fn=d~
4506 rp='Installation prefix to use?'
4507 . ./getfile
4508 oldprefix=''
4509 case "$prefix" in
4510 '') ;;
4511 *)
4512         case "$ans" in
4513         "$prefix") ;;
4514         *) oldprefix="$prefix";;
4515         esac
4516         ;;
4517 esac
4518 prefix="$ans"
4519 prefixexp="$ansexp"
4520
4521 : is AFS running?
4522 echo " "
4523 case "$afs" in
4524 $define|true)   afs=true ;;
4525 $undef|false)   afs=false ;;
4526 *)      if test -d /afs; then
4527                 afs=true
4528         else
4529                 afs=false
4530         fi
4531         ;;
4532 esac
4533 if $afs; then
4534         echo "AFS may be running... I'll be extra cautious then..." >&4
4535 else
4536         echo "AFS does not seem to be running..." >&4
4537 fi
4538
4539 : determine installation prefix for where package is to be installed.
4540 if $afs; then 
4541 $cat <<EOM
4542
4543 Since you are running AFS, I need to distinguish the directory in which
4544 files will reside from the directory in which they are installed (and from
4545 which they are presumably copied to the former directory by occult means).
4546
4547 EOM
4548         case "$installprefix" in
4549         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4550         *) dflt="$installprefix";;
4551         esac
4552 else
4553 $cat <<EOM
4554
4555 In some special cases, particularly when building $package for distribution,
4556 it is convenient to distinguish between the directory in which files should 
4557 be installed from the directory ($prefix) in which they 
4558 will eventually reside.  For most users, these two directories are the same.
4559
4560 EOM
4561         case "$installprefix" in
4562         '') dflt=$prefix ;;
4563         *) dflt=$installprefix;;
4564         esac
4565 fi
4566 fn=d~
4567 rp='What installation prefix should I use for installing files?'
4568 . ./getfile
4569 installprefix="$ans"
4570 installprefixexp="$ansexp"
4571
4572 : set the prefixit variable, to compute a suitable default value
4573 prefixit='case "$3" in
4574 ""|none)
4575         case "$oldprefix" in
4576         "") eval "$1=\"\$$2\"";;
4577         *)
4578                 case "$3" in
4579                 "") eval "$1=";;
4580                 none)
4581                         eval "tp=\"\$$2\"";
4582                         case "$tp" in
4583                         ""|" ") eval "$1=\"\$$2\"";;
4584                         *) eval "$1=";;
4585                         esac;;
4586                 esac;;
4587         esac;;
4588 *)
4589         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4590         case "$tp" in
4591         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4592         /*-$oldprefix/*|\~*-$oldprefix/*)
4593                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4594         *) eval "$1=\"\$$2\"";;
4595         esac;;
4596 esac'
4597
4598 : set the base revision
4599 baserev=5.0
4600
4601 : get the patchlevel
4602 echo " "
4603 echo "Getting the current patchlevel..." >&4
4604 if $test -r $rsrc/patchlevel.h;then
4605         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4606         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4607         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
4608 else
4609         patchlevel=0
4610         subversion=0
4611         apiversion=0
4612 fi
4613 $echo $n "(You have $package" $c
4614 case "$package" in
4615 "*$baserev")    ;;
4616 *)              $echo $n " $baserev" $c ;;
4617 esac
4618 $echo $n " patchlevel $patchlevel" $c
4619 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4620 echo ".)"
4621
4622 if test 0 -eq "$subversion"; then
4623         version=`LC_ALL=C; export LC_ALL; \
4624                  echo $baserev $patchlevel | \
4625                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
4626 else
4627         version=`LC_ALL=C; export LC_ALL; \
4628                  echo $baserev $patchlevel $subversion | \
4629                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
4630 fi
4631
4632 : determine installation style
4633 : For now, try to deduce it from prefix unless it is already set.
4634 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4635 case "$installstyle" in
4636 '')     case "$prefix" in
4637                 *perl*) dflt='lib';;
4638                 *) dflt='lib/perl5' ;;
4639         esac
4640         ;;
4641 *)      dflt='lib/perl5' ;;
4642 esac
4643 : Probably not worth prompting for this since we prompt for all
4644 : the directories individually, and the prompt would be too long and
4645 : confusing anyway.
4646 installstyle=$dflt
4647
4648 : determine where private library files go
4649 : Usual default is /usr/local/lib/perl5/$version.
4650 : Also allow things like /opt/perl/lib/$version, since 
4651 : /opt/perl/lib/perl5... would be redundant.
4652 : The default "style" setting is made in installstyle.U
4653 case "$installstyle" in
4654 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4655 *)       set dflt privlib lib/$version ;;
4656 esac
4657 eval $prefixit
4658 $cat <<EOM
4659
4660 There are some auxiliary files for $package that need to be put into a
4661 private library directory that is accessible by everyone.
4662
4663 EOM
4664 fn=d~+
4665 rp='Pathname where the private library files will reside?'
4666 . ./getfile
4667 privlib="$ans"
4668 privlibexp="$ansexp"
4669 : Change installation prefix, if necessary.
4670 if $test X"$prefix" != X"$installprefix"; then
4671         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4672 else
4673         installprivlib="$privlibexp"
4674 fi
4675
4676 : set the prefixup variable, to restore leading tilda escape
4677 prefixup='case "$prefixexp" in
4678 "$prefix") ;;
4679 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4680 esac'
4681
4682 : determine where public architecture dependent libraries go
4683 set archlib archlib
4684 eval $prefixit
4685 : privlib default is /usr/local/lib/$package/$version
4686 : archlib default is /usr/local/lib/$package/$version/$archname
4687 : privlib may have an optional trailing /share.
4688 tdflt=`echo $privlib | $sed 's,/share$,,'`
4689 tdflt=$tdflt/$archname
4690 case "$archlib" in
4691 '')     dflt=$tdflt
4692         ;;
4693 *)      dflt="$archlib"
4694     ;;
4695 esac
4696 $cat <<EOM
4697
4698 $spackage contains architecture-dependent library files.  If you are
4699 sharing libraries in a heterogeneous environment, you might store
4700 these files in a separate location.  Otherwise, you can just include
4701 them with the rest of the public library files.
4702
4703 EOM
4704 fn=d+~
4705 rp='Where do you want to put the public architecture-dependent libraries?'
4706 . ./getfile
4707 archlib="$ans"
4708 archlibexp="$ansexp"
4709 if $test X"$archlib" = X"$privlib"; then
4710         d_archlib="$undef"
4711 else
4712         d_archlib="$define"
4713 fi
4714 : Change installation prefix, if necessary.
4715 if $test X"$prefix" != X"$installprefix"; then
4716         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4717 else
4718         installarchlib="$archlibexp"
4719 fi
4720
4721
4722 : Binary compatibility with 5.005 is not possible for builds
4723 : with advanced features
4724 case "$usethreads$usemultiplicity" in
4725 *define*)
4726         bincompat5005="$undef"
4727         d_bincompat5005="$undef"
4728         ;;
4729 *)      $cat <<EOM
4730
4731 Perl 5.006 can be compiled for binary compatibility with 5.005.
4732 If you decide to do so, you will be able to continue using most
4733 of the extensions that were compiled for Perl 5.005.
4734
4735 EOM
4736         case "$bincompat5005$d_bincompat5005" in
4737         *"$undef"*) dflt=n ;;
4738         *) dflt=y ;;
4739         esac
4740         rp='Binary compatibility with Perl 5.005?'
4741         . ./myread
4742         case "$ans" in
4743         y*) val="$define" ;;
4744         *)  val="$undef" ;;
4745         esac
4746         set d_bincompat5005
4747         eval $setvar
4748         case "$d_bincompat5005" in
4749         "$define")
4750                 bincompat5005="$define"
4751                 ;;
4752         *)      bincompat5005="$undef"
4753                 d_bincompat5005="$undef"
4754                 ;;
4755         esac
4756         ;;
4757 esac
4758
4759
4760 : see if setuid scripts can be secure
4761 $cat <<EOM
4762
4763 Some kernels have a bug that prevents setuid #! scripts from being
4764 secure.  Some sites have disabled setuid #! scripts because of this.
4765
4766 First let's decide if your kernel supports secure setuid #! scripts.
4767 (If setuid #! scripts would be secure but have been disabled anyway,
4768 don't say that they are secure if asked.)
4769
4770 EOM
4771
4772 val="$undef"
4773 if $test -d /dev/fd; then
4774         echo "#!$ls" >reflect
4775         chmod +x,u+s reflect
4776         ./reflect >flect 2>&1
4777         if $contains "/dev/fd" flect >/dev/null; then
4778                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4779                 val="$define"
4780         else
4781                 $cat <<EOM
4782 If you are not sure if they are secure, I can check but I'll need a
4783 username and password different from the one you are using right now.
4784 If you don't have such a username or don't want me to test, simply
4785 enter 'none'.
4786
4787 EOM
4788                 rp='Other username to test security of setuid scripts with?'
4789                 dflt='none'
4790                 . ./myread
4791                 case "$ans" in
4792                 n|none)
4793                         case "$d_suidsafe" in
4794                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4795                                 dflt=n;;
4796                         "$undef")
4797                                 echo "Well, the $hint value is *not* secure." >&4
4798                                 dflt=n;;
4799                         *)      echo "Well, the $hint value *is* secure." >&4
4800                                 dflt=y;;
4801                         esac
4802                         ;;
4803                 *)
4804                         $rm -f reflect flect
4805                         echo "#!$ls" >reflect
4806                         chmod +x,u+s reflect
4807                         echo >flect
4808                         chmod a+w flect
4809                         echo '"su" will (probably) prompt you for '"$ans's password."
4810                         su $ans -c './reflect >flect'
4811                         if $contains "/dev/fd" flect >/dev/null; then
4812                                 echo "Okay, it looks like setuid scripts are secure." >&4
4813                                 dflt=y
4814                         else
4815                                 echo "I don't think setuid scripts are secure." >&4
4816                                 dflt=n
4817                         fi
4818                         ;;
4819                 esac
4820                 rp='Does your kernel have *secure* setuid scripts?'
4821                 . ./myread
4822                 case "$ans" in
4823                 [yY]*)  val="$define";;
4824                 *)      val="$undef";;
4825                 esac
4826         fi
4827 else
4828         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4829         echo "(That's for file descriptors, not floppy disks.)"
4830         val="$undef"
4831 fi
4832 set d_suidsafe
4833 eval $setvar
4834
4835 $rm -f reflect flect
4836
4837 : now see if they want to do setuid emulation
4838 echo " "
4839 val="$undef"
4840 case "$d_suidsafe" in
4841 "$define")
4842         val="$undef"
4843         echo "No need to emulate SUID scripts since they are secure here." >& 4
4844         ;;
4845 *)
4846         $cat <<EOM
4847 Some systems have disabled setuid scripts, especially systems where
4848 setuid scripts cannot be secure.  On systems where setuid scripts have
4849 been disabled, the setuid/setgid bits on scripts are currently
4850 useless.  It is possible for $package to detect those bits and emulate
4851 setuid/setgid in a secure fashion.  This emulation will only work if
4852 setuid scripts have been disabled in your kernel.
4853
4854 EOM
4855         case "$d_dosuid" in
4856         "$define") dflt=y ;;
4857         *) dflt=n ;;
4858         esac
4859         rp="Do you want to do setuid/setgid emulation?"
4860         . ./myread
4861         case "$ans" in
4862         [yY]*)  val="$define";;
4863         *)      val="$undef";;
4864         esac
4865         ;;
4866 esac
4867 set d_dosuid
4868 eval $setvar
4869
4870 : determine filename position in cpp output
4871 echo " "
4872 echo "Computing filename position in cpp output for #include directives..." >&4
4873 echo '#include <stdio.h>' > foo.c
4874 $cat >fieldn <<EOF
4875 $startsh
4876 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4877 $grep '^[       ]*#.*stdio\.h' | \
4878 while read cline; do
4879         pos=1
4880         set \$cline
4881         while $test \$# -gt 0; do
4882                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4883                         echo "\$pos"
4884                         exit 0
4885                 fi
4886                 shift
4887                 pos=\`expr \$pos + 1\`
4888         done
4889 done
4890 EOF
4891 chmod +x fieldn
4892 fieldn=`./fieldn`
4893 $rm -f foo.c fieldn
4894 case $fieldn in
4895 '') pos='???';;
4896 1) pos=first;;
4897 2) pos=second;;
4898 3) pos=third;;
4899 *) pos="${fieldn}th";;
4900 esac
4901 echo "Your cpp writes the filename in the $pos field of the line."
4902
4903 : locate header file
4904 $cat >findhdr <<EOF
4905 $startsh
4906 wanted=\$1
4907 name=''
4908 for usrincdir in $usrinc
4909 do
4910         if test -f \$usrincdir/\$wanted; then
4911                 echo "\$usrincdir/\$wanted"
4912                 exit 0
4913         fi
4914 done
4915 awkprg='{ print \$$fieldn }'
4916 echo "#include <\$wanted>" > foo\$\$.c
4917 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4918 $grep "^[       ]*#.*\$wanted" | \
4919 while read cline; do
4920         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4921         case "\$name" in
4922         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4923         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4924         *) exit 2;;
4925         esac;
4926 done;
4927 #
4928 # status = 0: grep returned 0 lines, case statement not executed
4929 # status = 1: headerfile found
4930 # status = 2: while loop executed, no headerfile found
4931 #
4932 status=\$?
4933 $rm -f foo\$\$.c;
4934 if test \$status -eq 1; then
4935         exit 0;
4936 fi
4937 exit 1
4938 EOF
4939 chmod +x findhdr
4940
4941 : define an alternate in-header-list? function
4942 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4943 cont=true; xxf="echo \"<\$1> found.\" >&4";
4944 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4945 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4946 esac;
4947 case $# in 4) instead=instead;; *) instead="at last";; esac;
4948 while $test "$cont"; do
4949         xxx=`./findhdr $1`
4950         var=$2; eval "was=\$$2";
4951         if $test "$xxx" && $test -r "$xxx";
4952         then eval $xxf;
4953         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4954                 cont="";
4955         else eval $xxnf;
4956         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4957         set $yyy; shift; shift; yyy=$@;
4958         case $# in 0) cont="";;
4959         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4960                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4961         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4962                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4963         esac;
4964 done;
4965 while $test "$yyy";
4966 do set $yyy; var=$2; eval "was=\$$2";
4967         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4968         set $yyy; shift; shift; yyy=$@;
4969 done'
4970
4971 : see if this is a malloc.h system
4972 set malloc.h i_malloc
4973 eval $inhdr
4974
4975 : see if stdlib is available
4976 set stdlib.h i_stdlib
4977 eval $inhdr
4978
4979 : determine which malloc to compile in
4980 echo " "
4981 case "$usemymalloc" in
4982 ''|[yY]*|true|$define)  dflt='y' ;;
4983 *)      dflt='n' ;;
4984 esac
4985 rp="Do you wish to attempt to use the malloc that comes with $package?"
4986 . ./myread
4987 usemymalloc="$ans"
4988 case "$ans" in
4989 y*|true)
4990         usemymalloc='y'
4991         mallocsrc='malloc.c'
4992         mallocobj="malloc$_o"
4993         d_mymalloc="$define"
4994         case "$libs" in
4995         *-lmalloc*)
4996                 : Remove malloc from list of libraries to use
4997                 echo "Removing unneeded -lmalloc from library list" >&4
4998                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4999                 shift
5000                 libs="$*"
5001                 echo "libs = $libs" >&4
5002                 ;;
5003         esac
5004         ;;
5005 *)
5006         usemymalloc='n'
5007         mallocsrc=''
5008         mallocobj=''
5009         d_mymalloc="$undef"
5010         ;;
5011 esac
5012
5013 : compute the return types of malloc and free
5014 echo " "
5015 $cat >malloc.c <<END
5016 #$i_malloc I_MALLOC
5017 #$i_stdlib I_STDLIB
5018 #include <stdio.h>
5019 #include <sys/types.h>
5020 #ifdef I_MALLOC
5021 #include <malloc.h>
5022 #endif
5023 #ifdef I_STDLIB
5024 #include <stdlib.h>
5025 #endif
5026 #ifdef TRY_MALLOC
5027 void *malloc();
5028 #endif
5029 #ifdef TRY_FREE
5030 void free();
5031 #endif
5032 END
5033 case "$malloctype" in
5034 '')
5035         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5036                 malloctype='void *'
5037         else
5038                 malloctype='char *'
5039         fi
5040         ;;
5041 esac
5042 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5043
5044 case "$freetype" in
5045 '')
5046         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5047                 freetype='void'
5048         else
5049                 freetype='int'
5050         fi
5051         ;;
5052 esac
5053 echo "Your system uses $freetype free(), it would seem." >&4
5054 $rm -f malloc.[co]
5055 $cat <<EOM
5056
5057 The installation process will also create a directory for
5058 vendor-supplied add-ons.  Vendors who supply perl with their system
5059 may find it convenient to place all vendor-supplied files in this
5060 directory rather than in the main distribution directory.  This will
5061 ease upgrades between binary-compatible maintenance versions of perl.
5062
5063 Of course you may also use these directories in whatever way you see
5064 fit.  For example, you might use them to access modules shared over a
5065 company-wide network.
5066
5067 The default answer should be fine for most people.
5068 This causes further questions about vendor add-ons to be skipped
5069 and no vendor-specific directories will be configured for perl.
5070
5071 EOM
5072 rp='Do you want to configure vendor-specific add-on directories?'
5073 case "$usevendorprefix" in
5074 define|true|[yY]*) dflt=y ;;
5075 *) dflt=n ;;
5076 esac
5077 . ./myread
5078 case "$ans" in
5079 [yY]*)  fn=d~+
5080         rp='Installation prefix to use for vendor-supplied add-ons?'
5081         case "$vendorprefix" in
5082         '') dflt='' ;;
5083         *)  dflt=$vendorprefix ;;
5084         esac
5085         . ./getfile
5086         oldvendorprefix=''
5087         case "$vendorprefix" in
5088         '') ;;
5089         *)      case "$ans" in
5090                 "$prefix") ;;
5091                 *) oldvendorprefix="$prefix";;
5092                 esac
5093                 ;;
5094         esac
5095         usevendorprefix="$define"
5096         vendorprefix="$ans"
5097         vendorprefixexp="$ansexp"
5098         ;;
5099 *)      usevendorprefix="$undef"
5100         vendorprefix=''
5101         vendorprefixexp=''
5102         ;;
5103 esac
5104
5105 case "$vendorprefix" in
5106 '')     d_vendorlib="$undef"
5107         vendorlib=''
5108         vendorlibexp=''
5109         ;;
5110 *)      d_vendorlib="$define"
5111         : determine where vendor-supplied modules go.
5112         : Usual default is /usr/local/lib/perl5/vendor_perl
5113         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5114         case "$installstyle" in
5115         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
5116         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
5117         esac
5118         fn=d~+
5119         rp='Pathname for the vendor-supplied library files?'
5120         . ./getfile
5121         vendorlib="$ans"
5122         vendorlibexp="$ansexp"
5123         : Change installation prefix, if necessary.
5124         if $test X"$prefix" != X"$installprefix"; then
5125                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5126         else
5127                 installvendorlib="$vendorlibexp"
5128         fi
5129         ;;
5130 esac
5131
5132 : Cruising for prototypes
5133 echo " "
5134 echo "Checking out function prototypes..." >&4
5135 $cat >prototype.c <<'EOCP'
5136 int main(int argc, char *argv[]) {
5137         exit(0);}
5138 EOCP
5139 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5140         echo "Your C compiler appears to support function prototypes."
5141         val="$define"
5142 else
5143         echo "Your C compiler doesn't seem to understand function prototypes."
5144         val="$undef"
5145 fi
5146 set prototype
5147 eval $setvar
5148 $rm -f prototype*
5149
5150 case "$prototype" in
5151 "$define") ;;
5152 *)      ansi2knr='ansi2knr'
5153         echo " "
5154         cat <<EOM >&4
5155
5156 $me:  FATAL ERROR:
5157 This version of $package can only be compiled by a compiler that 
5158 understands function prototypes.  Unfortunately, your C compiler 
5159         $cc $ccflags
5160 doesn't seem to understand them.  Sorry about that.
5161
5162 If GNU cc is available for your system, perhaps you could try that instead.  
5163
5164 Eventually, we hope to support building Perl with pre-ANSI compilers.
5165 If you would like to help in that effort, please contact <perlbug@perl.org>.
5166
5167 Aborting Configure now.
5168 EOM
5169         exit 2
5170         ;;
5171 esac
5172
5173 : determine where public executables go
5174 echo " "
5175 set dflt bin bin
5176 eval $prefixit
5177 fn=d~
5178 rp='Pathname where the public executables will reside?'
5179 . ./getfile
5180 if $test "X$ansexp" != "X$binexp"; then
5181         installbin=''
5182 fi
5183 bin="$ans"
5184 binexp="$ansexp"
5185 : Change installation prefix, if necessary.
5186 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5187 if $test X"$prefix" != X"$installprefix"; then
5188         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5189 else
5190         installbin="$binexp"
5191 fi
5192
5193 : determine whether to install perl also as /usr/bin/perl
5194
5195 echo " "
5196 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5197         $cat <<EOM
5198 Many scripts expect to perl to be installed as /usr/bin/perl.
5199 I can install the perl you are about to compile also as /usr/bin/perl
5200 (in addition to $installbin/perl).
5201 EOM
5202         case "$installusrbinperl" in
5203         "$undef"|[nN]*) dflt='n';;
5204         *)              dflt='y';;
5205         esac
5206         rp="Do you want to install perl as /usr/bin/perl?"
5207         . ./myread
5208         case "$ans" in
5209         [yY]*)  val="$define";;
5210         *)      val="$undef" ;;
5211         esac
5212 else
5213         val="$undef"
5214 fi
5215 set installusrbinperl
5216 eval $setvar
5217
5218 echo " "
5219 echo "Checking for GNU C Library..." >&4
5220 cat >gnulibc.c <<EOM
5221 #include <stdio.h>
5222 int main()
5223 {
5224 #ifdef __GLIBC__
5225     exit(0);
5226 #else
5227     exit(1);
5228 #endif
5229 }
5230 EOM
5231 set gnulibc
5232 if eval $compile_ok && ./gnulibc; then
5233         val="$define"
5234         echo "You are using the GNU C Library"
5235 else
5236         val="$undef"
5237         echo "You are not using the GNU C Library"
5238 fi
5239 $rm -f gnulibc*
5240 set d_gnulibc
5241 eval $setvar
5242
5243 : see if nm is to be used to determine whether a symbol is defined or not
5244 case "$usenm" in
5245 '')
5246         dflt=''
5247         case "$d_gnulibc" in
5248         "$define")
5249                 echo " "
5250                 echo "nm probably won't work on the GNU C Library." >&4
5251                 dflt=n
5252                 ;;
5253         esac
5254         case "$dflt" in
5255         '') 
5256                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5257                         echo " "
5258                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5259                         echo "'nm' won't be sufficient on this sytem." >&4
5260                         dflt=n
5261                 fi
5262                 ;;
5263         esac
5264         case "$dflt" in
5265         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5266                 if $test $dflt -gt 20; then
5267                         dflt=y
5268                 else
5269                         dflt=n
5270                 fi
5271                 ;;
5272         esac
5273         ;;
5274 *)
5275         case "$usenm" in
5276         true|$define) dflt=y;;
5277         *) dflt=n;;
5278         esac
5279         ;;
5280 esac
5281 $cat <<EOM
5282
5283 I can use $nm to extract the symbols from your C libraries. This
5284 is a time consuming task which may generate huge output on the disk (up
5285 to 3 megabytes) but that should make the symbols extraction faster. The
5286 alternative is to skip the 'nm' extraction part and to compile a small
5287 test program instead to determine whether each symbol is present. If
5288 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5289 this may be the best solution.
5290
5291 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5292
5293 EOM
5294 rp="Shall I use $nm to extract C symbols from the libraries?"
5295 . ./myread
5296 case "$ans" in
5297 [Nn]*) usenm=false;;
5298 *) usenm=true;;
5299 esac
5300
5301 runnm=$usenm
5302 case "$reuseval" in
5303 true) runnm=false;;
5304 esac
5305
5306 : nm options which may be necessary
5307 case "$nm_opt" in
5308 '') if $test -f /mach_boot; then
5309                 nm_opt=''       # Mach
5310         elif $test -d /usr/ccs/lib; then
5311                 nm_opt='-p'     # Solaris (and SunOS?)
5312         elif $test -f /dgux; then
5313                 nm_opt='-p'     # DG-UX
5314         elif $test -f /lib64/rld; then
5315                 nm_opt='-p'     # 64-bit Irix
5316         else
5317                 nm_opt=''
5318         fi;;
5319 esac
5320
5321 : nm options which may be necessary for shared libraries but illegal
5322 : for archive libraries.  Thank you, Linux.
5323 case "$nm_so_opt" in
5324 '')     case "$myuname" in
5325         *linux*)
5326                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5327                         nm_so_opt='--dynamic'
5328                 fi
5329                 ;;
5330         esac
5331         ;;
5332 esac
5333
5334 case "$runnm" in
5335 true)
5336 : get list of predefined functions in a handy place
5337 echo " "
5338 case "$libc" in
5339 '') libc=unknown
5340         case "$libs" in
5341         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5342         esac
5343         ;;
5344 esac
5345 libnames='';
5346 case "$libs" in
5347 '') ;;
5348 *)  for thislib in $libs; do
5349         case "$thislib" in
5350         -lc|-lc_s)
5351                 : Handle C library specially below.
5352                 ;;
5353         -l*)
5354                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5355                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5356                         :
5357                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5358                         :
5359                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5360                         :
5361                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5362                         :
5363                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5364                         :
5365                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5366                         :
5367                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5368                         :
5369                 else
5370                         try=''
5371                 fi
5372                 libnames="$libnames $try"
5373                 ;;
5374         *) libnames="$libnames $thislib" ;;
5375         esac
5376         done
5377         ;;
5378 esac
5379 xxx=normal
5380 case "$libc" in
5381 unknown)
5382         set /lib/libc.$so
5383         for xxx in $libpth; do
5384                 $test -r $1 || set $xxx/libc.$so
5385                 : The messy sed command sorts on library version numbers.
5386                 $test -r $1 || \
5387                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5388                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5389                                 h
5390                                 s/[0-9][0-9]*/0000&/g
5391                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5392                                 G
5393                                 s/\n/ /' | \
5394                          sort | $sed -e 's/^.* //'`
5395                 eval set \$$#
5396         done
5397         $test -r $1 || set /usr/ccs/lib/libc.$so
5398         $test -r $1 || set /lib/libsys_s$_a
5399         ;;
5400 *)
5401         set blurfl
5402         ;;
5403 esac
5404 if $test -r "$1"; then
5405         echo "Your (shared) C library seems to be in $1."
5406         libc="$1"
5407 elif $test -r /lib/libc && $test -r /lib/clib; then
5408         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5409         xxx=apollo
5410         libc='/lib/clib /lib/libc'
5411         if $test -r /lib/syslib; then
5412                 echo "(Your math library is in /lib/syslib.)"
5413                 libc="$libc /lib/syslib"
5414         fi
5415 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5416         echo "Your C library seems to be in $libc, as you said before."
5417 elif $test -r $incpath/usr/lib/libc$_a; then
5418         libc=$incpath/usr/lib/libc$_a;
5419         echo "Your C library seems to be in $libc.  That's fine."
5420 elif $test -r /lib/libc$_a; then
5421         libc=/lib/libc$_a;
5422         echo "Your C library seems to be in $libc.  You're normal."
5423 else
5424         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5425                 :
5426         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5427                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5428         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5429                 :
5430         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5431                 :
5432         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5433                 :
5434         else
5435                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5436         fi
5437         if $test -r "$tans"; then
5438                 echo "Your C library seems to be in $tans, of all places."
5439                 libc=$tans
5440         else
5441                 libc='blurfl'
5442         fi
5443 fi
5444 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5445         dflt="$libc"
5446         cat <<EOM
5447
5448 If the guess above is wrong (which it might be if you're using a strange
5449 compiler, or your machine supports multiple models), you can override it here.
5450
5451 EOM
5452 else
5453         dflt=''
5454         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5455         cat >&4 <<EOM
5456 I can't seem to find your C library.  I've looked in the following places:
5457
5458 EOM
5459         $sed 's/^/      /' libpath
5460         cat <<EOM
5461
5462 None of these seems to contain your C library. I need to get its name...
5463
5464 EOM
5465 fi
5466 fn=f
5467 rp='Where is your C library?'
5468 . ./getfile
5469 libc="$ans"
5470
5471 echo " "
5472 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5473 set X `cat libnames`
5474 shift
5475 xxx=files
5476 case $# in 1) xxx=file; esac
5477 echo "Extracting names from the following $xxx for later perusal:" >&4
5478 echo " "
5479 $sed 's/^/      /' libnames >&4
5480 echo " "
5481 $echo $n "This may take a while...$c" >&4
5482
5483 for file in $*; do
5484         case $file in
5485         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5486         *) $nm $nm_opt $file 2>/dev/null;;
5487         esac
5488 done >libc.tmp
5489
5490 $echo $n ".$c"
5491 $grep fprintf libc.tmp > libc.ptf
5492 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5493 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5494 xxx='[ADTSIW]'
5495 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5496         eval $xscan;\
5497         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5498                 eval $xrun
5499 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5500         eval $xscan;\
5501         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5502                 eval $xrun
5503 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5504         eval $xscan;\
5505         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5506                 eval $xrun
5507 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5508         eval $xscan;\
5509         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5510                 eval $xrun
5511 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5512         eval $xscan;\
5513         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5514                 eval $xrun
5515 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5516         eval $xscan;\
5517         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5518                 eval $xrun
5519 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5520                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5521         eval $xscan;\
5522         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5523                 eval $xrun
5524 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5525         eval $xscan;\
5526         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5527                 eval $xrun
5528 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5529         eval $xscan;\
5530         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5531                 eval $xrun
5532 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5533         eval $xscan;\
5534         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5535                 eval $xrun
5536 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5537         eval $xscan;\
5538         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5539                 eval $xrun
5540 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5541         eval $xscan;\
5542         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5543                 eval $xrun
5544 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5545         eval $xscan;\
5546         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5547                 eval $xrun
5548 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5549         eval $xscan;\
5550         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5551                 eval $xrun
5552 else
5553         $nm -p $* 2>/dev/null >libc.tmp
5554         $grep fprintf libc.tmp > libc.ptf
5555         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5556                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5557         then
5558                 nm_opt='-p'
5559                 eval $xrun
5560         else
5561                 echo " "
5562                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5563                 com=''
5564                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5565                         for thisname in $libnames $libc; do
5566                                 $ar t $thisname >>libc.tmp
5567                         done
5568                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5569                         echo "Ok." >&4
5570                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5571                         # Repeat libc to extract forwarders to DLL entries too
5572                         for thisname in $libnames $libc; do
5573                                 $ar tv $thisname >>libc.tmp
5574                                 # Revision 50 of EMX has bug in $ar.
5575                                 # it will not extract forwarders to DLL entries
5576                                 # Use emximp which will extract exactly them.
5577                                 emximp -o tmp.imp $thisname \
5578                                     2>/dev/null && \
5579                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5580                                     < tmp.imp >>libc.tmp
5581                                 $rm tmp.imp
5582                         done
5583                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5584                         echo "Ok." >&4
5585                 else
5586                         echo "$ar didn't seem to work right." >&4
5587                         echo "Maybe this is a Cray...trying bld instead..." >&4
5588                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5589                         then
5590                                 for thisname in $libnames; do
5591                                         bld t $libnames | \
5592                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5593                                         $ar t $thisname >>libc.tmp
5594                                 done
5595                                 echo "Ok." >&4
5596                         else
5597                                 echo "That didn't work either.  Giving up." >&4
5598                                 exit 1
5599                         fi
5600                 fi
5601         fi
5602 fi
5603 nm_extract="$com"
5604 if $test -f /lib/syscalls.exp; then
5605         echo " "
5606         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5607         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5608 fi
5609 ;;
5610 esac
5611 $rm -f libnames libpath
5612
5613 : see if dld is available
5614 set dld.h i_dld
5615 eval $inhdr
5616
5617 : is a C symbol defined?
5618 csym='tlook=$1;
5619 case "$3" in
5620 -v) tf=libc.tmp; tc=""; tdc="";;
5621 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5622 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5623 esac;
5624 tx=yes;
5625 case "$reuseval-$4" in
5626 true-) ;;
5627 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5628 esac;
5629 case "$tx" in
5630 yes)
5631         case "$runnm" in
5632         true)
5633                 if $contains $tlook $tf >/dev/null 2>&1;
5634                 then tval=true;
5635                 else tval=false;
5636                 fi;;
5637         *)
5638                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5639                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5640                 then tval=true;
5641                 else tval=false;
5642                 fi;
5643                 $rm -f t t.c;;
5644         esac;;
5645 *)
5646         case "$tval" in
5647         $define) tval=true;;
5648         *) tval=false;;
5649         esac;;
5650 esac;
5651 eval "$2=$tval"'
5652
5653 : define an is-in-libc? function
5654 inlibc='echo " "; td=$define; tu=$undef;
5655 sym=$1; var=$2; eval "was=\$$2";
5656 tx=yes;
5657 case "$reuseval$was" in
5658 true) ;;
5659 true*) tx=no;;
5660 esac;
5661 case "$tx" in
5662 yes)
5663         set $sym tres -f;
5664         eval $csym;
5665         case "$tres" in
5666         true)
5667                 echo "$sym() found." >&4;
5668                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5669         *)
5670                 echo "$sym() NOT found." >&4;
5671                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5672         esac;;
5673 *)
5674         case "$was" in
5675         $define) echo "$sym() found." >&4;;
5676         *) echo "$sym() NOT found." >&4;;
5677         esac;;
5678 esac'
5679
5680 : see if dlopen exists
5681 xxx_runnm="$runnm"
5682 runnm=false
5683 set dlopen d_dlopen
5684 eval $inlibc
5685 runnm="$xxx_runnm"
5686
5687 : determine which dynamic loading, if any, to compile in
5688 echo " "
5689 dldir="ext/DynaLoader"
5690 case "$usedl" in
5691 $define|y|true)
5692         dflt='y'
5693         usedl="$define"
5694         ;;
5695 $undef|n|false)
5696         dflt='n'
5697         usedl="$undef"
5698         ;;
5699 *) 
5700         dflt='n'
5701         case "$d_dlopen" in
5702             $define) dflt='y' ;;
5703         esac
5704         case "$i_dld" in
5705             $define) dflt='y' ;;
5706         esac
5707         : Does a dl_xxx.xs file exist for this operating system
5708         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5709         ;;
5710 esac
5711 rp="Do you wish to use dynamic loading?"
5712 . ./myread
5713 usedl="$ans"
5714 case "$ans" in
5715 y*) usedl="$define"
5716         case "$dlsrc" in
5717         '')
5718                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5719                         dflt="$dldir/dl_${osname}.xs"
5720                 elif $test "$d_dlopen" = "$define" ; then
5721                         dflt="$dldir/dl_dlopen.xs"
5722                 elif $test "$i_dld" = "$define" ; then
5723                         dflt="$dldir/dl_dld.xs"
5724                 else
5725                         dflt=''
5726                 fi
5727                 ;;
5728         *)      dflt="$dldir/$dlsrc"
5729                 ;;
5730         esac
5731     echo "The following dynamic loading files are available:"
5732         : Can not go over to $dldir because getfile has path hard-coded in.
5733         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5734         rp="Source file to use for dynamic loading"
5735         fn="fne"
5736         gfpth="$src"
5737         . ./getfile
5738         usedl="$define"
5739         : emulate basename
5740         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5741
5742         $cat << EOM
5743
5744 Some systems may require passing special flags to $cc -c to
5745 compile modules that will be used to create a shared library.
5746 To use no flags, say "none".
5747
5748 EOM
5749     case "$cccdlflags" in
5750     '') case "$gccversion" in
5751                 '') case "$osname" in
5752                         hpux)   dflt='+z' ;;
5753                         next)   dflt='none' ;;
5754                         irix*)  dflt='-KPIC' ;;
5755                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5756                         sunos)  dflt='-pic' ;;
5757                         *)      dflt='none' ;;
5758                     esac
5759                         ;;
5760                 *)  case "$osname" in
5761                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5762                         *)      dflt='-fpic' ;;
5763                     esac ;;
5764             esac ;;
5765         ' ') dflt='none' ;;
5766     *)  dflt="$cccdlflags" ;;
5767     esac
5768     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5769     . ./myread
5770     case "$ans" in
5771     none) cccdlflags=' ' ;;
5772     *) cccdlflags="$ans" ;;
5773     esac
5774
5775     cat << EOM
5776
5777 Some systems use ld to create libraries that can be dynamically loaded,
5778 while other systems (such as those using ELF) use $cc.
5779
5780 EOM
5781         case "$ld" in
5782         '')     $cat >try.c <<'EOM'
5783 /* Test for whether ELF binaries are produced */
5784 #include <fcntl.h>
5785 #include <stdlib.h>
5786 int main() {
5787         char b[4];
5788         int i = open("a.out",O_RDONLY);
5789         if(i == -1) 
5790                 exit(1); /* fail */
5791         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5792                 exit(0); /* succeed (yes, it's ELF) */
5793         else
5794                 exit(1); /* fail */
5795 }
5796 EOM
5797                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5798                         cat <<EOM
5799 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5800 EOM
5801                         dflt="$cc"
5802                 else
5803                         echo "I'll use ld to build dynamic libraries."
5804                         dflt='ld'
5805                 fi
5806                 rm -f try.c a.out
5807                 ;;
5808         *)      dflt="$ld"
5809                 ;;
5810         esac
5811
5812     rp="What command should be used to create dynamic libraries?"
5813     . ./myread
5814         ld="$ans"
5815
5816     cat << EOM
5817
5818 Some systems may require passing special flags to $ld to create a
5819 library that can be dynamically loaded.  If your ld flags include
5820 -L/other/path options to locate libraries outside your loader's normal
5821 search path, you may need to specify those -L options here as well.  To
5822 use no flags, say "none".
5823
5824 EOM
5825     case "$lddlflags" in
5826     '') case "$osname" in
5827                         beos) dflt='-nostart' ;;
5828                         hpux)  dflt='-b' ;;
5829                         linux|irix*)    dflt='-shared' ;;
5830                         next)  dflt='none' ;;
5831                         solaris) dflt='-G' ;;
5832                         sunos) dflt='-assert nodefinitions' ;;
5833                         svr4*|esix*) dflt="-G $ldflags" ;;
5834                 *)     dflt='none' ;;
5835                         esac
5836                         ;;
5837     *) dflt="$lddlflags" ;;
5838     esac
5839
5840         : Try to guess additional flags to pick up local libraries.
5841         : Be careful not to append to a plain 'none'
5842         case "$dflt" in
5843         none) dflt='' ;;
5844         esac
5845         for thisflag in $ldflags; do
5846                 case "$thisflag" in
5847                 -L*)
5848                         case " $dflt " in
5849                         *" $thisflag "*) ;;
5850                         *) dflt="$dflt $thisflag" ;;
5851                         esac
5852                         ;;
5853                 esac
5854         done
5855
5856         case "$dflt" in
5857         ''|' ') dflt='none' ;;
5858         esac
5859
5860     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5861     . ./myread
5862     case "$ans" in
5863     none) lddlflags=' ' ;;
5864     *) lddlflags="$ans" ;;
5865     esac
5866
5867         cat <<EOM
5868
5869 Some systems may require passing special flags to $cc to indicate that
5870 the resulting executable will use dynamic linking.  To use no flags,
5871 say "none".
5872
5873 EOM
5874     case "$ccdlflags" in
5875     '') case "$osname" in
5876                 hpux)   dflt='-Wl,-E' ;;
5877                 linux)  dflt='-rdynamic' ;;
5878                 next)   dflt='none' ;;
5879                 sunos)  dflt='none' ;;
5880                 *)      dflt='none' ;;
5881             esac ;;
5882     ' ')  dflt='none' ;;
5883     *)  dflt="$ccdlflags" ;;
5884     esac
5885     rp="Any special flags to pass to $cc to use dynamic loading?"
5886     . ./myread
5887     case "$ans" in
5888     none) ccdlflags=' ' ;;
5889     *) ccdlflags="$ans" ;;
5890     esac
5891     ;;
5892 *)  usedl="$undef"
5893         ld='ld'
5894     dlsrc='dl_none.xs'
5895     lddlflags=''
5896     ccdlflags=''
5897     ;;
5898 esac
5899
5900 also=''
5901 case "$usedl" in
5902 $undef)
5903         # No dynamic loading being used, so don't bother even to prompt.
5904         useshrplib='false'
5905         ;;
5906 *)      case "$useshrplib" in
5907         '')     case "$osname" in
5908                 svr4*|dgux|dynixptx|esix|powerux|beos)
5909                         dflt=y
5910                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5911                         ;;
5912                 next*)
5913                         case "$osvers" in
5914                         4*)     dflt=y
5915                                 also='Building a shared libperl is needed for MAB support.'
5916                                 ;;
5917                         *)      dflt=n
5918                                 ;;
5919                         esac
5920                         ;;
5921                 *)      dflt=n
5922                         ;;
5923                 esac
5924                 ;;
5925         $define|true|[Yy]*)
5926                 dflt=y
5927                 ;;
5928         *)      dflt=n
5929                 ;;
5930         esac
5931         $cat << EOM
5932
5933 The perl executable is normally obtained by linking perlmain.c with
5934 libperl${_a}, any static extensions (usually just DynaLoader), and
5935 any other libraries needed on this system (such as -lm, etc.).  Since
5936 your system supports dynamic loading, it is probably possible to build
5937 a shared libperl.$so.  If you will have more than one executable linked
5938 to libperl.$so, this will significantly reduce the size of each
5939 executable, but it may have a noticeable affect on performance.  The
5940 default is probably sensible for your system.
5941 $also
5942
5943 EOM
5944         rp="Build a shared libperl.$so (y/n)"
5945         . ./myread
5946         case "$ans" in
5947         true|$define|[Yy]*)
5948                 useshrplib='true'  ;;
5949         *)      useshrplib='false' ;;
5950         esac
5951         ;;
5952 esac
5953
5954 case "$useshrplib" in
5955 true)
5956         case "$libperl" in
5957         '')
5958                 # Figure out a good name for libperl.so.  Since it gets stored in
5959                 # a version-specific architecture-dependent library, the version
5960                 # number isn't really that important, except for making cc/ld happy.
5961                 #
5962                 # A name such as libperl.so.3.1
5963                 majmin="libperl.$so.$patchlevel.$subversion"
5964                 # A name such as libperl.so.301
5965                 majonly=`echo $patchlevel $subversion |
5966                         $awk '{printf "%d%02d", $1, $2}'`
5967                 majonly=libperl.$so.$majonly
5968                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5969                 # rely on figuring it out from the naming of libc.
5970                 case "${osname}${osvers}" in
5971                 next4*)
5972                         dflt=libperl.5.$so
5973                         # XXX How handle the --version stuff for MAB?
5974                         ;;
5975                 linux*)  # ld won't link with a bare -lperl otherwise.
5976                         dflt=libperl.$so
5977                         ;;
5978                 *)      # Try to guess based on whether libc has major.minor.
5979                         case "$libc" in
5980                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5981                         *libc.$so.[0-9]*) dflt=$majonly ;;
5982                         *)      dflt=libperl.$so ;;
5983                         esac
5984                         ;;
5985                 esac
5986                 ;;
5987         *)      dflt=$libperl
5988                 ;;
5989         esac
5990         cat << EOM
5991
5992 I need to select a good name for the shared libperl.  If your system uses
5993 library names with major and minor numbers, then you might want something
5994 like $majmin.  Alternatively, if your system uses a single version
5995 number for shared libraries, then you might want to use $majonly.
5996 Or, your system might be quite happy with a simple libperl.$so.
5997
5998 Since the shared libperl will get installed into a version-specific
5999 architecture-dependent directory, the version number of the shared perl
6000 library probably isn't important, so the default should be o.k.
6001
6002 EOM
6003         rp='What name do you want to give to the shared libperl?'
6004         . ./myread
6005         libperl=$ans
6006         echo "Ok, I'll use $libperl"
6007         ;;
6008 *)
6009         libperl="libperl${_a}"
6010         ;;
6011 esac
6012
6013 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6014 case "$shrpdir" in
6015 '') ;;
6016 *)      $cat >&4 <<EOM
6017 WARNING:  Use of the shrpdir variable for the installation location of
6018 the shared $libperl is not supported.  It was never documented and
6019 will not work in this version.  Let me (perlbug@perl.com)
6020 know of any problems this may cause.
6021
6022 EOM
6023         case "$shrpdir" in
6024         "$archlibexp/CORE")
6025                 $cat >&4 <<EOM
6026 But your current setting of $shrpdir is
6027 the default anyway, so it's harmless.
6028 EOM
6029                 ;;
6030         *)
6031                 $cat >&4 <<EOM
6032 Further, your current attempted setting of $shrpdir
6033 conflicts with the value of $archlibexp/CORE
6034 that installperl will use.
6035 EOM
6036                 ;;
6037         esac
6038         ;;
6039 esac
6040
6041 # How will the perl executable find the installed shared $libperl?
6042 # Add $xxx to ccdlflags.
6043 # If we can't figure out a command-line option, use $shrpenv to
6044 # set env LD_RUN_PATH.  The main perl makefile uses this.
6045 shrpdir=$archlibexp/CORE
6046 xxx=''
6047 tmp_shrpenv=''
6048 if "$useshrplib"; then
6049     case "$osname" in 
6050         aix)
6051                 # We'll set it in Makefile.SH...
6052                 ;;
6053         solaris|netbsd)
6054                 xxx="-R $shrpdir"
6055                 ;;
6056         freebsd)
6057                 xxx="-Wl,-R$shrpdir"
6058                 ;;
6059         linux|irix*|dec_osf)
6060                 xxx="-Wl,-rpath,$shrpdir"
6061                 ;;
6062         next)
6063                 # next doesn't like the default...
6064                 ;;
6065         beos)
6066                 # beos doesn't like the default, either.
6067                 ;;
6068         hpux*)
6069                 # hpux doesn't like the default, either.
6070                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6071                 ;;
6072         *)
6073                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6074                 ;;
6075         esac
6076         case "$xxx" in
6077         '') ;;
6078         *)      
6079                 # Only add $xxx if it isn't already in ccdlflags.
6080                 case " $ccdlflags " in
6081                 *" $xxx "*)     ;;
6082                 *)      ccdlflags="$ccdlflags $xxx"
6083                         cat <<EOM >&4
6084
6085 Adding $xxx to the flags
6086 passed to $ld so that the perl executable will find the 
6087 installed shared $libperl.
6088
6089 EOM
6090                         ;;
6091                 esac
6092                 ;;
6093         esac
6094 fi
6095 # Fix ccdlflags in AIX for building external extensions.
6096 # (For building Perl itself bare -bE:perl.exp is needed,
6097 #  Makefile.SH takes care of this.)
6098 case "$osname" in
6099 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6100 esac
6101 # Respect a hint or command-line value.
6102 case "$shrpenv" in
6103 '') shrpenv="$tmp_shrpenv" ;;
6104 esac
6105 case "$ldlibpthname" in
6106 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6107 none)   ldlibpthname='' ;;
6108 esac
6109
6110 : determine where manual pages go
6111 set man1dir man1dir none
6112 eval $prefixit
6113 $cat <<EOM
6114
6115 $spackage has manual pages available in source form.
6116 EOM
6117 case "$nroff" in
6118 nroff)
6119         echo "However, you don't have nroff, so they're probably useless to you."
6120         case "$man1dir" in
6121         '') man1dir="none";;
6122         esac;;
6123 esac
6124 echo "If you don't want the manual sources installed, answer 'none'."
6125 case "$man1dir" in
6126 ' ') dflt=none
6127         ;;
6128 '')
6129         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6130         lookpath="$lookpath $prefixexp/man/p_man/man1"
6131         lookpath="$lookpath $prefixexp/man/u_man/man1"
6132         lookpath="$lookpath $prefixexp/man/man.1"
6133         case "$sysman" in
6134         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6135         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6136         esac
6137         set dflt
6138         eval $prefixup
6139         ;;
6140 *)  dflt="$man1dir"
6141         ;;
6142 esac
6143 echo " "
6144 fn=dn+~
6145 rp="Where do the main $spackage manual pages (source) go?"
6146 . ./getfile
6147 if $test "X$man1direxp" != "X$ansexp"; then
6148         installman1dir=''
6149 fi
6150 man1dir="$ans"
6151 man1direxp="$ansexp"
6152 case "$man1dir" in
6153 '')     man1dir=' '
6154         installman1dir='';;
6155 esac
6156
6157 : Change installation prefix, if necessary.
6158 if $test X"$prefix" != X"$installprefix"; then
6159         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6160 else
6161         installman1dir="$man1direxp"
6162 fi
6163
6164 : What suffix to use on installed man pages
6165
6166 case "$man1dir" in
6167 ' ')
6168         man1ext='0'
6169         ;;
6170 *)
6171         rp="What suffix should be used for the main $spackage man pages?"
6172         case "$man1ext" in
6173         '')     case "$man1dir" in
6174                 *1)  dflt=1 ;;
6175                 *1p) dflt=1p ;;
6176                 *1pm) dflt=1pm ;;
6177                 *l) dflt=l;;
6178                 *n) dflt=n;;
6179                 *o) dflt=o;;
6180                 *p) dflt=p;;
6181                 *C) dflt=C;;
6182                 *L) dflt=L;;
6183                 *L1) dflt=L1;;
6184                 *) dflt=1;;
6185                 esac
6186                 ;;
6187         *)      dflt="$man1ext";;
6188         esac
6189         . ./myread
6190         man1ext="$ans"
6191         ;;
6192 esac
6193
6194 : see if we can have long filenames
6195 echo " "
6196 rmlist="$rmlist /tmp/cf$$"
6197 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6198 first=123456789abcdef
6199 second=/tmp/cf$$/$first
6200 $rm -f $first $second
6201 if (echo hi >$first) 2>/dev/null; then
6202         if $test -f 123456789abcde; then
6203                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6204                 val="$undef"
6205         else
6206                 if (echo hi >$second) 2>/dev/null; then
6207                         if $test -f /tmp/cf$$/123456789abcde; then
6208                                 $cat <<'EOM'
6209 That's peculiar... You can have filenames longer than 14 characters, but only
6210 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6211 I shall consider your system cannot support long filenames at all.
6212 EOM
6213                                 val="$undef"
6214                         else
6215                                 echo 'You can have filenames longer than 14 characters.' >&4
6216                                 val="$define"
6217                         fi
6218                 else
6219                         $cat <<'EOM'
6220 How confusing! Some of your filesystems are sane enough to allow filenames
6221 longer than 14 characters but some others like /tmp can't even think about them.
6222 So, for now on, I shall assume your kernel does not allow them at all.
6223 EOM
6224                         val="$undef"
6225                 fi
6226         fi
6227 else
6228         $cat <<'EOM'
6229 You can't have filenames longer than 14 chars.  You can't even think about them!
6230 EOM
6231         val="$undef"
6232 fi 
6233 set d_flexfnam
6234 eval $setvar
6235 $rm -rf /tmp/cf$$ 123456789abcde*
6236
6237 : determine where library module manual pages go
6238 set man3dir man3dir none
6239 eval $prefixit
6240 $cat <<EOM
6241
6242 $spackage has manual pages for many of the library modules.
6243 EOM
6244
6245 case "$nroff" in
6246 nroff)
6247         $cat <<'EOM'
6248 However, you don't have nroff, so they're probably useless to you.
6249 EOM
6250         case "$man3dir" in
6251         '') man3dir="none";;
6252         esac;;
6253 esac
6254
6255 case "$d_flexfnam" in
6256 undef)
6257         $cat <<'EOM'
6258 However, your system can't handle the long file names like File::Basename.3. 
6259 EOM
6260         case "$man3dir" in
6261         '') man3dir="none";;
6262         esac;;
6263 esac
6264
6265 echo "If you don't want the manual sources installed, answer 'none'."
6266 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6267 case "$man3dir" in
6268 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6269         if $test -d "$privlib/man/man3"; then
6270                 cat <<EOM >&4
6271
6272 WARNING:  Previous versions of perl installed man3 pages into
6273 $privlib/man/man3.  This version will suggest a 
6274 new default of $dflt.  
6275 EOM
6276                 tdflt=$dflt
6277                 dflt='n'
6278                 rp='Do you wish to preserve the old behavior?(y/n)'
6279                 . ./myread
6280                 case "$ans" in
6281                 y*) dflt="$privlib/man/man3" ;;
6282                 *)  dflt=$tdflt ;;
6283                 esac
6284     fi
6285         ;;
6286 ' ') dflt=none;;
6287 *)      dflt="$man3dir" ;;
6288 esac
6289 echo " "
6290 fn=dn+~
6291 rp="Where do the $package library man pages (source) go?"
6292 . ./getfile
6293 man3dir="$ans"
6294 man3direxp="$ansexp"
6295 case "$man1dir" in
6296 '')     man3dir=' '
6297         installman3dir='';;
6298 esac
6299
6300 : Change installation prefix, if necessary.
6301 if $test X"$prefix" != X"$installprefix"; then
6302         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6303 else
6304         installman3dir="$man3direxp"
6305 fi
6306
6307 : What suffix to use on installed man pages
6308 case "$man3dir" in
6309 ' ')
6310         man3ext='0'
6311         ;;
6312 *)
6313         rp="What suffix should be used for the $package library man pages?"
6314         case "$man3ext" in
6315         '')     case "$man3dir" in
6316                 *3)  dflt=3 ;;
6317                 *3p) dflt=3p ;;
6318                 *3pm) dflt=3pm ;;
6319                 *l) dflt=l;;
6320                 *n) dflt=n;;
6321                 *o) dflt=o;;
6322                 *p) dflt=p;;
6323                 *C) dflt=C;;
6324                 *L) dflt=L;;
6325                 *L3) dflt=L3;;
6326                 *) dflt=3;;
6327                 esac
6328                 ;;
6329         *)      dflt="$man3ext";;
6330         esac
6331         . ./myread
6332         man3ext="$ans"
6333         ;;
6334 esac
6335
6336 : see if we have to deal with yellow pages, now NIS.
6337 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6338         if $test -f /usr/etc/nibindd; then
6339                 echo " "
6340                 echo "I'm fairly confident you're on a NeXT."
6341                 echo " "
6342                 rp='Do you get the hosts file via NetInfo?'
6343                 dflt=y
6344                 case "$hostcat" in
6345                 nidump*) ;;
6346                 '') ;;
6347                 *) dflt=n;;
6348                 esac
6349                 . ./myread
6350                 case "$ans" in
6351                 y*) hostcat='nidump hosts .';;
6352                 *)      case "$hostcat" in
6353                         nidump*) hostcat='';;
6354                         esac
6355                         ;;
6356                 esac
6357         fi
6358         case "$hostcat" in
6359         nidump*) ;;
6360         *)
6361                 case "$hostcat" in
6362                 *ypcat*) dflt=y;;
6363                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6364                                 dflt=y
6365                         else
6366                                 dflt=n
6367                         fi;;
6368                 *) dflt=n;;
6369                 esac
6370                 echo " "
6371                 rp='Are you getting the hosts file via yellow pages?'
6372                 . ./myread
6373                 case "$ans" in
6374                 y*) hostcat='ypcat hosts';;
6375                 *) hostcat='cat /etc/hosts';;
6376                 esac
6377                 ;;
6378         esac
6379 fi
6380 case "$hostcat" in
6381 '') hostcat='cat /etc/hosts';;
6382 esac
6383 case "$groupcat" in
6384 '') groupcat='cat /etc/group';;
6385 esac
6386 case "$passcat" in
6387 '') passcat='cat /etc/passwd';;
6388 esac
6389
6390 : now get the host name
6391 echo " "
6392 echo "Figuring out host name..." >&4
6393 case "$myhostname" in
6394 '') cont=true
6395         echo 'Maybe "hostname" will work...'
6396         if tans=`sh -c hostname 2>&1` ; then
6397                 myhostname=$tans
6398                 phostname=hostname
6399                 cont=''
6400         fi
6401         ;;
6402 *) cont='';;
6403 esac
6404 if $test "$cont"; then
6405         if ./xenix; then
6406                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6407                 if tans=`cat /etc/systemid 2>&1` ; then
6408                         myhostname=$tans
6409                         phostname='cat /etc/systemid'
6410                         echo "Whadyaknow.  Xenix always was a bit strange..."
6411                         cont=''
6412                 fi
6413         elif $test -r /etc/systemid; then
6414                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6415         fi
6416 fi
6417 if $test "$cont"; then
6418         echo 'No, maybe "uuname -l" will work...'
6419         if tans=`sh -c 'uuname -l' 2>&1` ; then
6420                 myhostname=$tans
6421                 phostname='uuname -l'
6422         else
6423                 echo 'Strange.  Maybe "uname -n" will work...'
6424                 if tans=`sh -c 'uname -n' 2>&1` ; then
6425                         myhostname=$tans
6426                         phostname='uname -n'
6427                 else
6428                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6429                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6430                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6431                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6432                         else
6433                                 case "$myhostname" in
6434                                 '') echo "Does this machine have an identity crisis or something?"
6435                                         phostname='';;
6436                                 *)
6437                                         echo "Well, you said $myhostname before..."
6438                                         phostname='echo $myhostname';;
6439                                 esac
6440                         fi
6441                 fi
6442         fi
6443 fi
6444 : you do not want to know about this
6445 set $myhostname
6446 myhostname=$1
6447
6448 : verify guess
6449 if $test "$myhostname" ; then
6450         dflt=y
6451         rp='Your host name appears to be "'$myhostname'".'" Right?"
6452         . ./myread
6453         case "$ans" in
6454         y*) ;;
6455         *) myhostname='';;
6456         esac
6457 fi
6458
6459 : bad guess or no guess
6460 while $test "X$myhostname" = X ; do
6461         dflt=''
6462         rp="Please type the (one word) name of your host:"
6463         . ./myread
6464         myhostname="$ans"
6465 done
6466
6467 : translate upper to lower if necessary
6468 case "$myhostname" in
6469 *[A-Z]*)
6470         echo "(Normalizing case in your host name)"
6471         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6472         ;;
6473 esac
6474
6475 case "$myhostname" in
6476 *.*)
6477         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6478         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6479         echo "(Trimming domain name from host name--host name is now $myhostname)"
6480         ;;
6481 *) case "$mydomain" in
6482         '')
6483                 {
6484                         test "X$hostcat" = "Xypcat hosts" &&
6485                         ypmatch "$myhostname" hosts 2>/dev/null |\
6486                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6487                         $test -s hosts
6488                 } || {
6489                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6490                                         /[       ]$myhostname[  . ]/p" > hosts
6491                 }
6492                 tmp_re="[       . ]"
6493                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6494                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6495                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6496                         hosts | $sort | $uniq | \
6497                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6498                 case `$echo X$dflt` in
6499                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6500                         dflt=.
6501                         ;;
6502                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6503                         ;;
6504                 esac
6505                 case "$dflt" in
6506                 .)
6507                         tans=`./loc resolv.conf X /etc /usr/etc`
6508                         if $test -f "$tans"; then
6509                                 echo "(Attempting domain name extraction from $tans)"
6510                                 dflt=.`$sed -n -e 's/   / /g' \
6511                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6512                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6513                                 case "$dflt" in
6514                                 .) dflt=.`$sed -n -e 's/        / /g' \
6515                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6516                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6517                                         ;;
6518                                 esac
6519                         fi
6520                         ;;
6521                 esac
6522                 case "$dflt" in
6523                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6524                         dflt=.`sh -c domainname 2>/dev/null`
6525                         case "$dflt" in
6526                         '') dflt='.';;
6527                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6528                         esac
6529                         ;;
6530                 esac
6531                 case "$dflt" in
6532                 .) echo "(Lost all hope -- silly guess then)"
6533                         dflt='.uucp'
6534                         ;;
6535                 esac
6536                 $rm -f hosts
6537                 ;;
6538         *) dflt="$mydomain";;
6539         esac;;
6540 esac
6541 echo " "
6542 rp="What is your domain name?"
6543 . ./myread
6544 tans="$ans"
6545 case "$ans" in
6546 '') ;;
6547 .*) ;;
6548 *) tans=".$tans";;
6549 esac
6550 mydomain="$tans"
6551
6552 : translate upper to lower if necessary
6553 case "$mydomain" in
6554 *[A-Z]*)
6555         echo "(Normalizing case in your domain name)"
6556         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6557         ;;
6558 esac
6559
6560 : a little sanity check here
6561 case "$phostname" in
6562 '') ;;
6563 *)
6564         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6565         $myhostname$mydomain|$myhostname) ;;
6566         *)
6567                 case "$phostname" in
6568                 sed*)
6569                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6570                         ;;
6571                 *)
6572                         echo "(That doesn't agree with your $phostname command, by the way.)"
6573                         ;;
6574                 esac
6575         ;;
6576         esac
6577         ;;
6578 esac
6579
6580 $cat <<EOM
6581
6582 I need to get your e-mail address in Internet format if possible, i.e.
6583 something like user@host.domain. Please answer accurately since I have
6584 no easy means to double check it. The default value provided below
6585 is most probably close to the reality but may not be valid from outside
6586 your organization...
6587
6588 EOM
6589 cont=x
6590 while test "$cont"; do
6591         case "$cf_email" in
6592         '') dflt="$cf_by@$myhostname$mydomain";;
6593         *) dflt="$cf_email";;
6594         esac
6595         rp='What is your e-mail address?'
6596         . ./myread
6597         cf_email="$ans"
6598         case "$cf_email" in
6599         *@*.*) cont='' ;;
6600         *)
6601                 rp='Address does not look like an Internet one.  Use it anyway?'
6602                 case "$fastread" in
6603                 yes) dflt=y ;;
6604                 *) dflt=n ;;
6605                 esac
6606                 . ./myread
6607                 case "$ans" in
6608                 y*) cont='' ;;
6609                 *) echo " " ;;
6610                 esac
6611                 ;;
6612         esac
6613 done
6614
6615 $cat <<EOM
6616
6617 If you or somebody else will be maintaining perl at your site, please
6618 fill in the correct e-mail address here so that they may be contacted
6619 if necessary. Currently, the "perlbug" program included with perl
6620 will send mail to this address in addition to perlbug@perl.com. You may
6621 enter "none" for no administrator.
6622
6623 EOM
6624 case "$perladmin" in
6625 '') dflt="$cf_email";;
6626 *) dflt="$perladmin";;
6627 esac
6628 rp='Perl administrator e-mail address'
6629 . ./myread
6630 perladmin="$ans"
6631
6632 : figure out how to guarantee perl startup
6633 case "$startperl" in
6634 '')
6635         case "$sharpbang" in
6636         *!)
6637                 $cat <<EOH
6638
6639 I can use the #! construct to start perl on your system. This will
6640 make startup of perl scripts faster, but may cause problems if you
6641 want to share those scripts and perl is not in a standard place
6642 ($binexp/perl) on all your platforms. The alternative is to force
6643 a shell by starting the script with a single ':' character.
6644
6645 EOH
6646                 dflt="$binexp/perl"
6647                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6648                 . ./myread
6649                 case "$ans" in
6650                 none)   startperl=": # use perl";;
6651                 *)      startperl="#!$ans"
6652                         if $test 30 -lt `echo "$ans" | wc -c`; then
6653                                 $cat >&4 <<EOM
6654
6655 WARNING:  Some systems limit the #! command to 32 characters.
6656 If you experience difficulty running Perl scripts with #!, try
6657 installing Perl in a directory with a shorter pathname.
6658
6659 EOM
6660                         fi ;;
6661                 esac
6662                 ;;
6663         *) startperl=": # use perl"
6664                 ;;
6665         esac
6666         ;;
6667 esac
6668 echo "I'll use $startperl to start perl scripts."
6669
6670 : figure best path for perl in scripts
6671 case "$perlpath" in
6672 '')
6673         perlpath="$binexp/perl"
6674         case "$startperl" in
6675         *!*) ;;
6676         *)
6677                 $cat <<EOH
6678
6679 I will use the "eval 'exec'" idiom to start Perl on your system.
6680 I can use the full path of your Perl binary for this purpose, but
6681 doing so may cause problems if you want to share those scripts and
6682 Perl is not always in a standard place ($binexp/perl).
6683
6684 EOH
6685                 dflt="$binexp/perl"
6686                 rp="What path shall I use in \"eval 'exec'\"?"
6687                 . ./myread
6688                 perlpath="$ans"
6689                 ;;
6690         esac
6691         ;;
6692 esac
6693 case "$startperl" in
6694 *!*)    ;;
6695 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6696 esac
6697
6698 : determine where public executable scripts go
6699 set scriptdir scriptdir
6700 eval $prefixit
6701 case "$scriptdir" in
6702 '')
6703         dflt="$bin"
6704         : guess some guesses
6705         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6706         $test -d /usr/share/bin     && dflt=/usr/share/bin
6707         $test -d /usr/local/script  && dflt=/usr/local/script
6708         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6709         $test -d $prefixexp/script  && dflt=$prefixexp/script
6710         set dflt
6711         eval $prefixup
6712         ;;
6713 *)  dflt="$scriptdir"
6714         ;;
6715 esac
6716 $cat <<EOM
6717  
6718 Some installations have a separate directory just for executable scripts so
6719 that they can mount it across multiple architectures but keep the scripts in
6720 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6721 Or you might just lump your scripts in with all your other executables.
6722  
6723 EOM
6724 fn=d~
6725 rp='Where do you keep publicly executable scripts?'
6726 . ./getfile
6727 if $test "X$ansexp" != "X$scriptdirexp"; then
6728         installscript=''
6729 fi
6730 scriptdir="$ans"
6731 scriptdirexp="$ansexp"
6732 : Change installation prefix, if necessary.
6733 if $test X"$prefix" != X"$installprefix"; then
6734         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6735 else
6736         installscript="$scriptdirexp"
6737 fi
6738
6739 $cat <<EOM
6740
6741 After $package is installed, you may wish to install various
6742 add-on modules and utilities.  Typically, these add-ons will
6743 be installed under $prefix with the rest
6744 of this package.  However, you may wish to install such add-ons
6745 elsewhere under a different prefix.
6746
6747 If you do not wish to put everything under a single prefix, that's
6748 ok.  You will be prompted for the individual locations; this siteprefix
6749 is only used to suggest the defaults.
6750
6751 The default should be fine for most people.
6752
6753 EOM
6754 fn=d~+
6755 rp='Installation prefix to use for add-on modules and utilities?'
6756 : XXX Here might be another good place for an installstyle setting.
6757 case "$siteprefix" in
6758 '') dflt=$prefix ;;
6759 *)  dflt=$siteprefix ;;
6760 esac
6761 . ./getfile
6762 oldsiteprefix=''
6763 case "$siteprefix" in
6764 '') ;;
6765 *)
6766         case "$ans" in
6767         "$prefix") ;;
6768         *) oldsiteprefix="$prefix";;
6769         esac
6770         ;;
6771 esac
6772 siteprefix="$ans"
6773 siteprefixexp="$ansexp"
6774
6775 : determine where site specific libraries go.
6776 : Usual default is /usr/local/lib/perl5/site_perl
6777 : The default "style" setting is made in installstyle.U
6778 : XXX No longer works with Prefixit stuff.
6779 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6780 case "$installstyle" in
6781 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6782 *)       dflt=$siteprefix/lib/site_$prog ;;
6783 esac
6784 $cat <<EOM
6785
6786 The installation process will create a directory for
6787 site-specific extensions and modules.  Most users find it convenient
6788 to place all site-specific files in this directory rather than in the
6789 main distribution directory.
6790
6791 EOM
6792 fn=d~+
6793 rp='Pathname for the site-specific library files?'
6794 . ./getfile
6795 sitelib="$ans"
6796 sitelibexp="$ansexp"
6797 : Change installation prefix, if necessary.
6798 if $test X"$prefix" != X"$installprefix"; then
6799         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6800 else
6801         installsitelib="$sitelibexp"
6802 fi
6803
6804 : determine where site specific architecture-dependent libraries go.
6805 : sitelib  default is /usr/local/lib/perl5/site_perl/
6806 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6807 : sitelib may have an optional trailing /share.
6808 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6809 tdflt="$tdflt/$apiversion/$archname"
6810 set sitearch sitearch none
6811 eval $prefixit
6812 case "$sitearch" in
6813 '')     dflt="$tdflt" ;;
6814 *)      dflt="$sitearch" ;;
6815 esac
6816 $cat <<EOM
6817
6818 The installation process will also create a directory for
6819 architecture-dependent site-specific extensions and modules.
6820
6821 EOM
6822 fn=nd~+
6823 rp='Pathname for the site-specific architecture-dependent library files?'
6824 . ./getfile
6825 sitearch="$ans"
6826 sitearchexp="$ansexp"
6827 : Change installation prefix, if necessary.
6828 if $test X"$prefix" != X"$installprefix"; then
6829         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6830 else
6831         installsitearch="$sitearchexp"
6832 fi
6833
6834 : determine where add-on public executables go
6835 case "$sitebin" in
6836 '')     dflt=$siteprefix/bin ;;
6837 *)      dflt=$sitebin ;;
6838 esac
6839 fn=d~
6840 rp='Pathname where the add-on public executables should be installed?'
6841 . ./getfile
6842 sitebin="$ans"
6843 sitebinexp="$ansexp"
6844 : Change installation prefix, if necessary.
6845 if $test X"$prefix" != X"$installprefix"; then
6846         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6847 else
6848         installsitebin="$sitebinexp"
6849 fi
6850
6851 cat <<EOM
6852
6853 Perl can be built to take advantage of long doubles which
6854 (if available) may give more accuracy and range for floating point numbers.
6855
6856 If this doesn't make any sense to you, just accept the default 'n'.
6857 EOM
6858
6859 case "$ccflags" in
6860 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6861 esac
6862
6863 case "$uselongdouble" in
6864 $define|true|[yY]*)     dflt='y';;
6865 *) dflt='n';;
6866 esac
6867 rp='Try to use long doubles if available?'
6868 . ./myread
6869 case "$ans" in
6870 y|Y)    val="$define"   ;;
6871 *)      val="$undef"    ;;
6872 esac
6873 set uselongdouble
6874 eval $setvar
6875
6876 case "$uselongdouble" in
6877 true|[yY]*) uselongdouble="$define" ;;
6878 esac
6879
6880 case "$uselongdouble" in
6881 $define)
6882 : Look for a hint-file generated 'call-back-unit'.  If the
6883 : user has specified that long doubles should be used,
6884 : we may need to set or change some other defaults.
6885         if $test -f uselongdouble.cbu; then
6886                 echo "Your platform has some specific hints for long doubles, using them..."
6887                 . ./uselongdouble.cbu
6888         else
6889                 $cat <<EOM
6890 (Your platform doesn't have any specific hints for long doubles.)
6891 EOM
6892         fi
6893         ;;
6894 esac
6895
6896 cat <<EOM
6897
6898 Perl can be built to take advantage of long longs which
6899 (if available) may give more range for integer numbers.
6900
6901 If this doesn't make any sense to you, just accept the default 'n'.
6902 EOM
6903
6904 case "$ccflags" in
6905 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
6906 esac
6907
6908 case "$uselonglong" in
6909 $define|true|[yY]*)     dflt='y';;
6910 *) dflt='n';;
6911 esac
6912 rp='Try to use long longs if available?'
6913 . ./myread
6914 case "$ans" in
6915 y|Y)    val="$define"   ;;
6916 *)      val="$undef"    ;;
6917 esac
6918 set uselonglong
6919 eval $setvar
6920
6921 case "$uselonglong" in
6922 true|[yY]*) uselonglong="$define" ;;
6923 esac
6924
6925 case "$uselonglong" in
6926 $define)
6927 : Look for a hint-file generated 'call-back-unit'.  If the
6928 : user has specified that long longs should be used,
6929 : we may need to set or change some other defaults.
6930         if $test -f uselonglong.cbu; then
6931                 echo "Your platform has some specific hints for long longs, using them..."
6932                 . ./uselonglong.cbu
6933         else
6934                 $cat <<EOM
6935 (Your platform doesn't have any specific hints for long longs.)
6936 EOM
6937         fi
6938         ;;
6939 esac
6940
6941 cat <<EOM
6942
6943 Previous version of $package used the standard IO mechanisms as defined
6944 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6945 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6946 the default.  This abstraction layer can use AT&T's sfio (if you already
6947 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6948 problems with some extension modules.  Using PerlIO with stdio is safe,
6949 but it is slower than plain stdio and therefore is not the default.
6950
6951 If this doesn't make any sense to you, just accept the default 'n'.
6952 EOM
6953 case "$useperlio" in
6954 $define|true|[yY]*)     dflt='y';;
6955 *) dflt='n';;
6956 esac
6957 rp='Use the experimental PerlIO abstraction layer?'
6958 . ./myread
6959 case "$ans" in
6960 y|Y) 
6961         val="$define"
6962         ;;     
6963 *)      
6964         echo "Ok, doing things the stdio way"
6965         val="$undef"
6966         ;;
6967 esac
6968 set useperlio
6969 eval $setvar 
6970
6971 case "$vendorprefix" in
6972 '')     d_vendorbin="$undef"
6973         vendorbin=''
6974         vendorbinexp=''
6975         ;;
6976 *)      d_vendorbin="$define"
6977         : determine where vendor-supplied executables go.
6978         dflt=$vendorprefix/bin
6979         fn=d~+
6980         rp='Pathname for the vendor-supplied executables directory?'
6981         . ./getfile
6982         vendorbin="$ans"
6983         vendorbinexp="$ansexp"
6984         : Change installation prefix, if necessary.
6985         if $test X"$prefix" != X"$installprefix"; then
6986                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6987         else
6988                 installvendorbin="$vendorbinexp"
6989         fi
6990         ;;
6991 esac
6992
6993 : Check how to convert floats to strings.
6994 if test "X$d_Gconvert" = X; then
6995         echo " "
6996         echo "Checking for an efficient way to convert floats to strings."
6997         $cat >try.c <<'EOP'
6998 #ifdef TRY_gconvert
6999 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7000 char *myname = "gconvert";
7001 #endif
7002 #ifdef TRY_gcvt
7003 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7004 char *myname = "gcvt";
7005 #endif
7006 #ifdef TRY_sprintf
7007 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7008 char *myname = "sprintf";
7009 #endif
7010
7011 #include <stdio.h>
7012
7013 int
7014 checkit(expect, got)
7015 char *expect;
7016 char *got;
7017 {
7018     if (strcmp(expect, got)) {
7019                 printf("%s oddity:  Expected %s, got %s\n",
7020                         myname, expect, got);
7021                 exit(1);
7022         }
7023 }
7024
7025 int main()
7026
7027         char buf[64]; 
7028         buf[63] = '\0';
7029
7030         /* This must be 1st test on (which?) platform */
7031         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7032         Gconvert(0.1, 8, 0, buf);
7033         checkit("0.1", buf);
7034
7035         Gconvert(1.0, 8, 0, buf); 
7036         checkit("1", buf);
7037
7038         Gconvert(0.0, 8, 0, buf); 
7039         checkit("0", buf);
7040
7041         Gconvert(-1.0, 8, 0, buf); 
7042         checkit("-1", buf);
7043
7044         /* Some Linux gcvt's give 1.e+5 here. */
7045         Gconvert(100000.0, 8, 0, buf); 
7046         checkit("100000", buf);
7047         
7048         /* Some Linux gcvt's give -1.e+5 here. */
7049         Gconvert(-100000.0, 8, 0, buf); 
7050         checkit("-100000", buf);
7051
7052         exit(0);
7053 }
7054 EOP
7055         case "$d_Gconvert" in
7056         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7057         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7058         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7059         *) xxx_list='gconvert gcvt sprintf' ;;
7060         esac
7061
7062         for xxx_convert in $xxx_list; do
7063                 echo "Trying $xxx_convert"
7064                 $rm -f try try$_o
7065                 set try -DTRY_$xxx_convert
7066                 if eval $compile; then
7067                         echo "$xxx_convert" found. >&4
7068                         if ./try; then
7069                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7070                                 break;
7071                         else
7072                                 echo "...But $xxx_convert didn't work as I expected."
7073                         fi
7074                 else
7075                         echo "$xxx_convert NOT found." >&4
7076                 fi
7077         done
7078                 
7079         case "$xxx_convert" in
7080         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7081         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7082         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7083         esac
7084 fi
7085
7086 : check for length of double
7087 echo " "
7088 case "$doublesize" in
7089 '')
7090         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7091         $cat >try.c <<'EOCP'
7092 #include <stdio.h>
7093 int main()
7094 {
7095     printf("%d\n", (int)sizeof(double));
7096     exit(0);
7097 }
7098 EOCP
7099         set try
7100         if eval $compile_ok; then
7101                 doublesize=`./try`
7102                 $echo " $doublesize bytes." >&4
7103         else
7104                 dflt='8'
7105                 echo "(I can't seem to compile the test program.  Guessing...)"
7106                 rp="What is the size of a double precision number (in bytes)?"
7107                 . ./myread
7108                 doublesize="$ans"
7109         fi
7110         ;;
7111 esac
7112 $rm -f try.c try
7113
7114 : check for long doubles
7115 echo " "
7116 $echo $n "Checking to see if your system supports long double..." $c >&4
7117 echo 'int main() { long double x = 7.0; }' > try.c
7118 set try
7119 if eval $compile; then
7120         val="$define"
7121         echo " Yes, it does." >&4
7122 else
7123         val="$undef"
7124         echo " No, it doesn't." >&4
7125 fi
7126 $rm try.*
7127 set d_longdbl
7128 eval $setvar
7129
7130 : check for length of long double
7131 case "${d_longdbl}${longdblsize}" in
7132 $define)
7133         echo " "
7134         $echo $n "Checking to see how big your long doubles are..." $c >&4
7135         $cat >try.c <<'EOCP'
7136 #include <stdio.h>
7137 int main()
7138 {
7139         printf("%d\n", sizeof(long double));
7140 }
7141 EOCP
7142         set try
7143         set try
7144         if eval $compile; then
7145                 longdblsize=`./try$exe_ext`
7146                 $echo " $longdblsize bytes." >&4
7147         else
7148                 dflt='8'
7149                 echo " "
7150                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7151                 rp="What is the size of a long double (in bytes)?"
7152                 . ./myread
7153                 longdblsize="$ans"
7154         fi
7155         if $test "X$doublesize" = "X$longdblsize"; then
7156                 echo "(That isn't any different from an ordinary double.)"
7157         fi      
7158         ;;
7159 esac
7160 $rm -f try.* try
7161
7162 echo " "
7163
7164 if $test X"$d_longdbl" = X"$define"; then
7165
7166 echo "Checking how to print long doubles..." >&4
7167
7168 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7169         $cat >try.c <<'EOCP'
7170 #include <sys/types.h>
7171 #include <stdio.h>
7172 int main() {
7173   double d = 123.456;
7174   printf("%.3f\n", d);
7175 }
7176 EOCP
7177         set try
7178         if eval $compile; then
7179                 yyy=`./try$exe_ext`
7180                 case "$yyy" in
7181                 123.456)
7182                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7183                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7184                         echo "We will use %f."
7185                         ;;
7186                 esac
7187         fi
7188 fi
7189
7190 if $test X"$sPRIfldbl" = X; then
7191         $cat >try.c <<'EOCP'
7192 #include <sys/types.h>
7193 #include <stdio.h>
7194 int main() {
7195   long double d = 123.456;
7196   printf("%.3llf\n", d);
7197 }
7198 EOCP
7199         set try
7200         if eval $compile; then
7201                 yyy=`./try$exe_ext`
7202                 case "$yyy" in
7203                 123.456)
7204                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7205                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7206                         echo "We will use %llf."
7207                         ;;
7208                 esac
7209         fi
7210 fi
7211
7212 if $test X"$sPRIfldbl" = X; then
7213         $cat >try.c <<'EOCP'
7214 #include <sys/types.h>
7215 #include <stdio.h>
7216 int main() {
7217   long double d = 123.456;
7218   printf("%.3Lf\n", d);
7219 }
7220 EOCP
7221         set try
7222         if eval $compile; then
7223                 yyy=`./try$exe_ext`
7224                 case "$yyy" in
7225                 123.456)
7226                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7227                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7228                         echo "We will use %Lf."
7229                         ;;
7230                 esac
7231         fi
7232 fi
7233
7234 if $test X"$sPRIfldbl" = X; then
7235         $cat >try.c <<'EOCP'
7236 #include <sys/types.h>
7237 #include <stdio.h>
7238 int main() {
7239   long double d = 123.456;
7240   printf("%.3lf\n", d);
7241 }
7242 EOCP
7243         set try
7244         if eval $compile; then
7245                 yyy=`./try$exe_ext`
7246                 case "$yyy" in
7247                 123.456)
7248                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7249                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7250                         echo "We will use %lf."
7251                         ;;
7252                 esac
7253         fi
7254 fi
7255
7256 if $test X"$sPRIfldbl" = X; then
7257         echo "Cannot figure out how to print long doubles." >&4
7258 fi
7259
7260 $rm -f try try.*
7261
7262 fi # d_longdbl
7263
7264 case "$sPRIfldbl" in
7265 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7266         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7267         ;;
7268 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7269         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7270         ;;
7271 esac
7272
7273 : Initialize h_fcntl
7274 h_fcntl=false
7275
7276 : Initialize h_sysfile
7277 h_sysfile=false
7278
7279 : access call always available on UNIX
7280 set access d_access
7281 eval $inlibc
7282
7283 : locate the flags for 'access()'
7284 case "$d_access" in
7285 "$define")
7286         echo " "
7287         $cat >access.c <<'EOCP'
7288 #include <sys/types.h>
7289 #ifdef I_FCNTL
7290 #include <fcntl.h>
7291 #endif
7292 #ifdef I_SYS_FILE
7293 #include <sys/file.h>
7294 #endif
7295 #ifdef I_UNISTD
7296 #include <unistd.h>
7297 #endif
7298 int main() {
7299         exit(R_OK);
7300 }
7301 EOCP
7302         : check sys/file.h first, no particular reason here
7303         if $test `./findhdr sys/file.h` && \
7304                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7305                 h_sysfile=true;
7306                 echo "<sys/file.h> defines the *_OK access constants." >&4
7307         elif $test `./findhdr fcntl.h` && \
7308                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7309                 h_fcntl=true;
7310                 echo "<fcntl.h> defines the *_OK access constants." >&4
7311         elif $test `./findhdr unistd.h` && \
7312                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7313                 echo "<unistd.h> defines the *_OK access constants." >&4
7314         else
7315                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7316         fi
7317         ;;
7318 esac
7319 $rm -f access*
7320
7321 : see if accessx exists
7322 set accessx d_accessx
7323 eval $inlibc
7324
7325 : see if alarm exists
7326 set alarm d_alarm
7327 eval $inlibc
7328
7329 : see if atolf exists
7330 set atolf d_atolf
7331 eval $inlibc
7332
7333 : see if atoll exists
7334 set atoll d_atoll
7335 eval $inlibc
7336
7337 : Look for GNU-cc style attribute checking
7338 echo " "
7339 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7340 $cat >attrib.c <<'EOCP'
7341 #include <stdio.h>
7342 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7343 EOCP
7344 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7345         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7346                 echo "Your C compiler doesn't fully support __attribute__."
7347                 val="$undef"
7348         else
7349                 echo "Your C compiler supports __attribute__."
7350                 val="$define"
7351         fi
7352 else
7353         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7354         val="$undef"
7355 fi
7356 set d_attribut
7357 eval $setvar
7358 $rm -f attrib*
7359
7360 : see if bcmp exists
7361 set bcmp d_bcmp
7362 eval $inlibc
7363
7364 : see if bcopy exists
7365 set bcopy d_bcopy
7366 eval $inlibc
7367
7368 : see if this is a unistd.h system
7369 set unistd.h i_unistd
7370 eval $inhdr
7371
7372 : see if getpgrp exists
7373 set getpgrp d_getpgrp
7374 eval $inlibc
7375
7376 case "$d_getpgrp" in
7377 "$define")
7378         echo " "
7379         echo "Checking to see which flavor of getpgrp is in use..."
7380         $cat >set.c <<EOP
7381 #$i_unistd I_UNISTD
7382 #include <sys/types.h>
7383 #ifdef I_UNISTD
7384 #  include <unistd.h>
7385 #endif
7386 int main()
7387 {
7388         if (getuid() == 0) {
7389                 printf("(I see you are running Configure as super-user...)\n");
7390                 setuid(1);
7391         }
7392 #ifdef TRY_BSD_PGRP
7393         if (getpgrp(1) == 0)
7394                 exit(0);
7395 #else
7396         if (getpgrp() > 0)
7397                 exit(0);
7398 #endif
7399         exit(1);
7400 }
7401 EOP
7402         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7403                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7404                 val="$define"
7405         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7406                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7407                 val="$undef"
7408         else
7409                 echo "I can't seem to compile and run the test program."
7410                 if ./usg; then
7411                         xxx="a USG one, i.e. you use getpgrp()."
7412                 else
7413                         # SVR4 systems can appear rather BSD-ish.
7414                         case "$i_unistd" in
7415                         $undef)
7416                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7417                                 val="$define"
7418                                 ;;
7419                         $define)
7420                                 xxx="probably a USG one, i.e. you use getpgrp()."
7421                                 val="$undef"
7422                                 ;;
7423                         esac
7424                 fi
7425                 echo "Assuming your getpgrp is $xxx" >&4
7426         fi
7427         ;;
7428 *) val="$undef";;
7429 esac
7430 set d_bsdgetpgrp
7431 eval $setvar
7432 $rm -f set set.c
7433
7434 : see if setpgrp exists
7435 set setpgrp d_setpgrp
7436 eval $inlibc
7437
7438 case "$d_setpgrp" in
7439 "$define")
7440         echo " "
7441         echo "Checking to see which flavor of setpgrp is in use..."
7442         $cat >set.c <<EOP
7443 #$i_unistd I_UNISTD
7444 #include <sys/types.h>
7445 #ifdef I_UNISTD
7446 #  include <unistd.h>
7447 #endif
7448 int main()
7449 {
7450         if (getuid() == 0) {
7451                 printf("(I see you are running Configure as super-user...)\n");
7452                 setuid(1);
7453         }
7454 #ifdef TRY_BSD_PGRP
7455         if (-1 == setpgrp(1, 1))
7456                 exit(0);
7457 #else
7458         if (setpgrp() != -1)
7459                 exit(0);
7460 #endif
7461         exit(1);
7462 }
7463 EOP
7464         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7465                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7466                 val="$define"
7467         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7468                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7469                 val="$undef"
7470         else
7471                 echo "(I can't seem to compile and run the test program.)"
7472                 if ./usg; then
7473                         xxx="a USG one, i.e. you use setpgrp()."
7474                 else
7475                         # SVR4 systems can appear rather BSD-ish.
7476                         case "$i_unistd" in
7477                         $undef)
7478                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7479                                 val="$define"
7480                                 ;;
7481                         $define)
7482                                 xxx="probably a USG one, i.e. you use setpgrp()."
7483                                 val="$undef"
7484                                 ;;
7485                         esac
7486                 fi
7487                 echo "Assuming your setpgrp is $xxx" >&4
7488         fi
7489         ;;
7490 *) val="$undef";;
7491 esac
7492 set d_bsdsetpgrp
7493 eval $setvar
7494 $rm -f set set.c
7495 : see if bzero exists
7496 set bzero d_bzero
7497 eval $inlibc
7498
7499 : see if signal is declared as pointer to function returning int or void
7500 echo " "
7501 xxx=`./findhdr signal.h`
7502 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7503 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7504         echo "You have int (*signal())() instead of void." >&4
7505         val="$undef"
7506 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7507         echo "You have void (*signal())()." >&4
7508         val="$define"
7509 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7510         echo "You have int (*signal())() instead of void." >&4
7511         val="$undef"
7512 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7513         echo "You have void (*signal())()." >&4
7514         val="$define"
7515 else
7516         case "$d_voidsig" in
7517         '')
7518         echo "I can't determine whether signal handler returns void or int..." >&4
7519                 dflt=void
7520                 rp="What type does your signal handler return?"
7521                 . ./myread
7522                 case "$ans" in
7523                 v*) val="$define";;
7524                 *) val="$undef";;
7525                 esac;;
7526         "$define")
7527                 echo "As you already told me, signal handler returns void." >&4
7528                 val="$define"
7529                 ;;
7530         *)      echo "As you already told me, signal handler returns int." >&4
7531                 val="$undef"
7532                 ;;
7533         esac
7534 fi
7535 set d_voidsig
7536 eval $setvar
7537 case "$d_voidsig" in
7538 "$define") signal_t="void";;
7539 *) signal_t="int";;
7540 esac
7541 $rm -f $$.tmp
7542
7543 : check for ability to cast large floats to 32-bit ints.
7544 echo " "
7545 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7546 if $test "$intsize" -ge 4; then
7547         xxx=int
7548 else
7549         xxx=long
7550 fi
7551 $cat >try.c <<EOCP
7552 #include <stdio.h>
7553 #include <sys/types.h>
7554 #include <signal.h>
7555 $signal_t blech(s) int s; { exit(3); }
7556 int main()
7557 {
7558         $xxx i32;
7559         double f, g;
7560         int result = 0;
7561         char str[16];
7562         signal(SIGFPE, blech);
7563
7564         /* Don't let compiler optimize the test away.  Store the number 
7565            in a writable string for gcc to pass to sscanf under HP/UX.
7566         */
7567         sprintf(str, "2147483647");
7568         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7569         g = 10 * f;
7570         i32  = ($xxx) g;
7571
7572         /* x86 processors will probably give 0x8000 0000, which is a
7573        sign change.  We don't want that.  We want to mimic SPARC
7574            behavior here, which is to preserve the sign and give
7575            back 0x7fff ffff.
7576         */
7577         if (i32 != ($xxx) f)
7578                 result |= 1;
7579         exit(result);
7580 }
7581 EOCP
7582 set try
7583 if eval $compile_ok; then
7584         ./try
7585         yyy=$?
7586 else
7587         echo "(I can't seem to compile the test program--assuming it can't)"
7588         yyy=1
7589 fi
7590 case "$yyy" in
7591 0)      val="$define"
7592         echo "Yup, it can."
7593         ;;
7594 *)      val="$undef"
7595         echo "Nope, it can't."
7596         ;;
7597 esac
7598 set d_casti32
7599 eval $setvar
7600 $rm -f try try.*
7601
7602 : check for ability to cast negative floats to unsigned
7603 echo " "
7604 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7605 $cat >try.c <<EOCP
7606 #include <stdio.h>
7607 #include <sys/types.h>
7608 #include <signal.h>
7609 $signal_t blech(s) int s; { exit(7); }
7610 $signal_t blech_in_list(s) int s; { exit(4); }
7611 unsigned long dummy_long(p) unsigned long p; { return p; }
7612 unsigned int dummy_int(p) unsigned int p; { return p; }
7613 unsigned short dummy_short(p) unsigned short p; { return p; }
7614 int main()
7615 {
7616         double f;
7617         unsigned long along;
7618         unsigned int aint;
7619         unsigned short ashort;
7620         int result = 0;
7621         char str[16];
7622         
7623         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7624            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7625            optimized the whole file away
7626         */
7627         /* Store the number in a writable string for gcc to pass to 
7628            sscanf under HP/UX.
7629         */
7630         sprintf(str, "-123");
7631         sscanf(str, "%lf", &f);  /* f = -123.; */
7632
7633         signal(SIGFPE, blech);
7634         along = (unsigned long)f;
7635         aint = (unsigned int)f;
7636         ashort = (unsigned short)f;
7637         if (along != (unsigned long)-123)
7638                 result |= 1;
7639         if (aint != (unsigned int)-123)
7640                 result |= 1;
7641         if (ashort != (unsigned short)-123)
7642                 result |= 1;
7643         sprintf(str, "1073741824.");
7644         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7645         f = f + f;
7646         along = 0;
7647         along = (unsigned long)f;
7648         if (along != 0x80000000)
7649                 result |= 2;
7650         f -= 1.;
7651         along = 0;
7652         along = (unsigned long)f;
7653         if (along != 0x7fffffff)
7654                 result |= 1;
7655         f += 2.;
7656         along = 0;
7657         along = (unsigned long)f;
7658         if (along != 0x80000001)
7659                 result |= 2;
7660         if (result)
7661                 exit(result);
7662         signal(SIGFPE, blech_in_list);
7663         sprintf(str, "123.");
7664         sscanf(str, "%lf", &f);  /* f = 123.; */
7665         along = dummy_long((unsigned long)f);
7666         aint = dummy_int((unsigned int)f);
7667         ashort = dummy_short((unsigned short)f);
7668         if (along != (unsigned long)123)
7669                 result |= 4;
7670         if (aint != (unsigned int)123)
7671                 result |= 4;
7672         if (ashort != (unsigned short)123)
7673                 result |= 4;
7674         exit(result);
7675
7676 }
7677 EOCP
7678 set try
7679 if eval $compile_ok; then
7680         ./try
7681         castflags=$?
7682 else
7683         echo "(I can't seem to compile the test program--assuming it can't)"
7684         castflags=7
7685 fi
7686 case "$castflags" in
7687 0)      val="$define"
7688         echo "Yup, it can."
7689         ;;
7690 *)      val="$undef"
7691         echo "Nope, it can't."
7692         ;;
7693 esac
7694 set d_castneg
7695 eval $setvar
7696 $rm -f try.*
7697
7698 : see if vprintf exists
7699 echo " "
7700 if set vprintf val -f d_vprintf; eval $csym; $val; then
7701         echo 'vprintf() found.' >&4
7702         val="$define"
7703         $cat >vprintf.c <<'EOF'
7704 #include <varargs.h>
7705
7706 int main() { xxx("foo"); }
7707
7708 xxx(va_alist)
7709 va_dcl
7710 {
7711         va_list args;
7712         char buf[10];
7713
7714         va_start(args);
7715         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7716 }
7717 EOF
7718         set vprintf
7719         if eval $compile && ./vprintf; then
7720                 echo "Your vsprintf() returns (int)." >&4
7721                 val2="$undef"
7722         else
7723                 echo "Your vsprintf() returns (char*)." >&4
7724                 val2="$define"
7725         fi
7726 else
7727         echo 'vprintf() NOT found.' >&4
7728                 val="$undef"
7729                 val2="$undef"
7730 fi
7731 set d_vprintf
7732 eval $setvar
7733 val=$val2
7734 set d_charvspr
7735 eval $setvar
7736
7737 : see if chown exists
7738 set chown d_chown
7739 eval $inlibc
7740
7741 : see if chroot exists
7742 set chroot d_chroot
7743 eval $inlibc
7744
7745 : see if chsize exists
7746 set chsize d_chsize
7747 eval $inlibc
7748
7749 : check for const keyword
7750 echo " "
7751 echo 'Checking to see if your C compiler knows about "const"...' >&4
7752 $cat >const.c <<'EOCP'
7753 typedef struct spug { int drokk; } spug;
7754 int main()
7755 {
7756         const char *foo;
7757         const spug y;
7758 }
7759 EOCP
7760 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7761         val="$define"
7762         echo "Yup, it does."
7763 else
7764         val="$undef"
7765         echo "Nope, it doesn't."
7766 fi
7767 set d_const
7768 eval $setvar
7769
7770 : see if crypt exists
7771 echo " "
7772 if set crypt val -f d_crypt; eval $csym; $val; then
7773         echo 'crypt() found.' >&4
7774         val="$define"
7775         cryptlib=''
7776 else
7777         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7778         if $test -z "$cryptlib"; then
7779                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7780         else
7781                 cryptlib=-lcrypt
7782         fi
7783         if $test -z "$cryptlib"; then
7784                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7785         else
7786                 cryptlib=-lcrypt
7787         fi
7788         if $test -z "$cryptlib"; then
7789                 cryptlib=`./loc libcrypt$_a "" $libpth`
7790         else
7791                 cryptlib=-lcrypt
7792         fi
7793         if $test -z "$cryptlib"; then
7794                 echo 'crypt() NOT found.' >&4
7795                 val="$undef"
7796         else
7797                 val="$define"
7798         fi
7799 fi
7800 set d_crypt
7801 eval $setvar
7802
7803 : get csh whereabouts
7804 case "$csh" in
7805 'csh') val="$undef" ;;
7806 *) val="$define" ;;
7807 esac
7808 set d_csh
7809 eval $setvar
7810 : Respect a hint or command line value for full_csh.
7811 case "$full_csh" in
7812 '') full_csh=$csh ;;
7813 esac
7814
7815 : see if cuserid exists
7816 set cuserid d_cuserid
7817 eval $inlibc
7818
7819 : see if this is a limits.h system
7820 set limits.h i_limits
7821 eval $inhdr
7822
7823 : see if this is a float.h system
7824 set float.h i_float
7825 eval $inhdr
7826
7827 : See if number of significant digits in a double precision number is known
7828 echo " "
7829 $cat >dbl_dig.c <<EOM
7830 #$i_limits I_LIMITS
7831 #$i_float I_FLOAT
7832 #ifdef I_LIMITS
7833 #include <limits.h>
7834 #endif
7835 #ifdef I_FLOAT
7836 #include <float.h>
7837 #endif
7838 #ifdef DBL_DIG
7839 printf("Contains DBL_DIG");
7840 #endif
7841 EOM
7842 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7843 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7844         echo "DBL_DIG found." >&4
7845         val="$define"
7846 else
7847         echo "DBL_DIG NOT found." >&4
7848         val="$undef"
7849 fi
7850 $rm -f dbl_dig.?
7851 set d_dbl_dig
7852 eval $setvar
7853
7854 : see if difftime exists
7855 set difftime d_difftime
7856 eval $inlibc
7857
7858 : see if this is a dirent system
7859 echo " "
7860 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7861         val="$define"
7862         echo "<dirent.h> found." >&4
7863 else
7864         val="$undef"
7865         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7866                 echo "<sys/dir.h> found." >&4
7867                 echo " "
7868         else
7869                 xinc=`./findhdr sys/ndir.h`
7870         fi
7871         echo "<dirent.h> NOT found." >&4
7872 fi
7873 set i_dirent
7874 eval $setvar
7875
7876 : Look for type of directory structure.
7877 echo " "
7878 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7879
7880 case "$direntrytype" in
7881 ''|' ')
7882         case "$i_dirent" in
7883         $define) guess1='struct dirent' ;;
7884         *) guess1='struct direct'  ;;
7885         esac
7886         ;;
7887 *)      guess1="$direntrytype"
7888         ;;
7889 esac
7890
7891 case "$guess1" in
7892 'struct dirent') guess2='struct direct' ;;
7893 *) guess2='struct dirent' ;;
7894 esac
7895                 
7896 if $contains "$guess1" try.c >/dev/null 2>&1; then
7897         direntrytype="$guess1"
7898         echo "Your directory entries are $direntrytype." >&4
7899 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7900         direntrytype="$guess2"
7901         echo "Your directory entries seem to be $direntrytype." >&4
7902 else
7903         echo "I don't recognize your system's directory entries." >&4
7904         rp="What type is used for directory entries on this system?"
7905         dflt="$guess1"
7906         . ./myread
7907         direntrytype="$ans"
7908 fi
7909 $rm -f try.c
7910
7911
7912 : see if the directory entry stores field length
7913 echo " "
7914 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7915 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7916         echo "Good, your directory entry keeps length information in d_namlen." >&4
7917         val="$define"
7918 else
7919         echo "Your directory entry does not know about the d_namlen field." >&4
7920         val="$undef"
7921 fi
7922 set d_dirnamlen
7923 eval $setvar
7924 $rm -f try.c
7925
7926 : see if dlerror exists
7927 xxx_runnm="$runnm"
7928 runnm=false
7929 set dlerror d_dlerror
7930 eval $inlibc
7931 runnm="$xxx_runnm"
7932
7933 : see if dlfcn is available
7934 set dlfcn.h i_dlfcn
7935 eval $inhdr
7936
7937 case "$usedl" in
7938 $define|y|true)
7939         $cat << EOM
7940
7941 On a few systems, the dynamically loaded modules that perl generates and uses
7942 will need a different extension than shared libs. The default will probably
7943 be appropriate.
7944
7945 EOM
7946         case "$dlext" in
7947         '')     dflt="$so" ;;
7948         *)      dflt="$dlext" ;;
7949         esac
7950         rp='What is the extension of dynamically loaded modules'
7951         . ./myread
7952         dlext="$ans"
7953         ;;
7954 *)
7955         dlext="none"
7956         ;;
7957 esac
7958
7959 : Check if dlsym need a leading underscore
7960 echo " "
7961 val="$undef"
7962
7963 case "$dlsrc" in
7964 dl_dlopen.xs)
7965         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7966         $cat >dyna.c <<'EOM'
7967 fred () { }
7968 EOM
7969
7970 $cat >fred.c<<EOM
7971
7972 #include <stdio.h>
7973 #$i_dlfcn I_DLFCN
7974 #ifdef I_DLFCN
7975 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7976 #else
7977 #include <sys/types.h>
7978 #include <nlist.h>
7979 #include <link.h>
7980 #endif
7981
7982 extern int fred() ;
7983
7984 int main()
7985 {
7986     void * handle ;
7987     void * symbol ;
7988 #ifndef RTLD_LAZY
7989     int mode = 1 ;
7990 #else
7991     int mode = RTLD_LAZY ;
7992 #endif
7993     handle = dlopen("./dyna.$dlext", mode) ;
7994     if (handle == NULL) {
7995         printf ("1\n") ;
7996         fflush (stdout) ;
7997         exit(0);
7998     }
7999     symbol = dlsym(handle, "fred") ;
8000     if (symbol == NULL) {
8001         /* try putting a leading underscore */
8002         symbol = dlsym(handle, "_fred") ;
8003         if (symbol == NULL) {
8004             printf ("2\n") ;
8005             fflush (stdout) ;
8006             exit(0);
8007         }
8008         printf ("3\n") ;
8009     }
8010     else
8011         printf ("4\n") ;
8012     fflush (stdout) ;
8013     exit(0);
8014 }
8015 EOM
8016         : Call the object file tmp-dyna.o in case dlext=o.
8017         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8018                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8019                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8020                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8021                 xxx=`./fred`
8022                 case $xxx in
8023                 1)      echo "Test program failed using dlopen." >&4
8024                         echo "Perhaps you should not use dynamic loading." >&4;;
8025                 2)      echo "Test program failed using dlsym." >&4
8026                         echo "Perhaps you should not use dynamic loading." >&4;;
8027                 3)      echo "dlsym needs a leading underscore" >&4
8028                         val="$define" ;;
8029                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8030                 esac
8031         else
8032                 echo "I can't compile and run the test program." >&4
8033                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8034         fi
8035         ;;
8036 esac
8037                 
8038 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8039
8040 set d_dlsymun
8041 eval $setvar
8042
8043 hasproto='varname=$1; func=$2; shift; shift;
8044 while $test $# -ge 2; do
8045         case "$1" in
8046         $define) echo "#include <$2>";;
8047         esac ;
8048     shift 2;
8049 done > try.c;
8050 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8051 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8052         echo "$func() prototype found.";
8053         val="$define";
8054 else
8055         echo "$func() prototype NOT found.";
8056         val="$undef";
8057 fi;
8058 set $varname;
8059 eval $setvar;
8060 $rm -f try.c tryout.c'
8061
8062 : see if prototype for drand48 is available
8063 echo " "
8064 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8065 eval $hasproto
8066
8067 : see if dup2 exists
8068 set dup2 d_dup2
8069 eval $inlibc
8070
8071 : see if eaccess exists
8072 set eaccess d_eaccess
8073 eval $inlibc
8074
8075 : see if endgrent exists
8076 set endgrent d_endgrent
8077 eval $inlibc
8078
8079 : see if endhostent exists
8080 set endhostent d_endhent
8081 eval $inlibc
8082
8083 : see if endnetent exists
8084 set endnetent d_endnent
8085 eval $inlibc
8086
8087 : see if endprotoent exists
8088 set endprotoent d_endpent
8089 eval $inlibc
8090
8091 : see if endpwent exists
8092 set endpwent d_endpwent
8093 eval $inlibc
8094
8095 : see if endservent exists
8096 set endservent d_endsent
8097 eval $inlibc
8098
8099 : see if endspent exists
8100 set endspent d_endspent
8101 eval $inlibc
8102
8103 : Locate the flags for 'open()'
8104 echo " "
8105 $cat >open3.c <<'EOCP'
8106 #include <sys/types.h>
8107 #ifdef I_FCNTL
8108 #include <fcntl.h>
8109 #endif
8110 #ifdef I_SYS_FILE
8111 #include <sys/file.h>
8112 #endif
8113 int main() {
8114         if(O_RDONLY);
8115 #ifdef O_TRUNC
8116         exit(0);
8117 #else
8118         exit(1);
8119 #endif
8120 }
8121 EOCP
8122 : check sys/file.h first to get FREAD on Sun
8123 if $test `./findhdr sys/file.h` && \
8124                 set open3 -DI_SYS_FILE && eval $compile; then
8125         h_sysfile=true;
8126         echo "<sys/file.h> defines the O_* constants..." >&4
8127         if ./open3; then
8128                 echo "and you have the 3 argument form of open()." >&4
8129                 val="$define"
8130         else
8131                 echo "but not the 3 argument form of open().  Oh, well." >&4
8132                 val="$undef"
8133         fi
8134 elif $test `./findhdr fcntl.h` && \
8135                 set open3 -DI_FCNTL && eval $compile; then
8136         h_fcntl=true;
8137         echo "<fcntl.h> defines the O_* constants..." >&4
8138         if ./open3; then
8139                 echo "and you have the 3 argument form of open()." >&4
8140                 val="$define"
8141         else
8142                 echo "but not the 3 argument form of open().  Oh, well." >&4
8143                 val="$undef"
8144         fi
8145 else
8146         val="$undef"
8147         echo "I can't find the O_* constant definitions!  You got problems." >&4
8148 fi
8149 set d_open3
8150 eval $setvar
8151 $rm -f open3*
8152
8153 : see which of string.h or strings.h is needed
8154 echo " "
8155 strings=`./findhdr string.h`
8156 if $test "$strings" && $test -r "$strings"; then
8157         echo "Using <string.h> instead of <strings.h>." >&4
8158         val="$define"
8159 else
8160         val="$undef"
8161         strings=`./findhdr strings.h`
8162         if $test "$strings" && $test -r "$strings"; then
8163                 echo "Using <strings.h> instead of <string.h>." >&4
8164         else
8165                 echo "No string header found -- You'll surely have problems." >&4
8166         fi
8167 fi
8168 set i_string
8169 eval $setvar
8170 case "$i_string" in
8171 "$undef") strings=`./findhdr strings.h`;;
8172 *)        strings=`./findhdr string.h`;;
8173 esac
8174
8175 : check for non-blocking I/O stuff
8176 case "$h_sysfile" in
8177 true) echo "#include <sys/file.h>" > head.c;;
8178 *)
8179         case "$h_fcntl" in
8180         true) echo "#include <fcntl.h>" > head.c;;
8181         *) echo "#include <sys/fcntl.h>" > head.c;;
8182         esac
8183         ;;
8184 esac
8185 echo " "
8186 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8187 case "$o_nonblock" in
8188 '')
8189         $cat head.c > try.c
8190         $cat >>try.c <<'EOCP'
8191 #include <stdio.h>
8192 int main() {
8193 #ifdef O_NONBLOCK
8194         printf("O_NONBLOCK\n");
8195         exit(0);
8196 #endif
8197 #ifdef O_NDELAY
8198         printf("O_NDELAY\n");
8199         exit(0);
8200 #endif
8201 #ifdef FNDELAY
8202         printf("FNDELAY\n");
8203         exit(0);
8204 #endif
8205         exit(0);
8206 }
8207 EOCP
8208         set try
8209         if eval $compile_ok; then
8210                 o_nonblock=`./try`
8211                 case "$o_nonblock" in
8212                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8213                 *) echo "Seems like we can use $o_nonblock.";;
8214                 esac
8215         else
8216                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8217         fi
8218         ;;
8219 *) echo "Using $hint value $o_nonblock.";;
8220 esac
8221 $rm -f try try.* .out core
8222
8223 echo " "
8224 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8225 case "$eagain" in
8226 '')
8227         $cat head.c > try.c
8228         $cat >>try.c <<EOCP
8229 #include <errno.h>
8230 #include <sys/types.h>
8231 #include <signal.h>
8232 #include <stdio.h> 
8233 #define MY_O_NONBLOCK $o_nonblock
8234 #ifndef errno  /* XXX need better Configure test */
8235 extern int errno;
8236 #endif
8237 #$i_unistd I_UNISTD
8238 #ifdef I_UNISTD
8239 #include <unistd.h>
8240 #endif
8241 #ifdef $i_string
8242 #include <string.h>
8243 #else
8244 #include <strings.h>
8245 #endif
8246 $signal_t blech(x) int x; { exit(3); }
8247 EOCP
8248         $cat >> try.c <<'EOCP'
8249 int main()
8250 {
8251         int pd[2];
8252         int pu[2];
8253         char buf[1];
8254         char string[100];
8255
8256         pipe(pd);       /* Down: child -> parent */
8257         pipe(pu);       /* Up: parent -> child */
8258         if (0 != fork()) {
8259                 int ret;
8260                 close(pd[1]);   /* Parent reads from pd[0] */
8261                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8262                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8263                         exit(1);
8264                 signal(SIGALRM, blech);
8265                 alarm(5);
8266                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8267                         exit(2);
8268                 sprintf(string, "%d\n", ret);
8269                 write(2, string, strlen(string));
8270                 alarm(0);
8271 #ifdef EAGAIN
8272                 if (errno == EAGAIN) {
8273                         printf("EAGAIN\n");
8274                         goto ok;
8275                 }
8276 #endif
8277 #ifdef EWOULDBLOCK
8278                 if (errno == EWOULDBLOCK)
8279                         printf("EWOULDBLOCK\n");
8280 #endif
8281         ok:
8282                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8283                 sleep(2);                               /* Give it time to close our pipe */
8284                 alarm(5);
8285                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8286                 alarm(0);
8287                 sprintf(string, "%d\n", ret);
8288                 write(3, string, strlen(string));
8289                 exit(0);
8290         }
8291
8292         close(pd[0]);                   /* We write to pd[1] */
8293         close(pu[1]);                   /* We read from pu[0] */
8294         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8295         close(pd[1]);                   /* Pipe pd is now fully closed! */
8296         exit(0);                                /* Bye bye, thank you for playing! */
8297 }
8298 EOCP
8299         set try
8300         if eval $compile_ok; then
8301                 echo "$startsh" >mtry
8302                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8303                 chmod +x mtry
8304                 ./mtry >/dev/null 2>&1
8305                 case $? in
8306                 0) eagain=`$cat try.out`;;
8307                 1) echo "Could not perform non-blocking setting!";;
8308                 2) echo "I did a successful read() for something that was not there!";;
8309                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8310                 *) echo "Something terribly wrong happened during testing.";;
8311                 esac
8312                 rd_nodata=`$cat try.ret`
8313                 echo "A read() system call with no data present returns $rd_nodata."
8314                 case "$rd_nodata" in
8315                 0|-1) ;;
8316                 *)
8317                         echo "(That's peculiar, fixing that to be -1.)"
8318                         rd_nodata=-1
8319                         ;;
8320                 esac
8321                 case "$eagain" in
8322                 '')
8323                         echo "Forcing errno EAGAIN on read() with no data available."
8324                         eagain=EAGAIN
8325                         ;;
8326                 *)
8327                         echo "Your read() sets errno to $eagain when no data is available."
8328                         ;;
8329                 esac
8330                 status=`$cat try.err`
8331                 case "$status" in
8332                 0) echo "And it correctly returns 0 to signal EOF.";;
8333                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8334                 *) echo "However, your read() returns '$status' on EOF??";;
8335                 esac
8336                 val="$define"
8337                 if test "$status" = "$rd_nodata"; then
8338                         echo "WARNING: you can't distinguish between EOF and no data!"
8339                         val="$undef"
8340                 fi
8341         else
8342                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8343                 eagain=EAGAIN
8344         fi
8345         set d_eofnblk
8346         eval $setvar
8347         ;;
8348 *)
8349         echo "Using $hint value $eagain."
8350         echo "Your read() returns $rd_nodata when no data is present."
8351         case "$d_eofnblk" in
8352         "$define") echo "And you can see EOF because read() returns 0.";;
8353         "$undef") echo "But you can't see EOF status from read() returned value.";;
8354         *)
8355                 echo "(Assuming you can't see EOF status from read anyway.)"
8356                 d_eofnblk=$undef
8357                 ;;
8358         esac
8359         ;;
8360 esac
8361 $rm -f try try.* .out core head.c mtry
8362
8363 : see if fchmod exists
8364 set fchmod d_fchmod
8365 eval $inlibc
8366
8367 : see if fchown exists
8368 set fchown d_fchown
8369 eval $inlibc
8370
8371 : see if this is an fcntl system
8372 set fcntl d_fcntl
8373 eval $inlibc
8374
8375 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8376 while $test $# -ge 2; do
8377         case "$1" in
8378         $define) echo "#include <$2>";;
8379         esac ;
8380     shift 2;
8381 done > try.c;
8382 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8383 set try;
8384 if eval $compile; then
8385         val="$define";
8386 else
8387         val="$undef";
8388 fi;
8389 set $varname;
8390 eval $setvar;
8391 $rm -f try.c try.o'
8392
8393 socketlib=''
8394 sockethdr=''
8395 : see whether socket exists
8396 echo " "
8397 $echo $n "Hmm... $c" >&4
8398 if set socket val -f d_socket; eval $csym; $val; then
8399         echo "Looks like you have Berkeley networking support." >&4
8400         d_socket="$define"
8401         if set setsockopt val -f; eval $csym; $val; then
8402                 d_oldsock="$undef"
8403         else
8404                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8405                 d_oldsock="$define"
8406         fi
8407 else
8408         if $contains socklib libc.list >/dev/null 2>&1; then
8409                 echo "Looks like you have Berkeley networking support." >&4
8410                 d_socket="$define"
8411                 : we will have to assume that it supports the 4.2 BSD interface
8412                 d_oldsock="$undef"
8413         else
8414                 echo "You don't have Berkeley networking in libc$_a..." >&4
8415                 if test "X$d_socket" = "X$define"; then
8416                    echo "...but you seem to believe that you have sockets." >&4
8417                 else
8418                         for net in net socket
8419                         do
8420                                 if test -f /usr/lib/lib$net$_a; then
8421                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8422                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8423                                         if $contains socket libc.list >/dev/null 2>&1; then
8424                                                 d_socket="$define"
8425                                                 socketlib="-l$net"
8426                                                 case "$net" in
8427                                                 net)
8428                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8429                                                         sockethdr="-I/usr/netinclude"
8430                                                         ;;
8431                                                 esac
8432                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8433                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8434                                                         d_oldsock="$undef"
8435                                                 else
8436                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8437                                                         d_oldsock="$define"
8438                                                 fi
8439                                                 break
8440                                         fi
8441                                 fi
8442                         done
8443                         if test "X$d_socket" != "X$define"; then
8444                            echo "or anywhere else I see." >&4
8445                            d_socket="$undef"
8446                            d_oldsock="$undef"
8447                         fi
8448                 fi
8449         fi
8450 fi
8451
8452 : see if socketpair exists
8453 set socketpair d_sockpair
8454 eval $inlibc
8455
8456
8457 echo " "
8458 echo "Checking the availability of certain socket constants..." >& 4
8459 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8460         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8461         $cat >try.c <<EOF
8462 #include <sys/types.h>
8463 #include <sys/socket.h>
8464 int main() {
8465     int i = $ENUM;
8466 }
8467 EOF
8468         val="$undef"
8469         set try; if eval $compile; then
8470                 val="$define"
8471         fi
8472         set d_${enum}; eval $setvar
8473         $rm -f try.c try
8474 done
8475
8476 : see if sys/select.h has to be included
8477 set sys/select.h i_sysselct
8478 eval $inhdr
8479
8480 : see if we should include time.h, sys/time.h, or both
8481 echo " "
8482 if test "X$timeincl" = X; then
8483         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8484         $echo $n "I'm now running the test program...$c"
8485         $cat >try.c <<'EOCP'
8486 #include <sys/types.h>
8487 #ifdef I_TIME
8488 #include <time.h>
8489 #endif
8490 #ifdef I_SYSTIME
8491 #ifdef SYSTIMEKERNEL
8492 #define KERNEL
8493 #endif
8494 #include <sys/time.h>
8495 #endif
8496 #ifdef I_SYSSELECT
8497 #include <sys/select.h>
8498 #endif
8499 int main()
8500 {
8501         struct tm foo;
8502 #ifdef S_TIMEVAL
8503         struct timeval bar;
8504 #endif
8505 #ifdef S_TIMEZONE
8506         struct timezone tzp;
8507 #endif
8508         if (foo.tm_sec == foo.tm_sec)
8509                 exit(0);
8510 #ifdef S_TIMEVAL
8511         if (bar.tv_sec == bar.tv_sec)
8512                 exit(0);
8513 #endif
8514         exit(1);
8515 }
8516 EOCP
8517         flags=''
8518         for s_timezone in '-DS_TIMEZONE' ''; do
8519         sysselect=''
8520         for s_timeval in '-DS_TIMEVAL' ''; do
8521         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8522         for i_time in '' '-DI_TIME'; do
8523         for i_systime in '-DI_SYSTIME' ''; do
8524                 case "$flags" in
8525                 '') $echo $n ".$c"
8526                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8527                         if eval $compile; then
8528                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8529                                 shift
8530                                 flags="$*"
8531                                 echo " "
8532                                 $echo $n "Succeeded with $flags$c"
8533                         fi
8534                         ;;
8535                 esac
8536         done
8537         done
8538         done
8539         done
8540         done
8541         timeincl=''
8542         echo " "
8543         case "$flags" in
8544         *SYSTIMEKERNEL*) i_systimek="$define"
8545                 timeincl=`./findhdr sys/time.h`
8546                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8547         *) i_systimek="$undef";;
8548         esac
8549         case "$flags" in
8550         *I_TIME*) i_time="$define"
8551                 timeincl=`./findhdr time.h`" $timeincl"
8552                 echo "We'll include <time.h>." >&4;;
8553         *) i_time="$undef";;
8554         esac
8555         case "$flags" in
8556         *I_SYSTIME*) i_systime="$define"
8557                 timeincl=`./findhdr sys/time.h`" $timeincl"
8558                 echo "We'll include <sys/time.h>." >&4;;
8559         *) i_systime="$undef";;
8560         esac
8561         $rm -f try.c try
8562 fi
8563
8564 : check for fd_set items
8565 $cat <<EOM
8566
8567 Checking to see how well your C compiler handles fd_set and friends ...
8568 EOM
8569 $cat >fd_set.c <<EOCP
8570 #$i_systime I_SYS_TIME
8571 #$i_sysselct I_SYS_SELECT
8572 #$d_socket HAS_SOCKET
8573 #include <sys/types.h>
8574 #ifdef HAS_SOCKET
8575 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8576 #endif
8577 #ifdef I_SYS_TIME
8578 #include <sys/time.h>
8579 #endif
8580 #ifdef I_SYS_SELECT
8581 #include <sys/select.h>
8582 #endif
8583 int main() {
8584         fd_set fds;
8585
8586 #ifdef TRYBITS
8587         if(fds.fds_bits);
8588 #endif
8589
8590 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8591         exit(0);
8592 #else
8593         exit(1);
8594 #endif
8595 }
8596 EOCP
8597 set fd_set -DTRYBITS
8598 if eval $compile; then
8599         d_fds_bits="$define"
8600         d_fd_set="$define"
8601         echo "Well, your system knows about the normal fd_set typedef..." >&4
8602         if ./fd_set; then
8603                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8604                 d_fd_macros="$define"
8605         else
8606                 $cat >&4 <<'EOM'
8607 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8608 EOM
8609                 d_fd_macros="$undef"
8610         fi
8611 else
8612         $cat <<'EOM'
8613 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8614 EOM
8615         set fd_set
8616         if eval $compile; then
8617                 d_fds_bits="$undef"
8618                 d_fd_set="$define"
8619                 echo "Well, your system has some sort of fd_set available..." >&4
8620                 if ./fd_set; then
8621                         echo "and you have the normal fd_set macros." >&4
8622                         d_fd_macros="$define"
8623                 else
8624                         $cat <<'EOM'
8625 but not the normal fd_set macros!  Gross!  More work for me...
8626 EOM
8627                         d_fd_macros="$undef"
8628                 fi
8629         else
8630         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8631                 d_fd_set="$undef"
8632                 d_fds_bits="$undef"
8633                 d_fd_macros="$undef"
8634         fi
8635 fi
8636 $rm -f fd_set*
8637
8638 : see if fgetpos exists
8639 set fgetpos d_fgetpos
8640 eval $inlibc
8641
8642 : see if flock exists
8643 set flock d_flock
8644 eval $inlibc
8645
8646 : see if fork exists
8647 set fork d_fork
8648 eval $inlibc
8649
8650 : see if pathconf exists
8651 set pathconf d_pathconf
8652 eval $inlibc
8653
8654 : see if fpathconf exists
8655 set fpathconf d_fpathconf
8656 eval $inlibc
8657
8658
8659 : check for off64_t
8660 echo " "
8661 echo "Checking to see if your system supports off64_t..." >&4
8662 $cat >try.c <<EOCP
8663 #include <sys/types.h>
8664 #include <unistd.h>
8665 int main() { off64_t x = 7; }'
8666 EOCP
8667 set try
8668 if eval $compile; then
8669         val="$define"
8670         echo "Yes, it does."
8671 else
8672         val="$undef"
8673         echo "No, it doesn't."
8674         case "$lseeksize" in
8675         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8676         esac
8677 fi
8678 $rm -f try.* try
8679 set d_off64_t
8680 eval $setvar
8681
8682 : check for fpos64_t
8683 echo " "
8684 echo "Checking to see if your system supports fpos64_t..." >&4
8685 $cat >try.c <<EOCP
8686 #include <sys/stdio.h>
8687 int main() { fpos64_t x x = 7; }'
8688 EOCP
8689 set try
8690 if eval $compile; then
8691         val="$define"
8692         echo "Yes, it does."
8693 else
8694         val="$undef"
8695         echo "No, it doesn't."
8696         case "$fpossize" in
8697         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8698         esac
8699 fi
8700 $rm -f try.* try
8701 set d_fpos64_t
8702 eval $setvar
8703
8704 hasstruct='varname=$1; struct=$2; shift; shift;
8705 while $test $# -ge 2; do
8706         case "$1" in
8707         $define) echo "#include <$2>";;
8708         esac ;
8709     shift 2;
8710 done > try.c;
8711 echo "int main () { struct $struct foo; }" >> try.c;
8712 set try;
8713 if eval $compile; then
8714         val="$define";
8715 else
8716         val="$undef";
8717 fi;
8718 set $varname;
8719 eval $setvar;
8720 $rm -f try.c try.o'
8721
8722 : see if this is a sys/param system
8723 set sys/param.h i_sysparam
8724 eval $inhdr
8725
8726 : see if this is a sys/mount.h system
8727 set sys/mount.h i_sysmount
8728 eval $inhdr
8729
8730 : see if sys/types.h has to be included
8731 set sys/types.h i_systypes
8732 eval $inhdr
8733
8734
8735 echo " "
8736 echo "Checking to see if your system supports struct fs_data..." >&4
8737 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8738 eval $hasstruct
8739 case "$d_fs_data_s" in
8740 "$define")      echo "Yes, it does."   ;;
8741 *)              echo "No, it doesn't." ;;
8742 esac
8743
8744 : see if fseeko exists
8745 set fseeko d_fseeko
8746 eval $inlibc
8747 case "$longsize" in
8748 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8749 esac
8750
8751 : see if fsetpos exists
8752 set fsetpos d_fsetpos
8753 eval $inlibc
8754
8755
8756 : see if fstatfs exists
8757 set fstatfs d_fstatfs
8758 eval $inlibc
8759
8760
8761 : see if statvfs exists
8762 set statvfs d_statvfs
8763 eval $inlibc
8764
8765 : see if fstatvfs exists
8766 set fstatvfs d_fstatvfs
8767 eval $inlibc
8768
8769
8770 : see if ftello exists
8771 set ftello d_ftello
8772 eval $inlibc
8773 case "$longsize" in
8774 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8775 esac
8776
8777 : see if getgrent exists
8778 set getgrent d_getgrent
8779 eval $inlibc
8780
8781 : see if gethostbyaddr exists
8782 set gethostbyaddr d_gethbyaddr
8783 eval $inlibc
8784
8785 : see if gethostbyname exists
8786 set gethostbyname d_gethbyname
8787 eval $inlibc
8788
8789 : see if gethostent exists
8790 set gethostent d_gethent
8791 eval $inlibc
8792
8793 : see how we will look up host name
8794 echo " "
8795 call=''
8796 if set gethostname val -f d_gethname; eval $csym; $val; then
8797         echo 'gethostname() found.' >&4
8798         d_gethname="$define"
8799         call=gethostname
8800 fi
8801 if set uname val -f d_uname; eval $csym; $val; then
8802         if ./xenix; then
8803                 $cat <<'EOM'
8804 uname() was found, but you're running xenix, and older versions of xenix
8805 have a broken uname(). If you don't really know whether your xenix is old
8806 enough to have a broken system call, use the default answer.
8807
8808 EOM
8809                 dflt=y
8810                 case "$d_uname" in
8811                 "$define") dflt=n;;
8812                 esac
8813                 rp='Is your uname() broken?'
8814                 . ./myread
8815                 case "$ans" in
8816                 n*) d_uname="$define"; call=uname;;
8817                 esac
8818         else
8819                 echo 'uname() found.' >&4
8820                 d_uname="$define"
8821                 case "$call" in
8822                 '') call=uname ;;
8823                 esac
8824         fi
8825 fi
8826 case "$d_gethname" in
8827 '') d_gethname="$undef";;
8828 esac
8829 case "$d_uname" in
8830 '') d_uname="$undef";;
8831 esac
8832 case "$d_uname$d_gethname" in
8833 *define*)
8834         dflt=n
8835         cat <<EOM
8836  
8837 Every now and then someone has a $call() that lies about the hostname
8838 but can't be fixed for political or economic reasons.  If you wish, I can
8839 pretend $call() isn't there and maybe compute hostname at run-time
8840 thanks to the '$phostname' command.
8841
8842 EOM
8843         rp="Shall I ignore $call() from now on?"
8844         . ./myread
8845         case "$ans" in
8846         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8847         esac;;
8848 esac
8849 case "$phostname" in
8850 '') aphostname='';;
8851 *) case "$aphostname" in
8852         /*) ;;
8853         *) set X $phostname
8854                 shift
8855                 file=$1
8856                 shift
8857                 file=`./loc $file $file $pth`
8858                 aphostname=`echo $file $*`
8859                 ;;
8860         esac
8861         ;;
8862 esac
8863 case "$d_uname$d_gethname" in
8864 *define*) ;;
8865 *)
8866         case "$phostname" in
8867         '')
8868                 echo "There will be no way for $package to get your hostname." >&4;;
8869         *)
8870         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8871                 ;;
8872         esac;;
8873 esac
8874 case "$d_phostname" in
8875 '') d_phostname="$undef";;
8876 esac
8877
8878 : see if this is a netdb.h system
8879 set netdb.h i_netdb
8880 eval $inhdr
8881
8882 : see if prototypes for various gethostxxx netdb.h functions are available
8883 echo " "
8884 set d_gethostprotos gethostent $i_netdb netdb.h
8885 eval $hasproto
8886
8887 : see if getlogin exists
8888 set getlogin d_getlogin
8889 eval $inlibc
8890
8891 : see if getmnt exists
8892 set getmnt d_getmnt
8893 eval $inlibc
8894
8895 : see if getmntent exists
8896 set getmntent d_getmntent
8897 eval $inlibc
8898
8899 : see if getnetbyaddr exists
8900 set getnetbyaddr d_getnbyaddr
8901 eval $inlibc
8902
8903 : see if getnetbyname exists
8904 set getnetbyname d_getnbyname
8905 eval $inlibc
8906
8907 : see if getnetent exists
8908 set getnetent d_getnent
8909 eval $inlibc
8910
8911 : see if prototypes for various getnetxxx netdb.h functions are available
8912 echo " "
8913 set d_getnetprotos getnetent $i_netdb netdb.h
8914 eval $hasproto
8915
8916
8917 : see if getprotobyname exists
8918 set getprotobyname d_getpbyname
8919 eval $inlibc
8920
8921 : see if getprotobynumber exists
8922 set getprotobynumber d_getpbynumber
8923 eval $inlibc
8924
8925 : see if getprotoent exists
8926 set getprotoent d_getpent
8927 eval $inlibc
8928
8929 : see if getpgid exists
8930 set getpgid d_getpgid
8931 eval $inlibc
8932
8933 : see if getpgrp2 exists
8934 set getpgrp2 d_getpgrp2
8935 eval $inlibc
8936
8937 : see if getppid exists
8938 set getppid d_getppid
8939 eval $inlibc
8940
8941 : see if getpriority exists
8942 set getpriority d_getprior
8943 eval $inlibc
8944
8945 : see if prototypes for various getprotoxxx netdb.h functions are available
8946 echo " "
8947 set d_getprotoprotos getprotoent $i_netdb netdb.h
8948 eval $hasproto
8949
8950 : see if getpwent exists
8951 set getpwent d_getpwent
8952 eval $inlibc
8953
8954
8955 : see if getservbyname exists
8956 set getservbyname d_getsbyname
8957 eval $inlibc
8958
8959 : see if getservbyport exists
8960 set getservbyport d_getsbyport
8961 eval $inlibc
8962
8963 : see if getservent exists
8964 set getservent d_getsent
8965 eval $inlibc
8966
8967 : see if prototypes for various getservxxx netdb.h functions are available
8968 echo " "
8969 set d_getservprotos getservent $i_netdb netdb.h
8970 eval $hasproto
8971
8972 : see if getspent exists
8973 set getspent d_getspent
8974 eval $inlibc
8975
8976 : see if getspnam exists
8977 set getspnam d_getspnam
8978 eval $inlibc
8979
8980 : see if gettimeofday or ftime exists
8981 set gettimeofday d_gettimeod
8982 eval $inlibc
8983 case "$d_gettimeod" in
8984 "$undef")
8985         set ftime d_ftime 
8986         eval $inlibc
8987         ;;
8988 *)
8989         val="$undef"; set d_ftime; eval $setvar
8990         ;;
8991 esac
8992 case "$d_gettimeod$d_ftime" in
8993 "$undef$undef")
8994         echo " "
8995         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8996         ;;
8997 esac
8998
8999 : see if this is an grp system
9000 set grp.h i_grp
9001 eval $inhdr
9002
9003 case "$i_grp" in
9004 $define)
9005         xxx=`./findhdr grp.h`
9006         $cppstdin $cppflags $cppminus < $xxx >$$.h
9007
9008         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9009                 val="$define"
9010         else
9011                 val="$undef"
9012         fi
9013         set d_grpasswd
9014         eval $setvar
9015
9016         $rm -f $$.h
9017         ;;
9018 *)
9019         val="$undef";
9020         set d_grpasswd; eval $setvar
9021         ;;
9022 esac
9023
9024 : see if hasmntopt exists
9025 set hasmntopt d_hasmntopt
9026 eval $inlibc
9027
9028 : see if this is a netinet/in.h or sys/in.h system
9029 set netinet/in.h i_niin sys/in.h i_sysin
9030 eval $inhdr
9031
9032 : see if arpa/inet.h has to be included
9033 set arpa/inet.h i_arpainet
9034 eval $inhdr
9035
9036 : see if htonl --and friends-- exists
9037 val=''
9038 set htonl val
9039 eval $inlibc
9040
9041 : Maybe they are macros.
9042 case "$val" in
9043 $undef)
9044         $cat >htonl.c <<EOM
9045 #include <stdio.h>
9046 #include <sys/types.h>
9047 #$i_niin I_NETINET_IN
9048 #$i_sysin I_SYS_IN
9049 #$i_arpainet I_ARPA_INET
9050 #ifdef I_NETINET_IN
9051 #include <netinet/in.h>
9052 #endif
9053 #ifdef I_SYS_IN
9054 #include <sys/in.h>
9055 #endif
9056 #ifdef I_ARPA_INET
9057 #include <arpa/inet.h>
9058 #endif
9059 #ifdef htonl
9060 printf("Defined as a macro.");
9061 #endif
9062 EOM
9063         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9064         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9065                 val="$define"
9066                 echo "But it seems to be defined as a macro." >&4
9067         fi
9068         $rm -f htonl.?
9069         ;;
9070 esac
9071 set d_htonl
9072 eval $setvar
9073
9074 : index or strchr
9075 echo " "
9076 if set index val -f; eval $csym; $val; then
9077         if set strchr val -f d_strchr; eval $csym; $val; then
9078                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9079                         val="$define"
9080                         vali="$undef"
9081                         echo "strchr() found." >&4
9082                 else
9083                         val="$undef"
9084                         vali="$define"
9085                         echo "index() found." >&4
9086                 fi
9087         else
9088                 val="$undef"
9089                 vali="$define"
9090                 echo "index() found." >&4
9091         fi
9092 else
9093         if set strchr val -f d_strchr; eval $csym; $val; then
9094                 val="$define"
9095                 vali="$undef"
9096                 echo "strchr() found." >&4
9097         else
9098                 echo "No index() or strchr() found!" >&4
9099                 val="$undef"
9100                 vali="$undef"
9101         fi
9102 fi
9103 set d_strchr; eval $setvar
9104 val="$vali"
9105 set d_index; eval $setvar
9106
9107 : check whether inet_aton exists
9108 set inet_aton d_inetaton
9109 eval $inlibc
9110
9111 : see if inttypes.h is available
9112 : we want a real compile instead of Inhdr because some systems
9113 : have an inttypes.h which includes non-existent headers
9114 echo " "
9115 $cat >try.c <<EOCP
9116 #include <inttypes.h>
9117 int main() {
9118         static int32_t foo32 = 0x12345678;
9119 }
9120 EOCP
9121 set try
9122 if eval $compile; then
9123         echo "<inttypes.h> found." >&4
9124         val="$define"
9125 else
9126         echo "<inttypes.h> NOT found." >&4
9127         val="$undef"
9128 fi
9129 $rm -f try.c try
9130 set i_inttypes
9131 eval $setvar
9132
9133 : check for int64_t
9134 echo " "
9135 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9136 $cat >try.c <<EOCP
9137 #include <sys/types.h>
9138 #$i_inttypes I_INTTYPES
9139 #ifdef I_INTTYPES
9140 #include <inttypes.h>
9141 #endif
9142 int main() { int64_t x = 7; }
9143 EOCP
9144 set try
9145 if eval $compile; then
9146         val="$define"
9147         echo " Yes, it does." >&4
9148 else
9149         val="$undef"
9150         echo " No, it doesn't." >&4
9151 fi
9152 $rm -f try try.*
9153 set d_int64t
9154 eval $setvar
9155
9156 : Look for isascii
9157 echo " "
9158 $cat >isascii.c <<'EOCP'
9159 #include <stdio.h>
9160 #include <ctype.h>
9161 int main() {
9162         int c = 'A';
9163         if (isascii(c))
9164                 exit(0);
9165         else
9166                 exit(1);
9167 }
9168 EOCP
9169 set isascii
9170 if eval $compile; then
9171         echo "isascii() found." >&4
9172         val="$define"
9173 else
9174         echo "isascii() NOT found." >&4
9175         val="$undef"
9176 fi
9177 set d_isascii
9178 eval $setvar
9179 $rm -f isascii*
9180
9181 : see if killpg exists
9182 set killpg d_killpg
9183 eval $inlibc
9184
9185 : see if lchown exists
9186 echo " "
9187 $cat > try.c <<'EOCP'
9188 /* System header to define __stub macros and hopefully few prototypes,
9189     which can conflict with char lchown(); below.  */
9190 #include <assert.h>
9191 /* Override any gcc2 internal prototype to avoid an error.  */
9192 /* We use char because int might match the return type of a gcc2
9193    builtin and then its argument prototype would still apply.  */
9194 char lchown();
9195 int main() {
9196     /*  The GNU C library defines this for functions which it implements
9197         to always fail with ENOSYS.  Some functions are actually named
9198         something starting with __ and the normal name is an alias.  */
9199 #if defined (__stub_lchown) || defined (__stub___lchown)
9200 choke me
9201 #else
9202 lchown();
9203 #endif
9204 ; return 0; }
9205 EOCP
9206 set try
9207 if eval $compile; then
9208     $echo "lchown() found." >&4
9209     val="$define"
9210 else
9211     $echo "lchown() NOT found." >&4
9212     val="$undef"
9213 fi
9214 set d_lchown
9215 eval $setvar
9216
9217 : See if number of significant digits in a double precision number is known
9218 echo " "
9219 $cat >ldbl_dig.c <<EOM
9220 #$i_limits I_LIMITS
9221 #$i_float I_FLOAT
9222 #ifdef I_LIMITS
9223 #include <limits.h>
9224 #endif
9225 #ifdef I_FLOAT
9226 #include <float.h>
9227 #endif
9228 #ifdef LDBL_DIG
9229 printf("Contains LDBL_DIG");
9230 #endif
9231 EOM
9232 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9233 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9234         echo "LDBL_DIG found." >&4
9235         val="$define"
9236 else
9237         echo "LDBL_DIG NOT found." >&4
9238         val="$undef"
9239 fi
9240 $rm -f ldbl_dig.?
9241 set d_ldbl_dig
9242 eval $setvar
9243
9244 : see if link exists
9245 set link d_link
9246 eval $inlibc
9247
9248 : see if localeconv exists
9249 set localeconv d_locconv
9250 eval $inlibc
9251
9252 : see if lockf exists
9253 set lockf d_lockf
9254 eval $inlibc
9255
9256 : check for long long
9257 echo " "
9258 $echo $n "Checking to see if your system supports long long..." $c >&4
9259 echo 'int main() { long long x = 7; return 0; }' > try.c
9260 set try
9261 if eval $compile; then
9262         val="$define"
9263         echo " Yes, it does." >&4
9264 else
9265         val="$undef"
9266         echo " No, it doesn't." >&4
9267 fi
9268 $rm try.*
9269 set d_longlong
9270 eval $setvar
9271
9272 : check for length of long long
9273 case "${d_longlong}${longlongsize}" in
9274 $define)
9275         echo " "
9276         $echo $n "Checking to see how big your long longs are..." $c >&4
9277         $cat >try.c <<'EOCP'
9278 #include <stdio.h>
9279 int main()
9280 {
9281     printf("%d\n", (int)sizeof(long long));
9282     return(0);
9283 }
9284 EOCP
9285         set try
9286         if eval $compile_ok; then
9287                 longlongsize=`./try$exe_ext`
9288                 $echo " $longlongsize bytes." >&4
9289         else
9290                 dflt='8'
9291                 echo " "
9292                 echo "(I can't seem to compile the test program.  Guessing...)"
9293                 rp="What is the size of a long long (in bytes)?"
9294                 . ./myread
9295                 longlongsize="$ans"
9296         fi
9297         if $test "X$longsize" = "X$longlongsize"; then
9298                 echo "(That isn't any different from an ordinary long.)"
9299         fi      
9300         ;;
9301 esac
9302 $rm -f try.* try
9303
9304 : see if lstat exists
9305 set lstat d_lstat
9306 eval $inlibc
9307
9308 : see if mblen exists
9309 set mblen d_mblen
9310 eval $inlibc
9311
9312 : see if mbstowcs exists
9313 set mbstowcs d_mbstowcs
9314 eval $inlibc
9315
9316 : see if mbtowc exists
9317 set mbtowc d_mbtowc
9318 eval $inlibc
9319
9320 : see if memchr exists
9321 set memchr d_memchr
9322 eval $inlibc
9323
9324 : see if memcmp exists
9325 set memcmp d_memcmp
9326 eval $inlibc
9327
9328 : see if memcpy exists
9329 set memcpy d_memcpy
9330 eval $inlibc
9331
9332 : see if memmove exists
9333 set memmove d_memmove
9334 eval $inlibc
9335
9336 : see if memset exists
9337 set memset d_memset
9338 eval $inlibc
9339
9340 : see if mkdir exists
9341 set mkdir d_mkdir
9342 eval $inlibc
9343
9344 : see if mkfifo exists
9345 set mkfifo d_mkfifo
9346 eval $inlibc
9347
9348 : see if mktime exists
9349 set mktime d_mktime
9350 eval $inlibc
9351
9352 : see if msgctl exists
9353 set msgctl d_msgctl
9354 eval $inlibc
9355
9356 : see if msgget exists
9357 set msgget d_msgget
9358 eval $inlibc
9359
9360 : see if msgsnd exists
9361 set msgsnd d_msgsnd
9362 eval $inlibc
9363
9364 : see if msgrcv exists
9365 set msgrcv d_msgrcv
9366 eval $inlibc
9367
9368 : see how much of the 'msg*(2)' library is present.
9369 h_msg=true
9370 echo " "
9371 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9372 *"$undef"*) h_msg=false;;
9373 esac
9374 case "$osname" in
9375 freebsd)
9376     case "`ipcs 2>&1`" in
9377     "SVID messages"*"not configured"*)
9378         echo "Your $osname does not have the msg*(2) configured." >&4
9379         h_msg=false
9380         val="$undef"
9381         set msgctl d_msgctl
9382         eval $setvar
9383         set msgget d_msgget
9384         eval $setvar
9385         set msgsnd d_msgsnd
9386         eval $setvar
9387         set msgrcv d_msgrcv
9388         eval $setvar
9389         ;;
9390     esac
9391     ;;
9392 esac
9393 : we could also check for sys/ipc.h ...
9394 if $h_msg && $test `./findhdr sys/msg.h`; then
9395         echo "You have the full msg*(2) library." >&4
9396         val="$define"
9397 else
9398         echo "You don't have the full msg*(2) library." >&4
9399         val="$undef"
9400 fi
9401 set d_msg
9402 eval $setvar
9403
9404 : see if nice exists
9405 set nice d_nice
9406 eval $inlibc
9407
9408 : see if POSIX threads are available
9409 set pthread.h i_pthread
9410 eval $inhdr
9411
9412
9413
9414
9415 : how to create joinable pthreads
9416 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9417         echo " "
9418         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9419         $cat >try.c <<'EOCP'
9420 #include <pthread.h>
9421 int main() {
9422     int detachstate = JOINABLE;
9423 }
9424 EOCP
9425         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9426         if eval $compile; then
9427                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9428                 val="$undef" # Yes, undef.
9429                 set d_old_pthread_create_joinable
9430                 eval $setvar
9431                 val=""
9432                 set old_pthread_create_joinable
9433                 eval $setvar
9434         else
9435                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9436                 if eval $compile; then
9437                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9438                         val="$define"
9439                         set d_old_pthread_create_joinable
9440                         eval $setvar
9441                         val=PTHREAD_CREATE_UNDETACHED
9442                         set old_pthread_create_joinable
9443                         eval $setvar
9444                 else            
9445                         set try -DJOINABLE=__UNDETACHED
9446                         if eval $compile; then
9447                                 echo "You seem to use __UNDETACHED." >&4
9448                                 val="$define"
9449                                 set d_old_pthread_create_joinable
9450                                 eval $setvar
9451                                 val=__UNDETACHED
9452                                 set old_pthread_create_joinable
9453                                 eval $setvar
9454                         else
9455                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9456                                 val="$define"
9457                                 set d_old_pthread_create_joinable
9458                                 eval $setvar
9459                                 val=0
9460                                 set old_pthread_create_joinable
9461                                 eval $setvar
9462                         fi
9463                 fi
9464         fi
9465         $rm -f try try.*
9466 else
9467     d_old_pthread_create_joinable="$undef"
9468     old_pthread_create_joinable=""
9469 fi
9470
9471 : see if pause exists
9472 set pause d_pause
9473 eval $inlibc
9474
9475 : see if pipe exists
9476 set pipe d_pipe
9477 eval $inlibc
9478
9479 : see if poll exists
9480 set poll d_poll
9481 eval $inlibc
9482
9483
9484 : see whether the various POSIXish _yields exist
9485 $cat >try.c <<EOP
9486 #include <pthread.h>
9487 #include <stdio.h>
9488 int main() {
9489 #ifdef SCHED_YIELD
9490         sched_yield();
9491 #else
9492 #ifdef PTHREAD_YIELD
9493         pthread_yield();
9494 #else
9495 #ifdef PTHREAD_YIELD_NULL
9496         pthread_yield(NULL);
9497 #endif
9498 #endif
9499 #endif
9500 }
9501 EOP
9502 : see if sched_yield exists
9503 set try -DSCHED_YIELD
9504 if eval $compile; then
9505     val="$define"
9506     sched_yield='sched_yield()'
9507 else
9508     val="$undef"
9509 fi
9510 case "$usethreads" in
9511 $define)
9512         case "$val" in
9513         $define) echo 'sched_yield() found.' >&4        ;;
9514         *)       echo 'sched_yield() NOT found.' >&4    ;;
9515         esac
9516 esac
9517 set d_sched_yield
9518 eval $setvar
9519
9520 : see if pthread_yield exists
9521 set try -DPTHREAD_YIELD
9522 if eval $compile; then
9523     val="$define"
9524     case "$sched_yield" in
9525     '') sched_yield='pthread_yield()' ;;
9526     esac
9527 else
9528     set try -DPTHREAD_YIELD_NULL
9529     if eval $compile; then
9530         val="$define"
9531         case "$sched_yield" in
9532         '') sched_yield='pthread_yield(NULL)' ;;
9533         esac
9534     else
9535         val="$undef"
9536     fi
9537 fi
9538 case "$usethreads" in
9539 $define)
9540         case "$val" in
9541         $define) echo 'pthread_yield() found.' >&4      ;;
9542         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9543         esac
9544         ;;
9545 esac
9546 set d_pthread_yield
9547 eval $setvar
9548
9549 case "$sched_yield" in
9550 '') sched_yield=undef ;;
9551 esac
9552
9553 $rm -f try try.*
9554
9555 : see if this is a pwd.h system
9556 set pwd.h i_pwd
9557 eval $inhdr
9558
9559 case "$i_pwd" in
9560 $define)
9561         xxx=`./findhdr pwd.h`
9562         $cppstdin $cppflags $cppminus < $xxx >$$.h
9563
9564         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9565                 val="$define"
9566         else
9567                 val="$undef"
9568         fi
9569         set d_pwquota
9570         eval $setvar
9571
9572         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9573                 val="$define"
9574         else
9575                 val="$undef"
9576         fi
9577         set d_pwage
9578         eval $setvar
9579
9580         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9581                 val="$define"
9582         else
9583                 val="$undef"
9584         fi
9585         set d_pwchange
9586         eval $setvar
9587
9588         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9589                 val="$define"
9590         else
9591                 val="$undef"
9592         fi
9593         set d_pwclass
9594         eval $setvar
9595
9596         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9597                 val="$define"
9598         else
9599                 val="$undef"
9600         fi
9601         set d_pwexpire
9602         eval $setvar
9603
9604         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9605                 val="$define"
9606         else
9607                 val="$undef"
9608         fi
9609         set d_pwcomment
9610         eval $setvar
9611
9612         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9613                 val="$define"
9614         else
9615                 val="$undef"
9616         fi
9617         set d_pwgecos
9618         eval $setvar
9619
9620         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9621                 val="$define"
9622         else
9623                 val="$undef"
9624         fi
9625         set d_pwpasswd
9626         eval $setvar
9627
9628         $rm -f $$.h
9629         ;;
9630 *)
9631         val="$undef"; 
9632         set d_pwquota; eval $setvar
9633         set d_pwage; eval $setvar
9634         set d_pwchange; eval $setvar
9635         set d_pwclass; eval $setvar
9636         set d_pwexpire; eval $setvar
9637         set d_pwcomment; eval $setvar
9638         set d_pwgecos; eval $setvar
9639         set d_pwpasswd; eval $setvar
9640         ;;
9641 esac
9642
9643
9644 echo " "
9645 echo "Checking which 64-bit integer type we could use..." >&4
9646
9647 case "$intsize" in
9648 8) val=int
9649    set quadtype
9650    eval $setvar
9651    val='"unsigned int"'
9652    set uquadtype
9653    eval $setvar
9654    quadkind=1
9655    ;;
9656 *) case "$longsize" in
9657    8) val=long
9658       set quadtype
9659       eval $setvar
9660       val='"unsigned long"'
9661       set uquadtype
9662       eval $setvar
9663       quadkind=2
9664       ;;
9665    *) case "$uselonglong:$d_longlong:$longlongsize" in
9666       define:define:8)
9667         val='"long long"'
9668         set quadtype
9669         eval $setvar
9670         val='"unsigned long long"'
9671         set uquadtype
9672         eval $setvar
9673         quadkind=3
9674         ;;
9675       *) case "$d_int64t" in
9676          define)
9677            val=int64_t
9678            set quadtype
9679            eval $setvar
9680            val=uint64_t
9681            set uquadtype
9682            eval $setvar
9683            quadkind=4
9684            ;;
9685          esac
9686          ;;
9687       esac
9688       ;;
9689    esac
9690    ;;
9691 esac
9692
9693 case "$quadtype" in
9694 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9695         undef:define:8)
9696            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9697         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9698         esac
9699         d_quad="$undef"
9700         ;;
9701 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9702             verb="will"
9703         else
9704             verb="could"
9705         fi
9706         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9707         d_quad="$define"
9708         ;;
9709 esac
9710
9711 : see if readdir and friends exist
9712 set readdir d_readdir
9713 eval $inlibc
9714 set seekdir d_seekdir
9715 eval $inlibc
9716 set telldir d_telldir
9717 eval $inlibc
9718 set rewinddir d_rewinddir
9719 eval $inlibc
9720
9721 : see if readlink exists
9722 set readlink d_readlink
9723 eval $inlibc
9724
9725 : see if rename exists
9726 set rename d_rename
9727 eval $inlibc
9728
9729 : see if rmdir exists
9730 set rmdir d_rmdir
9731 eval $inlibc
9732
9733 : see if memory.h is available.
9734 val=''
9735 set memory.h val
9736 eval $inhdr
9737
9738 : See if it conflicts with string.h
9739 case "$val" in
9740 $define)
9741         case "$strings" in
9742         '') ;;
9743         *)
9744                 $cppstdin $cppflags $cppminus < $strings > mem.h
9745                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9746                         echo " "
9747                         echo "We won't be including <memory.h>."
9748                         val="$undef"
9749                 fi
9750                 $rm -f mem.h
9751                 ;;
9752         esac
9753 esac
9754 set i_memory
9755 eval $setvar
9756
9757 : can bcopy handle overlapping blocks?
9758 val="$undef"
9759 case "$d_bcopy" in
9760 "$define")
9761         echo " "
9762         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9763         $cat >try.c <<EOCP
9764 #$i_memory I_MEMORY
9765 #$i_stdlib I_STDLIB
9766 #$i_string I_STRING
9767 #$i_unistd I_UNISTD
9768 EOCP
9769         $cat >>try.c <<'EOCP'
9770 #include <stdio.h>
9771 #ifdef I_MEMORY
9772 #  include <memory.h>
9773 #endif
9774 #ifdef I_STDLIB
9775 #  include <stdlib.h>
9776 #endif
9777 #ifdef I_STRING
9778 #  include <string.h>
9779 #else
9780 #  include <strings.h>
9781 #endif
9782 #ifdef I_UNISTD
9783 #  include <unistd.h>  /* Needed for NetBSD */
9784 #endif
9785 int main()
9786 {
9787 char buf[128], abc[128];
9788 char *b;
9789 int len;
9790 int off;
9791 int align;
9792
9793 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9794
9795 for (align = 7; align >= 0; align--) {
9796         for (len = 36; len; len--) {
9797                 b = buf+align;
9798                 bcopy(abc, b, len);
9799                 for (off = 1; off <= len; off++) {
9800                         bcopy(b, b+off, len);
9801                         bcopy(b+off, b, len);
9802                         if (bcmp(b, abc, len))
9803                                 exit(1);
9804                 }
9805         }
9806 }
9807 exit(0);
9808 }
9809 EOCP
9810         set try
9811         if eval $compile_ok; then
9812                 if ./try 2>/dev/null; then
9813                         echo "Yes, it can."
9814                         val="$define"
9815                 else
9816                         echo "It can't, sorry."
9817                         case "$d_memmove" in
9818                         "$define") echo "But that's Ok since you have memmove()." ;;
9819                         esac
9820                 fi
9821         else
9822                 echo "(I can't compile the test program, so we'll assume not...)"
9823                 case "$d_memmove" in
9824                 "$define") echo "But that's Ok since you have memmove()." ;;
9825                 esac
9826         fi
9827         ;;
9828 esac
9829 $rm -f try.* try core
9830 set d_safebcpy
9831 eval $setvar
9832
9833 : can memcpy handle overlapping blocks?
9834 val="$undef"
9835 case "$d_memcpy" in
9836 "$define")
9837         echo " "
9838         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9839         $cat >try.c <<EOCP
9840 #$i_memory I_MEMORY
9841 #$i_stdlib I_STDLIB
9842 #$i_string I_STRING
9843 #$i_unistd I_UNISTD
9844 EOCP
9845         $cat >>try.c <<'EOCP'
9846 #include <stdio.h>
9847 #ifdef I_MEMORY
9848 #  include <memory.h>
9849 #endif
9850 #ifdef I_STDLIB
9851 #  include <stdlib.h>
9852 #endif
9853 #ifdef I_STRING
9854 #  include <string.h>
9855 #else
9856 #  include <strings.h>
9857 #endif
9858 #ifdef I_UNISTD
9859 #  include <unistd.h>  /* Needed for NetBSD */
9860 #endif
9861 int main()
9862 {
9863 char buf[128], abc[128];
9864 char *b;
9865 int len;
9866 int off;
9867 int align;
9868
9869 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9870    try to store the string in read-only memory. */
9871 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9872
9873 for (align = 7; align >= 0; align--) {
9874         for (len = 36; len; len--) {
9875                 b = buf+align;
9876                 memcpy(b, abc, len);
9877                 for (off = 1; off <= len; off++) {
9878                         memcpy(b+off, b, len);
9879                         memcpy(b, b+off, len);
9880                         if (memcmp(b, abc, len))
9881                                 exit(1);
9882                 }
9883         }
9884 }
9885 exit(0);
9886 }
9887 EOCP
9888         set try
9889         if eval $compile_ok; then
9890                 if ./try 2>/dev/null; then
9891                         echo "Yes, it can."
9892                         val="$define"
9893                 else
9894                         echo "It can't, sorry."
9895                         case "$d_memmove" in
9896                         "$define") echo "But that's Ok since you have memmove()." ;;
9897                         esac
9898                 fi
9899         else
9900                 echo "(I can't compile the test program, so we'll assume not...)"
9901                 case "$d_memmove" in
9902                 "$define") echo "But that's Ok since you have memmove()." ;;
9903                 esac
9904         fi
9905         ;;
9906 esac
9907 $rm -f try.* try core
9908 set d_safemcpy
9909 eval $setvar
9910
9911 : can memcmp be trusted to compare relative magnitude?
9912 val="$undef"
9913 case "$d_memcmp" in
9914 "$define")
9915         echo " "
9916         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9917         $cat >try.c <<EOCP
9918 #$i_memory I_MEMORY
9919 #$i_stdlib I_STDLIB
9920 #$i_string I_STRING
9921 #$i_unistd I_UNISTD
9922 EOCP
9923         $cat >>try.c <<'EOCP'
9924 #include <stdio.h>
9925 #ifdef I_MEMORY
9926 #  include <memory.h>
9927 #endif
9928 #ifdef I_STDLIB
9929 #  include <stdlib.h>
9930 #endif
9931 #ifdef I_STRING
9932 #  include <string.h>
9933 #else
9934 #  include <strings.h>
9935 #endif
9936 #ifdef I_UNISTD
9937 #  include <unistd.h>  /* Needed for NetBSD */
9938 #endif
9939 int main()
9940 {
9941 char a = -1;
9942 char b = 0;
9943 if ((a < b) && memcmp(&a, &b, 1) < 0)
9944         exit(1);
9945 exit(0);
9946 }
9947 EOCP
9948         set try
9949         if eval $compile_ok; then
9950                 if ./try 2>/dev/null; then
9951                         echo "Yes, it can."
9952                         val="$define"
9953                 else
9954                         echo "No, it can't (it uses signed chars)."
9955                 fi
9956         else
9957                 echo "(I can't compile the test program, so we'll assume not...)"
9958         fi
9959         ;;
9960 esac
9961 $rm -f try.* try core
9962 set d_sanemcmp
9963 eval $setvar
9964
9965 : see if select exists
9966 set select d_select
9967 eval $inlibc
9968
9969 : see if semctl exists
9970 set semctl d_semctl
9971 eval $inlibc
9972
9973 : see if semget exists
9974 set semget d_semget
9975 eval $inlibc
9976
9977 : see if semop exists
9978 set semop d_semop
9979 eval $inlibc
9980
9981 : see how much of the 'sem*(2)' library is present.
9982 h_sem=true
9983 echo " "
9984 case "$d_semctl$d_semget$d_semop" in
9985 *"$undef"*) h_sem=false;;
9986 esac
9987 case "$osname" in
9988 freebsd)
9989     case "`ipcs 2>&1`" in
9990     "SVID messages"*"not configured"*)
9991         echo "Your $osname does not have the sem*(2) configured." >&4
9992         h_sem=false
9993         val="$undef"
9994         set semctl d_semctl
9995         eval $setvar
9996         set semget d_semget
9997         eval $setvar
9998         set semop d_semop
9999         eval $setvar
10000         ;;
10001     esac
10002     ;;
10003 esac
10004 : we could also check for sys/ipc.h ...
10005 if $h_sem && $test `./findhdr sys/sem.h`; then
10006         echo "You have the full sem*(2) library." >&4
10007         val="$define"
10008 else
10009         echo "You don't have the full sem*(2) library." >&4
10010         val="$undef"
10011 fi
10012 set d_sem
10013 eval $setvar
10014
10015 : see whether sys/sem.h defines union semun
10016 echo " "
10017 $cat > try.c <<'END'
10018 #include <sys/types.h>
10019 #include <sys/ipc.h>
10020 #include <sys/sem.h>
10021 int main () { union semun semun; semun.buf = 0; }
10022 END
10023 set try
10024 if eval $compile; then
10025     echo "You have union semun in <sys/sem.h>." >&4
10026     val="$define"
10027 else
10028     echo "You do not have union semun in <sys/sem.h>." >&4
10029     val="$undef"
10030 fi
10031 $rm -f try try.c try.h
10032 set d_union_semun
10033 eval $setvar
10034
10035 : see how to do semctl IPC_STAT
10036 case "$d_sem" in
10037 $define)
10038     : see whether semctl IPC_STAT can use union semun
10039     echo " "
10040     $cat > try.h <<END
10041 #ifndef S_IRUSR
10042 #   ifdef S_IREAD
10043 #       define S_IRUSR S_IREAD
10044 #       define S_IWUSR S_IWRITE
10045 #       define S_IXUSR S_IEXEC
10046 #   else
10047 #       define S_IRUSR 0400
10048 #       define S_IWUSR 0200
10049 #       define S_IXUSR 0100
10050 #   endif
10051 #   define S_IRGRP (S_IRUSR>>3)
10052 #   define S_IWGRP (S_IWUSR>>3)
10053 #   define S_IXGRP (S_IXUSR>>3)
10054 #   define S_IROTH (S_IRUSR>>6)
10055 #   define S_IWOTH (S_IWUSR>>6)
10056 #   define S_IXOTH (S_IXUSR>>6)
10057 #endif
10058 #ifndef S_IRWXU
10059 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10060 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10061 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10062 #endif
10063 END
10064
10065     $cat > try.c <<END
10066 #include <sys/types.h>
10067 #include <sys/ipc.h>
10068 #include <sys/sem.h>
10069 #include <sys/stat.h>
10070 #include <stdio.h>
10071 #include <errno.h>
10072 #include "try.h"
10073 #ifndef errno
10074 extern int errno;
10075 #endif
10076 #$d_union_semun HAS_UNION_SEMUN
10077 int main() {
10078     union semun
10079 #ifndef HAS_UNION_SEMUN
10080     {
10081         int val;
10082         struct semid_ds *buf;
10083         unsigned short *array;
10084     }
10085 #endif
10086     arg;
10087     int sem, st;
10088
10089 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10090     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10091     if (sem > -1) {
10092         struct semid_ds argbuf;
10093         arg.buf = &argbuf;
10094 #       ifdef IPC_STAT
10095         st = semctl(sem, 0, IPC_STAT, arg);
10096         if (st == 0)
10097             printf("semun\n");
10098         else
10099 #       endif /* IPC_STAT */
10100             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10101 #       ifdef IPC_RMID
10102         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10103 #       endif /* IPC_RMID */
10104             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10105     } else
10106 #endif /* IPC_PRIVATE && ... */
10107         printf("semget failed: errno = %d\n", errno);
10108   return 0;
10109 }
10110 END
10111     val="$undef"
10112     set try
10113     if eval $compile; then
10114         xxx=`./try`
10115         case "$xxx" in
10116         semun) val="$define" ;;
10117         esac
10118     fi
10119     $rm -f try try.c
10120     set d_semctl_semun
10121     eval $setvar
10122     case "$d_semctl_semun" in
10123     $define)
10124         echo "You can use union semun for semctl IPC_STAT." >&4
10125         also='also'
10126         ;;
10127     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10128         also=''
10129         ;;
10130     esac
10131
10132     : see whether semctl IPC_STAT can use struct semid_ds pointer
10133     $cat > try.c <<'END'
10134 #include <sys/types.h>
10135 #include <sys/ipc.h>
10136 #include <sys/sem.h>
10137 #include <sys/stat.h>
10138 #include "try.h"
10139 #include <stdio.h>
10140 #include <errno.h>
10141 #ifndef errno
10142 extern int errno;
10143 #endif
10144 int main() {
10145     struct semid_ds arg;
10146     int sem, st;
10147
10148 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10149     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10150     if (sem > -1) {
10151 #       ifdef IPC_STAT
10152         st = semctl(sem, 0, IPC_STAT, &arg);
10153         if (st == 0)
10154             printf("semid_ds\n");
10155         else
10156 #       endif /* IPC_STAT */
10157             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10158 #       ifdef IPC_RMID
10159         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10160 #       endif /* IPC_RMID */
10161             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10162     } else
10163 #endif /* IPC_PRIVATE && ... */
10164         printf("semget failed: errno = %d\n", errno);
10165
10166     return 0;
10167 }
10168 END
10169     val="$undef"
10170     set try
10171     if eval $compile; then
10172         xxx=`./try`
10173         case "$xxx" in
10174         semid_ds) val="$define" ;;
10175         esac
10176     fi
10177     $rm -f try try.c
10178     set d_semctl_semid_ds
10179     eval $setvar
10180     case "$d_semctl_semid_ds" in
10181     $define)
10182         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10183         ;;
10184     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10185         ;;
10186     esac
10187     $rm -f try.h
10188     ;;
10189 *)  val="$undef"
10190
10191     # We do not have the full sem*(2) library, so assume we can not
10192     # use either.
10193
10194     set d_semctl_semun
10195     eval $setvar
10196
10197     set d_semctl_semid_ds
10198     eval $setvar
10199     ;;
10200 esac
10201
10202 : see if setegid exists
10203 set setegid d_setegid
10204 eval $inlibc
10205
10206 : see if seteuid exists
10207 set seteuid d_seteuid
10208 eval $inlibc
10209
10210 : see if setgrent exists
10211 set setgrent d_setgrent
10212 eval $inlibc
10213
10214 : see if sethostent exists
10215 set sethostent d_sethent
10216 eval $inlibc
10217
10218 : see if setlinebuf exists
10219 set setlinebuf d_setlinebuf
10220 eval $inlibc
10221
10222 : see if setlocale exists
10223 set setlocale d_setlocale
10224 eval $inlibc
10225
10226 : see if setnetent exists
10227 set setnetent d_setnent
10228 eval $inlibc
10229
10230 : see if setprotoent exists
10231 set setprotoent d_setpent
10232 eval $inlibc
10233
10234 : see if setpgid exists
10235 set setpgid d_setpgid
10236 eval $inlibc
10237
10238 : see if setpgrp2 exists
10239 set setpgrp2 d_setpgrp2
10240 eval $inlibc
10241
10242 : see if setpriority exists
10243 set setpriority d_setprior
10244 eval $inlibc
10245
10246 : see if setpwent exists
10247 set setpwent d_setpwent
10248 eval $inlibc
10249
10250 : see if setregid exists
10251 set setregid d_setregid
10252 eval $inlibc
10253 set setresgid d_setresgid
10254 eval $inlibc
10255
10256 : see if setreuid exists
10257 set setreuid d_setreuid
10258 eval $inlibc
10259 set setresuid d_setresuid
10260 eval $inlibc
10261
10262 : see if setrgid exists
10263 set setrgid d_setrgid
10264 eval $inlibc
10265
10266 : see if setruid exists
10267 set setruid d_setruid
10268 eval $inlibc
10269
10270 : see if setservent exists
10271 set setservent d_setsent
10272 eval $inlibc
10273
10274 : see if setsid exists
10275 set setsid d_setsid
10276 eval $inlibc
10277
10278 : see if setspent exists
10279 set setspent d_setspent
10280 eval $inlibc
10281
10282 : see if setvbuf exists
10283 set setvbuf d_setvbuf
10284 eval $inlibc
10285
10286 : see if sfio.h is available
10287 set sfio.h i_sfio
10288 eval $inhdr
10289
10290
10291 : see if sfio library is available
10292 case "$i_sfio" in
10293 $define)
10294         val=''
10295         set sfreserve val
10296         eval $inlibc
10297         ;;
10298 *)
10299         val="$undef"
10300         ;;
10301 esac
10302 : Ok, but do we want to use it.
10303 case "$val" in
10304 $define)
10305         case "$usesfio" in
10306         true|$define|[yY]*) dflt='y';;
10307         *) dflt='n';;
10308         esac
10309         echo "$package can use the sfio library, but it is experimental."
10310         rp="You seem to have sfio available, do you want to try using it?"
10311         . ./myread
10312         case "$ans" in
10313         y|Y) ;;
10314         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10315                 val="$undef"
10316                 : Remove sfio from list of libraries to use
10317                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10318                 shift
10319                 libs="$*"
10320                 echo "libs = $libs" >&4
10321                 ;;
10322         esac
10323         ;;
10324 *)      case "$usesfio" in
10325         true|$define|[yY]*)
10326                 echo "Sorry, cannot find sfio on this machine" >&4
10327                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10328                 ;;
10329         esac
10330         ;;
10331 esac
10332 set d_sfio
10333 eval $setvar
10334 case "$d_sfio" in
10335 $define) usesfio='true';;
10336 *) usesfio='false';;
10337 esac
10338
10339 : see if shmctl exists
10340 set shmctl d_shmctl
10341 eval $inlibc
10342
10343 : see if shmget exists
10344 set shmget d_shmget
10345 eval $inlibc
10346
10347 : see if shmat exists
10348 set shmat d_shmat
10349 eval $inlibc
10350 : see what shmat returns
10351 case "$d_shmat" in
10352 "$define")
10353         $cat >shmat.c <<'END'
10354 #include <sys/shm.h>
10355 void *shmat();
10356 END
10357         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10358                 shmattype='void *'
10359         else
10360                 shmattype='char *'
10361         fi
10362         echo "and it returns ($shmattype)." >&4
10363         : see if a prototype for shmat is available
10364         xxx=`./findhdr sys/shm.h`
10365         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10366         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10367                 val="$define"
10368         else
10369                 val="$undef"
10370         fi
10371         $rm -f shmat.[co]
10372         ;;
10373 *)
10374         val="$undef"
10375         ;;
10376 esac
10377 set d_shmatprototype
10378 eval $setvar
10379
10380 : see if shmdt exists
10381 set shmdt d_shmdt
10382 eval $inlibc
10383
10384 : see how much of the 'shm*(2)' library is present.
10385 h_shm=true
10386 echo " "
10387 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10388 *"$undef"*) h_shm=false;;
10389 esac
10390 case "$osname" in
10391 freebsd)
10392     case "`ipcs 2>&1`" in
10393     "SVID shared memory"*"not configured"*)
10394         echo "Your $osname does not have the shm*(2) configured." >&4
10395         h_shm=false
10396         val="$undef"
10397         set shmctl d_shmctl
10398         evat $setvar
10399         set shmget d_shmget
10400         evat $setvar
10401         set shmat d_shmat
10402         evat $setvar
10403         set shmdt d_shmdt
10404         evat $setvar
10405         ;;
10406     esac
10407     ;;
10408 esac
10409 : we could also check for sys/ipc.h ...
10410 if $h_shm && $test `./findhdr sys/shm.h`; then
10411         echo "You have the full shm*(2) library." >&4
10412         val="$define"
10413 else
10414         echo "You don't have the full shm*(2) library." >&4
10415         val="$undef"
10416 fi
10417 set d_shm
10418 eval $setvar
10419
10420 echo " "
10421 : see if we have sigaction
10422 if set sigaction val -f d_sigaction; eval $csym; $val; then
10423         echo 'sigaction() found.' >&4
10424         $cat > try.c <<'EOP'
10425 #include <stdio.h>
10426 #include <sys/types.h>
10427 #include <signal.h>
10428 int main()
10429 {
10430     struct sigaction act, oact;
10431     act.sa_flags = 0;
10432     oact.sa_handler = 0;
10433     /* so that act and oact are used */
10434     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10435 }
10436 EOP
10437         set try
10438         if eval $compile_ok; then
10439                 val="$define"
10440         else
10441                 echo "But you don't seem to have a useable struct sigaction." >&4
10442                 val="$undef"
10443         fi
10444 else
10445         echo 'sigaction NOT found.' >&4
10446         val="$undef"
10447 fi
10448 set d_sigaction; eval $setvar
10449 $rm -f try try$_o try.c
10450
10451 : see if sigsetjmp exists
10452 echo " "
10453 case "$d_sigsetjmp" in
10454 '')
10455         $cat >try.c <<'EOP'
10456 #include <setjmp.h>
10457 sigjmp_buf env;
10458 int set = 1;
10459 int main()
10460 {
10461         if (sigsetjmp(env,1))
10462                 exit(set);
10463         set = 0;
10464         siglongjmp(env, 1);
10465         exit(1);
10466 }
10467 EOP
10468         set try
10469         if eval $compile; then
10470                 if ./try >/dev/null 2>&1; then
10471                         echo "POSIX sigsetjmp found." >&4
10472                         val="$define"
10473                 else
10474                         $cat >&4 <<EOM
10475 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10476 I'll ignore them.
10477 EOM
10478                         val="$undef"
10479                 fi
10480         else
10481                 echo "sigsetjmp not found." >&4
10482                 val="$undef"
10483         fi
10484         ;;
10485 *) val="$d_sigsetjmp"
10486         case "$d_sigsetjmp" in
10487         $define) echo "POSIX sigsetjmp found." >&4;;
10488         $undef) echo "sigsetjmp not found." >&4;;
10489         esac
10490         ;;
10491 esac
10492 set d_sigsetjmp
10493 eval $setvar
10494 $rm -f try.c try
10495
10496 : see if sqrtl exists
10497 set sqrtl d_sqrtl
10498 eval $inlibc
10499
10500 : see if sys/stat.h is available
10501 set sys/stat.h i_sysstat
10502 eval $inhdr
10503
10504
10505 : see if stat knows about block sizes
10506 echo " "
10507 echo "Checking to see if your struct stat has st_blocks field..." >&4
10508 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10509 eval $hasfield
10510
10511
10512 : see if this is a sys/vfs.h system
10513 set sys/vfs.h i_sysvfs
10514 eval $inhdr
10515
10516
10517 : see if this is a sys/statfs.h system
10518 set sys/statfs.h i_sysstatfs
10519 eval $inhdr
10520
10521
10522 echo " "
10523 echo "Checking to see if your system supports struct statfs..." >&4
10524 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
10525 eval $hasstruct
10526 case "$d_statfs_s" in
10527 "$define")      echo "Yes, it does."   ;;
10528 *)              echo "No, it doesn't." ;;
10529 esac
10530
10531
10532
10533 : see if struct statfs knows about f_flags
10534 case "$d_statfs_s" in
10535 define) 
10536         echo " "
10537         echo "Checking to see if your struct statfs has f_flags field..." >&4
10538         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
10539         eval $hasfield
10540         ;;
10541 *)      val="$undef"
10542         set d_statfs_f_flags
10543         eval $setvar
10544         ;;
10545 esac
10546 case "$d_statfs_f_flags" in
10547 "$define")      echo "Yes, it does."   ;;
10548 *)              echo "No, it doesn't." ;;
10549 esac
10550
10551 : see if _ptr and _cnt from stdio act std
10552 echo " "
10553 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10554         echo "(Looks like you have stdio.h from Linux.)"
10555         case "$stdio_ptr" in
10556         '') stdio_ptr='((fp)->_IO_read_ptr)'
10557                 ptr_lval=$define
10558                 ;;
10559         *)      ptr_lval=$d_stdio_ptr_lval;;
10560         esac
10561         case "$stdio_cnt" in
10562         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10563                 cnt_lval=$undef
10564                 ;;
10565         *)      cnt_lval=$d_stdio_cnt_lval;;
10566         esac
10567         case "$stdio_base" in
10568         '') stdio_base='((fp)->_IO_read_base)';;
10569         esac
10570         case "$stdio_bufsiz" in
10571         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10572         esac
10573 else
10574         case "$stdio_ptr" in
10575         '') stdio_ptr='((fp)->_ptr)'
10576                 ptr_lval=$define
10577                 ;;
10578         *)      ptr_lval=$d_stdio_ptr_lval;;
10579         esac
10580         case "$stdio_cnt" in
10581         '') stdio_cnt='((fp)->_cnt)'
10582                 cnt_lval=$define
10583                 ;;
10584         *)      cnt_lval=$d_stdio_cnt_lval;;
10585         esac
10586         case "$stdio_base" in
10587         '') stdio_base='((fp)->_base)';;
10588         esac
10589         case "$stdio_bufsiz" in
10590         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10591         esac
10592 fi
10593 : test whether _ptr and _cnt really work
10594 echo "Checking how std your stdio is..." >&4
10595 $cat >try.c <<EOP
10596 #include <stdio.h>
10597 #define FILE_ptr(fp)    $stdio_ptr
10598 #define FILE_cnt(fp)    $stdio_cnt
10599 int main() {
10600         FILE *fp = fopen("try.c", "r");
10601         char c = getc(fp);
10602         if (
10603                 18 <= FILE_cnt(fp) &&
10604                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10605         )
10606                 exit(0);
10607         exit(1);
10608 }
10609 EOP
10610 val="$undef"
10611 set try
10612 if eval $compile; then
10613         if ./try; then
10614                 echo "Your stdio acts pretty std."
10615                 val="$define"
10616         else
10617                 echo "Your stdio isn't very std."
10618         fi
10619 else
10620         echo "Your stdio doesn't appear very std."
10621 fi
10622 $rm -f try.c try
10623 set d_stdstdio
10624 eval $setvar
10625
10626 : Can _ptr be used as an lvalue?
10627 case "$d_stdstdio$ptr_lval" in
10628 $define$define) val=$define ;;
10629 *) val=$undef ;;
10630 esac
10631 set d_stdio_ptr_lval
10632 eval $setvar
10633
10634 : Can _cnt be used as an lvalue?
10635 case "$d_stdstdio$cnt_lval" in
10636 $define$define) val=$define ;;
10637 *) val=$undef ;;
10638 esac
10639 set d_stdio_cnt_lval
10640 eval $setvar
10641
10642 : see if _base is also standard
10643 val="$undef"
10644 case "$d_stdstdio" in
10645 $define)
10646         $cat >try.c <<EOP
10647 #include <stdio.h>
10648 #define FILE_base(fp)   $stdio_base
10649 #define FILE_bufsiz(fp) $stdio_bufsiz
10650 int main() {
10651         FILE *fp = fopen("try.c", "r");
10652         char c = getc(fp);
10653         if (
10654                 19 <= FILE_bufsiz(fp) &&
10655                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10656         )
10657                 exit(0);
10658         exit(1);
10659 }
10660 EOP
10661         set try
10662         if eval $compile; then
10663                 if ./try; then
10664                         echo "And its _base field acts std."
10665                         val="$define"
10666                 else
10667                         echo "But its _base field isn't std."
10668                 fi
10669         else
10670                 echo "However, it seems to be lacking the _base field."
10671         fi
10672         $rm -f try.c try
10673         ;;
10674 esac
10675 set d_stdiobase
10676 eval $setvar
10677
10678 $cat >&4 <<EOM
10679 Checking how to access stdio streams by file descriptor number...
10680 EOM
10681 case "$stdio_stream_array" in
10682 '')     $cat >try.c <<EOCP
10683 #include <stdio.h>
10684 int main() {
10685   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10686     printf("yes\n");
10687 }
10688 EOCP
10689         for s in _iob __iob __sF
10690         do
10691                 set try -DSTDIO_STREAM_ARRAY=$s
10692                 if eval $compile; then
10693                         case "`./try$exe_ext`" in
10694                         yes)    stdio_stream_array=$s; break ;;
10695                         esac
10696                 fi
10697         done
10698         $rm -f try.* try$exe_ext
10699 esac
10700 case "$stdio_stream_array" in
10701 '')     $cat >&4 <<EOM
10702 I can't figure out how to access stdio streams by file descriptor number.
10703 EOM
10704         d_stdio_stream_array="$undef"
10705         ;;
10706 *)      $cat >&4 <<EOM
10707 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10708 EOM
10709         d_stdio_stream_array="$define"
10710         ;;
10711 esac
10712
10713 : see if strcoll exists
10714 set strcoll d_strcoll
10715 eval $inlibc
10716
10717 : check for structure copying
10718 echo " "
10719 echo "Checking to see if your C compiler can copy structs..." >&4
10720 $cat >try.c <<'EOCP'
10721 int main()
10722 {
10723         struct blurfl {
10724                 int dyick;
10725         } foo, bar;
10726
10727         foo = bar;
10728 }
10729 EOCP
10730 if $cc -c try.c >/dev/null 2>&1 ; then
10731         val="$define"
10732         echo "Yup, it can."
10733 else
10734         val="$undef"
10735         echo "Nope, it can't."
10736 fi
10737 set d_strctcpy
10738 eval $setvar
10739 $rm -f try.*
10740
10741 : see if strerror and/or sys_errlist[] exist
10742 echo " "
10743 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10744     if set strerror val -f d_strerror; eval $csym; $val; then
10745                 echo 'strerror() found.' >&4
10746                 d_strerror="$define"
10747                 d_strerrm='strerror(e)'
10748                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10749                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10750                         d_syserrlst="$define"
10751                 else
10752                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10753                         d_syserrlst="$undef"
10754                 fi
10755     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10756                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10757                 echo 'strerror() found in string header.' >&4
10758                 d_strerror="$define"
10759                 d_strerrm='strerror(e)'
10760                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10761                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10762                                 d_syserrlst="$define"
10763                 else
10764                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10765                         d_syserrlst="$undef"
10766                 fi
10767     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10768                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10769                 d_strerror="$undef"
10770                 d_syserrlst="$define"
10771                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10772     else
10773                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10774                 d_strerror="$undef"
10775                 d_syserrlst="$undef"
10776                 d_strerrm='"unknown"'
10777     fi
10778 fi
10779
10780 : see if strtod exists
10781 set strtod d_strtod
10782 eval $inlibc
10783
10784 : see if strtol exists
10785 set strtol d_strtol
10786 eval $inlibc
10787
10788 : see if strtoul exists
10789 set strtoul d_strtoul
10790 eval $inlibc
10791
10792 : see if strtoull exists
10793 set strtoull d_strtoull
10794 eval $inlibc
10795
10796 : see if strxfrm exists
10797 set strxfrm d_strxfrm
10798 eval $inlibc
10799
10800 : see if symlink exists
10801 set symlink d_symlink
10802 eval $inlibc
10803
10804 : see if syscall exists
10805 set syscall d_syscall
10806 eval $inlibc
10807
10808 : see if sysconf exists
10809 set sysconf d_sysconf
10810 eval $inlibc
10811
10812 : see if system exists
10813 set system d_system
10814 eval $inlibc
10815
10816 : see if tcgetpgrp exists
10817 set tcgetpgrp d_tcgetpgrp
10818 eval $inlibc
10819
10820 : see if tcsetpgrp exists
10821 set tcsetpgrp d_tcsetpgrp
10822 eval $inlibc
10823
10824 : see if prototype for telldir is available
10825 echo " "
10826 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10827 eval $hasproto
10828
10829 : see if this is a sys/times.h system
10830 set sys/times.h i_systimes
10831 eval $inhdr
10832
10833 : see if times exists
10834 echo " "
10835 if set times val -f d_times; eval $csym; $val; then
10836         echo 'times() found.' >&4
10837         d_times="$define"
10838         inc=''
10839         case "$i_systimes" in
10840         "$define") inc='sys/times.h';;
10841         esac
10842         rp="What is the type returned by times() on this system?"
10843         set clock_t clocktype long stdio.h sys/types.h $inc
10844         eval $typedef_ask
10845 else
10846         echo 'times() NOT found, hope that will do.' >&4
10847         d_times="$undef"
10848         clocktype='int'
10849 fi
10850
10851 : see if truncate exists
10852 set truncate d_truncate
10853 eval $inlibc
10854
10855 : see if tzname[] exists
10856 echo " "
10857 if set tzname val -a d_tzname; eval $csym; $val; then
10858         val="$define"
10859         echo 'tzname[] found.' >&4
10860 else
10861         val="$undef"
10862         echo 'tzname[] NOT found.' >&4
10863 fi
10864 set d_tzname
10865 eval $setvar
10866
10867 : see if umask exists
10868 set umask d_umask
10869 eval $inlibc
10870
10871 : see if ustat exists
10872 set ustat d_ustat
10873 eval $inlibc
10874
10875 : backward compatibility for d_hvfork
10876 if test X$d_hvfork != X; then
10877         d_vfork="$d_hvfork"
10878         d_hvfork=''
10879 fi
10880 : see if there is a vfork
10881 val=''
10882 set vfork val
10883 eval $inlibc
10884
10885 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10886 : perl on Solaris 2.x, and probably elsewhere.
10887 case "$val" in
10888 $define)
10889         echo " "
10890         case "$usevfork" in
10891         false) dflt='n';;
10892         *) dflt='y';;
10893         esac
10894         cat <<'EOM'
10895  
10896 Perl can only use a vfork() that doesn't suffer from strict
10897 restrictions on calling functions or modifying global data in
10898 the child.  For example, glibc-2.1 contains such a vfork()
10899 that is unsuitable.  If your system provides a proper fork()
10900 call, chances are that you do NOT want perl to use vfork().
10901
10902 EOM
10903         rp="Do you still want to use vfork()?"
10904         . ./myread
10905         case "$ans" in
10906         y|Y) ;;
10907         *)
10908                 echo "Ok, we won't use vfork()."
10909                 val="$undef"
10910                 ;;
10911         esac
10912         ;;
10913 esac
10914 set d_vfork
10915 eval $setvar
10916 case "$d_vfork" in
10917 $define) usevfork='true';;
10918 *) usevfork='false';;
10919 esac
10920
10921 : see if this is an sysdir system
10922 set sys/dir.h i_sysdir
10923 eval $inhdr
10924
10925 : see if this is an sysndir system
10926 set sys/ndir.h i_sysndir
10927 eval $inhdr
10928
10929 : see if closedir exists
10930 set closedir d_closedir
10931 eval $inlibc
10932
10933 case "$d_closedir" in
10934 "$define")
10935         echo " "
10936         echo "Checking whether closedir() returns a status..." >&4
10937         cat > closedir.c <<EOM
10938 #$i_dirent I_DIRENT             /**/
10939 #$i_sysdir I_SYS_DIR            /**/
10940 #$i_sysndir I_SYS_NDIR          /**/
10941 #$i_systypes I_SYS_TYPES        /**/
10942
10943 #if defined(I_SYS_TYPES)
10944 #include <sys/types.h>
10945 #endif
10946 #if defined(I_DIRENT)
10947 #include <dirent.h>
10948 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10949 #include <sys/dir.h>
10950 #endif
10951 #else
10952 #ifdef I_SYS_NDIR
10953 #include <sys/ndir.h>
10954 #else
10955 #ifdef I_SYS_DIR
10956 #ifdef hp9000s500
10957 #include <ndir.h>       /* may be wrong in the future */
10958 #else
10959 #include <sys/dir.h>
10960 #endif
10961 #endif
10962 #endif
10963 #endif 
10964 int main() { return closedir(opendir(".")); }
10965 EOM
10966         set closedir
10967         if eval $compile_ok; then
10968                 if ./closedir > /dev/null 2>&1 ; then
10969                         echo "Yes, it does."
10970                         val="$undef"
10971                 else
10972                         echo "No, it doesn't."
10973                         val="$define"
10974                 fi
10975         else
10976                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10977                 val="$define"
10978         fi
10979         ;;
10980 *)
10981         val="$undef";
10982         ;;
10983 esac
10984 set d_void_closedir
10985 eval $setvar
10986 $rm -f closedir*
10987 : check for volatile keyword
10988 echo " "
10989 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10990 $cat >try.c <<'EOCP'
10991 int main()
10992 {
10993         typedef struct _goo_struct goo_struct;
10994         goo_struct * volatile goo = ((goo_struct *)0);
10995         struct _goo_struct {
10996                 long long_int;
10997                 int reg_int;
10998                 char char_var;
10999         };
11000         typedef unsigned short foo_t;
11001         char *volatile foo;
11002         volatile int bar;
11003         volatile foo_t blech;
11004         foo = foo;
11005 }
11006 EOCP
11007 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11008         val="$define"
11009         echo "Yup, it does."
11010 else
11011         val="$undef"
11012         echo "Nope, it doesn't."
11013 fi
11014 set d_volatile
11015 eval $setvar
11016 $rm -f try.*
11017
11018 : see if there is a wait4
11019 set wait4 d_wait4
11020 eval $inlibc
11021
11022 : see if waitpid exists
11023 set waitpid d_waitpid
11024 eval $inlibc
11025
11026 : see if wcstombs exists
11027 set wcstombs d_wcstombs
11028 eval $inlibc
11029
11030 : see if wctomb exists
11031 set wctomb d_wctomb
11032 eval $inlibc
11033
11034 : preserve RCS keywords in files with variable substitution, grrr
11035 Date='$Date'
11036 Id='$Id'
11037 Log='$Log'
11038 RCSfile='$RCSfile'
11039 Revision='$Revision'
11040
11041 case "$crosscompile" in
11042 ''|[nN]*) crosscompile="$undef" ;;
11043 esac
11044
11045 case "$osname" in
11046 next|rhapsody) multiarch="$define" ;;
11047 esac
11048 case "$multiarch" in
11049 ''|[nN]*) multiarch="$undef" ;;
11050 esac
11051
11052 : check for alignment requirements
11053 echo " "
11054 case "$crosscompile$multiarch" in
11055 *$define*)
11056         $cat <<EOM
11057 You seem to be either cross-compiling or doing a multiarchitecture build,
11058 skipping the memory alignment check.
11059
11060 EOM
11061         case "$alignbytes" in
11062         '') alignbytes=8 ;;
11063         esac
11064         ;;
11065 *)
11066         case "$alignbytes" in
11067         '') echo "Checking alignment constraints..." >&4
11068                 $cat >try.c <<'EOCP'
11069 #include <stdio.h>
11070 struct foobar {
11071         char foo;
11072         double bar;
11073 } try_algn;
11074 int main()
11075 {
11076     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11077     return(0);
11078 }
11079 EOCP
11080                 set try
11081                 if eval $compile_ok; then
11082                         dflt=`./try`
11083                 else
11084                         dflt='8'
11085                         echo "(I can't seem to compile the test program...)"
11086                 fi
11087                 ;;
11088         *) dflt="$alignbytes"
11089                 ;;
11090         esac
11091         rp="Doubles must be aligned on a how-many-byte boundary?"
11092         . ./myread
11093         alignbytes="$ans"
11094         $rm -f try.c try
11095         ;;
11096 esac
11097
11098
11099 : check for ordering of bytes in a long
11100 echo " "
11101 case "$crosscompile$multiarch" in
11102 *$define*)
11103         $cat <<EOM
11104 You seem to be either cross-compiling or doing a multiarchitecture build,
11105 skipping the byteorder check.
11106
11107 EOM
11108         byteorder='0xffff'
11109         ;;
11110 *)
11111         case "$byteorder" in
11112         '')
11113                 $cat <<'EOM'
11114 In the following, larger digits indicate more significance.  A big-endian
11115 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11116 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11117 machines may have weird orders like 3412.  A Cray will report 87654321,
11118 an Alpha will report 12345678. If the test program works the default is
11119 probably right.
11120 I'm now running the test program...
11121 EOM
11122                 $cat >try.c <<'EOCP'
11123 #include <stdio.h>
11124 int main()
11125 {
11126         int i;
11127         union {
11128                 unsigned long l;
11129                 char c[sizeof(long)];
11130         } u;
11131
11132         if (sizeof(long) > 4)
11133                 u.l = (0x08070605L << 32) | 0x04030201L;
11134         else
11135                 u.l = 0x04030201L;
11136         for (i = 0; i < sizeof(long); i++)
11137                 printf("%c", u.c[i]+'0');
11138         printf("\n");
11139         exit(0);
11140 }
11141 EOCP
11142                 xxx_prompt=y
11143                 set try
11144                 if eval $compile && ./try > /dev/null; then
11145                         dflt=`./try`
11146                         case "$dflt" in
11147                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11148                                 echo "(The test program ran ok.)"
11149                                 echo "byteorder=$dflt"
11150                                 xxx_prompt=n
11151                         ;;
11152                         ????|????????) echo "(The test program ran ok.)" ;;
11153                         *) echo "(The test program didn't run right for some reason.)" ;;
11154                         esac
11155                 else
11156                         dflt='4321'
11157                         cat <<'EOM'
11158 (I can't seem to compile the test program.  Guessing big-endian...)
11159 EOM
11160                 fi
11161                 case "$xxx_prompt" in
11162                 y)
11163                         rp="What is the order of bytes in a long?"
11164                         . ./myread
11165                         byteorder="$ans"
11166                         ;;
11167                 *)      byteorder=$dflt
11168                         ;;
11169                 esac
11170                 ;;
11171         esac
11172         $rm -f try.c try
11173         ;;
11174 esac
11175
11176
11177 : how do we catenate cpp tokens here?
11178 echo " "
11179 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11180 $cat >cpp_stuff.c <<'EOCP'
11181 #define RCAT(a,b)a/**/b
11182 #define ACAT(a,b)a ## b
11183 RCAT(Rei,ser)
11184 ACAT(Cir,cus)
11185 EOCP
11186 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11187 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11188         echo "Oh!  Smells like ANSI's been here." >&4
11189         echo "We can catify or stringify, separately or together!"
11190         cpp_stuff=42
11191 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11192         echo "Ah, yes!  The good old days!" >&4
11193         echo "However, in the good old days we don't know how to stringify and"
11194         echo "catify at the same time."
11195         cpp_stuff=1
11196 else
11197         $cat >&4 <<EOM
11198 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11199 to have to edit the values of CAT[2-5] in config.h...
11200 EOM
11201         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11202 fi
11203 $rm -f cpp_stuff.*
11204
11205 : see if this is a db.h system
11206 set db.h i_db
11207 eval $inhdr
11208
11209 case "$i_db" in
11210 $define)
11211         : Check db version.
11212         echo " "
11213         echo "Checking Berkeley DB version ..." >&4
11214         $cat >try.c <<EOCP
11215 #$d_const HASCONST
11216 #ifndef HASCONST
11217 #define const
11218 #endif
11219 #include <sys/types.h>
11220 #include <stdio.h>
11221 #include <db.h>
11222 int main()
11223 {
11224 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11225     int Major, Minor, Patch ;
11226     unsigned long Version ;
11227     (void)db_version(&Major, &Minor, &Patch) ;
11228     printf("You have Berkeley DB Version 2 or greater\n");
11229
11230     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11231                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11232     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11233                 Major, Minor, Patch) ;
11234
11235     /* check that db.h & libdb are compatible */
11236     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11237         printf("db.h and libdb are incompatible\n") ;
11238         exit(3);        
11239     }
11240
11241     printf("db.h and libdb are compatible\n") ;
11242
11243     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11244                 + DB_VERSION_PATCH ;
11245
11246     /* needs to be >= 2.3.4 */
11247     if (Version < 2003004) {
11248     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11249         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11250         exit(2);        
11251     }
11252
11253     exit(0);
11254 #else
11255 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11256     printf("You have Berkeley DB Version 1\n");
11257     exit(0);    /* DB version < 2: the coast is clear. */
11258 #else
11259     exit(1);    /* <db.h> not Berkeley DB? */
11260 #endif
11261 #endif
11262 }
11263 EOCP
11264         set try
11265         if eval $compile && ./try; then
11266                 echo 'Looks OK.' >&4
11267         else
11268                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11269                 i_db=$undef
11270                 case " $libs " in
11271                 *"-ldb "*)
11272                         : Remove db from list of libraries to use
11273                         echo "Removing unusable -ldb from library list" >&4
11274                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11275                         shift
11276                         libs="$*"
11277                         echo "libs = $libs" >&4
11278                         ;;
11279                 esac
11280         fi
11281         $rm -f try.*
11282         ;;
11283 esac
11284
11285 case "$i_db" in
11286 define)
11287         : Check the return type needed for hash 
11288         echo " "
11289         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11290         $cat >try.c <<EOCP
11291 #$d_const HASCONST
11292 #ifndef HASCONST
11293 #define const
11294 #endif
11295 #include <sys/types.h>
11296 #include <db.h>
11297
11298 #ifndef DB_VERSION_MAJOR
11299 u_int32_t hash_cb (ptr, size)
11300 const void *ptr;
11301 size_t size;
11302 {
11303 }
11304 HASHINFO info;
11305 int main()
11306 {
11307         info.hash = hash_cb;
11308 }
11309 #endif
11310 EOCP
11311         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11312                 if $contains warning try.out >>/dev/null 2>&1 ; then
11313                         db_hashtype='int'
11314                 else
11315                         db_hashtype='u_int32_t'
11316                 fi
11317         else
11318                 : XXX Maybe we should just give up here.
11319                 db_hashtype=u_int32_t
11320                 $cat try.out >&4
11321                 echo "Help:  I can't seem to compile the db test program." >&4
11322                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11323         fi
11324         $rm -f try.*
11325         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11326         ;;
11327 *)      db_hashtype=u_int32_t
11328         ;;
11329 esac
11330 case "$i_db" in
11331 define)
11332         : Check the return type needed for prefix 
11333         echo " "
11334         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11335         cat >try.c <<EOCP
11336 #$d_const HASCONST
11337 #ifndef HASCONST
11338 #define const
11339 #endif
11340 #include <sys/types.h>
11341 #include <db.h>
11342
11343 #ifndef DB_VERSION_MAJOR
11344 size_t prefix_cb (key1, key2)
11345 const DBT *key1;
11346 const DBT *key2;
11347 {
11348 }
11349 BTREEINFO info;
11350 int main()
11351 {
11352         info.prefix = prefix_cb;
11353 }
11354 #endif
11355 EOCP
11356         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11357                 if $contains warning try.out >>/dev/null 2>&1 ; then
11358                         db_prefixtype='int'
11359                 else
11360                         db_prefixtype='size_t'
11361                 fi
11362         else
11363                 db_prefixtype='size_t'
11364                 : XXX Maybe we should just give up here.
11365                 $cat try.out >&4
11366                 echo "Help:  I can't seem to compile the db test program." >&4
11367                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11368         fi
11369         $rm -f try.*
11370         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11371         ;;
11372 *)      db_prefixtype='size_t'
11373         ;;
11374 esac
11375
11376 : check for void type
11377 echo " "
11378 echo "Checking to see how well your C compiler groks the void type..." >&4
11379 case "$voidflags" in
11380 '')
11381         $cat >try.c <<'EOCP'
11382 #if TRY & 1
11383 void sub() {
11384 #else
11385 sub() {
11386 #endif
11387         extern void moo();      /* function returning void */
11388         void (*goo)();          /* ptr to func returning void */
11389 #if TRY & 8
11390         void *hue;              /* generic ptr */
11391 #endif
11392 #if TRY & 2
11393         void (*foo[10])();
11394 #endif
11395
11396 #if TRY & 4
11397         if(goo == moo) {
11398                 exit(0);
11399         }
11400 #endif
11401         exit(0);
11402 }
11403 int main() { sub(); }
11404 EOCP
11405         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11406                 voidflags=$defvoidused
11407         echo "Good.  It appears to support void to the level $package wants.">&4
11408                 if $contains warning .out >/dev/null 2>&1; then
11409                         echo "However, you might get some warnings that look like this:"
11410                         $cat .out
11411                 fi
11412         else
11413 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11414                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11415                         echo "It supports 1..."
11416                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11417                                 echo "It also supports 2..."
11418                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11419                                         voidflags=7
11420                                         echo "And it supports 4 but not 8 definitely."
11421                                 else
11422                                         echo "It doesn't support 4..."
11423                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11424                                                 voidflags=11
11425                                                 echo "But it supports 8."
11426                                         else
11427                                                 voidflags=3
11428                                                 echo "Neither does it support 8."
11429                                         fi
11430                                 fi
11431                         else
11432                                 echo "It does not support 2..."
11433                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11434                                         voidflags=13
11435                                         echo "But it supports 4 and 8."
11436                                 else
11437                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11438                                                 voidflags=5
11439                                                 echo "And it supports 4 but has not heard about 8."
11440                                         else
11441                                                 echo "However it supports 8 but not 4."
11442                                         fi
11443                                 fi
11444                         fi
11445                 else
11446                         echo "There is no support at all for void."
11447                         voidflags=0
11448                 fi
11449         fi
11450 esac
11451 case "$voidflags" in
11452 "$defvoidused") ;;
11453 *)      $cat >&4 <<'EOM'
11454   Support flag bits are:
11455     1: basic void declarations.
11456     2: arrays of pointers to functions returning void.
11457     4: operations between pointers to and addresses of void functions.
11458     8: generic void pointers.
11459 EOM
11460         dflt="$voidflags";
11461         rp="Your void support flags add up to what?"
11462         . ./myread
11463         voidflags="$ans"
11464         ;;
11465 esac
11466 $rm -f try.* .out
11467
11468
11469 : How can we generate normalized random numbers ?
11470 echo " "
11471 echo "Looking for a random number function..." >&4
11472 case "$randfunc" in
11473 '')
11474         if set drand48 val -f; eval $csym; $val; then
11475                 dflt="drand48"
11476                 echo "Good, found drand48()." >&4
11477         elif set random val -f; eval $csym; $val; then
11478                 dflt="random"
11479                 echo "OK, found random()." >&4
11480         else
11481                 dflt="rand"
11482                 echo "Yick, looks like I have to use rand()." >&4
11483         fi
11484         echo " "
11485         ;;
11486 *)
11487         dflt="$randfunc"
11488         ;;
11489 esac
11490 cont=true
11491
11492 case "$ccflags" in
11493 *-Dmy_rand=*|*-Dmy_srand=*)
11494         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11495         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11496         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11497         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11498         ;;
11499 esac
11500
11501 while $test "$cont"; do
11502         rp="Use which function to generate random numbers?"
11503         . ./myread
11504         if $test "$ans" = "$dflt"; then
11505                 : null
11506         else
11507                 randbits=''
11508         fi
11509         randfunc="$ans"
11510         if set $ans val -f; eval $csym; $val; then
11511                 cont=''
11512         else
11513                 dflt=y
11514                 rp="I cannot find function $ans. Use that name anyway?"
11515                 . ./myread
11516                 dflt=rand
11517                 case "$ans" in
11518                         [yY]*) cont='';;
11519                 esac
11520         fi
11521         case "$cont" in
11522         '')
11523                 case "$randfunc" in
11524                 drand48)
11525                         drand01="drand48()"
11526                         seedfunc="srand48"
11527                         randbits=48
11528                         randseedtype=long
11529                         ;;
11530                 rand|random)
11531                         case "$randbits" in
11532                         '')
11533 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11534                                 $cat >try.c <<EOCP
11535 #$i_unistd I_UNISTD
11536 #$i_stdlib I_STDLIB
11537 #include <stdio.h>
11538 #ifdef I_UNISTD
11539 #  include <unistd.h>
11540 #endif
11541 #ifdef I_STDLIB
11542 #  include <stdlib.h>
11543 #endif
11544 int main()
11545 {
11546         register int i;
11547         register unsigned long tmp;
11548         register unsigned long max = 0L;
11549
11550         for (i = 1000; i; i--) {
11551                 tmp = (unsigned long) $randfunc();
11552                 if (tmp > max) max = tmp;
11553         }
11554         for (i = 0; max; i++)
11555                 max /= 2;
11556         printf("%d\n",i);
11557 }
11558 EOCP
11559                                 set try
11560                                 if eval $compile_ok; then
11561                                         dflt=`try`
11562                                 else
11563                                         dflt='?'
11564                                         echo "(I can't seem to compile the test program...)"
11565                                 fi
11566                                 ;;
11567                         *)
11568                                 dflt="$randbits"
11569                                 ;;
11570                         esac
11571                         rp="How many bits does your $randfunc() function produce?"
11572                         . ./myread
11573                         randbits="$ans"
11574                         $rm -f try.c try
11575                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11576                         seedfunc="s$randfunc"
11577                         randseedtype=unsigned
11578                         ;;
11579                 *)
11580                         dflt="31"
11581                         rp="How many bits does your $randfunc() function produce?"
11582                         . ./myread
11583                         randbits="$ans"
11584                         seedfunc="s$randfunc"
11585                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11586                         if set $seedfunc val -f; eval $csym; $val; then
11587                                 echo "(Using $seedfunc() to seed random generator)"
11588                         else
11589                                 echo "(Warning: no $seedfunc() to seed random generator)"
11590                                 seedfunc=rand
11591                         fi
11592                         randseedtype=unsigned
11593                         ;;
11594                 esac
11595                 ;;
11596         esac
11597 done
11598
11599 echo " "
11600 echo "Determining whether or not we are on an EBCDIC system..." >&4
11601 $cat >tebcdic.c <<'EOM'
11602 int main()
11603 {
11604   if ('M'==0xd4) return 0;
11605   return 1;
11606 }
11607 EOM
11608
11609 val=$undef
11610 set tebcdic
11611 if eval $compile_ok; then
11612         if ./tebcdic; then
11613                 echo "You have EBCDIC." >&4
11614                 val="$define"
11615         else
11616                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11617         fi
11618 else
11619         echo "I'm unable to compile the test program." >&4
11620         echo "I'll assume ASCII or some ISO Latin." >&4
11621 fi
11622 $rm -f tebcdic.c tebcdic
11623 set ebcdic
11624 eval $setvar
11625
11626 echo " "
11627 $cat >&4 <<EOM
11628 Checking how to flush all pending stdio output...
11629 EOM
11630 # I only know how to find the first 32 possibly open files on SunOS.
11631 # See also hints/sunos_4_1.sh and util.c  --AD
11632 case "$osname" in
11633 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11634 esac
11635 $cat >>try.c <<EOCP
11636 #include <stdio.h>
11637 #$i_unistd I_UNISTD
11638 #ifdef I_UNISTD
11639 # include <unistd.h>
11640 #endif
11641 #$d_sysconf HAS_SYSCONF
11642 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11643 #ifdef HAS_STDIO_STREAM_ARRAY
11644 # define STDIO_STREAM_ARRAY $stdio_stream_array
11645 #endif
11646 int main() {
11647   FILE* p = fopen("try.out", "w");
11648 #ifdef TRY_FPUTC
11649   fputc('x', p);
11650 #else
11651 # ifdef TRY_FPRINTF
11652   fprintf(p, "x");
11653 # endif
11654 #endif
11655 #ifdef TRY_FFLUSH_NULL
11656   fflush(NULL);
11657 #endif
11658 #ifdef TRY_FFLUSH_ALL
11659   {
11660     long open_max = -1;
11661 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11662     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11663 # else
11664 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11665     open_max = sysconf(_SC_OPEN_MAX);
11666 #  else
11667 #   ifdef FOPEN_MAX
11668     open_max = FOPEN_MAX;
11669 #   else
11670 #    ifdef OPEN_MAX
11671     open_max = OPEN_MAX;
11672 #    else
11673 #     ifdef _NFILE
11674     open_max = _NFILE;
11675 #     endif
11676 #    endif
11677 #   endif
11678 #  endif
11679 # endif 
11680 # ifdef HAS_STDIO_STREAM_ARRAY
11681     if (open_max > 0) {
11682       long i;
11683       for (i = 0; i < open_max; i++)
11684             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11685                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11686                 STDIO_STREAM_ARRAY[i]._flag)
11687                 fflush(&STDIO_STREAM_ARRAY[i]);
11688     }   
11689   }
11690 # endif
11691 #endif
11692   _exit(42);
11693 }
11694 EOCP
11695 : first we have to find out how _not_ to flush
11696 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11697     output=''
11698     set try -DTRY_FPUTC
11699     if eval $compile; then
11700             $rm -f try.out
11701             ./try$exe_ext 2>/dev/null
11702             if $test ! -s try.out -a "X$?" = X42; then
11703                 output=-DTRY_FPUTC
11704             fi
11705     fi
11706     case "$output" in
11707     '')
11708             set try -DTRY_FPRINTF
11709             $rm -f try.out
11710             if eval $compile; then
11711                     $rm -f try.out
11712                     ./try$exe_ext 2>/dev/null
11713                     if $test ! -s try.out -a "X$?" = X42; then
11714                         output=-DTRY_FPRINTF
11715                     fi
11716             fi
11717         ;;
11718     esac
11719 fi
11720 : check for fflush NULL behaviour
11721 case "$fflushNULL" in
11722 '')     set try -DTRY_FFLUSH_NULL $output
11723         if eval $compile; then
11724                 $rm -f try.out
11725                 ./try$exe_ext 2>/dev/null
11726                 code="$?"
11727                 if $test -s try.out -a "X$code" = X42; then
11728                         fflushNULL="`$cat try.out`"
11729                 else
11730                         if $test "X$code" != X42; then
11731                                 $cat >&4 <<EOM
11732 (If this test failed, don't worry, we'll try another method shortly.)
11733 EOM
11734                         fi
11735                 fi
11736         fi
11737         $rm -f core try.core core.try.*
11738         case "$fflushNULL" in
11739         x)      $cat >&4 <<EOM
11740 Your fflush(NULL) works okay.
11741 EOM
11742                 fflushNULL="$define"
11743                 ;;
11744         '')     $cat >&4 <<EOM
11745 Your fflush(NULL) isn't working (contrary to ANSI C).
11746 EOM
11747                 fflushNULL="$undef"
11748                 ;;
11749         *)      $cat >&4 <<EOM
11750 Cannot figure out whether your fflush(NULL) works or not.
11751 I'm assuming it doesn't (contrary to ANSI C).
11752 EOM
11753                 fflushNULL="$undef"
11754                 ;;
11755         esac
11756         ;;
11757 $define|true|[yY]*)
11758         fflushNULL="$define"
11759         ;;
11760 *)
11761         fflushNULL="$undef"
11762         ;;
11763 esac
11764 : check explicit looping only if NULL did not work
11765 case "$fflushNULL" in
11766 "$undef")
11767         : check for fflush all behaviour
11768         case "$fflushall" in
11769         '')     set try -DTRY_FFLUSH_ALL $output
11770                 if eval $compile; then
11771                         $cat >&4 <<EOM
11772 (Now testing the other method--but note that also this may fail.)
11773 EOM
11774                         $rm -f try.out
11775                         ./try$exe_ext 2>/dev/null
11776                         if $test -s try.out -a "X$?" = X42; then
11777                                 fflushall="`$cat try.out`"
11778                         fi
11779                 fi
11780                 $rm -f core try.core core.try.*
11781                 case "$fflushall" in
11782                 x)      $cat >&4 <<EOM
11783 Whew. Flushing explicitly all the stdio streams works.
11784 EOM
11785                         fflushall="$define"
11786                         ;;
11787                 '')     $cat >&4 <<EOM
11788 Sigh. Flushing explicitly all the stdio streams doesn't work.
11789 EOM
11790                         fflushall="$undef"
11791                         ;;
11792                 *)      $cat >&4 <<EOM
11793 Cannot figure out whether flushing stdio streams explicitly works or not.
11794 I'm assuming it doesn't.
11795 EOM
11796                         fflushall="$undef"
11797                         ;;
11798                 esac
11799                 ;;
11800         "$define"|true|[yY]*)
11801                 fflushall="$define"
11802                 ;;
11803         *)
11804                 fflushall="$undef"
11805                 ;;
11806         esac
11807         ;;
11808 *)      fflushall="$undef"      
11809         ;;
11810 esac
11811 case "$fflushNULL$fflushall" in
11812 undefundef)
11813         $cat <<EOM
11814 I cannot figure out how to flush pending stdio output.
11815 EOM
11816         ;;
11817 esac
11818 $rm -f try.* try$exe_ext
11819
11820 : Store the full pathname to the ar program for use in the C program
11821 : Respect a hint or command line value for full_ar.
11822 case "$full_ar" in
11823 '') full_ar=$ar ;;
11824 esac
11825
11826 : Store the full pathname to the sed program for use in the C program
11827 full_sed=$sed
11828
11829 : see what type gids are declared as in the kernel
11830 echo " "
11831 echo "Looking for the type for group ids returned by getgid()."
11832 set gid_t gidtype xxx stdio.h sys/types.h
11833 eval $typedef
11834 case "$gidtype" in
11835 xxx)
11836         xxx=`./findhdr sys/user.h`
11837         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11838         case $1 in
11839         unsigned) dflt="$1 $2" ;;
11840         *) dflt="$1" ;;
11841         esac
11842         ;;
11843 *) dflt="$gidtype";;
11844 esac
11845 case "$gidtype" in
11846 gid_t) echo "gid_t found." ;;
11847 *)      rp="What is the type for group ids returned by getgid()?"
11848         . ./myread
11849         gidtype="$ans"
11850         ;;
11851 esac
11852
11853 echo " "
11854 case "$gidtype" in
11855 *_t) zzz="$gidtype"     ;;
11856 *)   zzz="gid"          ;;
11857 esac
11858 echo "Checking the size of $zzz..." >&4 
11859 cat > try.c <<EOCP
11860 #include <sys/types.h>
11861 #include <stdio.h>
11862 int main() {
11863     printf("%d\n", (int)sizeof($gidtype));
11864     exit(0);
11865 }
11866 EOCP
11867 set try
11868 if eval $compile_ok; then
11869         yyy=`./try`
11870         case "$yyy" in
11871         '')     gidsize=4
11872                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11873                 ;;
11874         *)      gidsize=$yyy
11875                 echo "Your $zzz size is $gidsize bytes."
11876                 ;;
11877         esac
11878 else
11879         gidsize=4
11880         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11881 fi
11882
11883
11884 echo " "
11885 case "$gidtype" in
11886 *_t) zzz="$gidtype"     ;;
11887 *)   zzz="gid"          ;;
11888 esac
11889 echo "Checking the sign of $zzz..." >&4 
11890 cat > try.c <<EOCP
11891 #include <sys/types.h>
11892 #include <stdio.h>
11893 int main() {
11894         $gidtype foo = -1;
11895         if (foo < 0)
11896                 printf("-1\n");
11897         else
11898                 printf("1\n");
11899 }
11900 EOCP
11901 set try
11902 if eval $compile; then
11903         yyy=`./try`
11904         case "$yyy" in
11905         '')     gidsign=1
11906                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11907                 ;;
11908         *)      gidsign=$yyy
11909                 case "$gidsign" in
11910                  1) echo "Your $zzz is unsigned." ;;
11911                 -1) echo "Your $zzz is signed."   ;;
11912                 esac
11913                 ;;
11914         esac
11915 else
11916         gidsign=1
11917         echo "(I can't compile the test program--guessing unsigned.)" >&4
11918 fi
11919
11920
11921 : check for length of character
11922 echo " "
11923 case "$charsize" in
11924 '')
11925         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11926         $cat >try.c <<'EOCP'
11927 #include <stdio.h>
11928 int main()
11929 {
11930     printf("%d\n", (int)sizeof(char));
11931     exit(0);
11932 }
11933 EOCP
11934         set try
11935         if eval $compile_ok; then
11936                 dflt=`./try`
11937         else
11938                 dflt='1'
11939                 echo "(I can't seem to compile the test program.  Guessing...)"
11940         fi
11941         ;;
11942 *)
11943         dflt="$charsize"
11944         ;;
11945 esac
11946 rp="What is the size of a character (in bytes)?"
11947 . ./myread
11948 charsize="$ans"
11949 $rm -f try.c try
11950
11951
11952 echo " "
11953 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11954
11955 case "$use64bits:$d_quad:$quadtype" in
11956 define:define:?*)
11957         ivtype="$quadtype"
11958         uvtype="$uquadtype"
11959         ivsize=8
11960         uvsize=8
11961         ;;
11962 *)      ivtype="long"
11963         uvtype="unsigned long"
11964         ivsize=$longsize
11965         uvsize=$longsize
11966         ;;
11967 esac
11968
11969 case "$uselongdouble:$d_longdbl" in
11970 define:define)
11971         nvtype="long double"
11972         nvsize=$longdblsize
11973         ;;
11974 *)      nvtype=double
11975         nvsize=$doublesize
11976         ;;
11977 esac
11978
11979 echo "(IV will be "$ivtype", $ivsize bytes)"
11980 echo "(UV will be "$uvtype", $uvsize bytes)"
11981 echo "(NV will be "$nvtype", $nvsize bytes)"
11982
11983 $cat >try.c <<EOCP
11984 #$i_inttypes I_INTTYPES
11985 #ifdef I_INTTYPES
11986 #include <inttypes.h>
11987 #endif
11988 #include <stdio.h>
11989 int main() {
11990 #ifdef INT8
11991    int8_t i =  INT8_MAX;
11992   uint8_t u = UINT8_MAX;
11993   printf("int8_t\n");
11994 #endif
11995 #ifdef INT16
11996    int16_t i =  INT16_MAX;
11997   uint16_t i = UINT16_MAX;
11998   printf("int16_t\n");
11999 #endif
12000 #ifdef INT32
12001    int32_t i =  INT32_MAX;
12002   uint32_t u = UINT32_MAX;
12003   printf("int32_t\n");
12004 #endif
12005 }
12006 EOCP
12007
12008 case "$i8type" in
12009 '')     case "$charsize" in
12010         1)      i8type=char
12011                 u8type="unsigned char"
12012                 i8size=$charsize
12013                 u8size=$charsize
12014                 ;;
12015         esac
12016         ;;
12017 esac
12018 case "$i8type" in
12019 '')     set try -DINT8
12020         if eval $compile; then
12021                 case "`./try$exe_ext`" in
12022                 int8_t) i8type=int8_t
12023                         u8type=uint8_t
12024                         i8size=1
12025                         u8size=1
12026                         ;;
12027                 esac
12028         fi
12029         ;;
12030 esac
12031 case "$i8type" in
12032 '')     if $test $charsize -ge 1; then
12033                 i8type=char
12034                 u8type="unsigned char"
12035                 i8size=$charsize
12036                 u8size=$charsize
12037         fi
12038         ;;
12039 esac
12040
12041 case "$i16type" in
12042 '')     case "$shortsize" in
12043         2)      i16type=short
12044                 u16type="unsigned short"
12045                 i16size=$shortsize
12046                 u16size=$shortsize
12047                 ;;
12048         esac
12049         ;;
12050 esac
12051 case "$i16type" in
12052 '')     set try -DINT16
12053         if eval $compile; then
12054                 case "`./try$exe_ext`" in
12055                 int16_t)
12056                         i16type=int16_t
12057                         u16type=uint16_t
12058                         i16size=2
12059                         u16size=2
12060                         ;;
12061                 esac
12062         fi
12063         ;;
12064 esac
12065 case "$i16type" in
12066 '')     if $test $shortsize -ge 2; then
12067                 i16type=short
12068                 u16type="unsigned short"
12069                 i16size=$shortsize
12070                 u16size=$shortsize
12071         fi
12072         ;;
12073 esac
12074
12075 case "$i32type" in
12076 '')     case "$longsize" in
12077         4)      i32type=long
12078                 u32type="unsigned long"
12079                 i32size=$longsize
12080                 u32size=$longsize
12081                 ;;
12082         *)      case "$intsize" in
12083                 4)      i32type=int
12084                         u32type="unsigned int"
12085                         i32size=$intsize
12086                         u32size=$intsize
12087                         ;;
12088                 esac
12089                 ;;
12090         esac
12091         ;;
12092 esac
12093 case "$i32type" in
12094 '')     set try -DINT32
12095         if eval $compile; then
12096                 case "`./try$exe_ext`" in
12097                 int32_t)
12098                         i32type=int32_t
12099                         u32type=uint32_t
12100                         i32size=4
12101                         u32size=4
12102                         ;;
12103                 esac
12104         fi
12105         ;;
12106 esac
12107 case "$i32type" in
12108 '')     if $test $intsize -ge 4; then
12109                 i32type=int
12110                 u32type="unsigned int"
12111                 i32size=$intsize
12112                 u32size=$intsize
12113         fi
12114         ;;
12115 esac
12116
12117 case "$i64type" in
12118 '')     case "$d_quad:$quadtype" in
12119         define:?*)
12120                 i64type="$quadtype"
12121                 u64type="$uquadtype"
12122                 i64size=8
12123                 u64size=8
12124                 ;;
12125         esac
12126         ;;
12127 esac
12128
12129 $rm -f try.* try
12130
12131 echo " "
12132
12133 if $test X"$quadtype" != X; then
12134
12135 echo "Checking how to print 64-bit integers..." >&4
12136
12137 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12138         $cat >try.c <<'EOCP'
12139 #include <sys/types.h>
12140 #include <stdio.h>
12141 int main() {
12142   int q = 12345678901;
12143   printf("%ld\n", q);
12144 }
12145 EOCP
12146         set try
12147         if eval $compile; then
12148                 yyy=`./try$exe_ext`
12149                 case "$yyy" in
12150                 12345678901)
12151                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12152                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12153                         echo "We will use %d."
12154                         ;;
12155                 esac
12156         fi
12157 fi
12158
12159 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12160         $cat >try.c <<'EOCP'
12161 #include <sys/types.h>
12162 #include <stdio.h>
12163 int main() {
12164   long q = 12345678901;
12165   printf("%ld\n", q);
12166 }
12167 EOCP
12168         set try
12169         if eval $compile; then
12170                 yyy=`./try$exe_ext`
12171                 case "$yyy" in
12172                 12345678901)
12173                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12174                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12175                         echo "We will use %ld."
12176                         ;;
12177                 esac
12178         fi
12179 fi
12180
12181 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12182         $cat >try.c <<'EOCP'
12183 #include <sys/types.h>
12184 #include <inttypes.h>
12185 #include <stdio.h>
12186 int main() {
12187   int64_t q = 12345678901;
12188   printf("%" PRId64 "\n", q);
12189 }
12190 EOCP
12191         set try
12192         if eval $compile; then
12193                 yyy=`./try$exe_ext`
12194                 case "$yyy" in
12195                 12345678901)
12196                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12197                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12198                         echo "We will use the C9X style."
12199                         ;;
12200                 esac
12201         fi
12202 fi
12203
12204 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12205         $cat >try.c <<'EOCP'
12206 #include <sys/types.h>
12207 #include <stdio.h>
12208 int main() {
12209   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12210   printf("%lld\n", q);
12211 }
12212 EOCP
12213         set try
12214         if eval $compile; then
12215                 yyy=`./try$exe_ext`
12216                 case "$yyy" in
12217                 12345678901)
12218                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12219                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12220                         echo "We will use the %lld style."
12221                         ;;
12222                 esac
12223         fi
12224 fi
12225
12226 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12227         $cat >try.c <<EOCP
12228 #include <sys/types.h>
12229 #include <stdio.h>
12230 int main() {
12231   $quadtype q = 12345678901;
12232   printf("%Ld\n", q);
12233 }
12234 EOCP
12235         set try
12236         if eval $compile; then
12237                 yyy=`./try$exe_ext`
12238                 case "$yyy" in
12239                 12345678901)
12240                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12241                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12242                         echo "We will use %Ld."
12243                         ;;
12244                 esac
12245         fi
12246 fi
12247
12248 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12249         $cat >try.c <<EOCP
12250 #include <sys/types.h>
12251 #include <stdio.h>
12252 int main() {
12253   $quadtype q = 12345678901;
12254   printf("%qd\n", q);
12255 }
12256 EOCP
12257         set try
12258         if eval $compile; then
12259                 yyy=`./try$exe_ext`
12260                 case "$yyy" in
12261                 12345678901)
12262                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12263                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12264                         echo "We will use %qd."
12265                         ;;
12266                 esac
12267         fi
12268 fi
12269
12270 if $test X"$sPRId64" = X; then
12271         echo "Cannot figure out how to print 64-bit integers." >&4
12272 fi
12273
12274 $rm -f try try.*
12275
12276 fi
12277
12278 case "$sPRId64" in
12279 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12280         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12281         ;;
12282 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12283         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12284         ;;
12285 esac
12286
12287
12288 echo " "
12289 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12290
12291 if $test X"$ivsize" = X8; then
12292         ivdformat="$sPRId64"
12293         uvuformat="$sPRIu64"
12294         uvoformat="$sPRIo64"
12295         uvxformat="$sPRIx64"
12296 else
12297         if $test X"$ivsize" = X"$longsize"; then
12298                 ivdformat='"ld"'
12299                 uvuformat='"lu"'
12300                 uvoformat='"lo"'
12301                 uvxformat='"lx"'
12302         else
12303                 if $test X"$ivsize" = X"$intsize"; then
12304                         ivdformat='"d"'
12305                         uvuformat='"u"'
12306                         uvoformat='"o"'
12307                         uvxformat='"x"'
12308                 else
12309                         : far out
12310                         if $test X"$ivsize" = X"$shortsize"; then
12311                                 ivdformat='"hd"'
12312                                 uvuformat='"hu"'
12313                                 uvoformat='"ho"'
12314                                 uvxformat='"hx"'
12315                         fi
12316                 fi
12317         fi
12318 fi
12319
12320 case "$ivdformat" in
12321 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12322     exit 1
12323     ;;
12324 esac
12325
12326
12327 echo " "
12328 $echo "Checking the format string to be used for gids..." >&4
12329
12330 case "$gidsign" in
12331 -1)     if $test X"$gidsize" = X"$ivsize"; then
12332                 gidformat="$ivdformat"
12333         else
12334                 if $test X"$gidsize" = X"$longsize"; then
12335                         gidformat='"ld"'
12336                 else
12337                         if $test X"$gidsize" = X"$intsize"; then
12338                                 gidformat='"d"'
12339                         else
12340                                 if $test X"$gidsize" = X"$shortsize"; then
12341                                         gidformat='"hd"'
12342                                 fi
12343                         fi
12344                 fi
12345         fi
12346         ;;
12347 *)      if $test X"$gidsize" = X"$uvsize"; then
12348                 gidformat="$uvuformat"
12349         else
12350                 if $test X"$gidsize" = X"$longsize"; then
12351                         gidformat='"lu"'
12352                 else
12353                         if $test X"$gidsize" = X"$intsize"; then
12354                                 gidformat='"u"'
12355                         else
12356                                 if $test X"$gidsize" = X"$shortsize"; then
12357                                         gidformat='"hu"'
12358                                 fi
12359                         fi
12360                 fi
12361         fi
12362         ;;
12363 esac
12364
12365 : see if getgroups exists
12366 set getgroups d_getgrps
12367 eval $inlibc
12368
12369 : see if setgroups exists
12370 set setgroups d_setgrps
12371 eval $inlibc
12372
12373
12374 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12375 echo " "
12376 case "$d_getgrps$d_setgrps" in
12377 *define*)
12378         case "$groupstype" in
12379         '') dflt="$gidtype" ;;
12380         *)  dflt="$groupstype" ;;
12381         esac
12382         $cat <<EOM
12383 What type of pointer is the second argument to getgroups() and setgroups()?
12384 Usually this is the same as group ids, $gidtype, but not always.
12385
12386 EOM
12387         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12388         . ./myread
12389         groupstype="$ans"
12390         ;;
12391 *)  groupstype="$gidtype";;
12392 esac
12393
12394 echo " "
12395 echo "Checking if your $make program sets \$(MAKE)..." >&4
12396 case "$make_set_make" in
12397 '')
12398         $sed 's/^X //' > testmake.mak << 'EOF'
12399 Xall:
12400 X       @echo 'maketemp="$(MAKE)"'
12401 EOF
12402         case "`$make -f testmake.mak 2>/dev/null`" in
12403         *maketemp=*) make_set_make='#' ;;
12404         *)      make_set_make="MAKE=$make" ;;
12405         esac
12406         $rm -f testmake.mak
12407         ;;
12408 esac
12409 case "$make_set_make" in
12410 '#') echo "Yup, it does.";;
12411 *) echo "Nope, it doesn't.";;
12412 esac
12413
12414 : see what type is used for mode_t
12415 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12416 set mode_t modetype int stdio.h sys/types.h
12417 eval $typedef_ask
12418
12419 : define a fucntion to check prototypes
12420 $cat > protochk <<EOSH
12421 $startsh
12422 cc="$cc"
12423 optimize="$optimize"
12424 ccflags="$ccflags"
12425 prototype="$prototype"
12426 define="$define"
12427 rm=$rm
12428 EOSH
12429
12430 $cat >> protochk <<'EOSH'
12431
12432 $rm -f try.c
12433 foo="$1"
12434 shift
12435 while test $# -ge 2; do
12436         case "$1" in
12437                 $define) echo "#include <$2>" >> try.c ;;
12438                 literal) echo "$2" >> try.c ;;
12439         esac
12440     shift 2
12441 done
12442 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12443 cat >> try.c <<'EOCP'
12444 #ifdef CAN_PROTOTYPE
12445 #define _(args) args
12446 #else
12447 #define _(args) ()
12448 #endif
12449 EOCP
12450 echo "$foo" >> try.c
12451 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12452 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12453 status=$?
12454 $rm -f try.[co]
12455 exit $status
12456 EOSH
12457 chmod +x protochk
12458 $eunicefix protochk
12459
12460 : see what type is used for size_t
12461 rp="What is the type used for the length parameter for string functions?"
12462 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12463 eval $typedef_ask
12464
12465 : check for type of arguments to gethostbyaddr. 
12466 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12467         case "$d_gethbyaddr" in
12468         $define)
12469                 $cat <<EOM
12470
12471 Checking to see what type of arguments are accepted by gethostbyaddr().
12472 EOM
12473                 hdrs="$define sys/types.h
12474                         $d_socket sys/socket.h 
12475                         $i_niin netinet/in.h 
12476                         $i_netdb netdb.h
12477                         $i_unistd unistd.h"
12478                 : The first arg can 'char *' or 'void *'
12479                 : The second arg is some of integral type
12480                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12481                         for yyy in size_t long int; do
12482                                 case "$netdb_host_type" in
12483                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12484                                         if ./protochk "$try" $hdrs; then
12485                                                 echo "Your system accepts $xxx for the first arg."
12486                                                 echo "...and $yyy for the second arg."
12487                                                 netdb_host_type="$xxx"
12488                                                 netdb_hlen_type="$yyy"
12489                                         fi
12490                                         ;;
12491                                 esac
12492                         done
12493                 done
12494                 : In case none of those worked, prompt the user.
12495                 case "$netdb_host_type" in
12496                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12497                         dflt='char *'
12498                         . ./myread
12499                         netdb_host_type=$ans
12500                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12501                         dflt="$sizetype"
12502                         . ./myread
12503                         netdb_hlen_type=$ans
12504                         ;;
12505                 esac
12506                 ;;
12507         *)      : no gethostbyaddr, so pick harmless defaults
12508                 netdb_host_type='char *'
12509                 netdb_hlen_type="$sizetype"
12510                 ;;
12511         esac
12512         # Remove the "const" if needed. -- but then we'll have a 
12513         # prototype clash!
12514         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12515 fi
12516
12517 : check for type of argument to gethostbyname. 
12518 if test "X$netdb_name_type" = X ; then
12519         case "$d_gethbyname" in
12520         $define)
12521                 $cat <<EOM
12522
12523 Checking to see what type of argument is accepted by gethostbyname().
12524 EOM
12525                 hdrs="$define sys/types.h
12526                         $d_socket sys/socket.h 
12527                         $i_niin netinet/in.h 
12528                         $i_netdb netdb.h
12529                         $i_unistd unistd.h"
12530                 for xxx in "const char *" "char *"; do
12531                         case "$netdb_name_type" in
12532                         '')     try="extern struct hostent *gethostbyname($xxx);"
12533                                 if ./protochk "$try" $hdrs; then
12534                                         echo "Your system accepts $xxx."
12535                                         netdb_name_type="$xxx"
12536                                 fi
12537                                 ;;
12538                         esac
12539                 done
12540                 : In case none of those worked, prompt the user.
12541                 case "$netdb_name_type" in
12542                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12543                         dflt='char *'
12544                         . ./myread
12545                         netdb_name_type=$ans
12546                         ;;
12547                 esac
12548                 ;;
12549         *)      : no gethostbyname, so pick harmless default
12550                 netdb_name_type='char *'
12551                 ;;
12552         esac
12553 fi
12554
12555 : check for type of 1st argument to getnetbyaddr. 
12556 if test "X$netdb_net_type" = X ; then
12557         case "$d_getnbyaddr" in
12558         $define)
12559                 $cat <<EOM
12560
12561 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12562 EOM
12563                 hdrs="$define sys/types.h
12564                         $d_socket sys/socket.h 
12565                         $i_niin netinet/in.h 
12566                         $i_netdb netdb.h
12567                         $i_unistd unistd.h"
12568                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12569                         case "$netdb_net_type" in
12570                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12571                                 if ./protochk "$try" $hdrs; then
12572                                         echo "Your system accepts $xxx."
12573                                         netdb_net_type="$xxx"
12574                                 fi
12575                                 ;;
12576                         esac
12577                 done
12578                 : In case none of those worked, prompt the user.
12579                 case "$netdb_net_type" in
12580                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12581                         dflt='long'
12582                         . ./myread
12583                         netdb_net_type=$ans
12584                         ;;
12585                 esac
12586                 ;;
12587         *)      : no getnetbyaddr, so pick harmless default
12588                 netdb_net_type='long'
12589                 ;;
12590         esac
12591 fi
12592 : locate the preferred pager for this system
12593 case "$pager" in
12594 '')
12595         dflt=''
12596         case "$pg" in
12597         /*) dflt=$pg;;
12598         esac
12599         case "$more" in
12600         /*) dflt=$more;;
12601         esac
12602         case "$less" in
12603         /*) dflt=$less;;
12604         esac
12605         case "$dflt" in
12606         '') dflt=/usr/ucb/more;;
12607         esac
12608         ;;
12609 *) dflt="$pager";;
12610 esac
12611 echo " "
12612 fn=f/
12613 rp='What pager is used on your system?'
12614 . ./getfile
12615 pager="$ans"
12616
12617 : see what type pids are declared as in the kernel
12618 rp="What is the type of process ids on this system?"
12619 set pid_t pidtype int stdio.h sys/types.h
12620 eval $typedef_ask
12621
12622 : Find earliest binary compatible site_perl subdirectory perl can use.
12623 case "$bincompat5005" in
12624 "$define") xs_apiversion='5.005' ;;
12625 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12626 esac
12627 : Find earliest pure perl site_perl subdirectory perl can use.
12628 : The versioned directories started at 5.005.
12629 pm_apiversion='5.005'
12630
12631 : check for length of pointer
12632 echo " "
12633 case "$ptrsize" in
12634 '')
12635         $echo $n "Checking to see how big your pointers are...$c" >&4
12636         if test "$voidflags" -gt 7; then
12637                 echo '#define VOID_PTR char *' > try.c
12638         else
12639                 echo '#define VOID_PTR void *' > try.c
12640         fi
12641         $cat >>try.c <<'EOCP'
12642 #include <stdio.h>
12643 int main()
12644 {
12645     printf("%d\n", (int)sizeof(VOID_PTR));
12646     exit(0);
12647 }
12648 EOCP
12649         set try
12650         if eval $compile_ok; then
12651                 ptrsize=`./try`
12652                 $echo " $ptrsize bytes." >&4
12653         else
12654                 dflt='4'
12655                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12656                 rp="What is the size of a pointer (in bytes)?"
12657                 . ./myread
12658                 ptrsize="$ans"
12659         fi
12660         ;;
12661 esac
12662 $rm -f try.c try
12663
12664 : see if ar generates random libraries by itself
12665 echo " "
12666 echo "Checking how to generate random libraries on your machine..." >&4
12667 echo 'int bar1() { return bar2(); }' > bar1.c
12668 echo 'int bar2() { return 2; }' > bar2.c
12669 $cat > foo.c <<'EOP'
12670 int main() { printf("%d\n", bar1()); exit(0); }
12671 EOP
12672 $cc $ccflags -c bar1.c >/dev/null 2>&1
12673 $cc $ccflags -c bar2.c >/dev/null 2>&1
12674 $cc $ccflags -c foo.c >/dev/null 2>&1
12675 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12676 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12677         ./foobar >/dev/null 2>&1; then
12678         echo "$ar appears to generate random libraries itself."
12679         orderlib=false
12680         ranlib=":"
12681 elif $ar ts bar$_a >/dev/null 2>&1 &&
12682         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12683         ./foobar >/dev/null 2>&1; then
12684                 echo "a table of contents needs to be added with '$ar ts'."
12685                 orderlib=false
12686                 ranlib="$ar ts"
12687 else
12688         case "$ranlib" in
12689         :) ranlib='';;
12690         '')
12691                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12692                 $test -f $ranlib || ranlib=''
12693                 ;;
12694         esac
12695         if $test -n "$ranlib"; then
12696                 echo "your system has '$ranlib'; we'll use that."
12697                 orderlib=false
12698         else
12699                 echo "your system doesn't seem to support random libraries"
12700                 echo "so we'll use lorder and tsort to order the libraries."
12701                 orderlib=true
12702                 ranlib=":"
12703         fi
12704 fi
12705 $rm -f foo* bar* 
12706
12707 : check for type of arguments to select. 
12708 case "$selecttype" in
12709 '') case "$d_select" in
12710         $define)
12711                 $cat <<EOM
12712 Checking to see what type of arguments are accepted by select().
12713 EOM
12714                 hdrs="$define sys/types.h
12715                         $i_systime sys/time.h 
12716                         $i_sysselct sys/select.h
12717                         $d_socket sys/socket.h"
12718                 : The first arg can be int, unsigned, or size_t
12719                 : The last arg may or may not be 'const'
12720                 val=''
12721                 : void pointer has been seen but using that
12722                 : breaks the selectminbits test
12723                 for xxx in 'fd_set *' 'int *'; do
12724                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12725                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12726                                         case "$val" in
12727                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12728                                                 if ./protochk "$try" $hdrs; then
12729                                                         echo "Your system accepts $xxx."
12730                                                         val="$xxx"
12731                                                 fi
12732                                                 ;;
12733                                         esac
12734                                 done
12735                         done
12736                 done
12737                 case "$val" in
12738                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12739                         case "$d_fd_set" in
12740                                 $define) dflt="fd_set *" ;;
12741                                 *)              dflt="int *" ;;
12742                         esac
12743                         . ./myread
12744                         val=$ans
12745                         ;;
12746                 esac
12747                 selecttype="$val"
12748                 ;;
12749         *)      : no select, so pick a harmless default
12750                 selecttype='int *'
12751                 ;;
12752         esac
12753         ;;
12754 esac
12755
12756 : check for the select 'width'
12757 case "$selectminbits" in
12758 '') case "$d_select" in
12759         $define)
12760                 $cat <<EOM
12761
12762 Checking to see on how many bits at a time your select() operates...
12763 EOM
12764                 $cat >try.c <<EOCP
12765 #include <sys/types.h>
12766 #$i_time I_TIME
12767 #$i_systime I_SYS_TIME
12768 #$i_systimek I_SYS_TIME_KERNEL
12769 #ifdef I_TIME
12770 #   include <time.h>
12771 #endif
12772 #ifdef I_SYS_TIME
12773 #   ifdef I_SYS_TIME_KERNEL
12774 #       define KERNEL
12775 #   endif
12776 #   include <sys/time.h>
12777 #   ifdef I_SYS_TIME_KERNEL
12778 #       undef KERNEL
12779 #   endif
12780 #endif
12781 #$i_sysselct I_SYS_SELECT
12782 #ifdef I_SYS_SELECT
12783 #include <sys/select.h>
12784 #endif
12785 #$d_socket HAS_SOCKET
12786 #ifdef HAS_SOCKET
12787 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12788 #endif
12789 #include <stdio.h>
12790 $selecttype b;
12791 #define S sizeof(*(b))
12792 #define MINBITS 64
12793 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12794 #define NBITS  (NBYTES * 8)
12795 int main() {
12796     char s[NBYTES];
12797     struct timeval t;
12798     int i;
12799     FILE* fp;
12800     int fd;
12801
12802     fclose(stdin);
12803     fp = fopen("try.c", "r");
12804     if (fp == 0)
12805       exit(1);
12806     fd = fileno(fp);
12807     if (fd < 0)
12808       exit(2);
12809     b = ($selecttype)s;
12810     for (i = 0; i < NBITS; i++)
12811         FD_SET(i, b);
12812     t.tv_sec  = 0;
12813     t.tv_usec = 0;
12814     select(fd + 1, b, 0, 0, &t);
12815     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12816     printf("%d\n", i + 1);
12817     return 0;
12818 }
12819 EOCP
12820                 set try
12821                 if eval $compile_ok; then
12822                         selectminbits=`./try`
12823                         case "$selectminbits" in
12824                         '')     cat >&4 <<EOM
12825 Cannot figure out on how many bits at a time your select() operates.
12826 I'll play safe and guess it is 32 bits.
12827 EOM
12828                                 selectminbits=32
12829                                 bits="32 bits"
12830                                 ;;
12831                         1)      bits="1 bit" ;;
12832                         *)      bits="$selectminbits bits" ;;
12833                         esac
12834                         echo "Your select() operates on $bits at a time." >&4
12835                 else
12836                         rp='What is the minimum number of bits your select() operates on?'
12837                         case "$byteorder" in
12838                         1234|12345678)  dflt=32 ;;
12839                         *)              dflt=1  ;;
12840                         esac
12841                         . ./myread
12842                         val=$ans
12843                         selectminbits="$val"
12844                 fi
12845                 $rm -f try.* try
12846                 ;;
12847         *)      : no select, so pick a harmless default
12848                 selectminbits='32'
12849                 ;;
12850         esac
12851         ;;
12852 esac
12853
12854 : Trace out the files included by signal.h, then look for SIGxxx names.
12855 : Remove SIGARRAYSIZE used by HPUX.
12856 : Remove SIGSTKSIZE used by Linux.
12857 : Remove SIGSTKSZ used by Posix.
12858 : Remove SIGTYP void lines used by OS2.
12859 xxx=`echo '#include <signal.h>' |
12860         $cppstdin $cppminus $cppflags 2>/dev/null |
12861         $grep '^[       ]*#.*include' | 
12862         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12863 : Check this list of files to be sure we have parsed the cpp output ok.
12864 : This will also avoid potentially non-existent files, such 
12865 : as ../foo/bar.h
12866 xxxfiles=''
12867 for xx in $xxx /dev/null ; do
12868         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12869 done
12870 : If we have found no files, at least try signal.h
12871 case "$xxxfiles" in
12872 '')     xxxfiles=`./findhdr signal.h` ;;
12873 esac
12874 xxx=`awk '
12875 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12876         print substr($2, 4, 20)
12877 }
12878 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12879         print substr($3, 4, 20)
12880 }' $xxxfiles`
12881 : Append some common names just in case the awk scan failed.
12882 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12883 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12884 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12885 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12886 : generate a few handy files for later
12887 $cat > signal.c <<'EOCP'
12888 #include <sys/types.h>
12889 #include <signal.h>
12890 #include <stdio.h>
12891 int main() {
12892
12893 /* Strange style to avoid deeply-nested #if/#else/#endif */
12894 #ifndef NSIG
12895 #  ifdef _NSIG
12896 #    define NSIG (_NSIG)
12897 #  endif
12898 #endif
12899
12900 #ifndef NSIG
12901 #  ifdef SIGMAX
12902 #    define NSIG (SIGMAX+1)
12903 #  endif
12904 #endif
12905
12906 #ifndef NSIG
12907 #  ifdef SIG_MAX
12908 #    define NSIG (SIG_MAX+1)
12909 #  endif
12910 #endif
12911
12912 #ifndef NSIG
12913 #  ifdef MAXSIG
12914 #    define NSIG (MAXSIG+1)
12915 #  endif
12916 #endif
12917
12918 #ifndef NSIG
12919 #  ifdef MAX_SIG
12920 #    define NSIG (MAX_SIG+1)
12921 #  endif
12922 #endif
12923
12924 #ifndef NSIG
12925 #  ifdef SIGARRAYSIZE
12926 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12927 #  endif
12928 #endif
12929
12930 #ifndef NSIG
12931 #  ifdef _sys_nsig
12932 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12933 #  endif
12934 #endif
12935
12936 /* Default to some arbitrary number that's big enough to get most
12937    of the common signals.
12938 */
12939 #ifndef NSIG
12940 #    define NSIG 50
12941 #endif
12942
12943 printf("NSIG %d\n", NSIG);
12944
12945 #ifndef JUST_NSIG
12946
12947 EOCP
12948
12949 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12950 {
12951         printf "#ifdef SIG"; printf $1; printf "\n"
12952         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12953         printf $1; printf ");\n"
12954         printf "#endif\n"
12955 }
12956 END {
12957         printf "#endif /* JUST_NSIG */\n";
12958         printf "exit(0);\n}\n";
12959 }
12960 ' >>signal.c
12961 $cat >signal.awk <<'EOP'
12962 BEGIN { ndups = 0 }
12963 $1 ~ /^NSIG$/ { nsig = $2 }
12964 ($1 !~ /^NSIG$/) && (NF == 2) {
12965     if ($2 > maxsig) { maxsig = $2 }
12966     if (sig_name[$2]) {
12967         dup_name[ndups] = $1
12968         dup_num[ndups] = $2
12969         ndups++ 
12970     }
12971     else {
12972         sig_name[$2] = $1
12973         sig_num[$2] = $2
12974     }
12975 }
12976 END { 
12977     if (nsig == 0) {
12978         nsig = maxsig + 1
12979     }
12980     printf("NSIG %d\n", nsig);
12981     for (n = 1; n < nsig; n++) {
12982         if (sig_name[n]) {
12983             printf("%s %d\n", sig_name[n], sig_num[n])
12984         }
12985         else {
12986             printf("NUM%d %d\n", n, n) 
12987         }
12988     }
12989     for (n = 0; n < ndups; n++) {
12990         printf("%s %d\n", dup_name[n], dup_num[n])
12991     }
12992 }
12993 EOP
12994 $cat >signal_cmd <<EOS
12995 $startsh
12996 if $test -s signal.lst; then
12997     echo "Using your existing signal.lst file"
12998         exit 0
12999 fi
13000 xxx="$xxx"
13001 EOS
13002 $cat >>signal_cmd <<'EOS'
13003
13004 set signal
13005 if eval $compile_ok; then
13006         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13007 else
13008         echo "(I can't seem be able to compile the whole test program)" >&4
13009         echo "(I'll try it in little pieces.)" >&4
13010         set signal -DJUST_NSIG
13011         if eval $compile_ok; then
13012                 ./signal$_exe > signal.nsg
13013                 $cat signal.nsg
13014         else
13015                 echo "I can't seem to figure out how many signals you have." >&4
13016                 echo "Guessing 50." >&4
13017                 echo 'NSIG 50' > signal.nsg
13018         fi
13019         : Now look at all the signal names, one at a time.
13020         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13021                 $cat > signal.c <<EOCP
13022 #include <sys/types.h>
13023 #include <signal.h>
13024 #include <stdio.h>
13025 int main() {
13026 printf("$xx %d\n", SIG${xx});
13027 return 0;
13028 }
13029 EOCP
13030                 set signal
13031                 if eval $compile; then
13032                         echo "SIG${xx} found."
13033                         ./signal$_exe  >> signal.ls1
13034                 else
13035                         echo "SIG${xx} NOT found."
13036                 fi
13037         done
13038         if $test -s signal.ls1; then
13039                 $cat signal.nsg signal.ls1 |
13040                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13041         fi
13042
13043 fi
13044 if $test -s signal.lst; then
13045         :
13046 else
13047         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13048         echo 'kill -l' >signal
13049         set X `csh -f <signal`
13050         $rm -f signal
13051         shift
13052         case $# in
13053         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13054         esac
13055         echo $@ | $tr ' ' $trnl | \
13056             $awk '{ printf "%s %d\n", $1, ++s; }
13057                   END { printf "NSIG %d\n", ++s }' >signal.lst
13058 fi
13059 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13060 EOS
13061 chmod a+x signal_cmd
13062 $eunicefix signal_cmd
13063
13064 : generate list of signal names
13065 echo " "
13066 case "$sig_name_init" in
13067 '') doinit=yes ;;
13068 *)  case "$sig_num_init" in
13069     ''|*,*) doinit=yes ;;
13070     esac ;;
13071 esac
13072 case "$doinit" in
13073 yes)
13074         echo "Generating a list of signal names and numbers..." >&4
13075         . ./signal_cmd
13076         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13077         sig_name=`$awk 'BEGIN { printf "ZERO " }
13078                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13079         sig_num=`$awk  'BEGIN { printf "0 " }
13080                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13081         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13082                              !/^NSIG/   { printf "\"%s\", ", $1 }
13083                              END        { printf "0\n" }' signal.lst`
13084         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13085                              !/^NSIG/   { printf "%d, ", $2}
13086                              END        { printf "0\n"}' signal.lst`
13087         ;;
13088 esac
13089 echo "The following $sig_count signals are available:"
13090 echo " "
13091 echo $sig_name | $awk \
13092 'BEGIN { linelen = 0 }
13093 {
13094         for (i = 1; i <= NF; i++) {
13095                 name = "SIG" $i " "
13096                 linelen = linelen + length(name)
13097                 if (linelen > 70) {
13098                         printf "\n"
13099                         linelen = length(name)
13100                 }
13101                 printf "%s", name
13102         }
13103         printf "\n"
13104 }'
13105 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13106
13107 : see what type is used for signed size_t
13108 set ssize_t ssizetype int stdio.h sys/types.h
13109 eval $typedef
13110 dflt="$ssizetype"
13111 $cat > ssize.c <<EOM
13112 #include <stdio.h>
13113 #include <sys/types.h>
13114 #define Size_t $sizetype
13115 #define SSize_t $dflt
13116 int main()
13117 {
13118         if (sizeof(Size_t) == sizeof(SSize_t))
13119                 printf("$dflt\n");
13120         else if (sizeof(Size_t) == sizeof(int))
13121                 printf("int\n");
13122         else 
13123                 printf("long\n");
13124         exit(0);
13125 }
13126 EOM
13127 echo " "
13128 set ssize
13129 if eval $compile_ok && ./ssize > /dev/null; then
13130         ssizetype=`./ssize`
13131         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13132 else
13133         $cat >&4 <<EOM
13134 Help! I can't compile and run the ssize_t test program: please enlighten me!
13135 (This is probably a misconfiguration in your system or libraries, and
13136 you really ought to fix it.  Still, I'll try anyway.)
13137
13138 I need a type that is the same size as $sizetype, but is guaranteed to
13139 be signed.  Common values are ssize_t, int and long.
13140
13141 EOM
13142         rp="What signed type is the same size as $sizetype?"
13143         . ./myread
13144         ssizetype="$ans"
13145 fi
13146 $rm -f ssize ssize.*
13147
13148 : see what type of char stdio uses.
13149 echo " "
13150 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13151         echo "Your stdio uses unsigned chars." >&4
13152         stdchar="unsigned char"
13153 else
13154         echo "Your stdio uses signed chars." >&4
13155         stdchar="char"
13156 fi
13157
13158 : see if time exists
13159 echo " "
13160 if test "X$d_time" = X -o X"$timetype" = X; then
13161     if set time val -f d_time; eval $csym; $val; then
13162                 echo 'time() found.' >&4
13163                 val="$define"
13164                 rp="What is the type returned by time() on this system?"
13165                 set time_t timetype long stdio.h sys/types.h
13166                 eval $typedef_ask
13167     else
13168                 echo 'time() not found, hope that will do.' >&4
13169                 val="$undef"
13170                 timetype='int';
13171     fi
13172     set d_time
13173     eval $setvar
13174 fi
13175
13176 : see what type uids are declared as in the kernel
13177 echo " "
13178 echo "Looking for the type for user ids returned by getuid()."
13179 set uid_t uidtype xxx stdio.h sys/types.h
13180 eval $typedef
13181 case "$uidtype" in
13182 xxx)
13183         xxx=`./findhdr sys/user.h`
13184         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13185         case $1 in
13186         unsigned) dflt="$1 $2" ;;
13187         *) dflt="$1" ;;
13188         esac
13189         ;;
13190 *) dflt="$uidtype";;
13191 esac
13192 case "$uidtype" in
13193 uid_t)  echo "uid_t found." ;;
13194 *)      rp="What is the type for user ids returned by getuid()?"
13195         . ./myread
13196         uidtype="$ans"
13197         ;;
13198 esac
13199
13200 echo " "
13201 case "$uidtype" in
13202 *_t) zzz="$uidtype"     ;;
13203 *)   zzz="uid"          ;;
13204 esac
13205 echo "Checking the size of $zzz..." >&4 
13206 cat > try.c <<EOCP
13207 #include <sys/types.h>
13208 #include <stdio.h>
13209 int main() {
13210     printf("%d\n", (int)sizeof($uidtype));
13211     exit(0);
13212 }
13213 EOCP
13214 set try
13215 if eval $compile_ok; then
13216         yyy=`./try`
13217         case "$yyy" in
13218         '')     uidsize=4
13219                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13220                 ;;
13221         *)      uidsize=$yyy
13222                 echo "Your $zzz size is $uidsize bytes."
13223                 ;;
13224         esac
13225 else
13226         uidsize=4
13227         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13228 fi
13229
13230 echo " "
13231 case "$uidtype" in
13232 *_t) zzz="$uidtype"     ;;
13233 *)   zzz="uid"          ;;
13234 esac
13235 echo "Checking the sign of $zzz..." >&4
13236 cat > try.c <<EOCP
13237 #include <sys/types.h>
13238 #include <stdio.h>
13239 int main() {
13240         $uidtype foo = -1;
13241         if (foo < 0)
13242                 printf("-1\n");
13243         else
13244                 printf("1\n");
13245 }
13246 EOCP
13247 set try
13248 if eval $compile; then
13249         yyy=`./try`
13250         case "$yyy" in
13251         '')     uidsign=1
13252                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13253                 ;;
13254         *)      uidsign=$yyy
13255                 case "$uidsign" in
13256                  1) echo "Your $zzz is unsigned." ;;
13257                 -1) echo "Your $zzz is signed."   ;;
13258                 esac
13259                 ;;
13260         esac
13261 else
13262         uidsign=1
13263         echo "(I can't compile the test program--guessing unsigned.)" >&4
13264 fi
13265
13266
13267
13268 echo " "
13269 $echo "Checking the format string to be used for uids..." >&4
13270
13271 case "$uidsign" in
13272 -1)     if $test X"$uidsize" = X"$ivsize"; then
13273                 uidformat="$ivdformat"
13274         else
13275                 if $test X"$uidsize" = X"$longsize"; then
13276                         uidformat='"ld"'
13277                 else
13278                         if $test X"$uidsize" = X"$intsize"; then
13279                                 uidformat='"d"'
13280                         else
13281                                 if $test X"$uidsize" = X"$shortsize"; then
13282                                         uidformat='"hd"'
13283                                 fi
13284                         fi
13285                 fi
13286         fi
13287         ;;
13288 *)      if $test X"$uidsize" = X"$uvsize"; then
13289                 uidformat="$uvuformat"
13290         else
13291                 if $test X"$uidsize" = X"$longsize"; then
13292                         uidformat='"lu"'
13293                 else
13294                         if $test X"$uidsize" = X"$intsize"; then
13295                                 uidformat='"u"'
13296                         else
13297                                 if $test X"$uidsize" = X"$shortsize"; then
13298                                         uidformat='"hu"'
13299                                 fi
13300                         fi
13301                 fi
13302         fi
13303         ;;
13304 esac
13305
13306 : see if dbm.h is available
13307 : see if dbmclose exists
13308 set dbmclose d_dbmclose
13309 eval $inlibc
13310
13311 case "$d_dbmclose" in
13312 $define)
13313         set dbm.h i_dbm
13314         eval $inhdr
13315         case "$i_dbm" in
13316         $define)
13317                 val="$undef"
13318                 set i_rpcsvcdbm
13319                 eval $setvar
13320                 ;;
13321         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13322                 eval $inhdr
13323                 ;;
13324         esac
13325         ;;
13326 *)      echo "We won't be including <dbm.h>"
13327         val="$undef"
13328         set i_dbm
13329         eval $setvar
13330         val="$undef"
13331         set i_rpcsvcdbm
13332         eval $setvar
13333         ;;
13334 esac
13335
13336 : see if this is a sys/file.h system
13337 val=''
13338 set sys/file.h val
13339 eval $inhdr
13340
13341 : do we need to include sys/file.h ?
13342 case "$val" in
13343 "$define")
13344         echo " "
13345         if $h_sysfile; then
13346                 val="$define"
13347                 echo "We'll be including <sys/file.h>." >&4
13348         else
13349                 val="$undef"
13350                 echo "We won't be including <sys/file.h>." >&4
13351         fi
13352         ;;
13353 *)
13354         h_sysfile=false
13355         ;;
13356 esac
13357 set i_sysfile
13358 eval $setvar
13359
13360 : see if fcntl.h is there
13361 val=''
13362 set fcntl.h val
13363 eval $inhdr
13364
13365 : see if we can include fcntl.h
13366 case "$val" in
13367 "$define")
13368         echo " "
13369         if $h_fcntl; then
13370                 val="$define"
13371                 echo "We'll be including <fcntl.h>." >&4
13372         else
13373                 val="$undef"
13374                 if $h_sysfile; then
13375         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13376                 else
13377                         echo "We won't be including <fcntl.h>." >&4
13378                 fi
13379         fi
13380         ;;
13381 *)
13382         h_fcntl=false
13383         val="$undef"
13384         ;;
13385 esac
13386 set i_fcntl
13387 eval $setvar
13388
13389 : see if locale.h is available
13390 set locale.h i_locale
13391 eval $inhdr
13392
13393 : see if mach cthreads are available
13394 if test "X$usethreads" = "X$define"; then
13395         set mach/cthreads.h i_machcthr
13396         eval $inhdr
13397 else
13398         i_machcthr="$undef"
13399 fi
13400
13401
13402
13403 : see if this is a math.h system
13404 set math.h i_math
13405 eval $inhdr
13406
13407 : see if this is a mntent.h system
13408 set mntent.h i_mntent
13409 eval $inhdr
13410
13411 : see if ndbm.h is available
13412 set ndbm.h t_ndbm
13413 eval $inhdr
13414 case "$t_ndbm" in
13415 $define)
13416         : see if dbm_open exists
13417         set dbm_open d_dbm_open
13418         eval $inlibc
13419         case "$d_dbm_open" in
13420         $undef)
13421                 t_ndbm="$undef"
13422                 echo "We won't be including <ndbm.h>"
13423                 ;;
13424         esac
13425         ;;
13426 esac
13427 val="$t_ndbm"
13428 set i_ndbm
13429 eval $setvar
13430
13431 : see if net/errno.h is available
13432 val=''
13433 set net/errno.h val
13434 eval $inhdr
13435
13436 : Unfortunately, it causes problems on some systems.  Arrgh.
13437 case "$val" in
13438 $define)
13439         cat > try.c <<'EOM'
13440 #include <stdio.h>
13441 #include <errno.h>
13442 #include <net/errno.h>
13443 int func()
13444 {
13445         return ENOTSOCK;
13446 }
13447 EOM
13448         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13449                 echo "We'll be including <net/errno.h>." >&4
13450         else
13451                 echo "We won't be including <net/errno.h>." >&4
13452                 val="$undef"
13453         fi
13454         $rm -f try.* try
13455         ;;
13456 esac
13457 set i_neterrno
13458 eval $setvar
13459
13460 : see if netinet/tcp.h is available
13461 set netinet/tcp.h i_netinettcp
13462 eval $inhdr
13463
13464 : see if this is a poll.h system
13465 set poll.h i_poll
13466 eval $inhdr
13467
13468 : get C preprocessor symbols handy
13469 echo " "
13470 $echo $n "Hmm... $c"
13471 echo $al | $tr ' ' $trnl >Cppsym.know
13472 $cat <<EOSS >Cppsym
13473 $startsh
13474 case "\$1" in
13475 -l) list=true
13476         shift
13477         ;;
13478 esac
13479 unknown=''
13480 case "\$list\$#" in
13481 1|2)
13482         for sym do
13483                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13484                         exit 0
13485                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13486                         :
13487                 else
13488                         unknown="\$unknown \$sym"
13489                 fi
13490         done
13491         set X \$unknown
13492         shift
13493         ;;
13494 esac
13495 case \$# in
13496 0) exit 1;;
13497 esac
13498 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13499 #ifdef \1\\
13500 exit 0; _ _ _ _\1\\      \1\\
13501 #endif\\
13502 /' >Cppsym\$\$
13503 echo "exit 1; _ _ _" >>Cppsym\$\$
13504 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13505 case "\$list" in
13506 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13507 *)
13508         sh Cppsym2\$\$
13509         status=\$?
13510         ;;
13511 esac
13512 $rm -f Cppsym\$\$ Cppsym2\$\$
13513 exit \$status
13514 EOSS
13515 chmod +x Cppsym
13516 $eunicefix Cppsym
13517 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13518
13519 : now check the C compiler for additional symbols
13520 postprocess_cc_v=''
13521 case "$osname" in
13522 aix) postprocess_cc_v="|$tr , ' '" ;;
13523 esac
13524 $cat >ccsym <<EOS
13525 $startsh
13526 $cat >tmp.c <<EOF
13527 extern int foo;
13528 EOF
13529 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13530 do
13531         case "\$i" in
13532         -D*) echo "\$i" | $sed 's/^-D//';;
13533         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13534         esac
13535 done
13536 $rm -f try.c
13537 EOS
13538 postprocess_cc_v=''
13539 chmod +x ccsym
13540 $eunicefix ccsym
13541 ./ccsym > ccsym1.raw
13542 if $test -s ccsym1.raw; then
13543        $sort ccsym1.raw | $uniq >ccsym.raw
13544 else
13545        mv ccsym1.raw ccsym.raw
13546 fi
13547
13548 $awk '/\=/ { print $0; next }
13549         { print $0"=1" }' ccsym.raw >ccsym.list
13550 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13551 $comm -13 ccsym.true ccsym.list >ccsym.own
13552 $comm -12 ccsym.true ccsym.list >ccsym.com
13553 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13554 also=''
13555 if $test -z ccsym.raw; then
13556         echo "Your C compiler doesn't seem to define any symbols!" >&4
13557         echo " "
13558         echo "However, your C preprocessor defines the following symbols:"
13559         $cat Cppsym.true
13560         ccsymbols=''
13561         cppsymbols=`$cat Cppsym.true`
13562         cppsymbols=`echo $cppsymbols`
13563         cppccsymbols="$cppsymbols"
13564 else
13565         if $test -s ccsym.com; then
13566                 echo "Your C compiler and pre-processor define these symbols:"
13567                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13568                 also='also '
13569                 symbols='ones'
13570                 cppccsymbols=`$cat ccsym.com`
13571                 cppccsymbols=`echo $cppccsymbols`
13572                 $test "$silent" || sleep 1
13573         fi
13574         if $test -s ccsym.cpp; then
13575                 $test "$also" && echo " "
13576                 echo "Your C pre-processor ${also}defines the following symbols:"
13577                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13578                 also='further '
13579                 cppsymbols=`$cat ccsym.cpp`
13580                 cppsymbols=`echo $cppsymbols`
13581                 $test "$silent" || sleep 1
13582         fi
13583         if $test -s ccsym.own; then
13584                 $test "$also" && echo " "
13585                 echo "Your C compiler ${also}defines the following cpp symbols:"
13586                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13587                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13588                 ccsymbols=`$cat ccsym.own`
13589                 ccsymbols=`echo $ccsymbols`
13590                 $test "$silent" || sleep 1
13591         fi
13592 fi
13593 $rm -f ccsym*
13594
13595 : see if this is a termio system
13596 val="$undef"
13597 val2="$undef"
13598 val3="$undef"
13599 if $test `./findhdr termios.h`; then
13600         set tcsetattr i_termios
13601         eval $inlibc
13602         val3="$i_termios"
13603 fi
13604 echo " "
13605 case "$val3" in
13606 "$define") echo "You have POSIX termios.h... good!" >&4;;
13607 *) if ./Cppsym pyr; then
13608                 case "`/bin/universe`" in
13609                 ucb) if $test `./findhdr sgtty.h`; then
13610                                 val2="$define"
13611                                 echo "<sgtty.h> found." >&4
13612                         else
13613                                 echo "System is pyramid with BSD universe."
13614                                 echo "<sgtty.h> not found--you could have problems." >&4
13615                         fi;;
13616                 *) if $test `./findhdr termio.h`; then
13617                                 val="$define"
13618                                 echo "<termio.h> found." >&4
13619                         else
13620                                 echo "System is pyramid with USG universe."
13621                                 echo "<termio.h> not found--you could have problems." >&4
13622                         fi;;
13623                 esac
13624         elif ./usg; then
13625                 if $test `./findhdr termio.h`; then
13626                         echo "<termio.h> found." >&4
13627                         val="$define"
13628                 elif $test `./findhdr sgtty.h`; then
13629                         echo "<sgtty.h> found." >&4
13630                         val2="$define"
13631                 else
13632 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13633                 fi
13634         else
13635                 if $test `./findhdr sgtty.h`; then
13636                         echo "<sgtty.h> found." >&4
13637                         val2="$define"
13638                 elif $test `./findhdr termio.h`; then
13639                         echo "<termio.h> found." >&4
13640                         val="$define"
13641                 else
13642 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13643                 fi
13644         fi;;
13645 esac
13646 set i_termio; eval $setvar
13647 val=$val2; set i_sgtty; eval $setvar
13648 val=$val3; set i_termios; eval $setvar
13649
13650 : see if this is a shadow.h system
13651 set shadow.h i_shadow
13652 eval $inhdr
13653
13654 : see if this is a socks.h system
13655 set socks.h i_socks
13656 eval $inhdr
13657
13658 : see if stdarg is available
13659 echo " "
13660 if $test `./findhdr stdarg.h`; then
13661         echo "<stdarg.h> found." >&4
13662         valstd="$define"
13663 else
13664         echo "<stdarg.h> NOT found." >&4
13665         valstd="$undef"
13666 fi
13667
13668 : see if varags is available
13669 echo " "
13670 if $test `./findhdr varargs.h`; then
13671         echo "<varargs.h> found." >&4
13672 else
13673         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13674 fi
13675
13676 : set up the varargs testing programs
13677 $cat > varargs.c <<EOP
13678 #ifdef I_STDARG
13679 #include <stdarg.h>
13680 #endif
13681 #ifdef I_VARARGS
13682 #include <varargs.h>
13683 #endif
13684
13685 #ifdef I_STDARG
13686 int f(char *p, ...)
13687 #else
13688 int f(va_alist)
13689 va_dcl
13690 #endif
13691 {
13692         va_list ap;
13693 #ifndef I_STDARG
13694         char *p;
13695 #endif
13696 #ifdef I_STDARG
13697         va_start(ap,p);
13698 #else
13699         va_start(ap);
13700         p = va_arg(ap, char *);
13701 #endif
13702         va_end(ap);
13703 }
13704 EOP
13705 $cat > varargs <<EOP
13706 $startsh
13707 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13708         echo "true"
13709 else
13710         echo "false"
13711 fi
13712 $rm -f varargs$_o
13713 EOP
13714 chmod +x varargs
13715
13716 : now check which varargs header should be included
13717 echo " "
13718 i_varhdr=''
13719 case "$valstd" in
13720 "$define")
13721         if `./varargs I_STDARG`; then
13722                 val='stdarg.h'
13723         elif `./varargs I_VARARGS`; then
13724                 val='varargs.h'
13725         fi
13726         ;;
13727 *)
13728         if `./varargs I_VARARGS`; then
13729                 val='varargs.h'
13730         fi
13731         ;;
13732 esac
13733 case "$val" in
13734 '')
13735 echo "I could not find the definition for va_dcl... You have problems..." >&4
13736         val="$undef"; set i_stdarg; eval $setvar
13737         val="$undef"; set i_varargs; eval $setvar
13738         ;;
13739 *) 
13740         set i_varhdr
13741         eval $setvar
13742         case "$i_varhdr" in
13743         stdarg.h)
13744                 val="$define"; set i_stdarg; eval $setvar
13745                 val="$undef"; set i_varargs; eval $setvar
13746                 ;;
13747         varargs.h)
13748                 val="$undef"; set i_stdarg; eval $setvar
13749                 val="$define"; set i_varargs; eval $setvar
13750                 ;;
13751         esac
13752         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13753 esac
13754 $rm -f varargs*
13755
13756 : see if stddef is available
13757 set stddef.h i_stddef
13758 eval $inhdr
13759
13760 : see if sys/access.h is available
13761 set sys/access.h i_sysaccess
13762 eval $inhdr
13763
13764 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13765 set sys/filio.h i_sysfilio
13766 eval $inhdr
13767 echo " "
13768 if $test `./findhdr sys/ioctl.h`; then
13769         val="$define"
13770         echo '<sys/ioctl.h> found.' >&4
13771 else
13772         val="$undef"
13773         if $test $i_sysfilio = "$define"; then
13774             echo '<sys/ioctl.h> NOT found.' >&4
13775         else
13776                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13777                 $test $i_termio = "$define" && xxx="termio.h"
13778                 $test $i_termios = "$define" && xxx="termios.h"
13779 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13780         fi
13781 fi
13782 set i_sysioctl
13783 eval $setvar
13784
13785 : see if sys/resource.h has to be included
13786 set sys/resource.h i_sysresrc
13787 eval $inhdr
13788
13789 : see if sys/security.h is available
13790 set sys/security.h i_syssecrt
13791 eval $inhdr
13792
13793 : see if this is a sys/statvfs.h system
13794 set sys/statvfs.h i_sysstatvfs
13795 eval $inhdr
13796
13797 : see if this is a sys/uio.h system
13798 set sys/uio.h i_sysuio
13799 eval $inhdr
13800
13801 : see if this is a sys/un.h system
13802 set sys/un.h i_sysun
13803 eval $inhdr
13804
13805 : see if this is a syswait system
13806 set sys/wait.h i_syswait
13807 eval $inhdr
13808
13809 : see if this is a ustat.h system
13810 set ustat.h i_ustat
13811 eval $inhdr
13812
13813 : see if this is an utime system
13814 set utime.h i_utime
13815 eval $inhdr
13816
13817 : see if this is a values.h system
13818 set values.h i_values
13819 eval $inhdr
13820
13821 : see if this is a vfork system
13822 case "$d_vfork" in
13823 "$define")
13824         set vfork.h i_vfork
13825         eval $inhdr
13826         ;;
13827 *)
13828         i_vfork="$undef"
13829         ;;
13830 esac
13831
13832 : see if gdbm.h is available
13833 set gdbm.h t_gdbm
13834 eval $inhdr
13835 case "$t_gdbm" in
13836 $define)
13837         : see if gdbm_open exists
13838         set gdbm_open d_gdbm_open
13839         eval $inlibc
13840         case "$d_gdbm_open" in
13841         $undef)
13842                 t_gdbm="$undef"
13843                 echo "We won't be including <gdbm.h>"
13844                 ;;
13845         esac
13846         ;;
13847 esac
13848 val="$t_gdbm"
13849 set i_gdbm
13850 eval $setvar
13851
13852 echo " "
13853 echo "Looking for extensions..." >&4
13854 : If we are using the old config.sh, known_extensions may contain
13855 : old or inaccurate or duplicate values.
13856 known_extensions=''
13857 nonxs_extensions=''
13858 : We do not use find because it might not be available.
13859 : We do not just use MANIFEST because the user may have dropped
13860 : some additional extensions into the source tree and expect them
13861 : to be built.
13862
13863 : Function to recursively find available extensions, ignoring DynaLoader
13864 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13865 find_extensions='
13866     for xxx in *; do
13867        case "$xxx" in
13868            DynaLoader|dynaload) ;;
13869            *)
13870            if $test -f $xxx/$xxx.xs; then
13871                known_extensions="$known_extensions $1$xxx";
13872            elif $test -f $xxx/Makefile.PL; then
13873                nonxs_extensions="$nonxs_extensions $1$xxx";
13874            else
13875                if $test -d $xxx -a $# -lt 10; then
13876                    set $1$xxx/ $*;
13877                    cd $xxx;
13878                    eval $find_extensions;
13879                    cd ..;
13880                    shift;
13881                fi;
13882            fi
13883            ;;
13884        esac;
13885     done'
13886 tdir=`pwd`
13887 cd $rsrc/ext
13888 set X
13889 shift
13890 eval $find_extensions
13891 set X $nonxs_extensions
13892 shift
13893 nonxs_extensions="$*"
13894 set X $known_extensions
13895 shift
13896 known_extensions="$*"
13897 cd $tdir
13898
13899 : Now see which are supported on this system.
13900 avail_ext=''
13901 for xxx in $known_extensions ; do
13902         case "$xxx" in
13903         DB_File|db_file)
13904                 case "$i_db" in
13905                 $define) avail_ext="$avail_ext $xxx" ;;
13906                 esac
13907                 ;;
13908         GDBM_File|gdbm_fil)
13909                 case "$i_gdbm" in 
13910                 $define) avail_ext="$avail_ext $xxx" ;;
13911                 esac
13912                 ;;
13913         NDBM_File|ndbm_fil)
13914                 case "$i_ndbm" in
13915                 $define) avail_ext="$avail_ext $xxx" ;;
13916                 esac
13917                 ;;
13918         ODBM_File|odbm_fil) 
13919                 case "${i_dbm}${i_rpcsvcdbm}" in
13920                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13921                 esac
13922                 ;;
13923         POSIX|posix)
13924                 case "$useposix" in
13925                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13926                 esac
13927                 ;;
13928         Opcode|opcode)
13929                 case "$useopcode" in
13930                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13931                 esac
13932                 ;;
13933         Socket|socket)
13934                 case "$d_socket" in 
13935                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13936                 esac
13937                 ;;
13938         Thread|thread)
13939                 case "$usethreads" in 
13940                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13941                 esac
13942                 ;;
13943         IPC/SysV|ipc/sysv)
13944                 : XXX Do we need a useipcsysv variable here
13945                 case "${d_msg}${d_sem}${d_shm}" in 
13946                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13947                 esac
13948                 ;;
13949         *)      avail_ext="$avail_ext $xxx"
13950                 ;;
13951         esac
13952 done
13953
13954 set X $avail_ext
13955 shift
13956 avail_ext="$*"
13957
13958 : Now see which nonxs extensions are supported on this system.
13959 : For now assume all are.
13960 nonxs_ext=''
13961 for xxx in $nonxs_extensions ; do
13962         case "$xxx" in
13963         *)      nonxs_ext="$nonxs_ext $xxx"
13964                 ;;
13965         esac
13966 done
13967
13968 set X $nonxs_ext
13969 shift
13970 nonxs_ext="$*"
13971
13972 case $usedl in
13973 $define)
13974         $cat <<EOM
13975 A number of extensions are supplied with $package.  You may choose to
13976 compile these extensions for dynamic loading (the default), compile
13977 them into the $package executable (static loading), or not include
13978 them at all.  Answer "none" to include no extensions.
13979 Note that DynaLoader is always built and need not be mentioned here.
13980
13981 EOM
13982         case "$dynamic_ext" in
13983         '') dflt="$avail_ext" ;;
13984         *)      dflt="$dynamic_ext"
13985                 # Perhaps we are reusing an old out-of-date config.sh.
13986                 case "$hint" in
13987                 previous)
13988                         if test X"$dynamic_ext" != X"$avail_ext"; then
13989                                 $cat <<EOM
13990 NOTICE:  Your previous config.sh list may be incorrect. 
13991 The extensions now available to you are 
13992         ${avail_ext}
13993 but the default list from your previous config.sh is
13994         ${dynamic_ext} 
13995
13996 EOM
13997                         fi
13998                         ;;
13999                 esac
14000                 ;;
14001         esac
14002         case "$dflt" in
14003         '')     dflt=none;;
14004         esac
14005         rp="What extensions do you wish to load dynamically?"
14006         . ./myread
14007         case "$ans" in
14008         none) dynamic_ext=' ' ;;
14009         *) dynamic_ext="$ans" ;;
14010         esac
14011
14012         case "$static_ext" in
14013         '')
14014                 : Exclude those already listed in dynamic linking
14015                 dflt=''
14016                 for xxx in $avail_ext; do
14017                         case " $dynamic_ext " in
14018                         *" $xxx "*) ;;
14019                         *) dflt="$dflt $xxx" ;;
14020                         esac
14021                 done
14022                 set X $dflt
14023                 shift
14024                 dflt="$*"
14025                 ;;
14026         *)  dflt="$static_ext" 
14027                 ;;
14028         esac
14029
14030         case "$dflt" in
14031         '')     dflt=none;;
14032         esac
14033         rp="What extensions do you wish to load statically?"
14034         . ./myread
14035         case "$ans" in
14036         none) static_ext=' ' ;;
14037         *) static_ext="$ans" ;;
14038         esac
14039         ;;
14040 *)
14041         $cat <<EOM
14042 A number of extensions are supplied with $package.  Answer "none" 
14043 to include no extensions. 
14044 Note that DynaLoader is always built and need not be mentioned here.
14045
14046 EOM
14047         case "$static_ext" in
14048         '') dflt="$avail_ext" ;;
14049         *)      dflt="$static_ext"
14050                 # Perhaps we are reusing an old out-of-date config.sh.
14051                 case "$hint" in
14052                 previous)
14053                         if test X"$static_ext" != X"$avail_ext"; then
14054                                 $cat <<EOM
14055 NOTICE:  Your previous config.sh list may be incorrect. 
14056 The extensions now available to you are 
14057         ${avail_ext}
14058 but the default list from your previous config.sh is
14059         ${static_ext} 
14060
14061 EOM
14062                         fi
14063                         ;;
14064                 esac
14065                 ;;
14066         esac
14067         : Exclude those that are not xs extensions
14068         case "$dflt" in
14069         '')     dflt=none;;
14070         esac
14071         rp="What extensions do you wish to include?"
14072         . ./myread
14073         case "$ans" in
14074         none) static_ext=' ' ;;
14075         *) static_ext="$ans" ;;
14076         esac
14077         ;;
14078 esac
14079
14080 set X $dynamic_ext $static_ext $nonxs_ext
14081 shift
14082 extensions="$*"
14083
14084 : Remove build directory name from cppstdin so it can be used from
14085 : either the present location or the final installed location.
14086 echo " "
14087 : Get out of the UU directory to get correct path name.
14088 cd ..
14089 case "$cppstdin" in
14090 `pwd`/cppstdin)
14091         echo "Stripping down cppstdin path name"
14092         cppstdin=cppstdin
14093         ;;
14094 esac
14095 cd UU
14096
14097 : end of configuration questions
14098 echo " "
14099 echo "End of configuration questions."
14100 echo " "
14101
14102 : back to where it started
14103 if test -d ../UU; then
14104         cd ..
14105 fi
14106
14107 : configuration may be patched via a 'config.over' file
14108 if $test -f config.over; then
14109         echo " "
14110         dflt=y
14111         rp='I see a config.over file.  Do you wish to load it?'
14112         . UU/myread
14113         case "$ans" in
14114         n*) echo "OK, I'll ignore it.";;
14115         *)      . ./config.over
14116                 echo "Configuration override changes have been loaded."
14117                 ;;
14118         esac
14119 fi
14120
14121 : in case they want portability, strip down executable paths
14122 case "$d_portable" in
14123 "$define")
14124         echo " "
14125         echo "Stripping down executable paths..." >&4
14126         for file in $loclist $trylist; do
14127                 eval temp=\$$file
14128                 eval $file=`basename $temp`
14129         done
14130         ;;
14131 esac
14132
14133 : create config.sh file
14134 echo " "
14135 echo "Creating config.sh..." >&4
14136 $spitshell <<EOT >config.sh
14137 $startsh
14138 #
14139 # This file was produced by running the Configure script. It holds all the
14140 # definitions figured out by Configure. Should you modify one of these values,
14141 # do not forget to propagate your changes by running "Configure -der". You may
14142 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14143 #
14144
14145 # Package name      : $package
14146 # Source directory  : $src
14147 # Configuration time: $cf_time
14148 # Configured by     : $cf_by
14149 # Target system     : $myuname
14150
14151 Author='$Author'
14152 Date='$Date'
14153 Header='$Header'
14154 Id='$Id'
14155 Locker='$Locker'
14156 Log='$Log'
14157 Mcc='$Mcc'
14158 RCSfile='$RCSfile'
14159 Revision='$Revision'
14160 Source='$Source'
14161 State='$State'
14162 _a='$_a'
14163 _exe='$_exe'
14164 _o='$_o'
14165 afs='$afs'
14166 alignbytes='$alignbytes'
14167 ansi2knr='$ansi2knr'
14168 aphostname='$aphostname'
14169 apiversion='$apiversion'
14170 ar='$ar'
14171 archlib='$archlib'
14172 archlibexp='$archlibexp'
14173 archname64='$archname64'
14174 archname='$archname'
14175 archobjs='$archobjs'
14176 awk='$awk'
14177 baserev='$baserev'
14178 bash='$bash'
14179 bin='$bin'
14180 bincompat5005='$bincompat5005'
14181 binexp='$binexp'
14182 bison='$bison'
14183 byacc='$byacc'
14184 byteorder='$byteorder'
14185 c='$c'
14186 castflags='$castflags'
14187 cat='$cat'
14188 cc='$cc'
14189 cccdlflags='$cccdlflags'
14190 ccdlflags='$ccdlflags'
14191 ccflags='$ccflags'
14192 ccsymbols='$ccsymbols'
14193 cf_by='$cf_by'
14194 cf_email='$cf_email'
14195 cf_time='$cf_time'
14196 charsize='$charsize'
14197 chgrp='$chgrp'
14198 chmod='$chmod'
14199 chown='$chown'
14200 clocktype='$clocktype'
14201 comm='$comm'
14202 compress='$compress'
14203 contains='$contains'
14204 cp='$cp'
14205 cpio='$cpio'
14206 cpp='$cpp'
14207 cpp_stuff='$cpp_stuff'
14208 cppccsymbols='$cppccsymbols'
14209 cppflags='$cppflags'
14210 cpplast='$cpplast'
14211 cppminus='$cppminus'
14212 cpprun='$cpprun'
14213 cppstdin='$cppstdin'
14214 cppsymbols='$cppsymbols'
14215 crosscompile='$crosscompile'
14216 cryptlib='$cryptlib'
14217 csh='$csh'
14218 d_Gconvert='$d_Gconvert'
14219 d_PRIEldbl='$d_PRIEldbl'
14220 d_PRIFldbl='$d_PRIFldbl'
14221 d_PRIGldbl='$d_PRIGldbl'
14222 d_PRIX64='$d_PRIX64'
14223 d_PRId64='$d_PRId64'
14224 d_PRIeldbl='$d_PRIeldbl'
14225 d_PRIfldbl='$d_PRIfldbl'
14226 d_PRIgldbl='$d_PRIgldbl'
14227 d_PRIi64='$d_PRIi64'
14228 d_PRIo64='$d_PRIo64'
14229 d_PRIu64='$d_PRIu64'
14230 d_PRIx64='$d_PRIx64'
14231 d_access='$d_access'
14232 d_accessx='$d_accessx'
14233 d_alarm='$d_alarm'
14234 d_archlib='$d_archlib'
14235 d_atolf='$d_atolf'
14236 d_atoll='$d_atoll'
14237 d_attribut='$d_attribut'
14238 d_bcmp='$d_bcmp'
14239 d_bcopy='$d_bcopy'
14240 d_bincompat5005='$d_bincompat5005'
14241 d_bsd='$d_bsd'
14242 d_bsdgetpgrp='$d_bsdgetpgrp'
14243 d_bsdsetpgrp='$d_bsdsetpgrp'
14244 d_bzero='$d_bzero'
14245 d_casti32='$d_casti32'
14246 d_castneg='$d_castneg'
14247 d_charvspr='$d_charvspr'
14248 d_chown='$d_chown'
14249 d_chroot='$d_chroot'
14250 d_chsize='$d_chsize'
14251 d_closedir='$d_closedir'
14252 d_const='$d_const'
14253 d_crypt='$d_crypt'
14254 d_csh='$d_csh'
14255 d_cuserid='$d_cuserid'
14256 d_dbl_dig='$d_dbl_dig'
14257 d_difftime='$d_difftime'
14258 d_dirnamlen='$d_dirnamlen'
14259 d_dlerror='$d_dlerror'
14260 d_dlopen='$d_dlopen'
14261 d_dlsymun='$d_dlsymun'
14262 d_dosuid='$d_dosuid'
14263 d_drand48proto='$d_drand48proto'
14264 d_dup2='$d_dup2'
14265 d_eaccess='$d_eaccess'
14266 d_endgrent='$d_endgrent'
14267 d_endhent='$d_endhent'
14268 d_endnent='$d_endnent'
14269 d_endpent='$d_endpent'
14270 d_endpwent='$d_endpwent'
14271 d_endsent='$d_endsent'
14272 d_endspent='$d_endspent'
14273 d_eofnblk='$d_eofnblk'
14274 d_eunice='$d_eunice'
14275 d_fchmod='$d_fchmod'
14276 d_fchown='$d_fchown'
14277 d_fcntl='$d_fcntl'
14278 d_fd_macros='$d_fd_macros'
14279 d_fd_set='$d_fd_set'
14280 d_fds_bits='$d_fds_bits'
14281 d_fgetpos='$d_fgetpos'
14282 d_flexfnam='$d_flexfnam'
14283 d_flock='$d_flock'
14284 d_fork='$d_fork'
14285 d_fpathconf='$d_fpathconf'
14286 d_fpos64_t='$d_fpos64_t'
14287 d_fs_data_s='$d_fs_data_s'
14288 d_fseeko='$d_fseeko'
14289 d_fsetpos='$d_fsetpos'
14290 d_fstatfs='$d_fstatfs'
14291 d_fstatvfs='$d_fstatvfs'
14292 d_ftello='$d_ftello'
14293 d_ftime='$d_ftime'
14294 d_getgrent='$d_getgrent'
14295 d_getgrps='$d_getgrps'
14296 d_gethbyaddr='$d_gethbyaddr'
14297 d_gethbyname='$d_gethbyname'
14298 d_gethent='$d_gethent'
14299 d_gethname='$d_gethname'
14300 d_gethostprotos='$d_gethostprotos'
14301 d_getlogin='$d_getlogin'
14302 d_getmnt='$d_getmnt'
14303 d_getmntent='$d_getmntent'
14304 d_getnbyaddr='$d_getnbyaddr'
14305 d_getnbyname='$d_getnbyname'
14306 d_getnent='$d_getnent'
14307 d_getnetprotos='$d_getnetprotos'
14308 d_getpbyname='$d_getpbyname'
14309 d_getpbynumber='$d_getpbynumber'
14310 d_getpent='$d_getpent'
14311 d_getpgid='$d_getpgid'
14312 d_getpgrp2='$d_getpgrp2'
14313 d_getpgrp='$d_getpgrp'
14314 d_getppid='$d_getppid'
14315 d_getprior='$d_getprior'
14316 d_getprotoprotos='$d_getprotoprotos'
14317 d_getpwent='$d_getpwent'
14318 d_getsbyname='$d_getsbyname'
14319 d_getsbyport='$d_getsbyport'
14320 d_getsent='$d_getsent'
14321 d_getservprotos='$d_getservprotos'
14322 d_getspent='$d_getspent'
14323 d_getspnam='$d_getspnam'
14324 d_gettimeod='$d_gettimeod'
14325 d_gnulibc='$d_gnulibc'
14326 d_grpasswd='$d_grpasswd'
14327 d_hasmntopt='$d_hasmntopt'
14328 d_htonl='$d_htonl'
14329 d_index='$d_index'
14330 d_inetaton='$d_inetaton'
14331 d_int64t='$d_int64t'
14332 d_isascii='$d_isascii'
14333 d_killpg='$d_killpg'
14334 d_lchown='$d_lchown'
14335 d_ldbl_dig='$d_ldbl_dig'
14336 d_link='$d_link'
14337 d_locconv='$d_locconv'
14338 d_lockf='$d_lockf'
14339 d_longdbl='$d_longdbl'
14340 d_longlong='$d_longlong'
14341 d_lstat='$d_lstat'
14342 d_mblen='$d_mblen'
14343 d_mbstowcs='$d_mbstowcs'
14344 d_mbtowc='$d_mbtowc'
14345 d_memchr='$d_memchr'
14346 d_memcmp='$d_memcmp'
14347 d_memcpy='$d_memcpy'
14348 d_memmove='$d_memmove'
14349 d_memset='$d_memset'
14350 d_mkdir='$d_mkdir'
14351 d_mkfifo='$d_mkfifo'
14352 d_mktime='$d_mktime'
14353 d_msg='$d_msg'
14354 d_msg_ctrunc='$d_msg_ctrunc'
14355 d_msg_dontroute='$d_msg_dontroute'
14356 d_msg_oob='$d_msg_oob'
14357 d_msg_peek='$d_msg_peek'
14358 d_msg_proxy='$d_msg_proxy'
14359 d_msgctl='$d_msgctl'
14360 d_msgget='$d_msgget'
14361 d_msgrcv='$d_msgrcv'
14362 d_msgsnd='$d_msgsnd'
14363 d_mymalloc='$d_mymalloc'
14364 d_nice='$d_nice'
14365 d_off64_t='$d_off64_t'
14366 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14367 d_oldpthreads='$d_oldpthreads'
14368 d_oldsock='$d_oldsock'
14369 d_open3='$d_open3'
14370 d_pathconf='$d_pathconf'
14371 d_pause='$d_pause'
14372 d_phostname='$d_phostname'
14373 d_pipe='$d_pipe'
14374 d_poll='$d_poll'
14375 d_portable='$d_portable'
14376 d_pthread_yield='$d_pthread_yield'
14377 d_pwage='$d_pwage'
14378 d_pwchange='$d_pwchange'
14379 d_pwclass='$d_pwclass'
14380 d_pwcomment='$d_pwcomment'
14381 d_pwexpire='$d_pwexpire'
14382 d_pwgecos='$d_pwgecos'
14383 d_pwpasswd='$d_pwpasswd'
14384 d_pwquota='$d_pwquota'
14385 d_quad='$d_quad'
14386 d_readdir='$d_readdir'
14387 d_readlink='$d_readlink'
14388 d_rename='$d_rename'
14389 d_rewinddir='$d_rewinddir'
14390 d_rmdir='$d_rmdir'
14391 d_safebcpy='$d_safebcpy'
14392 d_safemcpy='$d_safemcpy'
14393 d_sanemcmp='$d_sanemcmp'
14394 d_sched_yield='$d_sched_yield'
14395 d_scm_rights='$d_scm_rights'
14396 d_seekdir='$d_seekdir'
14397 d_select='$d_select'
14398 d_sem='$d_sem'
14399 d_semctl='$d_semctl'
14400 d_semctl_semid_ds='$d_semctl_semid_ds'
14401 d_semctl_semun='$d_semctl_semun'
14402 d_semget='$d_semget'
14403 d_semop='$d_semop'
14404 d_setegid='$d_setegid'
14405 d_seteuid='$d_seteuid'
14406 d_setgrent='$d_setgrent'
14407 d_setgrps='$d_setgrps'
14408 d_sethent='$d_sethent'
14409 d_setlinebuf='$d_setlinebuf'
14410 d_setlocale='$d_setlocale'
14411 d_setnent='$d_setnent'
14412 d_setpent='$d_setpent'
14413 d_setpgid='$d_setpgid'
14414 d_setpgrp2='$d_setpgrp2'
14415 d_setpgrp='$d_setpgrp'
14416 d_setprior='$d_setprior'
14417 d_setpwent='$d_setpwent'
14418 d_setregid='$d_setregid'
14419 d_setresgid='$d_setresgid'
14420 d_setresuid='$d_setresuid'
14421 d_setreuid='$d_setreuid'
14422 d_setrgid='$d_setrgid'
14423 d_setruid='$d_setruid'
14424 d_setsent='$d_setsent'
14425 d_setsid='$d_setsid'
14426 d_setspent='$d_setspent'
14427 d_setvbuf='$d_setvbuf'
14428 d_sfio='$d_sfio'
14429 d_shm='$d_shm'
14430 d_shmat='$d_shmat'
14431 d_shmatprototype='$d_shmatprototype'
14432 d_shmctl='$d_shmctl'
14433 d_shmdt='$d_shmdt'
14434 d_shmget='$d_shmget'
14435 d_sigaction='$d_sigaction'
14436 d_sigsetjmp='$d_sigsetjmp'
14437 d_socket='$d_socket'
14438 d_sockpair='$d_sockpair'
14439 d_sqrtl='$d_sqrtl'
14440 d_statblks='$d_statblks'
14441 d_statfs_f_flags='$d_statfs_f_flags'
14442 d_statfs_s='$d_statfs_s'
14443 d_statvfs='$d_statvfs'
14444 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14445 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14446 d_stdio_stream_array='$d_stdio_stream_array'
14447 d_stdiobase='$d_stdiobase'
14448 d_stdstdio='$d_stdstdio'
14449 d_strchr='$d_strchr'
14450 d_strcoll='$d_strcoll'
14451 d_strctcpy='$d_strctcpy'
14452 d_strerrm='$d_strerrm'
14453 d_strerror='$d_strerror'
14454 d_strtod='$d_strtod'
14455 d_strtol='$d_strtol'
14456 d_strtoul='$d_strtoul'
14457 d_strtoull='$d_strtoull'
14458 d_strxfrm='$d_strxfrm'
14459 d_suidsafe='$d_suidsafe'
14460 d_symlink='$d_symlink'
14461 d_syscall='$d_syscall'
14462 d_sysconf='$d_sysconf'
14463 d_sysernlst='$d_sysernlst'
14464 d_syserrlst='$d_syserrlst'
14465 d_system='$d_system'
14466 d_tcgetpgrp='$d_tcgetpgrp'
14467 d_tcsetpgrp='$d_tcsetpgrp'
14468 d_telldir='$d_telldir'
14469 d_telldirproto='$d_telldirproto'
14470 d_time='$d_time'
14471 d_times='$d_times'
14472 d_truncate='$d_truncate'
14473 d_tzname='$d_tzname'
14474 d_umask='$d_umask'
14475 d_uname='$d_uname'
14476 d_union_semun='$d_union_semun'
14477 d_ustat='$d_ustat'
14478 d_vendorbin='$d_vendorbin'
14479 d_vendorlib='$d_vendorlib'
14480 d_vfork='$d_vfork'
14481 d_void_closedir='$d_void_closedir'
14482 d_voidsig='$d_voidsig'
14483 d_voidtty='$d_voidtty'
14484 d_volatile='$d_volatile'
14485 d_vprintf='$d_vprintf'
14486 d_wait4='$d_wait4'
14487 d_waitpid='$d_waitpid'
14488 d_wcstombs='$d_wcstombs'
14489 d_wctomb='$d_wctomb'
14490 d_xenix='$d_xenix'
14491 date='$date'
14492 db_hashtype='$db_hashtype'
14493 db_prefixtype='$db_prefixtype'
14494 defvoidused='$defvoidused'
14495 direntrytype='$direntrytype'
14496 dlext='$dlext'
14497 dlsrc='$dlsrc'
14498 doublesize='$doublesize'
14499 drand01='$drand01'
14500 dynamic_ext='$dynamic_ext'
14501 eagain='$eagain'
14502 ebcdic='$ebcdic'
14503 echo='$echo'
14504 egrep='$egrep'
14505 emacs='$emacs'
14506 eunicefix='$eunicefix'
14507 exe_ext='$exe_ext'
14508 expr='$expr'
14509 extensions='$extensions'
14510 fflushNULL='$fflushNULL'
14511 fflushall='$fflushall'
14512 find='$find'
14513 firstmakefile='$firstmakefile'
14514 flex='$flex'
14515 fpossize='$fpossize'
14516 fpostype='$fpostype'
14517 freetype='$freetype'
14518 full_ar='$full_ar'
14519 full_csh='$full_csh'
14520 full_sed='$full_sed'
14521 gccversion='$gccversion'
14522 gidformat='$gidformat'
14523 gidsign='$gidsign'
14524 gidsize='$gidsize'
14525 gidtype='$gidtype'
14526 glibpth='$glibpth'
14527 grep='$grep'
14528 groupcat='$groupcat'
14529 groupstype='$groupstype'
14530 gzip='$gzip'
14531 h_fcntl='$h_fcntl'
14532 h_sysfile='$h_sysfile'
14533 hint='$hint'
14534 hostcat='$hostcat'
14535 huge='$huge'
14536 i16size='$i16size'
14537 i16type='$i16type'
14538 i32size='$i32size'
14539 i32type='$i32type'
14540 i64size='$i64size'
14541 i64type='$i64type'
14542 i8size='$i8size'
14543 i8type='$i8type'
14544 i_arpainet='$i_arpainet'
14545 i_bsdioctl='$i_bsdioctl'
14546 i_db='$i_db'
14547 i_dbm='$i_dbm'
14548 i_dirent='$i_dirent'
14549 i_dld='$i_dld'
14550 i_dlfcn='$i_dlfcn'
14551 i_fcntl='$i_fcntl'
14552 i_float='$i_float'
14553 i_gdbm='$i_gdbm'
14554 i_grp='$i_grp'
14555 i_inttypes='$i_inttypes'
14556 i_limits='$i_limits'
14557 i_locale='$i_locale'
14558 i_machcthr='$i_machcthr'
14559 i_malloc='$i_malloc'
14560 i_math='$i_math'
14561 i_memory='$i_memory'
14562 i_mntent='$i_mntent'
14563 i_ndbm='$i_ndbm'
14564 i_netdb='$i_netdb'
14565 i_neterrno='$i_neterrno'
14566 i_netinettcp='$i_netinettcp'
14567 i_niin='$i_niin'
14568 i_poll='$i_poll'
14569 i_pthread='$i_pthread'
14570 i_pwd='$i_pwd'
14571 i_rpcsvcdbm='$i_rpcsvcdbm'
14572 i_sfio='$i_sfio'
14573 i_sgtty='$i_sgtty'
14574 i_shadow='$i_shadow'
14575 i_socks='$i_socks'
14576 i_stdarg='$i_stdarg'
14577 i_stddef='$i_stddef'
14578 i_stdlib='$i_stdlib'
14579 i_string='$i_string'
14580 i_sysaccess='$i_sysaccess'
14581 i_sysdir='$i_sysdir'
14582 i_sysfile='$i_sysfile'
14583 i_sysfilio='$i_sysfilio'
14584 i_sysin='$i_sysin'
14585 i_sysioctl='$i_sysioctl'
14586 i_sysmount='$i_sysmount'
14587 i_sysndir='$i_sysndir'
14588 i_sysparam='$i_sysparam'
14589 i_sysresrc='$i_sysresrc'
14590 i_syssecrt='$i_syssecrt'
14591 i_sysselct='$i_sysselct'
14592 i_syssockio='$i_syssockio'
14593 i_sysstat='$i_sysstat'
14594 i_sysstatfs='$i_sysstatfs'
14595 i_sysstatvfs='$i_sysstatvfs'
14596 i_systime='$i_systime'
14597 i_systimek='$i_systimek'
14598 i_systimes='$i_systimes'
14599 i_systypes='$i_systypes'
14600 i_sysuio='$i_sysuio'
14601 i_sysun='$i_sysun'
14602 i_sysvfs='$i_sysvfs'
14603 i_syswait='$i_syswait'
14604 i_termio='$i_termio'
14605 i_termios='$i_termios'
14606 i_time='$i_time'
14607 i_unistd='$i_unistd'
14608 i_ustat='$i_ustat'
14609 i_utime='$i_utime'
14610 i_values='$i_values'
14611 i_varargs='$i_varargs'
14612 i_varhdr='$i_varhdr'
14613 i_vfork='$i_vfork'
14614 ignore_versioned_solibs='$ignore_versioned_solibs'
14615 incpath='$incpath'
14616 inews='$inews'
14617 installarchlib='$installarchlib'
14618 installbin='$installbin'
14619 installman1dir='$installman1dir'
14620 installman3dir='$installman3dir'
14621 installprefix='$installprefix'
14622 installprefixexp='$installprefixexp'
14623 installprivlib='$installprivlib'
14624 installscript='$installscript'
14625 installsitearch='$installsitearch'
14626 installsitebin='$installsitebin'
14627 installsitelib='$installsitelib'
14628 installstyle='$installstyle'
14629 installusrbinperl='$installusrbinperl'
14630 installvendorbin='$installvendorbin'
14631 installvendorlib='$installvendorlib'
14632 intsize='$intsize'
14633 ivdformat='$ivdformat'
14634 ivsize='$ivsize'
14635 ivtype='$ivtype'
14636 known_extensions='$known_extensions'
14637 ksh='$ksh'
14638 large='$large'
14639 ld='$ld'
14640 lddlflags='$lddlflags'
14641 ldflags='$ldflags'
14642 ldlibpthname='$ldlibpthname'
14643 less='$less'
14644 lib_ext='$lib_ext'
14645 libc='$libc'
14646 libperl='$libperl'
14647 libpth='$libpth'
14648 libs='$libs'
14649 libswanted='$libswanted'
14650 line='$line'
14651 lint='$lint'
14652 lkflags='$lkflags'
14653 ln='$ln'
14654 lns='$lns'
14655 locincpth='$locincpth'
14656 loclibpth='$loclibpth'
14657 longdblsize='$longdblsize'
14658 longlongsize='$longlongsize'
14659 longsize='$longsize'
14660 lp='$lp'
14661 lpr='$lpr'
14662 ls='$ls'
14663 lseeksize='$lseeksize'
14664 lseektype='$lseektype'
14665 mail='$mail'
14666 mailx='$mailx'
14667 make='$make'
14668 make_set_make='$make_set_make'
14669 mallocobj='$mallocobj'
14670 mallocsrc='$mallocsrc'
14671 malloctype='$malloctype'
14672 man1dir='$man1dir'
14673 man1direxp='$man1direxp'
14674 man1ext='$man1ext'
14675 man3dir='$man3dir'
14676 man3direxp='$man3direxp'
14677 man3ext='$man3ext'
14678 medium='$medium'
14679 mips_type='$mips_type'
14680 mkdir='$mkdir'
14681 models='$models'
14682 modetype='$modetype'
14683 more='$more'
14684 multiarch='$multiarch'
14685 mv='$mv'
14686 myarchname='$myarchname'
14687 mydomain='$mydomain'
14688 myhostname='$myhostname'
14689 myuname='$myuname'
14690 n='$n'
14691 netdb_hlen_type='$netdb_hlen_type'
14692 netdb_host_type='$netdb_host_type'
14693 netdb_name_type='$netdb_name_type'
14694 netdb_net_type='$netdb_net_type'
14695 nm='$nm'
14696 nm_opt='$nm_opt'
14697 nm_so_opt='$nm_so_opt'
14698 nonxs_ext='$nonxs_ext'
14699 nroff='$nroff'
14700 nvsize='$nvsize'
14701 nvtype='$nvtype'
14702 o_nonblock='$o_nonblock'
14703 obj_ext='$obj_ext'
14704 old_pthread_create_joinable='$old_pthread_create_joinable'
14705 optimize='$optimize'
14706 orderlib='$orderlib'
14707 osname='$osname'
14708 osvers='$osvers'
14709 package='$package'
14710 pager='$pager'
14711 passcat='$passcat'
14712 patchlevel='$patchlevel'
14713 path_sep='$path_sep'
14714 perl='$perl'
14715 perladmin='$perladmin'
14716 perlpath='$perlpath'
14717 pg='$pg'
14718 phostname='$phostname'
14719 pidtype='$pidtype'
14720 plibpth='$plibpth'
14721 pm_apiversion='$pm_apiversion'
14722 pmake='$pmake'
14723 pr='$pr'
14724 prefix='$prefix'
14725 prefixexp='$prefixexp'
14726 privlib='$privlib'
14727 privlibexp='$privlibexp'
14728 prototype='$prototype'
14729 ptrsize='$ptrsize'
14730 quadkind='$quadkind'
14731 quadtype='$quadtype'
14732 randbits='$randbits'
14733 randfunc='$randfunc'
14734 randseedtype='$randseedtype'
14735 ranlib='$ranlib'
14736 rd_nodata='$rd_nodata'
14737 rm='$rm'
14738 rmail='$rmail'
14739 runnm='$runnm'
14740 sPRIEldbl='$sPRIEldbl'
14741 sPRIFldbl='$sPRIFldbl'
14742 sPRIGldbl='$sPRIGldbl'
14743 sPRIX64='$sPRIX64'
14744 sPRId64='$sPRId64'
14745 sPRIeldbl='$sPRIeldbl'
14746 sPRIfldbl='$sPRIfldbl'
14747 sPRIgldbl='$sPRIgldbl'
14748 sPRIi64='$sPRIi64'
14749 sPRIo64='$sPRIo64'
14750 sPRIu64='$sPRIu64'
14751 sPRIx64='$sPRIx64'
14752 sched_yield='$sched_yield'
14753 scriptdir='$scriptdir'
14754 scriptdirexp='$scriptdirexp'
14755 sed='$sed'
14756 seedfunc='$seedfunc'
14757 selectminbits='$selectminbits'
14758 selecttype='$selecttype'
14759 sendmail='$sendmail'
14760 sh='$sh'
14761 shar='$shar'
14762 sharpbang='$sharpbang'
14763 shmattype='$shmattype'
14764 shortsize='$shortsize'
14765 shrpenv='$shrpenv'
14766 shsharp='$shsharp'
14767 sig_count='$sig_count'
14768 sig_name='$sig_name'
14769 sig_name_init='$sig_name_init'
14770 sig_num='$sig_num'
14771 sig_num_init='$sig_num_init'
14772 signal_t='$signal_t'
14773 sitearch='$sitearch'
14774 sitearchexp='$sitearchexp'
14775 sitebin='$sitebin'
14776 sitebinexp='$sitebinexp'
14777 sitelib='$sitelib'
14778 sitelibexp='$sitelibexp'
14779 siteprefix='$siteprefix'
14780 siteprefixexp='$siteprefixexp'
14781 sizetype='$sizetype'
14782 sleep='$sleep'
14783 smail='$smail'
14784 small='$small'
14785 so='$so'
14786 sockethdr='$sockethdr'
14787 socketlib='$socketlib'
14788 sort='$sort'
14789 spackage='$spackage'
14790 spitshell='$spitshell'
14791 split='$split'
14792 src='$src'
14793 ssizetype='$ssizetype'
14794 startperl='$startperl'
14795 startsh='$startsh'
14796 static_ext='$static_ext'
14797 stdchar='$stdchar'
14798 stdio_base='$stdio_base'
14799 stdio_bufsiz='$stdio_bufsiz'
14800 stdio_cnt='$stdio_cnt'
14801 stdio_filbuf='$stdio_filbuf'
14802 stdio_ptr='$stdio_ptr'
14803 stdio_stream_array='$stdio_stream_array'
14804 strings='$strings'
14805 submit='$submit'
14806 subversion='$subversion'
14807 sysman='$sysman'
14808 tail='$tail'
14809 tar='$tar'
14810 tbl='$tbl'
14811 tee='$tee'
14812 test='$test'
14813 timeincl='$timeincl'
14814 timetype='$timetype'
14815 touch='$touch'
14816 tr='$tr'
14817 trnl='$trnl'
14818 troff='$troff'
14819 u16size='$u16size'
14820 u16type='$u16type'
14821 u32size='$u32size'
14822 u32type='$u32type'
14823 u64size='$u64size'
14824 u64type='$u64type'
14825 u8size='$u8size'
14826 u8type='$u8type'
14827 uidformat='$uidformat'
14828 uidsign='$uidsign'
14829 uidsize='$uidsize'
14830 uidtype='$uidtype'
14831 uname='$uname'
14832 uniq='$uniq'
14833 uquadtype='$uquadtype'
14834 use64bits='$use64bits'
14835 usedl='$usedl'
14836 uselargefiles='$uselargefiles'
14837 uselongdouble='$uselongdouble'
14838 uselonglong='$uselonglong'
14839 usemorebits='$usemorebits'
14840 usemultiplicity='$usemultiplicity'
14841 usemymalloc='$usemymalloc'
14842 usenm='$usenm'
14843 useopcode='$useopcode'
14844 useperlio='$useperlio'
14845 useposix='$useposix'
14846 usesfio='$usesfio'
14847 useshrplib='$useshrplib'
14848 usesocks='$usesocks'
14849 usethreads='$usethreads'
14850 usevendorprefix='$usevendorprefix'
14851 usevfork='$usevfork'
14852 usrinc='$usrinc'
14853 uuname='$uuname'
14854 uvoformat='$uvoformat'
14855 uvsize='$uvsize'
14856 uvtype='$uvtype'
14857 uvuformat='$uvuformat'
14858 uvxformat='$uvxformat'
14859 vendorbin='$vendorbin'
14860 vendorbinexp='$vendorbinexp'
14861 vendorlib='$vendorlib'
14862 vendorlibexp='$vendorlibexp'
14863 vendorprefix='$vendorprefix'
14864 vendorprefixexp='$vendorprefixexp'
14865 version='$version'
14866 vi='$vi'
14867 voidflags='$voidflags'
14868 xlibpth='$xlibpth'
14869 xs_apiversion='$xs_apiversion'
14870 zcat='$zcat'
14871 zip='$zip'
14872 EOT
14873
14874 : Add in command line options if available
14875 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14876
14877 : add special variables
14878 $test -f $src/patchlevel.h && \
14879 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14880 echo "CONFIGDOTSH=true" >>config.sh
14881
14882 : propagate old symbols
14883 if $test -f UU/config.sh; then
14884         <UU/config.sh sort | uniq >UU/oldconfig.sh
14885         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14886         sort | uniq -u >UU/oldsyms
14887         set X `cat UU/oldsyms`
14888         shift
14889         case $# in
14890         0) ;;
14891         *)
14892                 cat <<EOM
14893 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14894 EOM
14895                 echo "# Variables propagated from previous config.sh file." >>config.sh
14896                 for sym in `cat UU/oldsyms`; do
14897                         echo "    Propagating $hint variable "'$'"$sym..."
14898                         eval 'tmp="$'"${sym}"'"'
14899                         echo "$tmp" | \
14900                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14901                 done
14902                 ;;
14903         esac
14904 fi
14905
14906 : Finish up by extracting the .SH files
14907 case "$alldone" in
14908 exit)
14909         $rm -rf UU
14910         echo "Done."
14911         exit 0
14912         ;;
14913 cont)
14914         ;;
14915 '')
14916         dflt=''
14917         nostick=true
14918         $cat <<EOM
14919
14920 If you'd like to make any changes to the config.sh file before I begin
14921 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14922
14923 EOM
14924         rp="Press return or use a shell escape to edit config.sh:"
14925         . UU/myread
14926         nostick=''
14927         case "$ans" in
14928         '') ;;
14929         *) : in case they cannot read
14930                 sh 1>&4 -c "$ans";;
14931         esac
14932         ;;
14933 esac
14934
14935 : if this fails, just run all the .SH files by hand
14936 . ./config.sh
14937
14938 echo " "
14939 exec 1>&4
14940 . ./UU/extract
14941
14942 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14943         dflt=y
14944         case "$silent" in
14945         true) ;;
14946         *)
14947                 $cat <<EOM
14948
14949 Now you need to generate make dependencies by running "$make depend".
14950 You might prefer to run it in background: "$make depend > makedepend.out &"
14951 It can take a while, so you might not want to run it right now.
14952
14953 EOM
14954                 ;;
14955         esac
14956         rp="Run $make depend now?"
14957         . UU/myread
14958         case "$ans" in
14959         y*)
14960                 $make depend && echo "Now you must run a $make."
14961                 ;;
14962         *)
14963                 echo "You must run '$make depend' then '$make'."
14964                 ;;
14965         esac
14966 elif test -f [Mm]akefile; then
14967         echo " "
14968         echo "Now you must run a $make."
14969 else
14970         echo "Done."
14971 fi
14972
14973 if $test -f Policy.sh; then
14974     $cat <<EOM
14975
14976 If you compile $package on a different machine or from a different object
14977 directory, copy the Policy.sh file from this object directory to the
14978 new one before you run Configure -- this will help you with most of
14979 the policy defaults.
14980
14981 EOM
14982 fi
14983 if $test -f config.msg; then
14984     echo "Hmm.  I also noted the following information while running:"
14985     echo " "
14986     $cat config.msg >&4
14987     $rm -f config.msg
14988 fi
14989 $rm -f kit*isdone ark*isdone
14990 $rm -rf UU
14991
14992 : End of Configure
14993