29a59fb32d2294bd5251ffa786dd87c884a1b76d
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sun Jan 16 18:22:25 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_strtoul=''
534 d_strtoull=''
535 d_strtouq=''
536 d_strxfrm=''
537 d_symlink=''
538 d_syscall=''
539 d_sysconf=''
540 d_system=''
541 d_tcgetpgrp=''
542 d_tcsetpgrp=''
543 d_telldirproto=''
544 d_time=''
545 timetype=''
546 clocktype=''
547 d_times=''
548 d_truncate=''
549 d_tzname=''
550 d_umask=''
551 d_semctl_semid_ds=''
552 d_semctl_semun=''
553 d_union_semun=''
554 d_ustat=''
555 d_vfork=''
556 usevfork=''
557 d_voidsig=''
558 signal_t=''
559 d_volatile=''
560 d_charvspr=''
561 d_vprintf=''
562 d_wait4=''
563 d_waitpid=''
564 d_wcstombs=''
565 d_wctomb=''
566 dlext=''
567 cccdlflags=''
568 ccdlflags=''
569 dlsrc=''
570 ld=''
571 lddlflags=''
572 usedl=''
573 doublesize=''
574 ebcdic=''
575 fflushNULL=''
576 fflushall=''
577 fpossize=''
578 fpostype=''
579 gidformat=''
580 gidsign=''
581 gidsize=''
582 gidtype=''
583 groupstype=''
584 h_fcntl=''
585 h_sysfile=''
586 i_arpainet=''
587 db_hashtype=''
588 db_prefixtype=''
589 i_db=''
590 i_dbm=''
591 i_rpcsvcdbm=''
592 d_dirnamlen=''
593 direntrytype=''
594 i_dirent=''
595 i_dld=''
596 i_dlfcn=''
597 i_fcntl=''
598 i_float=''
599 i_gdbm=''
600 d_grpasswd=''
601 i_grp=''
602 i_inttypes=''
603 i_limits=''
604 i_locale=''
605 i_machcthr=''
606 i_malloc=''
607 i_math=''
608 i_memory=''
609 i_mntent=''
610 i_ndbm=''
611 i_netdb=''
612 i_neterrno=''
613 i_netinettcp=''
614 i_niin=''
615 i_sysin=''
616 i_poll=''
617 i_pthread=''
618 d_pwage=''
619 d_pwchange=''
620 d_pwclass=''
621 d_pwcomment=''
622 d_pwexpire=''
623 d_pwgecos=''
624 d_pwpasswd=''
625 d_pwquota=''
626 i_pwd=''
627 i_sfio=''
628 i_shadow=''
629 i_socks=''
630 i_stddef=''
631 i_stdlib=''
632 i_string=''
633 strings=''
634 i_sysaccess=''
635 i_sysdir=''
636 i_sysfile=''
637 d_voidtty=''
638 i_bsdioctl=''
639 i_sysfilio=''
640 i_sysioctl=''
641 i_syssockio=''
642 i_sysmount=''
643 i_sysndir=''
644 i_sysparam=''
645 i_sysresrc=''
646 i_syssecrt=''
647 i_sysselct=''
648 i_sysstat=''
649 i_sysstatfs=''
650 i_sysstatvfs=''
651 i_systimes=''
652 i_systypes=''
653 i_sysuio=''
654 i_sysun=''
655 i_sysvfs=''
656 i_syswait=''
657 i_sgtty=''
658 i_termio=''
659 i_termios=''
660 i_systime=''
661 i_systimek=''
662 i_time=''
663 timeincl=''
664 i_unistd=''
665 i_ustat=''
666 i_utime=''
667 i_values=''
668 i_stdarg=''
669 i_varargs=''
670 i_varhdr=''
671 i_vfork=''
672 inc_version_list=''
673 installprefix=''
674 installprefixexp=''
675 installstyle=''
676 installusrbinperl=''
677 intsize=''
678 longsize=''
679 shortsize=''
680 d_fpos64_t=''
681 d_off64_t=''
682 libc=''
683 ldlibpthname=''
684 libperl=''
685 shrpenv=''
686 useshrplib=''
687 glibpth=''
688 libpth=''
689 loclibpth=''
690 plibpth=''
691 xlibpth=''
692 ignore_versioned_solibs=''
693 libs=''
694 lns=''
695 d_PRIEldbl=''
696 d_PRIFldbl=''
697 d_PRIGldbl=''
698 d_PRIeldbl=''
699 d_PRIfldbl=''
700 d_PRIgldbl=''
701 sPRIEldbl=''
702 sPRIFldbl=''
703 sPRIGldbl=''
704 sPRIeldbl=''
705 sPRIfldbl=''
706 sPRIgldbl=''
707 lseeksize=''
708 lseektype=''
709 make_set_make=''
710 d_mymalloc=''
711 freetype=''
712 mallocobj=''
713 mallocsrc=''
714 malloctype=''
715 usemymalloc=''
716 installman1dir=''
717 man1dir=''
718 man1direxp=''
719 man1ext=''
720 installman3dir=''
721 man3dir=''
722 man3direxp=''
723 man3ext=''
724 huge=''
725 large=''
726 medium=''
727 models=''
728 small=''
729 split=''
730 modetype=''
731 multiarch=''
732 mydomain=''
733 myhostname=''
734 phostname=''
735 c=''
736 n=''
737 d_eofnblk=''
738 eagain=''
739 o_nonblock=''
740 rd_nodata=''
741 netdb_hlen_type=''
742 netdb_host_type=''
743 netdb_name_type=''
744 netdb_net_type=''
745 groupcat=''
746 hostcat=''
747 passcat=''
748 orderlib=''
749 ranlib=''
750 package=''
751 spackage=''
752 pager=''
753 api_revision=''
754 api_subversion=''
755 api_version=''
756 api_versionstring=''
757 patchlevel=''
758 subversion=''
759 version=''
760 perladmin=''
761 perlpath=''
762 i16size=''
763 i16type=''
764 i32size=''
765 i32type=''
766 i64size=''
767 i64type=''
768 i8size=''
769 i8type=''
770 ivsize=''
771 ivtype=''
772 nvsize=''
773 nvtype=''
774 u16size=''
775 u16type=''
776 u32size=''
777 u32type=''
778 u64size=''
779 u64type=''
780 u8size=''
781 u8type=''
782 uvsize=''
783 uvtype=''
784 ivdformat=''
785 uvoformat=''
786 uvuformat=''
787 uvxformat=''
788 pidtype=''
789 prefix=''
790 prefixexp=''
791 installprivlib=''
792 privlib=''
793 privlibexp=''
794 prototype=''
795 ptrsize=''
796 d_PRIX64=''
797 d_PRId64=''
798 d_PRIi64=''
799 d_PRIo64=''
800 d_PRIu64=''
801 d_PRIx64=''
802 sPRIX64=''
803 sPRId64=''
804 sPRIi64=''
805 sPRIo64=''
806 sPRIu64=''
807 sPRIx64=''
808 d_quad=''
809 quadkind=''
810 quadtype=''
811 uquadtype=''
812 drand01=''
813 randbits=''
814 randfunc=''
815 randseedtype=''
816 seedfunc=''
817 installscript=''
818 scriptdir=''
819 scriptdirexp=''
820 selectminbits=''
821 selecttype=''
822 sh=''
823 sig_count=''
824 sig_name=''
825 sig_name_init=''
826 sig_num=''
827 sig_num_init=''
828 installsitearch=''
829 sitearch=''
830 sitearchexp=''
831 installsitebin=''
832 sitebin=''
833 sitebinexp=''
834 installsitelib=''
835 sitelib=''
836 sitelibexp=''
837 siteprefix=''
838 siteprefixexp=''
839 sizetype=''
840 so=''
841 sharpbang=''
842 shsharp=''
843 spitshell=''
844 src=''
845 ssizetype=''
846 startperl=''
847 startsh=''
848 stdchar=''
849 d_stdio_stream_array=''
850 stdio_stream_array=''
851 sysman=''
852 trnl=''
853 uidformat=''
854 uidsign=''
855 uidsize=''
856 uidtype=''
857 archname64=''
858 use64bits=''
859 uselargefiles=''
860 uselongdouble=''
861 uselonglong=''
862 usemorebits=''
863 usemultiplicity=''
864 nm_opt=''
865 nm_so_opt=''
866 runnm=''
867 usenm=''
868 useperlio=''
869 usesocks=''
870 d_oldpthreads=''
871 use5005threads=''
872 useithreads=''
873 usethreads=''
874 incpath=''
875 mips_type=''
876 usrinc=''
877 d_vendorbin=''
878 installvendorbin=''
879 vendorbin=''
880 vendorbinexp=''
881 d_vendorlib=''
882 installvendorlib=''
883 vendorlib=''
884 vendorlibexp=''
885 usevendorprefix=''
886 vendorprefix=''
887 vendorprefixexp=''
888 defvoidused=''
889 voidflags=''
890 CONFIG=''
891
892 define='define'
893 undef='undef'
894 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
895 rmlist=''
896
897 : We must find out about Eunice early
898 eunicefix=':'
899 if test -f /etc/unixtovms; then
900         eunicefix=/etc/unixtovms
901 fi
902 if test -f /etc/unixtovms.exe; then
903         eunicefix=/etc/unixtovms.exe
904 fi
905
906 i_whoami=''
907 : list of known cpp symbols, sorted alphabetically
908 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
909 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
910 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
911 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
912 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
913 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
914 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
915 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
916 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
917 al="$al VMS Xenix286"
918 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
919 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
920 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
921 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
922 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
923 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
924 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
925 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
926 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
927 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
928 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
929 al="$al __SVR4_2__ __UMAXV__"
930 al="$al ____386BSD____ __alpha __alpha__ __amiga"
931 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
932 al="$al __host_mips__"
933 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
934 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
935 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
936 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
937 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
938 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
939 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
940 al="$al __mc88100 __mc88100__ __mips __mips__"
941 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
942 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
943 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
944 al="$al _host_mips _mips _unix"
945 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
946 al="$al apollo ardent att386 att3b"
947 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
948 al="$al cadmus clipper concurrent convex cray ctix"
949 al="$al dmert encore gcos gcx gimpel gould"
950 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
951 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
952 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
953 al="$al i186 i286 i386 i486 i8086"
954 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
955 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
956 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
957 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
958 al="$al mc88000 mc88100 merlin mert mips mvs n16"
959 al="$al ncl_el ncl_mr"
960 al="$al news1500 news1700 news1800 news1900 news3700"
961 al="$al news700 news800 news900 ns16000 ns32000"
962 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
963 al="$al parisc pc532 pdp11 plexus posix pyr"
964 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
965 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
966 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
967 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
968 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
969 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
970 al="$al xenix z8000"
971
972 : set useposix=false in your hint file to disable the POSIX extension.
973 useposix=true
974 : set useopcode=false in your hint file to disable the Opcode extension.
975 useopcode=true
976 : Trailing extension.  Override this in a hint file, if needed.
977 _exe=''
978 : Extra object files, if any, needed on this platform.
979 archobjs=''
980 : Possible local include directories to search.
981 : Set locincpth to "" in a hint file to defeat local include searches.
982 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
983 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
984 :
985 : no include file wanted by default
986 inclwanted=''
987
988 groupstype=''
989 : change the next line if compiling for Xenix/286 on Xenix/386
990 xlibpth='/usr/lib/386 /lib/386'
991
992 : Possible local library directories to search.
993 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
994 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
995
996 : general looking path for locating libraries
997 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
998 glibpth="$glibpth /lib /usr/lib $xlibpth"
999 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1000 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1001
1002 : Private path used by Configure to find libraries.  Its value
1003 : is prepended to libpth. This variable takes care of special
1004 : machines, like the mips.  Usually, it should be empty.
1005 plibpth=''
1006
1007 : default library list
1008 libswanted=''
1009 : some systems want to use only the non-versioned libso:s
1010 ignore_versioned_solibs=''
1011 : set usemultiplicity on the Configure command line to enable multiplicity.
1012 : set usesocks on the Configure command line to enable socks.
1013 : set usethreads on the Configure command line to enable threads.
1014 : full support for void wanted by default
1015 defvoidused=15
1016
1017 : List of libraries we want.
1018 : If anyone needs -lnet, put it in a hint file.
1019 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1020 libswanted="$libswanted dld ld sun m c cposix posix"
1021 libswanted="$libswanted ndir dir crypt sec"
1022 libswanted="$libswanted ucb bsd BSD PW x"
1023 : We probably want to search /usr/shlib before most other libraries.
1024 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1025 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1026 glibpth="/usr/shlib $glibpth"
1027 : Do not use vfork unless overridden by a hint file.
1028 usevfork=false
1029
1030 : Find the basic shell for Bourne shell scripts
1031 case "$sh" in
1032 '')
1033         case "$SYSTYPE" in
1034         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1035         *) xxx='/bin/sh';;
1036         esac
1037         if test -f "$xxx"; then
1038                 sh="$xxx"
1039         else
1040                 : Build up a list and do a single loop so we can 'break' out.
1041                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1042                 for xxx in sh bash ksh pdksh ash; do
1043                         for p in $pth; do
1044                                 try="$try ${p}/${xxx}"
1045                         done
1046                 done
1047                 for xxx in $try; do
1048                         if test -f "$xxx"; then
1049                                 sh="$xxx";
1050                                 break
1051                         elif test -f "$xxx.exe"; then
1052                                 sh="$xxx";
1053                                 break
1054                         fi
1055                 done
1056         fi
1057         ;;
1058 esac
1059
1060 case "$sh" in
1061 '')     cat <<EOM >&2
1062 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1063
1064 Usually it's in /bin/sh.  How did you even get this far?
1065 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1066 we'll try to straighten this all out.
1067 EOM
1068         exit 1
1069         ;;
1070 esac
1071
1072 : see if sh knows # comments
1073 if `$sh -c '#' >/dev/null 2>&1`; then
1074         shsharp=true
1075         spitshell=cat
1076         xcat=/bin/cat
1077         test -f $xcat || xcat=/usr/bin/cat
1078         echo "#!$xcat" >try
1079         $eunicefix try
1080         chmod +x try
1081         ./try > today
1082         if test -s today; then
1083                 sharpbang='#!'
1084         else
1085                 echo "#! $xcat" > try
1086                 $eunicefix try
1087                 chmod +x try
1088                 ./try > today
1089                 if test -s today; then
1090                         sharpbang='#! '
1091                 else
1092                         sharpbang=': use '
1093                 fi
1094         fi
1095 else
1096         echo " "
1097         echo "Your $sh doesn't grok # comments--I will strip them later on."
1098         shsharp=false
1099         cd ..
1100         echo "exec grep -v '^[  ]*#'" >spitshell
1101         chmod +x spitshell
1102         $eunicefix spitshell
1103         spitshell=`pwd`/spitshell
1104         cd UU
1105         echo "I presume that if # doesn't work, #! won't work either!"
1106         sharpbang=': use '
1107 fi
1108 rm -f try today
1109
1110 : figure out how to guarantee sh startup
1111 case "$startsh" in
1112 '') startsh=${sharpbang}${sh} ;;
1113 *)
1114 esac
1115 cat >try <<EOSS
1116 $startsh
1117 set abc
1118 test "$?abc" != 1
1119 EOSS
1120
1121 chmod +x try
1122 $eunicefix try
1123 if ./try; then
1124         : echo "Yup, it does."
1125 else
1126         echo "Hmm... '$startsh' does not guarantee sh startup..."
1127         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1128 fi
1129 rm -f try
1130
1131
1132 : Save command line options in file UU/cmdline.opt for later use in
1133 : generating config.sh.
1134 cat > cmdline.opt <<EOSH
1135 # Configure command line arguments.
1136 config_arg0='$0'
1137 config_args='$*'
1138 config_argc=$#
1139 EOSH
1140 argn=1
1141 for arg in "$@"; do
1142         cat >>cmdline.opt <<EOSH
1143 config_arg$argn='$arg'
1144 EOSH
1145         argn=`expr $argn + 1`
1146 done
1147
1148 : produce awk script to parse command line options
1149 cat >options.awk <<'EOF'
1150 BEGIN {
1151         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1152
1153         len = length(optstr);
1154         for (i = 1; i <= len; i++) {
1155                 c = substr(optstr, i, 1);
1156                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1157                 if (a == ":") {
1158                         arg[c] = 1;
1159                         i++;
1160                 }
1161                 opt[c] = 1;
1162         }
1163 }
1164 {
1165         expect = 0;
1166         str = $0;
1167         if (substr(str, 1, 1) != "-") {
1168                 printf("'%s'\n", str);
1169                 next;
1170         }
1171         len = length($0);
1172         for (i = 2; i <= len; i++) {
1173                 c = substr(str, i, 1);
1174                 if (!opt[c]) {
1175                         printf("-%s\n", substr(str, i));
1176                         next;
1177                 }
1178                 printf("-%s\n", c);
1179                 if (arg[c]) {
1180                         if (i < len)
1181                                 printf("'%s'\n", substr(str, i + 1));
1182                         else
1183                                 expect = 1;
1184                         next;
1185                 }
1186         }
1187 }
1188 END {
1189         if (expect)
1190                 print "?";
1191 }
1192 EOF
1193
1194 : process the command line options
1195 set X `for arg in "$@"; do echo "X$arg"; done |
1196         sed -e s/X// | awk -f options.awk`
1197 eval "set $*"
1198 shift
1199 rm -f options.awk
1200
1201 : set up default values
1202 fastread=''
1203 reuseval=false
1204 config_sh=''
1205 alldone=''
1206 error=''
1207 silent=''
1208 extractsh=''
1209 override=''
1210 knowitall=''
1211 rm -f optdef.sh posthint.sh
1212 cat >optdef.sh <<EOS
1213 $startsh
1214 EOS
1215
1216
1217 : option parsing
1218 while test $# -gt 0; do
1219         case "$1" in
1220         -d) shift; fastread=yes;;
1221         -e) shift; alldone=cont;;
1222         -f)
1223                 shift
1224                 cd ..
1225                 if test -r "$1"; then
1226                         config_sh="$1"
1227                 else
1228                         echo "$me: cannot read config file $1." >&2
1229                         error=true
1230                 fi
1231                 cd UU
1232                 shift;;
1233         -h) shift; error=true;;
1234         -r) shift; reuseval=true;;
1235         -s) shift; silent=true; realsilent=true;;
1236         -E) shift; alldone=exit;;
1237         -K) shift; knowitall=true;;
1238         -O) shift; override=true;;
1239         -S) shift; silent=true; extractsh=true;;
1240         -D)
1241                 shift
1242                 case "$1" in
1243                 *=)
1244                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1245                         echo "$me: ignoring -D $1" >&2
1246                         ;;
1247                 *=*) echo "$1" | \
1248                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1249                 *) echo "$1='define'" >> optdef.sh;;
1250                 esac
1251                 shift
1252                 ;;
1253         -U)
1254                 shift
1255                 case "$1" in
1256                 *=) echo "$1" >> optdef.sh;;
1257                 *=*)
1258                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1259                         echo "$me: ignoring -U $1" >&2
1260                         ;;
1261                 *) echo "$1='undef'" >> optdef.sh;;
1262                 esac
1263                 shift
1264                 ;;
1265         -A)
1266             shift
1267             xxx=''
1268             yyy="$1"
1269             zzz=''
1270             uuu=undef
1271             case "$yyy" in
1272             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1273                  case "$zzz" in
1274                  *:*) zzz='' ;;
1275                  *)   xxx=append
1276                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1277                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1278                  esac
1279                  ;;
1280             esac
1281             case "$xxx" in
1282             '')  case "$yyy" in
1283                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1284                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1285                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1286                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1287                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1288                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1289                  esac
1290                  ;;       
1291             esac
1292             case "$xxx" in
1293             append)
1294                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1295             clear)
1296                 echo "$yyy=''"                  >> posthint.sh ;;
1297             define)
1298                 case "$zzz" in
1299                 '') zzz=define ;;
1300                 esac
1301                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1302             eval)
1303                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1304             prepend)
1305                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1306             undef)
1307                 case "$zzz" in
1308                 '') zzz="$uuu" ;;
1309                 esac
1310                 echo "$yyy=$zzz"                >> posthint.sh ;;
1311             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1312             esac
1313             ;;
1314         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1315             exit 0;;
1316         --) break;;
1317         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1318         *) break;;
1319         esac
1320 done
1321
1322 case "$error" in
1323 true)
1324         cat >&2 <<EOM
1325 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1326                  [-U symbol] [-U symbol=] [-A command:symbol...]
1327   -d : use defaults for all answers.
1328   -e : go on without questioning past the production of config.sh.
1329   -f : specify an alternate default configuration file.
1330   -h : print this help message and exit (with an error status).
1331   -r : reuse C symbols value if possible (skips costly nm extraction).
1332   -s : silent mode, only echoes questions and essential information.
1333   -D : define symbol to have some value:
1334          -D symbol         symbol gets the value 'define'
1335          -D symbol=value   symbol gets the value 'value'
1336   -E : stop at the end of questions, after having produced config.sh.
1337   -K : do not use unless you know what you are doing.
1338   -O : let -D and -U override definitions from loaded configuration file.
1339   -S : perform variable substitutions on all .SH files (can mix with -f)
1340   -U : undefine symbol:
1341          -U symbol    symbol gets the value 'undef'
1342          -U symbol=   symbol gets completely empty
1343   -A : manipulate symbol after the platform specific hints have been applied:
1344          -A symbol=value                append " "value to symbol
1345          -A append:symbol=value         append value to symbol
1346          -A define:symbol=value         define symbol to have value
1347          -A clear:symbol                define symbol to be ''
1348          -A define:symbol               define symbol to be 'define'
1349          -A eval:symbol=value           define symbol to be eval of value
1350          -A prepend:symbol=value        prepend value to symbol
1351          -A undef:symbol                define symbol to be 'undef'
1352          -A undef:symbol=               define symbol to be ''
1353   -V : print version number and exit (with a zero status).
1354 EOM
1355         exit 1
1356         ;;
1357 esac
1358
1359 : Sanity checks
1360 case "$fastread$alldone" in
1361 yescont|yesexit) ;;
1362 *)
1363         if test ! -t 0; then
1364                 echo "Say 'sh Configure', not 'sh <Configure'"
1365                 exit 1
1366         fi
1367         ;;
1368 esac
1369
1370 exec 4>&1
1371 case "$silent" in
1372 true) exec 1>/dev/null;;
1373 esac
1374
1375 : run the defines and the undefines, if any, but leave the file out there...
1376 touch optdef.sh
1377 . ./optdef.sh
1378 : create the posthint manipulation script and leave the file out there...
1379 touch posthint.sh
1380
1381 : set package name
1382 package=perl5
1383 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1384 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1385 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1386 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1387 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1388 esac
1389
1390 : Some greps do not return status, grrr.
1391 echo "grimblepritz" >grimble
1392 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1393         contains=contains
1394 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1395         contains=grep
1396 else
1397         contains=contains
1398 fi
1399 rm -f grimble
1400 : the following should work in any shell
1401 case "$contains" in
1402 contains*)
1403         echo " "
1404         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1405         cat >contains <<'EOSS'
1406 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1407 EOSS
1408 chmod +x contains
1409 esac
1410
1411 : Find the path to the source tree
1412 case "$src" in
1413 '') case "$0" in
1414     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1415          case "$src" in
1416          /*)    ;;
1417          *)     src=`cd ../$src && pwd` ;;
1418          esac
1419          ;;
1420     *)   src='.';;
1421     esac;;
1422 esac
1423 case "$src" in
1424 '')     src=/
1425         rsrc=/
1426         ;;
1427 /*) rsrc="$src";;
1428 *) rsrc="../$src";;
1429 esac
1430 if test -f $rsrc/Configure && \
1431         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1432 then
1433    : found it, so we are ok.
1434 else
1435         rsrc=''
1436         for src in . .. ../.. ../../.. ../../../..; do
1437                 if test -f ../$src/Configure && \
1438                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1439                 then
1440                         rsrc=../$src
1441                         break
1442                 fi
1443         done
1444 fi
1445 case "$rsrc" in
1446 '')
1447         cat <<EOM >&4
1448
1449 Sorry, I can't seem to locate the source dir for $package.  Please start
1450 Configure with an explicit path -- i.e. /some/path/Configure.
1451
1452 EOM
1453         exit 1
1454         ;;
1455 ../.)   rsrc='..';;
1456 *)
1457         echo " "
1458         echo "Sources for $package found in \"$src\"." >&4
1459         ;;
1460 esac
1461
1462 : script used to extract .SH files with variable substitutions
1463 cat >extract <<'EOS'
1464 CONFIGDOTSH=true
1465 echo "Doing variable substitutions on .SH files..."
1466 if test -f $src/MANIFEST; then
1467         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1468 else
1469         echo "(Looking for .SH files under the source directory.)"
1470         set x `(cd $src; find . -name "*.SH" -print)`
1471 fi
1472 shift
1473 case $# in
1474 0) set x `(cd $src; echo *.SH)`; shift;;
1475 esac
1476 if test ! -f $src/$1; then
1477         shift
1478 fi
1479 mkdir_p='
1480 name=$1;
1481 create="";
1482 while test $name; do
1483         if test ! -d "$name"; then
1484                 create="$name $create";
1485                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1486                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1487         else
1488                 name="";
1489         fi;
1490 done;
1491 for file in $create; do
1492         mkdir $file;
1493 done
1494 '
1495 for file in $*; do
1496         case "$src" in
1497         ".")
1498                 case "$file" in
1499                 */*)
1500                         dir=`expr X$file : 'X\(.*\)/'`
1501                         file=`expr X$file : 'X.*/\(.*\)'`
1502                         (cd $dir && . ./$file)
1503                         ;;
1504                 *)
1505                         . ./$file
1506                         ;;
1507                 esac
1508                 ;;
1509         *)
1510                 case "$file" in
1511                 */*)
1512                         dir=`expr X$file : 'X\(.*\)/'`
1513                         file=`expr X$file : 'X.*/\(.*\)'`
1514                         (set x $dir; shift; eval $mkdir_p)
1515                         sh <$src/$dir/$file
1516                         ;;
1517                 *)
1518                         sh <$src/$file
1519                         ;;
1520                 esac
1521                 ;;
1522         esac
1523 done
1524 if test -f $src/config_h.SH; then
1525         if test ! -f config.h; then
1526         : oops, they left it out of MANIFEST, probably, so do it anyway.
1527         . $src/config_h.SH
1528         fi
1529 fi
1530 EOS
1531
1532 : extract files and exit if asked to do so
1533 case "$extractsh" in
1534 true)
1535         case "$realsilent" in
1536         true) ;;
1537         *) exec 1>&4;;
1538         esac
1539         case "$config_sh" in
1540         '') config_sh='config.sh';;
1541         esac
1542         echo " "
1543         echo "Fetching answers from $config_sh..."
1544         cd ..
1545         . $config_sh
1546         test "$override" && . ./optdef.sh
1547         echo " "
1548         . UU/extract
1549         rm -rf UU
1550         echo "Done."
1551         exit 0
1552         ;;
1553 esac
1554
1555 : Eunice requires " " instead of "", can you believe it
1556 echo " "
1557 : Here we go...
1558 echo "Beginning of configuration questions for $package."
1559
1560 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1561
1562 : first determine how to suppress newline on echo command
1563 echo " "
1564 echo "Checking echo to see how to suppress newlines..."
1565 (echo "hi there\c" ; echo " ") >.echotmp
1566 if $contains c .echotmp >/dev/null 2>&1 ; then
1567         echo "...using -n."
1568         n='-n'
1569         c=''
1570 else
1571         cat <<'EOM'
1572 ...using \c
1573 EOM
1574         n=''
1575         c='\c'
1576 fi
1577 echo $n "The star should be here-->$c"
1578 echo '*'
1579 rm -f .echotmp
1580
1581 : Now test for existence of everything in MANIFEST
1582 echo " "
1583 if test -f $rsrc/MANIFEST; then
1584         echo "First let's make sure your kit is complete.  Checking..." >&4
1585         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1586         rm -f missing
1587         tmppwd=`pwd`
1588         for filelist in x??; do
1589                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1590         done
1591         if test -s missing; then
1592                 cat missing >&4
1593                 cat >&4 <<'EOM'
1594
1595 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1596
1597 You have the option of continuing the configuration process, despite the
1598 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1599 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1600 and contact the author (perlbug@perl.com).
1601
1602 EOM
1603                 echo $n "Continue? [n] $c" >&4
1604                 read ans
1605                 case "$ans" in
1606                 y*)
1607                         echo "Continuing..." >&4
1608                         rm -f missing
1609                         ;;
1610                 *)
1611                         echo "ABORTING..." >&4
1612                         kill $$
1613                         ;;
1614                 esac
1615         else
1616                 echo "Looks good..."
1617         fi
1618 else
1619         echo "There is no MANIFEST file.  I hope your kit is complete !"
1620 fi
1621 rm -f missing x??
1622
1623 echo " "
1624 : Find the appropriate value for a newline for tr
1625 if test -n "$DJGPP"; then
1626        trnl='\012'
1627 fi
1628 if test X"$trnl" = X; then
1629         case "`echo foo|tr '\n' x 2>/dev/null`" in
1630         foox) trnl='\n' ;;
1631         esac
1632 fi
1633 if test X"$trnl" = X; then
1634         case "`echo foo|tr '\012' x 2>/dev/null`" in
1635         foox) trnl='\012' ;;
1636         esac
1637 fi
1638 if test X"$trnl" = X; then
1639         cat <<EOM >&2
1640
1641 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1642
1643 EOM
1644         exit 1
1645 fi
1646
1647 : compute the number of columns on the terminal for proper question formatting
1648 case "$COLUMNS" in
1649 '') COLUMNS='80';;
1650 esac
1651
1652 : set up the echo used in my read
1653 myecho="case \"\$xxxm\" in
1654 '') echo $n \"\$rp $c\" >&4;;
1655 *) case \"\$rp\" in
1656         '') echo $n \"[\$xxxm] $c\";;
1657         *)
1658                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1659                         echo \"\$rp\" >&4
1660                         echo $n \"[\$xxxm] $c\" >&4
1661                 else
1662                         echo $n \"\$rp [\$xxxm] $c\" >&4
1663                 fi
1664                 ;;
1665         esac;;
1666 esac"
1667
1668 : now set up to do reads with possible shell escape and default assignment
1669 cat <<EOSC >myread
1670 $startsh
1671 xxxm=\$dflt
1672 $myecho
1673 ans='!'
1674 case "\$fastread" in
1675 yes) case "\$dflt" in
1676         '') ;;
1677         *) ans='';
1678                 case "\$silent-\$rp" in
1679                 true-) ;;
1680                 *) echo " " >&4;;
1681                 esac;;
1682         esac;;
1683 *) case "\$silent" in
1684         true) case "\$rp" in
1685                 '') ans='';;
1686                 esac;;
1687         esac;;
1688 esac
1689 while expr "X\$ans" : "X!" >/dev/null; do
1690         read answ
1691         set x \$xxxm
1692         shift
1693         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1694         case  "\$answ" in
1695         "!")
1696                 sh 1>&4
1697                 echo " "
1698                 $myecho
1699                 ;;
1700         !*)
1701                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1702                 shift
1703                 sh 1>&4 -c "\$*"
1704                 echo " "
1705                 $myecho
1706                 ;;
1707         "\$ans")
1708                 case "\$ans" in
1709                 \\&*)
1710                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1711                         shift
1712                         case "\$1" in
1713                         -d)
1714                                 fastread=yes
1715                                 echo "(OK, I'll run with -d after this question.)" >&4
1716                                 ;;
1717                         -*)
1718                                 echo "*** Sorry, \$1 not supported yet." >&4
1719                                 ;;
1720                         esac
1721                         $myecho
1722                         ans=!
1723                         ;;
1724                 esac;;
1725         *)
1726                 case "\$aok" in
1727                 y)
1728                         echo "*** Substitution done -- please confirm."
1729                         xxxm="\$ans"
1730                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1731                         xxxm="\$ans"
1732                         ans=!
1733                         ;;
1734                 *)
1735                         echo "*** Error -- try again."
1736                         ans=!
1737                         ;;
1738                 esac
1739                 $myecho
1740                 ;;
1741         esac
1742         case "\$ans\$xxxm\$nostick" in
1743         '')
1744                 ans=!
1745                 $myecho
1746                 ;;
1747         esac
1748 done
1749 case "\$ans" in
1750 '') ans="\$xxxm";;
1751 esac
1752 EOSC
1753
1754 : create .config dir to save info across Configure sessions
1755 test -d ../.config || mkdir ../.config
1756 cat >../.config/README <<EOF
1757 This directory created by Configure to save information that should
1758 persist across sessions for $package.
1759
1760 You may safely delete it if you wish.
1761 EOF
1762
1763 : general instructions
1764 needman=true
1765 firsttime=true
1766 user=`(logname) 2>/dev/null`
1767 case "$user" in
1768 '') user=`whoami 2>&1`;;
1769 esac
1770 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1771         firsttime=false
1772         echo " "
1773         rp='Would you like to see the instructions?'
1774         dflt=n
1775         . ./myread
1776         case "$ans" in
1777         [yY]*) ;;
1778         *) needman=false;;
1779         esac
1780 fi
1781 if $needman; then
1782         cat <<EOH
1783
1784 This installation shell script will examine your system and ask you questions
1785 to determine how the perl5 package should be installed. If you get
1786 stuck on a question, you may use a ! shell escape to start a subshell or
1787 execute a command.  Many of the questions will have default answers in square
1788 brackets; typing carriage return will give you the default.
1789
1790 On some of the questions which ask for file or directory names you are allowed
1791 to use the ~name construct to specify the login directory belonging to "name",
1792 even if you don't have a shell which knows about that.  Questions where this is
1793 allowed will be marked "(~name ok)".
1794
1795 EOH
1796         rp=''
1797         dflt='Type carriage return to continue'
1798         . ./myread
1799         cat <<'EOH'
1800
1801 The prompter used in this script allows you to use shell variables and
1802 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1803 in the default answer, as if the default line was a set of arguments given to a
1804 script shell.  This means you may also use $* to repeat the whole default line,
1805 so you do not have to re-type everything to add something to the default.
1806
1807 Everytime there is a substitution, you will have to confirm.  If there is an
1808 error (e.g. an unmatched backtick), the default answer will remain unchanged
1809 and you will be prompted again.
1810
1811 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1812 the questions and use the computed defaults (or the previous answers if there
1813 was already a config.sh file). Type 'Configure -h' for a list of options.
1814 You may also start interactively and then answer '& -d' at any prompt to turn
1815 on the non-interactive behaviour for the remainder of the execution.
1816
1817 EOH
1818         . ./myread
1819         cat <<EOH
1820
1821 Much effort has been expended to ensure that this shell script will run on any
1822 Unix system.  If despite that it blows up on yours, your best bet is to edit
1823 Configure and run it again.  If you can't run Configure for some reason,
1824 you'll have to generate a config.sh file by hand.  Whatever problems you
1825 have, let me (perlbug@perl.com) know how I blew it.
1826
1827 This installation script affects things in two ways:
1828
1829 1) it may do direct variable substitutions on some of the files included
1830    in this kit.
1831 2) it builds a config.h file for inclusion in C programs.  You may edit
1832    any of these files as the need arises after running this script.
1833
1834 If you make a mistake on a question, there is no easy way to back up to it
1835 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1836 files.  Configure will offer to let you do this before it runs the SH files.
1837
1838 EOH
1839         dflt='Type carriage return to continue'
1840         . ./myread
1841         case "$firsttime" in
1842         true) echo $user >>../.config/instruct;;
1843         esac
1844 fi
1845
1846 : find out where common programs are
1847 echo " "
1848 echo "Locating common programs..." >&4
1849 cat <<EOSC >loc
1850 $startsh
1851 case \$# in
1852 0) exit 1;;
1853 esac
1854 thing=\$1
1855 shift
1856 dflt=\$1
1857 shift
1858 for dir in \$*; do
1859         case "\$thing" in
1860         .)
1861         if test -d \$dir/\$thing; then
1862                 echo \$dir
1863                 exit 0
1864         fi
1865         ;;
1866         *)
1867         for thisthing in \$dir/\$thing; do
1868                 : just loop through to pick last item
1869         done
1870         if test -f \$thisthing; then
1871                 echo \$thisthing
1872                 exit 0
1873         elif test -f \$dir/\$thing.exe; then
1874                 if test -n "$DJGPP"; then
1875                         echo \$dir/\$thing.exe
1876                 else
1877                         : on Eunice apparently
1878                         echo \$dir/\$thing
1879                 fi
1880                 exit 0
1881         fi
1882         ;;
1883         esac
1884 done
1885 echo \$dflt
1886 exit 1
1887 EOSC
1888 chmod +x loc
1889 $eunicefix loc
1890 loclist="
1891 awk
1892 cat
1893 comm
1894 cp
1895 echo
1896 expr
1897 grep
1898 ls
1899 make
1900 mkdir
1901 rm
1902 sed
1903 sort
1904 touch
1905 tr
1906 uniq
1907 "
1908 trylist="
1909 Mcc
1910 ar
1911 byacc
1912 cpp
1913 csh
1914 date
1915 egrep
1916 gzip
1917 less
1918 ln
1919 more
1920 nm
1921 nroff
1922 perl
1923 pg
1924 test
1925 uname
1926 zip
1927 "
1928 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1929 pth="$pth /lib /usr/lib"
1930 for file in $loclist; do
1931         eval xxx=\$$file
1932         case "$xxx" in
1933         /*|?:[\\/]*)
1934                 if test -f "$xxx"; then
1935                         : ok
1936                 else
1937                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1938                         xxx=`./loc $file $file $pth`
1939                 fi
1940                 ;;
1941         '') xxx=`./loc $file $file $pth`;;
1942         *) xxx=`./loc $xxx $xxx $pth`;;
1943         esac
1944         eval $file=$xxx
1945         eval _$file=$xxx
1946         case "$xxx" in
1947         /*)
1948                 echo $file is in $xxx.
1949                 ;;
1950         ?:[\\/]*)
1951                 echo $file is in $xxx.
1952                 ;;
1953         *)
1954                 echo "I don't know where '$file' is, and my life depends on it." >&4
1955                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1956                 exit 1
1957                 ;;
1958         esac
1959 done
1960 echo " "
1961 echo "Don't worry if any of the following aren't found..."
1962 say=offhand
1963 for file in $trylist; do
1964         eval xxx=\$$file
1965         case "$xxx" in
1966         /*|?:[\\/]*)
1967                 if test -f "$xxx"; then
1968                         : ok
1969                 else
1970                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1971                         xxx=`./loc $file $file $pth`
1972                 fi
1973                 ;;
1974         '') xxx=`./loc $file $file $pth`;;
1975         *) xxx=`./loc $xxx $xxx $pth`;;
1976         esac
1977         eval $file=$xxx
1978         eval _$file=$xxx
1979         case "$xxx" in
1980         /*)
1981                 echo $file is in $xxx.
1982                 ;;
1983         ?:[\\/]*)
1984                 echo $file is in $xxx.
1985                 ;;
1986         *)
1987                 echo "I don't see $file out there, $say."
1988                 say=either
1989                 ;;
1990         esac
1991 done
1992 case "$egrep" in
1993 egrep)
1994         echo "Substituting grep for egrep."
1995         egrep=$grep
1996         ;;
1997 esac
1998 case "$ln" in
1999 ln)
2000         echo "Substituting cp for ln."
2001         ln=$cp
2002         ;;
2003 esac
2004 case "$test" in
2005 test)
2006         echo "Hopefully test is built into your sh."
2007         ;;
2008 *)
2009         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2010                 echo "Using the test built into your sh."
2011                 test=test
2012                 _test=test
2013         fi
2014         ;;
2015 esac
2016 case "$echo" in
2017 echo)
2018         echo "Hopefully echo is built into your sh."
2019         ;;
2020 '') ;;
2021 *)
2022         echo " "
2023 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2024         $echo $n "hi there$c" >foo1
2025         echo $n "hi there$c" >foo2
2026         if cmp foo1 foo2 >/dev/null 2>&1; then
2027                 echo "They are compatible.  In fact, they may be identical."
2028         else
2029                 case "$n" in
2030                 '-n') n='' c='\c';;
2031                 *) n='-n' c='';;
2032                 esac
2033                 cat <<FOO
2034 They are not compatible!  You are probably running ksh on a non-USG system.
2035 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2036 have echo built in and we may have to run some Bourne shell scripts.  That
2037 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2038
2039 FOO
2040                 $echo $n "The star should be here-->$c"
2041                 $echo "*"
2042         fi
2043         $rm -f foo1 foo2
2044         ;;
2045 esac
2046
2047 : determine whether symbolic links are supported
2048 echo " "
2049 $touch blurfl
2050 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2051         echo "Symbolic links are supported." >&4
2052         lns="$ln -s"
2053 else
2054         echo "Symbolic links are NOT supported." >&4
2055         lns="$ln"
2056 fi
2057 $rm -f blurfl sym
2058
2059 : see whether [:lower:] and [:upper:] are supported character classes
2060 echo " "
2061 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2062 ABYZ)
2063         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2064         up='[:upper:]'
2065         low='[:lower:]'
2066         ;;
2067 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2068         # (0xc9 and 0xd1), therefore that is a nice testing point.
2069         if test "X$up" = X -o "X$low" = X; then
2070             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2071             ij) up='[A-Z]'
2072                 low='[a-z]'
2073                 ;;
2074             esac
2075         fi
2076         if test "X$up" = X -o "X$low" = X; then
2077             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2078             ij) up='A-Z'
2079                 low='a-z'
2080                 ;;
2081             esac
2082         fi
2083         if test "X$up" = X -o "X$low" = X; then
2084             case "`echo IJ | od -x 2>/dev/null`" in
2085             *C9D1*|*c9d1*)
2086                 echo "Hey, this might be EBCDIC." >&4
2087                 if test "X$up" = X -o "X$low" = X; then
2088                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2089                     ij) up='[A-IJ-RS-Z]'
2090                         low='[a-ij-rs-z]'
2091                         ;;
2092                     esac
2093                 fi
2094                 if test "X$up" = X -o "X$low" = X; then
2095                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2096                     ij) up='A-IJ-RS-Z'
2097                         low='a-ij-rs-z'
2098                         ;;
2099                     esac
2100                 fi
2101                 ;;
2102             esac
2103         fi
2104 esac
2105 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2106 ij)
2107     echo "Using $up and $low to convert case." >&4
2108     ;;
2109 *)
2110     echo "I don't know how to translate letters from upper to lower case." >&4
2111     echo "Your tr is not acting any way I know of." >&4
2112     exit 1
2113     ;;
2114 esac
2115 : set up the translation script tr, must be called with ./tr of course
2116 cat >tr <<EOSC
2117 $startsh
2118 case "\$1\$2" in
2119 '[A-Z][a-z]') exec $tr '$up' '$low';;
2120 '[a-z][A-Z]') exec $tr '$low' '$up';;
2121 esac
2122 exec $tr "\$@"
2123 EOSC
2124 chmod +x tr
2125 $eunicefix tr
2126
2127 : Try to determine whether config.sh was made on this system
2128 case "$config_sh" in
2129 '')
2130 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2131 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2132 # because the A-Z/a-z are not consecutive.
2133 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2134         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2135 newmyuname="$myuname"
2136 dflt=n
2137 case "$knowitall" in
2138 '')
2139         if test -f ../config.sh; then
2140                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2141                         eval "`grep myuname= ../config.sh`"
2142                 fi
2143                 if test "X$myuname" = "X$newmyuname"; then
2144                         dflt=y
2145                 fi
2146         fi
2147         ;;
2148 *) dflt=y;;
2149 esac
2150
2151 : Get old answers from old config file if Configure was run on the
2152 : same system, otherwise use the hints.
2153 hint=default
2154 cd ..
2155 if test -f config.sh; then
2156         echo " "
2157         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2158         . UU/myread
2159         case "$ans" in
2160         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2161         *)  echo "Fetching default answers from your old config.sh file..." >&4
2162                 tmp_n="$n"
2163                 tmp_c="$c"
2164                 tmp_sh="$sh"
2165                 . ./config.sh
2166                 cp config.sh UU
2167                 n="$tmp_n"
2168                 c="$tmp_c"
2169                 : Older versions did not always set $sh.  Catch re-use of such
2170                 : an old config.sh.
2171                 case "$sh" in
2172                 '') sh="$tmp_sh" ;;
2173                 esac
2174                 hint=previous
2175                 ;;
2176         esac
2177 fi
2178 if test ! -f config.sh; then
2179         $cat <<EOM
2180
2181 First time through, eh?  I have some defaults handy for some systems
2182 that need some extra help getting the Configure answers right:
2183
2184 EOM
2185         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2186         dflt=''
2187         : Half the following guesses are probably wrong... If you have better
2188         : tests or hints, please send them to perlbug@perl.com
2189         : The metaconfig authors would also appreciate a copy...
2190         $test -f /irix && osname=irix
2191         $test -f /xenix && osname=sco_xenix
2192         $test -f /dynix && osname=dynix
2193         $test -f /dnix && osname=dnix
2194         $test -f /lynx.os && osname=lynxos
2195         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2196         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2197         $test -f /bin/mips && /bin/mips && osname=mips
2198         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2199                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2200         $test -d /usr/apollo/bin && osname=apollo
2201         $test -f /etc/saf/_sactab && osname=svr4
2202         $test -d /usr/include/minix && osname=minix
2203         if $test -d /MachTen -o -d /MachTen_Folder; then
2204                 osname=machten
2205                 if $test -x /sbin/version; then
2206                         osvers=`/sbin/version | $awk '{print $2}' |
2207                         $sed -e 's/[A-Za-z]$//'`
2208                 elif $test -x /usr/etc/version; then
2209                         osvers=`/usr/etc/version | $awk '{print $2}' |
2210                         $sed -e 's/[A-Za-z]$//'`
2211                 else
2212                         osvers="$2.$3"
2213                 fi
2214         fi
2215
2216         $test -f /sys/posix.dll &&
2217                 $test -f /usr/bin/what &&
2218                 set X `/usr/bin/what /sys/posix.dll` &&
2219                 $test "$3" = UWIN &&
2220                 osname=uwin &&
2221                 osvers="$5"
2222
2223         if $test -f $uname; then
2224                 set X $myuname
2225                 shift
2226
2227                 case "$5" in
2228                 fps*) osname=fps ;;
2229                 mips*)
2230                         case "$4" in
2231                         umips) osname=umips ;;
2232                         *) osname=mips ;;
2233                         esac;;
2234                 [23]100) osname=mips ;;
2235                 next*) osname=next ;;
2236                 i386*)
2237                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2238                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2239                                 osname='sco'
2240                                 osvers=$tmp
2241                         elif $test -f /etc/kconfig; then
2242                                 osname=isc
2243                                 if test "$lns" = "$ln -s"; then
2244                                         osvers=4
2245                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2246                                         osvers=3
2247                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2248                                         osvers=2
2249                                 fi
2250                         fi
2251                         tmp=''
2252                         ;;
2253                 pc*)
2254                         if test -n "$DJGPP"; then
2255                                 osname=dos
2256                                 osvers=djgpp
2257                         fi
2258                         ;;
2259                 esac
2260
2261                 case "$1" in
2262                 aix) osname=aix
2263                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2264                         case "$tmp" in
2265                         'not found') osvers="$4"."$3" ;;
2266                         '<3240'|'<>3240') osvers=3.2.0 ;;
2267                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2268                         '=3250'|'>3250') osvers=3.2.5 ;;
2269                         *) osvers=$tmp;;
2270                         esac
2271                         ;;
2272                 bsd386) osname=bsd386
2273                         osvers=`$uname -r`
2274                         ;;
2275                 cygwin*) osname=cygwin
2276                         osvers="$3"
2277                         ;;
2278                 *dc.osx) osname=dcosx
2279                         osvers="$3"
2280                         ;;
2281                 dnix) osname=dnix
2282                         osvers="$3"
2283                         ;;
2284                 domainos) osname=apollo
2285                         osvers="$3"
2286                         ;;
2287                 dgux) osname=dgux 
2288                         osvers="$3"
2289                         ;;
2290                 dynixptx*) osname=dynixptx
2291                         osvers=`echo "$4"|sed 's/^v//'`
2292                         ;;
2293                 freebsd) osname=freebsd 
2294                         osvers="$3" ;;
2295                 genix) osname=genix ;;
2296                 hp*) osname=hpux 
2297                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2298                         ;;
2299                 irix*) osname=irix
2300                         case "$3" in
2301                         4*) osvers=4 ;;
2302                         5*) osvers=5 ;;
2303                         *)      osvers="$3" ;;
2304                         esac
2305                         ;;
2306                 linux) osname=linux
2307                         case "$3" in
2308                         *)      osvers="$3" ;;
2309                         esac
2310                         ;;
2311                 MiNT) osname=mint
2312                         ;;
2313                 netbsd*) osname=netbsd
2314                         osvers="$3"
2315                         ;;
2316                 news-os) osvers="$3"
2317                         case "$3" in
2318                         4*) osname=newsos4 ;;
2319                         *) osname=newsos ;;
2320                         esac
2321                         ;;
2322                 next*) osname=next ;;
2323                 POSIX-BC | posix-bc ) osname=posix-bc
2324                         osvers="$3"
2325                         ;;
2326                 powerux | power_ux | powermax_os | powermaxos | \
2327                 powerunix | power_unix) osname=powerux
2328                         osvers="$3"
2329                         ;;
2330                 qnx) osname=qnx
2331                         osvers="$4"
2332                         ;;
2333                 solaris) osname=solaris
2334                         case "$3" in
2335                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2336                         *)      osvers="$3" ;;
2337                         esac
2338                         ;;
2339                 sunos) osname=sunos
2340                         case "$3" in
2341                         5*) osname=solaris
2342                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2343                         *)      osvers="$3" ;;
2344                         esac
2345                         ;;
2346                 titanos) osname=titanos
2347                         case "$3" in
2348                         1*) osvers=1 ;;
2349                         2*) osvers=2 ;;
2350                         3*) osvers=3 ;;
2351                         4*) osvers=4 ;;
2352                         *)      osvers="$3" ;;
2353                         esac
2354                         ;;
2355                 ultrix) osname=ultrix
2356                         osvers="$3"
2357                         ;;
2358                 osf1|mls+)      case "$5" in
2359                                 alpha)
2360                                         osname=dec_osf
2361                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2362                                         ;;
2363                         hp*)    osname=hp_osf1  ;;
2364                         mips)   osname=mips_osf1 ;;
2365                         esac
2366                         ;;
2367                 unixware) osname=svr5
2368                         osvers="$4"
2369                         ;;
2370                 uts) osname=uts
2371                         osvers="$3"
2372                         ;;
2373                 $2) case "$osname" in
2374                         *isc*) ;;
2375                         *freebsd*) ;;
2376                         svr*)
2377                                 : svr4.x or possibly later
2378                                 case "svr$3" in 
2379                                 ${osname}*)
2380                                         osname=svr$3
2381                                         osvers=$4
2382                                         ;;
2383                                 esac
2384                                 case "$osname" in
2385                                 svr4.0)
2386                                         : Check for ESIX
2387                                         if test -f /stand/boot ; then
2388                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2389                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2390                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2391                                                         if test -n "$isesix"; then
2392                                                                 osname=esix4
2393                                                         fi
2394                                                 fi
2395                                         fi
2396                                         ;;
2397                                 esac
2398                                 ;;
2399                         *)      if test -f /etc/systemid; then
2400                                         osname=sco
2401                                         set `echo $3 | $sed 's/\./ /g'` $4
2402                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2403                                                 osvers=$1.$2.$3
2404                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2405                                                 osvers=$1.$2
2406                                         elif $test -f $src/hints/sco_$1.sh; then
2407                                                 osvers=$1
2408                                         fi
2409                                 else
2410                                         case "$osname" in
2411                                         '') : Still unknown.  Probably a generic Sys V.
2412                                                 osname="sysv"
2413                                                 osvers="$3"
2414                                                 ;;
2415                                         esac
2416                                 fi
2417                                 ;;
2418                         esac
2419                         ;;
2420                 *)      case "$osname" in
2421                         '') : Still unknown.  Probably a generic BSD.
2422                                 osname="$1"
2423                                 osvers="$3"
2424                                 ;;
2425                         esac
2426                         ;;
2427                 esac
2428         else
2429                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2430                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2431                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2432                                 osname=news_os
2433                         fi
2434                         $rm -f UU/kernel.what
2435                 elif test -d c:/.; then
2436                         set X $myuname
2437                         osname=os2
2438                         osvers="$5"
2439                 fi
2440         fi
2441         
2442         : Now look for a hint file osname_osvers, unless one has been
2443         : specified already.
2444         case "$hintfile" in
2445         ''|' ')
2446                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2447                 : Also try without trailing minor version numbers.
2448                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2449                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2450                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2451                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2452                 case "$file" in
2453                 '') dflt=none ;;
2454                 *)  case "$osvers" in
2455                         '') dflt=$file
2456                                 ;;
2457                         *)  if $test -f $src/hints/$file.sh ; then
2458                                         dflt=$file
2459                                 elif $test -f $src/hints/$xfile.sh ; then
2460                                         dflt=$xfile
2461                                 elif $test -f $src/hints/$xxfile.sh ; then
2462                                         dflt=$xxfile
2463                                 elif $test -f $src/hints/$xxxfile.sh ; then
2464                                         dflt=$xxxfile
2465                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2466                                         dflt=$xxxxfile
2467                                 elif $test -f "$src/hints/${osname}.sh" ; then
2468                                         dflt="${osname}"
2469                                 else
2470                                         dflt=none
2471                                 fi
2472                                 ;;
2473                         esac
2474                         ;;
2475                 esac
2476                 if $test -f Policy.sh ; then
2477                         case "$dflt" in
2478                         *Policy*) ;;
2479                         none) dflt="Policy" ;;
2480                         *) dflt="Policy $dflt" ;;
2481                         esac
2482                 fi
2483                 ;;
2484         *)
2485                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2486                 ;;
2487         esac
2488
2489         if $test -f Policy.sh ; then
2490                 $cat <<EOM
2491
2492 There's also a Policy hint file available, which should make the
2493 site-specific (policy) questions easier to answer.
2494 EOM
2495
2496         fi
2497
2498         $cat <<EOM
2499
2500 You may give one or more space-separated answers, or "none" if appropriate.
2501 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2502 is a good thing.  DO NOT give a wrong version or a wrong OS.
2503
2504 EOM
2505
2506         rp="Which of these apply, if any?"
2507         . UU/myread
2508         tans=$ans
2509         for file in $tans; do
2510                 if $test X$file = XPolicy -a -f Policy.sh; then
2511                         . Policy.sh
2512                         $cat Policy.sh >> UU/config.sh
2513                 elif $test -f $src/hints/$file.sh; then
2514                         . $src/hints/$file.sh
2515                         $cat $src/hints/$file.sh >> UU/config.sh
2516                 elif $test X$tans = X -o X$tans = Xnone ; then
2517                         : nothing
2518                 else
2519                         : Give one chance to correct a possible typo.
2520                         echo "$file.sh does not exist"
2521                         dflt=$file
2522                         rp="hint to use instead?"
2523                         . UU/myread
2524                         for file in $ans; do
2525                                 if $test -f "$src/hints/$file.sh"; then
2526                                         . $src/hints/$file.sh
2527                                         $cat $src/hints/$file.sh >> UU/config.sh
2528                                 elif $test X$ans = X -o X$ans = Xnone ; then
2529                                         : nothing
2530                                 else
2531                                         echo "$file.sh does not exist -- ignored."
2532                                 fi
2533                         done
2534                 fi
2535         done
2536
2537         hint=recommended
2538         : Remember our hint file for later.
2539         if $test -f "$src/hints/$file.sh" ; then
2540                 hintfile="$file"
2541         else
2542                 hintfile=''
2543         fi
2544 fi
2545 cd UU
2546 ;;
2547 *)
2548         echo " "
2549         echo "Fetching default answers from $config_sh..." >&4
2550         tmp_n="$n"
2551         tmp_c="$c"
2552         cd ..
2553         cp $config_sh config.sh 2>/dev/null
2554         chmod +w config.sh
2555         . ./config.sh
2556         cd UU
2557         cp ../config.sh .
2558         n="$tmp_n"
2559         c="$tmp_c"
2560         hint=previous
2561         ;;
2562 esac
2563 test "$override" && . ./optdef.sh
2564 myuname="$newmyuname"
2565
2566 : Restore computed paths
2567 for file in $loclist $trylist; do
2568         eval $file="\$_$file"
2569 done
2570
2571 cat << EOM
2572
2573 Configure uses the operating system name and version to set some defaults.
2574 The default value is probably right if the name rings a bell. Otherwise,
2575 since spelling matters for me, either accept the default or answer "none"
2576 to leave it blank.
2577
2578 EOM
2579 case "$osname" in
2580         ''|' ')
2581                 case "$hintfile" in
2582                 ''|' '|none) dflt=none ;;
2583                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2584                 esac
2585                 ;;
2586         *) dflt="$osname" ;;
2587 esac
2588 rp="Operating system name?"
2589 . ./myread
2590 case "$ans" in
2591 none)  osname='' ;;
2592 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2593 esac
2594 echo " "
2595 case "$osvers" in
2596         ''|' ')
2597                 case "$hintfile" in
2598                 ''|' '|none) dflt=none ;;
2599                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2600                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2601                         case "$dflt" in
2602                         ''|' ') dflt=none ;;
2603                         esac
2604                         ;;
2605                 esac
2606                 ;;
2607         *) dflt="$osvers" ;;
2608 esac
2609 rp="Operating system version?"
2610 . ./myread
2611 case "$ans" in
2612 none)  osvers='' ;;
2613 *) osvers="$ans" ;;
2614 esac
2615
2616
2617 . ./posthint.sh
2618
2619 : who configured the system
2620 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2621 cf_by=`(logname) 2>/dev/null`
2622 case "$cf_by" in
2623 "")
2624         cf_by=`(whoami) 2>/dev/null`
2625         case "$cf_by" in
2626         "") cf_by=unknown ;;
2627         esac ;;
2628 esac
2629
2630 : set up the script used to warn in case of inconsistency
2631 cat <<EOS >whoa
2632 $startsh
2633 EOS
2634 cat <<'EOSC' >>whoa
2635 dflt=y
2636 echo " "
2637 echo "*** WHOA THERE!!! ***" >&4
2638 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2639 rp="    Keep the $hint value?"
2640 . ./myread
2641 case "$ans" in
2642 y) td=$was; tu=$was;;
2643 esac
2644 EOSC
2645
2646 : function used to set $1 to $val
2647 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2648 case "$val$was" in
2649 $define$undef) . ./whoa; eval "$var=\$td";;
2650 $undef$define) . ./whoa; eval "$var=\$tu";;
2651 *) eval "$var=$val";;
2652 esac'
2653
2654 cat <<EOM
2655
2656 Perl can be built to take advantage of threads, on some systems.
2657 To do so, Configure must be run with -Dusethreads.
2658
2659 Note that threading is a highly experimental feature, and
2660 some known race conditions still remain.  If you choose to try
2661 it, be very sure to not actually deploy it for production
2662 purposes.  README.threads has more details, and is required
2663 reading if you enable threads.
2664 EOM
2665 case "$usethreads" in
2666 $define|true|[yY]*)     dflt='y';;
2667 *) dflt='n';;
2668 esac
2669 rp='Build a threading Perl?'
2670 . ./myread
2671 case "$ans" in
2672 y|Y)    val="$define" ;;
2673 *)      val="$undef" ;;
2674 esac
2675 set usethreads
2676 eval $setvar
2677
2678 case "$usethreads" in
2679 $define)
2680         $cat <<EOM
2681
2682 As of 5.5.640, Perl has two different internal threading implementations,
2683 the 5.005 version (5005threads) and an interpreter-based version
2684 (ithreads) that has one interpreter per thread.  Both are very 
2685 experimental.  This arrangement exists to help developers work out
2686 which one is better.
2687 EOM
2688         : Default to ithreads unless overridden on command line or with
2689         : old config.sh
2690         dflt='y'
2691         case "$use5005threads" in
2692                 $define|true|[yY]*) dflt='n';;
2693         esac
2694         case "$useithreads" in
2695                 $undef|false|[nN]*) dflt='n';;
2696         esac
2697         rp='Use interpreter-based ithreads?'
2698         . ./myread
2699         case "$ans" in
2700         y|Y)    val="$define" ;;
2701         *)      val="$undef" ;;
2702         esac
2703         set useithreads
2704         eval $setvar
2705         : Now set use5005threads to the opposite value.
2706         case "$useithreads" in
2707         $define) val="$undef" ;;
2708         *) val="$define" ;;
2709         esac
2710         set use5005threads
2711         eval $setvar
2712         ;;
2713 *)
2714         useithreads="$undef"
2715         use5005threads="$undef"
2716         ;;
2717 esac
2718
2719 case "$d_oldpthreads" in
2720 '')     : Configure tests would be welcome here.  For now, assume undef.
2721         val="$undef" ;;
2722 *)      val="$d_oldpthreads" ;;
2723 esac
2724 set d_oldpthreads
2725 eval $setvar
2726
2727
2728 case "$usethreads" in
2729 "$define"|true|[yY]*)
2730 : Look for a hint-file generated 'call-back-unit'.  If the
2731 : user has specified that a threading perl is to be built,
2732 : we may need to set or change some other defaults.
2733         if $test -f usethreads.cbu; then
2734                 echo "Your platform has some specific hints for threaded builds, using them..."
2735                 . ./usethreads.cbu
2736         else
2737                 $cat <<EOM
2738 (Your platform doesn't have any specific hints for threaded builds.
2739  Assuming POSIX threads, then.)
2740 EOM
2741         fi
2742         ;;
2743 esac
2744
2745 cat <<EOM
2746
2747 Perl can be built so that multiple Perl interpreters can coexist
2748 within the same Perl executable.
2749 EOM
2750
2751 case "$useithreads" in
2752 $define)
2753         cat <<EOM
2754 This multiple interpreter support is required for interpreter-based threads.
2755 EOM
2756         val="$define"
2757         ;;
2758 *)
2759         echo 'Normally you do not need this and you should answer no.'
2760         case "$usemultiplicity" in
2761         $define|true|[yY]*)     dflt='y';;
2762         *) dflt='n';;
2763         esac
2764         rp='Build Perl for multiplicity?'
2765         . ./myread
2766         case "$ans" in
2767         y|Y)    val="$define" ;;
2768         *)      val="$undef" ;;
2769         esac
2770         ;;
2771 esac
2772 set usemultiplicity
2773 eval $setvar
2774
2775 : determine where manual pages are on this system
2776 echo " "
2777 case "$sysman" in
2778 '') 
2779         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2780         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2781         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2782         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2783         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2784         sysman=`./loc . /usr/man/man1 $syspath`
2785         ;;
2786 esac
2787 if $test -d "$sysman"; then
2788         echo "System manual is in $sysman." >&4
2789 else
2790         echo "Could not find manual pages in source form." >&4
2791 fi
2792
2793 : see what memory models we can support
2794 case "$models" in
2795 '')
2796         $cat >pdp11.c <<'EOP'
2797 int main() {
2798 #ifdef pdp11
2799         exit(0);
2800 #else
2801         exit(1);
2802 #endif
2803 }
2804 EOP
2805         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2806         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2807                 dflt='unsplit split'
2808         else
2809                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2810                 case "$tans" in
2811                 X) dflt='none';;
2812                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2813                                 dflt='small'
2814                         else
2815                                 dflt=''
2816                         fi
2817                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2818                                 dflt="$dflt medium"
2819                         fi
2820                         if $test -d /lib/large || $test -d /usr/lib/large; then
2821                                 dflt="$dflt large"
2822                         fi
2823                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2824                                 dflt="$dflt huge"
2825                         fi
2826                 esac
2827         fi;;
2828 *) dflt="$models";;
2829 esac
2830 $cat <<EOM
2831  
2832 Some systems have different model sizes.  On most systems they are called
2833 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2834 split.  If your system doesn't support different memory models, say "none".
2835 If you wish to force everything to one memory model, say "none" here and
2836 put the appropriate flags later when it asks you for other cc and ld flags.
2837 Venix systems may wish to put "none" and let the compiler figure things out.
2838 (In the following question multiple model names should be space separated.)
2839
2840 The default for most systems is "none".
2841
2842 EOM
2843 rp="Which memory models are supported?"
2844 . ./myread
2845 models="$ans"
2846
2847 case "$models" in
2848 none)
2849         small=''
2850         medium=''
2851         large=''
2852         huge=''
2853         unsplit=''
2854         split=''
2855         ;;
2856 *split)
2857         case "$split" in
2858         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2859                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2860                         dflt='-i'
2861                 else
2862                         dflt='none'
2863                 fi;;
2864         *) dflt="$split";;
2865         esac
2866         rp="What flag indicates separate I and D space?"
2867         . ./myread
2868         tans="$ans"
2869         case "$tans" in
2870         none) tans='';;
2871         esac
2872         split="$tans"
2873         unsplit='';;
2874 *large*|*small*|*medium*|*huge*)
2875         case "$models" in
2876         *large*)
2877                 case "$large" in
2878                 '') dflt='-Ml';;
2879                 *) dflt="$large";;
2880                 esac
2881         rp="What flag indicates large model?"
2882         . ./myread
2883         tans="$ans"
2884         case "$tans" in
2885         none) tans='';
2886         esac
2887         large="$tans";;
2888         *) large='';;
2889         esac
2890         case "$models" in
2891         *huge*) case "$huge" in
2892                 '') dflt='-Mh';;
2893                 *) dflt="$huge";;
2894                 esac
2895                 rp="What flag indicates huge model?"
2896                 . ./myread
2897                 tans="$ans"
2898                 case "$tans" in
2899                 none) tans='';
2900                 esac
2901                 huge="$tans";;
2902         *) huge="$large";;
2903         esac
2904         case "$models" in
2905         *medium*) case "$medium" in
2906                 '') dflt='-Mm';;
2907                 *) dflt="$medium";;
2908                 esac
2909                 rp="What flag indicates medium model?"
2910                 . ./myread
2911                 tans="$ans"
2912                 case "$tans" in
2913                 none) tans='';
2914                 esac
2915                 medium="$tans";;
2916         *) medium="$large";;
2917         esac
2918         case "$models" in
2919         *small*) case "$small" in
2920                 '') dflt='none';;
2921                 *) dflt="$small";;
2922                 esac
2923                 rp="What flag indicates small model?"
2924                 . ./myread
2925                 tans="$ans"
2926                 case "$tans" in
2927                 none) tans='';
2928                 esac
2929                 small="$tans";;
2930         *) small='';;
2931         esac
2932         ;;
2933 *)
2934         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2935         ;;
2936 esac
2937 $rm -f pdp11.* pdp11
2938
2939 : make some quick guesses about what we are up against
2940 echo " "
2941 $echo $n "Hmm...  $c"
2942 echo exit 1 >bsd
2943 echo exit 1 >usg
2944 echo exit 1 >v7
2945 echo exit 1 >osf1
2946 echo exit 1 >eunice
2947 echo exit 1 >xenix
2948 echo exit 1 >venix
2949 echo exit 1 >os2
2950 d_bsd="$undef"
2951 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2952 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2953 then
2954         echo "Looks kind of like an OSF/1 system, but we'll see..."
2955         echo exit 0 >osf1
2956 elif test `echo abc | tr a-z A-Z` = Abc ; then
2957         xxx=`./loc addbib blurfl $pth`
2958         if $test -f $xxx; then
2959         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2960                 echo exit 0 >bsd
2961                 echo exit 0 >usg
2962         else
2963                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2964                         echo "Looks kind of like an extended USG system, but we'll see..."
2965                 else
2966                         echo "Looks kind of like a USG system, but we'll see..."
2967                 fi
2968                 echo exit 0 >usg
2969         fi
2970 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2971         echo "Looks kind of like a BSD system, but we'll see..."
2972         d_bsd="$define"
2973         echo exit 0 >bsd
2974 else
2975         echo "Looks kind of like a Version 7 system, but we'll see..."
2976         echo exit 0 >v7
2977 fi
2978 case "$eunicefix" in
2979 *unixtovms*)
2980         $cat <<'EOI'
2981 There is, however, a strange, musty smell in the air that reminds me of
2982 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2983 EOI
2984         echo exit 0 >eunice
2985         d_eunice="$define"
2986 : it so happens the Eunice I know will not run shell scripts in Unix format
2987         ;;
2988 *)
2989         echo " "
2990         echo "Congratulations.  You aren't running Eunice."
2991         d_eunice="$undef"
2992         ;;
2993 esac
2994 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2995 case "$p_" in
2996 :) ;;
2997 *)
2998         $cat <<'EOI'
2999 I have the feeling something is not exactly right, however...don't tell me...
3000 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3001 EOI
3002         echo exit 0 >os2
3003         ;;
3004 esac
3005 if test -f /xenix; then
3006         echo "Actually, this looks more like a XENIX system..."
3007         echo exit 0 >xenix
3008         d_xenix="$define"
3009 else
3010         echo " "
3011         echo "It's not Xenix..."
3012         d_xenix="$undef"
3013 fi
3014 chmod +x xenix
3015 $eunicefix xenix
3016 if test -f /venix; then
3017         echo "Actually, this looks more like a VENIX system..."
3018         echo exit 0 >venix
3019 else
3020         echo " "
3021         if ./xenix; then
3022                 : null
3023         else
3024                 echo "Nor is it Venix..."
3025         fi
3026 fi
3027 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3028 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3029 $rm -f foo
3030
3031 : see if we need a special compiler
3032 echo " "
3033 if ./usg; then
3034         case "$cc" in
3035         '') case "$Mcc" in
3036                 /*) dflt='Mcc';;
3037                 *) case "$large" in
3038                         -M*) dflt='cc';;
3039                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3040                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3041                                                 dflt='cc'
3042                                         else
3043                                                 dflt='cc -M'
3044                                         fi
3045                                 else
3046                                         dflt='cc'
3047                                 fi;;
3048                         esac;;
3049                 esac;;
3050         *)  dflt="$cc";;
3051         esac
3052         case "$dflt" in
3053         *M*)    $cat <<'EOM'
3054 On some older systems the default C compiler will not resolve multiple global
3055 references that happen to have the same name.  On some such systems the "Mcc"
3056 command may be used to force these to be resolved.  On other systems a "cc -M"
3057 command is required.  (Note that the -M flag on other systems indicates a
3058 memory model to use!) If you have the Gnu C compiler, you might wish to use
3059 that instead.
3060
3061 EOM
3062         ;;
3063         esac
3064         rp="Use which C compiler?"
3065         . ./myread
3066         cc="$ans"
3067 else
3068         case "$cc" in
3069         '') dflt=cc;;
3070         *) dflt="$cc";;
3071         esac
3072         rp="Use which C compiler?"
3073         . ./myread
3074         cc="$ans"
3075 fi
3076 : Look for a hint-file generated 'call-back-unit'.  Now that the
3077 : user has specified the compiler, we may need to set or change some
3078 : other defaults.
3079 if $test -f cc.cbu; then
3080     . ./cc.cbu
3081 fi
3082 echo " "
3083 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3084 $cat >gccvers.c <<EOM
3085 #include <stdio.h>
3086 int main() {
3087 #ifdef __GNUC__
3088 #ifdef __VERSION__
3089         printf("%s\n", __VERSION__);
3090 #else
3091         printf("%s\n", "1");
3092 #endif
3093 #endif
3094         exit(0);
3095 }
3096 EOM
3097 if $cc -o gccvers gccvers.c; then
3098         gccversion=`./gccvers`
3099         case "$gccversion" in
3100         '') echo "You are not using GNU cc." ;;
3101         *)  echo "You are using GNU cc $gccversion." ;;
3102         esac
3103 else
3104         echo " "
3105         echo "*** WHOA THERE!!! ***" >&4
3106         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3107         case "$knowitall" in
3108         '')
3109         echo "    You'd better start hunting for one and let me know about it." >&4
3110                 exit 1
3111                 ;;
3112         esac
3113 fi
3114 $rm -f gccvers*
3115 case "$gccversion" in
3116 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3117 esac
3118
3119 : see how we invoke the C preprocessor
3120 echo " "
3121 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3122 cat <<'EOT' >testcpp.c
3123 #define ABC abc
3124 #define XYZ xyz
3125 ABC.XYZ
3126 EOT
3127 cd ..
3128 if test ! -f cppstdin; then
3129         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3130                 # AIX cc -E doesn't show the absolute headerfile
3131                 # locations but we'll cheat by using the -M flag.
3132                 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
3133         else
3134                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3135         fi
3136 else
3137         echo "Keeping your $hint cppstdin wrapper."
3138 fi
3139 chmod 755 cppstdin
3140 wrapper=`pwd`/cppstdin
3141 ok='false'
3142 cd UU
3143
3144 if $test "X$cppstdin" != "X" && \
3145         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3146         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3147 then
3148         echo "You used to use $cppstdin $cppminus so we'll use that again."
3149         case "$cpprun" in
3150         '') echo "But let's see if we can live without a wrapper..." ;;
3151         *)
3152                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3153                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3154                 then
3155                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3156                         ok='true'
3157                 else
3158                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3159                 fi
3160                 ;;
3161         esac
3162 else
3163         case "$cppstdin" in
3164         '') ;;
3165         *)
3166                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3167                 ;;
3168         esac
3169 fi
3170
3171 if $ok; then
3172         : nothing
3173 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3174         $cc -E <testcpp.c >testcpp.out 2>&1; \
3175         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3176         echo "Yup, it does."
3177         x_cpp="$cc -E"
3178         x_minus='';
3179 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3180         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3181         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3182         echo "Yup, it does."
3183         x_cpp="$cc -E"
3184         x_minus='-';
3185 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3186         $cc -P <testcpp.c >testcpp.out 2>&1; \
3187         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3188         echo "Yipee, that works!"
3189         x_cpp="$cc -P"
3190         x_minus='';
3191 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3192         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3193         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3194         echo "At long last!"
3195         x_cpp="$cc -P"
3196         x_minus='-';
3197 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3198         $cpp <testcpp.c >testcpp.out 2>&1; \
3199         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3200         echo "It works!"
3201         x_cpp="$cpp"
3202         x_minus='';
3203 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3204         $cpp - <testcpp.c >testcpp.out 2>&1; \
3205         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3206         echo "Hooray, it works!  I was beginning to wonder."
3207         x_cpp="$cpp"
3208         x_minus='-';
3209 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3210         $wrapper <testcpp.c >testcpp.out 2>&1; \
3211         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3212         x_cpp="$wrapper"
3213         x_minus=''
3214         echo "Eureka!"
3215 else
3216         dflt=''
3217         rp="No dice.  I can't find a C preprocessor.  Name one:"
3218         . ./myread
3219         x_cpp="$ans"
3220         x_minus=''
3221         $x_cpp <testcpp.c >testcpp.out 2>&1
3222         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3223                 echo "OK, that will do." >&4
3224         else
3225 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3226                 exit 1
3227         fi
3228 fi
3229
3230 case "$ok" in
3231 false)
3232         cppstdin="$x_cpp"
3233         cppminus="$x_minus"
3234         cpprun="$x_cpp"
3235         cpplast="$x_minus"
3236         set X $x_cpp
3237         shift
3238         case "$1" in
3239         "$cpp")
3240                 echo "Perhaps can we force $cc -E using a wrapper..."
3241                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3242                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3243                 then
3244                         echo "Yup, we can."
3245                         cppstdin="$wrapper"
3246                         cppminus='';
3247                 else
3248                         echo "Nope, we'll have to live without it..."
3249                 fi
3250                 ;;
3251         esac
3252         case "$cpprun" in
3253         "$wrapper")
3254                 cpprun=''
3255                 cpplast=''
3256                 ;;
3257         esac
3258         ;;
3259 esac
3260
3261 case "$cppstdin" in
3262 "$wrapper"|'cppstdin') ;;
3263 *) $rm -f $wrapper;;
3264 esac
3265 $rm -f testcpp.c testcpp.out
3266
3267 : decide how portable to be.  Allow command line overrides.
3268 case "$d_portable" in
3269 "$undef") ;;
3270 *)      d_portable="$define" ;;
3271 esac
3272
3273 : set up shell script to do ~ expansion
3274 cat >filexp <<EOSS
3275 $startsh
3276 : expand filename
3277 case "\$1" in
3278  ~/*|~)
3279         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3280         ;;
3281  ~*)
3282         if $test -f /bin/csh; then
3283                 /bin/csh -f -c "glob \$1"
3284                 failed=\$?
3285                 echo ""
3286                 exit \$failed
3287         else
3288                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3289                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3290                 if $test ! -d "\$dir"; then
3291                         me=\`basename \$0\`
3292                         echo "\$me: can't locate home directory for: \$name" >&2
3293                         exit 1
3294                 fi
3295                 case "\$1" in
3296                 */*)
3297                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3298                         ;;
3299                 *)
3300                         echo \$dir
3301                         ;;
3302                 esac
3303         fi
3304         ;;
3305 *)
3306         echo \$1
3307         ;;
3308 esac
3309 EOSS
3310 chmod +x filexp
3311 $eunicefix filexp
3312
3313 : now set up to get a file name
3314 cat <<EOS >getfile
3315 $startsh
3316 EOS
3317 cat <<'EOSC' >>getfile
3318 tilde=''
3319 fullpath=''
3320 already=''
3321 skip=''
3322 none_ok=''
3323 exp_file=''
3324 nopath_ok=''
3325 orig_rp="$rp"
3326 orig_dflt="$dflt"
3327 case "$gfpth" in
3328 '') gfpth='.' ;;
3329 esac
3330
3331 case "$fn" in
3332 *\(*)
3333         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3334         fn=`echo $fn | sed 's/(.*)//'`
3335         ;;
3336 esac
3337
3338 case "$fn" in
3339 *:*)
3340         loc_file=`expr $fn : '.*:\(.*\)'`
3341         fn=`expr $fn : '\(.*\):.*'`
3342         ;;
3343 esac
3344
3345 case "$fn" in
3346 *~*) tilde=true;;
3347 esac
3348 case "$fn" in
3349 */*) fullpath=true;;
3350 esac
3351 case "$fn" in
3352 *+*) skip=true;;
3353 esac
3354 case "$fn" in
3355 *n*) none_ok=true;;
3356 esac
3357 case "$fn" in
3358 *e*) exp_file=true;;
3359 esac
3360 case "$fn" in
3361 *p*) nopath_ok=true;;
3362 esac
3363
3364 case "$fn" in
3365 *f*) type='File';;
3366 *d*) type='Directory';;
3367 *l*) type='Locate';;
3368 esac
3369
3370 what="$type"
3371 case "$what" in
3372 Locate) what='File';;
3373 esac
3374
3375 case "$exp_file" in
3376 '')
3377         case "$d_portable" in
3378         "$define") ;;
3379         *) exp_file=true;;
3380         esac
3381         ;;
3382 esac
3383
3384 cd ..
3385 while test "$type"; do
3386         redo=''
3387         rp="$orig_rp"
3388         dflt="$orig_dflt"
3389         case "$tilde" in
3390         true) rp="$rp (~name ok)";;
3391         esac
3392         . UU/myread
3393         if test -f UU/getfile.ok && \
3394                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3395         then
3396                 value="$ans"
3397                 ansexp="$ans"
3398                 break
3399         fi
3400         case "$ans" in
3401         none)
3402                 value=''
3403                 ansexp=''
3404                 case "$none_ok" in
3405                 true) type='';;
3406                 esac
3407                 ;;
3408         *)
3409                 case "$tilde" in
3410                 '') value="$ans"
3411                         ansexp="$ans";;
3412                 *)
3413                         value=`UU/filexp $ans`
3414                         case $? in
3415                         0)
3416                                 if test "$ans" != "$value"; then
3417                                         echo "(That expands to $value on this system.)"
3418                                 fi
3419                                 ;;
3420                         *) value="$ans";;
3421                         esac
3422                         ansexp="$value"
3423                         case "$exp_file" in
3424                         '') value="$ans";;
3425                         esac
3426                         ;;
3427                 esac
3428                 case "$fullpath" in
3429                 true)
3430                         case "$ansexp" in
3431                         /*) value="$ansexp" ;;
3432                         *)
3433                                 redo=true
3434                                 case "$already" in
3435                                 true)
3436                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3437                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3438                                         ;;
3439                                 *)
3440                                 echo "Please give a full path name, starting with slash." >&4
3441                                         case "$tilde" in
3442                                         true)
3443                                 echo "Note that using ~name is ok provided it expands well." >&4
3444                                                 already=true
3445                                                 ;;
3446                                         esac
3447                                 esac
3448                                 ;;
3449                         esac
3450                         ;;
3451                 esac
3452                 case "$redo" in
3453                 '')
3454                         case "$type" in
3455                         File)
3456                                 for fp in $gfpth; do
3457                                         if test "X$fp" = X.; then
3458                                             pf="$ansexp"
3459                                         else    
3460                                             pf="$fp/$ansexp"
3461                                         fi
3462                                         if test -f "$pf"; then
3463                                                 type=''
3464                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3465                                         then
3466                                                 echo "($value is not a plain file, but that's ok.)"
3467                                                 type=''
3468                                         fi
3469                                         if test X"$type" = X; then
3470                                             value="$pf"
3471                                             break
3472                                         fi
3473                                 done
3474                                 ;;
3475                         Directory)
3476                                 for fp in $gfpth; do
3477                                         if test "X$fp" = X.; then
3478                                             pf="$ansexp"
3479                                         else    
3480                                             pf="$fp/$ansexp"
3481                                         fi
3482                                         if test -d "$pf"; then
3483                                                 type=''
3484                                                 value="$pf"
3485                                                 break
3486                                         fi
3487                                 done
3488                                 ;;
3489                         Locate)
3490                                 if test -d "$ansexp"; then
3491                                         echo "(Looking for $loc_file in directory $value.)"
3492                                         value="$value/$loc_file"
3493                                         ansexp="$ansexp/$loc_file"
3494                                 fi
3495                                 if test -f "$ansexp"; then
3496                                         type=''
3497                                 fi
3498                                 case "$nopath_ok" in
3499                                 true)   case "$value" in
3500                                         */*) ;;
3501                                         *)      echo "Assuming $value will be in people's path."
3502                                                 type=''
3503                                                 ;;
3504                                         esac
3505                                         ;;
3506                                 esac
3507                                 ;;
3508                         esac
3509
3510                         case "$skip" in
3511                         true) type='';
3512                         esac
3513
3514                         case "$type" in
3515                         '') ;;
3516                         *)
3517                                 if test "$fastread" = yes; then
3518                                         dflt=y
3519                                 else
3520                                         dflt=n
3521                                 fi
3522                                 rp="$what $value doesn't exist.  Use that name anyway?"
3523                                 . UU/myread
3524                                 dflt=''
3525                                 case "$ans" in
3526                                 y*) type='';;
3527                                 *) echo " ";;
3528                                 esac
3529                                 ;;
3530                         esac
3531                         ;;
3532                 esac
3533                 ;;
3534         esac
3535 done
3536 cd UU
3537 ans="$value"
3538 rp="$orig_rp"
3539 dflt="$orig_dflt"
3540 rm -f getfile.ok
3541 test "X$gfpthkeep" != Xy && gfpth=""
3542 EOSC
3543
3544 : What should the include directory be ?
3545 echo " "
3546 $echo $n "Hmm...  $c"
3547 dflt='/usr/include'
3548 incpath=''
3549 mips_type=''
3550 if $test -f /bin/mips && /bin/mips; then
3551         echo "Looks like a MIPS system..."
3552         $cat >usr.c <<'EOCP'
3553 #ifdef SYSTYPE_BSD43
3554 /bsd43
3555 #endif
3556 EOCP
3557         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3558                 dflt='/bsd43/usr/include'
3559                 incpath='/bsd43'
3560                 mips_type='BSD 4.3'
3561         else
3562                 mips_type='System V'
3563         fi
3564         $rm -f usr.c usr.out
3565         echo "and you're compiling with the $mips_type compiler and libraries."
3566         xxx_prompt=y
3567         echo "exit 0" >mips
3568 else
3569         echo "Doesn't look like a MIPS system."
3570         xxx_prompt=n
3571         echo "exit 1" >mips
3572 fi
3573 chmod +x mips
3574 $eunicefix mips
3575 case "$usrinc" in
3576 '') ;;
3577 *) dflt="$usrinc";;
3578 esac
3579 case "$xxx_prompt" in
3580 y)      fn=d/
3581         echo " "
3582         rp='Where are the include files you want to use?'
3583         . ./getfile
3584         usrinc="$ans"
3585         ;;
3586 *)      usrinc="$dflt"
3587         ;;
3588 esac
3589
3590 : Set private lib path
3591 case "$plibpth" in
3592 '') if ./mips; then
3593                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3594         fi;;
3595 esac
3596 case "$libpth" in
3597 ' ') dlist='';;
3598 '') dlist="$loclibpth $plibpth $glibpth";;
3599 *) dlist="$libpth";;
3600 esac
3601
3602 : Now check and see which directories actually exist, avoiding duplicates
3603 libpth=''
3604 for xxx in $dlist
3605 do
3606     if $test -d $xxx; then
3607                 case " $libpth " in
3608                 *" $xxx "*) ;;
3609                 *) libpth="$libpth $xxx";;
3610                 esac
3611     fi
3612 done
3613 $cat <<'EOM'
3614
3615 Some systems have incompatible or broken versions of libraries.  Among
3616 the directories listed in the question below, please remove any you
3617 know not to be holding relevant libraries, and add any that are needed.
3618 Say "none" for none.
3619
3620 EOM
3621 case "$libpth" in
3622 '') dflt='none';;
3623 *)
3624         set X $libpth
3625         shift
3626         dflt=${1+"$@"}
3627         ;;
3628 esac
3629 rp="Directories to use for library searches?"
3630 . ./myread
3631 case "$ans" in
3632 none) libpth=' ';;
3633 *) libpth="$ans";;
3634 esac
3635
3636 : compute shared library extension
3637 case "$so" in
3638 '')
3639         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3640                 dflt='sl'
3641         else
3642                 dflt='so'
3643         fi
3644         ;;
3645 *) dflt="$so";;
3646 esac
3647 $cat <<EOM
3648
3649 On some systems, shared libraries may be available.  Answer 'none' if
3650 you want to suppress searching of shared libraries for the remaining
3651 of this configuration.
3652
3653 EOM
3654 rp='What is the file extension used for shared libraries?'
3655 . ./myread
3656 so="$ans"
3657
3658 : Define several unixisms.
3659 : Hints files or command line option can be used to override them.
3660 : The convoluted testing is in case hints files set either the old
3661 : or the new name.
3662 case "$_exe" in
3663 '')     case "$exe_ext" in
3664     '') ;;
3665         *)      _exe="$exe_ext" ;;
3666         esac
3667         ;;
3668 esac
3669 case "$_a" in
3670 '')     case "$lib_ext" in
3671     '') _a='.a';;
3672         *)      _a="$lib_ext" ;;
3673         esac
3674         ;;
3675 esac
3676 case "$_o" in
3677 '') case "$obj_ext" in
3678         '')     _o='.o';;
3679         *)      _o="$obj_ext";;
3680         esac
3681         ;;
3682 esac
3683 case "$p_" in
3684 '') case "$path_sep" in
3685         '')     p_=':';;
3686         *)      p_="$path_sep";;
3687         esac
3688         ;;
3689 esac
3690 exe_ext=$_exe
3691 lib_ext=$_a
3692 obj_ext=$_o
3693 path_sep=$p_
3694
3695 : Which makefile gets called first.  This is used by make depend.
3696 case "$firstmakefile" in
3697 '') firstmakefile='makefile';;
3698 esac
3699
3700 cat <<EOM
3701
3702 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3703 Configure must be run with -Dusesocks.
3704
3705 Normally you do not need this and you should answer no.
3706
3707 EOM
3708 case "$usesocks" in
3709 $define|true|[yY]*)     dflt='y';;
3710 *) dflt='n';;
3711 esac
3712 rp='Build Perl for SOCKS?'
3713 . ./myread
3714 case "$ans" in
3715 y|Y)    val="$define" ;;     
3716 *)      val="$undef" ;;
3717 esac
3718 set usesocks
3719 eval $setvar
3720
3721 : Looking for optional libraries
3722 echo " "
3723 echo "Checking for optional libraries..." >&4
3724 case "$libs" in
3725 ' '|'') dflt='';;
3726 *) dflt="$libs";;
3727 esac
3728 case "$libswanted" in
3729 '') libswanted='c_s';;
3730 esac
3731 case "$usesocks" in
3732 $define)
3733         libswanted="$libswanted socks5 socks5_sh"
3734         ;;
3735 esac
3736 for thislib in $libswanted; do
3737         
3738         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3739                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3740                 echo "Found -l$thislib (shared)."
3741                 case " $dflt " in
3742                 *"-l$thislib "*);;
3743                 *) dflt="$dflt -l$thislib";;
3744                 esac
3745         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3746                 echo "Found -l$thislib (shared)."
3747                 case " $dflt " in
3748                 *"-l$thislib "*);;
3749                 *) dflt="$dflt -l$thislib";;
3750                 esac
3751         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3752                 echo "Found -l$thislib."
3753                 case " $dflt " in
3754                 *"-l$thislib "*);;
3755                 *) dflt="$dflt -l$thislib";;
3756                 esac
3757         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3758                 echo "Found -l$thislib."
3759                 case " $dflt " in
3760                 *"-l$thislib "*);;
3761                 *) dflt="$dflt -l$thislib";;
3762                 esac
3763         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3764                 echo "Found -l${thislib}_s."
3765                 case " $dflt " in
3766                 *"-l$thislib "*);;
3767                 *) dflt="$dflt -l${thislib}_s";;
3768                 esac
3769         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3770                 echo "Found -l$thislib."
3771                 case " $dflt " in
3772                 *"-l$thislib "*);;
3773                 *) dflt="$dflt -l$thislib";;
3774                 esac
3775         else
3776                 echo "No -l$thislib."
3777         fi
3778 done
3779 set X $dflt
3780 shift
3781 dflt="$*"
3782 case "$libs" in
3783 '') dflt="$dflt";;
3784 *) dflt="$libs";;
3785 esac
3786 case "$dflt" in
3787 ' '|'') dflt='none';;
3788 esac
3789
3790 $cat <<EOM
3791
3792 In order to compile $package on your machine, a number of libraries
3793 are usually needed.  Include any other special libraries here as well.
3794 Say "none" for none.  The default list is almost always right.
3795 EOM
3796
3797 echo " "
3798 rp="What libraries to use?"
3799 . ./myread
3800 case "$ans" in
3801 none) libs=' ';;
3802 *) libs="$ans";;
3803 esac
3804
3805 : determine optimization, if desired, or use for debug flag also
3806 case "$optimize" in
3807 ' '|$undef) dflt='none';;
3808 '') dflt='-O';;
3809 *) dflt="$optimize";;
3810 esac
3811 $cat <<EOH
3812
3813 By default, $package compiles with the -O flag to use the optimizer.
3814 Alternately, you might want to use the symbolic debugger, which uses
3815 the -g flag (on traditional Unix systems).  Either flag can be
3816 specified here.  To use neither flag, specify the word "none".
3817
3818 EOH
3819 rp="What optimizer/debugger flag should be used?"
3820 . ./myread
3821 optimize="$ans"
3822 case "$optimize" in
3823 'none') optimize=" ";;
3824 esac
3825
3826 dflt=''
3827 : We will not override a previous value, but we might want to
3828 : augment a hint file
3829 case "$hint" in
3830 default|recommended)
3831         case "$gccversion" in
3832         1*) dflt='-fpcc-struct-return' ;;
3833         esac
3834         case "$optimize" in
3835         *-g*) dflt="$dflt -DDEBUGGING";;
3836         esac
3837         case "$gccversion" in
3838         2*) if test -d /etc/conf/kconfig.d &&
3839                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3840                 then
3841                         dflt="$dflt -posix"
3842                 fi
3843                 ;;
3844         esac
3845         case "$gccversion" in
3846         1*) ;;
3847         2.[0-8]*) ;;
3848         ?*)     echo " "
3849                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3850                 echo 'int main(void) { return 0; }' > gcctest.c
3851                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3852                         echo "Yes, it does." 2>&1
3853                         case "$ccflags" in
3854                         *strict-aliasing*) 
3855                                 echo "Leaving current flags $ccflags alone." 2>&1
3856                                 ;;
3857                         *) dflt="$dflt -fno-strict-aliasing" ;;
3858                         esac
3859                 else
3860                         echo "Nope, it doesn't, but that's ok." 2>&1
3861                 fi
3862                 ;;
3863         esac
3864         ;;
3865 esac
3866
3867 case "$mips_type" in
3868 *BSD*|'') inclwanted="$locincpth $usrinc";;
3869 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3870 esac
3871 for thisincl in $inclwanted; do
3872         if $test -d $thisincl; then
3873                 if $test x$thisincl != x$usrinc; then
3874                         case "$dflt" in
3875                         *$thisincl*);;
3876                         *) dflt="$dflt -I$thisincl";;
3877                         esac
3878                 fi
3879         fi
3880 done
3881
3882 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3883         xxx=true;
3884 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3885         xxx=true;
3886 else
3887         xxx=false;
3888 fi;
3889 if $xxx; then
3890         case "$dflt" in
3891         *$2*);;
3892         *) dflt="$dflt -D$2";;
3893         esac;
3894 fi'
3895
3896 set signal.h LANGUAGE_C; eval $inctest
3897
3898 case "$usesocks" in
3899 $define)
3900         ccflags="$ccflags -DSOCKS"
3901         ;;
3902 esac
3903
3904 case "$hint" in
3905 default|recommended) dflt="$ccflags $dflt" ;;
3906 *) dflt="$ccflags";;
3907 esac
3908
3909 case "$dflt" in
3910 ''|' ') dflt=none;;
3911 esac
3912 $cat <<EOH
3913
3914 Your C compiler may want other flags.  For this question you should include
3915 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3916 but you should NOT include libraries or ld flags like -lwhatever.  If you
3917 want $package to honor its debug switch, you should include -DDEBUGGING here.
3918 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3919
3920 To use no flags, specify the word "none".
3921
3922 EOH
3923 set X $dflt
3924 shift
3925 dflt=${1+"$@"}
3926 rp="Any additional cc flags?"
3927 . ./myread
3928 case "$ans" in
3929 none) ccflags='';;
3930 *) ccflags="$ans";;
3931 esac
3932
3933 : the following weeds options from ccflags that are of no interest to cpp
3934 cppflags="$ccflags"
3935 case "$gccversion" in
3936 1*) cppflags="$cppflags -D__GNUC__"
3937 esac
3938 case "$mips_type" in
3939 '');;
3940 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3941 esac
3942 case "$cppflags" in
3943 '');;
3944 *)
3945         echo " "
3946         echo "Let me guess what the preprocessor flags are..." >&4
3947         set X $cppflags
3948         shift
3949         cppflags=''
3950         $cat >cpp.c <<'EOM'
3951 #define BLURFL foo
3952
3953 BLURFL xx LFRULB
3954 EOM
3955         previous=''
3956         for flag in $*
3957         do
3958                 case "$flag" in
3959                 -*) ftry="$flag";;
3960                 *) ftry="$previous $flag";;
3961                 esac
3962                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3963                         >cpp1.out 2>/dev/null && \
3964                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3965                         >cpp2.out 2>/dev/null && \
3966                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3967                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3968                 then
3969                         cppflags="$cppflags $ftry"
3970                         previous=''
3971                 else
3972                         previous="$flag"
3973                 fi
3974         done
3975         set X $cppflags
3976         shift
3977         cppflags=${1+"$@"}
3978         case "$cppflags" in
3979         *-*)  echo "They appear to be: $cppflags";;
3980         esac
3981         $rm -f cpp.c cpp?.out
3982         ;;
3983 esac
3984
3985 : flags used in final linking phase
3986 case "$ldflags" in
3987 '') if ./venix; then
3988                 dflt='-i -z'
3989         else
3990                 dflt=''
3991         fi
3992         case "$ccflags" in
3993         *-posix*) dflt="$dflt -posix" ;;
3994         esac
3995         ;;
3996 *) dflt="$ldflags";;
3997 esac
3998
3999 : Try to guess additional flags to pick up local libraries.
4000 for thislibdir in $libpth; do
4001         case " $loclibpth " in
4002         *" $thislibdir "*)
4003                 case "$dflt " in 
4004                 *"-L$thislibdir "*) ;;
4005                 *)  dflt="$dflt -L$thislibdir" ;;
4006                 esac
4007                 ;;
4008         esac
4009 done
4010
4011 case "$dflt" in
4012 '') dflt='none' ;;
4013 esac
4014
4015 $cat <<EOH
4016
4017 Your C linker may need flags.  For this question you should
4018 include -L/whatever and any other flags used by the C linker, but you
4019 should NOT include libraries like -lwhatever.
4020
4021 Make sure you include the appropriate -L/path flags if your C linker
4022 does not normally search all of the directories you specified above,
4023 namely
4024         $libpth
4025 To use no flags, specify the word "none".
4026
4027 EOH
4028
4029 rp="Any additional ld flags (NOT including libraries)?"
4030 . ./myread
4031 case "$ans" in
4032 none) ldflags='';;
4033 *) ldflags="$ans";;
4034 esac
4035 rmlist="$rmlist pdp11"
4036
4037 : coherency check
4038 echo " "
4039 echo "Checking your choice of C compiler and flags for coherency..." >&4
4040 $cat > try.c <<'EOF'
4041 #include <stdio.h>
4042 int main() { printf("Ok\n"); exit(0); }
4043 EOF
4044 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4045 shift
4046 $cat >try.msg <<'EOM'
4047 I've tried to compile and run the following simple program:
4048
4049 EOM
4050 $cat try.c >> try.msg
4051
4052 $cat >> try.msg <<EOM
4053
4054 I used the command:
4055
4056         $*
4057         ./try
4058
4059 and I got the following output:
4060
4061 EOM
4062 dflt=y
4063 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4064         if sh -c './try' >>try.msg 2>&1; then
4065                 xxx=`./try`
4066                 case "$xxx" in
4067                 "Ok") dflt=n ;;
4068                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4069                         case " $libs " in
4070                         *" -lsfio "*)
4071                                 cat >> try.msg <<'EOQS'
4072 If $libs contains -lsfio, and sfio is mis-configured, then it
4073 sometimes (apparently) runs and exits with a 0 status, but with no
4074 output!  It may have to do with sfio's use of _exit vs. exit.
4075
4076 EOQS
4077                                 rp="You have a big problem.  Shall I abort Configure"
4078                                 dflt=y
4079                                 ;;
4080                         esac
4081                         ;;
4082                 esac
4083         else
4084                 echo "The program compiled OK, but exited with status $?." >>try.msg
4085                 rp="You have a problem.  Shall I abort Configure"
4086                 dflt=y
4087         fi
4088 else
4089         echo "I can't compile the test program." >>try.msg
4090         rp="You have a BIG problem.  Shall I abort Configure"
4091         dflt=y
4092 fi
4093 case "$dflt" in
4094 y)
4095         $cat try.msg >&4
4096         case "$knowitall" in
4097         '')
4098                 echo "(The supplied flags or libraries might be incorrect.)"
4099                 ;;
4100         *) dflt=n;;
4101         esac
4102         echo " "
4103         . ./myread
4104         case "$ans" in
4105         n*|N*) ;;
4106         *)      echo "Ok.  Stopping Configure." >&4
4107                 exit 1
4108                 ;;
4109         esac
4110         ;;
4111 n) echo "OK, that should do.";;
4112 esac
4113 $rm -f try try.* core
4114
4115 : define an is-a-typedef? function
4116 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4117 case "$inclist" in
4118 "") inclist="sys/types.h";;
4119 esac;
4120 eval "varval=\$$var";
4121 case "$varval" in
4122 "")
4123         $rm -f temp.c;
4124         for inc in $inclist; do
4125                 echo "#include <$inc>" >>temp.c;
4126         done;
4127         echo "#ifdef $type" >> temp.c;
4128         echo "printf(\"We have $type\");" >> temp.c;
4129         echo "#endif" >> temp.c;
4130         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4131         if $contains $type temp.E >/dev/null 2>&1; then
4132                 eval "$var=\$type";
4133         else
4134                 eval "$var=\$def";
4135         fi;
4136         $rm -f temp.?;;
4137 *) eval "$var=\$varval";;
4138 esac'
4139
4140 : define an is-a-typedef? function that prompts if the type is not available.
4141 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4142 case "$inclist" in
4143 "") inclist="sys/types.h";;
4144 esac;
4145 eval "varval=\$$var";
4146 case "$varval" in
4147 "")
4148         $rm -f temp.c;
4149         for inc in $inclist; do
4150                 echo "#include <$inc>" >>temp.c;
4151         done;
4152         echo "#ifdef $type" >> temp.c;
4153         echo "printf(\"We have $type\");" >> temp.c;
4154         echo "#endif" >> temp.c;
4155         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4156         echo " " ;
4157         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4158         if $contains $type temp.E >/dev/null 2>&1; then
4159                 echo "$type found." >&4;
4160                 eval "$var=\$type";
4161         else
4162                 echo "$type NOT found." >&4;
4163                 dflt="$def";
4164                 . ./myread ;
4165                 eval "$var=\$ans";
4166         fi;
4167         $rm -f temp.?;;
4168 *) eval "$var=\$varval";;
4169 esac'
4170
4171 : define a shorthand compile call
4172 compile='
4173 mc_file=$1;
4174 shift;
4175 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4176 : define a shorthand compile call for compilations that should be ok.
4177 compile_ok='
4178 mc_file=$1;
4179 shift;
4180 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4181
4182 : check for lengths of integral types
4183 echo " "
4184 case "$intsize" in
4185 '')
4186         echo "Checking to see how big your integers are..." >&4
4187         $cat >intsize.c <<'EOCP'
4188 #include <stdio.h>
4189 int main()
4190 {
4191         printf("intsize=%d;\n", (int)sizeof(int));
4192         printf("longsize=%d;\n", (int)sizeof(long));
4193         printf("shortsize=%d;\n", (int)sizeof(short));
4194         exit(0);
4195 }
4196 EOCP
4197         set intsize
4198         if eval $compile_ok && ./intsize > /dev/null; then
4199                 eval `./intsize`
4200                 echo "Your integers are $intsize bytes long."
4201                 echo "Your long integers are $longsize bytes long."
4202                 echo "Your short integers are $shortsize bytes long."
4203         else
4204                 $cat >&4 <<EOM
4205 !
4206 Help! I can't compile and run the intsize test program: please enlighten me!
4207 (This is probably a misconfiguration in your system or libraries, and
4208 you really ought to fix it.  Still, I'll try anyway.)
4209 !
4210 EOM
4211                 dflt=4
4212                 rp="What is the size of an integer (in bytes)?"
4213                 . ./myread
4214                 intsize="$ans"
4215                 dflt=$intsize
4216                 rp="What is the size of a long integer (in bytes)?"
4217                 . ./myread
4218                 longsize="$ans"
4219                 dflt=2
4220                 rp="What is the size of a short integer (in bytes)?"
4221                 . ./myread
4222                 shortsize="$ans"
4223         fi
4224         ;;
4225 esac
4226 $rm -f intsize intsize.*
4227
4228 : see what type lseek is declared as in the kernel
4229 rp="What is the type used for lseek's offset on this system?"
4230 set off_t lseektype long stdio.h sys/types.h
4231 eval $typedef_ask
4232
4233 echo " "
4234 $echo $n "Checking to see how big your file offsets are...$c" >&4
4235 $cat >try.c <<EOCP
4236 #include <sys/types.h>
4237 #include <stdio.h>
4238 int main()
4239 {
4240     printf("%d\n", (int)sizeof($lseektype));
4241     return(0); 
4242 }
4243 EOCP
4244 set try
4245 if eval $compile_ok; then
4246         lseeksize=`./try`
4247         $echo " $lseeksize bytes." >&4
4248 else
4249         dflt=$longsize
4250         echo " "
4251         echo "(I can't seem to compile the test program.  Guessing...)"
4252         rp="What is the size of your file offsets (in bytes)?"
4253         . ./myread
4254         lseeksize="$ans"
4255 fi
4256 $rm -f try.c try
4257
4258 : see what type file positions are declared as in the library
4259 rp="What is the type for file position used by fsetpos()?"
4260 set fpos_t fpostype long stdio.h sys/types.h
4261 eval $typedef_ask
4262
4263 echo " "
4264 case "$fpostype" in
4265 *_t) zzz="$fpostype"    ;;
4266 *)   zzz="fpos_t"       ;;
4267 esac
4268 $echo $n "Checking the size of $zzz...$c" >&4 
4269 cat > try.c <<EOCP
4270 #include <sys/types.h>
4271 #include <stdio.h>
4272 int main() {
4273     printf("%d\n", (int)sizeof($fpostype));
4274     exit(0);
4275 }
4276 EOCP
4277 set try
4278 if eval $compile_ok; then
4279         yyy=`./try`
4280         case "$yyy" in
4281         '')     fpossize=4
4282                 echo " "
4283                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4284                 ;;
4285         *)      fpossize=$yyy
4286                 echo " $fpossize bytes."
4287                 ;;
4288         esac
4289 else
4290         dflt="$longsize"
4291         echo " "
4292         echo "(I can't compile the test program.  Guessing...)" >&4
4293         rp="What is the size of your file positions (in bytes)?"
4294         . ./myread
4295         fpossize="$ans"
4296 fi
4297
4298
4299
4300 case "$lseeksize:$fpossize" in
4301 8:8) cat <<EOM
4302
4303 You can have files larger than 2 gigabytes.
4304 EOM
4305    val="$define" ;;
4306 *) cat <<EOM
4307
4308 Perl can be built to understand large files (files larger than 2 gigabytes)
4309 on some systems.  To do so, Configure must be run with -Duselargefiles.
4310
4311 If this doesn't make any sense to you, just accept the default 'y'.
4312 EOM
4313    case "$uselargefiles" in
4314    "$undef"|false|[nN]*) dflt='n' ;;
4315    *)   dflt='y' ;;
4316    esac
4317    rp='Try to understand large files, if available?'
4318    . ./myread
4319    case "$ans" in
4320    y|Y)         val="$define" ;;
4321    *)           val="$undef"  ;;
4322    esac
4323    ;;
4324 esac
4325 set uselargefiles
4326 eval $setvar
4327 case "$uselargefiles" in
4328 "$define")
4329 : Look for a hint-file generated 'call-back-unit'.  If the
4330 : user has specified that a large files perl is to be built,
4331 : we may need to set or change some other defaults.
4332         if $test -f uselfs.cbu; then
4333                 echo "Your platform has some specific hints for large file builds, using them..."
4334                 . ./uselfs.cbu
4335                 echo " "
4336                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4337                 $cat >try.c <<EOCP
4338 #include <sys/types.h>
4339 #include <stdio.h>
4340 int main()
4341 {
4342     printf("%d\n", (int)sizeof($lseektype));
4343     return(0); 
4344 }
4345 EOCP
4346                 set try
4347                 if eval $compile_ok; then
4348                         lseeksize=`./try`
4349                         $echo " $lseeksize bytes." >&4
4350                 else
4351                         dflt="$lseeksize"
4352                         echo " "
4353                         echo "(I can't seem to compile the test program.  Guessing...)"
4354                         rp="What is the size of your file offsets (in bytes)?"
4355                         . ./myread
4356                         lseeksize="$ans"
4357                 fi
4358                 case "$fpostype" in
4359                 *_t) zzz="$fpostype"    ;;
4360                 *)   zzz="fpos_t"       ;;
4361                 esac
4362                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4363                 $cat > try.c <<EOCP
4364 #include <sys/types.h>
4365 #include <stdio.h>
4366 int main() {
4367     printf("%d\n", (int)sizeof($fpostype));
4368     exit(0);
4369 }
4370 EOCP
4371                 set try
4372                 if eval $compile_ok; then
4373                         yyy=`./try`
4374                         dflt="$lseeksize"
4375                         case "$yyy" in
4376                         '')     echo " "
4377                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4378                                 ;;
4379                         *)      fpossize=$yyy
4380                                 echo " $fpossize bytes."
4381                                 ;;
4382                         esac
4383                 else
4384                         dflt="$fpossize"
4385                         echo " "
4386                         echo "(I can't compile the test program.  Guessing...)" >&4
4387                         rp="What is the size of your file positions (in bytes)?"
4388                         . ./myread
4389                         fpossize="$ans"
4390                 fi
4391                 $rm -f try.c try
4392         fi
4393         ;;
4394 esac
4395
4396
4397 case "$usemorebits" in
4398 "$define"|true|[yY]*)
4399         use64bits="$define"
4400         uselongdouble="$define"
4401         usemorebits="$define"
4402         ;;
4403 *)      usemorebits="$undef"
4404         ;;
4405 esac
4406
4407
4408 case "$intsize:$longsize" in
4409 8:*|*:8) cat <<EOM
4410
4411 You have natively 64-bit integers.
4412 EOM
4413    val="$define" ;;
4414 *) cat <<EOM
4415
4416 Perl can be built to take advantage of 64-bit integer types
4417 on some systems.  To do so, Configure must be run with -Duse64bits.
4418
4419 If this doesn't make any sense to you, just accept the default.
4420 EOM
4421   case "$use64bits" in
4422   $define|true|[yY]*)   dflt='y';;
4423   *) dflt='n';;
4424   esac
4425   rp='Try to use 64-bit integers, if available?'
4426   . ./myread
4427   case "$ans" in
4428   y|Y) val="$define" ;;
4429   *)   val="$undef"  ;;
4430   esac
4431   ;;
4432 esac
4433 set use64bits
4434 eval $setvar
4435
4436 case "$archname64" in
4437 '') archname64='' ;;    # not a typo
4438 esac
4439
4440 case "$use64bits" in
4441 "$define"|true|[yY]*)
4442 : Look for a hint-file generated 'call-back-unit'.  If the
4443 : user has specified that a 64-bit perl is to be built,
4444 : we may need to set or change some other defaults.
4445         if $test -f use64bits.cbu; then
4446                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4447                 . ./use64bits.cbu
4448         else
4449                 $cat <<EOM
4450 (Your platform doesn't have any specific hints for 64-bit builds.)
4451 EOM
4452                 case "$intsize:$longsize" in
4453 8:*|*:8) cat <<EOM
4454 (This is probably okay, as your system is a natively 64-bit system.)
4455 EOM
4456                   ;;
4457                 esac
4458                 case "$gccversion" in
4459                 '')     ;;
4460                 *)      case "$ccflags" in
4461                         *-DUSE_LONG_LONG*) ;;
4462                         *) $cat <<EOM
4463 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4464 to the compilation flags.
4465 EOM
4466                            ccflags="$ccflags -DUSE_LONG_LONG"
4467                            ;;
4468                         esac
4469                         ;;
4470                 esac
4471         fi
4472         ;;
4473 esac
4474
4475 : determine the architecture name
4476 echo " "
4477 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4478         tarch=`arch`"-$osname"
4479 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4480         if uname -m > tmparch 2>&1 ; then
4481                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4482                         -e 's/$/'"-$osname/" tmparch`
4483         else
4484                 tarch="$osname"
4485         fi
4486         $rm -f tmparch
4487 else
4488         tarch="$osname"
4489 fi
4490 case "$myarchname" in
4491 ''|"$tarch") ;;
4492 *)
4493         echo "(Your architecture name used to be $myarchname.)"
4494         archname=''
4495         ;;
4496 esac
4497 myarchname="$tarch"
4498 case "$archname" in
4499 '') dflt="$tarch";;
4500 *) dflt="$archname";;
4501 esac
4502 rp='What is your architecture name'
4503 . ./myread
4504 archname="$ans"
4505 case "$usethreads" in
4506 $define)
4507         echo "Threads selected." >&4
4508         case "$archname" in
4509         *-thread*) echo "...and architecture name already has -thread." >&4
4510                 ;;
4511         *)      archname="$archname-thread"
4512                 echo "...setting architecture name to $archname." >&4
4513                 ;;
4514         esac
4515         ;;
4516 esac
4517 case "$usemultiplicity" in
4518 $define)
4519         echo "Multiplicity selected." >&4
4520         case "$archname" in
4521         *-multi*) echo "...and architecture name already has -multi." >&4
4522                 ;;
4523         *)      archname="$archname-multi"
4524                 echo "...setting architecture name to $archname." >&4
4525                 ;;
4526         esac
4527         ;;
4528 esac
4529 case "$use64bits" in
4530 $define)
4531         case "$archname64" in
4532         '')
4533                 ;;
4534         *)
4535                 case "$archname" in
4536                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4537                         ;;
4538                 *)      archname="$archname-$archname64"
4539                         echo "...setting architecture name to $archname." >&4
4540                         ;;
4541                 esac
4542                 ;;
4543         esac
4544 esac
4545
4546 : determine root of directory hierarchy where package will be installed.
4547 case "$prefix" in
4548 '')
4549         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4550         ;;
4551 *)
4552         dflt="$prefix"
4553         ;;
4554 esac
4555 $cat <<EOM
4556
4557 By default, $package will be installed in $dflt/bin, manual pages
4558 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4559 installation directories. Typically this is something like /usr/local.
4560 If you wish to have binaries under /usr/bin but other parts of the
4561 installation under /usr/local, that's ok: you will be prompted
4562 separately for each of the installation directories, the prefix being
4563 only used to set the defaults.
4564
4565 EOM
4566 fn=d~
4567 rp='Installation prefix to use?'
4568 . ./getfile
4569 oldprefix=''
4570 case "$prefix" in
4571 '') ;;
4572 *)
4573         case "$ans" in
4574         "$prefix") ;;
4575         *) oldprefix="$prefix";;
4576         esac
4577         ;;
4578 esac
4579 prefix="$ans"
4580 prefixexp="$ansexp"
4581
4582 : is AFS running?
4583 echo " "
4584 case "$afs" in
4585 $define|true)   afs=true ;;
4586 $undef|false)   afs=false ;;
4587 *)      if test -d /afs; then
4588                 afs=true
4589         else
4590                 afs=false
4591         fi
4592         ;;
4593 esac
4594 if $afs; then
4595         echo "AFS may be running... I'll be extra cautious then..." >&4
4596 else
4597         echo "AFS does not seem to be running..." >&4
4598 fi
4599
4600 : determine installation prefix for where package is to be installed.
4601 if $afs; then 
4602 $cat <<EOM
4603
4604 Since you are running AFS, I need to distinguish the directory in which
4605 files will reside from the directory in which they are installed (and from
4606 which they are presumably copied to the former directory by occult means).
4607
4608 EOM
4609         case "$installprefix" in
4610         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4611         *) dflt="$installprefix";;
4612         esac
4613 else
4614 $cat <<EOM
4615
4616 In some special cases, particularly when building $package for distribution,
4617 it is convenient to distinguish between the directory in which files should 
4618 be installed from the directory ($prefix) in which they 
4619 will eventually reside.  For most users, these two directories are the same.
4620
4621 EOM
4622         case "$installprefix" in
4623         '') dflt=$prefix ;;
4624         *) dflt=$installprefix;;
4625         esac
4626 fi
4627 fn=d~
4628 rp='What installation prefix should I use for installing files?'
4629 . ./getfile
4630 installprefix="$ans"
4631 installprefixexp="$ansexp"
4632
4633 : set the prefixit variable, to compute a suitable default value
4634 prefixit='case "$3" in
4635 ""|none)
4636         case "$oldprefix" in
4637         "") eval "$1=\"\$$2\"";;
4638         *)
4639                 case "$3" in
4640                 "") eval "$1=";;
4641                 none)
4642                         eval "tp=\"\$$2\"";
4643                         case "$tp" in
4644                         ""|" ") eval "$1=\"\$$2\"";;
4645                         *) eval "$1=";;
4646                         esac;;
4647                 esac;;
4648         esac;;
4649 *)
4650         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4651         case "$tp" in
4652         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4653         /*-$oldprefix/*|\~*-$oldprefix/*)
4654                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4655         *) eval "$1=\"\$$2\"";;
4656         esac;;
4657 esac'
4658
4659 : set the base revision
4660 baserev=5.0
4661
4662
4663 : get the patchlevel
4664 echo " "
4665 echo "Getting the current patchlevel..." >&4
4666 if $test -r $rsrc/patchlevel.h;then
4667         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4668         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4669         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4670         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4671         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4672 else
4673         patchlevel=0
4674         subversion=0
4675         api_revision=0
4676         api_version=0
4677         api_subversion=0
4678 fi
4679 $echo $n "(You have $package" $c
4680 case "$package" in
4681 "*$baserev")    ;;
4682 *)              $echo $n " $baserev" $c ;;
4683 esac
4684 $echo $n " patchlevel $patchlevel" $c
4685 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4686 echo ".)"
4687 case "$osname" in
4688 dos|cygwin|vms|win32)
4689         : XXX Should be a Configure test for double-dots in filenames.
4690         version=`echo $baserev $patchlevel $subversion | \
4691                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4692         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4693                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4694         ;;
4695 *)
4696         version=`echo $baserev $patchlevel $subversion | \
4697                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4698         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4699                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4700         ;;
4701 esac
4702 : Special case the 5.005_xx maintenance series, which used 5.005
4703 : without any subversion label as a subdirectory in $sitelib
4704 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4705         api_versionstring='5.005'
4706 fi
4707
4708 : determine installation style
4709 : For now, try to deduce it from prefix unless it is already set.
4710 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4711 case "$installstyle" in
4712 '')     case "$prefix" in
4713                 *perl*) dflt='lib';;
4714                 *) dflt='lib/perl5' ;;
4715         esac
4716         ;;
4717 *)      dflt='lib/perl5' ;;
4718 esac
4719 : Probably not worth prompting for this since we prompt for all
4720 : the directories individually, and the prompt would be too long and
4721 : confusing anyway.
4722 installstyle=$dflt
4723
4724 : determine where private library files go
4725 : Usual default is /usr/local/lib/perl5/$version.
4726 : Also allow things like /opt/perl/lib/$version, since 
4727 : /opt/perl/lib/perl5... would be redundant.
4728 : The default "style" setting is made in installstyle.U
4729 case "$installstyle" in
4730 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4731 *)       set dflt privlib lib/$version ;;
4732 esac
4733 eval $prefixit
4734 $cat <<EOM
4735
4736 There are some auxiliary files for $package that need to be put into a
4737 private library directory that is accessible by everyone.
4738
4739 EOM
4740 fn=d~+
4741 rp='Pathname where the private library files will reside?'
4742 . ./getfile
4743 privlib="$ans"
4744 privlibexp="$ansexp"
4745 : Change installation prefix, if necessary.
4746 if $test X"$prefix" != X"$installprefix"; then
4747         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4748 else
4749         installprivlib="$privlibexp"
4750 fi
4751
4752 : set the prefixup variable, to restore leading tilda escape
4753 prefixup='case "$prefixexp" in
4754 "$prefix") ;;
4755 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4756 esac'
4757
4758 : determine where public architecture dependent libraries go
4759 set archlib archlib
4760 eval $prefixit
4761 : privlib default is /usr/local/lib/$package/$version
4762 : archlib default is /usr/local/lib/$package/$version/$archname
4763 : privlib may have an optional trailing /share.
4764 tdflt=`echo $privlib | $sed 's,/share$,,'`
4765 tdflt=$tdflt/$archname
4766 case "$archlib" in
4767 '')     dflt=$tdflt
4768         ;;
4769 *)      dflt="$archlib"
4770     ;;
4771 esac
4772 $cat <<EOM
4773
4774 $spackage contains architecture-dependent library files.  If you are
4775 sharing libraries in a heterogeneous environment, you might store
4776 these files in a separate location.  Otherwise, you can just include
4777 them with the rest of the public library files.
4778
4779 EOM
4780 fn=d+~
4781 rp='Where do you want to put the public architecture-dependent libraries?'
4782 . ./getfile
4783 archlib="$ans"
4784 archlibexp="$ansexp"
4785 if $test X"$archlib" = X"$privlib"; then
4786         d_archlib="$undef"
4787 else
4788         d_archlib="$define"
4789 fi
4790 : Change installation prefix, if necessary.
4791 if $test X"$prefix" != X"$installprefix"; then
4792         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4793 else
4794         installarchlib="$archlibexp"
4795 fi
4796
4797
4798 : Binary compatibility with 5.005 is not possible for builds
4799 : with advanced features
4800 case "$usethreads$usemultiplicity" in
4801 *define*)
4802         bincompat5005="$undef"
4803         d_bincompat5005="$undef"
4804         ;;
4805 *)      $cat <<EOM
4806
4807 Perl 5.006 can be compiled for binary compatibility with 5.005.
4808 If you decide to do so, you will be able to continue using most
4809 of the extensions that were compiled for Perl 5.005.
4810
4811 EOM
4812         case "$bincompat5005$d_bincompat5005" in
4813         *"$undef"*) dflt=n ;;
4814         *) dflt=y ;;
4815         esac
4816         rp='Binary compatibility with Perl 5.005?'
4817         . ./myread
4818         case "$ans" in
4819         y*) val="$define" ;;
4820         *)  val="$undef" ;;
4821         esac
4822         set d_bincompat5005
4823         eval $setvar
4824         case "$d_bincompat5005" in
4825         "$define")
4826                 bincompat5005="$define"
4827                 ;;
4828         *)      bincompat5005="$undef"
4829                 d_bincompat5005="$undef"
4830                 ;;
4831         esac
4832         ;;
4833 esac
4834
4835
4836 : see if setuid scripts can be secure
4837 $cat <<EOM
4838
4839 Some kernels have a bug that prevents setuid #! scripts from being
4840 secure.  Some sites have disabled setuid #! scripts because of this.
4841
4842 First let's decide if your kernel supports secure setuid #! scripts.
4843 (If setuid #! scripts would be secure but have been disabled anyway,
4844 don't say that they are secure if asked.)
4845
4846 EOM
4847
4848 val="$undef"
4849 if $test -d /dev/fd; then
4850         echo "#!$ls" >reflect
4851         chmod +x,u+s reflect
4852         ./reflect >flect 2>&1
4853         if $contains "/dev/fd" flect >/dev/null; then
4854                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4855                 val="$define"
4856         else
4857                 $cat <<EOM
4858 If you are not sure if they are secure, I can check but I'll need a
4859 username and password different from the one you are using right now.
4860 If you don't have such a username or don't want me to test, simply
4861 enter 'none'.
4862
4863 EOM
4864                 rp='Other username to test security of setuid scripts with?'
4865                 dflt='none'
4866                 . ./myread
4867                 case "$ans" in
4868                 n|none)
4869                         case "$d_suidsafe" in
4870                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4871                                 dflt=n;;
4872                         "$undef")
4873                                 echo "Well, the $hint value is *not* secure." >&4
4874                                 dflt=n;;
4875                         *)      echo "Well, the $hint value *is* secure." >&4
4876                                 dflt=y;;
4877                         esac
4878                         ;;
4879                 *)
4880                         $rm -f reflect flect
4881                         echo "#!$ls" >reflect
4882                         chmod +x,u+s reflect
4883                         echo >flect
4884                         chmod a+w flect
4885                         echo '"su" will (probably) prompt you for '"$ans's password."
4886                         su $ans -c './reflect >flect'
4887                         if $contains "/dev/fd" flect >/dev/null; then
4888                                 echo "Okay, it looks like setuid scripts are secure." >&4
4889                                 dflt=y
4890                         else
4891                                 echo "I don't think setuid scripts are secure." >&4
4892                                 dflt=n
4893                         fi
4894                         ;;
4895                 esac
4896                 rp='Does your kernel have *secure* setuid scripts?'
4897                 . ./myread
4898                 case "$ans" in
4899                 [yY]*)  val="$define";;
4900                 *)      val="$undef";;
4901                 esac
4902         fi
4903 else
4904         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4905         echo "(That's for file descriptors, not floppy disks.)"
4906         val="$undef"
4907 fi
4908 set d_suidsafe
4909 eval $setvar
4910
4911 $rm -f reflect flect
4912
4913 : now see if they want to do setuid emulation
4914 echo " "
4915 val="$undef"
4916 case "$d_suidsafe" in
4917 "$define")
4918         val="$undef"
4919         echo "No need to emulate SUID scripts since they are secure here." >& 4
4920         ;;
4921 *)
4922         $cat <<EOM
4923 Some systems have disabled setuid scripts, especially systems where
4924 setuid scripts cannot be secure.  On systems where setuid scripts have
4925 been disabled, the setuid/setgid bits on scripts are currently
4926 useless.  It is possible for $package to detect those bits and emulate
4927 setuid/setgid in a secure fashion.  This emulation will only work if
4928 setuid scripts have been disabled in your kernel.
4929
4930 EOM
4931         case "$d_dosuid" in
4932         "$define") dflt=y ;;
4933         *) dflt=n ;;
4934         esac
4935         rp="Do you want to do setuid/setgid emulation?"
4936         . ./myread
4937         case "$ans" in
4938         [yY]*)  val="$define";;
4939         *)      val="$undef";;
4940         esac
4941         ;;
4942 esac
4943 set d_dosuid
4944 eval $setvar
4945
4946 : determine filename position in cpp output
4947 echo " "
4948 echo "Computing filename position in cpp output for #include directives..." >&4
4949 echo '#include <stdio.h>' > foo.c
4950 $cat >fieldn <<EOF
4951 $startsh
4952 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4953 $grep '^[       ]*#.*stdio\.h' | \
4954 while read cline; do
4955         pos=1
4956         set \$cline
4957         while $test \$# -gt 0; do
4958                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4959                         echo "\$pos"
4960                         exit 0
4961                 fi
4962                 shift
4963                 pos=\`expr \$pos + 1\`
4964         done
4965 done
4966 EOF
4967 chmod +x fieldn
4968 fieldn=`./fieldn`
4969 $rm -f foo.c fieldn
4970 case $fieldn in
4971 '') pos='???';;
4972 1) pos=first;;
4973 2) pos=second;;
4974 3) pos=third;;
4975 *) pos="${fieldn}th";;
4976 esac
4977 echo "Your cpp writes the filename in the $pos field of the line."
4978
4979 : locate header file
4980 $cat >findhdr <<EOF
4981 $startsh
4982 wanted=\$1
4983 name=''
4984 for usrincdir in $usrinc
4985 do
4986         if test -f \$usrincdir/\$wanted; then
4987                 echo "\$usrincdir/\$wanted"
4988                 exit 0
4989         fi
4990 done
4991 awkprg='{ print \$$fieldn }'
4992 echo "#include <\$wanted>" > foo\$\$.c
4993 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4994 $grep "^[       ]*#.*\$wanted" | \
4995 while read cline; do
4996         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4997         case "\$name" in
4998         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4999         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5000         *) exit 2;;
5001         esac;
5002 done;
5003 #
5004 # status = 0: grep returned 0 lines, case statement not executed
5005 # status = 1: headerfile found
5006 # status = 2: while loop executed, no headerfile found
5007 #
5008 status=\$?
5009 $rm -f foo\$\$.c;
5010 if test \$status -eq 1; then
5011         exit 0;
5012 fi
5013 exit 1
5014 EOF
5015 chmod +x findhdr
5016
5017 : define an alternate in-header-list? function
5018 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5019 cont=true; xxf="echo \"<\$1> found.\" >&4";
5020 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5021 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5022 esac;
5023 case $# in 4) instead=instead;; *) instead="at last";; esac;
5024 while $test "$cont"; do
5025         xxx=`./findhdr $1`
5026         var=$2; eval "was=\$$2";
5027         if $test "$xxx" && $test -r "$xxx";
5028         then eval $xxf;
5029         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5030                 cont="";
5031         else eval $xxnf;
5032         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5033         set $yyy; shift; shift; yyy=$@;
5034         case $# in 0) cont="";;
5035         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5036                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5037         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5038                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5039         esac;
5040 done;
5041 while $test "$yyy";
5042 do set $yyy; var=$2; eval "was=\$$2";
5043         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5044         set $yyy; shift; shift; yyy=$@;
5045 done'
5046
5047 : see if this is a malloc.h system
5048 set malloc.h i_malloc
5049 eval $inhdr
5050
5051 : see if stdlib is available
5052 set stdlib.h i_stdlib
5053 eval $inhdr
5054
5055 : determine which malloc to compile in
5056 echo " "
5057 case "$usemymalloc" in
5058 ''|[yY]*|true|$define)  dflt='y' ;;
5059 *)      dflt='n' ;;
5060 esac
5061 rp="Do you wish to attempt to use the malloc that comes with $package?"
5062 . ./myread
5063 usemymalloc="$ans"
5064 case "$ans" in
5065 y*|true)
5066         usemymalloc='y'
5067         mallocsrc='malloc.c'
5068         mallocobj="malloc$_o"
5069         d_mymalloc="$define"
5070         case "$libs" in
5071         *-lmalloc*)
5072                 : Remove malloc from list of libraries to use
5073                 echo "Removing unneeded -lmalloc from library list" >&4
5074                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5075                 shift
5076                 libs="$*"
5077                 echo "libs = $libs" >&4
5078                 ;;
5079         esac
5080         ;;
5081 *)
5082         usemymalloc='n'
5083         mallocsrc=''
5084         mallocobj=''
5085         d_mymalloc="$undef"
5086         ;;
5087 esac
5088
5089 : compute the return types of malloc and free
5090 echo " "
5091 $cat >malloc.c <<END
5092 #$i_malloc I_MALLOC
5093 #$i_stdlib I_STDLIB
5094 #include <stdio.h>
5095 #include <sys/types.h>
5096 #ifdef I_MALLOC
5097 #include <malloc.h>
5098 #endif
5099 #ifdef I_STDLIB
5100 #include <stdlib.h>
5101 #endif
5102 #ifdef TRY_MALLOC
5103 void *malloc();
5104 #endif
5105 #ifdef TRY_FREE
5106 void free();
5107 #endif
5108 END
5109 case "$malloctype" in
5110 '')
5111         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5112                 malloctype='void *'
5113         else
5114                 malloctype='char *'
5115         fi
5116         ;;
5117 esac
5118 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5119
5120 case "$freetype" in
5121 '')
5122         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5123                 freetype='void'
5124         else
5125                 freetype='int'
5126         fi
5127         ;;
5128 esac
5129 echo "Your system uses $freetype free(), it would seem." >&4
5130 $rm -f malloc.[co]
5131 $cat <<EOM
5132
5133 The installation process will also create a directory for
5134 vendor-supplied add-ons.  Vendors who supply perl with their system
5135 may find it convenient to place all vendor-supplied files in this
5136 directory rather than in the main distribution directory.  This will
5137 ease upgrades between binary-compatible maintenance versions of perl.
5138
5139 Of course you may also use these directories in whatever way you see
5140 fit.  For example, you might use them to access modules shared over a
5141 company-wide network.
5142
5143 The default answer should be fine for most people.
5144 This causes further questions about vendor add-ons to be skipped
5145 and no vendor-specific directories will be configured for perl.
5146
5147 EOM
5148 rp='Do you want to configure vendor-specific add-on directories?'
5149 case "$usevendorprefix" in
5150 define|true|[yY]*) dflt=y ;;
5151 *) dflt=n ;;
5152 esac
5153 . ./myread
5154 case "$ans" in
5155 [yY]*)  fn=d~+
5156         rp='Installation prefix to use for vendor-supplied add-ons?'
5157         case "$vendorprefix" in
5158         '') dflt='' ;;
5159         *)  dflt=$vendorprefix ;;
5160         esac
5161         . ./getfile
5162         oldvendorprefix=''
5163         case "$vendorprefix" in
5164         '') ;;
5165         *)      case "$ans" in
5166                 "$prefix") ;;
5167                 *) oldvendorprefix="$prefix";;
5168                 esac
5169                 ;;
5170         esac
5171         usevendorprefix="$define"
5172         vendorprefix="$ans"
5173         vendorprefixexp="$ansexp"
5174         ;;
5175 *)      usevendorprefix="$undef"
5176         vendorprefix=''
5177         vendorprefixexp=''
5178         ;;
5179 esac
5180
5181 case "$vendorprefix" in
5182 '')     d_vendorlib="$undef"
5183         vendorlib=''
5184         vendorlibexp=''
5185         ;;
5186 *)      d_vendorlib="$define"
5187         : determine where vendor-supplied modules go.
5188         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5189         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5190         case "$installstyle" in
5191         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5192         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5193         esac
5194         fn=d~+
5195         rp='Pathname for the vendor-supplied library files?'
5196         . ./getfile
5197         vendorlib="$ans"
5198         vendorlibexp="$ansexp"
5199         : Change installation prefix, if necessary.
5200         if $test X"$prefix" != X"$installprefix"; then
5201                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5202         else
5203                 installvendorlib="$vendorlibexp"
5204         fi
5205         ;;
5206 esac
5207
5208 : Cruising for prototypes
5209 echo " "
5210 echo "Checking out function prototypes..." >&4
5211 $cat >prototype.c <<'EOCP'
5212 int main(int argc, char *argv[]) {
5213         exit(0);}
5214 EOCP
5215 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5216         echo "Your C compiler appears to support function prototypes."
5217         val="$define"
5218 else
5219         echo "Your C compiler doesn't seem to understand function prototypes."
5220         val="$undef"
5221 fi
5222 set prototype
5223 eval $setvar
5224 $rm -f prototype*
5225
5226 case "$prototype" in
5227 "$define") ;;
5228 *)      ansi2knr='ansi2knr'
5229         echo " "
5230         cat <<EOM >&4
5231
5232 $me:  FATAL ERROR:
5233 This version of $package can only be compiled by a compiler that 
5234 understands function prototypes.  Unfortunately, your C compiler 
5235         $cc $ccflags
5236 doesn't seem to understand them.  Sorry about that.
5237
5238 If GNU cc is available for your system, perhaps you could try that instead.  
5239
5240 Eventually, we hope to support building Perl with pre-ANSI compilers.
5241 If you would like to help in that effort, please contact <perlbug@perl.org>.
5242
5243 Aborting Configure now.
5244 EOM
5245         exit 2
5246         ;;
5247 esac
5248
5249 : determine where public executables go
5250 echo " "
5251 set dflt bin bin
5252 eval $prefixit
5253 fn=d~
5254 rp='Pathname where the public executables will reside?'
5255 . ./getfile
5256 if $test "X$ansexp" != "X$binexp"; then
5257         installbin=''
5258 fi
5259 bin="$ans"
5260 binexp="$ansexp"
5261 : Change installation prefix, if necessary.
5262 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5263 if $test X"$prefix" != X"$installprefix"; then
5264         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5265 else
5266         installbin="$binexp"
5267 fi
5268
5269 $cat <<EOM
5270
5271 After $package is installed, you may wish to install various
5272 add-on modules and utilities.  Typically, these add-ons will
5273 be installed under $prefix with the rest
5274 of this package.  However, you may wish to install such add-ons
5275 elsewhere under a different prefix.
5276
5277 If you do not wish to put everything under a single prefix, that's
5278 ok.  You will be prompted for the individual locations; this siteprefix
5279 is only used to suggest the defaults.
5280
5281 The default should be fine for most people.
5282
5283 EOM
5284 fn=d~+
5285 rp='Installation prefix to use for add-on modules and utilities?'
5286 : XXX Here might be another good place for an installstyle setting.
5287 case "$siteprefix" in
5288 '') dflt=$prefix ;;
5289 *)  dflt=$siteprefix ;;
5290 esac
5291 . ./getfile
5292 oldsiteprefix=''
5293 case "$siteprefix" in
5294 '') ;;
5295 *)
5296         case "$ans" in
5297         "$prefix") ;;
5298         *) oldsiteprefix="$prefix";;
5299         esac
5300         ;;
5301 esac
5302 siteprefix="$ans"
5303 siteprefixexp="$ansexp"
5304
5305 : determine where site specific libraries go.
5306 : Usual default is /usr/local/lib/perl5/site_perl/$version
5307 : The default "style" setting is made in installstyle.U
5308 : XXX No longer works with Prefixit stuff.
5309 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5310 case "$installstyle" in
5311 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5312 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5313 esac
5314 $cat <<EOM
5315
5316 The installation process will create a directory for
5317 site-specific extensions and modules.  Most users find it convenient
5318 to place all site-specific files in this directory rather than in the
5319 main distribution directory.
5320
5321 EOM
5322 fn=d~+
5323 rp='Pathname for the site-specific library files?'
5324 . ./getfile
5325 sitelib="$ans"
5326 sitelibexp="$ansexp"
5327 : Change installation prefix, if necessary.
5328 if $test X"$prefix" != X"$installprefix"; then
5329         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5330 else
5331         installsitelib="$sitelibexp"
5332 fi
5333
5334 : Determine list of previous versions to include in @INC
5335 $cat > getverlist <<EOPL
5336 #!$perl -w
5337 use File::Basename;
5338 \$api_versionstring = "$api_versionstring";
5339 \$version = "$version";
5340 \$sitelib = "$sitelib";
5341 \$archname = "$archname";
5342 EOPL
5343         $cat >> getverlist <<'EOPL'
5344 # Can't have leading @ because metaconfig interprets it as a command!
5345 ;@inc_version_list=();
5346 $stem=dirname($sitelib);
5347 # Redo to do opendir/readdir? 
5348 if (-d $stem) {
5349     chdir($stem);
5350     ;@candidates = glob("5.*");
5351 }
5352 else {
5353     ;@candidates = ();
5354 }
5355
5356 foreach $d (@candidates) {
5357     if ($d lt $version) {
5358         if ($d ge $api_versionstring) {
5359             unshift(@inc_version_list, "$d/$archname", $d);
5360         }
5361         elsif ($d ge "5.005") {
5362             unshift(@inc_version_list, $d);
5363         }
5364     }
5365     else {
5366         # Skip newer version.  I.e. don't look in
5367         # 5.7.0 if we're installing 5.6.1.
5368     }
5369 }
5370
5371 if (@inc_version_list) {
5372     print '"';
5373     print join('", "', @inc_version_list);
5374     print '"';
5375 }
5376 else {
5377     # Blank space to preserve value for next Configure run.
5378     print " ";
5379 }
5380 EOPL
5381 chmod +x getverlist
5382 case "$inc_version_list" in
5383 '')     if test -x $perl; then
5384                 dflt=`$perl getverlist`
5385         else
5386                 dflt=''
5387         fi
5388         ;;
5389 *)  dflt="$inc_version_list" ;;
5390 esac
5391 $cat <<'EOM'
5392
5393 In order to ease the process of upgrading, this version of perl 
5394 can be configured to use modules built and installed with earlier 
5395 versions of perl that were installed under $prefix.  Specify here
5396 the list of earlier versions that this version of perl should check.
5397 If Configure detected no earlier versions of perl installed under
5398 $prefix, then the list will be empty.
5399
5400 The default should almost always be sensible, so if you're not sure,
5401 just accept the default.
5402 EOM
5403
5404 rp='list of earlier versions to include in @INC?'
5405 . ./myread
5406 inc_version_list="$ans"
5407 $rm -f getverlist
5408
5409 : determine whether to install perl also as /usr/bin/perl
5410
5411 echo " "
5412 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5413         $cat <<EOM
5414 Many scripts expect to perl to be installed as /usr/bin/perl.
5415 I can install the perl you are about to compile also as /usr/bin/perl
5416 (in addition to $installbin/perl).
5417 EOM
5418         case "$installusrbinperl" in
5419         "$undef"|[nN]*) dflt='n';;
5420         *)              dflt='y';;
5421         esac
5422         rp="Do you want to install perl as /usr/bin/perl?"
5423         . ./myread
5424         case "$ans" in
5425         [yY]*)  val="$define";;
5426         *)      val="$undef" ;;
5427         esac
5428 else
5429         val="$undef"
5430 fi
5431 set installusrbinperl
5432 eval $setvar
5433
5434 echo " "
5435 echo "Checking for GNU C Library..." >&4
5436 cat >gnulibc.c <<EOM
5437 #include <stdio.h>
5438 int main()
5439 {
5440 #ifdef __GLIBC__
5441     exit(0);
5442 #else
5443     exit(1);
5444 #endif
5445 }
5446 EOM
5447 set gnulibc
5448 if eval $compile_ok && ./gnulibc; then
5449         val="$define"
5450         echo "You are using the GNU C Library"
5451 else
5452         val="$undef"
5453         echo "You are not using the GNU C Library"
5454 fi
5455 $rm -f gnulibc*
5456 set d_gnulibc
5457 eval $setvar
5458
5459 : see if nm is to be used to determine whether a symbol is defined or not
5460 case "$usenm" in
5461 '')
5462         dflt=''
5463         case "$d_gnulibc" in
5464         "$define")
5465                 echo " "
5466                 echo "nm probably won't work on the GNU C Library." >&4
5467                 dflt=n
5468                 ;;
5469         esac
5470         case "$dflt" in
5471         '') 
5472                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5473                         echo " "
5474                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5475                         echo "'nm' won't be sufficient on this sytem." >&4
5476                         dflt=n
5477                 fi
5478                 ;;
5479         esac
5480         case "$dflt" in
5481         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5482                 if $test $dflt -gt 20; then
5483                         dflt=y
5484                 else
5485                         dflt=n
5486                 fi
5487                 ;;
5488         esac
5489         ;;
5490 *)
5491         case "$usenm" in
5492         true|$define) dflt=y;;
5493         *) dflt=n;;
5494         esac
5495         ;;
5496 esac
5497 $cat <<EOM
5498
5499 I can use $nm to extract the symbols from your C libraries. This
5500 is a time consuming task which may generate huge output on the disk (up
5501 to 3 megabytes) but that should make the symbols extraction faster. The
5502 alternative is to skip the 'nm' extraction part and to compile a small
5503 test program instead to determine whether each symbol is present. If
5504 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5505 this may be the best solution.
5506
5507 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5508
5509 EOM
5510 rp="Shall I use $nm to extract C symbols from the libraries?"
5511 . ./myread
5512 case "$ans" in
5513 [Nn]*) usenm=false;;
5514 *) usenm=true;;
5515 esac
5516
5517 runnm=$usenm
5518 case "$reuseval" in
5519 true) runnm=false;;
5520 esac
5521
5522 : nm options which may be necessary
5523 case "$nm_opt" in
5524 '') if $test -f /mach_boot; then
5525                 nm_opt=''       # Mach
5526         elif $test -d /usr/ccs/lib; then
5527                 nm_opt='-p'     # Solaris (and SunOS?)
5528         elif $test -f /dgux; then
5529                 nm_opt='-p'     # DG-UX
5530         elif $test -f /lib64/rld; then
5531                 nm_opt='-p'     # 64-bit Irix
5532         else
5533                 nm_opt=''
5534         fi;;
5535 esac
5536
5537 : nm options which may be necessary for shared libraries but illegal
5538 : for archive libraries.  Thank you, Linux.
5539 case "$nm_so_opt" in
5540 '')     case "$myuname" in
5541         *linux*)
5542                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5543                         nm_so_opt='--dynamic'
5544                 fi
5545                 ;;
5546         esac
5547         ;;
5548 esac
5549
5550 case "$runnm" in
5551 true)
5552 : get list of predefined functions in a handy place
5553 echo " "
5554 case "$libc" in
5555 '') libc=unknown
5556         case "$libs" in
5557         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5558         esac
5559         ;;
5560 esac
5561 libnames='';
5562 case "$libs" in
5563 '') ;;
5564 *)  for thislib in $libs; do
5565         case "$thislib" in
5566         -lc|-lc_s)
5567                 : Handle C library specially below.
5568                 ;;
5569         -l*)
5570                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5571                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5572                         :
5573                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5574                         :
5575                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5576                         :
5577                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5578                         :
5579                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5580                         :
5581                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5582                         :
5583                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5584                         :
5585                 else
5586                         try=''
5587                 fi
5588                 libnames="$libnames $try"
5589                 ;;
5590         *) libnames="$libnames $thislib" ;;
5591         esac
5592         done
5593         ;;
5594 esac
5595 xxx=normal
5596 case "$libc" in
5597 unknown)
5598         set /lib/libc.$so
5599         for xxx in $libpth; do
5600                 $test -r $1 || set $xxx/libc.$so
5601                 : The messy sed command sorts on library version numbers.
5602                 $test -r $1 || \
5603                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5604                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5605                                 h
5606                                 s/[0-9][0-9]*/0000&/g
5607                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5608                                 G
5609                                 s/\n/ /' | \
5610                          sort | $sed -e 's/^.* //'`
5611                 eval set \$$#
5612         done
5613         $test -r $1 || set /usr/ccs/lib/libc.$so
5614         $test -r $1 || set /lib/libsys_s$_a
5615         ;;
5616 *)
5617         set blurfl
5618         ;;
5619 esac
5620 if $test -r "$1"; then
5621         echo "Your (shared) C library seems to be in $1."
5622         libc="$1"
5623 elif $test -r /lib/libc && $test -r /lib/clib; then
5624         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5625         xxx=apollo
5626         libc='/lib/clib /lib/libc'
5627         if $test -r /lib/syslib; then
5628                 echo "(Your math library is in /lib/syslib.)"
5629                 libc="$libc /lib/syslib"
5630         fi
5631 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5632         echo "Your C library seems to be in $libc, as you said before."
5633 elif $test -r $incpath/usr/lib/libc$_a; then
5634         libc=$incpath/usr/lib/libc$_a;
5635         echo "Your C library seems to be in $libc.  That's fine."
5636 elif $test -r /lib/libc$_a; then
5637         libc=/lib/libc$_a;
5638         echo "Your C library seems to be in $libc.  You're normal."
5639 else
5640         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5641                 :
5642         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5643                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5644         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5645                 :
5646         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5647                 :
5648         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5649                 :
5650         else
5651                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5652         fi
5653         if $test -r "$tans"; then
5654                 echo "Your C library seems to be in $tans, of all places."
5655                 libc=$tans
5656         else
5657                 libc='blurfl'
5658         fi
5659 fi
5660 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5661         dflt="$libc"
5662         cat <<EOM
5663
5664 If the guess above is wrong (which it might be if you're using a strange
5665 compiler, or your machine supports multiple models), you can override it here.
5666
5667 EOM
5668 else
5669         dflt=''
5670         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5671         cat >&4 <<EOM
5672 I can't seem to find your C library.  I've looked in the following places:
5673
5674 EOM
5675         $sed 's/^/      /' libpath
5676         cat <<EOM
5677
5678 None of these seems to contain your C library. I need to get its name...
5679
5680 EOM
5681 fi
5682 fn=f
5683 rp='Where is your C library?'
5684 . ./getfile
5685 libc="$ans"
5686
5687 echo " "
5688 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5689 set X `cat libnames`
5690 shift
5691 xxx=files
5692 case $# in 1) xxx=file; esac
5693 echo "Extracting names from the following $xxx for later perusal:" >&4
5694 echo " "
5695 $sed 's/^/      /' libnames >&4
5696 echo " "
5697 $echo $n "This may take a while...$c" >&4
5698
5699 for file in $*; do
5700         case $file in
5701         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5702         *) $nm $nm_opt $file 2>/dev/null;;
5703         esac
5704 done >libc.tmp
5705
5706 $echo $n ".$c"
5707 $grep fprintf libc.tmp > libc.ptf
5708 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5709 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5710 xxx='[ADTSIW]'
5711 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5736                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5757         eval $xscan;\
5758         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5759                 eval $xrun
5760 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5761         eval $xscan;\
5762         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763                 eval $xrun
5764 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5765         eval $xscan;\
5766         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767                 eval $xrun
5768 else
5769         $nm -p $* 2>/dev/null >libc.tmp
5770         $grep fprintf libc.tmp > libc.ptf
5771         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5772                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5773         then
5774                 nm_opt='-p'
5775                 eval $xrun
5776         else
5777                 echo " "
5778                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5779                 com=''
5780                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5781                         for thisname in $libnames $libc; do
5782                                 $ar t $thisname >>libc.tmp
5783                         done
5784                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5785                         echo "Ok." >&4
5786                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5787                         # Repeat libc to extract forwarders to DLL entries too
5788                         for thisname in $libnames $libc; do
5789                                 $ar tv $thisname >>libc.tmp
5790                                 # Revision 50 of EMX has bug in $ar.
5791                                 # it will not extract forwarders to DLL entries
5792                                 # Use emximp which will extract exactly them.
5793                                 emximp -o tmp.imp $thisname \
5794                                     2>/dev/null && \
5795                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5796                                     < tmp.imp >>libc.tmp
5797                                 $rm tmp.imp
5798                         done
5799                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5800                         echo "Ok." >&4
5801                 else
5802                         echo "$ar didn't seem to work right." >&4
5803                         echo "Maybe this is a Cray...trying bld instead..." >&4
5804                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5805                         then
5806                                 for thisname in $libnames; do
5807                                         bld t $libnames | \
5808                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5809                                         $ar t $thisname >>libc.tmp
5810                                 done
5811                                 echo "Ok." >&4
5812                         else
5813                                 echo "That didn't work either.  Giving up." >&4
5814                                 exit 1
5815                         fi
5816                 fi
5817         fi
5818 fi
5819 nm_extract="$com"
5820 if $test -f /lib/syscalls.exp; then
5821         echo " "
5822         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5823         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5824 fi
5825 ;;
5826 esac
5827 $rm -f libnames libpath
5828
5829 : see if dld is available
5830 set dld.h i_dld
5831 eval $inhdr
5832
5833 : is a C symbol defined?
5834 csym='tlook=$1;
5835 case "$3" in
5836 -v) tf=libc.tmp; tc=""; tdc="";;
5837 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5838 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5839 esac;
5840 tx=yes;
5841 case "$reuseval-$4" in
5842 true-) ;;
5843 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5844 esac;
5845 case "$tx" in
5846 yes)
5847         case "$runnm" in
5848         true)
5849                 if $contains $tlook $tf >/dev/null 2>&1;
5850                 then tval=true;
5851                 else tval=false;
5852                 fi;;
5853         *)
5854                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5855                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5856                 then tval=true;
5857                 else tval=false;
5858                 fi;
5859                 $rm -f t t.c;;
5860         esac;;
5861 *)
5862         case "$tval" in
5863         $define) tval=true;;
5864         *) tval=false;;
5865         esac;;
5866 esac;
5867 eval "$2=$tval"'
5868
5869 : define an is-in-libc? function
5870 inlibc='echo " "; td=$define; tu=$undef;
5871 sym=$1; var=$2; eval "was=\$$2";
5872 tx=yes;
5873 case "$reuseval$was" in
5874 true) ;;
5875 true*) tx=no;;
5876 esac;
5877 case "$tx" in
5878 yes)
5879         set $sym tres -f;
5880         eval $csym;
5881         case "$tres" in
5882         true)
5883                 echo "$sym() found." >&4;
5884                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5885         *)
5886                 echo "$sym() NOT found." >&4;
5887                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5888         esac;;
5889 *)
5890         case "$was" in
5891         $define) echo "$sym() found." >&4;;
5892         *) echo "$sym() NOT found." >&4;;
5893         esac;;
5894 esac'
5895
5896 : see if dlopen exists
5897 xxx_runnm="$runnm"
5898 runnm=false
5899 set dlopen d_dlopen
5900 eval $inlibc
5901 runnm="$xxx_runnm"
5902
5903 : determine which dynamic loading, if any, to compile in
5904 echo " "
5905 dldir="ext/DynaLoader"
5906 case "$usedl" in
5907 $define|y|true)
5908         dflt='y'
5909         usedl="$define"
5910         ;;
5911 $undef|n|false)
5912         dflt='n'
5913         usedl="$undef"
5914         ;;
5915 *) 
5916         dflt='n'
5917         case "$d_dlopen" in
5918             $define) dflt='y' ;;
5919         esac
5920         case "$i_dld" in
5921             $define) dflt='y' ;;
5922         esac
5923         : Does a dl_xxx.xs file exist for this operating system
5924         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5925         ;;
5926 esac
5927 rp="Do you wish to use dynamic loading?"
5928 . ./myread
5929 usedl="$ans"
5930 case "$ans" in
5931 y*) usedl="$define"
5932         case "$dlsrc" in
5933         '')
5934                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5935                         dflt="$dldir/dl_${osname}.xs"
5936                 elif $test "$d_dlopen" = "$define" ; then
5937                         dflt="$dldir/dl_dlopen.xs"
5938                 elif $test "$i_dld" = "$define" ; then
5939                         dflt="$dldir/dl_dld.xs"
5940                 else
5941                         dflt=''
5942                 fi
5943                 ;;
5944         *)      dflt="$dldir/$dlsrc"
5945                 ;;
5946         esac
5947     echo "The following dynamic loading files are available:"
5948         : Can not go over to $dldir because getfile has path hard-coded in.
5949         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5950         rp="Source file to use for dynamic loading"
5951         fn="fne"
5952         gfpth="$src"
5953         . ./getfile
5954         usedl="$define"
5955         : emulate basename
5956         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5957
5958         $cat << EOM
5959
5960 Some systems may require passing special flags to $cc -c to
5961 compile modules that will be used to create a shared library.
5962 To use no flags, say "none".
5963
5964 EOM
5965     case "$cccdlflags" in
5966     '') case "$gccversion" in
5967                 '') case "$osname" in
5968                         hpux)   dflt='+z' ;;
5969                         next)   dflt='none' ;;
5970                         irix*)  dflt='-KPIC' ;;
5971                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5972                         sunos)  dflt='-pic' ;;
5973                         *)      dflt='none' ;;
5974                     esac
5975                         ;;
5976                 *)  case "$osname" in
5977                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5978                         *)      dflt='-fpic' ;;
5979                     esac ;;
5980             esac ;;
5981         ' ') dflt='none' ;;
5982     *)  dflt="$cccdlflags" ;;
5983     esac
5984     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5985     . ./myread
5986     case "$ans" in
5987     none) cccdlflags=' ' ;;
5988     *) cccdlflags="$ans" ;;
5989     esac
5990
5991     cat << EOM
5992
5993 Some systems use ld to create libraries that can be dynamically loaded,
5994 while other systems (such as those using ELF) use $cc.
5995
5996 EOM
5997         case "$ld" in
5998         '')     $cat >try.c <<'EOM'
5999 /* Test for whether ELF binaries are produced */
6000 #include <fcntl.h>
6001 #include <stdlib.h>
6002 int main() {
6003         char b[4];
6004         int i = open("a.out",O_RDONLY);
6005         if(i == -1) 
6006                 exit(1); /* fail */
6007         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6008                 exit(0); /* succeed (yes, it's ELF) */
6009         else
6010                 exit(1); /* fail */
6011 }
6012 EOM
6013                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6014                         cat <<EOM
6015 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6016 EOM
6017                         dflt="$cc"
6018                 else
6019                         echo "I'll use ld to build dynamic libraries."
6020                         dflt='ld'
6021                 fi
6022                 rm -f try.c a.out
6023                 ;;
6024         *)      dflt="$ld"
6025                 ;;
6026         esac
6027
6028     rp="What command should be used to create dynamic libraries?"
6029     . ./myread
6030         ld="$ans"
6031
6032     cat << EOM
6033
6034 Some systems may require passing special flags to $ld to create a
6035 library that can be dynamically loaded.  If your ld flags include
6036 -L/other/path options to locate libraries outside your loader's normal
6037 search path, you may need to specify those -L options here as well.  To
6038 use no flags, say "none".
6039
6040 EOM
6041     case "$lddlflags" in
6042     '') case "$osname" in
6043                         beos) dflt='-nostart' ;;
6044                         hpux)  dflt='-b' ;;
6045                         linux|irix*)    dflt='-shared' ;;
6046                         next)  dflt='none' ;;
6047                         solaris) dflt='-G' ;;
6048                         sunos) dflt='-assert nodefinitions' ;;
6049                         svr4*|esix*) dflt="-G $ldflags" ;;
6050                 *)     dflt='none' ;;
6051                         esac
6052                         ;;
6053     *) dflt="$lddlflags" ;;
6054     esac
6055
6056         : Try to guess additional flags to pick up local libraries.
6057         : Be careful not to append to a plain 'none'
6058         case "$dflt" in
6059         none) dflt='' ;;
6060         esac
6061         for thisflag in $ldflags; do
6062                 case "$thisflag" in
6063                 -L*)
6064                         case " $dflt " in
6065                         *" $thisflag "*) ;;
6066                         *) dflt="$dflt $thisflag" ;;
6067                         esac
6068                         ;;
6069                 esac
6070         done
6071
6072         case "$dflt" in
6073         ''|' ') dflt='none' ;;
6074         esac
6075
6076     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6077     . ./myread
6078     case "$ans" in
6079     none) lddlflags=' ' ;;
6080     *) lddlflags="$ans" ;;
6081     esac
6082
6083         cat <<EOM
6084
6085 Some systems may require passing special flags to $cc to indicate that
6086 the resulting executable will use dynamic linking.  To use no flags,
6087 say "none".
6088
6089 EOM
6090     case "$ccdlflags" in
6091     '') case "$osname" in
6092                 hpux)   dflt='-Wl,-E' ;;
6093                 linux)  dflt='-rdynamic' ;;
6094                 next)   dflt='none' ;;
6095                 sunos)  dflt='none' ;;
6096                 *)      dflt='none' ;;
6097             esac ;;
6098     ' ')  dflt='none' ;;
6099     *)  dflt="$ccdlflags" ;;
6100     esac
6101     rp="Any special flags to pass to $cc to use dynamic loading?"
6102     . ./myread
6103     case "$ans" in
6104     none) ccdlflags=' ' ;;
6105     *) ccdlflags="$ans" ;;
6106     esac
6107     ;;
6108 *)  usedl="$undef"
6109         ld='ld'
6110     dlsrc='dl_none.xs'
6111     lddlflags=''
6112     ccdlflags=''
6113     ;;
6114 esac
6115
6116 also=''
6117 case "$usedl" in
6118 $undef)
6119         # No dynamic loading being used, so don't bother even to prompt.
6120         useshrplib='false'
6121         ;;
6122 *)      case "$useshrplib" in
6123         '')     case "$osname" in
6124                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6125                         dflt=y
6126                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6127                         ;;
6128                 next*)
6129                         case "$osvers" in
6130                         4*)     dflt=y
6131                                 also='Building a shared libperl is needed for MAB support.'
6132                                 ;;
6133                         *)      dflt=n
6134                                 ;;
6135                         esac
6136                         ;;
6137                 *)      dflt=n
6138                         ;;
6139                 esac
6140                 ;;
6141         $define|true|[Yy]*)
6142                 dflt=y
6143                 ;;
6144         *)      dflt=n
6145                 ;;
6146         esac
6147         $cat << EOM
6148
6149 The perl executable is normally obtained by linking perlmain.c with
6150 libperl${_a}, any static extensions (usually just DynaLoader), and
6151 any other libraries needed on this system (such as -lm, etc.).  Since
6152 your system supports dynamic loading, it is probably possible to build
6153 a shared libperl.$so.  If you will have more than one executable linked
6154 to libperl.$so, this will significantly reduce the size of each
6155 executable, but it may have a noticeable affect on performance.  The
6156 default is probably sensible for your system.
6157 $also
6158
6159 EOM
6160         rp="Build a shared libperl.$so (y/n)"
6161         . ./myread
6162         case "$ans" in
6163         true|$define|[Yy]*)
6164                 useshrplib='true'  ;;
6165         *)      useshrplib='false' ;;
6166         esac
6167         ;;
6168 esac
6169
6170 case "$useshrplib" in
6171 true)
6172         case "$libperl" in
6173         '')
6174                 # Figure out a good name for libperl.so.  Since it gets stored in
6175                 # a version-specific architecture-dependent library, the version
6176                 # number isn't really that important, except for making cc/ld happy.
6177                 #
6178                 # A name such as libperl.so.3.1
6179                 majmin="libperl.$so.$patchlevel.$subversion"
6180                 # A name such as libperl.so.301
6181                 majonly=`echo $patchlevel $subversion |
6182                         $awk '{printf "%d%02d", $1, $2}'`
6183                 majonly=libperl.$so.$majonly
6184                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6185                 # rely on figuring it out from the naming of libc.
6186                 case "${osname}${osvers}" in
6187                 next4*)
6188                         dflt=libperl.5.$so
6189                         # XXX How handle the --version stuff for MAB?
6190                         ;;
6191                 linux*)  # ld won't link with a bare -lperl otherwise.
6192                         dflt=libperl.$so
6193                         ;;
6194                 cygwin*) # include version
6195                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6196                         ;;
6197                 *)      # Try to guess based on whether libc has major.minor.
6198                         case "$libc" in
6199                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6200                         *libc.$so.[0-9]*) dflt=$majonly ;;
6201                         *)      dflt=libperl.$so ;;
6202                         esac
6203                         ;;
6204                 esac
6205                 ;;
6206         *)      dflt=$libperl
6207                 ;;
6208         esac
6209         cat << EOM
6210
6211 I need to select a good name for the shared libperl.  If your system uses
6212 library names with major and minor numbers, then you might want something
6213 like $majmin.  Alternatively, if your system uses a single version
6214 number for shared libraries, then you might want to use $majonly.
6215 Or, your system might be quite happy with a simple libperl.$so.
6216
6217 Since the shared libperl will get installed into a version-specific
6218 architecture-dependent directory, the version number of the shared perl
6219 library probably isn't important, so the default should be o.k.
6220
6221 EOM
6222         rp='What name do you want to give to the shared libperl?'
6223         . ./myread
6224         libperl=$ans
6225         echo "Ok, I'll use $libperl"
6226         ;;
6227 *)
6228         libperl="libperl${_a}"
6229         ;;
6230 esac
6231
6232 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6233 case "$shrpdir" in
6234 '') ;;
6235 *)      $cat >&4 <<EOM
6236 WARNING:  Use of the shrpdir variable for the installation location of
6237 the shared $libperl is not supported.  It was never documented and
6238 will not work in this version.  Let me (perlbug@perl.com)
6239 know of any problems this may cause.
6240
6241 EOM
6242         case "$shrpdir" in
6243         "$archlibexp/CORE")
6244                 $cat >&4 <<EOM
6245 But your current setting of $shrpdir is
6246 the default anyway, so it's harmless.
6247 EOM
6248                 ;;
6249         *)
6250                 $cat >&4 <<EOM
6251 Further, your current attempted setting of $shrpdir
6252 conflicts with the value of $archlibexp/CORE
6253 that installperl will use.
6254 EOM
6255                 ;;
6256         esac
6257         ;;
6258 esac
6259
6260 # How will the perl executable find the installed shared $libperl?
6261 # Add $xxx to ccdlflags.
6262 # If we can't figure out a command-line option, use $shrpenv to
6263 # set env LD_RUN_PATH.  The main perl makefile uses this.
6264 shrpdir=$archlibexp/CORE
6265 xxx=''
6266 tmp_shrpenv=''
6267 if "$useshrplib"; then
6268     case "$osname" in 
6269         aix)
6270                 # We'll set it in Makefile.SH...
6271                 ;;
6272         solaris|netbsd)
6273                 xxx="-R $shrpdir"
6274                 ;;
6275         freebsd)
6276                 xxx="-Wl,-R$shrpdir"
6277                 ;;
6278         linux|irix*|dec_osf)
6279                 xxx="-Wl,-rpath,$shrpdir"
6280                 ;;
6281         next)
6282                 # next doesn't like the default...
6283                 ;;
6284         beos)
6285                 # beos doesn't like the default, either.
6286                 ;;
6287         hpux*)
6288                 # hpux doesn't like the default, either.
6289                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6290                 ;;
6291         *)
6292                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6293                 ;;
6294         esac
6295         case "$xxx" in
6296         '') ;;
6297         *)      
6298                 # Only add $xxx if it isn't already in ccdlflags.
6299                 case " $ccdlflags " in
6300                 *" $xxx "*)     ;;
6301                 *)      ccdlflags="$ccdlflags $xxx"
6302                         cat <<EOM >&4
6303
6304 Adding $xxx to the flags
6305 passed to $ld so that the perl executable will find the 
6306 installed shared $libperl.
6307
6308 EOM
6309                         ;;
6310                 esac
6311                 ;;
6312         esac
6313 fi
6314 # Fix ccdlflags in AIX for building external extensions.
6315 # (For building Perl itself bare -bE:perl.exp is needed,
6316 #  Makefile.SH takes care of this.)
6317 case "$osname" in
6318 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6319 esac
6320 # Respect a hint or command-line value.
6321 case "$shrpenv" in
6322 '') shrpenv="$tmp_shrpenv" ;;
6323 esac
6324 case "$ldlibpthname" in
6325 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6326 none)   ldlibpthname='' ;;
6327 esac
6328
6329 : determine where manual pages go
6330 set man1dir man1dir none
6331 eval $prefixit
6332 $cat <<EOM
6333
6334 $spackage has manual pages available in source form.
6335 EOM
6336 case "$nroff" in
6337 nroff)
6338         echo "However, you don't have nroff, so they're probably useless to you."
6339         case "$man1dir" in
6340         '') man1dir="none";;
6341         esac;;
6342 esac
6343 echo "If you don't want the manual sources installed, answer 'none'."
6344 case "$man1dir" in
6345 ' ') dflt=none
6346         ;;
6347 '')
6348         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6349         lookpath="$lookpath $prefixexp/man/p_man/man1"
6350         lookpath="$lookpath $prefixexp/man/u_man/man1"
6351         lookpath="$lookpath $prefixexp/man/man.1"
6352         case "$sysman" in
6353         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6354         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6355         esac
6356         set dflt
6357         eval $prefixup
6358         ;;
6359 *)  dflt="$man1dir"
6360         ;;
6361 esac
6362 echo " "
6363 fn=dn+~
6364 rp="Where do the main $spackage manual pages (source) go?"
6365 . ./getfile
6366 if $test "X$man1direxp" != "X$ansexp"; then
6367         installman1dir=''
6368 fi
6369 man1dir="$ans"
6370 man1direxp="$ansexp"
6371 case "$man1dir" in
6372 '')     man1dir=' '
6373         installman1dir='';;
6374 esac
6375
6376 : Change installation prefix, if necessary.
6377 if $test X"$prefix" != X"$installprefix"; then
6378         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6379 else
6380         installman1dir="$man1direxp"
6381 fi
6382
6383 : What suffix to use on installed man pages
6384
6385 case "$man1dir" in
6386 ' ')
6387         man1ext='0'
6388         ;;
6389 *)
6390         rp="What suffix should be used for the main $spackage man pages?"
6391         case "$man1ext" in
6392         '')     case "$man1dir" in
6393                 *1)  dflt=1 ;;
6394                 *1p) dflt=1p ;;
6395                 *1pm) dflt=1pm ;;
6396                 *l) dflt=l;;
6397                 *n) dflt=n;;
6398                 *o) dflt=o;;
6399                 *p) dflt=p;;
6400                 *C) dflt=C;;
6401                 *L) dflt=L;;
6402                 *L1) dflt=L1;;
6403                 *) dflt=1;;
6404                 esac
6405                 ;;
6406         *)      dflt="$man1ext";;
6407         esac
6408         . ./myread
6409         man1ext="$ans"
6410         ;;
6411 esac
6412
6413 : see if we can have long filenames
6414 echo " "
6415 rmlist="$rmlist /tmp/cf$$"
6416 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6417 first=123456789abcdef
6418 second=/tmp/cf$$/$first
6419 $rm -f $first $second
6420 if (echo hi >$first) 2>/dev/null; then
6421         if $test -f 123456789abcde; then
6422                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6423                 val="$undef"
6424         else
6425                 if (echo hi >$second) 2>/dev/null; then
6426                         if $test -f /tmp/cf$$/123456789abcde; then
6427                                 $cat <<'EOM'
6428 That's peculiar... You can have filenames longer than 14 characters, but only
6429 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6430 I shall consider your system cannot support long filenames at all.
6431 EOM
6432                                 val="$undef"
6433                         else
6434                                 echo 'You can have filenames longer than 14 characters.' >&4
6435                                 val="$define"
6436                         fi
6437                 else
6438                         $cat <<'EOM'
6439 How confusing! Some of your filesystems are sane enough to allow filenames
6440 longer than 14 characters but some others like /tmp can't even think about them.
6441 So, for now on, I shall assume your kernel does not allow them at all.
6442 EOM
6443                         val="$undef"
6444                 fi
6445         fi
6446 else
6447         $cat <<'EOM'
6448 You can't have filenames longer than 14 chars.  You can't even think about them!
6449 EOM
6450         val="$undef"
6451 fi 
6452 set d_flexfnam
6453 eval $setvar
6454 $rm -rf /tmp/cf$$ 123456789abcde*
6455
6456 : determine where library module manual pages go
6457 set man3dir man3dir none
6458 eval $prefixit
6459 $cat <<EOM
6460
6461 $spackage has manual pages for many of the library modules.
6462 EOM
6463
6464 case "$nroff" in
6465 nroff)
6466         $cat <<'EOM'
6467 However, you don't have nroff, so they're probably useless to you.
6468 EOM
6469         case "$man3dir" in
6470         '') man3dir="none";;
6471         esac;;
6472 esac
6473
6474 case "$d_flexfnam" in
6475 undef)
6476         $cat <<'EOM'
6477 However, your system can't handle the long file names like File::Basename.3. 
6478 EOM
6479         case "$man3dir" in
6480         '') man3dir="none";;
6481         esac;;
6482 esac
6483
6484 echo "If you don't want the manual sources installed, answer 'none'."
6485 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6486 case "$man3dir" in
6487 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6488         if $test -d "$privlib/man/man3"; then
6489                 cat <<EOM >&4
6490
6491 WARNING:  Previous versions of perl installed man3 pages into
6492 $privlib/man/man3.  This version will suggest a 
6493 new default of $dflt.  
6494 EOM
6495                 tdflt=$dflt
6496                 dflt='n'
6497                 rp='Do you wish to preserve the old behavior?(y/n)'
6498                 . ./myread
6499                 case "$ans" in
6500                 y*) dflt="$privlib/man/man3" ;;
6501                 *)  dflt=$tdflt ;;
6502                 esac
6503     fi
6504         ;;
6505 ' ') dflt=none;;
6506 *)      dflt="$man3dir" ;;
6507 esac
6508 echo " "
6509 fn=dn+~
6510 rp="Where do the $package library man pages (source) go?"
6511 . ./getfile
6512 man3dir="$ans"
6513 man3direxp="$ansexp"
6514 case "$man1dir" in
6515 '')     man3dir=' '
6516         installman3dir='';;
6517 esac
6518
6519 : Change installation prefix, if necessary.
6520 if $test X"$prefix" != X"$installprefix"; then
6521         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6522 else
6523         installman3dir="$man3direxp"
6524 fi
6525
6526 : What suffix to use on installed man pages
6527 case "$man3dir" in
6528 ' ')
6529         man3ext='0'
6530         ;;
6531 *)
6532         rp="What suffix should be used for the $package library man pages?"
6533         case "$man3ext" in
6534         '')     case "$man3dir" in
6535                 *3)  dflt=3 ;;
6536                 *3p) dflt=3p ;;
6537                 *3pm) dflt=3pm ;;
6538                 *l) dflt=l;;
6539                 *n) dflt=n;;
6540                 *o) dflt=o;;
6541                 *p) dflt=p;;
6542                 *C) dflt=C;;
6543                 *L) dflt=L;;
6544                 *L3) dflt=L3;;
6545                 *) dflt=3;;
6546                 esac
6547                 ;;
6548         *)      dflt="$man3ext";;
6549         esac
6550         . ./myread
6551         man3ext="$ans"
6552         ;;
6553 esac
6554
6555 : see if we have to deal with yellow pages, now NIS.
6556 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6557         if $test -f /usr/etc/nibindd; then
6558                 echo " "
6559                 echo "I'm fairly confident you're on a NeXT."
6560                 echo " "
6561                 rp='Do you get the hosts file via NetInfo?'
6562                 dflt=y
6563                 case "$hostcat" in
6564                 nidump*) ;;
6565                 '') ;;
6566                 *) dflt=n;;
6567                 esac
6568                 . ./myread
6569                 case "$ans" in
6570                 y*) hostcat='nidump hosts .';;
6571                 *)      case "$hostcat" in
6572                         nidump*) hostcat='';;
6573                         esac
6574                         ;;
6575                 esac
6576         fi
6577         case "$hostcat" in
6578         nidump*) ;;
6579         *)
6580                 case "$hostcat" in
6581                 *ypcat*) dflt=y;;
6582                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6583                                 dflt=y
6584                         else
6585                                 dflt=n
6586                         fi;;
6587                 *) dflt=n;;
6588                 esac
6589                 echo " "
6590                 rp='Are you getting the hosts file via yellow pages?'
6591                 . ./myread
6592                 case "$ans" in
6593                 y*) hostcat='ypcat hosts';;
6594                 *) hostcat='cat /etc/hosts';;
6595                 esac
6596                 ;;
6597         esac
6598 fi
6599 case "$hostcat" in
6600 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6601 esac
6602 case "$groupcat" in
6603 '') test -f /etc/group && groupcat='cat /etc/group';;
6604 esac
6605 case "$passcat" in
6606 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6607 esac
6608
6609 : now get the host name
6610 echo " "
6611 echo "Figuring out host name..." >&4
6612 case "$myhostname" in
6613 '') cont=true
6614         echo 'Maybe "hostname" will work...'
6615         if tans=`sh -c hostname 2>&1` ; then
6616                 myhostname=$tans
6617                 phostname=hostname
6618                 cont=''
6619         fi
6620         ;;
6621 *) cont='';;
6622 esac
6623 if $test "$cont"; then
6624         if ./xenix; then
6625                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6626                 if tans=`cat /etc/systemid 2>&1` ; then
6627                         myhostname=$tans
6628                         phostname='cat /etc/systemid'
6629                         echo "Whadyaknow.  Xenix always was a bit strange..."
6630                         cont=''
6631                 fi
6632         elif $test -r /etc/systemid; then
6633                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6634         fi
6635 fi
6636 if $test "$cont"; then
6637         echo 'No, maybe "uuname -l" will work...'
6638         if tans=`sh -c 'uuname -l' 2>&1` ; then
6639                 myhostname=$tans
6640                 phostname='uuname -l'
6641         else
6642                 echo 'Strange.  Maybe "uname -n" will work...'
6643                 if tans=`sh -c 'uname -n' 2>&1` ; then
6644                         myhostname=$tans
6645                         phostname='uname -n'
6646                 else
6647                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6648                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6649                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6650                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6651                         else
6652                                 case "$myhostname" in
6653                                 '') echo "Does this machine have an identity crisis or something?"
6654                                         phostname='';;
6655                                 *)
6656                                         echo "Well, you said $myhostname before..."
6657                                         phostname='echo $myhostname';;
6658                                 esac
6659                         fi
6660                 fi
6661         fi
6662 fi
6663 : you do not want to know about this
6664 set $myhostname
6665 myhostname=$1
6666
6667 : verify guess
6668 if $test "$myhostname" ; then
6669         dflt=y
6670         rp='Your host name appears to be "'$myhostname'".'" Right?"
6671         . ./myread
6672         case "$ans" in
6673         y*) ;;
6674         *) myhostname='';;
6675         esac
6676 fi
6677
6678 : bad guess or no guess
6679 while $test "X$myhostname" = X ; do
6680         dflt=''
6681         rp="Please type the (one word) name of your host:"
6682         . ./myread
6683         myhostname="$ans"
6684 done
6685
6686 : translate upper to lower if necessary
6687 case "$myhostname" in
6688 *[A-Z]*)
6689         echo "(Normalizing case in your host name)"
6690         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6691         ;;
6692 esac
6693
6694 case "$myhostname" in
6695 *.*)
6696         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6697         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6698         echo "(Trimming domain name from host name--host name is now $myhostname)"
6699         ;;
6700 *) case "$mydomain" in
6701         '')
6702                 {
6703                         test "X$hostcat" = "Xypcat hosts" &&
6704                         ypmatch "$myhostname" hosts 2>/dev/null |\
6705                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6706                         $test -s hosts
6707                 } || {
6708                         test "X$hostcat" != "X" &&
6709                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6710                                         /[       ]$myhostname[  . ]/p" > hosts
6711                 }
6712                 tmp_re="[       . ]"
6713                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6714                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6715                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6716                         hosts | $sort | $uniq | \
6717                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6718                 case `$echo X$dflt` in
6719                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6720                         dflt=.
6721                         ;;
6722                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6723                         ;;
6724                 esac
6725                 case "$dflt" in
6726                 .)
6727                         tans=`./loc resolv.conf X /etc /usr/etc`
6728                         if $test -f "$tans"; then
6729                                 echo "(Attempting domain name extraction from $tans)"
6730                                 dflt=.`$sed -n -e 's/   / /g' \
6731                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6732                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6733                                 case "$dflt" in
6734                                 .) dflt=.`$sed -n -e 's/        / /g' \
6735                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6736                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6737                                         ;;
6738                                 esac
6739                         fi
6740                         ;;
6741                 esac
6742                 case "$dflt" in
6743                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6744                         dflt=.`sh -c domainname 2>/dev/null`
6745                         case "$dflt" in
6746                         '') dflt='.';;
6747                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6748                         esac
6749                         ;;
6750                 esac
6751                 case "$dflt" in
6752                 .) echo "(Lost all hope -- silly guess then)"
6753                         dflt='.uucp'
6754                         ;;
6755                 esac
6756                 $rm -f hosts
6757                 ;;
6758         *) dflt="$mydomain";;
6759         esac;;
6760 esac
6761 echo " "
6762 rp="What is your domain name?"
6763 . ./myread
6764 tans="$ans"
6765 case "$ans" in
6766 '') ;;
6767 .*) ;;
6768 *) tans=".$tans";;
6769 esac
6770 mydomain="$tans"
6771
6772 : translate upper to lower if necessary
6773 case "$mydomain" in
6774 *[A-Z]*)
6775         echo "(Normalizing case in your domain name)"
6776         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6777         ;;
6778 esac
6779
6780 : a little sanity check here
6781 case "$phostname" in
6782 '') ;;
6783 *)
6784         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6785         $myhostname$mydomain|$myhostname) ;;
6786         *)
6787                 case "$phostname" in
6788                 sed*)
6789                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6790                         ;;
6791                 *)
6792                         echo "(That doesn't agree with your $phostname command, by the way.)"
6793                         ;;
6794                 esac
6795         ;;
6796         esac
6797         ;;
6798 esac
6799
6800 $cat <<EOM
6801
6802 I need to get your e-mail address in Internet format if possible, i.e.
6803 something like user@host.domain. Please answer accurately since I have
6804 no easy means to double check it. The default value provided below
6805 is most probably close to the reality but may not be valid from outside
6806 your organization...
6807
6808 EOM
6809 cont=x
6810 while test "$cont"; do
6811         case "$cf_email" in
6812         '') dflt="$cf_by@$myhostname$mydomain";;
6813         *) dflt="$cf_email";;
6814         esac
6815         rp='What is your e-mail address?'
6816         . ./myread
6817         cf_email="$ans"
6818         case "$cf_email" in
6819         *@*.*) cont='' ;;
6820         *)
6821                 rp='Address does not look like an Internet one.  Use it anyway?'
6822                 case "$fastread" in
6823                 yes) dflt=y ;;
6824                 *) dflt=n ;;
6825                 esac
6826                 . ./myread
6827                 case "$ans" in
6828                 y*) cont='' ;;
6829                 *) echo " " ;;
6830                 esac
6831                 ;;
6832         esac
6833 done
6834
6835 $cat <<EOM
6836
6837 If you or somebody else will be maintaining perl at your site, please
6838 fill in the correct e-mail address here so that they may be contacted
6839 if necessary. Currently, the "perlbug" program included with perl
6840 will send mail to this address in addition to perlbug@perl.com. You may
6841 enter "none" for no administrator.
6842
6843 EOM
6844 case "$perladmin" in
6845 '') dflt="$cf_email";;
6846 *) dflt="$perladmin";;
6847 esac
6848 rp='Perl administrator e-mail address'
6849 . ./myread
6850 perladmin="$ans"
6851
6852 : figure out how to guarantee perl startup
6853 case "$startperl" in
6854 '')
6855         case "$sharpbang" in
6856         *!)
6857                 $cat <<EOH
6858
6859 I can use the #! construct to start perl on your system. This will
6860 make startup of perl scripts faster, but may cause problems if you
6861 want to share those scripts and perl is not in a standard place
6862 ($binexp/perl) on all your platforms. The alternative is to force
6863 a shell by starting the script with a single ':' character.
6864
6865 EOH
6866                 dflt="$binexp/perl"
6867                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6868                 . ./myread
6869                 case "$ans" in
6870                 none)   startperl=": # use perl";;
6871                 *)      startperl="#!$ans"
6872                         if $test 30 -lt `echo "$ans" | wc -c`; then
6873                                 $cat >&4 <<EOM
6874
6875 WARNING:  Some systems limit the #! command to 32 characters.
6876 If you experience difficulty running Perl scripts with #!, try
6877 installing Perl in a directory with a shorter pathname.
6878
6879 EOM
6880                         fi ;;
6881                 esac
6882                 ;;
6883         *) startperl=": # use perl"
6884                 ;;
6885         esac
6886         ;;
6887 esac
6888 echo "I'll use $startperl to start perl scripts."
6889
6890 : figure best path for perl in scripts
6891 case "$perlpath" in
6892 '')
6893         perlpath="$binexp/perl"
6894         case "$startperl" in
6895         *!*) ;;
6896         *)
6897                 $cat <<EOH
6898
6899 I will use the "eval 'exec'" idiom to start Perl on your system.
6900 I can use the full path of your Perl binary for this purpose, but
6901 doing so may cause problems if you want to share those scripts and
6902 Perl is not always in a standard place ($binexp/perl).
6903
6904 EOH
6905                 dflt="$binexp/perl"
6906                 rp="What path shall I use in \"eval 'exec'\"?"
6907                 . ./myread
6908                 perlpath="$ans"
6909                 ;;
6910         esac
6911         ;;
6912 esac
6913 case "$startperl" in
6914 *!*)    ;;
6915 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6916 esac
6917
6918 : determine where public executable scripts go
6919 set scriptdir scriptdir
6920 eval $prefixit
6921 case "$scriptdir" in
6922 '')
6923         dflt="$bin"
6924         : guess some guesses
6925         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6926         $test -d /usr/share/bin     && dflt=/usr/share/bin
6927         $test -d /usr/local/script  && dflt=/usr/local/script
6928         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6929         $test -d $prefixexp/script  && dflt=$prefixexp/script
6930         set dflt
6931         eval $prefixup
6932         ;;
6933 *)  dflt="$scriptdir"
6934         ;;
6935 esac
6936 $cat <<EOM
6937  
6938 Some installations have a separate directory just for executable scripts so
6939 that they can mount it across multiple architectures but keep the scripts in
6940 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6941 Or you might just lump your scripts in with all your other executables.
6942  
6943 EOM
6944 fn=d~
6945 rp='Where do you keep publicly executable scripts?'
6946 . ./getfile
6947 if $test "X$ansexp" != "X$scriptdirexp"; then
6948         installscript=''
6949 fi
6950 scriptdir="$ans"
6951 scriptdirexp="$ansexp"
6952 : Change installation prefix, if necessary.
6953 if $test X"$prefix" != X"$installprefix"; then
6954         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6955 else
6956         installscript="$scriptdirexp"
6957 fi
6958
6959 : determine where site specific architecture-dependent libraries go.
6960 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6961 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6962 : sitelib may have an optional trailing /share.
6963 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6964 tdflt="$tdflt/$archname"
6965 set sitearch sitearch none
6966 eval $prefixit
6967 case "$sitearch" in
6968 '')     dflt="$tdflt" ;;
6969 *)      dflt="$sitearch" ;;
6970 esac
6971 $cat <<EOM
6972
6973 The installation process will also create a directory for
6974 architecture-dependent site-specific extensions and modules.
6975
6976 EOM
6977 fn=nd~+
6978 rp='Pathname for the site-specific architecture-dependent library files?'
6979 . ./getfile
6980 sitearch="$ans"
6981 sitearchexp="$ansexp"
6982 : Change installation prefix, if necessary.
6983 if $test X"$prefix" != X"$installprefix"; then
6984         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6985 else
6986         installsitearch="$sitearchexp"
6987 fi
6988
6989 : determine where add-on public executables go
6990 case "$sitebin" in
6991 '')     dflt=$siteprefix/bin ;;
6992 *)      dflt=$sitebin ;;
6993 esac
6994 fn=d~
6995 rp='Pathname where the add-on public executables should be installed?'
6996 . ./getfile
6997 sitebin="$ans"
6998 sitebinexp="$ansexp"
6999 : Change installation prefix, if necessary.
7000 if $test X"$prefix" != X"$installprefix"; then
7001         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7002 else
7003         installsitebin="$sitebinexp"
7004 fi
7005
7006 cat <<EOM
7007
7008 Perl can be built to take advantage of long doubles which
7009 (if available) may give more accuracy and range for floating point numbers.
7010
7011 If this doesn't make any sense to you, just accept the default 'n'.
7012 EOM
7013
7014 case "$ccflags" in
7015 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7016 esac
7017
7018 case "$uselongdouble" in
7019 $define|true|[yY]*)     dflt='y';;
7020 *) dflt='n';;
7021 esac
7022 rp='Try to use long doubles if available?'
7023 . ./myread
7024 case "$ans" in
7025 y|Y)    val="$define"   ;;
7026 *)      val="$undef"    ;;
7027 esac
7028 set uselongdouble
7029 eval $setvar
7030
7031 case "$uselongdouble" in
7032 true|[yY]*) uselongdouble="$define" ;;
7033 esac
7034
7035 case "$uselongdouble" in
7036 $define)
7037 : Look for a hint-file generated 'call-back-unit'.  If the
7038 : user has specified that long doubles should be used,
7039 : we may need to set or change some other defaults.
7040         if $test -f uselongdouble.cbu; then
7041                 echo "Your platform has some specific hints for long doubles, using them..."
7042                 . ./uselongdouble.cbu
7043         else
7044                 $cat <<EOM
7045 (Your platform doesn't have any specific hints for long doubles.)
7046 EOM
7047         fi
7048         ;;
7049 esac
7050
7051 cat <<EOM
7052
7053 Perl can be built to take advantage of long longs which
7054 (if available) may give more range for integer numbers.
7055
7056 If this doesn't make any sense to you, just accept the default 'n'.
7057 EOM
7058
7059 case "$ccflags" in
7060 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7061 esac
7062
7063 case "$uselonglong" in
7064 $define|true|[yY]*)     dflt='y';;
7065 *) dflt='n';;
7066 esac
7067 rp='Try to use long longs if available?'
7068 . ./myread
7069 case "$ans" in
7070 y|Y)    val="$define"   ;;
7071 *)      val="$undef"    ;;
7072 esac
7073 set uselonglong
7074 eval $setvar
7075
7076 case "$uselonglong" in
7077 true|[yY]*) uselonglong="$define" ;;
7078 esac
7079
7080 case "$uselonglong" in
7081 $define)
7082 : Look for a hint-file generated 'call-back-unit'.  If the
7083 : user has specified that long longs should be used,
7084 : we may need to set or change some other defaults.
7085         if $test -f uselonglong.cbu; then
7086                 echo "Your platform has some specific hints for long longs, using them..."
7087                 . ./uselonglong.cbu
7088         else
7089                 $cat <<EOM
7090 (Your platform doesn't have any specific hints for long longs.)
7091 EOM
7092         fi
7093         ;;
7094 esac
7095
7096 cat <<EOM
7097
7098 Previous version of $package used the standard IO mechanisms as defined
7099 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7100 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7101 the default.  This abstraction layer can use AT&T's sfio (if you already
7102 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7103 problems with some extension modules.  Using PerlIO with stdio is safe,
7104 but it is slower than plain stdio and therefore is not the default.
7105
7106 If this doesn't make any sense to you, just accept the default 'n'.
7107 EOM
7108 case "$useperlio" in
7109 $define|true|[yY]*)     dflt='y';;
7110 *) dflt='n';;
7111 esac
7112 rp='Use the experimental PerlIO abstraction layer?'
7113 . ./myread
7114 case "$ans" in
7115 y|Y) 
7116         val="$define"
7117         ;;     
7118 *)      
7119         echo "Ok, doing things the stdio way"
7120         val="$undef"
7121         ;;
7122 esac
7123 set useperlio
7124 eval $setvar 
7125
7126 case "$vendorprefix" in
7127 '')     d_vendorbin="$undef"
7128         vendorbin=''
7129         vendorbinexp=''
7130         ;;
7131 *)      d_vendorbin="$define"
7132         : determine where vendor-supplied executables go.
7133         dflt=$vendorprefix/bin
7134         fn=d~+
7135         rp='Pathname for the vendor-supplied executables directory?'
7136         . ./getfile
7137         vendorbin="$ans"
7138         vendorbinexp="$ansexp"
7139         : Change installation prefix, if necessary.
7140         if $test X"$prefix" != X"$installprefix"; then
7141                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7142         else
7143                 installvendorbin="$vendorbinexp"
7144         fi
7145         ;;
7146 esac
7147
7148 : check for length of double
7149 echo " "
7150 case "$doublesize" in
7151 '')
7152         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7153         $cat >try.c <<'EOCP'
7154 #include <stdio.h>
7155 int main()
7156 {
7157     printf("%d\n", (int)sizeof(double));
7158     exit(0);
7159 }
7160 EOCP
7161         set try
7162         if eval $compile_ok; then
7163                 doublesize=`./try`
7164                 $echo " $doublesize bytes." >&4
7165         else
7166                 dflt='8'
7167                 echo "(I can't seem to compile the test program.  Guessing...)"
7168                 rp="What is the size of a double precision number (in bytes)?"
7169                 . ./myread
7170                 doublesize="$ans"
7171         fi
7172         ;;
7173 esac
7174 $rm -f try.c try
7175
7176 : check for long doubles
7177 echo " "
7178 $echo $n "Checking to see if your system supports long double..." $c >&4
7179 echo 'int main() { long double x = 7.0; }' > try.c
7180 set try
7181 if eval $compile; then
7182         val="$define"
7183         echo " Yes, it does." >&4
7184 else
7185         val="$undef"
7186         echo " No, it doesn't." >&4
7187 fi
7188 $rm try.*
7189 set d_longdbl
7190 eval $setvar
7191
7192 : check for length of long double
7193 case "${d_longdbl}${longdblsize}" in
7194 $define)
7195         echo " "
7196         $echo $n "Checking to see how big your long doubles are..." $c >&4
7197         $cat >try.c <<'EOCP'
7198 #include <stdio.h>
7199 int main()
7200 {
7201         printf("%d\n", sizeof(long double));
7202 }
7203 EOCP
7204         set try
7205         set try
7206         if eval $compile; then
7207                 longdblsize=`./try$exe_ext`
7208                 $echo " $longdblsize bytes." >&4
7209         else
7210                 dflt='8'
7211                 echo " "
7212                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7213                 rp="What is the size of a long double (in bytes)?"
7214                 . ./myread
7215                 longdblsize="$ans"
7216         fi
7217         if $test "X$doublesize" = "X$longdblsize"; then
7218                 echo "(That isn't any different from an ordinary double.)"
7219         fi      
7220         ;;
7221 esac
7222 $rm -f try.* try
7223
7224 : Check how to convert floats to strings.
7225 if test "X$d_Gconvert" = X; then
7226         echo " "
7227         echo "Checking for an efficient way to convert floats to strings."
7228         $cat >try.c <<EOP
7229 #ifdef TRY_gconvert
7230 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7231 char *myname = "gconvert";
7232 #endif
7233 #ifdef TRY_gcvt
7234 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7235 char *myname = "gcvt";
7236 #endif
7237 #ifdef TRY_qgcvt
7238 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7239 char *myname = "qgcvt";
7240 #define DOUBLETYPE long double
7241 #endif
7242 #ifdef TRY_sprintf
7243 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7244 char *myname = "sprintf";
7245 #endif
7246
7247 #ifndef DOUBLETYPE
7248 #define DOUBLETYPE double
7249 #endif
7250
7251 #include <stdio.h>
7252
7253 #ifdef I_STDLIB
7254 #include <stdlib.h>
7255 #endif
7256
7257 int
7258 checkit(expect, got)
7259 char *expect;
7260 char *got;
7261 {
7262     if (strcmp(expect, got)) {
7263                 printf("%s oddity:  Expected %s, got %s\n",
7264                         myname, expect, got);
7265                 exit(1);
7266         }
7267 }
7268
7269 int main()
7270
7271         char buf[64]; 
7272         buf[63] = '\0';
7273
7274         /* This must be 1st test on (which?) platform */
7275         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7276         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7277         checkit("0.1", buf);
7278
7279         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7280         checkit("1", buf);
7281
7282         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7283         checkit("0", buf);
7284
7285         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7286         checkit("-1", buf);
7287
7288         /* Some Linux gcvt's give 1.e+5 here. */
7289         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7290         checkit("100000", buf);
7291         
7292         /* Some Linux gcvt's give -1.e+5 here. */
7293         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7294         checkit("-100000", buf);
7295
7296         exit(0);
7297 }
7298 EOP
7299         case "$d_Gconvert" in
7300         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7301         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7302         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7303         *) xxx_list='gconvert gcvt sprintf' ;;
7304         esac
7305
7306         case "$d_longdbl$uselongdouble" in
7307         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7308         esac
7309
7310         for xxx_convert in $xxx_list; do
7311                 echo "Trying $xxx_convert..."
7312                 $rm -f try try$_o
7313                 set try -DTRY_$xxx_convert
7314                 if eval $compile; then
7315                         echo "$xxx_convert() found." >&4
7316                         if ./try; then
7317                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7318                                 break;
7319                         else
7320                                 echo "...But $xxx_convert didn't work as I expected."
7321                         fi
7322                 else
7323                         echo "$xxx_convert NOT found." >&4
7324                 fi
7325         done
7326                 
7327         case "$xxx_convert" in
7328         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7329         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7330         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7331         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7332         esac
7333 fi
7334
7335 echo " "
7336
7337 if $test X"$d_longdbl" = X"$define"; then
7338
7339 echo "Checking how to print long doubles..." >&4
7340
7341 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7342         $cat >try.c <<'EOCP'
7343 #include <sys/types.h>
7344 #include <stdio.h>
7345 int main() {
7346   double d = 123.456;
7347   printf("%.3f\n", d);
7348 }
7349 EOCP
7350         set try
7351         if eval $compile; then
7352                 yyy=`./try$exe_ext`
7353                 case "$yyy" in
7354                 123.456)
7355                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7356                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7357                         echo "We will use %f."
7358                         ;;
7359                 esac
7360         fi
7361 fi
7362
7363 if $test X"$sPRIfldbl" = X; then
7364         $cat >try.c <<'EOCP'
7365 #include <sys/types.h>
7366 #include <stdio.h>
7367 int main() {
7368   long double d = 123.456;
7369   printf("%.3llf\n", d);
7370 }
7371 EOCP
7372         set try
7373         if eval $compile; then
7374                 yyy=`./try$exe_ext`
7375                 case "$yyy" in
7376                 123.456)
7377                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7378                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7379                         echo "We will use %llf."
7380                         ;;
7381                 esac
7382         fi
7383 fi
7384
7385 if $test X"$sPRIfldbl" = X; then
7386         $cat >try.c <<'EOCP'
7387 #include <sys/types.h>
7388 #include <stdio.h>
7389 int main() {
7390   long double d = 123.456;
7391   printf("%.3Lf\n", d);
7392 }
7393 EOCP
7394         set try
7395         if eval $compile; then
7396                 yyy=`./try$exe_ext`
7397                 case "$yyy" in
7398                 123.456)
7399                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7400                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7401                         echo "We will use %Lf."
7402                         ;;
7403                 esac
7404         fi
7405 fi
7406
7407 if $test X"$sPRIfldbl" = X; then
7408         $cat >try.c <<'EOCP'
7409 #include <sys/types.h>
7410 #include <stdio.h>
7411 int main() {
7412   long double d = 123.456;
7413   printf("%.3lf\n", d);
7414 }
7415 EOCP
7416         set try
7417         if eval $compile; then
7418                 yyy=`./try$exe_ext`
7419                 case "$yyy" in
7420                 123.456)
7421                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7422                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7423                         echo "We will use %lf."
7424                         ;;
7425                 esac
7426         fi
7427 fi
7428
7429 if $test X"$sPRIfldbl" = X; then
7430         echo "Cannot figure out how to print long doubles." >&4
7431 fi
7432
7433 $rm -f try try.*
7434
7435 fi # d_longdbl
7436
7437 case "$sPRIfldbl" in
7438 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7439         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7440         ;;
7441 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7442         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7443         ;;
7444 esac
7445
7446 : Initialize h_fcntl
7447 h_fcntl=false
7448
7449 : Initialize h_sysfile
7450 h_sysfile=false
7451
7452 : access call always available on UNIX
7453 set access d_access
7454 eval $inlibc
7455
7456 : locate the flags for 'access()'
7457 case "$d_access" in
7458 "$define")
7459         echo " "
7460         $cat >access.c <<'EOCP'
7461 #include <sys/types.h>
7462 #ifdef I_FCNTL
7463 #include <fcntl.h>
7464 #endif
7465 #ifdef I_SYS_FILE
7466 #include <sys/file.h>
7467 #endif
7468 #ifdef I_UNISTD
7469 #include <unistd.h>
7470 #endif
7471 int main() {
7472         exit(R_OK);
7473 }
7474 EOCP
7475         : check sys/file.h first, no particular reason here
7476         if $test `./findhdr sys/file.h` && \
7477                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7478                 h_sysfile=true;
7479                 echo "<sys/file.h> defines the *_OK access constants." >&4
7480         elif $test `./findhdr fcntl.h` && \
7481                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7482                 h_fcntl=true;
7483                 echo "<fcntl.h> defines the *_OK access constants." >&4
7484         elif $test `./findhdr unistd.h` && \
7485                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7486                 echo "<unistd.h> defines the *_OK access constants." >&4
7487         else
7488                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7489         fi
7490         ;;
7491 esac
7492 $rm -f access*
7493
7494 : see if accessx exists
7495 set accessx d_accessx
7496 eval $inlibc
7497
7498 : see if alarm exists
7499 set alarm d_alarm
7500 eval $inlibc
7501
7502 : see if atolf exists
7503 set atolf d_atolf
7504 eval $inlibc
7505
7506 : see if atoll exists
7507 set atoll d_atoll
7508 eval $inlibc
7509
7510 : Look for GNU-cc style attribute checking
7511 echo " "
7512 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7513 $cat >attrib.c <<'EOCP'
7514 #include <stdio.h>
7515 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7516 EOCP
7517 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7518         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7519                 echo "Your C compiler doesn't fully support __attribute__."
7520                 val="$undef"
7521         else
7522                 echo "Your C compiler supports __attribute__."
7523                 val="$define"
7524         fi
7525 else
7526         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7527         val="$undef"
7528 fi
7529 set d_attribut
7530 eval $setvar
7531 $rm -f attrib*
7532
7533 : see if bcmp exists
7534 set bcmp d_bcmp
7535 eval $inlibc
7536
7537 : see if bcopy exists
7538 set bcopy d_bcopy
7539 eval $inlibc
7540
7541 : see if this is a unistd.h system
7542 set unistd.h i_unistd
7543 eval $inhdr
7544
7545 : see if getpgrp exists
7546 set getpgrp d_getpgrp
7547 eval $inlibc
7548
7549 case "$d_getpgrp" in
7550 "$define")
7551         echo " "
7552         echo "Checking to see which flavor of getpgrp is in use..."
7553         $cat >set.c <<EOP
7554 #$i_unistd I_UNISTD
7555 #include <sys/types.h>
7556 #ifdef I_UNISTD
7557 #  include <unistd.h>
7558 #endif
7559 int main()
7560 {
7561         if (getuid() == 0) {
7562                 printf("(I see you are running Configure as super-user...)\n");
7563                 setuid(1);
7564         }
7565 #ifdef TRY_BSD_PGRP
7566         if (getpgrp(1) == 0)
7567                 exit(0);
7568 #else
7569         if (getpgrp() > 0)
7570                 exit(0);
7571 #endif
7572         exit(1);
7573 }
7574 EOP
7575         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7576                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7577                 val="$define"
7578         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7579                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7580                 val="$undef"
7581         else
7582                 echo "I can't seem to compile and run the test program."
7583                 if ./usg; then
7584                         xxx="a USG one, i.e. you use getpgrp()."
7585                 else
7586                         # SVR4 systems can appear rather BSD-ish.
7587                         case "$i_unistd" in
7588                         $undef)
7589                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7590                                 val="$define"
7591                                 ;;
7592                         $define)
7593                                 xxx="probably a USG one, i.e. you use getpgrp()."
7594                                 val="$undef"
7595                                 ;;
7596                         esac
7597                 fi
7598                 echo "Assuming your getpgrp is $xxx" >&4
7599         fi
7600         ;;
7601 *) val="$undef";;
7602 esac
7603 set d_bsdgetpgrp
7604 eval $setvar
7605 $rm -f set set.c
7606
7607 : see if setpgrp exists
7608 set setpgrp d_setpgrp
7609 eval $inlibc
7610
7611 case "$d_setpgrp" in
7612 "$define")
7613         echo " "
7614         echo "Checking to see which flavor of setpgrp is in use..."
7615         $cat >set.c <<EOP
7616 #$i_unistd I_UNISTD
7617 #include <sys/types.h>
7618 #ifdef I_UNISTD
7619 #  include <unistd.h>
7620 #endif
7621 int main()
7622 {
7623         if (getuid() == 0) {
7624                 printf("(I see you are running Configure as super-user...)\n");
7625                 setuid(1);
7626         }
7627 #ifdef TRY_BSD_PGRP
7628         if (-1 == setpgrp(1, 1))
7629                 exit(0);
7630 #else
7631         if (setpgrp() != -1)
7632                 exit(0);
7633 #endif
7634         exit(1);
7635 }
7636 EOP
7637         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7638                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7639                 val="$define"
7640         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7641                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7642                 val="$undef"
7643         else
7644                 echo "(I can't seem to compile and run the test program.)"
7645                 if ./usg; then
7646                         xxx="a USG one, i.e. you use setpgrp()."
7647                 else
7648                         # SVR4 systems can appear rather BSD-ish.
7649                         case "$i_unistd" in
7650                         $undef)
7651                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7652                                 val="$define"
7653                                 ;;
7654                         $define)
7655                                 xxx="probably a USG one, i.e. you use setpgrp()."
7656                                 val="$undef"
7657                                 ;;
7658                         esac
7659                 fi
7660                 echo "Assuming your setpgrp is $xxx" >&4
7661         fi
7662         ;;
7663 *) val="$undef";;
7664 esac
7665 set d_bsdsetpgrp
7666 eval $setvar
7667 $rm -f set set.c
7668 : see if bzero exists
7669 set bzero d_bzero
7670 eval $inlibc
7671
7672 : see if signal is declared as pointer to function returning int or void
7673 echo " "
7674 xxx=`./findhdr signal.h`
7675 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7676 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7677         echo "You have int (*signal())() instead of void." >&4
7678         val="$undef"
7679 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7680         echo "You have void (*signal())()." >&4
7681         val="$define"
7682 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7683         echo "You have int (*signal())() instead of void." >&4
7684         val="$undef"
7685 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7686         echo "You have void (*signal())()." >&4
7687         val="$define"
7688 else
7689         case "$d_voidsig" in
7690         '')
7691         echo "I can't determine whether signal handler returns void or int..." >&4
7692                 dflt=void
7693                 rp="What type does your signal handler return?"
7694                 . ./myread
7695                 case "$ans" in
7696                 v*) val="$define";;
7697                 *) val="$undef";;
7698                 esac;;
7699         "$define")
7700                 echo "As you already told me, signal handler returns void." >&4
7701                 val="$define"
7702                 ;;
7703         *)      echo "As you already told me, signal handler returns int." >&4
7704                 val="$undef"
7705                 ;;
7706         esac
7707 fi
7708 set d_voidsig
7709 eval $setvar
7710 case "$d_voidsig" in
7711 "$define") signal_t="void";;
7712 *) signal_t="int";;
7713 esac
7714 $rm -f $$.tmp
7715
7716 : check for ability to cast large floats to 32-bit ints.
7717 echo " "
7718 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7719 if $test "$intsize" -ge 4; then
7720         xxx=int
7721 else
7722         xxx=long
7723 fi
7724 $cat >try.c <<EOCP
7725 #include <stdio.h>
7726 #include <sys/types.h>
7727 #include <signal.h>
7728 $signal_t blech(s) int s; { exit(3); }
7729 int main()
7730 {
7731         $xxx i32;
7732         double f, g;
7733         int result = 0;
7734         char str[16];
7735         signal(SIGFPE, blech);
7736
7737         /* Don't let compiler optimize the test away.  Store the number 
7738            in a writable string for gcc to pass to sscanf under HP/UX.
7739         */
7740         sprintf(str, "2147483647");
7741         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7742         g = 10 * f;
7743         i32  = ($xxx) g;
7744
7745         /* x86 processors will probably give 0x8000 0000, which is a
7746        sign change.  We don't want that.  We want to mimic SPARC
7747            behavior here, which is to preserve the sign and give
7748            back 0x7fff ffff.
7749         */
7750         if (i32 != ($xxx) f)
7751                 result |= 1;
7752         exit(result);
7753 }
7754 EOCP
7755 set try
7756 if eval $compile_ok; then
7757         ./try
7758         yyy=$?
7759 else
7760         echo "(I can't seem to compile the test program--assuming it can't)"
7761         yyy=1
7762 fi
7763 case "$yyy" in
7764 0)      val="$define"
7765         echo "Yup, it can."
7766         ;;
7767 *)      val="$undef"
7768         echo "Nope, it can't."
7769         ;;
7770 esac
7771 set d_casti32
7772 eval $setvar
7773 $rm -f try try.*
7774
7775 : check for ability to cast negative floats to unsigned
7776 echo " "
7777 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7778 $cat >try.c <<EOCP
7779 #include <stdio.h>
7780 #include <sys/types.h>
7781 #include <signal.h>
7782 $signal_t blech(s) int s; { exit(7); }
7783 $signal_t blech_in_list(s) int s; { exit(4); }
7784 unsigned long dummy_long(p) unsigned long p; { return p; }
7785 unsigned int dummy_int(p) unsigned int p; { return p; }
7786 unsigned short dummy_short(p) unsigned short p; { return p; }
7787 int main()
7788 {
7789         double f;
7790         unsigned long along;
7791         unsigned int aint;
7792         unsigned short ashort;
7793         int result = 0;
7794         char str[16];
7795         
7796         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7797            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7798            optimized the whole file away
7799         */
7800         /* Store the number in a writable string for gcc to pass to 
7801            sscanf under HP/UX.
7802         */
7803         sprintf(str, "-123");
7804         sscanf(str, "%lf", &f);  /* f = -123.; */
7805
7806         signal(SIGFPE, blech);
7807         along = (unsigned long)f;
7808         aint = (unsigned int)f;
7809         ashort = (unsigned short)f;
7810         if (along != (unsigned long)-123)
7811                 result |= 1;
7812         if (aint != (unsigned int)-123)
7813                 result |= 1;
7814         if (ashort != (unsigned short)-123)
7815                 result |= 1;
7816         sprintf(str, "1073741824.");
7817         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7818         f = f + f;
7819         along = 0;
7820         along = (unsigned long)f;
7821         if (along != 0x80000000)
7822                 result |= 2;
7823         f -= 1.;
7824         along = 0;
7825         along = (unsigned long)f;
7826         if (along != 0x7fffffff)
7827                 result |= 1;
7828         f += 2.;
7829         along = 0;
7830         along = (unsigned long)f;
7831         if (along != 0x80000001)
7832                 result |= 2;
7833         if (result)
7834                 exit(result);
7835         signal(SIGFPE, blech_in_list);
7836         sprintf(str, "123.");
7837         sscanf(str, "%lf", &f);  /* f = 123.; */
7838         along = dummy_long((unsigned long)f);
7839         aint = dummy_int((unsigned int)f);
7840         ashort = dummy_short((unsigned short)f);
7841         if (along != (unsigned long)123)
7842                 result |= 4;
7843         if (aint != (unsigned int)123)
7844                 result |= 4;
7845         if (ashort != (unsigned short)123)
7846                 result |= 4;
7847         exit(result);
7848
7849 }
7850 EOCP
7851 set try
7852 if eval $compile_ok; then
7853         ./try
7854         castflags=$?
7855 else
7856         echo "(I can't seem to compile the test program--assuming it can't)"
7857         castflags=7
7858 fi
7859 case "$castflags" in
7860 0)      val="$define"
7861         echo "Yup, it can."
7862         ;;
7863 *)      val="$undef"
7864         echo "Nope, it can't."
7865         ;;
7866 esac
7867 set d_castneg
7868 eval $setvar
7869 $rm -f try.*
7870
7871 : see if vprintf exists
7872 echo " "
7873 if set vprintf val -f d_vprintf; eval $csym; $val; then
7874         echo 'vprintf() found.' >&4
7875         val="$define"
7876         $cat >vprintf.c <<'EOF'
7877 #include <varargs.h>
7878
7879 int main() { xxx("foo"); }
7880
7881 xxx(va_alist)
7882 va_dcl
7883 {
7884         va_list args;
7885         char buf[10];
7886
7887         va_start(args);
7888         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7889 }
7890 EOF
7891         set vprintf
7892         if eval $compile && ./vprintf; then
7893                 echo "Your vsprintf() returns (int)." >&4
7894                 val2="$undef"
7895         else
7896                 echo "Your vsprintf() returns (char*)." >&4
7897                 val2="$define"
7898         fi
7899 else
7900         echo 'vprintf() NOT found.' >&4
7901                 val="$undef"
7902                 val2="$undef"
7903 fi
7904 set d_vprintf
7905 eval $setvar
7906 val=$val2
7907 set d_charvspr
7908 eval $setvar
7909
7910 : see if chown exists
7911 set chown d_chown
7912 eval $inlibc
7913
7914 : see if chroot exists
7915 set chroot d_chroot
7916 eval $inlibc
7917
7918 : see if chsize exists
7919 set chsize d_chsize
7920 eval $inlibc
7921
7922 : check for const keyword
7923 echo " "
7924 echo 'Checking to see if your C compiler knows about "const"...' >&4
7925 $cat >const.c <<'EOCP'
7926 typedef struct spug { int drokk; } spug;
7927 int main()
7928 {
7929         const char *foo;
7930         const spug y;
7931 }
7932 EOCP
7933 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7934         val="$define"
7935         echo "Yup, it does."
7936 else
7937         val="$undef"
7938         echo "Nope, it doesn't."
7939 fi
7940 set d_const
7941 eval $setvar
7942
7943 : see if crypt exists
7944 echo " "
7945 if set crypt val -f d_crypt; eval $csym; $val; then
7946         echo 'crypt() found.' >&4
7947         val="$define"
7948         cryptlib=''
7949 else
7950         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7951         if $test -z "$cryptlib"; then
7952                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7953         else
7954                 cryptlib=-lcrypt
7955         fi
7956         if $test -z "$cryptlib"; then
7957                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7958         else
7959                 cryptlib=-lcrypt
7960         fi
7961         if $test -z "$cryptlib"; then
7962                 cryptlib=`./loc libcrypt$_a "" $libpth`
7963         else
7964                 cryptlib=-lcrypt
7965         fi
7966         if $test -z "$cryptlib"; then
7967                 echo 'crypt() NOT found.' >&4
7968                 val="$undef"
7969         else
7970                 val="$define"
7971         fi
7972 fi
7973 set d_crypt
7974 eval $setvar
7975
7976 : get csh whereabouts
7977 case "$csh" in
7978 'csh') val="$undef" ;;
7979 *) val="$define" ;;
7980 esac
7981 set d_csh
7982 eval $setvar
7983 : Respect a hint or command line value for full_csh.
7984 case "$full_csh" in
7985 '') full_csh=$csh ;;
7986 esac
7987
7988 : see if cuserid exists
7989 set cuserid d_cuserid
7990 eval $inlibc
7991
7992 : see if this is a limits.h system
7993 set limits.h i_limits
7994 eval $inhdr
7995
7996 : see if this is a float.h system
7997 set float.h i_float
7998 eval $inhdr
7999
8000 : See if number of significant digits in a double precision number is known
8001 echo " "
8002 $cat >dbl_dig.c <<EOM
8003 #$i_limits I_LIMITS
8004 #$i_float I_FLOAT
8005 #ifdef I_LIMITS
8006 #include <limits.h>
8007 #endif
8008 #ifdef I_FLOAT
8009 #include <float.h>
8010 #endif
8011 #ifdef DBL_DIG
8012 printf("Contains DBL_DIG");
8013 #endif
8014 EOM
8015 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8016 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8017         echo "DBL_DIG found." >&4
8018         val="$define"
8019 else
8020         echo "DBL_DIG NOT found." >&4
8021         val="$undef"
8022 fi
8023 $rm -f dbl_dig.?
8024 set d_dbl_dig
8025 eval $setvar
8026
8027 : see if difftime exists
8028 set difftime d_difftime
8029 eval $inlibc
8030
8031 : see if this is a dirent system
8032 echo " "
8033 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8034         val="$define"
8035         echo "<dirent.h> found." >&4
8036 else
8037         val="$undef"
8038         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8039                 echo "<sys/dir.h> found." >&4
8040                 echo " "
8041         else
8042                 xinc=`./findhdr sys/ndir.h`
8043         fi
8044         echo "<dirent.h> NOT found." >&4
8045 fi
8046 set i_dirent
8047 eval $setvar
8048
8049 : Look for type of directory structure.
8050 echo " "
8051 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8052
8053 case "$direntrytype" in
8054 ''|' ')
8055         case "$i_dirent" in
8056         $define) guess1='struct dirent' ;;
8057         *) guess1='struct direct'  ;;
8058         esac
8059         ;;
8060 *)      guess1="$direntrytype"
8061         ;;
8062 esac
8063
8064 case "$guess1" in
8065 'struct dirent') guess2='struct direct' ;;
8066 *) guess2='struct dirent' ;;
8067 esac
8068                 
8069 if $contains "$guess1" try.c >/dev/null 2>&1; then
8070         direntrytype="$guess1"
8071         echo "Your directory entries are $direntrytype." >&4
8072 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8073         direntrytype="$guess2"
8074         echo "Your directory entries seem to be $direntrytype." >&4
8075 else
8076         echo "I don't recognize your system's directory entries." >&4
8077         rp="What type is used for directory entries on this system?"
8078         dflt="$guess1"
8079         . ./myread
8080         direntrytype="$ans"
8081 fi
8082 $rm -f try.c
8083
8084
8085 : see if the directory entry stores field length
8086 echo " "
8087 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8088 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8089         echo "Good, your directory entry keeps length information in d_namlen." >&4
8090         val="$define"
8091 else
8092         echo "Your directory entry does not know about the d_namlen field." >&4
8093         val="$undef"
8094 fi
8095 set d_dirnamlen
8096 eval $setvar
8097 $rm -f try.c
8098
8099 : see if dlerror exists
8100 xxx_runnm="$runnm"
8101 runnm=false
8102 set dlerror d_dlerror
8103 eval $inlibc
8104 runnm="$xxx_runnm"
8105
8106 : see if dlfcn is available
8107 set dlfcn.h i_dlfcn
8108 eval $inhdr
8109
8110 case "$usedl" in
8111 $define|y|true)
8112         $cat << EOM
8113
8114 On a few systems, the dynamically loaded modules that perl generates and uses
8115 will need a different extension than shared libs. The default will probably
8116 be appropriate.
8117
8118 EOM
8119         case "$dlext" in
8120         '')     dflt="$so" ;;
8121         *)      dflt="$dlext" ;;
8122         esac
8123         rp='What is the extension of dynamically loaded modules'
8124         . ./myread
8125         dlext="$ans"
8126         ;;
8127 *)
8128         dlext="none"
8129         ;;
8130 esac
8131
8132 : Check if dlsym need a leading underscore
8133 echo " "
8134 val="$undef"
8135
8136 case "$dlsrc" in
8137 dl_dlopen.xs)
8138         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8139         $cat >dyna.c <<'EOM'
8140 fred () { }
8141 EOM
8142
8143 $cat >fred.c<<EOM
8144
8145 #include <stdio.h>
8146 #$i_dlfcn I_DLFCN
8147 #ifdef I_DLFCN
8148 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8149 #else
8150 #include <sys/types.h>
8151 #include <nlist.h>
8152 #include <link.h>
8153 #endif
8154
8155 extern int fred() ;
8156
8157 int main()
8158 {
8159     void * handle ;
8160     void * symbol ;
8161 #ifndef RTLD_LAZY
8162     int mode = 1 ;
8163 #else
8164     int mode = RTLD_LAZY ;
8165 #endif
8166     handle = dlopen("./dyna.$dlext", mode) ;
8167     if (handle == NULL) {
8168         printf ("1\n") ;
8169         fflush (stdout) ;
8170         exit(0);
8171     }
8172     symbol = dlsym(handle, "fred") ;
8173     if (symbol == NULL) {
8174         /* try putting a leading underscore */
8175         symbol = dlsym(handle, "_fred") ;
8176         if (symbol == NULL) {
8177             printf ("2\n") ;
8178             fflush (stdout) ;
8179             exit(0);
8180         }
8181         printf ("3\n") ;
8182     }
8183     else
8184         printf ("4\n") ;
8185     fflush (stdout) ;
8186     exit(0);
8187 }
8188 EOM
8189         : Call the object file tmp-dyna.o in case dlext=o.
8190         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8191                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8192                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8193                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8194                 xxx=`./fred`
8195                 case $xxx in
8196                 1)      echo "Test program failed using dlopen." >&4
8197                         echo "Perhaps you should not use dynamic loading." >&4;;
8198                 2)      echo "Test program failed using dlsym." >&4
8199                         echo "Perhaps you should not use dynamic loading." >&4;;
8200                 3)      echo "dlsym needs a leading underscore" >&4
8201                         val="$define" ;;
8202                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8203                 esac
8204         else
8205                 echo "I can't compile and run the test program." >&4
8206                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8207         fi
8208         ;;
8209 esac
8210                 
8211 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8212
8213 set d_dlsymun
8214 eval $setvar
8215
8216 hasproto='varname=$1; func=$2; shift; shift;
8217 while $test $# -ge 2; do
8218         case "$1" in
8219         $define) echo "#include <$2>";;
8220         esac ;
8221     shift 2;
8222 done > try.c;
8223 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8224 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8225         echo "$func() prototype found.";
8226         val="$define";
8227 else
8228         echo "$func() prototype NOT found.";
8229         val="$undef";
8230 fi;
8231 set $varname;
8232 eval $setvar;
8233 $rm -f try.c tryout.c'
8234
8235 : see if prototype for drand48 is available
8236 echo " "
8237 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8238 eval $hasproto
8239
8240 : see if dup2 exists
8241 set dup2 d_dup2
8242 eval $inlibc
8243
8244 : see if eaccess exists
8245 set eaccess d_eaccess
8246 eval $inlibc
8247
8248 : see if endgrent exists
8249 set endgrent d_endgrent
8250 eval $inlibc
8251
8252 : see if endhostent exists
8253 set endhostent d_endhent
8254 eval $inlibc
8255
8256 : see if endnetent exists
8257 set endnetent d_endnent
8258 eval $inlibc
8259
8260 : see if endprotoent exists
8261 set endprotoent d_endpent
8262 eval $inlibc
8263
8264 : see if endpwent exists
8265 set endpwent d_endpwent
8266 eval $inlibc
8267
8268 : see if endservent exists
8269 set endservent d_endsent
8270 eval $inlibc
8271
8272 : see if endspent exists
8273 set endspent d_endspent
8274 eval $inlibc
8275
8276 : Locate the flags for 'open()'
8277 echo " "
8278 $cat >open3.c <<'EOCP'
8279 #include <sys/types.h>
8280 #ifdef I_FCNTL
8281 #include <fcntl.h>
8282 #endif
8283 #ifdef I_SYS_FILE
8284 #include <sys/file.h>
8285 #endif
8286 int main() {
8287         if(O_RDONLY);
8288 #ifdef O_TRUNC
8289         exit(0);
8290 #else
8291         exit(1);
8292 #endif
8293 }
8294 EOCP
8295 : check sys/file.h first to get FREAD on Sun
8296 if $test `./findhdr sys/file.h` && \
8297                 set open3 -DI_SYS_FILE && eval $compile; then
8298         h_sysfile=true;
8299         echo "<sys/file.h> defines the O_* constants..." >&4
8300         if ./open3; then
8301                 echo "and you have the 3 argument form of open()." >&4
8302                 val="$define"
8303         else
8304                 echo "but not the 3 argument form of open().  Oh, well." >&4
8305                 val="$undef"
8306         fi
8307 elif $test `./findhdr fcntl.h` && \
8308                 set open3 -DI_FCNTL && eval $compile; then
8309         h_fcntl=true;
8310         echo "<fcntl.h> defines the O_* constants..." >&4
8311         if ./open3; then
8312                 echo "and you have the 3 argument form of open()." >&4
8313                 val="$define"
8314         else
8315                 echo "but not the 3 argument form of open().  Oh, well." >&4
8316                 val="$undef"
8317         fi
8318 else
8319         val="$undef"
8320         echo "I can't find the O_* constant definitions!  You got problems." >&4
8321 fi
8322 set d_open3
8323 eval $setvar
8324 $rm -f open3*
8325
8326 : see which of string.h or strings.h is needed
8327 echo " "
8328 strings=`./findhdr string.h`
8329 if $test "$strings" && $test -r "$strings"; then
8330         echo "Using <string.h> instead of <strings.h>." >&4
8331         val="$define"
8332 else
8333         val="$undef"
8334         strings=`./findhdr strings.h`
8335         if $test "$strings" && $test -r "$strings"; then
8336                 echo "Using <strings.h> instead of <string.h>." >&4
8337         else
8338                 echo "No string header found -- You'll surely have problems." >&4
8339         fi
8340 fi
8341 set i_string
8342 eval $setvar
8343 case "$i_string" in
8344 "$undef") strings=`./findhdr strings.h`;;
8345 *)        strings=`./findhdr string.h`;;
8346 esac
8347
8348 : check for non-blocking I/O stuff
8349 case "$h_sysfile" in
8350 true) echo "#include <sys/file.h>" > head.c;;
8351 *)
8352         case "$h_fcntl" in
8353         true) echo "#include <fcntl.h>" > head.c;;
8354         *) echo "#include <sys/fcntl.h>" > head.c;;
8355         esac
8356         ;;
8357 esac
8358 echo " "
8359 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8360 case "$o_nonblock" in
8361 '')
8362         $cat head.c > try.c
8363         $cat >>try.c <<'EOCP'
8364 #include <stdio.h>
8365 int main() {
8366 #ifdef O_NONBLOCK
8367         printf("O_NONBLOCK\n");
8368         exit(0);
8369 #endif
8370 #ifdef O_NDELAY
8371         printf("O_NDELAY\n");
8372         exit(0);
8373 #endif
8374 #ifdef FNDELAY
8375         printf("FNDELAY\n");
8376         exit(0);
8377 #endif
8378         exit(0);
8379 }
8380 EOCP
8381         set try
8382         if eval $compile_ok; then
8383                 o_nonblock=`./try`
8384                 case "$o_nonblock" in
8385                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8386                 *) echo "Seems like we can use $o_nonblock.";;
8387                 esac
8388         else
8389                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8390         fi
8391         ;;
8392 *) echo "Using $hint value $o_nonblock.";;
8393 esac
8394 $rm -f try try.* .out core
8395
8396 echo " "
8397 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8398 case "$eagain" in
8399 '')
8400         $cat head.c > try.c
8401         $cat >>try.c <<EOCP
8402 #include <errno.h>
8403 #include <sys/types.h>
8404 #include <signal.h>
8405 #include <stdio.h> 
8406 #define MY_O_NONBLOCK $o_nonblock
8407 #ifndef errno  /* XXX need better Configure test */
8408 extern int errno;
8409 #endif
8410 #$i_unistd I_UNISTD
8411 #ifdef I_UNISTD
8412 #include <unistd.h>
8413 #endif
8414 #ifdef $i_string
8415 #include <string.h>
8416 #else
8417 #include <strings.h>
8418 #endif
8419 $signal_t blech(x) int x; { exit(3); }
8420 EOCP
8421         $cat >> try.c <<'EOCP'
8422 int main()
8423 {
8424         int pd[2];
8425         int pu[2];
8426         char buf[1];
8427         char string[100];
8428
8429         pipe(pd);       /* Down: child -> parent */
8430         pipe(pu);       /* Up: parent -> child */
8431         if (0 != fork()) {
8432                 int ret;
8433                 close(pd[1]);   /* Parent reads from pd[0] */
8434                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8435                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8436                         exit(1);
8437                 signal(SIGALRM, blech);
8438                 alarm(5);
8439                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8440                         exit(2);
8441                 sprintf(string, "%d\n", ret);
8442                 write(2, string, strlen(string));
8443                 alarm(0);
8444 #ifdef EAGAIN
8445                 if (errno == EAGAIN) {
8446                         printf("EAGAIN\n");
8447                         goto ok;
8448                 }
8449 #endif
8450 #ifdef EWOULDBLOCK
8451                 if (errno == EWOULDBLOCK)
8452                         printf("EWOULDBLOCK\n");
8453 #endif
8454         ok:
8455                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8456                 sleep(2);                               /* Give it time to close our pipe */
8457                 alarm(5);
8458                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8459                 alarm(0);
8460                 sprintf(string, "%d\n", ret);
8461                 write(3, string, strlen(string));
8462                 exit(0);
8463         }
8464
8465         close(pd[0]);                   /* We write to pd[1] */
8466         close(pu[1]);                   /* We read from pu[0] */
8467         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8468         close(pd[1]);                   /* Pipe pd is now fully closed! */
8469         exit(0);                                /* Bye bye, thank you for playing! */
8470 }
8471 EOCP
8472         set try
8473         if eval $compile_ok; then
8474                 echo "$startsh" >mtry
8475                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8476                 chmod +x mtry
8477                 ./mtry >/dev/null 2>&1
8478                 case $? in
8479                 0) eagain=`$cat try.out`;;
8480                 1) echo "Could not perform non-blocking setting!";;
8481                 2) echo "I did a successful read() for something that was not there!";;
8482                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8483                 *) echo "Something terribly wrong happened during testing.";;
8484                 esac
8485                 rd_nodata=`$cat try.ret`
8486                 echo "A read() system call with no data present returns $rd_nodata."
8487                 case "$rd_nodata" in
8488                 0|-1) ;;
8489                 *)
8490                         echo "(That's peculiar, fixing that to be -1.)"
8491                         rd_nodata=-1
8492                         ;;
8493                 esac
8494                 case "$eagain" in
8495                 '')
8496                         echo "Forcing errno EAGAIN on read() with no data available."
8497                         eagain=EAGAIN
8498                         ;;
8499                 *)
8500                         echo "Your read() sets errno to $eagain when no data is available."
8501                         ;;
8502                 esac
8503                 status=`$cat try.err`
8504                 case "$status" in
8505                 0) echo "And it correctly returns 0 to signal EOF.";;
8506                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8507                 *) echo "However, your read() returns '$status' on EOF??";;
8508                 esac
8509                 val="$define"
8510                 if test "$status" = "$rd_nodata"; then
8511                         echo "WARNING: you can't distinguish between EOF and no data!"
8512                         val="$undef"
8513                 fi
8514         else
8515                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8516                 eagain=EAGAIN
8517         fi
8518         set d_eofnblk
8519         eval $setvar
8520         ;;
8521 *)
8522         echo "Using $hint value $eagain."
8523         echo "Your read() returns $rd_nodata when no data is present."
8524         case "$d_eofnblk" in
8525         "$define") echo "And you can see EOF because read() returns 0.";;
8526         "$undef") echo "But you can't see EOF status from read() returned value.";;
8527         *)
8528                 echo "(Assuming you can't see EOF status from read anyway.)"
8529                 d_eofnblk=$undef
8530                 ;;
8531         esac
8532         ;;
8533 esac
8534 $rm -f try try.* .out core head.c mtry
8535
8536 : see if fchmod exists
8537 set fchmod d_fchmod
8538 eval $inlibc
8539
8540 : see if fchown exists
8541 set fchown d_fchown
8542 eval $inlibc
8543
8544 : see if this is an fcntl system
8545 set fcntl d_fcntl
8546 eval $inlibc
8547
8548 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8549 while $test $# -ge 2; do
8550         case "$1" in
8551         $define) echo "#include <$2>";;
8552         esac ;
8553     shift 2;
8554 done > try.c;
8555 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8556 set try;
8557 if eval $compile; then
8558         val="$define";
8559 else
8560         val="$undef";
8561 fi;
8562 set $varname;
8563 eval $setvar;
8564 $rm -f try.c try.o'
8565
8566 socketlib=''
8567 sockethdr=''
8568 : see whether socket exists
8569 echo " "
8570 $echo $n "Hmm... $c" >&4
8571 if set socket val -f d_socket; eval $csym; $val; then
8572         echo "Looks like you have Berkeley networking support." >&4
8573         d_socket="$define"
8574         if set setsockopt val -f; eval $csym; $val; then
8575                 d_oldsock="$undef"
8576         else
8577                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8578                 d_oldsock="$define"
8579         fi
8580 else
8581         if $contains socklib libc.list >/dev/null 2>&1; then
8582                 echo "Looks like you have Berkeley networking support." >&4
8583                 d_socket="$define"
8584                 : we will have to assume that it supports the 4.2 BSD interface
8585                 d_oldsock="$undef"
8586         else
8587                 echo "You don't have Berkeley networking in libc$_a..." >&4
8588                 if test "X$d_socket" = "X$define"; then
8589                    echo "...but you seem to believe that you have sockets." >&4
8590                 else
8591                         for net in net socket
8592                         do
8593                                 if test -f /usr/lib/lib$net$_a; then
8594                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8595                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8596                                         if $contains socket libc.list >/dev/null 2>&1; then
8597                                                 d_socket="$define"
8598                                                 socketlib="-l$net"
8599                                                 case "$net" in
8600                                                 net)
8601                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8602                                                         sockethdr="-I/usr/netinclude"
8603                                                         ;;
8604                                                 esac
8605                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8606                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8607                                                         d_oldsock="$undef"
8608                                                 else
8609                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8610                                                         d_oldsock="$define"
8611                                                 fi
8612                                                 break
8613                                         fi
8614                                 fi
8615                         done
8616                         if test "X$d_socket" != "X$define"; then
8617                            echo "or anywhere else I see." >&4
8618                            d_socket="$undef"
8619                            d_oldsock="$undef"
8620                         fi
8621                 fi
8622         fi
8623 fi
8624
8625 : see if socketpair exists
8626 set socketpair d_sockpair
8627 eval $inlibc
8628
8629
8630 echo " "
8631 echo "Checking the availability of certain socket constants..." >& 4
8632 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8633         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8634         $cat >try.c <<EOF
8635 #include <sys/types.h>
8636 #include <sys/socket.h>
8637 int main() {
8638     int i = $ENUM;
8639 }
8640 EOF
8641         val="$undef"
8642         set try; if eval $compile; then
8643                 val="$define"
8644         fi
8645         set d_${enum}; eval $setvar
8646         $rm -f try.c try
8647 done
8648
8649 : see if sys/select.h has to be included
8650 set sys/select.h i_sysselct
8651 eval $inhdr
8652
8653 : see if we should include time.h, sys/time.h, or both
8654 echo " "
8655 if test "X$timeincl" = X; then
8656         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8657         $echo $n "I'm now running the test program...$c"
8658         $cat >try.c <<'EOCP'
8659 #include <sys/types.h>
8660 #ifdef I_TIME
8661 #include <time.h>
8662 #endif
8663 #ifdef I_SYSTIME
8664 #ifdef SYSTIMEKERNEL
8665 #define KERNEL
8666 #endif
8667 #include <sys/time.h>
8668 #endif
8669 #ifdef I_SYSSELECT
8670 #include <sys/select.h>
8671 #endif
8672 int main()
8673 {
8674         struct tm foo;
8675 #ifdef S_TIMEVAL
8676         struct timeval bar;
8677 #endif
8678 #ifdef S_TIMEZONE
8679         struct timezone tzp;
8680 #endif
8681         if (foo.tm_sec == foo.tm_sec)
8682                 exit(0);
8683 #ifdef S_TIMEVAL
8684         if (bar.tv_sec == bar.tv_sec)
8685                 exit(0);
8686 #endif
8687         exit(1);
8688 }
8689 EOCP
8690         flags=''
8691         for s_timezone in '-DS_TIMEZONE' ''; do
8692         sysselect=''
8693         for s_timeval in '-DS_TIMEVAL' ''; do
8694         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8695         for i_time in '' '-DI_TIME'; do
8696         for i_systime in '-DI_SYSTIME' ''; do
8697                 case "$flags" in
8698                 '') $echo $n ".$c"
8699                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8700                         if eval $compile; then
8701                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8702                                 shift
8703                                 flags="$*"
8704                                 echo " "
8705                                 $echo $n "Succeeded with $flags$c"
8706                         fi
8707                         ;;
8708                 esac
8709         done
8710         done
8711         done
8712         done
8713         done
8714         timeincl=''
8715         echo " "
8716         case "$flags" in
8717         *SYSTIMEKERNEL*) i_systimek="$define"
8718                 timeincl=`./findhdr sys/time.h`
8719                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8720         *) i_systimek="$undef";;
8721         esac
8722         case "$flags" in
8723         *I_TIME*) i_time="$define"
8724                 timeincl=`./findhdr time.h`" $timeincl"
8725                 echo "We'll include <time.h>." >&4;;
8726         *) i_time="$undef";;
8727         esac
8728         case "$flags" in
8729         *I_SYSTIME*) i_systime="$define"
8730                 timeincl=`./findhdr sys/time.h`" $timeincl"
8731                 echo "We'll include <sys/time.h>." >&4;;
8732         *) i_systime="$undef";;
8733         esac
8734         $rm -f try.c try
8735 fi
8736
8737 : check for fd_set items
8738 $cat <<EOM
8739
8740 Checking to see how well your C compiler handles fd_set and friends ...
8741 EOM
8742 $cat >fd_set.c <<EOCP
8743 #$i_systime I_SYS_TIME
8744 #$i_sysselct I_SYS_SELECT
8745 #$d_socket HAS_SOCKET
8746 #include <sys/types.h>
8747 #ifdef HAS_SOCKET
8748 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8749 #endif
8750 #ifdef I_SYS_TIME
8751 #include <sys/time.h>
8752 #endif
8753 #ifdef I_SYS_SELECT
8754 #include <sys/select.h>
8755 #endif
8756 int main() {
8757         fd_set fds;
8758
8759 #ifdef TRYBITS
8760         if(fds.fds_bits);
8761 #endif
8762
8763 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8764         exit(0);
8765 #else
8766         exit(1);
8767 #endif
8768 }
8769 EOCP
8770 set fd_set -DTRYBITS
8771 if eval $compile; then
8772         d_fds_bits="$define"
8773         d_fd_set="$define"
8774         echo "Well, your system knows about the normal fd_set typedef..." >&4
8775         if ./fd_set; then
8776                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8777                 d_fd_macros="$define"
8778         else
8779                 $cat >&4 <<'EOM'
8780 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8781 EOM
8782                 d_fd_macros="$undef"
8783         fi
8784 else
8785         $cat <<'EOM'
8786 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8787 EOM
8788         set fd_set
8789         if eval $compile; then
8790                 d_fds_bits="$undef"
8791                 d_fd_set="$define"
8792                 echo "Well, your system has some sort of fd_set available..." >&4
8793                 if ./fd_set; then
8794                         echo "and you have the normal fd_set macros." >&4
8795                         d_fd_macros="$define"
8796                 else
8797                         $cat <<'EOM'
8798 but not the normal fd_set macros!  Gross!  More work for me...
8799 EOM
8800                         d_fd_macros="$undef"
8801                 fi
8802         else
8803         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8804                 d_fd_set="$undef"
8805                 d_fds_bits="$undef"
8806                 d_fd_macros="$undef"
8807         fi
8808 fi
8809 $rm -f fd_set*
8810
8811 : see if fgetpos exists
8812 set fgetpos d_fgetpos
8813 eval $inlibc
8814
8815 : see if flock exists
8816 set flock d_flock
8817 eval $inlibc
8818
8819 : see if fork exists
8820 set fork d_fork
8821 eval $inlibc
8822
8823 : see if pathconf exists
8824 set pathconf d_pathconf
8825 eval $inlibc
8826
8827 : see if fpathconf exists
8828 set fpathconf d_fpathconf
8829 eval $inlibc
8830
8831
8832 : check for off64_t
8833 echo " "
8834 echo "Checking to see if your system supports off64_t..." >&4
8835 $cat >try.c <<EOCP
8836 #include <sys/types.h>
8837 #include <unistd.h>
8838 int main() { off64_t x = 7; }'
8839 EOCP
8840 set try
8841 if eval $compile; then
8842         val="$define"
8843         echo "Yes, it does."
8844 else
8845         val="$undef"
8846         echo "No, it doesn't."
8847         case "$lseeksize" in
8848         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8849         esac
8850 fi
8851 $rm -f try.* try
8852 set d_off64_t
8853 eval $setvar
8854
8855 : check for fpos64_t
8856 echo " "
8857 echo "Checking to see if your system supports fpos64_t..." >&4
8858 $cat >try.c <<EOCP
8859 #include <sys/stdio.h>
8860 int main() { fpos64_t x x = 7; }'
8861 EOCP
8862 set try
8863 if eval $compile; then
8864         val="$define"
8865         echo "Yes, it does."
8866 else
8867         val="$undef"
8868         echo "No, it doesn't."
8869         case "$fpossize" in
8870         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8871         esac
8872 fi
8873 $rm -f try.* try
8874 set d_fpos64_t
8875 eval $setvar
8876
8877 hasstruct='varname=$1; struct=$2; shift; shift;
8878 while $test $# -ge 2; do
8879         case "$1" in
8880         $define) echo "#include <$2>";;
8881         esac ;
8882     shift 2;
8883 done > try.c;
8884 echo "int main () { struct $struct foo; }" >> try.c;
8885 set try;
8886 if eval $compile; then
8887         val="$define";
8888 else
8889         val="$undef";
8890 fi;
8891 set $varname;
8892 eval $setvar;
8893 $rm -f try.c try.o'
8894
8895 : see if this is a sys/param system
8896 set sys/param.h i_sysparam
8897 eval $inhdr
8898
8899 : see if this is a sys/mount.h system
8900 set sys/mount.h i_sysmount
8901 eval $inhdr
8902
8903 : see if sys/types.h has to be included
8904 set sys/types.h i_systypes
8905 eval $inhdr
8906
8907
8908 echo " "
8909 echo "Checking to see if your system supports struct fs_data..." >&4
8910 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8911 eval $hasstruct
8912 case "$d_fs_data_s" in
8913 "$define")      echo "Yes, it does."   ;;
8914 *)              echo "No, it doesn't." ;;
8915 esac
8916
8917 : see if fseeko exists
8918 set fseeko d_fseeko
8919 eval $inlibc
8920 case "$longsize" in
8921 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8922 esac
8923
8924 : see if fsetpos exists
8925 set fsetpos d_fsetpos
8926 eval $inlibc
8927
8928
8929 : see if fstatfs exists
8930 set fstatfs d_fstatfs
8931 eval $inlibc
8932
8933
8934 : see if statvfs exists
8935 set statvfs d_statvfs
8936 eval $inlibc
8937
8938 : see if fstatvfs exists
8939 set fstatvfs d_fstatvfs
8940 eval $inlibc
8941
8942
8943 : see if ftello exists
8944 set ftello d_ftello
8945 eval $inlibc
8946 case "$longsize" in
8947 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8948 esac
8949
8950 : see if getgrent exists
8951 set getgrent d_getgrent
8952 eval $inlibc
8953
8954 : see if gethostbyaddr exists
8955 set gethostbyaddr d_gethbyaddr
8956 eval $inlibc
8957
8958 : see if gethostbyname exists
8959 set gethostbyname d_gethbyname
8960 eval $inlibc
8961
8962 : see if gethostent exists
8963 set gethostent d_gethent
8964 eval $inlibc
8965
8966 : see how we will look up host name
8967 echo " "
8968 call=''
8969 if set gethostname val -f d_gethname; eval $csym; $val; then
8970         echo 'gethostname() found.' >&4
8971         d_gethname="$define"
8972         call=gethostname
8973 fi
8974 if set uname val -f d_uname; eval $csym; $val; then
8975         if ./xenix; then
8976                 $cat <<'EOM'
8977 uname() was found, but you're running xenix, and older versions of xenix
8978 have a broken uname(). If you don't really know whether your xenix is old
8979 enough to have a broken system call, use the default answer.
8980
8981 EOM
8982                 dflt=y
8983                 case "$d_uname" in
8984                 "$define") dflt=n;;
8985                 esac
8986                 rp='Is your uname() broken?'
8987                 . ./myread
8988                 case "$ans" in
8989                 n*) d_uname="$define"; call=uname;;
8990                 esac
8991         else
8992                 echo 'uname() found.' >&4
8993                 d_uname="$define"
8994                 case "$call" in
8995                 '') call=uname ;;
8996                 esac
8997         fi
8998 fi
8999 case "$d_gethname" in
9000 '') d_gethname="$undef";;
9001 esac
9002 case "$d_uname" in
9003 '') d_uname="$undef";;
9004 esac
9005 case "$d_uname$d_gethname" in
9006 *define*)
9007         dflt=n
9008         cat <<EOM
9009  
9010 Every now and then someone has a $call() that lies about the hostname
9011 but can't be fixed for political or economic reasons.  If you wish, I can
9012 pretend $call() isn't there and maybe compute hostname at run-time
9013 thanks to the '$phostname' command.
9014
9015 EOM
9016         rp="Shall I ignore $call() from now on?"
9017         . ./myread
9018         case "$ans" in
9019         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9020         esac;;
9021 esac
9022 case "$phostname" in
9023 '') aphostname='';;
9024 *) case "$aphostname" in
9025         /*) ;;
9026         *) set X $phostname
9027                 shift
9028                 file=$1
9029                 shift
9030                 file=`./loc $file $file $pth`
9031                 aphostname=`echo $file $*`
9032                 ;;
9033         esac
9034         ;;
9035 esac
9036 case "$d_uname$d_gethname" in
9037 *define*) ;;
9038 *)
9039         case "$phostname" in
9040         '')
9041                 echo "There will be no way for $package to get your hostname." >&4;;
9042         *)
9043         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9044                 ;;
9045         esac;;
9046 esac
9047 case "$d_phostname" in
9048 '') d_phostname="$undef";;
9049 esac
9050
9051 : see if this is a netdb.h system
9052 set netdb.h i_netdb
9053 eval $inhdr
9054
9055 : see if prototypes for various gethostxxx netdb.h functions are available
9056 echo " "
9057 set d_gethostprotos gethostent $i_netdb netdb.h
9058 eval $hasproto
9059
9060 : see if getlogin exists
9061 set getlogin d_getlogin
9062 eval $inlibc
9063
9064 : see if getmnt exists
9065 set getmnt d_getmnt
9066 eval $inlibc
9067
9068 : see if getmntent exists
9069 set getmntent d_getmntent
9070 eval $inlibc
9071
9072 : see if getnetbyaddr exists
9073 set getnetbyaddr d_getnbyaddr
9074 eval $inlibc
9075
9076 : see if getnetbyname exists
9077 set getnetbyname d_getnbyname
9078 eval $inlibc
9079
9080 : see if getnetent exists
9081 set getnetent d_getnent
9082 eval $inlibc
9083
9084 : see if prototypes for various getnetxxx netdb.h functions are available
9085 echo " "
9086 set d_getnetprotos getnetent $i_netdb netdb.h
9087 eval $hasproto
9088
9089
9090 : see if getprotobyname exists
9091 set getprotobyname d_getpbyname
9092 eval $inlibc
9093
9094 : see if getprotobynumber exists
9095 set getprotobynumber d_getpbynumber
9096 eval $inlibc
9097
9098 : see if getprotoent exists
9099 set getprotoent d_getpent
9100 eval $inlibc
9101
9102 : see if getpgid exists
9103 set getpgid d_getpgid
9104 eval $inlibc
9105
9106 : see if getpgrp2 exists
9107 set getpgrp2 d_getpgrp2
9108 eval $inlibc
9109
9110 : see if getppid exists
9111 set getppid d_getppid
9112 eval $inlibc
9113
9114 : see if getpriority exists
9115 set getpriority d_getprior
9116 eval $inlibc
9117
9118 : see if prototypes for various getprotoxxx netdb.h functions are available
9119 echo " "
9120 set d_getprotoprotos getprotoent $i_netdb netdb.h
9121 eval $hasproto
9122
9123 : see if getpwent exists
9124 set getpwent d_getpwent
9125 eval $inlibc
9126
9127
9128 : see if getservbyname exists
9129 set getservbyname d_getsbyname
9130 eval $inlibc
9131
9132 : see if getservbyport exists
9133 set getservbyport d_getsbyport
9134 eval $inlibc
9135
9136 : see if getservent exists
9137 set getservent d_getsent
9138 eval $inlibc
9139
9140 : see if prototypes for various getservxxx netdb.h functions are available
9141 echo " "
9142 set d_getservprotos getservent $i_netdb netdb.h
9143 eval $hasproto
9144
9145 : see if getspent exists
9146 set getspent d_getspent
9147 eval $inlibc
9148
9149 : see if getspnam exists
9150 set getspnam d_getspnam
9151 eval $inlibc
9152
9153 : see if gettimeofday or ftime exists
9154 set gettimeofday d_gettimeod
9155 eval $inlibc
9156 case "$d_gettimeod" in
9157 "$undef")
9158         set ftime d_ftime 
9159         eval $inlibc
9160         ;;
9161 *)
9162         val="$undef"; set d_ftime; eval $setvar
9163         ;;
9164 esac
9165 case "$d_gettimeod$d_ftime" in
9166 "$undef$undef")
9167         echo " "
9168         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9169         ;;
9170 esac
9171
9172 : see if this is an grp system
9173 set grp.h i_grp
9174 eval $inhdr
9175
9176 case "$i_grp" in
9177 $define)
9178         xxx=`./findhdr grp.h`
9179         $cppstdin $cppflags $cppminus < $xxx >$$.h
9180
9181         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9182                 val="$define"
9183         else
9184                 val="$undef"
9185         fi
9186         set d_grpasswd
9187         eval $setvar
9188
9189         $rm -f $$.h
9190         ;;
9191 *)
9192         val="$undef";
9193         set d_grpasswd; eval $setvar
9194         ;;
9195 esac
9196
9197 : see if hasmntopt exists
9198 set hasmntopt d_hasmntopt
9199 eval $inlibc
9200
9201 : see if this is a netinet/in.h or sys/in.h system
9202 set netinet/in.h i_niin sys/in.h i_sysin
9203 eval $inhdr
9204
9205 : see if arpa/inet.h has to be included
9206 set arpa/inet.h i_arpainet
9207 eval $inhdr
9208
9209 : see if htonl --and friends-- exists
9210 val=''
9211 set htonl val
9212 eval $inlibc
9213
9214 : Maybe they are macros.
9215 case "$val" in
9216 $undef)
9217         $cat >htonl.c <<EOM
9218 #include <stdio.h>
9219 #include <sys/types.h>
9220 #$i_niin I_NETINET_IN
9221 #$i_sysin I_SYS_IN
9222 #$i_arpainet I_ARPA_INET
9223 #ifdef I_NETINET_IN
9224 #include <netinet/in.h>
9225 #endif
9226 #ifdef I_SYS_IN
9227 #include <sys/in.h>
9228 #endif
9229 #ifdef I_ARPA_INET
9230 #include <arpa/inet.h>
9231 #endif
9232 #ifdef htonl
9233 printf("Defined as a macro.");
9234 #endif
9235 EOM
9236         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9237         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9238                 val="$define"
9239                 echo "But it seems to be defined as a macro." >&4
9240         fi
9241         $rm -f htonl.?
9242         ;;
9243 esac
9244 set d_htonl
9245 eval $setvar
9246
9247 : index or strchr
9248 echo " "
9249 if set index val -f; eval $csym; $val; then
9250         if set strchr val -f d_strchr; eval $csym; $val; then
9251                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9252                         val="$define"
9253                         vali="$undef"
9254                         echo "strchr() found." >&4
9255                 else
9256                         val="$undef"
9257                         vali="$define"
9258                         echo "index() found." >&4
9259                 fi
9260         else
9261                 val="$undef"
9262                 vali="$define"
9263                 echo "index() found." >&4
9264         fi
9265 else
9266         if set strchr val -f d_strchr; eval $csym; $val; then
9267                 val="$define"
9268                 vali="$undef"
9269                 echo "strchr() found." >&4
9270         else
9271                 echo "No index() or strchr() found!" >&4
9272                 val="$undef"
9273                 vali="$undef"
9274         fi
9275 fi
9276 set d_strchr; eval $setvar
9277 val="$vali"
9278 set d_index; eval $setvar
9279
9280 : check whether inet_aton exists
9281 set inet_aton d_inetaton
9282 eval $inlibc
9283
9284 : Look for isascii
9285 echo " "
9286 $cat >isascii.c <<'EOCP'
9287 #include <stdio.h>
9288 #include <ctype.h>
9289 int main() {
9290         int c = 'A';
9291         if (isascii(c))
9292                 exit(0);
9293         else
9294                 exit(1);
9295 }
9296 EOCP
9297 set isascii
9298 if eval $compile; then
9299         echo "isascii() found." >&4
9300         val="$define"
9301 else
9302         echo "isascii() NOT found." >&4
9303         val="$undef"
9304 fi
9305 set d_isascii
9306 eval $setvar
9307 $rm -f isascii*
9308
9309 : see if killpg exists
9310 set killpg d_killpg
9311 eval $inlibc
9312
9313 : see if lchown exists
9314 echo " "
9315 $cat > try.c <<'EOCP'
9316 /* System header to define __stub macros and hopefully few prototypes,
9317     which can conflict with char lchown(); below.  */
9318 #include <assert.h>
9319 /* Override any gcc2 internal prototype to avoid an error.  */
9320 /* We use char because int might match the return type of a gcc2
9321    builtin and then its argument prototype would still apply.  */
9322 char lchown();
9323 int main() {
9324     /*  The GNU C library defines this for functions which it implements
9325         to always fail with ENOSYS.  Some functions are actually named
9326         something starting with __ and the normal name is an alias.  */
9327 #if defined (__stub_lchown) || defined (__stub___lchown)
9328 choke me
9329 #else
9330 lchown();
9331 #endif
9332 ; return 0; }
9333 EOCP
9334 set try
9335 if eval $compile; then
9336     $echo "lchown() found." >&4
9337     val="$define"
9338 else
9339     $echo "lchown() NOT found." >&4
9340     val="$undef"
9341 fi
9342 set d_lchown
9343 eval $setvar
9344
9345 : See if number of significant digits in a double precision number is known
9346 echo " "
9347 $cat >ldbl_dig.c <<EOM
9348 #$i_limits I_LIMITS
9349 #$i_float I_FLOAT
9350 #ifdef I_LIMITS
9351 #include <limits.h>
9352 #endif
9353 #ifdef I_FLOAT
9354 #include <float.h>
9355 #endif
9356 #ifdef LDBL_DIG
9357 printf("Contains LDBL_DIG");
9358 #endif
9359 EOM
9360 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9361 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9362         echo "LDBL_DIG found." >&4
9363         val="$define"
9364 else
9365         echo "LDBL_DIG NOT found." >&4
9366         val="$undef"
9367 fi
9368 $rm -f ldbl_dig.?
9369 set d_ldbl_dig
9370 eval $setvar
9371
9372 : see if link exists
9373 set link d_link
9374 eval $inlibc
9375
9376 : see if localeconv exists
9377 set localeconv d_locconv
9378 eval $inlibc
9379
9380 : see if lockf exists
9381 set lockf d_lockf
9382 eval $inlibc
9383
9384 : check for long long
9385 echo " "
9386 $echo $n "Checking to see if your system supports long long..." $c >&4
9387 echo 'int main() { long long x = 7; return 0; }' > try.c
9388 set try
9389 if eval $compile; then
9390         val="$define"
9391         echo " Yes, it does." >&4
9392 else
9393         val="$undef"
9394         echo " No, it doesn't." >&4
9395 fi
9396 $rm try.*
9397 set d_longlong
9398 eval $setvar
9399
9400 : check for length of long long
9401 case "${d_longlong}${longlongsize}" in
9402 $define)
9403         echo " "
9404         $echo $n "Checking to see how big your long longs are..." $c >&4
9405         $cat >try.c <<'EOCP'
9406 #include <stdio.h>
9407 int main()
9408 {
9409     printf("%d\n", (int)sizeof(long long));
9410     return(0);
9411 }
9412 EOCP
9413         set try
9414         if eval $compile_ok; then
9415                 longlongsize=`./try$exe_ext`
9416                 $echo " $longlongsize bytes." >&4
9417         else
9418                 dflt='8'
9419                 echo " "
9420                 echo "(I can't seem to compile the test program.  Guessing...)"
9421                 rp="What is the size of a long long (in bytes)?"
9422                 . ./myread
9423                 longlongsize="$ans"
9424         fi
9425         if $test "X$longsize" = "X$longlongsize"; then
9426                 echo "(That isn't any different from an ordinary long.)"
9427         fi      
9428         ;;
9429 esac
9430 $rm -f try.* try
9431
9432 : see if lstat exists
9433 set lstat d_lstat
9434 eval $inlibc
9435
9436 : see if mblen exists
9437 set mblen d_mblen
9438 eval $inlibc
9439
9440 : see if mbstowcs exists
9441 set mbstowcs d_mbstowcs
9442 eval $inlibc
9443
9444 : see if mbtowc exists
9445 set mbtowc d_mbtowc
9446 eval $inlibc
9447
9448 : see if memchr exists
9449 set memchr d_memchr
9450 eval $inlibc
9451
9452 : see if memcmp exists
9453 set memcmp d_memcmp
9454 eval $inlibc
9455
9456 : see if memcpy exists
9457 set memcpy d_memcpy
9458 eval $inlibc
9459
9460 : see if memmove exists
9461 set memmove d_memmove
9462 eval $inlibc
9463
9464 : see if memset exists
9465 set memset d_memset
9466 eval $inlibc
9467
9468 : see if mkdir exists
9469 set mkdir d_mkdir
9470 eval $inlibc
9471
9472 : see if mkfifo exists
9473 set mkfifo d_mkfifo
9474 eval $inlibc
9475
9476 : see if mktime exists
9477 set mktime d_mktime
9478 eval $inlibc
9479
9480 : see if msgctl exists
9481 set msgctl d_msgctl
9482 eval $inlibc
9483
9484 : see if msgget exists
9485 set msgget d_msgget
9486 eval $inlibc
9487
9488 : see if msgsnd exists
9489 set msgsnd d_msgsnd
9490 eval $inlibc
9491
9492 : see if msgrcv exists
9493 set msgrcv d_msgrcv
9494 eval $inlibc
9495
9496 : see how much of the 'msg*(2)' library is present.
9497 h_msg=true
9498 echo " "
9499 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9500 *"$undef"*) h_msg=false;;
9501 esac
9502 case "$osname" in
9503 freebsd)
9504     case "`ipcs 2>&1`" in
9505     "SVID messages"*"not configured"*)
9506         echo "Your $osname does not have the msg*(2) configured." >&4
9507         h_msg=false
9508         val="$undef"
9509         set msgctl d_msgctl
9510         eval $setvar
9511         set msgget d_msgget
9512         eval $setvar
9513         set msgsnd d_msgsnd
9514         eval $setvar
9515         set msgrcv d_msgrcv
9516         eval $setvar
9517         ;;
9518     esac
9519     ;;
9520 esac
9521 : we could also check for sys/ipc.h ...
9522 if $h_msg && $test `./findhdr sys/msg.h`; then
9523         echo "You have the full msg*(2) library." >&4
9524         val="$define"
9525 else
9526         echo "You don't have the full msg*(2) library." >&4
9527         val="$undef"
9528 fi
9529 set d_msg
9530 eval $setvar
9531
9532 : see if nice exists
9533 set nice d_nice
9534 eval $inlibc
9535
9536 : see if POSIX threads are available
9537 set pthread.h i_pthread
9538 eval $inhdr
9539
9540
9541
9542
9543 : how to create joinable pthreads
9544 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9545         echo " "
9546         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9547         $cat >try.c <<'EOCP'
9548 #include <pthread.h>
9549 int main() {
9550     int detachstate = JOINABLE;
9551 }
9552 EOCP
9553         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9554         if eval $compile; then
9555                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9556                 val="$undef" # Yes, undef.
9557                 set d_old_pthread_create_joinable
9558                 eval $setvar
9559                 val=""
9560                 set old_pthread_create_joinable
9561                 eval $setvar
9562         else
9563                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9564                 if eval $compile; then
9565                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9566                         val="$define"
9567                         set d_old_pthread_create_joinable
9568                         eval $setvar
9569                         val=PTHREAD_CREATE_UNDETACHED
9570                         set old_pthread_create_joinable
9571                         eval $setvar
9572                 else            
9573                         set try -DJOINABLE=__UNDETACHED
9574                         if eval $compile; then
9575                                 echo "You seem to use __UNDETACHED." >&4
9576                                 val="$define"
9577                                 set d_old_pthread_create_joinable
9578                                 eval $setvar
9579                                 val=__UNDETACHED
9580                                 set old_pthread_create_joinable
9581                                 eval $setvar
9582                         else
9583                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9584                                 val="$define"
9585                                 set d_old_pthread_create_joinable
9586                                 eval $setvar
9587                                 val=0
9588                                 set old_pthread_create_joinable
9589                                 eval $setvar
9590                         fi
9591                 fi
9592         fi
9593         $rm -f try try.*
9594 else
9595     d_old_pthread_create_joinable="$undef"
9596     old_pthread_create_joinable=""
9597 fi
9598
9599 : see if pause exists
9600 set pause d_pause
9601 eval $inlibc
9602
9603 : see if pipe exists
9604 set pipe d_pipe
9605 eval $inlibc
9606
9607 : see if poll exists
9608 set poll d_poll
9609 eval $inlibc
9610
9611
9612 : see whether the various POSIXish _yields exist
9613 $cat >try.c <<EOP
9614 #include <pthread.h>
9615 #include <stdio.h>
9616 int main() {
9617 #ifdef SCHED_YIELD
9618         sched_yield();
9619 #else
9620 #ifdef PTHREAD_YIELD
9621         pthread_yield();
9622 #else
9623 #ifdef PTHREAD_YIELD_NULL
9624         pthread_yield(NULL);
9625 #endif
9626 #endif
9627 #endif
9628 }
9629 EOP
9630 : see if sched_yield exists
9631 set try -DSCHED_YIELD
9632 if eval $compile; then
9633     val="$define"
9634     sched_yield='sched_yield()'
9635 else
9636     val="$undef"
9637 fi
9638 case "$usethreads" in
9639 $define)
9640         case "$val" in
9641         $define) echo 'sched_yield() found.' >&4        ;;
9642         *)       echo 'sched_yield() NOT found.' >&4    ;;
9643         esac
9644 esac
9645 set d_sched_yield
9646 eval $setvar
9647
9648 : see if pthread_yield exists
9649 set try -DPTHREAD_YIELD
9650 if eval $compile; then
9651     val="$define"
9652     case "$sched_yield" in
9653     '') sched_yield='pthread_yield()' ;;
9654     esac
9655 else
9656     set try -DPTHREAD_YIELD_NULL
9657     if eval $compile; then
9658         val="$define"
9659         case "$sched_yield" in
9660         '') sched_yield='pthread_yield(NULL)' ;;
9661         esac
9662     else
9663         val="$undef"
9664     fi
9665 fi
9666 case "$usethreads" in
9667 $define)
9668         case "$val" in
9669         $define) echo 'pthread_yield() found.' >&4      ;;
9670         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9671         esac
9672         ;;
9673 esac
9674 set d_pthread_yield
9675 eval $setvar
9676
9677 case "$sched_yield" in
9678 '') sched_yield=undef ;;
9679 esac
9680
9681 $rm -f try try.*
9682
9683 : see if this is a pwd.h system
9684 set pwd.h i_pwd
9685 eval $inhdr
9686
9687 case "$i_pwd" in
9688 $define)
9689         xxx=`./findhdr pwd.h`
9690         $cppstdin $cppflags $cppminus < $xxx >$$.h
9691
9692         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9693                 val="$define"
9694         else
9695                 val="$undef"
9696         fi
9697         set d_pwquota
9698         eval $setvar
9699
9700         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9701                 val="$define"
9702         else
9703                 val="$undef"
9704         fi
9705         set d_pwage
9706         eval $setvar
9707
9708         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9709                 val="$define"
9710         else
9711                 val="$undef"
9712         fi
9713         set d_pwchange
9714         eval $setvar
9715
9716         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9717                 val="$define"
9718         else
9719                 val="$undef"
9720         fi
9721         set d_pwclass
9722         eval $setvar
9723
9724         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9725                 val="$define"
9726         else
9727                 val="$undef"
9728         fi
9729         set d_pwexpire
9730         eval $setvar
9731
9732         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9733                 val="$define"
9734         else
9735                 val="$undef"
9736         fi
9737         set d_pwcomment
9738         eval $setvar
9739
9740         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9741                 val="$define"
9742         else
9743                 val="$undef"
9744         fi
9745         set d_pwgecos
9746         eval $setvar
9747
9748         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9749                 val="$define"
9750         else
9751                 val="$undef"
9752         fi
9753         set d_pwpasswd
9754         eval $setvar
9755
9756         $rm -f $$.h
9757         ;;
9758 *)
9759         val="$undef"; 
9760         set d_pwquota; eval $setvar
9761         set d_pwage; eval $setvar
9762         set d_pwchange; eval $setvar
9763         set d_pwclass; eval $setvar
9764         set d_pwexpire; eval $setvar
9765         set d_pwcomment; eval $setvar
9766         set d_pwgecos; eval $setvar
9767         set d_pwpasswd; eval $setvar
9768         ;;
9769 esac
9770
9771 : see if inttypes.h is available
9772 : we want a real compile instead of Inhdr because some systems
9773 : have an inttypes.h which includes non-existent headers
9774 echo " "
9775 $cat >try.c <<EOCP
9776 #include <inttypes.h>
9777 int main() {
9778         static int32_t foo32 = 0x12345678;
9779 }
9780 EOCP
9781 set try
9782 if eval $compile; then
9783         echo "<inttypes.h> found." >&4
9784         val="$define"
9785 else
9786         echo "<inttypes.h> NOT found." >&4
9787         val="$undef"
9788 fi
9789 $rm -f try.c try
9790 set i_inttypes
9791 eval $setvar
9792
9793 : check for int64_t
9794 echo " "
9795 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9796 $cat >try.c <<EOCP
9797 #include <sys/types.h>
9798 #$i_inttypes I_INTTYPES
9799 #ifdef I_INTTYPES
9800 #include <inttypes.h>
9801 #endif
9802 int main() { int64_t x = 7; }
9803 EOCP
9804 set try
9805 if eval $compile; then
9806         val="$define"
9807         echo " Yes, it does." >&4
9808 else
9809         val="$undef"
9810         echo " No, it doesn't." >&4
9811 fi
9812 $rm -f try try.*
9813 set d_int64t
9814 eval $setvar
9815
9816
9817 echo " "
9818 echo "Checking which 64-bit integer type we could use..." >&4
9819
9820 case "$intsize" in
9821 8) val=int
9822    set quadtype
9823    eval $setvar
9824    val='"unsigned int"'
9825    set uquadtype
9826    eval $setvar
9827    quadkind=1
9828    ;;
9829 *) case "$longsize" in
9830    8) val=long
9831       set quadtype
9832       eval $setvar
9833       val='"unsigned long"'
9834       set uquadtype
9835       eval $setvar
9836       quadkind=2
9837       ;;
9838    *) case "$uselonglong:$d_longlong:$longlongsize" in
9839       define:define:8)
9840         val='"long long"'
9841         set quadtype
9842         eval $setvar
9843         val='"unsigned long long"'
9844         set uquadtype
9845         eval $setvar
9846         quadkind=3
9847         ;;
9848       *) case "$d_int64t" in
9849          define)
9850            val=int64_t
9851            set quadtype
9852            eval $setvar
9853            val=uint64_t
9854            set uquadtype
9855            eval $setvar
9856            quadkind=4
9857            ;;
9858          esac
9859          ;;
9860       esac
9861       ;;
9862    esac
9863    ;;
9864 esac
9865
9866 case "$quadtype" in
9867 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9868         undef:define:8)
9869            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9870         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9871         esac
9872         d_quad="$undef"
9873         ;;
9874 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9875             verb="will"
9876         else
9877             verb="could"
9878         fi
9879         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9880         d_quad="$define"
9881         ;;
9882 esac
9883
9884 : see if readdir and friends exist
9885 set readdir d_readdir
9886 eval $inlibc
9887 set seekdir d_seekdir
9888 eval $inlibc
9889 set telldir d_telldir
9890 eval $inlibc
9891 set rewinddir d_rewinddir
9892 eval $inlibc
9893
9894 : see if readlink exists
9895 set readlink d_readlink
9896 eval $inlibc
9897
9898 : see if rename exists
9899 set rename d_rename
9900 eval $inlibc
9901
9902 : see if rmdir exists
9903 set rmdir d_rmdir
9904 eval $inlibc
9905
9906 : see if memory.h is available.
9907 val=''
9908 set memory.h val
9909 eval $inhdr
9910
9911 : See if it conflicts with string.h
9912 case "$val" in
9913 $define)
9914         case "$strings" in
9915         '') ;;
9916         *)
9917                 $cppstdin $cppflags $cppminus < $strings > mem.h
9918                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9919                         echo " "
9920                         echo "We won't be including <memory.h>."
9921                         val="$undef"
9922                 fi
9923                 $rm -f mem.h
9924                 ;;
9925         esac
9926 esac
9927 set i_memory
9928 eval $setvar
9929
9930 : can bcopy handle overlapping blocks?
9931 val="$undef"
9932 case "$d_bcopy" in
9933 "$define")
9934         echo " "
9935         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9936         $cat >try.c <<EOCP
9937 #$i_memory I_MEMORY
9938 #$i_stdlib I_STDLIB
9939 #$i_string I_STRING
9940 #$i_unistd I_UNISTD
9941 EOCP
9942         $cat >>try.c <<'EOCP'
9943 #include <stdio.h>
9944 #ifdef I_MEMORY
9945 #  include <memory.h>
9946 #endif
9947 #ifdef I_STDLIB
9948 #  include <stdlib.h>
9949 #endif
9950 #ifdef I_STRING
9951 #  include <string.h>
9952 #else
9953 #  include <strings.h>
9954 #endif
9955 #ifdef I_UNISTD
9956 #  include <unistd.h>  /* Needed for NetBSD */
9957 #endif
9958 int main()
9959 {
9960 char buf[128], abc[128];
9961 char *b;
9962 int len;
9963 int off;
9964 int align;
9965
9966 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9967
9968 for (align = 7; align >= 0; align--) {
9969         for (len = 36; len; len--) {
9970                 b = buf+align;
9971                 bcopy(abc, b, len);
9972                 for (off = 1; off <= len; off++) {
9973                         bcopy(b, b+off, len);
9974                         bcopy(b+off, b, len);
9975                         if (bcmp(b, abc, len))
9976                                 exit(1);
9977                 }
9978         }
9979 }
9980 exit(0);
9981 }
9982 EOCP
9983         set try
9984         if eval $compile_ok; then
9985                 if ./try 2>/dev/null; then
9986                         echo "Yes, it can."
9987                         val="$define"
9988                 else
9989                         echo "It can't, sorry."
9990                         case "$d_memmove" in
9991                         "$define") echo "But that's Ok since you have memmove()." ;;
9992                         esac
9993                 fi
9994         else
9995                 echo "(I can't compile the test program, so we'll assume not...)"
9996                 case "$d_memmove" in
9997                 "$define") echo "But that's Ok since you have memmove()." ;;
9998                 esac
9999         fi
10000         ;;
10001 esac
10002 $rm -f try.* try core
10003 set d_safebcpy
10004 eval $setvar
10005
10006 : can memcpy handle overlapping blocks?
10007 val="$undef"
10008 case "$d_memcpy" in
10009 "$define")
10010         echo " "
10011         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10012         $cat >try.c <<EOCP
10013 #$i_memory I_MEMORY
10014 #$i_stdlib I_STDLIB
10015 #$i_string I_STRING
10016 #$i_unistd I_UNISTD
10017 EOCP
10018         $cat >>try.c <<'EOCP'
10019 #include <stdio.h>
10020 #ifdef I_MEMORY
10021 #  include <memory.h>
10022 #endif
10023 #ifdef I_STDLIB
10024 #  include <stdlib.h>
10025 #endif
10026 #ifdef I_STRING
10027 #  include <string.h>
10028 #else
10029 #  include <strings.h>
10030 #endif
10031 #ifdef I_UNISTD
10032 #  include <unistd.h>  /* Needed for NetBSD */
10033 #endif
10034 int main()
10035 {
10036 char buf[128], abc[128];
10037 char *b;
10038 int len;
10039 int off;
10040 int align;
10041
10042 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10043    try to store the string in read-only memory. */
10044 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10045
10046 for (align = 7; align >= 0; align--) {
10047         for (len = 36; len; len--) {
10048                 b = buf+align;
10049                 memcpy(b, abc, len);
10050                 for (off = 1; off <= len; off++) {
10051                         memcpy(b+off, b, len);
10052                         memcpy(b, b+off, len);
10053                         if (memcmp(b, abc, len))
10054                                 exit(1);
10055                 }
10056         }
10057 }
10058 exit(0);
10059 }
10060 EOCP
10061         set try
10062         if eval $compile_ok; then
10063                 if ./try 2>/dev/null; then
10064                         echo "Yes, it can."
10065                         val="$define"
10066                 else
10067                         echo "It can't, sorry."
10068                         case "$d_memmove" in
10069                         "$define") echo "But that's Ok since you have memmove()." ;;
10070                         esac
10071                 fi
10072         else
10073                 echo "(I can't compile the test program, so we'll assume not...)"
10074                 case "$d_memmove" in
10075                 "$define") echo "But that's Ok since you have memmove()." ;;
10076                 esac
10077         fi
10078         ;;
10079 esac
10080 $rm -f try.* try core
10081 set d_safemcpy
10082 eval $setvar
10083
10084 : can memcmp be trusted to compare relative magnitude?
10085 val="$undef"
10086 case "$d_memcmp" in
10087 "$define")
10088         echo " "
10089         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10090         $cat >try.c <<EOCP
10091 #$i_memory I_MEMORY
10092 #$i_stdlib I_STDLIB
10093 #$i_string I_STRING
10094 #$i_unistd I_UNISTD
10095 EOCP
10096         $cat >>try.c <<'EOCP'
10097 #include <stdio.h>
10098 #ifdef I_MEMORY
10099 #  include <memory.h>
10100 #endif
10101 #ifdef I_STDLIB
10102 #  include <stdlib.h>
10103 #endif
10104 #ifdef I_STRING
10105 #  include <string.h>
10106 #else
10107 #  include <strings.h>
10108 #endif
10109 #ifdef I_UNISTD
10110 #  include <unistd.h>  /* Needed for NetBSD */
10111 #endif
10112 int main()
10113 {
10114 char a = -1;
10115 char b = 0;
10116 if ((a < b) && memcmp(&a, &b, 1) < 0)
10117         exit(1);
10118 exit(0);
10119 }
10120 EOCP
10121         set try
10122         if eval $compile_ok; then
10123                 if ./try 2>/dev/null; then
10124                         echo "Yes, it can."
10125                         val="$define"
10126                 else
10127                         echo "No, it can't (it uses signed chars)."
10128                 fi
10129         else
10130                 echo "(I can't compile the test program, so we'll assume not...)"
10131         fi
10132         ;;
10133 esac
10134 $rm -f try.* try core
10135 set d_sanemcmp
10136 eval $setvar
10137
10138 : see if select exists
10139 set select d_select
10140 eval $inlibc
10141
10142 : see if semctl exists
10143 set semctl d_semctl
10144 eval $inlibc
10145
10146 : see if semget exists
10147 set semget d_semget
10148 eval $inlibc
10149
10150 : see if semop exists
10151 set semop d_semop
10152 eval $inlibc
10153
10154 : see how much of the 'sem*(2)' library is present.
10155 h_sem=true
10156 echo " "
10157 case "$d_semctl$d_semget$d_semop" in
10158 *"$undef"*) h_sem=false;;
10159 esac
10160 case "$osname" in
10161 freebsd)
10162     case "`ipcs 2>&1`" in
10163     "SVID messages"*"not configured"*)
10164         echo "Your $osname does not have the sem*(2) configured." >&4
10165         h_sem=false
10166         val="$undef"
10167         set semctl d_semctl
10168         eval $setvar
10169         set semget d_semget
10170         eval $setvar
10171         set semop d_semop
10172         eval $setvar
10173         ;;
10174     esac
10175     ;;
10176 esac
10177 : we could also check for sys/ipc.h ...
10178 if $h_sem && $test `./findhdr sys/sem.h`; then
10179         echo "You have the full sem*(2) library." >&4
10180         val="$define"
10181 else
10182         echo "You don't have the full sem*(2) library." >&4
10183         val="$undef"
10184 fi
10185 set d_sem
10186 eval $setvar
10187
10188 : see whether sys/sem.h defines union semun
10189 echo " "
10190 $cat > try.c <<'END'
10191 #include <sys/types.h>
10192 #include <sys/ipc.h>
10193 #include <sys/sem.h>
10194 int main () { union semun semun; semun.buf = 0; }
10195 END
10196 set try
10197 if eval $compile; then
10198     echo "You have union semun in <sys/sem.h>." >&4
10199     val="$define"
10200 else
10201     echo "You do not have union semun in <sys/sem.h>." >&4
10202     val="$undef"
10203 fi
10204 $rm -f try try.c try.h
10205 set d_union_semun
10206 eval $setvar
10207
10208 : see how to do semctl IPC_STAT
10209 case "$d_sem" in
10210 $define)
10211     : see whether semctl IPC_STAT can use union semun
10212     echo " "
10213     $cat > try.h <<END
10214 #ifndef S_IRUSR
10215 #   ifdef S_IREAD
10216 #       define S_IRUSR S_IREAD
10217 #       define S_IWUSR S_IWRITE
10218 #       define S_IXUSR S_IEXEC
10219 #   else
10220 #       define S_IRUSR 0400
10221 #       define S_IWUSR 0200
10222 #       define S_IXUSR 0100
10223 #   endif
10224 #   define S_IRGRP (S_IRUSR>>3)
10225 #   define S_IWGRP (S_IWUSR>>3)
10226 #   define S_IXGRP (S_IXUSR>>3)
10227 #   define S_IROTH (S_IRUSR>>6)
10228 #   define S_IWOTH (S_IWUSR>>6)
10229 #   define S_IXOTH (S_IXUSR>>6)
10230 #endif
10231 #ifndef S_IRWXU
10232 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10233 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10234 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10235 #endif
10236 END
10237
10238     $cat > try.c <<END
10239 #include <sys/types.h>
10240 #include <sys/ipc.h>
10241 #include <sys/sem.h>
10242 #include <sys/stat.h>
10243 #include <stdio.h>
10244 #include <errno.h>
10245 #include "try.h"
10246 #ifndef errno
10247 extern int errno;
10248 #endif
10249 #$d_union_semun HAS_UNION_SEMUN
10250 int main() {
10251     union semun
10252 #ifndef HAS_UNION_SEMUN
10253     {
10254         int val;
10255         struct semid_ds *buf;
10256         unsigned short *array;
10257     }
10258 #endif
10259     arg;
10260     int sem, st;
10261
10262 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10263     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10264     if (sem > -1) {
10265         struct semid_ds argbuf;
10266         arg.buf = &argbuf;
10267 #       ifdef IPC_STAT
10268         st = semctl(sem, 0, IPC_STAT, arg);
10269         if (st == 0)
10270             printf("semun\n");
10271         else
10272 #       endif /* IPC_STAT */
10273             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10274 #       ifdef IPC_RMID
10275         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10276 #       endif /* IPC_RMID */
10277             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10278     } else
10279 #endif /* IPC_PRIVATE && ... */
10280         printf("semget failed: errno = %d\n", errno);
10281   return 0;
10282 }
10283 END
10284     val="$undef"
10285     set try
10286     if eval $compile; then
10287         xxx=`./try`
10288         case "$xxx" in
10289         semun) val="$define" ;;
10290         esac
10291     fi
10292     $rm -f try try.c
10293     set d_semctl_semun
10294     eval $setvar
10295     case "$d_semctl_semun" in
10296     $define)
10297         echo "You can use union semun for semctl IPC_STAT." >&4
10298         also='also'
10299         ;;
10300     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10301         also=''
10302         ;;
10303     esac
10304
10305     : see whether semctl IPC_STAT can use struct semid_ds pointer
10306     $cat > try.c <<'END'
10307 #include <sys/types.h>
10308 #include <sys/ipc.h>
10309 #include <sys/sem.h>
10310 #include <sys/stat.h>
10311 #include "try.h"
10312 #include <stdio.h>
10313 #include <errno.h>
10314 #ifndef errno
10315 extern int errno;
10316 #endif
10317 int main() {
10318     struct semid_ds arg;
10319     int sem, st;
10320
10321 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10322     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10323     if (sem > -1) {
10324 #       ifdef IPC_STAT
10325         st = semctl(sem, 0, IPC_STAT, &arg);
10326         if (st == 0)
10327             printf("semid_ds\n");
10328         else
10329 #       endif /* IPC_STAT */
10330             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10331 #       ifdef IPC_RMID
10332         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10333 #       endif /* IPC_RMID */
10334             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10335     } else
10336 #endif /* IPC_PRIVATE && ... */
10337         printf("semget failed: errno = %d\n", errno);
10338
10339     return 0;
10340 }
10341 END
10342     val="$undef"
10343     set try
10344     if eval $compile; then
10345         xxx=`./try`
10346         case "$xxx" in
10347         semid_ds) val="$define" ;;
10348         esac
10349     fi
10350     $rm -f try try.c
10351     set d_semctl_semid_ds
10352     eval $setvar
10353     case "$d_semctl_semid_ds" in
10354     $define)
10355         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10356         ;;
10357     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10358         ;;
10359     esac
10360     $rm -f try.h
10361     ;;
10362 *)  val="$undef"
10363
10364     # We do not have the full sem*(2) library, so assume we can not
10365     # use either.
10366
10367     set d_semctl_semun
10368     eval $setvar
10369
10370     set d_semctl_semid_ds
10371     eval $setvar
10372     ;;
10373 esac
10374
10375 : see if setegid exists
10376 set setegid d_setegid
10377 eval $inlibc
10378
10379 : see if seteuid exists
10380 set seteuid d_seteuid
10381 eval $inlibc
10382
10383 : see if setgrent exists
10384 set setgrent d_setgrent
10385 eval $inlibc
10386
10387 : see if sethostent exists
10388 set sethostent d_sethent
10389 eval $inlibc
10390
10391 : see if setlinebuf exists
10392 set setlinebuf d_setlinebuf
10393 eval $inlibc
10394
10395 : see if setlocale exists
10396 set setlocale d_setlocale
10397 eval $inlibc
10398
10399 : see if setnetent exists
10400 set setnetent d_setnent
10401 eval $inlibc
10402
10403 : see if setprotoent exists
10404 set setprotoent d_setpent
10405 eval $inlibc
10406
10407 : see if setpgid exists
10408 set setpgid d_setpgid
10409 eval $inlibc
10410
10411 : see if setpgrp2 exists
10412 set setpgrp2 d_setpgrp2
10413 eval $inlibc
10414
10415 : see if setpriority exists
10416 set setpriority d_setprior
10417 eval $inlibc
10418
10419 : see if setpwent exists
10420 set setpwent d_setpwent
10421 eval $inlibc
10422
10423 : see if setregid exists
10424 set setregid d_setregid
10425 eval $inlibc
10426 set setresgid d_setresgid
10427 eval $inlibc
10428
10429 : see if setreuid exists
10430 set setreuid d_setreuid
10431 eval $inlibc
10432 set setresuid d_setresuid
10433 eval $inlibc
10434
10435 : see if setrgid exists
10436 set setrgid d_setrgid
10437 eval $inlibc
10438
10439 : see if setruid exists
10440 set setruid d_setruid
10441 eval $inlibc
10442
10443 : see if setservent exists
10444 set setservent d_setsent
10445 eval $inlibc
10446
10447 : see if setsid exists
10448 set setsid d_setsid
10449 eval $inlibc
10450
10451 : see if setspent exists
10452 set setspent d_setspent
10453 eval $inlibc
10454
10455 : see if setvbuf exists
10456 set setvbuf d_setvbuf
10457 eval $inlibc
10458
10459 : see if sfio.h is available
10460 set sfio.h i_sfio
10461 eval $inhdr
10462
10463
10464 : see if sfio library is available
10465 case "$i_sfio" in
10466 $define)
10467         val=''
10468         set sfreserve val
10469         eval $inlibc
10470         ;;
10471 *)
10472         val="$undef"
10473         ;;
10474 esac
10475 : Ok, but do we want to use it.
10476 case "$val" in
10477 $define)
10478         case "$usesfio" in
10479         true|$define|[yY]*) dflt='y';;
10480         *) dflt='n';;
10481         esac
10482         echo "$package can use the sfio library, but it is experimental."
10483         rp="You seem to have sfio available, do you want to try using it?"
10484         . ./myread
10485         case "$ans" in
10486         y|Y) ;;
10487         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10488                 val="$undef"
10489                 : Remove sfio from list of libraries to use
10490                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10491                 shift
10492                 libs="$*"
10493                 echo "libs = $libs" >&4
10494                 ;;
10495         esac
10496         ;;
10497 *)      case "$usesfio" in
10498         true|$define|[yY]*)
10499                 echo "Sorry, cannot find sfio on this machine" >&4
10500                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10501                 ;;
10502         esac
10503         ;;
10504 esac
10505 set d_sfio
10506 eval $setvar
10507 case "$d_sfio" in
10508 $define) usesfio='true';;
10509 *) usesfio='false';;
10510 esac
10511
10512 : see if shmctl exists
10513 set shmctl d_shmctl
10514 eval $inlibc
10515
10516 : see if shmget exists
10517 set shmget d_shmget
10518 eval $inlibc
10519
10520 : see if shmat exists
10521 set shmat d_shmat
10522 eval $inlibc
10523 : see what shmat returns
10524 case "$d_shmat" in
10525 "$define")
10526         $cat >shmat.c <<'END'
10527 #include <sys/shm.h>
10528 void *shmat();
10529 END
10530         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10531                 shmattype='void *'
10532         else
10533                 shmattype='char *'
10534         fi
10535         echo "and it returns ($shmattype)." >&4
10536         : see if a prototype for shmat is available
10537         xxx=`./findhdr sys/shm.h`
10538         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10539         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10540                 val="$define"
10541         else
10542                 val="$undef"
10543         fi
10544         $rm -f shmat.[co]
10545         ;;
10546 *)
10547         val="$undef"
10548         ;;
10549 esac
10550 set d_shmatprototype
10551 eval $setvar
10552
10553 : see if shmdt exists
10554 set shmdt d_shmdt
10555 eval $inlibc
10556
10557 : see how much of the 'shm*(2)' library is present.
10558 h_shm=true
10559 echo " "
10560 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10561 *"$undef"*) h_shm=false;;
10562 esac
10563 case "$osname" in
10564 freebsd)
10565     case "`ipcs 2>&1`" in
10566     "SVID shared memory"*"not configured"*)
10567         echo "Your $osname does not have the shm*(2) configured." >&4
10568         h_shm=false
10569         val="$undef"
10570         set shmctl d_shmctl
10571         evat $setvar
10572         set shmget d_shmget
10573         evat $setvar
10574         set shmat d_shmat
10575         evat $setvar
10576         set shmdt d_shmdt
10577         evat $setvar
10578         ;;
10579     esac
10580     ;;
10581 esac
10582 : we could also check for sys/ipc.h ...
10583 if $h_shm && $test `./findhdr sys/shm.h`; then
10584         echo "You have the full shm*(2) library." >&4
10585         val="$define"
10586 else
10587         echo "You don't have the full shm*(2) library." >&4
10588         val="$undef"
10589 fi
10590 set d_shm
10591 eval $setvar
10592
10593 echo " "
10594 : see if we have sigaction
10595 if set sigaction val -f d_sigaction; eval $csym; $val; then
10596         echo 'sigaction() found.' >&4
10597         $cat > try.c <<'EOP'
10598 #include <stdio.h>
10599 #include <sys/types.h>
10600 #include <signal.h>
10601 int main()
10602 {
10603     struct sigaction act, oact;
10604     act.sa_flags = 0;
10605     oact.sa_handler = 0;
10606     /* so that act and oact are used */
10607     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10608 }
10609 EOP
10610         set try
10611         if eval $compile_ok; then
10612                 val="$define"
10613         else
10614                 echo "But you don't seem to have a useable struct sigaction." >&4
10615                 val="$undef"
10616         fi
10617 else
10618         echo 'sigaction NOT found.' >&4
10619         val="$undef"
10620 fi
10621 set d_sigaction; eval $setvar
10622 $rm -f try try$_o try.c
10623
10624 : see if sigsetjmp exists
10625 echo " "
10626 case "$d_sigsetjmp" in
10627 '')
10628         $cat >try.c <<'EOP'
10629 #include <setjmp.h>
10630 sigjmp_buf env;
10631 int set = 1;
10632 int main()
10633 {
10634         if (sigsetjmp(env,1))
10635                 exit(set);
10636         set = 0;
10637         siglongjmp(env, 1);
10638         exit(1);
10639 }
10640 EOP
10641         set try
10642         if eval $compile; then
10643                 if ./try >/dev/null 2>&1; then
10644                         echo "POSIX sigsetjmp found." >&4
10645                         val="$define"
10646                 else
10647                         $cat >&4 <<EOM
10648 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10649 I'll ignore them.
10650 EOM
10651                         val="$undef"
10652                 fi
10653         else
10654                 echo "sigsetjmp not found." >&4
10655                 val="$undef"
10656         fi
10657         ;;
10658 *) val="$d_sigsetjmp"
10659         case "$d_sigsetjmp" in
10660         $define) echo "POSIX sigsetjmp found." >&4;;
10661         $undef) echo "sigsetjmp not found." >&4;;
10662         esac
10663         ;;
10664 esac
10665 set d_sigsetjmp
10666 eval $setvar
10667 $rm -f try.c try
10668
10669 : see if sqrtl exists
10670 set sqrtl d_sqrtl
10671 eval $inlibc
10672
10673 : see if sys/stat.h is available
10674 set sys/stat.h i_sysstat
10675 eval $inhdr
10676
10677
10678 : see if stat knows about block sizes
10679 echo " "
10680 echo "Checking to see if your struct stat has st_blocks field..." >&4
10681 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10682 eval $hasfield
10683
10684
10685 : see if this is a sys/vfs.h system
10686 set sys/vfs.h i_sysvfs
10687 eval $inhdr
10688
10689
10690 : see if this is a sys/statfs.h system
10691 set sys/statfs.h i_sysstatfs
10692 eval $inhdr
10693
10694
10695 echo " "
10696 echo "Checking to see if your system supports struct statfs..." >&4
10697 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
10698 eval $hasstruct
10699 case "$d_statfs_s" in
10700 "$define")      echo "Yes, it does."   ;;
10701 *)              echo "No, it doesn't." ;;
10702 esac
10703
10704
10705
10706 : see if struct statfs knows about f_flags
10707 case "$d_statfs_s" in
10708 define) 
10709         echo " "
10710         echo "Checking to see if your struct statfs has f_flags field..." >&4
10711         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
10712         eval $hasfield
10713         ;;
10714 *)      val="$undef"
10715         set d_statfs_f_flags
10716         eval $setvar
10717         ;;
10718 esac
10719 case "$d_statfs_f_flags" in
10720 "$define")      echo "Yes, it does."   ;;
10721 *)              echo "No, it doesn't." ;;
10722 esac
10723
10724 : see if _ptr and _cnt from stdio act std
10725 echo " "
10726 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10727         echo "(Looks like you have stdio.h from Linux.)"
10728         case "$stdio_ptr" in
10729         '') stdio_ptr='((fp)->_IO_read_ptr)'
10730                 ptr_lval=$define
10731                 ;;
10732         *)      ptr_lval=$d_stdio_ptr_lval;;
10733         esac
10734         case "$stdio_cnt" in
10735         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10736                 cnt_lval=$undef
10737                 ;;
10738         *)      cnt_lval=$d_stdio_cnt_lval;;
10739         esac
10740         case "$stdio_base" in
10741         '') stdio_base='((fp)->_IO_read_base)';;
10742         esac
10743         case "$stdio_bufsiz" in
10744         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10745         esac
10746 else
10747         case "$stdio_ptr" in
10748         '') stdio_ptr='((fp)->_ptr)'
10749                 ptr_lval=$define
10750                 ;;
10751         *)      ptr_lval=$d_stdio_ptr_lval;;
10752         esac
10753         case "$stdio_cnt" in
10754         '') stdio_cnt='((fp)->_cnt)'
10755                 cnt_lval=$define
10756                 ;;
10757         *)      cnt_lval=$d_stdio_cnt_lval;;
10758         esac
10759         case "$stdio_base" in
10760         '') stdio_base='((fp)->_base)';;
10761         esac
10762         case "$stdio_bufsiz" in
10763         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10764         esac
10765 fi
10766 : test whether _ptr and _cnt really work
10767 echo "Checking how std your stdio is..." >&4
10768 $cat >try.c <<EOP
10769 #include <stdio.h>
10770 #define FILE_ptr(fp)    $stdio_ptr
10771 #define FILE_cnt(fp)    $stdio_cnt
10772 int main() {
10773         FILE *fp = fopen("try.c", "r");
10774         char c = getc(fp);
10775         if (
10776                 18 <= FILE_cnt(fp) &&
10777                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10778         )
10779                 exit(0);
10780         exit(1);
10781 }
10782 EOP
10783 val="$undef"
10784 set try
10785 if eval $compile; then
10786         if ./try; then
10787                 echo "Your stdio acts pretty std."
10788                 val="$define"
10789         else
10790                 echo "Your stdio isn't very std."
10791         fi
10792 else
10793         echo "Your stdio doesn't appear very std."
10794 fi
10795 $rm -f try.c try
10796 set d_stdstdio
10797 eval $setvar
10798
10799 : Can _ptr be used as an lvalue?
10800 case "$d_stdstdio$ptr_lval" in
10801 $define$define) val=$define ;;
10802 *) val=$undef ;;
10803 esac
10804 set d_stdio_ptr_lval
10805 eval $setvar
10806
10807 : Can _cnt be used as an lvalue?
10808 case "$d_stdstdio$cnt_lval" in
10809 $define$define) val=$define ;;
10810 *) val=$undef ;;
10811 esac
10812 set d_stdio_cnt_lval
10813 eval $setvar
10814
10815 : see if _base is also standard
10816 val="$undef"
10817 case "$d_stdstdio" in
10818 $define)
10819         $cat >try.c <<EOP
10820 #include <stdio.h>
10821 #define FILE_base(fp)   $stdio_base
10822 #define FILE_bufsiz(fp) $stdio_bufsiz
10823 int main() {
10824         FILE *fp = fopen("try.c", "r");
10825         char c = getc(fp);
10826         if (
10827                 19 <= FILE_bufsiz(fp) &&
10828                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10829         )
10830                 exit(0);
10831         exit(1);
10832 }
10833 EOP
10834         set try
10835         if eval $compile; then
10836                 if ./try; then
10837                         echo "And its _base field acts std."
10838                         val="$define"
10839                 else
10840                         echo "But its _base field isn't std."
10841                 fi
10842         else
10843                 echo "However, it seems to be lacking the _base field."
10844         fi
10845         $rm -f try.c try
10846         ;;
10847 esac
10848 set d_stdiobase
10849 eval $setvar
10850
10851 $cat >&4 <<EOM
10852 Checking how to access stdio streams by file descriptor number...
10853 EOM
10854 case "$stdio_stream_array" in
10855 '')     $cat >try.c <<EOCP
10856 #include <stdio.h>
10857 int main() {
10858   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10859     printf("yes\n");
10860 }
10861 EOCP
10862         for s in _iob __iob __sF
10863         do
10864                 set try -DSTDIO_STREAM_ARRAY=$s
10865                 if eval $compile; then
10866                         case "`./try$exe_ext`" in
10867                         yes)    stdio_stream_array=$s; break ;;
10868                         esac
10869                 fi
10870         done
10871         $rm -f try.* try$exe_ext
10872 esac
10873 case "$stdio_stream_array" in
10874 '')     $cat >&4 <<EOM
10875 I can't figure out how to access stdio streams by file descriptor number.
10876 EOM
10877         d_stdio_stream_array="$undef"
10878         ;;
10879 *)      $cat >&4 <<EOM
10880 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10881 EOM
10882         d_stdio_stream_array="$define"
10883         ;;
10884 esac
10885
10886 : see if strcoll exists
10887 set strcoll d_strcoll
10888 eval $inlibc
10889
10890 : check for structure copying
10891 echo " "
10892 echo "Checking to see if your C compiler can copy structs..." >&4
10893 $cat >try.c <<'EOCP'
10894 int main()
10895 {
10896         struct blurfl {
10897                 int dyick;
10898         } foo, bar;
10899
10900         foo = bar;
10901 }
10902 EOCP
10903 if $cc -c try.c >/dev/null 2>&1 ; then
10904         val="$define"
10905         echo "Yup, it can."
10906 else
10907         val="$undef"
10908         echo "Nope, it can't."
10909 fi
10910 set d_strctcpy
10911 eval $setvar
10912 $rm -f try.*
10913
10914 : see if strerror and/or sys_errlist[] exist
10915 echo " "
10916 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10917     if set strerror val -f d_strerror; eval $csym; $val; then
10918                 echo 'strerror() found.' >&4
10919                 d_strerror="$define"
10920                 d_strerrm='strerror(e)'
10921                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10922                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10923                         d_syserrlst="$define"
10924                 else
10925                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10926                         d_syserrlst="$undef"
10927                 fi
10928     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10929                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10930                 echo 'strerror() found in string header.' >&4
10931                 d_strerror="$define"
10932                 d_strerrm='strerror(e)'
10933                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10934                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10935                                 d_syserrlst="$define"
10936                 else
10937                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10938                         d_syserrlst="$undef"
10939                 fi
10940     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10941                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10942                 d_strerror="$undef"
10943                 d_syserrlst="$define"
10944                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10945     else
10946                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10947                 d_strerror="$undef"
10948                 d_syserrlst="$undef"
10949                 d_strerrm='"unknown"'
10950     fi
10951 fi
10952
10953 : see if strtod exists
10954 set strtod d_strtod
10955 eval $inlibc
10956
10957 : see if strtol exists
10958 set strtol d_strtol
10959 eval $inlibc
10960
10961 : see if strtold exists
10962 set strtold d_strtold
10963 eval $inlibc
10964
10965 : see if strtoul exists
10966 set strtoul d_strtoul
10967 eval $inlibc
10968
10969 : see if strtoull exists
10970 set strtoull d_strtoull
10971 eval $inlibc
10972
10973 : see if strtouq exists
10974 set strtouq d_strtouq
10975 eval $inlibc
10976
10977 : see if strxfrm exists
10978 set strxfrm d_strxfrm
10979 eval $inlibc
10980
10981 : see if symlink exists
10982 set symlink d_symlink
10983 eval $inlibc
10984
10985 : see if syscall exists
10986 set syscall d_syscall
10987 eval $inlibc
10988
10989 : see if sysconf exists
10990 set sysconf d_sysconf
10991 eval $inlibc
10992
10993 : see if system exists
10994 set system d_system
10995 eval $inlibc
10996
10997 : see if tcgetpgrp exists
10998 set tcgetpgrp d_tcgetpgrp
10999 eval $inlibc
11000
11001 : see if tcsetpgrp exists
11002 set tcsetpgrp d_tcsetpgrp
11003 eval $inlibc
11004
11005 : see if prototype for telldir is available
11006 echo " "
11007 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11008 eval $hasproto
11009
11010 : see if this is a sys/times.h system
11011 set sys/times.h i_systimes
11012 eval $inhdr
11013
11014 : see if times exists
11015 echo " "
11016 if set times val -f d_times; eval $csym; $val; then
11017         echo 'times() found.' >&4
11018         d_times="$define"
11019         inc=''
11020         case "$i_systimes" in
11021         "$define") inc='sys/times.h';;
11022         esac
11023         rp="What is the type returned by times() on this system?"
11024         set clock_t clocktype long stdio.h sys/types.h $inc
11025         eval $typedef_ask
11026 else
11027         echo 'times() NOT found, hope that will do.' >&4
11028         d_times="$undef"
11029         clocktype='int'
11030 fi
11031
11032 : see if truncate exists
11033 set truncate d_truncate
11034 eval $inlibc
11035
11036 : see if tzname[] exists
11037 echo " "
11038 if set tzname val -a d_tzname; eval $csym; $val; then
11039         val="$define"
11040         echo 'tzname[] found.' >&4
11041 else
11042         val="$undef"
11043         echo 'tzname[] NOT found.' >&4
11044 fi
11045 set d_tzname
11046 eval $setvar
11047
11048 : see if umask exists
11049 set umask d_umask
11050 eval $inlibc
11051
11052 : see if ustat exists
11053 set ustat d_ustat
11054 eval $inlibc
11055
11056 : backward compatibility for d_hvfork
11057 if test X$d_hvfork != X; then
11058         d_vfork="$d_hvfork"
11059         d_hvfork=''
11060 fi
11061 : see if there is a vfork
11062 val=''
11063 set vfork val
11064 eval $inlibc
11065
11066 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11067 : perl on Solaris 2.x, and probably elsewhere.
11068 case "$val" in
11069 $define)
11070         echo " "
11071         case "$usevfork" in
11072         false) dflt='n';;
11073         *) dflt='y';;
11074         esac
11075         cat <<'EOM'
11076  
11077 Perl can only use a vfork() that doesn't suffer from strict
11078 restrictions on calling functions or modifying global data in
11079 the child.  For example, glibc-2.1 contains such a vfork()
11080 that is unsuitable.  If your system provides a proper fork()
11081 call, chances are that you do NOT want perl to use vfork().
11082
11083 EOM
11084         rp="Do you still want to use vfork()?"
11085         . ./myread
11086         case "$ans" in
11087         y|Y) ;;
11088         *)
11089                 echo "Ok, we won't use vfork()."
11090                 val="$undef"
11091                 ;;
11092         esac
11093         ;;
11094 esac
11095 set d_vfork
11096 eval $setvar
11097 case "$d_vfork" in
11098 $define) usevfork='true';;
11099 *) usevfork='false';;
11100 esac
11101
11102 : see if this is an sysdir system
11103 set sys/dir.h i_sysdir
11104 eval $inhdr
11105
11106 : see if this is an sysndir system
11107 set sys/ndir.h i_sysndir
11108 eval $inhdr
11109
11110 : see if closedir exists
11111 set closedir d_closedir
11112 eval $inlibc
11113
11114 case "$d_closedir" in
11115 "$define")
11116         echo " "
11117         echo "Checking whether closedir() returns a status..." >&4
11118         cat > closedir.c <<EOM
11119 #$i_dirent I_DIRENT             /**/
11120 #$i_sysdir I_SYS_DIR            /**/
11121 #$i_sysndir I_SYS_NDIR          /**/
11122 #$i_systypes I_SYS_TYPES        /**/
11123
11124 #if defined(I_SYS_TYPES)
11125 #include <sys/types.h>
11126 #endif
11127 #if defined(I_DIRENT)
11128 #include <dirent.h>
11129 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11130 #include <sys/dir.h>
11131 #endif
11132 #else
11133 #ifdef I_SYS_NDIR
11134 #include <sys/ndir.h>
11135 #else
11136 #ifdef I_SYS_DIR
11137 #ifdef hp9000s500
11138 #include <ndir.h>       /* may be wrong in the future */
11139 #else
11140 #include <sys/dir.h>
11141 #endif
11142 #endif
11143 #endif
11144 #endif 
11145 int main() { return closedir(opendir(".")); }
11146 EOM
11147         set closedir
11148         if eval $compile_ok; then
11149                 if ./closedir > /dev/null 2>&1 ; then
11150                         echo "Yes, it does."
11151                         val="$undef"
11152                 else
11153                         echo "No, it doesn't."
11154                         val="$define"
11155                 fi
11156         else
11157                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11158                 val="$define"
11159         fi
11160         ;;
11161 *)
11162         val="$undef";
11163         ;;
11164 esac
11165 set d_void_closedir
11166 eval $setvar
11167 $rm -f closedir*
11168 : check for volatile keyword
11169 echo " "
11170 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11171 $cat >try.c <<'EOCP'
11172 int main()
11173 {
11174         typedef struct _goo_struct goo_struct;
11175         goo_struct * volatile goo = ((goo_struct *)0);
11176         struct _goo_struct {
11177                 long long_int;
11178                 int reg_int;
11179                 char char_var;
11180         };
11181         typedef unsigned short foo_t;
11182         char *volatile foo;
11183         volatile int bar;
11184         volatile foo_t blech;
11185         foo = foo;
11186 }
11187 EOCP
11188 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11189         val="$define"
11190         echo "Yup, it does."
11191 else
11192         val="$undef"
11193         echo "Nope, it doesn't."
11194 fi
11195 set d_volatile
11196 eval $setvar
11197 $rm -f try.*
11198
11199 : see if there is a wait4
11200 set wait4 d_wait4
11201 eval $inlibc
11202
11203 : see if waitpid exists
11204 set waitpid d_waitpid
11205 eval $inlibc
11206
11207 : see if wcstombs exists
11208 set wcstombs d_wcstombs
11209 eval $inlibc
11210
11211 : see if wctomb exists
11212 set wctomb d_wctomb
11213 eval $inlibc
11214
11215 : preserve RCS keywords in files with variable substitution, grrr
11216 Date='$Date'
11217 Id='$Id'
11218 Log='$Log'
11219 RCSfile='$RCSfile'
11220 Revision='$Revision'
11221
11222 case "$crosscompile" in
11223 ''|[nN]*) crosscompile="$undef" ;;
11224 esac
11225
11226 case "$osname" in
11227 next|rhapsody) multiarch="$define" ;;
11228 esac
11229 case "$multiarch" in
11230 ''|[nN]*) multiarch="$undef" ;;
11231 esac
11232
11233 : check for alignment requirements
11234 echo " "
11235 case "$crosscompile$multiarch" in
11236 *$define*)
11237         $cat <<EOM
11238 You seem to be either cross-compiling or doing a multiarchitecture build,
11239 skipping the memory alignment check.
11240
11241 EOM
11242         case "$alignbytes" in
11243         '') alignbytes=8 ;;
11244         esac
11245         ;;
11246 *)
11247         case "$alignbytes" in
11248         '') echo "Checking alignment constraints..." >&4
11249                 $cat >try.c <<'EOCP'
11250 #include <stdio.h>
11251 struct foobar {
11252         char foo;
11253         double bar;
11254 } try_algn;
11255 int main()
11256 {
11257     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11258     return(0);
11259 }
11260 EOCP
11261                 set try
11262                 if eval $compile_ok; then
11263                         dflt=`./try`
11264                 else
11265                         dflt='8'
11266                         echo "(I can't seem to compile the test program...)"
11267                 fi
11268                 ;;
11269         *) dflt="$alignbytes"
11270                 ;;
11271         esac
11272         rp="Doubles must be aligned on a how-many-byte boundary?"
11273         . ./myread
11274         alignbytes="$ans"
11275         $rm -f try.c try
11276         ;;
11277 esac
11278
11279
11280 : check for ordering of bytes in a long
11281 echo " "
11282 case "$crosscompile$multiarch" in
11283 *$define*)
11284         $cat <<EOM
11285 You seem to be either cross-compiling or doing a multiarchitecture build,
11286 skipping the byteorder check.
11287
11288 EOM
11289         byteorder='0xffff'
11290         ;;
11291 *)
11292         case "$byteorder" in
11293         '')
11294                 $cat <<'EOM'
11295 In the following, larger digits indicate more significance.  A big-endian
11296 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11297 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11298 machines may have weird orders like 3412.  A Cray will report 87654321,
11299 an Alpha will report 12345678. If the test program works the default is
11300 probably right.
11301 I'm now running the test program...
11302 EOM
11303                 $cat >try.c <<'EOCP'
11304 #include <stdio.h>
11305 int main()
11306 {
11307         int i;
11308         union {
11309                 unsigned long l;
11310                 char c[sizeof(long)];
11311         } u;
11312
11313         if (sizeof(long) > 4)
11314                 u.l = (0x08070605L << 32) | 0x04030201L;
11315         else
11316                 u.l = 0x04030201L;
11317         for (i = 0; i < sizeof(long); i++)
11318                 printf("%c", u.c[i]+'0');
11319         printf("\n");
11320         exit(0);
11321 }
11322 EOCP
11323                 xxx_prompt=y
11324                 set try
11325                 if eval $compile && ./try > /dev/null; then
11326                         dflt=`./try`
11327                         case "$dflt" in
11328                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11329                                 echo "(The test program ran ok.)"
11330                                 echo "byteorder=$dflt"
11331                                 xxx_prompt=n
11332                         ;;
11333                         ????|????????) echo "(The test program ran ok.)" ;;
11334                         *) echo "(The test program didn't run right for some reason.)" ;;
11335                         esac
11336                 else
11337                         dflt='4321'
11338                         cat <<'EOM'
11339 (I can't seem to compile the test program.  Guessing big-endian...)
11340 EOM
11341                 fi
11342                 case "$xxx_prompt" in
11343                 y)
11344                         rp="What is the order of bytes in a long?"
11345                         . ./myread
11346                         byteorder="$ans"
11347                         ;;
11348                 *)      byteorder=$dflt
11349                         ;;
11350                 esac
11351                 ;;
11352         esac
11353         $rm -f try.c try
11354         ;;
11355 esac
11356
11357
11358 : how do we catenate cpp tokens here?
11359 echo " "
11360 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11361 $cat >cpp_stuff.c <<'EOCP'
11362 #define RCAT(a,b)a/**/b
11363 #define ACAT(a,b)a ## b
11364 RCAT(Rei,ser)
11365 ACAT(Cir,cus)
11366 EOCP
11367 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11368 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11369         echo "Oh!  Smells like ANSI's been here." >&4
11370         echo "We can catify or stringify, separately or together!"
11371         cpp_stuff=42
11372 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11373         echo "Ah, yes!  The good old days!" >&4
11374         echo "However, in the good old days we don't know how to stringify and"
11375         echo "catify at the same time."
11376         cpp_stuff=1
11377 else
11378         $cat >&4 <<EOM
11379 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11380 to have to edit the values of CAT[2-5] in config.h...
11381 EOM
11382         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11383 fi
11384 $rm -f cpp_stuff.*
11385
11386 : see if this is a db.h system
11387 set db.h i_db
11388 eval $inhdr
11389
11390 case "$i_db" in
11391 $define)
11392         : Check db version.
11393         echo " "
11394         echo "Checking Berkeley DB version ..." >&4
11395         $cat >try.c <<EOCP
11396 #$d_const HASCONST
11397 #ifndef HASCONST
11398 #define const
11399 #endif
11400 #include <sys/types.h>
11401 #include <stdio.h>
11402 #include <db.h>
11403 int main()
11404 {
11405 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11406     int Major, Minor, Patch ;
11407     unsigned long Version ;
11408     (void)db_version(&Major, &Minor, &Patch) ;
11409     printf("You have Berkeley DB Version 2 or greater\n");
11410
11411     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11412                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11413     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11414                 Major, Minor, Patch) ;
11415
11416     /* check that db.h & libdb are compatible */
11417     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11418         printf("db.h and libdb are incompatible\n") ;
11419         exit(3);        
11420     }
11421
11422     printf("db.h and libdb are compatible\n") ;
11423
11424     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11425                 + DB_VERSION_PATCH ;
11426
11427     /* needs to be >= 2.3.4 */
11428     if (Version < 2003004) {
11429     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11430         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11431         exit(2);        
11432     }
11433
11434     exit(0);
11435 #else
11436 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11437     printf("You have Berkeley DB Version 1\n");
11438     exit(0);    /* DB version < 2: the coast is clear. */
11439 #else
11440     exit(1);    /* <db.h> not Berkeley DB? */
11441 #endif
11442 #endif
11443 }
11444 EOCP
11445         set try
11446         if eval $compile_ok && ./try; then
11447                 echo 'Looks OK.' >&4
11448         else
11449                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11450                 i_db=$undef
11451                 case " $libs " in
11452                 *"-ldb "*)
11453                         : Remove db from list of libraries to use
11454                         echo "Removing unusable -ldb from library list" >&4
11455                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11456                         shift
11457                         libs="$*"
11458                         echo "libs = $libs" >&4
11459                         ;;
11460                 esac
11461         fi
11462         $rm -f try.*
11463         ;;
11464 esac
11465
11466 case "$i_db" in
11467 define)
11468         : Check the return type needed for hash 
11469         echo " "
11470         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11471         $cat >try.c <<EOCP
11472 #$d_const HASCONST
11473 #ifndef HASCONST
11474 #define const
11475 #endif
11476 #include <sys/types.h>
11477 #include <db.h>
11478
11479 #ifndef DB_VERSION_MAJOR
11480 u_int32_t hash_cb (ptr, size)
11481 const void *ptr;
11482 size_t size;
11483 {
11484 }
11485 HASHINFO info;
11486 int main()
11487 {
11488         info.hash = hash_cb;
11489 }
11490 #endif
11491 EOCP
11492         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11493                 if $contains warning try.out >>/dev/null 2>&1 ; then
11494                         db_hashtype='int'
11495                 else
11496                         db_hashtype='u_int32_t'
11497                 fi
11498         else
11499                 : XXX Maybe we should just give up here.
11500                 db_hashtype=u_int32_t
11501                 $cat try.out >&4
11502                 echo "Help:  I can't seem to compile the db test program." >&4
11503                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11504         fi
11505         $rm -f try.*
11506         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11507         ;;
11508 *)      db_hashtype=u_int32_t
11509         ;;
11510 esac
11511 case "$i_db" in
11512 define)
11513         : Check the return type needed for prefix 
11514         echo " "
11515         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11516         cat >try.c <<EOCP
11517 #$d_const HASCONST
11518 #ifndef HASCONST
11519 #define const
11520 #endif
11521 #include <sys/types.h>
11522 #include <db.h>
11523
11524 #ifndef DB_VERSION_MAJOR
11525 size_t prefix_cb (key1, key2)
11526 const DBT *key1;
11527 const DBT *key2;
11528 {
11529 }
11530 BTREEINFO info;
11531 int main()
11532 {
11533         info.prefix = prefix_cb;
11534 }
11535 #endif
11536 EOCP
11537         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11538                 if $contains warning try.out >>/dev/null 2>&1 ; then
11539                         db_prefixtype='int'
11540                 else
11541                         db_prefixtype='size_t'
11542                 fi
11543         else
11544                 db_prefixtype='size_t'
11545                 : XXX Maybe we should just give up here.
11546                 $cat try.out >&4
11547                 echo "Help:  I can't seem to compile the db test program." >&4
11548                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11549         fi
11550         $rm -f try.*
11551         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11552         ;;
11553 *)      db_prefixtype='size_t'
11554         ;;
11555 esac
11556
11557 : check for void type
11558 echo " "
11559 echo "Checking to see how well your C compiler groks the void type..." >&4
11560 case "$voidflags" in
11561 '')
11562         $cat >try.c <<'EOCP'
11563 #if TRY & 1
11564 void sub() {
11565 #else
11566 sub() {
11567 #endif
11568         extern void moo();      /* function returning void */
11569         void (*goo)();          /* ptr to func returning void */
11570 #if TRY & 8
11571         void *hue;              /* generic ptr */
11572 #endif
11573 #if TRY & 2
11574         void (*foo[10])();
11575 #endif
11576
11577 #if TRY & 4
11578         if(goo == moo) {
11579                 exit(0);
11580         }
11581 #endif
11582         exit(0);
11583 }
11584 int main() { sub(); }
11585 EOCP
11586         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11587                 voidflags=$defvoidused
11588         echo "Good.  It appears to support void to the level $package wants.">&4
11589                 if $contains warning .out >/dev/null 2>&1; then
11590                         echo "However, you might get some warnings that look like this:"
11591                         $cat .out
11592                 fi
11593         else
11594 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11595                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11596                         echo "It supports 1..."
11597                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11598                                 echo "It also supports 2..."
11599                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11600                                         voidflags=7
11601                                         echo "And it supports 4 but not 8 definitely."
11602                                 else
11603                                         echo "It doesn't support 4..."
11604                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11605                                                 voidflags=11
11606                                                 echo "But it supports 8."
11607                                         else
11608                                                 voidflags=3
11609                                                 echo "Neither does it support 8."
11610                                         fi
11611                                 fi
11612                         else
11613                                 echo "It does not support 2..."
11614                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11615                                         voidflags=13
11616                                         echo "But it supports 4 and 8."
11617                                 else
11618                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11619                                                 voidflags=5
11620                                                 echo "And it supports 4 but has not heard about 8."
11621                                         else
11622                                                 echo "However it supports 8 but not 4."
11623                                         fi
11624                                 fi
11625                         fi
11626                 else
11627                         echo "There is no support at all for void."
11628                         voidflags=0
11629                 fi
11630         fi
11631 esac
11632 case "$voidflags" in
11633 "$defvoidused") ;;
11634 *)      $cat >&4 <<'EOM'
11635   Support flag bits are:
11636     1: basic void declarations.
11637     2: arrays of pointers to functions returning void.
11638     4: operations between pointers to and addresses of void functions.
11639     8: generic void pointers.
11640 EOM
11641         dflt="$voidflags";
11642         rp="Your void support flags add up to what?"
11643         . ./myread
11644         voidflags="$ans"
11645         ;;
11646 esac
11647 $rm -f try.* .out
11648
11649
11650 : How can we generate normalized random numbers ?
11651 echo " "
11652 echo "Looking for a random number function..." >&4
11653 case "$randfunc" in
11654 '')
11655         if set drand48 val -f; eval $csym; $val; then
11656                 dflt="drand48"
11657                 echo "Good, found drand48()." >&4
11658         elif set random val -f; eval $csym; $val; then
11659                 dflt="random"
11660                 echo "OK, found random()." >&4
11661         else
11662                 dflt="rand"
11663                 echo "Yick, looks like I have to use rand()." >&4
11664         fi
11665         echo " "
11666         ;;
11667 *)
11668         dflt="$randfunc"
11669         ;;
11670 esac
11671 cont=true
11672
11673 case "$ccflags" in
11674 *-Dmy_rand=*|*-Dmy_srand=*)
11675         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11676         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11677         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11678         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11679         ;;
11680 esac
11681
11682 while $test "$cont"; do
11683         rp="Use which function to generate random numbers?"
11684         . ./myread
11685         if $test "$ans" = "$dflt"; then
11686                 : null
11687         else
11688                 randbits=''
11689         fi
11690         randfunc="$ans"
11691         if set $ans val -f; eval $csym; $val; then
11692                 cont=''
11693         else
11694                 dflt=y
11695                 rp="I cannot find function $ans. Use that name anyway?"
11696                 . ./myread
11697                 dflt=rand
11698                 case "$ans" in
11699                         [yY]*) cont='';;
11700                 esac
11701         fi
11702         case "$cont" in
11703         '')
11704                 case "$randfunc" in
11705                 drand48)
11706                         drand01="drand48()"
11707                         seedfunc="srand48"
11708                         randbits=48
11709                         randseedtype=long
11710                         ;;
11711                 rand|random)
11712                         case "$randbits" in
11713                         '')
11714 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11715                                 $cat >try.c <<EOCP
11716 #$i_unistd I_UNISTD
11717 #$i_stdlib I_STDLIB
11718 #include <stdio.h>
11719 #ifdef I_UNISTD
11720 #  include <unistd.h>
11721 #endif
11722 #ifdef I_STDLIB
11723 #  include <stdlib.h>
11724 #endif
11725 int main()
11726 {
11727         register int i;
11728         register unsigned long tmp;
11729         register unsigned long max = 0L;
11730
11731         for (i = 1000; i; i--) {
11732                 tmp = (unsigned long) $randfunc();
11733                 if (tmp > max) max = tmp;
11734         }
11735         for (i = 0; max; i++)
11736                 max /= 2;
11737         printf("%d\n",i);
11738 }
11739 EOCP
11740                                 set try
11741                                 if eval $compile_ok; then
11742                                         dflt=`try`
11743                                 else
11744                                         dflt='?'
11745                                         echo "(I can't seem to compile the test program...)"
11746                                 fi
11747                                 ;;
11748                         *)
11749                                 dflt="$randbits"
11750                                 ;;
11751                         esac
11752                         rp="How many bits does your $randfunc() function produce?"
11753                         . ./myread
11754                         randbits="$ans"
11755                         $rm -f try.c try
11756                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11757                         seedfunc="s$randfunc"
11758                         randseedtype=unsigned
11759                         ;;
11760                 *)
11761                         dflt="31"
11762                         rp="How many bits does your $randfunc() function produce?"
11763                         . ./myread
11764                         randbits="$ans"
11765                         seedfunc="s$randfunc"
11766                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11767                         if set $seedfunc val -f; eval $csym; $val; then
11768                                 echo "(Using $seedfunc() to seed random generator)"
11769                         else
11770                                 echo "(Warning: no $seedfunc() to seed random generator)"
11771                                 seedfunc=rand
11772                         fi
11773                         randseedtype=unsigned
11774                         ;;
11775                 esac
11776                 ;;
11777         esac
11778 done
11779
11780 echo " "
11781 echo "Determining whether or not we are on an EBCDIC system..." >&4
11782 $cat >tebcdic.c <<'EOM'
11783 int main()
11784 {
11785   if ('M'==0xd4) return 0;
11786   return 1;
11787 }
11788 EOM
11789
11790 val=$undef
11791 set tebcdic
11792 if eval $compile_ok; then
11793         if ./tebcdic; then
11794                 echo "You have EBCDIC." >&4
11795                 val="$define"
11796         else
11797                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11798         fi
11799 else
11800         echo "I'm unable to compile the test program." >&4
11801         echo "I'll assume ASCII or some ISO Latin." >&4
11802 fi
11803 $rm -f tebcdic.c tebcdic
11804 set ebcdic
11805 eval $setvar
11806
11807 echo " "
11808 $cat >&4 <<EOM
11809 Checking how to flush all pending stdio output...
11810 EOM
11811 # I only know how to find the first 32 possibly open files on SunOS.
11812 # See also hints/sunos_4_1.sh and util.c  --AD
11813 case "$osname" in
11814 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11815 esac
11816 $cat >>try.c <<EOCP
11817 #include <stdio.h>
11818 #$i_unistd I_UNISTD
11819 #ifdef I_UNISTD
11820 # include <unistd.h>
11821 #endif
11822 #$d_sysconf HAS_SYSCONF
11823 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11824 #ifdef HAS_STDIO_STREAM_ARRAY
11825 # define STDIO_STREAM_ARRAY $stdio_stream_array
11826 #endif
11827 int main() {
11828   FILE* p = fopen("try.out", "w");
11829 #ifdef TRY_FPUTC
11830   fputc('x', p);
11831 #else
11832 # ifdef TRY_FPRINTF
11833   fprintf(p, "x");
11834 # endif
11835 #endif
11836 #ifdef TRY_FFLUSH_NULL
11837   fflush(NULL);
11838 #endif
11839 #ifdef TRY_FFLUSH_ALL
11840   {
11841     long open_max = -1;
11842 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11843     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11844 # else
11845 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11846     open_max = sysconf(_SC_OPEN_MAX);
11847 #  else
11848 #   ifdef FOPEN_MAX
11849     open_max = FOPEN_MAX;
11850 #   else
11851 #    ifdef OPEN_MAX
11852     open_max = OPEN_MAX;
11853 #    else
11854 #     ifdef _NFILE
11855     open_max = _NFILE;
11856 #     endif
11857 #    endif
11858 #   endif
11859 #  endif
11860 # endif 
11861 # ifdef HAS_STDIO_STREAM_ARRAY
11862     if (open_max > 0) {
11863       long i;
11864       for (i = 0; i < open_max; i++)
11865             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11866                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11867                 STDIO_STREAM_ARRAY[i]._flag)
11868                 fflush(&STDIO_STREAM_ARRAY[i]);
11869     }   
11870   }
11871 # endif
11872 #endif
11873   _exit(42);
11874 }
11875 EOCP
11876 : first we have to find out how _not_ to flush
11877 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11878     output=''
11879     set try -DTRY_FPUTC
11880     if eval $compile; then
11881             $rm -f try.out
11882             ./try$exe_ext 2>/dev/null
11883             if $test ! -s try.out -a "X$?" = X42; then
11884                 output=-DTRY_FPUTC
11885             fi
11886     fi
11887     case "$output" in
11888     '')
11889             set try -DTRY_FPRINTF
11890             $rm -f try.out
11891             if eval $compile; then
11892                     $rm -f try.out
11893                     ./try$exe_ext 2>/dev/null
11894                     if $test ! -s try.out -a "X$?" = X42; then
11895                         output=-DTRY_FPRINTF
11896                     fi
11897             fi
11898         ;;
11899     esac
11900 fi
11901 : check for fflush NULL behaviour
11902 case "$fflushNULL" in
11903 '')     set try -DTRY_FFLUSH_NULL $output
11904         if eval $compile; then
11905                 $rm -f try.out
11906                 ./try$exe_ext 2>/dev/null
11907                 code="$?"
11908                 if $test -s try.out -a "X$code" = X42; then
11909                         fflushNULL="`$cat try.out`"
11910                 else
11911                         if $test "X$code" != X42; then
11912                                 $cat >&4 <<EOM
11913 (If this test failed, don't worry, we'll try another method shortly.)
11914 EOM
11915                         fi
11916                 fi
11917         fi
11918         $rm -f core try.core core.try.*
11919         case "$fflushNULL" in
11920         x)      $cat >&4 <<EOM
11921 Your fflush(NULL) works okay.
11922 EOM
11923                 fflushNULL="$define"
11924                 ;;
11925         '')     $cat >&4 <<EOM
11926 Your fflush(NULL) isn't working (contrary to ANSI C).
11927 EOM
11928                 fflushNULL="$undef"
11929                 ;;
11930         *)      $cat >&4 <<EOM
11931 Cannot figure out whether your fflush(NULL) works or not.
11932 I'm assuming it doesn't (contrary to ANSI C).
11933 EOM
11934                 fflushNULL="$undef"
11935                 ;;
11936         esac
11937         ;;
11938 $define|true|[yY]*)
11939         fflushNULL="$define"
11940         ;;
11941 *)
11942         fflushNULL="$undef"
11943         ;;
11944 esac
11945 : check explicit looping only if NULL did not work
11946 case "$fflushNULL" in
11947 "$undef")
11948         : check for fflush all behaviour
11949         case "$fflushall" in
11950         '')     set try -DTRY_FFLUSH_ALL $output
11951                 if eval $compile; then
11952                         $cat >&4 <<EOM
11953 (Now testing the other method--but note that also this may fail.)
11954 EOM
11955                         $rm -f try.out
11956                         ./try$exe_ext 2>/dev/null
11957                         if $test -s try.out -a "X$?" = X42; then
11958                                 fflushall="`$cat try.out`"
11959                         fi
11960                 fi
11961                 $rm -f core try.core core.try.*
11962                 case "$fflushall" in
11963                 x)      $cat >&4 <<EOM
11964 Whew. Flushing explicitly all the stdio streams works.
11965 EOM
11966                         fflushall="$define"
11967                         ;;
11968                 '')     $cat >&4 <<EOM
11969 Sigh. Flushing explicitly all the stdio streams doesn't work.
11970 EOM
11971                         fflushall="$undef"
11972                         ;;
11973                 *)      $cat >&4 <<EOM
11974 Cannot figure out whether flushing stdio streams explicitly works or not.
11975 I'm assuming it doesn't.
11976 EOM
11977                         fflushall="$undef"
11978                         ;;
11979                 esac
11980                 ;;
11981         "$define"|true|[yY]*)
11982                 fflushall="$define"
11983                 ;;
11984         *)
11985                 fflushall="$undef"
11986                 ;;
11987         esac
11988         ;;
11989 *)      fflushall="$undef"      
11990         ;;
11991 esac
11992 case "$fflushNULL$fflushall" in
11993 undefundef)
11994         $cat <<EOM
11995 I cannot figure out how to flush pending stdio output.
11996 EOM
11997         ;;
11998 esac
11999 $rm -f try.* try$exe_ext
12000
12001 : Store the full pathname to the ar program for use in the C program
12002 : Respect a hint or command line value for full_ar.
12003 case "$full_ar" in
12004 '') full_ar=$ar ;;
12005 esac
12006
12007 : Store the full pathname to the sed program for use in the C program
12008 full_sed=$sed
12009
12010 : see what type gids are declared as in the kernel
12011 echo " "
12012 echo "Looking for the type for group ids returned by getgid()."
12013 set gid_t gidtype xxx stdio.h sys/types.h
12014 eval $typedef
12015 case "$gidtype" in
12016 xxx)
12017         xxx=`./findhdr sys/user.h`
12018         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12019         case $1 in
12020         unsigned) dflt="$1 $2" ;;
12021         *) dflt="$1" ;;
12022         esac
12023         ;;
12024 *) dflt="$gidtype";;
12025 esac
12026 case "$gidtype" in
12027 gid_t) echo "gid_t found." ;;
12028 *)      rp="What is the type for group ids returned by getgid()?"
12029         . ./myread
12030         gidtype="$ans"
12031         ;;
12032 esac
12033
12034 echo " "
12035 case "$gidtype" in
12036 *_t) zzz="$gidtype"     ;;
12037 *)   zzz="gid"          ;;
12038 esac
12039 echo "Checking the size of $zzz..." >&4 
12040 cat > try.c <<EOCP
12041 #include <sys/types.h>
12042 #include <stdio.h>
12043 int main() {
12044     printf("%d\n", (int)sizeof($gidtype));
12045     exit(0);
12046 }
12047 EOCP
12048 set try
12049 if eval $compile_ok; then
12050         yyy=`./try`
12051         case "$yyy" in
12052         '')     gidsize=4
12053                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12054                 ;;
12055         *)      gidsize=$yyy
12056                 echo "Your $zzz size is $gidsize bytes."
12057                 ;;
12058         esac
12059 else
12060         gidsize=4
12061         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12062 fi
12063
12064
12065 echo " "
12066 case "$gidtype" in
12067 *_t) zzz="$gidtype"     ;;
12068 *)   zzz="gid"          ;;
12069 esac
12070 echo "Checking the sign of $zzz..." >&4 
12071 cat > try.c <<EOCP
12072 #include <sys/types.h>
12073 #include <stdio.h>
12074 int main() {
12075         $gidtype foo = -1;
12076         if (foo < 0)
12077                 printf("-1\n");
12078         else
12079                 printf("1\n");
12080 }
12081 EOCP
12082 set try
12083 if eval $compile; then
12084         yyy=`./try`
12085         case "$yyy" in
12086         '')     gidsign=1
12087                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12088                 ;;
12089         *)      gidsign=$yyy
12090                 case "$gidsign" in
12091                  1) echo "Your $zzz is unsigned." ;;
12092                 -1) echo "Your $zzz is signed."   ;;
12093                 esac
12094                 ;;
12095         esac
12096 else
12097         gidsign=1
12098         echo "(I can't compile the test program--guessing unsigned.)" >&4
12099 fi
12100
12101
12102 : check for length of character
12103 echo " "
12104 case "$charsize" in
12105 '')
12106         echo "Checking to see how big your characters are (hey, you never know)..." >&4
12107         $cat >try.c <<'EOCP'
12108 #include <stdio.h>
12109 int main()
12110 {
12111     printf("%d\n", (int)sizeof(char));
12112     exit(0);
12113 }
12114 EOCP
12115         set try
12116         if eval $compile_ok; then
12117                 dflt=`./try`
12118         else
12119                 dflt='1'
12120                 echo "(I can't seem to compile the test program.  Guessing...)"
12121         fi
12122         ;;
12123 *)
12124         dflt="$charsize"
12125         ;;
12126 esac
12127 rp="What is the size of a character (in bytes)?"
12128 . ./myread
12129 charsize="$ans"
12130 $rm -f try.c try
12131
12132
12133 echo " "
12134 $echo "Choosing the C types to be used for Perl's internal types..." >&4
12135
12136 case "$use64bits:$d_quad:$quadtype" in
12137 define:define:?*)
12138         ivtype="$quadtype"
12139         uvtype="$uquadtype"
12140         ivsize=8
12141         uvsize=8
12142         ;;
12143 *)      ivtype="long"
12144         uvtype="unsigned long"
12145         ivsize=$longsize
12146         uvsize=$longsize
12147         ;;
12148 esac
12149
12150 case "$uselongdouble:$d_longdbl" in
12151 define:define)
12152         nvtype="long double"
12153         nvsize=$longdblsize
12154         ;;
12155 *)      nvtype=double
12156         nvsize=$doublesize
12157         ;;
12158 esac
12159
12160 echo "(IV will be "$ivtype", $ivsize bytes)"
12161 echo "(UV will be "$uvtype", $uvsize bytes)"
12162 echo "(NV will be "$nvtype", $nvsize bytes)"
12163
12164 $cat >try.c <<EOCP
12165 #$i_inttypes I_INTTYPES
12166 #ifdef I_INTTYPES
12167 #include <inttypes.h>
12168 #endif
12169 #include <stdio.h>
12170 int main() {
12171 #ifdef INT8
12172    int8_t i =  INT8_MAX;
12173   uint8_t u = UINT8_MAX;
12174   printf("int8_t\n");
12175 #endif
12176 #ifdef INT16
12177    int16_t i =  INT16_MAX;
12178   uint16_t i = UINT16_MAX;
12179   printf("int16_t\n");
12180 #endif
12181 #ifdef INT32
12182    int32_t i =  INT32_MAX;
12183   uint32_t u = UINT32_MAX;
12184   printf("int32_t\n");
12185 #endif
12186 }
12187 EOCP
12188
12189 case "$i8type" in
12190 '')     case "$charsize" in
12191         1)      i8type=char
12192                 u8type="unsigned char"
12193                 i8size=$charsize
12194                 u8size=$charsize
12195                 ;;
12196         esac
12197         ;;
12198 esac
12199 case "$i8type" in
12200 '')     set try -DINT8
12201         if eval $compile; then
12202                 case "`./try$exe_ext`" in
12203                 int8_t) i8type=int8_t
12204                         u8type=uint8_t
12205                         i8size=1
12206                         u8size=1
12207                         ;;
12208                 esac
12209         fi
12210         ;;
12211 esac
12212 case "$i8type" in
12213 '')     if $test $charsize -ge 1; then
12214                 i8type=char
12215                 u8type="unsigned char"
12216                 i8size=$charsize
12217                 u8size=$charsize
12218         fi
12219         ;;
12220 esac
12221
12222 case "$i16type" in
12223 '')     case "$shortsize" in
12224         2)      i16type=short
12225                 u16type="unsigned short"
12226                 i16size=$shortsize
12227                 u16size=$shortsize
12228                 ;;
12229         esac
12230         ;;
12231 esac
12232 case "$i16type" in
12233 '')     set try -DINT16
12234         if eval $compile; then
12235                 case "`./try$exe_ext`" in
12236                 int16_t)
12237                         i16type=int16_t
12238                         u16type=uint16_t
12239                         i16size=2
12240                         u16size=2
12241                         ;;
12242                 esac
12243         fi
12244         ;;
12245 esac
12246 case "$i16type" in
12247 '')     if $test $shortsize -ge 2; then
12248                 i16type=short
12249                 u16type="unsigned short"
12250                 i16size=$shortsize
12251                 u16size=$shortsize
12252         fi
12253         ;;
12254 esac
12255
12256 case "$i32type" in
12257 '')     case "$longsize" in
12258         4)      i32type=long
12259                 u32type="unsigned long"
12260                 i32size=$longsize
12261                 u32size=$longsize
12262                 ;;
12263         *)      case "$intsize" in
12264                 4)      i32type=int
12265                         u32type="unsigned int"
12266                         i32size=$intsize
12267                         u32size=$intsize
12268                         ;;
12269                 esac
12270                 ;;
12271         esac
12272         ;;
12273 esac
12274 case "$i32type" in
12275 '')     set try -DINT32
12276         if eval $compile; then
12277                 case "`./try$exe_ext`" in
12278                 int32_t)
12279                         i32type=int32_t
12280                         u32type=uint32_t
12281                         i32size=4
12282                         u32size=4
12283                         ;;
12284                 esac
12285         fi
12286         ;;
12287 esac
12288 case "$i32type" in
12289 '')     if $test $intsize -ge 4; then
12290                 i32type=int
12291                 u32type="unsigned int"
12292                 i32size=$intsize
12293                 u32size=$intsize
12294         fi
12295         ;;
12296 esac
12297
12298 case "$i64type" in
12299 '')     case "$d_quad:$quadtype" in
12300         define:?*)
12301                 i64type="$quadtype"
12302                 u64type="$uquadtype"
12303                 i64size=8
12304                 u64size=8
12305                 ;;
12306         esac
12307         ;;
12308 esac
12309
12310 $rm -f try.* try
12311
12312 echo " "
12313
12314 if $test X"$quadtype" != X; then
12315
12316 echo "Checking how to print 64-bit integers..." >&4
12317
12318 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12319         $cat >try.c <<'EOCP'
12320 #include <sys/types.h>
12321 #include <stdio.h>
12322 int main() {
12323   int q = 12345678901;
12324   printf("%ld\n", q);
12325 }
12326 EOCP
12327         set try
12328         if eval $compile; then
12329                 yyy=`./try$exe_ext`
12330                 case "$yyy" in
12331                 12345678901)
12332                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12333                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12334                         echo "We will use %d."
12335                         ;;
12336                 esac
12337         fi
12338 fi
12339
12340 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12341         $cat >try.c <<'EOCP'
12342 #include <sys/types.h>
12343 #include <stdio.h>
12344 int main() {
12345   long q = 12345678901;
12346   printf("%ld\n", q);
12347 }
12348 EOCP
12349         set try
12350         if eval $compile; then
12351                 yyy=`./try$exe_ext`
12352                 case "$yyy" in
12353                 12345678901)
12354                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12355                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12356                         echo "We will use %ld."
12357                         ;;
12358                 esac
12359         fi
12360 fi
12361
12362 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12363         $cat >try.c <<'EOCP'
12364 #include <sys/types.h>
12365 #include <inttypes.h>
12366 #include <stdio.h>
12367 int main() {
12368   int64_t q = 12345678901;
12369   printf("%" PRId64 "\n", q);
12370 }
12371 EOCP
12372         set try
12373         if eval $compile; then
12374                 yyy=`./try$exe_ext`
12375                 case "$yyy" in
12376                 12345678901)
12377                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12378                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12379                         echo "We will use the C9X style."
12380                         ;;
12381                 esac
12382         fi
12383 fi
12384
12385 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12386         $cat >try.c <<'EOCP'
12387 #include <sys/types.h>
12388 #include <stdio.h>
12389 int main() {
12390   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12391   printf("%lld\n", q);
12392 }
12393 EOCP
12394         set try
12395         if eval $compile; then
12396                 yyy=`./try$exe_ext`
12397                 case "$yyy" in
12398                 12345678901)
12399                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12400                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12401                         echo "We will use the %lld style."
12402                         ;;
12403                 esac
12404         fi
12405 fi
12406
12407 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12408         $cat >try.c <<EOCP
12409 #include <sys/types.h>
12410 #include <stdio.h>
12411 int main() {
12412   $quadtype q = 12345678901;
12413   printf("%Ld\n", q);
12414 }
12415 EOCP
12416         set try
12417         if eval $compile; then
12418                 yyy=`./try$exe_ext`
12419                 case "$yyy" in
12420                 12345678901)
12421                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12422                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12423                         echo "We will use %Ld."
12424                         ;;
12425                 esac
12426         fi
12427 fi
12428
12429 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12430         $cat >try.c <<EOCP
12431 #include <sys/types.h>
12432 #include <stdio.h>
12433 int main() {
12434   $quadtype q = 12345678901;
12435   printf("%qd\n", q);
12436 }
12437 EOCP
12438         set try
12439         if eval $compile; then
12440                 yyy=`./try$exe_ext`
12441                 case "$yyy" in
12442                 12345678901)
12443                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12444                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12445                         echo "We will use %qd."
12446                         ;;
12447                 esac
12448         fi
12449 fi
12450
12451 if $test X"$sPRId64" = X; then
12452         echo "Cannot figure out how to print 64-bit integers." >&4
12453 fi
12454
12455 $rm -f try try.*
12456
12457 fi
12458
12459 case "$sPRId64" in
12460 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12461         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12462         ;;
12463 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12464         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12465         ;;
12466 esac
12467
12468
12469 echo " "
12470 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12471
12472 if $test X"$ivsize" = X8; then
12473         ivdformat="$sPRId64"
12474         uvuformat="$sPRIu64"
12475         uvoformat="$sPRIo64"
12476         uvxformat="$sPRIx64"
12477 else
12478         if $test X"$ivsize" = X"$longsize"; then
12479                 ivdformat='"ld"'
12480                 uvuformat='"lu"'
12481                 uvoformat='"lo"'
12482                 uvxformat='"lx"'
12483         else
12484                 if $test X"$ivsize" = X"$intsize"; then
12485                         ivdformat='"d"'
12486                         uvuformat='"u"'
12487                         uvoformat='"o"'
12488                         uvxformat='"x"'
12489                 else
12490                         : far out
12491                         if $test X"$ivsize" = X"$shortsize"; then
12492                                 ivdformat='"hd"'
12493                                 uvuformat='"hu"'
12494                                 uvoformat='"ho"'
12495                                 uvxformat='"hx"'
12496                         fi
12497                 fi
12498         fi
12499 fi
12500
12501 case "$ivdformat" in
12502 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12503     exit 1
12504     ;;
12505 esac
12506
12507
12508 echo " "
12509 $echo "Checking the format string to be used for gids..." >&4
12510
12511 case "$gidsign" in
12512 -1)     if $test X"$gidsize" = X"$ivsize"; then
12513                 gidformat="$ivdformat"
12514         else
12515                 if $test X"$gidsize" = X"$longsize"; then
12516                         gidformat='"ld"'
12517                 else
12518                         if $test X"$gidsize" = X"$intsize"; then
12519                                 gidformat='"d"'
12520                         else
12521                                 if $test X"$gidsize" = X"$shortsize"; then
12522                                         gidformat='"hd"'
12523                                 fi
12524                         fi
12525                 fi
12526         fi
12527         ;;
12528 *)      if $test X"$gidsize" = X"$uvsize"; then
12529                 gidformat="$uvuformat"
12530         else
12531                 if $test X"$gidsize" = X"$longsize"; then
12532                         gidformat='"lu"'
12533                 else
12534                         if $test X"$gidsize" = X"$intsize"; then
12535                                 gidformat='"u"'
12536                         else
12537                                 if $test X"$gidsize" = X"$shortsize"; then
12538                                         gidformat='"hu"'
12539                                 fi
12540                         fi
12541                 fi
12542         fi
12543         ;;
12544 esac
12545
12546 : see if getgroups exists
12547 set getgroups d_getgrps
12548 eval $inlibc
12549
12550 : see if setgroups exists
12551 set setgroups d_setgrps
12552 eval $inlibc
12553
12554
12555 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12556 echo " "
12557 case "$d_getgrps$d_setgrps" in
12558 *define*)
12559         case "$groupstype" in
12560         '') dflt="$gidtype" ;;
12561         *)  dflt="$groupstype" ;;
12562         esac
12563         $cat <<EOM
12564 What type of pointer is the second argument to getgroups() and setgroups()?
12565 Usually this is the same as group ids, $gidtype, but not always.
12566
12567 EOM
12568         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12569         . ./myread
12570         groupstype="$ans"
12571         ;;
12572 *)  groupstype="$gidtype";;
12573 esac
12574
12575 echo " "
12576 echo "Checking if your $make program sets \$(MAKE)..." >&4
12577 case "$make_set_make" in
12578 '')
12579         $sed 's/^X //' > testmake.mak << 'EOF'
12580 Xall:
12581 X       @echo 'maketemp="$(MAKE)"'
12582 EOF
12583         case "`$make -f testmake.mak 2>/dev/null`" in
12584         *maketemp=*) make_set_make='#' ;;
12585         *)      make_set_make="MAKE=$make" ;;
12586         esac
12587         $rm -f testmake.mak
12588         ;;
12589 esac
12590 case "$make_set_make" in
12591 '#') echo "Yup, it does.";;
12592 *) echo "Nope, it doesn't.";;
12593 esac
12594
12595 : see what type is used for mode_t
12596 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12597 set mode_t modetype int stdio.h sys/types.h
12598 eval $typedef_ask
12599
12600 : define a fucntion to check prototypes
12601 $cat > protochk <<EOSH
12602 $startsh
12603 cc="$cc"
12604 optimize="$optimize"
12605 ccflags="$ccflags"
12606 prototype="$prototype"
12607 define="$define"
12608 rm=$rm
12609 EOSH
12610
12611 $cat >> protochk <<'EOSH'
12612
12613 $rm -f try.c
12614 foo="$1"
12615 shift
12616 while test $# -ge 2; do
12617         case "$1" in
12618                 $define) echo "#include <$2>" >> try.c ;;
12619                 literal) echo "$2" >> try.c ;;
12620         esac
12621     shift 2
12622 done
12623 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12624 cat >> try.c <<'EOCP'
12625 #ifdef CAN_PROTOTYPE
12626 #define _(args) args
12627 #else
12628 #define _(args) ()
12629 #endif
12630 EOCP
12631 echo "$foo" >> try.c
12632 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12633 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12634 status=$?
12635 $rm -f try.[co]
12636 exit $status
12637 EOSH
12638 chmod +x protochk
12639 $eunicefix protochk
12640
12641 : see what type is used for size_t
12642 rp="What is the type used for the length parameter for string functions?"
12643 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12644 eval $typedef_ask
12645
12646 : check for type of arguments to gethostbyaddr. 
12647 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12648         case "$d_gethbyaddr" in
12649         $define)
12650                 $cat <<EOM
12651
12652 Checking to see what type of arguments are accepted by gethostbyaddr().
12653 EOM
12654                 hdrs="$define sys/types.h
12655                         $d_socket sys/socket.h 
12656                         $i_niin netinet/in.h 
12657                         $i_netdb netdb.h
12658                         $i_unistd unistd.h"
12659                 : The first arg can 'char *' or 'void *'
12660                 : The second arg is some of integral type
12661                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12662                         for yyy in size_t long int; do
12663                                 case "$netdb_host_type" in
12664                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12665                                         if ./protochk "$try" $hdrs; then
12666                                                 echo "Your system accepts $xxx for the first arg."
12667                                                 echo "...and $yyy for the second arg."
12668                                                 netdb_host_type="$xxx"
12669                                                 netdb_hlen_type="$yyy"
12670                                         fi
12671                                         ;;
12672                                 esac
12673                         done
12674                 done
12675                 : In case none of those worked, prompt the user.
12676                 case "$netdb_host_type" in
12677                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12678                         dflt='char *'
12679                         . ./myread
12680                         netdb_host_type=$ans
12681                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12682                         dflt="$sizetype"
12683                         . ./myread
12684                         netdb_hlen_type=$ans
12685                         ;;
12686                 esac
12687                 ;;
12688         *)      : no gethostbyaddr, so pick harmless defaults
12689                 netdb_host_type='char *'
12690                 netdb_hlen_type="$sizetype"
12691                 ;;
12692         esac
12693         # Remove the "const" if needed. -- but then we'll have a 
12694         # prototype clash!
12695         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12696 fi
12697
12698 : check for type of argument to gethostbyname. 
12699 if test "X$netdb_name_type" = X ; then
12700         case "$d_gethbyname" in
12701         $define)
12702                 $cat <<EOM
12703
12704 Checking to see what type of argument is accepted by gethostbyname().
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                 for xxx in "const char *" "char *"; do
12712                         case "$netdb_name_type" in
12713                         '')     try="extern struct hostent *gethostbyname($xxx);"
12714                                 if ./protochk "$try" $hdrs; then
12715                                         echo "Your system accepts $xxx."
12716                                         netdb_name_type="$xxx"
12717                                 fi
12718                                 ;;
12719                         esac
12720                 done
12721                 : In case none of those worked, prompt the user.
12722                 case "$netdb_name_type" in
12723                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12724                         dflt='char *'
12725                         . ./myread
12726                         netdb_name_type=$ans
12727                         ;;
12728                 esac
12729                 ;;
12730         *)      : no gethostbyname, so pick harmless default
12731                 netdb_name_type='char *'
12732                 ;;
12733         esac
12734 fi
12735
12736 : check for type of 1st argument to getnetbyaddr. 
12737 if test "X$netdb_net_type" = X ; then
12738         case "$d_getnbyaddr" in
12739         $define)
12740                 $cat <<EOM
12741
12742 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12743 EOM
12744                 hdrs="$define sys/types.h
12745                         $d_socket sys/socket.h 
12746                         $i_niin netinet/in.h 
12747                         $i_netdb netdb.h
12748                         $i_unistd unistd.h"
12749                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12750                         case "$netdb_net_type" in
12751                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12752                                 if ./protochk "$try" $hdrs; then
12753                                         echo "Your system accepts $xxx."
12754                                         netdb_net_type="$xxx"
12755                                 fi
12756                                 ;;
12757                         esac
12758                 done
12759                 : In case none of those worked, prompt the user.
12760                 case "$netdb_net_type" in
12761                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12762                         dflt='long'
12763                         . ./myread
12764                         netdb_net_type=$ans
12765                         ;;
12766                 esac
12767                 ;;
12768         *)      : no getnetbyaddr, so pick harmless default
12769                 netdb_net_type='long'
12770                 ;;
12771         esac
12772 fi
12773 : locate the preferred pager for this system
12774 case "$pager" in
12775 '')
12776         dflt=''
12777         case "$pg" in
12778         /*) dflt=$pg;;
12779         esac
12780         case "$more" in
12781         /*) dflt=$more;;
12782         esac
12783         case "$less" in
12784         /*) dflt=$less;;
12785         esac
12786         case "$dflt" in
12787         '') dflt=/usr/ucb/more;;
12788         esac
12789         ;;
12790 *) dflt="$pager";;
12791 esac
12792 echo " "
12793 fn=f/
12794 rp='What pager is used on your system?'
12795 . ./getfile
12796 pager="$ans"
12797
12798 : see what type pids are declared as in the kernel
12799 rp="What is the type of process ids on this system?"
12800 set pid_t pidtype int stdio.h sys/types.h
12801 eval $typedef_ask
12802
12803 : check for length of pointer
12804 echo " "
12805 case "$ptrsize" in
12806 '')
12807         $echo $n "Checking to see how big your pointers are...$c" >&4
12808         if test "$voidflags" -gt 7; then
12809                 echo '#define VOID_PTR char *' > try.c
12810         else
12811                 echo '#define VOID_PTR void *' > try.c
12812         fi
12813         $cat >>try.c <<'EOCP'
12814 #include <stdio.h>
12815 int main()
12816 {
12817     printf("%d\n", (int)sizeof(VOID_PTR));
12818     exit(0);
12819 }
12820 EOCP
12821         set try
12822         if eval $compile_ok; then
12823                 ptrsize=`./try`
12824                 $echo " $ptrsize bytes." >&4
12825         else
12826                 dflt='4'
12827                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12828                 rp="What is the size of a pointer (in bytes)?"
12829                 . ./myread
12830                 ptrsize="$ans"
12831         fi
12832         ;;
12833 esac
12834 $rm -f try.c try
12835
12836 : see if ar generates random libraries by itself
12837 echo " "
12838 echo "Checking how to generate random libraries on your machine..." >&4
12839 echo 'int bar1() { return bar2(); }' > bar1.c
12840 echo 'int bar2() { return 2; }' > bar2.c
12841 $cat > foo.c <<'EOP'
12842 int main() { printf("%d\n", bar1()); exit(0); }
12843 EOP
12844 $cc $ccflags -c bar1.c >/dev/null 2>&1
12845 $cc $ccflags -c bar2.c >/dev/null 2>&1
12846 $cc $ccflags -c foo.c >/dev/null 2>&1
12847 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12848 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12849         ./foobar >/dev/null 2>&1; then
12850         echo "$ar appears to generate random libraries itself."
12851         orderlib=false
12852         ranlib=":"
12853 elif $ar ts bar$_a >/dev/null 2>&1 &&
12854         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12855         ./foobar >/dev/null 2>&1; then
12856                 echo "a table of contents needs to be added with '$ar ts'."
12857                 orderlib=false
12858                 ranlib="$ar ts"
12859 else
12860         case "$ranlib" in
12861         :) ranlib='';;
12862         '')
12863                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12864                 $test -f $ranlib || ranlib=''
12865                 ;;
12866         esac
12867         if $test -n "$ranlib"; then
12868                 echo "your system has '$ranlib'; we'll use that."
12869                 orderlib=false
12870         else
12871                 echo "your system doesn't seem to support random libraries"
12872                 echo "so we'll use lorder and tsort to order the libraries."
12873                 orderlib=true
12874                 ranlib=":"
12875         fi
12876 fi
12877 $rm -f foo* bar* 
12878
12879 : check for type of arguments to select. 
12880 case "$selecttype" in
12881 '') case "$d_select" in
12882         $define)
12883                 $cat <<EOM
12884 Checking to see what type of arguments are accepted by select().
12885 EOM
12886                 hdrs="$define sys/types.h
12887                         $i_systime sys/time.h 
12888                         $i_sysselct sys/select.h
12889                         $d_socket sys/socket.h"
12890                 : The first arg can be int, unsigned, or size_t
12891                 : The last arg may or may not be 'const'
12892                 val=''
12893                 : void pointer has been seen but using that
12894                 : breaks the selectminbits test
12895                 for xxx in 'fd_set *' 'int *'; do
12896                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12897                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12898                                         case "$val" in
12899                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12900                                                 if ./protochk "$try" $hdrs; then
12901                                                         echo "Your system accepts $xxx."
12902                                                         val="$xxx"
12903                                                 fi
12904                                                 ;;
12905                                         esac
12906                                 done
12907                         done
12908                 done
12909                 case "$val" in
12910                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12911                         case "$d_fd_set" in
12912                                 $define) dflt="fd_set *" ;;
12913                                 *)              dflt="int *" ;;
12914                         esac
12915                         . ./myread
12916                         val=$ans
12917                         ;;
12918                 esac
12919                 selecttype="$val"
12920                 ;;
12921         *)      : no select, so pick a harmless default
12922                 selecttype='int *'
12923                 ;;
12924         esac
12925         ;;
12926 esac
12927
12928 : check for the select 'width'
12929 case "$selectminbits" in
12930 '') case "$d_select" in
12931         $define)
12932                 $cat <<EOM
12933
12934 Checking to see on how many bits at a time your select() operates...
12935 EOM
12936                 $cat >try.c <<EOCP
12937 #include <sys/types.h>
12938 #$i_time I_TIME
12939 #$i_systime I_SYS_TIME
12940 #$i_systimek I_SYS_TIME_KERNEL
12941 #ifdef I_TIME
12942 #   include <time.h>
12943 #endif
12944 #ifdef I_SYS_TIME
12945 #   ifdef I_SYS_TIME_KERNEL
12946 #       define KERNEL
12947 #   endif
12948 #   include <sys/time.h>
12949 #   ifdef I_SYS_TIME_KERNEL
12950 #       undef KERNEL
12951 #   endif
12952 #endif
12953 #$i_sysselct I_SYS_SELECT
12954 #ifdef I_SYS_SELECT
12955 #include <sys/select.h>
12956 #endif
12957 #$d_socket HAS_SOCKET
12958 #ifdef HAS_SOCKET
12959 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12960 #endif
12961 #include <stdio.h>
12962 $selecttype b;
12963 #define S sizeof(*(b))
12964 #define MINBITS 64
12965 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12966 #define NBITS  (NBYTES * 8)
12967 int main() {
12968     char s[NBYTES];
12969     struct timeval t;
12970     int i;
12971     FILE* fp;
12972     int fd;
12973
12974     fclose(stdin);
12975     fp = fopen("try.c", "r");
12976     if (fp == 0)
12977       exit(1);
12978     fd = fileno(fp);
12979     if (fd < 0)
12980       exit(2);
12981     b = ($selecttype)s;
12982     for (i = 0; i < NBITS; i++)
12983         FD_SET(i, b);
12984     t.tv_sec  = 0;
12985     t.tv_usec = 0;
12986     select(fd + 1, b, 0, 0, &t);
12987     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12988     printf("%d\n", i + 1);
12989     return 0;
12990 }
12991 EOCP
12992                 set try
12993                 if eval $compile_ok; then
12994                         selectminbits=`./try`
12995                         case "$selectminbits" in
12996                         '')     cat >&4 <<EOM
12997 Cannot figure out on how many bits at a time your select() operates.
12998 I'll play safe and guess it is 32 bits.
12999 EOM
13000                                 selectminbits=32
13001                                 bits="32 bits"
13002                                 ;;
13003                         1)      bits="1 bit" ;;
13004                         *)      bits="$selectminbits bits" ;;
13005                         esac
13006                         echo "Your select() operates on $bits at a time." >&4
13007                 else
13008                         rp='What is the minimum number of bits your select() operates on?'
13009                         case "$byteorder" in
13010                         1234|12345678)  dflt=32 ;;
13011                         *)              dflt=1  ;;
13012                         esac
13013                         . ./myread
13014                         val=$ans
13015                         selectminbits="$val"
13016                 fi
13017                 $rm -f try.* try
13018                 ;;
13019         *)      : no select, so pick a harmless default
13020                 selectminbits='32'
13021                 ;;
13022         esac
13023         ;;
13024 esac
13025
13026 : Trace out the files included by signal.h, then look for SIGxxx names.
13027 : Remove SIGARRAYSIZE used by HPUX.
13028 : Remove SIGSTKSIZE used by Linux.
13029 : Remove SIGSTKSZ used by Posix.
13030 : Remove SIGTYP void lines used by OS2.
13031 : Some cpps, like os390, dont give the file name anywhere
13032 if [ "X$fieldn" = X ]; then
13033         : Just make some guesses.  We check them later.
13034         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13035 else
13036         xxx=`echo '#include <signal.h>' |
13037         $cppstdin $cppminus $cppflags 2>/dev/null |
13038         $grep '^[       ]*#.*include' | 
13039         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13040 fi
13041 : Check this list of files to be sure we have parsed the cpp output ok.
13042 : This will also avoid potentially non-existent files, such 
13043 : as ../foo/bar.h
13044 xxxfiles=''
13045 for xx in $xxx /dev/null ; do
13046         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13047 done
13048 : If we have found no files, at least try signal.h
13049 case "$xxxfiles" in
13050 '')     xxxfiles=`./findhdr signal.h` ;;
13051 esac
13052 xxx=`awk '
13053 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13054         print substr($2, 4, 20)
13055 }
13056 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13057         print substr($3, 4, 20)
13058 }' $xxxfiles`
13059 : Append some common names just in case the awk scan failed.
13060 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13061 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13062 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13063 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13064 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13065
13066 : generate a few handy files for later
13067 $cat > signal.c <<'EOCP'
13068 #include <sys/types.h>
13069 #include <signal.h>
13070 #include <stdio.h>
13071 int main() {
13072
13073 /* Strange style to avoid deeply-nested #if/#else/#endif */
13074 #ifndef NSIG
13075 #  ifdef _NSIG
13076 #    define NSIG (_NSIG)
13077 #  endif
13078 #endif
13079
13080 #ifndef NSIG
13081 #  ifdef SIGMAX
13082 #    define NSIG (SIGMAX+1)
13083 #  endif
13084 #endif
13085
13086 #ifndef NSIG
13087 #  ifdef SIG_MAX
13088 #    define NSIG (SIG_MAX+1)
13089 #  endif
13090 #endif
13091
13092 #ifndef NSIG
13093 #  ifdef MAXSIG
13094 #    define NSIG (MAXSIG+1)
13095 #  endif
13096 #endif
13097
13098 #ifndef NSIG
13099 #  ifdef MAX_SIG
13100 #    define NSIG (MAX_SIG+1)
13101 #  endif
13102 #endif
13103
13104 #ifndef NSIG
13105 #  ifdef SIGARRAYSIZE
13106 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13107 #  endif
13108 #endif
13109
13110 #ifndef NSIG
13111 #  ifdef _sys_nsig
13112 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13113 #  endif
13114 #endif
13115
13116 /* Default to some arbitrary number that's big enough to get most
13117    of the common signals.
13118 */
13119 #ifndef NSIG
13120 #    define NSIG 50
13121 #endif
13122
13123 printf("NSIG %d\n", NSIG);
13124
13125 #ifndef JUST_NSIG
13126
13127 EOCP
13128
13129 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13130 {
13131         printf "#ifdef SIG"; printf $1; printf "\n"
13132         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13133         printf $1; printf ");\n"
13134         printf "#endif\n"
13135 }
13136 END {
13137         printf "#endif /* JUST_NSIG */\n";
13138         printf "exit(0);\n}\n";
13139 }
13140 ' >>signal.c
13141 $cat >signal.awk <<'EOP'
13142 BEGIN { ndups = 0 }
13143 $1 ~ /^NSIG$/ { nsig = $2 }
13144 ($1 !~ /^NSIG$/) && (NF == 2) {
13145     if ($2 > maxsig) { maxsig = $2 }
13146     if (sig_name[$2]) {
13147         dup_name[ndups] = $1
13148         dup_num[ndups] = $2
13149         ndups++ 
13150     }
13151     else {
13152         sig_name[$2] = $1
13153         sig_num[$2] = $2
13154     }
13155 }
13156 END { 
13157     if (nsig == 0) {
13158         nsig = maxsig + 1
13159     }
13160     printf("NSIG %d\n", nsig);
13161     for (n = 1; n < nsig; n++) {
13162         if (sig_name[n]) {
13163             printf("%s %d\n", sig_name[n], sig_num[n])
13164         }
13165         else {
13166             printf("NUM%d %d\n", n, n) 
13167         }
13168     }
13169     for (n = 0; n < ndups; n++) {
13170         printf("%s %d\n", dup_name[n], dup_num[n])
13171     }
13172 }
13173 EOP
13174 $cat >signal_cmd <<EOS
13175 $startsh
13176 if $test -s signal.lst; then
13177     echo "Using your existing signal.lst file"
13178         exit 0
13179 fi
13180 xxx="$xxx"
13181 EOS
13182 $cat >>signal_cmd <<'EOS'
13183
13184 set signal
13185 if eval $compile_ok; then
13186         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13187 else
13188         echo "(I can't seem be able to compile the whole test program)" >&4
13189         echo "(I'll try it in little pieces.)" >&4
13190         set signal -DJUST_NSIG
13191         if eval $compile_ok; then
13192                 ./signal$_exe > signal.nsg
13193                 $cat signal.nsg
13194         else
13195                 echo "I can't seem to figure out how many signals you have." >&4
13196                 echo "Guessing 50." >&4
13197                 echo 'NSIG 50' > signal.nsg
13198         fi
13199         : Now look at all the signal names, one at a time.
13200         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13201                 $cat > signal.c <<EOCP
13202 #include <sys/types.h>
13203 #include <signal.h>
13204 #include <stdio.h>
13205 int main() {
13206 printf("$xx %d\n", SIG${xx});
13207 return 0;
13208 }
13209 EOCP
13210                 set signal
13211                 if eval $compile; then
13212                         echo "SIG${xx} found."
13213                         ./signal$_exe  >> signal.ls1
13214                 else
13215                         echo "SIG${xx} NOT found."
13216                 fi
13217         done
13218         if $test -s signal.ls1; then
13219                 $cat signal.nsg signal.ls1 |
13220                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13221         fi
13222
13223 fi
13224 if $test -s signal.lst; then
13225         :
13226 else
13227         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13228         echo 'kill -l' >signal
13229         set X `csh -f <signal`
13230         $rm -f signal
13231         shift
13232         case $# in
13233         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13234         esac
13235         echo $@ | $tr ' ' $trnl | \
13236             $awk '{ printf "%s %d\n", $1, ++s; }
13237                   END { printf "NSIG %d\n", ++s }' >signal.lst
13238 fi
13239 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13240 EOS
13241 chmod a+x signal_cmd
13242 $eunicefix signal_cmd
13243
13244 : generate list of signal names
13245 echo " "
13246 case "$sig_name_init" in
13247 '') doinit=yes ;;
13248 *)  case "$sig_num_init" in
13249     ''|*,*) doinit=yes ;;
13250     esac ;;
13251 esac
13252 case "$doinit" in
13253 yes)
13254         echo "Generating a list of signal names and numbers..." >&4
13255         . ./signal_cmd
13256         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13257         sig_name=`$awk 'BEGIN { printf "ZERO " }
13258                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13259         sig_num=`$awk  'BEGIN { printf "0 " }
13260                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13261         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13262                              !/^NSIG/   { printf "\"%s\", ", $1 }
13263                              END        { printf "0\n" }' signal.lst`
13264         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13265                              !/^NSIG/   { printf "%d, ", $2}
13266                              END        { printf "0\n"}' signal.lst`
13267         ;;
13268 esac
13269 echo "The following $sig_count signals are available:"
13270 echo " "
13271 echo $sig_name | $awk \
13272 'BEGIN { linelen = 0 }
13273 {
13274         for (i = 1; i <= NF; i++) {
13275                 name = "SIG" $i " "
13276                 linelen = linelen + length(name)
13277                 if (linelen > 70) {
13278                         printf "\n"
13279                         linelen = length(name)
13280                 }
13281                 printf "%s", name
13282         }
13283         printf "\n"
13284 }'
13285 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13286
13287 : see what type is used for signed size_t
13288 set ssize_t ssizetype int stdio.h sys/types.h
13289 eval $typedef
13290 dflt="$ssizetype"
13291 $cat > ssize.c <<EOM
13292 #include <stdio.h>
13293 #include <sys/types.h>
13294 #define Size_t $sizetype
13295 #define SSize_t $dflt
13296 int main()
13297 {
13298         if (sizeof(Size_t) == sizeof(SSize_t))
13299                 printf("$dflt\n");
13300         else if (sizeof(Size_t) == sizeof(int))
13301                 printf("int\n");
13302         else 
13303                 printf("long\n");
13304         exit(0);
13305 }
13306 EOM
13307 echo " "
13308 set ssize
13309 if eval $compile_ok && ./ssize > /dev/null; then
13310         ssizetype=`./ssize`
13311         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13312 else
13313         $cat >&4 <<EOM
13314 Help! I can't compile and run the ssize_t test program: please enlighten me!
13315 (This is probably a misconfiguration in your system or libraries, and
13316 you really ought to fix it.  Still, I'll try anyway.)
13317
13318 I need a type that is the same size as $sizetype, but is guaranteed to
13319 be signed.  Common values are ssize_t, int and long.
13320
13321 EOM
13322         rp="What signed type is the same size as $sizetype?"
13323         . ./myread
13324         ssizetype="$ans"
13325 fi
13326 $rm -f ssize ssize.*
13327
13328 : see what type of char stdio uses.
13329 echo " "
13330 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13331         echo "Your stdio uses unsigned chars." >&4
13332         stdchar="unsigned char"
13333 else
13334         echo "Your stdio uses signed chars." >&4
13335         stdchar="char"
13336 fi
13337
13338 : see if time exists
13339 echo " "
13340 if test "X$d_time" = X -o X"$timetype" = X; then
13341     if set time val -f d_time; eval $csym; $val; then
13342                 echo 'time() found.' >&4
13343                 val="$define"
13344                 rp="What is the type returned by time() on this system?"
13345                 set time_t timetype long stdio.h sys/types.h
13346                 eval $typedef_ask
13347     else
13348                 echo 'time() not found, hope that will do.' >&4
13349                 val="$undef"
13350                 timetype='int';
13351     fi
13352     set d_time
13353     eval $setvar
13354 fi
13355
13356 : see what type uids are declared as in the kernel
13357 echo " "
13358 echo "Looking for the type for user ids returned by getuid()."
13359 set uid_t uidtype xxx stdio.h sys/types.h
13360 eval $typedef
13361 case "$uidtype" in
13362 xxx)
13363         xxx=`./findhdr sys/user.h`
13364         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13365         case $1 in
13366         unsigned) dflt="$1 $2" ;;
13367         *) dflt="$1" ;;
13368         esac
13369         ;;
13370 *) dflt="$uidtype";;
13371 esac
13372 case "$uidtype" in
13373 uid_t)  echo "uid_t found." ;;
13374 *)      rp="What is the type for user ids returned by getuid()?"
13375         . ./myread
13376         uidtype="$ans"
13377         ;;
13378 esac
13379
13380 echo " "
13381 case "$uidtype" in
13382 *_t) zzz="$uidtype"     ;;
13383 *)   zzz="uid"          ;;
13384 esac
13385 echo "Checking the size of $zzz..." >&4 
13386 cat > try.c <<EOCP
13387 #include <sys/types.h>
13388 #include <stdio.h>
13389 int main() {
13390     printf("%d\n", (int)sizeof($uidtype));
13391     exit(0);
13392 }
13393 EOCP
13394 set try
13395 if eval $compile_ok; then
13396         yyy=`./try`
13397         case "$yyy" in
13398         '')     uidsize=4
13399                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13400                 ;;
13401         *)      uidsize=$yyy
13402                 echo "Your $zzz size is $uidsize bytes."
13403                 ;;
13404         esac
13405 else
13406         uidsize=4
13407         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13408 fi
13409
13410 echo " "
13411 case "$uidtype" in
13412 *_t) zzz="$uidtype"     ;;
13413 *)   zzz="uid"          ;;
13414 esac
13415 echo "Checking the sign of $zzz..." >&4
13416 cat > try.c <<EOCP
13417 #include <sys/types.h>
13418 #include <stdio.h>
13419 int main() {
13420         $uidtype foo = -1;
13421         if (foo < 0)
13422                 printf("-1\n");
13423         else
13424                 printf("1\n");
13425 }
13426 EOCP
13427 set try
13428 if eval $compile; then
13429         yyy=`./try`
13430         case "$yyy" in
13431         '')     uidsign=1
13432                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13433                 ;;
13434         *)      uidsign=$yyy
13435                 case "$uidsign" in
13436                  1) echo "Your $zzz is unsigned." ;;
13437                 -1) echo "Your $zzz is signed."   ;;
13438                 esac
13439                 ;;
13440         esac
13441 else
13442         uidsign=1
13443         echo "(I can't compile the test program--guessing unsigned.)" >&4
13444 fi
13445
13446
13447
13448 echo " "
13449 $echo "Checking the format string to be used for uids..." >&4
13450
13451 case "$uidsign" in
13452 -1)     if $test X"$uidsize" = X"$ivsize"; then
13453                 uidformat="$ivdformat"
13454         else
13455                 if $test X"$uidsize" = X"$longsize"; then
13456                         uidformat='"ld"'
13457                 else
13458                         if $test X"$uidsize" = X"$intsize"; then
13459                                 uidformat='"d"'
13460                         else
13461                                 if $test X"$uidsize" = X"$shortsize"; then
13462                                         uidformat='"hd"'
13463                                 fi
13464                         fi
13465                 fi
13466         fi
13467         ;;
13468 *)      if $test X"$uidsize" = X"$uvsize"; then
13469                 uidformat="$uvuformat"
13470         else
13471                 if $test X"$uidsize" = X"$longsize"; then
13472                         uidformat='"lu"'
13473                 else
13474                         if $test X"$uidsize" = X"$intsize"; then
13475                                 uidformat='"u"'
13476                         else
13477                                 if $test X"$uidsize" = X"$shortsize"; then
13478                                         uidformat='"hu"'
13479                                 fi
13480                         fi
13481                 fi
13482         fi
13483         ;;
13484 esac
13485
13486 : see if dbm.h is available
13487 : see if dbmclose exists
13488 set dbmclose d_dbmclose
13489 eval $inlibc
13490
13491 case "$d_dbmclose" in
13492 $define)
13493         set dbm.h i_dbm
13494         eval $inhdr
13495         case "$i_dbm" in
13496         $define)
13497                 val="$undef"
13498                 set i_rpcsvcdbm
13499                 eval $setvar
13500                 ;;
13501         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13502                 eval $inhdr
13503                 ;;
13504         esac
13505         ;;
13506 *)      echo "We won't be including <dbm.h>"
13507         val="$undef"
13508         set i_dbm
13509         eval $setvar
13510         val="$undef"
13511         set i_rpcsvcdbm
13512         eval $setvar
13513         ;;
13514 esac
13515
13516 : see if this is a sys/file.h system
13517 val=''
13518 set sys/file.h val
13519 eval $inhdr
13520
13521 : do we need to include sys/file.h ?
13522 case "$val" in
13523 "$define")
13524         echo " "
13525         if $h_sysfile; then
13526                 val="$define"
13527                 echo "We'll be including <sys/file.h>." >&4
13528         else
13529                 val="$undef"
13530                 echo "We won't be including <sys/file.h>." >&4
13531         fi
13532         ;;
13533 *)
13534         h_sysfile=false
13535         ;;
13536 esac
13537 set i_sysfile
13538 eval $setvar
13539
13540 : see if fcntl.h is there
13541 val=''
13542 set fcntl.h val
13543 eval $inhdr
13544
13545 : see if we can include fcntl.h
13546 case "$val" in
13547 "$define")
13548         echo " "
13549         if $h_fcntl; then
13550                 val="$define"
13551                 echo "We'll be including <fcntl.h>." >&4
13552         else
13553                 val="$undef"
13554                 if $h_sysfile; then
13555         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13556                 else
13557                         echo "We won't be including <fcntl.h>." >&4
13558                 fi
13559         fi
13560         ;;
13561 *)
13562         h_fcntl=false
13563         val="$undef"
13564         ;;
13565 esac
13566 set i_fcntl
13567 eval $setvar
13568
13569 : see if locale.h is available
13570 set locale.h i_locale
13571 eval $inhdr
13572
13573 : see if mach cthreads are available
13574 if test "X$usethreads" = "X$define"; then
13575         set mach/cthreads.h i_machcthr
13576         eval $inhdr
13577 else
13578         i_machcthr="$undef"
13579 fi
13580
13581
13582
13583 : see if this is a math.h system
13584 set math.h i_math
13585 eval $inhdr
13586
13587 : see if this is a mntent.h system
13588 set mntent.h i_mntent
13589 eval $inhdr
13590
13591 : see if ndbm.h is available
13592 set ndbm.h t_ndbm
13593 eval $inhdr
13594 case "$t_ndbm" in
13595 $define)
13596         : see if dbm_open exists
13597         set dbm_open d_dbm_open
13598         eval $inlibc
13599         case "$d_dbm_open" in
13600         $undef)
13601                 t_ndbm="$undef"
13602                 echo "We won't be including <ndbm.h>"
13603                 ;;
13604         esac
13605         ;;
13606 esac
13607 val="$t_ndbm"
13608 set i_ndbm
13609 eval $setvar
13610
13611 : see if net/errno.h is available
13612 val=''
13613 set net/errno.h val
13614 eval $inhdr
13615
13616 : Unfortunately, it causes problems on some systems.  Arrgh.
13617 case "$val" in
13618 $define)
13619         cat > try.c <<'EOM'
13620 #include <stdio.h>
13621 #include <errno.h>
13622 #include <net/errno.h>
13623 int func()
13624 {
13625         return ENOTSOCK;
13626 }
13627 EOM
13628         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13629                 echo "We'll be including <net/errno.h>." >&4
13630         else
13631                 echo "We won't be including <net/errno.h>." >&4
13632                 val="$undef"
13633         fi
13634         $rm -f try.* try
13635         ;;
13636 esac
13637 set i_neterrno
13638 eval $setvar
13639
13640 : see if netinet/tcp.h is available
13641 set netinet/tcp.h i_netinettcp
13642 eval $inhdr
13643
13644 : see if this is a poll.h system
13645 set poll.h i_poll
13646 eval $inhdr
13647
13648 : get C preprocessor symbols handy
13649 echo " "
13650 $echo $n "Hmm... $c"
13651 echo $al | $tr ' ' $trnl >Cppsym.know
13652 $cat <<EOSS >Cppsym
13653 $startsh
13654 case "\$1" in
13655 -l) list=true
13656         shift
13657         ;;
13658 esac
13659 unknown=''
13660 case "\$list\$#" in
13661 1|2)
13662         for sym do
13663                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13664                         exit 0
13665                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13666                         :
13667                 else
13668                         unknown="\$unknown \$sym"
13669                 fi
13670         done
13671         set X \$unknown
13672         shift
13673         ;;
13674 esac
13675 case \$# in
13676 0) exit 1;;
13677 esac
13678 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13679 #ifdef \1\\
13680 exit 0; _ _ _ _\1\\      \1\\
13681 #endif\\
13682 /' >Cppsym\$\$
13683 echo "exit 1; _ _ _" >>Cppsym\$\$
13684 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13685 case "\$list" in
13686 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13687 *)
13688         sh Cppsym2\$\$
13689         status=\$?
13690         ;;
13691 esac
13692 $rm -f Cppsym\$\$ Cppsym2\$\$
13693 exit \$status
13694 EOSS
13695 chmod +x Cppsym
13696 $eunicefix Cppsym
13697 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13698
13699 : now check the C compiler for additional symbols
13700 postprocess_cc_v=''
13701 case "$osname" in
13702 aix) postprocess_cc_v="|$tr , ' '" ;;
13703 esac
13704 $cat >ccsym <<EOS
13705 $startsh
13706 $cat >tmp.c <<EOF
13707 extern int foo;
13708 EOF
13709 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13710 do
13711         case "\$i" in
13712         -D*) echo "\$i" | $sed 's/^-D//';;
13713         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13714         esac
13715 done
13716 $rm -f try.c
13717 EOS
13718 postprocess_cc_v=''
13719 chmod +x ccsym
13720 $eunicefix ccsym
13721 ./ccsym > ccsym1.raw
13722 if $test -s ccsym1.raw; then
13723        $sort ccsym1.raw | $uniq >ccsym.raw
13724 else
13725        mv ccsym1.raw ccsym.raw
13726 fi
13727
13728 $awk '/\=/ { print $0; next }
13729         { print $0"=1" }' ccsym.raw >ccsym.list
13730 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13731 $comm -13 ccsym.true ccsym.list >ccsym.own
13732 $comm -12 ccsym.true ccsym.list >ccsym.com
13733 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13734 also=''
13735 if $test -z ccsym.raw; then
13736         echo "Your C compiler doesn't seem to define any symbols!" >&4
13737         echo " "
13738         echo "However, your C preprocessor defines the following symbols:"
13739         $cat Cppsym.true
13740         ccsymbols=''
13741         cppsymbols=`$cat Cppsym.true`
13742         cppsymbols=`echo $cppsymbols`
13743         cppccsymbols="$cppsymbols"
13744 else
13745         if $test -s ccsym.com; then
13746                 echo "Your C compiler and pre-processor define these symbols:"
13747                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13748                 also='also '
13749                 symbols='ones'
13750                 cppccsymbols=`$cat ccsym.com`
13751                 cppccsymbols=`echo $cppccsymbols`
13752                 $test "$silent" || sleep 1
13753         fi
13754         if $test -s ccsym.cpp; then
13755                 $test "$also" && echo " "
13756                 echo "Your C pre-processor ${also}defines the following symbols:"
13757                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13758                 also='further '
13759                 cppsymbols=`$cat ccsym.cpp`
13760                 cppsymbols=`echo $cppsymbols`
13761                 $test "$silent" || sleep 1
13762         fi
13763         if $test -s ccsym.own; then
13764                 $test "$also" && echo " "
13765                 echo "Your C compiler ${also}defines the following cpp symbols:"
13766                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13767                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13768                 ccsymbols=`$cat ccsym.own`
13769                 ccsymbols=`echo $ccsymbols`
13770                 $test "$silent" || sleep 1
13771         fi
13772 fi
13773 $rm -f ccsym*
13774
13775 : see if this is a termio system
13776 val="$undef"
13777 val2="$undef"
13778 val3="$undef"
13779 if $test `./findhdr termios.h`; then
13780         set tcsetattr i_termios
13781         eval $inlibc
13782         val3="$i_termios"
13783 fi
13784 echo " "
13785 case "$val3" in
13786 "$define") echo "You have POSIX termios.h... good!" >&4;;
13787 *) if ./Cppsym pyr; then
13788                 case "`/bin/universe`" in
13789                 ucb) if $test `./findhdr sgtty.h`; then
13790                                 val2="$define"
13791                                 echo "<sgtty.h> found." >&4
13792                         else
13793                                 echo "System is pyramid with BSD universe."
13794                                 echo "<sgtty.h> not found--you could have problems." >&4
13795                         fi;;
13796                 *) if $test `./findhdr termio.h`; then
13797                                 val="$define"
13798                                 echo "<termio.h> found." >&4
13799                         else
13800                                 echo "System is pyramid with USG universe."
13801                                 echo "<termio.h> not found--you could have problems." >&4
13802                         fi;;
13803                 esac
13804         elif ./usg; then
13805                 if $test `./findhdr termio.h`; then
13806                         echo "<termio.h> found." >&4
13807                         val="$define"
13808                 elif $test `./findhdr sgtty.h`; then
13809                         echo "<sgtty.h> found." >&4
13810                         val2="$define"
13811                 else
13812 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13813                 fi
13814         else
13815                 if $test `./findhdr sgtty.h`; then
13816                         echo "<sgtty.h> found." >&4
13817                         val2="$define"
13818                 elif $test `./findhdr termio.h`; then
13819                         echo "<termio.h> found." >&4
13820                         val="$define"
13821                 else
13822 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13823                 fi
13824         fi;;
13825 esac
13826 set i_termio; eval $setvar
13827 val=$val2; set i_sgtty; eval $setvar
13828 val=$val3; set i_termios; eval $setvar
13829
13830 : see if this is a shadow.h system
13831 set shadow.h i_shadow
13832 eval $inhdr
13833
13834 : see if this is a socks.h system
13835 set socks.h i_socks
13836 eval $inhdr
13837
13838 : see if stdarg is available
13839 echo " "
13840 if $test `./findhdr stdarg.h`; then
13841         echo "<stdarg.h> found." >&4
13842         valstd="$define"
13843 else
13844         echo "<stdarg.h> NOT found." >&4
13845         valstd="$undef"
13846 fi
13847
13848 : see if varags is available
13849 echo " "
13850 if $test `./findhdr varargs.h`; then
13851         echo "<varargs.h> found." >&4
13852 else
13853         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13854 fi
13855
13856 : set up the varargs testing programs
13857 $cat > varargs.c <<EOP
13858 #ifdef I_STDARG
13859 #include <stdarg.h>
13860 #endif
13861 #ifdef I_VARARGS
13862 #include <varargs.h>
13863 #endif
13864
13865 #ifdef I_STDARG
13866 int f(char *p, ...)
13867 #else
13868 int f(va_alist)
13869 va_dcl
13870 #endif
13871 {
13872         va_list ap;
13873 #ifndef I_STDARG
13874         char *p;
13875 #endif
13876 #ifdef I_STDARG
13877         va_start(ap,p);
13878 #else
13879         va_start(ap);
13880         p = va_arg(ap, char *);
13881 #endif
13882         va_end(ap);
13883 }
13884 EOP
13885 $cat > varargs <<EOP
13886 $startsh
13887 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13888         echo "true"
13889 else
13890         echo "false"
13891 fi
13892 $rm -f varargs$_o
13893 EOP
13894 chmod +x varargs
13895
13896 : now check which varargs header should be included
13897 echo " "
13898 i_varhdr=''
13899 case "$valstd" in
13900 "$define")
13901         if `./varargs I_STDARG`; then
13902                 val='stdarg.h'
13903         elif `./varargs I_VARARGS`; then
13904                 val='varargs.h'
13905         fi
13906         ;;
13907 *)
13908         if `./varargs I_VARARGS`; then
13909                 val='varargs.h'
13910         fi
13911         ;;
13912 esac
13913 case "$val" in
13914 '')
13915 echo "I could not find the definition for va_dcl... You have problems..." >&4
13916         val="$undef"; set i_stdarg; eval $setvar
13917         val="$undef"; set i_varargs; eval $setvar
13918         ;;
13919 *) 
13920         set i_varhdr
13921         eval $setvar
13922         case "$i_varhdr" in
13923         stdarg.h)
13924                 val="$define"; set i_stdarg; eval $setvar
13925                 val="$undef"; set i_varargs; eval $setvar
13926                 ;;
13927         varargs.h)
13928                 val="$undef"; set i_stdarg; eval $setvar
13929                 val="$define"; set i_varargs; eval $setvar
13930                 ;;
13931         esac
13932         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13933 esac
13934 $rm -f varargs*
13935
13936 : see if stddef is available
13937 set stddef.h i_stddef
13938 eval $inhdr
13939
13940 : see if sys/access.h is available
13941 set sys/access.h i_sysaccess
13942 eval $inhdr
13943
13944 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13945 set sys/filio.h i_sysfilio
13946 eval $inhdr
13947 echo " "
13948 if $test `./findhdr sys/ioctl.h`; then
13949         val="$define"
13950         echo '<sys/ioctl.h> found.' >&4
13951 else
13952         val="$undef"
13953         if $test $i_sysfilio = "$define"; then
13954             echo '<sys/ioctl.h> NOT found.' >&4
13955         else
13956                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13957                 $test $i_termio = "$define" && xxx="termio.h"
13958                 $test $i_termios = "$define" && xxx="termios.h"
13959 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13960         fi
13961 fi
13962 set i_sysioctl
13963 eval $setvar
13964
13965 : see if sys/resource.h has to be included
13966 set sys/resource.h i_sysresrc
13967 eval $inhdr
13968
13969 : see if sys/security.h is available
13970 set sys/security.h i_syssecrt
13971 eval $inhdr
13972
13973 : see if this is a sys/statvfs.h system
13974 set sys/statvfs.h i_sysstatvfs
13975 eval $inhdr
13976
13977 : see if this is a sys/uio.h system
13978 set sys/uio.h i_sysuio
13979 eval $inhdr
13980
13981 : see if this is a sys/un.h system
13982 set sys/un.h i_sysun
13983 eval $inhdr
13984
13985 : see if this is a syswait system
13986 set sys/wait.h i_syswait
13987 eval $inhdr
13988
13989 : see if this is a ustat.h system
13990 set ustat.h i_ustat
13991 eval $inhdr
13992
13993 : see if this is an utime system
13994 set utime.h i_utime
13995 eval $inhdr
13996
13997 : see if this is a values.h system
13998 set values.h i_values
13999 eval $inhdr
14000
14001 : see if this is a vfork system
14002 case "$d_vfork" in
14003 "$define")
14004         set vfork.h i_vfork
14005         eval $inhdr
14006         ;;
14007 *)
14008         i_vfork="$undef"
14009         ;;
14010 esac
14011
14012 : see if gdbm.h is available
14013 set gdbm.h t_gdbm
14014 eval $inhdr
14015 case "$t_gdbm" in
14016 $define)
14017         : see if gdbm_open exists
14018         set gdbm_open d_gdbm_open
14019         eval $inlibc
14020         case "$d_gdbm_open" in
14021         $undef)
14022                 t_gdbm="$undef"
14023                 echo "We won't be including <gdbm.h>"
14024                 ;;
14025         esac
14026         ;;
14027 esac
14028 val="$t_gdbm"
14029 set i_gdbm
14030 eval $setvar
14031
14032 echo " "
14033 echo "Looking for extensions..." >&4
14034 : If we are using the old config.sh, known_extensions may contain
14035 : old or inaccurate or duplicate values.
14036 known_extensions=''
14037 nonxs_extensions=''
14038 : We do not use find because it might not be available.
14039 : We do not just use MANIFEST because the user may have dropped
14040 : some additional extensions into the source tree and expect them
14041 : to be built.
14042
14043 : Function to recursively find available extensions, ignoring DynaLoader
14044 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14045 find_extensions='
14046     for xxx in *; do
14047        case "$xxx" in
14048            DynaLoader|dynaload) ;;
14049            *)
14050            if $test -f $xxx/$xxx.xs; then
14051                known_extensions="$known_extensions $1$xxx";
14052            elif $test -f $xxx/Makefile.PL; then
14053                nonxs_extensions="$nonxs_extensions $1$xxx";
14054            else
14055                if $test -d $xxx -a $# -lt 10; then
14056                    set $1$xxx/ $*;
14057                    cd $xxx;
14058                    eval $find_extensions;
14059                    cd ..;
14060                    shift;
14061                fi;
14062            fi
14063            ;;
14064        esac;
14065     done'
14066 tdir=`pwd`
14067 cd $rsrc/ext
14068 set X
14069 shift
14070 eval $find_extensions
14071 set X $nonxs_extensions
14072 shift
14073 nonxs_extensions="$*"
14074 set X $known_extensions
14075 shift
14076 known_extensions="$*"
14077 cd $tdir
14078
14079 : Now see which are supported on this system.
14080 avail_ext=''
14081 for xxx in $known_extensions ; do
14082         case "$xxx" in
14083         DB_File|db_file)
14084                 case "$i_db" in
14085                 $define) avail_ext="$avail_ext $xxx" ;;
14086                 esac
14087                 ;;
14088         GDBM_File|gdbm_fil)
14089                 case "$i_gdbm" in 
14090                 $define) avail_ext="$avail_ext $xxx" ;;
14091                 esac
14092                 ;;
14093         NDBM_File|ndbm_fil)
14094                 case "$i_ndbm" in
14095                 $define) avail_ext="$avail_ext $xxx" ;;
14096                 esac
14097                 ;;
14098         ODBM_File|odbm_fil) 
14099                 case "${i_dbm}${i_rpcsvcdbm}" in
14100                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14101                 esac
14102                 ;;
14103         POSIX|posix)
14104                 case "$useposix" in
14105                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14106                 esac
14107                 ;;
14108         Opcode|opcode)
14109                 case "$useopcode" in
14110                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14111                 esac
14112                 ;;
14113         Socket|socket)
14114                 case "$d_socket" in 
14115                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14116                 esac
14117                 ;;
14118         Thread|thread)
14119                 case "$usethreads" in 
14120                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14121                 esac
14122                 ;;
14123         IPC/SysV|ipc/sysv)
14124                 : XXX Do we need a useipcsysv variable here
14125                 case "${d_msg}${d_sem}${d_shm}" in 
14126                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14127                 esac
14128                 ;;
14129         *)      avail_ext="$avail_ext $xxx"
14130                 ;;
14131         esac
14132 done
14133
14134 set X $avail_ext
14135 shift
14136 avail_ext="$*"
14137
14138 : Now see which nonxs extensions are supported on this system.
14139 : For now assume all are.
14140 nonxs_ext=''
14141 for xxx in $nonxs_extensions ; do
14142         case "$xxx" in
14143         *)      nonxs_ext="$nonxs_ext $xxx"
14144                 ;;
14145         esac
14146 done
14147
14148 set X $nonxs_ext
14149 shift
14150 nonxs_ext="$*"
14151
14152 case $usedl in
14153 $define)
14154         $cat <<EOM
14155 A number of extensions are supplied with $package.  You may choose to
14156 compile these extensions for dynamic loading (the default), compile
14157 them into the $package executable (static loading), or not include
14158 them at all.  Answer "none" to include no extensions.
14159 Note that DynaLoader is always built and need not be mentioned here.
14160
14161 EOM
14162         case "$dynamic_ext" in
14163         '') dflt="$avail_ext" ;;
14164         *)      dflt="$dynamic_ext"
14165                 # Perhaps we are reusing an old out-of-date config.sh.
14166                 case "$hint" in
14167                 previous)
14168                         if test X"$dynamic_ext" != X"$avail_ext"; then
14169                                 $cat <<EOM
14170 NOTICE:  Your previous config.sh list may be incorrect. 
14171 The extensions now available to you are 
14172         ${avail_ext}
14173 but the default list from your previous config.sh is
14174         ${dynamic_ext} 
14175
14176 EOM
14177                         fi
14178                         ;;
14179                 esac
14180                 ;;
14181         esac
14182         case "$dflt" in
14183         '')     dflt=none;;
14184         esac
14185         rp="What extensions do you wish to load dynamically?"
14186         . ./myread
14187         case "$ans" in
14188         none) dynamic_ext=' ' ;;
14189         *) dynamic_ext="$ans" ;;
14190         esac
14191
14192         case "$static_ext" in
14193         '')
14194                 : Exclude those already listed in dynamic linking
14195                 dflt=''
14196                 for xxx in $avail_ext; do
14197                         case " $dynamic_ext " in
14198                         *" $xxx "*) ;;
14199                         *) dflt="$dflt $xxx" ;;
14200                         esac
14201                 done
14202                 set X $dflt
14203                 shift
14204                 dflt="$*"
14205                 ;;
14206         *)  dflt="$static_ext" 
14207                 ;;
14208         esac
14209
14210         case "$dflt" in
14211         '')     dflt=none;;
14212         esac
14213         rp="What extensions do you wish to load statically?"
14214         . ./myread
14215         case "$ans" in
14216         none) static_ext=' ' ;;
14217         *) static_ext="$ans" ;;
14218         esac
14219         ;;
14220 *)
14221         $cat <<EOM
14222 A number of extensions are supplied with $package.  Answer "none" 
14223 to include no extensions. 
14224 Note that DynaLoader is always built and need not be mentioned here.
14225
14226 EOM
14227         case "$static_ext" in
14228         '') dflt="$avail_ext" ;;
14229         *)      dflt="$static_ext"
14230                 # Perhaps we are reusing an old out-of-date config.sh.
14231                 case "$hint" in
14232                 previous)
14233                         if test X"$static_ext" != X"$avail_ext"; then
14234                                 $cat <<EOM
14235 NOTICE:  Your previous config.sh list may be incorrect. 
14236 The extensions now available to you are 
14237         ${avail_ext}
14238 but the default list from your previous config.sh is
14239         ${static_ext} 
14240
14241 EOM
14242                         fi
14243                         ;;
14244                 esac
14245                 ;;
14246         esac
14247         : Exclude those that are not xs extensions
14248         case "$dflt" in
14249         '')     dflt=none;;
14250         esac
14251         rp="What extensions do you wish to include?"
14252         . ./myread
14253         case "$ans" in
14254         none) static_ext=' ' ;;
14255         *) static_ext="$ans" ;;
14256         esac
14257         ;;
14258 esac
14259
14260 set X $dynamic_ext $static_ext $nonxs_ext
14261 shift
14262 extensions="$*"
14263
14264 : Remove build directory name from cppstdin so it can be used from
14265 : either the present location or the final installed location.
14266 echo " "
14267 : Get out of the UU directory to get correct path name.
14268 cd ..
14269 case "$cppstdin" in
14270 `pwd`/cppstdin)
14271         echo "Stripping down cppstdin path name"
14272         cppstdin=cppstdin
14273         ;;
14274 esac
14275 cd UU
14276
14277 : end of configuration questions
14278 echo " "
14279 echo "End of configuration questions."
14280 echo " "
14281
14282 : back to where it started
14283 if test -d ../UU; then
14284         cd ..
14285 fi
14286
14287 : configuration may be patched via a 'config.over' file
14288 if $test -f config.over; then
14289         echo " "
14290         dflt=y
14291         rp='I see a config.over file.  Do you wish to load it?'
14292         . UU/myread
14293         case "$ans" in
14294         n*) echo "OK, I'll ignore it.";;
14295         *)      . ./config.over
14296                 echo "Configuration override changes have been loaded."
14297                 ;;
14298         esac
14299 fi
14300
14301 : in case they want portability, strip down executable paths
14302 case "$d_portable" in
14303 "$define")
14304         echo " "
14305         echo "Stripping down executable paths..." >&4
14306         for file in $loclist $trylist; do
14307                 eval temp=\$$file
14308                 eval $file=`basename $temp`
14309         done
14310         ;;
14311 esac
14312
14313 : create config.sh file
14314 echo " "
14315 echo "Creating config.sh..." >&4
14316 $spitshell <<EOT >config.sh
14317 $startsh
14318 #
14319 # This file was produced by running the Configure script. It holds all the
14320 # definitions figured out by Configure. Should you modify one of these values,
14321 # do not forget to propagate your changes by running "Configure -der". You may
14322 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14323 #
14324
14325 # Package name      : $package
14326 # Source directory  : $src
14327 # Configuration time: $cf_time
14328 # Configured by     : $cf_by
14329 # Target system     : $myuname
14330
14331 Author='$Author'
14332 Date='$Date'
14333 Header='$Header'
14334 Id='$Id'
14335 Locker='$Locker'
14336 Log='$Log'
14337 Mcc='$Mcc'
14338 RCSfile='$RCSfile'
14339 Revision='$Revision'
14340 Source='$Source'
14341 State='$State'
14342 _a='$_a'
14343 _exe='$_exe'
14344 _o='$_o'
14345 afs='$afs'
14346 alignbytes='$alignbytes'
14347 ansi2knr='$ansi2knr'
14348 aphostname='$aphostname'
14349 api_revision='$api_revision'
14350 api_subversion='$api_subversion'
14351 api_version='$api_version'
14352 api_versionstring='$api_versionstring'
14353 ar='$ar'
14354 archlib='$archlib'
14355 archlibexp='$archlibexp'
14356 archname64='$archname64'
14357 archname='$archname'
14358 archobjs='$archobjs'
14359 awk='$awk'
14360 baserev='$baserev'
14361 bash='$bash'
14362 bin='$bin'
14363 bincompat5005='$bincompat5005'
14364 binexp='$binexp'
14365 bison='$bison'
14366 byacc='$byacc'
14367 byteorder='$byteorder'
14368 c='$c'
14369 castflags='$castflags'
14370 cat='$cat'
14371 cc='$cc'
14372 cccdlflags='$cccdlflags'
14373 ccdlflags='$ccdlflags'
14374 ccflags='$ccflags'
14375 ccsymbols='$ccsymbols'
14376 cf_by='$cf_by'
14377 cf_email='$cf_email'
14378 cf_time='$cf_time'
14379 charsize='$charsize'
14380 chgrp='$chgrp'
14381 chmod='$chmod'
14382 chown='$chown'
14383 clocktype='$clocktype'
14384 comm='$comm'
14385 compress='$compress'
14386 contains='$contains'
14387 cp='$cp'
14388 cpio='$cpio'
14389 cpp='$cpp'
14390 cpp_stuff='$cpp_stuff'
14391 cppccsymbols='$cppccsymbols'
14392 cppflags='$cppflags'
14393 cpplast='$cpplast'
14394 cppminus='$cppminus'
14395 cpprun='$cpprun'
14396 cppstdin='$cppstdin'
14397 cppsymbols='$cppsymbols'
14398 crosscompile='$crosscompile'
14399 cryptlib='$cryptlib'
14400 csh='$csh'
14401 d_Gconvert='$d_Gconvert'
14402 d_PRIEldbl='$d_PRIEldbl'
14403 d_PRIFldbl='$d_PRIFldbl'
14404 d_PRIGldbl='$d_PRIGldbl'
14405 d_PRIX64='$d_PRIX64'
14406 d_PRId64='$d_PRId64'
14407 d_PRIeldbl='$d_PRIeldbl'
14408 d_PRIfldbl='$d_PRIfldbl'
14409 d_PRIgldbl='$d_PRIgldbl'
14410 d_PRIi64='$d_PRIi64'
14411 d_PRIo64='$d_PRIo64'
14412 d_PRIu64='$d_PRIu64'
14413 d_PRIx64='$d_PRIx64'
14414 d_access='$d_access'
14415 d_accessx='$d_accessx'
14416 d_alarm='$d_alarm'
14417 d_archlib='$d_archlib'
14418 d_atolf='$d_atolf'
14419 d_atoll='$d_atoll'
14420 d_attribut='$d_attribut'
14421 d_bcmp='$d_bcmp'
14422 d_bcopy='$d_bcopy'
14423 d_bincompat5005='$d_bincompat5005'
14424 d_bsd='$d_bsd'
14425 d_bsdgetpgrp='$d_bsdgetpgrp'
14426 d_bsdsetpgrp='$d_bsdsetpgrp'
14427 d_bzero='$d_bzero'
14428 d_casti32='$d_casti32'
14429 d_castneg='$d_castneg'
14430 d_charvspr='$d_charvspr'
14431 d_chown='$d_chown'
14432 d_chroot='$d_chroot'
14433 d_chsize='$d_chsize'
14434 d_closedir='$d_closedir'
14435 d_const='$d_const'
14436 d_crypt='$d_crypt'
14437 d_csh='$d_csh'
14438 d_cuserid='$d_cuserid'
14439 d_dbl_dig='$d_dbl_dig'
14440 d_difftime='$d_difftime'
14441 d_dirnamlen='$d_dirnamlen'
14442 d_dlerror='$d_dlerror'
14443 d_dlopen='$d_dlopen'
14444 d_dlsymun='$d_dlsymun'
14445 d_dosuid='$d_dosuid'
14446 d_drand48proto='$d_drand48proto'
14447 d_dup2='$d_dup2'
14448 d_eaccess='$d_eaccess'
14449 d_endgrent='$d_endgrent'
14450 d_endhent='$d_endhent'
14451 d_endnent='$d_endnent'
14452 d_endpent='$d_endpent'
14453 d_endpwent='$d_endpwent'
14454 d_endsent='$d_endsent'
14455 d_endspent='$d_endspent'
14456 d_eofnblk='$d_eofnblk'
14457 d_eunice='$d_eunice'
14458 d_fchmod='$d_fchmod'
14459 d_fchown='$d_fchown'
14460 d_fcntl='$d_fcntl'
14461 d_fd_macros='$d_fd_macros'
14462 d_fd_set='$d_fd_set'
14463 d_fds_bits='$d_fds_bits'
14464 d_fgetpos='$d_fgetpos'
14465 d_flexfnam='$d_flexfnam'
14466 d_flock='$d_flock'
14467 d_fork='$d_fork'
14468 d_fpathconf='$d_fpathconf'
14469 d_fpos64_t='$d_fpos64_t'
14470 d_fs_data_s='$d_fs_data_s'
14471 d_fseeko='$d_fseeko'
14472 d_fsetpos='$d_fsetpos'
14473 d_fstatfs='$d_fstatfs'
14474 d_fstatvfs='$d_fstatvfs'
14475 d_ftello='$d_ftello'
14476 d_ftime='$d_ftime'
14477 d_getgrent='$d_getgrent'
14478 d_getgrps='$d_getgrps'
14479 d_gethbyaddr='$d_gethbyaddr'
14480 d_gethbyname='$d_gethbyname'
14481 d_gethent='$d_gethent'
14482 d_gethname='$d_gethname'
14483 d_gethostprotos='$d_gethostprotos'
14484 d_getlogin='$d_getlogin'
14485 d_getmnt='$d_getmnt'
14486 d_getmntent='$d_getmntent'
14487 d_getnbyaddr='$d_getnbyaddr'
14488 d_getnbyname='$d_getnbyname'
14489 d_getnent='$d_getnent'
14490 d_getnetprotos='$d_getnetprotos'
14491 d_getpbyname='$d_getpbyname'
14492 d_getpbynumber='$d_getpbynumber'
14493 d_getpent='$d_getpent'
14494 d_getpgid='$d_getpgid'
14495 d_getpgrp2='$d_getpgrp2'
14496 d_getpgrp='$d_getpgrp'
14497 d_getppid='$d_getppid'
14498 d_getprior='$d_getprior'
14499 d_getprotoprotos='$d_getprotoprotos'
14500 d_getpwent='$d_getpwent'
14501 d_getsbyname='$d_getsbyname'
14502 d_getsbyport='$d_getsbyport'
14503 d_getsent='$d_getsent'
14504 d_getservprotos='$d_getservprotos'
14505 d_getspent='$d_getspent'
14506 d_getspnam='$d_getspnam'
14507 d_gettimeod='$d_gettimeod'
14508 d_gnulibc='$d_gnulibc'
14509 d_grpasswd='$d_grpasswd'
14510 d_hasmntopt='$d_hasmntopt'
14511 d_htonl='$d_htonl'
14512 d_index='$d_index'
14513 d_inetaton='$d_inetaton'
14514 d_int64t='$d_int64t'
14515 d_isascii='$d_isascii'
14516 d_killpg='$d_killpg'
14517 d_lchown='$d_lchown'
14518 d_ldbl_dig='$d_ldbl_dig'
14519 d_link='$d_link'
14520 d_locconv='$d_locconv'
14521 d_lockf='$d_lockf'
14522 d_longdbl='$d_longdbl'
14523 d_longlong='$d_longlong'
14524 d_lstat='$d_lstat'
14525 d_mblen='$d_mblen'
14526 d_mbstowcs='$d_mbstowcs'
14527 d_mbtowc='$d_mbtowc'
14528 d_memchr='$d_memchr'
14529 d_memcmp='$d_memcmp'
14530 d_memcpy='$d_memcpy'
14531 d_memmove='$d_memmove'
14532 d_memset='$d_memset'
14533 d_mkdir='$d_mkdir'
14534 d_mkfifo='$d_mkfifo'
14535 d_mktime='$d_mktime'
14536 d_msg='$d_msg'
14537 d_msg_ctrunc='$d_msg_ctrunc'
14538 d_msg_dontroute='$d_msg_dontroute'
14539 d_msg_oob='$d_msg_oob'
14540 d_msg_peek='$d_msg_peek'
14541 d_msg_proxy='$d_msg_proxy'
14542 d_msgctl='$d_msgctl'
14543 d_msgget='$d_msgget'
14544 d_msgrcv='$d_msgrcv'
14545 d_msgsnd='$d_msgsnd'
14546 d_mymalloc='$d_mymalloc'
14547 d_nice='$d_nice'
14548 d_off64_t='$d_off64_t'
14549 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14550 d_oldpthreads='$d_oldpthreads'
14551 d_oldsock='$d_oldsock'
14552 d_open3='$d_open3'
14553 d_pathconf='$d_pathconf'
14554 d_pause='$d_pause'
14555 d_phostname='$d_phostname'
14556 d_pipe='$d_pipe'
14557 d_poll='$d_poll'
14558 d_portable='$d_portable'
14559 d_pthread_yield='$d_pthread_yield'
14560 d_pwage='$d_pwage'
14561 d_pwchange='$d_pwchange'
14562 d_pwclass='$d_pwclass'
14563 d_pwcomment='$d_pwcomment'
14564 d_pwexpire='$d_pwexpire'
14565 d_pwgecos='$d_pwgecos'
14566 d_pwpasswd='$d_pwpasswd'
14567 d_pwquota='$d_pwquota'
14568 d_quad='$d_quad'
14569 d_readdir='$d_readdir'
14570 d_readlink='$d_readlink'
14571 d_rename='$d_rename'
14572 d_rewinddir='$d_rewinddir'
14573 d_rmdir='$d_rmdir'
14574 d_safebcpy='$d_safebcpy'
14575 d_safemcpy='$d_safemcpy'
14576 d_sanemcmp='$d_sanemcmp'
14577 d_sched_yield='$d_sched_yield'
14578 d_scm_rights='$d_scm_rights'
14579 d_seekdir='$d_seekdir'
14580 d_select='$d_select'
14581 d_sem='$d_sem'
14582 d_semctl='$d_semctl'
14583 d_semctl_semid_ds='$d_semctl_semid_ds'
14584 d_semctl_semun='$d_semctl_semun'
14585 d_semget='$d_semget'
14586 d_semop='$d_semop'
14587 d_setegid='$d_setegid'
14588 d_seteuid='$d_seteuid'
14589 d_setgrent='$d_setgrent'
14590 d_setgrps='$d_setgrps'
14591 d_sethent='$d_sethent'
14592 d_setlinebuf='$d_setlinebuf'
14593 d_setlocale='$d_setlocale'
14594 d_setnent='$d_setnent'
14595 d_setpent='$d_setpent'
14596 d_setpgid='$d_setpgid'
14597 d_setpgrp2='$d_setpgrp2'
14598 d_setpgrp='$d_setpgrp'
14599 d_setprior='$d_setprior'
14600 d_setpwent='$d_setpwent'
14601 d_setregid='$d_setregid'
14602 d_setresgid='$d_setresgid'
14603 d_setresuid='$d_setresuid'
14604 d_setreuid='$d_setreuid'
14605 d_setrgid='$d_setrgid'
14606 d_setruid='$d_setruid'
14607 d_setsent='$d_setsent'
14608 d_setsid='$d_setsid'
14609 d_setspent='$d_setspent'
14610 d_setvbuf='$d_setvbuf'
14611 d_sfio='$d_sfio'
14612 d_shm='$d_shm'
14613 d_shmat='$d_shmat'
14614 d_shmatprototype='$d_shmatprototype'
14615 d_shmctl='$d_shmctl'
14616 d_shmdt='$d_shmdt'
14617 d_shmget='$d_shmget'
14618 d_sigaction='$d_sigaction'
14619 d_sigsetjmp='$d_sigsetjmp'
14620 d_socket='$d_socket'
14621 d_sockpair='$d_sockpair'
14622 d_sqrtl='$d_sqrtl'
14623 d_statblks='$d_statblks'
14624 d_statfs_f_flags='$d_statfs_f_flags'
14625 d_statfs_s='$d_statfs_s'
14626 d_statvfs='$d_statvfs'
14627 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14628 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14629 d_stdio_stream_array='$d_stdio_stream_array'
14630 d_stdiobase='$d_stdiobase'
14631 d_stdstdio='$d_stdstdio'
14632 d_strchr='$d_strchr'
14633 d_strcoll='$d_strcoll'
14634 d_strctcpy='$d_strctcpy'
14635 d_strerrm='$d_strerrm'
14636 d_strerror='$d_strerror'
14637 d_strtod='$d_strtod'
14638 d_strtol='$d_strtol'
14639 d_strtold='$d_strtold'
14640 d_strtoul='$d_strtoul'
14641 d_strtoull='$d_strtoull'
14642 d_strtouq='$d_strtouq'
14643 d_strxfrm='$d_strxfrm'
14644 d_suidsafe='$d_suidsafe'
14645 d_symlink='$d_symlink'
14646 d_syscall='$d_syscall'
14647 d_sysconf='$d_sysconf'
14648 d_sysernlst='$d_sysernlst'
14649 d_syserrlst='$d_syserrlst'
14650 d_system='$d_system'
14651 d_tcgetpgrp='$d_tcgetpgrp'
14652 d_tcsetpgrp='$d_tcsetpgrp'
14653 d_telldir='$d_telldir'
14654 d_telldirproto='$d_telldirproto'
14655 d_time='$d_time'
14656 d_times='$d_times'
14657 d_truncate='$d_truncate'
14658 d_tzname='$d_tzname'
14659 d_umask='$d_umask'
14660 d_uname='$d_uname'
14661 d_union_semun='$d_union_semun'
14662 d_ustat='$d_ustat'
14663 d_vendorbin='$d_vendorbin'
14664 d_vendorlib='$d_vendorlib'
14665 d_vfork='$d_vfork'
14666 d_void_closedir='$d_void_closedir'
14667 d_voidsig='$d_voidsig'
14668 d_voidtty='$d_voidtty'
14669 d_volatile='$d_volatile'
14670 d_vprintf='$d_vprintf'
14671 d_wait4='$d_wait4'
14672 d_waitpid='$d_waitpid'
14673 d_wcstombs='$d_wcstombs'
14674 d_wctomb='$d_wctomb'
14675 d_xenix='$d_xenix'
14676 date='$date'
14677 db_hashtype='$db_hashtype'
14678 db_prefixtype='$db_prefixtype'
14679 defvoidused='$defvoidused'
14680 direntrytype='$direntrytype'
14681 dlext='$dlext'
14682 dlsrc='$dlsrc'
14683 doublesize='$doublesize'
14684 drand01='$drand01'
14685 dynamic_ext='$dynamic_ext'
14686 eagain='$eagain'
14687 ebcdic='$ebcdic'
14688 echo='$echo'
14689 egrep='$egrep'
14690 emacs='$emacs'
14691 eunicefix='$eunicefix'
14692 exe_ext='$exe_ext'
14693 expr='$expr'
14694 extensions='$extensions'
14695 fflushNULL='$fflushNULL'
14696 fflushall='$fflushall'
14697 find='$find'
14698 firstmakefile='$firstmakefile'
14699 flex='$flex'
14700 fpossize='$fpossize'
14701 fpostype='$fpostype'
14702 freetype='$freetype'
14703 full_ar='$full_ar'
14704 full_csh='$full_csh'
14705 full_sed='$full_sed'
14706 gccversion='$gccversion'
14707 gidformat='$gidformat'
14708 gidsign='$gidsign'
14709 gidsize='$gidsize'
14710 gidtype='$gidtype'
14711 glibpth='$glibpth'
14712 grep='$grep'
14713 groupcat='$groupcat'
14714 groupstype='$groupstype'
14715 gzip='$gzip'
14716 h_fcntl='$h_fcntl'
14717 h_sysfile='$h_sysfile'
14718 hint='$hint'
14719 hostcat='$hostcat'
14720 huge='$huge'
14721 i16size='$i16size'
14722 i16type='$i16type'
14723 i32size='$i32size'
14724 i32type='$i32type'
14725 i64size='$i64size'
14726 i64type='$i64type'
14727 i8size='$i8size'
14728 i8type='$i8type'
14729 i_arpainet='$i_arpainet'
14730 i_bsdioctl='$i_bsdioctl'
14731 i_db='$i_db'
14732 i_dbm='$i_dbm'
14733 i_dirent='$i_dirent'
14734 i_dld='$i_dld'
14735 i_dlfcn='$i_dlfcn'
14736 i_fcntl='$i_fcntl'
14737 i_float='$i_float'
14738 i_gdbm='$i_gdbm'
14739 i_grp='$i_grp'
14740 i_inttypes='$i_inttypes'
14741 i_limits='$i_limits'
14742 i_locale='$i_locale'
14743 i_machcthr='$i_machcthr'
14744 i_malloc='$i_malloc'
14745 i_math='$i_math'
14746 i_memory='$i_memory'
14747 i_mntent='$i_mntent'
14748 i_ndbm='$i_ndbm'
14749 i_netdb='$i_netdb'
14750 i_neterrno='$i_neterrno'
14751 i_netinettcp='$i_netinettcp'
14752 i_niin='$i_niin'
14753 i_poll='$i_poll'
14754 i_pthread='$i_pthread'
14755 i_pwd='$i_pwd'
14756 i_rpcsvcdbm='$i_rpcsvcdbm'
14757 i_sfio='$i_sfio'
14758 i_sgtty='$i_sgtty'
14759 i_shadow='$i_shadow'
14760 i_socks='$i_socks'
14761 i_stdarg='$i_stdarg'
14762 i_stddef='$i_stddef'
14763 i_stdlib='$i_stdlib'
14764 i_string='$i_string'
14765 i_sysaccess='$i_sysaccess'
14766 i_sysdir='$i_sysdir'
14767 i_sysfile='$i_sysfile'
14768 i_sysfilio='$i_sysfilio'
14769 i_sysin='$i_sysin'
14770 i_sysioctl='$i_sysioctl'
14771 i_sysmount='$i_sysmount'
14772 i_sysndir='$i_sysndir'
14773 i_sysparam='$i_sysparam'
14774 i_sysresrc='$i_sysresrc'
14775 i_syssecrt='$i_syssecrt'
14776 i_sysselct='$i_sysselct'
14777 i_syssockio='$i_syssockio'
14778 i_sysstat='$i_sysstat'
14779 i_sysstatfs='$i_sysstatfs'
14780 i_sysstatvfs='$i_sysstatvfs'
14781 i_systime='$i_systime'
14782 i_systimek='$i_systimek'
14783 i_systimes='$i_systimes'
14784 i_systypes='$i_systypes'
14785 i_sysuio='$i_sysuio'
14786 i_sysun='$i_sysun'
14787 i_sysvfs='$i_sysvfs'
14788 i_syswait='$i_syswait'
14789 i_termio='$i_termio'
14790 i_termios='$i_termios'
14791 i_time='$i_time'
14792 i_unistd='$i_unistd'
14793 i_ustat='$i_ustat'
14794 i_utime='$i_utime'
14795 i_values='$i_values'
14796 i_varargs='$i_varargs'
14797 i_varhdr='$i_varhdr'
14798 i_vfork='$i_vfork'
14799 ignore_versioned_solibs='$ignore_versioned_solibs'
14800 inc_version_list='$inc_version_list'
14801 incpath='$incpath'
14802 inews='$inews'
14803 installarchlib='$installarchlib'
14804 installbin='$installbin'
14805 installman1dir='$installman1dir'
14806 installman3dir='$installman3dir'
14807 installprefix='$installprefix'
14808 installprefixexp='$installprefixexp'
14809 installprivlib='$installprivlib'
14810 installscript='$installscript'
14811 installsitearch='$installsitearch'
14812 installsitebin='$installsitebin'
14813 installsitelib='$installsitelib'
14814 installstyle='$installstyle'
14815 installusrbinperl='$installusrbinperl'
14816 installvendorbin='$installvendorbin'
14817 installvendorlib='$installvendorlib'
14818 intsize='$intsize'
14819 ivdformat='$ivdformat'
14820 ivsize='$ivsize'
14821 ivtype='$ivtype'
14822 known_extensions='$known_extensions'
14823 ksh='$ksh'
14824 large='$large'
14825 ld='$ld'
14826 lddlflags='$lddlflags'
14827 ldflags='$ldflags'
14828 ldlibpthname='$ldlibpthname'
14829 less='$less'
14830 lib_ext='$lib_ext'
14831 libc='$libc'
14832 libperl='$libperl'
14833 libpth='$libpth'
14834 libs='$libs'
14835 libswanted='$libswanted'
14836 line='$line'
14837 lint='$lint'
14838 lkflags='$lkflags'
14839 ln='$ln'
14840 lns='$lns'
14841 locincpth='$locincpth'
14842 loclibpth='$loclibpth'
14843 longdblsize='$longdblsize'
14844 longlongsize='$longlongsize'
14845 longsize='$longsize'
14846 lp='$lp'
14847 lpr='$lpr'
14848 ls='$ls'
14849 lseeksize='$lseeksize'
14850 lseektype='$lseektype'
14851 mail='$mail'
14852 mailx='$mailx'
14853 make='$make'
14854 make_set_make='$make_set_make'
14855 mallocobj='$mallocobj'
14856 mallocsrc='$mallocsrc'
14857 malloctype='$malloctype'
14858 man1dir='$man1dir'
14859 man1direxp='$man1direxp'
14860 man1ext='$man1ext'
14861 man3dir='$man3dir'
14862 man3direxp='$man3direxp'
14863 man3ext='$man3ext'
14864 medium='$medium'
14865 mips_type='$mips_type'
14866 mkdir='$mkdir'
14867 models='$models'
14868 modetype='$modetype'
14869 more='$more'
14870 multiarch='$multiarch'
14871 mv='$mv'
14872 myarchname='$myarchname'
14873 mydomain='$mydomain'
14874 myhostname='$myhostname'
14875 myuname='$myuname'
14876 n='$n'
14877 netdb_hlen_type='$netdb_hlen_type'
14878 netdb_host_type='$netdb_host_type'
14879 netdb_name_type='$netdb_name_type'
14880 netdb_net_type='$netdb_net_type'
14881 nm='$nm'
14882 nm_opt='$nm_opt'
14883 nm_so_opt='$nm_so_opt'
14884 nonxs_ext='$nonxs_ext'
14885 nroff='$nroff'
14886 nvsize='$nvsize'
14887 nvtype='$nvtype'
14888 o_nonblock='$o_nonblock'
14889 obj_ext='$obj_ext'
14890 old_pthread_create_joinable='$old_pthread_create_joinable'
14891 optimize='$optimize'
14892 orderlib='$orderlib'
14893 osname='$osname'
14894 osvers='$osvers'
14895 package='$package'
14896 pager='$pager'
14897 passcat='$passcat'
14898 patchlevel='$patchlevel'
14899 path_sep='$path_sep'
14900 perl='$perl'
14901 perladmin='$perladmin'
14902 perlpath='$perlpath'
14903 pg='$pg'
14904 phostname='$phostname'
14905 pidtype='$pidtype'
14906 plibpth='$plibpth'
14907 pmake='$pmake'
14908 pr='$pr'
14909 prefix='$prefix'
14910 prefixexp='$prefixexp'
14911 privlib='$privlib'
14912 privlibexp='$privlibexp'
14913 prototype='$prototype'
14914 ptrsize='$ptrsize'
14915 quadkind='$quadkind'
14916 quadtype='$quadtype'
14917 randbits='$randbits'
14918 randfunc='$randfunc'
14919 randseedtype='$randseedtype'
14920 ranlib='$ranlib'
14921 rd_nodata='$rd_nodata'
14922 rm='$rm'
14923 rmail='$rmail'
14924 runnm='$runnm'
14925 sPRIEldbl='$sPRIEldbl'
14926 sPRIFldbl='$sPRIFldbl'
14927 sPRIGldbl='$sPRIGldbl'
14928 sPRIX64='$sPRIX64'
14929 sPRId64='$sPRId64'
14930 sPRIeldbl='$sPRIeldbl'
14931 sPRIfldbl='$sPRIfldbl'
14932 sPRIgldbl='$sPRIgldbl'
14933 sPRIi64='$sPRIi64'
14934 sPRIo64='$sPRIo64'
14935 sPRIu64='$sPRIu64'
14936 sPRIx64='$sPRIx64'
14937 sched_yield='$sched_yield'
14938 scriptdir='$scriptdir'
14939 scriptdirexp='$scriptdirexp'
14940 sed='$sed'
14941 seedfunc='$seedfunc'
14942 selectminbits='$selectminbits'
14943 selecttype='$selecttype'
14944 sendmail='$sendmail'
14945 sh='$sh'
14946 shar='$shar'
14947 sharpbang='$sharpbang'
14948 shmattype='$shmattype'
14949 shortsize='$shortsize'
14950 shrpenv='$shrpenv'
14951 shsharp='$shsharp'
14952 sig_count='$sig_count'
14953 sig_name='$sig_name'
14954 sig_name_init='$sig_name_init'
14955 sig_num='$sig_num'
14956 sig_num_init='$sig_num_init'
14957 signal_t='$signal_t'
14958 sitearch='$sitearch'
14959 sitearchexp='$sitearchexp'
14960 sitebin='$sitebin'
14961 sitebinexp='$sitebinexp'
14962 sitelib='$sitelib'
14963 sitelibexp='$sitelibexp'
14964 siteprefix='$siteprefix'
14965 siteprefixexp='$siteprefixexp'
14966 sizetype='$sizetype'
14967 sleep='$sleep'
14968 smail='$smail'
14969 small='$small'
14970 so='$so'
14971 sockethdr='$sockethdr'
14972 socketlib='$socketlib'
14973 sort='$sort'
14974 spackage='$spackage'
14975 spitshell='$spitshell'
14976 split='$split'
14977 src='$src'
14978 ssizetype='$ssizetype'
14979 startperl='$startperl'
14980 startsh='$startsh'
14981 static_ext='$static_ext'
14982 stdchar='$stdchar'
14983 stdio_base='$stdio_base'
14984 stdio_bufsiz='$stdio_bufsiz'
14985 stdio_cnt='$stdio_cnt'
14986 stdio_filbuf='$stdio_filbuf'
14987 stdio_ptr='$stdio_ptr'
14988 stdio_stream_array='$stdio_stream_array'
14989 strings='$strings'
14990 submit='$submit'
14991 subversion='$subversion'
14992 sysman='$sysman'
14993 tail='$tail'
14994 tar='$tar'
14995 tbl='$tbl'
14996 tee='$tee'
14997 test='$test'
14998 timeincl='$timeincl'
14999 timetype='$timetype'
15000 touch='$touch'
15001 tr='$tr'
15002 trnl='$trnl'
15003 troff='$troff'
15004 u16size='$u16size'
15005 u16type='$u16type'
15006 u32size='$u32size'
15007 u32type='$u32type'
15008 u64size='$u64size'
15009 u64type='$u64type'
15010 u8size='$u8size'
15011 u8type='$u8type'
15012 uidformat='$uidformat'
15013 uidsign='$uidsign'
15014 uidsize='$uidsize'
15015 uidtype='$uidtype'
15016 uname='$uname'
15017 uniq='$uniq'
15018 uquadtype='$uquadtype'
15019 use5005threads='$use5005threads'
15020 use64bits='$use64bits'
15021 usedl='$usedl'
15022 useithreads='$useithreads'
15023 uselargefiles='$uselargefiles'
15024 uselongdouble='$uselongdouble'
15025 uselonglong='$uselonglong'
15026 usemorebits='$usemorebits'
15027 usemultiplicity='$usemultiplicity'
15028 usemymalloc='$usemymalloc'
15029 usenm='$usenm'
15030 useopcode='$useopcode'
15031 useperlio='$useperlio'
15032 useposix='$useposix'
15033 usesfio='$usesfio'
15034 useshrplib='$useshrplib'
15035 usesocks='$usesocks'
15036 usethreads='$usethreads'
15037 usevendorprefix='$usevendorprefix'
15038 usevfork='$usevfork'
15039 usrinc='$usrinc'
15040 uuname='$uuname'
15041 uvoformat='$uvoformat'
15042 uvsize='$uvsize'
15043 uvtype='$uvtype'
15044 uvuformat='$uvuformat'
15045 uvxformat='$uvxformat'
15046 vendorbin='$vendorbin'
15047 vendorbinexp='$vendorbinexp'
15048 vendorlib='$vendorlib'
15049 vendorlibexp='$vendorlibexp'
15050 vendorprefix='$vendorprefix'
15051 vendorprefixexp='$vendorprefixexp'
15052 version='$version'
15053 vi='$vi'
15054 voidflags='$voidflags'
15055 xlibpth='$xlibpth'
15056 zcat='$zcat'
15057 zip='$zip'
15058 EOT
15059
15060 : Add in command line options if available
15061 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15062
15063 : add special variables
15064 $test -f $src/patchlevel.h && \
15065 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15066 echo "CONFIGDOTSH=true" >>config.sh
15067
15068 : propagate old symbols
15069 if $test -f UU/config.sh; then
15070         <UU/config.sh sort | uniq >UU/oldconfig.sh
15071         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15072         sort | uniq -u >UU/oldsyms
15073         set X `cat UU/oldsyms`
15074         shift
15075         case $# in
15076         0) ;;
15077         *)
15078                 cat <<EOM
15079 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15080 EOM
15081                 echo "# Variables propagated from previous config.sh file." >>config.sh
15082                 for sym in `cat UU/oldsyms`; do
15083                         echo "    Propagating $hint variable "'$'"$sym..."
15084                         eval 'tmp="$'"${sym}"'"'
15085                         echo "$tmp" | \
15086                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15087                 done
15088                 ;;
15089         esac
15090 fi
15091
15092 : Finish up by extracting the .SH files
15093 case "$alldone" in
15094 exit)
15095         $rm -rf UU
15096         echo "Done."
15097         exit 0
15098         ;;
15099 cont)
15100         ;;
15101 '')
15102         dflt=''
15103         nostick=true
15104         $cat <<EOM
15105
15106 If you'd like to make any changes to the config.sh file before I begin
15107 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15108
15109 EOM
15110         rp="Press return or use a shell escape to edit config.sh:"
15111         . UU/myread
15112         nostick=''
15113         case "$ans" in
15114         '') ;;
15115         *) : in case they cannot read
15116                 sh 1>&4 -c "$ans";;
15117         esac
15118         ;;
15119 esac
15120
15121 : if this fails, just run all the .SH files by hand
15122 . ./config.sh
15123
15124 echo " "
15125 exec 1>&4
15126 . ./UU/extract
15127
15128 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15129         dflt=y
15130         case "$silent" in
15131         true) ;;
15132         *)
15133                 $cat <<EOM
15134
15135 Now you need to generate make dependencies by running "$make depend".
15136 You might prefer to run it in background: "$make depend > makedepend.out &"
15137 It can take a while, so you might not want to run it right now.
15138
15139 EOM
15140                 ;;
15141         esac
15142         rp="Run $make depend now?"
15143         . UU/myread
15144         case "$ans" in
15145         y*)
15146                 $make depend && echo "Now you must run a $make."
15147                 ;;
15148         *)
15149                 echo "You must run '$make depend' then '$make'."
15150                 ;;
15151         esac
15152 elif test -f [Mm]akefile; then
15153         echo " "
15154         echo "Now you must run a $make."
15155 else
15156         echo "Done."
15157 fi
15158
15159 if $test -f Policy.sh; then
15160     $cat <<EOM
15161
15162 If you compile $package on a different machine or from a different object
15163 directory, copy the Policy.sh file from this object directory to the
15164 new one before you run Configure -- this will help you with most of
15165 the policy defaults.
15166
15167 EOM
15168 fi
15169 if $test -f config.msg; then
15170     echo "Hmm.  I also noted the following information while running:"
15171     echo " "
15172     $cat config.msg >&4
15173     $rm -f config.msg
15174 fi
15175 $rm -f kit*isdone ark*isdone
15176 $rm -rf UU
15177
15178 : End of Configure
15179