This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
more meaningful message on invalid pattern argument (from
[perl5.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 Jan 25 16:35:03 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_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_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 inc_version_list_init=''
675 installprefix=''
676 installprefixexp=''
677 installstyle=''
678 installusrbinperl=''
679 intsize=''
680 longsize=''
681 shortsize=''
682 d_fpos64_t=''
683 d_off64_t=''
684 libc=''
685 ldlibpthname=''
686 libperl=''
687 shrpenv=''
688 useshrplib=''
689 glibpth=''
690 libpth=''
691 loclibpth=''
692 plibpth=''
693 xlibpth=''
694 ignore_versioned_solibs=''
695 libs=''
696 lns=''
697 d_PRIEldbl=''
698 d_PRIFldbl=''
699 d_PRIGldbl=''
700 d_PRIeldbl=''
701 d_PRIfldbl=''
702 d_PRIgldbl=''
703 sPRIEldbl=''
704 sPRIFldbl=''
705 sPRIGldbl=''
706 sPRIeldbl=''
707 sPRIfldbl=''
708 sPRIgldbl=''
709 lseeksize=''
710 lseektype=''
711 make_set_make=''
712 d_mymalloc=''
713 freetype=''
714 mallocobj=''
715 mallocsrc=''
716 malloctype=''
717 usemymalloc=''
718 installman1dir=''
719 man1dir=''
720 man1direxp=''
721 man1ext=''
722 installman3dir=''
723 man3dir=''
724 man3direxp=''
725 man3ext=''
726 huge=''
727 large=''
728 medium=''
729 models=''
730 small=''
731 split=''
732 modetype=''
733 multiarch=''
734 mydomain=''
735 myhostname=''
736 phostname=''
737 c=''
738 n=''
739 d_eofnblk=''
740 eagain=''
741 o_nonblock=''
742 rd_nodata=''
743 netdb_hlen_type=''
744 netdb_host_type=''
745 netdb_name_type=''
746 netdb_net_type=''
747 groupcat=''
748 hostcat=''
749 passcat=''
750 orderlib=''
751 ranlib=''
752 package=''
753 spackage=''
754 pager=''
755 api_revision=''
756 api_subversion=''
757 api_version=''
758 api_versionstring=''
759 patchlevel=''
760 subversion=''
761 version=''
762 perladmin=''
763 perlpath=''
764 d_nvpresuv=''
765 i16size=''
766 i16type=''
767 i32size=''
768 i32type=''
769 i64size=''
770 i64type=''
771 i8size=''
772 i8type=''
773 ivsize=''
774 ivtype=''
775 nvsize=''
776 nvtype=''
777 u16size=''
778 u16type=''
779 u32size=''
780 u32type=''
781 u64size=''
782 u64type=''
783 u8size=''
784 u8type=''
785 uvsize=''
786 uvtype=''
787 ivdformat=''
788 uvoformat=''
789 uvuformat=''
790 uvxformat=''
791 pidtype=''
792 prefix=''
793 prefixexp=''
794 installprivlib=''
795 privlib=''
796 privlibexp=''
797 prototype=''
798 ptrsize=''
799 d_PRIX64=''
800 d_PRId64=''
801 d_PRIi64=''
802 d_PRIo64=''
803 d_PRIu64=''
804 d_PRIx64=''
805 sPRIX64=''
806 sPRId64=''
807 sPRIi64=''
808 sPRIo64=''
809 sPRIu64=''
810 sPRIx64=''
811 d_quad=''
812 quadkind=''
813 quadtype=''
814 uquadtype=''
815 drand01=''
816 randbits=''
817 randfunc=''
818 randseedtype=''
819 seedfunc=''
820 installscript=''
821 scriptdir=''
822 scriptdirexp=''
823 selectminbits=''
824 selecttype=''
825 sh=''
826 sig_count=''
827 sig_name=''
828 sig_name_init=''
829 sig_num=''
830 sig_num_init=''
831 installsitearch=''
832 sitearch=''
833 sitearchexp=''
834 installsitebin=''
835 sitebin=''
836 sitebinexp=''
837 installsitelib=''
838 sitelib=''
839 sitelibexp=''
840 siteprefix=''
841 siteprefixexp=''
842 sizetype=''
843 so=''
844 sharpbang=''
845 shsharp=''
846 spitshell=''
847 src=''
848 ssizetype=''
849 startperl=''
850 startsh=''
851 stdchar=''
852 d_stdio_stream_array=''
853 stdio_stream_array=''
854 sysman=''
855 trnl=''
856 uidformat=''
857 uidsign=''
858 uidsize=''
859 uidtype=''
860 archname64=''
861 use64bits=''
862 uselargefiles=''
863 uselongdouble=''
864 uselonglong=''
865 usemorebits=''
866 usemultiplicity=''
867 nm_opt=''
868 nm_so_opt=''
869 runnm=''
870 usenm=''
871 useperlio=''
872 usesocks=''
873 d_oldpthreads=''
874 use5005threads=''
875 useithreads=''
876 usethreads=''
877 incpath=''
878 mips_type=''
879 usrinc=''
880 d_vendorbin=''
881 installvendorbin=''
882 vendorbin=''
883 vendorbinexp=''
884 d_vendorlib=''
885 installvendorlib=''
886 vendorlib=''
887 vendorlibexp=''
888 usevendorprefix=''
889 vendorprefix=''
890 vendorprefixexp=''
891 defvoidused=''
892 voidflags=''
893 CONFIG=''
894
895 define='define'
896 undef='undef'
897 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
898 rmlist=''
899
900 : We must find out about Eunice early
901 eunicefix=':'
902 if test -f /etc/unixtovms; then
903         eunicefix=/etc/unixtovms
904 fi
905 if test -f /etc/unixtovms.exe; then
906         eunicefix=/etc/unixtovms.exe
907 fi
908
909 i_whoami=''
910 : list of known cpp symbols, sorted alphabetically
911 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
912 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
913 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
914 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
915 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
916 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
917 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
918 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
919 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
920 al="$al VMS Xenix286"
921 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
922 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
923 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
924 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
925 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
926 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
927 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
928 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
929 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
930 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
931 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
932 al="$al __SVR4_2__ __UMAXV__"
933 al="$al ____386BSD____ __alpha __alpha__ __amiga"
934 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
935 al="$al __host_mips__"
936 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
937 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
938 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
939 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
940 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
941 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
942 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
943 al="$al __mc88100 __mc88100__ __mips __mips__"
944 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
945 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
946 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
947 al="$al _host_mips _mips _unix"
948 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
949 al="$al apollo ardent att386 att3b"
950 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
951 al="$al cadmus clipper concurrent convex cray ctix"
952 al="$al dmert encore gcos gcx gimpel gould"
953 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
954 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
955 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
956 al="$al i186 i286 i386 i486 i8086"
957 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
958 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
959 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
960 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
961 al="$al mc88000 mc88100 merlin mert mips mvs n16"
962 al="$al ncl_el ncl_mr"
963 al="$al news1500 news1700 news1800 news1900 news3700"
964 al="$al news700 news800 news900 ns16000 ns32000"
965 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
966 al="$al parisc pc532 pdp11 plexus posix pyr"
967 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
968 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
969 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
970 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
971 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
972 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
973 al="$al xenix z8000"
974
975 : set useposix=false in your hint file to disable the POSIX extension.
976 useposix=true
977 : set useopcode=false in your hint file to disable the Opcode extension.
978 useopcode=true
979 : Trailing extension.  Override this in a hint file, if needed.
980 _exe=''
981 : Extra object files, if any, needed on this platform.
982 archobjs=''
983 : Possible local include directories to search.
984 : Set locincpth to "" in a hint file to defeat local include searches.
985 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
986 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
987 :
988 : no include file wanted by default
989 inclwanted=''
990
991 groupstype=''
992 : change the next line if compiling for Xenix/286 on Xenix/386
993 xlibpth='/usr/lib/386 /lib/386'
994
995 : Possible local library directories to search.
996 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
997 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
998
999 : general looking path for locating libraries
1000 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
1001 glibpth="$glibpth /lib /usr/lib $xlibpth"
1002 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1003 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1004
1005 : Private path used by Configure to find libraries.  Its value
1006 : is prepended to libpth. This variable takes care of special
1007 : machines, like the mips.  Usually, it should be empty.
1008 plibpth=''
1009
1010 : default library list
1011 libswanted=''
1012 : some systems want to use only the non-versioned libso:s
1013 ignore_versioned_solibs=''
1014 : set usemultiplicity on the Configure command line to enable multiplicity.
1015 : set usesocks on the Configure command line to enable socks.
1016 : set usethreads on the Configure command line to enable threads.
1017 : full support for void wanted by default
1018 defvoidused=15
1019
1020 : List of libraries we want.
1021 : If anyone needs -lnet, put it in a hint file.
1022 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1023 libswanted="$libswanted dld ld sun m c cposix posix"
1024 libswanted="$libswanted ndir dir crypt sec"
1025 libswanted="$libswanted ucb bsd BSD PW x"
1026 : We probably want to search /usr/shlib before most other libraries.
1027 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1028 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1029 glibpth="/usr/shlib $glibpth"
1030 : Do not use vfork unless overridden by a hint file.
1031 usevfork=false
1032
1033 : Find the basic shell for Bourne shell scripts
1034 case "$sh" in
1035 '')
1036         case "$SYSTYPE" in
1037         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1038         *) xxx='/bin/sh';;
1039         esac
1040         if test -f "$xxx"; then
1041                 sh="$xxx"
1042         else
1043                 : Build up a list and do a single loop so we can 'break' out.
1044                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1045                 for xxx in sh bash ksh pdksh ash; do
1046                         for p in $pth; do
1047                                 try="$try ${p}/${xxx}"
1048                         done
1049                 done
1050                 for xxx in $try; do
1051                         if test -f "$xxx"; then
1052                                 sh="$xxx";
1053                                 break
1054                         elif test -f "$xxx.exe"; then
1055                                 sh="$xxx";
1056                                 break
1057                         fi
1058                 done
1059         fi
1060         ;;
1061 esac
1062
1063 case "$sh" in
1064 '')     cat <<EOM >&2
1065 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1066
1067 Usually it's in /bin/sh.  How did you even get this far?
1068 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1069 we'll try to straighten this all out.
1070 EOM
1071         exit 1
1072         ;;
1073 esac
1074
1075 : see if sh knows # comments
1076 if `$sh -c '#' >/dev/null 2>&1`; then
1077         shsharp=true
1078         spitshell=cat
1079         xcat=/bin/cat
1080         test -f $xcat || xcat=/usr/bin/cat
1081         echo "#!$xcat" >try
1082         $eunicefix try
1083         chmod +x try
1084         ./try > today
1085         if test -s today; then
1086                 sharpbang='#!'
1087         else
1088                 echo "#! $xcat" > try
1089                 $eunicefix try
1090                 chmod +x try
1091                 ./try > today
1092                 if test -s today; then
1093                         sharpbang='#! '
1094                 else
1095                         sharpbang=': use '
1096                 fi
1097         fi
1098 else
1099         echo " "
1100         echo "Your $sh doesn't grok # comments--I will strip them later on."
1101         shsharp=false
1102         cd ..
1103         echo "exec grep -v '^[  ]*#'" >spitshell
1104         chmod +x spitshell
1105         $eunicefix spitshell
1106         spitshell=`pwd`/spitshell
1107         cd UU
1108         echo "I presume that if # doesn't work, #! won't work either!"
1109         sharpbang=': use '
1110 fi
1111 rm -f try today
1112
1113 : figure out how to guarantee sh startup
1114 case "$startsh" in
1115 '') startsh=${sharpbang}${sh} ;;
1116 *)
1117 esac
1118 cat >try <<EOSS
1119 $startsh
1120 set abc
1121 test "$?abc" != 1
1122 EOSS
1123
1124 chmod +x try
1125 $eunicefix try
1126 if ./try; then
1127         : echo "Yup, it does."
1128 else
1129         echo "Hmm... '$startsh' does not guarantee sh startup..."
1130         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1131 fi
1132 rm -f try
1133
1134
1135 : Save command line options in file UU/cmdline.opt for later use in
1136 : generating config.sh.
1137 cat > cmdline.opt <<EOSH
1138 # Configure command line arguments.
1139 config_arg0='$0'
1140 config_args='$*'
1141 config_argc=$#
1142 EOSH
1143 argn=1
1144 for arg in "$@"; do
1145         cat >>cmdline.opt <<EOSH
1146 config_arg$argn='$arg'
1147 EOSH
1148         argn=`expr $argn + 1`
1149 done
1150
1151 : produce awk script to parse command line options
1152 cat >options.awk <<'EOF'
1153 BEGIN {
1154         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1155
1156         len = length(optstr);
1157         for (i = 1; i <= len; i++) {
1158                 c = substr(optstr, i, 1);
1159                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1160                 if (a == ":") {
1161                         arg[c] = 1;
1162                         i++;
1163                 }
1164                 opt[c] = 1;
1165         }
1166 }
1167 {
1168         expect = 0;
1169         str = $0;
1170         if (substr(str, 1, 1) != "-") {
1171                 printf("'%s'\n", str);
1172                 next;
1173         }
1174         len = length($0);
1175         for (i = 2; i <= len; i++) {
1176                 c = substr(str, i, 1);
1177                 if (!opt[c]) {
1178                         printf("-%s\n", substr(str, i));
1179                         next;
1180                 }
1181                 printf("-%s\n", c);
1182                 if (arg[c]) {
1183                         if (i < len)
1184                                 printf("'%s'\n", substr(str, i + 1));
1185                         else
1186                                 expect = 1;
1187                         next;
1188                 }
1189         }
1190 }
1191 END {
1192         if (expect)
1193                 print "?";
1194 }
1195 EOF
1196
1197 : process the command line options
1198 set X `for arg in "$@"; do echo "X$arg"; done |
1199         sed -e s/X// | awk -f options.awk`
1200 eval "set $*"
1201 shift
1202 rm -f options.awk
1203
1204 : set up default values
1205 fastread=''
1206 reuseval=false
1207 config_sh=''
1208 alldone=''
1209 error=''
1210 silent=''
1211 extractsh=''
1212 override=''
1213 knowitall=''
1214 rm -f optdef.sh posthint.sh
1215 cat >optdef.sh <<EOS
1216 $startsh
1217 EOS
1218
1219
1220 : option parsing
1221 while test $# -gt 0; do
1222         case "$1" in
1223         -d) shift; fastread=yes;;
1224         -e) shift; alldone=cont;;
1225         -f)
1226                 shift
1227                 cd ..
1228                 if test -r "$1"; then
1229                         config_sh="$1"
1230                 else
1231                         echo "$me: cannot read config file $1." >&2
1232                         error=true
1233                 fi
1234                 cd UU
1235                 shift;;
1236         -h) shift; error=true;;
1237         -r) shift; reuseval=true;;
1238         -s) shift; silent=true; realsilent=true;;
1239         -E) shift; alldone=exit;;
1240         -K) shift; knowitall=true;;
1241         -O) shift; override=true;;
1242         -S) shift; silent=true; extractsh=true;;
1243         -D)
1244                 shift
1245                 case "$1" in
1246                 *=)
1247                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1248                         echo "$me: ignoring -D $1" >&2
1249                         ;;
1250                 *=*) echo "$1" | \
1251                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1252                 *) echo "$1='define'" >> optdef.sh;;
1253                 esac
1254                 shift
1255                 ;;
1256         -U)
1257                 shift
1258                 case "$1" in
1259                 *=) echo "$1" >> optdef.sh;;
1260                 *=*)
1261                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1262                         echo "$me: ignoring -U $1" >&2
1263                         ;;
1264                 *) echo "$1='undef'" >> optdef.sh;;
1265                 esac
1266                 shift
1267                 ;;
1268         -A)
1269             shift
1270             xxx=''
1271             yyy="$1"
1272             zzz=''
1273             uuu=undef
1274             case "$yyy" in
1275             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1276                  case "$zzz" in
1277                  *:*) zzz='' ;;
1278                  *)   xxx=append
1279                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1280                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281                  esac
1282                  ;;
1283             esac
1284             case "$xxx" in
1285             '')  case "$yyy" in
1286                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1287                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1288                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1289                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1290                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1291                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1292                  esac
1293                  ;;       
1294             esac
1295             case "$xxx" in
1296             append)
1297                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1298             clear)
1299                 echo "$yyy=''"                  >> posthint.sh ;;
1300             define)
1301                 case "$zzz" in
1302                 '') zzz=define ;;
1303                 esac
1304                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1305             eval)
1306                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1307             prepend)
1308                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1309             undef)
1310                 case "$zzz" in
1311                 '') zzz="$uuu" ;;
1312                 esac
1313                 echo "$yyy=$zzz"                >> posthint.sh ;;
1314             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1315             esac
1316             ;;
1317         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1318             exit 0;;
1319         --) break;;
1320         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1321         *) break;;
1322         esac
1323 done
1324
1325 case "$error" in
1326 true)
1327         cat >&2 <<EOM
1328 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1329                  [-U symbol] [-U symbol=] [-A command:symbol...]
1330   -d : use defaults for all answers.
1331   -e : go on without questioning past the production of config.sh.
1332   -f : specify an alternate default configuration file.
1333   -h : print this help message and exit (with an error status).
1334   -r : reuse C symbols value if possible (skips costly nm extraction).
1335   -s : silent mode, only echoes questions and essential information.
1336   -D : define symbol to have some value:
1337          -D symbol         symbol gets the value 'define'
1338          -D symbol=value   symbol gets the value 'value'
1339   -E : stop at the end of questions, after having produced config.sh.
1340   -K : do not use unless you know what you are doing.
1341   -O : let -D and -U override definitions from loaded configuration file.
1342   -S : perform variable substitutions on all .SH files (can mix with -f)
1343   -U : undefine symbol:
1344          -U symbol    symbol gets the value 'undef'
1345          -U symbol=   symbol gets completely empty
1346   -A : manipulate symbol after the platform specific hints have been applied:
1347          -A symbol=value                append " "value to symbol
1348          -A append:symbol=value         append value to symbol
1349          -A define:symbol=value         define symbol to have value
1350          -A clear:symbol                define symbol to be ''
1351          -A define:symbol               define symbol to be 'define'
1352          -A eval:symbol=value           define symbol to be eval of value
1353          -A prepend:symbol=value        prepend value to symbol
1354          -A undef:symbol                define symbol to be 'undef'
1355          -A undef:symbol=               define symbol to be ''
1356   -V : print version number and exit (with a zero status).
1357 EOM
1358         exit 1
1359         ;;
1360 esac
1361
1362 : Sanity checks
1363 case "$fastread$alldone" in
1364 yescont|yesexit) ;;
1365 *)
1366         if test ! -t 0; then
1367                 echo "Say 'sh Configure', not 'sh <Configure'"
1368                 exit 1
1369         fi
1370         ;;
1371 esac
1372
1373 exec 4>&1
1374 case "$silent" in
1375 true) exec 1>/dev/null;;
1376 esac
1377
1378 : run the defines and the undefines, if any, but leave the file out there...
1379 touch optdef.sh
1380 . ./optdef.sh
1381 : create the posthint manipulation script and leave the file out there...
1382 touch posthint.sh
1383
1384 : set package name
1385 package=perl5
1386 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1387 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1388 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1389 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1390 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1391 esac
1392
1393 : Some greps do not return status, grrr.
1394 echo "grimblepritz" >grimble
1395 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1396         contains=contains
1397 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1398         contains=grep
1399 else
1400         contains=contains
1401 fi
1402 rm -f grimble
1403 : the following should work in any shell
1404 case "$contains" in
1405 contains*)
1406         echo " "
1407         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1408         cat >contains <<'EOSS'
1409 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1410 EOSS
1411 chmod +x contains
1412 esac
1413
1414 : Find the path to the source tree
1415 case "$src" in
1416 '') case "$0" in
1417     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1418          case "$src" in
1419          /*)    ;;
1420          *)     src=`cd ../$src && pwd` ;;
1421          esac
1422          ;;
1423     *)   src='.';;
1424     esac;;
1425 esac
1426 case "$src" in
1427 '')     src=/
1428         rsrc=/
1429         ;;
1430 /*) rsrc="$src";;
1431 *) rsrc="../$src";;
1432 esac
1433 if test -f $rsrc/Configure && \
1434         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1435 then
1436    : found it, so we are ok.
1437 else
1438         rsrc=''
1439         for src in . .. ../.. ../../.. ../../../..; do
1440                 if test -f ../$src/Configure && \
1441                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1442                 then
1443                         rsrc=../$src
1444                         break
1445                 fi
1446         done
1447 fi
1448 case "$rsrc" in
1449 '')
1450         cat <<EOM >&4
1451
1452 Sorry, I can't seem to locate the source dir for $package.  Please start
1453 Configure with an explicit path -- i.e. /some/path/Configure.
1454
1455 EOM
1456         exit 1
1457         ;;
1458 ../.)   rsrc='..';;
1459 *)
1460         echo " "
1461         echo "Sources for $package found in \"$src\"." >&4
1462         ;;
1463 esac
1464
1465 : script used to extract .SH files with variable substitutions
1466 cat >extract <<'EOS'
1467 CONFIGDOTSH=true
1468 echo "Doing variable substitutions on .SH files..."
1469 if test -f $src/MANIFEST; then
1470         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1471 else
1472         echo "(Looking for .SH files under the source directory.)"
1473         set x `(cd $src; find . -name "*.SH" -print)`
1474 fi
1475 shift
1476 case $# in
1477 0) set x `(cd $src; echo *.SH)`; shift;;
1478 esac
1479 if test ! -f $src/$1; then
1480         shift
1481 fi
1482 mkdir_p='
1483 name=$1;
1484 create="";
1485 while test $name; do
1486         if test ! -d "$name"; then
1487                 create="$name $create";
1488                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1489                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1490         else
1491                 name="";
1492         fi;
1493 done;
1494 for file in $create; do
1495         mkdir $file;
1496 done
1497 '
1498 for file in $*; do
1499         case "$src" in
1500         ".")
1501                 case "$file" in
1502                 */*)
1503                         dir=`expr X$file : 'X\(.*\)/'`
1504                         file=`expr X$file : 'X.*/\(.*\)'`
1505                         (cd $dir && . ./$file)
1506                         ;;
1507                 *)
1508                         . ./$file
1509                         ;;
1510                 esac
1511                 ;;
1512         *)
1513                 case "$file" in
1514                 */*)
1515                         dir=`expr X$file : 'X\(.*\)/'`
1516                         file=`expr X$file : 'X.*/\(.*\)'`
1517                         (set x $dir; shift; eval $mkdir_p)
1518                         sh <$src/$dir/$file
1519                         ;;
1520                 *)
1521                         sh <$src/$file
1522                         ;;
1523                 esac
1524                 ;;
1525         esac
1526 done
1527 if test -f $src/config_h.SH; then
1528         if test ! -f config.h; then
1529         : oops, they left it out of MANIFEST, probably, so do it anyway.
1530         . $src/config_h.SH
1531         fi
1532 fi
1533 EOS
1534
1535 : extract files and exit if asked to do so
1536 case "$extractsh" in
1537 true)
1538         case "$realsilent" in
1539         true) ;;
1540         *) exec 1>&4;;
1541         esac
1542         case "$config_sh" in
1543         '') config_sh='config.sh';;
1544         esac
1545         echo " "
1546         echo "Fetching answers from $config_sh..."
1547         cd ..
1548         . $config_sh
1549         test "$override" && . ./optdef.sh
1550         echo " "
1551         . UU/extract
1552         rm -rf UU
1553         echo "Done."
1554         exit 0
1555         ;;
1556 esac
1557
1558 : Eunice requires " " instead of "", can you believe it
1559 echo " "
1560 : Here we go...
1561 echo "Beginning of configuration questions for $package."
1562
1563 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1564
1565 : first determine how to suppress newline on echo command
1566 echo " "
1567 echo "Checking echo to see how to suppress newlines..."
1568 (echo "hi there\c" ; echo " ") >.echotmp
1569 if $contains c .echotmp >/dev/null 2>&1 ; then
1570         echo "...using -n."
1571         n='-n'
1572         c=''
1573 else
1574         cat <<'EOM'
1575 ...using \c
1576 EOM
1577         n=''
1578         c='\c'
1579 fi
1580 echo $n "The star should be here-->$c"
1581 echo '*'
1582 rm -f .echotmp
1583
1584 : Now test for existence of everything in MANIFEST
1585 echo " "
1586 if test -f $rsrc/MANIFEST; then
1587         echo "First let's make sure your kit is complete.  Checking..." >&4
1588         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1589         rm -f missing
1590         tmppwd=`pwd`
1591         for filelist in x??; do
1592                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1593         done
1594         if test -s missing; then
1595                 cat missing >&4
1596                 cat >&4 <<'EOM'
1597
1598 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1599
1600 You have the option of continuing the configuration process, despite the
1601 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1602 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1603 and contact the author (perlbug@perl.com).
1604
1605 EOM
1606                 echo $n "Continue? [n] $c" >&4
1607                 read ans
1608                 case "$ans" in
1609                 y*)
1610                         echo "Continuing..." >&4
1611                         rm -f missing
1612                         ;;
1613                 *)
1614                         echo "ABORTING..." >&4
1615                         kill $$
1616                         ;;
1617                 esac
1618         else
1619                 echo "Looks good..."
1620         fi
1621 else
1622         echo "There is no MANIFEST file.  I hope your kit is complete !"
1623 fi
1624 rm -f missing x??
1625
1626 echo " "
1627 : Find the appropriate value for a newline for tr
1628 if test -n "$DJGPP"; then
1629        trnl='\012'
1630 fi
1631 if test X"$trnl" = X; then
1632         case "`echo foo|tr '\n' x 2>/dev/null`" in
1633         foox) trnl='\n' ;;
1634         esac
1635 fi
1636 if test X"$trnl" = X; then
1637         case "`echo foo|tr '\012' x 2>/dev/null`" in
1638         foox) trnl='\012' ;;
1639         esac
1640 fi
1641 if test X"$trnl" = X; then
1642         cat <<EOM >&2
1643
1644 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1645
1646 EOM
1647         exit 1
1648 fi
1649
1650 : compute the number of columns on the terminal for proper question formatting
1651 case "$COLUMNS" in
1652 '') COLUMNS='80';;
1653 esac
1654
1655 : set up the echo used in my read
1656 myecho="case \"\$xxxm\" in
1657 '') echo $n \"\$rp $c\" >&4;;
1658 *) case \"\$rp\" in
1659         '') echo $n \"[\$xxxm] $c\";;
1660         *)
1661                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1662                         echo \"\$rp\" >&4
1663                         echo $n \"[\$xxxm] $c\" >&4
1664                 else
1665                         echo $n \"\$rp [\$xxxm] $c\" >&4
1666                 fi
1667                 ;;
1668         esac;;
1669 esac"
1670
1671 : now set up to do reads with possible shell escape and default assignment
1672 cat <<EOSC >myread
1673 $startsh
1674 xxxm=\$dflt
1675 $myecho
1676 ans='!'
1677 case "\$fastread" in
1678 yes) case "\$dflt" in
1679         '') ;;
1680         *) ans='';
1681                 case "\$silent-\$rp" in
1682                 true-) ;;
1683                 *) echo " " >&4;;
1684                 esac;;
1685         esac;;
1686 *) case "\$silent" in
1687         true) case "\$rp" in
1688                 '') ans='';;
1689                 esac;;
1690         esac;;
1691 esac
1692 while expr "X\$ans" : "X!" >/dev/null; do
1693         read answ
1694         set x \$xxxm
1695         shift
1696         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1697         case  "\$answ" in
1698         "!")
1699                 sh 1>&4
1700                 echo " "
1701                 $myecho
1702                 ;;
1703         !*)
1704                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1705                 shift
1706                 sh 1>&4 -c "\$*"
1707                 echo " "
1708                 $myecho
1709                 ;;
1710         "\$ans")
1711                 case "\$ans" in
1712                 \\&*)
1713                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1714                         shift
1715                         case "\$1" in
1716                         -d)
1717                                 fastread=yes
1718                                 echo "(OK, I'll run with -d after this question.)" >&4
1719                                 ;;
1720                         -*)
1721                                 echo "*** Sorry, \$1 not supported yet." >&4
1722                                 ;;
1723                         esac
1724                         $myecho
1725                         ans=!
1726                         ;;
1727                 esac;;
1728         *)
1729                 case "\$aok" in
1730                 y)
1731                         echo "*** Substitution done -- please confirm."
1732                         xxxm="\$ans"
1733                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1734                         xxxm="\$ans"
1735                         ans=!
1736                         ;;
1737                 *)
1738                         echo "*** Error -- try again."
1739                         ans=!
1740                         ;;
1741                 esac
1742                 $myecho
1743                 ;;
1744         esac
1745         case "\$ans\$xxxm\$nostick" in
1746         '')
1747                 ans=!
1748                 $myecho
1749                 ;;
1750         esac
1751 done
1752 case "\$ans" in
1753 '') ans="\$xxxm";;
1754 esac
1755 EOSC
1756
1757 : create .config dir to save info across Configure sessions
1758 test -d ../.config || mkdir ../.config
1759 cat >../.config/README <<EOF
1760 This directory created by Configure to save information that should
1761 persist across sessions for $package.
1762
1763 You may safely delete it if you wish.
1764 EOF
1765
1766 : general instructions
1767 needman=true
1768 firsttime=true
1769 user=`(logname) 2>/dev/null`
1770 case "$user" in
1771 '') user=`whoami 2>&1`;;
1772 esac
1773 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1774         firsttime=false
1775         echo " "
1776         rp='Would you like to see the instructions?'
1777         dflt=n
1778         . ./myread
1779         case "$ans" in
1780         [yY]*) ;;
1781         *) needman=false;;
1782         esac
1783 fi
1784 if $needman; then
1785         cat <<EOH
1786
1787 This installation shell script will examine your system and ask you questions
1788 to determine how the perl5 package should be installed. If you get
1789 stuck on a question, you may use a ! shell escape to start a subshell or
1790 execute a command.  Many of the questions will have default answers in square
1791 brackets; typing carriage return will give you the default.
1792
1793 On some of the questions which ask for file or directory names you are allowed
1794 to use the ~name construct to specify the login directory belonging to "name",
1795 even if you don't have a shell which knows about that.  Questions where this is
1796 allowed will be marked "(~name ok)".
1797
1798 EOH
1799         rp=''
1800         dflt='Type carriage return to continue'
1801         . ./myread
1802         cat <<'EOH'
1803
1804 The prompter used in this script allows you to use shell variables and
1805 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1806 in the default answer, as if the default line was a set of arguments given to a
1807 script shell.  This means you may also use $* to repeat the whole default line,
1808 so you do not have to re-type everything to add something to the default.
1809
1810 Everytime there is a substitution, you will have to confirm.  If there is an
1811 error (e.g. an unmatched backtick), the default answer will remain unchanged
1812 and you will be prompted again.
1813
1814 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1815 the questions and use the computed defaults (or the previous answers if there
1816 was already a config.sh file). Type 'Configure -h' for a list of options.
1817 You may also start interactively and then answer '& -d' at any prompt to turn
1818 on the non-interactive behaviour for the remainder of the execution.
1819
1820 EOH
1821         . ./myread
1822         cat <<EOH
1823
1824 Much effort has been expended to ensure that this shell script will run on any
1825 Unix system.  If despite that it blows up on yours, your best bet is to edit
1826 Configure and run it again.  If you can't run Configure for some reason,
1827 you'll have to generate a config.sh file by hand.  Whatever problems you
1828 have, let me (perlbug@perl.com) know how I blew it.
1829
1830 This installation script affects things in two ways:
1831
1832 1) it may do direct variable substitutions on some of the files included
1833    in this kit.
1834 2) it builds a config.h file for inclusion in C programs.  You may edit
1835    any of these files as the need arises after running this script.
1836
1837 If you make a mistake on a question, there is no easy way to back up to it
1838 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1839 files.  Configure will offer to let you do this before it runs the SH files.
1840
1841 EOH
1842         dflt='Type carriage return to continue'
1843         . ./myread
1844         case "$firsttime" in
1845         true) echo $user >>../.config/instruct;;
1846         esac
1847 fi
1848
1849 : find out where common programs are
1850 echo " "
1851 echo "Locating common programs..." >&4
1852 cat <<EOSC >loc
1853 $startsh
1854 case \$# in
1855 0) exit 1;;
1856 esac
1857 thing=\$1
1858 shift
1859 dflt=\$1
1860 shift
1861 for dir in \$*; do
1862         case "\$thing" in
1863         .)
1864         if test -d \$dir/\$thing; then
1865                 echo \$dir
1866                 exit 0
1867         fi
1868         ;;
1869         *)
1870         for thisthing in \$dir/\$thing; do
1871                 : just loop through to pick last item
1872         done
1873         if test -f \$thisthing; then
1874                 echo \$thisthing
1875                 exit 0
1876         elif test -f \$dir/\$thing.exe; then
1877                 if test -n "$DJGPP"; then
1878                         echo \$dir/\$thing.exe
1879                 else
1880                         : on Eunice apparently
1881                         echo \$dir/\$thing
1882                 fi
1883                 exit 0
1884         fi
1885         ;;
1886         esac
1887 done
1888 echo \$dflt
1889 exit 1
1890 EOSC
1891 chmod +x loc
1892 $eunicefix loc
1893 loclist="
1894 awk
1895 cat
1896 comm
1897 cp
1898 echo
1899 expr
1900 grep
1901 ls
1902 make
1903 mkdir
1904 rm
1905 sed
1906 sort
1907 touch
1908 tr
1909 uniq
1910 "
1911 trylist="
1912 Mcc
1913 ar
1914 byacc
1915 cpp
1916 csh
1917 date
1918 egrep
1919 gzip
1920 less
1921 ln
1922 more
1923 nm
1924 nroff
1925 perl
1926 pg
1927 test
1928 uname
1929 zip
1930 "
1931 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1932 pth="$pth /lib /usr/lib"
1933 for file in $loclist; do
1934         eval xxx=\$$file
1935         case "$xxx" in
1936         /*|?:[\\/]*)
1937                 if test -f "$xxx"; then
1938                         : ok
1939                 else
1940                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1941                         xxx=`./loc $file $file $pth`
1942                 fi
1943                 ;;
1944         '') xxx=`./loc $file $file $pth`;;
1945         *) xxx=`./loc $xxx $xxx $pth`;;
1946         esac
1947         eval $file=$xxx
1948         eval _$file=$xxx
1949         case "$xxx" in
1950         /*)
1951                 echo $file is in $xxx.
1952                 ;;
1953         ?:[\\/]*)
1954                 echo $file is in $xxx.
1955                 ;;
1956         *)
1957                 echo "I don't know where '$file' is, and my life depends on it." >&4
1958                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1959                 exit 1
1960                 ;;
1961         esac
1962 done
1963 echo " "
1964 echo "Don't worry if any of the following aren't found..."
1965 say=offhand
1966 for file in $trylist; do
1967         eval xxx=\$$file
1968         case "$xxx" in
1969         /*|?:[\\/]*)
1970                 if test -f "$xxx"; then
1971                         : ok
1972                 else
1973                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1974                         xxx=`./loc $file $file $pth`
1975                 fi
1976                 ;;
1977         '') xxx=`./loc $file $file $pth`;;
1978         *) xxx=`./loc $xxx $xxx $pth`;;
1979         esac
1980         eval $file=$xxx
1981         eval _$file=$xxx
1982         case "$xxx" in
1983         /*)
1984                 echo $file is in $xxx.
1985                 ;;
1986         ?:[\\/]*)
1987                 echo $file is in $xxx.
1988                 ;;
1989         *)
1990                 echo "I don't see $file out there, $say."
1991                 say=either
1992                 ;;
1993         esac
1994 done
1995 case "$egrep" in
1996 egrep)
1997         echo "Substituting grep for egrep."
1998         egrep=$grep
1999         ;;
2000 esac
2001 case "$ln" in
2002 ln)
2003         echo "Substituting cp for ln."
2004         ln=$cp
2005         ;;
2006 esac
2007 case "$test" in
2008 test)
2009         echo "Hopefully test is built into your sh."
2010         ;;
2011 *)
2012         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2013                 echo "Using the test built into your sh."
2014                 test=test
2015                 _test=test
2016         fi
2017         ;;
2018 esac
2019 case "$echo" in
2020 echo)
2021         echo "Hopefully echo is built into your sh."
2022         ;;
2023 '') ;;
2024 *)
2025         echo " "
2026 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2027         $echo $n "hi there$c" >foo1
2028         echo $n "hi there$c" >foo2
2029         if cmp foo1 foo2 >/dev/null 2>&1; then
2030                 echo "They are compatible.  In fact, they may be identical."
2031         else
2032                 case "$n" in
2033                 '-n') n='' c='\c';;
2034                 *) n='-n' c='';;
2035                 esac
2036                 cat <<FOO
2037 They are not compatible!  You are probably running ksh on a non-USG system.
2038 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2039 have echo built in and we may have to run some Bourne shell scripts.  That
2040 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2041
2042 FOO
2043                 $echo $n "The star should be here-->$c"
2044                 $echo "*"
2045         fi
2046         $rm -f foo1 foo2
2047         ;;
2048 esac
2049
2050 : determine whether symbolic links are supported
2051 echo " "
2052 $touch blurfl
2053 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2054         echo "Symbolic links are supported." >&4
2055         lns="$ln -s"
2056 else
2057         echo "Symbolic links are NOT supported." >&4
2058         lns="$ln"
2059 fi
2060 $rm -f blurfl sym
2061
2062 : see whether [:lower:] and [:upper:] are supported character classes
2063 echo " "
2064 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2065 ABYZ)
2066         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2067         up='[:upper:]'
2068         low='[:lower:]'
2069         ;;
2070 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2071         # (0xc9 and 0xd1), therefore that is a nice testing point.
2072         if test "X$up" = X -o "X$low" = X; then
2073             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2074             ij) up='[A-Z]'
2075                 low='[a-z]'
2076                 ;;
2077             esac
2078         fi
2079         if test "X$up" = X -o "X$low" = X; then
2080             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2081             ij) up='A-Z'
2082                 low='a-z'
2083                 ;;
2084             esac
2085         fi
2086         if test "X$up" = X -o "X$low" = X; then
2087             case "`echo IJ | od -x 2>/dev/null`" in
2088             *C9D1*|*c9d1*)
2089                 echo "Hey, this might be EBCDIC." >&4
2090                 if test "X$up" = X -o "X$low" = X; then
2091                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2092                     ij) up='[A-IJ-RS-Z]'
2093                         low='[a-ij-rs-z]'
2094                         ;;
2095                     esac
2096                 fi
2097                 if test "X$up" = X -o "X$low" = X; then
2098                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2099                     ij) up='A-IJ-RS-Z'
2100                         low='a-ij-rs-z'
2101                         ;;
2102                     esac
2103                 fi
2104                 ;;
2105             esac
2106         fi
2107 esac
2108 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2109 ij)
2110     echo "Using $up and $low to convert case." >&4
2111     ;;
2112 *)
2113     echo "I don't know how to translate letters from upper to lower case." >&4
2114     echo "Your tr is not acting any way I know of." >&4
2115     exit 1
2116     ;;
2117 esac
2118 : set up the translation script tr, must be called with ./tr of course
2119 cat >tr <<EOSC
2120 $startsh
2121 case "\$1\$2" in
2122 '[A-Z][a-z]') exec $tr '$up' '$low';;
2123 '[a-z][A-Z]') exec $tr '$low' '$up';;
2124 esac
2125 exec $tr "\$@"
2126 EOSC
2127 chmod +x tr
2128 $eunicefix tr
2129
2130 : Try to determine whether config.sh was made on this system
2131 case "$config_sh" in
2132 '')
2133 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2134 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2135 # because the A-Z/a-z are not consecutive.
2136 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2137         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2138 newmyuname="$myuname"
2139 dflt=n
2140 case "$knowitall" in
2141 '')
2142         if test -f ../config.sh; then
2143                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2144                         eval "`grep myuname= ../config.sh`"
2145                 fi
2146                 if test "X$myuname" = "X$newmyuname"; then
2147                         dflt=y
2148                 fi
2149         fi
2150         ;;
2151 *) dflt=y;;
2152 esac
2153
2154 : Get old answers from old config file if Configure was run on the
2155 : same system, otherwise use the hints.
2156 hint=default
2157 cd ..
2158 if test -f config.sh; then
2159         echo " "
2160         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2161         . UU/myread
2162         case "$ans" in
2163         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2164         *)  echo "Fetching default answers from your old config.sh file..." >&4
2165                 tmp_n="$n"
2166                 tmp_c="$c"
2167                 tmp_sh="$sh"
2168                 . ./config.sh
2169                 cp config.sh UU
2170                 n="$tmp_n"
2171                 c="$tmp_c"
2172                 : Older versions did not always set $sh.  Catch re-use of such
2173                 : an old config.sh.
2174                 case "$sh" in
2175                 '') sh="$tmp_sh" ;;
2176                 esac
2177                 hint=previous
2178                 ;;
2179         esac
2180 fi
2181 if test ! -f config.sh; then
2182         $cat <<EOM
2183
2184 First time through, eh?  I have some defaults handy for some systems
2185 that need some extra help getting the Configure answers right:
2186
2187 EOM
2188         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2189         dflt=''
2190         : Half the following guesses are probably wrong... If you have better
2191         : tests or hints, please send them to perlbug@perl.com
2192         : The metaconfig authors would also appreciate a copy...
2193         $test -f /irix && osname=irix
2194         $test -f /xenix && osname=sco_xenix
2195         $test -f /dynix && osname=dynix
2196         $test -f /dnix && osname=dnix
2197         $test -f /lynx.os && osname=lynxos
2198         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2199         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2200         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2201         $test -f /bin/mips && /bin/mips && osname=mips
2202         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2203                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2204         $test -d /usr/apollo/bin && osname=apollo
2205         $test -f /etc/saf/_sactab && osname=svr4
2206         $test -d /usr/include/minix && osname=minix
2207         if $test -d /MachTen -o -d /MachTen_Folder; then
2208                 osname=machten
2209                 if $test -x /sbin/version; then
2210                         osvers=`/sbin/version | $awk '{print $2}' |
2211                         $sed -e 's/[A-Za-z]$//'`
2212                 elif $test -x /usr/etc/version; then
2213                         osvers=`/usr/etc/version | $awk '{print $2}' |
2214                         $sed -e 's/[A-Za-z]$//'`
2215                 else
2216                         osvers="$2.$3"
2217                 fi
2218         fi
2219
2220         $test -f /sys/posix.dll &&
2221                 $test -f /usr/bin/what &&
2222                 set X `/usr/bin/what /sys/posix.dll` &&
2223                 $test "$3" = UWIN &&
2224                 osname=uwin &&
2225                 osvers="$5"
2226
2227         if $test -f $uname; then
2228                 set X $myuname
2229                 shift
2230
2231                 case "$5" in
2232                 fps*) osname=fps ;;
2233                 mips*)
2234                         case "$4" in
2235                         umips) osname=umips ;;
2236                         *) osname=mips ;;
2237                         esac;;
2238                 [23]100) osname=mips ;;
2239                 next*) osname=next ;;
2240                 i386*)
2241                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2242                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2243                                 osname='sco'
2244                                 osvers=$tmp
2245                         elif $test -f /etc/kconfig; then
2246                                 osname=isc
2247                                 if test "$lns" = "$ln -s"; then
2248                                         osvers=4
2249                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2250                                         osvers=3
2251                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2252                                         osvers=2
2253                                 fi
2254                         fi
2255                         tmp=''
2256                         ;;
2257                 pc*)
2258                         if test -n "$DJGPP"; then
2259                                 osname=dos
2260                                 osvers=djgpp
2261                         fi
2262                         ;;
2263                 esac
2264
2265                 case "$1" in
2266                 aix) osname=aix
2267                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2268                         case "$tmp" in
2269                         'not found') osvers="$4"."$3" ;;
2270                         '<3240'|'<>3240') osvers=3.2.0 ;;
2271                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2272                         '=3250'|'>3250') osvers=3.2.5 ;;
2273                         *) osvers=$tmp;;
2274                         esac
2275                         ;;
2276                 bsd386) osname=bsd386
2277                         osvers=`$uname -r`
2278                         ;;
2279                 cygwin*) osname=cygwin
2280                         osvers="$3"
2281                         ;;
2282                 *dc.osx) osname=dcosx
2283                         osvers="$3"
2284                         ;;
2285                 dnix) osname=dnix
2286                         osvers="$3"
2287                         ;;
2288                 domainos) osname=apollo
2289                         osvers="$3"
2290                         ;;
2291                 dgux) osname=dgux 
2292                         osvers="$3"
2293                         ;;
2294                 dynixptx*) osname=dynixptx
2295                         osvers=`echo "$4"|sed 's/^v//'`
2296                         ;;
2297                 freebsd) osname=freebsd 
2298                         osvers="$3" ;;
2299                 genix) osname=genix ;;
2300                 hp*) osname=hpux 
2301                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2302                         ;;
2303                 irix*) osname=irix
2304                         case "$3" in
2305                         4*) osvers=4 ;;
2306                         5*) osvers=5 ;;
2307                         *)      osvers="$3" ;;
2308                         esac
2309                         ;;
2310                 linux) osname=linux
2311                         case "$3" in
2312                         *)      osvers="$3" ;;
2313                         esac
2314                         ;;
2315                 MiNT) osname=mint
2316                         ;;
2317                 netbsd*) osname=netbsd
2318                         osvers="$3"
2319                         ;;
2320                 news-os) osvers="$3"
2321                         case "$3" in
2322                         4*) osname=newsos4 ;;
2323                         *) osname=newsos ;;
2324                         esac
2325                         ;;
2326                 next*) osname=next ;;
2327                 POSIX-BC | posix-bc ) osname=posix-bc
2328                         osvers="$3"
2329                         ;;
2330                 powerux | power_ux | powermax_os | powermaxos | \
2331                 powerunix | power_unix) osname=powerux
2332                         osvers="$3"
2333                         ;;
2334                 qnx) osname=qnx
2335                         osvers="$4"
2336                         ;;
2337                 solaris) osname=solaris
2338                         case "$3" in
2339                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2340                         *)      osvers="$3" ;;
2341                         esac
2342                         ;;
2343                 sunos) osname=sunos
2344                         case "$3" in
2345                         5*) osname=solaris
2346                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2347                         *)      osvers="$3" ;;
2348                         esac
2349                         ;;
2350                 titanos) osname=titanos
2351                         case "$3" in
2352                         1*) osvers=1 ;;
2353                         2*) osvers=2 ;;
2354                         3*) osvers=3 ;;
2355                         4*) osvers=4 ;;
2356                         *)      osvers="$3" ;;
2357                         esac
2358                         ;;
2359                 ultrix) osname=ultrix
2360                         osvers="$3"
2361                         ;;
2362                 osf1|mls+)      case "$5" in
2363                                 alpha)
2364                                         osname=dec_osf
2365                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2366                                         ;;
2367                         hp*)    osname=hp_osf1  ;;
2368                         mips)   osname=mips_osf1 ;;
2369                         esac
2370                         ;;
2371                 unixware) osname=svr5
2372                         osvers="$4"
2373                         ;;
2374                 uts) osname=uts
2375                         osvers="$3"
2376                         ;;
2377                 $2) case "$osname" in
2378                         *isc*) ;;
2379                         *freebsd*) ;;
2380                         svr*)
2381                                 : svr4.x or possibly later
2382                                 case "svr$3" in 
2383                                 ${osname}*)
2384                                         osname=svr$3
2385                                         osvers=$4
2386                                         ;;
2387                                 esac
2388                                 case "$osname" in
2389                                 svr4.0)
2390                                         : Check for ESIX
2391                                         if test -f /stand/boot ; then
2392                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2393                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2394                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2395                                                         if test -n "$isesix"; then
2396                                                                 osname=esix4
2397                                                         fi
2398                                                 fi
2399                                         fi
2400                                         ;;
2401                                 esac
2402                                 ;;
2403                         *)      if test -f /etc/systemid; then
2404                                         osname=sco
2405                                         set `echo $3 | $sed 's/\./ /g'` $4
2406                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2407                                                 osvers=$1.$2.$3
2408                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2409                                                 osvers=$1.$2
2410                                         elif $test -f $src/hints/sco_$1.sh; then
2411                                                 osvers=$1
2412                                         fi
2413                                 else
2414                                         case "$osname" in
2415                                         '') : Still unknown.  Probably a generic Sys V.
2416                                                 osname="sysv"
2417                                                 osvers="$3"
2418                                                 ;;
2419                                         esac
2420                                 fi
2421                                 ;;
2422                         esac
2423                         ;;
2424                 *)      case "$osname" in
2425                         '') : Still unknown.  Probably a generic BSD.
2426                                 osname="$1"
2427                                 osvers="$3"
2428                                 ;;
2429                         esac
2430                         ;;
2431                 esac
2432         else
2433                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2434                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2435                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2436                                 osname=news_os
2437                         fi
2438                         $rm -f UU/kernel.what
2439                 elif test -d c:/.; then
2440                         set X $myuname
2441                         osname=os2
2442                         osvers="$5"
2443                 fi
2444         fi
2445         
2446         : Now look for a hint file osname_osvers, unless one has been
2447         : specified already.
2448         case "$hintfile" in
2449         ''|' ')
2450                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2451                 : Also try without trailing minor version numbers.
2452                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2453                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2454                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2455                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2456                 case "$file" in
2457                 '') dflt=none ;;
2458                 *)  case "$osvers" in
2459                         '') dflt=$file
2460                                 ;;
2461                         *)  if $test -f $src/hints/$file.sh ; then
2462                                         dflt=$file
2463                                 elif $test -f $src/hints/$xfile.sh ; then
2464                                         dflt=$xfile
2465                                 elif $test -f $src/hints/$xxfile.sh ; then
2466                                         dflt=$xxfile
2467                                 elif $test -f $src/hints/$xxxfile.sh ; then
2468                                         dflt=$xxxfile
2469                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2470                                         dflt=$xxxxfile
2471                                 elif $test -f "$src/hints/${osname}.sh" ; then
2472                                         dflt="${osname}"
2473                                 else
2474                                         dflt=none
2475                                 fi
2476                                 ;;
2477                         esac
2478                         ;;
2479                 esac
2480                 if $test -f Policy.sh ; then
2481                         case "$dflt" in
2482                         *Policy*) ;;
2483                         none) dflt="Policy" ;;
2484                         *) dflt="Policy $dflt" ;;
2485                         esac
2486                 fi
2487                 ;;
2488         *)
2489                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2490                 ;;
2491         esac
2492
2493         if $test -f Policy.sh ; then
2494                 $cat <<EOM
2495
2496 There's also a Policy hint file available, which should make the
2497 site-specific (policy) questions easier to answer.
2498 EOM
2499
2500         fi
2501
2502         $cat <<EOM
2503
2504 You may give one or more space-separated answers, or "none" if appropriate.
2505 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2506 is a good thing.  DO NOT give a wrong version or a wrong OS.
2507
2508 EOM
2509
2510         rp="Which of these apply, if any?"
2511         . UU/myread
2512         tans=$ans
2513         for file in $tans; do
2514                 if $test X$file = XPolicy -a -f Policy.sh; then
2515                         . Policy.sh
2516                         $cat Policy.sh >> UU/config.sh
2517                 elif $test -f $src/hints/$file.sh; then
2518                         . $src/hints/$file.sh
2519                         $cat $src/hints/$file.sh >> UU/config.sh
2520                 elif $test X$tans = X -o X$tans = Xnone ; then
2521                         : nothing
2522                 else
2523                         : Give one chance to correct a possible typo.
2524                         echo "$file.sh does not exist"
2525                         dflt=$file
2526                         rp="hint to use instead?"
2527                         . UU/myread
2528                         for file in $ans; do
2529                                 if $test -f "$src/hints/$file.sh"; then
2530                                         . $src/hints/$file.sh
2531                                         $cat $src/hints/$file.sh >> UU/config.sh
2532                                 elif $test X$ans = X -o X$ans = Xnone ; then
2533                                         : nothing
2534                                 else
2535                                         echo "$file.sh does not exist -- ignored."
2536                                 fi
2537                         done
2538                 fi
2539         done
2540
2541         hint=recommended
2542         : Remember our hint file for later.
2543         if $test -f "$src/hints/$file.sh" ; then
2544                 hintfile="$file"
2545         else
2546                 hintfile=''
2547         fi
2548 fi
2549 cd UU
2550 ;;
2551 *)
2552         echo " "
2553         echo "Fetching default answers from $config_sh..." >&4
2554         tmp_n="$n"
2555         tmp_c="$c"
2556         cd ..
2557         cp $config_sh config.sh 2>/dev/null
2558         chmod +w config.sh
2559         . ./config.sh
2560         cd UU
2561         cp ../config.sh .
2562         n="$tmp_n"
2563         c="$tmp_c"
2564         hint=previous
2565         ;;
2566 esac
2567 test "$override" && . ./optdef.sh
2568 myuname="$newmyuname"
2569
2570 : Restore computed paths
2571 for file in $loclist $trylist; do
2572         eval $file="\$_$file"
2573 done
2574
2575 cat << EOM
2576
2577 Configure uses the operating system name and version to set some defaults.
2578 The default value is probably right if the name rings a bell. Otherwise,
2579 since spelling matters for me, either accept the default or answer "none"
2580 to leave it blank.
2581
2582 EOM
2583 case "$osname" in
2584         ''|' ')
2585                 case "$hintfile" in
2586                 ''|' '|none) dflt=none ;;
2587                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2588                 esac
2589                 ;;
2590         *) dflt="$osname" ;;
2591 esac
2592 rp="Operating system name?"
2593 . ./myread
2594 case "$ans" in
2595 none)  osname='' ;;
2596 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2597 esac
2598 echo " "
2599 case "$osvers" in
2600         ''|' ')
2601                 case "$hintfile" in
2602                 ''|' '|none) dflt=none ;;
2603                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2604                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2605                         case "$dflt" in
2606                         ''|' ') dflt=none ;;
2607                         esac
2608                         ;;
2609                 esac
2610                 ;;
2611         *) dflt="$osvers" ;;
2612 esac
2613 rp="Operating system version?"
2614 . ./myread
2615 case "$ans" in
2616 none)  osvers='' ;;
2617 *) osvers="$ans" ;;
2618 esac
2619
2620
2621 . ./posthint.sh
2622
2623 : who configured the system
2624 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2625 cf_by=`(logname) 2>/dev/null`
2626 case "$cf_by" in
2627 "")
2628         cf_by=`(whoami) 2>/dev/null`
2629         case "$cf_by" in
2630         "") cf_by=unknown ;;
2631         esac ;;
2632 esac
2633
2634 : set up the script used to warn in case of inconsistency
2635 cat <<EOS >whoa
2636 $startsh
2637 EOS
2638 cat <<'EOSC' >>whoa
2639 dflt=y
2640 echo " "
2641 echo "*** WHOA THERE!!! ***" >&4
2642 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2643 rp="    Keep the $hint value?"
2644 . ./myread
2645 case "$ans" in
2646 y) td=$was; tu=$was;;
2647 esac
2648 EOSC
2649
2650 : function used to set $1 to $val
2651 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2652 case "$val$was" in
2653 $define$undef) . ./whoa; eval "$var=\$td";;
2654 $undef$define) . ./whoa; eval "$var=\$tu";;
2655 *) eval "$var=$val";;
2656 esac'
2657
2658 cat <<EOM
2659
2660 Perl can be built to take advantage of threads, on some systems.
2661 To do so, Configure must be run with -Dusethreads.
2662
2663 Note that threading is a highly experimental feature, and
2664 some known race conditions still remain.  If you choose to try
2665 it, be very sure to not actually deploy it for production
2666 purposes.  README.threads has more details, and is required
2667 reading if you enable threads.
2668 EOM
2669 case "$usethreads" in
2670 $define|true|[yY]*)     dflt='y';;
2671 *) dflt='n';;
2672 esac
2673 rp='Build a threading Perl?'
2674 . ./myread
2675 case "$ans" in
2676 y|Y)    val="$define" ;;
2677 *)      val="$undef" ;;
2678 esac
2679 set usethreads
2680 eval $setvar
2681
2682 case "$usethreads" in
2683 $define)
2684         $cat <<EOM
2685
2686 As of 5.5.640, Perl has two different internal threading implementations,
2687 the 5.005 version (5005threads) and an interpreter-based version
2688 (ithreads) that has one interpreter per thread.  Both are very 
2689 experimental.  This arrangement exists to help developers work out
2690 which one is better.
2691 EOM
2692         : Default to ithreads unless overridden on command line or with
2693         : old config.sh
2694         dflt='y'
2695         case "$use5005threads" in
2696                 $define|true|[yY]*) dflt='n';;
2697         esac
2698         case "$useithreads" in
2699                 $undef|false|[nN]*) dflt='n';;
2700         esac
2701         rp='Use interpreter-based ithreads?'
2702         . ./myread
2703         case "$ans" in
2704         y|Y)    val="$define" ;;
2705         *)      val="$undef" ;;
2706         esac
2707         set useithreads
2708         eval $setvar
2709         : Now set use5005threads to the opposite value.
2710         case "$useithreads" in
2711         $define) val="$undef" ;;
2712         *) val="$define" ;;
2713         esac
2714         set use5005threads
2715         eval $setvar
2716         ;;
2717 *)
2718         useithreads="$undef"
2719         use5005threads="$undef"
2720         ;;
2721 esac
2722
2723 case "$d_oldpthreads" in
2724 '')     : Configure tests would be welcome here.  For now, assume undef.
2725         val="$undef" ;;
2726 *)      val="$d_oldpthreads" ;;
2727 esac
2728 set d_oldpthreads
2729 eval $setvar
2730
2731
2732 case "$usethreads" in
2733 "$define"|true|[yY]*)
2734 : Look for a hint-file generated 'call-back-unit'.  If the
2735 : user has specified that a threading perl is to be built,
2736 : we may need to set or change some other defaults.
2737         if $test -f usethreads.cbu; then
2738                 echo "Your platform has some specific hints for threaded builds, using them..."
2739                 . ./usethreads.cbu
2740         else
2741                 $cat <<EOM
2742 (Your platform doesn't have any specific hints for threaded builds.
2743  Assuming POSIX threads, then.)
2744 EOM
2745         fi
2746         ;;
2747 esac
2748
2749 cat <<EOM
2750
2751 Perl can be built so that multiple Perl interpreters can coexist
2752 within the same Perl executable.
2753 EOM
2754
2755 case "$useithreads" in
2756 $define)
2757         cat <<EOM
2758 This multiple interpreter support is required for interpreter-based threads.
2759 EOM
2760         val="$define"
2761         ;;
2762 *)
2763         echo 'Normally you do not need this and you should answer no.'
2764         case "$usemultiplicity" in
2765         $define|true|[yY]*)     dflt='y';;
2766         *) dflt='n';;
2767         esac
2768         rp='Build Perl for multiplicity?'
2769         . ./myread
2770         case "$ans" in
2771         y|Y)    val="$define" ;;
2772         *)      val="$undef" ;;
2773         esac
2774         ;;
2775 esac
2776 set usemultiplicity
2777 eval $setvar
2778
2779 : determine where manual pages are on this system
2780 echo " "
2781 case "$sysman" in
2782 '') 
2783         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2784         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2785         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2786         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2787         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2788         sysman=`./loc . /usr/man/man1 $syspath`
2789         ;;
2790 esac
2791 if $test -d "$sysman"; then
2792         echo "System manual is in $sysman." >&4
2793 else
2794         echo "Could not find manual pages in source form." >&4
2795 fi
2796
2797 : see what memory models we can support
2798 case "$models" in
2799 '')
2800         $cat >pdp11.c <<'EOP'
2801 int main() {
2802 #ifdef pdp11
2803         exit(0);
2804 #else
2805         exit(1);
2806 #endif
2807 }
2808 EOP
2809         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2810         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2811                 dflt='unsplit split'
2812         else
2813                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2814                 case "$tans" in
2815                 X) dflt='none';;
2816                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2817                                 dflt='small'
2818                         else
2819                                 dflt=''
2820                         fi
2821                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2822                                 dflt="$dflt medium"
2823                         fi
2824                         if $test -d /lib/large || $test -d /usr/lib/large; then
2825                                 dflt="$dflt large"
2826                         fi
2827                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2828                                 dflt="$dflt huge"
2829                         fi
2830                 esac
2831         fi;;
2832 *) dflt="$models";;
2833 esac
2834 $cat <<EOM
2835  
2836 Some systems have different model sizes.  On most systems they are called
2837 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2838 split.  If your system doesn't support different memory models, say "none".
2839 If you wish to force everything to one memory model, say "none" here and
2840 put the appropriate flags later when it asks you for other cc and ld flags.
2841 Venix systems may wish to put "none" and let the compiler figure things out.
2842 (In the following question multiple model names should be space separated.)
2843
2844 The default for most systems is "none".
2845
2846 EOM
2847 rp="Which memory models are supported?"
2848 . ./myread
2849 models="$ans"
2850
2851 case "$models" in
2852 none)
2853         small=''
2854         medium=''
2855         large=''
2856         huge=''
2857         unsplit=''
2858         split=''
2859         ;;
2860 *split)
2861         case "$split" in
2862         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2863                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2864                         dflt='-i'
2865                 else
2866                         dflt='none'
2867                 fi;;
2868         *) dflt="$split";;
2869         esac
2870         rp="What flag indicates separate I and D space?"
2871         . ./myread
2872         tans="$ans"
2873         case "$tans" in
2874         none) tans='';;
2875         esac
2876         split="$tans"
2877         unsplit='';;
2878 *large*|*small*|*medium*|*huge*)
2879         case "$models" in
2880         *large*)
2881                 case "$large" in
2882                 '') dflt='-Ml';;
2883                 *) dflt="$large";;
2884                 esac
2885         rp="What flag indicates large model?"
2886         . ./myread
2887         tans="$ans"
2888         case "$tans" in
2889         none) tans='';
2890         esac
2891         large="$tans";;
2892         *) large='';;
2893         esac
2894         case "$models" in
2895         *huge*) case "$huge" in
2896                 '') dflt='-Mh';;
2897                 *) dflt="$huge";;
2898                 esac
2899                 rp="What flag indicates huge model?"
2900                 . ./myread
2901                 tans="$ans"
2902                 case "$tans" in
2903                 none) tans='';
2904                 esac
2905                 huge="$tans";;
2906         *) huge="$large";;
2907         esac
2908         case "$models" in
2909         *medium*) case "$medium" in
2910                 '') dflt='-Mm';;
2911                 *) dflt="$medium";;
2912                 esac
2913                 rp="What flag indicates medium model?"
2914                 . ./myread
2915                 tans="$ans"
2916                 case "$tans" in
2917                 none) tans='';
2918                 esac
2919                 medium="$tans";;
2920         *) medium="$large";;
2921         esac
2922         case "$models" in
2923         *small*) case "$small" in
2924                 '') dflt='none';;
2925                 *) dflt="$small";;
2926                 esac
2927                 rp="What flag indicates small model?"
2928                 . ./myread
2929                 tans="$ans"
2930                 case "$tans" in
2931                 none) tans='';
2932                 esac
2933                 small="$tans";;
2934         *) small='';;
2935         esac
2936         ;;
2937 *)
2938         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2939         ;;
2940 esac
2941 $rm -f pdp11.* pdp11
2942
2943 : make some quick guesses about what we are up against
2944 echo " "
2945 $echo $n "Hmm...  $c"
2946 echo exit 1 >bsd
2947 echo exit 1 >usg
2948 echo exit 1 >v7
2949 echo exit 1 >osf1
2950 echo exit 1 >eunice
2951 echo exit 1 >xenix
2952 echo exit 1 >venix
2953 echo exit 1 >os2
2954 d_bsd="$undef"
2955 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2956 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2957 then
2958         echo "Looks kind of like an OSF/1 system, but we'll see..."
2959         echo exit 0 >osf1
2960 elif test `echo abc | tr a-z A-Z` = Abc ; then
2961         xxx=`./loc addbib blurfl $pth`
2962         if $test -f $xxx; then
2963         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2964                 echo exit 0 >bsd
2965                 echo exit 0 >usg
2966         else
2967                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2968                         echo "Looks kind of like an extended USG system, but we'll see..."
2969                 else
2970                         echo "Looks kind of like a USG system, but we'll see..."
2971                 fi
2972                 echo exit 0 >usg
2973         fi
2974 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2975         echo "Looks kind of like a BSD system, but we'll see..."
2976         d_bsd="$define"
2977         echo exit 0 >bsd
2978 else
2979         echo "Looks kind of like a Version 7 system, but we'll see..."
2980         echo exit 0 >v7
2981 fi
2982 case "$eunicefix" in
2983 *unixtovms*)
2984         $cat <<'EOI'
2985 There is, however, a strange, musty smell in the air that reminds me of
2986 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2987 EOI
2988         echo exit 0 >eunice
2989         d_eunice="$define"
2990 : it so happens the Eunice I know will not run shell scripts in Unix format
2991         ;;
2992 *)
2993         echo " "
2994         echo "Congratulations.  You aren't running Eunice."
2995         d_eunice="$undef"
2996         ;;
2997 esac
2998 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2999 case "$p_" in
3000 :) ;;
3001 *)
3002         $cat <<'EOI'
3003 I have the feeling something is not exactly right, however...don't tell me...
3004 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3005 EOI
3006         echo exit 0 >os2
3007         ;;
3008 esac
3009 if test -f /xenix; then
3010         echo "Actually, this looks more like a XENIX system..."
3011         echo exit 0 >xenix
3012         d_xenix="$define"
3013 else
3014         echo " "
3015         echo "It's not Xenix..."
3016         d_xenix="$undef"
3017 fi
3018 chmod +x xenix
3019 $eunicefix xenix
3020 if test -f /venix; then
3021         echo "Actually, this looks more like a VENIX system..."
3022         echo exit 0 >venix
3023 else
3024         echo " "
3025         if ./xenix; then
3026                 : null
3027         else
3028                 echo "Nor is it Venix..."
3029         fi
3030 fi
3031 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3032 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3033 $rm -f foo
3034
3035 : see if we need a special compiler
3036 echo " "
3037 if ./usg; then
3038         case "$cc" in
3039         '') case "$Mcc" in
3040                 /*) dflt='Mcc';;
3041                 *) case "$large" in
3042                         -M*) dflt='cc';;
3043                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3044                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3045                                                 dflt='cc'
3046                                         else
3047                                                 dflt='cc -M'
3048                                         fi
3049                                 else
3050                                         dflt='cc'
3051                                 fi;;
3052                         esac;;
3053                 esac;;
3054         *)  dflt="$cc";;
3055         esac
3056         case "$dflt" in
3057         *M*)    $cat <<'EOM'
3058 On some older systems the default C compiler will not resolve multiple global
3059 references that happen to have the same name.  On some such systems the "Mcc"
3060 command may be used to force these to be resolved.  On other systems a "cc -M"
3061 command is required.  (Note that the -M flag on other systems indicates a
3062 memory model to use!) If you have the Gnu C compiler, you might wish to use
3063 that instead.
3064
3065 EOM
3066         ;;
3067         esac
3068         rp="Use which C compiler?"
3069         . ./myread
3070         cc="$ans"
3071 else
3072         case "$cc" in
3073         '') dflt=cc;;
3074         *) dflt="$cc";;
3075         esac
3076         rp="Use which C compiler?"
3077         . ./myread
3078         cc="$ans"
3079 fi
3080 : Look for a hint-file generated 'call-back-unit'.  Now that the
3081 : user has specified the compiler, we may need to set or change some
3082 : other defaults.
3083 if $test -f cc.cbu; then
3084     . ./cc.cbu
3085 fi
3086 echo " "
3087 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3088 $cat >gccvers.c <<EOM
3089 #include <stdio.h>
3090 int main() {
3091 #ifdef __GNUC__
3092 #ifdef __VERSION__
3093         printf("%s\n", __VERSION__);
3094 #else
3095         printf("%s\n", "1");
3096 #endif
3097 #endif
3098         exit(0);
3099 }
3100 EOM
3101 if $cc -o gccvers gccvers.c; then
3102         gccversion=`./gccvers`
3103         case "$gccversion" in
3104         '') echo "You are not using GNU cc." ;;
3105         *)  echo "You are using GNU cc $gccversion."
3106             ;;
3107         esac
3108 else
3109         echo " "
3110         echo "*** WHOA THERE!!! ***" >&4
3111         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3112         case "$knowitall" in
3113         '')
3114         echo "    You'd better start hunting for one and let me know about it." >&4
3115                 exit 1
3116                 ;;
3117         esac
3118 fi
3119 $rm -f gccvers*
3120 case "$gccversion" in
3121 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3122 esac
3123
3124 : decide how portable to be.  Allow command line overrides.
3125 case "$d_portable" in
3126 "$undef") ;;
3127 *)      d_portable="$define" ;;
3128 esac
3129
3130 : set up shell script to do ~ expansion
3131 cat >filexp <<EOSS
3132 $startsh
3133 : expand filename
3134 case "\$1" in
3135  ~/*|~)
3136         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3137         ;;
3138  ~*)
3139         if $test -f /bin/csh; then
3140                 /bin/csh -f -c "glob \$1"
3141                 failed=\$?
3142                 echo ""
3143                 exit \$failed
3144         else
3145                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3146                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3147                 if $test ! -d "\$dir"; then
3148                         me=\`basename \$0\`
3149                         echo "\$me: can't locate home directory for: \$name" >&2
3150                         exit 1
3151                 fi
3152                 case "\$1" in
3153                 */*)
3154                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3155                         ;;
3156                 *)
3157                         echo \$dir
3158                         ;;
3159                 esac
3160         fi
3161         ;;
3162 *)
3163         echo \$1
3164         ;;
3165 esac
3166 EOSS
3167 chmod +x filexp
3168 $eunicefix filexp
3169
3170 : now set up to get a file name
3171 cat <<EOS >getfile
3172 $startsh
3173 EOS
3174 cat <<'EOSC' >>getfile
3175 tilde=''
3176 fullpath=''
3177 already=''
3178 skip=''
3179 none_ok=''
3180 exp_file=''
3181 nopath_ok=''
3182 orig_rp="$rp"
3183 orig_dflt="$dflt"
3184 case "$gfpth" in
3185 '') gfpth='.' ;;
3186 esac
3187
3188 case "$fn" in
3189 *\(*)
3190         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3191         fn=`echo $fn | sed 's/(.*)//'`
3192         ;;
3193 esac
3194
3195 case "$fn" in
3196 *:*)
3197         loc_file=`expr $fn : '.*:\(.*\)'`
3198         fn=`expr $fn : '\(.*\):.*'`
3199         ;;
3200 esac
3201
3202 case "$fn" in
3203 *~*) tilde=true;;
3204 esac
3205 case "$fn" in
3206 */*) fullpath=true;;
3207 esac
3208 case "$fn" in
3209 *+*) skip=true;;
3210 esac
3211 case "$fn" in
3212 *n*) none_ok=true;;
3213 esac
3214 case "$fn" in
3215 *e*) exp_file=true;;
3216 esac
3217 case "$fn" in
3218 *p*) nopath_ok=true;;
3219 esac
3220
3221 case "$fn" in
3222 *f*) type='File';;
3223 *d*) type='Directory';;
3224 *l*) type='Locate';;
3225 esac
3226
3227 what="$type"
3228 case "$what" in
3229 Locate) what='File';;
3230 esac
3231
3232 case "$exp_file" in
3233 '')
3234         case "$d_portable" in
3235         "$define") ;;
3236         *) exp_file=true;;
3237         esac
3238         ;;
3239 esac
3240
3241 cd ..
3242 while test "$type"; do
3243         redo=''
3244         rp="$orig_rp"
3245         dflt="$orig_dflt"
3246         case "$tilde" in
3247         true) rp="$rp (~name ok)";;
3248         esac
3249         . UU/myread
3250         if test -f UU/getfile.ok && \
3251                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3252         then
3253                 value="$ans"
3254                 ansexp="$ans"
3255                 break
3256         fi
3257         case "$ans" in
3258         none)
3259                 value=''
3260                 ansexp=''
3261                 case "$none_ok" in
3262                 true) type='';;
3263                 esac
3264                 ;;
3265         *)
3266                 case "$tilde" in
3267                 '') value="$ans"
3268                         ansexp="$ans";;
3269                 *)
3270                         value=`UU/filexp $ans`
3271                         case $? in
3272                         0)
3273                                 if test "$ans" != "$value"; then
3274                                         echo "(That expands to $value on this system.)"
3275                                 fi
3276                                 ;;
3277                         *) value="$ans";;
3278                         esac
3279                         ansexp="$value"
3280                         case "$exp_file" in
3281                         '') value="$ans";;
3282                         esac
3283                         ;;
3284                 esac
3285                 case "$fullpath" in
3286                 true)
3287                         case "$ansexp" in
3288                         /*) value="$ansexp" ;;
3289                         *)
3290                                 redo=true
3291                                 case "$already" in
3292                                 true)
3293                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3294                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3295                                         ;;
3296                                 *)
3297                                 echo "Please give a full path name, starting with slash." >&4
3298                                         case "$tilde" in
3299                                         true)
3300                                 echo "Note that using ~name is ok provided it expands well." >&4
3301                                                 already=true
3302                                                 ;;
3303                                         esac
3304                                 esac
3305                                 ;;
3306                         esac
3307                         ;;
3308                 esac
3309                 case "$redo" in
3310                 '')
3311                         case "$type" in
3312                         File)
3313                                 for fp in $gfpth; do
3314                                         if test "X$fp" = X.; then
3315                                             pf="$ansexp"
3316                                         else    
3317                                             pf="$fp/$ansexp"
3318                                         fi
3319                                         if test -f "$pf"; then
3320                                                 type=''
3321                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3322                                         then
3323                                                 echo "($value is not a plain file, but that's ok.)"
3324                                                 type=''
3325                                         fi
3326                                         if test X"$type" = X; then
3327                                             value="$pf"
3328                                             break
3329                                         fi
3330                                 done
3331                                 ;;
3332                         Directory)
3333                                 for fp in $gfpth; do
3334                                         if test "X$fp" = X.; then
3335                                             pf="$ansexp"
3336                                         else    
3337                                             pf="$fp/$ansexp"
3338                                         fi
3339                                         if test -d "$pf"; then
3340                                                 type=''
3341                                                 value="$pf"
3342                                                 break
3343                                         fi
3344                                 done
3345                                 ;;
3346                         Locate)
3347                                 if test -d "$ansexp"; then
3348                                         echo "(Looking for $loc_file in directory $value.)"
3349                                         value="$value/$loc_file"
3350                                         ansexp="$ansexp/$loc_file"
3351                                 fi
3352                                 if test -f "$ansexp"; then
3353                                         type=''
3354                                 fi
3355                                 case "$nopath_ok" in
3356                                 true)   case "$value" in
3357                                         */*) ;;
3358                                         *)      echo "Assuming $value will be in people's path."
3359                                                 type=''
3360                                                 ;;
3361                                         esac
3362                                         ;;
3363                                 esac
3364                                 ;;
3365                         esac
3366
3367                         case "$skip" in
3368                         true) type='';
3369                         esac
3370
3371                         case "$type" in
3372                         '') ;;
3373                         *)
3374                                 if test "$fastread" = yes; then
3375                                         dflt=y
3376                                 else
3377                                         dflt=n
3378                                 fi
3379                                 rp="$what $value doesn't exist.  Use that name anyway?"
3380                                 . UU/myread
3381                                 dflt=''
3382                                 case "$ans" in
3383                                 y*) type='';;
3384                                 *) echo " ";;
3385                                 esac
3386                                 ;;
3387                         esac
3388                         ;;
3389                 esac
3390                 ;;
3391         esac
3392 done
3393 cd UU
3394 ans="$value"
3395 rp="$orig_rp"
3396 dflt="$orig_dflt"
3397 rm -f getfile.ok
3398 test "X$gfpthkeep" != Xy && gfpth=""
3399 EOSC
3400
3401 : What should the include directory be ?
3402 echo " "
3403 $echo $n "Hmm...  $c"
3404 dflt='/usr/include'
3405 incpath=''
3406 mips_type=''
3407 if $test -f /bin/mips && /bin/mips; then
3408         echo "Looks like a MIPS system..."
3409         $cat >usr.c <<'EOCP'
3410 #ifdef SYSTYPE_BSD43
3411 /bsd43
3412 #endif
3413 EOCP
3414         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3415                 dflt='/bsd43/usr/include'
3416                 incpath='/bsd43'
3417                 mips_type='BSD 4.3'
3418         else
3419                 mips_type='System V'
3420         fi
3421         $rm -f usr.c usr.out
3422         echo "and you're compiling with the $mips_type compiler and libraries."
3423         xxx_prompt=y
3424         echo "exit 0" >mips
3425 else
3426         echo "Doesn't look like a MIPS system."
3427         xxx_prompt=n
3428         echo "exit 1" >mips
3429 fi
3430 chmod +x mips
3431 $eunicefix mips
3432 case "$usrinc" in
3433 '') ;;
3434 *) dflt="$usrinc";;
3435 esac
3436 case "$xxx_prompt" in
3437 y)      fn=d/
3438         echo " "
3439         rp='Where are the include files you want to use?'
3440         . ./getfile
3441         usrinc="$ans"
3442         ;;
3443 *)      usrinc="$dflt"
3444         ;;
3445 esac
3446
3447 : see how we invoke the C preprocessor
3448 echo " "
3449 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3450 cat <<'EOT' >testcpp.c
3451 #define ABC abc
3452 #define XYZ xyz
3453 ABC.XYZ
3454 EOT
3455 cd ..
3456 if test ! -f cppstdin; then
3457         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3458                 # AIX cc -E doesn't show the absolute headerfile
3459                 # locations but we'll cheat by using the -M flag.
3460                 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
3461         else
3462                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3463         fi
3464 else
3465         echo "Keeping your $hint cppstdin wrapper."
3466 fi
3467 chmod 755 cppstdin
3468 wrapper=`pwd`/cppstdin
3469 ok='false'
3470 cd UU
3471
3472 if $test "X$cppstdin" != "X" && \
3473         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3474         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3475 then
3476         echo "You used to use $cppstdin $cppminus so we'll use that again."
3477         case "$cpprun" in
3478         '') echo "But let's see if we can live without a wrapper..." ;;
3479         *)
3480                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3481                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3482                 then
3483                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3484                         ok='true'
3485                 else
3486                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3487                 fi
3488                 ;;
3489         esac
3490 else
3491         case "$cppstdin" in
3492         '') ;;
3493         *)
3494                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3495                 ;;
3496         esac
3497 fi
3498
3499 if $ok; then
3500         : nothing
3501 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3502         $cc -E <testcpp.c >testcpp.out 2>&1; \
3503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3504         echo "Yup, it does."
3505         x_cpp="$cc -E"
3506         x_minus='';
3507 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3508         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3510         echo "Yup, it does."
3511         x_cpp="$cc -E"
3512         x_minus='-';
3513 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3514         $cc -P <testcpp.c >testcpp.out 2>&1; \
3515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3516         echo "Yipee, that works!"
3517         x_cpp="$cc -P"
3518         x_minus='';
3519 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3520         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3522         echo "At long last!"
3523         x_cpp="$cc -P"
3524         x_minus='-';
3525 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3526         $cpp <testcpp.c >testcpp.out 2>&1; \
3527         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3528         echo "It works!"
3529         x_cpp="$cpp"
3530         x_minus='';
3531 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3532         $cpp - <testcpp.c >testcpp.out 2>&1; \
3533         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3534         echo "Hooray, it works!  I was beginning to wonder."
3535         x_cpp="$cpp"
3536         x_minus='-';
3537 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3538         $wrapper <testcpp.c >testcpp.out 2>&1; \
3539         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3540         x_cpp="$wrapper"
3541         x_minus=''
3542         echo "Eureka!"
3543 else
3544         dflt=''
3545         rp="No dice.  I can't find a C preprocessor.  Name one:"
3546         . ./myread
3547         x_cpp="$ans"
3548         x_minus=''
3549         $x_cpp <testcpp.c >testcpp.out 2>&1
3550         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3551                 echo "OK, that will do." >&4
3552         else
3553 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3554                 exit 1
3555         fi
3556 fi
3557
3558 case "$ok" in
3559 false)
3560         cppstdin="$x_cpp"
3561         cppminus="$x_minus"
3562         cpprun="$x_cpp"
3563         cpplast="$x_minus"
3564         set X $x_cpp
3565         shift
3566         case "$1" in
3567         "$cpp")
3568                 echo "Perhaps can we force $cc -E using a wrapper..."
3569                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3570                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3571                 then
3572                         echo "Yup, we can."
3573                         cppstdin="$wrapper"
3574                         cppminus='';
3575                 else
3576                         echo "Nope, we'll have to live without it..."
3577                 fi
3578                 ;;
3579         esac
3580         case "$cpprun" in
3581         "$wrapper")
3582                 cpprun=''
3583                 cpplast=''
3584                 ;;
3585         esac
3586         ;;
3587 esac
3588
3589 case "$cppstdin" in
3590 "$wrapper"|'cppstdin') ;;
3591 *) $rm -f $wrapper;;
3592 esac
3593 $rm -f testcpp.c testcpp.out
3594
3595 : Set private lib path
3596 case "$plibpth" in
3597 '') if ./mips; then
3598                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3599         fi;;
3600 esac
3601 case "$libpth" in
3602 ' ') dlist='';;
3603 '') dlist="$loclibpth $plibpth $glibpth";;
3604 *) dlist="$libpth";;
3605 esac
3606
3607 : Now check and see which directories actually exist, avoiding duplicates
3608 libpth=''
3609 for xxx in $dlist
3610 do
3611     if $test -d $xxx; then
3612                 case " $libpth " in
3613                 *" $xxx "*) ;;
3614                 *) libpth="$libpth $xxx";;
3615                 esac
3616     fi
3617 done
3618 $cat <<'EOM'
3619
3620 Some systems have incompatible or broken versions of libraries.  Among
3621 the directories listed in the question below, please remove any you
3622 know not to be holding relevant libraries, and add any that are needed.
3623 Say "none" for none.
3624
3625 EOM
3626 case "$libpth" in
3627 '') dflt='none';;
3628 *)
3629         set X $libpth
3630         shift
3631         dflt=${1+"$@"}
3632         ;;
3633 esac
3634 rp="Directories to use for library searches?"
3635 . ./myread
3636 case "$ans" in
3637 none) libpth=' ';;
3638 *) libpth="$ans";;
3639 esac
3640
3641 : compute shared library extension
3642 case "$so" in
3643 '')
3644         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3645                 dflt='sl'
3646         else
3647                 dflt='so'
3648         fi
3649         ;;
3650 *) dflt="$so";;
3651 esac
3652 $cat <<EOM
3653
3654 On some systems, shared libraries may be available.  Answer 'none' if
3655 you want to suppress searching of shared libraries for the remainder
3656 of this configuration.
3657
3658 EOM
3659 rp='What is the file extension used for shared libraries?'
3660 . ./myread
3661 so="$ans"
3662
3663 : Define several unixisms.
3664 : Hints files or command line option can be used to override them.
3665 : The convoluted testing is in case hints files set either the old
3666 : or the new name.
3667 case "$_exe" in
3668 '')     case "$exe_ext" in
3669     '') ;;
3670         *)      _exe="$exe_ext" ;;
3671         esac
3672         ;;
3673 esac
3674 case "$_a" in
3675 '')     case "$lib_ext" in
3676     '') _a='.a';;
3677         *)      _a="$lib_ext" ;;
3678         esac
3679         ;;
3680 esac
3681 case "$_o" in
3682 '') case "$obj_ext" in
3683         '')     _o='.o';;
3684         *)      _o="$obj_ext";;
3685         esac
3686         ;;
3687 esac
3688 case "$p_" in
3689 '') case "$path_sep" in
3690         '')     p_=':';;
3691         *)      p_="$path_sep";;
3692         esac
3693         ;;
3694 esac
3695 exe_ext=$_exe
3696 lib_ext=$_a
3697 obj_ext=$_o
3698 path_sep=$p_
3699
3700 : Which makefile gets called first.  This is used by make depend.
3701 case "$firstmakefile" in
3702 '') firstmakefile='makefile';;
3703 esac
3704
3705 cat <<EOM
3706
3707 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3708 Configure must be run with -Dusesocks.
3709
3710 Normally you do not need this and you should answer no.
3711
3712 EOM
3713 case "$usesocks" in
3714 $define|true|[yY]*)     dflt='y';;
3715 *) dflt='n';;
3716 esac
3717 rp='Build Perl for SOCKS?'
3718 . ./myread
3719 case "$ans" in
3720 y|Y)    val="$define" ;;     
3721 *)      val="$undef" ;;
3722 esac
3723 set usesocks
3724 eval $setvar
3725
3726 : Looking for optional libraries
3727 echo " "
3728 echo "Checking for optional libraries..." >&4
3729 case "$libs" in
3730 ' '|'') dflt='';;
3731 *) dflt="$libs";;
3732 esac
3733 case "$libswanted" in
3734 '') libswanted='c_s';;
3735 esac
3736 case "$usesocks" in
3737 $define)
3738         libswanted="$libswanted socks5 socks5_sh"
3739         ;;
3740 esac
3741 for thislib in $libswanted; do
3742         
3743         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3744                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3745                 echo "Found -l$thislib (shared)."
3746                 case " $dflt " in
3747                 *"-l$thislib "*);;
3748                 *) dflt="$dflt -l$thislib";;
3749                 esac
3750         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3751                 echo "Found -l$thislib (shared)."
3752                 case " $dflt " in
3753                 *"-l$thislib "*);;
3754                 *) dflt="$dflt -l$thislib";;
3755                 esac
3756         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3757                 echo "Found -l$thislib."
3758                 case " $dflt " in
3759                 *"-l$thislib "*);;
3760                 *) dflt="$dflt -l$thislib";;
3761                 esac
3762         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3763                 echo "Found -l$thislib."
3764                 case " $dflt " in
3765                 *"-l$thislib "*);;
3766                 *) dflt="$dflt -l$thislib";;
3767                 esac
3768         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3769                 echo "Found -l${thislib}_s."
3770                 case " $dflt " in
3771                 *"-l$thislib "*);;
3772                 *) dflt="$dflt -l${thislib}_s";;
3773                 esac
3774         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3775                 echo "Found -l$thislib."
3776                 case " $dflt " in
3777                 *"-l$thislib "*);;
3778                 *) dflt="$dflt -l$thislib";;
3779                 esac
3780         else
3781                 echo "No -l$thislib."
3782         fi
3783 done
3784 set X $dflt
3785 shift
3786 dflt="$*"
3787 case "$libs" in
3788 '') dflt="$dflt";;
3789 *) dflt="$libs";;
3790 esac
3791 case "$dflt" in
3792 ' '|'') dflt='none';;
3793 esac
3794
3795 $cat <<EOM
3796
3797 In order to compile $package on your machine, a number of libraries
3798 are usually needed.  Include any other special libraries here as well.
3799 Say "none" for none.  The default list is almost always right.
3800 EOM
3801
3802 echo " "
3803 rp="What libraries to use?"
3804 . ./myread
3805 case "$ans" in
3806 none) libs=' ';;
3807 *) libs="$ans";;
3808 esac
3809
3810 : determine optimization, if desired, or use for debug flag also
3811 case "$optimize" in
3812 ' '|$undef) dflt='none';;
3813 '') dflt='-O';;
3814 *) dflt="$optimize";;
3815 esac
3816 $cat <<EOH
3817
3818 By default, $package compiles with the -O flag to use the optimizer.
3819 Alternately, you might want to use the symbolic debugger, which uses
3820 the -g flag (on traditional Unix systems).  Either flag can be
3821 specified here.  To use neither flag, specify the word "none".
3822
3823 EOH
3824 rp="What optimizer/debugger flag should be used?"
3825 . ./myread
3826 optimize="$ans"
3827 case "$optimize" in
3828 'none') optimize=" ";;
3829 esac
3830
3831 dflt=''
3832 : We will not override a previous value, but we might want to
3833 : augment a hint file
3834 case "$hint" in
3835 default|recommended)
3836         case "$gccversion" in
3837         1*) dflt='-fpcc-struct-return' ;;
3838         esac
3839         case "$optimize" in
3840         *-g*) dflt="$dflt -DDEBUGGING";;
3841         esac
3842         case "$gccversion" in
3843         2*) if test -d /etc/conf/kconfig.d &&
3844                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3845                 then
3846                         dflt="$dflt -posix"
3847                 fi
3848                 ;;
3849         esac
3850         case "$gccversion" in
3851         1*) ;;
3852         2.[0-8]*) ;;
3853         ?*)     echo " "
3854                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3855                 echo 'int main(void) { return 0; }' > gcctest.c
3856                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3857                         echo "Yes, it does." 2>&1
3858                         case "$ccflags" in
3859                         *strict-aliasing*) 
3860                                 echo "Leaving current flags $ccflags alone." 2>&1
3861                                 ;;
3862                         *) dflt="$dflt -fno-strict-aliasing" ;;
3863                         esac
3864                 else
3865                         echo "Nope, it doesn't, but that's ok." 2>&1
3866                 fi
3867                 ;;
3868         esac
3869         ;;
3870 esac
3871
3872 case "$mips_type" in
3873 *BSD*|'') inclwanted="$locincpth $usrinc";;
3874 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3875 esac
3876 for thisincl in $inclwanted; do
3877         if $test -d $thisincl; then
3878                 if $test x$thisincl != x$usrinc; then
3879                         case "$dflt" in
3880                         *$thisincl*);;
3881                         *) dflt="$dflt -I$thisincl";;
3882                         esac
3883                 fi
3884         fi
3885 done
3886
3887 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3888         xxx=true;
3889 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3890         xxx=true;
3891 else
3892         xxx=false;
3893 fi;
3894 if $xxx; then
3895         case "$dflt" in
3896         *$2*);;
3897         *) dflt="$dflt -D$2";;
3898         esac;
3899 fi'
3900
3901 set signal.h LANGUAGE_C; eval $inctest
3902
3903 case "$usesocks" in
3904 $define)
3905         ccflags="$ccflags -DSOCKS"
3906         ;;
3907 esac
3908
3909 case "$hint" in
3910 default|recommended) dflt="$ccflags $dflt" ;;
3911 *) dflt="$ccflags";;
3912 esac
3913
3914 case "$dflt" in
3915 ''|' ') dflt=none;;
3916 esac
3917 $cat <<EOH
3918
3919 Your C compiler may want other flags.  For this question you should include
3920 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3921 but you should NOT include libraries or ld flags like -lwhatever.  If you
3922 want $package to honor its debug switch, you should include -DDEBUGGING here.
3923 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3924
3925 To use no flags, specify the word "none".
3926
3927 EOH
3928 set X $dflt
3929 shift
3930 dflt=${1+"$@"}
3931 rp="Any additional cc flags?"
3932 . ./myread
3933 case "$ans" in
3934 none) ccflags='';;
3935 *) ccflags="$ans";;
3936 esac
3937
3938 : the following weeds options from ccflags that are of no interest to cpp
3939 cppflags="$ccflags"
3940 case "$gccversion" in
3941 1*) cppflags="$cppflags -D__GNUC__"
3942 esac
3943 case "$mips_type" in
3944 '');;
3945 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3946 esac
3947 case "$cppflags" in
3948 '');;
3949 *)
3950         echo " "
3951         echo "Let me guess what the preprocessor flags are..." >&4
3952         set X $cppflags
3953         shift
3954         cppflags=''
3955         $cat >cpp.c <<'EOM'
3956 #define BLURFL foo
3957
3958 BLURFL xx LFRULB
3959 EOM
3960         previous=''
3961         for flag in $*
3962         do
3963                 case "$flag" in
3964                 -*) ftry="$flag";;
3965                 *) ftry="$previous $flag";;
3966                 esac
3967                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3968                         >cpp1.out 2>/dev/null && \
3969                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3970                         >cpp2.out 2>/dev/null && \
3971                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3972                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3973                 then
3974                         cppflags="$cppflags $ftry"
3975                         previous=''
3976                 else
3977                         previous="$flag"
3978                 fi
3979         done
3980         set X $cppflags
3981         shift
3982         cppflags=${1+"$@"}
3983         case "$cppflags" in
3984         *-*)  echo "They appear to be: $cppflags";;
3985         esac
3986         $rm -f cpp.c cpp?.out
3987         ;;
3988 esac
3989
3990 : flags used in final linking phase
3991 case "$ldflags" in
3992 '') if ./venix; then
3993                 dflt='-i -z'
3994         else
3995                 dflt=''
3996         fi
3997         case "$ccflags" in
3998         *-posix*) dflt="$dflt -posix" ;;
3999         esac
4000         ;;
4001 *) dflt="$ldflags";;
4002 esac
4003
4004 : Try to guess additional flags to pick up local libraries.
4005 for thislibdir in $libpth; do
4006         case " $loclibpth " in
4007         *" $thislibdir "*)
4008                 case "$dflt " in 
4009                 *"-L$thislibdir "*) ;;
4010                 *)  dflt="$dflt -L$thislibdir" ;;
4011                 esac
4012                 ;;
4013         esac
4014 done
4015
4016 case "$dflt" in
4017 '') dflt='none' ;;
4018 esac
4019
4020 $cat <<EOH
4021
4022 Your C linker may need flags.  For this question you should
4023 include -L/whatever and any other flags used by the C linker, but you
4024 should NOT include libraries like -lwhatever.
4025
4026 Make sure you include the appropriate -L/path flags if your C linker
4027 does not normally search all of the directories you specified above,
4028 namely
4029         $libpth
4030 To use no flags, specify the word "none".
4031
4032 EOH
4033
4034 rp="Any additional ld flags (NOT including libraries)?"
4035 . ./myread
4036 case "$ans" in
4037 none) ldflags='';;
4038 *) ldflags="$ans";;
4039 esac
4040 rmlist="$rmlist pdp11"
4041
4042 : coherency check
4043 echo " "
4044 echo "Checking your choice of C compiler and flags for coherency..." >&4
4045 $cat > try.c <<'EOF'
4046 #include <stdio.h>
4047 int main() { printf("Ok\n"); exit(0); }
4048 EOF
4049 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4050 shift
4051 $cat >try.msg <<'EOM'
4052 I've tried to compile and run the following simple program:
4053
4054 EOM
4055 $cat try.c >> try.msg
4056
4057 $cat >> try.msg <<EOM
4058
4059 I used the command:
4060
4061         $*
4062         ./try
4063
4064 and I got the following output:
4065
4066 EOM
4067 dflt=y
4068 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4069         if sh -c './try' >>try.msg 2>&1; then
4070                 xxx=`./try`
4071                 case "$xxx" in
4072                 "Ok") dflt=n ;;
4073                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4074                         case " $libs " in
4075                         *" -lsfio "*)
4076                                 cat >> try.msg <<'EOQS'
4077 If $libs contains -lsfio, and sfio is mis-configured, then it
4078 sometimes (apparently) runs and exits with a 0 status, but with no
4079 output!  It may have to do with sfio's use of _exit vs. exit.
4080
4081 EOQS
4082                                 rp="You have a big problem.  Shall I abort Configure"
4083                                 dflt=y
4084                                 ;;
4085                         esac
4086                         ;;
4087                 esac
4088         else
4089                 echo "The program compiled OK, but exited with status $?." >>try.msg
4090                 rp="You have a problem.  Shall I abort Configure"
4091                 dflt=y
4092         fi
4093 else
4094         echo "I can't compile the test program." >>try.msg
4095         rp="You have a BIG problem.  Shall I abort Configure"
4096         dflt=y
4097 fi
4098 case "$dflt" in
4099 y)
4100         $cat try.msg >&4
4101         case "$knowitall" in
4102         '')
4103                 echo "(The supplied flags or libraries might be incorrect.)"
4104                 ;;
4105         *) dflt=n;;
4106         esac
4107         echo " "
4108         . ./myread
4109         case "$ans" in
4110         n*|N*) ;;
4111         *)      echo "Ok.  Stopping Configure." >&4
4112                 exit 1
4113                 ;;
4114         esac
4115         ;;
4116 n) echo "OK, that should do.";;
4117 esac
4118 $rm -f try try.* core
4119
4120 : define an is-a-typedef? function
4121 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4122 case "$inclist" in
4123 "") inclist="sys/types.h";;
4124 esac;
4125 eval "varval=\$$var";
4126 case "$varval" in
4127 "")
4128         $rm -f temp.c;
4129         for inc in $inclist; do
4130                 echo "#include <$inc>" >>temp.c;
4131         done;
4132         echo "#ifdef $type" >> temp.c;
4133         echo "printf(\"We have $type\");" >> temp.c;
4134         echo "#endif" >> temp.c;
4135         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4136         if $contains $type temp.E >/dev/null 2>&1; then
4137                 eval "$var=\$type";
4138         else
4139                 eval "$var=\$def";
4140         fi;
4141         $rm -f temp.?;;
4142 *) eval "$var=\$varval";;
4143 esac'
4144
4145 : define an is-a-typedef? function that prompts if the type is not available.
4146 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4147 case "$inclist" in
4148 "") inclist="sys/types.h";;
4149 esac;
4150 eval "varval=\$$var";
4151 case "$varval" in
4152 "")
4153         $rm -f temp.c;
4154         for inc in $inclist; do
4155                 echo "#include <$inc>" >>temp.c;
4156         done;
4157         echo "#ifdef $type" >> temp.c;
4158         echo "printf(\"We have $type\");" >> temp.c;
4159         echo "#endif" >> temp.c;
4160         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4161         echo " " ;
4162         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4163         if $contains $type temp.E >/dev/null 2>&1; then
4164                 echo "$type found." >&4;
4165                 eval "$var=\$type";
4166         else
4167                 echo "$type NOT found." >&4;
4168                 dflt="$def";
4169                 . ./myread ;
4170                 eval "$var=\$ans";
4171         fi;
4172         $rm -f temp.?;;
4173 *) eval "$var=\$varval";;
4174 esac'
4175
4176 : define a shorthand compile call
4177 compile='
4178 mc_file=$1;
4179 shift;
4180 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4181 : define a shorthand compile call for compilations that should be ok.
4182 compile_ok='
4183 mc_file=$1;
4184 shift;
4185 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4186
4187 : check for lengths of integral types
4188 echo " "
4189 case "$intsize" in
4190 '')
4191         echo "Checking to see how big your integers are..." >&4
4192         $cat >intsize.c <<'EOCP'
4193 #include <stdio.h>
4194 int main()
4195 {
4196         printf("intsize=%d;\n", (int)sizeof(int));
4197         printf("longsize=%d;\n", (int)sizeof(long));
4198         printf("shortsize=%d;\n", (int)sizeof(short));
4199         exit(0);
4200 }
4201 EOCP
4202         set intsize
4203         if eval $compile_ok && ./intsize > /dev/null; then
4204                 eval `./intsize`
4205                 echo "Your integers are $intsize bytes long."
4206                 echo "Your long integers are $longsize bytes long."
4207                 echo "Your short integers are $shortsize bytes long."
4208         else
4209                 $cat >&4 <<EOM
4210 !
4211 Help! I can't compile and run the intsize test program: please enlighten me!
4212 (This is probably a misconfiguration in your system or libraries, and
4213 you really ought to fix it.  Still, I'll try anyway.)
4214 !
4215 EOM
4216                 dflt=4
4217                 rp="What is the size of an integer (in bytes)?"
4218                 . ./myread
4219                 intsize="$ans"
4220                 dflt=$intsize
4221                 rp="What is the size of a long integer (in bytes)?"
4222                 . ./myread
4223                 longsize="$ans"
4224                 dflt=2
4225                 rp="What is the size of a short integer (in bytes)?"
4226                 . ./myread
4227                 shortsize="$ans"
4228         fi
4229         ;;
4230 esac
4231 $rm -f intsize intsize.*
4232
4233 : see what type lseek is declared as in the kernel
4234 rp="What is the type used for lseek's offset on this system?"
4235 set off_t lseektype long stdio.h sys/types.h
4236 eval $typedef_ask
4237
4238 echo " "
4239 $echo $n "Checking to see how big your file offsets are...$c" >&4
4240 $cat >try.c <<EOCP
4241 #include <sys/types.h>
4242 #include <stdio.h>
4243 int main()
4244 {
4245     printf("%d\n", (int)sizeof($lseektype));
4246     return(0); 
4247 }
4248 EOCP
4249 set try
4250 if eval $compile_ok; then
4251         lseeksize=`./try`
4252         $echo " $lseeksize bytes." >&4
4253 else
4254         dflt=$longsize
4255         echo " "
4256         echo "(I can't seem to compile the test program.  Guessing...)"
4257         rp="What is the size of your file offsets (in bytes)?"
4258         . ./myread
4259         lseeksize="$ans"
4260 fi
4261 $rm -f try.c try
4262
4263 : see what type file positions are declared as in the library
4264 rp="What is the type for file position used by fsetpos()?"
4265 set fpos_t fpostype long stdio.h sys/types.h
4266 eval $typedef_ask
4267
4268 echo " "
4269 case "$fpostype" in
4270 *_t) zzz="$fpostype"    ;;
4271 *)   zzz="fpos_t"       ;;
4272 esac
4273 $echo $n "Checking the size of $zzz...$c" >&4 
4274 cat > try.c <<EOCP
4275 #include <sys/types.h>
4276 #include <stdio.h>
4277 int main() {
4278     printf("%d\n", (int)sizeof($fpostype));
4279     exit(0);
4280 }
4281 EOCP
4282 set try
4283 if eval $compile_ok; then
4284         yyy=`./try`
4285         case "$yyy" in
4286         '')     fpossize=4
4287                 echo " "
4288                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4289                 ;;
4290         *)      fpossize=$yyy
4291                 echo " $fpossize bytes."
4292                 ;;
4293         esac
4294 else
4295         dflt="$longsize"
4296         echo " "
4297         echo "(I can't compile the test program.  Guessing...)" >&4
4298         rp="What is the size of your file positions (in bytes)?"
4299         . ./myread
4300         fpossize="$ans"
4301 fi
4302
4303
4304
4305 case "$lseeksize:$fpossize" in
4306 8:8) cat <<EOM
4307
4308 You can have files larger than 2 gigabytes.
4309 EOM
4310    val="$define" ;;
4311 *) cat <<EOM
4312
4313 Perl can be built to understand large files (files larger than 2 gigabytes)
4314 on some systems.  To do so, Configure must be run with -Duselargefiles.
4315
4316 If this doesn't make any sense to you, just accept the default 'y'.
4317 EOM
4318    case "$uselargefiles" in
4319    "$undef"|false|[nN]*) dflt='n' ;;
4320    *)   dflt='y' ;;
4321    esac
4322    rp='Try to understand large files, if available?'
4323    . ./myread
4324    case "$ans" in
4325    y|Y)         val="$define" ;;
4326    *)           val="$undef"  ;;
4327    esac
4328    ;;
4329 esac
4330 set uselargefiles
4331 eval $setvar
4332 case "$uselargefiles" in
4333 "$define")
4334 : Look for a hint-file generated 'call-back-unit'.  If the
4335 : user has specified that a large files perl is to be built,
4336 : we may need to set or change some other defaults.
4337         if $test -f uselfs.cbu; then
4338                 echo "Your platform has some specific hints for large file builds, using them..."
4339                 . ./uselfs.cbu
4340                 echo " "
4341                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4342                 $cat >try.c <<EOCP
4343 #include <sys/types.h>
4344 #include <stdio.h>
4345 int main()
4346 {
4347     printf("%d\n", (int)sizeof($lseektype));
4348     return(0); 
4349 }
4350 EOCP
4351                 set try
4352                 if eval $compile_ok; then
4353                         lseeksize=`./try`
4354                         $echo " $lseeksize bytes." >&4
4355                 else
4356                         dflt="$lseeksize"
4357                         echo " "
4358                         echo "(I can't seem to compile the test program.  Guessing...)"
4359                         rp="What is the size of your file offsets (in bytes)?"
4360                         . ./myread
4361                         lseeksize="$ans"
4362                 fi
4363                 case "$fpostype" in
4364                 *_t) zzz="$fpostype"    ;;
4365                 *)   zzz="fpos_t"       ;;
4366                 esac
4367                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4368                 $cat > try.c <<EOCP
4369 #include <sys/types.h>
4370 #include <stdio.h>
4371 int main() {
4372     printf("%d\n", (int)sizeof($fpostype));
4373     exit(0);
4374 }
4375 EOCP
4376                 set try
4377                 if eval $compile_ok; then
4378                         yyy=`./try`
4379                         dflt="$lseeksize"
4380                         case "$yyy" in
4381                         '')     echo " "
4382                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4383                                 ;;
4384                         *)      fpossize=$yyy
4385                                 echo " $fpossize bytes."
4386                                 ;;
4387                         esac
4388                 else
4389                         dflt="$fpossize"
4390                         echo " "
4391                         echo "(I can't compile the test program.  Guessing...)" >&4
4392                         rp="What is the size of your file positions (in bytes)?"
4393                         . ./myread
4394                         fpossize="$ans"
4395                 fi
4396                 $rm -f try.c try
4397         fi
4398         ;;
4399 esac
4400
4401
4402 case "$usemorebits" in
4403 "$define"|true|[yY]*)
4404         use64bits="$define"
4405         uselongdouble="$define"
4406         usemorebits="$define"
4407         ;;
4408 *)      usemorebits="$undef"
4409         ;;
4410 esac
4411
4412
4413 case "$intsize:$longsize" in
4414 8:*|*:8) cat <<EOM
4415
4416 You have natively 64-bit integers.
4417 EOM
4418    val="$define" ;;
4419 *) cat <<EOM
4420
4421 Perl can be built to take advantage of 64-bit integer types
4422 on some systems.  To do so, Configure must be run with -Duse64bits.
4423
4424 If this doesn't make any sense to you, just accept the default.
4425 EOM
4426   case "$use64bits" in
4427   $define|true|[yY]*)   dflt='y';;
4428   *) dflt='n';;
4429   esac
4430   rp='Try to use 64-bit integers, if available?'
4431   . ./myread
4432   case "$ans" in
4433   y|Y) val="$define" ;;
4434   *)   val="$undef"  ;;
4435   esac
4436   ;;
4437 esac
4438 set use64bits
4439 eval $setvar
4440
4441 case "$archname64" in
4442 '') archname64='' ;;    # not a typo
4443 esac
4444
4445 case "$use64bits" in
4446 "$define"|true|[yY]*)
4447 : Look for a hint-file generated 'call-back-unit'.  If the
4448 : user has specified that a 64-bit perl is to be built,
4449 : we may need to set or change some other defaults.
4450         if $test -f use64bits.cbu; then
4451                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4452                 . ./use64bits.cbu
4453         else
4454                 $cat <<EOM
4455 (Your platform doesn't have any specific hints for 64-bit builds.)
4456 EOM
4457                 case "$intsize:$longsize" in
4458 8:*|*:8) cat <<EOM
4459 (This is probably okay, as your system is a natively 64-bit system.)
4460 EOM
4461                   ;;
4462                 esac
4463                 case "$gccversion" in
4464                 '')     ;;
4465                 *)      case "$ccflags" in
4466                         *-DUSE_LONG_LONG*) ;;
4467                         *) $cat <<EOM
4468 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4469 to the compilation flags.
4470 EOM
4471                            ccflags="$ccflags -DUSE_LONG_LONG"
4472                            ;;
4473                         esac
4474                         ;;
4475                 esac
4476         fi
4477         ;;
4478 esac
4479
4480 : determine the architecture name
4481 echo " "
4482 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4483         tarch=`arch`"-$osname"
4484 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4485         if uname -m > tmparch 2>&1 ; then
4486                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4487                         -e 's/$/'"-$osname/" tmparch`
4488         else
4489                 tarch="$osname"
4490         fi
4491         $rm -f tmparch
4492 else
4493         tarch="$osname"
4494 fi
4495 case "$myarchname" in
4496 ''|"$tarch") ;;
4497 *)
4498         echo "(Your architecture name used to be $myarchname.)"
4499         archname=''
4500         ;;
4501 esac
4502 myarchname="$tarch"
4503 case "$archname" in
4504 '') dflt="$tarch";;
4505 *) dflt="$archname";;
4506 esac
4507 rp='What is your architecture name'
4508 . ./myread
4509 archname="$ans"
4510 case "$usethreads" in
4511 $define)
4512         echo "Threads selected." >&4
4513         case "$archname" in
4514         *-thread*) echo "...and architecture name already has -thread." >&4
4515                 ;;
4516         *)      archname="$archname-thread"
4517                 echo "...setting architecture name to $archname." >&4
4518                 ;;
4519         esac
4520         ;;
4521 esac
4522 case "$usemultiplicity" in
4523 $define)
4524         echo "Multiplicity selected." >&4
4525         case "$archname" in
4526         *-multi*) echo "...and architecture name already has -multi." >&4
4527                 ;;
4528         *)      archname="$archname-multi"
4529                 echo "...setting architecture name to $archname." >&4
4530                 ;;
4531         esac
4532         ;;
4533 esac
4534 case "$use64bits" in
4535 $define)
4536         case "$archname64" in
4537         '')
4538                 ;;
4539         *)
4540                 case "$archname" in
4541                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4542                         ;;
4543                 *)      archname="$archname-$archname64"
4544                         echo "...setting architecture name to $archname." >&4
4545                         ;;
4546                 esac
4547                 ;;
4548         esac
4549 esac
4550
4551 : determine root of directory hierarchy where package will be installed.
4552 case "$prefix" in
4553 '')
4554         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4555         ;;
4556 *)
4557         dflt="$prefix"
4558         ;;
4559 esac
4560 $cat <<EOM
4561
4562 By default, $package will be installed in $dflt/bin, manual pages
4563 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4564 installation directories. Typically this is something like /usr/local.
4565 If you wish to have binaries under /usr/bin but other parts of the
4566 installation under /usr/local, that's ok: you will be prompted
4567 separately for each of the installation directories, the prefix being
4568 only used to set the defaults.
4569
4570 EOM
4571 fn=d~
4572 rp='Installation prefix to use?'
4573 . ./getfile
4574 oldprefix=''
4575 case "$prefix" in
4576 '') ;;
4577 *)
4578         case "$ans" in
4579         "$prefix") ;;
4580         *) oldprefix="$prefix";;
4581         esac
4582         ;;
4583 esac
4584 prefix="$ans"
4585 prefixexp="$ansexp"
4586
4587 : is AFS running?
4588 echo " "
4589 case "$afs" in
4590 $define|true)   afs=true ;;
4591 $undef|false)   afs=false ;;
4592 *)      if test -d /afs; then
4593                 afs=true
4594         else
4595                 afs=false
4596         fi
4597         ;;
4598 esac
4599 if $afs; then
4600         echo "AFS may be running... I'll be extra cautious then..." >&4
4601 else
4602         echo "AFS does not seem to be running..." >&4
4603 fi
4604
4605 : determine installation prefix for where package is to be installed.
4606 if $afs; then 
4607 $cat <<EOM
4608
4609 Since you are running AFS, I need to distinguish the directory in which
4610 files will reside from the directory in which they are installed (and from
4611 which they are presumably copied to the former directory by occult means).
4612
4613 EOM
4614         case "$installprefix" in
4615         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4616         *) dflt="$installprefix";;
4617         esac
4618 else
4619 $cat <<EOM
4620
4621 In some special cases, particularly when building $package for distribution,
4622 it is convenient to distinguish between the directory in which files should 
4623 be installed from the directory ($prefix) in which they 
4624 will eventually reside.  For most users, these two directories are the same.
4625
4626 EOM
4627         case "$installprefix" in
4628         '') dflt=$prefix ;;
4629         *) dflt=$installprefix;;
4630         esac
4631 fi
4632 fn=d~
4633 rp='What installation prefix should I use for installing files?'
4634 . ./getfile
4635 installprefix="$ans"
4636 installprefixexp="$ansexp"
4637
4638 : set the prefixit variable, to compute a suitable default value
4639 prefixit='case "$3" in
4640 ""|none)
4641         case "$oldprefix" in
4642         "") eval "$1=\"\$$2\"";;
4643         *)
4644                 case "$3" in
4645                 "") eval "$1=";;
4646                 none)
4647                         eval "tp=\"\$$2\"";
4648                         case "$tp" in
4649                         ""|" ") eval "$1=\"\$$2\"";;
4650                         *) eval "$1=";;
4651                         esac;;
4652                 esac;;
4653         esac;;
4654 *)
4655         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4656         case "$tp" in
4657         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4658         /*-$oldprefix/*|\~*-$oldprefix/*)
4659                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4660         *) eval "$1=\"\$$2\"";;
4661         esac;;
4662 esac'
4663
4664 : set the base revision
4665 baserev=5.0
4666
4667
4668 : get the patchlevel
4669 echo " "
4670 echo "Getting the current patchlevel..." >&4
4671 if $test -r $rsrc/patchlevel.h;then
4672         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4673         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4674         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4675         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4676         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4677 else
4678         patchlevel=0
4679         subversion=0
4680         api_revision=0
4681         api_version=0
4682         api_subversion=0
4683 fi
4684 $echo $n "(You have $package" $c
4685 case "$package" in
4686 "*$baserev")    ;;
4687 *)              $echo $n " $baserev" $c ;;
4688 esac
4689 $echo $n " patchlevel $patchlevel" $c
4690 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4691 echo ".)"
4692 case "$osname" in
4693 dos|vms)
4694         : XXX Should be a Configure test for double-dots in filenames.
4695         version=`echo $baserev $patchlevel $subversion | \
4696                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4697         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4698                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4699         ;;
4700 *)
4701         version=`echo $baserev $patchlevel $subversion | \
4702                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4703         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4704                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4705         ;;
4706 esac
4707 : Special case the 5.005_xx maintenance series, which used 5.005
4708 : without any subversion label as a subdirectory in $sitelib
4709 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4710         api_versionstring='5.005'
4711 fi
4712
4713 : determine installation style
4714 : For now, try to deduce it from prefix unless it is already set.
4715 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4716 case "$installstyle" in
4717 '')     case "$prefix" in
4718                 *perl*) dflt='lib';;
4719                 *) dflt='lib/perl5' ;;
4720         esac
4721         ;;
4722 *)      dflt='lib/perl5' ;;
4723 esac
4724 : Probably not worth prompting for this since we prompt for all
4725 : the directories individually, and the prompt would be too long and
4726 : confusing anyway.
4727 installstyle=$dflt
4728
4729 : determine where private library files go
4730 : Usual default is /usr/local/lib/perl5/$version.
4731 : Also allow things like /opt/perl/lib/$version, since 
4732 : /opt/perl/lib/perl5... would be redundant.
4733 : The default "style" setting is made in installstyle.U
4734 case "$installstyle" in
4735 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4736 *)       set dflt privlib lib/$version ;;
4737 esac
4738 eval $prefixit
4739 $cat <<EOM
4740
4741 There are some auxiliary files for $package that need to be put into a
4742 private library directory that is accessible by everyone.
4743
4744 EOM
4745 fn=d~+
4746 rp='Pathname where the private library files will reside?'
4747 . ./getfile
4748 privlib="$ans"
4749 privlibexp="$ansexp"
4750 : Change installation prefix, if necessary.
4751 if $test X"$prefix" != X"$installprefix"; then
4752         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4753 else
4754         installprivlib="$privlibexp"
4755 fi
4756
4757 : set the prefixup variable, to restore leading tilda escape
4758 prefixup='case "$prefixexp" in
4759 "$prefix") ;;
4760 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4761 esac'
4762
4763 : determine where public architecture dependent libraries go
4764 set archlib archlib
4765 eval $prefixit
4766 : privlib default is /usr/local/lib/$package/$version
4767 : archlib default is /usr/local/lib/$package/$version/$archname
4768 : privlib may have an optional trailing /share.
4769 tdflt=`echo $privlib | $sed 's,/share$,,'`
4770 tdflt=$tdflt/$archname
4771 case "$archlib" in
4772 '')     dflt=$tdflt
4773         ;;
4774 *)      dflt="$archlib"
4775     ;;
4776 esac
4777 $cat <<EOM
4778
4779 $spackage contains architecture-dependent library files.  If you are
4780 sharing libraries in a heterogeneous environment, you might store
4781 these files in a separate location.  Otherwise, you can just include
4782 them with the rest of the public library files.
4783
4784 EOM
4785 fn=d+~
4786 rp='Where do you want to put the public architecture-dependent libraries?'
4787 . ./getfile
4788 archlib="$ans"
4789 archlibexp="$ansexp"
4790 if $test X"$archlib" = X"$privlib"; then
4791         d_archlib="$undef"
4792 else
4793         d_archlib="$define"
4794 fi
4795 : Change installation prefix, if necessary.
4796 if $test X"$prefix" != X"$installprefix"; then
4797         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4798 else
4799         installarchlib="$archlibexp"
4800 fi
4801
4802
4803 : Binary compatibility with 5.005 is not possible for builds
4804 : with advanced features
4805 case "$usethreads$usemultiplicity" in
4806 *define*)
4807         bincompat5005="$undef"
4808         d_bincompat5005="$undef"
4809         ;;
4810 *)      $cat <<EOM
4811
4812 Perl 5.006 can be compiled for binary compatibility with 5.005.
4813 If you decide to do so, you will be able to continue using most
4814 of the extensions that were compiled for Perl 5.005.
4815
4816 EOM
4817         case "$bincompat5005$d_bincompat5005" in
4818         *"$undef"*) dflt=n ;;
4819         *) dflt=y ;;
4820         esac
4821         rp='Binary compatibility with Perl 5.005?'
4822         . ./myread
4823         case "$ans" in
4824         y*) val="$define" ;;
4825         *)  val="$undef" ;;
4826         esac
4827         set d_bincompat5005
4828         eval $setvar
4829         case "$d_bincompat5005" in
4830         "$define")
4831                 bincompat5005="$define"
4832                 ;;
4833         *)      bincompat5005="$undef"
4834                 d_bincompat5005="$undef"
4835                 ;;
4836         esac
4837         ;;
4838 esac
4839
4840
4841 : see if setuid scripts can be secure
4842 $cat <<EOM
4843
4844 Some kernels have a bug that prevents setuid #! scripts from being
4845 secure.  Some sites have disabled setuid #! scripts because of this.
4846
4847 First let's decide if your kernel supports secure setuid #! scripts.
4848 (If setuid #! scripts would be secure but have been disabled anyway,
4849 don't say that they are secure if asked.)
4850
4851 EOM
4852
4853 val="$undef"
4854 if $test -d /dev/fd; then
4855         echo "#!$ls" >reflect
4856         chmod +x,u+s reflect
4857         ./reflect >flect 2>&1
4858         if $contains "/dev/fd" flect >/dev/null; then
4859                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4860                 val="$define"
4861         else
4862                 $cat <<EOM
4863 If you are not sure if they are secure, I can check but I'll need a
4864 username and password different from the one you are using right now.
4865 If you don't have such a username or don't want me to test, simply
4866 enter 'none'.
4867
4868 EOM
4869                 rp='Other username to test security of setuid scripts with?'
4870                 dflt='none'
4871                 . ./myread
4872                 case "$ans" in
4873                 n|none)
4874                         case "$d_suidsafe" in
4875                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4876                                 dflt=n;;
4877                         "$undef")
4878                                 echo "Well, the $hint value is *not* secure." >&4
4879                                 dflt=n;;
4880                         *)      echo "Well, the $hint value *is* secure." >&4
4881                                 dflt=y;;
4882                         esac
4883                         ;;
4884                 *)
4885                         $rm -f reflect flect
4886                         echo "#!$ls" >reflect
4887                         chmod +x,u+s reflect
4888                         echo >flect
4889                         chmod a+w flect
4890                         echo '"su" will (probably) prompt you for '"$ans's password."
4891                         su $ans -c './reflect >flect'
4892                         if $contains "/dev/fd" flect >/dev/null; then
4893                                 echo "Okay, it looks like setuid scripts are secure." >&4
4894                                 dflt=y
4895                         else
4896                                 echo "I don't think setuid scripts are secure." >&4
4897                                 dflt=n
4898                         fi
4899                         ;;
4900                 esac
4901                 rp='Does your kernel have *secure* setuid scripts?'
4902                 . ./myread
4903                 case "$ans" in
4904                 [yY]*)  val="$define";;
4905                 *)      val="$undef";;
4906                 esac
4907         fi
4908 else
4909         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4910         echo "(That's for file descriptors, not floppy disks.)"
4911         val="$undef"
4912 fi
4913 set d_suidsafe
4914 eval $setvar
4915
4916 $rm -f reflect flect
4917
4918 : now see if they want to do setuid emulation
4919 echo " "
4920 val="$undef"
4921 case "$d_suidsafe" in
4922 "$define")
4923         val="$undef"
4924         echo "No need to emulate SUID scripts since they are secure here." >& 4
4925         ;;
4926 *)
4927         $cat <<EOM
4928 Some systems have disabled setuid scripts, especially systems where
4929 setuid scripts cannot be secure.  On systems where setuid scripts have
4930 been disabled, the setuid/setgid bits on scripts are currently
4931 useless.  It is possible for $package to detect those bits and emulate
4932 setuid/setgid in a secure fashion.  This emulation will only work if
4933 setuid scripts have been disabled in your kernel.
4934
4935 EOM
4936         case "$d_dosuid" in
4937         "$define") dflt=y ;;
4938         *) dflt=n ;;
4939         esac
4940         rp="Do you want to do setuid/setgid emulation?"
4941         . ./myread
4942         case "$ans" in
4943         [yY]*)  val="$define";;
4944         *)      val="$undef";;
4945         esac
4946         ;;
4947 esac
4948 set d_dosuid
4949 eval $setvar
4950
4951 : determine filename position in cpp output
4952 echo " "
4953 echo "Computing filename position in cpp output for #include directives..." >&4
4954 echo '#include <stdio.h>' > foo.c
4955 $cat >fieldn <<EOF
4956 $startsh
4957 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4958 $grep '^[       ]*#.*stdio\.h' | \
4959 while read cline; do
4960         pos=1
4961         set \$cline
4962         while $test \$# -gt 0; do
4963                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4964                         echo "\$pos"
4965                         exit 0
4966                 fi
4967                 shift
4968                 pos=\`expr \$pos + 1\`
4969         done
4970 done
4971 EOF
4972 chmod +x fieldn
4973 fieldn=`./fieldn`
4974 $rm -f foo.c fieldn
4975 case $fieldn in
4976 '') pos='???';;
4977 1) pos=first;;
4978 2) pos=second;;
4979 3) pos=third;;
4980 *) pos="${fieldn}th";;
4981 esac
4982 echo "Your cpp writes the filename in the $pos field of the line."
4983
4984 : locate header file
4985 $cat >findhdr <<EOF
4986 $startsh
4987 wanted=\$1
4988 name=''
4989 for usrincdir in $usrinc
4990 do
4991         if test -f \$usrincdir/\$wanted; then
4992                 echo "\$usrincdir/\$wanted"
4993                 exit 0
4994         fi
4995 done
4996 awkprg='{ print \$$fieldn }'
4997 echo "#include <\$wanted>" > foo\$\$.c
4998 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4999 $grep "^[       ]*#.*\$wanted" | \
5000 while read cline; do
5001         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5002         case "\$name" in
5003         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5004         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5005         *) exit 2;;
5006         esac;
5007 done;
5008 #
5009 # status = 0: grep returned 0 lines, case statement not executed
5010 # status = 1: headerfile found
5011 # status = 2: while loop executed, no headerfile found
5012 #
5013 status=\$?
5014 $rm -f foo\$\$.c;
5015 if test \$status -eq 1; then
5016         exit 0;
5017 fi
5018 exit 1
5019 EOF
5020 chmod +x findhdr
5021
5022 : define an alternate in-header-list? function
5023 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5024 cont=true; xxf="echo \"<\$1> found.\" >&4";
5025 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5026 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5027 esac;
5028 case $# in 4) instead=instead;; *) instead="at last";; esac;
5029 while $test "$cont"; do
5030         xxx=`./findhdr $1`
5031         var=$2; eval "was=\$$2";
5032         if $test "$xxx" && $test -r "$xxx";
5033         then eval $xxf;
5034         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5035                 cont="";
5036         else eval $xxnf;
5037         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5038         set $yyy; shift; shift; yyy=$@;
5039         case $# in 0) cont="";;
5040         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5041                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5042         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5043                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5044         esac;
5045 done;
5046 while $test "$yyy";
5047 do set $yyy; var=$2; eval "was=\$$2";
5048         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5049         set $yyy; shift; shift; yyy=$@;
5050 done'
5051
5052 : see if this is a malloc.h system
5053 set malloc.h i_malloc
5054 eval $inhdr
5055
5056 : see if stdlib is available
5057 set stdlib.h i_stdlib
5058 eval $inhdr
5059
5060 : determine which malloc to compile in
5061 echo " "
5062 case "$usemymalloc" in
5063 ''|[yY]*|true|$define)  dflt='y' ;;
5064 *)      dflt='n' ;;
5065 esac
5066 rp="Do you wish to attempt to use the malloc that comes with $package?"
5067 . ./myread
5068 usemymalloc="$ans"
5069 case "$ans" in
5070 y*|true)
5071         usemymalloc='y'
5072         mallocsrc='malloc.c'
5073         mallocobj="malloc$_o"
5074         d_mymalloc="$define"
5075         case "$libs" in
5076         *-lmalloc*)
5077                 : Remove malloc from list of libraries to use
5078                 echo "Removing unneeded -lmalloc from library list" >&4
5079                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5080                 shift
5081                 libs="$*"
5082                 echo "libs = $libs" >&4
5083                 ;;
5084         esac
5085         ;;
5086 *)
5087         usemymalloc='n'
5088         mallocsrc=''
5089         mallocobj=''
5090         d_mymalloc="$undef"
5091         ;;
5092 esac
5093
5094 : compute the return types of malloc and free
5095 echo " "
5096 $cat >malloc.c <<END
5097 #$i_malloc I_MALLOC
5098 #$i_stdlib I_STDLIB
5099 #include <stdio.h>
5100 #include <sys/types.h>
5101 #ifdef I_MALLOC
5102 #include <malloc.h>
5103 #endif
5104 #ifdef I_STDLIB
5105 #include <stdlib.h>
5106 #endif
5107 #ifdef TRY_MALLOC
5108 void *malloc();
5109 #endif
5110 #ifdef TRY_FREE
5111 void free();
5112 #endif
5113 END
5114 case "$malloctype" in
5115 '')
5116         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5117                 malloctype='void *'
5118         else
5119                 malloctype='char *'
5120         fi
5121         ;;
5122 esac
5123 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5124
5125 case "$freetype" in
5126 '')
5127         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5128                 freetype='void'
5129         else
5130                 freetype='int'
5131         fi
5132         ;;
5133 esac
5134 echo "Your system uses $freetype free(), it would seem." >&4
5135 $rm -f malloc.[co]
5136 $cat <<EOM
5137
5138 The installation process will also create a directory for
5139 vendor-supplied add-ons.  Vendors who supply perl with their system
5140 may find it convenient to place all vendor-supplied files in this
5141 directory rather than in the main distribution directory.  This will
5142 ease upgrades between binary-compatible maintenance versions of perl.
5143
5144 Of course you may also use these directories in whatever way you see
5145 fit.  For example, you might use them to access modules shared over a
5146 company-wide network.
5147
5148 The default answer should be fine for most people.
5149 This causes further questions about vendor add-ons to be skipped
5150 and no vendor-specific directories will be configured for perl.
5151
5152 EOM
5153 rp='Do you want to configure vendor-specific add-on directories?'
5154 case "$usevendorprefix" in
5155 define|true|[yY]*) dflt=y ;;
5156 *) dflt=n ;;
5157 esac
5158 . ./myread
5159 case "$ans" in
5160 [yY]*)  fn=d~+
5161         rp='Installation prefix to use for vendor-supplied add-ons?'
5162         case "$vendorprefix" in
5163         '') dflt='' ;;
5164         *)  dflt=$vendorprefix ;;
5165         esac
5166         . ./getfile
5167         oldvendorprefix=''
5168         case "$vendorprefix" in
5169         '') ;;
5170         *)      case "$ans" in
5171                 "$prefix") ;;
5172                 *) oldvendorprefix="$prefix";;
5173                 esac
5174                 ;;
5175         esac
5176         usevendorprefix="$define"
5177         vendorprefix="$ans"
5178         vendorprefixexp="$ansexp"
5179         ;;
5180 *)      usevendorprefix="$undef"
5181         vendorprefix=''
5182         vendorprefixexp=''
5183         ;;
5184 esac
5185
5186 case "$vendorprefix" in
5187 '')     d_vendorlib="$undef"
5188         vendorlib=''
5189         vendorlibexp=''
5190         ;;
5191 *)      d_vendorlib="$define"
5192         : determine where vendor-supplied modules go.
5193         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5194         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5195         case "$installstyle" in
5196         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5197         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5198         esac
5199         fn=d~+
5200         rp='Pathname for the vendor-supplied library files?'
5201         . ./getfile
5202         vendorlib="$ans"
5203         vendorlibexp="$ansexp"
5204         : Change installation prefix, if necessary.
5205         if $test X"$prefix" != X"$installprefix"; then
5206                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5207         else
5208                 installvendorlib="$vendorlibexp"
5209         fi
5210         ;;
5211 esac
5212
5213 : Cruising for prototypes
5214 echo " "
5215 echo "Checking out function prototypes..." >&4
5216 $cat >prototype.c <<'EOCP'
5217 int main(int argc, char *argv[]) {
5218         exit(0);}
5219 EOCP
5220 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5221         echo "Your C compiler appears to support function prototypes."
5222         val="$define"
5223 else
5224         echo "Your C compiler doesn't seem to understand function prototypes."
5225         val="$undef"
5226 fi
5227 set prototype
5228 eval $setvar
5229 $rm -f prototype*
5230
5231 case "$prototype" in
5232 "$define") ;;
5233 *)      ansi2knr='ansi2knr'
5234         echo " "
5235         cat <<EOM >&4
5236
5237 $me:  FATAL ERROR:
5238 This version of $package can only be compiled by a compiler that 
5239 understands function prototypes.  Unfortunately, your C compiler 
5240         $cc $ccflags
5241 doesn't seem to understand them.  Sorry about that.
5242
5243 If GNU cc is available for your system, perhaps you could try that instead.  
5244
5245 Eventually, we hope to support building Perl with pre-ANSI compilers.
5246 If you would like to help in that effort, please contact <perlbug@perl.org>.
5247
5248 Aborting Configure now.
5249 EOM
5250         exit 2
5251         ;;
5252 esac
5253
5254 : determine where public executables go
5255 echo " "
5256 set dflt bin bin
5257 eval $prefixit
5258 fn=d~
5259 rp='Pathname where the public executables will reside?'
5260 . ./getfile
5261 if $test "X$ansexp" != "X$binexp"; then
5262         installbin=''
5263 fi
5264 bin="$ans"
5265 binexp="$ansexp"
5266 : Change installation prefix, if necessary.
5267 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5268 if $test X"$prefix" != X"$installprefix"; then
5269         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5270 else
5271         installbin="$binexp"
5272 fi
5273
5274 $cat <<EOM
5275
5276 After $package is installed, you may wish to install various
5277 add-on modules and utilities.  Typically, these add-ons will
5278 be installed under $prefix with the rest
5279 of this package.  However, you may wish to install such add-ons
5280 elsewhere under a different prefix.
5281
5282 If you do not wish to put everything under a single prefix, that's
5283 ok.  You will be prompted for the individual locations; this siteprefix
5284 is only used to suggest the defaults.
5285
5286 The default should be fine for most people.
5287
5288 EOM
5289 fn=d~+
5290 rp='Installation prefix to use for add-on modules and utilities?'
5291 : XXX Here might be another good place for an installstyle setting.
5292 case "$siteprefix" in
5293 '') dflt=$prefix ;;
5294 *)  dflt=$siteprefix ;;
5295 esac
5296 . ./getfile
5297 oldsiteprefix=''
5298 case "$siteprefix" in
5299 '') ;;
5300 *)
5301         case "$ans" in
5302         "$prefix") ;;
5303         *) oldsiteprefix="$prefix";;
5304         esac
5305         ;;
5306 esac
5307 siteprefix="$ans"
5308 siteprefixexp="$ansexp"
5309
5310 : determine where site specific libraries go.
5311 : Usual default is /usr/local/lib/perl5/site_perl/$version
5312 : The default "style" setting is made in installstyle.U
5313 : XXX No longer works with Prefixit stuff.
5314 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5315 case "$installstyle" in
5316 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5317 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5318 esac
5319 $cat <<EOM
5320
5321 The installation process will create a directory for
5322 site-specific extensions and modules.  Most users find it convenient
5323 to place all site-specific files in this directory rather than in the
5324 main distribution directory.
5325
5326 EOM
5327 fn=d~+
5328 rp='Pathname for the site-specific library files?'
5329 . ./getfile
5330 sitelib="$ans"
5331 sitelibexp="$ansexp"
5332 : Change installation prefix, if necessary.
5333 if $test X"$prefix" != X"$installprefix"; then
5334         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5335 else
5336         installsitelib="$sitelibexp"
5337 fi
5338
5339 : Determine list of previous versions to include in @INC
5340 $cat > getverlist <<EOPL
5341 #!$perl -w
5342 use File::Basename;
5343 \$api_versionstring = "$api_versionstring";
5344 \$version = "$version";
5345 \$sitelib = "$sitelib";
5346 \$archname = "$archname";
5347 EOPL
5348         $cat >> getverlist <<'EOPL'
5349 # Can't have leading @ because metaconfig interprets it as a command!
5350 ;@inc_version_list=();
5351 $stem=dirname($sitelib);
5352 # Redo to do opendir/readdir? 
5353 if (-d $stem) {
5354     chdir($stem);
5355     ;@candidates = glob("5.*");
5356 }
5357 else {
5358     ;@candidates = ();
5359 }
5360
5361 # XXX ToDo:  These comparisons must be reworked when two-digit
5362 # subversions come along, so that 5.7.10 compares as greater than
5363 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5364 # widespread that we can use the built-in version vectors rather
5365 # than reinventing them here.  For 5.6.0, however, we must
5366 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5367 foreach $d (@candidates) {
5368     if ($d lt $version) {
5369         if ($d ge $api_versionstring) {
5370             unshift(@inc_version_list, "$d/$archname", $d);
5371         }
5372         elsif ($d ge "5.005") {
5373             unshift(@inc_version_list, $d);
5374         }
5375     }
5376     else {
5377         # Skip newer version.  I.e. don't look in
5378         # 5.7.0 if we're installing 5.6.1.
5379     }
5380 }
5381
5382 if (@inc_version_list) {
5383     print join(' ', @inc_version_list);
5384 }
5385 else {
5386     # Blank space to preserve value for next Configure run.
5387     print " ";
5388 }
5389 EOPL
5390 chmod +x getverlist
5391 case "$inc_version_list" in
5392 '')     if test -x $perl; then
5393                 dflt=`$perl getverlist`
5394         else
5395                 dflt='none'
5396         fi
5397         ;;
5398 $undef) dflt='none' ;;
5399 *)  dflt="$inc_version_list" ;;
5400 esac
5401 $cat <<'EOM'
5402
5403 In order to ease the process of upgrading, this version of perl 
5404 can be configured to use modules built and installed with earlier 
5405 versions of perl that were installed under $prefix.  Specify here
5406 the list of earlier versions that this version of perl should check.
5407 If Configure detected no earlier versions of perl installed under
5408 $prefix, then the list will be empty.  Answer 'none' to tell perl
5409 to not search earlier versions.
5410
5411 The default should almost always be sensible, so if you're not sure,
5412 just accept the default.
5413 EOM
5414
5415 rp='List of earlier versions to include in @INC?'
5416 . ./myread
5417 case "$ans" in
5418 [Nn]one) inc_version_list=' ' ;;
5419 *) inc_version_list="$ans" ;;
5420 esac
5421 case "$inc_version_list" in
5422 ''|' ') 
5423         inc_version_list_init='""';;
5424 *)      inc_version_list_init=`echo $inc_version_list |
5425                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/"/'`
5426         ;;
5427 esac
5428 $rm -f getverlist
5429
5430 : determine whether to install perl also as /usr/bin/perl
5431
5432 echo " "
5433 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5434         $cat <<EOM
5435 Many scripts expect to perl to be installed as /usr/bin/perl.
5436 I can install the perl you are about to compile also as /usr/bin/perl
5437 (in addition to $installbin/perl).
5438 EOM
5439         case "$installusrbinperl" in
5440         "$undef"|[nN]*) dflt='n';;
5441         *)              dflt='y';;
5442         esac
5443         rp="Do you want to install perl as /usr/bin/perl?"
5444         . ./myread
5445         case "$ans" in
5446         [yY]*)  val="$define";;
5447         *)      val="$undef" ;;
5448         esac
5449 else
5450         val="$undef"
5451 fi
5452 set installusrbinperl
5453 eval $setvar
5454
5455 echo " "
5456 echo "Checking for GNU C Library..." >&4
5457 cat >gnulibc.c <<EOM
5458 #include <stdio.h>
5459 int main()
5460 {
5461 #ifdef __GLIBC__
5462     exit(0);
5463 #else
5464     exit(1);
5465 #endif
5466 }
5467 EOM
5468 set gnulibc
5469 if eval $compile_ok && ./gnulibc; then
5470         val="$define"
5471         echo "You are using the GNU C Library"
5472 else
5473         val="$undef"
5474         echo "You are not using the GNU C Library"
5475 fi
5476 $rm -f gnulibc*
5477 set d_gnulibc
5478 eval $setvar
5479
5480 : see if nm is to be used to determine whether a symbol is defined or not
5481 case "$usenm" in
5482 '')
5483         dflt=''
5484         case "$d_gnulibc" in
5485         "$define")
5486                 echo " "
5487                 echo "nm probably won't work on the GNU C Library." >&4
5488                 dflt=n
5489                 ;;
5490         esac
5491         case "$dflt" in
5492         '') 
5493                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5494                         echo " "
5495                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5496                         echo "'nm' won't be sufficient on this sytem." >&4
5497                         dflt=n
5498                 fi
5499                 ;;
5500         esac
5501         case "$dflt" in
5502         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5503                 if $test $dflt -gt 20; then
5504                         dflt=y
5505                 else
5506                         dflt=n
5507                 fi
5508                 ;;
5509         esac
5510         ;;
5511 *)
5512         case "$usenm" in
5513         true|$define) dflt=y;;
5514         *) dflt=n;;
5515         esac
5516         ;;
5517 esac
5518 $cat <<EOM
5519
5520 I can use $nm to extract the symbols from your C libraries. This
5521 is a time consuming task which may generate huge output on the disk (up
5522 to 3 megabytes) but that should make the symbols extraction faster. The
5523 alternative is to skip the 'nm' extraction part and to compile a small
5524 test program instead to determine whether each symbol is present. If
5525 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5526 this may be the best solution.
5527
5528 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5529
5530 EOM
5531 rp="Shall I use $nm to extract C symbols from the libraries?"
5532 . ./myread
5533 case "$ans" in
5534 [Nn]*) usenm=false;;
5535 *) usenm=true;;
5536 esac
5537
5538 runnm=$usenm
5539 case "$reuseval" in
5540 true) runnm=false;;
5541 esac
5542
5543 : nm options which may be necessary
5544 case "$nm_opt" in
5545 '') if $test -f /mach_boot; then
5546                 nm_opt=''       # Mach
5547         elif $test -d /usr/ccs/lib; then
5548                 nm_opt='-p'     # Solaris (and SunOS?)
5549         elif $test -f /dgux; then
5550                 nm_opt='-p'     # DG-UX
5551         elif $test -f /lib64/rld; then
5552                 nm_opt='-p'     # 64-bit Irix
5553         else
5554                 nm_opt=''
5555         fi;;
5556 esac
5557
5558 : nm options which may be necessary for shared libraries but illegal
5559 : for archive libraries.  Thank you, Linux.
5560 case "$nm_so_opt" in
5561 '')     case "$myuname" in
5562         *linux*)
5563                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5564                         nm_so_opt='--dynamic'
5565                 fi
5566                 ;;
5567         esac
5568         ;;
5569 esac
5570
5571 case "$runnm" in
5572 true)
5573 : get list of predefined functions in a handy place
5574 echo " "
5575 case "$libc" in
5576 '') libc=unknown
5577         case "$libs" in
5578         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5579         esac
5580         ;;
5581 esac
5582 libnames='';
5583 case "$libs" in
5584 '') ;;
5585 *)  for thislib in $libs; do
5586         case "$thislib" in
5587         -lc|-lc_s)
5588                 : Handle C library specially below.
5589                 ;;
5590         -l*)
5591                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5592                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5593                         :
5594                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5595                         :
5596                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5597                         :
5598                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5599                         :
5600                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5601                         :
5602                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5603                         :
5604                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5605                         :
5606                 else
5607                         try=''
5608                 fi
5609                 libnames="$libnames $try"
5610                 ;;
5611         *) libnames="$libnames $thislib" ;;
5612         esac
5613         done
5614         ;;
5615 esac
5616 xxx=normal
5617 case "$libc" in
5618 unknown)
5619         set /lib/libc.$so
5620         for xxx in $libpth; do
5621                 $test -r $1 || set $xxx/libc.$so
5622                 : The messy sed command sorts on library version numbers.
5623                 $test -r $1 || \
5624                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5625                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5626                                 h
5627                                 s/[0-9][0-9]*/0000&/g
5628                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5629                                 G
5630                                 s/\n/ /' | \
5631                          sort | $sed -e 's/^.* //'`
5632                 eval set \$$#
5633         done
5634         $test -r $1 || set /usr/ccs/lib/libc.$so
5635         $test -r $1 || set /lib/libsys_s$_a
5636         ;;
5637 *)
5638         set blurfl
5639         ;;
5640 esac
5641 if $test -r "$1"; then
5642         echo "Your (shared) C library seems to be in $1."
5643         libc="$1"
5644 elif $test -r /lib/libc && $test -r /lib/clib; then
5645         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5646         xxx=apollo
5647         libc='/lib/clib /lib/libc'
5648         if $test -r /lib/syslib; then
5649                 echo "(Your math library is in /lib/syslib.)"
5650                 libc="$libc /lib/syslib"
5651         fi
5652 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5653         echo "Your C library seems to be in $libc, as you said before."
5654 elif $test -r $incpath/usr/lib/libc$_a; then
5655         libc=$incpath/usr/lib/libc$_a;
5656         echo "Your C library seems to be in $libc.  That's fine."
5657 elif $test -r /lib/libc$_a; then
5658         libc=/lib/libc$_a;
5659         echo "Your C library seems to be in $libc.  You're normal."
5660 else
5661         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5662                 :
5663         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5664                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5665         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5666                 :
5667         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5668                 :
5669         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5670                 :
5671         else
5672                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5673         fi
5674         if $test -r "$tans"; then
5675                 echo "Your C library seems to be in $tans, of all places."
5676                 libc=$tans
5677         else
5678                 libc='blurfl'
5679         fi
5680 fi
5681 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5682         dflt="$libc"
5683         cat <<EOM
5684
5685 If the guess above is wrong (which it might be if you're using a strange
5686 compiler, or your machine supports multiple models), you can override it here.
5687
5688 EOM
5689 else
5690         dflt=''
5691         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5692         cat >&4 <<EOM
5693 I can't seem to find your C library.  I've looked in the following places:
5694
5695 EOM
5696         $sed 's/^/      /' libpath
5697         cat <<EOM
5698
5699 None of these seems to contain your C library. I need to get its name...
5700
5701 EOM
5702 fi
5703 fn=f
5704 rp='Where is your C library?'
5705 . ./getfile
5706 libc="$ans"
5707
5708 echo " "
5709 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5710 set X `cat libnames`
5711 shift
5712 xxx=files
5713 case $# in 1) xxx=file; esac
5714 echo "Extracting names from the following $xxx for later perusal:" >&4
5715 echo " "
5716 $sed 's/^/      /' libnames >&4
5717 echo " "
5718 $echo $n "This may take a while...$c" >&4
5719
5720 for file in $*; do
5721         case $file in
5722         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5723         *) $nm $nm_opt $file 2>/dev/null;;
5724         esac
5725 done >libc.tmp
5726
5727 $echo $n ".$c"
5728 $grep fprintf libc.tmp > libc.ptf
5729 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5730 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5731 xxx='[ADTSIW]'
5732 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5757                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5770         eval $xscan;\
5771         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772                 eval $xrun
5773 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5774         eval $xscan;\
5775         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5776                 eval $xrun
5777 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5778         eval $xscan;\
5779         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5780                 eval $xrun
5781 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5782         eval $xscan;\
5783         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5784                 eval $xrun
5785 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5786         eval $xscan;\
5787         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5788                 eval $xrun
5789 else
5790         $nm -p $* 2>/dev/null >libc.tmp
5791         $grep fprintf libc.tmp > libc.ptf
5792         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5793                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5794         then
5795                 nm_opt='-p'
5796                 eval $xrun
5797         else
5798                 echo " "
5799                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5800                 com=''
5801                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5802                         for thisname in $libnames $libc; do
5803                                 $ar t $thisname >>libc.tmp
5804                         done
5805                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5806                         echo "Ok." >&4
5807                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5808                         # Repeat libc to extract forwarders to DLL entries too
5809                         for thisname in $libnames $libc; do
5810                                 $ar tv $thisname >>libc.tmp
5811                                 # Revision 50 of EMX has bug in $ar.
5812                                 # it will not extract forwarders to DLL entries
5813                                 # Use emximp which will extract exactly them.
5814                                 emximp -o tmp.imp $thisname \
5815                                     2>/dev/null && \
5816                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5817                                     < tmp.imp >>libc.tmp
5818                                 $rm tmp.imp
5819                         done
5820                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5821                         echo "Ok." >&4
5822                 else
5823                         echo "$ar didn't seem to work right." >&4
5824                         echo "Maybe this is a Cray...trying bld instead..." >&4
5825                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5826                         then
5827                                 for thisname in $libnames; do
5828                                         bld t $libnames | \
5829                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5830                                         $ar t $thisname >>libc.tmp
5831                                 done
5832                                 echo "Ok." >&4
5833                         else
5834                                 echo "That didn't work either.  Giving up." >&4
5835                                 exit 1
5836                         fi
5837                 fi
5838         fi
5839 fi
5840 nm_extract="$com"
5841 if $test -f /lib/syscalls.exp; then
5842         echo " "
5843         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5844         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5845 fi
5846 ;;
5847 esac
5848 $rm -f libnames libpath
5849
5850 : see if dld is available
5851 set dld.h i_dld
5852 eval $inhdr
5853
5854 : is a C symbol defined?
5855 csym='tlook=$1;
5856 case "$3" in
5857 -v) tf=libc.tmp; tc=""; tdc="";;
5858 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5859 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5860 esac;
5861 tx=yes;
5862 case "$reuseval-$4" in
5863 true-) ;;
5864 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5865 esac;
5866 case "$tx" in
5867 yes)
5868         case "$runnm" in
5869         true)
5870                 if $contains $tlook $tf >/dev/null 2>&1;
5871                 then tval=true;
5872                 else tval=false;
5873                 fi;;
5874         *)
5875                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5876                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5877                 then tval=true;
5878                 else tval=false;
5879                 fi;
5880                 $rm -f t t.c;;
5881         esac;;
5882 *)
5883         case "$tval" in
5884         $define) tval=true;;
5885         *) tval=false;;
5886         esac;;
5887 esac;
5888 eval "$2=$tval"'
5889
5890 : define an is-in-libc? function
5891 inlibc='echo " "; td=$define; tu=$undef;
5892 sym=$1; var=$2; eval "was=\$$2";
5893 tx=yes;
5894 case "$reuseval$was" in
5895 true) ;;
5896 true*) tx=no;;
5897 esac;
5898 case "$tx" in
5899 yes)
5900         set $sym tres -f;
5901         eval $csym;
5902         case "$tres" in
5903         true)
5904                 echo "$sym() found." >&4;
5905                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5906         *)
5907                 echo "$sym() NOT found." >&4;
5908                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5909         esac;;
5910 *)
5911         case "$was" in
5912         $define) echo "$sym() found." >&4;;
5913         *) echo "$sym() NOT found." >&4;;
5914         esac;;
5915 esac'
5916
5917 : see if dlopen exists
5918 xxx_runnm="$runnm"
5919 runnm=false
5920 set dlopen d_dlopen
5921 eval $inlibc
5922 runnm="$xxx_runnm"
5923
5924 : determine which dynamic loading, if any, to compile in
5925 echo " "
5926 dldir="ext/DynaLoader"
5927 case "$usedl" in
5928 $define|y|true)
5929         dflt='y'
5930         usedl="$define"
5931         ;;
5932 $undef|n|false)
5933         dflt='n'
5934         usedl="$undef"
5935         ;;
5936 *) 
5937         dflt='n'
5938         case "$d_dlopen" in
5939             $define) dflt='y' ;;
5940         esac
5941         case "$i_dld" in
5942             $define) dflt='y' ;;
5943         esac
5944         : Does a dl_xxx.xs file exist for this operating system
5945         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5946         ;;
5947 esac
5948 rp="Do you wish to use dynamic loading?"
5949 . ./myread
5950 usedl="$ans"
5951 case "$ans" in
5952 y*) usedl="$define"
5953         case "$dlsrc" in
5954         '')
5955                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5956                         dflt="$dldir/dl_${osname}.xs"
5957                 elif $test "$d_dlopen" = "$define" ; then
5958                         dflt="$dldir/dl_dlopen.xs"
5959                 elif $test "$i_dld" = "$define" ; then
5960                         dflt="$dldir/dl_dld.xs"
5961                 else
5962                         dflt=''
5963                 fi
5964                 ;;
5965         *)      dflt="$dldir/$dlsrc"
5966                 ;;
5967         esac
5968     echo "The following dynamic loading files are available:"
5969         : Can not go over to $dldir because getfile has path hard-coded in.
5970         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5971         rp="Source file to use for dynamic loading"
5972         fn="fne"
5973         gfpth="$src"
5974         . ./getfile
5975         usedl="$define"
5976         : emulate basename
5977         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5978
5979         $cat << EOM
5980
5981 Some systems may require passing special flags to $cc -c to
5982 compile modules that will be used to create a shared library.
5983 To use no flags, say "none".
5984
5985 EOM
5986     case "$cccdlflags" in
5987     '') case "$gccversion" in
5988                 '') case "$osname" in
5989                         hpux)   dflt='+z' ;;
5990                         next)   dflt='none' ;;
5991                         irix*)  dflt='-KPIC' ;;
5992                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5993                         sunos)  dflt='-pic' ;;
5994                         *)      dflt='none' ;;
5995                     esac
5996                         ;;
5997                 *)  case "$osname" in
5998                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5999                         *)      dflt='-fpic' ;;
6000                     esac ;;
6001             esac ;;
6002         ' ') dflt='none' ;;
6003     *)  dflt="$cccdlflags" ;;
6004     esac
6005     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6006     . ./myread
6007     case "$ans" in
6008     none) cccdlflags=' ' ;;
6009     *) cccdlflags="$ans" ;;
6010     esac
6011
6012     cat << EOM
6013
6014 Some systems use ld to create libraries that can be dynamically loaded,
6015 while other systems (such as those using ELF) use $cc.
6016
6017 EOM
6018         case "$ld" in
6019         '')     $cat >try.c <<'EOM'
6020 /* Test for whether ELF binaries are produced */
6021 #include <fcntl.h>
6022 #include <stdlib.h>
6023 int main() {
6024         char b[4];
6025         int i = open("a.out",O_RDONLY);
6026         if(i == -1) 
6027                 exit(1); /* fail */
6028         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6029                 exit(0); /* succeed (yes, it's ELF) */
6030         else
6031                 exit(1); /* fail */
6032 }
6033 EOM
6034                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6035                         cat <<EOM
6036 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6037 EOM
6038                         dflt="$cc"
6039                 else
6040                         echo "I'll use ld to build dynamic libraries."
6041                         dflt='ld'
6042                 fi
6043                 rm -f try.c a.out
6044                 ;;
6045         *)      dflt="$ld"
6046                 ;;
6047         esac
6048
6049     rp="What command should be used to create dynamic libraries?"
6050     . ./myread
6051         ld="$ans"
6052
6053     cat << EOM
6054
6055 Some systems may require passing special flags to $ld to create a
6056 library that can be dynamically loaded.  If your ld flags include
6057 -L/other/path options to locate libraries outside your loader's normal
6058 search path, you may need to specify those -L options here as well.  To
6059 use no flags, say "none".
6060
6061 EOM
6062     case "$lddlflags" in
6063     '') case "$osname" in
6064                         beos) dflt='-nostart' ;;
6065                         hpux)  dflt='-b' ;;
6066                         linux|irix*)    dflt='-shared' ;;
6067                         next)  dflt='none' ;;
6068                         solaris) dflt='-G' ;;
6069                         sunos) dflt='-assert nodefinitions' ;;
6070                         svr4*|esix*) dflt="-G $ldflags" ;;
6071                 *)     dflt='none' ;;
6072                         esac
6073                         ;;
6074     *) dflt="$lddlflags" ;;
6075     esac
6076
6077         : Try to guess additional flags to pick up local libraries.
6078         : Be careful not to append to a plain 'none'
6079         case "$dflt" in
6080         none) dflt='' ;;
6081         esac
6082         for thisflag in $ldflags; do
6083                 case "$thisflag" in
6084                 -L*)
6085                         case " $dflt " in
6086                         *" $thisflag "*) ;;
6087                         *) dflt="$dflt $thisflag" ;;
6088                         esac
6089                         ;;
6090                 esac
6091         done
6092
6093         case "$dflt" in
6094         ''|' ') dflt='none' ;;
6095         esac
6096
6097     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6098     . ./myread
6099     case "$ans" in
6100     none) lddlflags=' ' ;;
6101     *) lddlflags="$ans" ;;
6102     esac
6103
6104         cat <<EOM
6105
6106 Some systems may require passing special flags to $cc to indicate that
6107 the resulting executable will use dynamic linking.  To use no flags,
6108 say "none".
6109
6110 EOM
6111     case "$ccdlflags" in
6112     '') case "$osname" in
6113                 hpux)   dflt='-Wl,-E' ;;
6114                 linux)  dflt='-rdynamic' ;;
6115                 next)   dflt='none' ;;
6116                 sunos)  dflt='none' ;;
6117                 *)      dflt='none' ;;
6118             esac ;;
6119     ' ')  dflt='none' ;;
6120     *)  dflt="$ccdlflags" ;;
6121     esac
6122     rp="Any special flags to pass to $cc to use dynamic linking?"
6123     . ./myread
6124     case "$ans" in
6125     none) ccdlflags=' ' ;;
6126     *) ccdlflags="$ans" ;;
6127     esac
6128     ;;
6129 *)  usedl="$undef"
6130         ld='ld'
6131     dlsrc='dl_none.xs'
6132     lddlflags=''
6133     ccdlflags=''
6134     ;;
6135 esac
6136
6137 also=''
6138 case "$usedl" in
6139 $undef)
6140         # No dynamic loading being used, so don't bother even to prompt.
6141         useshrplib='false'
6142         ;;
6143 *)      case "$useshrplib" in
6144         '')     case "$osname" in
6145                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6146                         dflt=y
6147                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6148                         ;;
6149                 next*)
6150                         case "$osvers" in
6151                         4*)     dflt=y
6152                                 also='Building a shared libperl is needed for MAB support.'
6153                                 ;;
6154                         *)      dflt=n
6155                                 ;;
6156                         esac
6157                         ;;
6158                 *)      dflt=n
6159                         ;;
6160                 esac
6161                 ;;
6162         $define|true|[Yy]*)
6163                 dflt=y
6164                 ;;
6165         *)      dflt=n
6166                 ;;
6167         esac
6168         $cat << EOM
6169
6170 The perl executable is normally obtained by linking perlmain.c with
6171 libperl${_a}, any static extensions (usually just DynaLoader), and
6172 any other libraries needed on this system (such as -lm, etc.).  Since
6173 your system supports dynamic loading, it is probably possible to build
6174 a shared libperl.$so.  If you will have more than one executable linked
6175 to libperl.$so, this will significantly reduce the size of each
6176 executable, but it may have a noticeable affect on performance.  The
6177 default is probably sensible for your system.
6178 $also
6179
6180 EOM
6181         rp="Build a shared libperl.$so (y/n)"
6182         . ./myread
6183         case "$ans" in
6184         true|$define|[Yy]*)
6185                 useshrplib='true'  ;;
6186         *)      useshrplib='false' ;;
6187         esac
6188         ;;
6189 esac
6190
6191 case "$useshrplib" in
6192 true)
6193         case "$libperl" in
6194         '')
6195                 # Figure out a good name for libperl.so.  Since it gets stored in
6196                 # a version-specific architecture-dependent library, the version
6197                 # number isn't really that important, except for making cc/ld happy.
6198                 #
6199                 # A name such as libperl.so.3.1
6200                 majmin="libperl.$so.$patchlevel.$subversion"
6201                 # A name such as libperl.so.301
6202                 majonly=`echo $patchlevel $subversion |
6203                         $awk '{printf "%d%02d", $1, $2}'`
6204                 majonly=libperl.$so.$majonly
6205                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6206                 # rely on figuring it out from the naming of libc.
6207                 case "${osname}${osvers}" in
6208                 next4*)
6209                         dflt=libperl.5.$so
6210                         # XXX How handle the --version stuff for MAB?
6211                         ;;
6212                 linux*)  # ld won't link with a bare -lperl otherwise.
6213                         dflt=libperl.$so
6214                         ;;
6215                 cygwin*) # include version
6216                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6217                         ;;
6218                 *)      # Try to guess based on whether libc has major.minor.
6219                         case "$libc" in
6220                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6221                         *libc.$so.[0-9]*) dflt=$majonly ;;
6222                         *)      dflt=libperl.$so ;;
6223                         esac
6224                         ;;
6225                 esac
6226                 ;;
6227         *)      dflt=$libperl
6228                 ;;
6229         esac
6230         cat << EOM
6231
6232 I need to select a good name for the shared libperl.  If your system uses
6233 library names with major and minor numbers, then you might want something
6234 like $majmin.  Alternatively, if your system uses a single version
6235 number for shared libraries, then you might want to use $majonly.
6236 Or, your system might be quite happy with a simple libperl.$so.
6237
6238 Since the shared libperl will get installed into a version-specific
6239 architecture-dependent directory, the version number of the shared perl
6240 library probably isn't important, so the default should be o.k.
6241
6242 EOM
6243         rp='What name do you want to give to the shared libperl?'
6244         . ./myread
6245         libperl=$ans
6246         echo "Ok, I'll use $libperl"
6247         ;;
6248 *)
6249         libperl="libperl${_a}"
6250         ;;
6251 esac
6252
6253 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6254 case "$shrpdir" in
6255 '') ;;
6256 *)      $cat >&4 <<EOM
6257 WARNING:  Use of the shrpdir variable for the installation location of
6258 the shared $libperl is not supported.  It was never documented and
6259 will not work in this version.  Let me (perlbug@perl.com)
6260 know of any problems this may cause.
6261
6262 EOM
6263         case "$shrpdir" in
6264         "$archlibexp/CORE")
6265                 $cat >&4 <<EOM
6266 But your current setting of $shrpdir is
6267 the default anyway, so it's harmless.
6268 EOM
6269                 ;;
6270         *)
6271                 $cat >&4 <<EOM
6272 Further, your current attempted setting of $shrpdir
6273 conflicts with the value of $archlibexp/CORE
6274 that installperl will use.
6275 EOM
6276                 ;;
6277         esac
6278         ;;
6279 esac
6280
6281 # How will the perl executable find the installed shared $libperl?
6282 # Add $xxx to ccdlflags.
6283 # If we can't figure out a command-line option, use $shrpenv to
6284 # set env LD_RUN_PATH.  The main perl makefile uses this.
6285 shrpdir=$archlibexp/CORE
6286 xxx=''
6287 tmp_shrpenv=''
6288 if "$useshrplib"; then
6289     case "$osname" in 
6290         aix)
6291                 # We'll set it in Makefile.SH...
6292                 ;;
6293         solaris|netbsd)
6294                 xxx="-R $shrpdir"
6295                 ;;
6296         freebsd)
6297                 xxx="-Wl,-R$shrpdir"
6298                 ;;
6299         linux|irix*|dec_osf)
6300                 xxx="-Wl,-rpath,$shrpdir"
6301                 ;;
6302         next)
6303                 # next doesn't like the default...
6304                 ;;
6305         beos)
6306                 # beos doesn't like the default, either.
6307                 ;;
6308         hpux*)
6309                 # hpux doesn't like the default, either.
6310                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6311                 ;;
6312         *)
6313                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6314                 ;;
6315         esac
6316         case "$xxx" in
6317         '') ;;
6318         *)      
6319                 # Only add $xxx if it isn't already in ccdlflags.
6320                 case " $ccdlflags " in
6321                 *" $xxx "*)     ;;
6322                 *)      ccdlflags="$ccdlflags $xxx"
6323                         cat <<EOM >&4
6324
6325 Adding $xxx to the flags
6326 passed to $ld so that the perl executable will find the 
6327 installed shared $libperl.
6328
6329 EOM
6330                         ;;
6331                 esac
6332                 ;;
6333         esac
6334 fi
6335 # Fix ccdlflags in AIX for building external extensions.
6336 # (For building Perl itself bare -bE:perl.exp is needed,
6337 #  Makefile.SH takes care of this.)
6338 case "$osname" in
6339 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6340 esac
6341 # Respect a hint or command-line value.
6342 case "$shrpenv" in
6343 '') shrpenv="$tmp_shrpenv" ;;
6344 esac
6345 case "$ldlibpthname" in
6346 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6347 none)   ldlibpthname='' ;;
6348 esac
6349
6350 : determine where manual pages go
6351 set man1dir man1dir none
6352 eval $prefixit
6353 $cat <<EOM
6354
6355 $spackage has manual pages available in source form.
6356 EOM
6357 case "$nroff" in
6358 nroff)
6359         echo "However, you don't have nroff, so they're probably useless to you."
6360         case "$man1dir" in
6361         '') man1dir="none";;
6362         esac;;
6363 esac
6364 echo "If you don't want the manual sources installed, answer 'none'."
6365 case "$man1dir" in
6366 ' ') dflt=none
6367         ;;
6368 '')
6369         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6370         lookpath="$lookpath $prefixexp/man/p_man/man1"
6371         lookpath="$lookpath $prefixexp/man/u_man/man1"
6372         lookpath="$lookpath $prefixexp/man/man.1"
6373         case "$sysman" in
6374         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6375         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6376         esac
6377         set dflt
6378         eval $prefixup
6379         ;;
6380 *)  dflt="$man1dir"
6381         ;;
6382 esac
6383 echo " "
6384 fn=dn+~
6385 rp="Where do the main $spackage manual pages (source) go?"
6386 . ./getfile
6387 if $test "X$man1direxp" != "X$ansexp"; then
6388         installman1dir=''
6389 fi
6390 man1dir="$ans"
6391 man1direxp="$ansexp"
6392 case "$man1dir" in
6393 '')     man1dir=' '
6394         installman1dir='';;
6395 esac
6396
6397 : Change installation prefix, if necessary.
6398 if $test X"$prefix" != X"$installprefix"; then
6399         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6400 else
6401         installman1dir="$man1direxp"
6402 fi
6403
6404 : What suffix to use on installed man pages
6405
6406 case "$man1dir" in
6407 ' ')
6408         man1ext='0'
6409         ;;
6410 *)
6411         rp="What suffix should be used for the main $spackage man pages?"
6412         case "$man1ext" in
6413         '')     case "$man1dir" in
6414                 *1)  dflt=1 ;;
6415                 *1p) dflt=1p ;;
6416                 *1pm) dflt=1pm ;;
6417                 *l) dflt=l;;
6418                 *n) dflt=n;;
6419                 *o) dflt=o;;
6420                 *p) dflt=p;;
6421                 *C) dflt=C;;
6422                 *L) dflt=L;;
6423                 *L1) dflt=L1;;
6424                 *) dflt=1;;
6425                 esac
6426                 ;;
6427         *)      dflt="$man1ext";;
6428         esac
6429         . ./myread
6430         man1ext="$ans"
6431         ;;
6432 esac
6433
6434 : see if we can have long filenames
6435 echo " "
6436 rmlist="$rmlist /tmp/cf$$"
6437 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6438 first=123456789abcdef
6439 second=/tmp/cf$$/$first
6440 $rm -f $first $second
6441 if (echo hi >$first) 2>/dev/null; then
6442         if $test -f 123456789abcde; then
6443                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6444                 val="$undef"
6445         else
6446                 if (echo hi >$second) 2>/dev/null; then
6447                         if $test -f /tmp/cf$$/123456789abcde; then
6448                                 $cat <<'EOM'
6449 That's peculiar... You can have filenames longer than 14 characters, but only
6450 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6451 I shall consider your system cannot support long filenames at all.
6452 EOM
6453                                 val="$undef"
6454                         else
6455                                 echo 'You can have filenames longer than 14 characters.' >&4
6456                                 val="$define"
6457                         fi
6458                 else
6459                         $cat <<'EOM'
6460 How confusing! Some of your filesystems are sane enough to allow filenames
6461 longer than 14 characters but some others like /tmp can't even think about them.
6462 So, for now on, I shall assume your kernel does not allow them at all.
6463 EOM
6464                         val="$undef"
6465                 fi
6466         fi
6467 else
6468         $cat <<'EOM'
6469 You can't have filenames longer than 14 chars.  You can't even think about them!
6470 EOM
6471         val="$undef"
6472 fi 
6473 set d_flexfnam
6474 eval $setvar
6475 $rm -rf /tmp/cf$$ 123456789abcde*
6476
6477 : determine where library module manual pages go
6478 set man3dir man3dir none
6479 eval $prefixit
6480 $cat <<EOM
6481
6482 $spackage has manual pages for many of the library modules.
6483 EOM
6484
6485 case "$nroff" in
6486 nroff)
6487         $cat <<'EOM'
6488 However, you don't have nroff, so they're probably useless to you.
6489 EOM
6490         case "$man3dir" in
6491         '') man3dir="none";;
6492         esac;;
6493 esac
6494
6495 case "$d_flexfnam" in
6496 undef)
6497         $cat <<'EOM'
6498 However, your system can't handle the long file names like File::Basename.3. 
6499 EOM
6500         case "$man3dir" in
6501         '') man3dir="none";;
6502         esac;;
6503 esac
6504
6505 echo "If you don't want the manual sources installed, answer 'none'."
6506 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6507 case "$man3dir" in
6508 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6509         if $test -d "$privlib/man/man3"; then
6510                 cat <<EOM >&4
6511
6512 WARNING:  Previous versions of perl installed man3 pages into
6513 $privlib/man/man3.  This version will suggest a 
6514 new default of $dflt.  
6515 EOM
6516                 tdflt=$dflt
6517                 dflt='n'
6518                 rp='Do you wish to preserve the old behavior?(y/n)'
6519                 . ./myread
6520                 case "$ans" in
6521                 y*) dflt="$privlib/man/man3" ;;
6522                 *)  dflt=$tdflt ;;
6523                 esac
6524     fi
6525         ;;
6526 ' ') dflt=none;;
6527 *)      dflt="$man3dir" ;;
6528 esac
6529 echo " "
6530 fn=dn+~
6531 rp="Where do the $package library man pages (source) go?"
6532 . ./getfile
6533 man3dir="$ans"
6534 man3direxp="$ansexp"
6535 case "$man1dir" in
6536 '')     man3dir=' '
6537         installman3dir='';;
6538 esac
6539
6540 : Change installation prefix, if necessary.
6541 if $test X"$prefix" != X"$installprefix"; then
6542         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6543 else
6544         installman3dir="$man3direxp"
6545 fi
6546
6547 : What suffix to use on installed man pages
6548 case "$man3dir" in
6549 ' ')
6550         man3ext='0'
6551         ;;
6552 *)
6553         rp="What suffix should be used for the $package library man pages?"
6554         case "$man3ext" in
6555         '')     case "$man3dir" in
6556                 *3)  dflt=3 ;;
6557                 *3p) dflt=3p ;;
6558                 *3pm) dflt=3pm ;;
6559                 *l) dflt=l;;
6560                 *n) dflt=n;;
6561                 *o) dflt=o;;
6562                 *p) dflt=p;;
6563                 *C) dflt=C;;
6564                 *L) dflt=L;;
6565                 *L3) dflt=L3;;
6566                 *) dflt=3;;
6567                 esac
6568                 ;;
6569         *)      dflt="$man3ext";;
6570         esac
6571         . ./myread
6572         man3ext="$ans"
6573         ;;
6574 esac
6575
6576 : see if we have to deal with yellow pages, now NIS.
6577 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6578         if $test -f /usr/etc/nibindd; then
6579                 echo " "
6580                 echo "I'm fairly confident you're on a NeXT."
6581                 echo " "
6582                 rp='Do you get the hosts file via NetInfo?'
6583                 dflt=y
6584                 case "$hostcat" in
6585                 nidump*) ;;
6586                 '') ;;
6587                 *) dflt=n;;
6588                 esac
6589                 . ./myread
6590                 case "$ans" in
6591                 y*) hostcat='nidump hosts .';;
6592                 *)      case "$hostcat" in
6593                         nidump*) hostcat='';;
6594                         esac
6595                         ;;
6596                 esac
6597         fi
6598         case "$hostcat" in
6599         nidump*) ;;
6600         *)
6601                 case "$hostcat" in
6602                 *ypcat*) dflt=y;;
6603                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6604                                 dflt=y
6605                         else
6606                                 dflt=n
6607                         fi;;
6608                 *) dflt=n;;
6609                 esac
6610                 echo " "
6611                 rp='Are you getting the hosts file via yellow pages?'
6612                 . ./myread
6613                 case "$ans" in
6614                 y*) hostcat='ypcat hosts';;
6615                 *) hostcat='cat /etc/hosts';;
6616                 esac
6617                 ;;
6618         esac
6619 fi
6620 case "$hostcat" in
6621 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6622 esac
6623 case "$groupcat" in
6624 '') test -f /etc/group && groupcat='cat /etc/group';;
6625 esac
6626 case "$passcat" in
6627 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6628 esac
6629
6630 : now get the host name
6631 echo " "
6632 echo "Figuring out host name..." >&4
6633 case "$myhostname" in
6634 '') cont=true
6635         echo 'Maybe "hostname" will work...'
6636         if tans=`sh -c hostname 2>&1` ; then
6637                 myhostname=$tans
6638                 phostname=hostname
6639                 cont=''
6640         fi
6641         ;;
6642 *) cont='';;
6643 esac
6644 if $test "$cont"; then
6645         if ./xenix; then
6646                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6647                 if tans=`cat /etc/systemid 2>&1` ; then
6648                         myhostname=$tans
6649                         phostname='cat /etc/systemid'
6650                         echo "Whadyaknow.  Xenix always was a bit strange..."
6651                         cont=''
6652                 fi
6653         elif $test -r /etc/systemid; then
6654                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6655         fi
6656 fi
6657 if $test "$cont"; then
6658         echo 'No, maybe "uuname -l" will work...'
6659         if tans=`sh -c 'uuname -l' 2>&1` ; then
6660                 myhostname=$tans
6661                 phostname='uuname -l'
6662         else
6663                 echo 'Strange.  Maybe "uname -n" will work...'
6664                 if tans=`sh -c 'uname -n' 2>&1` ; then
6665                         myhostname=$tans
6666                         phostname='uname -n'
6667                 else
6668                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6669                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6670                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6671                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6672                         else
6673                                 case "$myhostname" in
6674                                 '') echo "Does this machine have an identity crisis or something?"
6675                                         phostname='';;
6676                                 *)
6677                                         echo "Well, you said $myhostname before..."
6678                                         phostname='echo $myhostname';;
6679                                 esac
6680                         fi
6681                 fi
6682         fi
6683 fi
6684 : you do not want to know about this
6685 set $myhostname
6686 myhostname=$1
6687
6688 : verify guess
6689 if $test "$myhostname" ; then
6690         dflt=y
6691         rp='Your host name appears to be "'$myhostname'".'" Right?"
6692         . ./myread
6693         case "$ans" in
6694         y*) ;;
6695         *) myhostname='';;
6696         esac
6697 fi
6698
6699 : bad guess or no guess
6700 while $test "X$myhostname" = X ; do
6701         dflt=''
6702         rp="Please type the (one word) name of your host:"
6703         . ./myread
6704         myhostname="$ans"
6705 done
6706
6707 : translate upper to lower if necessary
6708 case "$myhostname" in
6709 *[A-Z]*)
6710         echo "(Normalizing case in your host name)"
6711         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6712         ;;
6713 esac
6714
6715 case "$myhostname" in
6716 *.*)
6717         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6718         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6719         echo "(Trimming domain name from host name--host name is now $myhostname)"
6720         ;;
6721 *) case "$mydomain" in
6722         '')
6723                 {
6724                         test "X$hostcat" = "Xypcat hosts" &&
6725                         ypmatch "$myhostname" hosts 2>/dev/null |\
6726                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6727                         $test -s hosts
6728                 } || {
6729                         test "X$hostcat" != "X" &&
6730                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6731                                         /[       ]$myhostname[  . ]/p" > hosts
6732                 }
6733                 tmp_re="[       . ]"
6734                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6735                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6736                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6737                         hosts | $sort | $uniq | \
6738                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6739                 case `$echo X$dflt` in
6740                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6741                         dflt=.
6742                         ;;
6743                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6744                         ;;
6745                 esac
6746                 case "$dflt" in
6747                 .)
6748                         tans=`./loc resolv.conf X /etc /usr/etc`
6749                         if $test -f "$tans"; then
6750                                 echo "(Attempting domain name extraction from $tans)"
6751                                 dflt=.`$sed -n -e 's/   / /g' \
6752                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6753                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6754                                 case "$dflt" in
6755                                 .) dflt=.`$sed -n -e 's/        / /g' \
6756                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6757                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6758                                         ;;
6759                                 esac
6760                         fi
6761                         ;;
6762                 esac
6763                 case "$dflt" in
6764                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6765                         dflt=.`sh -c domainname 2>/dev/null`
6766                         case "$dflt" in
6767                         '') dflt='.';;
6768                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6769                         esac
6770                         ;;
6771                 esac
6772                 case "$dflt" in
6773                 .) echo "(Lost all hope -- silly guess then)"
6774                         dflt='.uucp'
6775                         ;;
6776                 esac
6777                 $rm -f hosts
6778                 ;;
6779         *) dflt="$mydomain";;
6780         esac;;
6781 esac
6782 echo " "
6783 rp="What is your domain name?"
6784 . ./myread
6785 tans="$ans"
6786 case "$ans" in
6787 '') ;;
6788 .*) ;;
6789 *) tans=".$tans";;
6790 esac
6791 mydomain="$tans"
6792
6793 : translate upper to lower if necessary
6794 case "$mydomain" in
6795 *[A-Z]*)
6796         echo "(Normalizing case in your domain name)"
6797         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6798         ;;
6799 esac
6800
6801 : a little sanity check here
6802 case "$phostname" in
6803 '') ;;
6804 *)
6805         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6806         $myhostname$mydomain|$myhostname) ;;
6807         *)
6808                 case "$phostname" in
6809                 sed*)
6810                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6811                         ;;
6812                 *)
6813                         echo "(That doesn't agree with your $phostname command, by the way.)"
6814                         ;;
6815                 esac
6816         ;;
6817         esac
6818         ;;
6819 esac
6820
6821 $cat <<EOM
6822
6823 I need to get your e-mail address in Internet format if possible, i.e.
6824 something like user@host.domain. Please answer accurately since I have
6825 no easy means to double check it. The default value provided below
6826 is most probably close to reality but may not be valid from outside
6827 your organization...
6828
6829 EOM
6830 cont=x
6831 while test "$cont"; do
6832         case "$cf_email" in
6833         '') dflt="$cf_by@$myhostname$mydomain";;
6834         *) dflt="$cf_email";;
6835         esac
6836         rp='What is your e-mail address?'
6837         . ./myread
6838         cf_email="$ans"
6839         case "$cf_email" in
6840         *@*.*) cont='' ;;
6841         *)
6842                 rp='Address does not look like an Internet one.  Use it anyway?'
6843                 case "$fastread" in
6844                 yes) dflt=y ;;
6845                 *) dflt=n ;;
6846                 esac
6847                 . ./myread
6848                 case "$ans" in
6849                 y*) cont='' ;;
6850                 *) echo " " ;;
6851                 esac
6852                 ;;
6853         esac
6854 done
6855
6856 $cat <<EOM
6857
6858 If you or somebody else will be maintaining perl at your site, please
6859 fill in the correct e-mail address here so that they may be contacted
6860 if necessary. Currently, the "perlbug" program included with perl
6861 will send mail to this address in addition to perlbug@perl.com. You may
6862 enter "none" for no administrator.
6863
6864 EOM
6865 case "$perladmin" in
6866 '') dflt="$cf_email";;
6867 *) dflt="$perladmin";;
6868 esac
6869 rp='Perl administrator e-mail address'
6870 . ./myread
6871 perladmin="$ans"
6872
6873 : figure out how to guarantee perl startup
6874 case "$startperl" in
6875 '')
6876         case "$sharpbang" in
6877         *!)
6878                 $cat <<EOH
6879
6880 I can use the #! construct to start perl on your system. This will
6881 make startup of perl scripts faster, but may cause problems if you
6882 want to share those scripts and perl is not in a standard place
6883 ($binexp/perl) on all your platforms. The alternative is to force
6884 a shell by starting the script with a single ':' character.
6885
6886 EOH
6887                 dflt="$binexp/perl"
6888                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6889                 . ./myread
6890                 case "$ans" in
6891                 none)   startperl=": # use perl";;
6892                 *)      startperl="#!$ans"
6893                         if $test 30 -lt `echo "$ans" | wc -c`; then
6894                                 $cat >&4 <<EOM
6895
6896 WARNING:  Some systems limit the #! command to 32 characters.
6897 If you experience difficulty running Perl scripts with #!, try
6898 installing Perl in a directory with a shorter pathname.
6899
6900 EOM
6901                         fi ;;
6902                 esac
6903                 ;;
6904         *) startperl=": # use perl"
6905                 ;;
6906         esac
6907         ;;
6908 esac
6909 echo "I'll use $startperl to start perl scripts."
6910
6911 : figure best path for perl in scripts
6912 case "$perlpath" in
6913 '')
6914         perlpath="$binexp/perl"
6915         case "$startperl" in
6916         *!*) ;;
6917         *)
6918                 $cat <<EOH
6919
6920 I will use the "eval 'exec'" idiom to start Perl on your system.
6921 I can use the full path of your Perl binary for this purpose, but
6922 doing so may cause problems if you want to share those scripts and
6923 Perl is not always in a standard place ($binexp/perl).
6924
6925 EOH
6926                 dflt="$binexp/perl"
6927                 rp="What path shall I use in \"eval 'exec'\"?"
6928                 . ./myread
6929                 perlpath="$ans"
6930                 ;;
6931         esac
6932         ;;
6933 esac
6934 case "$startperl" in
6935 *!*)    ;;
6936 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6937 esac
6938
6939 : determine where public executable scripts go
6940 set scriptdir scriptdir
6941 eval $prefixit
6942 case "$scriptdir" in
6943 '')
6944         dflt="$bin"
6945         : guess some guesses
6946         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6947         $test -d /usr/share/bin     && dflt=/usr/share/bin
6948         $test -d /usr/local/script  && dflt=/usr/local/script
6949         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6950         $test -d $prefixexp/script  && dflt=$prefixexp/script
6951         set dflt
6952         eval $prefixup
6953         ;;
6954 *)  dflt="$scriptdir"
6955         ;;
6956 esac
6957 $cat <<EOM
6958  
6959 Some installations have a separate directory just for executable scripts so
6960 that they can mount it across multiple architectures but keep the scripts in
6961 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6962 Or you might just lump your scripts in with all your other executables.
6963  
6964 EOM
6965 fn=d~
6966 rp='Where do you keep publicly executable scripts?'
6967 . ./getfile
6968 if $test "X$ansexp" != "X$scriptdirexp"; then
6969         installscript=''
6970 fi
6971 scriptdir="$ans"
6972 scriptdirexp="$ansexp"
6973 : Change installation prefix, if necessary.
6974 if $test X"$prefix" != X"$installprefix"; then
6975         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6976 else
6977         installscript="$scriptdirexp"
6978 fi
6979
6980 : determine where site specific architecture-dependent libraries go.
6981 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6982 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6983 : sitelib may have an optional trailing /share.
6984 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6985 tdflt="$tdflt/$archname"
6986 set sitearch sitearch none
6987 eval $prefixit
6988 case "$sitearch" in
6989 '')     dflt="$tdflt" ;;
6990 *)      dflt="$sitearch" ;;
6991 esac
6992 $cat <<EOM
6993
6994 The installation process will also create a directory for
6995 architecture-dependent site-specific extensions and modules.
6996
6997 EOM
6998 fn=nd~+
6999 rp='Pathname for the site-specific architecture-dependent library files?'
7000 . ./getfile
7001 sitearch="$ans"
7002 sitearchexp="$ansexp"
7003 : Change installation prefix, if necessary.
7004 if $test X"$prefix" != X"$installprefix"; then
7005         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7006 else
7007         installsitearch="$sitearchexp"
7008 fi
7009
7010 : determine where add-on public executables go
7011 case "$sitebin" in
7012 '')     dflt=$siteprefix/bin ;;
7013 *)      dflt=$sitebin ;;
7014 esac
7015 fn=d~
7016 rp='Pathname where the add-on public executables should be installed?'
7017 . ./getfile
7018 sitebin="$ans"
7019 sitebinexp="$ansexp"
7020 : Change installation prefix, if necessary.
7021 if $test X"$prefix" != X"$installprefix"; then
7022         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7023 else
7024         installsitebin="$sitebinexp"
7025 fi
7026
7027 cat <<EOM
7028
7029 Perl can be built to take advantage of long doubles which
7030 (if available) may give more accuracy and range for floating point numbers.
7031
7032 If this doesn't make any sense to you, just accept the default 'n'.
7033 EOM
7034
7035 case "$ccflags" in
7036 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7037 esac
7038
7039 case "$uselongdouble" in
7040 $define|true|[yY]*)     dflt='y';;
7041 *) dflt='n';;
7042 esac
7043 rp='Try to use long doubles if available?'
7044 . ./myread
7045 case "$ans" in
7046 y|Y)    val="$define"   ;;
7047 *)      val="$undef"    ;;
7048 esac
7049 set uselongdouble
7050 eval $setvar
7051
7052 case "$uselongdouble" in
7053 true|[yY]*) uselongdouble="$define" ;;
7054 esac
7055
7056 case "$uselongdouble" in
7057 $define)
7058 : Look for a hint-file generated 'call-back-unit'.  If the
7059 : user has specified that long doubles should be used,
7060 : we may need to set or change some other defaults.
7061         if $test -f uselongdouble.cbu; then
7062                 echo "Your platform has some specific hints for long doubles, using them..."
7063                 . ./uselongdouble.cbu
7064         else
7065                 $cat <<EOM
7066 (Your platform doesn't have any specific hints for long doubles.)
7067 EOM
7068         fi
7069         ;;
7070 esac
7071
7072 cat <<EOM
7073
7074 Perl can be built to take advantage of long longs which
7075 (if available) may give more range for integer numbers.
7076
7077 If this doesn't make any sense to you, just accept the default 'n'.
7078 EOM
7079
7080 case "$ccflags" in
7081 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7082 esac
7083
7084 case "$uselonglong" in
7085 $define|true|[yY]*)     dflt='y';;
7086 *) dflt='n';;
7087 esac
7088 rp='Try to use long longs if available?'
7089 . ./myread
7090 case "$ans" in
7091 y|Y)    val="$define"   ;;
7092 *)      val="$undef"    ;;
7093 esac
7094 set uselonglong
7095 eval $setvar
7096
7097 case "$uselonglong" in
7098 true|[yY]*) uselonglong="$define" ;;
7099 esac
7100
7101 case "$uselonglong" in
7102 $define)
7103 : Look for a hint-file generated 'call-back-unit'.  If the
7104 : user has specified that long longs should be used,
7105 : we may need to set or change some other defaults.
7106         if $test -f uselonglong.cbu; then
7107                 echo "Your platform has some specific hints for long longs, using them..."
7108                 . ./uselonglong.cbu
7109         else
7110                 $cat <<EOM
7111 (Your platform doesn't have any specific hints for long longs.)
7112 EOM
7113         fi
7114         ;;
7115 esac
7116
7117 cat <<EOM
7118
7119 Previous version of $package used the standard IO mechanisms as defined
7120 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7121 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7122 the default.  This abstraction layer can use AT&T's sfio (if you already
7123 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7124 problems with some extension modules.  Using PerlIO with stdio is safe,
7125 but it is slower than plain stdio and therefore is not the default.
7126
7127 If this doesn't make any sense to you, just accept the default 'n'.
7128 EOM
7129 case "$useperlio" in
7130 $define|true|[yY]*)     dflt='y';;
7131 *) dflt='n';;
7132 esac
7133 rp='Use the experimental PerlIO abstraction layer?'
7134 . ./myread
7135 case "$ans" in
7136 y|Y) 
7137         val="$define"
7138         ;;     
7139 *)      
7140         echo "Ok, doing things the stdio way"
7141         val="$undef"
7142         ;;
7143 esac
7144 set useperlio
7145 eval $setvar 
7146
7147 case "$vendorprefix" in
7148 '')     d_vendorbin="$undef"
7149         vendorbin=''
7150         vendorbinexp=''
7151         ;;
7152 *)      d_vendorbin="$define"
7153         : determine where vendor-supplied executables go.
7154         dflt=$vendorprefix/bin
7155         fn=d~+
7156         rp='Pathname for the vendor-supplied executables directory?'
7157         . ./getfile
7158         vendorbin="$ans"
7159         vendorbinexp="$ansexp"
7160         : Change installation prefix, if necessary.
7161         if $test X"$prefix" != X"$installprefix"; then
7162                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7163         else
7164                 installvendorbin="$vendorbinexp"
7165         fi
7166         ;;
7167 esac
7168
7169 : check for length of double
7170 echo " "
7171 case "$doublesize" in
7172 '')
7173         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7174         $cat >try.c <<'EOCP'
7175 #include <stdio.h>
7176 int main()
7177 {
7178     printf("%d\n", (int)sizeof(double));
7179     exit(0);
7180 }
7181 EOCP
7182         set try
7183         if eval $compile_ok; then
7184                 doublesize=`./try`
7185                 $echo " $doublesize bytes." >&4
7186         else
7187                 dflt='8'
7188                 echo "(I can't seem to compile the test program.  Guessing...)"
7189                 rp="What is the size of a double precision number (in bytes)?"
7190                 . ./myread
7191                 doublesize="$ans"
7192         fi
7193         ;;
7194 esac
7195 $rm -f try.c try
7196
7197 : check for long doubles
7198 echo " "
7199 $echo $n "Checking to see if your system supports long double..." $c >&4
7200 echo 'int main() { long double x = 7.0; }' > try.c
7201 set try
7202 if eval $compile; then
7203         val="$define"
7204         echo " Yes, it does." >&4
7205 else
7206         val="$undef"
7207         echo " No, it doesn't." >&4
7208 fi
7209 $rm try.*
7210 set d_longdbl
7211 eval $setvar
7212
7213 : check for length of long double
7214 case "${d_longdbl}${longdblsize}" in
7215 $define)
7216         echo " "
7217         $echo $n "Checking to see how big your long doubles are..." $c >&4
7218         $cat >try.c <<'EOCP'
7219 #include <stdio.h>
7220 int main()
7221 {
7222         printf("%d\n", sizeof(long double));
7223 }
7224 EOCP
7225         set try
7226         set try
7227         if eval $compile; then
7228                 longdblsize=`./try$exe_ext`
7229                 $echo " $longdblsize bytes." >&4
7230         else
7231                 dflt='8'
7232                 echo " "
7233                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7234                 rp="What is the size of a long double (in bytes)?"
7235                 . ./myread
7236                 longdblsize="$ans"
7237         fi
7238         if $test "X$doublesize" = "X$longdblsize"; then
7239                 echo "(That isn't any different from an ordinary double.)"
7240         fi      
7241         ;;
7242 esac
7243 $rm -f try.* try
7244
7245 : Check how to convert floats to strings.
7246 if test "X$d_Gconvert" = X; then
7247         echo " "
7248         echo "Checking for an efficient way to convert floats to strings."
7249         $cat >try.c <<EOP
7250 #ifdef TRY_gconvert
7251 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7252 char *myname = "gconvert";
7253 #endif
7254 #ifdef TRY_gcvt
7255 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7256 char *myname = "gcvt";
7257 #endif
7258 #ifdef TRY_qgcvt
7259 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7260 char *myname = "qgcvt";
7261 #define DOUBLETYPE long double
7262 #endif
7263 #ifdef TRY_sprintf
7264 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7265 char *myname = "sprintf";
7266 #endif
7267
7268 #ifndef DOUBLETYPE
7269 #define DOUBLETYPE double
7270 #endif
7271
7272 #include <stdio.h>
7273
7274 #ifdef I_STDLIB
7275 #include <stdlib.h>
7276 #endif
7277
7278 int
7279 checkit(expect, got)
7280 char *expect;
7281 char *got;
7282 {
7283     if (strcmp(expect, got)) {
7284                 printf("%s oddity:  Expected %s, got %s\n",
7285                         myname, expect, got);
7286                 exit(1);
7287         }
7288 }
7289
7290 int main()
7291
7292         char buf[64]; 
7293         buf[63] = '\0';
7294
7295         /* This must be 1st test on (which?) platform */
7296         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7297         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7298         checkit("0.1", buf);
7299
7300         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7301         checkit("1", buf);
7302
7303         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7304         checkit("0", buf);
7305
7306         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7307         checkit("-1", buf);
7308
7309         /* Some Linux gcvt's give 1.e+5 here. */
7310         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7311         checkit("100000", buf);
7312         
7313         /* Some Linux gcvt's give -1.e+5 here. */
7314         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7315         checkit("-100000", buf);
7316
7317         exit(0);
7318 }
7319 EOP
7320         case "$d_Gconvert" in
7321         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7322         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7323         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7324         *) xxx_list='gconvert gcvt sprintf' ;;
7325         esac
7326
7327         case "$d_longdbl$uselongdouble" in
7328         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7329         esac
7330
7331         for xxx_convert in $xxx_list; do
7332                 echo "Trying $xxx_convert..."
7333                 $rm -f try try$_o
7334                 set try -DTRY_$xxx_convert
7335                 if eval $compile; then
7336                         echo "$xxx_convert() found." >&4
7337                         if ./try; then
7338                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7339                                 break;
7340                         else
7341                                 echo "...But $xxx_convert didn't work as I expected."
7342                         fi
7343                 else
7344                         echo "$xxx_convert NOT found." >&4
7345                 fi
7346         done
7347                 
7348         case "$xxx_convert" in
7349         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7350         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7351         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7352         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7353         esac
7354 fi
7355
7356 echo " "
7357
7358 if $test X"$d_longdbl" = X"$define"; then
7359
7360 echo "Checking how to print long doubles..." >&4
7361
7362 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7363         $cat >try.c <<'EOCP'
7364 #include <sys/types.h>
7365 #include <stdio.h>
7366 int main() {
7367   double d = 123.456;
7368   printf("%.3f\n", d);
7369 }
7370 EOCP
7371         set try
7372         if eval $compile; then
7373                 yyy=`./try$exe_ext`
7374                 case "$yyy" in
7375                 123.456)
7376                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7377                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7378                         echo "We will use %f."
7379                         ;;
7380                 esac
7381         fi
7382 fi
7383
7384 if $test X"$sPRIfldbl" = X; then
7385         $cat >try.c <<'EOCP'
7386 #include <sys/types.h>
7387 #include <stdio.h>
7388 int main() {
7389   long double d = 123.456;
7390   printf("%.3llf\n", d);
7391 }
7392 EOCP
7393         set try
7394         if eval $compile; then
7395                 yyy=`./try$exe_ext`
7396                 case "$yyy" in
7397                 123.456)
7398                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7399                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7400                         echo "We will use %llf."
7401                         ;;
7402                 esac
7403         fi
7404 fi
7405
7406 if $test X"$sPRIfldbl" = X; then
7407         $cat >try.c <<'EOCP'
7408 #include <sys/types.h>
7409 #include <stdio.h>
7410 int main() {
7411   long double d = 123.456;
7412   printf("%.3Lf\n", d);
7413 }
7414 EOCP
7415         set try
7416         if eval $compile; then
7417                 yyy=`./try$exe_ext`
7418                 case "$yyy" in
7419                 123.456)
7420                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7421                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7422                         echo "We will use %Lf."
7423                         ;;
7424                 esac
7425         fi
7426 fi
7427
7428 if $test X"$sPRIfldbl" = X; then
7429         $cat >try.c <<'EOCP'
7430 #include <sys/types.h>
7431 #include <stdio.h>
7432 int main() {
7433   long double d = 123.456;
7434   printf("%.3lf\n", d);
7435 }
7436 EOCP
7437         set try
7438         if eval $compile; then
7439                 yyy=`./try$exe_ext`
7440                 case "$yyy" in
7441                 123.456)
7442                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7443                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7444                         echo "We will use %lf."
7445                         ;;
7446                 esac
7447         fi
7448 fi
7449
7450 if $test X"$sPRIfldbl" = X; then
7451         echo "Cannot figure out how to print long doubles." >&4
7452 fi
7453
7454 $rm -f try try.*
7455
7456 fi # d_longdbl
7457
7458 case "$sPRIfldbl" in
7459 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7460         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7461         ;;
7462 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7463         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7464         ;;
7465 esac
7466
7467 : Initialize h_fcntl
7468 h_fcntl=false
7469
7470 : Initialize h_sysfile
7471 h_sysfile=false
7472
7473 : access call always available on UNIX
7474 set access d_access
7475 eval $inlibc
7476
7477 : locate the flags for 'access()'
7478 case "$d_access" in
7479 "$define")
7480         echo " "
7481         $cat >access.c <<'EOCP'
7482 #include <sys/types.h>
7483 #ifdef I_FCNTL
7484 #include <fcntl.h>
7485 #endif
7486 #ifdef I_SYS_FILE
7487 #include <sys/file.h>
7488 #endif
7489 #ifdef I_UNISTD
7490 #include <unistd.h>
7491 #endif
7492 int main() {
7493         exit(R_OK);
7494 }
7495 EOCP
7496         : check sys/file.h first, no particular reason here
7497         if $test `./findhdr sys/file.h` && \
7498                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7499                 h_sysfile=true;
7500                 echo "<sys/file.h> defines the *_OK access constants." >&4
7501         elif $test `./findhdr fcntl.h` && \
7502                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7503                 h_fcntl=true;
7504                 echo "<fcntl.h> defines the *_OK access constants." >&4
7505         elif $test `./findhdr unistd.h` && \
7506                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7507                 echo "<unistd.h> defines the *_OK access constants." >&4
7508         else
7509                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7510         fi
7511         ;;
7512 esac
7513 $rm -f access*
7514
7515 : see if accessx exists
7516 set accessx d_accessx
7517 eval $inlibc
7518
7519 : see if alarm exists
7520 set alarm d_alarm
7521 eval $inlibc
7522
7523 : see if atolf exists
7524 set atolf d_atolf
7525 eval $inlibc
7526
7527 : see if atoll exists
7528 set atoll d_atoll
7529 eval $inlibc
7530
7531 : Look for GNU-cc style attribute checking
7532 echo " "
7533 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7534 $cat >attrib.c <<'EOCP'
7535 #include <stdio.h>
7536 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7537 EOCP
7538 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7539         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7540                 echo "Your C compiler doesn't fully support __attribute__."
7541                 val="$undef"
7542         else
7543                 echo "Your C compiler supports __attribute__."
7544                 val="$define"
7545         fi
7546 else
7547         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7548         val="$undef"
7549 fi
7550 set d_attribut
7551 eval $setvar
7552 $rm -f attrib*
7553
7554 : see if bcmp exists
7555 set bcmp d_bcmp
7556 eval $inlibc
7557
7558 : see if bcopy exists
7559 set bcopy d_bcopy
7560 eval $inlibc
7561
7562 : see if this is a unistd.h system
7563 set unistd.h i_unistd
7564 eval $inhdr
7565
7566 : see if getpgrp exists
7567 set getpgrp d_getpgrp
7568 eval $inlibc
7569
7570 case "$d_getpgrp" in
7571 "$define")
7572         echo " "
7573         echo "Checking to see which flavor of getpgrp is in use..."
7574         $cat >set.c <<EOP
7575 #$i_unistd I_UNISTD
7576 #include <sys/types.h>
7577 #ifdef I_UNISTD
7578 #  include <unistd.h>
7579 #endif
7580 int main()
7581 {
7582         if (getuid() == 0) {
7583                 printf("(I see you are running Configure as super-user...)\n");
7584                 setuid(1);
7585         }
7586 #ifdef TRY_BSD_PGRP
7587         if (getpgrp(1) == 0)
7588                 exit(0);
7589 #else
7590         if (getpgrp() > 0)
7591                 exit(0);
7592 #endif
7593         exit(1);
7594 }
7595 EOP
7596         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7597                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7598                 val="$define"
7599         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7600                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7601                 val="$undef"
7602         else
7603                 echo "I can't seem to compile and run the test program."
7604                 if ./usg; then
7605                         xxx="a USG one, i.e. you use getpgrp()."
7606                 else
7607                         # SVR4 systems can appear rather BSD-ish.
7608                         case "$i_unistd" in
7609                         $undef)
7610                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7611                                 val="$define"
7612                                 ;;
7613                         $define)
7614                                 xxx="probably a USG one, i.e. you use getpgrp()."
7615                                 val="$undef"
7616                                 ;;
7617                         esac
7618                 fi
7619                 echo "Assuming your getpgrp is $xxx" >&4
7620         fi
7621         ;;
7622 *) val="$undef";;
7623 esac
7624 set d_bsdgetpgrp
7625 eval $setvar
7626 $rm -f set set.c
7627
7628 : see if setpgrp exists
7629 set setpgrp d_setpgrp
7630 eval $inlibc
7631
7632 case "$d_setpgrp" in
7633 "$define")
7634         echo " "
7635         echo "Checking to see which flavor of setpgrp is in use..."
7636         $cat >set.c <<EOP
7637 #$i_unistd I_UNISTD
7638 #include <sys/types.h>
7639 #ifdef I_UNISTD
7640 #  include <unistd.h>
7641 #endif
7642 int main()
7643 {
7644         if (getuid() == 0) {
7645                 printf("(I see you are running Configure as super-user...)\n");
7646                 setuid(1);
7647         }
7648 #ifdef TRY_BSD_PGRP
7649         if (-1 == setpgrp(1, 1))
7650                 exit(0);
7651 #else
7652         if (setpgrp() != -1)
7653                 exit(0);
7654 #endif
7655         exit(1);
7656 }
7657 EOP
7658         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7659                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7660                 val="$define"
7661         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7662                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7663                 val="$undef"
7664         else
7665                 echo "(I can't seem to compile and run the test program.)"
7666                 if ./usg; then
7667                         xxx="a USG one, i.e. you use setpgrp()."
7668                 else
7669                         # SVR4 systems can appear rather BSD-ish.
7670                         case "$i_unistd" in
7671                         $undef)
7672                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7673                                 val="$define"
7674                                 ;;
7675                         $define)
7676                                 xxx="probably a USG one, i.e. you use setpgrp()."
7677                                 val="$undef"
7678                                 ;;
7679                         esac
7680                 fi
7681                 echo "Assuming your setpgrp is $xxx" >&4
7682         fi
7683         ;;
7684 *) val="$undef";;
7685 esac
7686 set d_bsdsetpgrp
7687 eval $setvar
7688 $rm -f set set.c
7689 : see if bzero exists
7690 set bzero d_bzero
7691 eval $inlibc
7692
7693 : see if signal is declared as pointer to function returning int or void
7694 echo " "
7695 xxx=`./findhdr signal.h`
7696 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7697 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7698         echo "You have int (*signal())() instead of void." >&4
7699         val="$undef"
7700 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7701         echo "You have void (*signal())()." >&4
7702         val="$define"
7703 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7704         echo "You have int (*signal())() instead of void." >&4
7705         val="$undef"
7706 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7707         echo "You have void (*signal())()." >&4
7708         val="$define"
7709 else
7710         case "$d_voidsig" in
7711         '')
7712         echo "I can't determine whether signal handler returns void or int..." >&4
7713                 dflt=void
7714                 rp="What type does your signal handler return?"
7715                 . ./myread
7716                 case "$ans" in
7717                 v*) val="$define";;
7718                 *) val="$undef";;
7719                 esac;;
7720         "$define")
7721                 echo "As you already told me, signal handler returns void." >&4
7722                 val="$define"
7723                 ;;
7724         *)      echo "As you already told me, signal handler returns int." >&4
7725                 val="$undef"
7726                 ;;
7727         esac
7728 fi
7729 set d_voidsig
7730 eval $setvar
7731 case "$d_voidsig" in
7732 "$define") signal_t="void";;
7733 *) signal_t="int";;
7734 esac
7735 $rm -f $$.tmp
7736
7737 : check for ability to cast large floats to 32-bit ints.
7738 echo " "
7739 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7740 if $test "$intsize" -ge 4; then
7741         xxx=int
7742 else
7743         xxx=long
7744 fi
7745 $cat >try.c <<EOCP
7746 #include <stdio.h>
7747 #include <sys/types.h>
7748 #include <signal.h>
7749 $signal_t blech(s) int s; { exit(3); }
7750 int main()
7751 {
7752         $xxx i32;
7753         double f, g;
7754         int result = 0;
7755         char str[16];
7756         signal(SIGFPE, blech);
7757
7758         /* Don't let compiler optimize the test away.  Store the number 
7759            in a writable string for gcc to pass to sscanf under HP/UX.
7760         */
7761         sprintf(str, "2147483647");
7762         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7763         g = 10 * f;
7764         i32  = ($xxx) g;
7765
7766         /* x86 processors will probably give 0x8000 0000, which is a
7767        sign change.  We don't want that.  We want to mimic SPARC
7768            behavior here, which is to preserve the sign and give
7769            back 0x7fff ffff.
7770         */
7771         if (i32 != ($xxx) f)
7772                 result |= 1;
7773         exit(result);
7774 }
7775 EOCP
7776 set try
7777 if eval $compile_ok; then
7778         ./try
7779         yyy=$?
7780 else
7781         echo "(I can't seem to compile the test program--assuming it can't)"
7782         yyy=1
7783 fi
7784 case "$yyy" in
7785 0)      val="$define"
7786         echo "Yup, it can."
7787         ;;
7788 *)      val="$undef"
7789         echo "Nope, it can't."
7790         ;;
7791 esac
7792 set d_casti32
7793 eval $setvar
7794 $rm -f try try.*
7795
7796 : check for ability to cast negative floats to unsigned
7797 echo " "
7798 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7799 $cat >try.c <<EOCP
7800 #include <stdio.h>
7801 #include <sys/types.h>
7802 #include <signal.h>
7803 $signal_t blech(s) int s; { exit(7); }
7804 $signal_t blech_in_list(s) int s; { exit(4); }
7805 unsigned long dummy_long(p) unsigned long p; { return p; }
7806 unsigned int dummy_int(p) unsigned int p; { return p; }
7807 unsigned short dummy_short(p) unsigned short p; { return p; }
7808 int main()
7809 {
7810         double f;
7811         unsigned long along;
7812         unsigned int aint;
7813         unsigned short ashort;
7814         int result = 0;
7815         char str[16];
7816         
7817         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7818            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7819            optimized the whole file away
7820         */
7821         /* Store the number in a writable string for gcc to pass to 
7822            sscanf under HP/UX.
7823         */
7824         sprintf(str, "-123");
7825         sscanf(str, "%lf", &f);  /* f = -123.; */
7826
7827         signal(SIGFPE, blech);
7828         along = (unsigned long)f;
7829         aint = (unsigned int)f;
7830         ashort = (unsigned short)f;
7831         if (along != (unsigned long)-123)
7832                 result |= 1;
7833         if (aint != (unsigned int)-123)
7834                 result |= 1;
7835         if (ashort != (unsigned short)-123)
7836                 result |= 1;
7837         sprintf(str, "1073741824.");
7838         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7839         f = f + f;
7840         along = 0;
7841         along = (unsigned long)f;
7842         if (along != 0x80000000)
7843                 result |= 2;
7844         f -= 1.;
7845         along = 0;
7846         along = (unsigned long)f;
7847         if (along != 0x7fffffff)
7848                 result |= 1;
7849         f += 2.;
7850         along = 0;
7851         along = (unsigned long)f;
7852         if (along != 0x80000001)
7853                 result |= 2;
7854         if (result)
7855                 exit(result);
7856         signal(SIGFPE, blech_in_list);
7857         sprintf(str, "123.");
7858         sscanf(str, "%lf", &f);  /* f = 123.; */
7859         along = dummy_long((unsigned long)f);
7860         aint = dummy_int((unsigned int)f);
7861         ashort = dummy_short((unsigned short)f);
7862         if (along != (unsigned long)123)
7863                 result |= 4;
7864         if (aint != (unsigned int)123)
7865                 result |= 4;
7866         if (ashort != (unsigned short)123)
7867                 result |= 4;
7868         exit(result);
7869
7870 }
7871 EOCP
7872 set try
7873 if eval $compile_ok; then
7874         ./try
7875         castflags=$?
7876 else
7877         echo "(I can't seem to compile the test program--assuming it can't)"
7878         castflags=7
7879 fi
7880 case "$castflags" in
7881 0)      val="$define"
7882         echo "Yup, it can."
7883         ;;
7884 *)      val="$undef"
7885         echo "Nope, it can't."
7886         ;;
7887 esac
7888 set d_castneg
7889 eval $setvar
7890 $rm -f try.*
7891
7892 : see if vprintf exists
7893 echo " "
7894 if set vprintf val -f d_vprintf; eval $csym; $val; then
7895         echo 'vprintf() found.' >&4
7896         val="$define"
7897         $cat >vprintf.c <<'EOF'
7898 #include <varargs.h>
7899
7900 int main() { xxx("foo"); }
7901
7902 xxx(va_alist)
7903 va_dcl
7904 {
7905         va_list args;
7906         char buf[10];
7907
7908         va_start(args);
7909         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7910 }
7911 EOF
7912         set vprintf
7913         if eval $compile && ./vprintf; then
7914                 echo "Your vsprintf() returns (int)." >&4
7915                 val2="$undef"
7916         else
7917                 echo "Your vsprintf() returns (char*)." >&4
7918                 val2="$define"
7919         fi
7920 else
7921         echo 'vprintf() NOT found.' >&4
7922                 val="$undef"
7923                 val2="$undef"
7924 fi
7925 set d_vprintf
7926 eval $setvar
7927 val=$val2
7928 set d_charvspr
7929 eval $setvar
7930
7931 : see if chown exists
7932 set chown d_chown
7933 eval $inlibc
7934
7935 : see if chroot exists
7936 set chroot d_chroot
7937 eval $inlibc
7938
7939 : see if chsize exists
7940 set chsize d_chsize
7941 eval $inlibc
7942
7943 : check for const keyword
7944 echo " "
7945 echo 'Checking to see if your C compiler knows about "const"...' >&4
7946 $cat >const.c <<'EOCP'
7947 typedef struct spug { int drokk; } spug;
7948 int main()
7949 {
7950         const char *foo;
7951         const spug y;
7952 }
7953 EOCP
7954 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7955         val="$define"
7956         echo "Yup, it does."
7957 else
7958         val="$undef"
7959         echo "Nope, it doesn't."
7960 fi
7961 set d_const
7962 eval $setvar
7963
7964 : see if crypt exists
7965 echo " "
7966 if set crypt val -f d_crypt; eval $csym; $val; then
7967         echo 'crypt() found.' >&4
7968         val="$define"
7969         cryptlib=''
7970 else
7971         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7972         if $test -z "$cryptlib"; then
7973                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7974         else
7975                 cryptlib=-lcrypt
7976         fi
7977         if $test -z "$cryptlib"; then
7978                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7979         else
7980                 cryptlib=-lcrypt
7981         fi
7982         if $test -z "$cryptlib"; then
7983                 cryptlib=`./loc libcrypt$_a "" $libpth`
7984         else
7985                 cryptlib=-lcrypt
7986         fi
7987         if $test -z "$cryptlib"; then
7988                 echo 'crypt() NOT found.' >&4
7989                 val="$undef"
7990         else
7991                 val="$define"
7992         fi
7993 fi
7994 set d_crypt
7995 eval $setvar
7996
7997 : get csh whereabouts
7998 case "$csh" in
7999 'csh') val="$undef" ;;
8000 *) val="$define" ;;
8001 esac
8002 set d_csh
8003 eval $setvar
8004 : Respect a hint or command line value for full_csh.
8005 case "$full_csh" in
8006 '') full_csh=$csh ;;
8007 esac
8008
8009 : see if cuserid exists
8010 set cuserid d_cuserid
8011 eval $inlibc
8012
8013 : see if this is a limits.h system
8014 set limits.h i_limits
8015 eval $inhdr
8016
8017 : see if this is a float.h system
8018 set float.h i_float
8019 eval $inhdr
8020
8021 : See if number of significant digits in a double precision number is known
8022 echo " "
8023 $cat >dbl_dig.c <<EOM
8024 #$i_limits I_LIMITS
8025 #$i_float I_FLOAT
8026 #ifdef I_LIMITS
8027 #include <limits.h>
8028 #endif
8029 #ifdef I_FLOAT
8030 #include <float.h>
8031 #endif
8032 #ifdef DBL_DIG
8033 printf("Contains DBL_DIG");
8034 #endif
8035 EOM
8036 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8037 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8038         echo "DBL_DIG found." >&4
8039         val="$define"
8040 else
8041         echo "DBL_DIG NOT found." >&4
8042         val="$undef"
8043 fi
8044 $rm -f dbl_dig.?
8045 set d_dbl_dig
8046 eval $setvar
8047
8048 : see if difftime exists
8049 set difftime d_difftime
8050 eval $inlibc
8051
8052 : see if this is a dirent system
8053 echo " "
8054 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8055         val="$define"
8056         echo "<dirent.h> found." >&4
8057 else
8058         val="$undef"
8059         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8060                 echo "<sys/dir.h> found." >&4
8061                 echo " "
8062         else
8063                 xinc=`./findhdr sys/ndir.h`
8064         fi
8065         echo "<dirent.h> NOT found." >&4
8066 fi
8067 set i_dirent
8068 eval $setvar
8069
8070 : Look for type of directory structure.
8071 echo " "
8072 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8073
8074 case "$direntrytype" in
8075 ''|' ')
8076         case "$i_dirent" in
8077         $define) guess1='struct dirent' ;;
8078         *) guess1='struct direct'  ;;
8079         esac
8080         ;;
8081 *)      guess1="$direntrytype"
8082         ;;
8083 esac
8084
8085 case "$guess1" in
8086 'struct dirent') guess2='struct direct' ;;
8087 *) guess2='struct dirent' ;;
8088 esac
8089                 
8090 if $contains "$guess1" try.c >/dev/null 2>&1; then
8091         direntrytype="$guess1"
8092         echo "Your directory entries are $direntrytype." >&4
8093 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8094         direntrytype="$guess2"
8095         echo "Your directory entries seem to be $direntrytype." >&4
8096 else
8097         echo "I don't recognize your system's directory entries." >&4
8098         rp="What type is used for directory entries on this system?"
8099         dflt="$guess1"
8100         . ./myread
8101         direntrytype="$ans"
8102 fi
8103 $rm -f try.c
8104
8105
8106 : see if the directory entry stores field length
8107 echo " "
8108 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8109 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8110         echo "Good, your directory entry keeps length information in d_namlen." >&4
8111         val="$define"
8112 else
8113         echo "Your directory entry does not know about the d_namlen field." >&4
8114         val="$undef"
8115 fi
8116 set d_dirnamlen
8117 eval $setvar
8118 $rm -f try.c
8119
8120 : see if dlerror exists
8121 xxx_runnm="$runnm"
8122 runnm=false
8123 set dlerror d_dlerror
8124 eval $inlibc
8125 runnm="$xxx_runnm"
8126
8127 : see if dlfcn is available
8128 set dlfcn.h i_dlfcn
8129 eval $inhdr
8130
8131 case "$usedl" in
8132 $define|y|true)
8133         $cat << EOM
8134
8135 On a few systems, the dynamically loaded modules that perl generates and uses
8136 will need a different extension than shared libs. The default will probably
8137 be appropriate.
8138
8139 EOM
8140         case "$dlext" in
8141         '')     dflt="$so" ;;
8142         *)      dflt="$dlext" ;;
8143         esac
8144         rp='What is the extension of dynamically loaded modules'
8145         . ./myread
8146         dlext="$ans"
8147         ;;
8148 *)
8149         dlext="none"
8150         ;;
8151 esac
8152
8153 : Check if dlsym need a leading underscore
8154 echo " "
8155 val="$undef"
8156
8157 case "$dlsrc" in
8158 dl_dlopen.xs)
8159         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8160         $cat >dyna.c <<'EOM'
8161 fred () { }
8162 EOM
8163
8164 $cat >fred.c<<EOM
8165
8166 #include <stdio.h>
8167 #$i_dlfcn I_DLFCN
8168 #ifdef I_DLFCN
8169 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8170 #else
8171 #include <sys/types.h>
8172 #include <nlist.h>
8173 #include <link.h>
8174 #endif
8175
8176 extern int fred() ;
8177
8178 int main()
8179 {
8180     void * handle ;
8181     void * symbol ;
8182 #ifndef RTLD_LAZY
8183     int mode = 1 ;
8184 #else
8185     int mode = RTLD_LAZY ;
8186 #endif
8187     handle = dlopen("./dyna.$dlext", mode) ;
8188     if (handle == NULL) {
8189         printf ("1\n") ;
8190         fflush (stdout) ;
8191         exit(0);
8192     }
8193     symbol = dlsym(handle, "fred") ;
8194     if (symbol == NULL) {
8195         /* try putting a leading underscore */
8196         symbol = dlsym(handle, "_fred") ;
8197         if (symbol == NULL) {
8198             printf ("2\n") ;
8199             fflush (stdout) ;
8200             exit(0);
8201         }
8202         printf ("3\n") ;
8203     }
8204     else
8205         printf ("4\n") ;
8206     fflush (stdout) ;
8207     exit(0);
8208 }
8209 EOM
8210         : Call the object file tmp-dyna.o in case dlext=o.
8211         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8212                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8213                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8214                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8215                 xxx=`./fred`
8216                 case $xxx in
8217                 1)      echo "Test program failed using dlopen." >&4
8218                         echo "Perhaps you should not use dynamic loading." >&4;;
8219                 2)      echo "Test program failed using dlsym." >&4
8220                         echo "Perhaps you should not use dynamic loading." >&4;;
8221                 3)      echo "dlsym needs a leading underscore" >&4
8222                         val="$define" ;;
8223                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8224                 esac
8225         else
8226                 echo "I can't compile and run the test program." >&4
8227                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8228         fi
8229         ;;
8230 esac
8231                 
8232 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8233
8234 set d_dlsymun
8235 eval $setvar
8236
8237 hasproto='varname=$1; func=$2; shift; shift;
8238 while $test $# -ge 2; do
8239         case "$1" in
8240         $define) echo "#include <$2>";;
8241         esac ;
8242     shift 2;
8243 done > try.c;
8244 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8245 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8246         echo "$func() prototype found.";
8247         val="$define";
8248 else
8249         echo "$func() prototype NOT found.";
8250         val="$undef";
8251 fi;
8252 set $varname;
8253 eval $setvar;
8254 $rm -f try.c tryout.c'
8255
8256 : see if prototype for drand48 is available
8257 echo " "
8258 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8259 eval $hasproto
8260
8261 : see if dup2 exists
8262 set dup2 d_dup2
8263 eval $inlibc
8264
8265 : see if eaccess exists
8266 set eaccess d_eaccess
8267 eval $inlibc
8268
8269 : see if endgrent exists
8270 set endgrent d_endgrent
8271 eval $inlibc
8272
8273 : see if endhostent exists
8274 set endhostent d_endhent
8275 eval $inlibc
8276
8277 : see if endnetent exists
8278 set endnetent d_endnent
8279 eval $inlibc
8280
8281 : see if endprotoent exists
8282 set endprotoent d_endpent
8283 eval $inlibc
8284
8285 : see if endpwent exists
8286 set endpwent d_endpwent
8287 eval $inlibc
8288
8289 : see if endservent exists
8290 set endservent d_endsent
8291 eval $inlibc
8292
8293 : see if endspent exists
8294 set endspent d_endspent
8295 eval $inlibc
8296
8297 : Locate the flags for 'open()'
8298 echo " "
8299 $cat >open3.c <<'EOCP'
8300 #include <sys/types.h>
8301 #ifdef I_FCNTL
8302 #include <fcntl.h>
8303 #endif
8304 #ifdef I_SYS_FILE
8305 #include <sys/file.h>
8306 #endif
8307 int main() {
8308         if(O_RDONLY);
8309 #ifdef O_TRUNC
8310         exit(0);
8311 #else
8312         exit(1);
8313 #endif
8314 }
8315 EOCP
8316 : check sys/file.h first to get FREAD on Sun
8317 if $test `./findhdr sys/file.h` && \
8318                 set open3 -DI_SYS_FILE && eval $compile; then
8319         h_sysfile=true;
8320         echo "<sys/file.h> defines the O_* constants..." >&4
8321         if ./open3; then
8322                 echo "and you have the 3 argument form of open()." >&4
8323                 val="$define"
8324         else
8325                 echo "but not the 3 argument form of open().  Oh, well." >&4
8326                 val="$undef"
8327         fi
8328 elif $test `./findhdr fcntl.h` && \
8329                 set open3 -DI_FCNTL && eval $compile; then
8330         h_fcntl=true;
8331         echo "<fcntl.h> defines the O_* constants..." >&4
8332         if ./open3; then
8333                 echo "and you have the 3 argument form of open()." >&4
8334                 val="$define"
8335         else
8336                 echo "but not the 3 argument form of open().  Oh, well." >&4
8337                 val="$undef"
8338         fi
8339 else
8340         val="$undef"
8341         echo "I can't find the O_* constant definitions!  You got problems." >&4
8342 fi
8343 set d_open3
8344 eval $setvar
8345 $rm -f open3*
8346
8347 : see which of string.h or strings.h is needed
8348 echo " "
8349 strings=`./findhdr string.h`
8350 if $test "$strings" && $test -r "$strings"; then
8351         echo "Using <string.h> instead of <strings.h>." >&4
8352         val="$define"
8353 else
8354         val="$undef"
8355         strings=`./findhdr strings.h`
8356         if $test "$strings" && $test -r "$strings"; then
8357                 echo "Using <strings.h> instead of <string.h>." >&4
8358         else
8359                 echo "No string header found -- You'll surely have problems." >&4
8360         fi
8361 fi
8362 set i_string
8363 eval $setvar
8364 case "$i_string" in
8365 "$undef") strings=`./findhdr strings.h`;;
8366 *)        strings=`./findhdr string.h`;;
8367 esac
8368
8369 : check for non-blocking I/O stuff
8370 case "$h_sysfile" in
8371 true) echo "#include <sys/file.h>" > head.c;;
8372 *)
8373         case "$h_fcntl" in
8374         true) echo "#include <fcntl.h>" > head.c;;
8375         *) echo "#include <sys/fcntl.h>" > head.c;;
8376         esac
8377         ;;
8378 esac
8379 echo " "
8380 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8381 case "$o_nonblock" in
8382 '')
8383         $cat head.c > try.c
8384         $cat >>try.c <<'EOCP'
8385 #include <stdio.h>
8386 int main() {
8387 #ifdef O_NONBLOCK
8388         printf("O_NONBLOCK\n");
8389         exit(0);
8390 #endif
8391 #ifdef O_NDELAY
8392         printf("O_NDELAY\n");
8393         exit(0);
8394 #endif
8395 #ifdef FNDELAY
8396         printf("FNDELAY\n");
8397         exit(0);
8398 #endif
8399         exit(0);
8400 }
8401 EOCP
8402         set try
8403         if eval $compile_ok; then
8404                 o_nonblock=`./try`
8405                 case "$o_nonblock" in
8406                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8407                 *) echo "Seems like we can use $o_nonblock.";;
8408                 esac
8409         else
8410                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8411         fi
8412         ;;
8413 *) echo "Using $hint value $o_nonblock.";;
8414 esac
8415 $rm -f try try.* .out core
8416
8417 echo " "
8418 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8419 case "$eagain" in
8420 '')
8421         $cat head.c > try.c
8422         $cat >>try.c <<EOCP
8423 #include <errno.h>
8424 #include <sys/types.h>
8425 #include <signal.h>
8426 #include <stdio.h> 
8427 #define MY_O_NONBLOCK $o_nonblock
8428 #ifndef errno  /* XXX need better Configure test */
8429 extern int errno;
8430 #endif
8431 #$i_unistd I_UNISTD
8432 #ifdef I_UNISTD
8433 #include <unistd.h>
8434 #endif
8435 #ifdef $i_string
8436 #include <string.h>
8437 #else
8438 #include <strings.h>
8439 #endif
8440 $signal_t blech(x) int x; { exit(3); }
8441 EOCP
8442         $cat >> try.c <<'EOCP'
8443 int main()
8444 {
8445         int pd[2];
8446         int pu[2];
8447         char buf[1];
8448         char string[100];
8449
8450         pipe(pd);       /* Down: child -> parent */
8451         pipe(pu);       /* Up: parent -> child */
8452         if (0 != fork()) {
8453                 int ret;
8454                 close(pd[1]);   /* Parent reads from pd[0] */
8455                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8456                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8457                         exit(1);
8458                 signal(SIGALRM, blech);
8459                 alarm(5);
8460                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8461                         exit(2);
8462                 sprintf(string, "%d\n", ret);
8463                 write(2, string, strlen(string));
8464                 alarm(0);
8465 #ifdef EAGAIN
8466                 if (errno == EAGAIN) {
8467                         printf("EAGAIN\n");
8468                         goto ok;
8469                 }
8470 #endif
8471 #ifdef EWOULDBLOCK
8472                 if (errno == EWOULDBLOCK)
8473                         printf("EWOULDBLOCK\n");
8474 #endif
8475         ok:
8476                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8477                 sleep(2);                               /* Give it time to close our pipe */
8478                 alarm(5);
8479                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8480                 alarm(0);
8481                 sprintf(string, "%d\n", ret);
8482                 write(3, string, strlen(string));
8483                 exit(0);
8484         }
8485
8486         close(pd[0]);                   /* We write to pd[1] */
8487         close(pu[1]);                   /* We read from pu[0] */
8488         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8489         close(pd[1]);                   /* Pipe pd is now fully closed! */
8490         exit(0);                                /* Bye bye, thank you for playing! */
8491 }
8492 EOCP
8493         set try
8494         if eval $compile_ok; then
8495                 echo "$startsh" >mtry
8496                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8497                 chmod +x mtry
8498                 ./mtry >/dev/null 2>&1
8499                 case $? in
8500                 0) eagain=`$cat try.out`;;
8501                 1) echo "Could not perform non-blocking setting!";;
8502                 2) echo "I did a successful read() for something that was not there!";;
8503                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8504                 *) echo "Something terribly wrong happened during testing.";;
8505                 esac
8506                 rd_nodata=`$cat try.ret`
8507                 echo "A read() system call with no data present returns $rd_nodata."
8508                 case "$rd_nodata" in
8509                 0|-1) ;;
8510                 *)
8511                         echo "(That's peculiar, fixing that to be -1.)"
8512                         rd_nodata=-1
8513                         ;;
8514                 esac
8515                 case "$eagain" in
8516                 '')
8517                         echo "Forcing errno EAGAIN on read() with no data available."
8518                         eagain=EAGAIN
8519                         ;;
8520                 *)
8521                         echo "Your read() sets errno to $eagain when no data is available."
8522                         ;;
8523                 esac
8524                 status=`$cat try.err`
8525                 case "$status" in
8526                 0) echo "And it correctly returns 0 to signal EOF.";;
8527                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8528                 *) echo "However, your read() returns '$status' on EOF??";;
8529                 esac
8530                 val="$define"
8531                 if test "$status" = "$rd_nodata"; then
8532                         echo "WARNING: you can't distinguish between EOF and no data!"
8533                         val="$undef"
8534                 fi
8535         else
8536                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8537                 eagain=EAGAIN
8538         fi
8539         set d_eofnblk
8540         eval $setvar
8541         ;;
8542 *)
8543         echo "Using $hint value $eagain."
8544         echo "Your read() returns $rd_nodata when no data is present."
8545         case "$d_eofnblk" in
8546         "$define") echo "And you can see EOF because read() returns 0.";;
8547         "$undef") echo "But you can't see EOF status from read() returned value.";;
8548         *)
8549                 echo "(Assuming you can't see EOF status from read anyway.)"
8550                 d_eofnblk=$undef
8551                 ;;
8552         esac
8553         ;;
8554 esac
8555 $rm -f try try.* .out core head.c mtry
8556
8557 : see if fchmod exists
8558 set fchmod d_fchmod
8559 eval $inlibc
8560
8561 : see if fchown exists
8562 set fchown d_fchown
8563 eval $inlibc
8564
8565 : see if this is an fcntl system
8566 set fcntl d_fcntl
8567 eval $inlibc
8568
8569 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8570 while $test $# -ge 2; do
8571         case "$1" in
8572         $define) echo "#include <$2>";;
8573         esac ;
8574     shift 2;
8575 done > try.c;
8576 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8577 set try;
8578 if eval $compile; then
8579         val="$define";
8580 else
8581         val="$undef";
8582 fi;
8583 set $varname;
8584 eval $setvar;
8585 $rm -f try.c try.o'
8586
8587 socketlib=''
8588 sockethdr=''
8589 : see whether socket exists
8590 echo " "
8591 $echo $n "Hmm... $c" >&4
8592 if set socket val -f d_socket; eval $csym; $val; then
8593         echo "Looks like you have Berkeley networking support." >&4
8594         d_socket="$define"
8595         if set setsockopt val -f; eval $csym; $val; then
8596                 d_oldsock="$undef"
8597         else
8598                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8599                 d_oldsock="$define"
8600         fi
8601 else
8602         if $contains socklib libc.list >/dev/null 2>&1; then
8603                 echo "Looks like you have Berkeley networking support." >&4
8604                 d_socket="$define"
8605                 : we will have to assume that it supports the 4.2 BSD interface
8606                 d_oldsock="$undef"
8607         else
8608                 echo "You don't have Berkeley networking in libc$_a..." >&4
8609                 if test "X$d_socket" = "X$define"; then
8610                    echo "...but you seem to believe that you have sockets." >&4
8611                 else
8612                         for net in net socket
8613                         do
8614                                 if test -f /usr/lib/lib$net$_a; then
8615                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8616                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8617                                         if $contains socket libc.list >/dev/null 2>&1; then
8618                                                 d_socket="$define"
8619                                                 socketlib="-l$net"
8620                                                 case "$net" in
8621                                                 net)
8622                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8623                                                         sockethdr="-I/usr/netinclude"
8624                                                         ;;
8625                                                 esac
8626                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8627                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8628                                                         d_oldsock="$undef"
8629                                                 else
8630                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8631                                                         d_oldsock="$define"
8632                                                 fi
8633                                                 break
8634                                         fi
8635                                 fi
8636                         done
8637                         if test "X$d_socket" != "X$define"; then
8638                            echo "or anywhere else I see." >&4
8639                            d_socket="$undef"
8640                            d_oldsock="$undef"
8641                         fi
8642                 fi
8643         fi
8644 fi
8645
8646 : see if socketpair exists
8647 set socketpair d_sockpair
8648 eval $inlibc
8649
8650
8651 echo " "
8652 echo "Checking the availability of certain socket constants..." >& 4
8653 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8654         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8655         $cat >try.c <<EOF
8656 #include <sys/types.h>
8657 #include <sys/socket.h>
8658 int main() {
8659     int i = $ENUM;
8660 }
8661 EOF
8662         val="$undef"
8663         set try; if eval $compile; then
8664                 val="$define"
8665         fi
8666         set d_${enum}; eval $setvar
8667         $rm -f try.c try
8668 done
8669
8670 : see if sys/select.h has to be included
8671 set sys/select.h i_sysselct
8672 eval $inhdr
8673
8674 : see if we should include time.h, sys/time.h, or both
8675 echo " "
8676 if test "X$timeincl" = X; then
8677         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8678         $echo $n "I'm now running the test program...$c"
8679         $cat >try.c <<'EOCP'
8680 #include <sys/types.h>
8681 #ifdef I_TIME
8682 #include <time.h>
8683 #endif
8684 #ifdef I_SYSTIME
8685 #ifdef SYSTIMEKERNEL
8686 #define KERNEL
8687 #endif
8688 #include <sys/time.h>
8689 #endif
8690 #ifdef I_SYSSELECT
8691 #include <sys/select.h>
8692 #endif
8693 int main()
8694 {
8695         struct tm foo;
8696 #ifdef S_TIMEVAL
8697         struct timeval bar;
8698 #endif
8699 #ifdef S_TIMEZONE
8700         struct timezone tzp;
8701 #endif
8702         if (foo.tm_sec == foo.tm_sec)
8703                 exit(0);
8704 #ifdef S_TIMEVAL
8705         if (bar.tv_sec == bar.tv_sec)
8706                 exit(0);
8707 #endif
8708         exit(1);
8709 }
8710 EOCP
8711         flags=''
8712         for s_timezone in '-DS_TIMEZONE' ''; do
8713         sysselect=''
8714         for s_timeval in '-DS_TIMEVAL' ''; do
8715         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8716         for i_time in '' '-DI_TIME'; do
8717         for i_systime in '-DI_SYSTIME' ''; do
8718                 case "$flags" in
8719                 '') $echo $n ".$c"
8720                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8721                         if eval $compile; then
8722                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8723                                 shift
8724                                 flags="$*"
8725                                 echo " "
8726                                 $echo $n "Succeeded with $flags$c"
8727                         fi
8728                         ;;
8729                 esac
8730         done
8731         done
8732         done
8733         done
8734         done
8735         timeincl=''
8736         echo " "
8737         case "$flags" in
8738         *SYSTIMEKERNEL*) i_systimek="$define"
8739                 timeincl=`./findhdr sys/time.h`
8740                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8741         *) i_systimek="$undef";;
8742         esac
8743         case "$flags" in
8744         *I_TIME*) i_time="$define"
8745                 timeincl=`./findhdr time.h`" $timeincl"
8746                 echo "We'll include <time.h>." >&4;;
8747         *) i_time="$undef";;
8748         esac
8749         case "$flags" in
8750         *I_SYSTIME*) i_systime="$define"
8751                 timeincl=`./findhdr sys/time.h`" $timeincl"
8752                 echo "We'll include <sys/time.h>." >&4;;
8753         *) i_systime="$undef";;
8754         esac
8755         $rm -f try.c try
8756 fi
8757
8758 : check for fd_set items
8759 $cat <<EOM
8760
8761 Checking to see how well your C compiler handles fd_set and friends ...
8762 EOM
8763 $cat >fd_set.c <<EOCP
8764 #$i_systime I_SYS_TIME
8765 #$i_sysselct I_SYS_SELECT
8766 #$d_socket HAS_SOCKET
8767 #include <sys/types.h>
8768 #ifdef HAS_SOCKET
8769 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8770 #endif
8771 #ifdef I_SYS_TIME
8772 #include <sys/time.h>
8773 #endif
8774 #ifdef I_SYS_SELECT
8775 #include <sys/select.h>
8776 #endif
8777 int main() {
8778         fd_set fds;
8779
8780 #ifdef TRYBITS
8781         if(fds.fds_bits);
8782 #endif
8783
8784 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8785         exit(0);
8786 #else
8787         exit(1);
8788 #endif
8789 }
8790 EOCP
8791 set fd_set -DTRYBITS
8792 if eval $compile; then
8793         d_fds_bits="$define"
8794         d_fd_set="$define"
8795         echo "Well, your system knows about the normal fd_set typedef..." >&4
8796         if ./fd_set; then
8797                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8798                 d_fd_macros="$define"
8799         else
8800                 $cat >&4 <<'EOM'
8801 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8802 EOM
8803                 d_fd_macros="$undef"
8804         fi
8805 else
8806         $cat <<'EOM'
8807 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8808 EOM
8809         set fd_set
8810         if eval $compile; then
8811                 d_fds_bits="$undef"
8812                 d_fd_set="$define"
8813                 echo "Well, your system has some sort of fd_set available..." >&4
8814                 if ./fd_set; then
8815                         echo "and you have the normal fd_set macros." >&4
8816                         d_fd_macros="$define"
8817                 else
8818                         $cat <<'EOM'
8819 but not the normal fd_set macros!  Gross!  More work for me...
8820 EOM
8821                         d_fd_macros="$undef"
8822                 fi
8823         else
8824         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8825                 d_fd_set="$undef"
8826                 d_fds_bits="$undef"
8827                 d_fd_macros="$undef"
8828         fi
8829 fi
8830 $rm -f fd_set*
8831
8832 : see if fgetpos exists
8833 set fgetpos d_fgetpos
8834 eval $inlibc
8835
8836 : see if flock exists
8837 set flock d_flock
8838 eval $inlibc
8839
8840 : see if fork exists
8841 set fork d_fork
8842 eval $inlibc
8843
8844 : see if pathconf exists
8845 set pathconf d_pathconf
8846 eval $inlibc
8847
8848 : see if fpathconf exists
8849 set fpathconf d_fpathconf
8850 eval $inlibc
8851
8852
8853 : check for off64_t
8854 echo " "
8855 echo "Checking to see if your system supports off64_t..." >&4
8856 $cat >try.c <<EOCP
8857 #include <sys/types.h>
8858 #include <unistd.h>
8859 int main() { off64_t x = 7; }'
8860 EOCP
8861 set try
8862 if eval $compile; then
8863         val="$define"
8864         echo "Yes, it does."
8865 else
8866         val="$undef"
8867         echo "No, it doesn't."
8868         case "$lseeksize" in
8869         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8870         esac
8871 fi
8872 $rm -f try.* try
8873 set d_off64_t
8874 eval $setvar
8875
8876 : check for fpos64_t
8877 echo " "
8878 echo "Checking to see if your system supports fpos64_t..." >&4
8879 $cat >try.c <<EOCP
8880 #include <sys/stdio.h>
8881 int main() { fpos64_t x x = 7; }'
8882 EOCP
8883 set try
8884 if eval $compile; then
8885         val="$define"
8886         echo "Yes, it does."
8887 else
8888         val="$undef"
8889         echo "No, it doesn't."
8890         case "$fpossize" in
8891         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8892         esac
8893 fi
8894 $rm -f try.* try
8895 set d_fpos64_t
8896 eval $setvar
8897
8898 hasstruct='varname=$1; struct=$2; shift; shift;
8899 while $test $# -ge 2; do
8900         case "$1" in
8901         $define) echo "#include <$2>";;
8902         esac ;
8903     shift 2;
8904 done > try.c;
8905 echo "int main () { struct $struct foo; }" >> try.c;
8906 set try;
8907 if eval $compile; then
8908         val="$define";
8909 else
8910         val="$undef";
8911 fi;
8912 set $varname;
8913 eval $setvar;
8914 $rm -f try.c try.o'
8915
8916 : see if this is a sys/param system
8917 set sys/param.h i_sysparam
8918 eval $inhdr
8919
8920 : see if this is a sys/mount.h system
8921 set sys/mount.h i_sysmount
8922 eval $inhdr
8923
8924 : see if sys/types.h has to be included
8925 set sys/types.h i_systypes
8926 eval $inhdr
8927
8928
8929 echo " "
8930 echo "Checking to see if your system supports struct fs_data..." >&4
8931 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8932 eval $hasstruct
8933 case "$d_fs_data_s" in
8934 "$define")      echo "Yes, it does."   ;;
8935 *)              echo "No, it doesn't." ;;
8936 esac
8937
8938 : see if fseeko exists
8939 set fseeko d_fseeko
8940 eval $inlibc
8941 case "$longsize" in
8942 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8943 esac
8944
8945 : see if fsetpos exists
8946 set fsetpos d_fsetpos
8947 eval $inlibc
8948
8949
8950 : see if fstatfs exists
8951 set fstatfs d_fstatfs
8952 eval $inlibc
8953
8954
8955 : see if statvfs exists
8956 set statvfs d_statvfs
8957 eval $inlibc
8958
8959 : see if fstatvfs exists
8960 set fstatvfs d_fstatvfs
8961 eval $inlibc
8962
8963
8964 : see if ftello exists
8965 set ftello d_ftello
8966 eval $inlibc
8967 case "$longsize" in
8968 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8969 esac
8970
8971 : see if getgrent exists
8972 set getgrent d_getgrent
8973 eval $inlibc
8974
8975 : see if gethostbyaddr exists
8976 set gethostbyaddr d_gethbyaddr
8977 eval $inlibc
8978
8979 : see if gethostbyname exists
8980 set gethostbyname d_gethbyname
8981 eval $inlibc
8982
8983 : see if gethostent exists
8984 set gethostent d_gethent
8985 eval $inlibc
8986
8987 : see how we will look up host name
8988 echo " "
8989 call=''
8990 if set gethostname val -f d_gethname; eval $csym; $val; then
8991         echo 'gethostname() found.' >&4
8992         d_gethname="$define"
8993         call=gethostname
8994 fi
8995 if set uname val -f d_uname; eval $csym; $val; then
8996         if ./xenix; then
8997                 $cat <<'EOM'
8998 uname() was found, but you're running xenix, and older versions of xenix
8999 have a broken uname(). If you don't really know whether your xenix is old
9000 enough to have a broken system call, use the default answer.
9001
9002 EOM
9003                 dflt=y
9004                 case "$d_uname" in
9005                 "$define") dflt=n;;
9006                 esac
9007                 rp='Is your uname() broken?'
9008                 . ./myread
9009                 case "$ans" in
9010                 n*) d_uname="$define"; call=uname;;
9011                 esac
9012         else
9013                 echo 'uname() found.' >&4
9014                 d_uname="$define"
9015                 case "$call" in
9016                 '') call=uname ;;
9017                 esac
9018         fi
9019 fi
9020 case "$d_gethname" in
9021 '') d_gethname="$undef";;
9022 esac
9023 case "$d_uname" in
9024 '') d_uname="$undef";;
9025 esac
9026 case "$d_uname$d_gethname" in
9027 *define*)
9028         dflt=n
9029         cat <<EOM
9030  
9031 Every now and then someone has a $call() that lies about the hostname
9032 but can't be fixed for political or economic reasons.  If you wish, I can
9033 pretend $call() isn't there and maybe compute hostname at run-time
9034 thanks to the '$phostname' command.
9035
9036 EOM
9037         rp="Shall I ignore $call() from now on?"
9038         . ./myread
9039         case "$ans" in
9040         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9041         esac;;
9042 esac
9043 case "$phostname" in
9044 '') aphostname='';;
9045 *) case "$aphostname" in
9046         /*) ;;
9047         *) set X $phostname
9048                 shift
9049                 file=$1
9050                 shift
9051                 file=`./loc $file $file $pth`
9052                 aphostname=`echo $file $*`
9053                 ;;
9054         esac
9055         ;;
9056 esac
9057 case "$d_uname$d_gethname" in
9058 *define*) ;;
9059 *)
9060         case "$phostname" in
9061         '')
9062                 echo "There will be no way for $package to get your hostname." >&4;;
9063         *)
9064         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9065                 ;;
9066         esac;;
9067 esac
9068 case "$d_phostname" in
9069 '') d_phostname="$undef";;
9070 esac
9071
9072 : see if this is a netdb.h system
9073 set netdb.h i_netdb
9074 eval $inhdr
9075
9076 : see if prototypes for various gethostxxx netdb.h functions are available
9077 echo " "
9078 set d_gethostprotos gethostent $i_netdb netdb.h
9079 eval $hasproto
9080
9081 : see if getlogin exists
9082 set getlogin d_getlogin
9083 eval $inlibc
9084
9085 : see if getmnt exists
9086 set getmnt d_getmnt
9087 eval $inlibc
9088
9089 : see if getmntent exists
9090 set getmntent d_getmntent
9091 eval $inlibc
9092
9093 : see if getnetbyaddr exists
9094 set getnetbyaddr d_getnbyaddr
9095 eval $inlibc
9096
9097 : see if getnetbyname exists
9098 set getnetbyname d_getnbyname
9099 eval $inlibc
9100
9101 : see if getnetent exists
9102 set getnetent d_getnent
9103 eval $inlibc
9104
9105 : see if prototypes for various getnetxxx netdb.h functions are available
9106 echo " "
9107 set d_getnetprotos getnetent $i_netdb netdb.h
9108 eval $hasproto
9109
9110
9111 : see if getprotobyname exists
9112 set getprotobyname d_getpbyname
9113 eval $inlibc
9114
9115 : see if getprotobynumber exists
9116 set getprotobynumber d_getpbynumber
9117 eval $inlibc
9118
9119 : see if getprotoent exists
9120 set getprotoent d_getpent
9121 eval $inlibc
9122
9123 : see if getpgid exists
9124 set getpgid d_getpgid
9125 eval $inlibc
9126
9127 : see if getpgrp2 exists
9128 set getpgrp2 d_getpgrp2
9129 eval $inlibc
9130
9131 : see if getppid exists
9132 set getppid d_getppid
9133 eval $inlibc
9134
9135 : see if getpriority exists
9136 set getpriority d_getprior
9137 eval $inlibc
9138
9139 : see if prototypes for various getprotoxxx netdb.h functions are available
9140 echo " "
9141 set d_getprotoprotos getprotoent $i_netdb netdb.h
9142 eval $hasproto
9143
9144 : see if getpwent exists
9145 set getpwent d_getpwent
9146 eval $inlibc
9147
9148
9149 : see if getservbyname exists
9150 set getservbyname d_getsbyname
9151 eval $inlibc
9152
9153 : see if getservbyport exists
9154 set getservbyport d_getsbyport
9155 eval $inlibc
9156
9157 : see if getservent exists
9158 set getservent d_getsent
9159 eval $inlibc
9160
9161 : see if prototypes for various getservxxx netdb.h functions are available
9162 echo " "
9163 set d_getservprotos getservent $i_netdb netdb.h
9164 eval $hasproto
9165
9166 : see if getspent exists
9167 set getspent d_getspent
9168 eval $inlibc
9169
9170 : see if getspnam exists
9171 set getspnam d_getspnam
9172 eval $inlibc
9173
9174 : see if gettimeofday or ftime exists
9175 set gettimeofday d_gettimeod
9176 eval $inlibc
9177 case "$d_gettimeod" in
9178 "$undef")
9179         set ftime d_ftime 
9180         eval $inlibc
9181         ;;
9182 *)
9183         val="$undef"; set d_ftime; eval $setvar
9184         ;;
9185 esac
9186 case "$d_gettimeod$d_ftime" in
9187 "$undef$undef")
9188         echo " "
9189         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9190         ;;
9191 esac
9192
9193 : see if this is an grp system
9194 set grp.h i_grp
9195 eval $inhdr
9196
9197 case "$i_grp" in
9198 $define)
9199         xxx=`./findhdr grp.h`
9200         $cppstdin $cppflags $cppminus < $xxx >$$.h
9201
9202         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9203                 val="$define"
9204         else
9205                 val="$undef"
9206         fi
9207         set d_grpasswd
9208         eval $setvar
9209
9210         $rm -f $$.h
9211         ;;
9212 *)
9213         val="$undef";
9214         set d_grpasswd; eval $setvar
9215         ;;
9216 esac
9217
9218 : see if hasmntopt exists
9219 set hasmntopt d_hasmntopt
9220 eval $inlibc
9221
9222 : see if this is a netinet/in.h or sys/in.h system
9223 set netinet/in.h i_niin sys/in.h i_sysin
9224 eval $inhdr
9225
9226 : see if arpa/inet.h has to be included
9227 set arpa/inet.h i_arpainet
9228 eval $inhdr
9229
9230 : see if htonl --and friends-- exists
9231 val=''
9232 set htonl val
9233 eval $inlibc
9234
9235 : Maybe they are macros.
9236 case "$val" in
9237 $undef)
9238         $cat >htonl.c <<EOM
9239 #include <stdio.h>
9240 #include <sys/types.h>
9241 #$i_niin I_NETINET_IN
9242 #$i_sysin I_SYS_IN
9243 #$i_arpainet I_ARPA_INET
9244 #ifdef I_NETINET_IN
9245 #include <netinet/in.h>
9246 #endif
9247 #ifdef I_SYS_IN
9248 #include <sys/in.h>
9249 #endif
9250 #ifdef I_ARPA_INET
9251 #include <arpa/inet.h>
9252 #endif
9253 #ifdef htonl
9254 printf("Defined as a macro.");
9255 #endif
9256 EOM
9257         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9258         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9259                 val="$define"
9260                 echo "But it seems to be defined as a macro." >&4
9261         fi
9262         $rm -f htonl.?
9263         ;;
9264 esac
9265 set d_htonl
9266 eval $setvar
9267
9268 : index or strchr
9269 echo " "
9270 if set index val -f; eval $csym; $val; then
9271         if set strchr val -f d_strchr; eval $csym; $val; then
9272                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9273                         val="$define"
9274                         vali="$undef"
9275                         echo "strchr() found." >&4
9276                 else
9277                         val="$undef"
9278                         vali="$define"
9279                         echo "index() found." >&4
9280                 fi
9281         else
9282                 val="$undef"
9283                 vali="$define"
9284                 echo "index() found." >&4
9285         fi
9286 else
9287         if set strchr val -f d_strchr; eval $csym; $val; then
9288                 val="$define"
9289                 vali="$undef"
9290                 echo "strchr() found." >&4
9291         else
9292                 echo "No index() or strchr() found!" >&4
9293                 val="$undef"
9294                 vali="$undef"
9295         fi
9296 fi
9297 set d_strchr; eval $setvar
9298 val="$vali"
9299 set d_index; eval $setvar
9300
9301 : check whether inet_aton exists
9302 set inet_aton d_inetaton
9303 eval $inlibc
9304
9305 : Look for isascii
9306 echo " "
9307 $cat >isascii.c <<'EOCP'
9308 #include <stdio.h>
9309 #include <ctype.h>
9310 int main() {
9311         int c = 'A';
9312         if (isascii(c))
9313                 exit(0);
9314         else
9315                 exit(1);
9316 }
9317 EOCP
9318 set isascii
9319 if eval $compile; then
9320         echo "isascii() found." >&4
9321         val="$define"
9322 else
9323         echo "isascii() NOT found." >&4
9324         val="$undef"
9325 fi
9326 set d_isascii
9327 eval $setvar
9328 $rm -f isascii*
9329
9330 : see if killpg exists
9331 set killpg d_killpg
9332 eval $inlibc
9333
9334 : see if lchown exists
9335 echo " "
9336 $cat > try.c <<'EOCP'
9337 /* System header to define __stub macros and hopefully few prototypes,
9338     which can conflict with char lchown(); below.  */
9339 #include <assert.h>
9340 /* Override any gcc2 internal prototype to avoid an error.  */
9341 /* We use char because int might match the return type of a gcc2
9342    builtin and then its argument prototype would still apply.  */
9343 char lchown();
9344 int main() {
9345     /*  The GNU C library defines this for functions which it implements
9346         to always fail with ENOSYS.  Some functions are actually named
9347         something starting with __ and the normal name is an alias.  */
9348 #if defined (__stub_lchown) || defined (__stub___lchown)
9349 choke me
9350 #else
9351 lchown();
9352 #endif
9353 ; return 0; }
9354 EOCP
9355 set try
9356 if eval $compile; then
9357     $echo "lchown() found." >&4
9358     val="$define"
9359 else
9360     $echo "lchown() NOT found." >&4
9361     val="$undef"
9362 fi
9363 set d_lchown
9364 eval $setvar
9365
9366 : See if number of significant digits in a double precision number is known
9367 echo " "
9368 $cat >ldbl_dig.c <<EOM
9369 #$i_limits I_LIMITS
9370 #$i_float I_FLOAT
9371 #ifdef I_LIMITS
9372 #include <limits.h>
9373 #endif
9374 #ifdef I_FLOAT
9375 #include <float.h>
9376 #endif
9377 #ifdef LDBL_DIG
9378 printf("Contains LDBL_DIG");
9379 #endif
9380 EOM
9381 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9382 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9383         echo "LDBL_DIG found." >&4
9384         val="$define"
9385 else
9386         echo "LDBL_DIG NOT found." >&4
9387         val="$undef"
9388 fi
9389 $rm -f ldbl_dig.?
9390 set d_ldbl_dig
9391 eval $setvar
9392
9393 : see if link exists
9394 set link d_link
9395 eval $inlibc
9396
9397 : see if localeconv exists
9398 set localeconv d_locconv
9399 eval $inlibc
9400
9401 : see if lockf exists
9402 set lockf d_lockf
9403 eval $inlibc
9404
9405 : check for long long
9406 echo " "
9407 $echo $n "Checking to see if your system supports long long..." $c >&4
9408 echo 'int main() { long long x = 7; return 0; }' > try.c
9409 set try
9410 if eval $compile; then
9411         val="$define"
9412         echo " Yes, it does." >&4
9413 else
9414         val="$undef"
9415         echo " No, it doesn't." >&4
9416 fi
9417 $rm try.*
9418 set d_longlong
9419 eval $setvar
9420
9421 : check for length of long long
9422 case "${d_longlong}${longlongsize}" in
9423 $define)
9424         echo " "
9425         $echo $n "Checking to see how big your long longs are..." $c >&4
9426         $cat >try.c <<'EOCP'
9427 #include <stdio.h>
9428 int main()
9429 {
9430     printf("%d\n", (int)sizeof(long long));
9431     return(0);
9432 }
9433 EOCP
9434         set try
9435         if eval $compile_ok; then
9436                 longlongsize=`./try$exe_ext`
9437                 $echo " $longlongsize bytes." >&4
9438         else
9439                 dflt='8'
9440                 echo " "
9441                 echo "(I can't seem to compile the test program.  Guessing...)"
9442                 rp="What is the size of a long long (in bytes)?"
9443                 . ./myread
9444                 longlongsize="$ans"
9445         fi
9446         if $test "X$longsize" = "X$longlongsize"; then
9447                 echo "(That isn't any different from an ordinary long.)"
9448         fi      
9449         ;;
9450 esac
9451 $rm -f try.* try
9452
9453 : see if lstat exists
9454 set lstat d_lstat
9455 eval $inlibc
9456
9457 : see if mblen exists
9458 set mblen d_mblen
9459 eval $inlibc
9460
9461 : see if mbstowcs exists
9462 set mbstowcs d_mbstowcs
9463 eval $inlibc
9464
9465 : see if mbtowc exists
9466 set mbtowc d_mbtowc
9467 eval $inlibc
9468
9469 : see if memchr exists
9470 set memchr d_memchr
9471 eval $inlibc
9472
9473 : see if memcmp exists
9474 set memcmp d_memcmp
9475 eval $inlibc
9476
9477 : see if memcpy exists
9478 set memcpy d_memcpy
9479 eval $inlibc
9480
9481 : see if memmove exists
9482 set memmove d_memmove
9483 eval $inlibc
9484
9485 : see if memset exists
9486 set memset d_memset
9487 eval $inlibc
9488
9489 : see if mkdir exists
9490 set mkdir d_mkdir
9491 eval $inlibc
9492
9493 : see if mkfifo exists
9494 set mkfifo d_mkfifo
9495 eval $inlibc
9496
9497 : see if mktime exists
9498 set mktime d_mktime
9499 eval $inlibc
9500
9501 : see if msgctl exists
9502 set msgctl d_msgctl
9503 eval $inlibc
9504
9505 : see if msgget exists
9506 set msgget d_msgget
9507 eval $inlibc
9508
9509 : see if msgsnd exists
9510 set msgsnd d_msgsnd
9511 eval $inlibc
9512
9513 : see if msgrcv exists
9514 set msgrcv d_msgrcv
9515 eval $inlibc
9516
9517 : see how much of the 'msg*(2)' library is present.
9518 h_msg=true
9519 echo " "
9520 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9521 *"$undef"*) h_msg=false;;
9522 esac
9523 case "$osname" in
9524 freebsd)
9525     case "`ipcs 2>&1`" in
9526     "SVID messages"*"not configured"*)
9527         echo "Your $osname does not have the msg*(2) configured." >&4
9528         h_msg=false
9529         val="$undef"
9530         set msgctl d_msgctl
9531         eval $setvar
9532         set msgget d_msgget
9533         eval $setvar
9534         set msgsnd d_msgsnd
9535         eval $setvar
9536         set msgrcv d_msgrcv
9537         eval $setvar
9538         ;;
9539     esac
9540     ;;
9541 esac
9542 : we could also check for sys/ipc.h ...
9543 if $h_msg && $test `./findhdr sys/msg.h`; then
9544         echo "You have the full msg*(2) library." >&4
9545         val="$define"
9546 else
9547         echo "You don't have the full msg*(2) library." >&4
9548         val="$undef"
9549 fi
9550 set d_msg
9551 eval $setvar
9552
9553 : see if nice exists
9554 set nice d_nice
9555 eval $inlibc
9556
9557 : see if inttypes.h is available
9558 : we want a real compile instead of Inhdr because some systems
9559 : have an inttypes.h which includes non-existent headers
9560 echo " "
9561 $cat >try.c <<EOCP
9562 #include <inttypes.h>
9563 int main() {
9564         static int32_t foo32 = 0x12345678;
9565 }
9566 EOCP
9567 set try
9568 if eval $compile; then
9569         echo "<inttypes.h> found." >&4
9570         val="$define"
9571 else
9572         echo "<inttypes.h> NOT found." >&4
9573         val="$undef"
9574 fi
9575 $rm -f try.c try
9576 set i_inttypes
9577 eval $setvar
9578
9579 : check for int64_t
9580 echo " "
9581 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9582 $cat >try.c <<EOCP
9583 #include <sys/types.h>
9584 #$i_inttypes I_INTTYPES
9585 #ifdef I_INTTYPES
9586 #include <inttypes.h>
9587 #endif
9588 int main() { int64_t x = 7; }
9589 EOCP
9590 set try
9591 if eval $compile; then
9592         val="$define"
9593         echo " Yes, it does." >&4
9594 else
9595         val="$undef"
9596         echo " No, it doesn't." >&4
9597 fi
9598 $rm -f try try.*
9599 set d_int64t
9600 eval $setvar
9601
9602
9603 echo " "
9604 echo "Checking which 64-bit integer type we could use..." >&4
9605
9606 case "$intsize" in
9607 8) val=int
9608    set quadtype
9609    eval $setvar
9610    val='"unsigned int"'
9611    set uquadtype
9612    eval $setvar
9613    quadkind=1
9614    ;;
9615 *) case "$longsize" in
9616    8) val=long
9617       set quadtype
9618       eval $setvar
9619       val='"unsigned long"'
9620       set uquadtype
9621       eval $setvar
9622       quadkind=2
9623       ;;
9624    *) case "$uselonglong:$d_longlong:$longlongsize" in
9625       define:define:8)
9626         val='"long long"'
9627         set quadtype
9628         eval $setvar
9629         val='"unsigned long long"'
9630         set uquadtype
9631         eval $setvar
9632         quadkind=3
9633         ;;
9634       *) case "$d_int64t" in
9635          define)
9636            val=int64_t
9637            set quadtype
9638            eval $setvar
9639            val=uint64_t
9640            set uquadtype
9641            eval $setvar
9642            quadkind=4
9643            ;;
9644          esac
9645          ;;
9646       esac
9647       ;;
9648    esac
9649    ;;
9650 esac
9651
9652 case "$quadtype" in
9653 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9654         undef:define:8)
9655            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9656         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9657         esac
9658         d_quad="$undef"
9659         ;;
9660 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9661             verb="will"
9662         else
9663             verb="could"
9664         fi
9665         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9666         d_quad="$define"
9667         ;;
9668 esac
9669
9670 : check for length of character
9671 echo " "
9672 case "$charsize" in
9673 '')
9674         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9675         $cat >try.c <<'EOCP'
9676 #include <stdio.h>
9677 int main()
9678 {
9679     printf("%d\n", (int)sizeof(char));
9680     exit(0);
9681 }
9682 EOCP
9683         set try
9684         if eval $compile_ok; then
9685                 dflt=`./try`
9686         else
9687                 dflt='1'
9688                 echo "(I can't seem to compile the test program.  Guessing...)"
9689         fi
9690         ;;
9691 *)
9692         dflt="$charsize"
9693         ;;
9694 esac
9695 rp="What is the size of a character (in bytes)?"
9696 . ./myread
9697 charsize="$ans"
9698 $rm -f try.c try
9699
9700
9701 echo " "
9702 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9703
9704 case "$use64bits:$d_quad:$quadtype" in
9705 define:define:?*)
9706         ivtype="$quadtype"
9707         uvtype="$uquadtype"
9708         ivsize=8
9709         uvsize=8
9710         ;;
9711 *)      ivtype="long"
9712         uvtype="unsigned long"
9713         ivsize=$longsize
9714         uvsize=$longsize
9715         ;;
9716 esac
9717
9718 case "$uselongdouble:$d_longdbl" in
9719 define:define)
9720         nvtype="long double"
9721         nvsize=$longdblsize
9722         ;;
9723 *)      nvtype=double
9724         nvsize=$doublesize
9725         ;;
9726 esac
9727
9728 $echo "(IV will be "$ivtype", $ivsize bytes)"
9729 $echo "(UV will be "$uvtype", $uvsize bytes)"
9730 $echo "(NV will be "$nvtype", $nvsize bytes)"
9731
9732 $cat >try.c <<EOCP
9733 #$i_inttypes I_INTTYPES
9734 #ifdef I_INTTYPES
9735 #include <inttypes.h>
9736 #endif
9737 #include <stdio.h>
9738 int main() {
9739 #ifdef INT8
9740    int8_t i =  INT8_MAX;
9741   uint8_t u = UINT8_MAX;
9742   printf("int8_t\n");
9743 #endif
9744 #ifdef INT16
9745    int16_t i =  INT16_MAX;
9746   uint16_t i = UINT16_MAX;
9747   printf("int16_t\n");
9748 #endif
9749 #ifdef INT32
9750    int32_t i =  INT32_MAX;
9751   uint32_t u = UINT32_MAX;
9752   printf("int32_t\n");
9753 #endif
9754 }
9755 EOCP
9756
9757 case "$i8type" in
9758 '')     case "$charsize" in
9759         1)      i8type=char
9760                 u8type="unsigned char"
9761                 i8size=$charsize
9762                 u8size=$charsize
9763                 ;;
9764         esac
9765         ;;
9766 esac
9767 case "$i8type" in
9768 '')     set try -DINT8
9769         if eval $compile; then
9770                 case "`./try$exe_ext`" in
9771                 int8_t) i8type=int8_t
9772                         u8type=uint8_t
9773                         i8size=1
9774                         u8size=1
9775                         ;;
9776                 esac
9777         fi
9778         ;;
9779 esac
9780 case "$i8type" in
9781 '')     if $test $charsize -ge 1; then
9782                 i8type=char
9783                 u8type="unsigned char"
9784                 i8size=$charsize
9785                 u8size=$charsize
9786         fi
9787         ;;
9788 esac
9789
9790 case "$i16type" in
9791 '')     case "$shortsize" in
9792         2)      i16type=short
9793                 u16type="unsigned short"
9794                 i16size=$shortsize
9795                 u16size=$shortsize
9796                 ;;
9797         esac
9798         ;;
9799 esac
9800 case "$i16type" in
9801 '')     set try -DINT16
9802         if eval $compile; then
9803                 case "`./try$exe_ext`" in
9804                 int16_t)
9805                         i16type=int16_t
9806                         u16type=uint16_t
9807                         i16size=2
9808                         u16size=2
9809                         ;;
9810                 esac
9811         fi
9812         ;;
9813 esac
9814 case "$i16type" in
9815 '')     if $test $shortsize -ge 2; then
9816                 i16type=short
9817                 u16type="unsigned short"
9818                 i16size=$shortsize
9819                 u16size=$shortsize
9820         fi
9821         ;;
9822 esac
9823
9824 case "$i32type" in
9825 '')     case "$longsize" in
9826         4)      i32type=long
9827                 u32type="unsigned long"
9828                 i32size=$longsize
9829                 u32size=$longsize
9830                 ;;
9831         *)      case "$intsize" in
9832                 4)      i32type=int
9833                         u32type="unsigned int"
9834                         i32size=$intsize
9835                         u32size=$intsize
9836                         ;;
9837                 esac
9838                 ;;
9839         esac
9840         ;;
9841 esac
9842 case "$i32type" in
9843 '')     set try -DINT32
9844         if eval $compile; then
9845                 case "`./try$exe_ext`" in
9846                 int32_t)
9847                         i32type=int32_t
9848                         u32type=uint32_t
9849                         i32size=4
9850                         u32size=4
9851                         ;;
9852                 esac
9853         fi
9854         ;;
9855 esac
9856 case "$i32type" in
9857 '')     if $test $intsize -ge 4; then
9858                 i32type=int
9859                 u32type="unsigned int"
9860                 i32size=$intsize
9861                 u32size=$intsize
9862         fi
9863         ;;
9864 esac
9865
9866 case "$i64type" in
9867 '')     case "$d_quad:$quadtype" in
9868         define:?*)
9869                 i64type="$quadtype"
9870                 u64type="$uquadtype"
9871                 i64size=8
9872                 u64size=8
9873                 ;;
9874         esac
9875         ;;
9876 esac
9877
9878 $echo "Checking whether your NVs can preserve your UVs..." >&4
9879 $cat <<EOP >try.c
9880 #include <stdio.h>
9881 int main() {
9882     $uvtype k = ($uvtype)~0, l;
9883     $nvtype d;
9884     l = k;
9885     d = ($nvtype)l;
9886     l = ($uvtype)d;
9887     if (l == k)
9888        printf("preserve\n");
9889     exit(0);
9890 }
9891 EOP
9892 set try
9893 if eval $compile; then
9894         case "`./try$exe_ext`" in
9895         preserve) d_nvpresuv="$define" ;;
9896         esac
9897 fi      
9898 case "$d_nvpresuv" in
9899 $define) $echo "Yes, they can."  2>&1 ;;
9900 *)       $echo "No, they can't." 2>&1
9901          d_nvpresuv="$undef"
9902          ;;
9903 esac
9904
9905 $rm -f try.* try
9906
9907 : see if POSIX threads are available
9908 set pthread.h i_pthread
9909 eval $inhdr
9910
9911
9912
9913
9914 : how to create joinable pthreads
9915 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9916         echo " "
9917         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9918         $cat >try.c <<'EOCP'
9919 #include <pthread.h>
9920 int main() {
9921     int detachstate = JOINABLE;
9922 }
9923 EOCP
9924         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9925         if eval $compile; then
9926                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9927                 val="$undef" # Yes, undef.
9928                 set d_old_pthread_create_joinable
9929                 eval $setvar
9930                 val=""
9931                 set old_pthread_create_joinable
9932                 eval $setvar
9933         else
9934                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9935                 if eval $compile; then
9936                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9937                         val="$define"
9938                         set d_old_pthread_create_joinable
9939                         eval $setvar
9940                         val=PTHREAD_CREATE_UNDETACHED
9941                         set old_pthread_create_joinable
9942                         eval $setvar
9943                 else            
9944                         set try -DJOINABLE=__UNDETACHED
9945                         if eval $compile; then
9946                                 echo "You seem to use __UNDETACHED." >&4
9947                                 val="$define"
9948                                 set d_old_pthread_create_joinable
9949                                 eval $setvar
9950                                 val=__UNDETACHED
9951                                 set old_pthread_create_joinable
9952                                 eval $setvar
9953                         else
9954                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9955                                 val="$define"
9956                                 set d_old_pthread_create_joinable
9957                                 eval $setvar
9958                                 val=0
9959                                 set old_pthread_create_joinable
9960                                 eval $setvar
9961                         fi
9962                 fi
9963         fi
9964         $rm -f try try.*
9965 else
9966     d_old_pthread_create_joinable="$undef"
9967     old_pthread_create_joinable=""
9968 fi
9969
9970 : see if pause exists
9971 set pause d_pause
9972 eval $inlibc
9973
9974 : see if pipe exists
9975 set pipe d_pipe
9976 eval $inlibc
9977
9978 : see if poll exists
9979 set poll d_poll
9980 eval $inlibc
9981
9982
9983 : see whether the various POSIXish _yields exist
9984 $cat >try.c <<EOP
9985 #include <pthread.h>
9986 #include <stdio.h>
9987 int main() {
9988 #ifdef SCHED_YIELD
9989         sched_yield();
9990 #else
9991 #ifdef PTHREAD_YIELD
9992         pthread_yield();
9993 #else
9994 #ifdef PTHREAD_YIELD_NULL
9995         pthread_yield(NULL);
9996 #endif
9997 #endif
9998 #endif
9999 }
10000 EOP
10001 : see if sched_yield exists
10002 set try -DSCHED_YIELD
10003 if eval $compile; then
10004     val="$define"
10005     sched_yield='sched_yield()'
10006 else
10007     val="$undef"
10008 fi
10009 case "$usethreads" in
10010 $define)
10011         case "$val" in
10012         $define) echo 'sched_yield() found.' >&4        ;;
10013         *)       echo 'sched_yield() NOT found.' >&4    ;;
10014         esac
10015 esac
10016 set d_sched_yield
10017 eval $setvar
10018
10019 : see if pthread_yield exists
10020 set try -DPTHREAD_YIELD
10021 if eval $compile; then
10022     val="$define"
10023     case "$sched_yield" in
10024     '') sched_yield='pthread_yield()' ;;
10025     esac
10026 else
10027     set try -DPTHREAD_YIELD_NULL
10028     if eval $compile; then
10029         val="$define"
10030         case "$sched_yield" in
10031         '') sched_yield='pthread_yield(NULL)' ;;
10032         esac
10033     else
10034         val="$undef"
10035     fi
10036 fi
10037 case "$usethreads" in
10038 $define)
10039         case "$val" in
10040         $define) echo 'pthread_yield() found.' >&4      ;;
10041         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10042         esac
10043         ;;
10044 esac
10045 set d_pthread_yield
10046 eval $setvar
10047
10048 case "$sched_yield" in
10049 '') sched_yield=undef ;;
10050 esac
10051
10052 $rm -f try try.*
10053
10054 : see if this is a pwd.h system
10055 set pwd.h i_pwd
10056 eval $inhdr
10057
10058 case "$i_pwd" in
10059 $define)
10060         xxx=`./findhdr pwd.h`
10061         $cppstdin $cppflags $cppminus < $xxx >$$.h
10062
10063         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10064                 val="$define"
10065         else
10066                 val="$undef"
10067         fi
10068         set d_pwquota
10069         eval $setvar
10070
10071         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10072                 val="$define"
10073         else
10074                 val="$undef"
10075         fi
10076         set d_pwage
10077         eval $setvar
10078
10079         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10080                 val="$define"
10081         else
10082                 val="$undef"
10083         fi
10084         set d_pwchange
10085         eval $setvar
10086
10087         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10088                 val="$define"
10089         else
10090                 val="$undef"
10091         fi
10092         set d_pwclass
10093         eval $setvar
10094
10095         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10096                 val="$define"
10097         else
10098                 val="$undef"
10099         fi
10100         set d_pwexpire
10101         eval $setvar
10102
10103         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10104                 val="$define"
10105         else
10106                 val="$undef"
10107         fi
10108         set d_pwcomment
10109         eval $setvar
10110
10111         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10112                 val="$define"
10113         else
10114                 val="$undef"
10115         fi
10116         set d_pwgecos
10117         eval $setvar
10118
10119         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10120                 val="$define"
10121         else
10122                 val="$undef"
10123         fi
10124         set d_pwpasswd
10125         eval $setvar
10126
10127         $rm -f $$.h
10128         ;;
10129 *)
10130         val="$undef"; 
10131         set d_pwquota; eval $setvar
10132         set d_pwage; eval $setvar
10133         set d_pwchange; eval $setvar
10134         set d_pwclass; eval $setvar
10135         set d_pwexpire; eval $setvar
10136         set d_pwcomment; eval $setvar
10137         set d_pwgecos; eval $setvar
10138         set d_pwpasswd; eval $setvar
10139         ;;
10140 esac
10141
10142 : see if readdir and friends exist
10143 set readdir d_readdir
10144 eval $inlibc
10145 set seekdir d_seekdir
10146 eval $inlibc
10147 set telldir d_telldir
10148 eval $inlibc
10149 set rewinddir d_rewinddir
10150 eval $inlibc
10151
10152 : see if readlink exists
10153 set readlink d_readlink
10154 eval $inlibc
10155
10156 : see if rename exists
10157 set rename d_rename
10158 eval $inlibc
10159
10160 : see if rmdir exists
10161 set rmdir d_rmdir
10162 eval $inlibc
10163
10164 : see if memory.h is available.
10165 val=''
10166 set memory.h val
10167 eval $inhdr
10168
10169 : See if it conflicts with string.h
10170 case "$val" in
10171 $define)
10172         case "$strings" in
10173         '') ;;
10174         *)
10175                 $cppstdin $cppflags $cppminus < $strings > mem.h
10176                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10177                         echo " "
10178                         echo "We won't be including <memory.h>."
10179                         val="$undef"
10180                 fi
10181                 $rm -f mem.h
10182                 ;;
10183         esac
10184 esac
10185 set i_memory
10186 eval $setvar
10187
10188 : can bcopy handle overlapping blocks?
10189 val="$undef"
10190 case "$d_bcopy" in
10191 "$define")
10192         echo " "
10193         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10194         $cat >try.c <<EOCP
10195 #$i_memory I_MEMORY
10196 #$i_stdlib I_STDLIB
10197 #$i_string I_STRING
10198 #$i_unistd I_UNISTD
10199 EOCP
10200         $cat >>try.c <<'EOCP'
10201 #include <stdio.h>
10202 #ifdef I_MEMORY
10203 #  include <memory.h>
10204 #endif
10205 #ifdef I_STDLIB
10206 #  include <stdlib.h>
10207 #endif
10208 #ifdef I_STRING
10209 #  include <string.h>
10210 #else
10211 #  include <strings.h>
10212 #endif
10213 #ifdef I_UNISTD
10214 #  include <unistd.h>  /* Needed for NetBSD */
10215 #endif
10216 int main()
10217 {
10218 char buf[128], abc[128];
10219 char *b;
10220 int len;
10221 int off;
10222 int align;
10223
10224 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10225
10226 for (align = 7; align >= 0; align--) {
10227         for (len = 36; len; len--) {
10228                 b = buf+align;
10229                 bcopy(abc, b, len);
10230                 for (off = 1; off <= len; off++) {
10231                         bcopy(b, b+off, len);
10232                         bcopy(b+off, b, len);
10233                         if (bcmp(b, abc, len))
10234                                 exit(1);
10235                 }
10236         }
10237 }
10238 exit(0);
10239 }
10240 EOCP
10241         set try
10242         if eval $compile_ok; then
10243                 if ./try 2>/dev/null; then
10244                         echo "Yes, it can."
10245                         val="$define"
10246                 else
10247                         echo "It can't, sorry."
10248                         case "$d_memmove" in
10249                         "$define") echo "But that's Ok since you have memmove()." ;;
10250                         esac
10251                 fi
10252         else
10253                 echo "(I can't compile the test program, so we'll assume not...)"
10254                 case "$d_memmove" in
10255                 "$define") echo "But that's Ok since you have memmove()." ;;
10256                 esac
10257         fi
10258         ;;
10259 esac
10260 $rm -f try.* try core
10261 set d_safebcpy
10262 eval $setvar
10263
10264 : can memcpy handle overlapping blocks?
10265 val="$undef"
10266 case "$d_memcpy" in
10267 "$define")
10268         echo " "
10269         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10270         $cat >try.c <<EOCP
10271 #$i_memory I_MEMORY
10272 #$i_stdlib I_STDLIB
10273 #$i_string I_STRING
10274 #$i_unistd I_UNISTD
10275 EOCP
10276         $cat >>try.c <<'EOCP'
10277 #include <stdio.h>
10278 #ifdef I_MEMORY
10279 #  include <memory.h>
10280 #endif
10281 #ifdef I_STDLIB
10282 #  include <stdlib.h>
10283 #endif
10284 #ifdef I_STRING
10285 #  include <string.h>
10286 #else
10287 #  include <strings.h>
10288 #endif
10289 #ifdef I_UNISTD
10290 #  include <unistd.h>  /* Needed for NetBSD */
10291 #endif
10292 int main()
10293 {
10294 char buf[128], abc[128];
10295 char *b;
10296 int len;
10297 int off;
10298 int align;
10299
10300 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10301    try to store the string in read-only memory. */
10302 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10303
10304 for (align = 7; align >= 0; align--) {
10305         for (len = 36; len; len--) {
10306                 b = buf+align;
10307                 memcpy(b, abc, len);
10308                 for (off = 1; off <= len; off++) {
10309                         memcpy(b+off, b, len);
10310                         memcpy(b, b+off, len);
10311                         if (memcmp(b, abc, len))
10312                                 exit(1);
10313                 }
10314         }
10315 }
10316 exit(0);
10317 }
10318 EOCP
10319         set try
10320         if eval $compile_ok; then
10321                 if ./try 2>/dev/null; then
10322                         echo "Yes, it can."
10323                         val="$define"
10324                 else
10325                         echo "It can't, sorry."
10326                         case "$d_memmove" in
10327                         "$define") echo "But that's Ok since you have memmove()." ;;
10328                         esac
10329                 fi
10330         else
10331                 echo "(I can't compile the test program, so we'll assume not...)"
10332                 case "$d_memmove" in
10333                 "$define") echo "But that's Ok since you have memmove()." ;;
10334                 esac
10335         fi
10336         ;;
10337 esac
10338 $rm -f try.* try core
10339 set d_safemcpy
10340 eval $setvar
10341
10342 : can memcmp be trusted to compare relative magnitude?
10343 val="$undef"
10344 case "$d_memcmp" in
10345 "$define")
10346         echo " "
10347         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10348         $cat >try.c <<EOCP
10349 #$i_memory I_MEMORY
10350 #$i_stdlib I_STDLIB
10351 #$i_string I_STRING
10352 #$i_unistd I_UNISTD
10353 EOCP
10354         $cat >>try.c <<'EOCP'
10355 #include <stdio.h>
10356 #ifdef I_MEMORY
10357 #  include <memory.h>
10358 #endif
10359 #ifdef I_STDLIB
10360 #  include <stdlib.h>
10361 #endif
10362 #ifdef I_STRING
10363 #  include <string.h>
10364 #else
10365 #  include <strings.h>
10366 #endif
10367 #ifdef I_UNISTD
10368 #  include <unistd.h>  /* Needed for NetBSD */
10369 #endif
10370 int main()
10371 {
10372 char a = -1;
10373 char b = 0;
10374 if ((a < b) && memcmp(&a, &b, 1) < 0)
10375         exit(1);
10376 exit(0);
10377 }
10378 EOCP
10379         set try
10380         if eval $compile_ok; then
10381                 if ./try 2>/dev/null; then
10382                         echo "Yes, it can."
10383                         val="$define"
10384                 else
10385                         echo "No, it can't (it uses signed chars)."
10386                 fi
10387         else
10388                 echo "(I can't compile the test program, so we'll assume not...)"
10389         fi
10390         ;;
10391 esac
10392 $rm -f try.* try core
10393 set d_sanemcmp
10394 eval $setvar
10395
10396 : see if select exists
10397 set select d_select
10398 eval $inlibc
10399
10400 : see if semctl exists
10401 set semctl d_semctl
10402 eval $inlibc
10403
10404 : see if semget exists
10405 set semget d_semget
10406 eval $inlibc
10407
10408 : see if semop exists
10409 set semop d_semop
10410 eval $inlibc
10411
10412 : see how much of the 'sem*(2)' library is present.
10413 h_sem=true
10414 echo " "
10415 case "$d_semctl$d_semget$d_semop" in
10416 *"$undef"*) h_sem=false;;
10417 esac
10418 case "$osname" in
10419 freebsd)
10420     case "`ipcs 2>&1`" in
10421     "SVID messages"*"not configured"*)
10422         echo "Your $osname does not have the sem*(2) configured." >&4
10423         h_sem=false
10424         val="$undef"
10425         set semctl d_semctl
10426         eval $setvar
10427         set semget d_semget
10428         eval $setvar
10429         set semop d_semop
10430         eval $setvar
10431         ;;
10432     esac
10433     ;;
10434 esac
10435 : we could also check for sys/ipc.h ...
10436 if $h_sem && $test `./findhdr sys/sem.h`; then
10437         echo "You have the full sem*(2) library." >&4
10438         val="$define"
10439 else
10440         echo "You don't have the full sem*(2) library." >&4
10441         val="$undef"
10442 fi
10443 set d_sem
10444 eval $setvar
10445
10446 : see whether sys/sem.h defines union semun
10447 echo " "
10448 $cat > try.c <<'END'
10449 #include <sys/types.h>
10450 #include <sys/ipc.h>
10451 #include <sys/sem.h>
10452 int main () { union semun semun; semun.buf = 0; }
10453 END
10454 set try
10455 if eval $compile; then
10456     echo "You have union semun in <sys/sem.h>." >&4
10457     val="$define"
10458 else
10459     echo "You do not have union semun in <sys/sem.h>." >&4
10460     val="$undef"
10461 fi
10462 $rm -f try try.c try.h
10463 set d_union_semun
10464 eval $setvar
10465
10466 : see how to do semctl IPC_STAT
10467 case "$d_sem" in
10468 $define)
10469     : see whether semctl IPC_STAT can use union semun
10470     echo " "
10471     $cat > try.h <<END
10472 #ifndef S_IRUSR
10473 #   ifdef S_IREAD
10474 #       define S_IRUSR S_IREAD
10475 #       define S_IWUSR S_IWRITE
10476 #       define S_IXUSR S_IEXEC
10477 #   else
10478 #       define S_IRUSR 0400
10479 #       define S_IWUSR 0200
10480 #       define S_IXUSR 0100
10481 #   endif
10482 #   define S_IRGRP (S_IRUSR>>3)
10483 #   define S_IWGRP (S_IWUSR>>3)
10484 #   define S_IXGRP (S_IXUSR>>3)
10485 #   define S_IROTH (S_IRUSR>>6)
10486 #   define S_IWOTH (S_IWUSR>>6)
10487 #   define S_IXOTH (S_IXUSR>>6)
10488 #endif
10489 #ifndef S_IRWXU
10490 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10491 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10492 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10493 #endif
10494 END
10495
10496     $cat > try.c <<END
10497 #include <sys/types.h>
10498 #include <sys/ipc.h>
10499 #include <sys/sem.h>
10500 #include <sys/stat.h>
10501 #include <stdio.h>
10502 #include <errno.h>
10503 #include "try.h"
10504 #ifndef errno
10505 extern int errno;
10506 #endif
10507 #$d_union_semun HAS_UNION_SEMUN
10508 int main() {
10509     union semun
10510 #ifndef HAS_UNION_SEMUN
10511     {
10512         int val;
10513         struct semid_ds *buf;
10514         unsigned short *array;
10515     }
10516 #endif
10517     arg;
10518     int sem, st;
10519
10520 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10521     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10522     if (sem > -1) {
10523         struct semid_ds argbuf;
10524         arg.buf = &argbuf;
10525 #       ifdef IPC_STAT
10526         st = semctl(sem, 0, IPC_STAT, arg);
10527         if (st == 0)
10528             printf("semun\n");
10529         else
10530 #       endif /* IPC_STAT */
10531             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10532 #       ifdef IPC_RMID
10533         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10534 #       endif /* IPC_RMID */
10535             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10536     } else
10537 #endif /* IPC_PRIVATE && ... */
10538         printf("semget failed: errno = %d\n", errno);
10539   return 0;
10540 }
10541 END
10542     val="$undef"
10543     set try
10544     if eval $compile; then
10545         xxx=`./try`
10546         case "$xxx" in
10547         semun) val="$define" ;;
10548         esac
10549     fi
10550     $rm -f try try.c
10551     set d_semctl_semun
10552     eval $setvar
10553     case "$d_semctl_semun" in
10554     $define)
10555         echo "You can use union semun for semctl IPC_STAT." >&4
10556         also='also'
10557         ;;
10558     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10559         also=''
10560         ;;
10561     esac
10562
10563     : see whether semctl IPC_STAT can use struct semid_ds pointer
10564     $cat > try.c <<'END'
10565 #include <sys/types.h>
10566 #include <sys/ipc.h>
10567 #include <sys/sem.h>
10568 #include <sys/stat.h>
10569 #include "try.h"
10570 #include <stdio.h>
10571 #include <errno.h>
10572 #ifndef errno
10573 extern int errno;
10574 #endif
10575 int main() {
10576     struct semid_ds arg;
10577     int sem, st;
10578
10579 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10580     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10581     if (sem > -1) {
10582 #       ifdef IPC_STAT
10583         st = semctl(sem, 0, IPC_STAT, &arg);
10584         if (st == 0)
10585             printf("semid_ds\n");
10586         else
10587 #       endif /* IPC_STAT */
10588             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10589 #       ifdef IPC_RMID
10590         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10591 #       endif /* IPC_RMID */
10592             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10593     } else
10594 #endif /* IPC_PRIVATE && ... */
10595         printf("semget failed: errno = %d\n", errno);
10596
10597     return 0;
10598 }
10599 END
10600     val="$undef"
10601     set try
10602     if eval $compile; then
10603         xxx=`./try`
10604         case "$xxx" in
10605         semid_ds) val="$define" ;;
10606         esac
10607     fi
10608     $rm -f try try.c
10609     set d_semctl_semid_ds
10610     eval $setvar
10611     case "$d_semctl_semid_ds" in
10612     $define)
10613         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10614         ;;
10615     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10616         ;;
10617     esac
10618     $rm -f try.h
10619     ;;
10620 *)  val="$undef"
10621
10622     # We do not have the full sem*(2) library, so assume we can not
10623     # use either.
10624
10625     set d_semctl_semun
10626     eval $setvar
10627
10628     set d_semctl_semid_ds
10629     eval $setvar
10630     ;;
10631 esac
10632
10633 : see if setegid exists
10634 set setegid d_setegid
10635 eval $inlibc
10636
10637 : see if seteuid exists
10638 set seteuid d_seteuid
10639 eval $inlibc
10640
10641 : see if setgrent exists
10642 set setgrent d_setgrent
10643 eval $inlibc
10644
10645 : see if sethostent exists
10646 set sethostent d_sethent
10647 eval $inlibc
10648
10649 : see if setlinebuf exists
10650 set setlinebuf d_setlinebuf
10651 eval $inlibc
10652
10653 : see if setlocale exists
10654 set setlocale d_setlocale
10655 eval $inlibc
10656
10657 : see if setnetent exists
10658 set setnetent d_setnent
10659 eval $inlibc
10660
10661 : see if setprotoent exists
10662 set setprotoent d_setpent
10663 eval $inlibc
10664
10665 : see if setpgid exists
10666 set setpgid d_setpgid
10667 eval $inlibc
10668
10669 : see if setpgrp2 exists
10670 set setpgrp2 d_setpgrp2
10671 eval $inlibc
10672
10673 : see if setpriority exists
10674 set setpriority d_setprior
10675 eval $inlibc
10676
10677 : see if setpwent exists
10678 set setpwent d_setpwent
10679 eval $inlibc
10680
10681 : see if setregid exists
10682 set setregid d_setregid
10683 eval $inlibc
10684 set setresgid d_setresgid
10685 eval $inlibc
10686
10687 : see if setreuid exists
10688 set setreuid d_setreuid
10689 eval $inlibc
10690 set setresuid d_setresuid
10691 eval $inlibc
10692
10693 : see if setrgid exists
10694 set setrgid d_setrgid
10695 eval $inlibc
10696
10697 : see if setruid exists
10698 set setruid d_setruid
10699 eval $inlibc
10700
10701 : see if setservent exists
10702 set setservent d_setsent
10703 eval $inlibc
10704
10705 : see if setsid exists
10706 set setsid d_setsid
10707 eval $inlibc
10708
10709 : see if setspent exists
10710 set setspent d_setspent
10711 eval $inlibc
10712
10713 : see if setvbuf exists
10714 set setvbuf d_setvbuf
10715 eval $inlibc
10716
10717 : see if sfio.h is available
10718 set sfio.h i_sfio
10719 eval $inhdr
10720
10721
10722 : see if sfio library is available
10723 case "$i_sfio" in
10724 $define)
10725         val=''
10726         set sfreserve val
10727         eval $inlibc
10728         ;;
10729 *)
10730         val="$undef"
10731         ;;
10732 esac
10733 : Ok, but do we want to use it.
10734 case "$val" in
10735 $define)
10736         case "$usesfio" in
10737         true|$define|[yY]*) dflt='y';;
10738         *) dflt='n';;
10739         esac
10740         echo "$package can use the sfio library, but it is experimental."
10741         rp="You seem to have sfio available, do you want to try using it?"
10742         . ./myread
10743         case "$ans" in
10744         y|Y) ;;
10745         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10746                 val="$undef"
10747                 : Remove sfio from list of libraries to use
10748                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10749                 shift
10750                 libs="$*"
10751                 echo "libs = $libs" >&4
10752                 ;;
10753         esac
10754         ;;
10755 *)      case "$usesfio" in
10756         true|$define|[yY]*)
10757                 echo "Sorry, cannot find sfio on this machine" >&4
10758                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10759                 ;;
10760         esac
10761         ;;
10762 esac
10763 set d_sfio
10764 eval $setvar
10765 case "$d_sfio" in
10766 $define) usesfio='true';;
10767 *) usesfio='false';;
10768 esac
10769
10770 : see if shmctl exists
10771 set shmctl d_shmctl
10772 eval $inlibc
10773
10774 : see if shmget exists
10775 set shmget d_shmget
10776 eval $inlibc
10777
10778 : see if shmat exists
10779 set shmat d_shmat
10780 eval $inlibc
10781 : see what shmat returns
10782 case "$d_shmat" in
10783 "$define")
10784         $cat >shmat.c <<'END'
10785 #include <sys/shm.h>
10786 void *shmat();
10787 END
10788         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10789                 shmattype='void *'
10790         else
10791                 shmattype='char *'
10792         fi
10793         echo "and it returns ($shmattype)." >&4
10794         : see if a prototype for shmat is available
10795         xxx=`./findhdr sys/shm.h`
10796         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10797         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10798                 val="$define"
10799         else
10800                 val="$undef"
10801         fi
10802         $rm -f shmat.[co]
10803         ;;
10804 *)
10805         val="$undef"
10806         ;;
10807 esac
10808 set d_shmatprototype
10809 eval $setvar
10810
10811 : see if shmdt exists
10812 set shmdt d_shmdt
10813 eval $inlibc
10814
10815 : see how much of the 'shm*(2)' library is present.
10816 h_shm=true
10817 echo " "
10818 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10819 *"$undef"*) h_shm=false;;
10820 esac
10821 case "$osname" in
10822 freebsd)
10823     case "`ipcs 2>&1`" in
10824     "SVID shared memory"*"not configured"*)
10825         echo "Your $osname does not have the shm*(2) configured." >&4
10826         h_shm=false
10827         val="$undef"
10828         set shmctl d_shmctl
10829         evat $setvar
10830         set shmget d_shmget
10831         evat $setvar
10832         set shmat d_shmat
10833         evat $setvar
10834         set shmdt d_shmdt
10835         evat $setvar
10836         ;;
10837     esac
10838     ;;
10839 esac
10840 : we could also check for sys/ipc.h ...
10841 if $h_shm && $test `./findhdr sys/shm.h`; then
10842         echo "You have the full shm*(2) library." >&4
10843         val="$define"
10844 else
10845         echo "You don't have the full shm*(2) library." >&4
10846         val="$undef"
10847 fi
10848 set d_shm
10849 eval $setvar
10850
10851 echo " "
10852 : see if we have sigaction
10853 if set sigaction val -f d_sigaction; eval $csym; $val; then
10854         echo 'sigaction() found.' >&4
10855         $cat > try.c <<'EOP'
10856 #include <stdio.h>
10857 #include <sys/types.h>
10858 #include <signal.h>
10859 int main()
10860 {
10861     struct sigaction act, oact;
10862     act.sa_flags = 0;
10863     oact.sa_handler = 0;
10864     /* so that act and oact are used */
10865     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10866 }
10867 EOP
10868         set try
10869         if eval $compile_ok; then
10870                 val="$define"
10871         else
10872                 echo "But you don't seem to have a useable struct sigaction." >&4
10873                 val="$undef"
10874         fi
10875 else
10876         echo 'sigaction NOT found.' >&4
10877         val="$undef"
10878 fi
10879 set d_sigaction; eval $setvar
10880 $rm -f try try$_o try.c
10881
10882 : see if sigsetjmp exists
10883 echo " "
10884 case "$d_sigsetjmp" in
10885 '')
10886         $cat >try.c <<'EOP'
10887 #include <setjmp.h>
10888 sigjmp_buf env;
10889 int set = 1;
10890 int main()
10891 {
10892         if (sigsetjmp(env,1))
10893                 exit(set);
10894         set = 0;
10895         siglongjmp(env, 1);
10896         exit(1);
10897 }
10898 EOP
10899         set try
10900         if eval $compile; then
10901                 if ./try >/dev/null 2>&1; then
10902                         echo "POSIX sigsetjmp found." >&4
10903                         val="$define"
10904                 else
10905                         $cat >&4 <<EOM
10906 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10907 I'll ignore them.
10908 EOM
10909                         val="$undef"
10910                 fi
10911         else
10912                 echo "sigsetjmp not found." >&4
10913                 val="$undef"
10914         fi
10915         ;;
10916 *) val="$d_sigsetjmp"
10917         case "$d_sigsetjmp" in
10918         $define) echo "POSIX sigsetjmp found." >&4;;
10919         $undef) echo "sigsetjmp not found." >&4;;
10920         esac
10921         ;;
10922 esac
10923 set d_sigsetjmp
10924 eval $setvar
10925 $rm -f try.c try
10926
10927 : see if sqrtl exists
10928 set sqrtl d_sqrtl
10929 eval $inlibc
10930
10931 : see if sys/stat.h is available
10932 set sys/stat.h i_sysstat
10933 eval $inhdr
10934
10935
10936 : see if stat knows about block sizes
10937 echo " "
10938 echo "Checking to see if your struct stat has st_blocks field..." >&4
10939 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10940 eval $hasfield
10941
10942
10943 : see if this is a sys/vfs.h system
10944 set sys/vfs.h i_sysvfs
10945 eval $inhdr
10946
10947
10948 : see if this is a sys/statfs.h system
10949 set sys/statfs.h i_sysstatfs
10950 eval $inhdr
10951
10952
10953 echo " "
10954 echo "Checking to see if your system supports struct statfs..." >&4
10955 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
10956 eval $hasstruct
10957 case "$d_statfs_s" in
10958 "$define")      echo "Yes, it does."   ;;
10959 *)              echo "No, it doesn't." ;;
10960 esac
10961
10962
10963
10964 : see if struct statfs knows about f_flags
10965 case "$d_statfs_s" in
10966 define) 
10967         echo " "
10968         echo "Checking to see if your struct statfs has f_flags field..." >&4
10969         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
10970         eval $hasfield
10971         ;;
10972 *)      val="$undef"
10973         set d_statfs_f_flags
10974         eval $setvar
10975         ;;
10976 esac
10977 case "$d_statfs_f_flags" in
10978 "$define")      echo "Yes, it does."   ;;
10979 *)              echo "No, it doesn't." ;;
10980 esac
10981
10982 : see if _ptr and _cnt from stdio act std
10983 echo " "
10984 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10985         echo "(Looks like you have stdio.h from Linux.)"
10986         case "$stdio_ptr" in
10987         '') stdio_ptr='((fp)->_IO_read_ptr)'
10988                 ptr_lval=$define
10989                 ;;
10990         *)      ptr_lval=$d_stdio_ptr_lval;;
10991         esac
10992         case "$stdio_cnt" in
10993         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10994                 cnt_lval=$undef
10995                 ;;
10996         *)      cnt_lval=$d_stdio_cnt_lval;;
10997         esac
10998         case "$stdio_base" in
10999         '') stdio_base='((fp)->_IO_read_base)';;
11000         esac
11001         case "$stdio_bufsiz" in
11002         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11003         esac
11004 else
11005         case "$stdio_ptr" in
11006         '') stdio_ptr='((fp)->_ptr)'
11007                 ptr_lval=$define
11008                 ;;
11009         *)      ptr_lval=$d_stdio_ptr_lval;;
11010         esac
11011         case "$stdio_cnt" in
11012         '') stdio_cnt='((fp)->_cnt)'
11013                 cnt_lval=$define
11014                 ;;
11015         *)      cnt_lval=$d_stdio_cnt_lval;;
11016         esac
11017         case "$stdio_base" in
11018         '') stdio_base='((fp)->_base)';;
11019         esac
11020         case "$stdio_bufsiz" in
11021         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11022         esac
11023 fi
11024 : test whether _ptr and _cnt really work
11025 echo "Checking how std your stdio is..." >&4
11026 $cat >try.c <<EOP
11027 #include <stdio.h>
11028 #define FILE_ptr(fp)    $stdio_ptr
11029 #define FILE_cnt(fp)    $stdio_cnt
11030 int main() {
11031         FILE *fp = fopen("try.c", "r");
11032         char c = getc(fp);
11033         if (
11034                 18 <= FILE_cnt(fp) &&
11035                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11036         )
11037                 exit(0);
11038         exit(1);
11039 }
11040 EOP
11041 val="$undef"
11042 set try
11043 if eval $compile; then
11044         if ./try; then
11045                 echo "Your stdio acts pretty std."
11046                 val="$define"
11047         else
11048                 echo "Your stdio isn't very std."
11049         fi
11050 else
11051         echo "Your stdio doesn't appear very std."
11052 fi
11053 $rm -f try.c try
11054 set d_stdstdio
11055 eval $setvar
11056
11057 : Can _ptr be used as an lvalue?
11058 case "$d_stdstdio$ptr_lval" in
11059 $define$define) val=$define ;;
11060 *) val=$undef ;;
11061 esac
11062 set d_stdio_ptr_lval
11063 eval $setvar
11064
11065 : Can _cnt be used as an lvalue?
11066 case "$d_stdstdio$cnt_lval" in
11067 $define$define) val=$define ;;
11068 *) val=$undef ;;
11069 esac
11070 set d_stdio_cnt_lval
11071 eval $setvar
11072
11073 : see if _base is also standard
11074 val="$undef"
11075 case "$d_stdstdio" in
11076 $define)
11077         $cat >try.c <<EOP
11078 #include <stdio.h>
11079 #define FILE_base(fp)   $stdio_base
11080 #define FILE_bufsiz(fp) $stdio_bufsiz
11081 int main() {
11082         FILE *fp = fopen("try.c", "r");
11083         char c = getc(fp);
11084         if (
11085                 19 <= FILE_bufsiz(fp) &&
11086                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11087         )
11088                 exit(0);
11089         exit(1);
11090 }
11091 EOP
11092         set try
11093         if eval $compile; then
11094                 if ./try; then
11095                         echo "And its _base field acts std."
11096                         val="$define"
11097                 else
11098                         echo "But its _base field isn't std."
11099                 fi
11100         else
11101                 echo "However, it seems to be lacking the _base field."
11102         fi
11103         $rm -f try.c try
11104         ;;
11105 esac
11106 set d_stdiobase
11107 eval $setvar
11108
11109 $cat >&4 <<EOM
11110 Checking how to access stdio streams by file descriptor number...
11111 EOM
11112 case "$stdio_stream_array" in
11113 '')     $cat >try.c <<EOCP
11114 #include <stdio.h>
11115 int main() {
11116   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11117     printf("yes\n");
11118 }
11119 EOCP
11120         for s in _iob __iob __sF
11121         do
11122                 set try -DSTDIO_STREAM_ARRAY=$s
11123                 if eval $compile; then
11124                         case "`./try$exe_ext`" in
11125                         yes)    stdio_stream_array=$s; break ;;
11126                         esac
11127                 fi
11128         done
11129         $rm -f try.* try$exe_ext
11130 esac
11131 case "$stdio_stream_array" in
11132 '')     $cat >&4 <<EOM
11133 I can't figure out how to access stdio streams by file descriptor number.
11134 EOM
11135         d_stdio_stream_array="$undef"
11136         ;;
11137 *)      $cat >&4 <<EOM
11138 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11139 EOM
11140         d_stdio_stream_array="$define"
11141         ;;
11142 esac
11143
11144 : see if strcoll exists
11145 set strcoll d_strcoll
11146 eval $inlibc
11147
11148 : check for structure copying
11149 echo " "
11150 echo "Checking to see if your C compiler can copy structs..." >&4
11151 $cat >try.c <<'EOCP'
11152 int main()
11153 {
11154         struct blurfl {
11155                 int dyick;
11156         } foo, bar;
11157
11158         foo = bar;
11159 }
11160 EOCP
11161 if $cc -c try.c >/dev/null 2>&1 ; then
11162         val="$define"
11163         echo "Yup, it can."
11164 else
11165         val="$undef"
11166         echo "Nope, it can't."
11167 fi
11168 set d_strctcpy
11169 eval $setvar
11170 $rm -f try.*
11171
11172 : see if strerror and/or sys_errlist[] exist
11173 echo " "
11174 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11175     if set strerror val -f d_strerror; eval $csym; $val; then
11176                 echo 'strerror() found.' >&4
11177                 d_strerror="$define"
11178                 d_strerrm='strerror(e)'
11179                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11180                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11181                         d_syserrlst="$define"
11182                 else
11183                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11184                         d_syserrlst="$undef"
11185                 fi
11186     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11187                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11188                 echo 'strerror() found in string header.' >&4
11189                 d_strerror="$define"
11190                 d_strerrm='strerror(e)'
11191                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11192                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11193                                 d_syserrlst="$define"
11194                 else
11195                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11196                         d_syserrlst="$undef"
11197                 fi
11198     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11199                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11200                 d_strerror="$undef"
11201                 d_syserrlst="$define"
11202                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11203     else
11204                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11205                 d_strerror="$undef"
11206                 d_syserrlst="$undef"
11207                 d_strerrm='"unknown"'
11208     fi
11209 fi
11210
11211 : see if strtod exists
11212 set strtod d_strtod
11213 eval $inlibc
11214
11215 : see if strtol exists
11216 set strtol d_strtol
11217 eval $inlibc
11218
11219 : see if strtold exists
11220 set strtold d_strtold
11221 eval $inlibc
11222
11223 : see if strtoll exists
11224 set strtoll d_strtoll
11225 eval $inlibc
11226
11227 : see if strtoul exists
11228 set strtoul d_strtoul
11229 eval $inlibc
11230
11231 : see if strtoull exists
11232 set strtoull d_strtoull
11233 eval $inlibc
11234
11235 : see if strtouq exists
11236 set strtouq d_strtouq
11237 eval $inlibc
11238
11239 : see if strxfrm exists
11240 set strxfrm d_strxfrm
11241 eval $inlibc
11242
11243 : see if symlink exists
11244 set symlink d_symlink
11245 eval $inlibc
11246
11247 : see if syscall exists
11248 set syscall d_syscall
11249 eval $inlibc
11250
11251 : see if sysconf exists
11252 set sysconf d_sysconf
11253 eval $inlibc
11254
11255 : see if system exists
11256 set system d_system
11257 eval $inlibc
11258
11259 : see if tcgetpgrp exists
11260 set tcgetpgrp d_tcgetpgrp
11261 eval $inlibc
11262
11263 : see if tcsetpgrp exists
11264 set tcsetpgrp d_tcsetpgrp
11265 eval $inlibc
11266
11267 : see if prototype for telldir is available
11268 echo " "
11269 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11270 eval $hasproto
11271
11272 : see if this is a sys/times.h system
11273 set sys/times.h i_systimes
11274 eval $inhdr
11275
11276 : see if times exists
11277 echo " "
11278 if set times val -f d_times; eval $csym; $val; then
11279         echo 'times() found.' >&4
11280         d_times="$define"
11281         inc=''
11282         case "$i_systimes" in
11283         "$define") inc='sys/times.h';;
11284         esac
11285         rp="What is the type returned by times() on this system?"
11286         set clock_t clocktype long stdio.h sys/types.h $inc
11287         eval $typedef_ask
11288 else
11289         echo 'times() NOT found, hope that will do.' >&4
11290         d_times="$undef"
11291         clocktype='int'
11292 fi
11293
11294 : see if truncate exists
11295 set truncate d_truncate
11296 eval $inlibc
11297
11298 : see if tzname[] exists
11299 echo " "
11300 if set tzname val -a d_tzname; eval $csym; $val; then
11301         val="$define"
11302         echo 'tzname[] found.' >&4
11303 else
11304         val="$undef"
11305         echo 'tzname[] NOT found.' >&4
11306 fi
11307 set d_tzname
11308 eval $setvar
11309
11310 : see if umask exists
11311 set umask d_umask
11312 eval $inlibc
11313
11314 : see if ustat exists
11315 set ustat d_ustat
11316 eval $inlibc
11317
11318 : backward compatibility for d_hvfork
11319 if test X$d_hvfork != X; then
11320         d_vfork="$d_hvfork"
11321         d_hvfork=''
11322 fi
11323 : see if there is a vfork
11324 val=''
11325 set vfork val
11326 eval $inlibc
11327
11328 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11329 : perl on Solaris 2.x, and probably elsewhere.
11330 case "$val" in
11331 $define)
11332         echo " "
11333         case "$usevfork" in
11334         false) dflt='n';;
11335         *) dflt='y';;
11336         esac
11337         cat <<'EOM'
11338  
11339 Perl can only use a vfork() that doesn't suffer from strict
11340 restrictions on calling functions or modifying global data in
11341 the child.  For example, glibc-2.1 contains such a vfork()
11342 that is unsuitable.  If your system provides a proper fork()
11343 call, chances are that you do NOT want perl to use vfork().
11344
11345 EOM
11346         rp="Do you still want to use vfork()?"
11347         . ./myread
11348         case "$ans" in
11349         y|Y) ;;
11350         *)
11351                 echo "Ok, we won't use vfork()."
11352                 val="$undef"
11353                 ;;
11354         esac
11355         ;;
11356 esac
11357 set d_vfork
11358 eval $setvar
11359 case "$d_vfork" in
11360 $define) usevfork='true';;
11361 *) usevfork='false';;
11362 esac
11363
11364 : see if this is an sysdir system
11365 set sys/dir.h i_sysdir
11366 eval $inhdr
11367
11368 : see if this is an sysndir system
11369 set sys/ndir.h i_sysndir
11370 eval $inhdr
11371
11372 : see if closedir exists
11373 set closedir d_closedir
11374 eval $inlibc
11375
11376 case "$d_closedir" in
11377 "$define")
11378         echo " "
11379         echo "Checking whether closedir() returns a status..." >&4
11380         cat > closedir.c <<EOM
11381 #$i_dirent I_DIRENT             /**/
11382 #$i_sysdir I_SYS_DIR            /**/
11383 #$i_sysndir I_SYS_NDIR          /**/
11384 #$i_systypes I_SYS_TYPES        /**/
11385
11386 #if defined(I_SYS_TYPES)
11387 #include <sys/types.h>
11388 #endif
11389 #if defined(I_DIRENT)
11390 #include <dirent.h>
11391 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11392 #include <sys/dir.h>
11393 #endif
11394 #else
11395 #ifdef I_SYS_NDIR
11396 #include <sys/ndir.h>
11397 #else
11398 #ifdef I_SYS_DIR
11399 #ifdef hp9000s500
11400 #include <ndir.h>       /* may be wrong in the future */
11401 #else
11402 #include <sys/dir.h>
11403 #endif
11404 #endif
11405 #endif
11406 #endif 
11407 int main() { return closedir(opendir(".")); }
11408 EOM
11409         set closedir
11410         if eval $compile_ok; then
11411                 if ./closedir > /dev/null 2>&1 ; then
11412                         echo "Yes, it does."
11413                         val="$undef"
11414                 else
11415                         echo "No, it doesn't."
11416                         val="$define"
11417                 fi
11418         else
11419                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11420                 val="$define"
11421         fi
11422         ;;
11423 *)
11424         val="$undef";
11425         ;;
11426 esac
11427 set d_void_closedir
11428 eval $setvar
11429 $rm -f closedir*
11430 : check for volatile keyword
11431 echo " "
11432 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11433 $cat >try.c <<'EOCP'
11434 int main()
11435 {
11436         typedef struct _goo_struct goo_struct;
11437         goo_struct * volatile goo = ((goo_struct *)0);
11438         struct _goo_struct {
11439                 long long_int;
11440                 int reg_int;
11441                 char char_var;
11442         };
11443         typedef unsigned short foo_t;
11444         char *volatile foo;
11445         volatile int bar;
11446         volatile foo_t blech;
11447         foo = foo;
11448 }
11449 EOCP
11450 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11451         val="$define"
11452         echo "Yup, it does."
11453 else
11454         val="$undef"
11455         echo "Nope, it doesn't."
11456 fi
11457 set d_volatile
11458 eval $setvar
11459 $rm -f try.*
11460
11461 : see if there is a wait4
11462 set wait4 d_wait4
11463 eval $inlibc
11464
11465 : see if waitpid exists
11466 set waitpid d_waitpid
11467 eval $inlibc
11468
11469 : see if wcstombs exists
11470 set wcstombs d_wcstombs
11471 eval $inlibc
11472
11473 : see if wctomb exists
11474 set wctomb d_wctomb
11475 eval $inlibc
11476
11477 : preserve RCS keywords in files with variable substitution, grrr
11478 Date='$Date'
11479 Id='$Id'
11480 Log='$Log'
11481 RCSfile='$RCSfile'
11482 Revision='$Revision'
11483
11484 case "$crosscompile" in
11485 ''|[nN]*) crosscompile="$undef" ;;
11486 esac
11487
11488 case "$osname" in
11489 next|rhapsody) multiarch="$define" ;;
11490 esac
11491 case "$multiarch" in
11492 ''|[nN]*) multiarch="$undef" ;;
11493 esac
11494
11495 : check for alignment requirements
11496 echo " "
11497 case "$crosscompile$multiarch" in
11498 *$define*)
11499         $cat <<EOM
11500 You seem to be either cross-compiling or doing a multiarchitecture build,
11501 skipping the memory alignment check.
11502
11503 EOM
11504         case "$alignbytes" in
11505         '') alignbytes=8 ;;
11506         esac
11507         ;;
11508 *)
11509         case "$alignbytes" in
11510         '') echo "Checking alignment constraints..." >&4
11511                 $cat >try.c <<'EOCP'
11512 #include <stdio.h>
11513 struct foobar {
11514         char foo;
11515         double bar;
11516 } try_algn;
11517 int main()
11518 {
11519     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11520     return(0);
11521 }
11522 EOCP
11523                 set try
11524                 if eval $compile_ok; then
11525                         dflt=`./try`
11526                 else
11527                         dflt='8'
11528                         echo "(I can't seem to compile the test program...)"
11529                 fi
11530                 ;;
11531         *) dflt="$alignbytes"
11532                 ;;
11533         esac
11534         rp="Doubles must be aligned on a how-many-byte boundary?"
11535         . ./myread
11536         alignbytes="$ans"
11537         $rm -f try.c try
11538         ;;
11539 esac
11540
11541
11542 : check for ordering of bytes in a long
11543 echo " "
11544 case "$crosscompile$multiarch" in
11545 *$define*)
11546         $cat <<EOM
11547 You seem to be either cross-compiling or doing a multiarchitecture build,
11548 skipping the byteorder check.
11549
11550 EOM
11551         byteorder='0xffff'
11552         ;;
11553 *)
11554         case "$byteorder" in
11555         '')
11556                 $cat <<'EOM'
11557 In the following, larger digits indicate more significance.  A big-endian
11558 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11559 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11560 machines may have weird orders like 3412.  A Cray will report 87654321,
11561 an Alpha will report 12345678. If the test program works the default is
11562 probably right.
11563 I'm now running the test program...
11564 EOM
11565                 $cat >try.c <<'EOCP'
11566 #include <stdio.h>
11567 int main()
11568 {
11569         int i;
11570         union {
11571                 unsigned long l;
11572                 char c[sizeof(long)];
11573         } u;
11574
11575         if (sizeof(long) > 4)
11576                 u.l = (0x08070605L << 32) | 0x04030201L;
11577         else
11578                 u.l = 0x04030201L;
11579         for (i = 0; i < sizeof(long); i++)
11580                 printf("%c", u.c[i]+'0');
11581         printf("\n");
11582         exit(0);
11583 }
11584 EOCP
11585                 xxx_prompt=y
11586                 set try
11587                 if eval $compile && ./try > /dev/null; then
11588                         dflt=`./try`
11589                         case "$dflt" in
11590                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11591                                 echo "(The test program ran ok.)"
11592                                 echo "byteorder=$dflt"
11593                                 xxx_prompt=n
11594                         ;;
11595                         ????|????????) echo "(The test program ran ok.)" ;;
11596                         *) echo "(The test program didn't run right for some reason.)" ;;
11597                         esac
11598                 else
11599                         dflt='4321'
11600                         cat <<'EOM'
11601 (I can't seem to compile the test program.  Guessing big-endian...)
11602 EOM
11603                 fi
11604                 case "$xxx_prompt" in
11605                 y)
11606                         rp="What is the order of bytes in a long?"
11607                         . ./myread
11608                         byteorder="$ans"
11609                         ;;
11610                 *)      byteorder=$dflt
11611                         ;;
11612                 esac
11613                 ;;
11614         esac
11615         $rm -f try.c try
11616         ;;
11617 esac
11618
11619
11620 : how do we catenate cpp tokens here?
11621 echo " "
11622 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11623 $cat >cpp_stuff.c <<'EOCP'
11624 #define RCAT(a,b)a/**/b
11625 #define ACAT(a,b)a ## b
11626 RCAT(Rei,ser)
11627 ACAT(Cir,cus)
11628 EOCP
11629 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11630 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11631         echo "Oh!  Smells like ANSI's been here." >&4
11632         echo "We can catify or stringify, separately or together!"
11633         cpp_stuff=42
11634 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11635         echo "Ah, yes!  The good old days!" >&4
11636         echo "However, in the good old days we don't know how to stringify and"
11637         echo "catify at the same time."
11638         cpp_stuff=1
11639 else
11640         $cat >&4 <<EOM
11641 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11642 to have to edit the values of CAT[2-5] in config.h...
11643 EOM
11644         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11645 fi
11646 $rm -f cpp_stuff.*
11647
11648 : see if this is a db.h system
11649 set db.h i_db
11650 eval $inhdr
11651
11652 case "$i_db" in
11653 $define)
11654         : Check db version.
11655         echo " "
11656         echo "Checking Berkeley DB version ..." >&4
11657         $cat >try.c <<EOCP
11658 #$d_const HASCONST
11659 #ifndef HASCONST
11660 #define const
11661 #endif
11662 #include <sys/types.h>
11663 #include <stdio.h>
11664 #include <db.h>
11665 int main()
11666 {
11667 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11668     int Major, Minor, Patch ;
11669     unsigned long Version ;
11670     (void)db_version(&Major, &Minor, &Patch) ;
11671     printf("You have Berkeley DB Version 2 or greater\n");
11672
11673     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11674                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11675     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11676                 Major, Minor, Patch) ;
11677
11678     /* check that db.h & libdb are compatible */
11679     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11680         printf("db.h and libdb are incompatible\n") ;
11681         exit(3);        
11682     }
11683
11684     printf("db.h and libdb are compatible\n") ;
11685
11686     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11687                 + DB_VERSION_PATCH ;
11688
11689     /* needs to be >= 2.3.4 */
11690     if (Version < 2003004) {
11691     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11692         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11693         exit(2);        
11694     }
11695
11696     exit(0);
11697 #else
11698 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11699     printf("You have Berkeley DB Version 1\n");
11700     exit(0);    /* DB version < 2: the coast is clear. */
11701 #else
11702     exit(1);    /* <db.h> not Berkeley DB? */
11703 #endif
11704 #endif
11705 }
11706 EOCP
11707         set try
11708         if eval $compile_ok && ./try; then
11709                 echo 'Looks OK.' >&4
11710         else
11711                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11712                 i_db=$undef
11713                 case " $libs " in
11714                 *"-ldb "*)
11715                         : Remove db from list of libraries to use
11716                         echo "Removing unusable -ldb from library list" >&4
11717                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11718                         shift
11719                         libs="$*"
11720                         echo "libs = $libs" >&4
11721                         ;;
11722                 esac
11723         fi
11724         $rm -f try.*
11725         ;;
11726 esac
11727
11728 case "$i_db" in
11729 define)
11730         : Check the return type needed for hash 
11731         echo " "
11732         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11733         $cat >try.c <<EOCP
11734 #$d_const HASCONST
11735 #ifndef HASCONST
11736 #define const
11737 #endif
11738 #include <sys/types.h>
11739 #include <db.h>
11740
11741 #ifndef DB_VERSION_MAJOR
11742 u_int32_t hash_cb (ptr, size)
11743 const void *ptr;
11744 size_t size;
11745 {
11746 }
11747 HASHINFO info;
11748 int main()
11749 {
11750         info.hash = hash_cb;
11751 }
11752 #endif
11753 EOCP
11754         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11755                 if $contains warning try.out >>/dev/null 2>&1 ; then
11756                         db_hashtype='int'
11757                 else
11758                         db_hashtype='u_int32_t'
11759                 fi
11760         else
11761                 : XXX Maybe we should just give up here.
11762                 db_hashtype=u_int32_t
11763                 $cat try.out >&4
11764                 echo "Help:  I can't seem to compile the db test program." >&4
11765                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11766         fi
11767         $rm -f try.*
11768         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11769         ;;
11770 *)      db_hashtype=u_int32_t
11771         ;;
11772 esac
11773 case "$i_db" in
11774 define)
11775         : Check the return type needed for prefix 
11776         echo " "
11777         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11778         cat >try.c <<EOCP
11779 #$d_const HASCONST
11780 #ifndef HASCONST
11781 #define const
11782 #endif
11783 #include <sys/types.h>
11784 #include <db.h>
11785
11786 #ifndef DB_VERSION_MAJOR
11787 size_t prefix_cb (key1, key2)
11788 const DBT *key1;
11789 const DBT *key2;
11790 {
11791 }
11792 BTREEINFO info;
11793 int main()
11794 {
11795         info.prefix = prefix_cb;
11796 }
11797 #endif
11798 EOCP
11799         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11800                 if $contains warning try.out >>/dev/null 2>&1 ; then
11801                         db_prefixtype='int'
11802                 else
11803                         db_prefixtype='size_t'
11804                 fi
11805         else
11806                 db_prefixtype='size_t'
11807                 : XXX Maybe we should just give up here.
11808                 $cat try.out >&4
11809                 echo "Help:  I can't seem to compile the db test program." >&4
11810                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11811         fi
11812         $rm -f try.*
11813         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11814         ;;
11815 *)      db_prefixtype='size_t'
11816         ;;
11817 esac
11818
11819 : check for void type
11820 echo " "
11821 echo "Checking to see how well your C compiler groks the void type..." >&4
11822 case "$voidflags" in
11823 '')
11824         $cat >try.c <<'EOCP'
11825 #if TRY & 1
11826 void sub() {
11827 #else
11828 sub() {
11829 #endif
11830         extern void moo();      /* function returning void */
11831         void (*goo)();          /* ptr to func returning void */
11832 #if TRY & 8
11833         void *hue;              /* generic ptr */
11834 #endif
11835 #if TRY & 2
11836         void (*foo[10])();
11837 #endif
11838
11839 #if TRY & 4
11840         if(goo == moo) {
11841                 exit(0);
11842         }
11843 #endif
11844         exit(0);
11845 }
11846 int main() { sub(); }
11847 EOCP
11848         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11849                 voidflags=$defvoidused
11850         echo "Good.  It appears to support void to the level $package wants.">&4
11851                 if $contains warning .out >/dev/null 2>&1; then
11852                         echo "However, you might get some warnings that look like this:"
11853                         $cat .out
11854                 fi
11855         else
11856 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11857                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11858                         echo "It supports 1..."
11859                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11860                                 echo "It also supports 2..."
11861                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11862                                         voidflags=7
11863                                         echo "And it supports 4 but not 8 definitely."
11864                                 else
11865                                         echo "It doesn't support 4..."
11866                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11867                                                 voidflags=11
11868                                                 echo "But it supports 8."
11869                                         else
11870                                                 voidflags=3
11871                                                 echo "Neither does it support 8."
11872                                         fi
11873                                 fi
11874                         else
11875                                 echo "It does not support 2..."
11876                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11877                                         voidflags=13
11878                                         echo "But it supports 4 and 8."
11879                                 else
11880                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11881                                                 voidflags=5
11882                                                 echo "And it supports 4 but has not heard about 8."
11883                                         else
11884                                                 echo "However it supports 8 but not 4."
11885                                         fi
11886                                 fi
11887                         fi
11888                 else
11889                         echo "There is no support at all for void."
11890                         voidflags=0
11891                 fi
11892         fi
11893 esac
11894 case "$voidflags" in
11895 "$defvoidused") ;;
11896 *)      $cat >&4 <<'EOM'
11897   Support flag bits are:
11898     1: basic void declarations.
11899     2: arrays of pointers to functions returning void.
11900     4: operations between pointers to and addresses of void functions.
11901     8: generic void pointers.
11902 EOM
11903         dflt="$voidflags";
11904         rp="Your void support flags add up to what?"
11905         . ./myread
11906         voidflags="$ans"
11907         ;;
11908 esac
11909 $rm -f try.* .out
11910
11911
11912 : How can we generate normalized random numbers ?
11913 echo " "
11914 echo "Looking for a random number function..." >&4
11915 case "$randfunc" in
11916 '')
11917         if set drand48 val -f; eval $csym; $val; then
11918                 dflt="drand48"
11919                 echo "Good, found drand48()." >&4
11920         elif set random val -f; eval $csym; $val; then
11921                 dflt="random"
11922                 echo "OK, found random()." >&4
11923         else
11924                 dflt="rand"
11925                 echo "Yick, looks like I have to use rand()." >&4
11926         fi
11927         echo " "
11928         ;;
11929 *)
11930         dflt="$randfunc"
11931         ;;
11932 esac
11933 cont=true
11934
11935 case "$ccflags" in
11936 *-Dmy_rand=*|*-Dmy_srand=*)
11937         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11938         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11939         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11940         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11941         ;;
11942 esac
11943
11944 while $test "$cont"; do
11945         rp="Use which function to generate random numbers?"
11946         . ./myread
11947         if $test "$ans" = "$dflt"; then
11948                 : null
11949         else
11950                 randbits=''
11951         fi
11952         randfunc="$ans"
11953         if set $ans val -f; eval $csym; $val; then
11954                 cont=''
11955         else
11956                 dflt=y
11957                 rp="I cannot find function $ans. Use that name anyway?"
11958                 . ./myread
11959                 dflt=rand
11960                 case "$ans" in
11961                         [yY]*) cont='';;
11962                 esac
11963         fi
11964         case "$cont" in
11965         '')
11966                 case "$randfunc" in
11967                 drand48)
11968                         drand01="drand48()"
11969                         seedfunc="srand48"
11970                         randbits=48
11971                         randseedtype=long
11972                         ;;
11973                 rand|random)
11974                         case "$randbits" in
11975                         '')
11976 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11977                                 $cat >try.c <<EOCP
11978 #$i_unistd I_UNISTD
11979 #$i_stdlib I_STDLIB
11980 #include <stdio.h>
11981 #ifdef I_UNISTD
11982 #  include <unistd.h>
11983 #endif
11984 #ifdef I_STDLIB
11985 #  include <stdlib.h>
11986 #endif
11987 int main()
11988 {
11989         register int i;
11990         register unsigned long tmp;
11991         register unsigned long max = 0L;
11992
11993         for (i = 1000; i; i--) {
11994                 tmp = (unsigned long) $randfunc();
11995                 if (tmp > max) max = tmp;
11996         }
11997         for (i = 0; max; i++)
11998                 max /= 2;
11999         printf("%d\n",i);
12000 }
12001 EOCP
12002                                 set try
12003                                 if eval $compile_ok; then
12004                                         dflt=`try`
12005                                 else
12006                                         dflt='?'
12007                                         echo "(I can't seem to compile the test program...)"
12008                                 fi
12009                                 ;;
12010                         *)
12011                                 dflt="$randbits"
12012                                 ;;
12013                         esac
12014                         rp="How many bits does your $randfunc() function produce?"
12015                         . ./myread
12016                         randbits="$ans"
12017                         $rm -f try.c try
12018                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12019                         seedfunc="s$randfunc"
12020                         randseedtype=unsigned
12021                         ;;
12022                 *)
12023                         dflt="31"
12024                         rp="How many bits does your $randfunc() function produce?"
12025                         . ./myread
12026                         randbits="$ans"
12027                         seedfunc="s$randfunc"
12028                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12029                         if set $seedfunc val -f; eval $csym; $val; then
12030                                 echo "(Using $seedfunc() to seed random generator)"
12031                         else
12032                                 echo "(Warning: no $seedfunc() to seed random generator)"
12033                                 seedfunc=rand
12034                         fi
12035                         randseedtype=unsigned
12036                         ;;
12037                 esac
12038                 ;;
12039         esac
12040 done
12041
12042 echo " "
12043 echo "Determining whether or not we are on an EBCDIC system..." >&4
12044 $cat >tebcdic.c <<'EOM'
12045 int main()
12046 {
12047   if ('M'==0xd4) return 0;
12048   return 1;
12049 }
12050 EOM
12051
12052 val=$undef
12053 set tebcdic
12054 if eval $compile_ok; then
12055         if ./tebcdic; then
12056                 echo "You have EBCDIC." >&4
12057                 val="$define"
12058         else
12059                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12060         fi
12061 else
12062         echo "I'm unable to compile the test program." >&4
12063         echo "I'll assume ASCII or some ISO Latin." >&4
12064 fi
12065 $rm -f tebcdic.c tebcdic
12066 set ebcdic
12067 eval $setvar
12068
12069 echo " "
12070 $cat >&4 <<EOM
12071 Checking how to flush all pending stdio output...
12072 EOM
12073 # I only know how to find the first 32 possibly open files on SunOS.
12074 # See also hints/sunos_4_1.sh and util.c  --AD
12075 case "$osname" in
12076 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12077 esac
12078 $cat >>try.c <<EOCP
12079 #include <stdio.h>
12080 #$i_unistd I_UNISTD
12081 #ifdef I_UNISTD
12082 # include <unistd.h>
12083 #endif
12084 #$d_sysconf HAS_SYSCONF
12085 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12086 #ifdef HAS_STDIO_STREAM_ARRAY
12087 # define STDIO_STREAM_ARRAY $stdio_stream_array
12088 #endif
12089 int main() {
12090   FILE* p = fopen("try.out", "w");
12091 #ifdef TRY_FPUTC
12092   fputc('x', p);
12093 #else
12094 # ifdef TRY_FPRINTF
12095   fprintf(p, "x");
12096 # endif
12097 #endif
12098 #ifdef TRY_FFLUSH_NULL
12099   fflush(NULL);
12100 #endif
12101 #ifdef TRY_FFLUSH_ALL
12102   {
12103     long open_max = -1;
12104 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12105     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12106 # else
12107 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12108     open_max = sysconf(_SC_OPEN_MAX);
12109 #  else
12110 #   ifdef FOPEN_MAX
12111     open_max = FOPEN_MAX;
12112 #   else
12113 #    ifdef OPEN_MAX
12114     open_max = OPEN_MAX;
12115 #    else
12116 #     ifdef _NFILE
12117     open_max = _NFILE;
12118 #     endif
12119 #    endif
12120 #   endif
12121 #  endif
12122 # endif 
12123 # ifdef HAS_STDIO_STREAM_ARRAY
12124     if (open_max > 0) {
12125       long i;
12126       for (i = 0; i < open_max; i++)
12127             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12128                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12129                 STDIO_STREAM_ARRAY[i]._flag)
12130                 fflush(&STDIO_STREAM_ARRAY[i]);
12131     }   
12132   }
12133 # endif
12134 #endif
12135   _exit(42);
12136 }
12137 EOCP
12138 : first we have to find out how _not_ to flush
12139 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12140     output=''
12141     set try -DTRY_FPUTC
12142     if eval $compile; then
12143             $rm -f try.out
12144             ./try$exe_ext 2>/dev/null
12145             if $test ! -s try.out -a "X$?" = X42; then
12146                 output=-DTRY_FPUTC
12147             fi
12148     fi
12149     case "$output" in
12150     '')
12151             set try -DTRY_FPRINTF
12152             $rm -f try.out
12153             if eval $compile; then
12154                     $rm -f try.out
12155                     ./try$exe_ext 2>/dev/null
12156                     if $test ! -s try.out -a "X$?" = X42; then
12157                         output=-DTRY_FPRINTF
12158                     fi
12159             fi
12160         ;;
12161     esac
12162 fi
12163 : check for fflush NULL behaviour
12164 case "$fflushNULL" in
12165 '')     set try -DTRY_FFLUSH_NULL $output
12166         if eval $compile; then
12167                 $rm -f try.out
12168                 ./try$exe_ext 2>/dev/null
12169                 code="$?"
12170                 if $test -s try.out -a "X$code" = X42; then
12171                         fflushNULL="`$cat try.out`"
12172                 else
12173                         if $test "X$code" != X42; then
12174                                 $cat >&4 <<EOM
12175 (If this test failed, don't worry, we'll try another method shortly.)
12176 EOM
12177                         fi
12178                 fi
12179         fi
12180         $rm -f core try.core core.try.*
12181         case "$fflushNULL" in
12182         x)      $cat >&4 <<EOM
12183 Your fflush(NULL) works okay.
12184 EOM
12185                 fflushNULL="$define"
12186                 ;;
12187         '')     $cat >&4 <<EOM
12188 Your fflush(NULL) isn't working (contrary to ANSI C).
12189 EOM
12190                 fflushNULL="$undef"
12191                 ;;
12192         *)      $cat >&4 <<EOM
12193 Cannot figure out whether your fflush(NULL) works or not.
12194 I'm assuming it doesn't (contrary to ANSI C).
12195 EOM
12196                 fflushNULL="$undef"
12197                 ;;
12198         esac
12199         ;;
12200 $define|true|[yY]*)
12201         fflushNULL="$define"
12202         ;;
12203 *)
12204         fflushNULL="$undef"
12205         ;;
12206 esac
12207 : check explicit looping only if NULL did not work
12208 case "$fflushNULL" in
12209 "$undef")
12210         : check for fflush all behaviour
12211         case "$fflushall" in
12212         '')     set try -DTRY_FFLUSH_ALL $output
12213                 if eval $compile; then
12214                         $cat >&4 <<EOM
12215 (Now testing the other method--but note that also this may fail.)
12216 EOM
12217                         $rm -f try.out
12218                         ./try$exe_ext 2>/dev/null
12219                         if $test -s try.out -a "X$?" = X42; then
12220                                 fflushall="`$cat try.out`"
12221                         fi
12222                 fi
12223                 $rm -f core try.core core.try.*
12224                 case "$fflushall" in
12225                 x)      $cat >&4 <<EOM
12226 Whew. Flushing explicitly all the stdio streams works.
12227 EOM
12228                         fflushall="$define"
12229                         ;;
12230                 '')     $cat >&4 <<EOM
12231 Sigh. Flushing explicitly all the stdio streams doesn't work.
12232 EOM
12233                         fflushall="$undef"
12234                         ;;
12235                 *)      $cat >&4 <<EOM
12236 Cannot figure out whether flushing stdio streams explicitly works or not.
12237 I'm assuming it doesn't.
12238 EOM
12239                         fflushall="$undef"
12240                         ;;
12241                 esac
12242                 ;;
12243         "$define"|true|[yY]*)
12244                 fflushall="$define"
12245                 ;;
12246         *)
12247                 fflushall="$undef"
12248                 ;;
12249         esac
12250         ;;
12251 *)      fflushall="$undef"      
12252         ;;
12253 esac
12254 case "$fflushNULL$fflushall" in
12255 undefundef)
12256         $cat <<EOM
12257 I cannot figure out how to flush pending stdio output.
12258 EOM
12259         ;;
12260 esac
12261 $rm -f try.* try$exe_ext
12262
12263 : Store the full pathname to the ar program for use in the C program
12264 : Respect a hint or command line value for full_ar.
12265 case "$full_ar" in
12266 '') full_ar=$ar ;;
12267 esac
12268
12269 : Store the full pathname to the sed program for use in the C program
12270 full_sed=$sed
12271
12272 : see what type gids are declared as in the kernel
12273 echo " "
12274 echo "Looking for the type for group ids returned by getgid()."
12275 set gid_t gidtype xxx stdio.h sys/types.h
12276 eval $typedef
12277 case "$gidtype" in
12278 xxx)
12279         xxx=`./findhdr sys/user.h`
12280         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12281         case $1 in
12282         unsigned) dflt="$1 $2" ;;
12283         *) dflt="$1" ;;
12284         esac
12285         ;;
12286 *) dflt="$gidtype";;
12287 esac
12288 case "$gidtype" in
12289 gid_t) echo "gid_t found." ;;
12290 *)      rp="What is the type for group ids returned by getgid()?"
12291         . ./myread
12292         gidtype="$ans"
12293         ;;
12294 esac
12295
12296 echo " "
12297 case "$gidtype" in
12298 *_t) zzz="$gidtype"     ;;
12299 *)   zzz="gid"          ;;
12300 esac
12301 echo "Checking the size of $zzz..." >&4 
12302 cat > try.c <<EOCP
12303 #include <sys/types.h>
12304 #include <stdio.h>
12305 int main() {
12306     printf("%d\n", (int)sizeof($gidtype));
12307     exit(0);
12308 }
12309 EOCP
12310 set try
12311 if eval $compile_ok; then
12312         yyy=`./try`
12313         case "$yyy" in
12314         '')     gidsize=4
12315                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12316                 ;;
12317         *)      gidsize=$yyy
12318                 echo "Your $zzz size is $gidsize bytes."
12319                 ;;
12320         esac
12321 else
12322         gidsize=4
12323         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12324 fi
12325
12326
12327 echo " "
12328 case "$gidtype" in
12329 *_t) zzz="$gidtype"     ;;
12330 *)   zzz="gid"          ;;
12331 esac
12332 echo "Checking the sign of $zzz..." >&4 
12333 cat > try.c <<EOCP
12334 #include <sys/types.h>
12335 #include <stdio.h>
12336 int main() {
12337         $gidtype foo = -1;
12338         if (foo < 0)
12339                 printf("-1\n");
12340         else
12341                 printf("1\n");
12342 }
12343 EOCP
12344 set try
12345 if eval $compile; then
12346         yyy=`./try`
12347         case "$yyy" in
12348         '')     gidsign=1
12349                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12350                 ;;
12351         *)      gidsign=$yyy
12352                 case "$gidsign" in
12353                  1) echo "Your $zzz is unsigned." ;;
12354                 -1) echo "Your $zzz is signed."   ;;
12355                 esac
12356                 ;;
12357         esac
12358 else
12359         gidsign=1
12360         echo "(I can't compile the test program--guessing unsigned.)" >&4
12361 fi
12362
12363
12364 echo " "
12365
12366 if $test X"$quadtype" != X; then
12367
12368 echo "Checking how to print 64-bit integers..." >&4
12369
12370 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12371         $cat >try.c <<'EOCP'
12372 #include <sys/types.h>
12373 #include <stdio.h>
12374 int main() {
12375   int q = 12345678901;
12376   printf("%ld\n", q);
12377 }
12378 EOCP
12379         set try
12380         if eval $compile; then
12381                 yyy=`./try$exe_ext`
12382                 case "$yyy" in
12383                 12345678901)
12384                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12385                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12386                         echo "We will use %d."
12387                         ;;
12388                 esac
12389         fi
12390 fi
12391
12392 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12393         $cat >try.c <<'EOCP'
12394 #include <sys/types.h>
12395 #include <stdio.h>
12396 int main() {
12397   long q = 12345678901;
12398   printf("%ld\n", q);
12399 }
12400 EOCP
12401         set try
12402         if eval $compile; then
12403                 yyy=`./try$exe_ext`
12404                 case "$yyy" in
12405                 12345678901)
12406                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12407                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12408                         echo "We will use %ld."
12409                         ;;
12410                 esac
12411         fi
12412 fi
12413
12414 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12415         $cat >try.c <<'EOCP'
12416 #include <sys/types.h>
12417 #include <inttypes.h>
12418 #include <stdio.h>
12419 int main() {
12420   int64_t q = 12345678901;
12421   printf("%" PRId64 "\n", q);
12422 }
12423 EOCP
12424         set try
12425         if eval $compile; then
12426                 yyy=`./try$exe_ext`
12427                 case "$yyy" in
12428                 12345678901)
12429                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12430                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12431                         echo "We will use the C9X style."
12432                         ;;
12433                 esac
12434         fi
12435 fi
12436
12437 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12438         $cat >try.c <<'EOCP'
12439 #include <sys/types.h>
12440 #include <stdio.h>
12441 int main() {
12442   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12443   printf("%lld\n", q);
12444 }
12445 EOCP
12446         set try
12447         if eval $compile; then
12448                 yyy=`./try$exe_ext`
12449                 case "$yyy" in
12450                 12345678901)
12451                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12452                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12453                         echo "We will use the %lld style."
12454                         ;;
12455                 esac
12456         fi
12457 fi
12458
12459 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12460         $cat >try.c <<EOCP
12461 #include <sys/types.h>
12462 #include <stdio.h>
12463 int main() {
12464   $quadtype q = 12345678901;
12465   printf("%Ld\n", q);
12466 }
12467 EOCP
12468         set try
12469         if eval $compile; then
12470                 yyy=`./try$exe_ext`
12471                 case "$yyy" in
12472                 12345678901)
12473                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12474                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12475                         echo "We will use %Ld."
12476                         ;;
12477                 esac
12478         fi
12479 fi
12480
12481 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12482         $cat >try.c <<EOCP
12483 #include <sys/types.h>
12484 #include <stdio.h>
12485 int main() {
12486   $quadtype q = 12345678901;
12487   printf("%qd\n", q);
12488 }
12489 EOCP
12490         set try
12491         if eval $compile; then
12492                 yyy=`./try$exe_ext`
12493                 case "$yyy" in
12494                 12345678901)
12495                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12496                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12497                         echo "We will use %qd."
12498                         ;;
12499                 esac
12500         fi
12501 fi
12502
12503 if $test X"$sPRId64" = X; then
12504         echo "Cannot figure out how to print 64-bit integers." >&4
12505 fi
12506
12507 $rm -f try try.*
12508
12509 fi
12510
12511 case "$sPRId64" in
12512 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12513         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12514         ;;
12515 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12516         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12517         ;;
12518 esac
12519
12520
12521 echo " "
12522 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12523
12524 if $test X"$ivsize" = X8; then
12525         ivdformat="$sPRId64"
12526         uvuformat="$sPRIu64"
12527         uvoformat="$sPRIo64"
12528         uvxformat="$sPRIx64"
12529 else
12530         if $test X"$ivsize" = X"$longsize"; then
12531                 ivdformat='"ld"'
12532                 uvuformat='"lu"'
12533                 uvoformat='"lo"'
12534                 uvxformat='"lx"'
12535         else
12536                 if $test X"$ivsize" = X"$intsize"; then
12537                         ivdformat='"d"'
12538                         uvuformat='"u"'
12539                         uvoformat='"o"'
12540                         uvxformat='"x"'
12541                 else
12542                         : far out
12543                         if $test X"$ivsize" = X"$shortsize"; then
12544                                 ivdformat='"hd"'
12545                                 uvuformat='"hu"'
12546                                 uvoformat='"ho"'
12547                                 uvxformat='"hx"'
12548                         fi
12549                 fi
12550         fi
12551 fi
12552
12553 case "$ivdformat" in
12554 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12555     exit 1
12556     ;;
12557 esac
12558
12559
12560 echo " "
12561 $echo "Checking the format string to be used for gids..." >&4
12562
12563 case "$gidsign" in
12564 -1)     if $test X"$gidsize" = X"$ivsize"; then
12565                 gidformat="$ivdformat"
12566         else
12567                 if $test X"$gidsize" = X"$longsize"; then
12568                         gidformat='"ld"'
12569                 else
12570                         if $test X"$gidsize" = X"$intsize"; then
12571                                 gidformat='"d"'
12572                         else
12573                                 if $test X"$gidsize" = X"$shortsize"; then
12574                                         gidformat='"hd"'
12575                                 fi
12576                         fi
12577                 fi
12578         fi
12579         ;;
12580 *)      if $test X"$gidsize" = X"$uvsize"; then
12581                 gidformat="$uvuformat"
12582         else
12583                 if $test X"$gidsize" = X"$longsize"; then
12584                         gidformat='"lu"'
12585                 else
12586                         if $test X"$gidsize" = X"$intsize"; then
12587                                 gidformat='"u"'
12588                         else
12589                                 if $test X"$gidsize" = X"$shortsize"; then
12590                                         gidformat='"hu"'
12591                                 fi
12592                         fi
12593                 fi
12594         fi
12595         ;;
12596 esac
12597
12598 : see if getgroups exists
12599 set getgroups d_getgrps
12600 eval $inlibc
12601
12602 : see if setgroups exists
12603 set setgroups d_setgrps
12604 eval $inlibc
12605
12606
12607 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12608 echo " "
12609 case "$d_getgrps$d_setgrps" in
12610 *define*)
12611         case "$groupstype" in
12612         '') dflt="$gidtype" ;;
12613         *)  dflt="$groupstype" ;;
12614         esac
12615         $cat <<EOM
12616 What type of pointer is the second argument to getgroups() and setgroups()?
12617 Usually this is the same as group ids, $gidtype, but not always.
12618
12619 EOM
12620         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12621         . ./myread
12622         groupstype="$ans"
12623         ;;
12624 *)  groupstype="$gidtype";;
12625 esac
12626
12627 echo " "
12628 echo "Checking if your $make program sets \$(MAKE)..." >&4
12629 case "$make_set_make" in
12630 '')
12631         $sed 's/^X //' > testmake.mak << 'EOF'
12632 Xall:
12633 X       @echo 'maketemp="$(MAKE)"'
12634 EOF
12635         case "`$make -f testmake.mak 2>/dev/null`" in
12636         *maketemp=*) make_set_make='#' ;;
12637         *)      make_set_make="MAKE=$make" ;;
12638         esac
12639         $rm -f testmake.mak
12640         ;;
12641 esac
12642 case "$make_set_make" in
12643 '#') echo "Yup, it does.";;
12644 *) echo "Nope, it doesn't.";;
12645 esac
12646
12647 : see what type is used for mode_t
12648 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12649 set mode_t modetype int stdio.h sys/types.h
12650 eval $typedef_ask
12651
12652 : define a fucntion to check prototypes
12653 $cat > protochk <<EOSH
12654 $startsh
12655 cc="$cc"
12656 optimize="$optimize"
12657 ccflags="$ccflags"
12658 prototype="$prototype"
12659 define="$define"
12660 rm=$rm
12661 EOSH
12662
12663 $cat >> protochk <<'EOSH'
12664
12665 $rm -f try.c
12666 foo="$1"
12667 shift
12668 while test $# -ge 2; do
12669         case "$1" in
12670                 $define) echo "#include <$2>" >> try.c ;;
12671                 literal) echo "$2" >> try.c ;;
12672         esac
12673     shift 2
12674 done
12675 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12676 cat >> try.c <<'EOCP'
12677 #ifdef CAN_PROTOTYPE
12678 #define _(args) args
12679 #else
12680 #define _(args) ()
12681 #endif
12682 EOCP
12683 echo "$foo" >> try.c
12684 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12685 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12686 status=$?
12687 $rm -f try.[co]
12688 exit $status
12689 EOSH
12690 chmod +x protochk
12691 $eunicefix protochk
12692
12693 : see what type is used for size_t
12694 rp="What is the type used for the length parameter for string functions?"
12695 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12696 eval $typedef_ask
12697
12698 : check for type of arguments to gethostbyaddr. 
12699 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12700         case "$d_gethbyaddr" in
12701         $define)
12702                 $cat <<EOM
12703
12704 Checking to see what type of arguments are accepted by gethostbyaddr().
12705 EOM
12706                 hdrs="$define sys/types.h
12707                         $d_socket sys/socket.h 
12708                         $i_niin netinet/in.h 
12709                         $i_netdb netdb.h
12710                         $i_unistd unistd.h"
12711                 : The first arg can 'char *' or 'void *'
12712                 : The second arg is some of integral type
12713                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12714                         for yyy in size_t long int; do
12715                                 case "$netdb_host_type" in
12716                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12717                                         if ./protochk "$try" $hdrs; then
12718                                                 echo "Your system accepts $xxx for the first arg."
12719                                                 echo "...and $yyy for the second arg."
12720                                                 netdb_host_type="$xxx"
12721                                                 netdb_hlen_type="$yyy"
12722                                         fi
12723                                         ;;
12724                                 esac
12725                         done
12726                 done
12727                 : In case none of those worked, prompt the user.
12728                 case "$netdb_host_type" in
12729                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12730                         dflt='char *'
12731                         . ./myread
12732                         netdb_host_type=$ans
12733                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12734                         dflt="$sizetype"
12735                         . ./myread
12736                         netdb_hlen_type=$ans
12737                         ;;
12738                 esac
12739                 ;;
12740         *)      : no gethostbyaddr, so pick harmless defaults
12741                 netdb_host_type='char *'
12742                 netdb_hlen_type="$sizetype"
12743                 ;;
12744         esac
12745         # Remove the "const" if needed. -- but then we'll have a 
12746         # prototype clash!
12747         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12748 fi
12749
12750 : check for type of argument to gethostbyname. 
12751 if test "X$netdb_name_type" = X ; then
12752         case "$d_gethbyname" in
12753         $define)
12754                 $cat <<EOM
12755
12756 Checking to see what type of argument is accepted by gethostbyname().
12757 EOM
12758                 hdrs="$define sys/types.h
12759                         $d_socket sys/socket.h 
12760                         $i_niin netinet/in.h 
12761                         $i_netdb netdb.h
12762                         $i_unistd unistd.h"
12763                 for xxx in "const char *" "char *"; do
12764                         case "$netdb_name_type" in
12765                         '')     try="extern struct hostent *gethostbyname($xxx);"
12766                                 if ./protochk "$try" $hdrs; then
12767                                         echo "Your system accepts $xxx."
12768                                         netdb_name_type="$xxx"
12769                                 fi
12770                                 ;;
12771                         esac
12772                 done
12773                 : In case none of those worked, prompt the user.
12774                 case "$netdb_name_type" in
12775                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12776                         dflt='char *'
12777                         . ./myread
12778                         netdb_name_type=$ans
12779                         ;;
12780                 esac
12781                 ;;
12782         *)      : no gethostbyname, so pick harmless default
12783                 netdb_name_type='char *'
12784                 ;;
12785         esac
12786 fi
12787
12788 : check for type of 1st argument to getnetbyaddr. 
12789 if test "X$netdb_net_type" = X ; then
12790         case "$d_getnbyaddr" in
12791         $define)
12792                 $cat <<EOM
12793
12794 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12795 EOM
12796                 hdrs="$define sys/types.h
12797                         $d_socket sys/socket.h 
12798                         $i_niin netinet/in.h 
12799                         $i_netdb netdb.h
12800                         $i_unistd unistd.h"
12801                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12802                         case "$netdb_net_type" in
12803                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12804                                 if ./protochk "$try" $hdrs; then
12805                                         echo "Your system accepts $xxx."
12806                                         netdb_net_type="$xxx"
12807                                 fi
12808                                 ;;
12809                         esac
12810                 done
12811                 : In case none of those worked, prompt the user.
12812                 case "$netdb_net_type" in
12813                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12814                         dflt='long'
12815                         . ./myread
12816                         netdb_net_type=$ans
12817                         ;;
12818                 esac
12819                 ;;
12820         *)      : no getnetbyaddr, so pick harmless default
12821                 netdb_net_type='long'
12822                 ;;
12823         esac
12824 fi
12825 : locate the preferred pager for this system
12826 case "$pager" in
12827 '')
12828         dflt=''
12829         case "$pg" in
12830         /*) dflt=$pg;;
12831         esac
12832         case "$more" in
12833         /*) dflt=$more;;
12834         esac
12835         case "$less" in
12836         /*) dflt=$less;;
12837         esac
12838         case "$dflt" in
12839         '') dflt=/usr/ucb/more;;
12840         esac
12841         ;;
12842 *) dflt="$pager";;
12843 esac
12844 echo " "
12845 fn=f/
12846 rp='What pager is used on your system?'
12847 . ./getfile
12848 pager="$ans"
12849
12850 : see what type pids are declared as in the kernel
12851 rp="What is the type of process ids on this system?"
12852 set pid_t pidtype int stdio.h sys/types.h
12853 eval $typedef_ask
12854
12855 : check for length of pointer
12856 echo " "
12857 case "$ptrsize" in
12858 '')
12859         $echo $n "Checking to see how big your pointers are...$c" >&4
12860         if test "$voidflags" -gt 7; then
12861                 echo '#define VOID_PTR char *' > try.c
12862         else
12863                 echo '#define VOID_PTR void *' > try.c
12864         fi
12865         $cat >>try.c <<'EOCP'
12866 #include <stdio.h>
12867 int main()
12868 {
12869     printf("%d\n", (int)sizeof(VOID_PTR));
12870     exit(0);
12871 }
12872 EOCP
12873         set try
12874         if eval $compile_ok; then
12875                 ptrsize=`./try`
12876                 $echo " $ptrsize bytes." >&4
12877         else
12878                 dflt='4'
12879                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12880                 rp="What is the size of a pointer (in bytes)?"
12881                 . ./myread
12882                 ptrsize="$ans"
12883         fi
12884         ;;
12885 esac
12886 $rm -f try.c try
12887
12888 : see if ar generates random libraries by itself
12889 echo " "
12890 echo "Checking how to generate random libraries on your machine..." >&4
12891 echo 'int bar1() { return bar2(); }' > bar1.c
12892 echo 'int bar2() { return 2; }' > bar2.c
12893 $cat > foo.c <<'EOP'
12894 int main() { printf("%d\n", bar1()); exit(0); }
12895 EOP
12896 $cc $ccflags -c bar1.c >/dev/null 2>&1
12897 $cc $ccflags -c bar2.c >/dev/null 2>&1
12898 $cc $ccflags -c foo.c >/dev/null 2>&1
12899 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12900 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12901         ./foobar >/dev/null 2>&1; then
12902         echo "$ar appears to generate random libraries itself."
12903         orderlib=false
12904         ranlib=":"
12905 elif $ar ts bar$_a >/dev/null 2>&1 &&
12906         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12907         ./foobar >/dev/null 2>&1; then
12908                 echo "a table of contents needs to be added with '$ar ts'."
12909                 orderlib=false
12910                 ranlib="$ar ts"
12911 else
12912         case "$ranlib" in
12913         :) ranlib='';;
12914         '')
12915                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12916                 $test -f $ranlib || ranlib=''
12917                 ;;
12918         esac
12919         if $test -n "$ranlib"; then
12920                 echo "your system has '$ranlib'; we'll use that."
12921                 orderlib=false
12922         else
12923                 echo "your system doesn't seem to support random libraries"
12924                 echo "so we'll use lorder and tsort to order the libraries."
12925                 orderlib=true
12926                 ranlib=":"
12927         fi
12928 fi
12929 $rm -f foo* bar* 
12930
12931 : check for type of arguments to select. 
12932 case "$selecttype" in
12933 '') case "$d_select" in
12934         $define)
12935                 echo " "
12936                 $cat <<EOM
12937 Checking to see what type of arguments are accepted by select().
12938 EOM
12939                 hdrs="$define sys/types.h
12940                         $i_systime sys/time.h 
12941                         $i_sysselct sys/select.h
12942                         $d_socket sys/socket.h"
12943                 : The first arg can be int, unsigned, or size_t
12944                 : The last arg may or may not be 'const'
12945                 val=''
12946                 : void pointer has been seen but using that
12947                 : breaks the selectminbits test
12948                 for xxx in 'fd_set *' 'int *'; do
12949                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12950                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12951                                         case "$val" in
12952                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12953                                                 if ./protochk "$try" $hdrs; then
12954                                                         echo "Your system accepts $xxx."
12955                                                         val="$xxx"
12956                                                 fi
12957                                                 ;;
12958                                         esac
12959                                 done
12960                         done
12961                 done
12962                 case "$val" in
12963                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12964                         case "$d_fd_set" in
12965                                 $define) dflt="fd_set *" ;;
12966                                 *)              dflt="int *" ;;
12967                         esac
12968                         . ./myread
12969                         val=$ans
12970                         ;;
12971                 esac
12972                 selecttype="$val"
12973                 ;;
12974         *)      : no select, so pick a harmless default
12975                 selecttype='int *'
12976                 ;;
12977         esac
12978         ;;
12979 esac
12980
12981 : check for the select 'width'
12982 case "$selectminbits" in
12983 '') case "$d_select" in
12984         $define)
12985                 $cat <<EOM
12986
12987 Checking to see on how many bits at a time your select() operates...
12988 EOM
12989                 $cat >try.c <<EOCP
12990 #include <sys/types.h>
12991 #$i_time I_TIME
12992 #$i_systime I_SYS_TIME
12993 #$i_systimek I_SYS_TIME_KERNEL
12994 #ifdef I_TIME
12995 #   include <time.h>
12996 #endif
12997 #ifdef I_SYS_TIME
12998 #   ifdef I_SYS_TIME_KERNEL
12999 #       define KERNEL
13000 #   endif
13001 #   include <sys/time.h>
13002 #   ifdef I_SYS_TIME_KERNEL
13003 #       undef KERNEL
13004 #   endif
13005 #endif
13006 #$i_sysselct I_SYS_SELECT
13007 #ifdef I_SYS_SELECT
13008 #include <sys/select.h>
13009 #endif
13010 #$d_socket HAS_SOCKET
13011 #ifdef HAS_SOCKET
13012 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13013 #endif
13014 #include <stdio.h>
13015 $selecttype b;
13016 #define S sizeof(*(b))
13017 #define MINBITS 64
13018 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13019 #define NBITS  (NBYTES * 8)
13020 int main() {
13021     char s[NBYTES];
13022     struct timeval t;
13023     int i;
13024     FILE* fp;
13025     int fd;
13026
13027     fclose(stdin);
13028     fp = fopen("try.c", "r");
13029     if (fp == 0)
13030       exit(1);
13031     fd = fileno(fp);
13032     if (fd < 0)
13033       exit(2);
13034     b = ($selecttype)s;
13035     for (i = 0; i < NBITS; i++)
13036         FD_SET(i, b);
13037     t.tv_sec  = 0;
13038     t.tv_usec = 0;
13039     select(fd + 1, b, 0, 0, &t);
13040     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13041     printf("%d\n", i + 1);
13042     return 0;
13043 }
13044 EOCP
13045                 set try
13046                 if eval $compile_ok; then
13047                         selectminbits=`./try`
13048                         case "$selectminbits" in
13049                         '')     cat >&4 <<EOM
13050 Cannot figure out on how many bits at a time your select() operates.
13051 I'll play safe and guess it is 32 bits.
13052 EOM
13053                                 selectminbits=32
13054                                 bits="32 bits"
13055                                 ;;
13056                         1)      bits="1 bit" ;;
13057                         *)      bits="$selectminbits bits" ;;
13058                         esac
13059                         echo "Your select() operates on $bits at a time." >&4
13060                 else
13061                         rp='What is the minimum number of bits your select() operates on?'
13062                         case "$byteorder" in
13063                         1234|12345678)  dflt=32 ;;
13064                         *)              dflt=1  ;;
13065                         esac
13066                         . ./myread
13067                         val=$ans
13068                         selectminbits="$val"
13069                 fi
13070                 $rm -f try.* try
13071                 ;;
13072         *)      : no select, so pick a harmless default
13073                 selectminbits='32'
13074                 ;;
13075         esac
13076         ;;
13077 esac
13078
13079 : Trace out the files included by signal.h, then look for SIGxxx names.
13080 : Remove SIGARRAYSIZE used by HPUX.
13081 : Remove SIGSTKSIZE used by Linux.
13082 : Remove SIGSTKSZ used by Posix.
13083 : Remove SIGTYP void lines used by OS2.
13084 : Some cpps, like os390, dont give the file name anywhere
13085 if [ "X$fieldn" = X ]; then
13086         : Just make some guesses.  We check them later.
13087         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13088 else
13089         xxx=`echo '#include <signal.h>' |
13090         $cppstdin $cppminus $cppflags 2>/dev/null |
13091         $grep '^[       ]*#.*include' | 
13092         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13093 fi
13094 : Check this list of files to be sure we have parsed the cpp output ok.
13095 : This will also avoid potentially non-existent files, such 
13096 : as ../foo/bar.h
13097 xxxfiles=''
13098 for xx in $xxx /dev/null ; do
13099         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13100 done
13101 : If we have found no files, at least try signal.h
13102 case "$xxxfiles" in
13103 '')     xxxfiles=`./findhdr signal.h` ;;
13104 esac
13105 xxx=`awk '
13106 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13107         print substr($2, 4, 20)
13108 }
13109 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13110         print substr($3, 4, 20)
13111 }' $xxxfiles`
13112 : Append some common names just in case the awk scan failed.
13113 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13114 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13115 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13116 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13117 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13118
13119 : generate a few handy files for later
13120 $cat > signal.c <<'EOCP'
13121 #include <sys/types.h>
13122 #include <signal.h>
13123 #include <stdio.h>
13124 int main() {
13125
13126 /* Strange style to avoid deeply-nested #if/#else/#endif */
13127 #ifndef NSIG
13128 #  ifdef _NSIG
13129 #    define NSIG (_NSIG)
13130 #  endif
13131 #endif
13132
13133 #ifndef NSIG
13134 #  ifdef SIGMAX
13135 #    define NSIG (SIGMAX+1)
13136 #  endif
13137 #endif
13138
13139 #ifndef NSIG
13140 #  ifdef SIG_MAX
13141 #    define NSIG (SIG_MAX+1)
13142 #  endif
13143 #endif
13144
13145 #ifndef NSIG
13146 #  ifdef MAXSIG
13147 #    define NSIG (MAXSIG+1)
13148 #  endif
13149 #endif
13150
13151 #ifndef NSIG
13152 #  ifdef MAX_SIG
13153 #    define NSIG (MAX_SIG+1)
13154 #  endif
13155 #endif
13156
13157 #ifndef NSIG
13158 #  ifdef SIGARRAYSIZE
13159 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13160 #  endif
13161 #endif
13162
13163 #ifndef NSIG
13164 #  ifdef _sys_nsig
13165 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13166 #  endif
13167 #endif
13168
13169 /* Default to some arbitrary number that's big enough to get most
13170    of the common signals.
13171 */
13172 #ifndef NSIG
13173 #    define NSIG 50
13174 #endif
13175
13176 printf("NSIG %d\n", NSIG);
13177
13178 #ifndef JUST_NSIG
13179
13180 EOCP
13181
13182 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13183 {
13184         printf "#ifdef SIG"; printf $1; printf "\n"
13185         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13186         printf $1; printf ");\n"
13187         printf "#endif\n"
13188 }
13189 END {
13190         printf "#endif /* JUST_NSIG */\n";
13191         printf "exit(0);\n}\n";
13192 }
13193 ' >>signal.c
13194 $cat >signal.awk <<'EOP'
13195 BEGIN { ndups = 0 }
13196 $1 ~ /^NSIG$/ { nsig = $2 }
13197 ($1 !~ /^NSIG$/) && (NF == 2) {
13198     if ($2 > maxsig) { maxsig = $2 }
13199     if (sig_name[$2]) {
13200         dup_name[ndups] = $1
13201         dup_num[ndups] = $2
13202         ndups++ 
13203     }
13204     else {
13205         sig_name[$2] = $1
13206         sig_num[$2] = $2
13207     }
13208 }
13209 END { 
13210     if (nsig == 0) {
13211         nsig = maxsig + 1
13212     }
13213     printf("NSIG %d\n", nsig);
13214     for (n = 1; n < nsig; n++) {
13215         if (sig_name[n]) {
13216             printf("%s %d\n", sig_name[n], sig_num[n])
13217         }
13218         else {
13219             printf("NUM%d %d\n", n, n) 
13220         }
13221     }
13222     for (n = 0; n < ndups; n++) {
13223         printf("%s %d\n", dup_name[n], dup_num[n])
13224     }
13225 }
13226 EOP
13227 $cat >signal_cmd <<EOS
13228 $startsh
13229 if $test -s signal.lst; then
13230     echo "Using your existing signal.lst file"
13231         exit 0
13232 fi
13233 xxx="$xxx"
13234 EOS
13235 $cat >>signal_cmd <<'EOS'
13236
13237 set signal
13238 if eval $compile_ok; then
13239         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13240 else
13241         echo "(I can't seem be able to compile the whole test program)" >&4
13242         echo "(I'll try it in little pieces.)" >&4
13243         set signal -DJUST_NSIG
13244         if eval $compile_ok; then
13245                 ./signal$_exe > signal.nsg
13246                 $cat signal.nsg
13247         else
13248                 echo "I can't seem to figure out how many signals you have." >&4
13249                 echo "Guessing 50." >&4
13250                 echo 'NSIG 50' > signal.nsg
13251         fi
13252         : Now look at all the signal names, one at a time.
13253         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13254                 $cat > signal.c <<EOCP
13255 #include <sys/types.h>
13256 #include <signal.h>
13257 #include <stdio.h>
13258 int main() {
13259 printf("$xx %d\n", SIG${xx});
13260 return 0;
13261 }
13262 EOCP
13263                 set signal
13264                 if eval $compile; then
13265                         echo "SIG${xx} found."
13266                         ./signal$_exe  >> signal.ls1
13267                 else
13268                         echo "SIG${xx} NOT found."
13269                 fi
13270         done
13271         if $test -s signal.ls1; then
13272                 $cat signal.nsg signal.ls1 |
13273                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13274         fi
13275
13276 fi
13277 if $test -s signal.lst; then
13278         :
13279 else
13280         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13281         echo 'kill -l' >signal
13282         set X `csh -f <signal`
13283         $rm -f signal
13284         shift
13285         case $# in
13286         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13287         esac
13288         echo $@ | $tr ' ' $trnl | \
13289             $awk '{ printf "%s %d\n", $1, ++s; }
13290                   END { printf "NSIG %d\n", ++s }' >signal.lst
13291 fi
13292 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13293 EOS
13294 chmod a+x signal_cmd
13295 $eunicefix signal_cmd
13296
13297 : generate list of signal names
13298 echo " "
13299 case "$sig_name_init" in
13300 '') doinit=yes ;;
13301 *)  case "$sig_num_init" in
13302     ''|*,*) doinit=yes ;;
13303     esac ;;
13304 esac
13305 case "$doinit" in
13306 yes)
13307         echo "Generating a list of signal names and numbers..." >&4
13308         . ./signal_cmd
13309         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13310         sig_name=`$awk 'BEGIN { printf "ZERO " }
13311                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13312         sig_num=`$awk  'BEGIN { printf "0 " }
13313                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13314         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13315                              !/^NSIG/   { printf "\"%s\", ", $1 }
13316                              END        { printf "0\n" }' signal.lst`
13317         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13318                              !/^NSIG/   { printf "%d, ", $2}
13319                              END        { printf "0\n"}' signal.lst`
13320         ;;
13321 esac
13322 echo "The following $sig_count signals are available:"
13323 echo " "
13324 echo $sig_name | $awk \
13325 'BEGIN { linelen = 0 }
13326 {
13327         for (i = 1; i <= NF; i++) {
13328                 name = "SIG" $i " "
13329                 linelen = linelen + length(name)
13330                 if (linelen > 70) {
13331                         printf "\n"
13332                         linelen = length(name)
13333                 }
13334                 printf "%s", name
13335         }
13336         printf "\n"
13337 }'
13338 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13339
13340 : see what type is used for signed size_t
13341 set ssize_t ssizetype int stdio.h sys/types.h
13342 eval $typedef
13343 dflt="$ssizetype"
13344 $cat > ssize.c <<EOM
13345 #include <stdio.h>
13346 #include <sys/types.h>
13347 #define Size_t $sizetype
13348 #define SSize_t $dflt
13349 int main()
13350 {
13351         if (sizeof(Size_t) == sizeof(SSize_t))
13352                 printf("$dflt\n");
13353         else if (sizeof(Size_t) == sizeof(int))
13354                 printf("int\n");
13355         else 
13356                 printf("long\n");
13357         exit(0);
13358 }
13359 EOM
13360 echo " "
13361 set ssize
13362 if eval $compile_ok && ./ssize > /dev/null; then
13363         ssizetype=`./ssize`
13364         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13365 else
13366         $cat >&4 <<EOM
13367 Help! I can't compile and run the ssize_t test program: please enlighten me!
13368 (This is probably a misconfiguration in your system or libraries, and
13369 you really ought to fix it.  Still, I'll try anyway.)
13370
13371 I need a type that is the same size as $sizetype, but is guaranteed to
13372 be signed.  Common values are ssize_t, int and long.
13373
13374 EOM
13375         rp="What signed type is the same size as $sizetype?"
13376         . ./myread
13377         ssizetype="$ans"
13378 fi
13379 $rm -f ssize ssize.*
13380
13381 : see what type of char stdio uses.
13382 echo " "
13383 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13384         echo "Your stdio uses unsigned chars." >&4
13385         stdchar="unsigned char"
13386 else
13387         echo "Your stdio uses signed chars." >&4
13388         stdchar="char"
13389 fi
13390
13391 : see if time exists
13392 echo " "
13393 if test "X$d_time" = X -o X"$timetype" = X; then
13394     if set time val -f d_time; eval $csym; $val; then
13395                 echo 'time() found.' >&4
13396                 val="$define"
13397                 rp="What is the type returned by time() on this system?"
13398                 set time_t timetype long stdio.h sys/types.h
13399                 eval $typedef_ask
13400     else
13401                 echo 'time() not found, hope that will do.' >&4
13402                 val="$undef"
13403                 timetype='int';
13404     fi
13405     set d_time
13406     eval $setvar
13407 fi
13408
13409 : see what type uids are declared as in the kernel
13410 echo " "
13411 echo "Looking for the type for user ids returned by getuid()."
13412 set uid_t uidtype xxx stdio.h sys/types.h
13413 eval $typedef
13414 case "$uidtype" in
13415 xxx)
13416         xxx=`./findhdr sys/user.h`
13417         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13418         case $1 in
13419         unsigned) dflt="$1 $2" ;;
13420         *) dflt="$1" ;;
13421         esac
13422         ;;
13423 *) dflt="$uidtype";;
13424 esac
13425 case "$uidtype" in
13426 uid_t)  echo "uid_t found." ;;
13427 *)      rp="What is the type for user ids returned by getuid()?"
13428         . ./myread
13429         uidtype="$ans"
13430         ;;
13431 esac
13432
13433 echo " "
13434 case "$uidtype" in
13435 *_t) zzz="$uidtype"     ;;
13436 *)   zzz="uid"          ;;
13437 esac
13438 echo "Checking the size of $zzz..." >&4 
13439 cat > try.c <<EOCP
13440 #include <sys/types.h>
13441 #include <stdio.h>
13442 int main() {
13443     printf("%d\n", (int)sizeof($uidtype));
13444     exit(0);
13445 }
13446 EOCP
13447 set try
13448 if eval $compile_ok; then
13449         yyy=`./try`
13450         case "$yyy" in
13451         '')     uidsize=4
13452                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13453                 ;;
13454         *)      uidsize=$yyy
13455                 echo "Your $zzz size is $uidsize bytes."
13456                 ;;
13457         esac
13458 else
13459         uidsize=4
13460         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13461 fi
13462
13463 echo " "
13464 case "$uidtype" in
13465 *_t) zzz="$uidtype"     ;;
13466 *)   zzz="uid"          ;;
13467 esac
13468 echo "Checking the sign of $zzz..." >&4
13469 cat > try.c <<EOCP
13470 #include <sys/types.h>
13471 #include <stdio.h>
13472 int main() {
13473         $uidtype foo = -1;
13474         if (foo < 0)
13475                 printf("-1\n");
13476         else
13477                 printf("1\n");
13478 }
13479 EOCP
13480 set try
13481 if eval $compile; then
13482         yyy=`./try`
13483         case "$yyy" in
13484         '')     uidsign=1
13485                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13486                 ;;
13487         *)      uidsign=$yyy
13488                 case "$uidsign" in
13489                  1) echo "Your $zzz is unsigned." ;;
13490                 -1) echo "Your $zzz is signed."   ;;
13491                 esac
13492                 ;;
13493         esac
13494 else
13495         uidsign=1
13496         echo "(I can't compile the test program--guessing unsigned.)" >&4
13497 fi
13498
13499
13500
13501 echo " "
13502 $echo "Checking the format string to be used for uids..." >&4
13503
13504 case "$uidsign" in
13505 -1)     if $test X"$uidsize" = X"$ivsize"; then
13506                 uidformat="$ivdformat"
13507         else
13508                 if $test X"$uidsize" = X"$longsize"; then
13509                         uidformat='"ld"'
13510                 else
13511                         if $test X"$uidsize" = X"$intsize"; then
13512                                 uidformat='"d"'
13513                         else
13514                                 if $test X"$uidsize" = X"$shortsize"; then
13515                                         uidformat='"hd"'
13516                                 fi
13517                         fi
13518                 fi
13519         fi
13520         ;;
13521 *)      if $test X"$uidsize" = X"$uvsize"; then
13522                 uidformat="$uvuformat"
13523         else
13524                 if $test X"$uidsize" = X"$longsize"; then
13525                         uidformat='"lu"'
13526                 else
13527                         if $test X"$uidsize" = X"$intsize"; then
13528                                 uidformat='"u"'
13529                         else
13530                                 if $test X"$uidsize" = X"$shortsize"; then
13531                                         uidformat='"hu"'
13532                                 fi
13533                         fi
13534                 fi
13535         fi
13536         ;;
13537 esac
13538
13539 : see if dbm.h is available
13540 : see if dbmclose exists
13541 set dbmclose d_dbmclose
13542 eval $inlibc
13543
13544 case "$d_dbmclose" in
13545 $define)
13546         set dbm.h i_dbm
13547         eval $inhdr
13548         case "$i_dbm" in
13549         $define)
13550                 val="$undef"
13551                 set i_rpcsvcdbm
13552                 eval $setvar
13553                 ;;
13554         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13555                 eval $inhdr
13556                 ;;
13557         esac
13558         ;;
13559 *)      echo "We won't be including <dbm.h>"
13560         val="$undef"
13561         set i_dbm
13562         eval $setvar
13563         val="$undef"
13564         set i_rpcsvcdbm
13565         eval $setvar
13566         ;;
13567 esac
13568
13569 : see if this is a sys/file.h system
13570 val=''
13571 set sys/file.h val
13572 eval $inhdr
13573
13574 : do we need to include sys/file.h ?
13575 case "$val" in
13576 "$define")
13577         echo " "
13578         if $h_sysfile; then
13579                 val="$define"
13580                 echo "We'll be including <sys/file.h>." >&4
13581         else
13582                 val="$undef"
13583                 echo "We won't be including <sys/file.h>." >&4
13584         fi
13585         ;;
13586 *)
13587         h_sysfile=false
13588         ;;
13589 esac
13590 set i_sysfile
13591 eval $setvar
13592
13593 : see if fcntl.h is there
13594 val=''
13595 set fcntl.h val
13596 eval $inhdr
13597
13598 : see if we can include fcntl.h
13599 case "$val" in
13600 "$define")
13601         echo " "
13602         if $h_fcntl; then
13603                 val="$define"
13604                 echo "We'll be including <fcntl.h>." >&4
13605         else
13606                 val="$undef"
13607                 if $h_sysfile; then
13608         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13609                 else
13610                         echo "We won't be including <fcntl.h>." >&4
13611                 fi
13612         fi
13613         ;;
13614 *)
13615         h_fcntl=false
13616         val="$undef"
13617         ;;
13618 esac
13619 set i_fcntl
13620 eval $setvar
13621
13622 : see if locale.h is available
13623 set locale.h i_locale
13624 eval $inhdr
13625
13626 : see if mach cthreads are available
13627 if test "X$usethreads" = "X$define"; then
13628         set mach/cthreads.h i_machcthr
13629         eval $inhdr
13630 else
13631         i_machcthr="$undef"
13632 fi
13633
13634
13635
13636 : see if this is a math.h system
13637 set math.h i_math
13638 eval $inhdr
13639
13640 : see if this is a mntent.h system
13641 set mntent.h i_mntent
13642 eval $inhdr
13643
13644 : see if ndbm.h is available
13645 set ndbm.h t_ndbm
13646 eval $inhdr
13647 case "$t_ndbm" in
13648 $define)
13649         : see if dbm_open exists
13650         set dbm_open d_dbm_open
13651         eval $inlibc
13652         case "$d_dbm_open" in
13653         $undef)
13654                 t_ndbm="$undef"
13655                 echo "We won't be including <ndbm.h>"
13656                 ;;
13657         esac
13658         ;;
13659 esac
13660 val="$t_ndbm"
13661 set i_ndbm
13662 eval $setvar
13663
13664 : see if net/errno.h is available
13665 val=''
13666 set net/errno.h val
13667 eval $inhdr
13668
13669 : Unfortunately, it causes problems on some systems.  Arrgh.
13670 case "$val" in
13671 $define)
13672         cat > try.c <<'EOM'
13673 #include <stdio.h>
13674 #include <errno.h>
13675 #include <net/errno.h>
13676 int func()
13677 {
13678         return ENOTSOCK;
13679 }
13680 EOM
13681         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13682                 echo "We'll be including <net/errno.h>." >&4
13683         else
13684                 echo "We won't be including <net/errno.h>." >&4
13685                 val="$undef"
13686         fi
13687         $rm -f try.* try
13688         ;;
13689 esac
13690 set i_neterrno
13691 eval $setvar
13692
13693 : see if netinet/tcp.h is available
13694 set netinet/tcp.h i_netinettcp
13695 eval $inhdr
13696
13697 : see if this is a poll.h system
13698 set poll.h i_poll
13699 eval $inhdr
13700
13701 : get C preprocessor symbols handy
13702 echo " "
13703 $echo $n "Hmm... $c"
13704 echo $al | $tr ' ' $trnl >Cppsym.know
13705 $cat <<EOSS >Cppsym
13706 $startsh
13707 case "\$1" in
13708 -l) list=true
13709         shift
13710         ;;
13711 esac
13712 unknown=''
13713 case "\$list\$#" in
13714 1|2)
13715         for sym do
13716                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13717                         exit 0
13718                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13719                         :
13720                 else
13721                         unknown="\$unknown \$sym"
13722                 fi
13723         done
13724         set X \$unknown
13725         shift
13726         ;;
13727 esac
13728 case \$# in
13729 0) exit 1;;
13730 esac
13731 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13732 #ifdef \1\\
13733 exit 0; _ _ _ _\1\\      \1\\
13734 #endif\\
13735 /' >Cppsym\$\$
13736 echo "exit 1; _ _ _" >>Cppsym\$\$
13737 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13738 case "\$list" in
13739 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13740 *)
13741         sh Cppsym2\$\$
13742         status=\$?
13743         ;;
13744 esac
13745 $rm -f Cppsym\$\$ Cppsym2\$\$
13746 exit \$status
13747 EOSS
13748 chmod +x Cppsym
13749 $eunicefix Cppsym
13750 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13751
13752 : now check the C compiler for additional symbols
13753 postprocess_cc_v=''
13754 case "$osname" in
13755 aix) postprocess_cc_v="|$tr , ' '" ;;
13756 esac
13757 $cat >ccsym <<EOS
13758 $startsh
13759 $cat >tmp.c <<EOF
13760 extern int foo;
13761 EOF
13762 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13763 do
13764         case "\$i" in
13765         -D*) echo "\$i" | $sed 's/^-D//';;
13766         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13767         esac
13768 done
13769 $rm -f try.c
13770 EOS
13771 postprocess_cc_v=''
13772 chmod +x ccsym
13773 $eunicefix ccsym
13774 ./ccsym > ccsym1.raw
13775 if $test -s ccsym1.raw; then
13776        $sort ccsym1.raw | $uniq >ccsym.raw
13777 else
13778        mv ccsym1.raw ccsym.raw
13779 fi
13780
13781 $awk '/\=/ { print $0; next }
13782         { print $0"=1" }' ccsym.raw >ccsym.list
13783 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13784 $comm -13 ccsym.true ccsym.list >ccsym.own
13785 $comm -12 ccsym.true ccsym.list >ccsym.com
13786 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13787 also=''
13788 if $test -z ccsym.raw; then
13789         echo "Your C compiler doesn't seem to define any symbols!" >&4
13790         echo " "
13791         echo "However, your C preprocessor defines the following symbols:"
13792         $cat Cppsym.true
13793         ccsymbols=''
13794         cppsymbols=`$cat Cppsym.true`
13795         cppsymbols=`echo $cppsymbols`
13796         cppccsymbols="$cppsymbols"
13797 else
13798         if $test -s ccsym.com; then
13799                 echo "Your C compiler and pre-processor define these symbols:"
13800                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13801                 also='also '
13802                 symbols='ones'
13803                 cppccsymbols=`$cat ccsym.com`
13804                 cppccsymbols=`echo $cppccsymbols`
13805                 $test "$silent" || sleep 1
13806         fi
13807         if $test -s ccsym.cpp; then
13808                 $test "$also" && echo " "
13809                 echo "Your C pre-processor ${also}defines the following symbols:"
13810                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13811                 also='further '
13812                 cppsymbols=`$cat ccsym.cpp`
13813                 cppsymbols=`echo $cppsymbols`
13814                 $test "$silent" || sleep 1
13815         fi
13816         if $test -s ccsym.own; then
13817                 $test "$also" && echo " "
13818                 echo "Your C compiler ${also}defines the following cpp symbols:"
13819                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13820                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13821                 ccsymbols=`$cat ccsym.own`
13822                 ccsymbols=`echo $ccsymbols`
13823                 $test "$silent" || sleep 1
13824         fi
13825 fi
13826 $rm -f ccsym*
13827
13828 : see if this is a termio system
13829 val="$undef"
13830 val2="$undef"
13831 val3="$undef"
13832 if $test `./findhdr termios.h`; then
13833         set tcsetattr i_termios
13834         eval $inlibc
13835         val3="$i_termios"
13836 fi
13837 echo " "
13838 case "$val3" in
13839 "$define") echo "You have POSIX termios.h... good!" >&4;;
13840 *) if ./Cppsym pyr; then
13841                 case "`/bin/universe`" in
13842                 ucb) if $test `./findhdr sgtty.h`; then
13843                                 val2="$define"
13844                                 echo "<sgtty.h> found." >&4
13845                         else
13846                                 echo "System is pyramid with BSD universe."
13847                                 echo "<sgtty.h> not found--you could have problems." >&4
13848                         fi;;
13849                 *) if $test `./findhdr termio.h`; then
13850                                 val="$define"
13851                                 echo "<termio.h> found." >&4
13852                         else
13853                                 echo "System is pyramid with USG universe."
13854                                 echo "<termio.h> not found--you could have problems." >&4
13855                         fi;;
13856                 esac
13857         elif ./usg; then
13858                 if $test `./findhdr termio.h`; then
13859                         echo "<termio.h> found." >&4
13860                         val="$define"
13861                 elif $test `./findhdr sgtty.h`; then
13862                         echo "<sgtty.h> found." >&4
13863                         val2="$define"
13864                 else
13865 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13866                 fi
13867         else
13868                 if $test `./findhdr sgtty.h`; then
13869                         echo "<sgtty.h> found." >&4
13870                         val2="$define"
13871                 elif $test `./findhdr termio.h`; then
13872                         echo "<termio.h> found." >&4
13873                         val="$define"
13874                 else
13875 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13876                 fi
13877         fi;;
13878 esac
13879 set i_termio; eval $setvar
13880 val=$val2; set i_sgtty; eval $setvar
13881 val=$val3; set i_termios; eval $setvar
13882
13883 : see if this is a shadow.h system
13884 set shadow.h i_shadow
13885 eval $inhdr
13886
13887 : see if this is a socks.h system
13888 set socks.h i_socks
13889 eval $inhdr
13890
13891 : see if stdarg is available
13892 echo " "
13893 if $test `./findhdr stdarg.h`; then
13894         echo "<stdarg.h> found." >&4
13895         valstd="$define"
13896 else
13897         echo "<stdarg.h> NOT found." >&4
13898         valstd="$undef"
13899 fi
13900
13901 : see if varags is available
13902 echo " "
13903 if $test `./findhdr varargs.h`; then
13904         echo "<varargs.h> found." >&4
13905 else
13906         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13907 fi
13908
13909 : set up the varargs testing programs
13910 $cat > varargs.c <<EOP
13911 #ifdef I_STDARG
13912 #include <stdarg.h>
13913 #endif
13914 #ifdef I_VARARGS
13915 #include <varargs.h>
13916 #endif
13917
13918 #ifdef I_STDARG
13919 int f(char *p, ...)
13920 #else
13921 int f(va_alist)
13922 va_dcl
13923 #endif
13924 {
13925         va_list ap;
13926 #ifndef I_STDARG
13927         char *p;
13928 #endif
13929 #ifdef I_STDARG
13930         va_start(ap,p);
13931 #else
13932         va_start(ap);
13933         p = va_arg(ap, char *);
13934 #endif
13935         va_end(ap);
13936 }
13937 EOP
13938 $cat > varargs <<EOP
13939 $startsh
13940 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13941         echo "true"
13942 else
13943         echo "false"
13944 fi
13945 $rm -f varargs$_o
13946 EOP
13947 chmod +x varargs
13948
13949 : now check which varargs header should be included
13950 echo " "
13951 i_varhdr=''
13952 case "$valstd" in
13953 "$define")
13954         if `./varargs I_STDARG`; then
13955                 val='stdarg.h'
13956         elif `./varargs I_VARARGS`; then
13957                 val='varargs.h'
13958         fi
13959         ;;
13960 *)
13961         if `./varargs I_VARARGS`; then
13962                 val='varargs.h'
13963         fi
13964         ;;
13965 esac
13966 case "$val" in
13967 '')
13968 echo "I could not find the definition for va_dcl... You have problems..." >&4
13969         val="$undef"; set i_stdarg; eval $setvar
13970         val="$undef"; set i_varargs; eval $setvar
13971         ;;
13972 *) 
13973         set i_varhdr
13974         eval $setvar
13975         case "$i_varhdr" in
13976         stdarg.h)
13977                 val="$define"; set i_stdarg; eval $setvar
13978                 val="$undef"; set i_varargs; eval $setvar
13979                 ;;
13980         varargs.h)
13981                 val="$undef"; set i_stdarg; eval $setvar
13982                 val="$define"; set i_varargs; eval $setvar
13983                 ;;
13984         esac
13985         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13986 esac
13987 $rm -f varargs*
13988
13989 : see if stddef is available
13990 set stddef.h i_stddef
13991 eval $inhdr
13992
13993 : see if sys/access.h is available
13994 set sys/access.h i_sysaccess
13995 eval $inhdr
13996
13997 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13998 set sys/filio.h i_sysfilio
13999 eval $inhdr
14000 echo " "
14001 if $test `./findhdr sys/ioctl.h`; then
14002         val="$define"
14003         echo '<sys/ioctl.h> found.' >&4
14004 else
14005         val="$undef"
14006         if $test $i_sysfilio = "$define"; then
14007             echo '<sys/ioctl.h> NOT found.' >&4
14008         else
14009                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14010                 $test $i_termio = "$define" && xxx="termio.h"
14011                 $test $i_termios = "$define" && xxx="termios.h"
14012 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14013         fi
14014 fi
14015 set i_sysioctl
14016 eval $setvar
14017
14018 : see if sys/resource.h has to be included
14019 set sys/resource.h i_sysresrc
14020 eval $inhdr
14021
14022 : see if sys/security.h is available
14023 set sys/security.h i_syssecrt
14024 eval $inhdr
14025
14026 : see if this is a sys/statvfs.h system
14027 set sys/statvfs.h i_sysstatvfs
14028 eval $inhdr
14029
14030 : see if this is a sys/uio.h system
14031 set sys/uio.h i_sysuio
14032 eval $inhdr
14033
14034 : see if this is a sys/un.h system
14035 set sys/un.h i_sysun
14036 eval $inhdr
14037
14038 : see if this is a syswait system
14039 set sys/wait.h i_syswait
14040 eval $inhdr
14041
14042 : see if this is a ustat.h system
14043 set ustat.h i_ustat
14044 eval $inhdr
14045
14046 : see if this is an utime system
14047 set utime.h i_utime
14048 eval $inhdr
14049
14050 : see if this is a values.h system
14051 set values.h i_values
14052 eval $inhdr
14053
14054 : see if this is a vfork system
14055 case "$d_vfork" in
14056 "$define")
14057         set vfork.h i_vfork
14058         eval $inhdr
14059         ;;
14060 *)
14061         i_vfork="$undef"
14062         ;;
14063 esac
14064
14065 : see if gdbm.h is available
14066 set gdbm.h t_gdbm
14067 eval $inhdr
14068 case "$t_gdbm" in
14069 $define)
14070         : see if gdbm_open exists
14071         set gdbm_open d_gdbm_open
14072         eval $inlibc
14073         case "$d_gdbm_open" in
14074         $undef)
14075                 t_gdbm="$undef"
14076                 echo "We won't be including <gdbm.h>"
14077                 ;;
14078         esac
14079         ;;
14080 esac
14081 val="$t_gdbm"
14082 set i_gdbm
14083 eval $setvar
14084
14085 echo " "
14086 echo "Looking for extensions..." >&4
14087 : If we are using the old config.sh, known_extensions may contain
14088 : old or inaccurate or duplicate values.
14089 known_extensions=''
14090 nonxs_extensions=''
14091 : We do not use find because it might not be available.
14092 : We do not just use MANIFEST because the user may have dropped
14093 : some additional extensions into the source tree and expect them
14094 : to be built.
14095
14096 : Function to recursively find available extensions, ignoring DynaLoader
14097 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14098 find_extensions='
14099     for xxx in *; do
14100        case "$xxx" in
14101            DynaLoader|dynaload) ;;
14102            *)
14103            if $test -f $xxx/$xxx.xs; then
14104                known_extensions="$known_extensions $1$xxx";
14105            elif $test -f $xxx/Makefile.PL; then
14106                nonxs_extensions="$nonxs_extensions $1$xxx";
14107            else
14108                if $test -d $xxx -a $# -lt 10; then
14109                    set $1$xxx/ $*;
14110                    cd $xxx;
14111                    eval $find_extensions;
14112                    cd ..;
14113                    shift;
14114                fi;
14115            fi
14116            ;;
14117        esac;
14118     done'
14119 tdir=`pwd`
14120 cd $rsrc/ext
14121 set X
14122 shift
14123 eval $find_extensions
14124 set X $nonxs_extensions
14125 shift
14126 nonxs_extensions="$*"
14127 set X $known_extensions
14128 shift
14129 known_extensions="$*"
14130 cd $tdir
14131
14132 : Now see which are supported on this system.
14133 avail_ext=''
14134 for xxx in $known_extensions ; do
14135         case "$xxx" in
14136         DB_File|db_file)
14137                 case "$i_db" in
14138                 $define) avail_ext="$avail_ext $xxx" ;;
14139                 esac
14140                 ;;
14141         GDBM_File|gdbm_fil)
14142                 case "$i_gdbm" in 
14143                 $define) avail_ext="$avail_ext $xxx" ;;
14144                 esac
14145                 ;;
14146         NDBM_File|ndbm_fil)
14147                 case "$i_ndbm" in
14148                 $define) avail_ext="$avail_ext $xxx" ;;
14149                 esac
14150                 ;;
14151         ODBM_File|odbm_fil) 
14152                 case "${i_dbm}${i_rpcsvcdbm}" in
14153                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14154                 esac
14155                 ;;
14156         POSIX|posix)
14157                 case "$useposix" in
14158                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14159                 esac
14160                 ;;
14161         Opcode|opcode)
14162                 case "$useopcode" in
14163                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14164                 esac
14165                 ;;
14166         Socket|socket)
14167                 case "$d_socket" in 
14168                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14169                 esac
14170                 ;;
14171         Thread|thread)
14172                 case "$usethreads" in 
14173                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14174                 esac
14175                 ;;
14176         IPC/SysV|ipc/sysv)
14177                 : XXX Do we need a useipcsysv variable here
14178                 case "${d_msg}${d_sem}${d_shm}" in 
14179                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14180                 esac
14181                 ;;
14182         *)      avail_ext="$avail_ext $xxx"
14183                 ;;
14184         esac
14185 done
14186
14187 set X $avail_ext
14188 shift
14189 avail_ext="$*"
14190
14191 : Now see which nonxs extensions are supported on this system.
14192 : For now assume all are.
14193 nonxs_ext=''
14194 for xxx in $nonxs_extensions ; do
14195         case "$xxx" in
14196         *)      nonxs_ext="$nonxs_ext $xxx"
14197                 ;;
14198         esac
14199 done
14200
14201 set X $nonxs_ext
14202 shift
14203 nonxs_ext="$*"
14204
14205 case $usedl in
14206 $define)
14207         $cat <<EOM
14208 A number of extensions are supplied with $package.  You may choose to
14209 compile these extensions for dynamic loading (the default), compile
14210 them into the $package executable (static loading), or not include
14211 them at all.  Answer "none" to include no extensions.
14212 Note that DynaLoader is always built and need not be mentioned here.
14213
14214 EOM
14215         case "$dynamic_ext" in
14216         '') dflt="$avail_ext" ;;
14217         *)      dflt="$dynamic_ext"
14218                 # Perhaps we are reusing an old out-of-date config.sh.
14219                 case "$hint" in
14220                 previous)
14221                         if test X"$dynamic_ext" != X"$avail_ext"; then
14222                                 $cat <<EOM
14223 NOTICE:  Your previous config.sh list may be incorrect. 
14224 The extensions now available to you are 
14225         ${avail_ext}
14226 but the default list from your previous config.sh is
14227         ${dynamic_ext} 
14228
14229 EOM
14230                         fi
14231                         ;;
14232                 esac
14233                 ;;
14234         esac
14235         case "$dflt" in
14236         '')     dflt=none;;
14237         esac
14238         rp="What extensions do you wish to load dynamically?"
14239         . ./myread
14240         case "$ans" in
14241         none) dynamic_ext=' ' ;;
14242         *) dynamic_ext="$ans" ;;
14243         esac
14244
14245         case "$static_ext" in
14246         '')
14247                 : Exclude those already listed in dynamic linking
14248                 dflt=''
14249                 for xxx in $avail_ext; do
14250                         case " $dynamic_ext " in
14251                         *" $xxx "*) ;;
14252                         *) dflt="$dflt $xxx" ;;
14253                         esac
14254                 done
14255                 set X $dflt
14256                 shift
14257                 dflt="$*"
14258                 ;;
14259         *)  dflt="$static_ext" 
14260                 ;;
14261         esac
14262
14263         case "$dflt" in
14264         '')     dflt=none;;
14265         esac
14266         rp="What extensions do you wish to load statically?"
14267         . ./myread
14268         case "$ans" in
14269         none) static_ext=' ' ;;
14270         *) static_ext="$ans" ;;
14271         esac
14272         ;;
14273 *)
14274         $cat <<EOM
14275 A number of extensions are supplied with $package.  Answer "none" 
14276 to include no extensions. 
14277 Note that DynaLoader is always built and need not be mentioned here.
14278
14279 EOM
14280         case "$static_ext" in
14281         '') dflt="$avail_ext" ;;
14282         *)      dflt="$static_ext"
14283                 # Perhaps we are reusing an old out-of-date config.sh.
14284                 case "$hint" in
14285                 previous)
14286                         if test X"$static_ext" != X"$avail_ext"; then
14287                                 $cat <<EOM
14288 NOTICE:  Your previous config.sh list may be incorrect. 
14289 The extensions now available to you are 
14290         ${avail_ext}
14291 but the default list from your previous config.sh is
14292         ${static_ext} 
14293
14294 EOM
14295                         fi
14296                         ;;
14297                 esac
14298                 ;;
14299         esac
14300         : Exclude those that are not xs extensions
14301         case "$dflt" in
14302         '')     dflt=none;;
14303         esac
14304         rp="What extensions do you wish to include?"
14305         . ./myread
14306         case "$ans" in
14307         none) static_ext=' ' ;;
14308         *) static_ext="$ans" ;;
14309         esac
14310         ;;
14311 esac
14312
14313 set X $dynamic_ext $static_ext $nonxs_ext
14314 shift
14315 extensions="$*"
14316
14317 : Remove build directory name from cppstdin so it can be used from
14318 : either the present location or the final installed location.
14319 echo " "
14320 : Get out of the UU directory to get correct path name.
14321 cd ..
14322 case "$cppstdin" in
14323 `pwd`/cppstdin)
14324         echo "Stripping down cppstdin path name"
14325         cppstdin=cppstdin
14326         ;;
14327 esac
14328 cd UU
14329
14330 : end of configuration questions
14331 echo " "
14332 echo "End of configuration questions."
14333 echo " "
14334
14335 : back to where it started
14336 if test -d ../UU; then
14337         cd ..
14338 fi
14339
14340 : configuration may be patched via a 'config.over' file
14341 if $test -f config.over; then
14342         echo " "
14343         dflt=y
14344         rp='I see a config.over file.  Do you wish to load it?'
14345         . UU/myread
14346         case "$ans" in
14347         n*) echo "OK, I'll ignore it.";;
14348         *)      . ./config.over
14349                 echo "Configuration override changes have been loaded."
14350                 ;;
14351         esac
14352 fi
14353
14354 : in case they want portability, strip down executable paths
14355 case "$d_portable" in
14356 "$define")
14357         echo " "
14358         echo "Stripping down executable paths..." >&4
14359         for file in $loclist $trylist; do
14360                 eval temp=\$$file
14361                 eval $file=`basename $temp`
14362         done
14363         ;;
14364 esac
14365
14366 : create config.sh file
14367 echo " "
14368 echo "Creating config.sh..." >&4
14369 $spitshell <<EOT >config.sh
14370 $startsh
14371 #
14372 # This file was produced by running the Configure script. It holds all the
14373 # definitions figured out by Configure. Should you modify one of these values,
14374 # do not forget to propagate your changes by running "Configure -der". You may
14375 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14376 #
14377
14378 # Package name      : $package
14379 # Source directory  : $src
14380 # Configuration time: $cf_time
14381 # Configured by     : $cf_by
14382 # Target system     : $myuname
14383
14384 Author='$Author'
14385 Date='$Date'
14386 Header='$Header'
14387 Id='$Id'
14388 Locker='$Locker'
14389 Log='$Log'
14390 Mcc='$Mcc'
14391 RCSfile='$RCSfile'
14392 Revision='$Revision'
14393 Source='$Source'
14394 State='$State'
14395 _a='$_a'
14396 _exe='$_exe'
14397 _o='$_o'
14398 afs='$afs'
14399 alignbytes='$alignbytes'
14400 ansi2knr='$ansi2knr'
14401 aphostname='$aphostname'
14402 api_revision='$api_revision'
14403 api_subversion='$api_subversion'
14404 api_version='$api_version'
14405 api_versionstring='$api_versionstring'
14406 ar='$ar'
14407 archlib='$archlib'
14408 archlibexp='$archlibexp'
14409 archname64='$archname64'
14410 archname='$archname'
14411 archobjs='$archobjs'
14412 awk='$awk'
14413 baserev='$baserev'
14414 bash='$bash'
14415 bin='$bin'
14416 bincompat5005='$bincompat5005'
14417 binexp='$binexp'
14418 bison='$bison'
14419 byacc='$byacc'
14420 byteorder='$byteorder'
14421 c='$c'
14422 castflags='$castflags'
14423 cat='$cat'
14424 cc='$cc'
14425 cccdlflags='$cccdlflags'
14426 ccdlflags='$ccdlflags'
14427 ccflags='$ccflags'
14428 ccsymbols='$ccsymbols'
14429 cf_by='$cf_by'
14430 cf_email='$cf_email'
14431 cf_time='$cf_time'
14432 charsize='$charsize'
14433 chgrp='$chgrp'
14434 chmod='$chmod'
14435 chown='$chown'
14436 clocktype='$clocktype'
14437 comm='$comm'
14438 compress='$compress'
14439 contains='$contains'
14440 cp='$cp'
14441 cpio='$cpio'
14442 cpp='$cpp'
14443 cpp_stuff='$cpp_stuff'
14444 cppccsymbols='$cppccsymbols'
14445 cppflags='$cppflags'
14446 cpplast='$cpplast'
14447 cppminus='$cppminus'
14448 cpprun='$cpprun'
14449 cppstdin='$cppstdin'
14450 cppsymbols='$cppsymbols'
14451 crosscompile='$crosscompile'
14452 cryptlib='$cryptlib'
14453 csh='$csh'
14454 d_Gconvert='$d_Gconvert'
14455 d_PRIEldbl='$d_PRIEldbl'
14456 d_PRIFldbl='$d_PRIFldbl'
14457 d_PRIGldbl='$d_PRIGldbl'
14458 d_PRIX64='$d_PRIX64'
14459 d_PRId64='$d_PRId64'
14460 d_PRIeldbl='$d_PRIeldbl'
14461 d_PRIfldbl='$d_PRIfldbl'
14462 d_PRIgldbl='$d_PRIgldbl'
14463 d_PRIi64='$d_PRIi64'
14464 d_PRIo64='$d_PRIo64'
14465 d_PRIu64='$d_PRIu64'
14466 d_PRIx64='$d_PRIx64'
14467 d_access='$d_access'
14468 d_accessx='$d_accessx'
14469 d_alarm='$d_alarm'
14470 d_archlib='$d_archlib'
14471 d_atolf='$d_atolf'
14472 d_atoll='$d_atoll'
14473 d_attribut='$d_attribut'
14474 d_bcmp='$d_bcmp'
14475 d_bcopy='$d_bcopy'
14476 d_bincompat5005='$d_bincompat5005'
14477 d_bsd='$d_bsd'
14478 d_bsdgetpgrp='$d_bsdgetpgrp'
14479 d_bsdsetpgrp='$d_bsdsetpgrp'
14480 d_bzero='$d_bzero'
14481 d_casti32='$d_casti32'
14482 d_castneg='$d_castneg'
14483 d_charvspr='$d_charvspr'
14484 d_chown='$d_chown'
14485 d_chroot='$d_chroot'
14486 d_chsize='$d_chsize'
14487 d_closedir='$d_closedir'
14488 d_const='$d_const'
14489 d_crypt='$d_crypt'
14490 d_csh='$d_csh'
14491 d_cuserid='$d_cuserid'
14492 d_dbl_dig='$d_dbl_dig'
14493 d_difftime='$d_difftime'
14494 d_dirnamlen='$d_dirnamlen'
14495 d_dlerror='$d_dlerror'
14496 d_dlopen='$d_dlopen'
14497 d_dlsymun='$d_dlsymun'
14498 d_dosuid='$d_dosuid'
14499 d_drand48proto='$d_drand48proto'
14500 d_dup2='$d_dup2'
14501 d_eaccess='$d_eaccess'
14502 d_endgrent='$d_endgrent'
14503 d_endhent='$d_endhent'
14504 d_endnent='$d_endnent'
14505 d_endpent='$d_endpent'
14506 d_endpwent='$d_endpwent'
14507 d_endsent='$d_endsent'
14508 d_endspent='$d_endspent'
14509 d_eofnblk='$d_eofnblk'
14510 d_eunice='$d_eunice'
14511 d_fchmod='$d_fchmod'
14512 d_fchown='$d_fchown'
14513 d_fcntl='$d_fcntl'
14514 d_fd_macros='$d_fd_macros'
14515 d_fd_set='$d_fd_set'
14516 d_fds_bits='$d_fds_bits'
14517 d_fgetpos='$d_fgetpos'
14518 d_flexfnam='$d_flexfnam'
14519 d_flock='$d_flock'
14520 d_fork='$d_fork'
14521 d_fpathconf='$d_fpathconf'
14522 d_fpos64_t='$d_fpos64_t'
14523 d_fs_data_s='$d_fs_data_s'
14524 d_fseeko='$d_fseeko'
14525 d_fsetpos='$d_fsetpos'
14526 d_fstatfs='$d_fstatfs'
14527 d_fstatvfs='$d_fstatvfs'
14528 d_ftello='$d_ftello'
14529 d_ftime='$d_ftime'
14530 d_getgrent='$d_getgrent'
14531 d_getgrps='$d_getgrps'
14532 d_gethbyaddr='$d_gethbyaddr'
14533 d_gethbyname='$d_gethbyname'
14534 d_gethent='$d_gethent'
14535 d_gethname='$d_gethname'
14536 d_gethostprotos='$d_gethostprotos'
14537 d_getlogin='$d_getlogin'
14538 d_getmnt='$d_getmnt'
14539 d_getmntent='$d_getmntent'
14540 d_getnbyaddr='$d_getnbyaddr'
14541 d_getnbyname='$d_getnbyname'
14542 d_getnent='$d_getnent'
14543 d_getnetprotos='$d_getnetprotos'
14544 d_getpbyname='$d_getpbyname'
14545 d_getpbynumber='$d_getpbynumber'
14546 d_getpent='$d_getpent'
14547 d_getpgid='$d_getpgid'
14548 d_getpgrp2='$d_getpgrp2'
14549 d_getpgrp='$d_getpgrp'
14550 d_getppid='$d_getppid'
14551 d_getprior='$d_getprior'
14552 d_getprotoprotos='$d_getprotoprotos'
14553 d_getpwent='$d_getpwent'
14554 d_getsbyname='$d_getsbyname'
14555 d_getsbyport='$d_getsbyport'
14556 d_getsent='$d_getsent'
14557 d_getservprotos='$d_getservprotos'
14558 d_getspent='$d_getspent'
14559 d_getspnam='$d_getspnam'
14560 d_gettimeod='$d_gettimeod'
14561 d_gnulibc='$d_gnulibc'
14562 d_grpasswd='$d_grpasswd'
14563 d_hasmntopt='$d_hasmntopt'
14564 d_htonl='$d_htonl'
14565 d_index='$d_index'
14566 d_inetaton='$d_inetaton'
14567 d_int64t='$d_int64t'
14568 d_isascii='$d_isascii'
14569 d_killpg='$d_killpg'
14570 d_lchown='$d_lchown'
14571 d_ldbl_dig='$d_ldbl_dig'
14572 d_link='$d_link'
14573 d_locconv='$d_locconv'
14574 d_lockf='$d_lockf'
14575 d_longdbl='$d_longdbl'
14576 d_longlong='$d_longlong'
14577 d_lstat='$d_lstat'
14578 d_mblen='$d_mblen'
14579 d_mbstowcs='$d_mbstowcs'
14580 d_mbtowc='$d_mbtowc'
14581 d_memchr='$d_memchr'
14582 d_memcmp='$d_memcmp'
14583 d_memcpy='$d_memcpy'
14584 d_memmove='$d_memmove'
14585 d_memset='$d_memset'
14586 d_mkdir='$d_mkdir'
14587 d_mkfifo='$d_mkfifo'
14588 d_mktime='$d_mktime'
14589 d_msg='$d_msg'
14590 d_msg_ctrunc='$d_msg_ctrunc'
14591 d_msg_dontroute='$d_msg_dontroute'
14592 d_msg_oob='$d_msg_oob'
14593 d_msg_peek='$d_msg_peek'
14594 d_msg_proxy='$d_msg_proxy'
14595 d_msgctl='$d_msgctl'
14596 d_msgget='$d_msgget'
14597 d_msgrcv='$d_msgrcv'
14598 d_msgsnd='$d_msgsnd'
14599 d_mymalloc='$d_mymalloc'
14600 d_nice='$d_nice'
14601 d_nvpresuv='$d_nvpresuv'
14602 d_off64_t='$d_off64_t'
14603 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14604 d_oldpthreads='$d_oldpthreads'
14605 d_oldsock='$d_oldsock'
14606 d_open3='$d_open3'
14607 d_pathconf='$d_pathconf'
14608 d_pause='$d_pause'
14609 d_phostname='$d_phostname'
14610 d_pipe='$d_pipe'
14611 d_poll='$d_poll'
14612 d_portable='$d_portable'
14613 d_pthread_yield='$d_pthread_yield'
14614 d_pwage='$d_pwage'
14615 d_pwchange='$d_pwchange'
14616 d_pwclass='$d_pwclass'
14617 d_pwcomment='$d_pwcomment'
14618 d_pwexpire='$d_pwexpire'
14619 d_pwgecos='$d_pwgecos'
14620 d_pwpasswd='$d_pwpasswd'
14621 d_pwquota='$d_pwquota'
14622 d_quad='$d_quad'
14623 d_readdir='$d_readdir'
14624 d_readlink='$d_readlink'
14625 d_rename='$d_rename'
14626 d_rewinddir='$d_rewinddir'
14627 d_rmdir='$d_rmdir'
14628 d_safebcpy='$d_safebcpy'
14629 d_safemcpy='$d_safemcpy'
14630 d_sanemcmp='$d_sanemcmp'
14631 d_sched_yield='$d_sched_yield'
14632 d_scm_rights='$d_scm_rights'
14633 d_seekdir='$d_seekdir'
14634 d_select='$d_select'
14635 d_sem='$d_sem'
14636 d_semctl='$d_semctl'
14637 d_semctl_semid_ds='$d_semctl_semid_ds'
14638 d_semctl_semun='$d_semctl_semun'
14639 d_semget='$d_semget'
14640 d_semop='$d_semop'
14641 d_setegid='$d_setegid'
14642 d_seteuid='$d_seteuid'
14643 d_setgrent='$d_setgrent'
14644 d_setgrps='$d_setgrps'
14645 d_sethent='$d_sethent'
14646 d_setlinebuf='$d_setlinebuf'
14647 d_setlocale='$d_setlocale'
14648 d_setnent='$d_setnent'
14649 d_setpent='$d_setpent'
14650 d_setpgid='$d_setpgid'
14651 d_setpgrp2='$d_setpgrp2'
14652 d_setpgrp='$d_setpgrp'
14653 d_setprior='$d_setprior'
14654 d_setpwent='$d_setpwent'
14655 d_setregid='$d_setregid'
14656 d_setresgid='$d_setresgid'
14657 d_setresuid='$d_setresuid'
14658 d_setreuid='$d_setreuid'
14659 d_setrgid='$d_setrgid'
14660 d_setruid='$d_setruid'
14661 d_setsent='$d_setsent'
14662 d_setsid='$d_setsid'
14663 d_setspent='$d_setspent'
14664 d_setvbuf='$d_setvbuf'
14665 d_sfio='$d_sfio'
14666 d_shm='$d_shm'
14667 d_shmat='$d_shmat'
14668 d_shmatprototype='$d_shmatprototype'
14669 d_shmctl='$d_shmctl'
14670 d_shmdt='$d_shmdt'
14671 d_shmget='$d_shmget'
14672 d_sigaction='$d_sigaction'
14673 d_sigsetjmp='$d_sigsetjmp'
14674 d_socket='$d_socket'
14675 d_sockpair='$d_sockpair'
14676 d_sqrtl='$d_sqrtl'
14677 d_statblks='$d_statblks'
14678 d_statfs_f_flags='$d_statfs_f_flags'
14679 d_statfs_s='$d_statfs_s'
14680 d_statvfs='$d_statvfs'
14681 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14682 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14683 d_stdio_stream_array='$d_stdio_stream_array'
14684 d_stdiobase='$d_stdiobase'
14685 d_stdstdio='$d_stdstdio'
14686 d_strchr='$d_strchr'
14687 d_strcoll='$d_strcoll'
14688 d_strctcpy='$d_strctcpy'
14689 d_strerrm='$d_strerrm'
14690 d_strerror='$d_strerror'
14691 d_strtod='$d_strtod'
14692 d_strtol='$d_strtol'
14693 d_strtold='$d_strtold'
14694 d_strtoll='$d_strtoll'
14695 d_strtoul='$d_strtoul'
14696 d_strtoull='$d_strtoull'
14697 d_strtouq='$d_strtouq'
14698 d_strxfrm='$d_strxfrm'
14699 d_suidsafe='$d_suidsafe'
14700 d_symlink='$d_symlink'
14701 d_syscall='$d_syscall'
14702 d_sysconf='$d_sysconf'
14703 d_sysernlst='$d_sysernlst'
14704 d_syserrlst='$d_syserrlst'
14705 d_system='$d_system'
14706 d_tcgetpgrp='$d_tcgetpgrp'
14707 d_tcsetpgrp='$d_tcsetpgrp'
14708 d_telldir='$d_telldir'
14709 d_telldirproto='$d_telldirproto'
14710 d_time='$d_time'
14711 d_times='$d_times'
14712 d_truncate='$d_truncate'
14713 d_tzname='$d_tzname'
14714 d_umask='$d_umask'
14715 d_uname='$d_uname'
14716 d_union_semun='$d_union_semun'
14717 d_ustat='$d_ustat'
14718 d_vendorbin='$d_vendorbin'
14719 d_vendorlib='$d_vendorlib'
14720 d_vfork='$d_vfork'
14721 d_void_closedir='$d_void_closedir'
14722 d_voidsig='$d_voidsig'
14723 d_voidtty='$d_voidtty'
14724 d_volatile='$d_volatile'
14725 d_vprintf='$d_vprintf'
14726 d_wait4='$d_wait4'
14727 d_waitpid='$d_waitpid'
14728 d_wcstombs='$d_wcstombs'
14729 d_wctomb='$d_wctomb'
14730 d_xenix='$d_xenix'
14731 date='$date'
14732 db_hashtype='$db_hashtype'
14733 db_prefixtype='$db_prefixtype'
14734 defvoidused='$defvoidused'
14735 direntrytype='$direntrytype'
14736 dlext='$dlext'
14737 dlsrc='$dlsrc'
14738 doublesize='$doublesize'
14739 drand01='$drand01'
14740 dynamic_ext='$dynamic_ext'
14741 eagain='$eagain'
14742 ebcdic='$ebcdic'
14743 echo='$echo'
14744 egrep='$egrep'
14745 emacs='$emacs'
14746 eunicefix='$eunicefix'
14747 exe_ext='$exe_ext'
14748 expr='$expr'
14749 extensions='$extensions'
14750 fflushNULL='$fflushNULL'
14751 fflushall='$fflushall'
14752 find='$find'
14753 firstmakefile='$firstmakefile'
14754 flex='$flex'
14755 fpossize='$fpossize'
14756 fpostype='$fpostype'
14757 freetype='$freetype'
14758 full_ar='$full_ar'
14759 full_csh='$full_csh'
14760 full_sed='$full_sed'
14761 gccversion='$gccversion'
14762 gidformat='$gidformat'
14763 gidsign='$gidsign'
14764 gidsize='$gidsize'
14765 gidtype='$gidtype'
14766 glibpth='$glibpth'
14767 grep='$grep'
14768 groupcat='$groupcat'
14769 groupstype='$groupstype'
14770 gzip='$gzip'
14771 h_fcntl='$h_fcntl'
14772 h_sysfile='$h_sysfile'
14773 hint='$hint'
14774 hostcat='$hostcat'
14775 huge='$huge'
14776 i16size='$i16size'
14777 i16type='$i16type'
14778 i32size='$i32size'
14779 i32type='$i32type'
14780 i64size='$i64size'
14781 i64type='$i64type'
14782 i8size='$i8size'
14783 i8type='$i8type'
14784 i_arpainet='$i_arpainet'
14785 i_bsdioctl='$i_bsdioctl'
14786 i_db='$i_db'
14787 i_dbm='$i_dbm'
14788 i_dirent='$i_dirent'
14789 i_dld='$i_dld'
14790 i_dlfcn='$i_dlfcn'
14791 i_fcntl='$i_fcntl'
14792 i_float='$i_float'
14793 i_gdbm='$i_gdbm'
14794 i_grp='$i_grp'
14795 i_inttypes='$i_inttypes'
14796 i_limits='$i_limits'
14797 i_locale='$i_locale'
14798 i_machcthr='$i_machcthr'
14799 i_malloc='$i_malloc'
14800 i_math='$i_math'
14801 i_memory='$i_memory'
14802 i_mntent='$i_mntent'
14803 i_ndbm='$i_ndbm'
14804 i_netdb='$i_netdb'
14805 i_neterrno='$i_neterrno'
14806 i_netinettcp='$i_netinettcp'
14807 i_niin='$i_niin'
14808 i_poll='$i_poll'
14809 i_pthread='$i_pthread'
14810 i_pwd='$i_pwd'
14811 i_rpcsvcdbm='$i_rpcsvcdbm'
14812 i_sfio='$i_sfio'
14813 i_sgtty='$i_sgtty'
14814 i_shadow='$i_shadow'
14815 i_socks='$i_socks'
14816 i_stdarg='$i_stdarg'
14817 i_stddef='$i_stddef'
14818 i_stdlib='$i_stdlib'
14819 i_string='$i_string'
14820 i_sysaccess='$i_sysaccess'
14821 i_sysdir='$i_sysdir'
14822 i_sysfile='$i_sysfile'
14823 i_sysfilio='$i_sysfilio'
14824 i_sysin='$i_sysin'
14825 i_sysioctl='$i_sysioctl'
14826 i_sysmount='$i_sysmount'
14827 i_sysndir='$i_sysndir'
14828 i_sysparam='$i_sysparam'
14829 i_sysresrc='$i_sysresrc'
14830 i_syssecrt='$i_syssecrt'
14831 i_sysselct='$i_sysselct'
14832 i_syssockio='$i_syssockio'
14833 i_sysstat='$i_sysstat'
14834 i_sysstatfs='$i_sysstatfs'
14835 i_sysstatvfs='$i_sysstatvfs'
14836 i_systime='$i_systime'
14837 i_systimek='$i_systimek'
14838 i_systimes='$i_systimes'
14839 i_systypes='$i_systypes'
14840 i_sysuio='$i_sysuio'
14841 i_sysun='$i_sysun'
14842 i_sysvfs='$i_sysvfs'
14843 i_syswait='$i_syswait'
14844 i_termio='$i_termio'
14845 i_termios='$i_termios'
14846 i_time='$i_time'
14847 i_unistd='$i_unistd'
14848 i_ustat='$i_ustat'
14849 i_utime='$i_utime'
14850 i_values='$i_values'
14851 i_varargs='$i_varargs'
14852 i_varhdr='$i_varhdr'
14853 i_vfork='$i_vfork'
14854 ignore_versioned_solibs='$ignore_versioned_solibs'
14855 inc_version_list='$inc_version_list'
14856 inc_version_list_init='$inc_version_list_init'
14857 incpath='$incpath'
14858 inews='$inews'
14859 installarchlib='$installarchlib'
14860 installbin='$installbin'
14861 installman1dir='$installman1dir'
14862 installman3dir='$installman3dir'
14863 installprefix='$installprefix'
14864 installprefixexp='$installprefixexp'
14865 installprivlib='$installprivlib'
14866 installscript='$installscript'
14867 installsitearch='$installsitearch'
14868 installsitebin='$installsitebin'
14869 installsitelib='$installsitelib'
14870 installstyle='$installstyle'
14871 installusrbinperl='$installusrbinperl'
14872 installvendorbin='$installvendorbin'
14873 installvendorlib='$installvendorlib'
14874 intsize='$intsize'
14875 ivdformat='$ivdformat'
14876 ivsize='$ivsize'
14877 ivtype='$ivtype'
14878 known_extensions='$known_extensions'
14879 ksh='$ksh'
14880 large='$large'
14881 ld='$ld'
14882 lddlflags='$lddlflags'
14883 ldflags='$ldflags'
14884 ldlibpthname='$ldlibpthname'
14885 less='$less'
14886 lib_ext='$lib_ext'
14887 libc='$libc'
14888 libperl='$libperl'
14889 libpth='$libpth'
14890 libs='$libs'
14891 libswanted='$libswanted'
14892 line='$line'
14893 lint='$lint'
14894 lkflags='$lkflags'
14895 ln='$ln'
14896 lns='$lns'
14897 locincpth='$locincpth'
14898 loclibpth='$loclibpth'
14899 longdblsize='$longdblsize'
14900 longlongsize='$longlongsize'
14901 longsize='$longsize'
14902 lp='$lp'
14903 lpr='$lpr'
14904 ls='$ls'
14905 lseeksize='$lseeksize'
14906 lseektype='$lseektype'
14907 mail='$mail'
14908 mailx='$mailx'
14909 make='$make'
14910 make_set_make='$make_set_make'
14911 mallocobj='$mallocobj'
14912 mallocsrc='$mallocsrc'
14913 malloctype='$malloctype'
14914 man1dir='$man1dir'
14915 man1direxp='$man1direxp'
14916 man1ext='$man1ext'
14917 man3dir='$man3dir'
14918 man3direxp='$man3direxp'
14919 man3ext='$man3ext'
14920 medium='$medium'
14921 mips_type='$mips_type'
14922 mkdir='$mkdir'
14923 models='$models'
14924 modetype='$modetype'
14925 more='$more'
14926 multiarch='$multiarch'
14927 mv='$mv'
14928 myarchname='$myarchname'
14929 mydomain='$mydomain'
14930 myhostname='$myhostname'
14931 myuname='$myuname'
14932 n='$n'
14933 netdb_hlen_type='$netdb_hlen_type'
14934 netdb_host_type='$netdb_host_type'
14935 netdb_name_type='$netdb_name_type'
14936 netdb_net_type='$netdb_net_type'
14937 nm='$nm'
14938 nm_opt='$nm_opt'
14939 nm_so_opt='$nm_so_opt'
14940 nonxs_ext='$nonxs_ext'
14941 nroff='$nroff'
14942 nvsize='$nvsize'
14943 nvtype='$nvtype'
14944 o_nonblock='$o_nonblock'
14945 obj_ext='$obj_ext'
14946 old_pthread_create_joinable='$old_pthread_create_joinable'
14947 optimize='$optimize'
14948 orderlib='$orderlib'
14949 osname='$osname'
14950 osvers='$osvers'
14951 package='$package'
14952 pager='$pager'
14953 passcat='$passcat'
14954 patchlevel='$patchlevel'
14955 path_sep='$path_sep'
14956 perl='$perl'
14957 perladmin='$perladmin'
14958 perlpath='$perlpath'
14959 pg='$pg'
14960 phostname='$phostname'
14961 pidtype='$pidtype'
14962 plibpth='$plibpth'
14963 pmake='$pmake'
14964 pr='$pr'
14965 prefix='$prefix'
14966 prefixexp='$prefixexp'
14967 privlib='$privlib'
14968 privlibexp='$privlibexp'
14969 prototype='$prototype'
14970 ptrsize='$ptrsize'
14971 quadkind='$quadkind'
14972 quadtype='$quadtype'
14973 randbits='$randbits'
14974 randfunc='$randfunc'
14975 randseedtype='$randseedtype'
14976 ranlib='$ranlib'
14977 rd_nodata='$rd_nodata'
14978 rm='$rm'
14979 rmail='$rmail'
14980 runnm='$runnm'
14981 sPRIEldbl='$sPRIEldbl'
14982 sPRIFldbl='$sPRIFldbl'
14983 sPRIGldbl='$sPRIGldbl'
14984 sPRIX64='$sPRIX64'
14985 sPRId64='$sPRId64'
14986 sPRIeldbl='$sPRIeldbl'
14987 sPRIfldbl='$sPRIfldbl'
14988 sPRIgldbl='$sPRIgldbl'
14989 sPRIi64='$sPRIi64'
14990 sPRIo64='$sPRIo64'
14991 sPRIu64='$sPRIu64'
14992 sPRIx64='$sPRIx64'
14993 sched_yield='$sched_yield'
14994 scriptdir='$scriptdir'
14995 scriptdirexp='$scriptdirexp'
14996 sed='$sed'
14997 seedfunc='$seedfunc'
14998 selectminbits='$selectminbits'
14999 selecttype='$selecttype'
15000 sendmail='$sendmail'
15001 sh='$sh'
15002 shar='$shar'
15003 sharpbang='$sharpbang'
15004 shmattype='$shmattype'
15005 shortsize='$shortsize'
15006 shrpenv='$shrpenv'
15007 shsharp='$shsharp'
15008 sig_count='$sig_count'
15009 sig_name='$sig_name'
15010 sig_name_init='$sig_name_init'
15011 sig_num='$sig_num'
15012 sig_num_init='$sig_num_init'
15013 signal_t='$signal_t'
15014 sitearch='$sitearch'
15015 sitearchexp='$sitearchexp'
15016 sitebin='$sitebin'
15017 sitebinexp='$sitebinexp'
15018 sitelib='$sitelib'
15019 sitelibexp='$sitelibexp'
15020 siteprefix='$siteprefix'
15021 siteprefixexp='$siteprefixexp'
15022 sizetype='$sizetype'
15023 sleep='$sleep'
15024 smail='$smail'
15025 small='$small'
15026 so='$so'
15027 sockethdr='$sockethdr'
15028 socketlib='$socketlib'
15029 sort='$sort'
15030 spackage='$spackage'
15031 spitshell='$spitshell'
15032 split='$split'
15033 src='$src'
15034 ssizetype='$ssizetype'
15035 startperl='$startperl'
15036 startsh='$startsh'
15037 static_ext='$static_ext'
15038 stdchar='$stdchar'
15039 stdio_base='$stdio_base'
15040 stdio_bufsiz='$stdio_bufsiz'
15041 stdio_cnt='$stdio_cnt'
15042 stdio_filbuf='$stdio_filbuf'
15043 stdio_ptr='$stdio_ptr'
15044 stdio_stream_array='$stdio_stream_array'
15045 strings='$strings'
15046 submit='$submit'
15047 subversion='$subversion'
15048 sysman='$sysman'
15049 tail='$tail'
15050 tar='$tar'
15051 tbl='$tbl'
15052 tee='$tee'
15053 test='$test'
15054 timeincl='$timeincl'
15055 timetype='$timetype'
15056 touch='$touch'
15057 tr='$tr'
15058 trnl='$trnl'
15059 troff='$troff'
15060 u16size='$u16size'
15061 u16type='$u16type'
15062 u32size='$u32size'
15063 u32type='$u32type'
15064 u64size='$u64size'
15065 u64type='$u64type'
15066 u8size='$u8size'
15067 u8type='$u8type'
15068 uidformat='$uidformat'
15069 uidsign='$uidsign'
15070 uidsize='$uidsize'
15071 uidtype='$uidtype'
15072 uname='$uname'
15073 uniq='$uniq'
15074 uquadtype='$uquadtype'
15075 use5005threads='$use5005threads'
15076 use64bits='$use64bits'
15077 usedl='$usedl'
15078 useithreads='$useithreads'
15079 uselargefiles='$uselargefiles'
15080 uselongdouble='$uselongdouble'
15081 uselonglong='$uselonglong'
15082 usemorebits='$usemorebits'
15083 usemultiplicity='$usemultiplicity'
15084 usemymalloc='$usemymalloc'
15085 usenm='$usenm'
15086 useopcode='$useopcode'
15087 useperlio='$useperlio'
15088 useposix='$useposix'
15089 usesfio='$usesfio'
15090 useshrplib='$useshrplib'
15091 usesocks='$usesocks'
15092 usethreads='$usethreads'
15093 usevendorprefix='$usevendorprefix'
15094 usevfork='$usevfork'
15095 usrinc='$usrinc'
15096 uuname='$uuname'
15097 uvoformat='$uvoformat'
15098 uvsize='$uvsize'
15099 uvtype='$uvtype'
15100 uvuformat='$uvuformat'
15101 uvxformat='$uvxformat'
15102 vendorbin='$vendorbin'
15103 vendorbinexp='$vendorbinexp'
15104 vendorlib='$vendorlib'
15105 vendorlibexp='$vendorlibexp'
15106 vendorprefix='$vendorprefix'
15107 vendorprefixexp='$vendorprefixexp'
15108 version='$version'
15109 vi='$vi'
15110 voidflags='$voidflags'
15111 xlibpth='$xlibpth'
15112 zcat='$zcat'
15113 zip='$zip'
15114 EOT
15115
15116 : Add in command line options if available
15117 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15118
15119 : add special variables
15120 $test -f $src/patchlevel.h && \
15121 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15122 echo "CONFIGDOTSH=true" >>config.sh
15123
15124 : propagate old symbols
15125 if $test -f UU/config.sh; then
15126         <UU/config.sh sort | uniq >UU/oldconfig.sh
15127         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15128         sort | uniq -u >UU/oldsyms
15129         set X `cat UU/oldsyms`
15130         shift
15131         case $# in
15132         0) ;;
15133         *)
15134                 cat <<EOM
15135 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15136 EOM
15137                 echo "# Variables propagated from previous config.sh file." >>config.sh
15138                 for sym in `cat UU/oldsyms`; do
15139                         echo "    Propagating $hint variable "'$'"$sym..."
15140                         eval 'tmp="$'"${sym}"'"'
15141                         echo "$tmp" | \
15142                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15143                 done
15144                 ;;
15145         esac
15146 fi
15147
15148 : Finish up by extracting the .SH files
15149 case "$alldone" in
15150 exit)
15151         $rm -rf UU
15152         echo "Done."
15153         exit 0
15154         ;;
15155 cont)
15156         ;;
15157 '')
15158         dflt=''
15159         nostick=true
15160         $cat <<EOM
15161
15162 If you'd like to make any changes to the config.sh file before I begin
15163 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15164
15165 EOM
15166         rp="Press return or use a shell escape to edit config.sh:"
15167         . UU/myread
15168         nostick=''
15169         case "$ans" in
15170         '') ;;
15171         *) : in case they cannot read
15172                 sh 1>&4 -c "$ans";;
15173         esac
15174         ;;
15175 esac
15176
15177 : if this fails, just run all the .SH files by hand
15178 . ./config.sh
15179
15180 echo " "
15181 exec 1>&4
15182 . ./UU/extract
15183
15184 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15185         dflt=y
15186         case "$silent" in
15187         true) ;;
15188         *)
15189                 $cat <<EOM
15190
15191 Now you need to generate make dependencies by running "$make depend".
15192 You might prefer to run it in background: "$make depend > makedepend.out &"
15193 It can take a while, so you might not want to run it right now.
15194
15195 EOM
15196                 ;;
15197         esac
15198         rp="Run $make depend now?"
15199         . UU/myread
15200         case "$ans" in
15201         y*)
15202                 $make depend && echo "Now you must run a $make."
15203                 ;;
15204         *)
15205                 echo "You must run '$make depend' then '$make'."
15206                 ;;
15207         esac
15208 elif test -f [Mm]akefile; then
15209         echo " "
15210         echo "Now you must run a $make."
15211 else
15212         echo "Done."
15213 fi
15214
15215 if $test -f Policy.sh; then
15216     $cat <<EOM
15217
15218 If you compile $package on a different machine or from a different object
15219 directory, copy the Policy.sh file from this object directory to the
15220 new one before you run Configure -- this will help you with most of
15221 the policy defaults.
15222
15223 EOM
15224 fi
15225 if $test -f config.msg; then
15226     echo "Hmm.  I also noted the following information while running:"
15227     echo " "
15228     $cat config.msg >&4
15229     $rm -f config.msg
15230 fi
15231 $rm -f kit*isdone ark*isdone
15232 $rm -rf UU
15233
15234 : End of Configure
15235